From patchwork Tue May 7 15:14:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 163543 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp3883275oca; Tue, 7 May 2019 08:16:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsKOCEef3DW6mZYgEPM2B00EAWGreQot1xtKxGzClSstiog+woImDyKpz69i6HDZrAVyXL X-Received: by 2002:a24:ad5f:: with SMTP id a31mr25241075itj.55.1557242216226; Tue, 07 May 2019 08:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557242216; cv=none; d=google.com; s=arc-20160816; b=U+nUl7OofvfdE+1doOGYLbbJMMeMKMZW1fyXbjSyXV9cRtmBz5axA1F9+qTw/CJvo/ KWa7DIzUz4lsNMX+c4M43Cuys2PXWHWSZ6/5/bELw7jcFRy8y2PLfQPgkO2JArh/asuD EMFv4E3bBddDnFyDI5W/4drqkZ6G2d1nnCad4GgvsDekqU6C8ZQD7LBYX0NEgeugI20v bH9uquhbwODzW4wmUL1UpgHHupqP8KlQmZ6Feur7PdYaCFr0uu7iF650pDbrROSef68h 4QmL3Cj8uNsn51RwrKBN7+EcxuJrS72wZxt8jfL+wF4opNGYBDAx55Wkty1dfub4Dde0 Cvkw== 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=681a4adC5CTLiCzO2hu687VZZRL1HXcwjCCzbYicz0Q=; b=OgpJ1FA+Njxea2xplRv8m+LOJPUShV/V8GRSm1ijUQhTbE3FzrVUWtJy5qNravirdO vemBTt8xfBqnpBlsLBhbUWUClnmMapMztVz0sKHv4z/WfZzrTN+94Ju3OYWTMVRM0j8S 8HKbUDxgL3+a3poRWJZDc6b8TYYHEvmB6HbFD9/rEvHeDl4FS8w9/bwus5mUWlGt/E+7 Zm3P/SfhFjxKaUPMCZXBV2wrwOwXRgkMSi0bhoCLnrsrOHD/F9YK6/QoVstk5OHD38dV Ae14YGpg8r89vhpnqjMtiPNGPNoYmKR8OMV2lQmHkW9v98ZmzmGI28D+75OjodUPI56b PKpQ== 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 w82si10377471itb.0.2019.05.07.08.16.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 May 2019 08:16:56 -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 1hO1oi-0007gP-1p; Tue, 07 May 2019 15:15:40 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hO1og-0007en-O7 for xen-devel@lists.xenproject.org; Tue, 07 May 2019 15:15:38 +0000 X-Inumbo-ID: f7c8fccb-70da-11e9-843c-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id f7c8fccb-70da-11e9-843c-bc764e045a96; Tue, 07 May 2019 15:15:37 +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 3879FEBD; Tue, 7 May 2019 08:15:37 -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 6A03A3F5AF; Tue, 7 May 2019 08:15:35 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 7 May 2019 16:14:58 +0100 Message-Id: <20190507151458.29350-15-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190507151458.29350-1-julien.grall@arm.com> References: <20190507151458.29350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 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 , 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 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 3ba7168cc9..07d2d44491 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -658,4 +658,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__ */