* [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED
@ 2010-09-23 23:30 Bjorn Helgaas
2010-09-23 23:32 ` Bjorn Helgaas
2010-09-24 23:06 ` Bjorn Helgaas
0 siblings, 2 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2010-09-23 23:30 UTC (permalink / raw)
To: Venkatesh Pallipadi
Cc: Prarit Bhargava, fredlwm, Simon Arlott, x86, Clemens Ladisch,
linux-kernel, Marc Jones, Jordan Crouse, Ingo Molnar,
H. Peter Anvin, Thomas Gleixner
We often discover the HPET early, via the static ACPI HPET table, before
enumerating PCI devices. If the HPET is implemented as a PCI function,
we will discover it again during PCI device enumeration. We must make
sure we never move the PCI function out from under the driver.
Doing this for *any* PCI BAR that matches a previously discovered HPET
should be more generic than the previous ATI-specific quirk.
This is for a regression from 2.6.34, but the reporter has been unable
to test it yet.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=18482
Reported-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
arch/x86/kernel/quirks.c | 19 +++++++++++++++++++
arch/x86/pci/fixup.c | 28 ----------------------------
2 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 939b9e9..8acd667 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -507,6 +507,25 @@ static void force_disable_hpet_msi(struct pci_dev *unused)
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
force_disable_hpet_msi);
+static void mark_pci_hpet_fixed(struct pci_dev *dev)
+{
+ int i;
+
+ if (!hpet_address)
+ return;
+
+ for (i = 0; i < 6; i++) {
+ struct resource *res = &dev->resource[i];
+
+ if (resource_type(res) == IORESOURCE_MEM &&
+ res->start == hpet_address) {
+ dev_info(&dev->dev, "BAR %d: %pR is an HPET we found earlier; making it immovable\n",
+ i, res);
+ res->flags |= IORESOURCE_PCI_FIXED;
+ }
+ }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, mark_pci_hpet_fixed);
#endif
#if defined(CONFIG_PCI) && defined(CONFIG_NUMA)
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 6dd8955..08eba69 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -493,31 +493,3 @@ static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev)
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
pci_siemens_interrupt_controller);
-
-/*
- * SB600: Disable BAR1 on device 14.0 to avoid HPET resources from
- * confusing the PCI engine:
- */
-static void sb600_disable_hpet_bar(struct pci_dev *dev)
-{
- u8 val;
-
- /*
- * The SB600 and SB700 both share the same device
- * ID, but the PM register 0x55 does something different
- * for the SB700, so make sure we are dealing with the
- * SB600 before touching the bit:
- */
-
- pci_read_config_byte(dev, 0x08, &val);
-
- if (val < 0x2F) {
- outb(0x55, 0xCD6);
- val = inb(0xCD7);
-
- /* Set bit 7 in PM register 0x55 */
- outb(0x55, 0xCD6);
- outb(val | 0x80, 0xCD7);
- }
-}
-DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED
2010-09-23 23:30 [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED Bjorn Helgaas
@ 2010-09-23 23:32 ` Bjorn Helgaas
2010-09-24 23:06 ` Bjorn Helgaas
1 sibling, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2010-09-23 23:32 UTC (permalink / raw)
To: Venkatesh Pallipadi
Cc: Prarit Bhargava, fredlwm, Simon Arlott, x86, Clemens Ladisch,
linux-kernel, Marc Jones, Jordan Crouse, Ingo Molnar,
H. Peter Anvin, Thomas Gleixner
Sorry for the duplicate; I tried to include Frédéric's proper name,
but stg mail got horribly confused and made a mess of the cc: list.
This one should be better.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED
2010-09-23 23:30 [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED Bjorn Helgaas
2010-09-23 23:32 ` Bjorn Helgaas
@ 2010-09-24 23:06 ` Bjorn Helgaas
2010-09-24 23:59 ` Yinghai Lu
1 sibling, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2010-09-24 23:06 UTC (permalink / raw)
To: Venkatesh Pallipadi
Cc: Prarit Bhargava, fredlwm, Simon Arlott, x86, Clemens Ladisch,
linux-kernel, Marc Jones, Jordan Crouse, Ingo Molnar,
H. Peter Anvin, Thomas Gleixner, Yinghai Lu
Sorry Yinghai, I forgot to copy you on the initial post. Any
comments on this? If not, we should try to get it into linux-next
soon.
On Thursday, September 23, 2010 05:30:47 pm Bjorn Helgaas wrote:
>
> We often discover the HPET early, via the static ACPI HPET table, before
> enumerating PCI devices. If the HPET is implemented as a PCI function,
> we will discover it again during PCI device enumeration. We must make
> sure we never move the PCI function out from under the driver.
>
> Doing this for *any* PCI BAR that matches a previously discovered HPET
> should be more generic than the previous ATI-specific quirk.
>
> This is for a regression from 2.6.34, but the reporter has been unable
> to test it yet.
>
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=18482
> Reported-by: Simon Arlott <simon@fire.lp0.eu>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> ---
>
> arch/x86/kernel/quirks.c | 19 +++++++++++++++++++
> arch/x86/pci/fixup.c | 28 ----------------------------
> 2 files changed, 19 insertions(+), 28 deletions(-)
>
>
> diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
> index 939b9e9..8acd667 100644
> --- a/arch/x86/kernel/quirks.c
> +++ b/arch/x86/kernel/quirks.c
> @@ -507,6 +507,25 @@ static void force_disable_hpet_msi(struct pci_dev *unused)
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
> force_disable_hpet_msi);
>
> +static void mark_pci_hpet_fixed(struct pci_dev *dev)
> +{
> + int i;
> +
> + if (!hpet_address)
> + return;
> +
> + for (i = 0; i < 6; i++) {
> + struct resource *res = &dev->resource[i];
> +
> + if (resource_type(res) == IORESOURCE_MEM &&
> + res->start == hpet_address) {
> + dev_info(&dev->dev, "BAR %d: %pR is an HPET we found earlier; making it immovable\n",
> + i, res);
> + res->flags |= IORESOURCE_PCI_FIXED;
> + }
> + }
> +}
> +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, mark_pci_hpet_fixed);
> #endif
>
> #if defined(CONFIG_PCI) && defined(CONFIG_NUMA)
> diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
> index 6dd8955..08eba69 100644
> --- a/arch/x86/pci/fixup.c
> +++ b/arch/x86/pci/fixup.c
> @@ -493,31 +493,3 @@ static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev)
> }
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
> pci_siemens_interrupt_controller);
> -
> -/*
> - * SB600: Disable BAR1 on device 14.0 to avoid HPET resources from
> - * confusing the PCI engine:
> - */
> -static void sb600_disable_hpet_bar(struct pci_dev *dev)
> -{
> - u8 val;
> -
> - /*
> - * The SB600 and SB700 both share the same device
> - * ID, but the PM register 0x55 does something different
> - * for the SB700, so make sure we are dealing with the
> - * SB600 before touching the bit:
> - */
> -
> - pci_read_config_byte(dev, 0x08, &val);
> -
> - if (val < 0x2F) {
> - outb(0x55, 0xCD6);
> - val = inb(0xCD7);
> -
> - /* Set bit 7 in PM register 0x55 */
> - outb(0x55, 0xCD6);
> - outb(val | 0x80, 0xCD7);
> - }
> -}
> -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar);
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED
2010-09-24 23:06 ` Bjorn Helgaas
@ 2010-09-24 23:59 ` Yinghai Lu
2010-09-25 0:08 ` H. Peter Anvin
0 siblings, 1 reply; 7+ messages in thread
From: Yinghai Lu @ 2010-09-24 23:59 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Venkatesh Pallipadi, Prarit Bhargava, fredlwm, Simon Arlott, x86,
Clemens Ladisch, linux-kernel, Marc Jones, Jordan Crouse,
Ingo Molnar, H. Peter Anvin, Thomas Gleixner
On Fri, Sep 24, 2010 at 4:06 PM, Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
> Sorry Yinghai, I forgot to copy you on the initial post. Any
> comments on this? If not, we should try to get it into linux-next
> soon.
should be good.
only one thing, that will punish all other vendors... and run that
quirk for every pci device.
please check if you can have
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_ANY_ID, mark_pci_hpet_fixed);
AND _AMD maybe, if AMD dump _ATI brand later.
Thanks
Yinghai
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED
2010-09-24 23:59 ` Yinghai Lu
@ 2010-09-25 0:08 ` H. Peter Anvin
2010-09-25 0:12 ` Yinghai Lu
0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2010-09-25 0:08 UTC (permalink / raw)
To: Yinghai Lu
Cc: Bjorn Helgaas, Venkatesh Pallipadi, Prarit Bhargava, fredlwm,
Simon Arlott, x86, Clemens Ladisch, linux-kernel, Marc Jones,
Jordan Crouse, Ingo Molnar, Thomas Gleixner
On 09/24/2010 04:59 PM, Yinghai Lu wrote:
> On Fri, Sep 24, 2010 at 4:06 PM, Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
>> Sorry Yinghai, I forgot to copy you on the initial post. Any
>> comments on this? If not, we should try to get it into linux-next
>> soon.
>
> should be good.
>
> only one thing, that will punish all other vendors... and run that
> quirk for every pci device.
>
> please check if you can have
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_ANY_ID, mark_pci_hpet_fixed);
>
> AND _AMD maybe, if AMD dump _ATI brand later.
>
No, because the problem is known to happen on multiple vendors.
-hpa
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED
2010-09-25 0:08 ` H. Peter Anvin
@ 2010-09-25 0:12 ` Yinghai Lu
2010-09-25 0:25 ` H. Peter Anvin
0 siblings, 1 reply; 7+ messages in thread
From: Yinghai Lu @ 2010-09-25 0:12 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Bjorn Helgaas, Venkatesh Pallipadi, Prarit Bhargava, fredlwm,
Simon Arlott, x86, Clemens Ladisch, linux-kernel, Marc Jones,
Jordan Crouse, Ingo Molnar, Thomas Gleixner
On 09/24/2010 05:08 PM, H. Peter Anvin wrote:
> On 09/24/2010 04:59 PM, Yinghai Lu wrote:
>> On Fri, Sep 24, 2010 at 4:06 PM, Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
>>> Sorry Yinghai, I forgot to copy you on the initial post. Any
>>> comments on this? If not, we should try to get it into linux-next
>>> soon.
>>
>> should be good.
>>
>> only one thing, that will punish all other vendors... and run that
>> quirk for every pci device.
>>
>> please check if you can have
>> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_ANY_ID, mark_pci_hpet_fixed);
>>
>> AND _AMD maybe, if AMD dump _ATI brand later.
>>
>
> No, because the problem is known to happen on multiple vendors.
>
Do you have URL to them?
INTEL ?
ServerWorks?
Via?
Yinghai
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED
2010-09-25 0:12 ` Yinghai Lu
@ 2010-09-25 0:25 ` H. Peter Anvin
0 siblings, 0 replies; 7+ messages in thread
From: H. Peter Anvin @ 2010-09-25 0:25 UTC (permalink / raw)
To: Yinghai Lu
Cc: Bjorn Helgaas, Venkatesh Pallipadi, Prarit Bhargava, fredlwm,
Simon Arlott, x86, Clemens Ladisch, linux-kernel, Marc Jones,
Jordan Crouse, Ingo Molnar, Thomas Gleixner
On 09/24/2010 05:12 PM, Yinghai Lu wrote:
>>
>> No, because the problem is known to happen on multiple vendors.
>>
> Do you have URL to them?
>
> INTEL ?
> ServerWorks?
> Via?
>
It'll happen on any platform where the HPET is a BAR. There is no point
in enumerating it by vendor, since there is a static test for it.
-hpa
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-25 0:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 23:30 [PATCH] x86, HPET: mark HPET PCI BARs as IORESOURCE_PCI_FIXED Bjorn Helgaas
2010-09-23 23:32 ` Bjorn Helgaas
2010-09-24 23:06 ` Bjorn Helgaas
2010-09-24 23:59 ` Yinghai Lu
2010-09-25 0:08 ` H. Peter Anvin
2010-09-25 0:12 ` Yinghai Lu
2010-09-25 0:25 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox