From patchwork Thu Feb 8 19:21:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 127727 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1793807ljc; Thu, 8 Feb 2018 11:24:23 -0800 (PST) X-Google-Smtp-Source: AH8x225TNnxOF/fQTJR5u71PJdBwis6DQsYUXdLE+0AXwvKNnxOmpz22BQz5YJpZEl8ErG03+Ad5 X-Received: by 10.107.36.195 with SMTP id k186mr122718iok.131.1518117862939; Thu, 08 Feb 2018 11:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518117862; cv=none; d=google.com; s=arc-20160816; b=O0UbxZEvHaEGZF7HcksPKKzulXCkJtV9uo5jxm/SK6Rj0BY0uzelT3GgcfaEHgiNAV XNgWHCAuEV8F4b+4qK6+h4cv7EmXnU/eAW8VgpxN6FvpGB/FszAMXc0mlUOHdFW8/Y2/ yLPpqkc2xfXXNmpO+Up0eOYfJ0nUNxHg9WwbMAKa+qsldwYqFI3h4mN1j9PLj6AHH+qc SdDMIMc54uHcRptrBWP9afhjw1nSdH0tWry6E3W9HtkoBxGACh01nSaGULTT5g3vaeFa /XDY9S8kqnZAcZ2K23bgdYl8QDZQO3RSp87hcIQOGDulFQ4APCsHCJ/vzGm8FjKBSjZt da+w== 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=SMikpk39pK6uJyJnjpr3J01L4PuNanVlNqtkmjWEJ/A=; b=qjID/CCjmwnS1SKjC6SjymEVyYAJoJyWkHuGwWLBVdI0cgESotR0mYRv+TfghEJjs2 7dVKYVMxm9xOMveo2QM/kggvknBVQi74uu7DpbojrwUh/zAXyUQu+CcFXXrKPntNYzZG 6YRgN1ckwThYNpX8GvQ81D8m9SAqF1GSCUy0hcJVwR/6l94ajGiuewEuvOE73WcAgYL1 3vMwssiq7g/w4vliO9zsWy3wJa/ljS2h2t3TmZD5iVQ/6l4SuSJNCeSl7xs2crhvT33B haLZoVrs1p6M1sy0gCYnhWUaz+LmDbNcVRsm4Ow24KI/0Ok7ziBQlT3Wv1pzZXHEivG4 mIMg== 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 z22si461590ioi.297.2018.02.08.11.24.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 11:24:22 -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 1ejrm9-0006NB-5n; Thu, 08 Feb 2018 19:22:29 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejrm8-0006HU-5S for xen-devel@lists.xen.org; Thu, 08 Feb 2018 19:22:28 +0000 X-Inumbo-ID: 845f13f7-0d05-11e8-b9b1-635ca7ef6cff Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 845f13f7-0d05-11e8-b9b1-635ca7ef6cff; Thu, 08 Feb 2018 19:23:18 +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 5F3611435; Thu, 8 Feb 2018 11:22:22 -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 505213F24D; Thu, 8 Feb 2018 11:22:21 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 8 Feb 2018 19:21:56 +0000 Message-Id: <20180208192203.9556-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180208192203.9556-1-julien.grall@arm.com> References: <20180208192203.9556-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, volodymyr_babchuk@epam.com, andre.przywara@linaro.org Subject: [Xen-devel] [PATCH v2 08/15] 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 --- 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 d24ccb51d8..caa2c9cc1b 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