[libvirt] [PATCH] hostdev: skip ACS check when using VFIO for device assignment
The ACS checks are meaningless when using the more modern VFIO driver for device assignment since VFIO has its own more complete and exact checks, but I didn't realize that when I added support for VFIO. This patch eliminates the ACS check when preparing PCI devices for assignment if VFIO is being used. This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1256486 --- src/util/virhostdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 529753c..0bc5120 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1,6 +1,6 @@ /* virhostdev.c: hostdev management * - * Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc. + * Copyright (C) 2006-2007, 2009-2015 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. * @@ -230,7 +230,6 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) virObjectUnref(list); return NULL; } - if (virPCIDeviceListAdd(list, dev) 0) { virPCIDeviceFree(dev); virObjectUnref(list); @@ -579,7 +578,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, struct virHostdevIsPCINodeDeviceUsedData data = {hostdev_mgr, dom_name, usesVfio}; -if (!virPCIDeviceIsAssignable(dev, strict_acs_check)) { +if (!usesVfio !virPCIDeviceIsAssignable(dev, strict_acs_check)) { virReportError(VIR_ERR_OPERATION_INVALID, _(PCI device %s is not assignable), virPCIDeviceGetName(dev)); -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] hostdev: skip ACS check when using VFIO for device assignment
On 08/26/2015 04:13 AM, Martin Kletzander wrote: On Wed, Aug 26, 2015 at 02:07:32AM -0400, Laine Stump wrote: The ACS checks are meaningless when using the more modern VFIO driver for device assignment since VFIO has its own more complete and exact checks, but I didn't realize that when I added support for VFIO. This patch eliminates the ACS check when preparing PCI devices for assignment if VFIO is being used. This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1256486 I don't remember how it's possible as neatly as I managed to do somehow, but I believe git has good support for 'Key: Value' on one line so that you can then easily see, for example, patches that have Key == Resolves etc., so I'm using Resolves: link-to-bz, but as I said, I forgot how to use that formatting neatly (it was almost like one parameter only). So this is just an FYI, no need to change it. Interesting, I didn't know about that. --- src/util/virhostdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 529753c..0bc5120 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1,6 +1,6 @@ /* virhostdev.c: hostdev management * - * Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc. + * Copyright (C) 2006-2007, 2009-2015 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. * @@ -230,7 +230,6 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) virObjectUnref(list); return NULL; } - if (virPCIDeviceListAdd(list, dev) 0) { virPCIDeviceFree(dev); virObjectUnref(list); @@ -579,7 +578,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, struct virHostdevIsPCINodeDeviceUsedData data = {hostdev_mgr, dom_name, usesVfio}; -if (!virPCIDeviceIsAssignable(dev, strict_acs_check)) { +if (!usesVfio !virPCIDeviceIsAssignable(dev, strict_acs_check)) { I suppose we could unset the strict check in case of VFIO as that would work too, but was not meant for this job. Just in case someone were to be incredibly intelligent and try to use legacy assignment and vfio in the same system, we can't just disable the global strict_acs check. Besides, even if the strict ACS check is disabled, we still go poking around in sysfs (calling virPCIDeviceIsBehindSwitchLackingACS()), which we really *don't* want to do, as that is causing problems for people attempting to do vfio device assignment from a session-mode libvirt (which should otherwise work as long as the device is pre-bound to vfio-pci and all the device node permissions are set). Who wants to do vfio device assignment from session-mode libvirt? gnome-boxes of course! They want to do GPU passthrough. ACK as-is. Thanks! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] hostdev: skip ACS check when using VFIO for device assignment
On Wed, Aug 26, 2015 at 02:07:32AM -0400, Laine Stump wrote: The ACS checks are meaningless when using the more modern VFIO driver for device assignment since VFIO has its own more complete and exact checks, but I didn't realize that when I added support for VFIO. This patch eliminates the ACS check when preparing PCI devices for assignment if VFIO is being used. This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1256486 I don't remember how it's possible as neatly as I managed to do somehow, but I believe git has good support for 'Key: Value' on one line so that you can then easily see, for example, patches that have Key == Resolves etc., so I'm using Resolves: link-to-bz, but as I said, I forgot how to use that formatting neatly (it was almost like one parameter only). So this is just an FYI, no need to change it. --- src/util/virhostdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 529753c..0bc5120 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1,6 +1,6 @@ /* virhostdev.c: hostdev management * - * Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc. + * Copyright (C) 2006-2007, 2009-2015 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. * @@ -230,7 +230,6 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) virObjectUnref(list); return NULL; } - if (virPCIDeviceListAdd(list, dev) 0) { virPCIDeviceFree(dev); virObjectUnref(list); @@ -579,7 +578,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, struct virHostdevIsPCINodeDeviceUsedData data = {hostdev_mgr, dom_name, usesVfio}; -if (!virPCIDeviceIsAssignable(dev, strict_acs_check)) { +if (!usesVfio !virPCIDeviceIsAssignable(dev, strict_acs_check)) { I suppose we could unset the strict check in case of VFIO as that would work too, but was not meant for this job. ACK as-is. virReportError(VIR_ERR_OPERATION_INVALID, _(PCI device %s is not assignable), virPCIDeviceGetName(dev)); -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list