From patchwork Tue Jun 12 11:36:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 138329 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5235028lji; Tue, 12 Jun 2018 04:39:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ3oA6oMlh2NJ0EwDTAn1B8sknAEhrEf8pexBIv2GTlQAd3oMFsK76RvTZFyNw2F4H9kV6A X-Received: by 2002:a24:414c:: with SMTP id x73-v6mr8139ita.96.1528803574033; Tue, 12 Jun 2018 04:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528803574; cv=none; d=google.com; s=arc-20160816; b=RRtlZ6fu7mqL38r3hQ3RXFJ+QVhrvgOAXZsunWhV93R6+iL45YRkbZ3hGF8Xy4VJUO LSfgJ8vgWggrqa1KU7kcAi0bjDE/90uXCYgokZHwJ0crW88BxUGz0ALG6F51J6WE+e29 98DAVGM1vz0EKLbrkZO+1o21xP+12OXwj70CNam61Dwb8pL20O1TR7eeXWvURoMsjAH6 AB/PzGxKb/S6gkSdkFRsoO/inJqtTlmUpztlXDATG2u6QjqdlKE9wo+bUbbIufc5m/Nb JE1wBn3kZVL/V5y+utmqQVD2TdWTxuBmR1VdlLyBGYc7fHzpCjY+QTMxaOyNqnBAU0RS yfKQ== 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=EWJUC/1UqN0pVVnVHxodOhuvjvERyOqkL55zIAgc15I=; b=UHqXFbS5cvG4t8SLpeEEEhhEI6Hax1uV8zIVw1DtlyCW/NdsPim/GoRJwxThxT0P7c KcIe4/gscGGyP/PGD6sQ65nqf26W5iWD0lA9/KaeUz/L/EQft0wG0R8XLiAHCn/ZLj30 R3CvsZQGcZbS9MXa53Nsmp7g0T2f4sK6VgaTQYrz66084XncAH12xuVceqpeJcurqp5l HfbbP9QSqwKIDxtk4w0y1GLAosaADdOM+8kU+0HFqNytElAsRZTIWumee4iPk8Mtxsgx PFsedgqLN/iqMkiN+MImlkYkid/Qo+q98e7vfPRto49cz7vuksN+TROYEsGWps9hPvfJ jJyA== 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 r207-v6si220948itr.10.2018.06.12.04.39.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 04:39:34 -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 1fShbi-0000rO-PG; Tue, 12 Jun 2018 11:37:02 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fShbh-0000qy-Iv for xen-devel@lists.xenproject.org; Tue, 12 Jun 2018 11:37:01 +0000 X-Inumbo-ID: eea6a7f2-6e34-11e8-bc1d-65256ead4e3a Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id eea6a7f2-6e34-11e8-bc1d-65256ead4e3a; Tue, 12 Jun 2018 11:37:05 +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 C371D1596; Tue, 12 Jun 2018 04:37:00 -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 D971E3F318; Tue, 12 Jun 2018 04:36:59 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 12 Jun 2018 12:36:39 +0100 Message-Id: <20180612113643.32020-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180612113643.32020-1-julien.grall@arm.com> References: <20180612113643.32020-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 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 --- 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