Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 2026 19:49:24 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Oliver Pinter <oliver.pntr@gmail.com>
Cc:        John Baldwin <jhb@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
Subject:   Re: git: fe9f0b18bf6a - main - busdma: Use char * instead of vm_offset_t for bounce page kernel pointers
Message-ID:  <9A89D171-0067-43C1-ABB3-E18A832FC6D5@freebsd.org>
In-Reply-To: <CAPjTQNGpnG25u00nxrXcpGzipLZ7SKXHPffYWiBt%2BV-TMZDYpA@mail.gmail.com>
References:  <69ea61e8.46e01.b303182@gitrepo.freebsd.org> <CAPjTQNGpnG25u00nxrXcpGzipLZ7SKXHPffYWiBt%2BV-TMZDYpA@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]


Jessica

> On 28 Apr 2026, at 19:43, Oliver Pinter <oliver.pntr@gmail.com> wrote:
> 
> 
> 
> On Thursday, April 23, 2026, John Baldwin <jhb@freebsd.org <mailto:jhb@freebsd.org>> wrote:
>> The branch main has been updated by jhb:
>> 
>> URL: https://cgit.FreeBSD.org/src/commit/?id=fe9f0b18bf6a1f881fbe57da716ea429acd539c1 <https://cgit.freebsd.org/src/commit/?id=fe9f0b18bf6a1f881fbe57da716ea429acd539c1>;
>> 
>> commit fe9f0b18bf6a1f881fbe57da716ea429acd539c1
>> Author:     John Baldwin <jhb@FreeBSD.org>
>> AuthorDate: 2026-04-23 17:05:53 +0000
>> Commit:     John Baldwin <jhb@FreeBSD.org>
>> CommitDate: 2026-04-23 17:05:53 +0000
>> 
>>     busdma: Use char * instead of vm_offset_t for bounce page kernel pointers
>> 
>>     Effort:         CHERI upstreaming
>>     Reviewed by:    kib
>>     Sponsored by:   AFRL, DARPA
>>     Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
>> ---
>>  sys/arm/arm/busdma_machdep.c         | 18 ++++++++----------
>>  sys/arm64/arm64/busdma_bounce.c      | 18 ++++++++----------
>>  sys/kern/subr_busdma_bounce.c        | 30 +++++++++++++++---------------
>>  sys/powerpc/powerpc/busdma_machdep.c | 20 +++++++++-----------
>>  sys/riscv/riscv/busdma_bounce.c      | 18 ++++++++----------
>>  sys/x86/x86/busdma_bounce.c          | 26 +++++++++++---------------
>>  6 files changed, 59 insertions(+), 71 deletions(-)
>> 
>> diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c
>> index 3c65cb8ebbf4..81b8b4a2883a 100644
>> --- a/sys/arm/arm/busdma_machdep.c
>> +++ b/sys/arm/arm/busdma_machdep.c
>> @@ -1002,7 +1002,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
>> 
>>                 if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr,
>>                     sgsize)) {
>> -                       curaddr = add_bounce_page(dmat, map, (vm_offset_t)kvaddr, curaddr,
>> +                       curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,
>>                             sgsize);
>>                 } else if ((dmat->flags & BUS_DMA_COHERENT) == 0) {
>>                         if (map->sync_count > 0) {
>> @@ -1199,18 +1199,17 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
>>                 if (op & BUS_DMASYNC_PREWRITE) {
>>                         while (bpage != NULL) {
>>                                 tempvaddr = NULL;
>> -                               datavaddr = (void *)bpage->datavaddr;
>> +                               datavaddr = bpage->datavaddr;
>>                                 if (datavaddr == NULL) {
>>                                         tempvaddr = pmap_quick_enter_page(
>>                                             bpage->datapage);
>>                                         datavaddr = tempvaddr + bpage->dataoffs;
>>                                 }
>> -                               bcopy(datavaddr, (void *)bpage->vaddr,
>> -                                   bpage->datacount);
>> +                               bcopy(datavaddr, bpage->vaddr, bpage->datacount);
>>                                 if (tempvaddr != NULL)
>>                                         pmap_quick_remove_page(tempvaddr);
>>                                 if ((dmat->flags & BUS_DMA_COHERENT) == 0)
>> -                                       dcache_wb_poc(bpage->vaddr,
>> +                                       dcache_wb_poc((vm_offset_t)bpage->vaddr,
>>                                             bpage->busaddr, bpage->datacount);
>>                                 bpage = STAILQ_NEXT(bpage, links);
>>                         }
>> @@ -1232,7 +1231,7 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
>>                         bpage = STAILQ_FIRST(&map->bpages);
>>                         while (bpage != NULL) {
>>                                 if ((dmat->flags & BUS_DMA_COHERENT) == 0)
>> -                                       dcache_inv_poc_dma(bpage->vaddr,
>> +                                       dcache_inv_poc_dma((vm_offset_t)bpage->vaddr,
>>                                             bpage->busaddr, bpage->datacount);
>>                                 bpage = STAILQ_NEXT(bpage, links);
>>                         }
>> @@ -1250,17 +1249,16 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
>>                 if (op & BUS_DMASYNC_POSTREAD) {
>>                         while (bpage != NULL) {
>>                                 if ((dmat->flags & BUS_DMA_COHERENT) == 0)
>> -                                       dcache_inv_poc(bpage->vaddr,
>> +                                       dcache_inv_poc((vm_offset_t)bpage->vaddr,
>>                                             bpage->busaddr, bpage->datacount);
>>                                 tempvaddr = NULL;
>> -                               datavaddr = (void *)bpage->datavaddr;
>> +                               datavaddr = bpage->datavaddr;
>>                                 if (datavaddr == NULL) {
>>                                         tempvaddr = pmap_quick_enter_page(
>>                                             bpage->datapage);
>>                                         datavaddr = tempvaddr + bpage->dataoffs;
>>                                 }
>> -                               bcopy((void *)bpage->vaddr, datavaddr,
>> -                                   bpage->datacount);
>> +                               bcopy(bpage->vaddr, datavaddr, bpage->datacount);
>>                                 if (tempvaddr != NULL)
>>                                         pmap_quick_remove_page(tempvaddr);
>>                                 bpage = STAILQ_NEXT(bpage, links);
>> diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c
>> index ad46e26e406f..74fa611e6d1a 100644
>> --- a/sys/arm64/arm64/busdma_bounce.c
>> +++ b/sys/arm64/arm64/busdma_bounce.c
>> @@ -868,7 +868,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
>>                         KASSERT(dmat->common.alignment <= PAGE_SIZE,
>>                             ("bounced buffer cannot have alignment bigger "
>>                             "than PAGE_SIZE: %lu", dmat->common.alignment));
>> -                       curaddr = add_bounce_page(dmat, map, (vm_offset_t)kvaddr, curaddr,
>> +                       curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,
>>                             sgsize);
>>                 } else if ((map->flags & DMAMAP_COHERENT) == 0) {
>>                         if (map->sync_count > 0) {
>> @@ -1047,19 +1047,18 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
>>                 if ((op & BUS_DMASYNC_PREWRITE) != 0) {
>>                         while (bpage != NULL) {
>>                                 tempvaddr = NULL;
>> -                               datavaddr = (void *)bpage->datavaddr;
>> +                               datavaddr = bpage->datavaddr;
>>                                 if (datavaddr == NULL) {
>>                                         tempvaddr = pmap_quick_enter_page(
>>                                             bpage->datapage);
>>                                         datavaddr = tempvaddr + bpage->dataoffs;
>>                                 }
>> 
>> -                               bcopy(datavaddr,
>> -                                   (void *)bpage->vaddr, bpage->datacount);
>> +                               bcopy(datavaddr, bpage->vaddr, bpage->datacount);
>>                                 if (tempvaddr != NULL)
>>                                         pmap_quick_remove_page(tempvaddr);
>>                                 if ((map->flags & DMAMAP_COHERENT) == 0)
>> -                                       cpu_dcache_wb_range((void *)bpage->vaddr,
>> +                                       cpu_dcache_wb_range(bpage->vaddr,
>>                                             bpage->datacount);
>>                                 bpage = STAILQ_NEXT(bpage, links);
>>                         }
>> @@ -1067,7 +1066,7 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
>>                 } else if ((op & BUS_DMASYNC_PREREAD) != 0) {
>>                         while (bpage != NULL) {
>>                                 if ((map->flags & DMAMAP_COHERENT) == 0)
>> -                                       cpu_dcache_wbinv_range((void *)bpage->vaddr,
>> +                                       cpu_dcache_wbinv_range(bpage->vaddr,
>>                                             bpage->datacount);
>>                                 bpage = STAILQ_NEXT(bpage, links);
>>                         }
>> @@ -1076,18 +1075,17 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
>>                 if ((op & BUS_DMASYNC_POSTREAD) != 0) {
>>                         while (bpage != NULL) {
>>                                 if ((map->flags & DMAMAP_COHERENT) == 0)
>> -                                       cpu_dcache_inv_range((void *)bpage->vaddr,
>> +                                       cpu_dcache_inv_range(bpage->vaddr,
>>                                             bpage->datacount);
>>                                 tempvaddr = NULL;
>> -                               datavaddr = (void *)bpage->datavaddr;
>> +                               datavaddr = bpage->datavaddr;
>>                                 if (datavaddr == NULL) {
>>                                         tempvaddr = pmap_quick_enter_page(
>>                                             bpage->datapage);
>>                                         datavaddr = tempvaddr + bpage->dataoffs;
>>                                 }
>> 
>> -                               bcopy((void *)bpage->vaddr,
>> -                                   datavaddr, bpage->datacount);
>> +                               bcopy(bpage->vaddr, datavaddr, bpage->datacount);
>> 
>>                                 if (tempvaddr != NULL)
>>                                         pmap_quick_remove_page(tempvaddr);
>> diff --git a/sys/kern/subr_busdma_bounce.c b/sys/kern/subr_busdma_bounce.c
>> index 60fe2fc6b2a6..2774128a1ae5 100644
>> --- a/sys/kern/subr_busdma_bounce.c
>> +++ b/sys/kern/subr_busdma_bounce.c
>> @@ -49,9 +49,9 @@
>>  #include <sys/sched.h>
>> 
>>  struct bounce_page {
>> -       vm_offset_t     vaddr;          /* kva of bounce buffer */
>> +       char            *vaddr;         /* kva of bounce buffer */
>>         bus_addr_t      busaddr;        /* Physical address */
>> -       vm_offset_t     datavaddr;      /* kva of client data */
>> +       char            *datavaddr;     /* kva of client data */
>>  #if defined(__amd64__) || defined(__i386__)
>>         vm_page_t       datapage[2];    /* physical page(s) of client data */
>>  #else
>> @@ -282,18 +282,18 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages)
>>                 if (bpage == NULL)
>>                         break;
>>  #ifdef dmat_domain
>> -               bpage->vaddr = (vm_offset_t)contigmalloc_domainset(PAGE_SIZE,
>> +               bpage->vaddr = contigmalloc_domainset(PAGE_SIZE,
>>                     M_BOUNCE, DOMAINSET_PREF(bz->domain), M_NOWAIT,
>>                     0ul, bz->lowaddr, PAGE_SIZE, 0);
>>  #else
>> -               bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_BOUNCE,
>> +               bpage->vaddr = contigmalloc(PAGE_SIZE, M_BOUNCE,
>>                     M_NOWAIT, 0ul, bz->lowaddr, PAGE_SIZE, 0);
>>  #endif
>> -               if (bpage->vaddr == 0) {
>> +               if (bpage->vaddr == NULL) {
>>                         free(bpage, M_BUSDMA);
>>                         break;
>>                 }
>> -               bpage->busaddr = pmap_kextract(bpage->vaddr);
>> +               bpage->busaddr = pmap_kextract((vm_offset_t)bpage->vaddr);
>>                 mtx_lock(&bounce_lock);
>>                 STAILQ_INSERT_TAIL(&bz->bounce_page_list, bpage, links);
>>                 total_bpages++;
>> @@ -327,11 +327,11 @@ reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int commit)
>> 
>>  #if defined(__amd64__) || defined(__i386__)
>>  static bus_addr_t
>> -add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,
>> +add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, void *vaddr,
>>      vm_paddr_t addr1, vm_paddr_t addr2, bus_size_t size)
>>  #else
>>  static bus_addr_t
>> -add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,
>> +add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, void *vaddr,
>>      bus_addr_t addr, bus_size_t size)
>>  #endif
>>  {
>> @@ -370,13 +370,13 @@ add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,
>>         if (dmat_flags(dmat) & BUS_DMA_KEEP_PG_OFFSET) {
>>                 /* Page offset needs to be preserved. */
>>  #if defined(__amd64__) || defined(__i386__)
>> -               bpage->vaddr |= addr1 & PAGE_MASK;
>> -               bpage->busaddr |= addr1 & PAGE_MASK;
>> +               bpage->vaddr += addr1 & PAGE_MASK;
>> +               bpage->busaddr += addr1 & PAGE_MASK;
>>                 KASSERT(addr2 == 0,
>>             ("Trying to bounce multiple pages with BUS_DMA_KEEP_PG_OFFSET"));
> 
> These hunks looks different from the commit message.

|= isn’t defined for pointers, but += is, and they’re equivalent
since the LHS is page aligned and the RHS is a page offset.

Jessica


[-- Attachment #2 --]
<html aria-label="message body"><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br id="lineBreakAtBeginningOfMessage"><div>
<br>Jessica

</div>

<div><br><blockquote type="cite"><div>On 28 Apr 2026, at 19:43, Oliver Pinter &lt;oliver.pntr@gmail.com&gt; wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">On Thursday, April 23, 2026, John Baldwin &lt;</span><a href="mailto:jhb@freebsd.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;">jhb@freebsd.org</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">&gt; wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><blockquote class="gmail_quote" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">The branch main has been updated by jhb:<br><br>URL:<span class="Apple-converted-space">&nbsp;</span><a href="https://cgit.freebsd.org/src/commit/?id=fe9f0b18bf6a1f881fbe57da716ea429acd539c1" target="_blank">https://cgit.FreeBSD.org/src/<wbr>commit/?id=<wbr>fe9f0b18bf6a1f881fbe57da716ea4<wbr>29acd539c1</a><br><br>commit fe9f0b18bf6a1f881fbe57da716ea4<wbr>29acd539c1<br>Author:&nbsp; &nbsp; &nbsp;John Baldwin &lt;jhb@FreeBSD.org&gt;<br>AuthorDate: 2026-04-23 17:05:53 +0000<br>Commit:&nbsp; &nbsp; &nbsp;John Baldwin &lt;jhb@FreeBSD.org&gt;<br>CommitDate: 2026-04-23 17:05:53 +0000<br><br>&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>busdma: Use char * instead of vm_offset_t for bounce page kernel pointers<br><br>&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>Effort:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CHERI upstreaming<br>&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>Reviewed by:&nbsp; &nbsp; kib<br>&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>Sponsored by:&nbsp; &nbsp;AFRL, DARPA<br>&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>Pull Request:&nbsp; &nbsp;<a href="https://github.com/freebsd/freebsd-src/pull/2068" target="_blank">https://github.com/freebsd/<wbr>freebsd-src/pull/2068</a><br>---<br>&nbsp;sys/arm/arm/busdma_machdep.c&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 18 ++++++++----------<br>&nbsp;sys/arm64/arm64/busdma_bounce.<wbr>c&nbsp; &nbsp; &nbsp; | 18 ++++++++----------<br>&nbsp;sys/kern/subr_busdma_bounce.c&nbsp; &nbsp; &nbsp; &nbsp; | 30 +++++++++++++++---------------<br>&nbsp;sys/powerpc/powerpc/busdma_<wbr>machdep.c | 20 +++++++++-----------<br>&nbsp;sys/riscv/riscv/busdma_bounce.<wbr>c&nbsp; &nbsp; &nbsp; | 18 ++++++++----------<br>&nbsp;sys/x86/x86/busdma_bounce.c&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | 26 +++++++++++---------------<br>&nbsp;6 files changed, 59 insertions(+), 71 deletions(-)<br><br>diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c<br>index 3c65cb8ebbf4..81b8b4a2883a 100644<br>--- a/sys/arm/arm/busdma_machdep.c<br>+++ b/sys/arm/arm/busdma_machdep.c<br>@@ -1002,7 +1002,7 @@ _bus_dmamap_load_buffer(bus_<wbr>dma_tag_t dmat, bus_dmamap_t map, void *buf,<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (map-&gt;pagesneeded != 0 &amp;&amp; must_bounce(dmat, map, curaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>sgsize)) {<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;curaddr = add_bounce_page(dmat, map, (vm_offset_t)kvaddr, curaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>sgsize);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>} else if ((dmat-&gt;flags &amp; BUS_DMA_COHERENT) == 0) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (map-&gt;sync_count &gt; 0) {<br>@@ -1199,18 +1199,17 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (op &amp; BUS_DMASYNC_PREWRITE) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>while (bpage != NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = NULL;<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = (void *)bpage-&gt;datavaddr;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = bpage-&gt;datavaddr;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (datavaddr == NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = pmap_quick_enter_page(<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;datapage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>datavaddr = tempvaddr + bpage-&gt;dataoffs;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy(datavaddr, (void *)bpage-&gt;vaddr,<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;datacount);<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy(datavaddr, bpage-&gt;vaddr, bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (tempvaddr != NULL)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>pmap_quick_remove_page(<wbr>tempvaddr);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((dmat-&gt;flags &amp; BUS_DMA_COHERENT) == 0)<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dcache_wb_poc(bpage-&gt;vaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dcache_wb_poc((vm_offset_t)<wbr>bpage-&gt;vaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;busaddr, bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage = STAILQ_NEXT(bpage, links);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br>@@ -1232,7 +1231,7 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage = STAILQ_FIRST(&amp;map-&gt;bpages);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>while (bpage != NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((dmat-&gt;flags &amp; BUS_DMA_COHERENT) == 0)<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dcache_inv_poc_dma(bpage-&gt;<wbr>vaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dcache_inv_poc_dma((vm_offset_<wbr>t)bpage-&gt;vaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;busaddr, bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage = STAILQ_NEXT(bpage, links);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br>@@ -1250,17 +1249,16 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (op &amp; BUS_DMASYNC_POSTREAD) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>while (bpage != NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((dmat-&gt;flags &amp; BUS_DMA_COHERENT) == 0)<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dcache_inv_poc(bpage-&gt;vaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dcache_inv_poc((vm_offset_t)<wbr>bpage-&gt;vaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;busaddr, bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = NULL;<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = (void *)bpage-&gt;datavaddr;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = bpage-&gt;datavaddr;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (datavaddr == NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = pmap_quick_enter_page(<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;datapage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>datavaddr = tempvaddr + bpage-&gt;dataoffs;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy((void *)bpage-&gt;vaddr, datavaddr,<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;datacount);<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy(bpage-&gt;vaddr, datavaddr, bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (tempvaddr != NULL)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>pmap_quick_remove_page(<wbr>tempvaddr);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage = STAILQ_NEXT(bpage, links);<br>diff --git a/sys/arm64/arm64/busdma_<wbr>bounce.c b/sys/arm64/arm64/busdma_<wbr>bounce.c<br>index ad46e26e406f..74fa611e6d1a 100644<br>--- a/sys/arm64/arm64/busdma_<wbr>bounce.c<br>+++ b/sys/arm64/arm64/busdma_<wbr>bounce.c<br>@@ -868,7 +868,7 @@ bounce_bus_dmamap_load_buffer(<wbr>bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>KASSERT(dmat-&gt;common.alignment &lt;= PAGE_SIZE,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>("bounced buffer cannot have alignment bigger "<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>"than PAGE_SIZE: %lu", dmat-&gt;common.alignment));<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;curaddr = add_bounce_page(dmat, map, (vm_offset_t)kvaddr, curaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>sgsize);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>} else if ((map-&gt;flags &amp; DMAMAP_COHERENT) == 0) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (map-&gt;sync_count &gt; 0) {<br>@@ -1047,19 +1047,18 @@ bounce_bus_dmamap_sync(bus_<wbr>dma_tag_t dmat, bus_dmamap_t map,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((op &amp; BUS_DMASYNC_PREWRITE) != 0) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>while (bpage != NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = NULL;<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = (void *)bpage-&gt;datavaddr;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = bpage-&gt;datavaddr;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (datavaddr == NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = pmap_quick_enter_page(<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;datapage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>datavaddr = tempvaddr + bpage-&gt;dataoffs;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br><br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy(datavaddr,<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(void *)bpage-&gt;vaddr, bpage-&gt;datacount);<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy(datavaddr, bpage-&gt;vaddr, bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (tempvaddr != NULL)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>pmap_quick_remove_page(<wbr>tempvaddr);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((map-&gt;flags &amp; DMAMAP_COHERENT) == 0)<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cpu_dcache_wb_range((void *)bpage-&gt;vaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cpu_dcache_wb_range(bpage-&gt;<wbr>vaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage = STAILQ_NEXT(bpage, links);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br>@@ -1067,7 +1066,7 @@ bounce_bus_dmamap_sync(bus_<wbr>dma_tag_t dmat, bus_dmamap_t map,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>} else if ((op &amp; BUS_DMASYNC_PREREAD) != 0) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>while (bpage != NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((map-&gt;flags &amp; DMAMAP_COHERENT) == 0)<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cpu_dcache_wbinv_range((void *)bpage-&gt;vaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cpu_dcache_wbinv_range(bpage-&gt;<wbr>vaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage = STAILQ_NEXT(bpage, links);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br>@@ -1076,18 +1075,17 @@ bounce_bus_dmamap_sync(bus_<wbr>dma_tag_t dmat, bus_dmamap_t map,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((op &amp; BUS_DMASYNC_POSTREAD) != 0) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>while (bpage != NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ((map-&gt;flags &amp; DMAMAP_COHERENT) == 0)<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cpu_dcache_inv_range((void *)bpage-&gt;vaddr,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cpu_dcache_inv_range(bpage-&gt;<wbr>vaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;datacount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = NULL;<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = (void *)bpage-&gt;datavaddr;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr = bpage-&gt;datavaddr;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (datavaddr == NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>tempvaddr = pmap_quick_enter_page(<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bpage-&gt;datapage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>datavaddr = tempvaddr + bpage-&gt;dataoffs;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br><br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy((void *)bpage-&gt;vaddr,<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;datavaddr, bpage-&gt;datacount);<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bcopy(bpage-&gt;vaddr, datavaddr, bpage-&gt;datacount);<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (tempvaddr != NULL)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>pmap_quick_remove_page(<wbr>tempvaddr);<br>diff --git a/sys/kern/subr_busdma_bounce.<wbr>c b/sys/kern/subr_busdma_bounce.<wbr>c<br>index 60fe2fc6b2a6..2774128a1ae5 100644<br>--- a/sys/kern/subr_busdma_bounce.<wbr>c<br>+++ b/sys/kern/subr_busdma_bounce.<wbr>c<br>@@ -49,9 +49,9 @@<br>&nbsp;#include &lt;sys/sched.h&gt;<br><br>&nbsp;struct bounce_page {<br>-&nbsp; &nbsp; &nbsp; &nbsp;vm_offset_t&nbsp; &nbsp; &nbsp;vaddr;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* kva of bounce buffer */<br>+&nbsp; &nbsp; &nbsp; &nbsp;char&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *vaddr;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* kva of bounce buffer */<br>&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>bus_addr_t&nbsp; &nbsp; &nbsp; busaddr;&nbsp; &nbsp; &nbsp; &nbsp; /* Physical address */<br>-&nbsp; &nbsp; &nbsp; &nbsp;vm_offset_t&nbsp; &nbsp; &nbsp;datavaddr;&nbsp; &nbsp; &nbsp; /* kva of client data */<br>+&nbsp; &nbsp; &nbsp; &nbsp;char&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *datavaddr;&nbsp; &nbsp; &nbsp;/* kva of client data */<br>&nbsp;#if defined(__amd64__) || defined(__i386__)<br>&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>vm_page_t&nbsp; &nbsp; &nbsp; &nbsp;datapage[2];&nbsp; &nbsp; /* physical page(s) of client data */<br>&nbsp;#else<br>@@ -282,18 +282,18 @@ alloc_bounce_pages(bus_dma_<wbr>tag_t dmat, u_int numpages)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (bpage == NULL)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>break;<br>&nbsp;#ifdef dmat_domain<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;vaddr = (vm_offset_t)contigmalloc_<wbr>domainset(PAGE_SIZE,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;vaddr = contigmalloc_domainset(PAGE_<wbr>SIZE,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>M_BOUNCE, DOMAINSET_PREF(bz-&gt;domain), M_NOWAIT,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>0ul, bz-&gt;lowaddr, PAGE_SIZE, 0);<br>&nbsp;#else<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;vaddr = (vm_offset_t)contigmalloc(<wbr>PAGE_SIZE, M_BOUNCE,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;vaddr = contigmalloc(PAGE_SIZE, M_BOUNCE,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>M_NOWAIT, 0ul, bz-&gt;lowaddr, PAGE_SIZE, 0);<br>&nbsp;#endif<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (bpage-&gt;vaddr == 0) {<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (bpage-&gt;vaddr == NULL) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>free(bpage, M_BUSDMA);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>break;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;busaddr = pmap_kextract(bpage-&gt;vaddr);<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;busaddr = pmap_kextract((vm_offset_t)<wbr>bpage-&gt;vaddr);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>mtx_lock(&amp;bounce_lock);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>STAILQ_INSERT_TAIL(&amp;bz-&gt;<wbr>bounce_page_list, bpage, links);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>total_bpages++;<br>@@ -327,11 +327,11 @@ reserve_bounce_pages(bus_dma_<wbr>tag_t dmat, bus_dmamap_t map, int commit)<br><br>&nbsp;#if defined(__amd64__) || defined(__i386__)<br>&nbsp;static bus_addr_t<br>-add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,<br>+add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, void *vaddr,<br>&nbsp; &nbsp; &nbsp;vm_paddr_t addr1, vm_paddr_t addr2, bus_size_t size)<br>&nbsp;#else<br>&nbsp;static bus_addr_t<br>-add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,<br>+add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, void *vaddr,<br>&nbsp; &nbsp; &nbsp;bus_addr_t addr, bus_size_t size)<br>&nbsp;#endif<br>&nbsp;{<br>@@ -370,13 +370,13 @@ add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,<br>&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if (dmat_flags(dmat) &amp; BUS_DMA_KEEP_PG_OFFSET) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>/* Page offset needs to be preserved. */<br>&nbsp;#if defined(__amd64__) || defined(__i386__)<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;vaddr |= addr1 &amp; PAGE_MASK;<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;busaddr |= addr1 &amp; PAGE_MASK;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;vaddr += addr1 &amp; PAGE_MASK;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bpage-&gt;busaddr += addr1 &amp; PAGE_MASK;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>KASSERT(addr2 == 0,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>("Trying to bounce multiple pages with BUS_DMA_KEEP_PG_OFFSET"));</blockquote><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><br></div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">These hunks looks different from the commit message.</div></div></blockquote><br></div><div><div>|= isn’t defined for pointers, but += is, and they’re equivalent</div><div>since the LHS is page aligned and the RHS is a page offset.</div><div><br></div></div><div>Jessica</div><div><br></div></body></html>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9A89D171-0067-43C1-ABB3-E18A832FC6D5>