1 |
Author: mpagano |
2 |
Date: 2012-03-01 00:10:15 +0000 (Thu, 01 Mar 2012) |
3 |
New Revision: 2098 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.2/2300_per-pci-device-msi-irq-listing.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.2/0000_README |
9 |
Log: |
10 |
Add a per-pci-device subdirectory in sysfs. Gentoo bug #405357 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.2/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.2/0000_README 2012-02-27 23:49:12 UTC (rev 2097) |
15 |
+++ genpatches-2.6/trunk/3.2/0000_README 2012-03-01 00:10:15 UTC (rev 2098) |
16 |
@@ -72,6 +72,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.2.8 |
19 |
|
20 |
+Patch: 2300_per-pci-device-msi-irq-listing.patch |
21 |
+From: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=da8d1c8ba4dcb16d60be54b233deca9a7cac98dc |
22 |
+Desc: Add a per-pci-device subdirectory in sysfs |
23 |
+ |
24 |
Patch: 2400_kcopy-patch-for-infiniband-driver.patch |
25 |
From: Alexey Shvetsov <alexxy@g.o> |
26 |
Desc: Zero copy for infiniband psm userspace driver |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.2/2300_per-pci-device-msi-irq-listing.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.2/2300_per-pci-device-msi-irq-listing.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.2/2300_per-pci-device-msi-irq-listing.patch 2012-03-01 00:10:15 UTC (rev 2098) |
32 |
@@ -0,0 +1,211 @@ |
33 |
+--- a/Documentation/ABI/testing/sysfs-bus-pci 2012-01-05 01:55:44.000000000 +0200 |
34 |
++++ b/Documentation/ABI/testing/sysfs-bus-pci 2012-02-03 13:32:19.188582988 +0200 |
35 |
+@@ -66,6 +66,24 @@ Description: |
36 |
+ re-discover previously removed devices. |
37 |
+ Depends on CONFIG_HOTPLUG. |
38 |
+ |
39 |
++What: /sys/bus/pci/devices/.../msi_irqs/ |
40 |
++Date: September, 2011 |
41 |
++Contact: Neil Horman <nhorman@×××××××××.com> |
42 |
++Description: |
43 |
++ The /sys/devices/.../msi_irqs directory contains a variable set |
44 |
++ of sub-directories, with each sub-directory being named after a |
45 |
++ corresponding msi irq vector allocated to that device. Each |
46 |
++ numbered sub-directory N contains attributes of that irq. |
47 |
++ Note that this directory is not created for device drivers which |
48 |
++ do not support msi irqs |
49 |
++ |
50 |
++What: /sys/bus/pci/devices/.../msi_irqs/<N>/mode |
51 |
++Date: September 2011 |
52 |
++Contact: Neil Horman <nhorman@×××××××××.com> |
53 |
++Description: |
54 |
++ This attribute indicates the mode that the irq vector named by |
55 |
++ the parent directory is in (msi vs. msix) |
56 |
++ |
57 |
+ What: /sys/bus/pci/devices/.../remove |
58 |
+ Date: January 2009 |
59 |
+ Contact: Linux PCI developers <linux-pci@×××××××××××.org> |
60 |
+--- a/drivers/pci/msi.c 2012-02-02 00:33:14.568582984 +0200 |
61 |
++++ b/drivers/pci/msi.c 2012-02-03 13:32:19.196582978 +0200 |
62 |
+@@ -323,6 +323,8 @@ static void free_msi_irqs(struct pci_dev |
63 |
+ if (list_is_last(&entry->list, &dev->msi_list)) |
64 |
+ iounmap(entry->mask_base); |
65 |
+ } |
66 |
++ kobject_del(&entry->kobj); |
67 |
++ kobject_put(&entry->kobj); |
68 |
+ list_del(&entry->list); |
69 |
+ kfree(entry); |
70 |
+ } |
71 |
+@@ -403,6 +405,98 @@ void pci_restore_msi_state(struct pci_de |
72 |
+ } |
73 |
+ EXPORT_SYMBOL_GPL(pci_restore_msi_state); |
74 |
+ |
75 |
++ |
76 |
++#define to_msi_attr(obj) container_of(obj, struct msi_attribute, attr) |
77 |
++#define to_msi_desc(obj) container_of(obj, struct msi_desc, kobj) |
78 |
++ |
79 |
++struct msi_attribute { |
80 |
++ struct attribute attr; |
81 |
++ ssize_t (*show)(struct msi_desc *entry, struct msi_attribute *attr, |
82 |
++ char *buf); |
83 |
++ ssize_t (*store)(struct msi_desc *entry, struct msi_attribute *attr, |
84 |
++ const char *buf, size_t count); |
85 |
++}; |
86 |
++ |
87 |
++static ssize_t show_msi_mode(struct msi_desc *entry, struct msi_attribute *atr, |
88 |
++ char *buf) |
89 |
++{ |
90 |
++ return sprintf(buf, "%s\n", entry->msi_attrib.is_msix ? "msix" : "msi"); |
91 |
++} |
92 |
++ |
93 |
++static ssize_t msi_irq_attr_show(struct kobject *kobj, |
94 |
++ struct attribute *attr, char *buf) |
95 |
++{ |
96 |
++ struct msi_attribute *attribute = to_msi_attr(attr); |
97 |
++ struct msi_desc *entry = to_msi_desc(kobj); |
98 |
++ |
99 |
++ if (!attribute->show) |
100 |
++ return -EIO; |
101 |
++ |
102 |
++ return attribute->show(entry, attribute, buf); |
103 |
++} |
104 |
++ |
105 |
++static const struct sysfs_ops msi_irq_sysfs_ops = { |
106 |
++ .show = msi_irq_attr_show, |
107 |
++}; |
108 |
++ |
109 |
++static struct msi_attribute mode_attribute = |
110 |
++ __ATTR(mode, S_IRUGO, show_msi_mode, NULL); |
111 |
++ |
112 |
++ |
113 |
++struct attribute *msi_irq_default_attrs[] = { |
114 |
++ &mode_attribute.attr, |
115 |
++ NULL |
116 |
++}; |
117 |
++ |
118 |
++void msi_kobj_release(struct kobject *kobj) |
119 |
++{ |
120 |
++ struct msi_desc *entry = to_msi_desc(kobj); |
121 |
++ |
122 |
++ pci_dev_put(entry->dev); |
123 |
++} |
124 |
++ |
125 |
++static struct kobj_type msi_irq_ktype = { |
126 |
++ .release = msi_kobj_release, |
127 |
++ .sysfs_ops = &msi_irq_sysfs_ops, |
128 |
++ .default_attrs = msi_irq_default_attrs, |
129 |
++}; |
130 |
++ |
131 |
++static int populate_msi_sysfs(struct pci_dev *pdev) |
132 |
++{ |
133 |
++ struct msi_desc *entry; |
134 |
++ struct kobject *kobj; |
135 |
++ int ret; |
136 |
++ int count = 0; |
137 |
++ |
138 |
++ pdev->msi_kset = kset_create_and_add("msi_irqs", NULL, &pdev->dev.kobj); |
139 |
++ if (!pdev->msi_kset) |
140 |
++ return -ENOMEM; |
141 |
++ |
142 |
++ list_for_each_entry(entry, &pdev->msi_list, list) { |
143 |
++ kobj = &entry->kobj; |
144 |
++ kobj->kset = pdev->msi_kset; |
145 |
++ pci_dev_get(pdev); |
146 |
++ ret = kobject_init_and_add(kobj, &msi_irq_ktype, NULL, |
147 |
++ "%u", entry->irq); |
148 |
++ if (ret) |
149 |
++ goto out_unroll; |
150 |
++ |
151 |
++ count++; |
152 |
++ } |
153 |
++ |
154 |
++ return 0; |
155 |
++ |
156 |
++out_unroll: |
157 |
++ list_for_each_entry(entry, &pdev->msi_list, list) { |
158 |
++ if (!count) |
159 |
++ break; |
160 |
++ kobject_del(&entry->kobj); |
161 |
++ kobject_put(&entry->kobj); |
162 |
++ count--; |
163 |
++ } |
164 |
++ return ret; |
165 |
++} |
166 |
++ |
167 |
+ /** |
168 |
+ * msi_capability_init - configure device's MSI capability structure |
169 |
+ * @dev: pointer to the pci_dev data structure of MSI device function |
170 |
+@@ -454,6 +548,13 @@ static int msi_capability_init(struct pc |
171 |
+ return ret; |
172 |
+ } |
173 |
+ |
174 |
++ ret = populate_msi_sysfs(dev); |
175 |
++ if (ret) { |
176 |
++ msi_mask_irq(entry, mask, ~mask); |
177 |
++ free_msi_irqs(dev); |
178 |
++ return ret; |
179 |
++ } |
180 |
++ |
181 |
+ /* Set MSI enabled bits */ |
182 |
+ pci_intx_for_msi(dev, 0); |
183 |
+ msi_set_enable(dev, pos, 1); |
184 |
+@@ -574,6 +675,12 @@ static int msix_capability_init(struct p |
185 |
+ |
186 |
+ msix_program_entries(dev, entries); |
187 |
+ |
188 |
++ ret = populate_msi_sysfs(dev); |
189 |
++ if (ret) { |
190 |
++ ret = 0; |
191 |
++ goto error; |
192 |
++ } |
193 |
++ |
194 |
+ /* Set MSI-X enabled bits and unmask the function */ |
195 |
+ pci_intx_for_msi(dev, 0); |
196 |
+ dev->msix_enabled = 1; |
197 |
+@@ -732,6 +839,8 @@ void pci_disable_msi(struct pci_dev *dev |
198 |
+ |
199 |
+ pci_msi_shutdown(dev); |
200 |
+ free_msi_irqs(dev); |
201 |
++ kset_unregister(dev->msi_kset); |
202 |
++ dev->msi_kset = NULL; |
203 |
+ } |
204 |
+ EXPORT_SYMBOL(pci_disable_msi); |
205 |
+ |
206 |
+@@ -830,6 +939,8 @@ void pci_disable_msix(struct pci_dev *de |
207 |
+ |
208 |
+ pci_msix_shutdown(dev); |
209 |
+ free_msi_irqs(dev); |
210 |
++ kset_unregister(dev->msi_kset); |
211 |
++ dev->msi_kset = NULL; |
212 |
+ } |
213 |
+ EXPORT_SYMBOL(pci_disable_msix); |
214 |
+ |
215 |
+--- a/include/linux/msi.h 2012-01-05 01:55:44.000000000 +0200 |
216 |
++++ b/include/linux/msi.h 2012-02-03 13:32:19.196582978 +0200 |
217 |
+@@ -1,6 +1,7 @@ |
218 |
+ #ifndef LINUX_MSI_H |
219 |
+ #define LINUX_MSI_H |
220 |
+ |
221 |
++#include <linux/kobject.h> |
222 |
+ #include <linux/list.h> |
223 |
+ |
224 |
+ struct msi_msg { |
225 |
+@@ -44,6 +45,8 @@ struct msi_desc { |
226 |
+ |
227 |
+ /* Last set MSI message */ |
228 |
+ struct msi_msg msg; |
229 |
++ |
230 |
++ struct kobject kobj; |
231 |
+ }; |
232 |
+ |
233 |
+ /* |
234 |
+--- a/include/linux/pci.h 2012-01-05 01:55:44.000000000 +0200 |
235 |
++++ b/include/linux/pci.h 2012-02-03 13:32:19.196582978 +0200 |
236 |
+@@ -336,6 +336,7 @@ struct pci_dev { |
237 |
+ struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ |
238 |
+ #ifdef CONFIG_PCI_MSI |
239 |
+ struct list_head msi_list; |
240 |
++ struct kset *msi_kset; |
241 |
+ #endif |
242 |
+ struct pci_vpd *vpd; |
243 |
+ #ifdef CONFIG_PCI_ATS |