On Sun, Jan 29, 2023 at 10:51 AM Longpeng(Mike) <longpeng2@xxxxxxxxxx> wrote: > > From: Longpeng <longpeng2@xxxxxxxxxx> > > Adds get_vq_notification_pgprot operation to vdpa_config_ops to support > specify the pgprot of vq norification area. It's an optional operation, > the vdpa framework will treat the pgprot of vq notification area as > noncached as default as usual. Missing sob. Other than this. Acked-by: Jason Wang <jasowang@xxxxxxxxxx> Thanks > --- > drivers/vhost/vdpa.c | 4 +++- > include/linux/vdpa.h | 9 +++++++++ > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > index 166044642fd5..036fe88425c8 100644 > --- a/drivers/vhost/vdpa.c > +++ b/drivers/vhost/vdpa.c > @@ -1263,7 +1263,9 @@ static vm_fault_t vhost_vdpa_fault(struct vm_fault *vmf) > > notify = ops->get_vq_notification(vdpa, index); > > - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); > + vma->vm_page_prot = ops->get_vq_notification_pgprot ? > + ops->get_vq_notification_pgprot(vdpa, index, vma->vm_page_prot) : > + pgprot_noncached(vma->vm_page_prot); > if (remap_pfn_range(vma, vmf->address & PAGE_MASK, > PFN_DOWN(notify.addr), PAGE_SIZE, > vma->vm_page_prot)) > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index 6d0f5e4e82c2..07fcf5e6abc8 100644 > --- a/include/linux/vdpa.h > +++ b/include/linux/vdpa.h > @@ -169,6 +169,12 @@ struct vdpa_map_file { > * @vdev: vdpa device > * @idx: virtqueue index > * Returns the notifcation area > + * @get_vq_notification_pgprot: Get the pgprot of the vq's notification area (optional) > + * @vdev: vdpa device > + * @idx: virtqueue index > + * @prot: original page protection value of the > + * notification area > + * Returns pgprot_t: the pgprot of the notification area > * @get_vq_irq: Get the irq number of a virtqueue (optional, > * but must implemented if require vq irq offloading) > * @vdev: vdpa device > @@ -305,6 +311,9 @@ struct vdpa_config_ops { > struct netlink_ext_ack *extack); > struct vdpa_notification_area > (*get_vq_notification)(struct vdpa_device *vdev, u16 idx); > + pgprot_t (*get_vq_notification_pgprot)(struct vdpa_device *vdev, > + u16 idx, > + pgprot_t prot); > /* vq irq is not expected to be changed once DRIVER_OK is set */ > int (*get_vq_irq)(struct vdpa_device *vdev, u16 idx); > > -- > 2.23.0 > _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization