From patchwork Tue May 22 17:42:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 136590 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1929463lji; Tue, 22 May 2018 10:45:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoYWpI4EFKul6EQqLYnE26Dun3LjigOnoa5BLfpjbZ36I+UQmJO19jphikLmTh0ss2ws/ez X-Received: by 2002:a6b:9704:: with SMTP id z4-v6mr27290160iod.120.1527011143496; Tue, 22 May 2018 10:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527011143; cv=none; d=google.com; s=arc-20160816; b=Yr1s6Mprt5aueMOx3ySVELKDcjSZilgtb3gsDgfWxCWskmelyoYk3iFOY7EM3TMaWm a4cvT2+jUGIerv6pNXZbrU8yIXrDXeqLmpqVWqvOoMBPhtWQDnAWqNHAM/wOYhntqzi9 aA41u7L/3BHuGZiA52ojKIZIHLue+njhZZqwfAXAuwL8By08zBD1j9brC8GxNgG/6/Ph dx1NbXWsg2gzNeLIbQxoAz9UGuw4xx4mFfeXWzEWYFXdfltNA2MM6X47cmMRbhtOzn2g hCvePUuzylkVhR1kOgN45yBqN6WNr+xjLECgN94Ry39Gunxn1ANrxHuvDgtR7ATGvOsC m1hA== 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=2QN0tBT3m1fwJ9xafkxXkZrIgo7SDJkxuh1ZvCONItc=; b=nqd9dkhfb2YLDe/2f0s+yEFJmZ8bBy5zSh6prKnPG0Aa41T/+esNIxpE3S7jcxxF9T IRtwRue8MFmexs8ekSxtZJ8C9kRjnuUgAiomIQA5XG8mVN/R4oxWKSXp+PseSc4zD845 l/j5u2QZzCJZ+WnIAUdWVeLuXD5FnveZRnoJaYgIDIWQiUmqs/qQ9Ut/wFCSym7uPXBq cb3om9uOVBIqZVO8vAjo6qxZsv/0y+FHlVPT0qgu0hfYrco/5Zdyc2kujKu3qCRhPVoF xja7cRsCG4MyrrpEyMo000q9nRGIvH9jjr1s3GHTb6gE5rlzyHnA6+H8Xf9sCmOsVKW8 a8rg== 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 m69-v6si338046ith.132.2018.05.22.10.45.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 May 2018 10:45:43 -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 1fLBJc-0002Bj-54; Tue, 22 May 2018 17:43:16 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fLBJb-0002BV-Gf for xen-devel@lists.xenproject.org; Tue, 22 May 2018 17:43:15 +0000 X-Inumbo-ID: 1a3f8c99-5de8-11e8-8249-2fda3a446a53 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 1a3f8c99-5de8-11e8-8249-2fda3a446a53; Tue, 22 May 2018 17:46:49 +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 767C51435; Tue, 22 May 2018 10:43:14 -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 8C39C3F589; Tue, 22 May 2018 10:43:13 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 22 May 2018 18:42:50 +0100 Message-Id: <20180522174254.27551-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180522174254.27551-1-julien.grall@arm.com> References: <20180522174254.27551-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 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 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 --- 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