[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH 4/7] vfio: Record host IOMMU's available IO page s
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH 4/7] vfio: Record host IOMMU's available IO page sizes |
Date: |
Fri, 25 Sep 2015 15:21:42 +1000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Sep 24, 2015 at 11:32:14AM -0600, Alex Williamson wrote:
> 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 <address@hidden>
> > Reviewed-by: Thomas Huth <address@hidden>
> > Reviewed-by: Laurent Vivier <address@hidden>
> > ---
> > 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 ;)
:p
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
pgpW2rrkhyFbJ.pgp
Description: PGP signature