Skip to content

Conversation

@elysia-best
Copy link

This patch adds essential compatibility support for ACPI-based systems running on older firmware. Some older computers with Kunlun firmware still rely on this mechanism and are unlikely to receive futher firmeware updates. This change ensures proper ISA I/O space reservation across for them.

@elysia-best elysia-best marked this pull request as draft January 16, 2026 12:47
@elysia-best elysia-best changed the title AOSCOS: LoongArch: Add ACPI compatibility for ISA I/O space reservation [WIP] LoongArch: Add ACPI compatibility for ISA I/O space reservation Jan 16, 2026
@MingcongBai
Copy link

Eww. This probably calls for a better (even DMI-specific) quirk...

pr_warn("Failed to allocate fwnode for legacy ISA\n");
return 0;
}
if (add_legacy_isa_io(fwnode, LOONGSON_LIO_BASE, ISA_IOSIZE)) {
Copy link

@xry111 xry111 Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this patch can be merged as-is.

Both 7A1000 and 7A2000 manuals state that 0x18000000-0x1800ffff (64K) is for "LPC I/O", but this patch reserves 0x18000000-0x18003fff (16K). The only reference I can find about this 16K range is the 2K1000 ISA controller which is obviously unrelated to any desktop platform. The macro name ("ISA_IOSIZE") also seems something for 2K1000 now.

We need some detailed analysis of the issue and maybe some research on the ACPI specification.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, a fast search for ISA_IOSIZE shows that this marco was introduced in initial commits for LoongArch support at torvalds@7153c3c

It didn't explain why this marco should be 16K rather than 64K. Additionally, ISA_IOSIZE is also used in loongnix's patch for this issue. I agree that this issue needs more analysis :)

@elysia-best
Copy link
Author

Add a DMI check for my tested board. This list can be extended in the futuer if more boards need this workaround.

This patch adds essential compatibility support for ACPI-based systems running on older firmware. Many older computers with old firmware still rely on this mechanism and are unlikely to receive futher firmeware updates. This change ensures proper ISA I/O space reservation across for them.

Use DMI to judge if the system needs patching.

Signed-off-by: Yinan Qin <a.elysia@proton.me>
@xry111
Copy link

xry111 commented Jan 19, 2026

If the issue isn't limited to BPI system (i.e. also reproducible with the correct UEFI boot process) we expect to make the quirk upstream. Then don't use legacy_boot.c which is not upstream.

I think adding it to arch/loongarch/pci/pci.c as a PCI quirk against some 7A1000/2000 device (which one??1) would be better. Taking twinhead_reserve_killing_zone() in arch/x86/pci/fixup.c as an example.

Footnotes

  1. I considered 0014:7a0c (the LPC controller which is supposed to use this memory range) but it's not enabled on all of my systems (so the PCI enumeration doesn't find it at all). Now I'm actually wondering if the problem is that LPC controller is not really supported by your firmware but it mistakenly enables the controller. Would you kindly prove or disprove my guess by running lspci on your system?

@elysia-best
Copy link
Author

running lspci on your system?

Sure, here is the output for that

(ssh)elysia@elysia-loong64-pc [ linux@aosc-6.17.7 ] ! lspci -vvv -s "00:17.0"
00:17.0 ISA bridge: Loongson Technology LLC 2K2000 / 7A1000/2000 Chipset LPC Controller (rev 01)
        Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 255
        NUMA node: 0

@elysia-best
Copy link
Author

elysia-best commented Jan 20, 2026

P.S. Crash log using unpatched kernel is uploaded here panic.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants