Received: by 10.192.165.156 with SMTP id m28csp3011387imm; Sun, 15 Apr 2018 14:58:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/1PufY/+mIL5UYUsGZTI6d0ePb2jRmYnOru+Bxttvykq/dVJfKRJuXwDOmTY8ZuJEgpjzY X-Received: by 2002:a17:902:bd03:: with SMTP id p3-v6mr13191258pls.236.1523829527059; Sun, 15 Apr 2018 14:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523829527; cv=none; d=google.com; s=arc-20160816; b=d1XRWH7215B6pYkeMbsOwLG5j5dVGRh6ZMqdpjR+jMsdfyHtwZPRIGCRTrhwZ6Gi2G 2XacQwVB0H6u9OHtC2mfnCjRFaEFufcy57h7PU8QCkX0dOeRN4yAkQI/h9giAVS1uGib Yu2AN0RECBQjY8YelNnYd4gBoh4juMgwm5Lnai2bjWOaFJvhU8jLDbbbUAAek4NIUwJr VFV0UviUSUJACogJKzX9ahLw2PrIhjNJkXDUiAPHotsRh1GXqGG6RZvqAuYOjzNGa8QU EaM465/eOBsYFmWZ8glCP/zyoe4BiLkQ0I356EbFZH8nrdGbXXtztx8jTlIT+XGb3H7o vLoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=A0TKl0kwzcy816/yCOBh6E1cm2Xbcqap24hdBvOOtFQ=; b=a8m+XFnVeBtecmlQnYVbrQpg4v6mb2udL/QMwR1jsS6w0WrpWvspDcdiwE5H1aoxy/ SOAUsnPOgHckh1EDM/tWggoWpkC7KYN7BX7niE7/FooxhYHciVd/7Wtzx8JYTkKzeARJ ulPsyEPJn+Kv8b79giy6x0KY38Xz4EqodCbqszy/sxe7pGYuODk+pqes7cN4mUQheyAB f41PAMCV7RL12SXcOeyxR5r13sahbtuzsLzFDoV7WaQHEUqI7X5TIsD/8AlBSxQX+9Js yjivz4EdHo98TD3P7ftAX6vxh/I/nJsaaU7+FxS9GBE+OVHbHdx3XSwMTLaUU2JeU0bo SEgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=ndgLkCYv; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si363180pge.105.2018.04.15.14.58.05; Sun, 15 Apr 2018 14:58:47 -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; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=ndgLkCYv; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753050AbeDOVzs (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.7.4