From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E851EC4320A for ; Mon, 23 Aug 2021 17:03:28 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DBD461371 for ; Mon, 23 Aug 2021 17:03:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4DBD461371 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cs.pub.ro Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.170503.311296 (Exim 4.92) (envelope-from ) id 1mIDLq-0001K4-Hd; Mon, 23 Aug 2021 17:03:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 170503.311296; Mon, 23 Aug 2021 17:03:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mIDLq-0001J7-DD; Mon, 23 Aug 2021 17:03:10 +0000 Received: by outflank-mailman (input) for mailman id 170503; Mon, 23 Aug 2021 17:03:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mIDLp-0001H2-7b for xen-devel@lists.xenproject.org; Mon, 23 Aug 2021 17:03:09 +0000 Received: from mx.upb.ro (unknown [141.85.13.220]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 33d58277-c271-4081-ae4c-a0dbf4362b78; Mon, 23 Aug 2021 17:03:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mx.upb.ro (Postfix) with ESMTP id 2E3B2B56008F; Mon, 23 Aug 2021 20:03:06 +0300 (EEST) Received: from mx.upb.ro ([127.0.0.1]) by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ZXIII3mYf7jK; Mon, 23 Aug 2021 20:03:03 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mx.upb.ro (Postfix) with ESMTP id 90F37B5600BF; Mon, 23 Aug 2021 20:03:03 +0300 (EEST) Received: from mx.upb.ro ([127.0.0.1]) by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Wz-XGhTtxHKr; Mon, 23 Aug 2021 20:03:03 +0300 (EEST) Received: from localhost.localdomain (unknown [86.121.144.181]) by mx.upb.ro (Postfix) with ESMTPSA id 9185AB56008F; Mon, 23 Aug 2021 20:03:02 +0300 (EEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 33d58277-c271-4081-ae4c-a0dbf4362b78 X-Virus-Scanned: amavisd-new at upb.ro From: Costin Lupu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v3 1/4] public: Add page related definitions for accessing guests memory Date: Mon, 23 Aug 2021 20:02:53 +0300 Message-Id: <22031be8466bb18d1dd891481ccc67d8c2b2dd55.1629737453.git.costin.lupu@cs.pub.ro> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable These changes introduce the page related definitions needed for mapping a= nd accessing guests memory. These values are intended to be used by any tool= stack component that needs to map guests memory. Until now, the values were def= ined by the xenctrl.h header, therefore whenever a component had to use them i= t also had to add a dependency for the xenctrl library. This patch also introduces xen_mk_long() macrodefinition for defining lon= g constants both for C and assembler code. Signed-off-by: Costin Lupu --- xen/include/public/arch-arm.h | 8 ++++++++ xen/include/public/arch-x86/xen.h | 8 ++++++++ xen/include/public/xen.h | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.= h index 64a2ca30da..caf7825d95 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -471,6 +471,14 @@ typedef uint64_t xen_callback_t; typedef struct xen_pmu_arch { uint8_t dummy; } xen_pmu_arch_t; #endif =20 +#if defined(__XEN__) || defined(__XEN_TOOLS__) +/* + * Page definitions needed for accessing guests memory + */ +#define XEN_PAGE_SHIFT 12 + +#endif/* __XEN__ || __XEN_TOOLS__ */ + #endif /* __XEN_PUBLIC_ARCH_ARM_H__ */ =20 /* diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-= x86/xen.h index 7acd94c8eb..f9939c742b 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -385,6 +385,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_msr_entry_t); */ #define XEN_HVM_DEBUGCONS_IOPORT 0xe9 =20 +#if defined(__XEN__) || defined(__XEN_TOOLS__) +/* + * Page definitions needed for accessing guests memory + */ +#define XEN_PAGE_SHIFT 12 + +#endif /* __XEN__ || __XEN_TOOLS__ */ + #endif /* __XEN_PUBLIC_ARCH_X86_XEN_H__ */ =20 /* diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index e373592c33..c6486040b9 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -64,11 +64,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); =20 /* Turn a plain number into a C unsigned (long (long)) constant. */ #define __xen_mk_uint(x) x ## U +#define __xen_mk_long(x) x ## L #define __xen_mk_ulong(x) x ## UL #ifndef __xen_mk_ullong # define __xen_mk_ullong(x) x ## ULL #endif #define xen_mk_uint(x) __xen_mk_uint(x) +#define xen_mk_long(x) __xen_mk_long(x) #define xen_mk_ulong(x) __xen_mk_ulong(x) #define xen_mk_ullong(x) __xen_mk_ullong(x) =20 @@ -76,6 +78,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); =20 /* In assembly code we cannot use C numeric constant suffixes. */ #define xen_mk_uint(x) x +#define xen_mk_long(x) x #define xen_mk_ulong(x) x #define xen_mk_ullong(x) x =20 @@ -1034,6 +1037,12 @@ struct xenctl_bitmap { typedef struct xenctl_bitmap xenctl_bitmap_t; #endif =20 +/* + * Page definitions needed for accessing guests memory + */ +#define XEN_PAGE_SIZE (xen_mk_long(1) << XEN_PAGE_SHIFT) +#define XEN_PAGE_MASK (~(XEN_PAGE_SIZE - 1)) + #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ =20 #endif /* __XEN_PUBLIC_XEN_H__ */ --=20 2.20.1