Skip to contentSkip to conversation

pciback: user-space PCI quirks

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

lore
Share & tools
lore

Chris

author
#0 lore raw

PATCH 1/5 pciback: user-space PCI quirks

This patch, in combination with the a following patch to xend, allows per-device configuration for fine-grained control over PCI configuration space writes, with a goal that was also previously described by Ryan:

"Permissive mode should only be used as a fall back for unknown devices. I think the correct solution for dealing with these device-specific configuration space registers is to identify them and add the device-specific fields to the overlay. This patch adds a special configuration space handler for network cards based on the tg3 linux network device driver. This handler should allow for reads/writes to all of the configuration space registers that the tg3 driver requires."

This patch attempts to address concerns with Ryan's original submission by moving policy from the dom0 kernel into dom0 user-space. As new quirky devices emerge they can be incorporated into the user-space policy. An added benefit is that changes to the policy are effective for domains created after the changes are written (no need rebuild the hypervisor or restart xend).

linux-2.6-xen-sparse/drivers/xen/pciback/Makefile +2 -1
diff -r b20580cf7fc1 -r 94a0a82c91d1 linux-2.6-xen-sparse/drivers/xen/pciback/Makefile
@@ -4,7 +4,8 @@ pciback-y += conf_space.o conf_space_hea
 pciback-y += conf_space.o conf_space_header.o \
 	     conf_space_capability.o \
 	     conf_space_capability_vpd.o \
-	     conf_space_capability_pm.o
+	     conf_space_capability_pm.o \
+             conf_space_quirks.o
 pciback-$(CONFIG_XEN_PCIDEV_BACKEND_VPCI) += vpci.o
 pciback-$(CONFIG_XEN_PCIDEV_BACKEND_PASS) += passthrough.o
 
linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c +48 -23

118 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.h +7 -4
diff -r b20580cf7fc1 -r 94a0a82c91d1 linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.h
@@ -33,11 +33,13 @@ typedef int (*conf_byte_read) (struct pc
  * values.
  */
 struct config_field {
-	unsigned int     offset;
-	unsigned int     size;
-	conf_field_init  init;
+	unsigned int offset;
+	unsigned int size;
+	unsigned int mask;
+	conf_field_init init;
 	conf_field_reset reset;
-	conf_field_free  release;
+	conf_field_free release;
+	void (*clean) (struct config_field * field);
 	union {
 		struct {
 			conf_dword_write write;
@@ -52,6 +54,7 @@ struct config_field {
 			conf_byte_read read;
 		} b;
 	} u;
+	struct list_head list;
 };
 
 struct config_field_entry {
linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c +155 -1

228 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h +1 -0
diff -r b20580cf7fc1 -r 94a0a82c91d1 linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h
@@ -61,6 +61,7 @@ void pciback_reset_device(struct pci_dev
 /* Access a virtual configuration space for a PCI device */
 int pciback_config_init(void);
 int pciback_config_init_dev(struct pci_dev *dev);
+void pciback_config_free_dyn_fields(struct pci_dev *dev);
 void pciback_config_reset_dev(struct pci_dev *dev);
 void pciback_config_free_dev(struct pci_dev *dev);
 int pciback_config_read(struct pci_dev *dev, int offset, int size,
linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_quirks.c new file +128 -0

128 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_quirks.h new file +35 -0
diff -r b20580cf7fc1 -r 94a0a82c91d1 linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_quirks.h
@@ -0,0 +1,35 @@
+/*
+ * PCI Backend - Data structures for special overlays for broken devices.
+ *
+ * Ryan Wilson <[email protected]>
+ * Chris Bookholt <[email protected]>
+ */
+
+#ifndef __XEN_PCIBACK_CONF_SPACE_QUIRKS_H__
+#define __XEN_PCIBACK_CONF_SPACE_QUIRKS_H__
+
+#include <linux/pci.h>
+#include <linux/list.h>
+
+struct pciback_config_quirk {
+	struct list_head quirks_list;
+	struct pci_device_id devid;
+	struct pci_dev *pdev;
+};
+
+struct pciback_config_quirk *pciback_find_quirk(struct pci_dev *dev);
+
+int pciback_config_quirks_add_field(struct pci_dev *dev, struct config_field
+				    *field);
+
+int pciback_config_quirks_remove_field(struct pci_dev *dev, int reg);
+
+int pciback_config_quirks_init(struct pci_dev *dev);
+
+void pciback_config_field_free(struct config_field *field);
+
+int pciback_config_quirk_release(struct pci_dev *dev);
+
+int pciback_field_is_dup(struct pci_dev *dev, int reg);
+
+#endif

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