From patchwork Tue Jun 5 15:22:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 137764 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1099068lji; Tue, 5 Jun 2018 08:26:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIoVeKAhRlll2FGqS4N69wBLlzRr6Z33uppZ0s1pD/KXkEstUJB9Do0YWSXrQHn55SfhY/m X-Received: by 2002:a24:efc2:: with SMTP id i185-v6mr11796335ith.57.1528212371760; Tue, 05 Jun 2018 08:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528212371; cv=none; d=google.com; s=arc-20160816; b=jf1k1P6o4UxawDo/3PpTatUcNvE9Z90mjjTYQnfigoY0xwO/py46yxt7u/ZJS6Iach 3/fqjeDI4VTLfpYV/vlNy1MNrYXS86vHnw3vgeYs6EelC8F4ds1XyfUMtAwD5MlQkzx5 Y32pH70hFXjaX0aPq5C3BbkiNTJ3t18CORrdOD74RQ2mkcvWuk68oCvgYszvcela13+5 NpbbUjJ/qEVVzB4887BfnLJVb53ffvpIHmvPOq+nFdR1GyK1ktQJEeKESL1ugJcEdgFT 2+Y1s7lR6NBbLtvk2K7gw4WdF7GxDTxkmdGbaYm9QUo3eSyA+JwuIQHd8T23/ovs/6fi oenw== 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:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=02rkkCNahmVW5nVl2POeGICfBMWGBUZuJMDv4XJduCU=; b=Ze8UwkUWBh71bLVtUEb1TdMQJ1HzTwXacObl7t/MyeSivPPcEx6ocbbR/yLNBzm+rP pilKdhnxJG1ycEAOIUTrIFdjkA82RLiJdrcRMdnA5RwXuTzQEOeTvMpcLCfojFh9bo+q AHvCAMNOlYcvXcmef/pHPbLGzmirnNPUL1ULs4XWuxXvZBSvSNL/zj32L7s6oNj/cQuL VlWs6DL0gaFfTgCVaiwuPDQKk+E9GzO69oA1nlNy1sTk4E/y1A/VNB4VNpTzwF37zn+k Hme288p75GxF/lnlEiEE9AOLLewrjFSbBdoKSXo1NAn8cTOdDlNXO5oRVB/6hzwTaSer EUnA== 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 i12-v6si1787653itb.110.2018.06.05.08.26.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 08:26:11 -0700 (PDT) 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.89) (envelope-from ) id 1fQDo3-0005Cq-JX; Tue, 05 Jun 2018 15:23:31 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fQDo2-0005CM-Oy for xen-devel@lists.xenproject.org; Tue, 05 Jun 2018 15:23:30 +0000 X-Inumbo-ID: 16233dd4-68d4-11e8-9728-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 16233dd4-68d4-11e8-9728-bc764e045a96; Tue, 05 Jun 2018 17:21:14 +0200 (CEST) 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 0814F1596; Tue, 5 Jun 2018 08:23:29 -0700 (PDT) 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 EE59F3F557; Tue, 5 Jun 2018 08:23:27 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 5 Jun 2018 16:22:59 +0100 Message-Id: <20180605152303.14450-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180605152303.14450-1-julien.grall@arm.com> References: <20180605152303.14450-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v1 09/13] xen/arm64: Add generic assembly macros X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Stefano Stabellini MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add assembly macros to simplify assembly code: - adr_cpu_info: Get the address to the current cpu_info structure - ldr_this_cpu: Load a per-cpu value This is part of XSA-263. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/include/asm-arm/arm64/macros.h | 25 +++++++++++++++++++++++++ xen/include/asm-arm/macros.h | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 xen/include/asm-arm/arm64/macros.h diff --git a/xen/include/asm-arm/arm64/macros.h b/xen/include/asm-arm/arm64/macros.h new file mode 100644 index 0000000000..9c5e676b37 --- /dev/null +++ b/xen/include/asm-arm/arm64/macros.h @@ -0,0 +1,25 @@ +#ifndef __ASM_ARM_ARM64_MACROS_H +#define __ASM_ARM_ARM64_MACROS_H + + /* + * @dst: Result of get_cpu_info() + */ + .macro adr_cpu_info, dst + add \dst, sp, #STACK_SIZE + and \dst, \dst, #~(STACK_SIZE - 1) + sub \dst, \dst, #CPUINFO_sizeof + .endm + + /* + * @dst: Result of READ_ONCE(per_cpu(sym, smp_processor_id())) + * @sym: The name of the per-cpu variable + * @tmp: scratch register + */ + .macro ldr_this_cpu, dst, sym, tmp + ldr \dst, =per_cpu__\sym + mrs \tmp, tpidr_el2 + ldr \dst, [\dst, \tmp] + .endm + +#endif /* __ASM_ARM_ARM64_MACROS_H */ + diff --git a/xen/include/asm-arm/macros.h b/xen/include/asm-arm/macros.h index 5d837cb38b..1d4bb41d15 100644 --- a/xen/include/asm-arm/macros.h +++ b/xen/include/asm-arm/macros.h @@ -8,7 +8,7 @@ #if defined (CONFIG_ARM_32) # include #elif defined(CONFIG_ARM_64) -/* No specific ARM64 macros for now */ +# include #else # error "unknown ARM variant" #endif