Skip to content

Commit 00a3b30

Browse files
committed
Rebase on a 6.12.3 kernel
Rebase on a 6.12.3 kernel, jumping to the next LTS series. Only a surprisingly small amount of changes needed in the patches, mostly in the DGRAM and TSI sets. A new qboot binary was also needed with a very small change to account for the new SEV kernel entry point (tested under SEV-ES on Naples). We also dropped "0009-tests-add-vsock-dgram-tests.patch" to reduce the maintenance burden (was useless anyway). Signed-off-by: Sergio Lopez <[email protected]>
1 parent 563389b commit 00a3b30

26 files changed

+360
-1100
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
KERNEL_VERSION = linux-6.6.63
1+
KERNEL_VERSION = linux-6.12.3
22
KERNEL_REMOTE = https://cdn.kernel.org/pub/linux/kernel/v6.x/$(KERNEL_VERSION).tar.xz
33
KERNEL_TARBALL = tarballs/$(KERNEL_VERSION).tar.xz
44
KERNEL_SOURCES = $(KERNEL_VERSION)
55
KERNEL_PATCHES = $(shell find patches/ -name "0*.patch" | sort)
66
KERNEL_C_BUNDLE = kernel.c
77

88
ABI_VERSION = 4
9-
FULL_VERSION = 4.6.0
10-
TIMESTAMP = "Mon Dec 2 11:39:28 CET 2024"
9+
FULL_VERSION = 4.7.0
10+
TIMESTAMP = "Wed Dec 11 20:34:13 CET 2024"
1111

1212
KERNEL_FLAGS = KBUILD_BUILD_TIMESTAMP=$(TIMESTAMP)
1313
KERNEL_FLAGS += KBUILD_BUILD_USER=root

patches-sev/0001-virtio-enable-DMA-API-if-memory-is-restricted.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 937e56d777cf3809a5ac0a5d8d42dfcbcc93c330 Mon Sep 17 00:00:00 2001
1+
From 08321e01f374236bbd4358824a7d0bed75db56ca Mon Sep 17 00:00:00 2001
22
From: Sergio Lopez <[email protected]>
33
Date: Fri, 10 Sep 2021 13:05:01 +0200
44
Subject: [PATCH 1/4] virtio: enable DMA API if memory is restricted
@@ -15,10 +15,10 @@ Signed-off-by: Sergio Lopez <[email protected]>
1515
2 files changed, 4 insertions(+), 6 deletions(-)
1616

1717
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
18-
index 71dee622b771..f92475dbca43 100644
18+
index b9095751e43b..9e6420d5bc66 100644
1919
--- a/drivers/virtio/virtio.c
2020
+++ b/drivers/virtio/virtio.c
21-
@@ -180,12 +180,6 @@ static int virtio_features_ok(struct virtio_device *dev)
21+
@@ -213,12 +213,6 @@ static int virtio_features_ok(struct virtio_device *dev)
2222
"device must provide VIRTIO_F_VERSION_1\n");
2323
return -ENODEV;
2424
}
@@ -32,7 +32,7 @@ index 71dee622b771..f92475dbca43 100644
3232

3333
if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1))
3434
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
35-
index 80669e05bf0e..438b4f6c5cdb 100644
35+
index 98374ed7c577..8daebc83208c 100644
3636
--- a/drivers/virtio/virtio_ring.c
3737
+++ b/drivers/virtio/virtio_ring.c
3838
@@ -6,6 +6,7 @@

patches-sev/0002-x86-sev-write-AP-reset-vector.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 15cc4533c0e0bfa1b8a762ecffb5486ed258d87a Mon Sep 17 00:00:00 2001
1+
From 9da8c48cd0849c0c58b848c01f8cca7adf79ee70 Mon Sep 17 00:00:00 2001
22
From: Sergio Lopez <[email protected]>
33
Date: Thu, 20 Oct 2022 10:23:16 +0200
44
Subject: [PATCH 2/4] x86/sev: write AP reset vector
@@ -8,14 +8,14 @@ into the AP reset vector used by libkrun's qboot.
88

99
Signed-off-by: Sergio Lopez <[email protected]>
1010
---
11-
arch/x86/kernel/sev.c | 25 ++++++++++++++++++++++++-
11+
arch/x86/coco/sev/core.c | 25 ++++++++++++++++++++++++-
1212
1 file changed, 24 insertions(+), 1 deletion(-)
1313

14-
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
15-
index 9905dc0e0b09..38df85fd1324 100644
16-
--- a/arch/x86/kernel/sev.c
17-
+++ b/arch/x86/kernel/sev.c
18-
@@ -1116,6 +1116,29 @@ void __init snp_set_wakeup_secondary_cpu(void)
14+
diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
15+
index de1df0cb45da..7ed486a790fb 100644
16+
--- a/arch/x86/coco/sev/core.c
17+
+++ b/arch/x86/coco/sev/core.c
18+
@@ -1266,6 +1266,29 @@ void __init snp_set_wakeup_secondary_cpu(void)
1919
apic_update_callback(wakeup_secondary_cpu, wakeup_cpu_via_vmgexit);
2020
}
2121

@@ -45,7 +45,7 @@ index 9905dc0e0b09..38df85fd1324 100644
4545
int __init sev_es_setup_ap_jump_table(struct real_mode_header *rmh)
4646
{
4747
u16 startup_cs, startup_ip;
48-
@@ -1127,7 +1150,7 @@ int __init sev_es_setup_ap_jump_table(struct real_mode_header *rmh)
48+
@@ -1277,7 +1300,7 @@ int __init sev_es_setup_ap_jump_table(struct real_mode_header *rmh)
4949

5050
/* On UP guests there is no jump table so this is not a failure */
5151
if (!jump_table_addr)

patches-sev/0003-Implement-driver-to-retrieve-secrets-from-cmdline.patch

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 4db2da9b067d0c7b10d7f7543c45dcb0d608e307 Mon Sep 17 00:00:00 2001
1+
From ff94a2d240ee168296ce4e2bb3370ee10272bbef Mon Sep 17 00:00:00 2001
22
From: Sergio Lopez <[email protected]>
33
Date: Wed, 3 Aug 2022 12:35:12 +0200
44
Subject: [PATCH 3/4] Implement driver to retrieve secrets from cmdline
@@ -14,24 +14,24 @@ efi_secret.c
1414

1515
Signed-off-by: Sergio Lopez <[email protected]>
1616
---
17-
arch/x86/kernel/setup.c | 7 +
18-
drivers/virt/Kconfig | 2 +
19-
drivers/virt/Makefile | 1 +
17+
arch/x86/kernel/setup.c | 6 +
18+
drivers/virt/coco/Kconfig | 2 +
19+
drivers/virt/coco/Makefile | 1 +
2020
drivers/virt/coco/cmdline_secret/Kconfig | 13 ++
2121
drivers/virt/coco/cmdline_secret/Makefile | 2 +
2222
.../virt/coco/cmdline_secret/cmdline_secret.c | 135 ++++++++++++++++++
2323
include/linux/init.h | 4 +
2424
init/main.c | 13 ++
25-
8 files changed, 177 insertions(+)
25+
8 files changed, 176 insertions(+)
2626
create mode 100644 drivers/virt/coco/cmdline_secret/Kconfig
2727
create mode 100644 drivers/virt/coco/cmdline_secret/Makefile
2828
create mode 100644 drivers/virt/coco/cmdline_secret/cmdline_secret.c
2929

3030
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
31-
index eb129277dcdd..3906896a62af 100644
31+
index f1fea506e20f..3778d544e93b 100644
3232
--- a/arch/x86/kernel/setup.c
3333
+++ b/arch/x86/kernel/setup.c
34-
@@ -876,7 +876,9 @@ void __init setup_arch(char **cmdline_p)
34+
@@ -751,12 +751,18 @@ void __init setup_arch(char **cmdline_p)
3535
*/
3636
__flush_tlb_all();
3737
#else
@@ -41,42 +41,40 @@ index eb129277dcdd..3906896a62af 100644
4141
boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
4242
#endif
4343

44-
@@ -961,6 +963,11 @@ void __init setup_arch(char **cmdline_p)
45-
4644
#ifdef CONFIG_CMDLINE_BOOL
4745
#ifdef CONFIG_CMDLINE_OVERRIDE
4846
+#ifdef CONFIG_CMDLINE_SECRET
4947
+ strscpy(early_secret_cmdline, boot_command_line, COMMAND_LINE_SIZE);
5048
+ memzero_explicit(boot_command_line, COMMAND_LINE_SIZE);
51-
+ clflush_cache_range(boot_command_line, COMMAND_LINE_SIZE);
5249
+#endif
5350
strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
5451
#else
5552
if (builtin_cmdline[0]) {
56-
diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig
57-
index f79ab13a5c28..4a62feec1a0e 100644
58-
--- a/drivers/virt/Kconfig
59-
+++ b/drivers/virt/Kconfig
60-
@@ -50,6 +50,8 @@ source "drivers/virt/acrn/Kconfig"
61-
62-
source "drivers/virt/coco/efi_secret/Kconfig"
53+
diff --git a/drivers/virt/coco/Kconfig b/drivers/virt/coco/Kconfig
54+
index d9ff676bf48d..fd37c502b42d 100644
55+
--- a/drivers/virt/coco/Kconfig
56+
+++ b/drivers/virt/coco/Kconfig
57+
@@ -7,6 +7,8 @@ config TSM_REPORTS
58+
select CONFIGFS_FS
59+
tristate
6360

6461
+source "drivers/virt/coco/cmdline_secret/Kconfig"
6562
+
66-
source "drivers/virt/coco/sev-guest/Kconfig"
63+
source "drivers/virt/coco/efi_secret/Kconfig"
6764

68-
source "drivers/virt/coco/tdx-guest/Kconfig"
69-
diff --git a/drivers/virt/Makefile b/drivers/virt/Makefile
70-
index e9aa6fc96fab..9174d4f9286e 100644
71-
--- a/drivers/virt/Makefile
72-
+++ b/drivers/virt/Makefile
73-
@@ -10,5 +10,6 @@ obj-y += vboxguest/
74-
obj-$(CONFIG_NITRO_ENCLAVES) += nitro_enclaves/
75-
obj-$(CONFIG_ACRN_HSM) += acrn/
76-
obj-$(CONFIG_EFI_SECRET) += coco/efi_secret/
77-
+obj-$(CONFIG_CMDLINE_SECRET) += coco/cmdline_secret/
78-
obj-$(CONFIG_SEV_GUEST) += coco/sev-guest/
79-
obj-$(CONFIG_INTEL_TDX_GUEST) += coco/tdx-guest/
65+
source "drivers/virt/coco/pkvm-guest/Kconfig"
66+
diff --git a/drivers/virt/coco/Makefile b/drivers/virt/coco/Makefile
67+
index b69c30c1c720..da3d9254900c 100644
68+
--- a/drivers/virt/coco/Makefile
69+
+++ b/drivers/virt/coco/Makefile
70+
@@ -3,6 +3,7 @@
71+
# Confidential computing related collateral
72+
#
73+
obj-$(CONFIG_TSM_REPORTS) += tsm.o
74+
+obj-$(CONFIG_CMDLINE_SECRET) += cmdline_secret/
75+
obj-$(CONFIG_EFI_SECRET) += efi_secret/
76+
obj-$(CONFIG_ARM_PKVM_GUEST) += pkvm-guest/
77+
obj-$(CONFIG_SEV_GUEST) += sev-guest/
8078
diff --git a/drivers/virt/coco/cmdline_secret/Kconfig b/drivers/virt/coco/cmdline_secret/Kconfig
8179
new file mode 100644
8280
index 000000000000..bb601280d50d
@@ -246,7 +244,7 @@ index 000000000000..e53edce18768
246244
+module_init(cmdline_secret_init);
247245
+module_exit(cmdline_secret_exit);
248246
diff --git a/include/linux/init.h b/include/linux/init.h
249-
index 01b52c9c7526..889a0cf32832 100644
247+
index ee1309473bc6..96c0f3c72395 100644
250248
--- a/include/linux/init.h
251249
+++ b/include/linux/init.h
252250
@@ -143,6 +143,10 @@ extern int do_one_initcall(initcall_t fn);
@@ -261,10 +259,10 @@ index 01b52c9c7526..889a0cf32832 100644
261259

262260
/* used by init/main.c */
263261
diff --git a/init/main.c b/init/main.c
264-
index c787e94cc898..2fb8a8af9af6 100644
262+
index c4778edae797..a475bd3bcb34 100644
265263
--- a/init/main.c
266264
+++ b/init/main.c
267-
@@ -147,6 +147,11 @@ static char *extra_command_line;
265+
@@ -149,6 +149,11 @@ static char *extra_command_line;
268266
/* Extra init arguments */
269267
static char *extra_init_args;
270268

@@ -276,7 +274,7 @@ index c787e94cc898..2fb8a8af9af6 100644
276274
#ifdef CONFIG_BOOT_CONFIG
277275
/* Is bootconfig on command line? */
278276
static bool bootconfig_found;
279-
@@ -670,6 +675,14 @@ static void __init setup_command_line(char *command_line)
277+
@@ -685,6 +690,14 @@ static void __init setup_command_line(char *command_line)
280278
}
281279

282280
saved_command_line_len = strlen(saved_command_line);

patches-sev/0004-x86-sev-Avoid-using-native_cpuid.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From d53bef286ab6731ad5c721537ef8ad3ec39c0200 Mon Sep 17 00:00:00 2001
1+
From 459990b97e11b3be4272d06b4647bdab6bdf099e Mon Sep 17 00:00:00 2001
22
From: Sergio Lopez <[email protected]>
33
Date: Wed, 5 Jun 2024 16:20:08 +0200
44
Subject: [PATCH 4/4] x86/sev: Avoid using native_cpuid
@@ -16,7 +16,7 @@ Signed-off-by: Sergio Lopez <[email protected]>
1616
1 file changed, 3 insertions(+), 23 deletions(-)
1717

1818
diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c
19-
index cc47a818a640..a2b5b08eee23 100644
19+
index ac33b2263a43..d894fdb89007 100644
2020
--- a/arch/x86/mm/mem_encrypt_identity.c
2121
+++ b/arch/x86/mm/mem_encrypt_identity.c
2222
@@ -495,37 +495,17 @@ void __head sme_enable(struct boot_params *bp)

patches/0001-krunfw-Don-t-panic-when-init-dies.patch

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From a6442523102c4d482bf24f0f21a38ae29b3f0c8c Mon Sep 17 00:00:00 2001
1+
From 784c1bce5f1ca4c39d6c94dd1db220291cb26f9a Mon Sep 17 00:00:00 2001
22
From: Sergio Lopez <[email protected]>
33
Date: Thu, 2 Mar 2023 07:34:49 +0100
4-
Subject: [PATCH 01/20] krunfw: Don't panic when init dies
4+
Subject: [PATCH 01/19] krunfw: Don't panic when init dies
55

66
In libkrun, the isolated process runs as PID 1. When it exits,
77
trigger an orderly reboot instead of panic'ing.
@@ -11,23 +11,24 @@ play with the printk levels instead.
1111

1212
Signed-off-by: Sergio Lopez <[email protected]>
1313
---
14-
kernel/exit.c | 5 +++++
14+
kernel/exit.c | 6 ++++++
1515
kernel/reboot.c | 2 ++
16-
2 files changed, 7 insertions(+)
16+
2 files changed, 8 insertions(+)
1717

1818
diff --git a/kernel/exit.c b/kernel/exit.c
19-
index 3540b2c9b1b6..8348e9825945 100644
19+
index 619f0014c33b..987bec96ebee 100644
2020
--- a/kernel/exit.c
2121
+++ b/kernel/exit.c
22-
@@ -69,6 +69,7 @@
22+
@@ -69,6 +69,8 @@
2323
#include <linux/rethook.h>
2424
#include <linux/sysfs.h>
2525
#include <linux/user_events.h>
2626
+#include <linux/reboot.h>
27-
27+
+
2828
#include <linux/uaccess.h>
29-
#include <asm/unistd.h>
30-
@@ -840,8 +841,12 @@ void __noreturn do_exit(long code)
29+
30+
#include <uapi/linux/wait.h>
31+
@@ -905,8 +907,12 @@ void __noreturn do_exit(long code)
3132
* immediately to get a useable coredump.
3233
*/
3334
if (unlikely(is_global_init(tsk)))
@@ -41,10 +42,10 @@ index 3540b2c9b1b6..8348e9825945 100644
4142
#ifdef CONFIG_POSIX_TIMERS
4243
hrtimer_cancel(&tsk->signal->real_timer);
4344
diff --git a/kernel/reboot.c b/kernel/reboot.c
44-
index 6ebef11c8876..4323caa5b871 100644
45+
index f05dbde2c93f..f047bde90c03 100644
4546
--- a/kernel/reboot.c
4647
+++ b/kernel/reboot.c
47-
@@ -269,10 +269,12 @@ void kernel_restart(char *cmd)
48+
@@ -278,10 +278,12 @@ void kernel_restart(char *cmd)
4849
do_kernel_restart_prepare();
4950
migrate_to_reboot_cpu();
5051
syscore_shutdown();

patches/0002-krunfw-Ignore-run_cmd-on-orderly-reboot.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 46b2f712bf3d3de11cbc0358ec6f833be99f2f49 Mon Sep 17 00:00:00 2001
1+
From c843c27bf58ade43ae935391ade4908d980ba1a2 Mon Sep 17 00:00:00 2001
22
From: Sergio Lopez <[email protected]>
33
Date: Mon, 16 May 2022 16:04:27 +0200
4-
Subject: [PATCH 02/20] krunfw: Ignore run_cmd on orderly reboot
4+
Subject: [PATCH 02/19] krunfw: Ignore run_cmd on orderly reboot
55

66
We don't really support restarting the conventional way, so ignore
77
"run_cmd" so we can fall back to an emergency sync and reboot.
@@ -12,10 +12,10 @@ Signed-off-by: Sergio Lopez <[email protected]>
1212
1 file changed, 4 insertions(+)
1313

1414
diff --git a/kernel/reboot.c b/kernel/reboot.c
15-
index 4323caa5b871..d9d6f0dd2ebc 100644
15+
index f047bde90c03..aeea51201f90 100644
1616
--- a/kernel/reboot.c
1717
+++ b/kernel/reboot.c
18-
@@ -836,7 +836,11 @@ static int __orderly_reboot(void)
18+
@@ -852,7 +852,11 @@ static int __orderly_reboot(void)
1919
{
2020
int ret;
2121

0 commit comments

Comments
 (0)