Commit c14f6466 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'loongarch-kvm-6.20' of...

Merge tag 'loongarch-kvm-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson into HEAD

LoongArch KVM changes for v6.20

1. Add more CPUCFG mask bits.
2. Improve feature detection.
3. Add FPU/LBT delay load support.
4. Set default return value in KVM IO bus ops.
5. Add paravirt preempt feature support.
6. Add KVM steal time test case for tools/selftests.
parents 05f7e89a 2d94a3f7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#define KVM_REQ_TLB_FLUSH_GPA		KVM_ARCH_REQ(0)
#define KVM_REQ_STEAL_UPDATE		KVM_ARCH_REQ(1)
#define KVM_REQ_PMU			KVM_ARCH_REQ(2)
#define KVM_REQ_AUX_LOAD		KVM_ARCH_REQ(3)

#define KVM_GUESTDBG_SW_BP_MASK		\
	(KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)
@@ -164,6 +165,7 @@ enum emulation_result {

#define LOONGARCH_PV_FEAT_UPDATED	BIT_ULL(63)
#define LOONGARCH_PV_FEAT_MASK		(BIT(KVM_FEATURE_IPI) |		\
					 BIT(KVM_FEATURE_PREEMPT) |	\
					 BIT(KVM_FEATURE_STEAL_TIME) |	\
					 BIT(KVM_FEATURE_USER_HCALL) |	\
					 BIT(KVM_FEATURE_VIRT_EXTIOI))
@@ -200,6 +202,7 @@ struct kvm_vcpu_arch {

	/* Which auxiliary state is loaded (KVM_LARCH_*) */
	unsigned int aux_inuse;
	unsigned int aux_ldtype;

	/* FPU state */
	struct loongarch_fpu fpu FPU_ALIGN;
@@ -252,6 +255,7 @@ struct kvm_vcpu_arch {
		u64 guest_addr;
		u64 last_steal;
		struct gfn_to_hva_cache cache;
		u8  preempted;
	} st;
};

@@ -265,6 +269,11 @@ static inline void writel_sw_gcsr(struct loongarch_csrs *csr, int reg, unsigned
	csr->csrs[reg] = val;
}

static inline bool kvm_guest_has_msgint(struct kvm_vcpu_arch *arch)
{
	return arch->cpucfg[1] & CPUCFG1_MSGINT;
}

static inline bool kvm_guest_has_fpu(struct kvm_vcpu_arch *arch)
{
	return arch->cpucfg[2] & CPUCFG2_FP;
+3 −1
Original line number Diff line number Diff line
@@ -37,8 +37,10 @@ struct kvm_steal_time {
	__u64 steal;
	__u32 version;
	__u32 flags;
	__u32 pad[12];
	__u8  preempted;
	__u8  pad[47];
};
#define KVM_VCPU_PREEMPTED		(1 << 0)

/*
 * Hypercall interface for KVM hypervisor
+1 −0
Original line number Diff line number Diff line
@@ -690,6 +690,7 @@
#define LOONGARCH_CSR_ISR3		0xa3

#define LOONGARCH_CSR_IRR		0xa4
#define LOONGARCH_CSR_IPR		0xa5

#define LOONGARCH_CSR_PRID		0xc0

+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
	return true;
}

#define vcpu_is_preempted vcpu_is_preempted

bool vcpu_is_preempted(int cpu);

#endif /* CONFIG_PARAVIRT */

#include <asm-generic/qspinlock.h>
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ struct kvm_fpu {
#define  KVM_LOONGARCH_VM_FEAT_PV_STEALTIME	7
#define  KVM_LOONGARCH_VM_FEAT_PTW		8
#define  KVM_LOONGARCH_VM_FEAT_MSGINT		9
#define  KVM_LOONGARCH_VM_FEAT_PV_PREEMPT	10

/* Device Control API on vcpu fd */
#define KVM_LOONGARCH_VCPU_CPUCFG	0
Loading