On Thu, Jul 14, 2022 at 01:51:06PM +0200, Jan Beulich wrote: > On 06.07.2022 17:32, Marek Marczykowski-Górecki wrote: > > + /* > > + * Don't place anything else on this page - it will be > > + * DMA-reachable by the USB controller. > > + */ > > + char _pad[0] __aligned(XUE_PAGE_SIZE); > > I don't think this is needed, due to sizeof() being required to be > a multiple of alignof().
I'd prefer to be explicit about this, because if some future change
breaks this property (makes alignment smaller than a page size), the
result will be pretty bad.
> > +};
> > +static struct xue_dma_bufs xue_dma_bufs __aligned(XUE_PAGE_SIZE);
>
> I don't think the alignment here is needed, as the struct will
> already have suitable alignment (derived from the biggest field
> alignment value). Instead please consider putting this in
> .bss.page_aligned.
Ok.
> > @@ -990,16 +999,22 @@ void __init xue_uart_init(void)
> > xue->sbdf = PCI_SBDF(0, bus, slot, func);
> > }
> >
> > - xue->dbc_ctx = &ctx;
> > - xue->dbc_erst = &erst;
> > - xue->dbc_ering.trb = evt_trb;
> > - xue->dbc_oring.trb = out_trb;
> > - xue->dbc_iring.trb = in_trb;
> > - xue->dbc_owork.buf = wrk_buf;
> > - xue->dbc_str = str_buf;
> > + xue->dbc_ctx = &xue_dma_bufs.ctx;
> > + xue->dbc_erst = &xue_dma_bufs.erst;
> > + xue->dbc_ering.trb = xue_dma_bufs.evt_trb;
> > + xue->dbc_oring.trb = xue_dma_bufs.out_trb;
> > + xue->dbc_iring.trb = xue_dma_bufs.in_trb;
> > + xue->dbc_owork.buf = xue_dma_bufs.wrk_buf;
> > + xue->dbc_str = xue_dma_bufs.str_buf;
> >
> > if ( xue_open(xue) )
> > + {
> > + iommu_add_extra_reserved_device_memory(
> > + PFN_DOWN(virt_to_maddr(&xue_dma_bufs)),
>
> virt_to_pfn()?
Doesn't exist. Did you mean virt_to_mfn()?
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
signature.asc
Description: PGP signature
