All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RFC v2] PCI: Workaround to enable poweroff on Mac Pro 11
@ 2016-08-18 17:44 Chen Yu
  2016-08-19  7:21 ` Lukas Wunner
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Yu @ 2016-08-18 17:44 UTC (permalink / raw)
  To: linux-pci; +Cc: Bjorn Helgaas, linux-kernel, Chen Yu, Rafael J . Wysocki

People reported that they can not do a poweroff nor a
suspend to memory on their Mac Pro 11. After some investigations
it was found that, once the PCI bridge 0000:00:1c.0 reassigns its
mm windows([mem 0x7fa00000-0x7fbfffff] and
[mem 0x7fc00000-0x7fdfffff 64bit pref]), the region of ACPI
io resource 0x1804 becomes unaccessible immediately, where the
ACPI Sleep register is located, as a result neither poweroff(S5)
nor suspend to memory(S3) works.

As suggested by Bjorn, further testing shows that, there is an
unreported device may be (using) conflict with above aperture,
so if we reassign the memory aperture to other place, the poweroff
works again.

As we did not find any resource declared in _CRS which contain above
memory aperture, thus we choose a simple workaround to clear the hotplug
flag(suggested by Yinghai Lu), thus do not allocate any resource for
this pci bridge.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=103211
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 drivers/pci/quirks.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 37ff015..47b303a 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2776,6 +2776,27 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
 
 /*
+ * Apple: Avoid programming the memory/io aperture of 00:1c.0
+ *
+ * BIOS does not declare any resource for 00:1c.0, but with
+ * hotplug flag set, thus OS allocate:
+ * [mem 0x7fa00000 - 0x7fbfffff]
+ * [mem 0x7fc00000-0x7fdfffff 64bit pref]
+ * which is conflict with an unreported device, which
+ * causes unpredictable result such as accessing io port.
+ * So clear the hotplug flag to work around it.
+ */
+static void quirk_apple_mbp_poweroff(struct pci_dev *dev)
+{
+	if (dmi_match(DMI_BOARD_VENDOR, "Apple Inc.") &&
+	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,4") ||
+	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,5"))
+		dev->is_hotplug_bridge = 0;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_apple_mbp_poweroff);
+
+/*
  * This is a quirk for the Ricoh MMC controller found as a part of
  * some mulifunction chips.
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][RFC v2] PCI: Workaround to enable poweroff on Mac Pro 11
  2016-08-18 17:44 [PATCH][RFC v2] PCI: Workaround to enable poweroff on Mac Pro 11 Chen Yu
@ 2016-08-19  7:21 ` Lukas Wunner
  2016-08-19  8:01   ` Chen Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Lukas Wunner @ 2016-08-19  7:21 UTC (permalink / raw)
  To: Chen Yu; +Cc: linux-pci, Bjorn Helgaas, linux-kernel, Rafael J . Wysocki

On Fri, Aug 19, 2016 at 01:44:52AM +0800, Chen Yu wrote:
> People reported that they can not do a poweroff nor a
> suspend to memory on their Mac Pro 11. After some investigations
> it was found that, once the PCI bridge 0000:00:1c.0 reassigns its
> mm windows([mem 0x7fa00000-0x7fbfffff] and
> [mem 0x7fc00000-0x7fdfffff 64bit pref]), the region of ACPI
> io resource 0x1804 becomes unaccessible immediately, where the
> ACPI Sleep register is located, as a result neither poweroff(S5)
> nor suspend to memory(S3) works.
> 
> As suggested by Bjorn, further testing shows that, there is an
> unreported device may be (using) conflict with above aperture,
> so if we reassign the memory aperture to other place, the poweroff
> works again.
> 
> As we did not find any resource declared in _CRS which contain above
> memory aperture, thus we choose a simple workaround to clear the hotplug
> flag(suggested by Yinghai Lu), thus do not allocate any resource for
> this pci bridge.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=103211
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---
>  drivers/pci/quirks.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 37ff015..47b303a 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -2776,6 +2776,27 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
>  
>  /*
> + * Apple: Avoid programming the memory/io aperture of 00:1c.0
> + *
> + * BIOS does not declare any resource for 00:1c.0, but with
> + * hotplug flag set, thus OS allocate:
> + * [mem 0x7fa00000 - 0x7fbfffff]
> + * [mem 0x7fc00000-0x7fdfffff 64bit pref]
> + * which is conflict with an unreported device, which
> + * causes unpredictable result such as accessing io port.
> + * So clear the hotplug flag to work around it.
> + */
> +static void quirk_apple_mbp_poweroff(struct pci_dev *dev)
> +{
> +	if (dmi_match(DMI_BOARD_VENDOR, "Apple Inc.") &&
> +	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,4") ||
> +	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,5"))

&& has higher precedence than ||, so you would need parentheses here.
However I don't think there's another vendor using those product names,
so it's probably safe to drop the check for the vendor altogether.

Best regards,

Lukas

> +		dev->is_hotplug_bridge = 0;
> +}
> +
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_apple_mbp_poweroff);
> +
> +/*
>   * This is a quirk for the Ricoh MMC controller found as a part of
>   * some mulifunction chips.
>  
> -- 
> 2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][RFC v2] PCI: Workaround to enable poweroff on Mac Pro 11
  2016-08-19  7:21 ` Lukas Wunner
@ 2016-08-19  8:01   ` Chen Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chen Yu @ 2016-08-19  8:01 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: linux-pci, Bjorn Helgaas, linux-kernel, Rafael J . Wysocki

On Fri, Aug 19, 2016 at 09:21:40AM +0200, Lukas Wunner wrote:
> On Fri, Aug 19, 2016 at 01:44:52AM +0800, Chen Yu wrote:
> > People reported that they can not do a poweroff nor a
> > suspend to memory on their Mac Pro 11. After some investigations
> > it was found that, once the PCI bridge 0000:00:1c.0 reassigns its
> > mm windows([mem 0x7fa00000-0x7fbfffff] and
> > [mem 0x7fc00000-0x7fdfffff 64bit pref]), the region of ACPI
> > io resource 0x1804 becomes unaccessible immediately, where the
> > ACPI Sleep register is located, as a result neither poweroff(S5)
> > nor suspend to memory(S3) works.
> > 
> > As suggested by Bjorn, further testing shows that, there is an
> > unreported device may be (using) conflict with above aperture,
> > so if we reassign the memory aperture to other place, the poweroff
> > works again.
> > 
> > As we did not find any resource declared in _CRS which contain above
> > memory aperture, thus we choose a simple workaround to clear the hotplug
> > flag(suggested by Yinghai Lu), thus do not allocate any resource for
> > this pci bridge.
> > 
> > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=103211
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: Rafael J. Wysocki <rafael@kernel.org>
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> > ---
> >  drivers/pci/quirks.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index 37ff015..47b303a 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
> > @@ -2776,6 +2776,27 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
> >  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
> >  
> >  /*
> > + * Apple: Avoid programming the memory/io aperture of 00:1c.0
> > + *
> > + * BIOS does not declare any resource for 00:1c.0, but with
> > + * hotplug flag set, thus OS allocate:
> > + * [mem 0x7fa00000 - 0x7fbfffff]
> > + * [mem 0x7fc00000-0x7fdfffff 64bit pref]
> > + * which is conflict with an unreported device, which
> > + * causes unpredictable result such as accessing io port.
> > + * So clear the hotplug flag to work around it.
> > + */
> > +static void quirk_apple_mbp_poweroff(struct pci_dev *dev)
> > +{
> > +	if (dmi_match(DMI_BOARD_VENDOR, "Apple Inc.") &&
> > +	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,4") ||
> > +	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,5"))
> 
> && has higher precedence than ||, so you would need parentheses here.
> However I don't think there's another vendor using those product names,
> so it's probably safe to drop the check for the vendor altogether.
>
You are right, will send another version. thanks!

Yu 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH][RFC v2] PCI: Workaround to enable poweroff on Mac Pro 11
@ 2016-08-19  1:16 Chen Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chen Yu @ 2016-08-19  1:16 UTC (permalink / raw)
  To: linux-pci; +Cc: linux-kernel, Chen Yu, Bjorn Helgaas, Rafael J . Wysocki

People reported that they can not do a poweroff nor a
suspend to memory on their Mac Pro 11. After some investigations
it was found that, once the PCI bridge 0000:00:1c.0 reassigns its
mm windows([mem 0x7fa00000-0x7fbfffff] and
[mem 0x7fc00000-0x7fdfffff 64bit pref]), the region of ACPI
io resource 0x1804 becomes unaccessible immediately, where the
ACPI Sleep register is located, as a result neither poweroff(S5)
nor suspend to memory(S3) works.

As suggested by Bjorn, further testing shows that, there is an
unreported device may be (using) conflict with above aperture,
so if we reassign the memory aperture to other place, the poweroff
works again.

As we did not find any resource declared in _CRS which contain above
memory aperture, thus we choose a simple workaround to clear the hotplug
flag(suggested by Yinghai Lu), thus do not allocate any resource for
this pci bridge.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=103211
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 drivers/pci/quirks.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 37ff015..47b303a 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2776,6 +2776,27 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
 
 /*
+ * Apple: Avoid programming the memory/io aperture of 00:1c.0
+ *
+ * BIOS does not declare any resource for 00:1c.0, but with
+ * hotplug flag set, thus OS allocate:
+ * [mem 0x7fa00000 - 0x7fbfffff]
+ * [mem 0x7fc00000-0x7fdfffff 64bit pref]
+ * which is conflict with an unreported device, which
+ * causes unpredictable result such as accessing io port.
+ * So clear the hotplug flag to work around it.
+ */
+static void quirk_apple_mbp_poweroff(struct pci_dev *dev)
+{
+	if (dmi_match(DMI_BOARD_VENDOR, "Apple Inc.") &&
+	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,4") ||
+	    dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,5"))
+		dev->is_hotplug_bridge = 0;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_apple_mbp_poweroff);
+
+/*
  * This is a quirk for the Ricoh MMC controller found as a part of
  * some mulifunction chips.
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-19  7:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18 17:44 [PATCH][RFC v2] PCI: Workaround to enable poweroff on Mac Pro 11 Chen Yu
2016-08-19  7:21 ` Lukas Wunner
2016-08-19  8:01   ` Chen Yu
2016-08-19  1:16 Chen Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.