Received: by 2002:a17:90a:2044:0:0:0:0 with SMTP id n62csp529830pjc; Mon, 20 May 2019 11:19:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3b9YRlJ6v/TOVc8GRmiejxjYWIqyE4xN96jhxu6mA4grnHI+A6kEteentI6F0KwG9J1Iu X-Received: by 2002:a63:117:: with SMTP id 23mr75928242pgb.34.1558376349904; Mon, 20 May 2019 11:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558376349; cv=none; d=google.com; s=arc-20160816; b=RYrhioO4G4jIXxx0P7/2Y2AmC13+6ti8jXAl7bWaXlFnaL8GY1r+tw/UzlpFUVMzW/ 5vf8SA/3zbuICm8psgddmLMv1BmNouTOmy4oeyrsBWHMZM9kPataE1c6GK73Ezu3cu0A +/M2Juh4Iih60gRMAIw0iPOjE9ebD1hzYCsZumfs61VUHnJXajU3JH01BqfIuERCXIV9 KIASDZUVqwo6jvMtScW2DiAR0+s5Z2ul4IXiwTTiF1QV6Oj5ONMbsvzpJVoNfaAd09wX oj4DbavbejjzNR7n9AQuMo6tMQRlmgY4vYqRSgLgOEMMTsNFTZxBusYCzzhMsdA1k9qO lF6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:cc:to:subject:from; bh=3LLHNyXasgZYh43d0DEC/+Quej4u5u5LDk+dBAAsbjA=; b=tftvoPmupW3cwoQviQ11HoD3EwirDTTgK3jwyBIUo/Sg96WZp0+gS6FGVJio1Y1uM+ QfCAxW+5QMt+1vxjEepcWQy/pkM7bVUmlZKGvJLQqgKs5CK9hCOhhTu4PpY0i0g/raWu dRbl/kHda0Ablev+p0eZQv83IJFVC2cjuBKk4i2QxI5HowxPrInqqGbcySUStIYea9KF IhtHSwjS35IXlBEHl7gS0h9kEtTLa90EWR+4DJj1HAZjct6kjFv5T+7H9siNz4Z+YXYI 5UpLl0ZGRPW3Fwf7miQSbvHaTRb/i9ZrH9m7rmsU768IHh/g6TI3TBxgViGR8J/io1ju UA2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j23si18888296pff.159.2019.05.20.11.18.55; Mon, 20 May 2019 11:19:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389566AbfETQoT (ORCPT + 99 others); Mon, 20 May 2019 12:44:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:54890 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389205AbfETQoT (ORCPT ); Mon, 20 May 2019 12:44:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5D061AC63; Mon, 20 May 2019 16:44:18 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 06D1CE0184; Mon, 20 May 2019 18:44:18 +0200 (CEST) From: Michal Kubecek Subject: [PATCH RESEND] kvm: make kvm_vcpu_(un)map dependency on CONFIG_HAS_IOMEM explicit To: kvm@vger.kernel.org Cc: Paolo Bonzini , Radim Krcmar , KarimAllah Ahmed , linux-kernel@vger.kernel.org Message-Id: <20190520164418.06D1CE0184@unicorn.suse.cz> Date: Mon, 20 May 2019 18:44:18 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recently introduced functions kvm_vcpu_map() and kvm_vcpu_unmap() call memremap() and memunmap() which are only available if HAS_IOMEM is enabled but this dependency is not explicit, so that the build fails with HAS_IOMEM disabled. As both function are only used on x86 where HAS_IOMEM is always enabled, the easiest fix seems to be to only provide them when HAS_IOMEM is enabled. Fixes: e45adf665a53 ("KVM: Introduce a new guest mapping API") Signed-off-by: Michal Kubecek --- include/linux/kvm_host.h | 6 +++++- virt/kvm/kvm_main.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 79fa4426509c..371d68fef5e1 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -759,9 +759,13 @@ struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu); struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn); kvm_pfn_t kvm_vcpu_gfn_to_pfn_atomic(struct kvm_vcpu *vcpu, gfn_t gfn); kvm_pfn_t kvm_vcpu_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn); + +#ifdef CONFIG_HAS_IOMEM int kvm_vcpu_map(struct kvm_vcpu *vcpu, gpa_t gpa, struct kvm_host_map *map); -struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn); void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map, bool dirty); +#endif + +struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn); unsigned long kvm_vcpu_gfn_to_hva(struct kvm_vcpu *vcpu, gfn_t gfn); unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *writable); int kvm_vcpu_read_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn, void *data, int offset, diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index f0d13d9d125d..4a2c813e75d6 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1743,6 +1743,7 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) } EXPORT_SYMBOL_GPL(gfn_to_page); +#ifdef CONFIG_HAS_IOMEM static int __kvm_map_gfn(struct kvm_memory_slot *slot, gfn_t gfn, struct kvm_host_map *map) { @@ -1806,6 +1807,7 @@ void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map, map->page = NULL; } EXPORT_SYMBOL_GPL(kvm_vcpu_unmap); +#endif /* CONFIG_HAS_IOMEM */ struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn) { -- 2.21.0