[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241029141114.7207-1-jeremy.linton@arm.com>
Date: Tue, 29 Oct 2024 09:11:14 -0500
From: Jeremy Linton <jeremy.linton@....com>
To: linux-arm-kernel@...ts.infradead.org
Cc: steven.price@....com,
suzuki.poulose@....com,
catalin.marinas@....com,
will@...nel.org,
gshan@...hat.com,
sami.mujawar@....com,
linux-kernel@...r.kernel.org,
Jeremy Linton <jeremy.linton@....com>
Subject: [PATCH] arm64: rsi: Add automatic arm-cca-guest module loading
The TSM module provides both guest identification as well as
attestation when a guest is run in CCA mode. Lets assure by creating a
dummy platform device that the module is automatically loaded during
boot. Once it is in place it can be used earlier in the boot process
to say decrypt a LUKS rootfs.
Signed-off-by: Jeremy Linton <jeremy.linton@....com>
---
arch/arm64/include/asm/rsi.h | 2 ++
arch/arm64/kernel/rsi.c | 15 +++++++++++++++
drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 7 +++++++
3 files changed, 24 insertions(+)
diff --git a/arch/arm64/include/asm/rsi.h b/arch/arm64/include/asm/rsi.h
index 188cbb9b23f5..1b14a4c4257a 100644
--- a/arch/arm64/include/asm/rsi.h
+++ b/arch/arm64/include/asm/rsi.h
@@ -10,6 +10,8 @@
#include <linux/jump_label.h>
#include <asm/rsi_cmds.h>
+#define ARMV9_RSI_PDEV_NAME "arm-cca-dev"
+
DECLARE_STATIC_KEY_FALSE(rsi_present);
void __init arm64_rsi_init(void);
diff --git a/arch/arm64/kernel/rsi.c b/arch/arm64/kernel/rsi.c
index 3031f25c32ef..ad963eb12921 100644
--- a/arch/arm64/kernel/rsi.c
+++ b/arch/arm64/kernel/rsi.c
@@ -8,6 +8,7 @@
#include <linux/psci.h>
#include <linux/swiotlb.h>
#include <linux/cc_platform.h>
+#include <linux/platform_device.h>
#include <asm/io.h>
#include <asm/mem_encrypt.h>
@@ -140,3 +141,17 @@ void __init arm64_rsi_init(void)
static_branch_enable(&rsi_present);
}
+static struct platform_device rsi_dev = {
+ .name = ARMV9_RSI_PDEV_NAME,
+ .id = -1
+};
+
+static int __init rsi_init(void)
+{
+ if (is_realm_world())
+ if (platform_device_register(&rsi_dev))
+ pr_err("failed to register rsi platform device");
+ return 0;
+}
+
+arch_initcall(rsi_init)
diff --git a/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c b/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c
index 488153879ec9..e7ef3b83d5d9 100644
--- a/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c
+++ b/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c
@@ -6,6 +6,7 @@
#include <linux/arm-smccc.h>
#include <linux/cc_platform.h>
#include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/smp.h>
#include <linux/tsm.h>
@@ -219,6 +220,12 @@ static void __exit arm_cca_guest_exit(void)
}
module_exit(arm_cca_guest_exit);
+static const struct platform_device_id arm_cca_match[] = {
+ { ARMV9_RSI_PDEV_NAME, 0},
+ { }
+};
+
+MODULE_DEVICE_TABLE(platform, arm_cca_match);
MODULE_AUTHOR("Sami Mujawar <sami.mujawar@....com>");
MODULE_DESCRIPTION("Arm CCA Guest TSM Driver");
MODULE_LICENSE("GPL");
--
2.46.0
Powered by blists - more mailing lists