arch-arm, kvm: Fix KVM_ARM_IRQ_VCPU2_SHIFT compilation error
After the following patch: https://gem5-review.googlesource.com/c/public/gem5/+/59310 gem5 doesn't compile on Arm machines that don't define the KVM_ARM_IRQ_VCPU2_SHIFT macro as the latter is not guarded anymore. This patch fixes the problem by amending capIRQLineLayout2 to rely on KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 only (which makes sense) and moves back the KVM_ARM_IRQ_VCPU2_SHIFT guard back to its original place Change-Id: Ib6b6ef4014c2a54580cb3e5b0167d4ee1f7139ed Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63111 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -96,8 +96,11 @@ KvmKernelGic::setIntState(unsigned type, unsigned vcpu, unsigned irq,
|
||||
|
||||
static const bool vcpu2_enabled = vm.kvm->capIRQLineLayout2();
|
||||
uint32_t kvm_vcpu = (vcpu_index << KVM_ARM_IRQ_VCPU_SHIFT);
|
||||
|
||||
#if defined(KVM_ARM_IRQ_VCPU2_SHIFT)
|
||||
if (vcpu2_enabled)
|
||||
kvm_vcpu |= vcpu2_index << KVM_ARM_IRQ_VCPU2_SHIFT;
|
||||
#endif
|
||||
|
||||
panic_if((!vcpu2_enabled && vcpu2_index) || kvm_vcpu > 0xffff,
|
||||
"VCPU out of range");
|
||||
|
||||
@@ -207,7 +207,7 @@ Kvm::capXSave() const
|
||||
bool
|
||||
Kvm::capIRQLineLayout2() const
|
||||
{
|
||||
#if defined(KVM_CAP_ARM_IRQ_LINE_LAYOUT_2) && defined(KVM_ARM_IRQ_VCPU2_SHIFT)
|
||||
#if defined(KVM_CAP_ARM_IRQ_LINE_LAYOUT_2)
|
||||
return checkExtension(KVM_CAP_ARM_IRQ_LINE_LAYOUT_2) != 0;
|
||||
#else
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user