mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-25 08:33:21 -04:00
Merge branch kvm-arm64/misc-7.2 into kvmarm-master/next
* kvm-arm64/misc-7.2: : . : - Check for a valid vcpu pointer upon deactivating traps when handling : a HYP panic in VHE mode : : - Make the __deactivate_fgt() macro use its arguments instead of the : surrounding context : : - Don't bother with initialising TPIDR_EL2 in the hyp stubs, as this : is already taken care of in more obvious places : : - Drop the unused kvm_arch pointer passed to __load_stage2() : : - Return -EOPNOTSUPP when a hypercall fails for some reason, instead of : returning whatever was in the result structure : : - Make the ITS ABI selection helpers return void, which avoids wondering : about the nature of the return code (always 0) : . KVM: arm64: vgic-its: Make ABI commit helpers return void KVM: arm64: Set a Linux errno on SMCCC error in kvm_call_hyp_nvhe() KVM: arm64: Remove @arch from __load_stage2() KVM: arm64: Don't populate TPIDR_EL2 in finalise_el2() KVM: arm64: Fix __deactivate_fgt macro parameter typo KVM: arm64: Guard against NULL vcpu on VHE hyp panic path Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
@@ -1274,13 +1274,14 @@ void kvm_arm_resume_guest(struct kvm *kvm);
|
||||
#define vcpu_has_run_once(vcpu) (!!READ_ONCE((vcpu)->pid))
|
||||
|
||||
#ifndef __KVM_NVHE_HYPERVISOR__
|
||||
#define kvm_call_hyp_nvhe(f, ...) \
|
||||
#define kvm_call_hyp_nvhe(f, ...) \
|
||||
({ \
|
||||
struct arm_smccc_res res; \
|
||||
\
|
||||
arm_smccc_1_1_hvc(KVM_HOST_SMCCC_FUNC(f), \
|
||||
##__VA_ARGS__, &res); \
|
||||
WARN_ON(res.a0 != SMCCC_RET_SUCCESS); \
|
||||
if (WARN_ON(res.a0 != SMCCC_RET_SUCCESS)) \
|
||||
res.a1 = -EOPNOTSUPP; \
|
||||
\
|
||||
res.a1; \
|
||||
})
|
||||
|
||||
@@ -318,8 +318,7 @@ static __always_inline u64 kvm_get_vttbr(struct kvm_s2_mmu *mmu)
|
||||
* Must be called from hyp code running at EL2 with an updated VTTBR
|
||||
* and interrupts disabled.
|
||||
*/
|
||||
static __always_inline void __load_stage2(struct kvm_s2_mmu *mmu,
|
||||
struct kvm_arch *arch)
|
||||
static __always_inline void __load_stage2(struct kvm_s2_mmu *mmu)
|
||||
{
|
||||
write_sysreg(mmu->vtcr, vtcr_el2);
|
||||
write_sysreg(kvm_get_vttbr(mmu), vttbr_el2);
|
||||
|
||||
@@ -104,11 +104,9 @@ SYM_CODE_START_LOCAL(__finalise_el2)
|
||||
mov_q x0, HCR_HOST_VHE_FLAGS
|
||||
msr_hcr_el2 x0
|
||||
|
||||
// Use the EL1 allocated stack, per-cpu offset
|
||||
// Use the EL1 allocated stack
|
||||
mrs x0, sp_el1
|
||||
mov sp, x0
|
||||
mrs x0, tpidr_el1
|
||||
msr tpidr_el2, x0
|
||||
|
||||
// FP configuration, vectors
|
||||
mrs_s x0, SYS_CPACR_EL12
|
||||
|
||||
@@ -1449,7 +1449,7 @@ static u64 __kvm_at_s1e01_fast(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
|
||||
}
|
||||
}
|
||||
write_sysreg_el1(vcpu_read_sys_reg(vcpu, SCTLR_EL1), SYS_SCTLR);
|
||||
__load_stage2(mmu, mmu->arch);
|
||||
__load_stage2(mmu);
|
||||
|
||||
skip_mmu_switch:
|
||||
/* Temporarily switch back to guest context */
|
||||
|
||||
@@ -68,7 +68,7 @@ int refill_memcache(struct kvm_hyp_memcache *mc, unsigned long min_pages,
|
||||
static __always_inline void __load_host_stage2(void)
|
||||
{
|
||||
if (static_branch_likely(&kvm_protected_mode_initialized))
|
||||
__load_stage2(&host_mmu.arch.mmu, &host_mmu.arch);
|
||||
__load_stage2(&host_mmu.arch.mmu);
|
||||
else
|
||||
write_sysreg(0, vttbr_el2);
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ int __pkvm_prot_finalize(void)
|
||||
kvm_flush_dcache_to_poc(params, sizeof(*params));
|
||||
|
||||
write_sysreg_hcr(params->hcr_el2);
|
||||
__load_stage2(&host_mmu.arch.mmu, &host_mmu.arch);
|
||||
__load_stage2(&host_mmu.arch.mmu);
|
||||
|
||||
/*
|
||||
* Make sure to have an ISB before the TLB maintenance below but only
|
||||
|
||||
@@ -315,7 +315,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu)
|
||||
__sysreg_restore_state_nvhe(guest_ctxt);
|
||||
|
||||
mmu = kern_hyp_va(vcpu->arch.hw_mmu);
|
||||
__load_stage2(mmu, kern_hyp_va(mmu->arch));
|
||||
__load_stage2(mmu);
|
||||
__activate_traps(vcpu);
|
||||
|
||||
__hyp_vgic_restore_state(vcpu);
|
||||
|
||||
@@ -110,7 +110,7 @@ static void enter_vmid_context(struct kvm_s2_mmu *mmu,
|
||||
if (vcpu)
|
||||
__load_host_stage2();
|
||||
else
|
||||
__load_stage2(mmu, kern_hyp_va(mmu->arch));
|
||||
__load_stage2(mmu);
|
||||
|
||||
asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
|
||||
}
|
||||
@@ -128,7 +128,7 @@ static void exit_vmid_context(struct tlb_inv_context *cxt)
|
||||
return;
|
||||
|
||||
if (vcpu)
|
||||
__load_stage2(mmu, kern_hyp_va(mmu->arch));
|
||||
__load_stage2(mmu);
|
||||
else
|
||||
__load_host_stage2();
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ void kvm_vcpu_load_vhe(struct kvm_vcpu *vcpu)
|
||||
|
||||
__vcpu_load_switch_sysregs(vcpu);
|
||||
__vcpu_load_activate_traps(vcpu);
|
||||
__load_stage2(vcpu->arch.hw_mmu, vcpu->arch.hw_mmu->arch);
|
||||
__load_stage2(vcpu->arch.hw_mmu);
|
||||
}
|
||||
|
||||
void kvm_vcpu_put_vhe(struct kvm_vcpu *vcpu)
|
||||
|
||||
@@ -60,7 +60,7 @@ static void enter_vmid_context(struct kvm_s2_mmu *mmu,
|
||||
* place before clearing TGE. __load_stage2() already
|
||||
* has an ISB in order to deal with this.
|
||||
*/
|
||||
__load_stage2(mmu, mmu->arch);
|
||||
__load_stage2(mmu);
|
||||
val = read_sysreg(hcr_el2);
|
||||
val &= ~HCR_TGE;
|
||||
write_sysreg_hcr(val);
|
||||
@@ -78,7 +78,7 @@ static void exit_vmid_context(struct tlb_inv_context *cxt)
|
||||
|
||||
/* ... and the stage-2 MMU context that we switched away from */
|
||||
if (cxt->mmu)
|
||||
__load_stage2(cxt->mmu, cxt->mmu->arch);
|
||||
__load_stage2(cxt->mmu);
|
||||
|
||||
if (cpus_have_final_cap(ARM64_WORKAROUND_SPECULATIVE_AT)) {
|
||||
/* Restore the registers to what they were */
|
||||
|
||||
@@ -27,7 +27,7 @@ static struct kvm_device_ops kvm_arm_vgic_its_ops;
|
||||
|
||||
static int vgic_its_save_tables_v0(struct vgic_its *its);
|
||||
static int vgic_its_restore_tables_v0(struct vgic_its *its);
|
||||
static int vgic_its_commit_v0(struct vgic_its *its);
|
||||
static void vgic_its_commit_v0(struct vgic_its *its);
|
||||
static int update_lpi_config(struct kvm *kvm, struct vgic_irq *irq,
|
||||
struct kvm_vcpu *filter_vcpu, bool needs_inv);
|
||||
|
||||
@@ -168,7 +168,7 @@ struct vgic_its_abi {
|
||||
int ite_esz;
|
||||
int (*save_tables)(struct vgic_its *its);
|
||||
int (*restore_tables)(struct vgic_its *its);
|
||||
int (*commit)(struct vgic_its *its);
|
||||
void (*commit)(struct vgic_its *its);
|
||||
};
|
||||
|
||||
#define ABI_0_ESZ 8
|
||||
@@ -192,13 +192,13 @@ inline const struct vgic_its_abi *vgic_its_get_abi(struct vgic_its *its)
|
||||
return &its_table_abi_versions[its->abi_rev];
|
||||
}
|
||||
|
||||
static int vgic_its_set_abi(struct vgic_its *its, u32 rev)
|
||||
static void vgic_its_set_abi(struct vgic_its *its, u32 rev)
|
||||
{
|
||||
const struct vgic_its_abi *abi;
|
||||
|
||||
its->abi_rev = rev;
|
||||
abi = vgic_its_get_abi(its);
|
||||
return abi->commit(its);
|
||||
abi->commit(its);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -472,7 +472,8 @@ static int vgic_mmio_uaccess_write_its_iidr(struct kvm *kvm,
|
||||
|
||||
if (rev >= NR_ITS_ABIS)
|
||||
return -EINVAL;
|
||||
return vgic_its_set_abi(its, rev);
|
||||
vgic_its_set_abi(its, rev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long vgic_mmio_read_its_idregs(struct kvm *kvm,
|
||||
@@ -1888,14 +1889,11 @@ static int vgic_its_create(struct kvm_device *dev, u32 type)
|
||||
its->baser_coll_table = INITIAL_BASER_VALUE |
|
||||
((u64)GITS_BASER_TYPE_COLLECTION << GITS_BASER_TYPE_SHIFT);
|
||||
dev->kvm->arch.vgic.propbaser = INITIAL_PROPBASER_VALUE;
|
||||
|
||||
dev->private = its;
|
||||
|
||||
ret = vgic_its_set_abi(its, NR_ITS_ABIS - 1);
|
||||
|
||||
vgic_its_set_abi(its, NR_ITS_ABIS - 1);
|
||||
mutex_unlock(&dev->kvm->arch.config_lock);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vgic_its_destroy(struct kvm_device *kvm_dev)
|
||||
@@ -2606,7 +2604,7 @@ static int vgic_its_restore_tables_v0(struct vgic_its *its)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vgic_its_commit_v0(struct vgic_its *its)
|
||||
static void vgic_its_commit_v0(struct vgic_its *its)
|
||||
{
|
||||
const struct vgic_its_abi *abi;
|
||||
|
||||
@@ -2619,7 +2617,6 @@ static int vgic_its_commit_v0(struct vgic_its *its)
|
||||
|
||||
its->baser_device_table |= (GIC_ENCODE_SZ(abi->dte_esz, 5)
|
||||
<< GITS_BASER_ENTRY_SIZE_SHIFT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vgic_its_reset(struct kvm *kvm, struct vgic_its *its)
|
||||
|
||||
Reference in New Issue
Block a user