]>
Commit | Line | Data |
---|---|---|
4e52de75 FG |
1 | From: Alex Williamson <alex.williamson@redhat.com> |
2 | Subject: [PATCH 1/2] PCI: Reverse standard ACS vs device specific ACS enabling | |
3 | ||
4 | The original thought was that if a device implemented ACS, then surely | |
5 | we want to use that... well, it turns out that devices can make an ACS | |
6 | capability so broken that we still need to fall back to quirks. | |
7 | Reverse the order of ACS enabling to give quirks first shot at it. | |
8 | ||
9 | Signed-off-by: Alex Williamson <alex.williamson@redhat.com> | |
10 | --- | |
11 | drivers/pci/pci.c | 10 ++++------ | |
12 | drivers/pci/quirks.c | 6 ++++-- | |
13 | include/linux/pci.h | 7 +++++-- | |
14 | 3 files changed, 13 insertions(+), 10 deletions(-) | |
15 | ||
16 | diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c | |
17 | index 25e0327..c98c4e2 100644 | |
18 | --- a/drivers/pci/pci.c | |
19 | +++ b/drivers/pci/pci.c | |
20 | @@ -2548,7 +2548,7 @@ void pci_request_acs(void) | |
21 | * pci_std_enable_acs - enable ACS on devices using standard ACS capabilites | |
22 | * @dev: the PCI device | |
23 | */ | |
24 | -static int pci_std_enable_acs(struct pci_dev *dev) | |
25 | +static void pci_std_enable_acs(struct pci_dev *dev) | |
26 | { | |
27 | int pos; | |
28 | u16 cap; | |
29 | @@ -2556,7 +2556,7 @@ static int pci_std_enable_acs(struct pci_dev *dev) | |
30 | ||
31 | pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS); | |
32 | if (!pos) | |
33 | - return -ENODEV; | |
34 | + return; | |
35 | ||
36 | pci_read_config_word(dev, pos + PCI_ACS_CAP, &cap); | |
37 | pci_read_config_word(dev, pos + PCI_ACS_CTRL, &ctrl); | |
38 | @@ -2574,8 +2574,6 @@ static int pci_std_enable_acs(struct pci_dev *dev) | |
39 | ctrl |= (cap & PCI_ACS_UF); | |
40 | ||
41 | pci_write_config_word(dev, pos + PCI_ACS_CTRL, ctrl); | |
42 | - | |
43 | - return 0; | |
44 | } | |
45 | ||
46 | /** | |
47 | @@ -2585,10 +2585,10 @@ void pci_enable_acs(struct pci_dev *dev) | |
48 | if (!pci_acs_enable) | |
49 | return; | |
50 | ||
51 | - if (!pci_std_enable_acs(dev)) | |
52 | + if (!pci_dev_specific_enable_acs(dev)) | |
53 | return; | |
54 | ||
55 | - pci_dev_specific_enable_acs(dev); | |
56 | + pci_std_enable_acs(dev); | |
57 | } | |
58 | ||
59 | static bool pci_acs_flags_enabled(struct pci_dev *pdev, u16 acs_flags) | |
60 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c | |
61 | index 8e67802..701fad6 100644 | |
62 | --- a/drivers/pci/quirks.c | |
63 | +++ b/drivers/pci/quirks.c | |
64 | @@ -4224,7 +4224,7 @@ static const struct pci_dev_enable_acs { | |
65 | { 0 } | |
66 | }; | |
67 | ||
68 | -void pci_dev_specific_enable_acs(struct pci_dev *dev) | |
69 | +int pci_dev_specific_enable_acs(struct pci_dev *dev) | |
70 | { | |
71 | const struct pci_dev_enable_acs *i; | |
72 | int ret; | |
73 | @@ -4236,9 +4236,11 @@ void pci_dev_specific_enable_acs(struct pci_dev *dev) | |
74 | i->device == (u16)PCI_ANY_ID)) { | |
75 | ret = i->enable_acs(dev); | |
76 | if (ret >= 0) | |
77 | - return; | |
78 | + return ret; | |
79 | } | |
80 | } | |
81 | + | |
82 | + return -ENOTTY; | |
83 | } | |
84 | ||
85 | /* | |
86 | diff --git a/include/linux/pci.h b/include/linux/pci.h | |
87 | index 004b813..aaec79a 100644 | |
88 | --- a/include/linux/pci.h | |
89 | +++ b/include/linux/pci.h | |
90 | @@ -1657,7 +1657,7 @@ enum pci_fixup_pass { | |
91 | #ifdef CONFIG_PCI_QUIRKS | |
92 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | |
93 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); | |
94 | -void pci_dev_specific_enable_acs(struct pci_dev *dev); | |
95 | +int pci_dev_specific_enable_acs(struct pci_dev *dev); | |
96 | #else | |
97 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | |
98 | struct pci_dev *dev) { } | |
99 | @@ -1666,7 +1666,10 @@ static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, | |
100 | { | |
101 | return -ENOTTY; | |
102 | } | |
103 | -static inline void pci_dev_specific_enable_acs(struct pci_dev *dev) { } | |
104 | +static inline int pci_dev_specific_enable_acs(struct pci_dev *dev) | |
105 | +{ | |
106 | + return -ENOTTY; | |
107 | +} | |
108 | #endif | |
109 | ||
110 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |