From nobody Tue Dec 30 08:10:37 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57350C072A2 for ; Fri, 17 Nov 2023 20:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232203AbjKQUBV (ORCPT ); Fri, 17 Nov 2023 15:01:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbjKQUBS (ORCPT ); Fri, 17 Nov 2023 15:01:18 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 247FDD6A for ; Fri, 17 Nov 2023 12:01:13 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1cc1e1e74beso21240245ad.1 for ; Fri, 17 Nov 2023 12:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1700251272; x=1700856072; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eFY9yyw+/EAdIRUxdIlmPfWs3oHbG4Tu++kYGInr8MQ=; b=bzFeIzWMPm+/0dMozHI/Kobn4mCLpm09WvAAi72Dj+KYJFOl2rSt1TvrhinPx00785 h3BTFvsLrfQ3USlKgzj5HXJ0R6eWLcyrvKyhmMhvgDlBU4+CNIrmBb3tXCt5PQsOpU8f t6I0OW2wBJHWmo4+KkZlct4Hl94HJT57ZLITdL6Hrb9qIjY0VBK5iA0X0rfrlSb2Us94 NsZcX+nNbUvp0ieMVFyy9FMImvvR5WrygHlckbny4FQvcAWVM01Ejm6PW6FJGviEptJr uIt4Zdv0Vx4D7/2ZzKLvrBrrGiBmT8MRB6BCYGHxxOjZrVGHnMGxu9ylqdBUVNf5RSW0 sFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700251272; x=1700856072; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eFY9yyw+/EAdIRUxdIlmPfWs3oHbG4Tu++kYGInr8MQ=; b=pPmybbYSH2Q6+F2N73NdTzxcYcF/2coSfCJjihbv16cqq1lEU2GHyY4123gveTIm3f KK8EDmvYp4lqlmdsO4fvylIzT5xkNYabaO0/wUUWR2ECVu5z7wcRQLqT0XHZYFBNSc72 IjpSoDlVnrlirBXfXhk1f/4lYoIY7DVhfCIfZjtoWWH7RjiqzR3xJ9WERuqF0s3BHbg6 hU2bNjqGbC1FeF2YspqLzfRvRd2lLYy6Ec7ZgdjvZZF6pLg8ZQXJ9cb3qBxx1tjGdWFl aVMcQy1G7tAwv5gmtMglSHDUtHBHJEaSPtUu1sMyFIAlkKATFXUPktthKcXhc9XdmD+J J3zg== X-Gm-Message-State: AOJu0Yz1zgO28xaw5x3iTlRrxhI6/f8Pu/Md6y3l16psc/YdqpY+aGf4 IAVeLcvHiJPBhepkwWZ3ihWnnQ== X-Google-Smtp-Source: AGHT+IEZETbP2T/dkEnvQJyicMa++aA+ZLyZ7dyLJO2+XFAKGQHurPfaAZ0f+yK0ANeWCP6Zuh/+bQ== X-Received: by 2002:a17:902:9687:b0:1cc:431f:55e6 with SMTP id n7-20020a170902968700b001cc431f55e6mr543932plp.63.1700251272659; Fri, 17 Nov 2023 12:01:12 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id bf1-20020a170902b90100b001b53953f306sm1749737plb.178.2023.11.17.12.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 12:01:11 -0800 (PST) From: Charlie Jenkins Date: Fri, 17 Nov 2023 11:56:11 -0800 Subject: [PATCH 1/2] Support rv32 ULEB128 test MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231117-module_fixup-v1-1-62bb777f6825@rivosinc.com> References: <20231117-module_fixup-v1-0-62bb777f6825@rivosinc.com> In-Reply-To: <20231117-module_fixup-v1-0-62bb777f6825@rivosinc.com> To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Randy Dunlap Cc: Palmer Dabbelt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use opcodes available to both rv32 and rv64 in uleb128 module linking test. Fixes: af71bc194916 ("riscv: Add tests for riscv module loading") Signed-off-by: Charlie Jenkins Reported-by: Randy Dunlap Tested-by: Randy Dunlap # build-tested --- arch/riscv/kernel/tests/module_test/test_uleb128.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/riscv/kernel/tests/module_test/test_uleb128.S b/arch/risc= v/kernel/tests/module_test/test_uleb128.S index 90f22049d553..8515ed7cd8c1 100644 --- a/arch/riscv/kernel/tests/module_test/test_uleb128.S +++ b/arch/riscv/kernel/tests/module_test/test_uleb128.S @@ -6,13 +6,13 @@ .text .global test_uleb_basic test_uleb_basic: - ld a0, second + lw a0, second addi a0, a0, -127 ret =20 .global test_uleb_large test_uleb_large: - ld a0, fourth + lw a0, fourth addi a0, a0, -0x07e8 ret =20 @@ -22,10 +22,10 @@ first: second: .reloc second, R_RISCV_SET_ULEB128, second .reloc second, R_RISCV_SUB_ULEB128, first - .dword 0 + .word 0 third: .space 1000 fourth: .reloc fourth, R_RISCV_SET_ULEB128, fourth .reloc fourth, R_RISCV_SUB_ULEB128, third - .dword 0 + .word 0 --=20 2.34.1 From nobody Tue Dec 30 08:10:37 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90803C5ACB3 for ; Fri, 17 Nov 2023 20:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231757AbjKQUBX (ORCPT ); Fri, 17 Nov 2023 15:01:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjKQUBS (ORCPT ); Fri, 17 Nov 2023 15:01:18 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F017AD for ; Fri, 17 Nov 2023 12:01:14 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1ce618b7919so5934275ad.0 for ; Fri, 17 Nov 2023 12:01:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1700251274; x=1700856074; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PagaqPISiFMUN5ZfGlzy9E8bahGMoCf4MLBDz6dwo3U=; b=qrEa9VIkFCMc8UBv7aN8NJGTiooZ3UXuqTzX9IXIH9ecQaAlMXRgmud2bwOJ5autrh bGI6CsxP5fGAs62q462ClRCpxepC24dE7VSLqKg8YOO8FdcfTcn2y7AWfyXFlrXbR/Ge aCNLa3zRDr/xs03Qhp+AdBZBDo2VF54PzuUVKAaRgkJZK/Up06vcQdLFzVC/4sQv7AKY 2b58QpujQeY7AaIHJQH8F27596dG1cg7JUFKE7wONJNgJnfcPzYEKke/nPMh4O4t/oVF 9QyxexuSeulKwx1CfulQplwD/LYICJfeCv2P4JU8UhqvsvAOgY0acEiSzaTuOtrhR8wm QP2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700251274; x=1700856074; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PagaqPISiFMUN5ZfGlzy9E8bahGMoCf4MLBDz6dwo3U=; b=PhwrRHmDd6nsCqLncrMDbfG9pTJ3KwgBIhz6dxVipd5JvwpSUQugdtwDeqyKGLiY/p Vhp3euMF37SApmXO/0RwPWA5QpGKwovw9kKUskOztFQ9mmNExt0OCKBA5oOGOgZc1YKf hQKmwXP0kaCWKRTPCwJMsa6pNGx6CeBaKjWmaC87QKYaiR/bOE+v4OHgI6yTdFqc71xU dZl4hA2bZd9dnRz4kG/YCaAe3XK0AVWYmEo1axzTSqRVMaQT63xKUFz+G+EMG7lgD9t4 294Pq3bsiBrJ94KsqCV/5TdOzHZ2kELXLxfINObiRpqtfQA77glewTVjnPjRpSR6VRly ZEbw== X-Gm-Message-State: AOJu0YxLZj744PdIguIjfFmTpXu8+8iSDqDQlTI9Fall+7xgeZkOHFar l5O8MfINvNlo+bpPSCC3xC6U4A== X-Google-Smtp-Source: AGHT+IHWyullGhPD+gZObx6KM81Mz06irM+FIueUcekK/sxdqjmscsmQoE/71DHzli6umycW8VRUeg== X-Received: by 2002:a17:902:f684:b0:1c0:afda:7707 with SMTP id l4-20020a170902f68400b001c0afda7707mr127578plg.34.1700251273779; Fri, 17 Nov 2023 12:01:13 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id bf1-20020a170902b90100b001b53953f306sm1749737plb.178.2023.11.17.12.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 12:01:13 -0800 (PST) From: Charlie Jenkins Date: Fri, 17 Nov 2023 11:56:12 -0800 Subject: [PATCH 2/2] Correct type casting in module loading MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231117-module_fixup-v1-2-62bb777f6825@rivosinc.com> References: <20231117-module_fixup-v1-0-62bb777f6825@rivosinc.com> In-Reply-To: <20231117-module_fixup-v1-0-62bb777f6825@rivosinc.com> To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Randy Dunlap Cc: Palmer Dabbelt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make static variables static and use __le16. Fixes: 8fd6c5142395 ("riscv: Add remaining module relocations") Signed-off-by: Charlie Jenkins Reviewed-by: Samuel Holland Tested-by: Samuel Holland --- arch/riscv/kernel/module.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 56a8c78e9e21..9f2dc2c0e436 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -45,9 +45,9 @@ void process_accumulated_relocations(struct module *me); int add_relocation_to_accumulate(struct module *me, int type, void *locati= on, unsigned int hashtable_bits, Elf_Addr v); =20 -struct hlist_head *relocation_hashtable; +static struct hlist_head *relocation_hashtable; =20 -struct list_head used_buckets_list; +static struct list_head used_buckets_list; =20 /* * The auipc+jalr instruction pair can reach any PC-relative offset @@ -64,7 +64,7 @@ static bool riscv_insn_valid_32bit_offset(ptrdiff_t val) =20 static int riscv_insn_rmw(void *location, u32 keep, u32 set) { - u16 *parcel =3D location; + __le16 *parcel =3D location; u32 insn =3D (u32)le16_to_cpu(parcel[0]) | (u32)le16_to_cpu(parcel[1]) <<= 16; =20 insn &=3D keep; @@ -77,7 +77,7 @@ static int riscv_insn_rmw(void *location, u32 keep, u32 s= et) =20 static int riscv_insn_rvc_rmw(void *location, u16 keep, u16 set) { - u16 *parcel =3D location; + __le16 *parcel =3D location; u16 insn =3D le16_to_cpu(*parcel); =20 insn &=3D keep; --=20 2.34.1