Skip to content

Commit 427d7ca

Browse files
Marc Zyngierchazy
authored andcommitted
arm64: KVM: Move the AArch32 conditional execution to common code
It would make some sense to share the conditional execution code between 32 and 64bit. In order to achieve this, let's move that code to virt/kvm/arm/aarch32.c. While we're at it, drop a superfluous BUG_ON() that wasn't that useful. Following patches will migrate the 32bit port to that code base. Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent 3e51d43 commit 427d7ca

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

arch/arm/kvm/emulate.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ static void kvm_adjust_itstate(struct kvm_vcpu *vcpu)
221221
unsigned long cpsr = *vcpu_cpsr(vcpu);
222222
bool is_arm = !(cpsr & PSR_T_BIT);
223223

224-
BUG_ON(is_arm && (cpsr & PSR_IT_MASK));
225-
226-
if (!(cpsr & PSR_IT_MASK))
224+
if (is_arm || !(cpsr & PSR_IT_MASK))
227225
return;
228226

229227
cond = (cpsr & 0xe000) >> 13;

arch/arm64/kvm/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/e
1616
kvm-$(CONFIG_KVM_ARM_HOST) += $(ARM)/arm.o $(ARM)/mmu.o $(ARM)/mmio.o
1717
kvm-$(CONFIG_KVM_ARM_HOST) += $(ARM)/psci.o $(ARM)/perf.o
1818

19-
kvm-$(CONFIG_KVM_ARM_HOST) += emulate.o inject_fault.o regmap.o
19+
kvm-$(CONFIG_KVM_ARM_HOST) += inject_fault.o regmap.o
2020
kvm-$(CONFIG_KVM_ARM_HOST) += hyp.o hyp-init.o handle_exit.o
2121
kvm-$(CONFIG_KVM_ARM_HOST) += guest.o debug.o reset.o sys_regs.o sys_regs_generic_v8.o
22+
kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/aarch32.o
2223

2324
kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic/vgic.o
2425
kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic/vgic-init.o

arch/arm64/kvm/emulate.c renamed to virt/kvm/arm/aarch32.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ static void kvm_adjust_itstate(struct kvm_vcpu *vcpu)
109109
unsigned long cpsr = *vcpu_cpsr(vcpu);
110110
bool is_arm = !(cpsr & COMPAT_PSR_T_BIT);
111111

112-
BUG_ON(is_arm && (cpsr & COMPAT_PSR_IT_MASK));
113-
114-
if (!(cpsr & COMPAT_PSR_IT_MASK))
112+
if (is_arm || !(cpsr & COMPAT_PSR_IT_MASK))
115113
return;
116114

117115
cond = (cpsr & 0xe000) >> 13;

0 commit comments

Comments
 (0)