From patchwork Mon Aug 19 14:26:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 11101187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E8F81398 for ; Mon, 19 Aug 2019 14:29:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E65628419 for ; Mon, 19 Aug 2019 14:29:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B2F4288A2; Mon, 19 Aug 2019 14:29:58 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D4A4828896 for ; Mon, 19 Aug 2019 14:29:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hzicj-0007I8-96; Mon, 19 Aug 2019 14:27:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hzici-0007Ht-2I for xen-devel@lists.xenproject.org; Mon, 19 Aug 2019 14:27:04 +0000 X-Inumbo-ID: 69736474-c28d-11e9-b90c-bc764e2007e4 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 69736474-c28d-11e9-b90c-bc764e2007e4; Mon, 19 Aug 2019 14:27:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7D9DC1576; Mon, 19 Aug 2019 07:27:02 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 29E2E3F718; Mon, 19 Aug 2019 07:27:01 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 19 Aug 2019 15:26:51 +0100 Message-Id: <20190819142651.11058-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190819142651.11058-1-julien.grall@arm.com> References: <20190819142651.11058-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v4 2/2] xen/domain: Use typesafe gfn in map_vcpu_info X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP At the same time, modify the documentation of the hypercall to reflect the real meaning of the field mfn. Signed-off-by: Julien Grall --- Changes in v4: - Patch added --- xen/common/domain.c | 6 +++--- xen/include/public/vcpu.h | 2 +- xen/include/xen/domain.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index e8f6dfbdf1..915ebca190 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1282,7 +1282,7 @@ int vcpu_reset(struct vcpu *v) * of memory, and it sets a pending event to make sure that a pending * event doesn't get missed. */ -int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) +int map_vcpu_info(struct vcpu *v, gfn_t gfn, unsigned offset) { struct domain *d = v->domain; void *mapping; @@ -1299,7 +1299,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) if ( (v != current) && !(v->pause_flags & VPF_down) ) return -EINVAL; - page = get_page_from_gfn(d, _gfn(gfn), NULL, P2M_ALLOC); + page = get_page_from_gfn(d, gfn, NULL, P2M_ALLOC); if ( !page ) return -EINVAL; @@ -1538,7 +1538,7 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) break; domain_lock(d); - rc = map_vcpu_info(v, info.mfn, info.offset); + rc = map_vcpu_info(v, _gfn(info.mfn), info.offset); domain_unlock(d); break; diff --git a/xen/include/public/vcpu.h b/xen/include/public/vcpu.h index 3623af932f..dc4c6a72a0 100644 --- a/xen/include/public/vcpu.h +++ b/xen/include/public/vcpu.h @@ -182,7 +182,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t); */ #define VCPUOP_register_vcpu_info 10 /* arg == vcpu_register_vcpu_info_t */ struct vcpu_register_vcpu_info { - uint64_t mfn; /* mfn of page to place vcpu_info */ + uint64_t mfn; /* gfn of page to place vcpu_info */ uint32_t offset; /* offset within page */ uint32_t rsvd; /* unused */ }; diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 3f09cb66c0..7e754f7cc0 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -58,7 +58,7 @@ void free_pirq_struct(void *); int arch_vcpu_create(struct vcpu *v); void arch_vcpu_destroy(struct vcpu *v); -int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset); +int map_vcpu_info(struct vcpu *v, gfn_t gfn, unsigned offset); void unmap_vcpu_info(struct vcpu *v); int arch_domain_create(struct domain *d,