On 23/11/17 00:39, David Gibson wrote: > On Wed, Nov 22, 2017 at 04:15:52PM +1100, Alexey Kardashevskiy wrote: >> The vfio_iommu_spapr_tce driver always advertises v1 and v2 IOMMU support, >> however PR KVM (a special version of KVM designed to work in >> a paravirtualized system; these days used for nested virtualizaion) only >> supports the "pseries" platform which does not support v2. Since there is >> no way to choose the IOMMU version in QEMU, it fails to start. >> >> This adds a fallback to the v1 IOMMU if v2 cannot be used. >> >> Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> > > The fallback itself isn't a bad idea, but your commit message contains > several inaccurracies. KVM PR is not particularly designed to work in > a paravirtualized system, and it doesn't only support the pseries > platform (as guest *or* host). It's actually a lot more general than > KVM HV - just slow, not that well tested and missing a number of > features that no-one's bothered to port to it.
Well, true. I kinda tried to give an example of how this may be useful and exaggerated a bit, plus my ignorance :) I'll repost if Alex does not have objections otherwise. > >> --- >> hw/vfio/common.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/hw/vfio/common.c b/hw/vfio/common.c >> index 7b2924c..cd81cc9 100644 >> --- a/hw/vfio/common.c >> +++ b/hw/vfio/common.c >> @@ -1040,6 +1040,11 @@ static int vfio_connect_container(VFIOGroup *group, >> AddressSpace *as, >> v2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU; >> ret = ioctl(fd, VFIO_SET_IOMMU, container->iommu_type); >> if (ret) { >> + container->iommu_type = VFIO_SPAPR_TCE_IOMMU; >> + v2 = false; >> + ret = ioctl(fd, VFIO_SET_IOMMU, container->iommu_type); >> + } >> + if (ret) { >> error_setg_errno(errp, errno, "failed to set iommu for >> container"); >> ret = -errno; >> goto free_container_exit; > -- Alexey
signature.asc
Description: OpenPGP digital signature