Commit fa5e4043 authored by Marc Zyngier's avatar Marc Zyngier
Browse files

Merge branch kvm-arm64/misc-6.14 into kvmarm-master/next



* kvm-arm64/misc-6.14:
  : .
  : Misc KVM/arm64 changes for 6.14
  :
  : - Don't expose AArch32 EL0 capability when NV is enabled
  :
  : - Update documentation to reflect the full gamut of kvm-arm.mode
  :   behaviours
  :
  : - Use the hypervisor VA bit width when dumping stacktraces
  :
  : - Decouple the hypervisor stack size from PAGE_SIZE, at least
  :   on the surface...
  :
  : - Make use of str_enabled_disabled() when advertising GICv4.1 support
  :
  : - Explicitly handle BRBE traps as UNDEFINED
  : .
  KVM: arm64: Explicitly handle BRBE traps as UNDEFINED
  KVM: arm64: vgic: Use str_enabled_disabled() in vgic_v3_probe()
  arm64: kvm: Introduce nvhe stack size constants
  KVM: arm64: Fix nVHE stacktrace VA bits mask
  Documentation: Update the behaviour of "kvm-arm.mode"
  KVM: arm64: nv: Advertise the lack of AArch32 EL0 support

Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parents 3643b334 a7f1fa55
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -2748,17 +2748,21 @@
			nvhe: Standard nVHE-based mode, without support for
			      protected guests.

			protected: nVHE-based mode with support for guests whose
				   state is kept private from the host.
			protected: Mode with support for guests whose state is
				   kept private from the host, using VHE or
				   nVHE depending on HW support.

			nested: VHE-based mode with support for nested
				virtualization. Requires at least ARMv8.3
				hardware.
				virtualization. Requires at least ARMv8.4
				hardware (with FEAT_NV2).

			Defaults to VHE/nVHE based on hardware support. Setting
			mode to "protected" will disable kexec and hibernation
			for the host. "nested" is experimental and should be
			used with extreme caution.
			for the host. To force nVHE on VHE hardware, add
			"arm64_sw.hvhe=0 id_aa64mmfr1.vh=0" to the
			command-line.
			"nested" is experimental and should be used with
			extreme caution.

	kvm-arm.vgic_v3_group0_trap=
			[KVM,ARM,EARLY] Trap guest accesses to GICv3 group-0
+2 −0
Original line number Diff line number Diff line
@@ -139,6 +139,8 @@ static __always_inline unsigned long __kern_hyp_va(unsigned long v)

#define kern_hyp_va(v) 	((typeof(v))(__kern_hyp_va((unsigned long)(v))))

extern u32 __hyp_va_bits;

/*
 * We currently support using a VM-specified IPA size. For backward
 * compatibility, the default IPA size is fixed to 40bits.
+4 −1
Original line number Diff line number Diff line
@@ -145,13 +145,16 @@

#define OVERFLOW_STACK_SIZE	SZ_4K

#define NVHE_STACK_SHIFT       PAGE_SHIFT
#define NVHE_STACK_SIZE        (UL(1) << NVHE_STACK_SHIFT)

/*
 * With the minimum frame size of [x29, x30], exactly half the combined
 * sizes of the hyp and overflow stacks is the maximum size needed to
 * save the unwinded stacktrace; plus an additional entry to delimit the
 * end.
 */
#define NVHE_STACKTRACE_SIZE	((OVERFLOW_STACK_SIZE + PAGE_SIZE) / 2 + sizeof(long))
#define NVHE_STACKTRACE_SIZE	((OVERFLOW_STACK_SIZE + NVHE_STACK_SIZE) / 2 + sizeof(long))

/*
 * Alignment of kernel segments (e.g. .text, .data).
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ static inline void kvm_nvhe_unwind_init(struct unwind_state *state,

DECLARE_KVM_NVHE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack);
DECLARE_KVM_NVHE_PER_CPU(struct kvm_nvhe_stacktrace_info, kvm_stacktrace_info);
DECLARE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
DECLARE_PER_CPU(unsigned long, kvm_arm_hyp_stack_base);

void kvm_nvhe_dump_backtrace(unsigned long hyp_offset);

+9 −9
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ static enum kvm_wfx_trap_policy kvm_wfe_trap_policy __read_mostly = KVM_WFX_NOTR

DECLARE_KVM_HYP_PER_CPU(unsigned long, kvm_hyp_vector);

DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_base);
DECLARE_KVM_NVHE_PER_CPU(struct kvm_nvhe_init_params, kvm_init_params);

DECLARE_KVM_NVHE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt);
@@ -2329,7 +2329,7 @@ static void __init teardown_hyp_mode(void)

	free_hyp_pgds();
	for_each_possible_cpu(cpu) {
		free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
		free_pages(per_cpu(kvm_arm_hyp_stack_base, cpu), NVHE_STACK_SHIFT - PAGE_SHIFT);
		free_pages(kvm_nvhe_sym(kvm_arm_hyp_percpu_base)[cpu], nvhe_percpu_order());

		if (free_sve) {
@@ -2517,15 +2517,15 @@ static int __init init_hyp_mode(void)
	 * Allocate stack pages for Hypervisor-mode
	 */
	for_each_possible_cpu(cpu) {
		unsigned long stack_page;
		unsigned long stack_base;

		stack_page = __get_free_page(GFP_KERNEL);
		if (!stack_page) {
		stack_base = __get_free_pages(GFP_KERNEL, NVHE_STACK_SHIFT - PAGE_SHIFT);
		if (!stack_base) {
			err = -ENOMEM;
			goto out_err;
		}

		per_cpu(kvm_arm_hyp_stack_page, cpu) = stack_page;
		per_cpu(kvm_arm_hyp_stack_base, cpu) = stack_base;
	}

	/*
@@ -2594,9 +2594,9 @@ static int __init init_hyp_mode(void)
	 */
	for_each_possible_cpu(cpu) {
		struct kvm_nvhe_init_params *params = per_cpu_ptr_nvhe_sym(kvm_init_params, cpu);
		char *stack_page = (char *)per_cpu(kvm_arm_hyp_stack_page, cpu);
		char *stack_base = (char *)per_cpu(kvm_arm_hyp_stack_base, cpu);

		err = create_hyp_stack(__pa(stack_page), &params->stack_hyp_va);
		err = create_hyp_stack(__pa(stack_base), &params->stack_hyp_va);
		if (err) {
			kvm_err("Cannot map hyp stack\n");
			goto out_err;
@@ -2608,7 +2608,7 @@ static int __init init_hyp_mode(void)
		 * __hyp_pa() won't do the right thing there, since the stack
		 * has been mapped in the flexible private VA space.
		 */
		params->stack_pa = __pa(stack_page);
		params->stack_pa = __pa(stack_base);
	}

	for_each_possible_cpu(cpu) {
Loading