Skip to content

Commit 0a63354

Browse files
committed
Revert "LoongArch: Workaround LS2K/LS7A GPU DMA hang bug"
deepin incluion category: bugfix This reverts commit 955dad2. It confirmed the commit caused kernel crash with extra GPU, such as arise and amdgpu. Log: [ 0.805731] Kernel ade access[#1]: [ 0.809103] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.6.134-loong64-desktop-hwe deepin-community#25.01.00.23 [ 0.817833] Hardware name: Loongson Loongson-3A6000-HV-7A2000-1w-V0.1-EVB/Loongson-3A6000-HV-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05756-prestab [ 0.831573] pc 9000000001839bd4 ra 9000000001839b60 tp 90000001002d0000 sp 90000001002d36a0 [ 0.839869] a0 80000efe00003100 a1 0000000000003100 a2 0000000000000000 a3 0000000000000002 [ 0.848166] a4 90000001002d3694 a5 900000010087714d a6 90000000032a4000 a7 0000000000000001 [ 0.856463] t0 00000000000085b9 t1 000000000000ffff t2 0000000000000000 t3 0000000000000000 [ 0.864759] t4 fffffffffffffffd t5 00000000fffb6e7c t6 0000000000f06001 t7 00388a0001000090 [ 0.873056] t8 9000000100877234 u0 900000010087714d s9 90000001002d3806 s0 90000000041cab88 [ 0.881352] s1 7fffffffffffff00 s2 90000000041cab90 s3 0000000000002710 s4 0000000000000000 [ 0.889648] s5 0000000000000000 s6 90000001008a3000 s7 7fffffffffffff00 s8 9000000004074000 [ 0.897944] ra: 9000000001839b60 loongson_gpu_fixup_dma_hang+0x40/0x210 [ 0.904774] ERA: 9000000001839bd4 loongson_gpu_fixup_dma_hang+0xb4/0x210 [ 0.911602] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) [ 0.917744] PRMD: 00000004 (PPLV0 +PIE -PWE) [ 0.922068] EUEN: 00000000 (-FPE -SXE -ASXE -BTE) [ 0.926825] ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7) [ 0.931581] ESTAT: 00480000 [ADEM] (IS= ECode=8 EsubCode=1) [ 0.937114] BADV: 7fffffffffffff00 [ 0.940571] PRID: 0014d000 (Loongson-64bit, Loongson-3A6000-HV) [ 0.946535] Modules linked in: [ 0.949561] Process swapper/0 (pid: 1, threadinfo=(____ptrval____), task=(____ptrval____)) [ 0.957771] Stack : 0000000000000006 90000001002d3758 90000001002d36e4 0000000000000007 [ 0.965726] 0000000024004f00 9000000001839d30 000000000000ffff ffffffffffffffff [ 0.973679] 9000000002b080a0 90000001008a3000 9000000002b08088 9000000000f2a7c8 [ 0.981632] 0000000000000000 0000000000000000 0000000000000006 90000001002d3758 [ 0.989586] 90000001008a30b8 90000000032a4000 0000000000000000 90000001008a4000 [ 0.997539] 90000001008a3000 9000000000efa02c 9000000100004c00 9000000004000001 [ 1.005492] 90000001002d37c4 a5f4111bbd94bf0d 0000000000000000 0000000000000000 [ 1.013445] 0000000000000006 90000000032a4000 0000000000000030 90000000032a4000 [ 1.021398] 900000087c994000 90000001008a3000 0000000000000000 9000000000efae80 [ 1.029351] 7a2500147c84b060 a5f4111bbd94bf0d 0000000000000001 0000000000000030 [ 1.037304] ... [ 1.039726] Call Trace: [ 1.039727] [<9000000001839bd4>] loongson_gpu_fixup_dma_hang+0xb4/0x210 [ 1.048717] [<9000000000f2a7c4>] pci_fixup_device+0x104/0x280 [ 1.054425] [<9000000000efa028>] pci_setup_device+0x248/0x690 [ 1.060133] [<9000000000efae7c>] pci_scan_single_device+0xdc/0x140 [ 1.066272] [<9000000000efafa0>] pci_scan_slot+0xc0/0x280 [ 1.071632] [<9000000000efc61c>] pci_scan_child_bus_extend+0x5c/0x3f0 [ 1.078030] [<9000000000f9b6b0>] acpi_pci_root_create+0x2b0/0x420 [ 1.084083] [<900000000183a530>] pci_acpi_scan_root+0x2e0/0x490 [ 1.089962] [<9000000000f9aa48>] acpi_pci_root_add+0x218/0x3a0 [ 1.095754] [<9000000000f8e7d0>] acpi_bus_attach+0x1a0/0x3c0 [ 1.101374] [<900000000112b488>] device_for_each_child+0x68/0xe0 [ 1.107342] [<9000000000f8b570>] acpi_dev_for_each_child+0x40/0x70 [ 1.113481] [<9000000000f8e8bc>] acpi_bus_attach+0x28c/0x3c0 [ 1.119099] [<900000000112b488>] device_for_each_child+0x68/0xe0 [ 1.125065] [<9000000000f8b570>] acpi_dev_for_each_child+0x40/0x70 [ 1.131202] [<9000000000f8e8bc>] acpi_bus_attach+0x28c/0x3c0 [ 1.136820] [<9000000000f91a98>] acpi_bus_scan+0x68/0x280 [ 1.142180] [<90000000018cef4c>] acpi_scan_init+0x190/0x310 [ 1.147716] [<90000000018ceb8c>] acpi_init+0xcc/0x148 [ 1.152731] [<9000000000244cd8>] do_one_initcall+0x48/0x310 [ 1.158265] [<90000000018918f0>] kernel_init_freeable+0x254/0x2d4 [ 1.164319] [<9000000001875280>] kernel_init+0x24/0x134 [ 1.169509] [<9000000001873d08>] ret_from_kernel_thread+0x28/0xc0 [ 1.175561] [<9000000000246164>] ret_from_kernel_thread_asm+0xc/0x88 [ 1.181872] [ 1.183342] Code: 0015001b 02c022f9 0010efd8 <2400030c> 0040818c 38720005 40006380 240002ed 034401ad [ 1.193028] [ 1.194500] ---[ end trace 0000000000000000 ]--- [ 1.199084] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
1 parent 32b884a commit 0a63354

1 file changed

Lines changed: 0 additions & 80 deletions

File tree

arch/loongarch/pci/pci.c

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,16 @@
66
#include <linux/export.h>
77
#include <linux/init.h>
88
#include <linux/acpi.h>
9-
#include <linux/delay.h>
109
#include <linux/types.h>
1110
#include <linux/pci.h>
1211
#include <linux/vgaarb.h>
13-
#include <linux/io-64-nonatomic-lo-hi.h>
1412
#include <asm/cacheflush.h>
1513
#include <asm/loongson.h>
1614

1715
#define PCI_DEVICE_ID_LOONGSON_HOST 0x7a00
1816
#define PCI_DEVICE_ID_LOONGSON_DC1 0x7a06
1917
#define PCI_DEVICE_ID_LOONGSON_DC2 0x7a36
2018
#define PCI_DEVICE_ID_LOONGSON_DC3 0x7a46
21-
#define PCI_DEVICE_ID_LOONGSON_GPU1 0x7a15
22-
#define PCI_DEVICE_ID_LOONGSON_GPU2 0x7a25
23-
#define PCI_DEVICE_ID_LOONGSON_GPU3 0x7a35
2419

2520
int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
2621
int reg, int len, u32 *val)
@@ -105,78 +100,3 @@ static void pci_fixup_vgadev(struct pci_dev *pdev)
105100
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_DC1, pci_fixup_vgadev);
106101
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_DC2, pci_fixup_vgadev);
107102
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_DC3, pci_fixup_vgadev);
108-
109-
#define CRTC_NUM_MAX 2
110-
#define CRTC_OUTPUT_ENABLE 0x100
111-
112-
static void loongson_gpu_fixup_dma_hang(struct pci_dev *pdev, bool on)
113-
{
114-
u32 i, val, count, crtc_offset, device;
115-
void __iomem *crtc_reg, *base, *regbase;
116-
static u32 crtc_status[CRTC_NUM_MAX] = { 0 };
117-
118-
base = pdev->bus->ops->map_bus(pdev->bus, pdev->devfn + 1, 0);
119-
device = readw(base + PCI_DEVICE_ID);
120-
121-
regbase = ioremap(readq(base + PCI_BASE_ADDRESS_0) & ~0xffull, SZ_64K);
122-
if (!regbase) {
123-
pci_err(pdev, "Failed to ioremap()\n");
124-
return;
125-
}
126-
127-
switch (device) {
128-
case PCI_DEVICE_ID_LOONGSON_DC2:
129-
crtc_reg = regbase + 0x1240;
130-
crtc_offset = 0x10;
131-
break;
132-
case PCI_DEVICE_ID_LOONGSON_DC3:
133-
crtc_reg = regbase;
134-
crtc_offset = 0x400;
135-
break;
136-
}
137-
138-
for (i = 0; i < CRTC_NUM_MAX; i++, crtc_reg += crtc_offset) {
139-
val = readl(crtc_reg);
140-
141-
if (!on)
142-
crtc_status[i] = val;
143-
144-
/* No need to fixup if the status is off at startup. */
145-
if (!(crtc_status[i] & CRTC_OUTPUT_ENABLE))
146-
continue;
147-
148-
if (on)
149-
val |= CRTC_OUTPUT_ENABLE;
150-
else
151-
val &= ~CRTC_OUTPUT_ENABLE;
152-
153-
mb();
154-
writel(val, crtc_reg);
155-
156-
for (count = 0; count < 40; count++) {
157-
val = readl(crtc_reg) & CRTC_OUTPUT_ENABLE;
158-
if ((on && val) || (!on && !val))
159-
break;
160-
udelay(1000);
161-
}
162-
163-
pci_info(pdev, "DMA hang fixup at reg[0x%lx]: 0x%x\n",
164-
(unsigned long)crtc_reg & 0xffff, readl(crtc_reg));
165-
}
166-
167-
iounmap(regbase);
168-
}
169-
170-
static void pci_fixup_dma_hang_early(struct pci_dev *pdev)
171-
{
172-
loongson_gpu_fixup_dma_hang(pdev, false);
173-
}
174-
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_GPU2, pci_fixup_dma_hang_early);
175-
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_GPU3, pci_fixup_dma_hang_early);
176-
177-
static void pci_fixup_dma_hang_final(struct pci_dev *pdev)
178-
{
179-
loongson_gpu_fixup_dma_hang(pdev, true);
180-
}
181-
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_GPU2, pci_fixup_dma_hang_final);
182-
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_GPU3, pci_fixup_dma_hang_final);

0 commit comments

Comments
 (0)