From patchwork Thu Feb 15 15:02:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 128461 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1846947ljc; Thu, 15 Feb 2018 07:05:46 -0800 (PST) X-Google-Smtp-Source: AH8x227ckv0VhXRRxfh53/qv39a5Cyg9MRiHVcfJYRXpN2+B1XDP8OeLHgfdX+SdznsrCD5RgTl7 X-Received: by 10.36.90.147 with SMTP id v141mr3520415ita.64.1518707146423; Thu, 15 Feb 2018 07:05:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518707146; cv=none; d=google.com; s=arc-20160816; b=UxrqqngF/XY/TqxFH7Oi/+F7vXkmBY+ixMAPotiwuV7YqJJhMhYlPn/xVtVKdtqFp6 9YWtGQBksrHhL2IcW3Yymn4sqVd1FxGXv2uD1tw5gBlWjuPptct7K76DjMFxHMLgCZrH n7yyBxsI7/2ZXLWBSqM622g6f1qQ19K6rNxPHJ0utzq0GP1uRj7lAiDZ71fZ6aaQ5fAy bZIOqt0rV2g5+6P+tFOJZh8QBrZnwmIsi1XzdqVNuRgh3F2GbptDpvGYMhO+AalkbSRe l5gTKzyXZLxdf6AmwrEblbvaLk8C3FvpcBigmms84XsTGBGVEFMx/bCcMXwa+eC3Gk4B ZOBQ== 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=QcBvRqzHWwMglXQBcwVQt119JP33T0BAN6gISsqgXek=; b=DBE/mcDMIEs2ByqpdX9dFZPLkZxBel43+132XrSsVsyQv7osSCFSSXMrSC4EA48oov Cou+d4F6NEcKtctMNkgBNe0nh4qEmz8cjcXPJvVutxmTCHrzHLhGvfibg7kPjVsZi1Uz 0ihTkrAunR434ZB0R8Qb9S7FT7SCGn98kakpkgx7FGgTYfz2Ut9VTuwbGhRrafzqkE2Y XPsgBGDlvNEYNDoaEjq7KolcPcfU2BBlfgd/M8Mw+ZS31fdR9XvGQwhcw5qFBI7k8gEV J3KJ8JTvdp9zmNfC9XzSk1eBvHW9It7MsbWHxZ01wersvbxdkVDfDduRMjHRYwAtHH/f TSfw== 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 b123si2571iti.123.2018.02.15.07.05.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 07:05:46 -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 1emL48-00020O-3u; Thu, 15 Feb 2018 15:03:16 +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 1emL47-0001yB-84 for xen-devel@lists.xen.org; Thu, 15 Feb 2018 15:03:15 +0000 X-Inumbo-ID: 8391f313-1261-11e8-b9b1-635ca7ef6cff Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 8391f313-1261-11e8-b9b1-635ca7ef6cff; Thu, 15 Feb 2018 15:04:26 +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 BB31A15AD; Thu, 15 Feb 2018 07:03:08 -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 ABED23F41F; Thu, 15 Feb 2018 07:03:07 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 15 Feb 2018 15:02:38 +0000 Message-Id: <20180215150248.28922-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180215150248.28922-1-julien.grall@arm.com> References: <20180215150248.28922-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, volodymyr_babchuk@epam.com, andre.przywara@linaro.org Subject: [Xen-devel] [PATCH v3 07/17] 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 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