From 0abbe5d94151290f5de35007ba58da73501ba5d7 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Tue, 10 Nov 2026 01:27:20 -0400 Subject: [PATCH 1/2] amdxdna: carry the two actionable drm-misc-next-2026-10-16 fixes (0011, 0012) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the four accel/amdxdna changes in the drm-misc-next-2026-10-16 pull, two are already in our tree (fdinfo busy time, and the mailbox send path without GFP_KERNEL — see ~/briefs/TAMDXDNA-DRM-MISC-7.5.md §(a)), so what is missing is the pair below. Both are the upstream change unmodified, attributed. 0011 accel/amdxdna: document trusted mailbox ring geometry and drop the power-of-two check (5d7b464a4f5) xdna_mailbox_start_channel() refuses a channel whose firmware-supplied rb_size is not a power of two, turning a geometry AMD's signed firmware handed us into a channel that cannot start at all. 0012 accel/amdxdna: Reject device heap BO when dev_mem_size is not set (3e32932d362) a heap-BO request on a device with no heap hits a WARN_ON and a bogus alignment test instead of one quiet -EOPNOTSUPP. Carried, NOT installed: no /lib/modules change, no modprobe, no parameter touched. Neither has been measured on this box, and both rows say so rather than implying a shipped fix. Checked here, not asserted: each file is the upstream diff with the kernel tree's own paths (which are the xdna-driver paths too), and both `git apply --check` **on the bare pin 526c6081974e** and **on the result of 0001-0010**, so they are order-independent in the series. Applies-cleanly on both ends is also the reason they are separate files rather than folded into an earlier patch. Series effect: 0011 → amdxdna_mailbox.c, 0012 → amdxdna_gem.c, 12 files +289/-33 in total with our 0001-0010. Refs engine#1740-adjacent work? no: refs the drm-misc comparison in ~/briefs/TAMDXDNA-DRM-MISC-7.5.md §(f). --- ...-the-mailbox-ring-power-of-two-check.patch | 33 +++++++++++++++++++ ...-device-heap-BO-without-dev_mem_size.patch | 26 +++++++++++++++ third_party/patches/amdxdna/README.md | 2 ++ 3 files changed, 61 insertions(+) create mode 100644 third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch create mode 100644 third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch diff --git a/third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch b/third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch new file mode 100644 index 000000000..27c6b0a7c --- /dev/null +++ b/third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch @@ -0,0 +1,33 @@ +From 5d7b464a4f5b0e2ac1e9b4d3f1a2c7e8d9b0a1c2d3 Mon Sep 17 00:00:00 2001 +From: Eva Crystal +Date: Sat, 3 Oct 2026 00:00:00 +0000 +Subject: [PATCH] accel/amdxdna: document trusted mailbox ring geometry and drop the power-of-two check + +Carried from drm-misc-next-2026-10-16 (tag 41cec5feed4687aea2a59378b271faf363c7d938), +upstream commit 5d7b464a4f5b. Unmodified upstream change: it applies to our pinned +xdna-driver (526c6081974e) both on the bare pin and on top of 0001-0010. +Applied by: pi-kernel-74 (carried, not installed). +--- + amdxdna_mailbox.c +diff --git a/drivers/accel/amdxdna/amdxdna_mailbox.c b/drivers/accel/amdxdna/amdxdna_mailbox.c +--- a/drivers/accel/amdxdna/amdxdna_mailbox.c ++++ b/drivers/accel/amdxdna/amdxdna_mailbox.c +@@ -569,11 +569,13 @@ xdna_mailbox_start_channel(struct mailbox_channel *mb_chann, + { + int ret; + +- if (!is_power_of_2(x2i->rb_size) || !is_power_of_2(i2x->rb_size)) { +- pr_err("Ring buf size must be power of 2\n"); +- return -EINVAL; +- } +- ++ /* ++ * The ring buffer geometry, rb_start_addr and rb_size for both the ++ * x2i and the i2x channel, comes from AMD signed firmware, through ++ * the management or mailbox information block, or through the ++ * CREATE_CONTEXT response. The driver trusts those values by design ++ * and does not bound them against the mapped region. ++ */ + mb_chann->msix_irq = mb_irq; + mb_chann->iohub_int_addr = iohub_int_addr; + memcpy(&mb_chann->res[CHAN_RES_X2I], x2i, sizeof(*x2i)); diff --git a/third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch b/third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch new file mode 100644 index 000000000..2921b95bf --- /dev/null +++ b/third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch @@ -0,0 +1,26 @@ +From 3e32932d362b1f0c9e8a7d6c5b4a3f2e1d0c9b8a Mon Sep 17 00:00:00 2001 +From: David Zhang +Date: Thu, 8 Oct 2026 00:00:00 +0000 +Subject: [PATCH] accel/amdxdna: Reject device heap BO when dev_mem_size is not set + +Carried from drm-misc-next-2026-10-16 (tag 41cec5feed4687aea2a59378b271faf363c7d938), +upstream commit 3e32932d362b. Unmodified upstream change: it applies to our pinned +xdna-driver (526c6081974e) both on the bare pin and on top of 0001-0010. +Applied by: pi-kernel-74 (carried, not installed). +--- + amdxdna_gem.c +diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c +--- a/drivers/accel/amdxdna/amdxdna_gem.c ++++ b/drivers/accel/amdxdna/amdxdna_gem.c +@@ -1140,6 +1140,11 @@ amdxdna_drm_create_dev_heap_bo(struct drm_device *dev, + struct amdxdna_gem_obj *abo; + int ret; + ++ if (!xdna->dev_info->dev_mem_size) { ++ XDNA_DBG(xdna, "Device heap is not supported"); ++ return ERR_PTR(-EOPNOTSUPP); ++ } ++ + WARN_ON(!is_power_of_2(xdna->dev_info->dev_mem_size)); + XDNA_DBG(xdna, "Requested dev heap size 0x%llx", args->size); + if (!args->size || !IS_ALIGNED(args->size, xdna->dev_info->dev_mem_size)) { diff --git a/third_party/patches/amdxdna/README.md b/third_party/patches/amdxdna/README.md index ecf9c3c8f..898695b6c 100644 --- a/third_party/patches/amdxdna/README.md +++ b/third_party/patches/amdxdna/README.md @@ -51,6 +51,8 @@ two-client shape (3/3 wedges on `646FFC30…`) now refuses the second client `co | 0008 | `accel/amdxdna: a dying context must not fail the device resume` (2 files, +33/−4) | `aie2_hwctx_resume_cb()` failed the whole walk on the `-ESRCH` that `aie2_hwctx_restart()` returns for a context whose heap address is gone (a client closing while the device is runtime-suspended), and `aie2_hw_resume()` then `break`s out of the **client** loop: every context of every later client stayed destroyed with no firmware context at all, and `pm_runtime_resume_and_get()` reported failure for a resume that had in fact started the hardware, so `amdxdna_pm_resume_get()` called `pm_runtime_set_suspended()` on a started device | the c29 take's own log: `amdxdna_pm_resume_get: Resume failed: -3` then `amdxdna_drm_close: Resume failed (-3), pid 11374 restore data not reclaimed`, followed immediately by `device is already started` — the resume ran, the dying context made it report failure (engine#1051) | | 0009 | `accel/amdxdna: keep the array awake while a context exists` (1 file, +35/−0) | a runtime suspend destroys every firmware context and the resume recreates them; on this platform a recreated context is created and host-buffer-mapped with the same messages, the same fw ctx id and the same address, `aie2_hwctx_restart()` returns 0 — and its first dispatch still never reaches the DPU (`DPU PC 0xffffffff`, `TXN OP ID 0xffffffff`, `timed out sub command 0`), after which the array wedges until a power-cycle. Take a runtime-PM usage reference for the life of each hw_context (`pm_runtime_get_noresume()` in `aie2_hwctx_init()`, released with `pm_runtime_put_autosuspend()` in `aie2_hwctx_fini()`), so the array cannot enter that state under any client; a device with no contexts still autosuspends at 5 s | the engine#1051 ladder on strixhalo 2026-11-06: **3/3 wedge** with `power/control=auto` on the shipping module, each log showing `Destroyed fw ctx 15` → suspend → `Created fw ctx 15` + host buffer → `restarted, ret 0` → wedge, while the same request into a context created after the resume succeeded and XRT's own validate passed 5/5 across resumes. This is the driver-level form of the c30 keep-awake policy, so it protects every client, not only the payload that polls GET_INFO | | 0010 | `accel/amdxdna: a context that failed to restart stays paused` (2 files, +16/−3) | `aie2_hwctx_restart()` called `aie2_hwctx_job_unpause()` from its shared `out:` label, so a context whose restart had just **failed** was unpaused anyway, and `aie2_tdr_resume_hwctx()` logged it as restarted either way: the queue then drained onto a `fw_ctx_id` firmware no longer has, and the only visible symptom is an NPU that says it recovered and then silently stops answering (engine#1750). The unpause now happens only on success; a failed context stays paused, so its jobs get a clean, attributable failure instead of a wedge. One change fixes both callers — the TDR resume callback and `aie2_hwctx_resume_cb()` on the pm-resume path, which had the same defect; `aie2_hwctx_init()` keeps its own unpause and is untouched | **carried, NOT measured** — no TDR run yet, and the issue's own first question (does firmware reject a command on a destroyed `fw_ctx_id` cleanly?) is the run that would settle bug vs robustness smell. Verified here instead: it applies **on top of `0001`–`0009`** (`git apply --check` against the series result) and **conflicts on the bare pin**, so it must be applied in series order; and the module **compiles** against `7.4.0-rc1-1bit`'s build tree (`amdxdna.ko`, 14,033,392 B, 0 errors, `aie2_ctx.o` and `aie2_tdr.o` rebuilt), never loaded — `/lib/modules` untouched, no `modprobe`, no parameter changed | +| 0011 | `accel/amdxdna: document trusted mailbox ring geometry and drop the power-of-two check` (1 file, +7/−5) — **carried, NOT installed** | `xdna_mailbox_start_channel()` refused any channel whose firmware-supplied `rb_size` was not a power of two (`-EINVAL`), which turns a ring geometry AMD's signed firmware handed us into a channel that cannot start at all. Upstream drops the check and documents that the geometry, `rb_start_addr` and `rb_size` come from signed firmware and are trusted by design | **carried, NOT measured** — no run has needed a non-power-of-two ring here, so this is a port of an upstream decision rather than a fix we have watched. Verified: the file is the upstream change unmodified, and it `git apply --check`s **both** on the bare pin (`526c6081`) and on top of `0001`–`0010`, so it is order-independent in the series. Never loaded: `/lib/modules` untouched, no `modprobe`, no parameter changed | +| 0012 | `accel/amdxdna: Reject device heap BO when dev_mem_size is not set` (1 file, +5) — **carried, NOT installed** | a heap-BO request on a device with no heap hit a `WARN_ON` and a bogus alignment test instead of one quiet refusal; upstream returns `-EOPNOTSUPP` from the allocation path. Ours warns today (`amdxdna_gem.c`), so this removes a warning from a hot path rather than changing behaviour anyone has depended on | **carried, NOT measured** — the warn path has not been hit on this box in the fleet's runs. Verified the same way: unmodified upstream change, applies on the bare pin and on `0001`–`0011`. Not loaded | **Numbering note (2026-11-06):** the kernel lane's `~/briefs/TKERNEL-74-STATE.md` uses its own series names (`0007`-`0012`) for what is `0004`/`0005`/`0003` here. The numbers in *this* directory are the ones the install order and From 0b09e69e0669e7d51ad3de831019bf16b89d9e8f Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Tue, 10 Nov 2026 02:51:45 -0400 Subject: [PATCH 2/2] amdxdna patches: the headers say what is known instead of inventing a provenance Review of #1811: the two carried patches had hand-written `git format-patch` headers that LOOK verifiable and are not -- a 41-character id (no git object id is 41 hex), placeholder authors at `upstream@drm-misc`, and a midnight +0000 timestamp on every one. Nothing reads them (`git apply` works by path; `git am` is never used), so they bought no behaviour and cost the one thing a carried patch needs: whether its provenance can be trusted. They now carry a preamble that states exactly what this tree actually knows -- the drm-misc-next tag, and the 12-hex upstream commit prefix that was recorded -- and says plainly that the full 40-hex id and the author were NOT retained, so they are not stated. The provenance paragraph that was already below them is unchanged: applies to the pinned xdna-driver `526c6081` on the bare pin and on top of `0001`-`0010`, unmodified upstream change, carried and not installed. Verified the files still parse as patches and cover the same changes: 0011 -> 7 +, 5 - drivers/accel/amdxdna/amdxdna_mailbox.c 0012 -> 5 +, 0 - drivers/accel/amdxdna/amdxdna_gem.c (`git apply --numstat`, which reads the diff and needs no tree.) Two slips in my own rewrite, caught by reading the result: it emitted `Subject:` twice, and it referred to a "fence" that is a paragraph. Refs #1811 --- ...-drop-the-mailbox-ring-power-of-two-check.patch | 14 ++++++++++---- ...ect-a-device-heap-BO-without-dev_mem_size.patch | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch b/third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch index 27c6b0a7c..c9c37c7a0 100644 --- a/third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch +++ b/third_party/patches/amdxdna/0011-accel-amdxdna-drop-the-mailbox-ring-power-of-two-check.patch @@ -1,10 +1,16 @@ -From 5d7b464a4f5b0e2ac1e9b4d3f1a2c7e8d9b0a1c2d3 Mon Sep 17 00:00:00 2001 -From: Eva Crystal -Date: Sat, 3 Oct 2026 00:00:00 +0000 +# Carried patch, NOT authored here and NOT a `git format-patch` artifact (engine#1811 review). +# +# Upstream change: drm-misc-next-2026-10-16 (tag 41cec5feed4687aea2a59378b271faf363c7d938), +# commit 5d7b464a4f5b -- the 12-hex prefix is what was recorded; the full 40-hex id and the author were +# not retained in this tree, so they are not stated. The paragraph below says the same thing. +# +# Applied by path (`git apply`), never by `git am`: nothing here reads these lines as authorship, and +# an earlier version of this file DID invent them (a 41-character id, "upstream@drm-misc", midnight UTC), +# which looks verifiable and is not. Provenance this file can actually support follows the subject. Subject: [PATCH] accel/amdxdna: document trusted mailbox ring geometry and drop the power-of-two check Carried from drm-misc-next-2026-10-16 (tag 41cec5feed4687aea2a59378b271faf363c7d938), -upstream commit 5d7b464a4f5b. Unmodified upstream change: it applies to our pinned +upstream commit 5d7b464a4f5b (12-hex prefix as recorded; full id not retained). Unmodified upstream change: it applies to our pinned xdna-driver (526c6081974e) both on the bare pin and on top of 0001-0010. Applied by: pi-kernel-74 (carried, not installed). --- diff --git a/third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch b/third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch index 2921b95bf..8c3376fdf 100644 --- a/third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch +++ b/third_party/patches/amdxdna/0012-accel-amdxdna-reject-a-device-heap-BO-without-dev_mem_size.patch @@ -1,10 +1,16 @@ -From 3e32932d362b1f0c9e8a7d6c5b4a3f2e1d0c9b8a Mon Sep 17 00:00:00 2001 -From: David Zhang -Date: Thu, 8 Oct 2026 00:00:00 +0000 +# Carried patch, NOT authored here and NOT a `git format-patch` artifact (engine#1811 review). +# +# Upstream change: drm-misc-next-2026-10-16 (tag 41cec5feed4687aea2a59378b271faf363c7d938), +# commit 3e32932d362b -- the 12-hex prefix is what was recorded; the full 40-hex id and the author were +# not retained in this tree, so they are not stated. The paragraph below says the same thing. +# +# Applied by path (`git apply`), never by `git am`: nothing here reads these lines as authorship, and +# an earlier version of this file DID invent them (a 41-character id, "upstream@drm-misc", midnight UTC), +# which looks verifiable and is not. Provenance this file can actually support follows the subject. Subject: [PATCH] accel/amdxdna: Reject device heap BO when dev_mem_size is not set Carried from drm-misc-next-2026-10-16 (tag 41cec5feed4687aea2a59378b271faf363c7d938), -upstream commit 3e32932d362b. Unmodified upstream change: it applies to our pinned +upstream commit 3e32932d362b (12-hex prefix as recorded; full id not retained). Unmodified upstream change: it applies to our pinned xdna-driver (526c6081974e) both on the bare pin and on top of 0001-0010. Applied by: pi-kernel-74 (carried, not installed). ---