Skip to contentSkip to conversation

pciback: per-device permissive flag

PATCH In review Chris 1 participant 1 message Jul 17, 2006

lore
Share & tools
lore

Chris

author
#0 lore raw

PATCH 2/5 pciback: per-device permissive flag

This patch includes the per-device permissive flag as described by its original author, Ryan:

"The permissive flag was added to the PCI Backend to disable the PCI Backend's "read-only by default" stance to allow devices in driver domains to write to registers within a device's configuration space. This flag was global for all devices controlled by the PCI Backend in all domains. This patch removes the global flag and instead adds a per-device flag. Permissive mode for a particular device can be enabled by writing the device's slot number to a sysfs attribute (/sys/bus/pci/drivers/pciback/permissive). That sysfs node can also be read to list all devices for which permissive mode is enabled. However, once enabled, this patch provides no interface to turn permissive mode off for a device. Please unbind the device from the backend and re-bind it if you need that capability for now."

NB: This patch provides a feature that is independent of preceding patch, however because the two affect the same areas it is important to either apply patch 1/5 first (if you want both patches) OR manually extract and apply the changes from this patch (if you want just the per-device patch).

linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c +1 -4
diff -r 46eb52cd64e3 linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c
@@ -14,9 +14,6 @@
 #include "pciback.h"
 #include "conf_space.h"
 #include "conf_space_quirks.h"
-
-static int permissive = 0;
-module_param(permissive, bool, 0644);
 
 #define DEFINE_PCI_CONFIG(op,size,type) 			\
 int pciback_##op##_config_##size 				\
@@ -258,7 +255,7 @@ int pciback_config_write(struct pci_dev 
 		 * This means that some fields may still be read-only because
 		 * they have entries in the config_field list that intercept
 		 * the write and do nothing. */
-		if (permissive) {
+		if (dev_data->permissive) {
 			switch (size) {
 			case 1:
 				err = pci_write_config_byte(dev, offset,
linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c +68 -0

86 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h +1 -0
diff -r 46eb52cd64e3 linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h
@@ -44,6 +44,7 @@ struct pciback_device {
 
 struct pciback_dev_data {
 	struct list_head config_fields;
+	int permissive;
 	int warned_on_write;
 };
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel