From owner-freebsd-current@FreeBSD.ORG Fri Apr 24 11:34:43 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 52FECE71 for ; Fri, 24 Apr 2015 11:34:43 +0000 (UTC) Received: from mail-ig0-x231.google.com (mail-ig0-x231.google.com [IPv6:2607:f8b0:4001:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F2F21D6E for ; Fri, 24 Apr 2015 11:34:43 +0000 (UTC) Received: by iget9 with SMTP id t9so27206911ige.1 for ; Fri, 24 Apr 2015 04:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=7mJmMDzcRjZ52EWYkNCgWODNW1xGE4E/iYeKXtOVjCY=; b=T0RmNJfvEyaMQ5UcykypBhBCPU0pecolbc6IiDdCqw6cmzKw3dMY183UzpsqzIa/iT +Vzz96i5Qp9QXFVQEWKggrYIN4p4T332ZNiyoQfr0HKDW9dS7Q45sTWHF2+Pv7fPHUcj fRdsLPZjJmnc18e+LAnFFSd3Opyexzm7/LLoYlyPDutAt6AltDbTfVLE1B6MM6r9opWJ 1a3kVU6uPsoze/qQQD+mEO0tXwp3sTnJIs5o0ePyQgAH3XKJJIpESiMzpXT7Z9cyzp/w O7rRSKgCGjc0aljO8J97LKa8o5u4QvcUPTlpL5WS3oQWAAoRm3lTFJ8OQTZKj94vVncH ZNxA== MIME-Version: 1.0 X-Received: by 10.107.133.27 with SMTP id h27mr10279499iod.31.1429875282339; Fri, 24 Apr 2015 04:34:42 -0700 (PDT) Received: by 10.64.13.81 with HTTP; Fri, 24 Apr 2015 04:34:42 -0700 (PDT) Date: Fri, 24 Apr 2015 13:34:42 +0200 Message-ID: Subject: [patch] fix add_bounce_page() for BUS_DMA_KEEP_PG_OFFSET From: Svatopluk Kraus To: freebsd-current@freebsd.org Content-Type: multipart/mixed; boundary=001a113ec1f248a1f0051476c854 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2015 11:34:43 -0000 --001a113ec1f248a1f0051476c854 Content-Type: text/plain; charset=UTF-8 The add_bounce_page() can be called from _bus_dmamap_load_phys(). Client virtual address is zero (not valid) in that case. So, client physical address must be used to get an offset when BUS_DMA_KEEP_PG_OFFSET flag is set. Note that client physical address is always valid. Svatopluk Kraus --001a113ec1f248a1f0051476c854 Content-Type: text/plain; charset=US-ASCII; name="add_bounce_page.diff" Content-Disposition: attachment; filename="add_bounce_page.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_i8vijyvi0 ZGlmZiAtLWdpdCBhL3N5cy9hcm0vYXJtL2J1c2RtYV9tYWNoZGVwLXY2LmMgYi9zeXMvYXJtL2Fy bS9idXNkbWFfbWFjaGRlcC12Ni5jCmluZGV4IGVkNTAxYzUuLjcyMzZjNWEgMTAwNjQ0Ci0tLSBh L3N5cy9hcm0vYXJtL2J1c2RtYV9tYWNoZGVwLXY2LmMKKysrIGIvc3lzL2FybS9hcm0vYnVzZG1h X21hY2hkZXAtdjYuYwpAQCAtMTY4NSw4ICsxNjg1LDggQEAgYWRkX2JvdW5jZV9wYWdlKGJ1c19k bWFfdGFnX3QgZG1hdCwgYnVzX2RtYW1hcF90IG1hcCwgdm1fb2Zmc2V0X3QgdmFkZHIsCiAKIAlp ZiAoZG1hdC0+ZmxhZ3MgJiBCVVNfRE1BX0tFRVBfUEdfT0ZGU0VUKSB7CiAJCS8qIFBhZ2Ugb2Zm c2V0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