Commit 4a9ee4fc authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'kvmarm-fixes-7.1-2' of...

Merge tag 'kvmarm-fixes-7.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD

KVM/arm64 fixes for 7.1, take #2

- Add the pKVM side of the workaround for ARM's erratum 4193714, provided
  that the EL3 firmware does its part of the job. KVM will refuse to
  initialise otherwise.

- Correctly handle 52bit VAs for guest EL2 stage-1 translations when
  running under NV with E2H==0.

- Correctly deal with permission faults in guest_memfd memslots.

- Fix the steal-time selftest after the infrastructure was reworked.

- Make sure the host cannot pass a non-sensical clock update to the
  EL2 tracing infrastructure.

- Appoint Steffen Eiden as a reviewer in anticipation of the KVM/s390
  ability to run arm64 guests, which will inevitably lead to arm64
  code being directly used on s390.

- Make sure that EL2 is configured with both exception entry and exit
  being Context Synchronization Events.

- Handle the current vcpu being NULL on EL2 panic.

- Fix the selftest_vcpu memcache being empty at the point of donation or
  sharing.

- Check that the memcache has enough capacity before engaging on the
  share/donate path.

- Fix __deactivate_fgt() to use its parameter rather than a variable
  in the macro context.
parents 80f4a7b8 effc0a39
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14052,6 +14052,7 @@ KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)
M:	Marc Zyngier <maz@kernel.org>
M:	Oliver Upton <oupton@kernel.org>
R:	Joey Gouly <joey.gouly@arm.com>
R:	Steffen Eiden <seiden@linux.ibm.com>
R:	Suzuki K Poulose <suzuki.poulose@arm.com>
R:	Zenghui Yu <yuzenghui@huawei.com>
L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ static inline u64 tcr_el2_ps_to_tcr_el1_ips(u64 tcr_el2)
static inline u64 translate_tcr_el2_to_tcr_el1(u64 tcr)
{
	return TCR_EPD1_MASK |				/* disable TTBR1_EL1 */
	       ((tcr & TCR_EL2_DS) ? TCR_DS : 0) |
	       ((tcr & TCR_EL2_TBI) ? TCR_TBI0 : 0) |
	       tcr_el2_ps_to_tcr_el1_ips(tcr) |
	       (tcr & TCR_EL2_TG0_MASK) |
+1 −1
Original line number Diff line number Diff line
@@ -844,7 +844,7 @@
#define INIT_SCTLR_EL2_MMU_ON						\
	(SCTLR_ELx_M  | SCTLR_ELx_C | SCTLR_ELx_SA | SCTLR_ELx_I |	\
	 SCTLR_ELx_IESB | SCTLR_ELx_WXN | ENDIAN_SET_EL2 |		\
	 SCTLR_ELx_ITFSB | SCTLR_EL2_RES1)
	 SCTLR_ELx_ITFSB | SCTLR_ELx_EIS | SCTLR_ELx_EOS | SCTLR_EL2_RES1)

#define INIT_SCTLR_EL2_MMU_OFF \
	(SCTLR_EL2_RES1 | ENDIAN_SET_EL2)
+21 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 * Author: Christoffer Dall <c.dall@virtualopensystems.com>
 */

#include <linux/arm-smccc.h>
#include <linux/bug.h>
#include <linux/cpu_pm.h>
#include <linux/errno.h>
@@ -2638,6 +2639,22 @@ static int init_pkvm_host_sve_state(void)
	return 0;
}

static int pkvm_check_sme_dvmsync_fw_call(void)
{
	struct arm_smccc_res res;

	if (!cpus_have_final_cap(ARM64_WORKAROUND_4193714))
		return 0;

	arm_smccc_1_1_smc(ARM_SMCCC_CPU_WORKAROUND_4193714, &res);
	if (res.a0) {
		kvm_err("pKVM requires firmware support for C1-Pro erratum 4193714\n");
		return -ENODEV;
	}

	return 0;
}

/*
 * Finalizes the initialization of hyp mode, once everything else is initialized
 * and the initialziation process cannot fail.
@@ -2838,6 +2855,10 @@ static int __init init_hyp_mode(void)
		if (err)
			goto out_err;

		err = pkvm_check_sme_dvmsync_fw_call();
		if (err)
			goto out_err;

		err = kvm_hyp_init_protection(hyp_va_bits);
		if (err) {
			kvm_err("Failed to init hyp memory protection\n");
+1 −1
Original line number Diff line number Diff line
@@ -245,7 +245,7 @@ static inline void __activate_traps_ich_hfgxtr(struct kvm_vcpu *vcpu)
	__activate_fgt(hctxt, vcpu, ICH_HFGITR_EL2);
}

#define __deactivate_fgt(htcxt, vcpu, reg)				\
#define __deactivate_fgt(hctxt, vcpu, reg)				\
	do {								\
		write_sysreg_s(ctxt_sys_reg(hctxt, reg),		\
			       SYS_ ## reg);				\
Loading