[PATCH v14 26/44] arm64: RMI: Allow populating initial contents
Suzuki K Poulose
suzuki.poulose at arm.com
Mon Jun 8 02:41:47 PDT 2026
On 08/06/2026 10:36, Steven Price wrote:
> On 28/05/2026 06:30, Gavin Shan wrote:
>> Hi Steve,
>>
>> On 5/13/26 11:17 PM, Steven Price wrote:
>>> The VMM needs to populate the realm with some data before starting (e.g.
>>> a kernel and initrd). This is measured by the RMM and used as part of
>>> the attestation later on.
>>>
>>> Signed-off-by: Steven Price <steven.price at arm.com>
...
>>> diff --git a/arch/arm64/kvm/rmi.c b/arch/arm64/kvm/rmi.c
>>> index a89873a5eb77..209087bcf399 100644
>>> --- a/arch/arm64/kvm/rmi.c
>>> +++ b/arch/arm64/kvm/rmi.c
>>> @@ -486,6 +486,75 @@ void kvm_realm_unmap_range(struct kvm *kvm,
>>> unsigned long start,
>>> realm_unmap_private_range(kvm, start, end, may_block);
>>> }
>>> +static int realm_data_map_init(struct kvm *kvm, unsigned long ipa,
>>> + kvm_pfn_t dst_pfn, kvm_pfn_t src_pfn,
>>> + unsigned long flags)
>>> +{
>>> + struct realm *realm = &kvm->arch.realm;
>>> + phys_addr_t rd = virt_to_phys(realm->rd);
>>> + phys_addr_t dst_phys, src_phys;
>>> + int ret;
>>> +
>>> + dst_phys = __pfn_to_phys(dst_pfn);
>>> + src_phys = __pfn_to_phys(src_pfn);
>>> +
>>> + if (rmi_delegate_page(dst_phys))
>>> + return -ENXIO;
>>> +
>>> + ret = rmi_rtt_data_map_init(rd, dst_phys, ipa, src_phys, flags);
>>> + if (RMI_RETURN_STATUS(ret) == RMI_ERROR_RTT) {
>>> + /* Create missing RTTs and retry */
>>> + int level = RMI_RETURN_INDEX(ret);
>>> +
>>> + KVM_BUG_ON(level == KVM_PGTABLE_LAST_LEVEL, kvm);
>>
>> KVM_BUG_ON(level >= KVM_PGTABLE_LAST_LEVEL, kvm);
>
> Ack.
>
Thinking more about this, I guess a buggy VMM can trigger this
by populating twice ? (level == KVM_PGTABLE_LAST_LEVEL). So, we should
return the error back, than warning here and suppressing the error ?
Suzuki
More information about the linux-arm-kernel
mailing list