From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59AB2C433F5 for ; Thu, 30 Sep 2021 10:34:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4630C61884 for ; Thu, 30 Sep 2021 10:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350121AbhI3Kgj (ORCPT ); Thu, 30 Sep 2021 06:36:39 -0400 Received: from foss.arm.com ([217.140.110.172]:52108 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350094AbhI3Kgc (ORCPT ); Thu, 30 Sep 2021 06:36:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6BD3E106F; Thu, 30 Sep 2021 03:34:49 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.73.203]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4139D3F793; Thu, 30 Sep 2021 03:34:46 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: suzuki.poulose@arm.com, mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com, maz@kernel.org, james.morse@arm.com, steven.price@arm.com, Anshuman Khandual Subject: [RFC V3 09/13] arm64/mm: Add __cpu_secondary_check52bitpa() Date: Thu, 30 Sep 2021 16:05:12 +0530 Message-Id: <1632998116-11552-10-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1632998116-11552-1-git-send-email-anshuman.khandual@arm.com> References: <1632998116-11552-1-git-send-email-anshuman.khandual@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org FEAT_LPA2 enabled systems needs to test ID_AA64MMFR0.TGRAN value to ensure that 52 bit PA range is supported across all secondary CPUs both for 4K and 16K configs. This adds a new __cpu_secondary_check52bitva check along with a corresponding reason code CPU_STUCK_REASON_52_BIT_PA. This will identify the exact reason in case the system gets stuck after detecting a secondary CPU that does not support 52 bit PA. Signed-off-by: Anshuman Khandual --- arch/arm64/include/asm/smp.h | 1 + arch/arm64/kernel/head.S | 21 +++++++++++++++++++++ arch/arm64/kernel/smp.c | 2 ++ 3 files changed, 24 insertions(+) diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index fc55f5a..e5ff305 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -22,6 +22,7 @@ #define CPU_STUCK_REASON_52_BIT_VA (UL(1) << CPU_STUCK_REASON_SHIFT) #define CPU_STUCK_REASON_NO_GRAN (UL(2) << CPU_STUCK_REASON_SHIFT) +#define CPU_STUCK_REASON_52_BIT_PA (UL(3) << CPU_STUCK_REASON_SHIFT) #ifndef __ASSEMBLY__ diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index ab21aac..0b48e4c 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -667,6 +667,7 @@ SYM_FUNC_START_LOCAL(secondary_startup) */ bl switch_to_vhe bl __cpu_secondary_check52bitva + bl __cpu_secondary_check52bitpa bl __cpu_setup // initialise processor adrp x1, swapper_pg_dir bl __enable_mmu @@ -770,6 +771,26 @@ SYM_FUNC_START(__cpu_secondary_check52bitva) 2: ret SYM_FUNC_END(__cpu_secondary_check52bitva) +SYM_FUNC_START(__cpu_secondary_check52bitpa) +#ifdef CONFIG_ARM64_PA_BITS_52_LPA2 + ldr_l x0, arm64_lpa2_enabled + cmp x2, #1 + b.ne 2f + + mrs x0, ID_AA64MMFR0_EL1 + ubfx x0, x0, #ID_AA64MMFR0_TGRAN_SHIFT, 4 + cmp x0, #ID_AA64MMFR0_TGRAN_LPA2 + b.ge 2f + + update_early_cpu_boot_status \ + CPU_STUCK_IN_KERNEL | CPU_STUCK_REASON_52_BIT_PA, x0, x1 +1: wfe + wfi + b 1b +#endif +2: ret +SYM_FUNC_END(__cpu_secondary_check52bitpa) + SYM_FUNC_START_LOCAL(__no_granule_support) /* Indicate that this CPU can't boot and is stuck in the kernel */ update_early_cpu_boot_status \ diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 6f6ff072..a8d08d1 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -164,6 +164,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) if (status & CPU_STUCK_REASON_NO_GRAN) { pr_crit("CPU%u: does not support %luK granule\n", cpu, PAGE_SIZE / SZ_1K); + if (status & CPU_STUCK_REASON_52_BIT_PA) + pr_crit("CPU%u: does not support 52-bit PAs\n", cpu); } cpus_stuck_in_kernel++; break; -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45555C433F5 for ; Thu, 30 Sep 2021 10:40:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A8E761989 for ; Thu, 30 Sep 2021 10:40:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0A8E761989 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zKawWjT0/bBho18kGo6GxARmLwN7ScwXqyBB9EjD2WI=; b=tOxxUf6zEIIz8e DEkShM5EbRH2ERbBdYv2IEYLNm7CjDsJbbgZMwg8VowB1qQlv+yXatVzOeLrphyuSkU3n7WPH1yde flYLef/a00b7UUFeyvfAqCtYa7i3dcSWhh5vX42J4b6nTgQGAnjb1ar+TfclHWLVuGPK+3Q26D5ix vEvZZh9NZwP8AQ1pPF8V374ru7TrKEovrlybWRnLgTrP4zR3zqdNWKe7l/dCsTyqfAiXo6mqFN/yU ci4EOlBQOmLPnFxpHBZnc5OsIuETYQw8CNLRtjfLb+N4Uh2Gcc3lummKIoI4eyqjtyqOJKnMp5V94 XDv2yU7U15R0/N9xGdkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVtRm-00DqnR-DG; Thu, 30 Sep 2021 10:37:51 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVtOs-00DpIG-0c for linux-arm-kernel@lists.infradead.org; Thu, 30 Sep 2021 10:34:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6BD3E106F; Thu, 30 Sep 2021 03:34:49 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.73.203]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4139D3F793; Thu, 30 Sep 2021 03:34:46 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: suzuki.poulose@arm.com, mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com, maz@kernel.org, james.morse@arm.com, steven.price@arm.com, Anshuman Khandual Subject: [RFC V3 09/13] arm64/mm: Add __cpu_secondary_check52bitpa() Date: Thu, 30 Sep 2021 16:05:12 +0530 Message-Id: <1632998116-11552-10-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1632998116-11552-1-git-send-email-anshuman.khandual@arm.com> References: <1632998116-11552-1-git-send-email-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210930_033450_155959_5DAE4A4E X-CRM114-Status: GOOD ( 11.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org FEAT_LPA2 enabled systems needs to test ID_AA64MMFR0.TGRAN value to ensure that 52 bit PA range is supported across all secondary CPUs both for 4K and 16K configs. This adds a new __cpu_secondary_check52bitva check along with a corresponding reason code CPU_STUCK_REASON_52_BIT_PA. This will identify the exact reason in case the system gets stuck after detecting a secondary CPU that does not support 52 bit PA. Signed-off-by: Anshuman Khandual --- arch/arm64/include/asm/smp.h | 1 + arch/arm64/kernel/head.S | 21 +++++++++++++++++++++ arch/arm64/kernel/smp.c | 2 ++ 3 files changed, 24 insertions(+) diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index fc55f5a..e5ff305 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -22,6 +22,7 @@ #define CPU_STUCK_REASON_52_BIT_VA (UL(1) << CPU_STUCK_REASON_SHIFT) #define CPU_STUCK_REASON_NO_GRAN (UL(2) << CPU_STUCK_REASON_SHIFT) +#define CPU_STUCK_REASON_52_BIT_PA (UL(3) << CPU_STUCK_REASON_SHIFT) #ifndef __ASSEMBLY__ diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index ab21aac..0b48e4c 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -667,6 +667,7 @@ SYM_FUNC_START_LOCAL(secondary_startup) */ bl switch_to_vhe bl __cpu_secondary_check52bitva + bl __cpu_secondary_check52bitpa bl __cpu_setup // initialise processor adrp x1, swapper_pg_dir bl __enable_mmu @@ -770,6 +771,26 @@ SYM_FUNC_START(__cpu_secondary_check52bitva) 2: ret SYM_FUNC_END(__cpu_secondary_check52bitva) +SYM_FUNC_START(__cpu_secondary_check52bitpa) +#ifdef CONFIG_ARM64_PA_BITS_52_LPA2 + ldr_l x0, arm64_lpa2_enabled + cmp x2, #1 + b.ne 2f + + mrs x0, ID_AA64MMFR0_EL1 + ubfx x0, x0, #ID_AA64MMFR0_TGRAN_SHIFT, 4 + cmp x0, #ID_AA64MMFR0_TGRAN_LPA2 + b.ge 2f + + update_early_cpu_boot_status \ + CPU_STUCK_IN_KERNEL | CPU_STUCK_REASON_52_BIT_PA, x0, x1 +1: wfe + wfi + b 1b +#endif +2: ret +SYM_FUNC_END(__cpu_secondary_check52bitpa) + SYM_FUNC_START_LOCAL(__no_granule_support) /* Indicate that this CPU can't boot and is stuck in the kernel */ update_early_cpu_boot_status \ diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 6f6ff072..a8d08d1 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -164,6 +164,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) if (status & CPU_STUCK_REASON_NO_GRAN) { pr_crit("CPU%u: does not support %luK granule\n", cpu, PAGE_SIZE / SZ_1K); + if (status & CPU_STUCK_REASON_52_BIT_PA) + pr_crit("CPU%u: does not support 52-bit PAs\n", cpu); } cpus_stuck_in_kernel++; break; -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel