Re: [PATCH v17 00/20] KVM: arm64: CCA: Add basic plumbing for Realms
From: Suzuki K Poulose
Date: Wed Sep 09 2026 - 10:40:23 EST
On 09/09/2026 14:18, Fuad Tabba wrote:
Hi Suzuki,
On Tue, 8 Sept 2026 at 17:22, Suzuki K Poulose <suzuki.poulose@xxxxxxx> wrote:
...
3) NEW: Enlighten KVM arm64 about the different VM types and use call backs for
the VM type, rather than spilling the is_this_type_of_vm() everywhere. This is
not complete yet, but it is largely functional. Adds VCPU and Stage2 MMU related
callbacks with support for the existing VM types.
A design thought on the vm_flavor dispatch tables. They're
hand-maintained arrays indexed by enum, and a gap fails silently at
runtime, not at build: arm64_vm_s2_ops[] has no VM_REALM row, so a
realm VM would get NULL ops.
How about something like declaring it unsized with
BUILD_BUG_ON(ARRAY_SIZE(arm64_vm_s2_ops) != VM_FLAVOR_MAX), as
host_hcall does? A non-NULL check of the selected ops' mandatory
callbacks at VM init would catch the s2_ops naming typo Sashiko
caught, where the rows point at zeroed forward-declared structs.
Agreed, I will add that. The VM_REALM S2 ops will come in the next part,
as we can't have anything meaningful without the RMI backends.
Thanks for the review !
Cheers
Suzuki