lkml.org 
[lkml]   [2023]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC kvm-unit-tests 23/27] arm: realm: add RSI interface for attestation measurements
    Date
    From: Suzuki K Poulose <suzuki.poulose@arm.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@arm.com>
    Signed-off-by: Joey Gouly <joey.gouly@arm.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
    \
     
     \ /
      Last update: 2023-03-26 23:58    [W:5.574 / U:1.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site