[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230127114108.10025-24-joey.gouly@arm.com>
Date: Fri, 27 Jan 2023 11:41:04 +0000
From: Joey Gouly <joey.gouly@....com>
To: Andrew Jones <andrew.jones@...ux.dev>, <kvmarm@...ts.linux.dev>,
<kvm@...r.kernel.org>
CC: <joey.gouly@....com>, Alexandru Elisei <alexandru.elisei@....com>,
Christoffer Dall <christoffer.dall@....com>,
Fuad Tabba <tabba@...gle.com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Joey Gouly <Joey.Gouly@....com>, Marc Zyngier <maz@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Oliver Upton <oliver.upton@...ux.dev>,
Paolo Bonzini <pbonzini@...hat.com>,
Quentin Perret <qperret@...gle.com>,
Steven Price <steven.price@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
"Thomas Huth" <thuth@...hat.com>, Will Deacon <will@...nel.org>,
Zenghui Yu <yuzenghui@...wei.com>,
<linux-coco@...ts.linux.dev>, <kvmarm@...ts.cs.columbia.edu>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [RFC kvm-unit-tests 23/27] arm: realm: add RSI interface for attestation measurements
From: Suzuki K Poulose <suzuki.poulose@....com>
Add wrappers for the Attestation and measurement related RSI calls.
These will be later used in the test cases
Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
Signed-off-by: Joey Gouly <joey.gouly@....com>
---
lib/arm64/asm/rsi.h | 7 +++++++
lib/arm64/rsi.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/lib/arm64/asm/rsi.h b/lib/arm64/asm/rsi.h
index c8179341..50bab993 100644
--- a/lib/arm64/asm/rsi.h
+++ b/lib/arm64/asm/rsi.h
@@ -27,6 +27,13 @@ int rsi_invoke(unsigned int function_id, unsigned long arg0,
struct smccc_result *result);
int rsi_get_version(void);
+void rsi_attest_token_init(phys_addr_t addr, unsigned long *challenge,
+ struct smccc_result *res);
+void rsi_attest_token_continue(phys_addr_t addr, struct smccc_result *res);
+void rsi_extend_measurement(unsigned int index, unsigned long size,
+ unsigned long *measurement,
+ struct smccc_result *res);
+void rsi_read_measurement(unsigned int index, struct smccc_result *res);
static inline bool is_realm(void)
{
diff --git a/lib/arm64/rsi.c b/lib/arm64/rsi.c
index 08c77889..63d0620a 100644
--- a/lib/arm64/rsi.c
+++ b/lib/arm64/rsi.c
@@ -66,6 +66,38 @@ void arm_rsi_init(void)
prot_ns_shared = (1UL << phys_mask_shift);
}
+void rsi_attest_token_init(phys_addr_t addr, unsigned long *challenge,
+ struct smccc_result *res)
+{
+ rsi_invoke(SMC_RSI_ATTEST_TOKEN_INIT, addr,
+ challenge[0], challenge[1], challenge[2],
+ challenge[3], challenge[4], challenge[5],
+ challenge[6], challenge[7], 0, 0, res);
+}
+
+void rsi_attest_token_continue(phys_addr_t addr, struct smccc_result *res)
+{
+ rsi_invoke(SMC_RSI_ATTEST_TOKEN_CONTINUE, addr,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, res);
+}
+
+void rsi_extend_measurement(unsigned int index, unsigned long size,
+ unsigned long *measurement, struct smccc_result *res)
+{
+ rsi_invoke(SMC_RSI_MEASUREMENT_EXTEND, index, size,
+ measurement[0], measurement[1],
+ measurement[2], measurement[3],
+ measurement[4], measurement[5],
+ measurement[6], measurement[7],
+ 0, res);
+}
+
+void rsi_read_measurement(unsigned int index, struct smccc_result *res)
+{
+ rsi_invoke(SMC_RSI_MEASUREMENT_READ, index, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, res);
+}
+
static unsigned rsi_set_addr_range_state(unsigned long start, unsigned long size,
enum ripas_t state, unsigned long *top)
{
--
2.17.1
Powered by blists - more mailing lists