From patchwork Mon Apr 22 16:49:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162608 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801364jan; Mon, 22 Apr 2019 09:51:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxd+s2gKpU3zC00n8QOeR89loz7zXbVuhN3Be6Jdc9HDnhdWd6aMyBQNgVP67LU19UTx/7 X-Received: by 2002:a25:25d2:: with SMTP id l201mr17330155ybl.257.1555951880457; Mon, 22 Apr 2019 09:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951880; cv=none; d=google.com; s=arc-20160816; b=RLollyNLbaaBzOtwGl5fMk5Uh4JHGd767uC5pL7B4OjgxFjKrDqzoCb/Pipe7C0fsb SvltnfNQGaEBlhyrCbLA0UIo0EYfIsOL679OFdo8F9qO98aDlNp5QKDa8t0XfXTVq58h 0o8lXLjW+4H6J9xOiX1EUelH/pjY0PEGQjt5gBfuiElSCVgpmSua5MfMUKLk5fQPv66O A5UapAjYHYbLYb0d5FVHF/f45FaIHZLWmDrceQa8fG9lQ+Gpxe1vPIiwqdQa7yiAlcjx QxSrNMufgOY7/g32SDvkk1DCXSOqmrRA4FH+OJTHnU4Z3PCsH3X40EQ0zKpUX8z8Psi5 dJXA== 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; bh=RnIkcWvTDTtP7dQEhDgaDwQ1HPPH7uW3TdJHf9p0IZs=; b=qXCgH/Y40NKWSHOGNTjn7kTi1G2htFx5vWQ/4zzcGdaCGFBIQpqUmfNPB50MGxIts6 ABVTdQ1qeZIKG4YBH07QGNH4Wk5zaEC69FIeyBAxSw0u0DQFNMWx5715laGMfpUvBveU adDTne8x0erFeUfZVaE3adlIGERWX0y0eom5GjdettjwVy6UD5033q3HQBCf3JHSJmuZ Hze/MOHVIsoS9Cmh3X8r0A+DYifJm9nVn2SFBXSWH+ijdX8nvHY9C0J4Mgs7wYEgbkd9 E+f2SLIIxp95dKVn/mILfDc3s9ARPbaO6o8nRK88ZxErObDi6bMsHVAMCjaou73a8ukr vOHA== 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 y204si965759ywy.441.2019.04.22.09.51.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:20 -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 1hIc8g-0004Qk-La; Mon, 22 Apr 2019 16:49:54 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8f-0004Qe-N1 for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:49:53 +0000 X-Inumbo-ID: a6946122-651e-11e9-9db4-1b290d8ec6c6 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id a6946122-651e-11e9-9db4-1b290d8ec6c6; Mon, 22 Apr 2019 16:49:53 +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 B70BDEBD; Mon, 22 Apr 2019 09:49:52 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A35DE3F557; Mon, 22 Apr 2019 09:49:50 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:18 +0100 Message-Id: <20190422164937.21350-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 01/20] xen/const: Introduce _BITUL and _BITULL 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: sstabellini@kernel.org, Andrii_Anisov@epam.com, Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Oleksandr_Tyshchenko@epam.com, Julien Grall , Jan Beulich , Wei Liu MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The pattern _AC(1, UL{,L}) << X is commonly used in the headers to make define usuable in both assembly and C. So introduce _BITUL and _BITULL to make the code slightly more readable. The idea has been taken from Linux (see include/uapi/linux.h). Signed-off-by: Julien Grall --- xen/include/xen/const.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/include/xen/const.h b/xen/include/xen/const.h index 0d5b2c64f5..b4b067bffa 100644 --- a/xen/include/xen/const.h +++ b/xen/include/xen/const.h @@ -21,4 +21,7 @@ #define _AT(T,X) ((T)(X)) #endif +#define _BITUL(x) (_AC(1, UL) << (x)) +#define _BITULL(x) (_AC(1, ULL) << (x)) + #endif /* __XEN_CONST_H__ */ From patchwork Mon Apr 22 16:49:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162606 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801339jan; Mon, 22 Apr 2019 09:51:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqww3y0wJOyTepttuwM03NOZk0+TWtTX/jf9HLuje/txVChK0mgLMPtiR0D7IBgG64LVVXXE X-Received: by 2002:a25:c648:: with SMTP id k69mr17893220ybf.67.1555951879540; Mon, 22 Apr 2019 09:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951879; cv=none; d=google.com; s=arc-20160816; b=xdkeWJpVlCHm5uBxUaOTG8LypMx0GLbBr0/SrbEPXdZ95zExGZiz52f8dV0qLD0/dq //YkDtUSUpLf0yplD0/kLyXq7SFO8QoctuiuR2kn+Z91CkUvoM984eHUzhusPCtYMnHb A398u1t8SwwsExZ7aSeImumAkioch8qbufSlmJrbJGL9+ykU2sPuTWOlDp6UZa+87Uxy 9RzzxekG6zuUf9uoc5d5Q67LKe+6yyl6Sxb8rPnbpuElWcXIyZM9TeHZMRldMKrfbaiU zcNpcE8v3Aj0+zqhw/A9fdah863yyQlWVvX4CB43V+udQCkJyM0SLJdJ2DiowxszUiqR Jy5w== 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; bh=2KvKFpeo4eXH2D6NJB+s+QtbeOdE5WL96u8RiGaRaXU=; b=SPy1j3sRQr+tEHgfIZ5VXJrwfMU4zDyK3D6dRJiKnsRKnXzfXpM3TfKO1HurzqPZlu Nm69js0lI5q7RMgHbBzYLW5jtQh2pZIAmU/LWVPjCJuqp59unzxl++5qRmxHgy85cKvf ijLEFyGQ5ES4rssjP03AO8LtF8C/WMl0GDYjXw1uvX3WM2bQ/iBo0hg2kVu57fh143hI 62DFw9bY5cvMGgoGHvUsa8lAU5nYpW/raW4bj148EoYdsrTJhoU8CrLMcft1OXjbDFb/ WyqmZQldb0lbGnhUsMosRub0XGlGb+M3PSfk/MKGy06azP8msLP1Zu7RgrQLydmIZmMc 4AbA== 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 129si9097926ybb.436.2019.04.22.09.51.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:19 -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 1hIc8j-0004RG-Ub; Mon, 22 Apr 2019 16:49:57 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8h-0004Qy-Qd for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:49:55 +0000 X-Inumbo-ID: a752a49b-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id a752a49b-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:49:54 +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 0FEE7374; Mon, 22 Apr 2019 09:49:54 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0099F3F557; Mon, 22 Apr 2019 09:49:52 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:19 +0100 Message-Id: <20190422164937.21350-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 02/20] xen/arm: Rename SCTLR_* defines and remove unused one 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The SCTLR_* are currently used for SCTLR/HSCTLR (arm32) and SCTLR_EL1/SCTLR_EL2 (arm64). The naming scheme is actually quite confusing because they may only be defined for an archicture (or even an exception level). So it is not easy for the developer to know which one to use. The naming scheme is reworked by adding Axx_ELx in each define: * xx is replaced by 32 or 64 if specific to an architecture * x is replaced by 2 (hypervisor) or 1 (kernel) if specific to an exception level While doing the renaming, remove the unused defines (or at least the ones that are unlikely going to be used). Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm32/head.S | 5 +++-- xen/arch/arm/arm64/head.S | 4 ++-- xen/arch/arm/guest_walk.c | 2 +- xen/arch/arm/mm.c | 2 +- xen/arch/arm/traps.c | 6 +++--- xen/include/asm-arm/p2m.h | 4 +++- xen/include/asm-arm/processor.h | 37 +++++++++++++++++-------------------- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 390a505e05..5ef7e5a2f3 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -244,7 +244,7 @@ cpu_init_done: * Alignment checking enabled, * MMU translation disabled (for now). */ - ldr r0, =(HSCTLR_BASE|SCTLR_A) + ldr r0, =(HSCTLR_BASE|SCTLR_AXX_A) mcr CP32(r0, HSCTLR) /* @@ -369,7 +369,8 @@ virtphys_clash: ldr r1, =paging /* Explicit vaddr, not RIP-relative */ mrc CP32(r0, HSCTLR) - orr r0, r0, #(SCTLR_M|SCTLR_C) /* Enable MMU and D-cache */ + /* Enable MMU and D-cache */ + orr r0, r0, #(SCTLR_Axx_ELx_M|SCTLR_Axx_ELx_C) dsb /* Flush PTE writes and finish reads */ mcr CP32(r0, HSCTLR) /* now paging is enabled */ isb /* Now, flush the icache */ diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 4589a37874..8a6be3352e 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -514,8 +514,8 @@ virtphys_clash: ldr x1, =paging /* Explicit vaddr, not RIP-relative */ mrs x0, SCTLR_EL2 - orr x0, x0, #SCTLR_M /* Enable MMU */ - orr x0, x0, #SCTLR_C /* Enable D-cache */ + orr x0, x0, #SCTLR_Axx_ELx_M /* Enable MMU */ + orr x0, x0, #SCTLR_Axx_ELx_C /* Enable D-cache */ dsb sy /* Flush PTE writes and finish reads */ msr SCTLR_EL2, x0 /* now paging is enabled */ isb /* Now, flush the icache */ diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c index 1bee198777..54065ac4b6 100644 --- a/xen/arch/arm/guest_walk.c +++ b/xen/arch/arm/guest_walk.c @@ -612,7 +612,7 @@ bool guest_walk_tables(const struct vcpu *v, vaddr_t gva, *perms = GV2M_READ; /* If the MMU is disabled, there is no need to translate the gva. */ - if ( !(sctlr & SCTLR_M) ) + if ( !(sctlr & SCTLR_Axx_ELx_M) ) { *ipa = gva; diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 9d584e4cbf..e090afb976 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -609,7 +609,7 @@ void __init remove_early_mappings(void) */ static void xen_pt_enforce_wnx(void) { - WRITE_SYSREG32(READ_SYSREG32(SCTLR_EL2) | SCTLR_WXN, SCTLR_EL2); + WRITE_SYSREG32(READ_SYSREG32(SCTLR_EL2) | SCTLR_Axx_ELx_WXN, SCTLR_EL2); /* * The TLBs may cache SCTLR_EL2.WXN. So ensure it is synchronized * before flushing the TLBs. diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 1aba970415..6c757c12a8 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -392,9 +392,9 @@ static void cpsr_switch_mode(struct cpu_user_regs *regs, int mode) regs->cpsr |= PSR_IRQ_MASK; if ( mode == PSR_MODE_ABT ) regs->cpsr |= PSR_ABT_MASK; - if ( sctlr & SCTLR_TE ) + if ( sctlr & SCTLR_A32_ELx_TE ) regs->cpsr |= PSR_THUMB; - if ( sctlr & SCTLR_EE ) + if ( sctlr & SCTLR_Axx_ELx_EE ) regs->cpsr |= PSR_BIG_ENDIAN; } @@ -402,7 +402,7 @@ static vaddr_t exception_handler32(vaddr_t offset) { uint32_t sctlr = READ_SYSREG32(SCTLR_EL1); - if ( sctlr & SCTLR_V ) + if ( sctlr & SCTLR_A32_EL1_V ) return 0xffff0000 + offset; else /* always have security exceptions */ return READ_SYSREG(VBAR_EL1) + offset; diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 041dea827c..2f89bb00c3 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -391,10 +391,12 @@ static inline int set_foreign_p2m_entry(struct domain *d, unsigned long gfn, */ static inline bool vcpu_has_cache_enabled(struct vcpu *v) { + const uint32_t mask = SCTLR_Axx_ELx_C | SCTLR_Axx_ELx_M; + /* Only works with the current vCPU */ ASSERT(current == v); - return (READ_SYSREG32(SCTLR_EL1) & (SCTLR_C|SCTLR_M)) == (SCTLR_C|SCTLR_M); + return (READ_SYSREG32(SCTLR_EL1) & mask) == mask; } #endif /* _XEN_P2M_H */ diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index b5f515805d..c6f56490b3 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -112,26 +112,23 @@ #define TTBCR_PD1 (_AC(1,U)<<5) /* SCTLR System Control Register. */ -/* HSCTLR is a subset of this. */ -#define SCTLR_TE (_AC(1,U)<<30) -#define SCTLR_AFE (_AC(1,U)<<29) -#define SCTLR_TRE (_AC(1,U)<<28) -#define SCTLR_NMFI (_AC(1,U)<<27) -#define SCTLR_EE (_AC(1,U)<<25) -#define SCTLR_VE (_AC(1,U)<<24) -#define SCTLR_U (_AC(1,U)<<22) -#define SCTLR_FI (_AC(1,U)<<21) -#define SCTLR_WXN (_AC(1,U)<<19) -#define SCTLR_HA (_AC(1,U)<<17) -#define SCTLR_RR (_AC(1,U)<<14) -#define SCTLR_V (_AC(1,U)<<13) -#define SCTLR_I (_AC(1,U)<<12) -#define SCTLR_Z (_AC(1,U)<<11) -#define SCTLR_SW (_AC(1,U)<<10) -#define SCTLR_B (_AC(1,U)<<7) -#define SCTLR_C (_AC(1,U)<<2) -#define SCTLR_A (_AC(1,U)<<1) -#define SCTLR_M (_AC(1,U)<<0) + +/* Bits specific to SCTLR_EL1 for Arm32 */ + +#define SCTLR_A32_EL1_V (_AC(1,U)<<13) + +/* Common bits for SCTLR_ELx for Arm32 */ + +#define SCTLR_A32_ELx_TE (_AC(1,U)<<30) +#define SCTLR_A32_ELx_FI (_AC(1,U)<<21) + +/* Common bits for SCTLR_ELx on all architectures */ +#define SCTLR_Axx_ELx_EE (_AC(1,U)<<25) +#define SCTLR_Axx_ELx_WXN (_AC(1,U)<<19) +#define SCTLR_Axx_ELx_I (_AC(1,U)<<12) +#define SCTLR_Axx_ELx_C (_AC(1,U)<<2) +#define SCTLR_Axx_ELx_A (_AC(1,U)<<1) +#define SCTLR_Axx_ELx_M (_AC(1,U)<<0) #define HSCTLR_BASE _AC(0x30c51878,U) From patchwork Mon Apr 22 16:49:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162609 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801378jan; Mon, 22 Apr 2019 09:51:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4b7Re/IexzYYnc/YMWjv9PqfVOtobuOuo0EQzBJibMqMZbAD2jHn3uhiYLB/+9A+MwPhR X-Received: by 2002:a81:4b94:: with SMTP id y142mr4734830ywa.69.1555951881231; Mon, 22 Apr 2019 09:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951881; cv=none; d=google.com; s=arc-20160816; b=aBPZpmmY6R50kpVsTnUatzeFb0JE/skGdeOlHKoz9BhqD95YXak+4e6mcvRQSXeWAa 7JwTGnVYgC8Eor+mg0Iw5xwxZodAPieJpE9gncKezL6No4SQyQKPHvSk1uWdYhEJxk8Z o9VTCVj6Wy8dveusrL83gyDPq1Dn5eJGWR4pNUDz0X6Y8hKziRhv6vMBvb/AAHpabCg3 dB0FJkJe4BnzHqwxkIBY4B7I1TnLAIU6l2x9kTbRjjiiDKREsuPYap//I8ZKREL2WssA GOaC5HQJbrvs8sDhQr0gYVmqautsramHFkEgzFQ58rdRjqgCN2rNKiAKPU/Kz2Msk9Ta Xgkg== 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; bh=x7j/qFxxh0s7F0qk+uH3u9rTdrBTNGFtOOEIdQZIGMo=; b=i+IpTAl197UyQO0njuQHZEEJU9xnBqQJzciLkLwJpoz/DhLCvhHqB8k8YQLU4Xqq9L F1LVX7aafG7KMrNLXrrg6wO50atOZh8iCJuvr5+1bg663uwm5Snyp7JJzMYyDhuyuH5/ AzVMMHRgl4LDA6uucas1tI2fPXQKbfc1QfKuJ3RbH7zZCd7X4oVpdh6XUlSS0ppPsyh/ jKLjrQatFgUxMrihLJPqoSwhVU7BXPSx30qTZu8iKZyK3OePT6AYJaLQ4b52OZQ2rnz6 txfeVHWvall9hMvuMuYJK1+NjA2VCEXZxO3eiPzpDPMGWYmEQfeODvuYhAPEkdaWayud iLDw== 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 d3si9096117ybf.167.2019.04.22.09.51.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:21 -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 1hIc8k-0004RO-7J; Mon, 22 Apr 2019 16:49:58 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8j-0004R7-46 for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:49:57 +0000 X-Inumbo-ID: a8215803-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id a8215803-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:49:55 +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 5D65F15AB; Mon, 22 Apr 2019 09:49:55 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4DF113F557; Mon, 22 Apr 2019 09:49:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:20 +0100 Message-Id: <20190422164937.21350-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 03/20] xen/arm: processor: Use _BITUL instead of _AC(1, U) in SCTLR_ defines 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The newly introduced macro _BITUL makes the code more readable. Signed-off-by: Julien Grall --- xen/include/asm-arm/processor.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index c6f56490b3..1a143fb6a3 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -115,20 +115,20 @@ /* Bits specific to SCTLR_EL1 for Arm32 */ -#define SCTLR_A32_EL1_V (_AC(1,U)<<13) +#define SCTLR_A32_EL1_V _BITUL(13) /* Common bits for SCTLR_ELx for Arm32 */ -#define SCTLR_A32_ELx_TE (_AC(1,U)<<30) -#define SCTLR_A32_ELx_FI (_AC(1,U)<<21) +#define SCTLR_A32_ELx_TE _BITUL(30) +#define SCTLR_A32_ELx_FI _BITUL(21) /* Common bits for SCTLR_ELx on all architectures */ -#define SCTLR_Axx_ELx_EE (_AC(1,U)<<25) -#define SCTLR_Axx_ELx_WXN (_AC(1,U)<<19) -#define SCTLR_Axx_ELx_I (_AC(1,U)<<12) -#define SCTLR_Axx_ELx_C (_AC(1,U)<<2) -#define SCTLR_Axx_ELx_A (_AC(1,U)<<1) -#define SCTLR_Axx_ELx_M (_AC(1,U)<<0) +#define SCTLR_Axx_ELx_EE _BITUL(25) +#define SCTLR_Axx_ELx_WXN _BITUL(19) +#define SCTLR_Axx_ELx_I _BITUL(12) +#define SCTLR_Axx_ELx_C _BITUL(2) +#define SCTLR_Axx_ELx_A _BITUL(1) +#define SCTLR_Axx_ELx_M _BITUL(0) #define HSCTLR_BASE _AC(0x30c51878,U) From patchwork Mon Apr 22 16:49:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162612 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801415jan; Mon, 22 Apr 2019 09:51:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfY7XUXFqv0q0jqBVH5OzDlIUKsqejEMta1+6/s8kpZamqQzAuBnjuHp8ualApgc8fIJPN X-Received: by 2002:a0d:e844:: with SMTP id r65mr10360591ywe.41.1555951883023; Mon, 22 Apr 2019 09:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951883; cv=none; d=google.com; s=arc-20160816; b=oJRbKbZCOOkcr9j8+MPvLCDb9TmMkqcK0KOuRl6bxgmvcPjm3gT9RnIwmR2tHxdzdt 7eFPQYiJVglpfh83ZJRgcCUeQaXRNqvior8hB39ih6nzlM/vl/P3uRe7uFS89To4kfF2 QfdzBg2kmt6kl58ctRMotQY9o2CwUnQCxwm7EdX7L7YEvXM7CE09TUSIKNTOKqorHlVy YRmnzwce0NxxFS+38C6K4L5+DzQlanA3naqN/ix4YcEuaVrPlUxFlz8a7yz9qtNt2zjg jMo1QtlFpXkolI80I61tZAK+oK+kBTyirDXvpJAUGC52BRJ8vz6+mmgscxseyrLm7VO2 ekHw== 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; bh=QW/tjoOtb2n65Pv8Rs/tPaEWHScIZdDEAy+wzET2CsY=; b=LWyfbH9J1RQuAzjEVJbmhbtWbj0ihSC49Z/uwvrYYfF/6//q7Pldf/hsqL7ne7nUPs Kp4tHEuqMvaNP0srqLlaAWkWBmYA7vb4t61l1wwljJ6QNIHSlCrrnaaqXUGspMFCxBdQ wLLsd+YlH3soy/zHZ46RXrPwqbtI5UDuY/7SbsMQRvZmsrHKdjZVJ86Wmd51w7fa6pIE Pdx2yg+3SC8xPRCbyv70bFm1LuEZM+RKmfTKuSDXbGHtEyB39leVj25TPZ2LV1NGluzk jhMo5S+PKt80vQz0c17SM6xmOCARP8PnK8KLuwc0K4n/d25m0Cr9zwSFCOKZ/O12g2Eo 9Ngg== 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 s8si8534038ybk.195.2019.04.22.09.51.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:22 -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 1hIc8l-0004Sc-HZ; Mon, 22 Apr 2019 16:49:59 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8k-0004RR-Co for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:49:58 +0000 X-Inumbo-ID: a8dcf381-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id a8dcf381-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:49:56 +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 AAE74EBD; Mon, 22 Apr 2019 09:49:56 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9B6353F557; Mon, 22 Apr 2019 09:49:55 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:21 +0100 Message-Id: <20190422164937.21350-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 04/20] xen/arm: Rework HSCTLR_BASE 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The current value of HSCTLR_BASE for Arm64 is pretty wrong. It would actually turn on SCTLR_EL2.nAA (bit 6) on hardware implementing ARMv8.4-LSE. Furthermore, the documentation of what is cleared/set in SCTLR_EL2 is also not correct and looks like to be a verbatim copy from Arm32. HSCTLR_BASE is replaced with a bunch of per-architecture new defines helping to understand better what is the initialie value for SCTLR_EL2/HSCTLR. Note the defines *_CLEAR are only used to check the state of each bits are known. Lastly, the documentation is dropped from arm{32,64}/head.S as it would be pretty easy to get out-of-sync with the definitions. Signed-off-by: Julien Grall --- xen/arch/arm/arm32/head.S | 12 +--------- xen/arch/arm/arm64/head.S | 10 +------- xen/include/asm-arm/processor.h | 52 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 5ef7e5a2f3..8a98607459 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -234,17 +234,7 @@ cpu_init_done: ldr r0, =(TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(0)) mcr CP32(r0, HTCR) - /* - * Set up the HSCTLR: - * Exceptions in LE ARM, - * Low-latency IRQs disabled, - * Write-implies-XN disabled (for now), - * D-cache disabled (for now), - * I-cache enabled, - * Alignment checking enabled, - * MMU translation disabled (for now). - */ - ldr r0, =(HSCTLR_BASE|SCTLR_AXX_A) + ldr r0, =HSCTLR_SET mcr CP32(r0, HSCTLR) /* diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 8a6be3352e..4fe904c51d 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -363,15 +363,7 @@ skip_bss: msr tcr_el2, x0 - /* Set up the SCTLR_EL2: - * Exceptions in LE ARM, - * Low-latency IRQs disabled, - * Write-implies-XN disabled (for now), - * D-cache disabled (for now), - * I-cache enabled, - * Alignment checking disabled, - * MMU translation disabled (for now). */ - ldr x0, =(HSCTLR_BASE) + ldr x0, =SCTLR_EL2_SET msr SCTLR_EL2, x0 /* Ensure that any exceptions encountered at EL2 diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 1a143fb6a3..6dac500e40 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -122,6 +122,9 @@ #define SCTLR_A32_ELx_TE _BITUL(30) #define SCTLR_A32_ELx_FI _BITUL(21) +/* Common bits for SCTLR_ELx for Arm64 */ +#define SCTLR_A64_ELx_SA _BITUL(3) + /* Common bits for SCTLR_ELx on all architectures */ #define SCTLR_Axx_ELx_EE _BITUL(25) #define SCTLR_Axx_ELx_WXN _BITUL(19) @@ -130,7 +133,54 @@ #define SCTLR_Axx_ELx_A _BITUL(1) #define SCTLR_Axx_ELx_M _BITUL(0) -#define HSCTLR_BASE _AC(0x30c51878,U) +#ifdef CONFIG_ARM_32 + +#define HSCTLR_RES1 (_BITUL(3) | _BITUL(4) | _BITUL(5) | _BITUL(6) |\ + _BITUL(11) | _BITUL(16) | _BITUL(18) | _BITUL(22) |\ + _BITUL(23) | _BITUL(28) | _BITUL(29)) + +#define HSCTLR_RES0 (_BITUL(7) | _BITUL(8) | _BITUL(9) | _BITUL(10) |\ + _BITUL(13) | _BITUL(14) | _BITUL(15) | _BITUL(17) |\ + _BITUL(20) | _BITUL(24) | _BITUL(26) | _BITUL(27) |\ + _BITUL(31)) + +/* Initial value for HSCTLR */ +#define HSCTLR_SET (HSCTLR_RES1 | SCTLR_Axx_ELx_A | SCTLR_Axx_ELx_I) + +#define HSCTLR_CLEAR (HSCTLR_RES0 | SCTLR_Axx_ELx_M |\ + SCTLR_Axx_ELx_C | SCTLR_Axx_ELx_WXN |\ + SCTLR_A32_ELx_FI | SCTLR_Axx_ELx_EE |\ + SCTLR_A32_ELx_TE) + +#if (HSCTLR_SET ^ HSCTLR_CLEAR) != 0xffffffffU +#error "Inconsistent HSCTLR set/clear bits" +#endif + +#else + +#define SCTLR_EL2_RES1 (_BITUL(4) | _BITUL(5) | _BITUL(11) | _BITUL(16) |\ + _BITUL(18) | _BITUL(22) | _BITUL(23) | _BITUL(28) |\ + _BITUL(29)) + +#define SCTLR_EL2_RES0 (_BITUL(6) | _BITUL(7) | _BITUL(8) | _BITUL(9) |\ + _BITUL(10) | _BITUL(13) | _BITUL(14) | _BITUL(15) |\ + _BITUL(17) | _BITUL(20) | _BITUL(21) | _BITUL(24) |\ + _BITUL(26) | _BITUL(27) | _BITUL(30) | _BITUL(31) |\ + (0xffffffffULL << 32)) + +/* Initial value for SCTLR_EL2 */ +#define SCTLR_EL2_SET (SCTLR_EL2_RES1 | SCTLR_A64_ELx_SA |\ + SCTLR_Axx_ELx_I) + +#define SCTLR_EL2_CLEAR (SCTLR_EL2_RES0 | SCTLR_Axx_ELx_M |\ + SCTLR_Axx_ELx_A | SCTLR_Axx_ELx_C |\ + SCTLR_Axx_ELx_WXN | SCTLR_Axx_ELx_EE) + +#if (SCTLR_EL2_SET ^ SCTLR_EL2_CLEAR) != 0xffffffffffffffffUL +#error "Inconsistent SCTLR_EL2 set/clear bits" +#endif + +#endif /* HCR Hyp Configuration Register */ #define HCR_RW (_AC(1,UL)<<31) /* Register Width, ARM64 only */ From patchwork Mon Apr 22 16:49:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162610 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801389jan; Mon, 22 Apr 2019 09:51:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwd2TiM8iYVYcC9S9g9FznEmHkPUDu23wezVN8c4zvLZxsC/fFxpjnHVq5UlSi8NEGpSnzC X-Received: by 2002:a81:218b:: with SMTP id h133mr16614814ywh.487.1555951881916; Mon, 22 Apr 2019 09:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951881; cv=none; d=google.com; s=arc-20160816; b=AdfHNLzxn/ksyl9y8pI5yPNF2idOi/X5PAqsBz+2853vAltc3xt5c4RuIEWK/37m4P XoYtw7hEfG4teGACuxVzA+c/0mjNefdNPlkw7MvHqwF0kkjWb5rRPJppWAX0APFRLJe1 ABsFZ1FJkZwACaxbAsNzgm4wHwTQvpREkbQEB/rdQZkEn/7zmv5mHCjHIRRbWeIw7DcA Z83O6L+9BzspqMdihUai5NkKW2cg+M1yW8vkl8ml/wI51r9DVsWwOvm28i48ljoO4bLO 4q2c3FapQJqg5xKKOk5MFnotvUZ/M/B1bOff6WJi9vk1qwyThCyFjbXerlxHNYN7IMzk y9vw== 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; bh=f/JxSIsRF+WoP1XJsAZbemOyljz9g+U0FtEnJjlNDNg=; b=C3UQEeSKHH+84NCvpp3jSIZAmxFLu5m6kn3V4OuDcba7yb4FQdsdPVQmEEHNQf/Uvj lSxyboUn1AE51I94FAVxtNxFbcRnvHBWIpif14eILW31wez7see0tfj6JZq1poHXYVmo Te7NumnlVfJyc72j91z1TJjvjkuwd1xrpJ4wwgxp4H2iG6jYq1XvnCJsgx8RhCjeIPCi 5cLTv7AJmzQyKz8fmW9aapwU8BhqkfzM5L6yQwN3Q3etOysLatmm1fSvo5J1hp6wSG8v h9Jsdknkt37MioNv2VmH4km1PR30LciCCPsTZf7FTIrZEOxhDSoEi26YD2RTF2DSfg+g NaHw== 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 l76si9090017ywc.186.2019.04.22.09.51.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:21 -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 1hIc8m-0004Tl-W9; Mon, 22 Apr 2019 16:50:00 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8k-0004SK-V6 for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:49:58 +0000 X-Inumbo-ID: a9b1d358-651e-11e9-a8c6-93b1c3c83655 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id a9b1d358-651e-11e9-a8c6-93b1c3c83655; Mon, 22 Apr 2019 16:49:58 +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 0408A374; Mon, 22 Apr 2019 09:49:58 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E8C673F557; Mon, 22 Apr 2019 09:49:56 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:22 +0100 Message-Id: <20190422164937.21350-6-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 05/20] xen/arm: Rework secondary_start prototype 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" None of the parameters of secondary_start are actually used. So turn secondary_start to a function with no parameters. Also modify the assembly code to avoid setting-up the registers before calling secondary_start. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm32/head.S | 6 +++--- xen/arch/arm/arm64/head.S | 3 ++- xen/arch/arm/smpboot.c | 4 +--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 8a98607459..b71d7fb11d 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -445,10 +445,10 @@ launch: ldr sp, [r0] add sp, #STACK_SIZE /* (which grows down from the top). */ sub sp, #CPUINFO_sizeof /* Make room for CPU save record */ - mov r0, r10 /* Marshal args: - phys_offset */ - mov r1, r8 /* - DTB address */ - mov r2, r7 /* - CPU ID */ teq r12, #0 + moveq r0, r10 /* Marshal args: - phys_offset */ + moveq r1, r8 /* - DTB address */ + moveq r2, r7 /* - CPU ID */ beq start_xen /* and disappear into the land of C */ b start_secondary /* (to the appropriate entry point) */ diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 4fe904c51d..b26126de53 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -582,10 +582,11 @@ launch: sub x0, x0, #CPUINFO_sizeof /* Make room for CPU save record */ mov sp, x0 + cbnz x22, 1f + mov x0, x20 /* Marshal args: - phys_offset */ mov x1, x21 /* - FDT */ mov x2, x24 /* - CPU ID */ - cbnz x22, 1f b start_xen /* and disappear into the land of C */ 1: b start_secondary /* (to the appropriate entry point) */ diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index f756444362..00b64c3322 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -297,9 +297,7 @@ smp_prepare_cpus(void) } /* Boot the current CPU */ -void start_secondary(unsigned long boot_phys_offset, - unsigned long fdt_paddr, - unsigned long hwid) +void start_secondary(void) { unsigned int cpuid = init_data.cpuid; From patchwork Mon Apr 22 16:49:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162607 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801361jan; Mon, 22 Apr 2019 09:51:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFDkp5h7s+6O0z0yWDcIXlAeum1L09RG9kIEV0N55PKOViJeMzmfetK1cjTgyBAzQ7mH1L X-Received: by 2002:a25:7312:: with SMTP id o18mr16039915ybc.521.1555951880320; Mon, 22 Apr 2019 09:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951880; cv=none; d=google.com; s=arc-20160816; b=CVABAogXPhslzq/JBnYWd96+SntvxGkrVXFujJv9M3b6bcV1hhW6d9hTwY93ZPHfho 2Q+yyW/EzWtD26qP2GIGdEG1/Vh3Dyeqe+378muWCbG7ivZsSM6gBgaMg9u1pGKy77hI 9aElcPXFIFUJedEjrX+fOPP8blFYUJXeQxnx/D+SCHqQW7/ex3q/lc2UWlHdoROt4/FJ /swXHbqHbIaUQlIjvuVzKRpuMojKOAOWGk+zmy+0mSYvv2saginKY18uKZDuo4zt7L7U P/nye79swPG4zPFWr+1tQgusqaQsFEj0jdGenOPjRAydOcEYwGUAkw+VSRIbjCAVVbIU 937g== 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; bh=DcwIKbWiZRQtJ3fU8QZrm92d4ucSJ5eJV8AT2ISN4lQ=; b=crhC2lsUpisAUb8Qv4w/p6tyfXtKV7PqekllVl/ZlrEoITEjzrfYlbgUtTloOkbAC9 pD1CHu5BS6VQVhgbOBpJpSgr4pil//ujolXtf29amHIiOwdMGSTzY+nwYn9sF7XAKa+m 7CiWVGfIamYDVvU84ZmvnsCuNmj9OUTx1K2aoi4t4m2ZPhTqvacC+CiICwaR60g8IMN/ i05jFIXcev1Y+0GII/zQVIRTaaDPkx14r0GT7WW8d2FWjeNugZljuqIgRKYZC3GFAgLK FLRAYWDTXeGFhR8D2KYYVWf6ozZUhBvxl54OpC34ew+pQMwLVqtbx12z1VTS0lOA73iF sHGw== 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 13si9144461ywv.46.2019.04.22.09.51.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:20 -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 1hIc8n-0004VE-Ae; Mon, 22 Apr 2019 16:50:01 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8m-0004T7-74 for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:00 +0000 X-Inumbo-ID: aa743eac-651e-11e9-a8ce-1bd14de404b9 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id aa743eac-651e-11e9-a8ce-1bd14de404b9; Mon, 22 Apr 2019 16:49:59 +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 519B015AB; Mon, 22 Apr 2019 09:49:59 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 41F2E3F557; Mon, 22 Apr 2019 09:49:58 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:23 +0100 Message-Id: <20190422164937.21350-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 06/20] xen/arm: Remove parameter cpuid from start_xen 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The parameter cpuid is not used by start_xen. So remove it. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm32/head.S | 1 - xen/arch/arm/arm64/head.S | 1 - xen/arch/arm/setup.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index b71d7fb11d..9f40face98 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -448,7 +448,6 @@ launch: teq r12, #0 moveq r0, r10 /* Marshal args: - phys_offset */ moveq r1, r8 /* - DTB address */ - moveq r2, r7 /* - CPU ID */ beq start_xen /* and disappear into the land of C */ b start_secondary /* (to the appropriate entry point) */ diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index b26126de53..cb30d6f22e 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -586,7 +586,6 @@ launch: mov x0, x20 /* Marshal args: - phys_offset */ mov x1, x21 /* - FDT */ - mov x2, x24 /* - CPU ID */ b start_xen /* and disappear into the land of C */ 1: b start_secondary /* (to the appropriate entry point) */ diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index ccb0f181ea..6dfbba2927 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -728,8 +728,7 @@ size_t __read_mostly dcache_line_bytes; /* C entry point for boot CPU */ void __init start_xen(unsigned long boot_phys_offset, - unsigned long fdt_paddr, - unsigned long cpuid) + unsigned long fdt_paddr) { size_t fdt_size; int cpus, i; From patchwork Mon Apr 22 16:49:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162611 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801411jan; Mon, 22 Apr 2019 09:51:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqww2nd9Gk+lfSosY+Ar9HPm4DqYNeX6h2WrQmD032VoTBg2vc2deuHJVoFfA8lU+VntfwS4 X-Received: by 2002:a25:65d4:: with SMTP id z203mr16927531ybb.370.1555951882909; Mon, 22 Apr 2019 09:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951882; cv=none; d=google.com; s=arc-20160816; b=JTYI7iIcSQu8cvFB9CeKlwBuRy/sXy5DoYPmFhlMU53TePYdkRttN7BM5j9lWJZeWv Q2jMjgMzCJLJpQXCU6m3e6UsKlBVFq1vkGbVQ2QuLaxF8lmn2FJGaDZ9uuNa+zS2rRvj r1p44R2rBrzOYLFESCSe0b2soDqrNbioslJKFPYQmStGboU9fi4xp2OZrk9LT/QwDeW2 8tqZRx6ZEy/uvFp+7ZJ8RmrUO6BfxHDHcC8EcZEfrGA+bU9lZIrRXLIca6QtqJUvq7zO 2Id2Sm1TDF64SXdGfrThVHzNBb8tOtpBQJLWqwvSYH6IsNAAu9yurNvJF8Z4IPV0rD1U eY8A== 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; bh=fwl8ON/FGOMZUc2o4mMWmo8NqMawRLeI0ydgE6rH/kM=; b=RvxnY3fsLMJhE5yLg3jw29cH9bhW21oqmAgJSw0OgcsnGcdoeYOs6ArejYbTNnQpjC YhqtUspsPo9O3TFWo9LrSKStDXy5pFYJfeeOEVDSyrSwdqvWfR/JDW3nADm435KrSAYy /PG6BnOETeh7E/2UvvkfehdANMyxVZ7YG/oq/+OJagWipZ9M8TW6/owPJlef+Y20JnJe dq8zpU1fplWaxbH+r4QY35zkfAjksNCVxVJ8JevtG+rob+y9IhRc9C44IiGHBrlw2q8v wX89UjADsbCQhikVCA1BPkO0Y4AQ8G3YFJIcJa5zrsS8AWJV23Y4u2AByBJxaB1JehHl UxbQ== 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 c66si9364256ybb.493.2019.04.22.09.51.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:22 -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 1hIc8o-0004bg-On; Mon, 22 Apr 2019 16:50:02 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8n-0004WC-M3 for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:01 +0000 X-Inumbo-ID: ab50b3de-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id ab50b3de-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:01 +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 9F252EBD; Mon, 22 Apr 2019 09:50:00 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F8B33F557; Mon, 22 Apr 2019 09:49:59 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:24 +0100 Message-Id: <20190422164937.21350-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 07/20] xen/arm64: head: Remove unnecessary comment 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" So far, we don't init specific core initialization at boot. So remove the comment. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm64/head.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index cb30d6f22e..ad446e7345 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -344,8 +344,6 @@ el2: PRINT("- Xen starting at EL2 -\r\n") skip_bss: PRINT("- Setting up control registers -\r\n") - /* XXXX call PROCINFO_cpu_init here */ - /* Set up memory attribute type tables */ ldr x0, =MAIRVAL msr mair_el2, x0 From patchwork Mon Apr 22 16:49:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162613 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801456jan; Mon, 22 Apr 2019 09:51:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOG/hx34uYvZr8uOkxDlrj3k18OXyBAcAf4iCY6mNqeUFj57oFLVOn57d6ebDT/VRvi72n X-Received: by 2002:a25:48f:: with SMTP id 137mr17502293ybe.290.1555951884775; Mon, 22 Apr 2019 09:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951884; cv=none; d=google.com; s=arc-20160816; b=IGOfNXpRydY0GA3z7pjJmQ47ewPabTpnObGvFgfyTraHOPkbPV2BIEGZSXCdYrToXJ bpy7hA9BE/wPi/7CgoBAnFE/p0Z1d1qn+YhACrzynVpGWmplBrHztOaSVct3vqzMVYul 7VMoV2un2aJHZkM8xxpq72pR0FvXjRXwowz/uNf0weRBzyVk+Gg7T2jSvFWjuqwmxO8B l28+zmHtIir5VC6JF28I9KsIjJPdX85FmkE7JUsVbu0yhHzQGWbPhg03hVdUB8AjjAo0 Rtnj2nMQs1mIX8fDyF4JiOjMAi2eojKHNZK+USx6lZZECJ2LeDuNHq12JeRuq7QMrk8O FpUA== 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; bh=KaHjZyCvhH9J7T3HHpk5GlSUlkZpYQnr4d7E7oK1HCs=; b=xa/BBRJ4FfPNhHQs6/uloI1Ox5ChNUemUQIcRKT+zrKZ3LD4DqLa76IAhS/VzH7hAm q3N6PUliIKHcVUOhlDrhNsccPaAQ1f6FLnImzRoqGr6tTpW4cg4XLrWzUDdNiPEiJFC/ LwTdOuXqoqriJlkWMx5TzfU4+xNO0astvo3vI9H13HWz1sRBGAaUO8nLtVcq/xue8OqP jToVxpQtd3jMdoxKUOOWnk/epdEtuyULb6S1pKZ6L6yKQ4lTub0iG+ZwjrVANsdxPSrS DIb2oZ8iSP1XPdfmf3/wnRiZ3n2YjZ4L85O1VCv7OizuCnkGO8cjGj/RYlWnZ3djRFI3 Og2w== 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 123si8862123ywr.52.2019.04.22.09.51.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:24 -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 1hIc8r-0004mL-5N; Mon, 22 Apr 2019 16:50:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8p-0004fN-G3 for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:03 +0000 X-Inumbo-ID: ac1324f8-651e-11e9-af01-c34a14b1c1f1 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id ac1324f8-651e-11e9-af01-c34a14b1c1f1; Mon, 22 Apr 2019 16:50:02 +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 EC255374; Mon, 22 Apr 2019 09:50:01 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DCA383F557; Mon, 22 Apr 2019 09:50:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:25 +0100 Message-Id: <20190422164937.21350-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 08/20] xen/arm64: head: Move earlyprintk messages in .rodata.str 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" At the moment, the earlyprintk messages are interleaved with the instructions. This makes more difficult to read the objdump output. Introduce a new macro to add a string in .rodata.str and use it for all the earlyprintk messages. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- I haven't done a similar change in arm32 yet because the compiler will throw an error when using 'adr' when load an address from a different section (see A5-200 in ARM DDI 0406C.a for the technical reason). The change is likely to be more elaborate. --- xen/arch/arm/arm64/head.S | 14 +++++--------- xen/include/asm-arm/asm_defns.h | 5 +++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index ad446e7345..b957eb90fb 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -81,13 +81,10 @@ /* Macro to print a string to the UART, if there is one. * Clobbers x0-x3. */ #ifdef CONFIG_EARLY_PRINTK -#define PRINT(_s) \ - adr x0, 98f ; \ - bl puts ; \ - b 99f ; \ -98: .asciz _s ; \ - .align 2 ; \ -99: +#define PRINT(_s) \ + adr x0, 98f ; \ + bl puts ; \ + RODATA_STR(98, _s) #else /* CONFIG_EARLY_PRINTK */ #define PRINT(s) #endif /* !CONFIG_EARLY_PRINTK */ @@ -633,8 +630,7 @@ init_uart: #endif adr x0, 1f b puts -1: .asciz "- UART enabled -\r\n" - .align 4 +RODATA_STR(1, "- UART enabled -\r\n") /* Print early debug messages. * x0: Nul-terminated string to print. diff --git a/xen/include/asm-arm/asm_defns.h b/xen/include/asm-arm/asm_defns.h index 02be83e2b3..3f21def0ab 100644 --- a/xen/include/asm-arm/asm_defns.h +++ b/xen/include/asm-arm/asm_defns.h @@ -16,6 +16,11 @@ # error "unknown ARM variant" #endif +#define RODATA_STR(label, msg) \ +.pushsection .rodata.str, "aMS", %progbits, 1 ; \ +label: .asciz msg; \ +.popsection + #endif /* __ARM_ASM_DEFNS_H__ */ /* * Local variables: From patchwork Mon Apr 22 16:49:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162614 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801425jan; Mon, 22 Apr 2019 09:51:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiTqyrloVidmlzhPW+w2fEzhyUzideM6hdawCiEOKqMl1yzhLffn5XMewUcHATVqvXR061 X-Received: by 2002:a81:62c5:: with SMTP id w188mr16213530ywb.328.1555951883212; Mon, 22 Apr 2019 09:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951883; cv=none; d=google.com; s=arc-20160816; b=Diz8lkYdpRylYDk1WLN7WU4ydwYoUw/bu1fECfv1FlqaekX7SIxETDLvdg/TG/sIPe 8lGpyFYAf/REX3HkpzxAanZEpcmtn7v+YBiFAo0wB6709k3iP2A6rg4CIgbHGe+KGSzf iTsh8C5g1AkDpUfX5TLtObejQJ1LOP45PAS+IEk5Fs9U1JqlOe7sd2YK21C5PMZ7G/5t h9A48SN6rAxXi1Ys3QuHhURc9Iyjfe8nEpqb/gj/RKGOrykSzpkuclEy3mwI3wY51td8 HLCPpHUTbdqzREf0D9nWLVcOmLKWcKAQ/LclsQWLosP0z5o5Rc/w+QDswIekJMN5KZL8 8xmQ== 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; bh=G1r+Hl1PQSSb1OK2ietNjKme1goxhhtJivpZcD0sWCw=; b=ptP7so2CEVvBGNbnO/lkw75rN2XjpiDTNjWnIHurEutNo/+3i6gPBoWpKzSQ8lTpBl mjmFez+n0nDoDRAMzwJXlL09455Vnz2YCg2ECqg5OJ306byRRmWJn11TqBBjXGsUyEpv 7ORHQa1fAKIl+yxDQ0sDwOhw5VVycLVbuRO2xYbTNV6+r1piBIDitKUxZkYjLb7bbqXl htcFUn9pcKtA02SQv60cY3Cot/9x/RGBDEDQgYoIaiRnhqwaLsNEGGB7Rm4tQaax6i5r +HTE21BWiEM+uuAno6BVTwjgsaljSXDkgpFuO1ZyARKoOXCHUWJCgUtwUZeSesgMzUcW l2OA== 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 q3si10189917ybo.63.2019.04.22.09.51.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:23 -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 1hIc8r-0004oM-Fw; Mon, 22 Apr 2019 16:50:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8q-0004il-Nn for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:04 +0000 X-Inumbo-ID: accf1e7e-651e-11e9-8c13-179d71b0fcb1 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id accf1e7e-651e-11e9-8c13-179d71b0fcb1; Mon, 22 Apr 2019 16:50:03 +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 4583B15AB; Mon, 22 Apr 2019 09:50:03 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 35D443F557; Mon, 22 Apr 2019 09:50:02 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:26 +0100 Message-Id: <20190422164937.21350-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 09/20] xen/arm64: head: Correctly report the HW CPU ID 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" There are no reason to consider the HW CPU ID will be 0 when the processor is part of a uniprocessor system. At best, this will result to conflicting output as the rest of Xen use the value directly read from MPIDR_EL1. So remove the zeroing and logic to check if the CPU is part of a uniprocessor system. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm64/head.S | 6 ------ 1 file changed, 6 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index b957eb90fb..08094a273e 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -277,15 +277,9 @@ GLOBAL(init_secondary) mov x26, #1 /* X26 := skip_zero_bss */ common_start: - mov x24, #0 /* x24 := CPU ID. Initialy zero until we - * find that multiprocessor extensions are - * present and the system is SMP */ mrs x0, mpidr_el1 - tbnz x0, _MPIDR_UP, 1f /* Uniprocessor system? */ - ldr x13, =(~MPIDR_HWID_MASK) bic x24, x0, x13 /* Mask out flags to get CPU ID */ -1: /* Non-boot CPUs wait here until __cpu_up is ready for them */ cbz x22, 1f From patchwork Mon Apr 22 16:49:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162615 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801485jan; Mon, 22 Apr 2019 09:51:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0GEKGAk7VEctFUdPGnY1Uuqw08nfW7VDL3sCPG4RAS7F3UDp4joNlpF99YPOiDndD4oV+ X-Received: by 2002:a25:5b41:: with SMTP id p62mr17207895ybb.322.1555951887047; Mon, 22 Apr 2019 09:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951887; cv=none; d=google.com; s=arc-20160816; b=yWwqXVdhDNJ5gHE0t/AEmFC0g7DeZAcyc+KTFm3+yKEcRu3u8L/gJNIuO7sE3OoiIB zBADSvuFSJOH/c5x/KQlo2yyiVRkxIcoa8a+LKcNd4/ge06PSorLH4QONj+++4BBtZ6R 0+i3r7UHcVV/vKQIK5jJ0ryGea0915+E7IMHkzAKpX4tVMIrMC4c7gt0SMlxs6BHAJW/ ZteRd91eDv78vLt23iYCcRkVvn7+QyGV4aPZ95u3jnFOxTW/i9FaYwUwPNPmP0Ee4JWP 55LNGn0/bHTxmz1e2MY847vRYltlA53zUjtVwNfSQcUaQkJhgr6XopnpMt3ZnNLgUqiB R/Bw== 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; bh=tll2TEOPgJsZGJ6yWYRZaeaITHeWVNRp9XBqtywrWQM=; b=MNRIBkiTluIMP8maQ2QeV2cCt0aD1NFe4JJ1jD3YglvIIuDFRxOhHKqBh3vRf2vOn2 fcADN6FUsjdMplHNozgCiowFkwXCSazu94ia3tTE5qP7v8dF9EcaH6ibE3GeRTLz3Pjh sw+M1z3tLvkCc2kpvS4WZb/+xaBNpZrg/Sn2/N6KpOUmZPojuzqLaOWELTcncxaojEPu 8JGCBed9vi/dWmBcN0Oed2e9HttW6ThfEJ9WdTcpDUI/sjhxve9oc7OoDLC2h32nNZ5m f8gPzm7/4cT/WdOQbPC8blAucMdD8OJ4U1NUdnfd8BZ0xQjjKaocuwGlVD3RGvWa+n5s vxWg== 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 190si6787982ybt.125.2019.04.22.09.51.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:27 -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 1hIc8s-0004wZ-Uw; Mon, 22 Apr 2019 16:50:06 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8r-0004pv-V7 for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:05 +0000 X-Inumbo-ID: ad9151e3-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id ad9151e3-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:04 +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 93589374; Mon, 22 Apr 2019 09:50:04 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 835A63F557; Mon, 22 Apr 2019 09:50:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:27 +0100 Message-Id: <20190422164937.21350-11-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 10/20] xen/arm32: head: Correctly report the HW CPU ID 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" There are no reason to consider the HW CPU ID will be 0 when the processor is part of a uniprocessor system. At best, this will result to conflicting output as the rest of Xen use the value directly read from MPIDR. So remove the zeroing and logic to check if the CPU is part of a uniprocessor system. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm32/head.S | 8 -------- 1 file changed, 8 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 9f40face98..d42a13556c 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -124,16 +124,8 @@ GLOBAL(init_secondary) mov r12, #1 /* r12 := is_secondary_cpu */ common_start: - mov r7, #0 /* r7 := CPU ID. Initialy zero until we - * find that multiprocessor extensions are - * present and the system is SMP */ mrc CP32(r1, MPIDR) - tst r1, #MPIDR_SMP /* Multiprocessor extension supported? */ - beq 1f - tst r1, #MPIDR_UP /* Uniprocessor system? */ - bne 1f bic r7, r1, #(~MPIDR_HWID_MASK) /* Mask out flags to get CPU ID */ -1: /* Non-boot CPUs wait here until __cpu_up is ready for them */ teq r12, #0 From patchwork Mon Apr 22 16:49:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162618 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801534jan; Mon, 22 Apr 2019 09:51:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKVMCO7RO36v6di8OtVldMwkDPwa/jD0MmOht3O4usV+1mUVcCsQ16Jqon/9H3KrqIFeX/ X-Received: by 2002:a25:408a:: with SMTP id n132mr16655852yba.8.1555951889932; Mon, 22 Apr 2019 09:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951889; cv=none; d=google.com; s=arc-20160816; b=eH7RyT5rotZdvFqszhuIAcm82bf46EqpY6BCrQzkEki1w1j2qxc++FNtKJfwOkRHB3 vcAeWIpis34p15s/oFBFo19Ly02909GRzwDrCq14esOPS0PMHvoUiCmfrxrXp4FMRSxP 7FF7xde8HJWPoKqM05WVFhgxAyCjODtPK29aYmxjLeWxFKbNuosNzxVdPxQWgO2NyE7x LG0SLrz0TmYgv2msAWCE3JQ2O8f1vbj2e89njkWFdBNd0YWQlV/DiNjw/g7VaSG/8qcW pQnrTvCUWEr0wdZbvbS0eOLwpEnZF6gOjmuqWbyND0bmrEmfExqjMTfG/hcSVva8+V2d siAA== 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; bh=A5tzEkz/61XFdLDwLbhKjH7kl6CkPjevUJLBF/NZ9GY=; b=vwanKO1DKQiipOFB4KjCqOi0VGDPdankZuC3CCCgt7NNwWRVQrrmy3oZ2nVoh7y7xO P5JFpimFrmqUJghxO4Mo/9KQsSyKH1y4waThNlBlPzN/SjJ4KsRqBwPOPqohgXy7Eh6b Af5k+Dt2vUSyDosiE69PGKUvXm4TkqYW7Nz3qEgoFIWqtmq3NXWXV83mxeW1DIZX9x/p YEnLBShtKz/keJxnwBhaaXOu5H1jdJdnI55CwU+PEkUsyz7KqxuGdsdEF+c12z1uyzH3 Syu9hXx+sFWeH1izEHJ1SP/C/X06PXaKQnzlUQc+WtavpJvo5qlwAxIN1Q5Emj6flpC2 SvqQ== 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 5si8929914yba.107.2019.04.22.09.51.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:29 -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 1hIc8v-000585-AA; Mon, 22 Apr 2019 16:50:09 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8t-0004xh-7J for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:07 +0000 X-Inumbo-ID: ae5a5d71-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id ae5a5d71-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:06 +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 E1096EBD; Mon, 22 Apr 2019 09:50:05 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D153C3F557; Mon, 22 Apr 2019 09:50:04 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:28 +0100 Message-Id: <20190422164937.21350-12-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 11/20] xen/arm32: head: Don't set MAIR0 and MAIR1 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The co-processor registers MAIR0 and MAIR1 are managed by EL1. So there are no need to initialize them during Xen boot. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm32/head.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index d42a13556c..3448817aab 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -212,8 +212,6 @@ cpu_init_done: /* Set up memory attribute type tables */ ldr r0, =MAIR0VAL ldr r1, =MAIR1VAL - mcr CP32(r0, MAIR0) - mcr CP32(r1, MAIR1) mcr CP32(r0, HMAIR0) mcr CP32(r1, HMAIR1) From patchwork Mon Apr 22 16:49:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162616 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801497jan; Mon, 22 Apr 2019 09:51:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw89NyUaGikpsgXu2E7D7Y2OxCGvuwEmQ/CD1mDL06El0RuBvlAz/IBtTfF5buuLt0UaFlc X-Received: by 2002:a25:e7d6:: with SMTP id e205mr16326384ybh.161.1555951888041; Mon, 22 Apr 2019 09:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951888; cv=none; d=google.com; s=arc-20160816; b=NN/R1GGqZglH51UFicszstrvE4Y3e4lHuuEWNt9R2b3H54jFZEZ8xx0S2Jo8X7qbVm a1JckBJjcZv9E8GwzMaP1mUZzhiPMb1RpJe/29ovFur053SesHVKTO/ed+OuErG+u8nI xUyWp5n2VZOwR+3s+rp9sDlumgSG4vGTKxKx4ItzDMv4WBzlTBWn53FwbQ0LHfXjNczS 7CegwfgbU0+JZM7P8cje1+yUWBEdNlPtLn8xp+Lh9YJ3/o5tquhCaX/xnLRyfAuJsq/O hVwP4eqKn+MsQokaaZIDAC2bkhVOWPJZICpzooowsvMbMREEzZlTKeU+roYBqvuNY3Lg febA== 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; bh=aHvZNhSyeR4Zg0OxcnJG/kd/zPUcdjkvKqY1dJkr9o4=; b=U6HTkq0MXunkgSS3mM1BOln2t14UJpOnFjDMsqCMtQnmbLuzmohBKEP0QdAoo0mgtg VkI84NP7tCRRwp6QreIV1uEd9cuVrbm9atM09ULsHcYt/WBbv1FHNs+X22IeznzuQQb0 Z62slpIj+KRNvyjxUf4UWO41n4NLNKgcbFX8XeusK4O6sksoTF3U6QhIY3cNerEZp07q ILnATeAexMLQjwTVO3jQ7sKBoZfT4rBLQ37oY4qX1eEe1wxJ4s0AlQr0j6bE/sigx350 7wWctiDexPYNa0cQSN3+hHbGXqbEQo8vIiJGh/11pNCIuj9F3xHBtcrqjfsZL1Ryake4 pNDg== 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 c187si8994236ybb.370.2019.04.22.09.51.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:28 -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 1hIc8v-00058o-O4; Mon, 22 Apr 2019 16:50:09 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8u-00054g-FK for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:08 +0000 X-Inumbo-ID: af2501c1-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id af2501c1-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:07 +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 3A0B615AB; Mon, 22 Apr 2019 09:50:07 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A9B43F557; Mon, 22 Apr 2019 09:50:06 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:29 +0100 Message-Id: <20190422164937.21350-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 12/20] xen/arm32: head: Always zero r3 before update a page-table entry 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The boot code is using r2 and r3 to hold the page-table entry value. While r2 is always updated before storing the value, this is not always the case for r3. Thankfully today, r3 will always be zero when we care. But this is difficult to track and error-prone. So always zero r3 within the few instructions before the write the page-table entry. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm32/head.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 3448817aab..0536b62aec 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -270,6 +270,7 @@ cpu_init_done: orr r2, r2, #PT_UPPER(MEM) /* r2:r3 := section map */ orr r2, r2, #PT_LOWER(MEM) lsl r1, r1, #3 /* r1 := Slot offset */ + mov r3, #0x0 strd r2, r3, [r4, r1] /* Mapping of paddr(start) */ mov r6, #1 /* r6 := identity map now in place */ @@ -377,6 +378,7 @@ paging: lsl r2, r2, #THIRD_SHIFT /* 4K aligned paddr of UART */ orr r2, r2, #PT_UPPER(DEV_L3) orr r2, r2, #PT_LOWER(DEV_L3) /* r2:r3 := 4K dev map including UART */ + mov r3, #0 strd r2, r3, [r1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ 1: @@ -388,6 +390,7 @@ paging: orr r2, r2, #PT_LOWER(PT) /* r2:r3 := table map of xen_fixmap */ ldr r4, =FIXMAP_ADDR(0) mov r4, r4, lsr #(SECOND_SHIFT - 3) /* r4 := Slot for FIXMAP(0) */ + mov r3, #0 strd r2, r3, [r1, r4] /* Map it in the fixmap's slot */ /* Use a virtual address to access the UART. */ From patchwork Mon Apr 22 16:49:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162617 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801521jan; Mon, 22 Apr 2019 09:51:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNDtWnT46JyY78VLQswKMvBBKSw8jDDdo0M6HifVjSWUTwax3NEjQ3gr5/GSPBvawsiirB X-Received: by 2002:a25:eb03:: with SMTP id d3mr17837169ybs.319.1555951889275; Mon, 22 Apr 2019 09:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951889; cv=none; d=google.com; s=arc-20160816; b=goJQrOoRAUemyx04ffA/4IsLl1Gyjy0uQxhz5lZ312AJyccOYFeKPDvibS9EEmPBai 3sL9AwrqniDlAcnMyPfSWcXjOABI8zFWYoZzmrYR5ymz6rUcAUTsgbfCTh/njRYWdDnR nrQ8N71llDqKefCDrfaxAvok5XuPLrQHoSYTDKDxJniM/pjudoqs/mv/JrKdFVRkeTCD sPlUHaPfq5Q2VRk+yEorFgRJCwFVLqkldZs+Z/6miJ55FCIXFb4GMY5hYP/F2KM8z1P0 JACz5zEz/BPywZnLvXJVGenl+2L20BA7GH/2XbK3TKUXtdtAcwVFbFJurECDS16aqXhx IZpQ== 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; bh=EhjX9lxpMElXJhmiX7QtbMgj9GjsxjVH63DRKI1EMzY=; b=h1CVf+ucMXGvCZbjeamZEUyUr7qfepuhGkE7vKlKHI5OErnywD4eQLAQJEen06s/Q4 tPxAySYZIEvn87b3bwt4OTfHFp7yZ4rikvQ7cPc0F3cby5jb7s0WZfkuUjC82Kyz+J7r /B3R4oL/DtkOc9FyAaatEBgz5lGU8vNhlLidOqqj4S75GuEcbLck5M3/RMJT5WufkGaK wldjGFPqAXAYmkXDQBgC8D/b1/iWTkr9qPXyizwmssUTrBf76FKUzUcW89Cfq+MtShTh K68oZhpH12orFgHrok9RPrlwBYTRB7dN/xzmFq42pCpHrZftpJlZ+We3it75GTS/5o4q AyKw== 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 q130si10603057ybg.4.2019.04.22.09.51.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:29 -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 1hIc8x-0005E4-6Q; Mon, 22 Apr 2019 16:50:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8v-000591-VL for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:09 +0000 X-Inumbo-ID: b0009bfe-651e-11e9-8219-37847f238d1e Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id b0009bfe-651e-11e9-8219-37847f238d1e; Mon, 22 Apr 2019 16:50:08 +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 875D7374; Mon, 22 Apr 2019 09:50:08 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 77F3E3F557; Mon, 22 Apr 2019 09:50:07 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:30 +0100 Message-Id: <20190422164937.21350-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 13/20] xen/arm32: mm: Avoid to zero and clean cache for CPU0 domheap 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The page-table walker is configured to use the same shareability and cacheability as the access performed when updating the page-tables. This means cleaning the cache for CPU0 domheap is unnecessary. Furthermore, CPU0 page-tables are part of Xen binary and will already be zeroed beforehand. So it is pointless to zero the domheap again. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/mm.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index e090afb976..cda2847d00 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -724,11 +724,6 @@ void __init setup_pagetables(unsigned long boot_phys_offset) #ifdef CONFIG_ARM_32 per_cpu(xen_pgtable, 0) = cpu0_pgtable; per_cpu(xen_dommap, 0) = cpu0_dommap; - - /* Make sure it is clear */ - memset(this_cpu(xen_dommap), 0, DOMHEAP_SECOND_PAGES*PAGE_SIZE); - clean_dcache_va_range(this_cpu(xen_dommap), - DOMHEAP_SECOND_PAGES*PAGE_SIZE); #endif } From patchwork Mon Apr 22 16:49:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162600 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801129jan; Mon, 22 Apr 2019 09:51:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbkH3NQw7ZQkxEPVrCDWJAdiJ+GceUdFFj2HC2RCjYX8DVYeebEQbjkiVdmqZ1Xh41RT1G X-Received: by 2002:a25:504e:: with SMTP id e75mr16930178ybb.68.1555951864557; Mon, 22 Apr 2019 09:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951864; cv=none; d=google.com; s=arc-20160816; b=IlhaBsIgDrtI8TMvuTKEmfth/r+qhncH/MRPfZAm/gOAY/tHkld8nmkbULe9c3x3iI ebWhvSB3vfSdE40dJT3QVafikiJfjbx+7wcIvXCKk5twpOJ4kQlkgGmtmD4rxTi02IfT eTJtq5zp2kj7CMbjlCi33HS7H7zPxoAgx4APpEzWdCWfW4XWlRlON56+rmNoBJCNCsPP Kqw6jb9duZqJAGzIRTEObvPwQy4k9HmgLeHbNIOaXhPsOUKBA1vCWpFUqv/IUb3ByQUs pBf9Yn8QLowNM3tC2nIIm6PVYN5W+AaMDAp07anJCVDRLMPYDLtHH6DmvOzHCoVq93Uu k6XA== 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; bh=FEkkaDDNrJGNXfeDzdRVAcaHkA1Z+mgHn0hHpMXphYY=; b=XQ9V5AXcfhB5eVm9rQ9Fjgi0zyLI8DTaJ/NvRXWNLgOiMdtXUK9uOV6SCT4EGftG1h D3X8dP6MSMV7jABp7Y1EQwr45VakjL15n6rOUaPk/pZqSNBvm0dOCAF+yxNSz0r0PIb/ /6CFmTzG/uO7lB2QAh1RnR4pRUDaeGXkbkLucGkibsb1shssg4ebXoVaMwQDjclRrqRg 10JmyxAOzCu3eReWxtVwj6EBR4pa5K/YCFmJPw9R2dayd+lBtzV04etNR9bldR/urDRW Xj3B14nV4ER2aPN7kZX1fP2290b2b+CXBtd9cZWzDU7qNFKBArm8MpOW7DK/UMyWtAkO 0RGw== 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 w194si6367292ywa.209.2019.04.22.09.51.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:04 -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 1hIc8y-0005H6-Uu; Mon, 22 Apr 2019 16:50:12 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8x-0005EB-Cg for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:11 +0000 X-Inumbo-ID: b0be0597-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id b0be0597-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:10 +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 D4A7DEBD; Mon, 22 Apr 2019 09:50:09 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C51F43F557; Mon, 22 Apr 2019 09:50:08 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:31 +0100 Message-Id: <20190422164937.21350-15-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 14/20] xen/arm32: mm: Avoid cleaning the cache for secondary CPUs page-tables 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The page-table walker is configured to use the same shareability and cacheability as the access performed when updating the page-tables. This means cleaning the cache for secondary CPUs runtime page-tables is unnecessary. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/mm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index cda2847d00..6db7dda0da 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -769,9 +769,6 @@ int init_secondary_pagetables(int cpu) write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte); } - clean_dcache_va_range(first, PAGE_SIZE); - clean_dcache_va_range(domheap, DOMHEAP_SECOND_PAGES*PAGE_SIZE); - per_cpu(xen_pgtable, cpu) = first; per_cpu(xen_dommap, cpu) = domheap; From patchwork Mon Apr 22 16:49:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162619 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801627jan; Mon, 22 Apr 2019 09:51:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9I5NrriWMgF/RlvdLffzgbJoF8SaVqq3h/CM2Y0GJhnu/gRc63TjAlZYlCDXbExoifm5n X-Received: by 2002:a0d:dbd7:: with SMTP id d206mr17401104ywe.332.1555951895818; Mon, 22 Apr 2019 09:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951895; cv=none; d=google.com; s=arc-20160816; b=pT+8Lhdd/ey7VvloE3UXKrT9qFVP57RNrUhlFCNsqSs7gg0wOpx8+qC5xHU/vo5wzl m8QdGceOJPsxLsQwFaM0TAQ+UjBcOQKDpAQUuwDnpnPl+Bx8thXoYeIslJFLBkTMOKBe ZwC8R8eux1oVVnXWJvbE6LyqanW/jRdSMScUenU9QmFGb/EQ9uxwN+OtBm/WC4V9hlXy P7zZivQKj8VoqqhcJwgjTHv3awBH8WJV9ddh0+B5kvZGSRcgEgA4UzTSps5lv9fffhm+ bFxWede+bLNeUWj9S5N7CndSj6DpoVM69Q2SQugd4h1ZEST1wwMcvjDNCc5VmNJvQMnF 6eYw== 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; bh=il4ZcLt2h9cI6G0bYMe1TL1OCibLiwKyT++mhks/O6U=; b=UQLFOJYnSUEAl7OuRQONCRdksOF5zZjzMFPzNmKBHf9W1Q8aws34oVpWpggZOc7/Hu JIayHH3cA739ssvOuO+6XuArMC6cQ0sSWBME4hzmWrf6JqsjIbEX4AMPAsUR5KxHPbx3 nrgKCsJncSMJXCc4/pudfQy6kYMBAWuBYnAxUxhdYzp5W5RFS6k9tizrzHRljkSfSW9L Hbw2o2jc/NHePsrastG299NARi5cqLc6GRbdy3rFVU4lG2K0N7TkZZSCKMhMbWDqSMzF ZnjPmwON3lxs4Hy3cgCDyd1nLiCZWFk3iIhWrCQWK3U8eyRc6lVh2xDenkbJZr4Jajtg d1tw== 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 j190si6371098ywd.431.2019.04.22.09.51.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:35 -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 1hIc90-0005Ja-Dh; Mon, 22 Apr 2019 16:50:14 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8y-0005GP-Je for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:12 +0000 X-Inumbo-ID: b1836d79-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id b1836d79-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:11 +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 2DBDA15AB; Mon, 22 Apr 2019 09:50:11 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E5F23F557; Mon, 22 Apr 2019 09:50:09 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:32 +0100 Message-Id: <20190422164937.21350-16-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 15/20] xen/arm: mm: Use the shorter version __aligned(PAGE_SIZE) to align page-tables 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" We currently use the very long version __attribute__((__aligned(4096))) to align page-tables. Thankfully there is a shorter version to make the code more readable. While modifying the attribute: 1) Move it before the variable name as we do in other part of Xen 2) Switch to PAGE_SIZE instead of 4096 to make more future-proof 3) Mark static page-tables not used outside the file (i.e any page-tables other than boot_* and xen_fixmap). Lastly, some of the variables use __attribute__(__aligned(X * 4096)). However this is not necessary as page-tables are only required to be to be aligned to a page-size. So use __aligned(PAGE_SIZE). Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/mm.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 6db7dda0da..fa0f41bd07 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -73,13 +73,13 @@ struct domain *dom_xen, *dom_io, *dom_cow; * Finally, if EARLY_PRINTK is enabled then xen_fixmap will be mapped * by the CPU once it has moved off the 1:1 mapping. */ -lpae_t boot_pgtable[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +lpae_t __aligned(PAGE_SIZE) boot_pgtable[LPAE_ENTRIES]; #ifdef CONFIG_ARM_64 -lpae_t boot_first[LPAE_ENTRIES] __attribute__((__aligned__(4096))); -lpae_t boot_first_id[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +lpae_t __aligned(PAGE_SIZE) boot_first[LPAE_ENTRIES]; +lpae_t __aligned(PAGE_SIZE) boot_first_id[LPAE_ENTRIES]; #endif -lpae_t boot_second[LPAE_ENTRIES] __attribute__((__aligned__(4096))); -lpae_t boot_third[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +lpae_t __aligned(PAGE_SIZE) boot_second[LPAE_ENTRIES]; +lpae_t __aligned(PAGE_SIZE) boot_third[LPAE_ENTRIES]; /* Main runtime page tables */ @@ -93,8 +93,8 @@ lpae_t boot_third[LPAE_ENTRIES] __attribute__((__aligned__(4096))); #ifdef CONFIG_ARM_64 #define HYP_PT_ROOT_LEVEL 0 -lpae_t xen_pgtable[LPAE_ENTRIES] __attribute__((__aligned__(4096))); -lpae_t xen_first[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +static lpae_t __aligned(PAGE_SIZE) xen_pgtable[LPAE_ENTRIES]; +static lpae_t __aligned(PAGE_SIZE) xen_first[LPAE_ENTRIES]; #define THIS_CPU_PGTABLE xen_pgtable #else #define HYP_PT_ROOT_LEVEL 1 @@ -107,17 +107,16 @@ static DEFINE_PER_CPU(lpae_t *, xen_pgtable); * DOMHEAP_VIRT_START...DOMHEAP_VIRT_END in 2MB chunks. */ static DEFINE_PER_CPU(lpae_t *, xen_dommap); /* Root of the trie for cpu0, other CPU's PTs are dynamically allocated */ -lpae_t cpu0_pgtable[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +static lpae_t __aligned(PAGE_SIZE) cpu0_pgtable[LPAE_ENTRIES]; /* cpu0's domheap page tables */ -lpae_t cpu0_dommap[LPAE_ENTRIES*DOMHEAP_SECOND_PAGES] - __attribute__((__aligned__(4096*DOMHEAP_SECOND_PAGES))); +static lpae_t __aligned(PAGE_SIZE) cpu0_dommap[LPAE_ENTRIES*DOMHEAP_SECOND_PAGES]; #endif #ifdef CONFIG_ARM_64 /* The first page of the first level mapping of the xenheap. The * subsequent xenheap first level pages are dynamically allocated, but * we need this one to bootstrap ourselves. */ -lpae_t xenheap_first_first[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +static lpae_t __aligned(PAGE_SIZE) xenheap_first_first[LPAE_ENTRIES]; /* The zeroeth level slot which uses xenheap_first_first. Used because * setup_xenheap_mappings otherwise relies on mfn_to_virt which isn't * valid for a non-xenheap mapping. */ @@ -131,12 +130,12 @@ static __initdata int xenheap_first_first_slot = -1; * addresses from 0 to 0x7fffffff. Offsets into it are calculated * with second_linear_offset(), not second_table_offset(). */ -lpae_t xen_second[LPAE_ENTRIES*2] __attribute__((__aligned__(4096*2))); +static lpae_t __aligned(PAGE_SIZE) xen_second[LPAE_ENTRIES*2]; /* First level page table used for fixmap */ -lpae_t xen_fixmap[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +lpae_t __aligned(PAGE_SIZE) xen_fixmap[LPAE_ENTRIES]; /* First level page table used to map Xen itself with the XN bit set * as appropriate. */ -static lpae_t xen_xenmap[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +static lpae_t __aligned(PAGE_SIZE) xen_xenmap[LPAE_ENTRIES]; /* Non-boot CPUs use this to find the correct pagetables. */ uint64_t init_ttbr; From patchwork Mon Apr 22 16:49:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162599 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801128jan; Mon, 22 Apr 2019 09:51:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxF0Igtp1s08qBr8AFKwKyeU0Gzr4sHM3LqHiNsrZDEWj9nnwM4ysCucnFML6Y5dkRF8Xk3 X-Received: by 2002:a25:7344:: with SMTP id o65mr17091820ybc.324.1555951864610; Mon, 22 Apr 2019 09:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951864; cv=none; d=google.com; s=arc-20160816; b=q5Tpotl1CRt9QO/V5BDkzKRaOpweEJJO2hbJe6TupoTWk/BTdrIi0IdT7uslk7J32R bnUhAA0nYstjWKrqHoI2UgElMYu4rnLCGl6/QQ8gTxNbbph+jelv/TfuN/rRvc16cgBZ /+vbRKm+cT7WXuSrXu+MHXDAkFPE5GJ7w4o9qoYcKcaaXsTjxecDEibV9Qat/dsufnv6 GST6aQ95FvEAIvUGHJ5xZ0QMvCwBYeJxmd/neOdn2AjjLOV5JAFkrzkDQj0fTa2jP0R4 EjhfLrjz+GgWV262IK7vh2lDDgPera4w3rXQA8sS2m+G75BMl16zgzzT9x4kSTDUnBY7 InSw== 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; bh=vkbWm5L4hkPeh6lhhbiKjUlgqmRpXhzR5r7St2GVTNQ=; b=nNDOk+fgLRZE+HoZOt7G1aMfwXsXIylt6ce5SfIY7lgeEjNQx/2PGR6M+5GuXBYW9V dIc/nx9FB7eWSXL2WDLHwwj3Z9cUBjgxuVAPJvgjyHd2acv7Zowx6lYZApqtKhgxvk36 1MQVODILPrTSc4+3uqO6g5rCNtXT2OxtP0dk+5oSz0lzxhlmCFukL0Y4BjR5Sva8YmVh Qe/buoC+KlVjMCBmDQHvaEq8FzJipbEgwz/N6DgREa4yrOWo9qqp6tPaHnBUdrERajn6 Di/Lvtp0OzByawtS4qBprkzW98s2I6l8FBqVjevF2mVu7Y91NA9DOiYEQYYB3U7HaGDY 2w2Q== 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 k8si9121262ywb.11.2019.04.22.09.51.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:04 -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 1hIc91-0005Kr-0n; Mon, 22 Apr 2019 16:50:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8z-0005Ie-Sj for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:13 +0000 X-Inumbo-ID: b24e7016-651e-11e9-8ecb-6bad741746e0 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id b24e7016-651e-11e9-8ecb-6bad741746e0; Mon, 22 Apr 2019 16:50:12 +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 7B674374; Mon, 22 Apr 2019 09:50:12 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6BCE13F557; Mon, 22 Apr 2019 09:50:11 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:33 +0100 Message-Id: <20190422164937.21350-17-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 16/20] xen/arm: mm: Protect Xen page-table update with a spinlock 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The function create_xen_entries may be concurrently called. So we need to protect with a spinlock to avoid corruption the page-tables. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/mm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index fa0f41bd07..ecde4e34df 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -969,6 +969,8 @@ enum xenmap_operation { RESERVE }; +static DEFINE_SPINLOCK(xen_pt_lock); + static int create_xen_entries(enum xenmap_operation op, unsigned long virt, mfn_t mfn, @@ -980,6 +982,8 @@ static int create_xen_entries(enum xenmap_operation op, lpae_t pte, *entry; lpae_t *third = NULL; + spin_lock(&xen_pt_lock); + for(; addr < addr_end; addr += PAGE_SIZE, mfn = mfn_add(mfn, 1)) { entry = &xen_second[second_linear_offset(addr)]; @@ -1054,6 +1058,8 @@ out: */ flush_xen_tlb_range_va(virt, PAGE_SIZE * nr_mfns); + spin_unlock(&xen_pt_lock); + return rc; } From patchwork Mon Apr 22 16:49:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162602 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801159jan; Mon, 22 Apr 2019 09:51:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqypx/9RolTpjQdvpDLYpMEZxJyuagRhAbTgFt7XSdiANZgVkJ3tt++gBNGdUNT52Xg4xLlT X-Received: by 2002:a81:378a:: with SMTP id e132mr16335188ywa.137.1555951866889; Mon, 22 Apr 2019 09:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951866; cv=none; d=google.com; s=arc-20160816; b=LrcLI+oEME2CAbntMrR+SgEmM+pdWqvB1KkN6a2XOlmSgqrSmSDnvI+NdGCj5Y7Wug jJY2/9HvYA6CkdVGRt3GD25Cf7Bc0/fSTNCmzM5IXu0jrXlEFcVRgqB84DKOk+x59cqP lRZmYP+gyFT+Yu0zL6czgvelFBcX3HaYLo7YU+s9tkf0Vi1F3cFO65jGTPfX5hweFuMW hUj9Q/e7+EGiD6EN+G3/p1tcJR5RBSGddxNRe2jUnFfTBmYyLbn8+wur9umQCXHGx/ne qNASPLRQFS1IVeeFvJb/dqSUqCayl9l3F52z6LndrNoG8yAJHaitXdVNZLLyHqnEvt7n esOg== 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; bh=rylKIrqsmmwYqcWzDXVKtxkqacZVek60Bbn77HQ64eM=; b=IBqsoYXvtCud0Hf1w6gPQllxS+N/bWqI1GYU4UkDUAREV0ISFNUSlSjDiOP3t0GViN ilWVpqdApGi2FtWX9Higd+M+CklpYlly3wNL8pYIAmdgUVCQPqh8JRvFZz1KXloFd9Jg 07RPymt97UZyue3d9UAC1AUJTqYSIfmsX89lEo1NxeiH5zQKUt8i1kWFENCG6YHuJ6Pl ZYjK87bJsfUXPsxrrHhK863UpMzIMVt++MkNopB5apnbA8ZVsmPlUxaxSMJMwyZIdmTo +Vg+srwECamcPDQdGHwRn5+JYyx2VxbWbzYuhPYk8q+AeTEY/DQ9Dy98B8CT3mYrLAri 39vg== 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 b3si1011127ywf.100.2019.04.22.09.51.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:06 -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 1hIc92-0005NO-FM; Mon, 22 Apr 2019 16:50:16 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc90-0005KN-Pt for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:14 +0000 X-Inumbo-ID: b3115267-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id b3115267-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:14 +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 C9312EBD; Mon, 22 Apr 2019 09:50:13 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B94403F557; Mon, 22 Apr 2019 09:50:12 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:34 +0100 Message-Id: <20190422164937.21350-18-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 17/20] xen/arm: mm: Initialize page-tables earlier 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Since commit f60658c6ae "xen/arm: Stop relocating Xen", the function setup_page_tables() does not require any information from the FDT. So the initialization of the page-tables can be done much earlier in the boot process. The earliest setup_page_tables() can be called is after traps have been initialized, so we can get backtrace if an error occurred. Moving the initialization of the page-tables also avoid the dance to map the FDT again in the new set of page-tables. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/mm.c | 12 +++--------- xen/arch/arm/setup.c | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index ecde4e34df..ee541a38e3 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -545,7 +545,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va) return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL); } -/* Map the FDT in the early boot page table */ +/* Map the FDT in the runtime page table */ void * __init early_fdt_map(paddr_t fdt_paddr) { /* We are using 2MB superpage for mapping the FDT */ @@ -568,7 +568,7 @@ void * __init early_fdt_map(paddr_t fdt_paddr) /* The FDT is mapped using 2MB superpage */ BUILD_BUG_ON(BOOT_FDT_VIRT_START % SZ_2M); - create_mappings(boot_second, BOOT_FDT_VIRT_START, paddr_to_pfn(base_paddr), + create_mappings(xen_second, BOOT_FDT_VIRT_START, paddr_to_pfn(base_paddr), SZ_2M >> PAGE_SHIFT, SZ_2M); offset = fdt_paddr % SECOND_SIZE; @@ -583,7 +583,7 @@ void * __init early_fdt_map(paddr_t fdt_paddr) if ( (offset + size) > SZ_2M ) { - create_mappings(boot_second, BOOT_FDT_VIRT_START + SZ_2M, + create_mappings(xen_second, BOOT_FDT_VIRT_START + SZ_2M, paddr_to_pfn(base_paddr + SZ_2M), SZ_2M >> PAGE_SHIFT, SZ_2M); } @@ -694,12 +694,6 @@ void __init setup_pagetables(unsigned long boot_phys_offset) pte.pt.table = 1; xen_second[second_table_offset(FIXMAP_ADDR(0))] = pte; - /* ... DTB */ - pte = boot_second[second_table_offset(BOOT_FDT_VIRT_START)]; - xen_second[second_table_offset(BOOT_FDT_VIRT_START)] = pte; - pte = boot_second[second_table_offset(BOOT_FDT_VIRT_START + SZ_2M)]; - xen_second[second_table_offset(BOOT_FDT_VIRT_START + SZ_2M)] = pte; - #ifdef CONFIG_ARM_64 ttbr = (uintptr_t) xen_pgtable + phys_offset; #else diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 6dfbba2927..f7a399ce89 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -754,6 +754,8 @@ void __init start_xen(unsigned long boot_phys_offset, /* Initialize traps early allow us to get backtrace when an error occurred */ init_traps(); + setup_pagetables(boot_phys_offset); + smp_clear_cpu_maps(); device_tree_flattened = early_fdt_map(fdt_paddr); @@ -775,8 +777,6 @@ void __init start_xen(unsigned long boot_phys_offset, (paddr_t)(uintptr_t)(_end - _start + 1), false); BUG_ON(!xen_bootmodule); - setup_pagetables(boot_phys_offset); - setup_mm(fdt_paddr, fdt_size); /* Parse the ACPI tables for possible boot-time configuration */ From patchwork Mon Apr 22 16:49:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162601 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801145jan; Mon, 22 Apr 2019 09:51:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqySw1nIxFln4hTkhazWoKDWXQgYyjRAVqkGUg0y/VnWB+e67FPW4I+C22x/9NuQM46K8daL X-Received: by 2002:a25:d08e:: with SMTP id h136mr16213800ybg.316.1555951866133; Mon, 22 Apr 2019 09:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951866; cv=none; d=google.com; s=arc-20160816; b=BVJvst/6Ast7ThXdVwo1pTzLNWjfxi7Vwy3VMvMyE0bsFPiHMoI/kM74UZzd+mj2HW 5otylkUOtN2ddlbR5JiONpFu5WP3krkuewbYS/hJLvEaLmd6Yknv+AT3vxijFGuEAwMl 5tST2PTKXWAlIyZQJaGXaY52gu1foPlj94chDL9k796tbPe/9gPm2YrkKVGFcDa2dwQx 5I3hcLvJKD+Zu/DOp8gD/dOqvewwDHUuQBVzU2RJaKDnKDDdBsbxHiqe5Kpzi0L+UfCN n4zty9w2wbcENxnlGTE/FMS7AbFqlte4Z7GlSAlvdx0Mhf7d3wtF1corGAvSdDAY/sRz mO8w== 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; bh=EXjBHqB9fSbkM3MIkS5nbRJx+ySoM+2QGhtbanEzSoU=; b=s4JukPZVgrfmDJaOH6b3uE1zVuhFkbylAUdQ9LSeKI3mYAAL4SB4Np8NN3NfcIYRUx jwI9mluZ7oii9MSGkUFR4UItr+dxVN8qYQNPNDGcVXpH3Nl1THe2V2q2MxhXdCPDp5sE 3vnRLuzRaO8LY6rpxS/Eq2KCPANjsFGm6mosterwQSoGyZN7auIEqryhkJY8Djdcdudu uQMB3y2PnvE2fhZY3Ph+MLFr+GBZMwhB3+4pi4RUOQhvE0oa77VafMrfGDOVEQn8KbtG D5EFnEausWGKR3R5xs24f8X22JZHPCD8tSDxSyqKq3X5WdiXd3jDnqFkNbewCzKX3ANt RQKQ== 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 y203si9737310ywa.294.2019.04.22.09.51.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:06 -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 1hIc94-0005Rd-Vz; Mon, 22 Apr 2019 16:50:18 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc92-0005Ne-NJ for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:16 +0000 X-Inumbo-ID: b3e13c88-651e-11e9-aa2e-a7481e74956a Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id b3e13c88-651e-11e9-aa2e-a7481e74956a; Mon, 22 Apr 2019 16:50:15 +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 22EDC15AB; Mon, 22 Apr 2019 09:50:15 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 12FCE3F557; Mon, 22 Apr 2019 09:50:13 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:35 +0100 Message-Id: <20190422164937.21350-19-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 18/20] xen/arm: mm: Check start is always before end in {destroy, modify}_xen_mappings 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The two helpers {destroy, modify}_xen_mappings don't check that the start is always before the end. This should never happen but if it happens, it will result to unexpected behavior. Catch such issues earlier on by adding an ASSERT in destroy_xen_mappings and modify_xen_mappings. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/mm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index ee541a38e3..d6157c35d6 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1072,11 +1072,13 @@ int populate_pt_range(unsigned long virt, unsigned long nr_mfns) int destroy_xen_mappings(unsigned long v, unsigned long e) { + ASSERT(v <= e); return create_xen_entries(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 0); } int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags) { + ASSERT(s <= e); return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); } From patchwork Mon Apr 22 16:49:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162603 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801208jan; Mon, 22 Apr 2019 09:51:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdnuaaeoM9WgzjyCTpn3GPvKaoEtsZnX27CQwpBRpw2xhTXsnUKmtBLoVWr6yU8/OxmNtq X-Received: by 2002:a81:9982:: with SMTP id q124mr16813938ywg.390.1555951868908; Mon, 22 Apr 2019 09:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951868; cv=none; d=google.com; s=arc-20160816; b=Izbg+jD830Mb3CKzj4XDOC9oSgc219Ml2KXXoccx3eAv+/SujGePPdrMa5Ib0b1yWg QR+MRfIMCG+7BUoSUCpcraHKAtZdZ7TLCotxyRX4mD8fWuH/sdtBkzsBPhbe3/4YkECQ UAidlgYGNGw4pBGcTTszOY/1cf6w72Z0GtA6rtYkDiDJZF2vKXmQ5ckTVyu5GnpujexC F/aijO3wnms62jSDyZdVcp+vCcBZ+RFmgge+rFjDRxk4/C81/SHjKhP5XOndB1kZZJBy /b1LjJ/WiL/JeJN7PfCFgW07N3ZRzboD69kuzlP0WIoLsU+e+yx46yByb9/ARk6apInS Jzsg== 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; bh=D8c4FalC3AnAaEhqRDCwmEvcyQmmm0xVRQCjH7+U/Qs=; b=Ng7Ir6/rI5gWqRfs2Oc7HZU23iRq3hZ4s2beN7VcFY6BtXeQJQEXDlR0LsAoT+SCZo BDbdt+dexqAUgammP3K4GDPfZCThcL7I1QhCP+SzeQc8TVSWFdefvNR0nSXrj8b8bd1G hGWIMiufSYBVW487zezmtPz7nparISg5QsvjG+pGTe6brsj0RGRrUSB7zn3tGVmt2Hxh Ndt+KUnRWtKpdJXnvDk9zSARBBfBL4rwweurKb7BuoR1ygC/iXI80FOqGUjLJ5H+F+/D FCAOoP7lQrPI7y4uzxZz+Ex1hMR7uT6kW7ikABGYO9zf1JxBtj3/5O7QVYnnZsYox71h dGXg== 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 q185si4234132ywb.278.2019.04.22.09.51.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:08 -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 1hIc95-0005ST-Dx; Mon, 22 Apr 2019 16:50:19 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc93-0005PI-NF for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:17 +0000 X-Inumbo-ID: b4acb2b2-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id b4acb2b2-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:16 +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 703B4374; Mon, 22 Apr 2019 09:50:16 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60CF43F557; Mon, 22 Apr 2019 09:50:15 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:36 +0100 Message-Id: <20190422164937.21350-20-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 19/20] xen/arm: Pair call to set_fixmap with call to clear_fixmap in copy_from_paddr 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" At the moment, set_fixmap may replace a valid entry without following the break-before-make sequence. This may result to TLB conflict abort. Rather than dealing with Break-Before-Make in set_fixmap, every call to set_fixmap is paired with a call to clear_fixmap. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/kernel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index e3ffdb2fa1..389bef2afa 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -58,13 +58,12 @@ void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), PAGE_HYPERVISOR_WC); memcpy(dst, src + s, l); clean_dcache_va_range(dst, l); + clear_fixmap(FIXMAP_MISC); paddr += l; dst += l; len -= l; } - - clear_fixmap(FIXMAP_MISC); } static void __init place_modules(struct kernel_info *info, From patchwork Mon Apr 22 16:49:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162604 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801253jan; Mon, 22 Apr 2019 09:51:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqze7Jx2jJ9A8T4biT5nOHAVzW3ts3n4Ony2jEX3+9CFlTXwppB1wYXj4pY7iQ9JRv3uIWo5 X-Received: by 2002:a25:e80f:: with SMTP id k15mr16172879ybd.489.1555951873689; Mon, 22 Apr 2019 09:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951873; cv=none; d=google.com; s=arc-20160816; b=PdxBNrGSBgTT8ceONbccp7IdQVOhHVYK/M0pt8d4tLfjuqq6VX5CedKaLgL/5zq4Ta TMyLAofwkIX2w63KU93vtuhEVDTegYKXPgI8MQLMmDrj0c3ehOsLAjpNceQ3qjz3Jx0g AmB+B6q4/JH87HcDlBMRcVaAOLajjxRg3mblLwydQSldkJ5hhZ2LvXfcihF+2/Anola6 HgwWMjXbBRxRzvLaMHFKS55v8vnlibYQQflUxl0voEwQfzN4lGkqLVT272I0SEQn1hVQ /w5CMvFFZFbbsSKLhpNR+V5FgghEhaLOS6d7hGDgoKpKe+Og5ebH2oERKDPjbFR0/Jo0 oEzQ== 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; bh=jr+ELKhZchDAuTudjtlKfRBV9Qhi/sqAoyd1T9oeKkQ=; b=gccwWJu+GCqDRDmpyYBB8x+lhcpWPuyymxiMVDExsvYuhZvkXg467HKvpNmxRhgO67 4NnPv32aS4ZMSPYIm/+C5ED88ixc0bw6dddCzof9+3+ZH8RZ4Gq8C2xsP24aYxVsylzj OC2YoKGjhk2x2w3z1iwZqpnAdXU6UOblevk5coxfP8vbyiBsIvhJjmN/UkQJdZfQhETz KLyCYxjEGHcNgFpHqERAoewF4fw+cICtsjamr8BeRptr5xlC8hOTUqvMUGJEqh8AVvdQ q67cr5CQ/LEjgZ1T1nQRybD9AUwu2I3kQREmz0Gs9vnqBSf+n1EZPHeZ8DlL92QfkxZb 92QA== 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 80si9207988ybn.24.2019.04.22.09.51.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:13 -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 1hIc97-0005Xd-Ul; Mon, 22 Apr 2019 16:50:21 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc95-0005TL-Uo for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:19 +0000 X-Inumbo-ID: b56b5ac9-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id b56b5ac9-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:17 +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 BDCCFEBD; Mon, 22 Apr 2019 09:50:17 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AE2C73F719; Mon, 22 Apr 2019 09:50:16 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:37 +0100 Message-Id: <20190422164937.21350-21-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 20/20] xen/arm: Allow cleaning the directory even when CONFIG_EARLY_PRINTK is set 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" CONFIG_EARLY_PRINTK can only be set when CONFIG_DEBUG is enabled. It can be quite convenient to only modify the target. However, the target clean will not include the .config. This means CONFIG_DEBUG is not enabled and therefore make will throw an error preventing clean to continue. The check is not moved at linking time. Signed-off-by: Julien Grall --- This code is pretty nasty, but I haven't found a better way for avoiding to check if CONFIG_DEBUG is enabled when the target clean is called. Ideally we will want to move CONFIG_EARLY_PRINTK in Kconfig. I haven't had time yet to look at it properly so far. --- xen/arch/arm/Makefile | 5 +++++ xen/arch/arm/Rules.mk | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index cb902cb6fe..fef508c836 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -101,6 +101,11 @@ prelink.o: $(ALL_OBJS) endif $(TARGET)-syms: prelink.o xen.lds +ifneq ($(CONFIG_EARLY_PRINTK), ) +ifneq ($(CONFIG_DEBUG), y) + $(error CONFIG_EARLY_PRINTK enabled for non-debug build) +endif +endif $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \ $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 $(NM) -pa --format=sysv $(@D)/.$(@F).0 \ diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index f264592aef..12150986c5 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -80,11 +80,4 @@ CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD) CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS) CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT) -else # !CONFIG_DEBUG - -ifneq ($(CONFIG_EARLY_PRINTK),) -# Early printk is dependant on a debug build. -$(error CONFIG_EARLY_PRINTK enabled for non-debug build) -endif - endif