From: Zheng Chongzhen zhengchongzhen@wxiat.com
Sunway inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I56OSP
--------------------------------
The device controllers of ZX200 chipset are all the 32-bit DMA capable device, so we add pci quirk function hook to set dev.bus_dma_limit to DMA_BIT_MASK(32) for all devices on the chipset, besides when CONFIG_SUNWAY_IOMMU=n, all these devices will use swiotlb dma_ops.
Signed-off-by: Zheng Chongzhen zhengchongzhen@wxiat.com
Signed-off-by: Gu Zitao guzitao@wxiat.com --- arch/sw_64/kernel/pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/arch/sw_64/kernel/pci.c b/arch/sw_64/kernel/pci.c index a004ea9fde7f..7cc8b7d2d43b 100644 --- a/arch/sw_64/kernel/pci.c +++ b/arch/sw_64/kernel/pci.c @@ -691,3 +691,16 @@ sw64_init_pci(void) { common_init_pci(); } + +static int setup_bus_dma_cb(struct pci_dev *pdev, void *data) +{ + pdev->dev.bus_dma_limit = DMA_BIT_MASK(32); + return 0; +} + +static void fix_bus_dma_limit(struct pci_dev *dev) +{ + pci_walk_bus(dev->subordinate, setup_bus_dma_cb, NULL); + pr_info("Set zx200 bus_dma_limit to 32-bit\n"); +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ZHAOXIN, 0x071f, fix_bus_dma_limit);