Only defining KVM_MMIO is not flexible enough for multi-KVM systems where one KVM implements MMIO but others do not. Solve this by additionally testing for the non-existence of KVM_NO_MMIO before including MMIO code to KVM. Signed-off-by: Steffen Eiden --- virt/kvm/coalesced_mmio.c | 4 ++++ virt/kvm/coalesced_mmio.h | 2 +- virt/kvm/kvm_main.c | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c index 6b1d90161099..8ff9d9a6f47a 100644 --- a/virt/kvm/coalesced_mmio.c +++ b/virt/kvm/coalesced_mmio.c @@ -15,6 +15,8 @@ #include #include +#ifndef KVM_NO_MMIO + #include "coalesced_mmio.h" static inline struct kvm_coalesced_mmio_dev *to_mmio(struct kvm_io_device *dev) @@ -188,3 +190,5 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm, */ return 0; } + +#endif /* ifndef KVM_NO_MMIO */ diff --git a/virt/kvm/coalesced_mmio.h b/virt/kvm/coalesced_mmio.h index 36f84264ed25..826af421a5be 100644 --- a/virt/kvm/coalesced_mmio.h +++ b/virt/kvm/coalesced_mmio.h @@ -11,7 +11,7 @@ * */ -#ifdef CONFIG_KVM_MMIO +#if defined(CONFIG_KVM_MMIO) && !defined(KVM_NO_MMIO) #include diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 0b34477bf325..a5dcb38e80db 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4063,7 +4063,7 @@ static vm_fault_t kvm_vcpu_fault(struct vm_fault *vmf) else if (vmf->pgoff == KVM_PIO_PAGE_OFFSET) page = virt_to_page(vcpu->arch.pio_data); #endif -#ifdef CONFIG_KVM_MMIO +#if defined(CONFIG_KVM_MMIO) && !defined(KVM_NO_MMIO) else if (vmf->pgoff == KVM_COALESCED_MMIO_PAGE_OFFSET) page = virt_to_page(vcpu->kvm->coalesced_mmio_ring); #endif @@ -4904,7 +4904,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) case KVM_CAP_ENABLE_CAP_VM: case KVM_CAP_HALT_POLL: return 1; -#ifdef CONFIG_KVM_MMIO +#if defined(CONFIG_KVM_MMIO) && !defined(KVM_NO_MMIO) case KVM_CAP_COALESCED_MMIO: return KVM_COALESCED_MMIO_PAGE_OFFSET; case KVM_CAP_COALESCED_PIO: @@ -5245,7 +5245,7 @@ static long kvm_vm_ioctl(struct file *filp, break; } #endif -#ifdef CONFIG_KVM_MMIO +#if defined(CONFIG_KVM_MMIO) && !defined(KVM_NO_MMIO) case KVM_REGISTER_COALESCED_MMIO: { struct kvm_coalesced_mmio_zone zone; @@ -5580,7 +5580,7 @@ static long kvm_dev_ioctl(struct file *filp, #ifdef CONFIG_X86 r += PAGE_SIZE; /* pio data page */ #endif -#ifdef CONFIG_KVM_MMIO +#if defined(CONFIG_KVM_MMIO) && !defined(KVM_NO_MMIO) r += PAGE_SIZE; /* coalesced mmio ring page */ #endif break; -- 2.53.0