Commit 82eac475 authored by wanghaibin's avatar wanghaibin Committed by Dongxu Sun
Browse files

KVM: arm64: GICv4.1: Inform the HiSilicon vtimer irqbypass capability

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8K89F


CVE: NA

------------------------------------------------------------------

HiSilicon implementation of GICv4.1 has provided direct injection capability
of vtimer interrupts.  Inform users about the capability by vgic_global's
has_direct_vtimer, which depends on the HW-capability from gic_kvm_info and
kernel command "kvm-arm.vgic_v4_enable=1".

Signed-off-by: default avatarwanghaibin <wanghaibin.wang@huawei.com>
Signed-off-by: default avatarZenghui Yu <yuzenghui@huawei.com>
Signed-off-by: default avatarKunkun Jiang <jiangkunkun@huawei.com>
Signed-off-by: default avatarDongxu Sun <sundongxu3@huawei.com>
parent 95bc7fb1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -655,6 +655,10 @@ int vgic_v3_probe(const struct gic_kvm_info *info)
		kvm_info("GICv4%s support %sabled\n",
			 kvm_vgic_global_state.has_gicv4_1 ? ".1" : "",
			 gicv4_enable ? "en" : "dis");

		kvm_vgic_global_state.has_direct_vtimer = info->has_vtimer && gicv4_enable;
		if (kvm_vgic_global_state.has_direct_vtimer)
			kvm_info("vtimer-irqbypass support enabled at GIC level\n");
	}

	if (!info->vcpu.start) {
+14 −0
Original line number Diff line number Diff line
@@ -75,6 +75,12 @@ struct vgic_global {
	bool			has_gicv4;
	bool			has_gicv4_1;

	/*
	 * Hardware (HiSilicon implementation) has vtimer interrupt
	 * direct injection support?
	 */
	bool			has_direct_vtimer;

	/* GIC system register CPU interface */
	struct static_key_false gicv3_cpuif;

@@ -383,6 +389,14 @@ void kvm_vgic_reset_mapped_irq(struct kvm_vcpu *vcpu, u32 vintid);

void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg, bool allow_group1);

/**
 * kvm_vgic_vtimer_irqbypass_support - Get the vtimer irqbypass HW capability
 */
static inline bool kvm_vgic_vtimer_irqbypass_support(void)
{
	return kvm_vgic_global_state.has_direct_vtimer;
}

/**
 * kvm_vgic_get_max_vcpus - Get the maximum number of VCPUs allowed by HW
 *