From 12c7dfdadc02f9fe36c058c175a9c7a726b43932 Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Fri, 7 Apr 2023 16:22:22 -0400 Subject: [PATCH] modules/linux: Support building with Linux 6.1.8. This is particularly beneficial for servers with Aspeed BMC video, because it introduces framebuffer console acceleration. The framebuffer console is much more responsive. Patches were ported from 5.10.5: 0001-fake-acpi.patch: This may not be needed any more, but it applies cleanly and I don't think it would harm anything. 0002-nmi-squelch.patch: The comment mentions qemu but I see this message on physical machines occasionally, so I think this is needed. 0003-fake-trampoline.patch: This patch does not apply cleanly. It could be ported, but I don't think it's needed, I dropped it. Dates back to a very old commit where Linux was being embedded into a vendor UEFI firmware: a4d7654b1eee65a104053c0a2b2b882fa1ec9e44. 0010-winterfell-ahci.patch: Minor change of %x to %lx in context. Signed-off-by: Jonathon Hall --- modules/linux | 3 ++ patches/linux-6.1.8/0001-fake-acpi.patch | 32 +++++++++++++++++++ patches/linux-6.1.8/0002-nmi-squelch.patch | 20 ++++++++++++ .../linux-6.1.8/0010-winterfell-ahci.patch | 18 +++++++++++ 4 files changed, 73 insertions(+) create mode 100644 patches/linux-6.1.8/0001-fake-acpi.patch create mode 100644 patches/linux-6.1.8/0002-nmi-squelch.patch create mode 100644 patches/linux-6.1.8/0010-winterfell-ahci.patch diff --git a/modules/linux b/modules/linux index 94e98ebd..b4571569 100644 --- a/modules/linux +++ b/modules/linux @@ -31,6 +31,9 @@ linux_hash := a6fbd4ee903c128367892c2393ee0d9657b6ed3ea90016d4dc6f1f6da20b2330 else ifeq "$(CONFIG_LINUX_VERSION)" "5.10.5" linux_version := 5.10.5 linux_hash := 3991a9e16a187d78d5f414d89236ae5d7f404a69e60c4c42a9d262ee19612ef4 +else ifeq "$(CONFIG_LINUX_VERSION)" "6.1.8" +linux_version := 6.1.8 +linux_hash := b60bb53ab8ba370a270454b11e93d41af29126fc72bd6ede517673e2e57b816d else $(error "$(BOARD): does not specify linux kernel version under CONFIG_LINUX_VERSION") endif diff --git a/patches/linux-6.1.8/0001-fake-acpi.patch b/patches/linux-6.1.8/0001-fake-acpi.patch new file mode 100644 index 00000000..0c8b3b54 --- /dev/null +++ b/patches/linux-6.1.8/0001-fake-acpi.patch @@ -0,0 +1,32 @@ +diff --recursive -u ./clean/linux-4.9.80/drivers/acpi/acpica/evxfevnt.c linux-4.9.80/drivers/acpi/acpica/evxfevnt.c +--- ./clean/linux-4.9.80/drivers/acpi/acpica/evxfevnt.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/drivers/acpi/acpica/evxfevnt.c 2018-02-07 15:51:28.786502597 -0500 +@@ -111,6 +111,8 @@ + } + + ACPI_ERROR((AE_INFO, "Hardware did not enter ACPI mode")); ++printk("%s:%d faking ACPI mode\n", __func__, __LINE__); ++ return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); + } + +diff --recursive -u ./clean/linux-4.9.80/drivers/acpi/acpica/hwacpi.c linux-4.9.80/drivers/acpi/acpica/hwacpi.c +--- ./clean/linux-4.9.80/drivers/acpi/acpica/hwacpi.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/drivers/acpi/acpica/hwacpi.c 2018-02-07 15:51:35.126557868 -0500 +@@ -168,12 +168,16 @@ + + status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); + if (ACPI_FAILURE(status)) { ++printk("%s:%d faking ACPI mode\n", __func__, __LINE__); ++ return_UINT32(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_LEGACY); + } + + if (value) { + return_UINT32(ACPI_SYS_MODE_ACPI); + } else { ++//printk("%s:%d faking ACPI mode\n", __func__, __LINE__); ++// return_UINT32(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_LEGACY); + } + } diff --git a/patches/linux-6.1.8/0002-nmi-squelch.patch b/patches/linux-6.1.8/0002-nmi-squelch.patch new file mode 100644 index 00000000..bce1cd2f --- /dev/null +++ b/patches/linux-6.1.8/0002-nmi-squelch.patch @@ -0,0 +1,20 @@ +diff --recursive -u ./clean/linux-4.9.80/arch/x86/kernel/nmi.c linux-4.9.80/arch/x86/kernel/nmi.c +--- ./clean/linux-4.9.80/arch/x86/kernel/nmi.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/arch/x86/kernel/nmi.c 2018-02-07 18:56:10.475613884 -0500 +@@ -303,6 +303,8 @@ + + __this_cpu_add(nmi_stats.unknown, 1); + ++#if 0 ++// qemu generates these for some reason + pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n", + reason, smp_processor_id()); + +@@ -311,6 +313,7 @@ + nmi_panic(regs, "NMI: Not continuing"); + + pr_emerg("Dazed and confused, but trying to continue\n"); ++#endif + } + NOKPROBE_SYMBOL(unknown_nmi_error); + diff --git a/patches/linux-6.1.8/0010-winterfell-ahci.patch b/patches/linux-6.1.8/0010-winterfell-ahci.patch new file mode 100644 index 00000000..7f241773 --- /dev/null +++ b/patches/linux-6.1.8/0010-winterfell-ahci.patch @@ -0,0 +1,18 @@ +diff --recursive -u ./clean/linux-4.9.80/drivers/ata/libahci.c linux-4.9.80/drivers/ata/libahci.c +--- ./clean/linux-4.9.80/drivers/ata/libahci.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/drivers/ata/libahci.c 2018-02-07 18:02:32.526535910 -0500 +@@ -537,8 +537,12 @@ + } + + /* fabricate port_map from cap.nr_ports for < AHCI 1.3 */ +- if (!port_map && vers < 0x10300) { +- port_map = (1 << ahci_nr_ports(cap)) - 1; ++ if (!port_map) { // && vers < 0x10300) { ++ printk("%s: saved_port=%02x\n", __func__, hpriv->saved_port_map); ++ writel(0x1, mmio + HOST_PORTS_IMPL); ++ port_map = readl(mmio + HOST_PORTS_IMPL); ++ ++ //port_map = (1 << ahci_nr_ports(cap)) - 1; + dev_warn(dev, "forcing PORTS_IMPL to 0x%lx\n", port_map); + + /* write the fixed up value to the PI register */