From patchwork Mon Jun 3 16:03:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 165673 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4660927ili; Mon, 3 Jun 2019 09:05:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwORGLw3x3m/e7Vz35KF8R31YsDdF2EzkOwVX+/Pw02GoYTDsbUcK9lpWvGfHo1qK50ODdy X-Received: by 2002:a24:9083:: with SMTP id x125mr11135879itd.76.1559577945426; Mon, 03 Jun 2019 09:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577945; cv=none; d=google.com; s=arc-20160816; b=uG77TpzIFFySrjoQ1jyZs3dclDW/4pvYjvLoih/XL9m/kgs+24Pe66hr/ghbf6KISM xuOEb/8M+y0Lk6wkvQC+ghkdmJoQuVBcUDDm0+0PBfs6V8MJdtBSgKh0ArC4o3wDmM7u LdqeuDfiFUqINjHhHAK7KMRZqDBO2Vg1GQHfhy+J9aPP/KFafnQfVKaNbnYTIIOuxccJ i6aHkI2FErvMiu5TiUaV7JVn882gcQi3uo0sTtpoSgBVFAVyGwIxGVHrom1+zRJh0Ovj BtoyFqwbAXD+F7Z1rCnVQu2zS/WEfGUgAd7n9VsOK7eZLaM1+TyAHdULwGnlPDdBQoAc Yy2w== 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=2H6zg9h09xX8OJxhTNWdzaI3ssiklzJpUKhh7iqnGKU=; b=zhvLl6RkkentEXCVlji3v5b11q0ZLo7rO84a/m4pIfkyMqB0KKlJYKlxZmFWXJ61tT zd2cSYKa5oB2DP/aUDDACRRmbgMGJjA669T7YDPEJlTLPAIa7Bv0OokTYZu2CB8qYmJK YjyVqs6DbwsjqbLCfnyF+iHfZx8YV1r1sUK0lYUleKvCXwmk+BeD7NY0PfS1utaCtehV wFm38ffJc3nQnqVr7aw5IdcpE1pBa//glvqvPLjTsBt/TLE7/SQa9JuNjUDpcCWUM+eO XNzMD33N7hVM/2sGY1ht0VovIGndpE1p76mlf9mqnIyuMm5McpGsrNNzMg0n2CtHCM8z nGeQ== 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 d20si10134632jaq.50.2019.06.03.09.05.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 09:05:45 -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 1hXpRk-0002HC-UQ; Mon, 03 Jun 2019 16:04:28 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXpRk-0002FS-02 for xen-devel@lists.xenproject.org; Mon, 03 Jun 2019 16:04:28 +0000 X-Inumbo-ID: 42cbcab1-8619-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 42cbcab1-8619-11e9-8980-bc764e045a96; Mon, 03 Jun 2019 16:04:26 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 460761682; Mon, 3 Jun 2019 09:04:26 -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 557A73F246; Mon, 3 Jun 2019 09:04:24 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 3 Jun 2019 17:03:50 +0100 Message-Id: <20190603160350.29806-15-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190603160350.29806-1-julien.grall@arm.com> References: <20190603160350.29806-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 14/14] xen/mm: Provide dummy M2P-related helpers when !CONFIG_HAVE_M2P 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 , George Dunlap , Tim Deegan , Julien Grall , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" At the moment, Arm is providing a dummy implementation for the M2P helpers used in common code. However, they are quite isolated and could be used by other architecture in the future. So move all the helpers in xen/mm.h. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini Acked-by: George Dunlap --- Changes in v3: - Add Stefano's reviewed-by - Add George's acked-by Changes in v2: - Patch added --- xen/include/asm-arm/mm.h | 11 ----------- xen/include/xen/mm.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 3c03be3bca..d68d1794e5 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -313,17 +313,6 @@ static inline void *page_to_virt(const struct page_info *pg) struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, unsigned long flags); -/* - * Arm does not have an M2P, but common code expects a handful of - * M2P-related defines and functions. Provide dummy versions of these. - */ -#define INVALID_M2P_ENTRY (~0UL) -#define SHARED_M2P_ENTRY (~0UL - 1UL) -#define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY) - -/* We don't have a M2P on Arm */ -static inline void set_pfn_from_mfn(mfn_t mfn, unsigned long pfn) {} - /* Arch-specific portion of memory_op hypercall. */ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 196ce9fcda..477d24d52f 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -655,4 +655,18 @@ static inline void share_xen_page_with_privileged_guests( share_xen_page_with_guest(page, dom_xen, flags); } +/* + * Dummy implementation of M2P-related helpers for common code when + * the architecture doesn't have an M2P. + */ +#ifndef CONFIG_HAS_M2P + +#define INVALID_M2P_ENTRY (~0UL) +#define SHARED_M2P_ENTRY (~0UL - 1UL) +#define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY) + +static inline void set_pfn_from_mfn(mfn_t mfn, unsigned long pfn) {} + +#endif + #endif /* __XEN_MM_H__ */