Skip to content

Commit

Permalink
linux kernel 5.10.214: add patches, modify nix required shebangs.patc…
Browse files Browse the repository at this point in the history
…h from linuxboot#1661 (less and less required but still some). Cannot remove 5.10.5 because kgpe-d16 uses it.

Signed-off-by: Thierry Laurion <[email protected]>
  • Loading branch information
tlaurion committed May 17, 2024
1 parent 2c07ea3 commit 3951634
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
32 changes: 32 additions & 0 deletions patches/linux-5.10.214/0001-fake-acpi.patch
Original file line number Diff line number Diff line change
@@ -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);
}
}
20 changes: 20 additions & 0 deletions patches/linux-5.10.214/0002-nmi-squelch.patch
Original file line number Diff line number Diff line change
@@ -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);

28 changes: 28 additions & 0 deletions patches/linux-5.10.214/0003-fake-trampoline.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --recursive -u ./clean/linux-4.9.80/arch/x86/realmode/init.c linux-4.9.80/arch/x86/realmode/init.c
--- ./clean/linux-4.9.80/arch/x86/realmode/init.c 2018-02-03 11:05:43.000000000 -0500
+++ linux-4.9.80/arch/x86/realmode/init.c 2018-02-07 15:51:28.538500435 -0500
@@ -35,8 +35,8 @@
/* Has to be under 1M so we can execute real-mode AP code. */
mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE);
if (!mem) {
- pr_info("No sub-1M memory is available for the trampoline\n");
- return;
+ mem = 0x4000;
+ pr_info("No sub-1M memory is available for the trampoline, guessing %p\n", mem);
}

memblock_reserve(mem, size);
@@ -138,7 +138,12 @@
static int __init init_real_mode(void)
{
if (!real_mode_header)
- panic("Real mode trampoline was not allocated");
+ {
+ // ignore for now
+ //panic("Real mode trampoline was not allocated");
+ pr_warn("Real mode trampoline was not allocated");
+ return 0;
+ }

setup_real_mode();
set_real_mode_permissions();
18 changes: 18 additions & 0 deletions patches/linux-5.10.214/0010-winterfell-ahci.patch
Original file line number Diff line number Diff line change
@@ -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%x\n", port_map);

/* write the fixed up value to the PI register */
40 changes: 40 additions & 0 deletions patches/linux-5.10.214/shebangs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/scripts/check-sysctl-docs b/scripts/check-sysctl-docs
index 8bcb9e26c7bc..90137319c50a 100755
--- a/scripts/check-sysctl-docs
+++ b/scripts/check-sysctl-docs
@@ -1,4 +1,4 @@
-#!/usr/bin/gawk -f
+#!/usr/bin/env -S gawk -f
# SPDX-License-Identifier: GPL-2.0

# Script to check sysctl documentation against source files
diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
index f2be0ff9a738..7a5b546ece16 100755
--- a/scripts/ld-version.sh
+++ b/scripts/ld-version.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/awk -f
+#!/usr/bin/env -S awk -f
# SPDX-License-Identifier: GPL-2.0
# extract linker version number from stdin and turn into single number
{
diff --git a/scripts/parse-maintainers.pl b/scripts/parse-maintainers.pl
index 2ca4eb3f190d..9515765158fa 100755
--- a/scripts/parse-maintainers.pl
+++ b/scripts/parse-maintainers.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env -S perl -w
# SPDX-License-Identifier: GPL-2.0

use strict;
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 0968a3070eff..345b92f71d2d 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -1,4 +1,4 @@
-#!/usr/bin/awk -f
+#!/usr/bin/env -S awk -f
# SPDX-License-Identifier: GPL-2.0
# Before running this script please ensure that your PATH is
# typical as you use for compilation/installation. I use

0 comments on commit 3951634

Please sign in to comment.