From patchwork Sun Apr 15 21:53:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KarimAllah Ahmed X-Patchwork-Id: 10341807 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 8C2D0601C2 for ; Sun, 15 Apr 2018 21:56:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7353927C2D for ; Sun, 15 Apr 2018 21:56:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67E5327D16; Sun, 15 Apr 2018 21:56:15 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 273B427C2D for ; Sun, 15 Apr 2018 21:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753032AbeDOVzs (ORCPT ); Sun, 15 Apr 2018 17:55:48 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:6149 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbeDOVzC (ORCPT ); Sun, 15 Apr 2018 17:55:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1523829302; x=1555365302; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=A0TKl0kwzcy816/yCOBh6E1cm2Xbcqap24hdBvOOtFQ=; b=ndgLkCYv1kUOnFrP28ngdTpAoctfsdxM0e3KnzU+/FPrBEGQ1mC5SF9V QpI1BFNEPzkKBBnnPuukVd9zYBXUhCYIQe3mT3J3QNu8wlSATSz72SOB7 kSJmUXNEhKyb34fo9RAs9Zkcs0z/V0MFKH6RrENchoIapjibLSrlxLqyr Q=; X-IronPort-AV: E=Sophos;i="5.48,456,1517875200"; d="scan'208";a="339950789" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Apr 2018 21:55:01 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (iad1-ws-svc-lb91-vlan2.amazon.com [10.0.103.146]) by email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w3FLsuqP020608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 15 Apr 2018 21:54:58 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 w3FLst68013468; Sun, 15 Apr 2018 23:54:55 +0200 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w3FLssfw013467; Sun, 15 Apr 2018 23:54:54 +0200 From: KarimAllah Ahmed To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com Cc: KarimAllah Ahmed Subject: [PATCH v2 11/12] KVM/X86: hyperv: Use kvm_vcpu_map in synic_deliver_msg Date: Sun, 15 Apr 2018 23:53:17 +0200 Message-Id: <1523829198-13236-12-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523829198-13236-1-git-send-email-karahmed@amazon.de> References: <1523829198-13236-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 Use kvm_vcpu_map in synic_deliver_msg 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 --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/hyperv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index fc33d8f..668dbd3 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -580,7 +580,7 @@ static int synic_deliver_msg(struct kvm_vcpu_hv_synic *synic, u32 sint, struct hv_message *src_msg) { struct kvm_vcpu *vcpu = synic_to_vcpu(synic); - struct page *page; + struct kvm_host_map map; gpa_t gpa; struct hv_message *dst_msg; int r; @@ -590,11 +590,11 @@ static int synic_deliver_msg(struct kvm_vcpu_hv_synic *synic, u32 sint, return -ENOENT; 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(gpa), &map)) return -EFAULT; - msg_page = kmap_atomic(page); + msg_page = map.hva; dst_msg = &msg_page->sint_message[sint]; if (sync_cmpxchg(&dst_msg->header.message_type, HVMSG_NONE, src_msg->header.message_type) != HVMSG_NONE) { @@ -611,8 +611,8 @@ static int synic_deliver_msg(struct kvm_vcpu_hv_synic *synic, u32 sint, else if (r == 0) r = -EFAULT; } - kunmap_atomic(msg_page); - kvm_release_page_dirty(page); + + kvm_vcpu_unmap(&map); kvm_vcpu_mark_page_dirty(vcpu, gpa >> PAGE_SHIFT); return r; }