From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D182F21FF28 for ; Fri, 20 Jun 2025 20:22:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750450934; cv=none; b=E28Hq11WGUON5kf+ui2RhhuvjFpoOzSD5CotlvuZuCByuTmyDG66OliN8ZUgnReciu/WzjZrxVjHp4ecoopePje6+9rboYuWeJpLgn2ROHqF29NqvZ8QynHzpA30zTqIFollPO9wQH3nYI1YgT4DSDzuIoG24BflQg1jRgJAhe0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750450934; c=relaxed/simple; bh=zNnEbdShfnt7dg6Wnhs4FrAsA8snzs7PQOci4sCR+Cw=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=UhrdPnNT6dDKMGXz83AXpNme08ueUMQvEFNDUkd4MS86X/hEzbLAiytaTuK67Es4qePyjF4LF0pSsuA4hC2v36TRhKkoY1UuH0IqM5zGQLW46Tz6Aj82wBgpd5O83EJ8MoxCjlRzOq2bNK9GAqvCBLARKb5ILRAfRVQasR0Y0Gc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=wz6jXaMt; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="wz6jXaMt" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2353a2bc210so20501335ad.2 for ; Fri, 20 Jun 2025 13:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1750450932; x=1751055732; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=zR93x1w6dXrRMkMadRB1UTNlrKc0W0v3FGDIv1ERUx4=; b=wz6jXaMtkTctUGKPZhVGymmCUm9FRFeXkZf1glEuZ4AlRHUMZ/HtTiAcdjkrlOZ2MC stN59+AYKHwHqnlXUKkhcIwICHuuahgGus//GX+wfD8UXF/dd8kSwEN3vkQXUk77E5ix QjHxQNcwFC7tCERxKm7uAWvAwhw+fAPhp5Ivb3P10AqONPatlZNL9Fms6lszoSDe81DV ef69Qm5ONZys8rMg1IOGbgsWb31bX+DOn/k/u4iWkXrKjTQGJz3UkF3xS0xGMcUpWEMi JLPdzPGdir6VU0IEV2aWVBV27+WnHB1uwqcIEutH4KsgYvfc79tsw/29MybrFYkm8GRO boWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750450932; x=1751055732; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zR93x1w6dXrRMkMadRB1UTNlrKc0W0v3FGDIv1ERUx4=; b=NpJff1zpJY3mWYjLW21Pv3pdfIKNKN9VUGaF9U9wIWzQC+GMGT2RRe6AogcFDIadAA gHWYajD9ba0JHPuUnftWltj7p43yhAT5l+cl8mJCrxQxZRU4h7O2R7h6oam7B1vje/KJ 9CEDGWX2Iuh7ZRF9eElaturQzBgWVERgBseZotSUAe+9r8QTBTqNp6v1xePW4I1JL0dX RdVL3nhzriCYlZdOgofdNG3YHpE23Brpaya4HqTtyVFWFf81KjUK5aIewMD8t8q/6Pfh finmTmn+X09fGUVHk+PAiZLa4MHND/8DTpQ2KBuEPmE6q0yxQBmc98gFGBXT1wE7hird AMZA== X-Forwarded-Encrypted: i=1; AJvYcCVdfx9vRCl1VT8KNznVvxZkaM7OOB9IgB1U5osf9FFD06jw9asbka91VKOPJjTSBO1jisjF+9S+MEb8SB8=@vger.kernel.org X-Gm-Message-State: AOJu0YywbWoz8Q5cPcN4hr5gsCZSebHgOKmXNQqVnj4DArz+FEoDQIOi lDxa9ODhPj7nrQ/uKuRGhRklEO4S47Mymf5rG9Lcp+xrS5C6kt7bz4EsFWcHtNcrE8A= X-Gm-Gg: ASbGncuC5Ud6xJi7j/hyBoeTT4v4k7X+oDgRImr8bzvQvxSE49CUhuEEB7YuQnLL3xk fUfcne7epyV2N8+MCiJ8iSDVKMi3yTkxP0msiNPYqT3+F5opLBGuAujwghwZmKzSTgxKhFxtpkX 1MfFwtI6r/fs5bQDUMJBAgSlsvuKE1S/D3SFuB6L5pA6aGxn30v5+z5L+SRf0LT3dl8cbAeYKHx wmokWIw1m8syMr9XktUfE+IAbcNpNW9Wi/9kQAFNBMrTxsCcOxcr+jCTb3sM59CejBU43yr8uSH vQ4aWcwbjZCvuMBIimLisZ3wAYBprIH5Z/HF8YpbLO0dIEkyLgZ1dFyqB1OyLL3W2jybJ3afNx2 ZcKadyBzvaWUEoP7rb+8P8qc2eVKDjH/g6g== X-Google-Smtp-Source: AGHT+IGMjAKS+ZR6xDwRzLnhzjJTUfYEfrwovg8rbA1ebQN5xfuztY8xY8dqTmR5sIFHBMzmyc1fcA== X-Received: by 2002:a17:903:3bc4:b0:224:10a2:cae7 with SMTP id d9443c01a7336-237d9981dc9mr67398695ad.40.1750450932143; Fri, 20 Jun 2025 13:22:12 -0700 (PDT) Received: from alexghiti.eu.rivosinc.com (alexghiti.eu.rivosinc.com. [141.95.202.232]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-237d860fb58sm24239005ad.99.2025.06.20.13.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jun 2025 13:22:11 -0700 (PDT) From: Alexandre Ghiti Subject: [PATCH v5 0/3] Move duplicated instructions macros into asm/insn.h Date: Fri, 20 Jun 2025 20:21:56 +0000 Message-Id: <20250620-dev-alex-insn_duplicate_v5_manual-v5-0-d865dc9ad180@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIAOTCVWgC/x3N0QrCMAxA0V8ZeTbQZVTQXxEpsc00UONoXRmM/ bvFx/Ny7w5VikqF67BDkaZVP9bhTwPEF9tTUFM3kCPvzuQwSUPOsqFatZDWJWvkr4Tmw5tt5Yw UaRovY5zc/IDeWYrMuv0ft/tx/ADolUImcwAAAA== X-Change-ID: 20250620-dev-alex-insn_duplicate_v5_manual-2c23191c30fb To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Atish Patra Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Alexandre Ghiti , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Jones X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1777; i=alexghiti@rivosinc.com; h=from:subject:message-id; bh=zNnEbdShfnt7dg6Wnhs4FrAsA8snzs7PQOci4sCR+Cw=; b=owGbwMvMwCGWYr9pz6TW912Mp9WSGDJCD72P8Dn9w+tB9qn6mgksQSULDE+I5Uh+Cv1r/Vl9V zyHwHKNjlIWBjEOBlkxRRYF84SuFvuz9bP/XHoPM4eVCWQIAxenAExEO4Lhn2L99duffV9+4rU4 c++cq1De1m3/N17SqX9TLrJw5+2jH7wYGZYK1y25xpz/NbrjiP2VGt+AsASb1/PY1jKVBUxeHRu TyA4A X-Developer-Key: i=alexghiti@rivosinc.com; a=openpgp; fpr=DC049C97114ED82152FE79A783E4BA75438E93E3 The instructions parsing macros were duplicated and one of them had different implementations, which is error prone. So let's consolidate those macros in asm/insn.h. v1: https://lore.kernel.org/linux-riscv/20250422082545.450453-1-alexghiti@rivosinc.com/ v2: https://lore.kernel.org/linux-riscv/20250508082215.88658-1-alexghiti@rivosinc.com/ v3: https://lore.kernel.org/linux-riscv/20250508125202.108613-1-alexghiti@rivosinc.com/ v4: https://lore.kernel.org/linux-riscv/20250516140805.282770-1-alexghiti@rivosinc.com/ Changes in v5: - Rebase on top of 6.16-rc1 Changes in v4: - Rebase on top of for-next (on top of 6.15-rc6) Changes in v3: - Fix patch 2 which caused build failures (linux riscv bot), but the patchset is exactly the same as v2 Changes in v2: - Rebase on top of 6.15-rc5 - Add RB tags - Define RV_X() using RV_X_mask() (Clément) - Remove unused defines (Clément) - Fix tabulations (Drew) Signed-off-by: Alexandre Ghiti --- Alexandre Ghiti (3): riscv: Fix typo EXRACT -> EXTRACT riscv: Strengthen duplicate and inconsistent definition of RV_X() riscv: Move all duplicate insn parsing macros into asm/insn.h arch/riscv/include/asm/insn.h | 206 +++++++++++++++++++++++++++++---- arch/riscv/kernel/machine_kexec_file.c | 2 +- arch/riscv/kernel/traps_misaligned.c | 144 +---------------------- arch/riscv/kernel/vector.c | 2 +- arch/riscv/kvm/vcpu_insn.c | 128 +------------------- 5 files changed, 188 insertions(+), 294 deletions(-) --- base-commit: 731e998c429974cb141a049c1347a9cab444e44c change-id: 20250620-dev-alex-insn_duplicate_v5_manual-2c23191c30fb Best regards, -- Alexandre Ghiti