[PATCH v5 07/11] KVM: arm64: CCA: Add Realm RTT mapping and invalidation helpers

Steven Price steven.price at arm.com
Wed Dec 2 03:49:29 PST 2026


On 01/12/2026 23:15, Suzuki K Poulose wrote:
> On 30/11/2026 14:25, Steven Price wrote:
>> Add the RMI RTT creation and unmap helpers needed by CCA Realm stage-2
>> memory operations. REC exit handling and guest requested RIPAS changes
>> follow in the vCPU series.
>>

[...]

>> +
>> +void kvm_realm_unmap_range_filter(struct kvm *kvm, unsigned long start,
>> +                  unsigned long size, bool may_block,
>> +                  enum kvm_gfn_range_filter attr_filter)
>> +{
>> +    /*
>> +     * MMU notifier callbacks only invalidate shared mappings, which can
>> +     * fall back to unmapping a larger block if an atomic split fails.
>> +     * Private invalidation uses a local cache instead of the eager
>> split
>> +     * cache protected by slots_lock.
>> +     */
>> +    struct kvm_mmu_memory_cache cache = { .gfp_zero = __GFP_ZERO };
> 
> Is it better to keep a cache in struct realm that can be used here
> instead of the local cache ? That could be reused for RMI_POPULATE
> and even SET_RIPAS.

The benefit of the local cache is it avoids locking issues. We drop
mmu_lock to allocate pages so that doesn't help coordinate a shared
cache, and holding it makes using another lock tricky without causing
lock ordering issues. SET_RIPAS already makes use of the vCPU cache and
RMI_POPULATE doesn't currently use a cache.

So a local cache is certainly much easier to reason about and without
evidence of it causing performance issues I'd be keen to keep it this way.

Thanks,
Steve




More information about the linux-arm-kernel mailing list