aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/xen/xen-pciback/conf_space.c1
-rw-r--r--drivers/xen/xen-pciback/conf_space_header.c3
-rw-r--r--drivers/xen/xen-pciback/conf_space_quirks.c3
-rw-r--r--drivers/xen/xen-pciback/passthrough.c2
-rw-r--r--drivers/xen/xen-pciback/pci_stub.c34
-rw-r--r--drivers/xen/xen-pciback/pciback.h30
-rw-r--r--drivers/xen/xen-pciback/pciback_ops.c1
-rw-r--r--drivers/xen/xen-pciback/vpci.c9
-rw-r--r--drivers/xen/xen-pciback/xenbus.c5
9 files changed, 44 insertions, 44 deletions
diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c
index a8031445d94e..444345afbd5c 100644
--- a/drivers/xen/xen-pciback/conf_space.c
+++ b/drivers/xen/xen-pciback/conf_space.c
@@ -15,7 +15,6 @@
15#include "conf_space.h" 15#include "conf_space.h"
16#include "conf_space_quirks.h" 16#include "conf_space_quirks.h"
17 17
18#define DRV_NAME "xen-pciback"
19static int permissive; 18static int permissive;
20module_param(permissive, bool, 0644); 19module_param(permissive, bool, 0644);
21 20
diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c
index f14b30f71464..3daf862d739d 100644
--- a/drivers/xen/xen-pciback/conf_space_header.c
+++ b/drivers/xen/xen-pciback/conf_space_header.c
@@ -15,7 +15,6 @@ struct pci_bar_info {
15 int which; 15 int which;
16}; 16};
17 17
18#define DRV_NAME "xen-pciback"
19#define is_enable_cmd(value) ((value)&(PCI_COMMAND_MEMORY|PCI_COMMAND_IO)) 18#define is_enable_cmd(value) ((value)&(PCI_COMMAND_MEMORY|PCI_COMMAND_IO))
20#define is_master_cmd(value) ((value)&PCI_COMMAND_MASTER) 19#define is_master_cmd(value) ((value)&PCI_COMMAND_MASTER)
21 20
@@ -25,7 +24,7 @@ static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data)
25 int ret; 24 int ret;
26 25
27 ret = xen_pcibk_read_config_word(dev, offset, value, data); 26 ret = xen_pcibk_read_config_word(dev, offset, value, data);
28 if (!atomic_read(&dev->enable_cnt)) 27 if (!pci_is_enabled(dev))
29 return ret; 28 return ret;
30 29
31 for (i = 0; i < PCI_ROM_RESOURCE; i++) { 30 for (i = 0; i < PCI_ROM_RESOURCE; i++) {
diff --git a/drivers/xen/xen-pciback/conf_space_quirks.c b/drivers/xen/xen-pciback/conf_space_quirks.c
index 921a889e65eb..7476791cab40 100644
--- a/drivers/xen/xen-pciback/conf_space_quirks.c
+++ b/drivers/xen/xen-pciback/conf_space_quirks.c
@@ -12,7 +12,6 @@
12#include "conf_space_quirks.h" 12#include "conf_space_quirks.h"
13 13
14LIST_HEAD(xen_pcibk_quirks); 14LIST_HEAD(xen_pcibk_quirks);
15#define DRV_NAME "xen-pciback"
16static inline const struct pci_device_id * 15static inline const struct pci_device_id *
17match_one_device(const struct pci_device_id *id, const struct pci_dev *dev) 16match_one_device(const struct pci_device_id *id, const struct pci_dev *dev)
18{ 17{
@@ -36,7 +35,7 @@ static struct xen_pcibk_config_quirk *xen_pcibk_find_quirk(struct pci_dev *dev)
36 goto out; 35 goto out;
37 tmp_quirk = NULL; 36 tmp_quirk = NULL;
38 printk(KERN_DEBUG DRV_NAME 37 printk(KERN_DEBUG DRV_NAME
39 ":quirk didn't match any device xen_pciback knows about\n"); 38 ": quirk didn't match any device known\n");
40out: 39out:
41 return tmp_quirk; 40 return tmp_quirk;
42} 41}
diff --git a/drivers/xen/xen-pciback/passthrough.c b/drivers/xen/xen-pciback/passthrough.c
index e01e4b6ef267..828dddc360df 100644
--- a/drivers/xen/xen-pciback/passthrough.c
+++ b/drivers/xen/xen-pciback/passthrough.c
@@ -176,7 +176,7 @@ static int __xen_pcibk_get_pcifront_dev(struct pci_dev *pcidev,
176 return 1; 176 return 1;
177} 177}
178 178
179struct xen_pcibk_backend xen_pcibk_passthrough_backend = { 179const struct xen_pcibk_backend xen_pcibk_passthrough_backend = {
180 .name = "passthrough", 180 .name = "passthrough",
181 .init = __xen_pcibk_init_devices, 181 .init = __xen_pcibk_init_devices,
182 .free = __xen_pcibk_release_devices, 182 .free = __xen_pcibk_release_devices,
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index aec214ac0a14..1b474804180a 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -21,8 +21,6 @@
21#include "conf_space.h" 21#include "conf_space.h"
22#include "conf_space_quirks.h" 22#include "conf_space_quirks.h"
23 23
24#define DRV_NAME "xen-pciback"
25
26static char *pci_devs_to_hide; 24static char *pci_devs_to_hide;
27wait_queue_head_t xen_pcibk_aer_wait_queue; 25wait_queue_head_t xen_pcibk_aer_wait_queue;
28/*Add sem for sync AER handling and xen_pcibk remove/reconfigue ops, 26/*Add sem for sync AER handling and xen_pcibk remove/reconfigue ops,
@@ -514,12 +512,14 @@ static void kill_domain_by_device(struct pcistub_device *psdev)
514 int err; 512 int err;
515 char nodename[PCI_NODENAME_MAX]; 513 char nodename[PCI_NODENAME_MAX];
516 514
517 if (!psdev) 515 if (!psdev) {
518 dev_err(&psdev->dev->dev, 516 dev_err(&psdev->dev->dev,
519 "device is NULL when do AER recovery/kill_domain\n"); 517 "device is NULL when do AER recovery/kill_domain\n");
518 return;
519 }
520
520 snprintf(nodename, PCI_NODENAME_MAX, "/local/domain/0/backend/pci/%d/0", 521 snprintf(nodename, PCI_NODENAME_MAX, "/local/domain/0/backend/pci/%d/0",
521 psdev->pdev->xdev->otherend_id); 522 psdev->pdev->xdev->otherend_id);
522 nodename[strlen(nodename)] = '\0';
523 523
524again: 524again:
525 err = xenbus_transaction_start(&xbt); 525 err = xenbus_transaction_start(&xbt);
@@ -605,7 +605,7 @@ static pci_ers_result_t common_process(struct pcistub_device *psdev,
605 if (test_bit(_XEN_PCIF_active, 605 if (test_bit(_XEN_PCIF_active,
606 (unsigned long *)&psdev->pdev->sh_info->flags)) { 606 (unsigned long *)&psdev->pdev->sh_info->flags)) {
607 dev_dbg(&psdev->dev->dev, 607 dev_dbg(&psdev->dev->dev,
608 "schedule pci_conf service in xen_pcibk\n"); 608 "schedule pci_conf service in " DRV_NAME "\n");
609 xen_pcibk_test_and_schedule_op(psdev->pdev); 609 xen_pcibk_test_and_schedule_op(psdev->pdev);
610 } 610 }
611 611
@@ -995,8 +995,7 @@ out:
995 err = count; 995 err = count;
996 return err; 996 return err;
997} 997}
998 998static DRIVER_ATTR(new_slot, S_IWUSR, NULL, pcistub_slot_add);
999DRIVER_ATTR(new_slot, S_IWUSR, NULL, pcistub_slot_add);
1000 999
1001static ssize_t pcistub_slot_remove(struct device_driver *drv, const char *buf, 1000static ssize_t pcistub_slot_remove(struct device_driver *drv, const char *buf,
1002 size_t count) 1001 size_t count)
@@ -1015,8 +1014,7 @@ out:
1015 err = count; 1014 err = count;
1016 return err; 1015 return err;
1017} 1016}
1018 1017static DRIVER_ATTR(remove_slot, S_IWUSR, NULL, pcistub_slot_remove);
1019DRIVER_ATTR(remove_slot, S_IWUSR, NULL, pcistub_slot_remove);
1020 1018
1021static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf) 1019static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf)
1022{ 1020{
@@ -1039,8 +1037,7 @@ static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf)
1039 1037
1040 return count; 1038 return count;
1041} 1039}
1042 1040static DRIVER_ATTR(slots, S_IRUSR, pcistub_slot_show, NULL);
1043DRIVER_ATTR(slots, S_IRUSR, pcistub_slot_show, NULL);
1044 1041
1045static ssize_t pcistub_irq_handler_show(struct device_driver *drv, char *buf) 1042static ssize_t pcistub_irq_handler_show(struct device_driver *drv, char *buf)
1046{ 1043{
@@ -1069,8 +1066,7 @@ static ssize_t pcistub_irq_handler_show(struct device_driver *drv, char *buf)
1069 spin_unlock_irqrestore(&pcistub_devices_lock, flags); 1066 spin_unlock_irqrestore(&pcistub_devices_lock, flags);
1070 return count; 1067 return count;
1071} 1068}
1072 1069static DRIVER_ATTR(irq_handlers, S_IRUSR, pcistub_irq_handler_show, NULL);
1073DRIVER_ATTR(irq_handlers, S_IRUSR, pcistub_irq_handler_show, NULL);
1074 1070
1075static ssize_t pcistub_irq_handler_switch(struct device_driver *drv, 1071static ssize_t pcistub_irq_handler_switch(struct device_driver *drv,
1076 const char *buf, 1072 const char *buf,
@@ -1106,7 +1102,8 @@ out:
1106 err = count; 1102 err = count;
1107 return err; 1103 return err;
1108} 1104}
1109DRIVER_ATTR(irq_handler_state, S_IWUSR, NULL, pcistub_irq_handler_switch); 1105static DRIVER_ATTR(irq_handler_state, S_IWUSR, NULL,
1106 pcistub_irq_handler_switch);
1110 1107
1111static ssize_t pcistub_quirk_add(struct device_driver *drv, const char *buf, 1108static ssize_t pcistub_quirk_add(struct device_driver *drv, const char *buf,
1112 size_t count) 1109 size_t count)
@@ -1170,8 +1167,8 @@ out:
1170 1167
1171 return count; 1168 return count;
1172} 1169}
1173 1170static DRIVER_ATTR(quirks, S_IRUSR | S_IWUSR, pcistub_quirk_show,
1174DRIVER_ATTR(quirks, S_IRUSR | S_IWUSR, pcistub_quirk_show, pcistub_quirk_add); 1171 pcistub_quirk_add);
1175 1172
1176static ssize_t permissive_add(struct device_driver *drv, const char *buf, 1173static ssize_t permissive_add(struct device_driver *drv, const char *buf,
1177 size_t count) 1174 size_t count)
@@ -1236,8 +1233,8 @@ static ssize_t permissive_show(struct device_driver *drv, char *buf)
1236 spin_unlock_irqrestore(&pcistub_devices_lock, flags); 1233 spin_unlock_irqrestore(&pcistub_devices_lock, flags);
1237 return count; 1234 return count;
1238} 1235}
1239 1236static DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show,
1240DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show, permissive_add); 1237 permissive_add);
1241 1238
1242static void pcistub_exit(void) 1239static void pcistub_exit(void)
1243{ 1240{
@@ -1374,3 +1371,4 @@ module_init(xen_pcibk_init);
1374module_exit(xen_pcibk_cleanup); 1371module_exit(xen_pcibk_cleanup);
1375 1372
1376MODULE_LICENSE("Dual BSD/GPL"); 1373MODULE_LICENSE("Dual BSD/GPL");
1374MODULE_ALIAS("xen-backend:pci");
diff --git a/drivers/xen/xen-pciback/pciback.h b/drivers/xen/xen-pciback/pciback.h
index a0e131a81503..d095acdc0e65 100644
--- a/drivers/xen/xen-pciback/pciback.h
+++ b/drivers/xen/xen-pciback/pciback.h
@@ -15,6 +15,8 @@
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <xen/interface/io/pciif.h> 16#include <xen/interface/io/pciif.h>
17 17
18#define DRV_NAME "xen-pciback"
19
18struct pci_dev_entry { 20struct pci_dev_entry {
19 struct list_head list; 21 struct list_head list;
20 struct pci_dev *dev; 22 struct pci_dev *dev;
@@ -89,7 +91,7 @@ typedef int (*publish_pci_root_cb) (struct xen_pcibk_device *pdev,
89 * passthrough - BDFs are exactly like in the host. 91 * passthrough - BDFs are exactly like in the host.
90 */ 92 */
91struct xen_pcibk_backend { 93struct xen_pcibk_backend {
92 char *name; 94 const char *name;
93 int (*init)(struct xen_pcibk_device *pdev); 95 int (*init)(struct xen_pcibk_device *pdev);
94 void (*free)(struct xen_pcibk_device *pdev); 96 void (*free)(struct xen_pcibk_device *pdev);
95 int (*find)(struct pci_dev *pcidev, struct xen_pcibk_device *pdev, 97 int (*find)(struct pci_dev *pcidev, struct xen_pcibk_device *pdev,
@@ -104,9 +106,9 @@ struct xen_pcibk_backend {
104 unsigned int devfn); 106 unsigned int devfn);
105}; 107};
106 108
107extern struct xen_pcibk_backend xen_pcibk_vpci_backend; 109extern const struct xen_pcibk_backend xen_pcibk_vpci_backend;
108extern struct xen_pcibk_backend xen_pcibk_passthrough_backend; 110extern const struct xen_pcibk_backend xen_pcibk_passthrough_backend;
109extern struct xen_pcibk_backend *xen_pcibk_backend; 111extern const struct xen_pcibk_backend *xen_pcibk_backend;
110 112
111static inline int xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, 113static inline int xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
112 struct pci_dev *dev, 114 struct pci_dev *dev,
@@ -116,13 +118,14 @@ static inline int xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
116 if (xen_pcibk_backend && xen_pcibk_backend->add) 118 if (xen_pcibk_backend && xen_pcibk_backend->add)
117 return xen_pcibk_backend->add(pdev, dev, devid, publish_cb); 119 return xen_pcibk_backend->add(pdev, dev, devid, publish_cb);
118 return -1; 120 return -1;
119}; 121}
122
120static inline void xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev, 123static inline void xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev,
121 struct pci_dev *dev) 124 struct pci_dev *dev)
122{ 125{
123 if (xen_pcibk_backend && xen_pcibk_backend->free) 126 if (xen_pcibk_backend && xen_pcibk_backend->free)
124 return xen_pcibk_backend->release(pdev, dev); 127 return xen_pcibk_backend->release(pdev, dev);
125}; 128}
126 129
127static inline struct pci_dev * 130static inline struct pci_dev *
128xen_pcibk_get_pci_dev(struct xen_pcibk_device *pdev, unsigned int domain, 131xen_pcibk_get_pci_dev(struct xen_pcibk_device *pdev, unsigned int domain,
@@ -131,7 +134,8 @@ xen_pcibk_get_pci_dev(struct xen_pcibk_device *pdev, unsigned int domain,
131 if (xen_pcibk_backend && xen_pcibk_backend->get) 134 if (xen_pcibk_backend && xen_pcibk_backend->get)
132 return xen_pcibk_backend->get(pdev, domain, bus, devfn); 135 return xen_pcibk_backend->get(pdev, domain, bus, devfn);
133 return NULL; 136 return NULL;
134}; 137}
138
135/** 139/**
136* Add for domain0 PCIE-AER handling. Get guest domain/bus/devfn in xen_pcibk 140* Add for domain0 PCIE-AER handling. Get guest domain/bus/devfn in xen_pcibk
137* before sending aer request to pcifront, so that guest could identify 141* before sending aer request to pcifront, so that guest could identify
@@ -148,25 +152,29 @@ static inline int xen_pcibk_get_pcifront_dev(struct pci_dev *pcidev,
148 return xen_pcibk_backend->find(pcidev, pdev, domain, bus, 152 return xen_pcibk_backend->find(pcidev, pdev, domain, bus,
149 devfn); 153 devfn);
150 return -1; 154 return -1;
151}; 155}
156
152static inline int xen_pcibk_init_devices(struct xen_pcibk_device *pdev) 157static inline int xen_pcibk_init_devices(struct xen_pcibk_device *pdev)
153{ 158{
154 if (xen_pcibk_backend && xen_pcibk_backend->init) 159 if (xen_pcibk_backend && xen_pcibk_backend->init)
155 return xen_pcibk_backend->init(pdev); 160 return xen_pcibk_backend->init(pdev);
156 return -1; 161 return -1;
157}; 162}
163
158static inline int xen_pcibk_publish_pci_roots(struct xen_pcibk_device *pdev, 164static inline int xen_pcibk_publish_pci_roots(struct xen_pcibk_device *pdev,
159 publish_pci_root_cb cb) 165 publish_pci_root_cb cb)
160{ 166{
161 if (xen_pcibk_backend && xen_pcibk_backend->publish) 167 if (xen_pcibk_backend && xen_pcibk_backend->publish)
162 return xen_pcibk_backend->publish(pdev, cb); 168 return xen_pcibk_backend->publish(pdev, cb);
163 return -1; 169 return -1;
164}; 170}
171
165static inline void xen_pcibk_release_devices(struct xen_pcibk_device *pdev) 172static inline void xen_pcibk_release_devices(struct xen_pcibk_device *pdev)
166{ 173{
167 if (xen_pcibk_backend && xen_pcibk_backend->free) 174 if (xen_pcibk_backend && xen_pcibk_backend->free)
168 return xen_pcibk_backend->free(pdev); 175 return xen_pcibk_backend->free(pdev);
169}; 176}
177
170/* Handles events from front-end */ 178/* Handles events from front-end */
171irqreturn_t xen_pcibk_handle_event(int irq, void *dev_id); 179irqreturn_t xen_pcibk_handle_event(int irq, void *dev_id);
172void xen_pcibk_do_op(struct work_struct *data); 180void xen_pcibk_do_op(struct work_struct *data);
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
index 8c95c3415b75..63616d7453e6 100644
--- a/drivers/xen/xen-pciback/pciback_ops.c
+++ b/drivers/xen/xen-pciback/pciback_ops.c
@@ -10,7 +10,6 @@
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include "pciback.h" 11#include "pciback.h"
12 12
13#define DRV_NAME "xen-pciback"
14int verbose_request; 13int verbose_request;
15module_param(verbose_request, int, 0644); 14module_param(verbose_request, int, 0644);
16 15
diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c
index 4a42cfb0959d..a7785525f253 100644
--- a/drivers/xen/xen-pciback/vpci.c
+++ b/drivers/xen/xen-pciback/vpci.c
@@ -12,7 +12,6 @@
12#include "pciback.h" 12#include "pciback.h"
13 13
14#define PCI_SLOT_MAX 32 14#define PCI_SLOT_MAX 32
15#define DRV_NAME "xen-pciback"
16 15
17struct vpci_dev_data { 16struct vpci_dev_data {
18 /* Access to dev_list must be protected by lock */ 17 /* Access to dev_list must be protected by lock */
@@ -150,9 +149,9 @@ static void __xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev,
150 spin_lock_irqsave(&vpci_dev->lock, flags); 149 spin_lock_irqsave(&vpci_dev->lock, flags);
151 150
152 for (slot = 0; slot < PCI_SLOT_MAX; slot++) { 151 for (slot = 0; slot < PCI_SLOT_MAX; slot++) {
153 struct pci_dev_entry *e, *tmp; 152 struct pci_dev_entry *e;
154 list_for_each_entry_safe(e, tmp, &vpci_dev->dev_list[slot], 153
155 list) { 154 list_for_each_entry(e, &vpci_dev->dev_list[slot], list) {
156 if (e->dev == dev) { 155 if (e->dev == dev) {
157 list_del(&e->list); 156 list_del(&e->list);
158 found_dev = e->dev; 157 found_dev = e->dev;
@@ -247,7 +246,7 @@ static int __xen_pcibk_get_pcifront_dev(struct pci_dev *pcidev,
247 return found; 246 return found;
248} 247}
249 248
250struct xen_pcibk_backend xen_pcibk_vpci_backend = { 249const struct xen_pcibk_backend xen_pcibk_vpci_backend = {
251 .name = "vpci", 250 .name = "vpci",
252 .init = __xen_pcibk_init_devices, 251 .init = __xen_pcibk_init_devices,
253 .free = __xen_pcibk_release_devices, 252 .free = __xen_pcibk_release_devices,
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 978d2c6f5dca..522f2daa96cc 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -13,7 +13,6 @@
13#include <asm/xen/pci.h> 13#include <asm/xen/pci.h>
14#include "pciback.h" 14#include "pciback.h"
15 15
16#define DRV_NAME "xen-pciback"
17#define INVALID_EVTCHN_IRQ (-1) 16#define INVALID_EVTCHN_IRQ (-1)
18struct workqueue_struct *xen_pcibk_wq; 17struct workqueue_struct *xen_pcibk_wq;
19 18
@@ -176,7 +175,7 @@ static int xen_pcibk_attach(struct xen_pcibk_device *pdev)
176 if (magic == NULL || strcmp(magic, XEN_PCI_MAGIC) != 0) { 175 if (magic == NULL || strcmp(magic, XEN_PCI_MAGIC) != 0) {
177 xenbus_dev_fatal(pdev->xdev, -EFAULT, 176 xenbus_dev_fatal(pdev->xdev, -EFAULT,
178 "version mismatch (%s/%s) with pcifront - " 177 "version mismatch (%s/%s) with pcifront - "
179 "halting xen_pcibk", 178 "halting " DRV_NAME,
180 magic, XEN_PCI_MAGIC); 179 magic, XEN_PCI_MAGIC);
181 goto out; 180 goto out;
182 } 181 }
@@ -724,7 +723,7 @@ static struct xenbus_driver xenbus_xen_pcibk_driver = {
724 .otherend_changed = xen_pcibk_frontend_changed, 723 .otherend_changed = xen_pcibk_frontend_changed,
725}; 724};
726 725
727struct xen_pcibk_backend *xen_pcibk_backend; 726const struct xen_pcibk_backend *__read_mostly xen_pcibk_backend;
728 727
729int __init xen_pcibk_xenbus_register(void) 728int __init xen_pcibk_xenbus_register(void)
730{ 729{