qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Viktor Prutyanov <viktor@daynix.com>,
	mst@redhat.com, marcel.apfelbaum@gmail.com, pbonzini@redhat.com,
	peterx@redhat.com, david@redhat.com
Cc: philmd@linaro.org, qemu-devel@nongnu.org, yan@daynix.com,
	yuri.benditovich@daynix.com
Subject: Re: [RFC PATCH 2/4] virtio-pci: add handling of ATS state change
Date: Wed, 26 Apr 2023 13:50:36 +0800	[thread overview]
Message-ID: <98eda02a-63a8-7c2d-7c10-85ca986141a2@redhat.com> (raw)
In-Reply-To: <20230424112147.17083-3-viktor@daynix.com>


在 2023/4/24 19:21, Viktor Prutyanov 写道:
> Guest may enable or disable ATS for the device. Add logic for handling
> these events.
>
> Signed-off-by: Viktor Prutyanov <viktor@daynix.com>
> ---
>   hw/virtio/virtio-pci.c     | 12 ++++++++++++
>   include/hw/virtio/virtio.h |  2 ++
>   2 files changed, 14 insertions(+)
>
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 247325c193..70f63a4986 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1731,6 +1731,17 @@ static void virtio_pci_device_write(void *opaque, hwaddr addr,
>       }
>   }
>   
> +static void virtio_pci_ats_ctrl_trigger(PCIDevice *pci_dev, bool enable)
> +{
> +    VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
> +    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
> +
> +    vdev->ats_enabled = enable;
> +
> +    if (vdev->ats_ctrl_trigger)
> +        vdev->ats_ctrl_trigger(enable, vdev);
> +}
> +
>   static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy,
>                                              const char *vdev_name)
>   {
> @@ -2166,6 +2177,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
>           if (proxy->flags & VIRTIO_PCI_FLAG_ATS) {
>               pcie_ats_init(pci_dev, last_pcie_cap_offset,
>                             proxy->flags & VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED);
> +            pci_dev->ats_ctrl_trigger = virtio_pci_ats_ctrl_trigger;
>               last_pcie_cap_offset += PCI_EXT_CAP_ATS_SIZEOF;
>           }
>   
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 77c6c55929..2812561aae 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -155,6 +155,8 @@ struct VirtIODevice
>       QLIST_HEAD(, VirtQueue) *vector_queues;
>       QTAILQ_ENTRY(VirtIODevice) next;
>       EventNotifier config_notifier;
> +    void (*ats_ctrl_trigger)(bool enable, VirtIODevice *vdev);
> +    bool ats_enabled;


ATS is pci specific in the virtio layer we might use something more 
general like "device-iotlb"?

And this method needs to go in VirtioDeviceClass.

Thanks


>   };
>   
>   struct VirtioDeviceClass {



  reply	other threads:[~2023-04-26  5:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 11:21 [RFC PATCH 0/4] vhost: register and change IOMMU flag depending on ATS state Viktor Prutyanov
2023-04-24 11:21 ` [RFC PATCH 1/4] pci: add handling of Enable bit in ATS Control Register Viktor Prutyanov
2023-04-26  5:31   ` Jason Wang
2023-04-26  5:48     ` Jason Wang
2023-05-02 21:35     ` Viktor Prutyanov
2023-04-24 11:21 ` [RFC PATCH 2/4] virtio-pci: add handling of ATS state change Viktor Prutyanov
2023-04-26  5:50   ` Jason Wang [this message]
2023-04-24 11:21 ` [RFC PATCH 3/4] memory: add interface for triggering IOMMU notify_flag_changed handler Viktor Prutyanov
2023-04-26 14:20   ` Peter Xu
2023-04-24 11:21 ` [RFC PATCH 4/4] vhost: register and change IOMMU flag depending on ATS state Viktor Prutyanov
2023-04-26  5:54   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98eda02a-63a8-7c2d-7c10-85ca986141a2@redhat.com \
    --to=jasowang@redhat.com \
    --cc=david@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=viktor@daynix.com \
    --cc=yan@daynix.com \
    --cc=yuri.benditovich@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).