From patchwork Fri Feb 23 16:47:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 129457 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp813831lja; Fri, 23 Feb 2018 08:50:03 -0800 (PST) X-Google-Smtp-Source: AH8x224BGUC+JNggQvMi/pQaWgiJN2GBlMLMk38Y4XFhhv44BzapYTS6bDqx39u3Ea6eI42N8Bnm X-Received: by 10.36.147.70 with SMTP id y67mr3025244itd.121.1519404603632; Fri, 23 Feb 2018 08:50:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519404603; cv=none; d=google.com; s=arc-20160816; b=hw0NW1ETNeEW9o8QLspXoWMW/Kj0qP/pTH1/zhLGKKmAV71eef+7MyTxhSNHLJA6S7 SF6dO8cde6XXpbycQQlfpQXMkUttCOwNTD7qcwZfZWKElfpYvqLicbg4Tr2rs4BEDZu7 0PjK6GwzR7kdCdHoft8hPqHBgtD1kV6chcYi4nfMUAgGUldUDYAu6gYOjTLXDeS8ri9L BjvyL308sm3OwL7P9iA1tmvx4x6Y3vRqPL+9iW4qB7YQ/t5SVJT4+97FQfaTBvvUNlsQ jHNXDPQu9mrrnNg2k+2p+89p8X1aMkCTmGe52EbPz7MSRVHVDCnPpC7C8I3RR8voUA+w yb6g== 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 :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=s+1udkVf3pJCOsgGEF4cgOdrtCju8yo6x5hGdOYKPIU=; b=S88v+KaqElfn/7pxPhPDCxLvvU0qn5fBIv8cJ4dEPPk1opNt3DwLBdhVWCNBod9f8k xw48bThqQ+avRz4jlUGQUkchwVlZIOqoC2Eo0hMeUUljPckhw6260M4flpfZtNcW1FeQ pTYJQhBw8byGfF1x1qDmLeeEvXE3GDIEI1It9n3DEy7MxvWtTcd5dUf0CAb275XIWjfB rMJ2OmdiuEOfNrowzxl7g7BjrH/bS/0rxe0wRFOmdLHQrcXNRkHxNulf+aShSeGmYbm6 YkY0zGmLV6C0zpPDoJN62wx0xv9nnKbhosEiIjzegLi2cTGwmh6bhjGMJDDkosixKeOF o3XQ== 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 a14si1462052ita.24.2018.02.23.08.50.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 08:50:03 -0800 (PST) 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.84_2) (envelope-from ) id 1epGW9-0003Wv-V3; Fri, 23 Feb 2018 16:48:17 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epGW9-0003V6-Dv for xen-devel@lists.xen.org; Fri, 23 Feb 2018 16:48:17 +0000 X-Inumbo-ID: 3a87bfa2-18b9-11e8-ba59-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 3a87bfa2-18b9-11e8-ba59-bc764e045a96; Fri, 23 Feb 2018 17:47:26 +0100 (CET) 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 8067B1529; Fri, 23 Feb 2018 08:48:16 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7120F3F25C; Fri, 23 Feb 2018 08:48:15 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 23 Feb 2018 16:47:42 +0000 Message-Id: <20180223164753.27311-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180223164753.27311-1-julien.grall@arm.com> References: <20180223164753.27311-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, volodymyr_babchuk@epam.com, andre.przywara@linaro.org Subject: [Xen-devel] [PATCH v4 08/19] xen/arm: smccc: Add macros SMCCC_VERSION, SMCCC_VERSION_{MINOR, MAJOR} X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add macros SMCCC_VERSION, SMCCC_VERSION_{MINOR, MAJOR} to easily convert between a 32-bit value and a version number. The encoding is based on 2.2.2 in "Firmware interfaces for mitigation CVE-2017-5715" (ARM DEN 0070A). Also re-use them to define ARM_SMCCC_VERSION_1_0 and ARM_SMCCC_VERSION_1_1. Signed-off-by: Julien Grall Reviewed-by: Volodymyr Babchuk Acked-by: Stefano Stabellini --- Changes in v4: - Add Stefano's acked-by Changes in v3: - Add Volodymyr's reviewed-by Changes in v2: - Patch added --- xen/include/asm-arm/smccc.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-arm/smccc.h b/xen/include/asm-arm/smccc.h index 30208d12ca..d0240d64bf 100644 --- a/xen/include/asm-arm/smccc.h +++ b/xen/include/asm-arm/smccc.h @@ -16,8 +16,20 @@ #ifndef __ASM_ARM_SMCCC_H__ #define __ASM_ARM_SMCCC_H__ -#define ARM_SMCCC_VERSION_1_0 0x10000 -#define ARM_SMCCC_VERSION_1_1 0x10001 +#define SMCCC_VERSION_MAJOR_SHIFT 16 +#define SMCCC_VERSION_MINOR_MASK \ + ((1U << SMCCC_VERSION_MAJOR_SHIFT) - 1) +#define SMCCC_VERSION_MAJOR_MASK ~SMCCC_VERSION_MINOR_MASK +#define SMCCC_VERSION_MAJOR(ver) \ + (((ver) & SMCCC_VERSION_MAJOR_MASK) >> SMCCC_VERSION_MAJOR_SHIFT) +#define SMCCC_VERSION_MINOR(ver) \ + ((ver) & SMCCC_VERSION_MINOR_MASK) + +#define SMCCC_VERSION(major, minor) \ + (((major) << SMCCC_VERSION_MAJOR_SHIFT) | (minor)) + +#define ARM_SMCCC_VERSION_1_0 SMCCC_VERSION(1, 0) +#define ARM_SMCCC_VERSION_1_1 SMCCC_VERSION(1, 1) /* * This file provides common defines for ARM SMC Calling Convention as