From patchwork Fri Apr 4 14:48:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayuresh Chitale X-Patchwork-Id: 2068668 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=jSY7bjjz; dkim-atps=neutral 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 4ZThMX0cPbz1yHF for ; Sat, 5 Apr 2025 01:49:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AED28829F5; Fri, 4 Apr 2025 16:49:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="jSY7bjjz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D4A7682A36; Fri, 4 Apr 2025 16:49:41 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5FA5F82A0A for ; Fri, 4 Apr 2025 16:49:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mchitale@ventanamicro.com Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-224100e9a5cso23047645ad.2 for ; Fri, 04 Apr 2025 07:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1743778176; x=1744382976; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eoZuUW7pGdED/Xf41pBvl49pBkONiGJCDiSSyPmF5oM=; b=jSY7bjjzOQ10eCNsoQ+gy9akM2VBanIi5B3DYzVkXlbQUW5SAIHMlMeT8NwB00IUrF zoLNZilSIP2ykf/wIR5IfrNsSjpXhQ7m0aphad2CpqjNMvM0pAhMeuBCHcnKWJXVZSrK QKcrve5EoOkOoiKT7p3Dx3/4SoyI0xHXlu/S0+GpyMrXAzaSi003DXExj/Py4PYP4du7 xI3aWzQ5gamwvv3nBPiUOQozIN2/FG/A4BmxYBgdg3a5E65WTI7J8d73o6jqZ1iM7Jqd t1Xz6NVLiZ0t5YH7xxDp1Gy/r75o0dzyIiQkhza8g4LfuXh7Z9EkmozpjFmNq21+oJGI l5Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743778176; x=1744382976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eoZuUW7pGdED/Xf41pBvl49pBkONiGJCDiSSyPmF5oM=; b=Z0HTtqu0ivOOrKrLeSP2EfcDt2TqDivWLAIFtyIbiRjobOd8nytspnIArPvlpNBklq TSJSikh4fteG3NzR2tf66OwJfZyi0402rSDFFMGLeCMte0e6vxJsIj1oTmPpJCA0COky utBVNiYaL8vwvvsiktxOi8C4R1e0uZneuDws2Gz6iOH16fji7Yl77KgvzXk6xFLO2nSG qmrRsWbnn/PWSLlpo8oPdva9TUi9Uz7ricAqkKSYC1k7NjaONPwyfcIawsWsTTCWlOlc gRksqKbXGnP1GWwNvS7UGd3+Zx/4YjvB7/lGws0ibMm5bG1lGa6AJZJAgVQShAMkBg05 hy5w== X-Gm-Message-State: AOJu0Yxtrw5H5tOUFP486+DvXRXfEWSszWzn9CVDHCDAyF4K0jAah/BE 5GMs2hASNIk5+IeWWSFjPG4krdwiGkVlTtjmYLP2uliAchkBDtbD4qqu5CRHulyWM0qHbpSwdE1 h X-Gm-Gg: ASbGncsZe33+hZgkzcRHodPh08FyFx9uUOhu+ydt7ApiOD7T86NocfKW/DNZzyFNjzn 6O9rCUkOdFkGBQS0BJ8cWXqGQNZsuNX8N6wihBc2A/YSLj+A/6UT2gSCh1YjyqOYMQXAFLVv+8A FLAq0Q4yII25+O4ccBdH4hOYNSumCxmjhwaxp6bXKIXl8aw46efakKl5ZS0jgulxvNILoPgg+iB +LMB4fA7YAe7FuFebhiOjshr0cDMeDTu1pzDGiLyACUJ2x0RpDu88RRepzEEvEWXka/fRIR3RTn ufivI9R2+4T2s3bxokfsf8ClV1C7M0Jp5sdaNlFFr6ro1dJbK4Dh/ZrDBTrndAegyl6ywCBqjpY L X-Google-Smtp-Source: AGHT+IFXAyljRCd3ZtWR4OfVDlbtbM0FjNFTXbDdsba5J2fzcchLTZ57oLG7pN8hVJ+9g4NZAzAARg== X-Received: by 2002:a17:903:3bc6:b0:224:1eab:97b5 with SMTP id d9443c01a7336-22a8a858f8fmr43910175ad.1.1743778176520; Fri, 04 Apr 2025 07:49:36 -0700 (PDT) Received: from localhost.localdomain ([103.97.166.196]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-2297866dccbsm32950705ad.176.2025.04.04.07.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Apr 2025 07:49:36 -0700 (PDT) From: Mayuresh Chitale To: u-boot@lists.denx.de Cc: Mayuresh Chitale , Tom Rini , Maxim Moskalets , Mattijs Korpershoek , Igor Opaniuk , Raymond Mao , Marek Vasut , Simon Glass , Julien Masson , Sughosh Ganu , Paul HENRYS Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64 Date: Fri, 4 Apr 2025 14:48:55 +0000 Message-ID: <20250404144859.112313-2-mchitale@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250404144859.112313-1-mchitale@ventanamicro.com> References: <20250404144859.112313-1-mchitale@ventanamicro.com> MIME-Version: 1.0 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 Similar to ARM and X86, introduce a new image type which allows u-boot to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs. Signed-off-by: Mayuresh Chitale Reviewed-by: Maxim Moskalets --- boot/image.c | 3 ++- include/image.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/boot/image.c b/boot/image.c index 139c5bd035a..45299a7dc33 100644 --- a/boot/image.c +++ b/boot/image.c @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = { { IH_ARCH_ARC, "arc", "ARC", }, { IH_ARCH_X86_64, "x86_64", "AMD x86_64", }, { IH_ARCH_XTENSA, "xtensa", "Xtensa", }, - { IH_ARCH_RISCV, "riscv", "RISC-V", }, + { IH_ARCH_RISCV, "riscv", "RISC-V 32 Bit",}, + { IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",}, { -1, "", "", }, }; diff --git a/include/image.h b/include/image.h index 07912606f33..411bfcd0877 100644 --- a/include/image.h +++ b/include/image.h @@ -138,7 +138,8 @@ enum { IH_ARCH_ARC, /* Synopsys DesignWare ARC */ IH_ARCH_X86_64, /* AMD x86_64, Intel and Via */ IH_ARCH_XTENSA, /* Xtensa */ - IH_ARCH_RISCV, /* RISC-V */ + IH_ARCH_RISCV, /* RISC-V 32 bit*/ + IH_ARCH_RISCV64, /* RISC-V 64 bit*/ IH_ARCH_COUNT, }; From patchwork Fri Apr 4 14:48:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayuresh Chitale X-Patchwork-Id: 2068669 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=mcTY3+zh; dkim-atps=neutral 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 4ZThMj4S9gz1yHF for ; Sat, 5 Apr 2025 01:49:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 133DF82A16; Fri, 4 Apr 2025 16:49:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="mcTY3+zh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D41582A0D; Fri, 4 Apr 2025 16:49:45 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8E8E1828AB for ; Fri, 4 Apr 2025 16:49:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mchitale@ventanamicro.com Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2295d78b45cso27878365ad.0 for ; Fri, 04 Apr 2025 07:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1743778181; x=1744382981; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=is36Na8dvk/foHAtQozAr7j8VafFohAS2dzm0pzp9J8=; b=mcTY3+zh1JVeGk1VNp6R/VkQgJ6gb8ghb1yTkoDN/LBE215Zg7qfoNyxfdCC/8UtCk xGVaHBpGkDLP2y20dJ3MT2Kdem5u7obBbMdOdYoyea5UuD4Z3oIWRZEQCAq8Ul2vZ8Rv UgMGbSfPpO1v+IivpYPasV9aLqmR0O+Qrm7Z/lQc2G/oz81Eysom9YU7KvQYOCeC48w6 RV48ssksyiTMU0StSaGBLgAeMpyhi/+jK9HzZZxc4YfGdvsBG+wGInWXoCDiw0BV523o eqXj7TP96TfqmgmW+I4y5XyipAr1VciHHFT+QY9pwayLVK7IxsADq0VNOJYJg4KPEzPW WL1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743778181; x=1744382981; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=is36Na8dvk/foHAtQozAr7j8VafFohAS2dzm0pzp9J8=; b=bRBYiNunwclEsPkn6UFrsCe9c460RaMudi47ITGbHjfUuswxXL0HkiKy7f9Ic/FDP3 2voAjjzOFvPy/TI3rH3S484aTivalb2H3vR7u0POb7JypGRWWGzLte1ivBhaSwBUmkbB Ajkfk0cRbXF+jB0wYu/FrbsFTo7v/NGGY4QJFt5bOgG345jjCivHJUE0yMZ9LBVxm6DN mhB0vAqe59AVCPrXu6wL+C/zNftx3xXkW63I5YXAW8MFVIKL9mVhN+SVaaCXh1E7GNYy PnS89L5QIaYcBnsnVtviDDsXDls+Qp0JOuibdzJUJp0r9whDvs3iH1701ph7naxH/4ST gE7A== X-Gm-Message-State: AOJu0YxN8/xlfXFv1x+Njhe7Oa5LlElPnKaaaEIT5BMtcJxR4lH6HAWx 6LWl7g5HBU3ycirLaV3EyEMeVIsSq+kHqsXlS5bxtTOqju5kGNnDuK8FDVh0NMmh6Xr1DOfysCO 4 X-Gm-Gg: ASbGncvdUWwoWAo4Nmn02TKi6dR+ihAcGyR0Orij0aJzr/+/E3Y6P/3bn9nyuwsXLuy mwMP9XYcCN3wRZhlihtYxGPsRbL8ZNbarriFSGaq1mPkfXXQmgMzy0K72YMImGZMbDBv0pdIQRG SVVb5l3dzmL6nEE41SarEPfQGISplwcmb0iduAcmee6gYsJXfPiYD0NEvGzeyT1oE4DJxJtyZvE 9Fk7rRZBIXAT52BDJ94zPSwlAEyOg8VNZJq6D8w1C/YJ4TufQo/mDGxwWWvy6juwwCg/qva6LjU lw4iuxcgQ8I8X3z9eMD17EL4WFz5Z3VNhhCdYv2CzTqLy0RIyLtSYPHMjgBcuzxUxQ== X-Google-Smtp-Source: AGHT+IEisIWQnI12k+8r3niCud09aMlGGPHm7YH/WrUWuBfAO1pb2+uRF5i4iSFWV1go5Rz0aUScUg== X-Received: by 2002:a17:903:22d1:b0:21f:c67:a68a with SMTP id d9443c01a7336-22a8a067a4dmr46515575ad.31.1743778180899; Fri, 04 Apr 2025 07:49:40 -0700 (PDT) Received: from localhost.localdomain ([103.97.166.196]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-2297866dccbsm32950705ad.176.2025.04.04.07.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Apr 2025 07:49:40 -0700 (PDT) From: Mayuresh Chitale To: u-boot@lists.denx.de Cc: Mayuresh Chitale , Rick Chen , Leo , Tom Rini , Yu-Chien Peter Lin Subject: [PATCH v2 2/3] riscv: Select appropriate image type Date: Fri, 4 Apr 2025 14:48:56 +0000 Message-ID: <20250404144859.112313-3-mchitale@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250404144859.112313-1-mchitale@ventanamicro.com> References: <20250404144859.112313-1-mchitale@ventanamicro.com> MIME-Version: 1.0 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 Select between the 32-bit or 64-bit arch type for the image headers depending on how the build is configured. Signed-off-by: Mayuresh Chitale Reviewed-by: Leo Yu-Chi Liang --- arch/riscv/dts/binman.dtsi | 14 ++++++++++---- arch/riscv/include/asm/u-boot.h | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/riscv/dts/binman.dtsi b/arch/riscv/dts/binman.dtsi index 0405faca574..a1a566b511b 100644 --- a/arch/riscv/dts/binman.dtsi +++ b/arch/riscv/dts/binman.dtsi @@ -5,6 +5,12 @@ #include +#ifdef CONFIG_64BIT +#define ARCH "riscv64" +#else +#define ARCH "riscv" + +#endif / { binman: binman { multiple-images; @@ -31,7 +37,7 @@ description = "U-Boot"; type = "standalone"; os = "U-Boot"; - arch = "riscv"; + arch = ARCH; compression = "none"; load = /bits/ 64 ; @@ -44,7 +50,7 @@ description = "Linux"; type = "standalone"; os = "Linux"; - arch = "riscv"; + arch = ARCH; compression = "none"; load = /bits/ 64 ; @@ -57,7 +63,7 @@ tee { description = "OP-TEE"; type = "tee"; - arch = "riscv"; + arch = ARCH; compression = "none"; os = "tee"; load = /bits/ 64 ; @@ -71,7 +77,7 @@ description = "OpenSBI fw_dynamic Firmware"; type = "firmware"; os = "opensbi"; - arch = "riscv"; + arch = ARCH; compression = "none"; load = /bits/ 64 ; entry = /bits/ 64 ; diff --git a/arch/riscv/include/asm/u-boot.h b/arch/riscv/include/asm/u-boot.h index d5e1d5f3231..a90cc4c21cf 100644 --- a/arch/riscv/include/asm/u-boot.h +++ b/arch/riscv/include/asm/u-boot.h @@ -23,6 +23,10 @@ #include /* For image.h:image_check_target_arch() */ +#ifdef CONFIG_64BIT +#define IH_ARCH_DEFAULT IH_ARCH_RISCV64 +#else #define IH_ARCH_DEFAULT IH_ARCH_RISCV +#endif #endif /* _U_BOOT_H_ */ From patchwork Fri Apr 4 14:48:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayuresh Chitale X-Patchwork-Id: 2068670 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=oKcFU0z+; dkim-atps=neutral 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 4ZThMv3Lprz1yHF for ; Sat, 5 Apr 2025 01:49:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AA4082A0D; Fri, 4 Apr 2025 16:49:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="oKcFU0z+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 38EDE82A0C; Fri, 4 Apr 2025 16:49:52 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 897F0828AB for ; Fri, 4 Apr 2025 16:49:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mchitale@ventanamicro.com Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-224019ad9edso28922065ad.1 for ; Fri, 04 Apr 2025 07:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1743778188; x=1744382988; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P3+88lxcyigCrziUjCy8/JMVtxotNgrX6nDbP8CR55I=; b=oKcFU0z+yVZShk8EL7GY6Ue/fvyjYaPJeKnM2hl/8+INKl2GZtBe/mHH7iydmIu6UN CKmUpZB8z36dIC2i2Lc+YHoTi4IqQEvSfIgCa6OukKfMNNgGp+yTB4B5wYmY+lmyGCHp VN29uTWuynL6NnsjzX6FLhjpYHPjfpYtb643sDJOyP7E9XYAW8gMFLqYVoJZl/glBYfZ 3whj5w7UEXOTorc/Sm7NeSL0rD8CVQ/pBOeb9abCsUBTBoPPc6X+/FKBnd3zYyRUbMbA XKLlqcKLPaqKRRyc36qd4HJE5zslzLzm+NcSkI8P69WHHmjiDTm5cGAtc5mkWQ1+x54I a6XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743778188; x=1744382988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P3+88lxcyigCrziUjCy8/JMVtxotNgrX6nDbP8CR55I=; b=ZNqrhUPf4wkpbMyKYgR9N4CKijCrmSfowwV2gPvDJ1598EH6whIK8BQqtC7Gk6YfdX UTnCdOkoCWGMzVCp0+4xjZTpYOXWRP3jKiw3AxEXSNprR8U1jC1QqLAQk1t/QdnXj769 C+J+VV5q+dC/n5IQkPJNi+wX8mj/6OUiv2oVSLpHPvLnMljp2arK9f5h4vZjpYrlM5vF H0K9YzCqoJYbtH455y+5ebRkEHDARQhadRT4n2KNSNoIWImHBDciu/Pcr+wYQHHDeJLo VgDq18Q4+kT+JUKzgRzU53nwrk/fHK+NmE6YPz0/LXDsYWdKf4ENnontV2A2oYwd0LpR BFZA== X-Gm-Message-State: AOJu0YxWbRml0sE99EN61auRICTSVWUe7Opqh/jqOvb227lOwIh2+c7+ 0z3WLf/oZP8eyip5s7NKik8EXv1TzUmsLlKvJFuJPbK2vGeybGiQ+LgPPaIy9sWrrNnsNGvLpVB m X-Gm-Gg: ASbGncsLmAZdlbe9gfTAFt9spHMoPaIRpoOycT+taG04/kj3Rljs4miLFCnXw/1kzBI RW38kMWaSJuvOBfXIk6ZY62hAQF/nA4Y0x0xNv+xloUn58wOdT0D6gnxoC8tYjHZsAD80FrBV7b EprNk1WnC8HExEQCFLdY0vfMWZ4LcjcPXtSkjYmI7unAuYi6DI3pUPO0tvnwz9Ez6T846D3r/4l dnZA4TH11sHYYQyWOP4EEfC6Uv+4W1x+wZk+vVbd+YDWqJ5TS+0cva0DjYARHCnYfmiD0Xt9FeU e8xQXWj1QH7O/HMxjOUcnlXtZxGbC39m5F332jL2mMUynZqLm3HlRlVKQU8MpUsI3Q== X-Google-Smtp-Source: AGHT+IFwbNNirXEykX1Iz3svsdQGs35InEF8IvCD65qOUrsvzHiTGqXZQJRScnso803NhmsLheHT8A== X-Received: by 2002:a17:902:f547:b0:224:76f:9e44 with SMTP id d9443c01a7336-22a8a045df2mr32148405ad.8.1743778187779; Fri, 04 Apr 2025 07:49:47 -0700 (PDT) Received: from localhost.localdomain ([103.97.166.196]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-2297866dccbsm32950705ad.176.2025.04.04.07.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Apr 2025 07:49:47 -0700 (PDT) From: Mayuresh Chitale To: u-boot@lists.denx.de Cc: Mayuresh Chitale , Rick Chen , Leo , Tom Rini , Sughosh Ganu , Simon Glass , Heinrich Schuchardt , Ilias Apalodimas , Janne Grunau , Dario Binacchi , Sam Protsenko Subject: [PATCH v2 3/3] booti/bootm: riscv: Verify image arch type Date: Fri, 4 Apr 2025 14:48:57 +0000 Message-ID: <20250404144859.112313-4-mchitale@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250404144859.112313-1-mchitale@ventanamicro.com> References: <20250404144859.112313-1-mchitale@ventanamicro.com> MIME-Version: 1.0 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 Unlike ARM and X86, booting 32-bit images on 64-bit CPUs is currently not supported for Risc-V. Hence, for bootm, disallow booting a FIT or a legacy image that was built for an arch type which is different than the current arch and for booti, set the arch type to be the same as the current arch. Signed-off-by: Mayuresh Chitale Reviewed-by: Heinrich Schuchardt --- arch/riscv/lib/bootm.c | 4 ++++ cmd/booti.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 76c610bcee0..90f71bee6a5 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -94,6 +94,10 @@ static void boot_jump_linux(struct bootm_headers *images, int flag) announce_and_cleanup(fake); if (!fake) { + if (images->os.arch != IH_ARCH_DEFAULT) { + printf("Image arch not compatible with host arch.\n"); + hang(); + } if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) { #ifdef CONFIG_SMP ret = smp_call_function(images->ep, diff --git a/cmd/booti.c b/cmd/booti.c index 1a57fe91397..ced2c1047ab 100644 --- a/cmd/booti.c +++ b/cmd/booti.c @@ -130,8 +130,11 @@ int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) bootm_disable_interrupts(); images.os.os = IH_OS_LINUX; - if (IS_ENABLED(CONFIG_RISCV_SMODE)) - images.os.arch = IH_ARCH_RISCV; + if (IS_ENABLED(CONFIG_RISCV)) + if (IS_ENABLED(CONFIG_64BIT)) + images.os.arch = IH_ARCH_RISCV64; + else + images.os.arch = IH_ARCH_RISCV; else if (IS_ENABLED(CONFIG_ARM64)) images.os.arch = IH_ARCH_ARM64;