[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <76879d8a-3c5f-2fb0-c8f9-100368eafa6e@linux.vnet.ibm.com>
Date: Thu, 30 Nov 2017 15:49:36 +0100
From: Pierre Morel <pmorel@...ux.vnet.ibm.com>
To: Jean-Philippe Brucker <jean-philippe.brucker@....com>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>
Cc: "cohuck@...hat.com" <cohuck@...hat.com>,
"borntraeger@...ibm.com" <borntraeger@...ibm.com>,
"zyimin@...ux.vnet.ibm.com" <zyimin@...ux.vnet.ibm.com>,
"pasic@...ux.vnet.ibm.com" <pasic@...ux.vnet.ibm.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfio/iommu_type1: report the IOMMU aperture info
On 30/11/2017 15:16, Pierre Morel wrote:
> On 30/11/2017 13:57, Jean-Philippe Brucker wrote:
>> Hello,
>>
>> On 30/11/17 11:34, Pierre Morel wrote:
>> [...]
>>> +/**
>>> + * vfio_get_aperture - report minimal aperture of a vfio_iommu
>>> + * @iommu: the current vfio_iommu
>>> + * @start: a pointer to the aperture start
>>> + * @end : a pointer to the aperture end
>>> + *
>>> + * This function iterate on the domains using the given vfio_iommu
>>> + * and restrict the aperture to the minimal aperture common
>>> + * to all domains sharing this vfio_iommu.
>>> + */
>>> +static void vfio_get_aperture(struct vfio_iommu *iommu, uint64_t
>>> *start,
>>> + uint64_t *end)
>>> +{
>>> + struct iommu_domain_geometry geometry;
>>> + struct vfio_domain *domain;
>>> +
>>> + *start = 0;
>>> + *end = U64_MAX;
>>
>> I wonder if the default values should also reflect what the VFIO
>> implementation actually supports. Looking at vfio_dma_do_map, a 32-bit
>> host will reject any iova greater than 32 bits. In addition,
>> vfio_dma_do_unmap doesn't support unmapping the last page of a 64-bit
>> address space (existing IOMMUs would probably reject map requests with
>> IOVA > 52 bits anyway, but if they don't report a domain aperture, VFIO
>> can't guess it).
>>
>> I think it's convenient to use VFIO_IOMMU_UNMAP_DMA on the full address
>> space when an unmap-all is needed, maybe we could provide default
>> aperture
>> values that help doing this? (~0U for 32-bit and (~0ULL - PAGE_SIZE) for
>> 64-bit)
indeed the error is to use uint64_t, I should *never* use this hardware
specific values but simply unsigned long and -1UL/~0U at this level.
Shouldn't the 52bit problem be reported by the iommu geometry?
>>
>> Thanks,
>> Jean
>>
>
> Thanks, I will take care of this.
>
> Pierre
>
>
--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany
Powered by blists - more mailing lists