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: 171641 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3060971ily; Mon, 19 Aug 2019 07:29:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz24GlHWCXl4uf28bpjcZHf1x6NtiYwHBna4pMsA5V0DYGHArDCsVVlIG25R0jsBeptfFnU X-Received: by 2002:a6b:8d90:: with SMTP id p138mr11283723iod.282.1566224973684; Mon, 19 Aug 2019 07:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566224973; cv=none; d=google.com; s=arc-20160816; b=HUx5q584F/kzJS45GeGRnEUpdzobcw1Qx44xYXXU7MJiVUdRjiOhJGgZkdTG8uOwCC a2WkNmpU0lPXqQMyKVxPAPntWKOoA54KQVIqEjkFOE/LvAJSQGVI/WbfLKSLoZdOp/bV QA56cpNclW+n9KoY4mkVt/g2wvuT7uLCkuQRr3VC7HyTePH26YdS22/ukWsR5aBBb92n +THjmxDdOl2X4BH4EwmiBUqL0NMZbmM/s2JKD6KowbrkJWOf+YYtYYDB6H5W1V66tcGX qFviwOzxK/UsKomnhOHYzv6q4s0ZlGctvqqrlkjopGfhL/gDd8FZQAO+dKyueRFGmdtZ 9gGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=Cm0cPtxEyRX2EOFBwp4YFmukFT9Ue/LvB0n8E7zK0NU=; b=WDBJyqhemws0LdtKceJITDNIJ96BbJoGvnqdW7gf1fYKgrkJPev6ER+3kTeLTF5nBV +9ys58fTanJL6rxaNIaCLgPg5u1aY8P/c0Z+V3y5N3g16GbmxDE+U8YjEQhTg9KMivoW Gf7QqM6Em73QepAjC9FjsLIEzZfwz0TWwnPhZ478npPTOya+HN+kcfsJ1CAB6vbHurAW MkIKBpJkjqKZRpAJoKsKjpXHhTUX/L3GAI+tBCIWiXgEVjVwboSjQP30OLojaFOd6jPu eklOlu16sCioog7njAIzSZXhVUFTGE75zq5ReQkynV+yC52HEro/zpY79JIucRuRKo3s CcLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id v3si13732418iot.133.2019.08.19.07.29.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 07:29:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org 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" 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,