On Fri, Mar 24, 2023 at 2:57 PM Xuan Zhuo <[email protected]> wrote:
>
> On Fri, 24 Mar 2023 14:47:56 +0800, Jason Wang <[email protected]> wrote:
> > On Fri, Mar 24, 2023 at 2:30 PM Xuan Zhuo <[email protected]> 
> > wrote:
> > >
> > > virtio core only supports virtual addresses, dma is completed in virtio
> > > core.
> > >
> > > In some scenarios (such as the AF_XDP), the memory is allocated
> > > and DMA mapping is completed in advance, so it is necessary for us to
> > > support passing the DMA address to virtio core.
> > >
> > > Drives can use sg->dma_address to pass the mapped dma address to virtio
> > > core. If one sg->dma_address is used then all sgs must use
> > > sg->dma_address, otherwise all must be null when passing it to the APIs
> > > of virtio.
> > >
> > > Signed-off-by: Xuan Zhuo <[email protected]>
> > > ---
> > >  drivers/virtio/virtio_ring.c | 17 ++++++++++++++---
> > >  1 file changed, 14 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > > index 1c3084a8f4e3..df6d514a681a 100644
> > > --- a/drivers/virtio/virtio_ring.c
> > > +++ b/drivers/virtio/virtio_ring.c
> > > @@ -78,6 +78,7 @@ struct vring_desc_state_split {
> > >  struct vring_desc_state_packed {
> > >         void *data;                     /* Data for callback. */
> > >         struct vring_packed_desc *indir_desc; /* Indirect descriptor, if 
> > > any. */
> > > +       u64 flags;                      /* State flags. */
> >
> > I'd use u32 then there would be no need for the compiler to pad the
> > structure in both 32 and 64 bit archs.
>
>
> OK.
>
> I just try to keep the same as split. Maybe I should add some notes,
> indicating that there is some difference between split.

It would be better to use a u32 + explicit pad for split in this case.

Thanks

>
>
> Thanks.
>
>
> >
> > Thanks
> >
>

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to