From: Bo Wu wubo40@huawei.com
euleros inclusion category: bugfix bugzilla: 13666, https://gitee.com/openeuler/kernel/issues/I4M9ZL?from=project-issue CVE: NA
-------------------------------------
SD5896 NP init failed, when some unused BAR is enabled. The unused BAR should be disabled to fix this problem.
Signed-off-by: geruijun geruijun@huawei.com Signed-off-by: Yeqing Peng pengyeqing@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/pci/quirks.c | 25 +++++++++++++++++++++++++ include/linux/pci_ids.h | 3 +++ 2 files changed, 28 insertions(+)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 54a8e390ad67..a7676cdae529 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -5622,6 +5622,31 @@ static void quirk_switchtec_ntb_dma_alias(struct pci_dev *pdev) pci_iounmap(pdev, mmio); pci_disable_device(pdev); } + +static void pci_quirk_hisi_fixup_class(struct pci_dev *dev) +{ + dev->class = PCI_BASE_CLASS_NETWORK << 8; + pci_info(dev, "force hisi class type to network\n"); +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_HUAWEI, PCIE_DEVICE_ID_HISI_5896, + pci_quirk_hisi_fixup_class); + +static void pci_quirk_hisi_fixup_bar(struct pci_dev *dev) +{ + int i, start = 3; + + for (i = start; i < PCI_NUM_RESOURCES; i++) { + dev->resource[i].start = 0; + dev->resource[i].end = 0; + dev->resource[i].flags = 0; + } + + pci_info(dev, "force disable hisilicon np bar\n"); +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HUAWEI, PCIE_DEVICE_ID_HISI_5896, + pci_quirk_hisi_fixup_bar); + + #define SWITCHTEC_QUIRK(vid) \ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_MICROSEMI, vid, \ PCI_CLASS_BRIDGE_OTHER, 8, quirk_switchtec_ntb_dma_alias) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 635a9243cce0..f8da3669b6b0 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2570,6 +2570,9 @@
#define PCI_VENDOR_ID_HUAWEI 0x19e5
+/* Hisilicon PCIe NP devices */ +#define PCIE_DEVICE_ID_HISI_5896 0x5896 + #define PCI_VENDOR_ID_NETRONOME 0x19ee #define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000 #define PCI_DEVICE_ID_NETRONOME_NFP5000 0x5000