Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2220830/?format=api
{ "id": 2220830, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220830/?format=api", "web_url": "http://patchwork.ozlabs.org/project/opensbi/patch/20260408072123.7543-4-dave.patel@riscstar.com/", "project": { "id": 67, "url": "http://patchwork.ozlabs.org/api/1.1/projects/67/?format=api", "name": "OpenSBI development", "link_name": "opensbi", "list_id": "opensbi.lists.infradead.org", "list_email": "opensbi@lists.infradead.org", "web_url": "https://github.com/riscv/opensbi", "scm_url": "", "webscm_url": "" }, "msgid": "<20260408072123.7543-4-dave.patel@riscstar.com>", "date": "2026-04-08T07:21:23", "name": "[3/3] lib: sbi: domain FP/Vector context support for context switch", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "bfbd730c46422977c92541aa6c4889fee2d984b3", "submitter": { "id": 92617, "url": "http://patchwork.ozlabs.org/api/1.1/people/92617/?format=api", "name": "Dave Patel", "email": "dave.patel@riscstar.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/opensbi/patch/20260408072123.7543-4-dave.patel@riscstar.com/mbox/", "series": [ { "id": 499083, "url": "http://patchwork.ozlabs.org/api/1.1/series/499083/?format=api", "web_url": "http://patchwork.ozlabs.org/project/opensbi/list/?series=499083", "date": "2026-04-08T07:21:21", "name": "Add eager FP and RISC-V vector context switching support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499083/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220830/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220830/checks/", "tags": {}, "headers": { "Return-Path": "\n <opensbi-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=ja1awKva;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=riscstar-com.20251104.gappssmtp.com\n header.i=@riscstar-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=j7gXJiy5;\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=opensbi-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 4frF004qsnz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 17:22:56 +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 1wANFU-00000008PpM-1hqH;\n\tWed, 08 Apr 2026 07:22:52 +0000", "from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wANFQ-00000008PmP-3hD1\n\tfor opensbi@lists.infradead.org;\n\tWed, 08 Apr 2026 07:22:50 +0000", "by mail-wm1-x32b.google.com with SMTP id\n 5b1f17b1804b1-488ba6366a7so23965855e9.0\n for <opensbi@lists.infradead.org>;\n Wed, 08 Apr 2026 00:22:48 -0700 (PDT)", "from Dev-EliteBook.Home (97e782b0.skybroadband.com.\n [151.231.130.176])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43d1e2c5419sm66188083f8f.11.2026.04.08.00.22.46\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 08 Apr 2026 00:22:46 -0700 (PDT)" ], "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:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=nRS/Bit5mmBB90HVEwVm9NUgXZlsniiS5TYHYol/1cI=; b=ja1awKva2f0qwo\n\tdomq80QiLLkawarnELamXJHGLktRPUyVMHkE/7l+OGOafOmkJvH4I4xTii9JfJ6KEybhGOzY9MyDf\n\tcCeiLIfOkWyN/oaB8V5urZp4rbzaHE2JLgaPO0RS+L7PS9+ubi9O8AtIusWW2dYsn6+6moe6NaZIQ\n\tYykEGyJkjEqGfWJUEG95sRrCP2x++SQM6xTmHCk+eqfd8A9u+TNcEGB+vHFZmjhFjVs5xK1Am6HuT\n\tg2e+M2VwgWcpNyzzgYJmj7pTcwT2GJOZZ09Ks3u1QIvQDlH4xPfJ/r3WJ9+7+DNf3pEMzz2xaUhSf\n\tE2XIb6rdv2ah4DB5BsLw==;", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=riscstar-com.20251104.gappssmtp.com; s=20251104; t=1775632967;\n x=1776237767; darn=lists.infradead.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=zCvcUnvQejUJ4kPxuKA4oq02jilNCVtJbVkINVNE4NA=;\n b=j7gXJiy5rdUmIn33cTNnw79//0vqZjD/YUyHylZOXf6t+/neYTZBpcFFe2ONXL/YIU\n U1e4164sYFwAevruwI8Tt+7wrqBEVHiEKHi/WDccWSIiQooU5tSqNJB8ViPLBXUZNY8B\n fcAONT40N0J5ipdIZykOKykn095EKLZhE/OI7nK+KiLLjFDgSe1LgWBStmBq5O2vymu4\n kMCf9JXNHIeiO25cJbuELIUjXMNxmLNNBO/YkhLeHHfqntsoWBx7eKD9gGuNXUa7Bleb\n Fs+grG7gMt+DugmYwqQb0uOoZa99NGIp4N7T1BQ5boejbhXtZhQ51PPINL2Wve4344k4\n m/QQ==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775632967; x=1776237767;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=zCvcUnvQejUJ4kPxuKA4oq02jilNCVtJbVkINVNE4NA=;\n b=dUUc1QlPi8jShusUt2rqNDCsUgLPzo3MF5vGuXN/mjwQ1wpP5Ukde0ora6Bi2Ow0dx\n XkTWGBQYAkI/lX+FTjcaWjqlQOEcjRB+h/1gksvcJXIt20bZF43jdj7hF17ofnHhuJib\n zlvhygrM8N0Q0j7DM5gDODabwKcHy/HjnM4XdBnrBljB8csisLeYuTPKGzvqkiYveU5e\n HT+DxqXV79QEbmnQk7nPHS+oEnTgg/1K5BtRHlS6l+BlLzKztNvDSpkad6Cp8CEiwNVx\n g1furFvLxoLaf2wEClcV0TDkYCd3TOBV4m9PnjU6MzVZ4mORMWxV0Ud4vuGvydsMjan2\n cbog==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCX0PUzJAFvC4YkKw53fLuxgrNVbTkPJ9Y0wvQnK9o+ZiM/vlPcpeSRkfyXkyhZt8gUCjmc5S8pC@lists.infradead.org", "X-Gm-Message-State": "AOJu0YyGFs/udYPLT/ddez816X1+ZcwbRylCk0YgnW6L/8NMQp2pE3O3\n\terr3fSAIxuHSI2sN7WGUPxCDM9SC5O3OYA+fizdzTVFNPyTCyxoqwJ8iexH2rakEOOQ=", "X-Gm-Gg": "AeBDiet/4d5WM3ZQjMB7HtCOAEys9CDBaJeobfEzq/zc4+4rRpfB7z4D4Fxurby1EmU\n\t940Z52bFfohdGy8sJyZKQ6FFh6m7EMEhmy6BDR2p1D53Ns0ssNtiOp+DCMeg0ZNoVSCU4E3FtCc\n\tUSgexWbVpgF5Zw0JO7QyhzrMKrXLbJZZw31//zViEILolZ6fP+XSrxz5xpmZO0gx43ZPYhEwiRP\n\t7ny6QFpWfQLcR5HKWb+un4W7GGLlCNScWvl8jv9NuGI4kjMFJx2AdOCaSj7pq7smSsfP0WUwFz5\n\tMEVmMOaJyJruheKjQmnFhyE5dZa277du5LZ+8Z7kpMKR8f+s44gZpzxs1TShAHkhnQDSL8iohSn\n\tHJWXcpDjitG27AQc2FBKxvMxDn0l9JXFGHzVxSfidN0eTg5GFomUuFK8ZYXSuf4PnDG9h9Yq/Fa\n\thqh1UhR4isEj38/qOZfVVrajNIxwhWK/iNVDxHKucVT6dF+69IvIMUHOghjcc53iCiqp8=", "X-Received": "by 2002:a05:6000:2303:b0:43c:fb9f:150c with SMTP id\n ffacd0b85a97d-43d292ecccbmr27941419f8f.43.1775632967033;\n Wed, 08 Apr 2026 00:22:47 -0700 (PDT)", "From": "dave.patel@riscstar.com", "To": "Samuel Holland <samuel.holland@sifive.com>", "Cc": "Scott Bambrough <scott@riscstar.com>,\n\tRobin Randhawa <robin.randhawa@sifive.com>,\n\tAnup Patel <anup.patel@qti.qualcomm.com>,\n\tDave Patel <dave.patel@riscstar.com>,\n\tRay Mao <raymond.mao@riscstar.com>,\n\tAnup Patel <anuppate@qti.qualcomm.com>,\n\tDhaval <dhaval@rivosinc.com>,\n\tPeter Lin <peter.lin@sifive.com>,\n\topensbi@lists.infradead.org,\n\tradim.krcmar@oss.qualcomm.com", "Subject": "[PATCH 3/3] lib: sbi: domain FP/Vector context support for context\n switch", "Date": "Wed, 8 Apr 2026 08:21:23 +0100", "Message-ID": "<20260408072123.7543-4-dave.patel@riscstar.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260408072123.7543-1-dave.patel@riscstar.com>", "References": "<20260408072123.7543-1-dave.patel@riscstar.com>", "MIME-Version": "1.0", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20260408_002248_946193_BFF84215 ", "X-CRM114-Status": "GOOD ( 14.30 )", "X-Spam-Score": "-1.9 (-)", "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: Dave Patel <dave.patel@riscstar.com> This patch adds\n proper support for per-domain floating-point (FP) and vector (V) contexts\n in the domain context switch logic. Each domain now maintains its own FP\n and vector state, which is saved and [...]\n Content analysis details: (-1.9 points, 5.0 required)\n pts rule name description\n ---- ----------------------\n --------------------------------------------------\n -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no\n trust\n [2a00:1450:4864:20:0:0:0:32b listed in]\n [list.dnswl.org]\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_SIGNED Message has a DKIM or DK signature,\n not necessarily valid\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]", "X-BeenThere": "opensbi@lists.infradead.org", "X-Mailman-Version": "2.1.34", "Precedence": "list", "List-Id": "<opensbi.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/opensbi/>", "List-Post": "<mailto:opensbi@lists.infradead.org>", "List-Help": "<mailto:opensbi-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"opensbi\" <opensbi-bounces@lists.infradead.org>", "Errors-To": "opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "From: Dave Patel <dave.patel@riscstar.com>\n\nThis patch adds proper support for per-domain floating-point (FP) and\nvector (V) contexts in the domain context switch logic. Each domain\nnow maintains its own FP and vector state, which is saved and restored\nduring domain switches.\n\nChanges include:\n\n- Added `fp_ctx` and `vec_ctx` members to `struct sbi_domain`.\n- Introduced `sbi_vector_domain_init` for vlen check\n to allocate and free per-domain FP and vector context.\n- Modified `sbi_domain_register()` to initialize FP/Vector context per domain.\n- Updated `switch_to_next_domain_context()` to save/restore FP and vector\n contexts safely:\n - Ensures FS/VS fields in `mstatus` are enabled (set to Initial) only if Off.\n- Added runtime checks for FP and vector extensions where needed.\n\nThis improves support for multi-domain systems with FP and Vector\nextensions, and prevents corruption of FP/Vector state during domain\nswitches.\n\nSigned-off-by: Dave Patel <dave.patel@riscstar.com>\n---\n include/sbi/sbi_domain.h | 6 ++++++\n lib/sbi/sbi_domain.c | 6 ++++++\n lib/sbi/sbi_domain_context.c | 12 ++++++++++++\n 3 files changed, 24 insertions(+)", "diff": "diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h\nindex 882b62c2..318d3a9a 100644\n--- a/include/sbi/sbi_domain.h\n+++ b/include/sbi/sbi_domain.h\n@@ -16,6 +16,8 @@\n #include <sbi/sbi_hartmask.h>\n #include <sbi/sbi_domain_context.h>\n #include <sbi/sbi_domain_data.h>\n+#include <sbi/sbi_vector.h>\n+#include <sbi/sbi_fp.h>\n \n struct sbi_scratch;\n \n@@ -217,6 +219,10 @@ struct sbi_domain {\n \tbool fw_region_inited;\n \t/** per-domain wired-IRQ courier state */\n \tvoid *virq_priv;\n+\t/** per-domain float context state */\n+\tstruct sbi_fp_context fp_ctx;\n+\t/** per-domain vector context state */\n+\tstruct sbi_vector_context vec_ctx;\n };\n \n /** The root domain instance */\ndiff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c\nindex 498a1d56..424204eb 100644\n--- a/lib/sbi/sbi_domain.c\n+++ b/lib/sbi/sbi_domain.c\n@@ -19,6 +19,8 @@\n #include <sbi/sbi_scratch.h>\n #include <sbi/sbi_string.h>\n #include <sbi/sbi_virq.h>\n+#include <sbi/sbi_vector.h>\n+#include <sbi/sbi_fp.h>\n \n SBI_LIST_HEAD(domain_list);\n \n@@ -1007,6 +1009,10 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid)\n \tif (rc)\n \t\tgoto fail_free_root_hmask;\n \n+\trc = sbi_vector_domain_init();\n+\tif (rc)\n+\t\tgoto fail_free_root_hmask;\n+\n \treturn 0;\n \n fail_free_root_hmask:\ndiff --git a/lib/sbi/sbi_domain_context.c b/lib/sbi/sbi_domain_context.c\nindex 158f4990..f646c7d4 100644\n--- a/lib/sbi/sbi_domain_context.c\n+++ b/lib/sbi/sbi_domain_context.c\n@@ -18,6 +18,9 @@\n #include <sbi/sbi_domain_context.h>\n #include <sbi/sbi_platform.h>\n #include <sbi/sbi_trap.h>\n+#include <sbi/sbi_vector.h>\n+#include <sbi/sbi_fp.h>\n+\n \n /** Context representation for a hart within a domain */\n struct hart_context {\n@@ -143,6 +146,15 @@ static int switch_to_next_domain_context(struct hart_context *ctx,\n \tif (sbi_hart_has_extension(scratch, SBI_HART_EXT_SSQOSID))\n \t\tctx->srmcfg\t= csr_swap(CSR_SRMCFG, dom_ctx->srmcfg);\n \n+\t/* Make sure FS and VS is on before context switch */\n+\tcsr_set(CSR_MSTATUS, MSTATUS_FS | MSTATUS_VS);\n+\n+\t/* Eager context switch F and V */\n+\tsbi_fp_save(¤t_dom->fp_ctx);\n+\tsbi_fp_restore(&target_dom->fp_ctx);\n+\tsbi_vector_save(¤t_dom->vec_ctx);\n+\tsbi_vector_restore(&target_dom->vec_ctx);\n+\n \t/* Save current trap state and restore target domain's trap state */\n \ttrap_ctx = sbi_trap_get_context(scratch);\n \tsbi_memcpy(&ctx->trap_ctx, trap_ctx, sizeof(*trap_ctx));\n", "prefixes": [ "3/3" ] }