Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2220794/?format=api
{ "id": 2220794, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220794/?format=api", "web_url": "http://patchwork.ozlabs.org/project/kvm-riscv/patch/20260407-riscv_insn_table-v1-15-54b4736a1e77@gmail.com/", "project": { "id": 70, "url": "http://patchwork.ozlabs.org/api/1.1/projects/70/?format=api", "name": "Linux KVM RISC-V", "link_name": "kvm-riscv", "list_id": "kvm-riscv.lists.infradead.org", "list_email": "kvm-riscv@lists.infradead.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260407-riscv_insn_table-v1-15-54b4736a1e77@gmail.com>", "date": "2026-04-08T04:46:03", "name": "[15/16] riscv: kexec: Use generated instruction headers for kexec relocations", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c0335f6a37501a8bcb79c38732db6901e9a41640", "submitter": { "id": 92521, "url": "http://patchwork.ozlabs.org/api/1.1/people/92521/?format=api", "name": "Charlie Jenkins via B4 Relay", "email": "devnull+thecharlesjenkins.gmail.com@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/kvm-riscv/patch/20260407-riscv_insn_table-v1-15-54b4736a1e77@gmail.com/mbox/", "series": [ { "id": 499063, "url": "http://patchwork.ozlabs.org/api/1.1/series/499063/?format=api", "web_url": "http://patchwork.ozlabs.org/project/kvm-riscv/list/?series=499063", "date": "2026-04-08T04:45:48", "name": "riscv: Generate riscv instruction functions", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499063/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220794/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220794/checks/", "tags": {}, "headers": { "Return-Path": "\n <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hhdOKbUK;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=IEe3IZuc;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fr9X12Sm2z1yDG\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 14:46:57 +1000 (AEST)", "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wAKoW-00000008Eu9-32nh;\n\tWed, 08 Apr 2026 04:46:52 +0000", "from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wAKoL-00000008Ee2-0bSB;\n\tWed, 08 Apr 2026 04:46:44 +0000", "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby sea.source.kernel.org (Postfix) with ESMTP id 068A9445A5;\n\tWed, 8 Apr 2026 04:46:38 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPS id DA4D7C19425;\n\tWed, 8 Apr 2026 04:46:37 +0000 (UTC)", "from aws-us-west-2-korg-lkml-1.web.codeaurora.org\n (localhost.localdomain [127.0.0.1])\n\tby smtp.lore.kernel.org (Postfix) with ESMTP id D221BFD5F70;\n\tWed, 8 Apr 2026 04:46:37 +0000 (UTC)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help:\n\tList-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:\n\tMessage-Id:MIME-Version:Subject:Date:From:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=ZpJ11wQs/gbOypTUPnMvAGdM9xCE1RVc813DaIQn534=; b=hhdOKbUKwBlQ84\n\t7El3YSBwpxQmu2P+DPD0kaqmvg1xyTEuEY+9agoQMns8mEd6Gz6wkh/mK07z+MqcpMPZ+Bbl0spSV\n\tiji34+87CVvo3ef9JB7oRNbBoB2T8K6aNqcqu6pmIYzYr+Tq0O8ZVzCWldto2pmoSSeNbZ0sTQJsT\n\tITXZypR+eBHKnvFOc8Pt0xQNjBqQdhiz1DrxYUhmj+c6BoDbzd43FdtIIr5egByjjgsGeo0a+vvrW\n\tr9S+qw/0bZDONBFFeiNF/8wFCKQcPH3Yzd49PRe+QBZnjeCpfLPuQXjH+7Y0+3VZ3ExlFclFj0iOZ\n\t9TC9yXvi1pp+Si1QHH3w==;", "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775623597;\n\tbh=yXr1OY92hmXeh6OBXzipzOIC3tW8ebE9lewtd1G8Asg=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From;\n\tb=IEe3IZucW+mH7x+/+qXU5BOd4Xtt0LjVls4UbN1L+MNxGxkLWtP0ZAI10B6tR1bxx\n\t X5vhBbzP0iyoC+HWbP3ODtFU5sDJ6FsLK1lCZnrZbAj9JtvqcweiCOaTacJ9Xb39K7\n\t D+qOgWfpD8PQZslSTUth0kSZKvKwbrHLxLk0FRY61RT8Fyf3n3pyDiFAUTYZjcsxiO\n\t pmbaaUSdIReEr9sWs0gJNyuX52zSBFzHUm3wbe2qmdvDnyinve/7CPushabq8zpN0K\n\t q1nZ91+zcT4LJh+XTKW7Yi+2Ysm0w/vL4fedVSPq+tI2FAyAS0rfa7sPAcvl+NaV/p\n\t 24vrK9P6yzHTg==" ], "From": "Charlie Jenkins via B4 Relay\n <devnull+thecharlesjenkins.gmail.com@kernel.org>", "Date": "Tue, 07 Apr 2026 21:46:03 -0700", "Subject": "[PATCH 15/16] riscv: kexec: Use generated instruction headers for\n kexec relocations", "MIME-Version": "1.0", "Message-Id": "<20260407-riscv_insn_table-v1-15-54b4736a1e77@gmail.com>", "References": "<20260407-riscv_insn_table-v1-0-54b4736a1e77@gmail.com>", "In-Reply-To": "<20260407-riscv_insn_table-v1-0-54b4736a1e77@gmail.com>", "To": "Paul Walmsley <pjw@kernel.org>, Palmer Dabbelt <palmer@dabbelt.com>,\n Alexandre Ghiti <alex@ghiti.fr>, Anup Patel <anup@brainfault.org>,\n Atish Patra <atish.patra@linux.dev>, Conor Dooley <conor@kernel.org>,\n Paolo Bonzini <pbonzini@redhat.com>,\n Andrew Morton <akpm@linux-foundation.org>, Shuah Khan <shuah@kernel.org>", "Cc": "linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,\n kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,\n linux-kselftest@vger.kernel.org,\n Charlie Jenkins <thecharlesjenkins@gmail.com>", "X-Mailer": "b4 0.14.3", "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1775623594; l=3956;\n i=thecharlesjenkins@gmail.com; s=2026030; h=from:subject:message-id;\n bh=xqRUM2JXf85Zh+yqhrsAE1KnYguobicrPYwOKvSMf/k=;\n b=Ef2tD17dwpijvmUL+uh6TImx+ecanapQBRBXbjhUAKTd2GhdfKsfY8jVUeaMjLf3X/3erSF2N\n bU8wdXu4+FNBrd+qiU4tZikYJWOGjQV5cCiWonrBy+azbODZa+V23Ag", "X-Developer-Key": "i=thecharlesjenkins@gmail.com; a=ed25519;\n pk=vpF2USrG+aB6CTbSt34rzJKsAVe/l+GAXo1IomCMETk=", "X-Endpoint-Received": "by B4 Relay for thecharlesjenkins@gmail.com/2026030\n with auth_id=663", "X-Original-From": "Charlie Jenkins <thecharlesjenkins@gmail.com>", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20260407_214641_273382_686E646E ", "X-CRM114-Status": "GOOD ( 10.44 )", "X-Spam-Score": "-0.0 (/)", "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam. The original\n message has been attached to this so you can view it or label\n similar future email. If you have any questions, see\n the administrator of that system for details.\n Content preview: From: Charlie Jenkins Migrate the kexec relocation code to\n use the generated instruction headers instead of the hand-written\n instruction\n composition functions. Signed-off-by: Charlie Jenkins\n Content analysis details: (-0.0 points, 5.0 required)\n pts rule name description\n ---- ----------------------\n --------------------------------------------------\n -0.0 SPF_PASS SPF: sender matches SPF record\n 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record\n -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from\n envelope-from domain\n 0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n author's\n domain\n -0.1 DKIM_VALID Message has at least one valid DKIM or DK\n signature\n -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n [score: 0.0000]\n 2.1 FREEMAIL_FORGED_REPLYTO Freemail in Reply-To, but not From", "X-BeenThere": "kvm-riscv@lists.infradead.org", "X-Mailman-Version": "2.1.34", "Precedence": "list", "List-Id": "<kvm-riscv.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/kvm-riscv/>", "List-Post": "<mailto:kvm-riscv@lists.infradead.org>", "List-Help": "<mailto:kvm-riscv-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe>", "Reply-To": "thecharlesjenkins@gmail.com", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"kvm-riscv\" <kvm-riscv-bounces@lists.infradead.org>", "Errors-To": "kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "From: Charlie Jenkins <thecharlesjenkins@gmail.com>\n\nMigrate the kexec relocation code to use the generated instruction\nheaders instead of the hand-written instruction composition functions.\n\nSigned-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>\n\n---\n\nThis was again tested by brute forcing all possible inputs to the value\nfed into the immediates.\n---\n arch/riscv/kernel/machine_kexec_file.c | 55 ++++++++++++----------------------\n 1 file changed, 19 insertions(+), 36 deletions(-)", "diff": "diff --git a/arch/riscv/kernel/machine_kexec_file.c b/arch/riscv/kernel/machine_kexec_file.c\nindex dd9d92a96517..1d58aafea232 100644\n--- a/arch/riscv/kernel/machine_kexec_file.c\n+++ b/arch/riscv/kernel/machine_kexec_file.c\n@@ -116,32 +116,6 @@ static char *setup_kdump_cmdline(struct kimage *image, char *cmdline,\n \t(((x) + (RISCV_IMM_REACH >> 1)) & ~(RISCV_IMM_REACH - 1))\n #define RISCV_CONST_LOW_PART(x) ((x) - RISCV_CONST_HIGH_PART(x))\n \n-#define ENCODE_ITYPE_IMM(x) \\\n-\t(RV_X(x, 0, 12) << 20)\n-#define ENCODE_BTYPE_IMM(x) \\\n-\t((RV_X(x, 1, 4) << 8) | (RV_X(x, 5, 6) << 25) | \\\n-\t(RV_X(x, 11, 1) << 7) | (RV_X(x, 12, 1) << 31))\n-#define ENCODE_UTYPE_IMM(x) \\\n-\t(RV_X(x, 12, 20) << 12)\n-#define ENCODE_JTYPE_IMM(x) \\\n-\t((RV_X(x, 1, 10) << 21) | (RV_X(x, 11, 1) << 20) | \\\n-\t(RV_X(x, 12, 8) << 12) | (RV_X(x, 20, 1) << 31))\n-#define ENCODE_CBTYPE_IMM(x) \\\n-\t((RV_X(x, 1, 2) << 3) | (RV_X(x, 3, 2) << 10) | (RV_X(x, 5, 1) << 2) | \\\n-\t(RV_X(x, 6, 2) << 5) | (RV_X(x, 8, 1) << 12))\n-#define ENCODE_CJTYPE_IMM(x) \\\n-\t((RV_X(x, 1, 3) << 3) | (RV_X(x, 4, 1) << 11) | (RV_X(x, 5, 1) << 2) | \\\n-\t(RV_X(x, 6, 1) << 7) | (RV_X(x, 7, 1) << 6) | (RV_X(x, 8, 2) << 9) | \\\n-\t(RV_X(x, 10, 1) << 8) | (RV_X(x, 11, 1) << 12))\n-#define ENCODE_UJTYPE_IMM(x) \\\n-\t(ENCODE_UTYPE_IMM(RISCV_CONST_HIGH_PART(x)) | \\\n-\t(ENCODE_ITYPE_IMM(RISCV_CONST_LOW_PART(x)) << 32))\n-#define ENCODE_UITYPE_IMM(x) \\\n-\t(ENCODE_UTYPE_IMM(x) | (ENCODE_ITYPE_IMM(x) << 32))\n-\n-#define CLEAN_IMM(type, x) \\\n-\t((~ENCODE_##type##_IMM((uint64_t)(-1))) & (x))\n-\n int arch_kexec_apply_relocations_add(struct purgatory_info *pi,\n \t\t\t\t Elf_Shdr *section,\n \t\t\t\t const Elf_Shdr *relsec,\n@@ -197,12 +171,14 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,\n \n \t\tswitch (r_type) {\n \t\tcase R_RISCV_BRANCH:\n-\t\t\t*(u32 *)loc = CLEAN_IMM(BTYPE, *(u32 *)loc) |\n-\t\t\t\t ENCODE_BTYPE_IMM(val - addr);\n+\t\t\t/*\n+\t\t\t * For simplicity, use beq as represenative of all\n+\t\t\t * branches (they all have the same imm encoding)\n+\t\t\t */\n+\t\t\triscv_insn_beq_insert_imm((u32 *)loc, val - addr);\n \t\t\tbreak;\n \t\tcase R_RISCV_JAL:\n-\t\t\t*(u32 *)loc = CLEAN_IMM(JTYPE, *(u32 *)loc) |\n-\t\t\t\t ENCODE_JTYPE_IMM(val - addr);\n+\t\t\triscv_insn_jal_insert_imm((u32 *)loc, val - addr);\n \t\t\tbreak;\n \t\t/*\n \t\t * With no R_RISCV_PCREL_LO12_S, R_RISCV_PCREL_LO12_I\n@@ -213,16 +189,23 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,\n \t\tcase R_RISCV_PCREL_HI20:\n \t\tcase R_RISCV_CALL_PLT:\n \t\tcase R_RISCV_CALL:\n-\t\t\t*(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) |\n-\t\t\t\t ENCODE_UJTYPE_IMM(val - addr);\n+\t\t\triscv_insn_auipc_insert_imm((u32 *)loc, RISCV_CONST_HIGH_PART(val - addr));\n+\t\t\triscv_insn_jalr_insert_imm((u32 *)loc + 1,\n+\t\t\t\t\t\t RISCV_CONST_LOW_PART(val - addr));\n \t\t\tbreak;\n \t\tcase R_RISCV_RVC_BRANCH:\n-\t\t\t*(u32 *)loc = CLEAN_IMM(CBTYPE, *(u32 *)loc) |\n-\t\t\t\t ENCODE_CBTYPE_IMM(val - addr);\n+\t\t\t/*\n+\t\t\t * For simplicity, use c.beqz as represenative of all\n+\t\t\t * compressed branches (they all have the same imm encoding)\n+\t\t\t */\n+\t\t\triscv_insn_c_beqz_insert_imm((u16 *)loc, val - addr);\n \t\t\tbreak;\n \t\tcase R_RISCV_RVC_JUMP:\n-\t\t\t*(u32 *)loc = CLEAN_IMM(CJTYPE, *(u32 *)loc) |\n-\t\t\t\t ENCODE_CJTYPE_IMM(val - addr);\n+\t\t\t/*\n+\t\t\t * For simplicity, use c.j as represenative of all\n+\t\t\t * compressed jumps (they all have the same imm encoding)\n+\t\t\t */\n+\t\t\triscv_insn_c_j_insert_imm((u16 *)loc, val - addr);\n \t\t\tbreak;\n \t\tcase R_RISCV_ADD16:\n \t\t\t*(u16 *)loc += val;\n", "prefixes": [ "15/16" ] }