Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3df59d8d authored by Christoffer Dall's avatar Christoffer Dall Committed by Marc Zyngier
Browse files

KVM: arm/arm64: Get rid of vcpu->arch.irq_lines



We currently have a separate read-modify-write of the HCR_EL2 on entry
to the guest for the sole purpose of setting the VF and VI bits, if set.
Since this is most rarely the case (only when using userspace IRQ chip
and interrupts are in flight), let's get rid of this operation and
instead modify the bits in the vcpu->arch.hcr[_el2] directly when
needed.

Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
Reviewed-by: default avatarJulien Thierry <julien.thierry@arm.com>
Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 35a84dec
Loading
Loading
Loading
Loading
+2 −7
Original line number Original line Diff line number Diff line
@@ -92,14 +92,9 @@ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
	vcpu->arch.hcr = HCR_GUEST_MASK;
	vcpu->arch.hcr = HCR_GUEST_MASK;
}
}


static inline unsigned long vcpu_get_hcr(const struct kvm_vcpu *vcpu)
static inline unsigned long *vcpu_hcr(const struct kvm_vcpu *vcpu)
{
{
	return vcpu->arch.hcr;
	return (unsigned long *)&vcpu->arch.hcr;
}

static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, unsigned long hcr)
{
	vcpu->arch.hcr = hcr;
}
}


static inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu)
static inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu)
+0 −3
Original line number Original line Diff line number Diff line
@@ -155,9 +155,6 @@ struct kvm_vcpu_arch {
	/* HYP trapping configuration */
	/* HYP trapping configuration */
	u32 hcr;
	u32 hcr;


	/* Interrupt related fields */
	u32 irq_lines;		/* IRQ and FIQ levels */

	/* Exception Information */
	/* Exception Information */
	struct kvm_vcpu_fault_info fault;
	struct kvm_vcpu_fault_info fault;


+1 −1
Original line number Original line Diff line number Diff line
@@ -174,5 +174,5 @@ unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu)
 */
 */
void kvm_inject_vabt(struct kvm_vcpu *vcpu)
void kvm_inject_vabt(struct kvm_vcpu *vcpu)
{
{
	vcpu_set_hcr(vcpu, vcpu_get_hcr(vcpu) | HCR_VA);
	*vcpu_hcr(vcpu) |= HCR_VA;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu, u32 *fpexc_host)
		isb();
		isb();
	}
	}


	write_sysreg(vcpu->arch.hcr | vcpu->arch.irq_lines, HCR);
	write_sysreg(vcpu->arch.hcr, HCR);
	/* Trap on AArch32 cp15 c15 accesses (EL1 or EL0) */
	/* Trap on AArch32 cp15 c15 accesses (EL1 or EL0) */
	write_sysreg(HSTR_T(15), HSTR);
	write_sysreg(HSTR_T(15), HSTR);
	write_sysreg(HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11), HCPTR);
	write_sysreg(HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11), HCPTR);
+2 −7
Original line number Original line Diff line number Diff line
@@ -69,14 +69,9 @@ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
		vcpu->arch.hcr_el2 |= HCR_TID3;
		vcpu->arch.hcr_el2 |= HCR_TID3;
}
}


static inline unsigned long vcpu_get_hcr(struct kvm_vcpu *vcpu)
static inline unsigned long *vcpu_hcr(struct kvm_vcpu *vcpu)
{
{
	return vcpu->arch.hcr_el2;
	return (unsigned long *)&vcpu->arch.hcr_el2;
}

static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, unsigned long hcr)
{
	vcpu->arch.hcr_el2 = hcr;
}
}


static inline void vcpu_set_vsesr(struct kvm_vcpu *vcpu, u64 vsesr)
static inline void vcpu_set_vsesr(struct kvm_vcpu *vcpu, u64 vsesr)
Loading