On Mon, 04 Aug 2025 15:41:48 +0100, Alexandru Elisei <alexandru.elisei@xxxxxxx> wrote: > > Hi Andre, > > On Tue, Jul 29, 2025 at 10:57:41AM +0100, Andre Przywara wrote: > > The ARMv8.3 architecture update includes support for nested > > virtualization. Allow the user to specify "--nested" to start a guest in > > (virtual) EL2 instead of EL1. > > This will also change the PSCI conduit from HVC to SMC in the device > > tree. > > > > Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> > > --- > > arm64/fdt.c | 5 ++++- > > arm64/include/kvm/kvm-config-arch.h | 5 ++++- > > arm64/kvm-cpu.c | 12 +++++++++++- > > 3 files changed, 19 insertions(+), 3 deletions(-) > > > > diff --git a/arm64/fdt.c b/arm64/fdt.c > > index df7775876..98f1dd9d4 100644 > > --- a/arm64/fdt.c > > +++ b/arm64/fdt.c > > @@ -205,7 +205,10 @@ static int setup_fdt(struct kvm *kvm) > > _FDT(fdt_property_string(fdt, "compatible", "arm,psci")); > > fns = &psci_0_1_fns; > > } > > - _FDT(fdt_property_string(fdt, "method", "hvc")); > > + if (kvm->cfg.arch.nested_virt) > > + _FDT(fdt_property_string(fdt, "method", "smc")); > > + else > > + _FDT(fdt_property_string(fdt, "method", "hvc")); > > _FDT(fdt_property_cell(fdt, "cpu_suspend", fns->cpu_suspend)); > > _FDT(fdt_property_cell(fdt, "cpu_off", fns->cpu_off)); > > _FDT(fdt_property_cell(fdt, "cpu_on", fns->cpu_on)); > > diff --git a/arm64/include/kvm/kvm-config-arch.h b/arm64/include/kvm/kvm-config-arch.h > > index ee031f010..a1dac28e6 100644 > > --- a/arm64/include/kvm/kvm-config-arch.h > > +++ b/arm64/include/kvm/kvm-config-arch.h > > @@ -10,6 +10,7 @@ struct kvm_config_arch { > > bool aarch32_guest; > > bool has_pmuv3; > > bool mte_disabled; > > + bool nested_virt; > > u64 kaslr_seed; > > enum irqchip_type irqchip; > > u64 fw_addr; > > @@ -57,6 +58,8 @@ int sve_vl_parser(const struct option *opt, const char *arg, int unset); > > "Type of interrupt controller to emulate in the guest", \ > > irqchip_parser, NULL), \ > > OPT_U64('\0', "firmware-address", &(cfg)->fw_addr, \ > > - "Address where firmware should be loaded"), > > + "Address where firmware should be loaded"), \ > > + OPT_BOOLEAN('\0', "nested", &(cfg)->nested_virt, \ > > --nested sounds a bit vague (what if KVM decides to nest something else in the > future?) and the variable that keeps track of the parameter is called > 'nested_virt'. Is it too late to rename --nested to --nested-virt for > consistency and better clarity? I disagree. 'nested' is pretty much unambiguous in the context of virtualisation. 'nested-virt' is only an overstatement of an idiom that anyone playing with kvmtool will understand. M. -- Jazz isn't dead. It just smells funny.