From: Alex Williamson <alex.williamson@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: lvivier@redhat.com, thuth@redhat.com, abologna@redhat.com,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 4/7] vfio: Record host IOMMU's available IO page sizes
Date: Thu, 24 Sep 2015 11:32:14 -0600 [thread overview]
Message-ID: <1443115934.23936.568.camel@redhat.com> (raw)
In-Reply-To: <1443069231-14856-5-git-send-email-david@gibson.dropbear.id.au>
On Thu, 2015-09-24 at 14:33 +1000, David Gibson wrote:
> Depending on the host IOMMU type we determine and record the available page
> sizes for IOMMU translation. We'll need this for other validation in
> future patches.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> ---
> hw/vfio/common.c | 13 +++++++++++++
> include/hw/vfio/vfio-common.h | 1 +
> 2 files changed, 14 insertions(+)
>
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index f90cc75..db8dff3 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -677,6 +677,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as)
> if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) ||
> ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) {
> bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU);
> + struct vfio_iommu_type1_info info;
>
> ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd);
> if (ret) {
> @@ -702,6 +703,15 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as)
> */
> container->min_iova = 0;
> container->max_iova = (hwaddr)-1;
> +
> + /* Assume just 4K IOVA page size */
> + container->iova_pgsizes = 0x1000;
> + info.argsz = sizeof(info);
> + ret = ioctl(fd, VFIO_IOMMU_GET_INFO, &info);
> + /* Ignore errors */
> + if ((ret == 0) && (info.flags & VFIO_IOMMU_INFO_PGSIZES)) {
> + container->iova_pgsizes = info.iova_pgsizes;
> + }
> } else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU)) {
> struct vfio_iommu_spapr_tce_info info;
>
> @@ -744,6 +754,9 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as)
> }
> container->min_iova = info.dma32_window_start;
> container->max_iova = container->min_iova + info.dma32_window_size - 1;
> +
> + /* Assume just 4K IOVA pages for now */
Ironically, no FIXME ;)
> + container->iova_pgsizes = 0x1000;
> } else {
> error_report("vfio: No available IOMMU models");
> ret = -EINVAL;
> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
> index 859dbec..b8a76e1 100644
> --- a/include/hw/vfio/vfio-common.h
> +++ b/include/hw/vfio/vfio-common.h
> @@ -71,6 +71,7 @@ typedef struct VFIOContainer {
> * that in future
> */
> hwaddr min_iova, max_iova;
> + uint64_t iova_pgsizes;
> QLIST_HEAD(, VFIOGuestIOMMU) giommu_list;
> QLIST_HEAD(, VFIOGroup) group_list;
> QLIST_ENTRY(VFIOContainer) next;
next prev parent reply other threads:[~2015-09-24 17:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 4:33 [Qemu-devel] [PATCH 0/7] VFIO extensions to allow VFIO devices on spapr-pci-host-bridge David Gibson
2015-09-24 4:33 ` [Qemu-devel] [PATCH 1/7] vfio: Remove unneeded union from VFIOContainer David Gibson
2015-09-24 16:01 ` Alex Williamson
2015-09-25 5:14 ` David Gibson
2015-09-24 16:10 ` Thomas Huth
2015-09-24 4:33 ` [Qemu-devel] [PATCH 2/7] vfio: Generalize vfio_listener_region_add failure path David Gibson
2015-09-24 4:33 ` [Qemu-devel] [PATCH 3/7] vfio: Check guest IOVA ranges against host IOMMU capabilities David Gibson
2015-09-24 17:32 ` Alex Williamson
2015-09-25 5:20 ` David Gibson
2015-09-24 4:33 ` [Qemu-devel] [PATCH 4/7] vfio: Record host IOMMU's available IO page sizes David Gibson
2015-09-24 17:32 ` Alex Williamson [this message]
2015-09-25 5:21 ` David Gibson
2015-09-24 4:33 ` [Qemu-devel] [PATCH 5/7] memory: Allow replay of IOMMU mapping notifications David Gibson
2015-09-24 16:08 ` Laurent Vivier
2015-09-25 5:39 ` David Gibson
2015-09-24 17:32 ` Alex Williamson
2015-09-25 5:24 ` David Gibson
2015-09-25 11:25 ` Paolo Bonzini
2015-09-25 11:20 ` Paolo Bonzini
2015-09-25 11:33 ` David Gibson
2015-09-25 12:04 ` Paolo Bonzini
2015-09-26 6:54 ` David Gibson
2015-09-28 8:59 ` Paolo Bonzini
2015-09-29 3:30 ` David Gibson
2015-09-29 7:15 ` Paolo Bonzini
2015-09-30 2:15 ` David Gibson
2015-09-24 4:33 ` [Qemu-devel] [PATCH 6/7] vfio: Allow hotplug of containers onto existing guest IOMMU mappings David Gibson
2015-09-24 4:33 ` [Qemu-devel] [PATCH 7/7] vfio: Expose a VFIO PCI device's group for EEH David Gibson
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=1443115934.23936.568.camel@redhat.com \
--to=alex.williamson@redhat.com \
--cc=abologna@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.