From patchwork Fri Jul 19 11:48:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Z.Q. Hou" X-Patchwork-Id: 1962453 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WQS8s0SFMz1ySl for ; Fri, 19 Jul 2024 21:28:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F99288B7C; Fri, 19 Jul 2024 13:28:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id CFDA488B90; Fri, 19 Jul 2024 13:28:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C0D5788B84 for ; Fri, 19 Jul 2024 13:27:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Zhiqiang.Hou@nxp.com Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7EA7D1A13CF; Fri, 19 Jul 2024 13:27:57 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 443DF1A13B8; Fri, 19 Jul 2024 13:27:57 +0200 (CEST) Received: from mega.am.freescale.net (mega.ap.freescale.net [10.192.208.232]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id D31821820F77; Fri, 19 Jul 2024 19:27:55 +0800 (+08) From: Zhiqiang Hou To: u-boot@lists.denx.de, sbabic@denx.de, festevam@gmail.com, uboot-imx@nxp.com, trini@konsulko.com, peng.fan@nxp.com Cc: Tao Yang , Hou Zhiqiang Subject: [PATCHv1 1/3] mp: imx9: add cpu command support Date: Fri, 19 Jul 2024 19:48:48 +0800 Message-Id: <20240719114850.28134-2-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240719114850.28134-1-Zhiqiang.Hou@nxp.com> References: <20240719114850.28134-1-Zhiqiang.Hou@nxp.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Tao Yang Implement the cpu command to kick cpu core to run barematel or RTOS applications. Signed-off-by: Tao Yang Signed-off-by: Hou Zhiqiang --- arch/arm/mach-imx/imx9/Makefile | 4 +- arch/arm/mach-imx/imx9/mp.c | 81 +++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-imx/imx9/mp.c diff --git a/arch/arm/mach-imx/imx9/Makefile b/arch/arm/mach-imx/imx9/Makefile index e1b09ab534..975b6831cc 100644 --- a/arch/arm/mach-imx/imx9/Makefile +++ b/arch/arm/mach-imx/imx9/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# Copyright 2022 NXP +# Copyright 2022, 2024 NXP obj-y += lowlevel_init.o obj-y += soc.o clock.o clock_root.o trdc.o @@ -8,3 +8,5 @@ obj-y += soc.o clock.o clock_root.o trdc.o #ifndef CONFIG_SPL_BUILD obj-y += imx_bootaux.o #endif + +obj-$(CONFIG_MP) += mp.o diff --git a/arch/arm/mach-imx/imx9/mp.c b/arch/arm/mach-imx/imx9/mp.c new file mode 100644 index 0000000000..9ddfc7784b --- /dev/null +++ b/arch/arm/mach-imx/imx9/mp.c @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2024 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MPIDR_MT_BIT BIT(24) +#define MPIDR_AFF1_SHFT (8) + +static u64 logical_id_to_hwid(unsigned int core) +{ + u64 hwid = core; + + if (read_mpidr() & MPIDR_MT_BIT) + hwid = core << MPIDR_AFF1_SHFT; + + return hwid; +} + +int is_core_valid(unsigned int core) +{ + if (core < MAX_CPUS) + return 1; + + return 0; +} + +int cpu_reset(u32 nr) +{ + printf("Feature is not implemented.\n"); + + return 0; +} + +int cpu_disable(u32 nr) +{ + printf("Feature is not implemented.\n"); + + return 0; +} + +int cpu_status(u32 nr) +{ + printf("Feature is not implemented.\n"); + + return 0; +} + +int cpu_release(u32 nr, int argc, char *const argv[]) +{ + struct pt_regs regs; + u64 boot_addr; + + if (nr >= MAX_CPUS) { + printf("Invalid CPU ID %d\n", nr); + return -1; + } + + boot_addr = simple_strtoull(argv[0], NULL, 16); + + regs.regs[0] = PSCI_0_2_FN64_CPU_ON; + regs.regs[1] = logical_id_to_hwid(nr); + regs.regs[2] = boot_addr; + regs.regs[3] = 0; + + smc_call(®s); + if (regs.regs[0]) + return -1; + + printf("kicked cpu core #%d to address %llx\n", nr, boot_addr); + + return 0; +} From patchwork Fri Jul 19 11:48:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Z.Q. Hou" X-Patchwork-Id: 1962454 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WQS927324z1ySl for ; Fri, 19 Jul 2024 21:28:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9020B88B95; Fri, 19 Jul 2024 13:28:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 7A65C88B8A; Fri, 19 Jul 2024 13:28:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B218C88B8D for ; Fri, 19 Jul 2024 13:27:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Zhiqiang.Hou@nxp.com Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7C65B1A2969; Fri, 19 Jul 2024 13:27:58 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 425841A13B8; Fri, 19 Jul 2024 13:27:58 +0200 (CEST) Received: from mega.am.freescale.net (mega.ap.freescale.net [10.192.208.232]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id C8D87181D0FE; Fri, 19 Jul 2024 19:27:56 +0800 (+08) From: Zhiqiang Hou To: u-boot@lists.denx.de, sbabic@denx.de, festevam@gmail.com, uboot-imx@nxp.com, trini@konsulko.com, peng.fan@nxp.com Cc: Tao Yang , Hou Zhiqiang Subject: [PATCHv1 2/3] imx93_evk: add definition MAX_CPUS Date: Fri, 19 Jul 2024 19:48:49 +0800 Message-Id: <20240719114850.28134-3-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240719114850.28134-1-Zhiqiang.Hou@nxp.com> References: <20240719114850.28134-1-Zhiqiang.Hou@nxp.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Tao Yang Add definition for determining the implemented CPU numbers. Signed-off-by: Tao Yang Signed-off-by: Hou Zhiqiang --- include/configs/imx93_evk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/configs/imx93_evk.h b/include/configs/imx93_evk.h index ce6567e2af..24a8124ca1 100644 --- a/include/configs/imx93_evk.h +++ b/include/configs/imx93_evk.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright 2022 NXP + * Copyright 2022, 2024 NXP */ #ifndef __IMX93_EVK_H @@ -134,4 +134,6 @@ /* Using ULP WDOG for reset */ #define WDOG_BASE_ADDR WDG3_BASE_ADDR +#define MAX_CPUS 2 + #endif From patchwork Fri Jul 19 11:48:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Z.Q. Hou" X-Patchwork-Id: 1962455 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WQS9F3g2lz1ySl for ; Fri, 19 Jul 2024 21:28:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0316F88BAD; Fri, 19 Jul 2024 13:28:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9CF8C884CA; Fri, 19 Jul 2024 13:28:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B3E9F88B7C for ; Fri, 19 Jul 2024 13:27:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Zhiqiang.Hou@nxp.com Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 7F12B20136B; Fri, 19 Jul 2024 13:27:59 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 4658E201367; Fri, 19 Jul 2024 13:27:59 +0200 (CEST) Received: from mega.am.freescale.net (mega.ap.freescale.net [10.192.208.232]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id C76FD1820F77; Fri, 19 Jul 2024 19:27:57 +0800 (+08) From: Zhiqiang Hou To: u-boot@lists.denx.de, sbabic@denx.de, festevam@gmail.com, uboot-imx@nxp.com, trini@konsulko.com, peng.fan@nxp.com Cc: Tao Yang , Hou Zhiqiang Subject: [PATCHv1 3/3] configs: imx93-11x11-evk: enable CONFIG_MP to support cpu command Date: Fri, 19 Jul 2024 19:48:50 +0800 Message-Id: <20240719114850.28134-4-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240719114850.28134-1-Zhiqiang.Hou@nxp.com> References: <20240719114850.28134-1-Zhiqiang.Hou@nxp.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Tao Yang Enable the cpu command support for the default config. Signed-off-by: Tao Yang Signed-off-by: Hou Zhiqiang --- configs/imx93_11x11_evk_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/imx93_11x11_evk_defconfig b/configs/imx93_11x11_evk_defconfig index 2246715d82..b5c7e92a0e 100644 --- a/configs/imx93_11x11_evk_defconfig +++ b/configs/imx93_11x11_evk_defconfig @@ -127,3 +127,4 @@ CONFIG_ULP_WATCHDOG=y CONFIG_WDT=y CONFIG_LZO=y CONFIG_BZIP2=y +CONFIG_MP=y