From patchwork Fri Feb 23 18:57:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 129490 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp984801edc; Fri, 23 Feb 2018 10:59:57 -0800 (PST) X-Google-Smtp-Source: AG47ELuWPYFaheIEnmLw/PugI8qL2GXPAf+3PJLnOqu6L+3svL0cYSaFU5H8NdI7330lEerMEchx X-Received: by 10.107.35.7 with SMTP id j7mr2780732ioj.226.1519412397693; Fri, 23 Feb 2018 10:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519412397; cv=none; d=google.com; s=arc-20160816; b=NF9SrqDAN2HSDCISTG31H6voPWg/0wR8KxTnb4/by83l84mlV0FKUo0HjL8Jz89hKq c0eb8d5a61c53DAC9PbNDUOztNqaFVUaJmBvRJ+COsSDSg+oQFcthv2TX7BaZn+mYULg 792j8amOTtvjR0AiCTAgUxMGOxOVfZAhTsBqqZo1oAVVp2ys7B6iIKPPHSuZpxnB6ycy 5h28ywFcvbFE7Se4JAODM4/yEomtcSc5un0wrJxisPM18eGZm8YhHqqGH3+zRkQjzt8W Hph78MQJKmDBASOSnRBDShRfZnQVRGHitZZqj4eB+UKUed1FHz+yahESXSS6FtarTDIG 2XGA== 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=LUp+R+qSUXERHmUCLa6wWzC0IKFWNlytnk75RFWtpoGEjXCv251nNurufLcFnF6YBW L4Evg8ntJGVxA/69w/OU4FtBSok2KZcFWqsl7Qq5DpuOF+8l5yPe8bjbi0KtlL+zARG+ la//Ta68EPr63LKjaBYeuCrnSqPxopZwjZzKzE4zLCjUNp/RwipR7MwQ+or3WabwESgj WAAkiOoap+un9A00sLIyRP+Q/DZjBoKX8FywaTMOEzOI61FW1R9KyufUsncP4NyyoBD4 qGhpfjhdVudSUVp5nUwE/mRHF9JRXe0CV0gGcPosCBdek5omPfET41qVVr2F35WymjNA 0EHA== 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 v13si1707577itv.7.2018.02.23.10.59.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 10:59:57 -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 1epIXX-0002vy-Et; Fri, 23 Feb 2018 18:57:51 +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 1epIXV-0002tq-G6 for xen-devel@lists.xen.org; Fri, 23 Feb 2018 18:57:49 +0000 X-Inumbo-ID: 52b18d44-18cb-11e8-ba59-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 52b18d44-18cb-11e8-ba59-bc764e045a96; Fri, 23 Feb 2018 19:56:58 +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 2518715AD; Fri, 23 Feb 2018 10:57:48 -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 15E6E3F25C; Fri, 23 Feb 2018 10:57:46 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 23 Feb 2018 18:57:19 +0000 Message-Id: <20180223185729.8780-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180223185729.8780-1-julien.grall@arm.com> References: <20180223185729.8780-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, volodymyr_babchuk@epam.com, andre.przywara@linaro.org Subject: [Xen-devel] [PATCH v5 08/18] 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