Received: by 10.192.165.156 with SMTP id m28csp3011389imm; Sun, 15 Apr 2018 14:58:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Y81ZlHwSk8wVYPCbG4kFdRWSUq+iXXVO/tGm9UbwWm9eVJ7QOg0GviNX1mdiwqARkFDvC X-Received: by 2002:a17:902:32a2:: with SMTP id z31-v6mr13128462plb.41.1523829527071; 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=B7oiqMigKoy+m6zBkmNG2O3zoA70vlYSN7iGwKGmf9rO26TKGwlHXnyAPpQWi8Plvu djBHqneOa94N4RMr27X+1F9FigU7MBXiOnO4TBznxndtw5395M+8/bpD66zwjsw/WmPy rgsWWx/L8Vj7rjnntmbFlggGracU6VQLs217S+wKJFX6hL3YR8NgcrV8x2ilsSKy6+4w +4ZP3dIQVWFv3p5728mx6O4/9u149bca6FS7dsJ/hgafF02FH+63eKdAJjxyt0s5F9rZ jpWKOvf3w7ULNMBLxi49H63nDhtaPZcXkRf08Q4aJvu2sQrZe0bgkg5w8Z81uzQXk32C EWEA== 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=uj3bkz4krerjEl1+3Y9mp+klgFotJDEsPBEHePoeNTU=; b=pwaWZXwXYqJcOyEeDEi1L3pC0XUqKRaX4Hl6mTDVO6zvxryV9kZGmaP0WGmcClZb8t PQrwTtcesL/Z0on0P1TwPrAgnmUhGXA7Q+HpIpF4J/e06souEHWJAFmw5/10h2hv0eWQ l/gsSb66uH1RZPpL2An/0Oq4OS82dokUCdH0cj0s6+s1EdHt3//wBe5o1c5gnz7FTLRR qG/jWgLZrQri6LrHqj4gCy4uUVsXgVCAa7vjxOaRh+ivTls+gFb+1A+hBPoPrBngIfVC +tILDTBzm2l5Tzc5qcDU8JNOr1MhIxL/XSGEjjlQkf2OJFm20m2ZI81SbgNe3zSWIeE0 sW8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=nAPs7NGy; 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 k12si747836pgc.182.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=nAPs7NGy; 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 S1752975AbeDOVzd (ORCPT + 99 others); Sun, 15 Apr 2018 17:55:33 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:21598 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786AbeDOVzD (ORCPT ); Sun, 15 Apr 2018 17:55:03 -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=uj3bkz4krerjEl1+3Y9mp+klgFotJDEsPBEHePoeNTU=; b=nAPs7NGyPtndDKz+htjdt+7E2SIAqIVHN9X/3LU+3Are3oQo4aqe9VEU bffVvgzJJ2uHx+GQ+FE5TZgnzQu9BxeZ8B9PDNVW/uaG20S8ZG6ay2QZ7 HYZfNs6LUQHP+2J1PYMEE1dWo1YEDuweTDzLoPPliW8McUDcIQFoTUloM E=; X-IronPort-AV: E=Sophos;i="5.48,456,1517875200"; d="scan'208";a="735371362" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1a-e34f1ddc.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Apr 2018 21:55:02 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (iad1-ws-svc-lb91-vlan2.amazon.com [10.0.103.146]) by email-inbound-relay-1a-e34f1ddc.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w3FLstAq018157 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 15 Apr 2018 21:54:57 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 w3FLss6G013462; Sun, 15 Apr 2018 23:54:54 +0200 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w3FLss0l013461; 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 10/12] KVM/X86: hyperv: Use kvm_vcpu_map in synic_clear_sint_msg_pending Date: Sun, 15 Apr 2018 23:53:16 +0200 Message-Id: <1523829198-13236-11-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_clear_sint_msg_pending 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 | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 98618e3..fc33d8f 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -158,26 +158,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.hva; 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) -- 2.7.4