Thread (31 messages) flat view 31 messages, 5 authors, 2021-08-26

Re: [PATCH V4 10/13] PCI / VFIO: Add 'override_only' support for VFIO PCI sub system

From: Alex Williamson <hidden>
Date: 2021-08-25 22:05:52
Also in: kvm, linux-kbuild, linux-pci, linux-s390

On Wed, 25 Aug 2021 16:51:36 +0300
Yishai Hadas [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 7c97fa8e36bc..c3edbf73157e 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -426,7 +426,7 @@ static int do_ieee1394_entry(const char *filename,
 	return 1;
 }
 
-/* Looks like: pci:vNdNsvNsdNbcNscNiN. */
+/* Looks like: pci:vNdNsvNsdNbcNscNiN or <prefix>_pci:vNdNsvNsdNbcNscNiN. */
 static int do_pci_entry(const char *filename,
 			void *symval, char *alias)
 {
@@ -440,8 +440,12 @@ static int do_pci_entry(const char *filename,
 	DEF_FIELD(symval, pci_device_id, subdevice);
 	DEF_FIELD(symval, pci_device_id, class);
 	DEF_FIELD(symval, pci_device_id, class_mask);
+	DEF_FIELD(symval, pci_device_id, override_only);
 
-	strcpy(alias, "pci:");
+	if (override_only & PCI_ID_F_VFIO_DRIVER_OVERRIDE)
+		strcpy(alias, "vfio_pci:");
+	else
+		strcpy(alias, "pci:");
I'm a little concerned that we're allowing unknown, non-zero
override_only values to fall through to create "pci:" alias matches.
Should this be something like:

	if (override_only & PCI_ID_F_VFIO_DRIVER_OVERRIDE) {
		strcpy(alias, "vfio_pci:");
	} else if (override_only) {
		warn("Unknown PCI driver_override alias %08X\n",
			driver_override);
		return 0;
	} else {
		strcpy(alias, "pci:");
	}

And then if we can only have a single bit set in override_only (I
can't think of a use case for a single entry to have multiple
override options), should PCI_DEVICE_DRIVER_OVERRIDE() be defined to
take a "driver_override_shift" value where .driver_override is assigned
(1 << driver_override_shift)?  That would encode the semantics in the
prototypes a little better.  Thanks,

Alex
 	ADD(alias, "v", vendor != PCI_ANY_ID, vendor);
 	ADD(alias, "d", device != PCI_ANY_ID, device);
 	ADD(alias, "sv", subvendor != PCI_ANY_ID, subvendor);
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help