From: Auger Eric <eric.auger@redhat.com>
To: Bharat Bhushan <bbhushan2@marvell.com>,
peter.maydell@linaro.org, peterx@redhat.com,
eric.auger.pro@gmail.com, alex.williamson@redhat.com,
kevin.tian@intel.com, mst@redhat.com, tnowicki@marvell.com,
drjones@redhat.com, linuc.decode@gmail.com,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
bharatb.linux@gmail.com, jean-philippe@linaro.org,
yang.zhong@intel.com
Subject: Re: [PATCH v8 4/8] virtio-iommu: set supported page size mask
Date: Wed, 18 Mar 2020 12:28:21 +0100 [thread overview]
Message-ID: <3da60c1b-6897-7ab1-3a67-bec44fa00a54@redhat.com> (raw)
In-Reply-To: <20200318101159.8767-5-bbhushan2@marvell.com>
Hi Bharat,
On 3/18/20 11:11 AM, Bharat Bhushan wrote:
> Add optional interface to set page size mask.
> Currently this is set global configuration and not
> per endpoint.
>
> Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
> ---
> v7->v8:
> - new patch
>
> hw/virtio/virtio-iommu.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
> index 4cee8083bc..c00a55348d 100644
> --- a/hw/virtio/virtio-iommu.c
> +++ b/hw/virtio/virtio-iommu.c
> @@ -650,6 +650,15 @@ static gint int_cmp(gconstpointer a, gconstpointer b, gpointer user_data)
> return (ua > ub) - (ua < ub);
> }
>
> +static void virtio_iommu_set_page_size_mask(IOMMUMemoryRegion *mr,
> + uint64_t page_size_mask)
> +{
> + IOMMUDevice *sdev = container_of(mr, IOMMUDevice, iommu_mr);
> + VirtIOIOMMU *s = sdev->viommu;
> +
> + s->config.page_size_mask = page_size_mask;
The problem is page_size_mask is global to the VIRTIO-IOMMU.
- Can't different VFIO containers impose different/inconsistent settings?
- VFIO devices can be hotplugged. So we may start with some default
page_size_mask which is latter overriden by a host imposed one. Assume
you first launch the VM with a virtio NIC. This uses 64K. Then you
hotplug a VFIO device behind a physical IOMMU which only supports 4K
pages. Isn't it a valid scenario?
Thanks
Eric
> +}
> +
> static void virtio_iommu_device_realize(DeviceState *dev, Error **errp)
> {
> VirtIODevice *vdev = VIRTIO_DEVICE(dev);
> @@ -865,6 +874,7 @@ static void virtio_iommu_memory_region_class_init(ObjectClass *klass,
> IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_CLASS(klass);
>
> imrc->translate = virtio_iommu_translate;
> + imrc->iommu_set_page_size_mask = virtio_iommu_set_page_size_mask;
> }
>
> static const TypeInfo virtio_iommu_info = {
>
next prev parent reply other threads:[~2020-03-18 11:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 10:11 [PATCH v8 0/8] virtio-iommu: VFIO integration Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 1/8] hw/vfio/common: Remove error print on mmio region translation by viommu Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 2/8] memory: Add interface to set iommu page size mask Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 3/8] vfio: set iommu page size as per host supported page size Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 4/8] virtio-iommu: set supported page size mask Bharat Bhushan
2020-03-18 11:28 ` Auger Eric [this message]
2020-03-18 14:35 ` Bharat Bhushan
2020-03-23 8:43 ` Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 5/8] virtio-iommu: Add iommu notifier for map/unmap Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 6/8] virtio-iommu: Call iommu notifier for attach/detach Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 7/8] virtio-iommu: add iommu replay Bharat Bhushan
2020-03-18 10:11 ` [PATCH v8 8/8] virtio-iommu: add iommu notifier memory-region Bharat Bhushan
2020-03-18 10:53 ` [PATCH v8 0/8] virtio-iommu: VFIO integration Auger Eric
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=3da60c1b-6897-7ab1-3a67-bec44fa00a54@redhat.com \
--to=eric.auger@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=bbhushan2@marvell.com \
--cc=bharatb.linux@gmail.com \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=jean-philippe@linaro.org \
--cc=kevin.tian@intel.com \
--cc=linuc.decode@gmail.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=tnowicki@marvell.com \
--cc=yang.zhong@intel.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).