From patchwork Wed Feb 21 17:47:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KarimAllah Ahmed X-Patchwork-Id: 10233731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 99C2660209 for ; Wed, 21 Feb 2018 17:52:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 915E227F7F for ; Wed, 21 Feb 2018 17:52:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85C6027F82; Wed, 21 Feb 2018 17:52:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2772C27F7F for ; Wed, 21 Feb 2018 17:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934150AbeBURwu (ORCPT ); Wed, 21 Feb 2018 12:52:50 -0500 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:26762 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935104AbeBURrv (ORCPT ); Wed, 21 Feb 2018 12:47:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1519235271; x=1550771271; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=OS5nzkQ5Kak26KJC8upMPoa1l2yvfnMHldY55l+xwqQ=; b=vflxSEZPsflJqXomCz8rj0m+TFCQmnSxLdERdGipB633zHunJHgLaZSP uqmoDstGPy+gDiL+vxpWkaft4JaX7DepvoaCHv+l7Vykle5ssdDty+pue uqQrMn3OQKXJdiNRBzcN6kI8fmOm8/h8hr5hTwu+4CUfnmqb02gPXMjtJ c=; X-IronPort-AV: E=Sophos;i="5.47,375,1515456000"; d="scan'208";a="709068518" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-f273de60.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Feb 2018 17:47:50 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (iad1-ws-svc-lb91-vlan2.amazon.com [10.0.103.146]) by email-inbound-relay-1d-f273de60.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w1LHlfBT113352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 21 Feb 2018 17:47:44 GMT Received: from u54e1ad5160425a4b64ea.ant.amazon.com (localhost [127.0.0.1]) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w1LHlew0006689; Wed, 21 Feb 2018 18:47:41 +0100 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w1LHle1Z006685; Wed, 21 Feb 2018 18:47:40 +0100 From: KarimAllah Ahmed To: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: hpa@zytor.com, jmattson@google.com, mingo@redhat.com, pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de, KarimAllah Ahmed Subject: [PATCH 09/10] KVM/X86: hyperv: Use kvm_vcpu_map in synic_clear_sint_msg_pending Date: Wed, 21 Feb 2018 18:47:20 +0100 Message-Id: <1519235241-6500-10-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519235241-6500-1-git-send-email-karahmed@amazon.de> References: <1519235241-6500-1-git-send-email-karahmed@amazon.de> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ... since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/hyperv.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index dc97f25..909b498 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -137,26 +137,22 @@ static void synic_clear_sint_msg_pending(struct kvm_vcpu_hv_synic *synic, u32 sint) { struct kvm_vcpu *vcpu = synic_to_vcpu(synic); - struct page *page; - gpa_t gpa; + struct kvm_host_map map; struct hv_message *msg; struct hv_message_page *msg_page; - gpa = synic->msg_page & PAGE_MASK; - page = kvm_vcpu_gfn_to_page(vcpu, gpa >> PAGE_SHIFT); - if (is_error_page(page)) { + if (!kvm_vcpu_map(vcpu, gpa_to_gfn(synic->msg_page), &map)) { vcpu_err(vcpu, "Hyper-V SynIC can't get msg page, gpa 0x%llx\n", - gpa); + synic->msg_page); return; } - msg_page = kmap_atomic(page); + msg_page = map.kaddr; msg = &msg_page->sint_message[sint]; msg->header.message_flags.msg_pending = 0; - kunmap_atomic(msg_page); - kvm_release_page_dirty(page); - kvm_vcpu_mark_page_dirty(vcpu, gpa >> PAGE_SHIFT); + kvm_vcpu_unmap(&map); + kvm_vcpu_mark_page_dirty(vcpu, gpa_to_gfn(synic->msg_page)); } static void kvm_hv_notify_acked_sint(struct kvm_vcpu *vcpu, u32 sint)