[SRU][Zesty][PATCH 0/1] Fix for LP#1698706

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[SRU][Zesty][PATCH 0/1] Fix for LP#1698706

Daniel Axtens
SRU Justification

[Impact]
Xorg autodetection does not work on HiSilicon D05 boards.

[Fix]
The HiSilicon D05 board has some PCI bridges (PCI ID 19e5:1610) that
are not spec-compliant: they do not set the VGA Enable bit when a VGA
card is behind the bridge. This stops vgaarb setting the device as a
boot vga device, breaking Xorg auto-detection. [0]

Despite this, the hibmc VGA card (PCI ID 19e5:1711) is known to work
when behind these bridges.

Provide a quirk so that this combination of bridge and card works.

[Testcase]
On an affected board, run:
# find /sys/devices -name boot_vga -exec cat \{\} \;

This should print 0 without this patch and 1 with this patch.

[Regression Potential]
There is a risk with overriding the VGA arbiter that adding additional
VGA cards to the board may go wrong somehow. The fixup specifically
tests for the bridge and card on the board, so regressions should be
limited to that combination of bridge and card.

[Notes]
HiSilicon is hoping to have the 16.04.3 HWE kernel support their
board, hence the submission of this patch before it has been accepted
upstream. The patch has been submitted upstream and I will continue to
work with upstream to land it.[1]

[0] https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991 - this
bug tracked debugging of a segfault and then this issue. Comments 25
(https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991/comments/25)
and 31 onwards detail this issue.

[1] https://patchwork.ozlabs.org/patch/778054/

Daniel Axtens (1):
  UBUNTU: SAUCE: PCI: Support hibmc VGA cards behind a misbehaving
    HiSilicon bridge

 drivers/pci/quirks.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

--
2.11.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[SRU][Zesty][PATCH] UBUNTU: SAUCE: PCI: Support hibmc VGA cards behind a misbehaving HiSilicon bridge

Daniel Axtens
BugLink: https://bugs.launchpad.net/bugs/1698706

The HiSilicon D05 board has some PCI bridges (PCI ID 19e5:1610) that
are not spec-compliant: the VGA Enable bit is set to 0 in hardware
and writes do not change it.

This stops VGA arbitrartion from marking a VGA card behind the bridge
as a boot device, and therefore breaks Xorg auto-configuration.

The hibmc VGA card (PCI ID 19e5:1711) is known to work when behind
these bridges.

Provide a quirk so that this combination of bridge and card is eligible
to be the default VGA card.

This fixes Xorg auto-detection.

Cc: Xinliang Liu <[hidden email]>
Cc: Rongrong Zou <[hidden email]>
Signed-off-by: Daniel Axtens <[hidden email]>
---
 drivers/pci/quirks.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 2a03cd03d9c2..e40684ae7335 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -25,6 +25,7 @@
 #include <linux/sched.h>
 #include <linux/ktime.h>
 #include <linux/mm.h>
+#include <linux/vgaarb.h>
 #include <asm/dma.h> /* isa_dma_bridge_buggy */
 #include "pci.h"
 
@@ -4669,3 +4670,48 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2030, quirk_no_aersid);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032, quirk_no_aersid);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
+
+/*
+ * The hibmc card on a HiSilicon D05 board sits behind a non-compliant
+ * bridge. The bridge has the PCI_BRIDGE_CTL_VGA config bit fixed at 0
+ * in hardware. This prevents the vgaarb from marking a card behind it
+ * as boot VGA device.
+ *
+ * However, the hibmc card is known to still work, so if we have that
+ * card behind that particular bridge (19e5:1610), mark it as the
+ * default device if none has been detected.
+ */
+static void hibmc_fixup_vgaarb(struct pci_dev *pdev)
+{
+ struct pci_dev *bridge;
+ struct pci_bus *bus;
+ u16 config;
+
+ bus = pdev->bus;
+ bridge = bus->self;
+ if (!bridge)
+ return;
+
+ if (!pci_is_bridge(bridge))
+ return;
+
+ if (bridge->vendor != PCI_VENDOR_ID_HUAWEI ||
+    bridge->device != 0x1610)
+ return;
+
+ pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
+     &config);
+ if (config & PCI_BRIDGE_CTL_VGA) {
+ /*
+ * Weirdly, this bridge *is* spec compliant, so bail
+ * and let vgaarb do its job
+ */
+ return;
+ }
+
+ if (vga_default_device())
+ return;
+
+ vga_set_default_device(pdev);
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_HUAWEI, 0x1711, hibmc_fixup_vgaarb);
--
2.11.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [SRU][Zesty][PATCH] UBUNTU: SAUCE: PCI: Support hibmc VGA cards behind a misbehaving HiSilicon bridge

Stefan Bader-2
On 29.06.2017 05:45, Daniel Axtens wrote:

> BugLink: https://bugs.launchpad.net/bugs/1698706
>
> The HiSilicon D05 board has some PCI bridges (PCI ID 19e5:1610) that
> are not spec-compliant: the VGA Enable bit is set to 0 in hardware
> and writes do not change it.
>
> This stops VGA arbitrartion from marking a VGA card behind the bridge
> as a boot device, and therefore breaks Xorg auto-configuration.
>
> The hibmc VGA card (PCI ID 19e5:1711) is known to work when behind
> these bridges.
>
> Provide a quirk so that this combination of bridge and card is eligible
> to be the default VGA card.
>
> This fixes Xorg auto-detection.
>
> Cc: Xinliang Liu <[hidden email]>
> Cc: Rongrong Zou <[hidden email]>
> Signed-off-by: Daniel Axtens <[hidden email]>
Acked-by: Stefan Bader <[hidden email]>

> ---

Sounds like sufficient effort has been made to restrict impact to a specific set
of hardware. So should be easy to verify.

>  drivers/pci/quirks.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 2a03cd03d9c2..e40684ae7335 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -25,6 +25,7 @@
>  #include <linux/sched.h>
>  #include <linux/ktime.h>
>  #include <linux/mm.h>
> +#include <linux/vgaarb.h>
>  #include <asm/dma.h> /* isa_dma_bridge_buggy */
>  #include "pci.h"
>  
> @@ -4669,3 +4670,48 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2030, quirk_no_aersid);
>  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid);
>  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032, quirk_no_aersid);
>  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
> +
> +/*
> + * The hibmc card on a HiSilicon D05 board sits behind a non-compliant
> + * bridge. The bridge has the PCI_BRIDGE_CTL_VGA config bit fixed at 0
> + * in hardware. This prevents the vgaarb from marking a card behind it
> + * as boot VGA device.
> + *
> + * However, the hibmc card is known to still work, so if we have that
> + * card behind that particular bridge (19e5:1610), mark it as the
> + * default device if none has been detected.
> + */
> +static void hibmc_fixup_vgaarb(struct pci_dev *pdev)
> +{
> + struct pci_dev *bridge;
> + struct pci_bus *bus;
> + u16 config;
> +
> + bus = pdev->bus;
> + bridge = bus->self;
> + if (!bridge)
> + return;
> +
> + if (!pci_is_bridge(bridge))
> + return;
> +
> + if (bridge->vendor != PCI_VENDOR_ID_HUAWEI ||
> +    bridge->device != 0x1610)
> + return;
> +
> + pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
> +     &config);
> + if (config & PCI_BRIDGE_CTL_VGA) {
> + /*
> + * Weirdly, this bridge *is* spec compliant, so bail
> + * and let vgaarb do its job
> + */
> + return;
> + }
> +
> + if (vga_default_device())
> + return;
> +
> + vga_set_default_device(pdev);
> +}
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_HUAWEI, 0x1711, hibmc_fixup_vgaarb);
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK / APPLIED[artful]: [SRU][Zesty][PATCH] UBUNTU: SAUCE: PCI: Support hibmc VGA cards behind a misbehaving HiSilicon bridge

Seth Forshee
In reply to this post by Daniel Axtens
On Thu, Jun 29, 2017 at 01:45:44PM +1000, Daniel Axtens wrote:

> BugLink: https://bugs.launchpad.net/bugs/1698706
>
> The HiSilicon D05 board has some PCI bridges (PCI ID 19e5:1610) that
> are not spec-compliant: the VGA Enable bit is set to 0 in hardware
> and writes do not change it.
>
> This stops VGA arbitrartion from marking a VGA card behind the bridge
> as a boot device, and therefore breaks Xorg auto-configuration.
>
> The hibmc VGA card (PCI ID 19e5:1711) is known to work when behind
> these bridges.
>
> Provide a quirk so that this combination of bridge and card is eligible
> to be the default VGA card.
>
> This fixes Xorg auto-detection.
>
> Cc: Xinliang Liu <[hidden email]>
> Cc: Rongrong Zou <[hidden email]>
> Signed-off-by: Daniel Axtens <[hidden email]>

Scope is limited to specific hardware, limiting regression potential.

Acked-by: Seth Forshee <[hidden email]>

Applied to artful/master-next and unstable/master, thanks.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

APPLIED: [SRU][Zesty][PATCH 0/1] Fix for LP#1698706

Thadeu Lima de Souza Cascardo-3
In reply to this post by Daniel Axtens
Applied to zesty master-next branch.

Thanks.
Cascardo.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Loading...