diff options
91 files changed, 2533 insertions, 1251 deletions
@@ -53,7 +53,7 @@ The policy is therefore: | Component | License | Why | |---|---|---| -| `kernel/**` (e.g. `open-iov-vfio.ko`) | **GPL-2.0** (`MODULE_LICENSE("GPL v2")`) | Uses GPL-only kernel exports (VFIO/mdev/IOMMU). | +| `kernel/**` (e.g. `vgsp.ko`) | **GPL-2.0** (`MODULE_LICENSE("GPL v2")`) | Uses GPL-only kernel exports (VFIO/mdev/IOMMU). | | `userspace/**`, `tools/**`, `scripts/**`, `config/**`, `docs/**` | **BSD-3-Clause** | No GPL-only interfaces; maximize reuse. | | Third-party imports (vendor firmware, submodules, study material) | their own terms | Used for interoperability study; not relicensed. | @@ -1,5 +1,5 @@ # Open-IOV Top-Level Build System -# Builds: kernel module (open-iov-vfio.ko), userspace lib (open-iov.so), examples, tests +# Builds: kernel module (vgsp.ko), userspace lib (open-iov.so), examples, tests SHELL := /bin/bash @@ -9,7 +9,7 @@ USERSPACE_DIR := userspace FIRMWARE_DIR := firmware/57X-GSP/570.144 # Kernel module -KERNEL_MODULE := open-iov-vfio.ko +KERNEL_MODULE := vgsp.ko KERNEL_MODULE_SRC := $(KERNEL_DIR)/$(KERNEL_MODULE) # Userspace library @@ -30,7 +30,7 @@ help: @echo "" @echo "Targets:" @echo " all - Build kernel module, userspace library, examples" - @echo " kernel - Build open-iov-vfio.ko" + @echo " kernel - Build vgsp.ko" @echo " userspace - Build open-iov.so and libvgpu.so compat link" @echo " examples - Build example applications" @echo " tests - Build kernel and userspace tests" @@ -106,7 +106,7 @@ load: kernel firmware-check # Unload kernel module unload: - -sudo rmmod open-iov-vfio + -sudo rmmod vgsp # Reload kernel module reload: unload load @@ -22,7 +22,7 @@ patching any driver or firmware, and without forking any hypervisor. | Path | Contents | |---|---| -| `kernel/` | `open-iov-vfio.ko` — host VFIO mdev driver: virtual GPU device, GSP/GSP-RM emulation, memory model, work forwarding (in progress) | +| `kernel/` | `vgsp.ko` — host VFIO mdev driver: virtual GPU device, GSP/GSP-RM emulation, memory model, work forwarding (in progress) | | `userspace/` | `libiov.so` management library, examples, tests | | `tools/` | diagnostics, guest-side probes, firmware analysis wrappers | | `scripts/` | `stack_manager.sh`, VM harness, build/load/test automation | @@ -15,7 +15,7 @@ | **Created (UTC)** | 2026-10-02T06:47:39Z | | **Created by** | The Open-IOV Project (automated inventory audit of the tracked tree) | | **Primary component** | Open-IOV virtual GSP/vGPU stack | -| **Primary version** | `0.1.0` (`OPEN_IOV_VFIO_VERSION` in `kernel/include/nvidia-vgpu-vfio.h`) | +| **Primary version** | `0.1.0` (`VGSP_VERSION` in `kernel/include/nvidia-vgpu-vfio.h`) | | **Primary license** | BSD-3-Clause (kernel side: GPL-2.0; see §8) | | **Repository** | <https://git.vgpu.io/open-iov.git> | | **Scope** | All files tracked in the repository, plus the external components required to build, run and support it | @@ -31,7 +31,7 @@ Processor (GSP) and its resource-manager firmware interface (GSP-RM) in a host kernel module, and by arranging for guest work to execute on the physical GPU. * Supplier: The Open-IOV Project -* Version: `0.1.0` — defined by `OPEN_IOV_VFIO_VERSION` in +* Version: `0.1.0` — defined by `VGSP_VERSION` in `kernel/include/nvidia-vgpu-vfio.h` * Unique ID: `pkg:generic/open-iov@0.1.0` * License: BSD-3-Clause (see `LICENSE`) @@ -65,7 +65,7 @@ The kernel module is **GPL-2.0** (see §8). | Component | Version | License | Location | Unique ID | Contents / purpose | |---|---|---|---|---|---| -| `open-iov-vfio` kernel module | 0.1.0 | GPL-2.0 | `kernel/**` | `pkg:generic/open-iov-vfio@0.1.0` | Host VFIO mdev driver + emulated GSP/GSP-RM, semaphore service, memory model, physical-GPU backend, BAR/MSI-X emulation, mdev/VFIO lifecycle | +| `vgsp` kernel module | 0.1.0 | GPL-2.0 | `kernel/**` | `pkg:generic/vgsp@0.1.0` | Host VFIO mdev driver + emulated GSP/GSP-RM, semaphore service, memory model, physical-GPU backend, BAR/MSI-X emulation, mdev/VFIO lifecycle | | `libiov` userspace library | 0.1.0 | BSD-3-Clause | `userspace/lib/**`, `userspace/include/libvgpu.h` | `pkg:generic/libiov@0.1.0` | Management library (`libiov.so`) + `libvgpu.so` compatibility link, RPC emulation helpers, pkg-config metadata | | `example_vgpu` example | 0.1.0 | BSD-3-Clause | `userspace/examples/**` | `pkg:generic/open-iov-example@0.1.0` | Minimal library usage example and build files | | Userspace tests | 0.1.0 | BSD-3-Clause | `userspace/tests/**` | `pkg:generic/open-iov-userspace-tests@0.1.0` | Userspace VF management tests | @@ -174,7 +174,7 @@ the project develops and tests against; see `config/versions/*.yaml` and ``` pkg:generic/open-iov@0.1.0 -├── contains open-iov-vfio (kernel module) ── depends on ── Linux kernel (VFIO/mdev/IOMMU/DMA) +├── contains vgsp (kernel module) ── depends on ── Linux kernel (VFIO/mdev/IOMMU/DMA) ├── contains libiov / libvgpu ── depends on ── tomlc99, cargs ├── contains example_vgpu, userspace tests, kernel tests ├── contains tools (guest-diag, cuda-ab, rmq, ghidra, guest_agent, vm/module/debug/test) diff --git a/debug/risc-v-gsp-rm-vm/README.md b/debug/risc-v-gsp-rm-vm/README.md index 8882f9a..61204af 100644 --- a/debug/risc-v-gsp-rm-vm/README.md +++ b/debug/risc-v-gsp-rm-vm/README.md @@ -2,7 +2,7 @@ > Status: implemented, documented and tested (audit: docs/27-TOOL-AUDIT.md; value demos: docs/25-VALUE-VALIDATION.md). > Experimental tooling for simulating and inspecting the GSP firmware's -> runtime memory, for `gsp-rm-vfio` accuracy measurements and GSP/uproc +> runtime memory, for `vgsp` accuracy measurements and GSP/uproc > reverse engineering. It is a development-only, out-of-tree tool: never a > dependency of the shipped driver and never present in a guest. diff --git a/debug/risc-v-gsp-rm-vm/RISC-V-GSP-RM-DEBUGGER-ROADMAP.md b/debug/risc-v-gsp-rm-vm/RISC-V-GSP-RM-DEBUGGER-ROADMAP.md index 88183ea..a7a8227 100644 --- a/debug/risc-v-gsp-rm-vm/RISC-V-GSP-RM-DEBUGGER-ROADMAP.md +++ b/debug/risc-v-gsp-rm-vm/RISC-V-GSP-RM-DEBUGGER-ROADMAP.md @@ -12,7 +12,7 @@ Open-IOV's hardest long-term problem is not writing the emulation once — it is **surviving adversarial firmware change**. NVIDIA ships new GSP images, new device pairings and new architectures on independent schedules, and the firmware is deliberately opaque (stripped, signed, hardware-coupled, with -non-recoverable boot states). To keep `open-iov-vfio` accurate across that +non-recoverable boot states). To keep `vgsp` accurate across that churn, the project needs a toolchain that can: 1. **Run** firmware off-hardware, safely and repeatably. @@ -22,7 +22,7 @@ churn, the project needs a toolchain that can: 4. **Compare** — hardware vs VFIO vs simulation, old vs new firmware, with a metric contract instead of anecdotes. 5. **Reimplement** — turn observed behaviour into reviewed code in - `open-iov-vfio` with evidence attached. + `vgsp` with evidence attached. risc-v-gsp-rm-debugger is the vehicle for that program. It is explicitly a **development environment**, never a shipped component. @@ -226,7 +226,7 @@ reimplement quickly. Observe what each service reads/writes (watchpoints, TCG trace) and infer capabilities (which objects, ranges, controls it touches); compare with the declared/emulated capability model; surface least-privilege and security -findings for `open-iov-vfio`. +findings for `vgsp`. ### H4.3 Mutation and fuzzing Feed malformed construction/control traffic into re-hosted or simulated @@ -247,7 +247,7 @@ The canonical loop for any behaviour: 1. Observe on hardware/VFIO (reference capture). 2. Observe in risc-v-gsp-rm-debugger (simulator, replayable). 3. `compare` + metric table M1–M6 (docs/06-ACCURACY.md). -4. Implement in `open-iov-vfio` with the session directories attached as +4. Implement in `vgsp` with the session directories attached as evidence. 5. Re-run the same stimulus; the metric table must improve or stay equal. This loop becomes a scripted harness ("consensus harness") so every change diff --git a/debug/risc-v-gsp-rm-vm/docs/00-OVERVIEW.md b/debug/risc-v-gsp-rm-vm/docs/00-OVERVIEW.md index a404663..0df8d08 100644 --- a/debug/risc-v-gsp-rm-vm/docs/00-OVERVIEW.md +++ b/debug/risc-v-gsp-rm-vm/docs/00-OVERVIEW.md @@ -2,7 +2,7 @@ > Status: implemented, documented and tested (audit: docs/27-TOOL-AUDIT.md; value demos: docs/25-VALUE-VALIDATION.md). > Experimental tooling for simulating and inspecting the GSP firmware's -> runtime memory, for `gsp-rm-vfio` accuracy measurements and GSP/uproc +> runtime memory, for `vgsp` accuracy measurements and GSP/uproc > reverse engineering. Interfaces and file formats may change without notice. > It is development-only: never shipped, never a dependency of the emulation, > never present in a guest. diff --git a/debug/risc-v-gsp-rm-vm/docs/06-ACCURACY.md b/debug/risc-v-gsp-rm-vm/docs/06-ACCURACY.md index e55162d..ebc9226 100644 --- a/debug/risc-v-gsp-rm-vm/docs/06-ACCURACY.md +++ b/debug/risc-v-gsp-rm-vm/docs/06-ACCURACY.md @@ -7,7 +7,7 @@ ## 1. Purpose risc-v-gsp-rm-debugger exists to measure how accurately Open-IOV's GSP emulation -(`gsp-rm-vfio` and the in-kernel emulation) reproduces the behaviour of the +(`vgsp` and the in-kernel emulation) reproduces the behaviour of the real GSP firmware, and to make the firmware itself analysable. That makes accuracy a first-class deliverable, not an assumption. This document defines the fidelity levels, the measurement contract, and the rules for honest @@ -73,7 +73,7 @@ Re-host fidelity must be stated per module in the session metadata, and every "this is what the firmware does" claim should be cross-checked against the physical RPC traces (PLAN B) before it is used to change the emulation. -## 5. Measurement contract for `gsp-rm-vfio` accuracy +## 5. Measurement contract for `vgsp` accuracy Define these metrics once and use them everywhere: diff --git a/debug/risc-v-gsp-rm-vm/docs/11-GSP-RM-SERVICE-DEVELOPER-GUIDE.md b/debug/risc-v-gsp-rm-vm/docs/11-GSP-RM-SERVICE-DEVELOPER-GUIDE.md index 2022cf1..714dc27 100644 --- a/debug/risc-v-gsp-rm-vm/docs/11-GSP-RM-SERVICE-DEVELOPER-GUIDE.md +++ b/debug/risc-v-gsp-rm-vm/docs/11-GSP-RM-SERVICE-DEVELOPER-GUIDE.md @@ -149,7 +149,7 @@ prototype is analysed exactly like firmware code. * **Watchpoint the state, hook the entry.** Watchpoints are immediate (one instruction step) and ideal for counters; hooks give arguments/returns. * **Never ship a service.** Injected code is a development experiment; the - product changes go through `open-iov-vfio` with the accuracy loop. + product changes go through `vgsp` with the accuracy loop. * **Record everything.** A claim about a service without a session is not evidence. diff --git a/debug/risc-v-gsp-rm-vm/docs/14-ADVERSARIAL-INTEROP-GUIDE.md b/debug/risc-v-gsp-rm-vm/docs/14-ADVERSARIAL-INTEROP-GUIDE.md index 1ddd17e..c000d42 100644 --- a/debug/risc-v-gsp-rm-vm/docs/14-ADVERSARIAL-INTEROP-GUIDE.md +++ b/debug/risc-v-gsp-rm-vm/docs/14-ADVERSARIAL-INTEROP-GUIDE.md @@ -5,7 +5,7 @@ ## 1. Purpose and scope Open-IOV's hard problem is not writing the GSP emulation once; it is keeping -`open-iov-vfio` accurate while the firmware changes underneath it. New GSP +`vgsp` accurate while the firmware changes underneath it. New GSP images, device pairings and architectures arrive stripped, signed and hardware-coupled, and some actively resist analysis. This guide is the practical companion to `RISC-V-GSP-RM-DEBUGGER-ROADMAP.md` H4: how to move from "the new @@ -47,7 +47,7 @@ hardware coupling a simulator cannot yet exercise. question > Ghidra (static): decompile, dispatcher tables, symbols > risc-v-gsp-rm-debugger (dynamic): same stimulus, hooks, watchpoints, trace > sessions + hits TSV: risc-v-gsp-rm-debugger compare -> triage -> evidence pack - > open-iov-vfio change (with evidence) + > vgsp change (with evidence) ``` | Question | Ghidra answers | risc-v-gsp-rm-debugger answers | Shared artifact | @@ -170,7 +170,7 @@ with the capability model the emulation assumes. | write | `0x…` | w | `func+0x…` | not modelled | least-privilege candidate | | read | `0x…` | r | `func+0x…` | denied in emulation | potential fail-closed gap | - Least-privilege readings matter for `open-iov-vfio`, but a simulator + Least-privilege readings matter for `vgsp`, but a simulator observation is evidence about the firmware (docs/06 §6); confirm before it changes the product. @@ -294,7 +294,7 @@ reproduced physically; simulator-only divergence becomes a fidelity gap. The canonical accuracy loop (roadmap H4.5): (1) observe on hardware/VFIO; (2) observe in risc-v-gsp-rm-debugger (replayable session); (3) `compare` + M1–M6; -(4) implement in `open-iov-vfio` with the session directories attached as +(4) implement in `vgsp` with the session directories attached as evidence; (5) re-run the same stimulus and require the metric table to improve or stay equal. @@ -367,7 +367,7 @@ L0/L1 in simulator; L2 not claimed; L3 absent for <registers>. Physical reproduction required before product change: yes/no, why. ## Product action -open-iov-vfio change (or explicit "no change"): <link/notes> +vgsp change (or explicit "no change"): <link/notes> ``` ## 7. Boundaries, safety and ethics @@ -384,7 +384,7 @@ open-iov-vfio change (or explicit "no change"): <link/notes> * **Fuzzing is gated.** Mutation runs only against the simulator or re-hosted code, behind explicit harnesses, with session evidence (docs/12 §9, R5). Never use injection to defeat a hardware security boundary (docs/12 §1). -* **Escalate to physical.** Any conclusion that would change `open-iov-vfio` +* **Escalate to physical.** Any conclusion that would change `vgsp` must be confirmed against a physical capture (docs/06 §6, docs/07 P4.5). ## 8. Roadmap hooks diff --git a/debug/risc-v-gsp-rm-vm/docs/15-AGENTIC-GSP-IDE.md b/debug/risc-v-gsp-rm-vm/docs/15-AGENTIC-GSP-IDE.md index db71833..a7feb21 100644 --- a/debug/risc-v-gsp-rm-vm/docs/15-AGENTIC-GSP-IDE.md +++ b/debug/risc-v-gsp-rm-vm/docs/15-AGENTIC-GSP-IDE.md @@ -14,7 +14,7 @@ a **deterministic, scriptable harness** (`ge.launch`/`ge.attach`, `Session`, * sessions are the shared state between agents, humans and Ghidra, so every claim is inspectable after the fact; * **humans keep product-change authority**: an agent may propose an - `open-iov-vfio` change with evidence, but only a human merges it, and the + `vgsp` change with evidence, but only a human merges it, and the physical-confirmation rules of docs/06 and docs/07 still apply. Non-goals: autonomous hardware cycles, unattended reboots, agents that "fix" @@ -249,7 +249,7 @@ the reply/object, and in what order relative to `<Z>`?" 6. Stop condition: direct and firmware-dispatched results agree, the session is recorded, and the prototype is documented as development-only. Product - code goes to `open-iov-vfio` only through the accuracy loop (docs/11 §8, + code goes to `vgsp` only through the accuracy loop (docs/11 §8, docs/12 §9); GSP-RM registration is roadmap H1.3. ### 4.4 Prepare a portability report @@ -288,7 +288,7 @@ Hard rules (no agent may override them): * **No unattended hardware.** The agent runs against the simulator by default; physical GPU cycles are supervised and human-driven (H7). * **Human approval for product changes.** Agents produce proposals and - evidence packs; only humans merge `open-iov-vfio` changes. + evidence packs; only humans merge `vgsp` changes. * **Budgets everywhere.** Every run uses `duration=`/`max_stops=`/`timeout=` and a wall-clock cap; a wedged target leaves the session stopped and is restarted clean rather than poked. @@ -300,7 +300,7 @@ Capability manifest for actions (proposed file for the harness; see §7): | Read | `info`, `plugins`, `symbols resolve`, `analyze`, `compare` | agent, unattended | path/DB provenance recorded | | Observe | `probe`, `record`, `demo`, hooks/watch/step | agent, unattended on simulator | timeout, session recording on | | Write (target) | `memory.write*`, `call`, `run_until`, `inject`, mailbox stimulus | agent with manifest | declared address/range, fresh session, before/after snapshots, mutation values noted | -| Product | `open-iov-vfio` patch | human only | M1–M6 + physical confirmation rules (docs/07 P4.5) | +| Product | `vgsp` patch | human only | M1–M6 + physical confirmation rules (docs/07 P4.5) | | Hardware | physical cycles/reboots | human only | supervised, never unattended | A write action's manifest entry names the session, the target range, the diff --git a/debug/risc-v-gsp-rm-vm/docs/16-CUSTOM-SIMULATOR.md b/debug/risc-v-gsp-rm-vm/docs/16-CUSTOM-SIMULATOR.md index 4e96a44..b2980bc 100644 --- a/debug/risc-v-gsp-rm-vm/docs/16-CUSTOM-SIMULATOR.md +++ b/debug/risc-v-gsp-rm-vm/docs/16-CUSTOM-SIMULATOR.md @@ -160,7 +160,7 @@ adds: differential tests against QEMU, gate behind H2, minimal `Backend`. * Confidentiality/isolation/security claims: a study environment only (§06 §6). * Replacing QEMU before M4; native is opt-in (`--backend native`, M6). * Graphics/board emulation, undeclared fidelity claims, or shipping: nothing - here becomes a dependency of `gsp-rm-vfio` or a guest. + here becomes a dependency of `vgsp` or a guest. ### 3.1 Fidelity claims diff --git a/debug/risc-v-gsp-rm-vm/docs/20-MCP-SERVER.md b/debug/risc-v-gsp-rm-vm/docs/20-MCP-SERVER.md index 4c13d1f..46e28a4 100644 --- a/debug/risc-v-gsp-rm-vm/docs/20-MCP-SERVER.md +++ b/debug/risc-v-gsp-rm-vm/docs/20-MCP-SERVER.md @@ -241,7 +241,7 @@ recorded, and the session can be compared like any other run. 6. **Protocol hygiene.** stdout is reserved for JSON-RPC; diagnostics go to stderr. One bad tool call returns `isError` and the server keeps serving. 7. **No product changes.** MCP can propose evidence, not merge emulation - changes; human approval still gates `open-iov-vfio`. + changes; human approval still gates `vgsp`. ## 8. Absent capabilities diff --git a/debug/risc-v-gsp-rm-vm/docs/22-PORTING-CUDA-AND-DEVICES.md b/debug/risc-v-gsp-rm-vm/docs/22-PORTING-CUDA-AND-DEVICES.md index 63fbffa..8570d0d 100644 --- a/debug/risc-v-gsp-rm-vm/docs/22-PORTING-CUDA-AND-DEVICES.md +++ b/debug/risc-v-gsp-rm-vm/docs/22-PORTING-CUDA-AND-DEVICES.md @@ -9,7 +9,7 @@ ## 1. The three churn axes and the anchor discipline NVIDIA ships three things on independent schedules, and any one of them can -break `open-iov-vfio` while the other two stay still: +break `vgsp` while the other two stay still: | Axis | Examples | Primary evidence path | |---|---|---| @@ -76,7 +76,7 @@ tools/cudatool.py delta <old>/run/libcuda.so.<old> <new>/run/libcuda.so.<new> | Name transfer + corpus annotation | `ApplyNameMap.java` (`--dry-run` first), `tools/annotate_corpus.py` | `./risc-v-gsp-rm-debugger.sh symbols export` builds a runtime-address symbol DB from the same index/names | | Driver-API smoke | `tools/test/cuda_drv_test.c` compiled as `/tmp/cdt` (prints `ALL OK`) | `./risc-v-gsp-rm-debugger.sh symbols resolve --db ... <addr>` spot-checks transferred addresses per call path | | Runtime workload | `tools/cuda-ab/ab.sh all` (`vector_add.cu`; `RESULT`/`STATUS` must match host) | session-format evidence and `./risc-v-gsp-rm-debugger.sh compare` when firmware-side sessions exist | -| Guest-side control observation | `tools/guest-diag/ioctl_trace.c`, host module trace (`gsp-resman-vfio:`) | annotation of the firmware-side RPC path with the per-version symbol DB | +| Guest-side control observation | `tools/guest-diag/ioctl_trace.c`, host module trace (`vgsp:`) | annotation of the firmware-side RPC path with the per-version symbol DB | | Firmware-side confirmation | — | `./risc-v-gsp-rm-debugger.sh probe` / `record` / `compare` against the paired firmware | **Be honest about the execution boundary.** `cdt` and `vectorAdd` are x86_64 @@ -182,7 +182,7 @@ remains the dynamic oracle. | Engine inventory | host oracle `rmtool engine list --format=json`, guest `guest_engines.c` | inventory table | | Interrupt topology | MSI-X tables, guest `lspci -vvv` | profile notes | | ROM/VBIOS quirks | ROM read, laptop/Surface variants | profile overrides | -| Probe-time register values | guest driver init trace (`gsp-resman-vfio:`) | expected-value list | +| Probe-time register values | guest driver init trace (`vgsp:`) | expected-value list | The host oracle (`rmharness`, docs/17) is read-only and safe alongside a live CUDA job; capture it into a session so the numbers carry SHA-256 provenance: diff --git a/debug/risc-v-gsp-rm-vm/docs/25-VALUE-VALIDATION.md b/debug/risc-v-gsp-rm-vm/docs/25-VALUE-VALIDATION.md index 93d5d17..f7ccacd 100644 --- a/debug/risc-v-gsp-rm-vm/docs/25-VALUE-VALIDATION.md +++ b/debug/risc-v-gsp-rm-vm/docs/25-VALUE-VALIDATION.md @@ -33,7 +33,7 @@ the baseline cost from the handoffs, and measures the risc-v-gsp-rm-debugger pat Fidelity is exactly docs/06: L0 instruction semantics and L1 memory behaviour are exercised; **L2 time/concurrency is not modelled** and **L3 device environment is absent**. A risc-v-gsp-rm-debugger observation is evidence about the -firmware, and anything that would change `open-iov-vfio` is escalated to a +firmware, and anything that would change `vgsp` is escalated to a physical capture before the product changes (docs/06 §6, docs/14 §7). ### 2.2 Run contract diff --git a/debug/risc-v-gsp-rm-vm/docs/26-ARCHITECTURE.md b/debug/risc-v-gsp-rm-vm/docs/26-ARCHITECTURE.md index e4b8396..fce7a96 100644 --- a/debug/risc-v-gsp-rm-vm/docs/26-ARCHITECTURE.md +++ b/debug/risc-v-gsp-rm-vm/docs/26-ARCHITECTURE.md @@ -10,7 +10,7 @@ risc-v-gsp-rm-debugger runs GSP/uproc firmware in a controllable machine, observes it with Frida-like primitives, records a durable session, changes the machine's inputs -(including injected code), and compares runs as evidence for `open-iov-vfio` +(including injected code), and compares runs as evidence for `vgsp` emulation changes. | It is | It is not | @@ -342,7 +342,7 @@ The canonical loop (H4.5, 06 §5, 07 P4, 25 §7). Each stage names its gate. | 4. Record | `greeneye-session/1` with snapshots and notes | events + snapshots + hashes written | missing `session.json`/empty analyzer → recording off | | 5. Compare | `compare` against a reference (old firmware, hardware/VFIO capture, self-diff) | deltas explained symbolically; self-diff is zero | unexplained hit/watch/write delta → investigate first | | 6. Decide | fill M1–M6 with the reference method (06 §5); mutation/triage for error paths | metric table improves or stays equal | metric claimed without a reference capture | -| 7. Implement | change `open-iov-vfio` (never the simulator for a product fix); keep the stimulus | physical confirmation for behaviour changes (06 §6, 14 §7) | product change from a simulator-only observation | +| 7. Implement | change `vgsp` (never the simulator for a product fix); keep the stimulus | physical confirmation for behaviour changes (06 §6, 14 §7) | product change from a simulator-only observation | | 8. Regression | re-run step 3 with an unchanged stimulus; golden sessions/CI (`make test`, `risc-v-gsp-rm-debugger.yml`) | profile improves or stays equal; CI green | regression → revert and re-derive | ```mermaid @@ -350,7 +350,7 @@ flowchart LR Q["Question"] --> OBS["Observe<br/>probe / hooks / watch / trace"] OBS --> ORI["Orient<br/>analyze + symbol decode + snapshots"] ORI --> DEC["Decide<br/>compare + M1-M6 + mutation"] - DEC --> ACT["Act<br/>implement in open-iov-vfio"] + DEC --> ACT["Act<br/>implement in vgsp"] ACT --> REG["Regression<br/>same stimulus, same budgets"] REG -->|"improved / equal"| SHIP["Evidence pack<br/>sessions + report + hashes"] REG -->|"regressed"| Q diff --git a/debug/risc-v-gsp-rm-vm/docs/28-PORTING-AUTOMATION.md b/debug/risc-v-gsp-rm-vm/docs/28-PORTING-AUTOMATION.md index 974f013..b10542f 100644 --- a/debug/risc-v-gsp-rm-vm/docs/28-PORTING-AUTOMATION.md +++ b/debug/risc-v-gsp-rm-vm/docs/28-PORTING-AUTOMATION.md @@ -283,7 +283,7 @@ rather than recompute hashes. sweep handles the ISA/image shape and the matrix records the first-touch deltas, but PMU/SOE and partition-model work belongs to the roadmap. * **New product behaviour** — out of scope: these tools produce evidence, they - never edit `open-iov-vfio`. Product changes need the docs/07 P4 escalation + never edit `vgsp`. Product changes need the docs/07 P4 escalation and a physical reference. --- diff --git a/debug/risc-v-gsp-rm-vm/docs/29-PACKAGING-AND-TRIALING.md b/debug/risc-v-gsp-rm-vm/docs/29-PACKAGING-AND-TRIALING.md index 53e0f03..1a0e12a 100644 --- a/debug/risc-v-gsp-rm-vm/docs/29-PACKAGING-AND-TRIALING.md +++ b/debug/risc-v-gsp-rm-vm/docs/29-PACKAGING-AND-TRIALING.md @@ -171,7 +171,7 @@ status; a thrown error is recorded and exits 1. and expects the same `status`/call results. Divergence is a finding against the package or the tree, not a nuance. 5. Nothing here is product evidence by itself: any conclusion that would - change `open-iov-vfio` still escalates to a physical capture (docs/06 §6, + change `vgsp` still escalates to a physical capture (docs/06 §6, docs/25 §2.1). The package makes that physical confirmation cheap, it does not replace it. diff --git a/docs/02-getting-started/01-install-and-first-run.md b/docs/02-getting-started/01-install-and-first-run.md index 9ae81c2..7bc12bc 100644 --- a/docs/02-getting-started/01-install-and-first-run.md +++ b/docs/02-getting-started/01-install-and-first-run.md @@ -55,7 +55,7 @@ make userspace ``` **Build-order matters.** The NVIDIA modules resolve symbols that -`open-iov-vfio.ko` exports; building them in the wrong order produces +`vgsp.ko` exports; building them in the wrong order produces `Unknown symbol` failures at load time. See [`../03-architecture/06-host-module-and-hybrid-model.md`](../03-architecture/06-host-module-and-hybrid-model.md). @@ -69,7 +69,7 @@ make userspace ``` **The `nvidia` (OpenRM) stage is optional.** It is needed only when the host -must run NVIDIA's OpenRM modules built against the symbols `open-iov-vfio.ko` +must run NVIDIA's OpenRM modules built against the symbols `vgsp.ko` exports — that is, the native vGPU-management/RM-callback workflows. The QEMU/emulated path uses the distribution driver that already manages the physical GPU; `load-stack` skips the OpenRM submodule when a distribution @@ -167,7 +167,7 @@ by hand while a VM holds the mdev. ## 8. Watching the emulation work Every meaningful decision the emulation makes is visible in `dmesg` with the -prefix **`gsp-resman-vfio:`** (module logs) and the per-RPC traces. Handy: +prefix **`vgsp:`** (module logs) and the per-RPC traces. Handy: ```bash sudo dmesg -w | grep -iE 'gsp-resman-vfio|gsp_|rpc' # live @@ -181,7 +181,7 @@ Developer debug knobs (module parameters) are documented in | Symptom | Start here | |---|---| -| Module will not load | `dmesg`, `modinfo open-iov-vfio.ko`, stale module state → `cleanup-crash` | +| Module will not load | `dmesg`, `modinfo vgsp.ko`, stale module state → `cleanup-crash` | | No mdev type for your GPU | [hardware matrix](../06-portability/hardware-software-matrix.md) | | Guest sees wrong PCIe link speed/width | root-port attachment + config-space mirror (debugging doc) | | `nvidia.ko` probe fails in guest | guest dmesg + `lspci -vvv` + [driver lifecycle field guide](../03-architecture/07-driver-lifecycle-field-guide.md) | @@ -192,7 +192,7 @@ Developer debug knobs (module parameters) are documented in ```bash ./scripts/stack_manager.sh unload -sudo rmmod open_iov_vfio nvidia nvidia_modeset nvidia_uvm # if present +sudo rmmod vgsp nvidia nvidia_modeset nvidia_uvm # if present ``` The project never modifies your host driver's files; removing the Open-IOV diff --git a/docs/03-architecture/01-system-overview.md b/docs/03-architecture/01-system-overview.md index fa328ae..8205154 100644 --- a/docs/03-architecture/01-system-overview.md +++ b/docs/03-architecture/01-system-overview.md @@ -56,7 +56,7 @@ GUEST ════════╪════════════════════════════════════════════════════════════════ HYPERVISOR (KVM/Xen/...) VFIO mdev transport + IOMMU isolation │ -HOST MODULE open-iov-vfio.ko +HOST MODULE vgsp.ko ├─ virtual device: config space, BAR0/BAR1/BAR3 windows, MSI-X ├─ emulation core: GSP boot + GSP-RM (RPC msgq, controls, objects, events) ├─ memory model: guest RAM access, VA↔PA maps, VRAM backing @@ -71,7 +71,7 @@ REAL HARDWARE (engines, memory, interrupts) ## 3. Host module architecture -`open-iov-vfio.ko` is a **VFIO mediated-device (mdev) driver**. It registers a +`vgsp.ko` is a **VFIO mediated-device (mdev) driver**. It registers a parent on the physical GPU and exposes virtual GPU types; each `mdev` instance is one virtual GPU for one VM. diff --git a/docs/03-architecture/06-host-module-and-hybrid-model.md b/docs/03-architecture/06-host-module-and-hybrid-model.md index 0dbc89a..7f670d7 100644 --- a/docs/03-architecture/06-host-module-and-hybrid-model.md +++ b/docs/03-architecture/06-host-module-and-hybrid-model.md @@ -1,6 +1,6 @@ # The Host Module and the Hybrid Model -> `open-iov-vfio.ko` in detail: the virtual device, the emulation engine, the +> `vgsp.ko` in detail: the virtual device, the emulation engine, the > memory model, and how work will be forwarded. This is the "where the code > lives" document. @@ -15,7 +15,7 @@ └────┬──────────────────────────────────────────────┘ │ ┌────┴───────────────────────────────────────────────────────────────┐ - │ open-iov-vfio.ko │ + │ vgsp.ko │ │ virtual device ── emulation core ── memory model ── work path │ └────┬─────────────────────────────────────┬─────────────────────────┘ │ module-owned device + real GSP │ (future) vendor-managed @@ -249,7 +249,7 @@ operations stays a development bridge, not the data plane. ## 6. Debug tooling in the module The module exposes debug parameters (writes to -`/sys/module/open_iov_vfio/parameters/*`) that make the guest's memory and the +`/sys/module/vgsp/parameters/*`) that make the guest's memory and the emulated device inspectable without rebuilding: | Parameter | Purpose | @@ -290,7 +290,7 @@ mismatch. Their workflows are documented in ## 7. Build and symbol contracts -* `open-iov-vfio.ko` exports the `nvidia_vgpu_vfio_*` interface +* `vgsp.ko` exports the `nvidia_vgpu_vfio_*` interface (`nvidia_vgpu_vfio_probe/remove`, ops get/set, mdev parent registration) for hosts that want to pair our device with the NVIDIA OpenRM host modules. * When NVIDIA's OpenRM modules are built from source, they must be built with diff --git a/docs/03-architecture/07-driver-lifecycle-field-guide.md b/docs/03-architecture/07-driver-lifecycle-field-guide.md index 73b007e..3a85da6 100644 --- a/docs/03-architecture/07-driver-lifecycle-field-guide.md +++ b/docs/03-architecture/07-driver-lifecycle-field-guide.md @@ -45,7 +45,7 @@ terminate. **Log signature:** ``` -gsp-resman-vfio: GSP-BOOT: ... trigger auto-cleared ... +vgsp: GSP-BOOT: ... trigger auto-cleared ... ``` ## 3. Static configuration @@ -62,7 +62,7 @@ layout, engine list, vGPU-friendly VF values). **Log signature:** ``` -GSPRM: GET_GSP_STATIC_INFO → ... +vgsp-rm: GET_GSP_STATIC_INFO → ... ``` ## 4. Message queues @@ -81,8 +81,8 @@ byte-stream-based**: each message is one element and may span pages. **Log signature:** ``` -gsp-resman-vfio: libos region[i] id8=... pa=... size=... -gsp-resman-vfio: queue args sharedPA=... ptes=... cmdOff=... statOff=... +vgsp: libos region[i] id8=... pa=... size=... +vgsp: queue args sharedPA=... ptes=... cmdOff=... statOff=... ``` ## 5. Resource-manager initialization (the control battery) @@ -113,7 +113,7 @@ fallback). Representative controls: **Log signature:** ``` -GSPRM: GSP_RM_CONTROL cmd=0x... hClient=0x... hObject=0x... paramsSize=... +vgsp-rm: GSP_RM_CONTROL cmd=0x... hClient=0x... hObject=0x... paramsSize=... ``` ## 6. Object creation @@ -150,7 +150,7 @@ tree reconstructible from `dmesg`. **Log signature:** ``` -GSPRM: GSP_RM_ALLOC class=0x... paramsSize=... hClient=... hParent=... hObject=... +vgsp-rm: GSP_RM_ALLOC class=0x... paramsSize=... hClient=... hParent=... hObject=... ``` ## 7. UVM registration (the wall we climbed) diff --git a/docs/03-architecture/08-physical-gpu-integration.md b/docs/03-architecture/08-physical-gpu-integration.md index 532cd77..6e13e7b 100644 --- a/docs/03-architecture/08-physical-gpu-integration.md +++ b/docs/03-architecture/08-physical-gpu-integration.md @@ -367,7 +367,7 @@ per-context scheduling. Tenant policy and fairness are a later layer on top. release the RPC runs once (only when the full boot stage ran) before the existing quiesce/FWSEC teardown; without a full boot the fail-safe behaviour is unchanged. A write-only debugfs trigger - (`open-iov-vfio/gsp-phys-unload-rpc`, write "1") lets a live claimed + (`vgsp/gsp-phys-unload-rpc`, write "1") lets a live claimed session test the shutdown without touching WPR2. All of it is inert unless the full boot stage ran. **Live-verified (2026-10-01):** the unload RPC shuts the server down (GSP-RM processor suspended in ~220 ms, handoff bits @@ -375,7 +375,7 @@ per-context scheduling. Tenant policy and fairness are a later layer on top. reboot on every clean cycle. * **Update (2026-10-01) — rung 4c slice 1 implemented (build-only):** for the next cycle a host resource-manager static-info probe is available: the - write-only debugfs file `open-iov-vfio/gsp-phys-rm-probe` (write "1", only + write-only debugfs file `vgsp/gsp-phys-rm-probe` (write "1", only when GSP-RM init-done was observed) sends `GET_GSP_STATIC_INFO` over the real command queue and decodes the server's static configuration (internal handles, split-VA flag, BAR1/2 PDE bases, framebuffer geometry, engine diff --git a/docs/03-architecture/09-full-system-picture.md b/docs/03-architecture/09-full-system-picture.md index 3c15830..97b4617 100644 --- a/docs/03-architecture/09-full-system-picture.md +++ b/docs/03-architecture/09-full-system-picture.md @@ -38,7 +38,7 @@ flowchart TB IOMMU["IOMMU / IOMMUFD<br/>per-VM DMA address spaces"] end - subgraph MOD["open-iov-vfio.ko - the only host component"] + subgraph MOD["vgsp.ko - the only host component"] VDEV["Virtual device<br/>config space, BAR0/1/3, MSI-X"] EMU["Emulation core<br/>GSP boot + GSP-RM RPC + objects"] MEMM["Memory model<br/>VA to PA, pins, VRAM shadow, page tables"] @@ -207,7 +207,7 @@ flowchart LR VRS["VRAM objects - BAR1 aperture view"] end - subgraph MM["open-iov-vfio.ko memory model"] + subgraph MM["vgsp.ko memory model"] DISC["Discovery<br/>structure walk + content scan + pins"] PMAP["VA to PA map<br/>page-granular, merge rebuilds"] SHAD["BAR1 VRAM shadow"] @@ -362,7 +362,7 @@ flowchart TB T2["VM B - mdev 2"] T3["VM C - mdev N"] end - subgraph MOD["open-iov-vfio.ko"] + subgraph MOD["vgsp.ko"] Q1["Emulation context 1<br/>BARs, queues, counters"] Q2["Emulation context 2"] Q3["Emulation context N"] diff --git a/docs/03-architecture/12-host-vf-acceleration-future-goal.md b/docs/03-architecture/12-host-vf-acceleration-future-goal.md index 298b329..5a331c8 100644 --- a/docs/03-architecture/12-host-vf-acceleration-future-goal.md +++ b/docs/03-architecture/12-host-vf-acceleration-future-goal.md @@ -14,7 +14,7 @@ Give a process **running on the host OS** GPU acceleration through the open-iov device model: bind the host's stock NVIDIA kernel driver to a virtual function -or virtual device presented by `open-iov-vfio.ko`, so that host userspace +or virtual device presented by `vgsp.ko`, so that host userspace (`libcuda`, `nvidia-smi`, CUDA applications) consumes the mediated device the way a guest does, with no VM in between. diff --git a/docs/05-operations/02-debugging-and-maintenance-workflows.md b/docs/05-operations/02-debugging-and-maintenance-workflows.md index b7aab25..cb3ea28 100644 --- a/docs/05-operations/02-debugging-and-maintenance-workflows.md +++ b/docs/05-operations/02-debugging-and-maintenance-workflows.md @@ -12,7 +12,7 @@ Three layers, in order of usefulness: precisely what it expected and what it got (e.g. UVM's "Tracker entry for value N … channel_init()"). Always start here. 2. **Host module trace** — every RPC and every emulation decision is logged - with the `gsp-resman-vfio:` prefix. A full CUDA run produces a few hundred + with the `vgsp:` prefix. A full CUDA run produces a few hundred lines that reconstruct the object tree and the control battery. 3. **Memory observation** — when the problem is in memory state (mappings, semaphores, pushes), the module's debug parameters read and write guest @@ -52,13 +52,13 @@ See the host-module doc for the full list. Canonical examples: ```bash # Find where a value lives in guest RAM (e.g. a semaphore VA): -echo 0x121000000 | sudo tee /sys/module/open_iov_vfio/parameters/scan_guest_ram +echo 0x121000000 | sudo tee /sys/module/vgsp/parameters/scan_guest_ram # Find a decoded method sequence in guest RAM: -echo 0x1,0x21000000,0x1 | sudo tee /sys/module/open_iov_vfio/parameters/scan_seq +echo 0x1,0x21000000,0x1 | sudo tee /sys/module/vgsp/parameters/scan_seq # Write a value to a guest physical address (completing a semaphore release): -echo 0x120299010,0x1 | sudo tee /sys/module/open_iov_vfio/parameters/poke_guest +echo 0x120299010,0x1 | sudo tee /sys/module/vgsp/parameters/poke_guest ``` **Caution:** all guest-RAM operations run in a kernel thread context by design; @@ -282,7 +282,7 @@ addresses into a new configuration — re-derive per firmware. [`../06-portability/hardware-software-matrix.md` §6](../06-portability/hardware-software-matrix.md)). * Add the new entry to the runtime signature database in `kernel/firmware_analyzer.c` (`known_signatures[]`: version string, hashes, - discovered addresses). This is what lets one `open-iov-vfio.ko` identify + discovered addresses). This is what lets one `vgsp.ko` identify multiple firmware versions safely. **5. Validate (same checklist every version).** @@ -380,14 +380,14 @@ ordering; the quickstart and tool chooser are in the | Symptom | Likely cause | First check | |---------|--------------|-------------| -| `insmod open-iov-vfio.ko: Unknown symbol` | missing prerequisite module (`mdev`) | `modprobe mdev vfio vfio_iommu_type1 vfio_pci` | +| `insmod vgsp.ko: Unknown symbol` | missing prerequisite module (`mdev`) | `modprobe mdev vfio vfio_iommu_type1 vfio_pci` | | mdev create `-EUSERS` | `available_instances` = 0 (leak) | `cat .../available_instances` | | Guest: no PCI device | mdev not attached | QEMU command line for `sysfsdev=` | | Guest: sees device, probe hangs instantly | BAR0 mmap PFN bug (fixed) | host `make_spte` WARN | | Guest: probe hangs, no KVM warning | doorbell/RPC never consumed | host dmesg for the emulation thread and doorbell writes | | Guest: RPC processed but driver still waits | MSI-X never delivered | `SET_IRQS wired` line; `irqs[0].trigger` non-NULL | | Guest agent dead, QEMU alive | guest kernel wedge | gdbstub vCPU sampling (§3.7) | -| `rmmod open_iov_vfio` hangs | leaked kthread / open fds | `ps -e \| grep gsp_emu`; mdevs still present? | +| `rmmod vgsp` hangs | leaked kthread / open fds | `ps -e \| grep gsp_emu`; mdevs still present? | | Guest Code 43 / probe fail (Windows) | config space / MSI-X details | config read/write logs | | `pr_warn_ratelimited(... not supported in emulation mode)` | guest used a BAR_TRAP/MIGRATE RPC | expected fail-fast; wire a real handler if hot | diff --git a/docs/05-operations/03-risc-v-gsp-rm-vm.md b/docs/05-operations/03-risc-v-gsp-rm-vm.md index cde0736..a55e3ac 100644 --- a/docs/05-operations/03-risc-v-gsp-rm-vm.md +++ b/docs/05-operations/03-risc-v-gsp-rm-vm.md @@ -29,7 +29,7 @@ its runtime behaviour inspectable with Frida-like primitives: "execute until here" from the decompiler. Its stated purpose is **simulating and inspecting the GSP firmware's runtime -memory for `gsp-rm-vfio` accuracy measurements**: capture how the firmware +memory for `vgsp` accuracy measurements**: capture how the firmware behaves, compare that with the emulation and with the physical backend, and survive GSP version/device/architecture churn with repeatable evidence. diff --git a/docs/05-operations/04-risc-v-gsp-rm-debugger-user-guide.md b/docs/05-operations/04-risc-v-gsp-rm-debugger-user-guide.md index c1ecffe..d16da23 100644 --- a/docs/05-operations/04-risc-v-gsp-rm-debugger-user-guide.md +++ b/docs/05-operations/04-risc-v-gsp-rm-debugger-user-guide.md @@ -18,7 +18,7 @@ authoritative details live in the tool's own documentation set risc-v-gsp-rm-debugger runs GSP/uproc firmware in a controllable machine, instruments it with Frida-like primitives, records a durable session, changes the machine's inputs (including injected code), and compares runs so that emulation changes -in `open-iov-vfio` land with evidence instead of anecdotes. +in `vgsp` land with evidence instead of anecdotes. | It is | It is not | |---|---| @@ -363,7 +363,7 @@ audited v0.1 surfaces; treat changes to them as reviewed events. gdbstub. * **No guest, no hardware, no product.** Nothing runs in a guest; injected services are prototypes, not shipped code; product changes go through - `open-iov-vfio` with physical confirmation. + `vgsp` with physical confirmation. * **Read by default; writes gated.** MCP `write_mem`/`call_function` need `--allow-write`, injection needs `--allow-inject`, and every write is recorded in the session. diff --git a/docs/06-portability/03-device-validation-and-porting-sequence.md b/docs/06-portability/03-device-validation-and-porting-sequence.md index e4e7be5..2756777 100644 --- a/docs/06-portability/03-device-validation-and-porting-sequence.md +++ b/docs/06-portability/03-device-validation-and-porting-sequence.md @@ -126,7 +126,7 @@ Per driver/firmware version `N`: 5. **Supervised physical cycle** (approved, attended): * boot the guest with the stock driver of version `N` on the device bound to `vfio-pci`; run the CUDA smoke and the ioctl tracer; - * capture host module trace (`gsp-resman-vfio:`), guest dmesg, + * capture host module trace (`vgsp:`), guest dmesg, `nvidia-smi -q`, `lspci -vvv`, and the control/ioctl sequence; * compare the physical captures with the simulator sessions (`./risc-v-gsp-rm-debugger.sh compare`, M1–M6) and resolve every delta as profile, logic or diff --git a/docs/07-developers/02-development-and-analysis-environment.md b/docs/07-developers/02-development-and-analysis-environment.md index f19a4d8..c58ec35 100644 --- a/docs/07-developers/02-development-and-analysis-environment.md +++ b/docs/07-developers/02-development-and-analysis-environment.md @@ -35,7 +35,7 @@ and the tool's own flowchart TB subgraph HOST["Lab host - x86_64 or aarch64"] SM["scripts/stack_manager.sh<br/>build / load / status / test / unload"] - MOD["open-iov-vfio.ko<br/>virtual device + GSP-RM emulation + backend"] + MOD["vgsp.ko<br/>virtual device + GSP-RM emulation + backend"] QEMU["QEMU / KVM<br/>scripts/vgpu_vm.py, launch_qemu_*.sh"] VFIO["VFIO mdev + IOMMU isolation"] RMTOOLS["tools/rmtool, rmtop, rmq<br/>read-only host RM oracle"] @@ -83,14 +83,14 @@ flowchart TB ## 3. Host stack: KVM, QEMU, VFIO and the module -The reference path is KVM + QEMU with the VFIO mdev transport. `open-iov-vfio.ko` +The reference path is KVM + QEMU with the VFIO mdev transport. `vgsp.ko` emulates the device interface and GSP-RM behaviour (or drives the physical backend, per the chosen execution mode); the guest runs stock drivers only. ```bash ./install.sh deps nvidia firmware build # full host setup (stages selectable) make kernel # or: ./scripts/stack_manager.sh build-kernel -./scripts/stack_manager.sh load-open-iov # load open-iov-vfio.ko +./scripts/stack_manager.sh load-open-iov # load vgsp.ko ./scripts/stack_manager.sh mdev-create # create the mediated device ./scripts/vgpu_vm.py start vgpu-linux # guest lifecycle + guest-agent exec/shell ./scripts/stack_manager.sh test # host test suite @@ -246,7 +246,7 @@ the long-term program is | `stack_manager.sh` | build/load/status/test/unload with correct ordering | every host-stack change or bring-up | `scripts/stack_manager.sh` | [`03-architecture/06` §7](../03-architecture/06-host-module-and-hybrid-model.md) | | `vgpu_vm.py` | VM lifecycle + guest-agent exec/shell | booting/inspecting the guest | `scripts/vgpu_vm.py` | [`05-operations/02`](../05-operations/02-debugging-and-maintenance-workflows.md) | | QEMU launch/gdb helpers | direct QEMU launches, QMP/gdbstub access | gdbstub triage, direct QEMU runs | `scripts/launch_qemu_*.sh`, `qemu_*.sh/py` | [`05-operations/02` §3.3/§3.7](../05-operations/02-debugging-and-maintenance-workflows.md) | -| module debug parameters | guest-RAM scan/poke, live trace | memory-state debugging in kernel context | `/sys/module/open_iov_vfio/parameters/` | [`05-operations/02` §3.1–3.2](../05-operations/02-debugging-and-maintenance-workflows.md) | +| module debug parameters | guest-RAM scan/poke, live trace | memory-state debugging in kernel context | `/sys/module/vgsp/parameters/` | [`05-operations/02` §3.1–3.2](../05-operations/02-debugging-and-maintenance-workflows.md) | | `guest-diag` | ioctl trace, engine list, pmap | driver-side oracle for a guest failure | `tools/guest-diag/` | [`05-operations/02` §3.4](../05-operations/02-debugging-and-maintenance-workflows.md) | | `cudatool.py` | CUDA binary info/delta/crash/fdematch | every `libcuda` version bump or crash | `userspace/cuda/tools/` | [`READ-ME-FIRST` §3](../../userspace/cuda/READ-ME-FIRST.md) | | `callwalk.py` | caller/callee/path walks | tracing a crash path through the corpus | `userspace/cuda/tools/` | [`READ-ME-FIRST` §3](../../userspace/cuda/READ-ME-FIRST.md) | @@ -287,7 +287,7 @@ flowchart LR end A2 -->|"symbol DB with bias<br/>(symbols export)"| B1 B3 -->|"export_hits, fault PC,<br/>corpus bucket:line"| A1 - A3 --> C["emulation change in open-iov-vfio"] + A3 --> C["emulation change in vgsp"] B3 --> C C --> D["physical confirmation +<br/>regression with the same stimulus"] ``` diff --git a/docs/07-developers/onboarding-and-standards.md b/docs/07-developers/onboarding-and-standards.md index 50f4f93..ef6388e 100644 --- a/docs/07-developers/onboarding-and-standards.md +++ b/docs/07-developers/onboarding-and-standards.md @@ -109,7 +109,7 @@ The following rules each come from a real bug and are enforced in review: `-ENOTSUPP` with `pr_warn_ratelimited` until a real handler exists. * **Log through the NULL-tolerant `nv_vgpu_*` wrappers and rate-limit** anything a guest can spam. -* `open-iov-vfio.ko` is **standalone**: no `MODULE_SOFTDEP`/dependency on +* `vgsp.ko` is **standalone**: no `MODULE_SOFTDEP`/dependency on `nvidia` — `nvidia.ko` imports our symbols, not the other way around. * VM access in tooling goes through `scripts/vgpu_vm.py`; do not invoke QEMU directly. @@ -158,7 +158,7 @@ The following rules each come from a real bug and are enforced in review: | `tools/firmware_analyzer.py` + Ghidra scripts | firmware analysis pipeline | | module debug parameters | guest-memory scanning/poking, VRAM inspection; physical-backend parameters and debugfs state/control files (see [`../eng-ops.md`](../eng-ops.md) Part II) | | QEMU gdbstub workflow | guest virtual-memory inspection/writing | -| `debug/risc-v-gsp-rm-vm/` (risc-v-gsp-rm-debugger) | implemented, documented and tested ([audit](../../debug/risc-v-gsp-rm-vm/docs/27-TOOL-AUDIT.md); [value demos](../../debug/risc-v-gsp-rm-vm/docs/25-VALUE-VALIDATION.md)) — RISC-V GSP/uproc VM runtime inspection, session recording and `gsp-rm-vfio` accuracy measurement (see [`../05-operations/03-risc-v-gsp-rm-vm.md`](../05-operations/03-risc-v-gsp-rm-vm.md)) | +| `debug/risc-v-gsp-rm-vm/` (risc-v-gsp-rm-debugger) | implemented, documented and tested ([audit](../../debug/risc-v-gsp-rm-vm/docs/27-TOOL-AUDIT.md); [value demos](../../debug/risc-v-gsp-rm-vm/docs/25-VALUE-VALIDATION.md)) — RISC-V GSP/uproc VM runtime inspection, session recording and `vgsp` accuracy measurement (see [`../05-operations/03-risc-v-gsp-rm-vm.md`](../05-operations/03-risc-v-gsp-rm-vm.md)) | | `wiki/` documents | protocol and firmware deep dives | ## 5. Landing a change @@ -177,7 +177,7 @@ The following rules each come from a real bug and are enforced in review: ## 6. Makefile targets ```bash -make kernel # open-iov-vfio.ko (first!) +make kernel # vgsp.ko (first!) ./scripts/build_nvidia_openrm.sh # optional OpenRM modules, KBUILD_EXTRA_SYMBOLS from kernel/Module.symvers make userspace # libiov.so, examples make all # in the correct order diff --git a/docs/09-reference/legal-and-licensing.md b/docs/09-reference/legal-and-licensing.md index 87d8002..1d82735 100644 --- a/docs/09-reference/legal-and-licensing.md +++ b/docs/09-reference/legal-and-licensing.md @@ -11,7 +11,7 @@ | Component | License | Rationale | |---|---|---| -| `kernel/**` (e.g. `open-iov-vfio.ko`) | **GPL-2.0** (`MODULE_LICENSE("GPL v2")`) | The Linux kernel exports the interfaces we need (VFIO, mdev, IOMMU, DMA) under `EXPORT_SYMBOL_GPL`. GPL-2.0 is the legally correct choice. | +| `kernel/**` (e.g. `vgsp.ko`) | **GPL-2.0** (`MODULE_LICENSE("GPL v2")`) | The Linux kernel exports the interfaces we need (VFIO, mdev, IOMMU, DMA) under `EXPORT_SYMBOL_GPL`. GPL-2.0 is the legally correct choice. | | `userspace/**`, `tools/**`, `scripts/**`, `config/**`, `docs/**` | **BSD-3-Clause** | Maximizes reuse and adoption — the project's mission. | | Third-party submodules and imported trees | their own licenses | Not relicensed; used under their terms. | diff --git a/docs/10-post-1.0/experimental-host-acceleration.md b/docs/10-post-1.0/experimental-host-acceleration.md index 38b9774..2095a49 100644 --- a/docs/10-post-1.0/experimental-host-acceleration.md +++ b/docs/10-post-1.0/experimental-host-acceleration.md @@ -93,7 +93,7 @@ document may be started. itself* use the GPU at full capability — host desktop (X11/Wayland) on the physical outputs (HDMI/DP), host CUDA/3D through the real stock driver, and guests running concurrently in compartments, with scheduling and -compartmentalization enforced by `open-iov-vfio.ko`. +compartmentalization enforced by `vgsp.ko`. This stretch goal is explicitly **one**: it is attempted only after every baseline goal is met, and it must not jeopardize them. @@ -107,7 +107,7 @@ baseline goal is met, and it must not jeopardize them. | S1 | The host's real, stock `nvidia.ko` provides host CUDA/3D and the host desktop | | S2 | Full display output from the GPU's HDMI/DP, driving the host desktop | | S3 | Guest frame buffers are shown on the host (Looking Glass / KVMFR / IVSHMEM), both sides accelerated | -| S4 | Host and guest work coexist on one GPU under `open-iov-vfio.ko` scheduling and compartmentalization | +| S4 | Host and guest work coexist on one GPU under `vgsp.ko` scheduling and compartmentalization | | S5 | High performance: work-dominated workloads within a few percent of native; launch-bound latency bounded and published | | S6 | No unnecessary memory copies; zero-copy workload path | | S7 | Isolation: a guest can never reach host memory or host interrupts; fail closed | diff --git a/docs/README.md b/docs/README.md index 0873387..05ee0d6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -42,7 +42,7 @@ flowchart TB subgraph HYP["Hypervisor - KVM and QEMU"] D["VFIO mdev transport + IOMMU isolation"] end - subgraph MOD["open-iov-vfio.ko - the only host component"] + subgraph MOD["vgsp.ko - the only host component"] E["Virtual device - BARs, config space, MSI-X"] F["GSP boot + GSP-RM emulation"] G["Memory model + work path"] @@ -226,7 +226,7 @@ The pre-reboot flat documents have been merged into this tree and removed and risc-v-gsp-rm-debugger user guide; additive only. --> * firmware runtime analysis (experimental): running GSP/uproc firmware in a - RISC-V QEMU VM with hooks, watchpoints, memory dumps and `gsp-rm-vfio` + RISC-V QEMU VM with hooks, watchpoints, memory dumps and `vgsp` accuracy measurement — implemented, documented and tested ([audit](../debug/risc-v-gsp-rm-vm/docs/27-TOOL-AUDIT.md); [value demos](../debug/risc-v-gsp-rm-vm/docs/25-VALUE-VALIDATION.md)) → [`05-operations/03-risc-v-gsp-rm-vm.md`](05-operations/03-risc-v-gsp-rm-vm.md) (tooling in [`../debug/risc-v-gsp-rm-vm/`](../debug/risc-v-gsp-rm-vm/README.md)) diff --git a/docs/RUNBOOK.md b/docs/RUNBOOK.md index c0dd3c8..c0d80d9 100644 --- a/docs/RUNBOOK.md +++ b/docs/RUNBOOK.md @@ -28,7 +28,7 @@ Rules for reading under pressure: 1. Find the symptom in §5 (scenario catalogue) or §9 (one-page decision tree). 2. Follow the **response order** exactly; do not skip the pairing/hash check. -3. Before any action that could change `open-iov-vfio`, complete the evidence +3. Before any action that could change `vgsp`, complete the evidence bundle (§6) and pass the escalation gates (§7). 4. Record the outcome where the scenario says to record it — a finding without a record is lost work. @@ -164,7 +164,7 @@ actor, and it does not justify shortcuts. | **Decide** | 7 | Fill the M1–M6 skeleton with the reference-capture method; list unexplained deltas | Metric table and open list attached | | | 8 | Choose: no change, version-keyed handler, profile data, or fidelity gap | Decision names the evidence that drove it | | | 9 | If the decision changes emulation behaviour, require physical reproduction; if it touches RM 610, stop at the gate | Gate passed or work parked | -| **Act** | 10 | Implement in `open-iov-vfio` with the evidence bundle linked; never in the simulator | PR carries the bundle and the metric table | +| **Act** | 10 | Implement in `vgsp` with the evidence bundle linked; never in the simulator | PR carries the bundle and the metric table | | | 11 | Re-run the identical stimulus; require profiles to improve or stay equal; re-run the guest ladder | No rung regression; CI green | | | 12 | Archive the bundle and update the matrix/version docs only where earned | Recorded and reversible | diff --git a/docs/eng-ops.md b/docs/eng-ops.md index 218b8cd..20985d7 100644 --- a/docs/eng-ops.md +++ b/docs/eng-ops.md @@ -198,7 +198,7 @@ flowchart LR HR["harness/*.py"] end subgraph HOST["Host and guest"] - MOD["open-iov-vfio.ko"] + MOD["vgsp.ko"] VM["stock guest + guest-diag"] RMH["rmtool/rmtop/rmq + rmharness"] end @@ -450,7 +450,7 @@ decision. **Caveat, in every package README: this is a simulation package, not a signed production image.** It is not a firmware patch, must never be flashed or injected into a guest, and is not bootable on silicon. Injected code is development-only ([`docs/12`](../debug/risc-v-gsp-rm-vm/docs/12-INJECTION-SDK.md) §1); -productization goes through `open-iov-vfio` + physical confirmation, never +productization goes through `vgsp` + physical confirmation, never through a simulator package. Local-only, budgeted, session-recorded; never touches `/dev`, a module, an @@ -550,7 +550,7 @@ the rules win. **Build order (physical-backend work needs the kernel module only):** -1. Build `open-iov-vfio.ko` first; it generates the `Module.symvers` the +1. Build `vgsp.ko` first; it generates the `Module.symvers` the optional OpenRM modules link against. `scripts/stack_manager.sh build-kernel`. 2. Build the optional OpenRM `nvidia.ko` with @@ -566,7 +566,7 @@ the rules win. 1. Prerequisites: `vfio`, `vfio_iommu_type1`, `vfio_pci`, `mdev` (`scripts/stack_manager.sh load-prereqs`). -2. `open-iov-vfio.ko` with the exact reviewed parameter set +2. `vgsp.ko` with the exact reviewed parameter set (`scripts/stack_manager.sh load-open-iov`). The backend claim is **module-owned** at load with `gsp_phys_gpu=1 gsp_phys_hazard_ack=1`, or **mdev-owned** and deferred to the first mdev create with @@ -602,7 +602,7 @@ authoritative for the literal default. | `gsp_phys_fault_relay` | 0 | On a relay timeout, drain the status queue for the engine fault (`0x1006`, corroborated by `0x1020`), match runlistId/chid and write the guest channel notifier + event. | Requires `gsp_phys_relay=1` and the three parameters above. | | `gsp_phys_fault_inject` | 0 | Debug: write the relayed pair's source PTE as zero to force an engine fault on the next relay submission; only relayed pairs are affected. | Requires the relay path; default 0 programs the real source HPA. | | `gsp_phys_rmcall_engine` | 0 | Ladder engine: 0 = COPY0 (CE copy submission), 1 = GR0 (compute object, BIND engineType 1, GR semaphore release). Snapshotted when stage 3 starts; mid-session changes are ignored. | Requires boot + init-done; CE forwarding paths refuse on a GR ladder. | -| `gsp_phys_rmcall_gr_promote` | 0 (clamp 0..3) | GR context-promote bisection: **0 never sends `PROMOTE_CTX`** (the ladder stops after the geometry queries, context buffer/PT allocation, PDB mapping and channel/compute alloc, before BIND); 1 = single MAIN entry, initialize/no-nonmapped, size raw+subctx; 2 = two-phase PA-only then VA-only; 3 = single entry with the exact raw size. Nonzero enables can assert GSP-RM (`0x52a8b04`) and wedge the device. | GR ladder only; value snapshotted at stage 3; **requires confirmed reboot readiness** before enabling. | +| `gsp_phys_rmcall_gr_promote` | 0 (clamp 0..17) | GR context-promote bisection: **0 never sends `PROMOTE_CTX`** (the ladder stops after the geometry queries, context buffer/PT allocation, PDB mapping and channel/compute alloc, before BIND); 1 = single MAIN entry, initialize/no-nonmapped, size raw+subctx; 2 = two-phase PA-only then VA-only with the same PA/VA/size; 3 = single entry with the exact raw size; 4 = two-phase with the reference client's zero-field VA-only step; 5 = one control with `entryCount=2` (PA-only init + zero-field VA-only); 6 = no-entry `hVirtMemory`: allocate an `NV01_MEMORY_VIRTUAL` (class 0x70) VA-range object on the ladder VAS at the context window, then `PROMOTE_CTX` with `hVirtMemory`/`virtAddress`/`size` and `entryCount=0`; 7 = no-entry bare `(virtAddress, size)` with `entryCount=0` and no `hVirtMemory`; 8 = single MAIN entry like 1 on the KMD-managed channel variant V6 (the V5 channel plus alloc flag `SKIP_CTXBUFFER_ALLOC` bit 31); 9 = same V6 channel with the stock client's zero-field VA-only MAIN entry (`bInitialize=0`); 10 = same V6 channel, `GPU_INITIALIZE_CTX` (`0x2080012d`) installs the physical context memdesc first, then `PROMOTE_CTX` `entryCount=0` bare `(virtAddress, size)`; 11 = mode 10 with the context buffer swapped to a server FBMEM allocation (class 0x40, VIDMEM `physAttr=0x4`, aperture-0 leaf PTEs); 12 = V5 UVM/vGPU-faithful PA-only MAIN entry (`bInitialize=1 bNonmapped=1`, no VA) and continue to BIND/SCHEDULE/submit; 13 = mode 12 plus a PATCH PA-only promote first (size from engine context properties engineId 0x10); 14 = V6 KMD channel + PATCH PA-only then the single-entry MAIN init+VA (the flow that books the context VA and calls the commit); 15 = mode 14 with a server FBMEM MAIN buffer and VIDMEM `physAttr 0x4`; 16 = mode 14 plus a PM ctxsw PA-only promote first (engineId 0x09); 17 = no client promote, paired with `gsp_phys_srv_ctxbuf=1` (pre-boot registry profile with `RMSetClientRMAllocatedCtxBuffer=0`) so the GSP-RM server-manages the context buffers. Live result: modes 1, 2 step 2 and 4 all wedged GSP-RM (`0x52a8b04`, `NV_ERR_OBJECT_NOT_FOUND` 0x57 in the LOGINIT stack) while the PA-only nonmapped step of modes 2/4 is accepted every time - the VA resolve, not the entry fields, is the wall (our external VAS has no server-side VA booking). Mode 6 (hVirtMemory, V5 channel) was refused **cleanly** (`status=0x1f` `NV_ERR_INVALID_ARGUMENT`, no assert, clean release) because the channel was not KMD-managed. Modes 8-11 all completed with **clean releases** (WPR2 down, driver rebound, 5 locks, pstore empty): the V6 channel alloc is accepted (`flags=0x80800000`); modes 8 and 9 (with and without an init entry) both return a clean `status=0x40` `NV_ERR_INVALID_STATE` (mode 9 without the server error log - entry shape irrelevant); mode 10's `GPU_INITIALIZE_CTX` is accepted (`status=0`) but the bare-VA promote still returns `0x40` with the same server log anchor; mode 11 (server FBMEM context buffer) returns `0x40` with a **different** server log anchor, so FBMEM moves the failure to a different structural check. Session 2 (modes 12-17, all clean): mode 12's V5 PA-only MAIN promote is **accepted** (`status=0`) and BIND succeeds, but the GR push faults `CTXNOTVALID` (`sem=0`, `GPGet=1`) - the accepted entry does not set `ENG_CTX_VALID`; mode 13 (PATCH first) and mode 14/15/16 (V6 KMD + PATCH, +PM, FBMEM/VIDMEM) all leave the MAIN promote at the same `0x40` rec-677 site as mode 8, so PATCH/PM/buffer type are not the missing prerequisite; mode 17 (registry `RMSetClientRMAllocatedCtxBuffer=0`, no promote) also faults `CTXNOTVALID`, so even server-managed context buffers leave the channel invalid - the remaining wall is the engine-context commit/RAMFC path, not buffer ownership. Nonzero enables can still assert GSP-RM and wedge the device. | GR ladder only; value snapshotted at stage 3; **requires confirmed reboot readiness** before enabling. | | `gsp_phys_repower` | 0 (latched) | Restore the pre-claim runtime-PM/D3cold policy when releasing the GPU; with 0 the D0 locks and runtime reference are deliberately left held until reboot. | **Never enable** (rule 3); re-arming D3cold after a claim can hard-freeze the host. | The emulation-side `sema_*` parameters (ring discovery, release recovery, @@ -627,7 +627,7 @@ hard signature. **Step 1 — build and identity check.** Rebuild the reviewed source; record the module hash; never run a cycle against a stale or unknown module. -**Step 2 — load.** Prerequisites, then `open-iov-vfio.ko` with the reviewed +**Step 2 — load.** Prerequisites, then `vgsp.ko` with the reviewed parameters. Module-owned: the claim and requested stages run at load. Mdev-owned: load, then create the mdev (the async claim/boot starts) only when no VM is live. @@ -699,7 +699,7 @@ written post-reboot plan - never a second attempt in the same boot. ### 10.4 debugfs inventory All files live under the module's debugfs directory -`/sys/kernel/debug/open-iov-vfio/`. **The directory and every file are +`/sys/kernel/debug/vgsp/`. **The directory and every file are root-only on this system**: existence and read checks must run as root (a permission error can look like an absent file). Every writer is inert unless its gates hold, and every accepted write performs a real RPC or device @@ -760,11 +760,11 @@ bump, device/ISA/ROM change, protected state, matrix/CI) are owned by | Symptom | Exact signal to look for | Decode / likely cause | First diagnostic | Action | |---|---|---|---|---| | Guest GR push faults | `func=0x1006 ... exceptType=0x20 runlistId=0 chid=1 errString="... intr1 80000000"`; NOCAT `recType=4 errorCode=0x20 faultingEngine="GR"` | `0x20` = robust-channel PBDMA error; `intr1` bit 31 = `CTXNOTVALID`; the external-VAS GR engine context was never committed (`ENG_CTX_VALID=0`), so the guest binds via `PROMOTE_CTX` (`0x2080012b`). CE channels are unaffected. | `gsp-phys-status-drain`; `gsp-phys-state` `rm_call`/`rm_call_ctx` | Decode first, no retry. Only a proven promote shape commits the context; keep the client promote path gated by `gsp_phys_rmcall_gr_promote=0` until a variant is proven. | -| `PROMOTE_CTX` wedge | `gsp-nocat: rec seq=N recType=5 errorCode=0x52a8b04 source="ASSERT" faultingEngine=""`, then no fn76 reply (timeout `-110`); status ring stops, server command read pointer advanced | A host/server-RM assert in the promote path - not an engine fault (no `0x1006`). The server consumed the command and wrote no reply. Teardown cannot clear WPR2 (its unlock is fuse-locked on this part). | `gsp-phys-state` (`cmd_tx`/`stat_tx`, `wpr2`), release log | Ladder aborts by design; **do not retry**. Fail-safe holds the device; reboot with written approval (rule 2); bisect exactly one promote variant per cycle after reboot. | +| `PROMOTE_CTX` wedge | `vgsp-nocat: rec seq=N recType=5 errorCode=0x52a8b04 source="ASSERT" faultingEngine=""`, then no fn76 reply (timeout `-110`); status ring stops, server command read pointer advanced | A host/server-RM assert in the promote path - not an engine fault (no `0x1006`). The server consumed the command and wrote no reply. Teardown cannot clear WPR2 (its unlock is fuse-locked on this part). | `gsp-phys-state` (`cmd_tx`/`stat_tx`, `wpr2`), release log | Ladder aborts by design; **do not retry**. Fail-safe holds the device; reboot with written approval (rule 2); bisect exactly one promote variant per cycle after reboot. | | WPR2 / clean-release failure | `teardown did not clear WPR2 (HI=0x...)`; `release: WPR2 still up after teardown ... refusing the hand-back`; `NOT rebinding ... power domain stays LOCKED` | The booter-unload gate bits were never completed by the wedge, or the board stopped answering; the host-side unlock is fuse-locked. | `gsp-phys-state` `wpr2`, `scratch14`, `stage:` | Fail-safe is the designed state: no rebind, locks held, WPR2 up. Leave the device; reboot with approval. | | Module unload hang | `rmmod` does not return; `ps` shows the emulation/relay kthreads or work items; mdev still present | Teardown ordering (kthread/workqueue) or an open mdev/VM; the emulation-side cleanup applies. | `ps -e \| grep gsp_emu`; mdev list; `dmesg` tail | Remove mdev/stop VM first; `scripts/stack_manager.sh cleanup-crash`; reboot with approval if it persists (rule 5). | -| Guest `cuInit` wedge / guest flake | guest `cuInit rc=999`, `rmapiControlCacheSet ... NV_ERR_INVALID_PARAMETER`, or a host `gsp-phys-fwsec: unexpected WPR2 already up`; a one-off guest Oops in `free_swap_cache` cleared on retry | On the emulated path this is a known guest-side flake; the WPR2-up line is the FWSEC refusal on a board already in a bad state. | guest dmesg; host `gsp-phys-state` `wpr2`; retry the guest once | If only the guest flaked, restart the guest once. If `unexpected WPR2 already up` appears, stop the cycle and inspect state; never retry FWSEC (rule 4/5). | -| GSP boot failure | `gsp-phys-fwsec: staging not visible before kick (DMEM0 ... IMEM ...)` then `FWSEC/FRTS execution failed: -5`; historical `GSP_INIT_DONE rpc_result=0x59` | Staging DMA did not land (async mdev-owned FWSEC path) or, historically, the pre-boot handshake/identity payload was wrong (`0x59` = operating-system error). | `gsp-phys-state` `stage:`, `gsp-phys-log-dump` | Use the module-owned claim path (proven); the async FWSEC defect is fail-open and off the critical path. Do not repeat a failed boot in the same boot after a hard signature. | +| Guest `cuInit` wedge / guest flake | guest `cuInit rc=999`, `rmapiControlCacheSet ... NV_ERR_INVALID_PARAMETER`, or a host `vgsp-fwsec: unexpected WPR2 already up`; a one-off guest Oops in `free_swap_cache` cleared on retry | On the emulated path this is a known guest-side flake; the WPR2-up line is the FWSEC refusal on a board already in a bad state. | guest dmesg; host `gsp-phys-state` `wpr2`; retry the guest once | If only the guest flaked, restart the guest once. If `unexpected WPR2 already up` appears, stop the cycle and inspect state; never retry FWSEC (rule 4/5). | +| GSP boot failure | `vgsp-fwsec: staging not visible before kick (DMEM0 ... IMEM ...)` then `FWSEC/FRTS execution failed: -5`; historical `GSP_INIT_DONE rpc_result=0x59` | Staging DMA did not land (async mdev-owned FWSEC path) or, historically, the pre-boot handshake/identity payload was wrong (`0x59` = operating-system error). | `gsp-phys-state` `stage:`, `gsp-phys-log-dump` | Use the module-owned claim path (proven); the async FWSEC defect is fail-open and off the critical path. Do not repeat a failed boot in the same boot after a hard signature. | | MMU/PTE faults and the fetch-line rule | engine copy times out with no semaphore; `GUEST CE COPY FAILED: scratch-PT pool exhausted ... capacity=512`; re-translated GPA yields a different HPA | The GMMU caches PTE fetches in 128-byte lines and there is no invalidate: a runtime PTE write into an already-fetched line is invisible. A guest page's HPA can change between translations. | `rm-call: guest HPA changed: gpa=... was ... now ...`; `work_guest` `pool_exhausted`/`next_line` | Always use a fresh never-reused line per pair; pre-build guest-window slots before engine access; pin translated pages; treat pool exhaustion as end-of-budget, not a bug. | | PBDMA method/class errors | `0x1006` with `intr0` nonzero (a method/class was rejected) versus `intr1` bit 31 (`CTXNOTVALID`); NOCAT `faultingEngine="GR"`; errString `"Channel ID ... intr0 ... intr1 ..."` | Wrong method encoding, class/subchannel or channel state; `intr0 != 0` means the engine rejected the method, so look at the pushed method block, not the context only. | `gsp-phys-status-drain`; compare the method encoding with the engine's class | Fix the method/class encoding; no retry against the same wedged channel; re-run from a fresh ladder. | | Relay symptoms | `GUEST CE RELAY FAILED: semaphore released ... does not match ... (retried after 2 ms)`; `verify_fail`/`verify_transient`/`hold_verify_fail`; `fallback`/`skipped_sw`; `pool_exhausted`; `guest HPA changed` | One persistent data mismatch (shadow-page/concurrent-guest race or decode offset edge) is the open residual; anything else is the designed fail-closed fallback to the software apply. | `work_relay` line; the relay failure log includes sem target/payload/poll, first differing byte, live/snapshot dumps, `src_mutated`, `snap_vs_dst` | Keep default off until the mismatch is triaged. Abort the feature (`gsp_phys_relay=0`, then `gsp_phys_work_forward=0`) if `timeouts>0` or `verify_fail>0` ever appears. | @@ -779,7 +779,7 @@ bump, device/ISA/ROM change, protected state, matrix/CI) are owned by | Failed mutating RPC wedges GSP-RM | One bad mutating operation (channel-flag incident; `PROMOTE_CTX` assert `0x52a8b04`) leaves the server unable to reply or suspend while WPR2 stays up. | One mutating attempt per staged step; never retry a failed mutating RPC; abort the ladder from the first failure; the release fail-safe keeps the locks and refuses the hand-back. | | debugfs write side effects | Every 0200 file performs a real RPC/device action when its gates hold; a "test" write changes device or guest state. | Root-only; read `gsp-phys-state` and record the intended effect before any write; one write per action; no trigger writes outside a supervised cycle. | | `pkill -f qemu-system-x86_64` self-match | The pattern also matches the invoking shell's own command line, killing the agent/session instead of the VM. | Use bracket patterns (`pgrep/pkill -f '[q]emu-system-x86_64'`) or explicit PIDs; stop VMs through `scripts/vgpu_vm.py`. | -| Root-only debugfs | The whole `open-iov-vfio` debugfs directory and its files are root-only; a non-root existence check reports absence. | Run existence/read checks under root; treat "missing" as a permission question first. | +| Root-only debugfs | The whole `vgsp` debugfs directory and its files are root-only; a non-root existence check reports absence. | Run existence/read checks under root; treat "missing" as a permission question first. | | Module reload/unload hazards | Kthread/workqueue teardown can hang; the IOMMU identity-domain property and the guest-RAM file must not outlive the session; unloading with a live mdev/VM corrupts the teardown order. | Remove mdevs and stop VMs first; `gsp_sema_service_work_quiesce()` before staging is freed (release does this); use `scripts/stack_manager.sh unload`/`cleanup-crash`; audit leftovers after every unload. | | pstore/journal persistence | A freeze leaves no oops but usually a persistent pstore record; the journal stops. | Check `/sys/fs/pstore` before and after every cycle; never clear it; capture it before any reboot or retry - it is the only post-freeze evidence. | | Guest-RAM shared-file requirement | The engine can reach guest pages only through the QEMU file-backed shared region; a non-shared or non-preallocated RAM backend has no host page cache to translate. | Start QEMU with `memory-backend-file,share=yes,prealloc=on`; configure the file via `gsp-phys-guest-ram`; one file per module cycle; translation is gated on an open mdev and an active range. | diff --git a/docs/future-eng-ops.md b/docs/future-eng-ops.md index 13a0b73..3191c9f 100644 --- a/docs/future-eng-ops.md +++ b/docs/future-eng-ops.md @@ -11,7 +11,7 @@ Status snapshot: 2026-10-02. Sources are the risc-v-gsp-rm-debugger roadmap, tool docs 16–27, the `harness/` entry points and the tool audit (doc 27). The tool tree -is development-only: never shipped, never a dependency of `open-iov-vfio`, +is development-only: never shipped, never a dependency of `vgsp`, never present in a guest. RM 610 work is gated by human approval ([`docs/21` §3](../debug/risc-v-gsp-rm-vm/docs/21-CI-RELEASE-PIPELINE.md), [`docs/23`](../debug/risc-v-gsp-rm-vm/docs/23-RM610-READINESS.md)). diff --git a/docs/tools/README.md b/docs/tools/README.md index c5ebb9f..fd805f1 100644 --- a/docs/tools/README.md +++ b/docs/tools/README.md @@ -69,7 +69,7 @@ tools/ ## Integration with Open-IOV Stack Tools will integrate with the host VFIO driver via: - `/dev/nvidia*` character devices (existing nvidia.ko) -- `open-iov-vfio.ko` observability: **there is currently no debugfs interface** — +- `vgsp.ko` observability: **there is currently no debugfs interface** — stats and traces come from `dmesg`, and the module's write-only parameters (`scan_guest_ram`, `scan_vidmem`, `scan_seq`, `sema_probe`, `scan_pt`, `scan_masked`, `fill_vidmem`, `poke_guest`, `poke_fill`, `dump_vidmem`, @@ -8,7 +8,7 @@ # 1. deps Install build/runtime dependencies (apt) # 2. nvidia Clone NVIDIA open-gpu-kernel-modules @ pinned tag + patch # 3. firmware Fetch GSP firmware from linux-firmware.git + extract fwimage -# 4. build Build open-iov-vfio.ko -> nvidia.ko -> userspace (in order) +# 4. build Build vgsp.ko -> nvidia.ko -> userspace (in order) # 5. system Host config: VFIO modules, hugepages, IOMMU/blacklist check # 6. load Load the driver stack (root) # 7. mdev Create a vGPU mdev device (root) @@ -178,7 +178,7 @@ stage_firmware() { # ---------------------------------------------------------------------------- stage_build() { - log "Building open-iov-vfio.ko (generates Module.symvers)..." + log "Building vgsp.ko (generates Module.symvers)..." make -C "$OPEN_IOV_ROOT" kernel log "Building NVIDIA OpenRM (3-step, KBUILD_EXTRA_SYMBOLS)..." @@ -188,8 +188,8 @@ stage_build() { KBUILD_EXTRA_SYMBOLS="$OPEN_IOV_ROOT/kernel/Module.symvers" modules log "Verifying vGPU VFIO symbols resolved (modinfo depends)..." - modinfo "$NVIDIA_DIR/kernel-open/nvidia.ko" | grep -q "^depends:.*open-iov-vfio" \ - || die "nvidia.ko missing 'depends: open-iov-vfio' - KBUILD_EXTRA_SYMBOLS resolution failed" + modinfo "$NVIDIA_DIR/kernel-open/nvidia.ko" | grep -q "^depends:.*vgsp" \ + || die "nvidia.ko missing 'depends: vgsp' - KBUILD_EXTRA_SYMBOLS resolution failed" log "Building userspace (libiov.so + examples)..." make -C "$OPEN_IOV_ROOT" userspace examples @@ -202,10 +202,10 @@ stage_system() { local SUDO; SUDO=$(need_sudo) # VFIO/mdev modules at boot - if [[ ! -f /etc/modules-load.d/open-iov-vfio.conf ]]; then + if [[ ! -f /etc/modules-load.d/vgsp.conf ]]; then printf 'vfio\nvfio_iommu_type1\nvfio_pci\nmdev\nvfio_mdev\n' \ - | $SUDO tee /etc/modules-load.d/open-iov-vfio.conf >/dev/null - ok "wrote /etc/modules-load.d/open-iov-vfio.conf" + | $SUDO tee /etc/modules-load.d/vgsp.conf >/dev/null + ok "wrote /etc/modules-load.d/vgsp.conf" else ok "modules-load.d already configured" fi diff --git a/kernel/Makefile b/kernel/Makefile index 0d26dc3..c035e41 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,6 +1,6 @@ -obj-m += open-iov-vfio.o +obj-m += vgsp.o -open-iov-vfio-y := \ +vgsp-y := \ main.o \ bar_init.o \ bar_emulation.o \ diff --git a/kernel/dynamic_rpc_dispatcher.c b/kernel/dynamic_rpc_dispatcher.c index 3853604..98fc670 100644 --- a/kernel/dynamic_rpc_dispatcher.c +++ b/kernel/dynamic_rpc_dispatcher.c @@ -239,15 +239,15 @@ int dynamic_dispatcher_init(const char *fw_path) */ ret = fw_analyzer_load_and_analyze(fw_path, &result); if (ret) { - pr_warn("DYN_DISPATCH: Firmware analysis failed, using emulation: %d\n", ret); + pr_warn("vgsp-dyn-dispatch: Firmware analysis failed, using emulation: %d\n", ret); iface = &interface_emu; } else if (result.matched && strcmp(result.version, "570.144W") == 0) { iface = &interface_570; use_native = true; - pr_info("DYN_DISPATCH: Using native 570.144W interface\n"); + pr_info("vgsp-dyn-dispatch: Using native 570.144W interface\n"); } else { iface = &interface_emu; - pr_info("DYN_DISPATCH: Using emulation interface (version: %s)\n", result.version); + pr_info("vgsp-dyn-dispatch: Using emulation interface (version: %s)\n", result.version); } spin_lock(&g_dispatcher.lock); diff --git a/kernel/firmware_analyzer.c b/kernel/firmware_analyzer.c index 2d8d84d..9873181 100644 --- a/kernel/firmware_analyzer.c +++ b/kernel/firmware_analyzer.c @@ -3,6 +3,8 @@ * Auto-discovers RPC handler addresses, struct layouts, and firmware signatures */ +#define pr_fmt(fmt) "vgsp-fw-analyzer: " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -116,19 +118,19 @@ static int analyze_rpc_dispatcher(const u8 *fw, size_t fw_len, struct fw_address ret = find_pattern(fw, fw_len, pattern_rpc_dispatch, sizeof(pattern_rpc_dispatch), &offset); if (ret == 0) { addrs->rpc_dispatch_primary = GSP_FW_BASE + offset; - pr_info("FW_ANALYZER: Found RPC dispatcher at 0x%llx\n", addrs->rpc_dispatch_primary); + pr_info("Found RPC dispatcher at 0x%llx\n", addrs->rpc_dispatch_primary); } ret = find_pattern(fw, fw_len, pattern_jump_table, sizeof(pattern_jump_table), &offset); if (ret == 0) { addrs->rpc_jump_table = GSP_FW_BASE + offset; - pr_info("FW_ANALYZER: Found RPC jump table at 0x%llx\n", addrs->rpc_jump_table); + pr_info("Found RPC jump table at 0x%llx\n", addrs->rpc_jump_table); } ret = find_pattern(fw, fw_len, pattern_alloc, sizeof(pattern_alloc), &offset); if (ret == 0) { addrs->alloc_main = GSP_FW_BASE + offset; - pr_info("FW_ANALYZER: Found ALLOC handler at 0x%llx\n", addrs->alloc_main); + pr_info("Found ALLOC handler at 0x%llx\n", addrs->alloc_main); } return 0; @@ -153,8 +155,8 @@ int fw_analyzer_analyze(const u8 *fw_data, size_t fw_len, struct fw_analysis_res if (ret) return ret; - pr_info("FW_ANALYZER: Firmware size=%zu, CRC32=0x%08x\n", fw_len, result->crc32); - pr_info("FW_ANALYZER: SHA256: %*phN\n", 32, result->sha256); + pr_info("Firmware size=%zu, CRC32=0x%08x\n", fw_len, result->crc32); + pr_info("SHA256: %*phN\n", 32, result->sha256); /* Match against known signatures */ for (size_t i = 0; i < ARRAY_SIZE(known_signatures); i++) { @@ -163,13 +165,13 @@ int fw_analyzer_analyze(const u8 *fw_data, size_t fw_len, struct fw_analysis_res strncpy(result->version, known_signatures[i].version, sizeof(result->version) - 1); result->addresses = known_signatures[i].addrs; result->matched = true; - pr_info("FW_ANALYZER: Matched known firmware version: %s\n", result->version); + pr_info("Matched known firmware version: %s\n", result->version); return 0; } } /* Auto-discover addresses if no match */ - pr_info("FW_ANALYZER: No known signature match, attempting auto-discovery\n"); + pr_info("No known signature match, attempting auto-discovery\n"); ret = analyze_rpc_dispatcher(fw_data, fw_len, &result->addresses); if (ret == 0) { result->matched = false; @@ -186,7 +188,7 @@ int fw_analyzer_load_and_analyze(const char *fw_path, struct fw_analysis_result ret = request_firmware(&fw, fw_path, NULL); if (ret) { - pr_err("FW_ANALYZER: Failed to load firmware %s: %d\n", fw_path, ret); + pr_err("Failed to load firmware %s: %d\n", fw_path, ret); return ret; } diff --git a/kernel/gsp_emulation.c b/kernel/gsp_emulation.c index 4d8642a..5b75ec6 100644 --- a/kernel/gsp_emulation.c +++ b/kernel/gsp_emulation.c @@ -249,7 +249,7 @@ static void gsp_emu_poll_boot(struct gsp_emu_context *ctx) continue; gsp_emu_shadow_write32(ctx, tlb_inv_regs[i], val & ~GSP_EMU_MMU_INVALIDATE_TRIGGER); - pr_info_ratelimited("GSP-BOOT: MMU_INVALIDATE[0x%x] trigger auto-cleared (val=0x%x)\n", + pr_info_ratelimited("vgsp-boot: MMU_INVALIDATE[0x%x] trigger auto-cleared (val=0x%x)\n", tlb_inv_regs[i], val); } } @@ -284,7 +284,7 @@ static void gsp_emu_poll_boot(struct gsp_emu_context *ctx) if (!val) continue; gsp_emu_shadow_write32(ctx, uflush_regs[i], 0); - pr_info_ratelimited("GSP-BOOT: UFLUSH[0x%x] 0x%x auto-cleared\n", + pr_info_ratelimited("vgsp-boot: UFLUSH[0x%x] 0x%x auto-cleared\n", uflush_regs[i], val); } } @@ -303,7 +303,7 @@ static void gsp_emu_poll_boot(struct gsp_emu_context *ctx) nv_vgpu_info(ctx->vgpu, "GSP-BOOT: cleared CrashCat wayfinder (was 0x%x)", wfl0); } else if (wfl0) { - pr_info_ratelimited("GSP-BOOT: DEBUGINFO nonzero (0x%x), not a wayfinder\n", + pr_info_ratelimited("vgsp-boot: DEBUGINFO nonzero (0x%x), not a wayfinder\n", wfl0); } } diff --git a/kernel/gsp_phys_boot.c b/kernel/gsp_phys_boot.c index 59e7966..598bb7b 100644 --- a/kernel/gsp_phys_boot.c +++ b/kernel/gsp_phys_boot.c @@ -182,28 +182,28 @@ static int gsp_phys_fb_size_decode(void __iomem *bar0, u64 fw_image_size, if (ecc) fb_size = fb_size / 16 * 15; - pr_info("gsp-phys-boot: FB size register[0x%06x]=0x%08x lowerMag=%u lowerScale=%u ecc=%u -> real usable FB size 0x%llx (%llu GiB)\n", + pr_info("vgsp-boot: FB size register[0x%06x]=0x%08x lowerMag=%u lowerScale=%u ecc=%u -> real usable FB size 0x%llx (%llu GiB)\n", GSP_PHYS_FB_LOCAL_MEMORY_RANGE, reg, mag, scale, (unsigned int)ecc, fb_size, fb_size >> 30); if (!mag || !fb_size) { - pr_err("gsp-phys-boot: FB size register decodes to zero (reg=0x%08x mag=%u scale=%u); refusing layout\n", + pr_err("vgsp-boot: FB size register decodes to zero (reg=0x%08x mag=%u scale=%u); refusing layout\n", reg, mag, scale); return -EINVAL; } if (fb_size < GSP_PHYS_FB_SIZE_MIN || fb_size > GSP_PHYS_FB_SIZE_MAX) { - pr_err("gsp-phys-boot: decoded real FB size 0x%llx outside sane range [0x%llx..0x%llx]; refusing layout\n", + pr_err("vgsp-boot: decoded real FB size 0x%llx outside sane range [0x%llx..0x%llx]; refusing layout\n", fb_size, (u64)GSP_PHYS_FB_SIZE_MIN, (u64)GSP_PHYS_FB_SIZE_MAX); return -ERANGE; } if (!IS_ALIGNED(fb_size, GSP_PHYS_PAGE_SIZE)) { - pr_err("gsp-phys-boot: decoded real FB size 0x%llx is not page-aligned; refusing layout\n", + pr_err("vgsp-boot: decoded real FB size 0x%llx is not page-aligned; refusing layout\n", fb_size); return -ERANGE; } if (fw_image_size && fb_size <= fw_image_size) { - pr_err("gsp-phys-boot: decoded real FB size 0x%llx does not fit the staged GSP-RM image (0x%llx); refusing layout\n", + pr_err("vgsp-boot: decoded real FB size 0x%llx does not fit the staged GSP-RM image (0x%llx); refusing layout\n", fb_size, fw_image_size); return -ERANGE; } @@ -257,34 +257,34 @@ static bool gsp_phys_wpr_layout_valid(const struct gsp_phys_wpr_meta *m) static void gsp_phys_wpr_meta_dump(const struct gsp_phys_wpr_meta *m) { - pr_info("gsp-phys-boot: GspFwWprMeta sizeof=%zu (must be 256) magic=0x%llx revision=%llu flags=0x%x\n", + pr_info("vgsp-boot: GspFwWprMeta sizeof=%zu (must be 256) magic=0x%llx revision=%llu flags=0x%x\n", sizeof(*m), (u64)m->magic, (u64)m->revision, m->flags); - pr_info("gsp-phys-boot: fbSize=0x%llx vgaWorkspace=0x%llx - 0x%llx (0x%llx)\n", + pr_info("vgsp-boot: fbSize=0x%llx vgaWorkspace=0x%llx - 0x%llx (0x%llx)\n", m->fb_size, m->vga_workspace_offset, m->vga_workspace_offset + m->vga_workspace_size - 1, m->vga_workspace_size); - pr_info("gsp-phys-boot: gspFwRsvdStart=0x%llx\n", m->gsp_fw_rsvd_start); - pr_info("gsp-phys-boot: nonWprHeap=0x%llx - 0x%llx (0x%llx)\n", + pr_info("vgsp-boot: gspFwRsvdStart=0x%llx\n", m->gsp_fw_rsvd_start); + pr_info("vgsp-boot: nonWprHeap=0x%llx - 0x%llx (0x%llx)\n", m->non_wpr_heap_offset, m->non_wpr_heap_offset + m->non_wpr_heap_size - 1, m->non_wpr_heap_size); - pr_info("gsp-phys-boot: gspFwWprStart=0x%llx\n", m->gsp_fw_wpr_start); - pr_info("gsp-phys-boot: gspFwHeap=0x%llx - 0x%llx (0x%llx)\n", + pr_info("vgsp-boot: gspFwWprStart=0x%llx\n", m->gsp_fw_wpr_start); + pr_info("vgsp-boot: gspFwHeap=0x%llx - 0x%llx (0x%llx)\n", m->gsp_fw_heap_offset, m->gsp_fw_heap_offset + m->gsp_fw_heap_size - 1, m->gsp_fw_heap_size); - pr_info("gsp-phys-boot: gspFwOffset=0x%llx - 0x%llx (0x%llx)\n", + pr_info("vgsp-boot: gspFwOffset=0x%llx - 0x%llx (0x%llx)\n", m->gsp_fw_offset, m->gsp_fw_offset + m->size_of_radix3_elf - 1, m->size_of_radix3_elf); - pr_info("gsp-phys-boot: bootBinOffset=0x%llx - 0x%llx (0x%llx)\n", + pr_info("vgsp-boot: bootBinOffset=0x%llx - 0x%llx (0x%llx)\n", m->boot_bin_offset, m->boot_bin_offset + m->size_of_bootloader - 1, m->size_of_bootloader); - pr_info("gsp-phys-boot: frtsOffset=0x%llx - 0x%llx (0x%llx)\n", + pr_info("vgsp-boot: frtsOffset=0x%llx - 0x%llx (0x%llx)\n", m->frts_offset, m->frts_offset + m->frts_size - 1, m->frts_size); - pr_info("gsp-phys-boot: gspFwWprEnd=0x%llx bootCount=%llu verified=%llu\n", + pr_info("vgsp-boot: gspFwWprEnd=0x%llx bootCount=%llu verified=%llu\n", m->gsp_fw_wpr_end, (u64)m->boot_count, (u64)m->verified); - pr_info("gsp-phys-boot: stubs: sysmemAddrOfRadix3Elf/Bootloader/Signature=0 crashReportQueue=0 (image not staged in 3b), bootloader offsets=0\n"); + pr_info("vgsp-boot: stubs: sysmemAddrOfRadix3Elf/Bootloader/Signature=0 crashReportQueue=0 (image not staged in 3b), bootloader offsets=0\n"); } /* @@ -315,29 +315,29 @@ int gsp_phys_boot_layout_init(struct gsp_phys_boot *boot, struct pci_dev *pdev, BUILD_BUG_ON(sizeof(struct gsp_phys_wpr_meta) != 256); - pr_info("gsp-phys-boot: stage 3b layout+allocation on %s (BAR0 read-only, no device writes)\n", + pr_info("vgsp-boot: stage 3b layout+allocation on %s (BAR0 read-only, no device writes)\n", pci_name(pdev)); ret = gsp_phys_fb_size_decode(bar0, fw_image_size, &usable_fb_size); if (ret) return ret; - pr_info("gsp-phys-boot: real FB size = 0x%llx (%llu GiB), replacing the BAR1-aperture approximation\n", + pr_info("vgsp-boot: real FB size = 0x%llx (%llu GiB), replacing the BAR1-aperture approximation\n", usable_fb_size, usable_fb_size >> 30); - pr_info("gsp-phys-boot: BAR1 aperture = 0x%llx (%llu MiB); decoded real FB size difference %+lld bytes\n", + pr_info("vgsp-boot: BAR1 aperture = 0x%llx (%llu MiB); decoded real FB size difference %+lld bytes\n", (u64)bar1_len, (u64)bar1_len >> 20, (long long)((s64)usable_fb_size - (s64)bar1_len)); - pr_info("gsp-phys-boot: staged GSP-RM image (.fwimage) size = 0x%llx\n", + pr_info("vgsp-boot: staged GSP-RM image (.fwimage) size = 0x%llx\n", fw_image_size); - pr_info("gsp-phys-boot: stub: boot binary size assumed 0x%x (boot ucode is compiled-in bindata, not a .fwimage section)\n", + pr_info("vgsp-boot: stub: boot binary size assumed 0x%x (boot ucode is compiled-in bindata, not a .fwimage section)\n", GSP_PHYS_BOOTLOADER_SIZE_STUB); - pr_info("gsp-phys-boot: wprEndMargin=0 (reference normal first-boot path; no override/retry margin)\n"); + pr_info("vgsp-boot: wprEndMargin=0 (reference normal first-boot path; no override/retry margin)\n"); boot->wpr_meta_size = GSP_PHYS_PAGE_SIZE; boot->wpr_meta_va = dma_alloc_coherent(&pdev->dev, boot->wpr_meta_size, &boot->wpr_meta_dma, GFP_KERNEL); if (!boot->wpr_meta_va) { - pr_err("gsp-phys-boot: WPR meta page allocation failed\n"); + pr_err("vgsp-boot: WPR meta page allocation failed\n"); ret = -ENOMEM; goto err; } @@ -345,7 +345,7 @@ int gsp_phys_boot_layout_init(struct gsp_phys_boot *boot, struct pci_dev *pdev, boot->libos_args_va = dma_alloc_coherent(&pdev->dev, boot->libos_args_size, &boot->libos_args_dma, GFP_KERNEL); if (!boot->libos_args_va) { - pr_err("gsp-phys-boot: libos init arguments allocation failed\n"); + pr_err("vgsp-boot: libos init arguments allocation failed\n"); ret = -ENOMEM; goto err; } @@ -353,17 +353,17 @@ int gsp_phys_boot_layout_init(struct gsp_phys_boot *boot, struct pci_dev *pdev, boot->gsp_args_va = dma_alloc_coherent(&pdev->dev, boot->gsp_args_size, &boot->gsp_args_dma, GFP_KERNEL); if (!boot->gsp_args_va) { - pr_err("gsp-phys-boot: GSP/bootloader arguments allocation failed\n"); + pr_err("vgsp-boot: GSP/bootloader arguments allocation failed\n"); ret = -ENOMEM; goto err; } - pr_info("gsp-phys-boot: WPR meta page 0x%zx bytes dma=0x%llx va=%p (coherent/uncached, zeroed)\n", + pr_info("vgsp-boot: WPR meta page 0x%zx bytes dma=0x%llx va=%p (coherent/uncached, zeroed)\n", boot->wpr_meta_size, (u64)boot->wpr_meta_dma, boot->wpr_meta_va); - pr_info("gsp-phys-boot: libos args 0x%zx bytes dma=0x%llx va=%p (coherent, zeroed; filled in a later stage)\n", + pr_info("vgsp-boot: libos args 0x%zx bytes dma=0x%llx va=%p (coherent, zeroed; filled in a later stage)\n", boot->libos_args_size, (u64)boot->libos_args_dma, boot->libos_args_va); - pr_info("gsp-phys-boot: gsp args 0x%zx bytes dma=0x%llx va=%p (coherent, zeroed; filled in a later stage)\n", + pr_info("vgsp-boot: gsp args 0x%zx bytes dma=0x%llx va=%p (coherent, zeroed; filled in a later stage)\n", boot->gsp_args_size, (u64)boot->gsp_args_dma, boot->gsp_args_va); meta = boot->wpr_meta_va; @@ -401,7 +401,7 @@ int gsp_phys_boot_layout_init(struct gsp_phys_boot *boot, struct pci_dev *pdev, post_wpr_heap); if (meta->gsp_fw_offset < pre_wpr_heap + wpr_heap_size) { - pr_err("gsp-phys-boot: real FB size 0x%llx too small: image (0x%llx) + WPR heap (0x%llx) + pre-WPR regions (0x%llx) do not fit below the VGA workspace\n", + pr_err("vgsp-boot: real FB size 0x%llx too small: image (0x%llx) + WPR heap (0x%llx) + pre-WPR regions (0x%llx) do not fit below the VGA workspace\n", usable_fb_size, meta->size_of_radix3_elf, wpr_heap_size, pre_wpr_heap); ret = -ERANGE; @@ -436,13 +436,13 @@ int gsp_phys_boot_layout_init(struct gsp_phys_boot *boot, struct pci_dev *pdev, meta->magic = GSP_PHYS_WPR_META_MAGIC; meta->flags = GSP_PHYS_WPR_META_FLAG_CLOCK_BOOST; - pr_info("gsp-phys-boot: FW heap size = 0x%llx (pre=0x%llx post=0x%llx, min %uMB max %uMB, pre-scrubbed top 0x%llx)\n", + pr_info("vgsp-boot: FW heap size = 0x%llx (pre=0x%llx post=0x%llx, min %uMB max %uMB, pre-scrubbed top 0x%llx)\n", wpr_heap_size, pre_wpr_heap, post_wpr_heap, GSP_PHYS_FW_HEAP_MIN_MB, GSP_PHYS_FW_HEAP_MAX_MB, (u64)GSP_PHYS_PRESCRUBBED_TOP_FB); if (!gsp_phys_wpr_layout_valid(meta)) { - pr_err("gsp-phys-boot: computed layout is inconsistent (frame too small for image/heap?)\n"); + pr_err("vgsp-boot: computed layout is inconsistent (frame too small for image/heap?)\n"); ret = -EINVAL; goto err; } @@ -467,7 +467,7 @@ int gsp_phys_boot_layout_init(struct gsp_phys_boot *boot, struct pci_dev *pdev, boot->gsp_fw_rsvd_start = meta->gsp_fw_rsvd_start; boot->initialized = true; - pr_info("gsp-phys-boot: stage 3b complete: boot args allocated, WPR meta filled (no device writes)\n"); + pr_info("vgsp-boot: stage 3b complete: boot args allocated, WPR meta filled (no device writes)\n"); return 0; err: @@ -497,7 +497,7 @@ void gsp_phys_boot_layout_fini(struct gsp_phys_boot *boot, struct pci_dev *pdev) boot->libos_args_va = NULL; boot->gsp_args_va = NULL; boot->initialized = false; - pr_info("gsp-phys-boot: boot-argument pages freed\n"); + pr_info("vgsp-boot: boot-argument pages freed\n"); } int gsp_phys_boot_meta_set_sysmem(struct gsp_phys_boot *boot, @@ -511,7 +511,7 @@ int gsp_phys_boot_meta_set_sysmem(struct gsp_phys_boot *boot, return -EINVAL; if (!radix3_dma || !radix3_size || !fmc_dma || !fmc_size || !sig_dma || !sig_size) { - pr_err("gsp-phys-boot: refusing to write zero sysmem addresses into the WPR meta (radix3=0x%llx fmc=0x%llx sig=0x%llx)\n", + pr_err("vgsp-boot: refusing to write zero sysmem addresses into the WPR meta (radix3=0x%llx fmc=0x%llx sig=0x%llx)\n", radix3_dma, fmc_dma, sig_dma); return -EINVAL; } @@ -534,11 +534,11 @@ int gsp_phys_boot_meta_set_sysmem(struct gsp_phys_boot *boot, meta->sysmem_addr_of_signature != sig_dma || meta->size_of_bootloader != fmc_size || meta->size_of_signature != sig_size) { - pr_err("gsp-phys-boot: WPR meta sysmem readback mismatch\n"); + pr_err("vgsp-boot: WPR meta sysmem readback mismatch\n"); return -EIO; } - pr_info("gsp-phys-boot: WPR meta sysmem addrs: radix3=0x%llx (0x%llx), bootloader=0x%llx (0x%llx), signature=0x%llx (0x%llx), crashReportQueue=0/0, bootloader offsets=0\n", + pr_info("vgsp-boot: WPR meta sysmem addrs: radix3=0x%llx (0x%llx), bootloader=0x%llx (0x%llx), signature=0x%llx (0x%llx), crashReportQueue=0/0, bootloader offsets=0\n", radix3_dma, radix3_size, fmc_dma, fmc_size, sig_dma, sig_size); return 0; } diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 9232961..c77e2e2 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -56,6 +56,7 @@ #include "gsp_phys_booter_load_img.h" #include "gsp_phys_gsp_rm_boot_img.h" #include "gsp_phys_registry_img.h" +#include "gsp_phys_registry_img_srvctx.h" static bool gsp_phys_boot_param; module_param_named(gsp_phys_boot, gsp_phys_boot_param, bool, 0644); @@ -223,6 +224,7 @@ bool gsp_phys_boot_requested(void) #define GSP_PHYS_RMCALL_CLASS_SUBDEVICE 0x2080u #define GSP_PHYS_RMCALL_CLASS_MEMLIST_SYSTEM 0x0081u #define GSP_PHYS_RMCALL_CLASS_MEMORY_LOCAL_USER 0x0040u +#define GSP_PHYS_RMCALL_CLASS_MEMORY_VIRTUAL 0x0070u #define GSP_PHYS_RMCALL_CLASS_TSG 0xa06cu #define GSP_PHYS_RMCALL_CLASS_CHANNEL 0xc46fu #define GSP_PHYS_RMCALL_CLASS_CE 0xc5b5u @@ -307,11 +309,41 @@ bool gsp_phys_boot_requested(void) #define GSP_PHYS_RMCALL_CTRL_FIFO_GET_ENGINE_CONTEXT_PROPERTIES 0x801707u #define GSP_PHYS_RMCALL_CTRL_FIFO_GET_INFO 0x20801109u #define GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX 0x2080012bu +/* + * NV2080_CTRL_CMD_GPU_INITIALIZE_CTX (0x2080012d, ctrl2080gpu.h:1047-1063): + * the old-interface physical-context init. The server routes it to + * grctxInitializeAPI, which stores the PA/size/physAttr memdesc as the + * GraphicsContext's context buffer; a following PROMOTE_CTX with a + * hVirtMemory/bare-VA virtual memdesc then finds that memdesc and binds the + * context. This is the documented client-managed flow the KMD promote path + * expects. + */ +#define GSP_PHYS_RMCALL_CTRL_GPU_INITIALIZE_CTX 0x2080012du #define GSP_PHYS_RMCALL_CTRL_GR_GET_CTX_BUFFER_INFO 0x20801219u #define GSP_PHYS_RMCALL_GR_CTX_ENGINE_ID 0u #define GSP_PHYS_RMCALL_FIFO_INFO_MAX_SUBCONTEXT 3u #define GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR 0x6u +/* + * VIDMEM + GPU cacheable no (NV2080_CTRL_GPU_INITIALIZE_CTX_APERTURE_VIDMEM + * 0, _GPU_CACHEABLE_NO 1), the attribute the reference client derives for an + * FBMEM context memdesc (kernel_graphics_context.c:1814-1843). + */ +#define GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR_FB 0x4u #define GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_MAIN 0u +#define GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_PM 1u +#define GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_PATCH 2u +/* + * GR_PATCH engine id in NV0080_CTRL_CMD_FIFO_GET_ENGINE_CONTEXT_PROPERTIES + * (ctrl/ctrl0080/ctrl0080fifo.h:137 -> 0x10), the size source for the + * PATCH promote entry (kernel_graphics_context.c:1227). + */ +#define GSP_PHYS_RMCALL_GR_PATCH_ENGINE_ID 0x10u +/* + * GR_PM engine id (ctrl0080fifo.h:132 -> 0x09), the PM ctxsw buffer size + * source the client uses for the externally-owned-VAS pre-allocation + * (kernel_graphics_context.c:1296). + */ +#define GSP_PHYS_RMCALL_GR_PM_ENGINE_ID 0x09u #define GSP_PHYS_RMCALL_GR_CTX_MAX_SIZE (32u * 1024u * 1024u) /* One 4 KB PT page covers one 2 MB PD0 slot; 32 MB max -> 16 pages max. */ #define GSP_PHYS_RMCALL_GR_CTX_PT_MAX \ @@ -323,8 +355,58 @@ bool gsp_phys_boot_requested(void) #define GSP_PHYS_RMCALL_GR_PROMOTE_SINGLE 1u #define GSP_PHYS_RMCALL_GR_PROMOTE_TWO_PHASE 2u #define GSP_PHYS_RMCALL_GR_PROMOTE_SINGLE_RAW 3u +#define GSP_PHYS_RMCALL_GR_PROMOTE_VA_ZERO 4u +#define GSP_PHYS_RMCALL_GR_PROMOTE_BATCHED 5u +#define GSP_PHYS_RMCALL_GR_PROMOTE_HVIRT 6u +#define GSP_PHYS_RMCALL_GR_PROMOTE_BARE_VA 7u +#define GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_SINGLE 8u +#define GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_VA 9u +#define GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_VA 10u +#define GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_FB 11u +/* + * Modes 12/13 (2026-10-02): the UVM/vGPU-faithful PA-only flow. The real + * guest client never promotes the context VAs on an externally-owned VAS; it + * sends bInitialize=1 bNonmapped=1 entries and lets the server commit the + * engine context, while UVM owns the page tables. Mode 2 step 1 proved that + * exact MAIN entry is ACCEPTED (status=0x0) on the V5 channel; only the + * follow-up VA-only step wedged. Mode 12 sends the accepted entry alone and + * continues to BIND/SCHEDULE/submit. Mode 13 additionally promotes the PATCH + * buffer first (the real client's promote set always contains PATCH), sized + * from GET_ENGINE_CONTEXT_PROPERTIES engineId 0x10, in case the commit path + * requires it. + */ +#define GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY 12u +#define GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH 13u +/* + * Modes 14/15 (2026-10-02): the KMD client-context-buffer path (V6 + * SKIP_CTXBUFFER_ALLOC channel) is the only flow that books the context VA in + * the server's engine-context vaList and commits ENG_CTX_VALID (the CTXNOTVALID + * wall the V5 PA-only modes cannot clear). Modes 8-11 reached it but returned + * 0x40 before the commit; the real client always promotes the PATCH buffer, so + * modes 14/15 promote PATCH PA-only first, then the single-entry MAIN + * (bInitialize=1 bNonmapped=0, PA+VA). Mode 15 backs MAIN with a server FBMEM + * allocation and the VIDMEM physAttr (0x4), the buffer type a vGPU host + * context uses. + */ +#define GSP_PHYS_RMCALL_GR_PROMOTE_KMD 14u +#define GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB 15u +/* + * Mode 16: mode 14 plus the PM ctxsw buffer PA-only promote. The client + * pre-allocates PM for externally-owned VAS and the promote-time + * preemption/commit HALs consume it; its absence is the next candidate for + * the shared 0x40 site after PATCH failed to clear it. + */ +#define GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM 16u +/* + * Mode 17 (2026-10-02): no client PROMOTE_CTX at all, paired with + * gsp_phys_srv_ctxbuf=1. On the server-managed path the GSP-RM allocates and + * commits the engine context itself; the ladder just proceeds to + * BIND/SCHEDULE/submit. Used to test whether the server-side commit makes the + * GR channel valid where every client-owned-buffer promote returned 0x40. + */ +#define GSP_PHYS_RMCALL_GR_PROMOTE_SERVER 17u #define GSP_PHYS_RMCALL_GR_PROMOTE_MAX \ - (GSP_PHYS_RMCALL_GR_PROMOTE_SINGLE_RAW) + (GSP_PHYS_RMCALL_GR_PROMOTE_SERVER) /* * Work-submit token notifier slot. The default index is @@ -498,9 +580,12 @@ bool gsp_phys_boot_requested(void) #define GSP_PHYS_RMCALL_HANDLE_CHANNEL_V2 0xcaf00014u #define GSP_PHYS_RMCALL_HANDLE_CHANNEL_V3 0xcaf00018u #define GSP_PHYS_RMCALL_HANDLE_CHANNEL_V5 0xcaf00024u +#define GSP_PHYS_RMCALL_HANDLE_CHANNEL_V6 0xcaf00034u #define GSP_PHYS_RMCALL_HANDLE_NOTIFIER_MEM 0xcaf00028u #define GSP_PHYS_RMCALL_HANDLE_MEM_BASE 0xcaf01000u #define GSP_PHYS_RMCALL_HANDLE_MEM_STRIDE 4u +#define GSP_PHYS_RMCALL_HANDLE_MEM_VIRT 0xcaf00030u +#define GSP_PHYS_RMCALL_HANDLE_CTX_FB 0xcaf00038u /* * NVOS04_FLAGS_CHANNEL_SKIP_SCRUBBER bit 23 (alloc/alloc_channel.h:223-225); @@ -511,6 +596,20 @@ bool gsp_phys_boot_requested(void) #define GSP_PHYS_RMCALL_CHANNEL_FLAG_SKIP_SCRUBBER (1u << 23) /* + * NVOS04_FLAGS_SKIP_CTXBUFFER_ALLOC bit 31 (alloc_channel.h:285-287): the + * client owns the engine context buffer and supplies it through PROMOTE_CTX + * (KMD virtual context). The server records it as bSkipCtxBufferAlloc + * (kernel_channel.c:211) and a single MAIN promote entry then takes the + * client-context-buffer path, which creates the virtual context memdesc + * itself instead of resolving the VA against a server-side booking (the + * mode-1/2/4 assert) - live mode 6 showed the hVirtMemory no-entry branch + * returns NV_ERR_INVALID_ARGUMENT without this bit on the channel. Mode 8 + * selects the V5 shape plus this bit; no other mode and no COPY0 step sets + * it. + */ +#define GSP_PHYS_RMCALL_CHANNEL_FLAG_SKIP_CTXBUFFER_ALLOC (1u << 31) + +/* * BANNED - do not use: internalFlags bit 6 = 0x40 marks the channel as * GSP-owned. A live run with this bit set wedged the GSP-RM task: the alloc * RPC never replied, every later RPC timed out, and the fail-safe held the @@ -1138,12 +1237,31 @@ static struct gsp_phys_boot_stage { */ bool rmcall_ctx_prepared; bool rmcall_ctx_valid; + /* mode 11: the context buffer is a server-owned FBMEM allocation */ + bool rmcall_ctx_fbmem; u64 rmcall_ctx_pa; /* context buffer DMA base */ u64 rmcall_ctx_va; /* promoted GPU VA window base */ u32 rmcall_ctx_size; /* promoted total size */ u32 rmcall_ctx_pages; /* 4 KB pages mapped */ u32 rmcall_ctx_pt_pages; /* small-PT pages used */ /* + * Mode 13: the client PATCH context buffer (PA-only promote). Prepared + * lazily in the promote step from the engine-context geometry query + * (engineId 0x10); freed by gsp_phys_rmcall_fini(). + */ + bool rmcall_patch_prepared; + u64 rmcall_patch_pa; /* PATCH buffer DMA base */ + u32 rmcall_patch_size; /* queried patch save size */ + struct gsp_phys_boot_chunk rmcall_patch; + /* + * Mode 16: the client PM ctxsw buffer (PA-only promote), pre-allocated + * for externally-owned VAS. + */ + bool rmcall_pm_prepared; + u64 rmcall_pm_pa; /* PM buffer DMA base */ + u32 rmcall_pm_size; /* queried PM save size */ + struct gsp_phys_boot_chunk rmcall_pm; + /* * GR context-promote bisection snapshot (stage 3, GR0 only): the 0..3 * gsp_phys_rmcall_gr_promote value, the number of accepted promote * controls (0 = none, 1 = PA/init accepted, 2 = VA accepted; mode 2 @@ -1157,6 +1275,7 @@ static struct gsp_phys_boot_stage { bool rmcall_gr_promote_warned; /* promote-site wedge warning logged */ u32 rmcall_gr_promote_step; u32 rmcall_gr_promote_size; + u32 rmcall_gr_hvirt; /* mode-6 NV01_MEMORY_VIRTUAL handle */ u32 rmcall_token; /* GET_WORK_SUBMIT_TOKEN result */ u32 rmcall_notifier_mem; /* FBMEM error-notifier object handle */ u64 rmcall_notifier_base; /* its returned frame-buffer address */ @@ -1310,7 +1429,7 @@ static int gsp_phys_chunk_alloc(struct pci_dev *pdev, goto err; } - pr_warn("gsp-phys-boot: contiguous %u-page coherent allocation failed; using %u per-page allocations\n", + pr_warn("vgsp-boot: contiguous %u-page coherent allocation failed; using %u per-page allocations\n", pages, pages); return 0; @@ -1404,12 +1523,12 @@ static int gsp_phys_radix3_build(struct pci_dev *pdev, memset(r3, 0, sizeof(*r3)); if (!size) { - pr_err("gsp-phys-boot: radix3 image size is zero; refusing\n"); + pr_err("vgsp-boot: radix3 image size is zero; refusing\n"); return -EINVAL; } if (data_pages > GSP_PHYS_RADIX3_L2_PAGES * GSP_PHYS_RADIX3_ENTRIES_PER_NODE) { - pr_err("gsp-phys-boot: radix3 data (%u pages) exceeds the fixed %u-node table (max %u pages)\n", + pr_err("vgsp-boot: radix3 data (%u pages) exceeds the fixed %u-node table (max %u pages)\n", data_pages, GSP_PHYS_RADIX3_L2_PAGES, GSP_PHYS_RADIX3_L2_PAGES * GSP_PHYS_RADIX3_ENTRIES_PER_NODE); @@ -1427,7 +1546,7 @@ static int gsp_phys_radix3_build(struct pci_dev *pdev, u32 pages = min_t(u32, remaining, GSP_PHYS_RADIX3_CHUNK_PAGES); if (r3->nr_chunks >= GSP_PHYS_RADIX3_MAX_CHUNKS) { - pr_err("gsp-phys-boot: radix3 needs more than %u chunks\n", + pr_err("vgsp-boot: radix3 needs more than %u chunks\n", GSP_PHYS_RADIX3_MAX_CHUNKS); ret = -ENOSPC; goto err; @@ -1544,16 +1663,16 @@ static void gsp_phys_libos_args_fill(struct gsp_phys_boot *boot) args[2].kind = GSP_PHYS_LIBOS_KIND_CONTIGUOUS; args[2].loc = GSP_PHYS_LIBOS_LOC_SYSMEM; - pr_info("gsp-phys-boot: libos args[0]: LOGINIT id8=0x%llx pa=0x%llx size=0x%x kind=%u loc=%u\n", + pr_info("vgsp-boot: libos args[0]: LOGINIT id8=0x%llx pa=0x%llx size=0x%x kind=%u loc=%u\n", GSP_PHYS_LIBOS_ID_LOGINIT, login_pa, GSP_PHYS_LOG_BUFFER_SIZE, args[0].kind, args[0].loc); - pr_info("gsp-phys-boot: libos args[1]: LOGRM id8=0x%llx pa=0x%llx size=0x%x kind=%u loc=%u\n", + pr_info("vgsp-boot: libos args[1]: LOGRM id8=0x%llx pa=0x%llx size=0x%x kind=%u loc=%u\n", GSP_PHYS_LIBOS_ID_LOGRM, logrm_pa, GSP_PHYS_LOG_BUFFER_SIZE, args[1].kind, args[1].loc); - pr_info("gsp-phys-boot: libos args[2]: RMARGS id8=0x%llx pa=0x%llx size=0x%llx kind=%u loc=%u\n", + pr_info("vgsp-boot: libos args[2]: RMARGS id8=0x%llx pa=0x%llx size=0x%llx kind=%u loc=%u\n", GSP_PHYS_LIBOS_ID_RMARGS, (u64)boot->gsp_args_dma, (u64)boot->gsp_args_size, args[2].kind, args[2].loc); - pr_info("gsp-phys-boot: libos args list: LOGINIT, LOGRM, RMARGS + zero terminator (LOGINIT first for early init logging; pa = page-0 DMA, not the region base)\n"); + pr_info("vgsp-boot: libos args list: LOGINIT, LOGRM, RMARGS + zero terminator (LOGINIT first for early init logging; pa = page-0 DMA, not the region base)\n"); } static void gsp_phys_gsp_args_fill(struct gsp_phys_boot *boot, @@ -1576,7 +1695,7 @@ static void gsp_phys_gsp_args_fill(struct gsp_phys_boot *boot, args->profiler.pa = cpu_to_le64(0); args->profiler.size = cpu_to_le64(0); - pr_info("gsp-phys-boot: GSP args: mq{shared=0x%llx ptes=%u cmd=0x%x stat=0x%x} sr{0,0,0} gpuInstance=0 bDmemStack=1 profiler{0,0}\n", + pr_info("vgsp-boot: GSP args: mq{shared=0x%llx ptes=%u cmd=0x%x stat=0x%x} sr{0,0,0} gpuInstance=0 bDmemStack=1 profiler{0,0}\n", (u64)gsp_phys_chunk_page_dma(queue, 0), GSP_PHYS_QUEUE_PTE_COUNT, GSP_PHYS_QUEUE_CMD_OFF, GSP_PHYS_QUEUE_STAT_OFF); @@ -1608,7 +1727,7 @@ static int gsp_phys_staging_self_check(struct gsp_phys_boot *boot) 2 + first_unused / GSP_PHYS_RADIX3_ENTRIES_PER_NODE) : NULL; if (r3->data_pages != expected_pages || r3->nr_chunks == 0) { - pr_err("gsp-phys-boot: self-check radix3 counts FAIL (dataPages=%u want %u, chunks=%u)\n", + pr_err("vgsp-boot: self-check radix3 counts FAIL (dataPages=%u want %u, chunks=%u)\n", r3->data_pages, expected_pages, r3->nr_chunks); return -EINVAL; } @@ -1621,7 +1740,7 @@ static int gsp_phys_staging_self_check(struct gsp_phys_boot *boot) gsp_phys_radix3_page_dma(r3, last_used) || (l2_unused && l2_unused[first_unused % GSP_PHYS_RADIX3_ENTRIES_PER_NODE] != 0)) { - pr_err("gsp-phys-boot: self-check radix3 entry encoding FAIL (L0/L1/L2 leaf mismatch)\n"); + pr_err("vgsp-boot: self-check radix3 entry encoding FAIL (L0/L1/L2 leaf mismatch)\n"); return -EINVAL; } tx = gsp_phys_chunk_page_va(q, GSP_PHYS_QUEUE_CMD_OFF / GSP_PHYS_PAGE_SIZE); @@ -1636,7 +1755,7 @@ static int gsp_phys_staging_self_check(struct gsp_phys_boot *boot) le64_to_cpu(ptes[0]) != gsp_phys_chunk_page_dma(q, 0) || le64_to_cpu(ptes[GSP_PHYS_QUEUE_PTE_COUNT - 1]) != gsp_phys_chunk_page_dma(q, GSP_PHYS_QUEUE_PTE_COUNT - 1)) { - pr_err("gsp-phys-boot: self-check queue PTEs/header FAIL\n"); + pr_err("vgsp-boot: self-check queue PTEs/header FAIL\n"); return -EINVAL; } if (le64_to_cpu(gsp_args->mq.shared_mem_phys_addr) != @@ -1658,13 +1777,13 @@ static int gsp_phys_staging_self_check(struct gsp_phys_boot *boot) le64_to_cpu(libos[2].pa) != (u64)boot->gsp_args_dma || le64_to_cpu(libos[2].size) != (u64)boot->gsp_args_size || le64_to_cpu(libos[3].id8) != 0 || libos[3].kind != 0) { - pr_err("gsp-phys-boot: self-check GSP/libos args FAIL (LOGINIT/LOGRM/RMARGS ids, addresses, sizes or the zero terminator mismatch)\n"); + pr_err("vgsp-boot: self-check GSP/libos args FAIL (LOGINIT/LOGRM/RMARGS ids, addresses, sizes or the zero terminator mismatch)\n"); return -EINVAL; } for (i = 0; i < 3; i++) { if (libos[i].kind != GSP_PHYS_LIBOS_KIND_CONTIGUOUS || libos[i].loc != GSP_PHYS_LIBOS_LOC_SYSMEM) { - pr_err("gsp-phys-boot: self-check libos args[%u] kind/loc FAIL\n", + pr_err("vgsp-boot: self-check libos args[%u] kind/loc FAIL\n", i); return -EINVAL; } @@ -1679,7 +1798,7 @@ static int gsp_phys_staging_self_check(struct gsp_phys_boot *boot) le64_to_cpu(logrm_pa[GSP_PHYS_LOG_BUFFER_PAGES]) != gsp_phys_chunk_page_dma(&boot_stage.logrm, GSP_PHYS_LOG_BUFFER_PAGES - 1)) { - pr_err("gsp-phys-boot: self-check log PA tables FAIL (first/last page DMA mismatch)\n"); + pr_err("vgsp-boot: self-check log PA tables FAIL (first/last page DMA mismatch)\n"); return -EINVAL; } if (!gsp_phys_chunk_page_dma(&boot_stage.fmc, 0) || @@ -1688,11 +1807,11 @@ static int gsp_phys_staging_self_check(struct gsp_phys_boot *boot) !gsp_phys_chunk_page_dma(q, 0) || !gsp_phys_chunk_page_dma(&boot_stage.login, 0) || !gsp_phys_chunk_page_dma(&boot_stage.logrm, 0)) { - pr_err("gsp-phys-boot: self-check sysmem addresses FAIL (a page-0 DMA address is zero)\n"); + pr_err("vgsp-boot: self-check sysmem addresses FAIL (a page-0 DMA address is zero)\n"); return -EINVAL; } - pr_info("gsp-phys-boot: self-check PASS: radix3 %u data pages, %u L2 + 1 L1 + 1 L0, data at 0x%x; queue %u PTEs, cmd header v0 size=0x%x msgSize=%u msgCount=%u flags=%u rxHdrOff=0x20 entryOff=0x1000; libos LOGINIT/LOGRM/RMARGS + zero terminator, 64 KB log PA tables; all sysmem addrs nonzero\n", + pr_info("vgsp-boot: self-check PASS: radix3 %u data pages, %u L2 + 1 L1 + 1 L0, data at 0x%x; queue %u PTEs, cmd header v0 size=0x%x msgSize=%u msgCount=%u flags=%u rxHdrOff=0x20 entryOff=0x1000; libos LOGINIT/LOGRM/RMARGS + zero terminator, 64 KB log PA tables; all sysmem addrs nonzero\n", r3->data_pages, GSP_PHYS_RADIX3_L2_PAGES, GSP_PHYS_RADIX3_DATA_OFFSET, GSP_PHYS_QUEUE_PTE_COUNT, GSP_PHYS_QUEUE_CMD_SIZE, GSP_PHYS_MSG_SIZE, @@ -1711,7 +1830,7 @@ static void gsp_phys_scratch14_log(void __iomem *bar0, const char *where) struct gsp_phys_scratch14 s; gsp_phys_fwsec_scratch14_read(bar0, &s); - pr_info("gsp-phys-boot: scratch14 handoffs: raw=0x%08x version=%u booterLoad=%u ahesasc=%u booterReload=%u acrUnload=%u booterBinaryVersion=%u [%s]\n", + pr_info("vgsp-boot: scratch14 handoffs: raw=0x%08x version=%u booterLoad=%u ahesasc=%u booterReload=%u acrUnload=%u booterBinaryVersion=%u [%s]\n", s.raw, s.acr_version, s.booter_load, s.ahesasc_booter_reload, s.booter_reload_acr_unload, s.acr_unload_booter_unload, s.booter_binary_version, where); @@ -1748,17 +1867,25 @@ static void gsp_phys_rmcall_reset(void) boot_stage.rmcall_gr_object = 0; boot_stage.rmcall_ctx_prepared = false; boot_stage.rmcall_ctx_valid = false; + boot_stage.rmcall_ctx_fbmem = false; boot_stage.rmcall_ctx_pa = 0; boot_stage.rmcall_ctx_va = 0; boot_stage.rmcall_ctx_size = 0; boot_stage.rmcall_ctx_pages = 0; boot_stage.rmcall_ctx_pt_pages = 0; + boot_stage.rmcall_patch_prepared = false; + boot_stage.rmcall_patch_pa = 0; + boot_stage.rmcall_patch_size = 0; + boot_stage.rmcall_pm_prepared = false; + boot_stage.rmcall_pm_pa = 0; + boot_stage.rmcall_pm_size = 0; boot_stage.rmcall_gr_promote = 0; boot_stage.rmcall_gr_promote_valid = false; boot_stage.rmcall_gr_promote_change_logged = false; boot_stage.rmcall_gr_promote_warned = false; boot_stage.rmcall_gr_promote_step = 0; boot_stage.rmcall_gr_promote_size = 0; + boot_stage.rmcall_gr_hvirt = 0; boot_stage.rmcall_token = 0; boot_stage.rmcall_notifier_mem = 0; boot_stage.rmcall_notifier_base = 0; @@ -1807,16 +1934,16 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, !src->fw_signature || !src->fw_image_size) return -EINVAL; if (!boot->initialized || !boot->wpr_meta_va) { - pr_err("gsp-phys-boot: boot layout not initialised; refusing stage 3d staging\n"); + pr_err("vgsp-boot: boot layout not initialised; refusing stage 3d staging\n"); return -EINVAL; } if (boot_stage.primed) { - pr_err("gsp-phys-boot: staging already primed; refusing a second stage 3d staging\n"); + pr_err("vgsp-boot: staging already primed; refusing a second stage 3d staging\n"); return -EBUSY; } if (src->fw_image_size != boot->size_of_radix3_elf || src->fw_signature_size != GSP_PHYS_SIGNATURE_SIZE) { - pr_err("gsp-phys-boot: staged firmware views mismatch (image=0x%llx layout=0x%llx signature=0x%llx want 0x%x); refusing stage 3d\n", + pr_err("vgsp-boot: staged firmware views mismatch (image=0x%llx layout=0x%llx signature=0x%llx want 0x%x); refusing stage 3d\n", src->fw_image_size, boot->size_of_radix3_elf, src->fw_signature_size, GSP_PHYS_SIGNATURE_SIZE); return -EINVAL; @@ -1834,7 +1961,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, */ boot_stage.pdev = pdev; gsp_phys_rmcall_reset(); - pr_info("gsp-phys-boot: stage 3d %s on %s: staging 0x%llx (.fwimage) + FMC 0x%x + signature 0x%x + queue 0x%x + LOGINIT 0x%x + LOGRM 0x%x (total 0x%llx; host memory only, %s)\n", + pr_info("vgsp-boot: stage 3d %s on %s: staging 0x%llx (.fwimage) + FMC 0x%x + signature 0x%x + queue 0x%x + LOGINIT 0x%x + LOGRM 0x%x (total 0x%llx; host memory only, %s)\n", dryrun ? "prime" : "staging", pci_name(pdev), src->fw_image_size, GSP_PHYS_FMC_SIZE, GSP_PHYS_SIGNATURE_SIZE, GSP_PHYS_QUEUE_TOTAL_SIZE, GSP_PHYS_LOG_BUFFER_SIZE, @@ -1845,7 +1972,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, dryrun ? "no BAR0 writes, no falcon resets" : "device writes follow"); /* The staging reads are the only device access here. */ - pr_info("gsp-phys-boot: state before staging (read-only): WPR2_LO=0x%08x WPR2_HI=0x%08x GFW_BOOT=0x%08x GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x\n", + pr_info("vgsp-boot: state before staging (read-only): WPR2_LO=0x%08x WPR2_HI=0x%08x GFW_BOOT=0x%08x GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x\n", readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), readl(bar0 + GSP_PHYS_WPR2_ADDR_HI), readl(bar0 + GSP_PHYS_GFW_BOOT), @@ -1859,7 +1986,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, memcpy(gsp_phys_chunk_page_va(&boot_stage.fmc, 0), gsp_phys_gsp_rm_boot_image, sizeof(gsp_phys_gsp_rm_boot_image)); - pr_info("gsp-phys-boot: FMC copy 0x%zx bytes at dma=0x%llx (appVersion=%u from the v4 descriptor)\n", + pr_info("vgsp-boot: FMC copy 0x%zx bytes at dma=0x%llx (appVersion=%u from the v4 descriptor)\n", sizeof(gsp_phys_gsp_rm_boot_image), (u64)gsp_phys_chunk_page_dma(&boot_stage.fmc, 0), GSP_PHYS_FMC_APP_VERSION); @@ -1868,7 +1995,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, src->fw_image_size); if (ret) goto err; - pr_info("gsp-phys-boot: radix3 for 0x%llx: dataPages=%llu L2=%u L1=1 L0=1 tables=%u pages (data at 0x%x), rootDma=0x%llx, %u data chunks\n", + pr_info("vgsp-boot: radix3 for 0x%llx: dataPages=%llu L2=%u L1=1 L0=1 tables=%u pages (data at 0x%x), rootDma=0x%llx, %u data chunks\n", src->fw_image_size, data_pages, GSP_PHYS_RADIX3_L2_PAGES, GSP_PHYS_RADIX3_TABLE_PAGES, GSP_PHYS_RADIX3_DATA_OFFSET, (u64)gsp_phys_chunk_page_dma(&boot_stage.radix3.table, 0), @@ -1879,7 +2006,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, goto err; memcpy(gsp_phys_chunk_page_va(&boot_stage.signature, 0), src->fw_signature, GSP_PHYS_SIGNATURE_SIZE); - pr_info("gsp-phys-boot: signature copy 0x%x bytes at dma=0x%llx (256-aligned)\n", + pr_info("vgsp-boot: signature copy 0x%x bytes at dma=0x%llx (256-aligned)\n", GSP_PHYS_SIGNATURE_SIZE, (u64)gsp_phys_chunk_page_dma(&boot_stage.signature, 0)); @@ -1896,7 +2023,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, goto err; gsp_phys_chunk_zero(&boot_stage.logrm); gsp_phys_log_chunk_fill(&boot_stage.logrm); - pr_info("gsp-phys-boot: libos log regions 0x%x each: LOGINIT pa=0x%llx LOGRM pa=0x%llx (put pointer 0, %u-page PA table at +0x%x)\n", + pr_info("vgsp-boot: libos log regions 0x%x each: LOGINIT pa=0x%llx LOGRM pa=0x%llx (put pointer 0, %u-page PA table at +0x%x)\n", GSP_PHYS_LOG_BUFFER_SIZE, (u64)gsp_phys_chunk_page_dma(&boot_stage.login, 0), (u64)gsp_phys_chunk_page_dma(&boot_stage.logrm, 0), @@ -1905,7 +2032,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, ret = gsp_phys_queue_init(pdev, &boot_stage.queue); if (ret) goto err; - pr_info("gsp-phys-boot: queue 0x%x at dma=0x%llx: pt@+0x0 (129 PTEs) cmd@+0x%x stat@+0x%x (GSP-RM publishes the status TX header)\n", + pr_info("vgsp-boot: queue 0x%x at dma=0x%llx: pt@+0x0 (129 PTEs) cmd@+0x%x stat@+0x%x (GSP-RM publishes the status TX header)\n", GSP_PHYS_QUEUE_TOTAL_SIZE, (u64)gsp_phys_chunk_page_dma(&boot_stage.queue, 0), GSP_PHYS_QUEUE_CMD_OFF, GSP_PHYS_QUEUE_STAT_OFF); @@ -1931,7 +2058,7 @@ int gsp_phys_boot_prime(struct gsp_phys_boot *boot, struct pci_dev *pdev, goto err; boot_stage.primed = true; - pr_info("gsp-phys-boot: stage 3d prime complete: host staging ready (radix3 root=0x%llx FMC=0x%llx signature=0x%llx queue=0x%llx LOGINIT=0x%llx LOGRM=0x%llx); %s\n", + pr_info("vgsp-boot: stage 3d prime complete: host staging ready (radix3 root=0x%llx FMC=0x%llx signature=0x%llx queue=0x%llx LOGINIT=0x%llx LOGRM=0x%llx); %s\n", (u64)gsp_phys_chunk_page_dma(&boot_stage.radix3.table, 0), (u64)gsp_phys_chunk_page_dma(&boot_stage.fmc, 0), (u64)gsp_phys_chunk_page_dma(&boot_stage.signature, 0), @@ -1955,7 +2082,7 @@ err: static void gsp_phys_boot_telemetry(void __iomem *bar0) { - pr_info("gsp-phys-boot: telemetry: GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x SEC2_M0=0x%08x SEC2_M1=0x%08x RISCV_STATUS=0x%08x FALCON_OS=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x scratch0E=0x%08x scratch15=0x%08x GFW_BOOT=0x%08x\n", + pr_info("vgsp-boot: telemetry: GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x SEC2_M0=0x%08x SEC2_M1=0x%08x RISCV_STATUS=0x%08x FALCON_OS=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x scratch0E=0x%08x scratch15=0x%08x GFW_BOOT=0x%08x\n", readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_CPUCTL), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_CPUCTL), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX0), @@ -1981,19 +2108,19 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, if (!boot || !pdev || !bar0) return -EINVAL; if (!boot_stage.primed || !boot->initialized) { - pr_err("gsp-phys-boot: stage 3d FAILED: host staging is not primed\n"); + pr_err("vgsp-boot: stage 3d FAILED: host staging is not primed\n"); return -EINVAL; } if (!gsp_phys_fwsec_wpr2_up(bar0)) { - pr_err("gsp-phys-boot: stage 3d FAILED: WPR2 is not up (FWSEC did not complete); refusing to start the booter\n"); + pr_err("vgsp-boot: stage 3d FAILED: WPR2 is not up (FWSEC did not complete); refusing to start the booter\n"); return -EBUSY; } if (boot_stage.dryrun) { - pr_err("gsp-phys-boot: stage 3d FAILED: staging was primed in dry-run mode; refusing device writes\n"); + pr_err("vgsp-boot: stage 3d FAILED: staging was primed in dry-run mode; refusing device writes\n"); return -EINVAL; } if (gsp_phys_fwsec_board_debug(bar0)) { - pr_err("gsp-phys-boot: stage 3d FAILED: board is in debug mode (SECURE_GSP_DEBUG_DIS bit0==0) but the staged Booter Load image is the production build; refusing the device sequence\n"); + pr_err("vgsp-boot: stage 3d FAILED: board is in debug mode (SECURE_GSP_DEBUG_DIS bit0==0) but the staged Booter Load image is the production build; refusing the device sequence\n"); return -EPERM; } @@ -2009,7 +2136,7 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, if (!boot_stage.preinit_submitted) { ret = gsp_phys_preinit_rpcs(bar0, pdev); if (ret) { - pr_err("gsp-phys-boot: stage 3d FAILED: pre-boot async init RPCs (fn %u/%u) were not queued (%d); refusing to start GSP-RM without system info\n", + pr_err("vgsp-boot: stage 3d FAILED: pre-boot async init RPCs (fn %u/%u) were not queued (%d); refusing to start GSP-RM without system info\n", GSP_PHYS_RPC_FUNC_GSP_SET_SYSTEM_INFO, GSP_PHYS_RPC_FUNC_SET_REGISTRY, ret); return ret; @@ -2017,12 +2144,12 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, boot_stage.preinit_submitted = true; } - pr_info("gsp-phys-boot: stage 3d: resetting GSP falcon into RISC-V, libos args 0x%llx\n", + pr_info("vgsp-boot: stage 3d: resetting GSP falcon into RISC-V, libos args 0x%llx\n", (u64)boot->libos_args_dma); gsp_phys_scratch14_log(bar0, "pre-gsp-reset"); ret = gsp_phys_falcon_reset(bar0, GSP_PHYS_GSP_BASE); if (ret) { - pr_err("gsp-phys-boot: stage 3d FAILED: GSP falcon reset (RISC-V) error %d\n", + pr_err("vgsp-boot: stage 3d FAILED: GSP falcon reset (RISC-V) error %d\n", ret); return ret; } @@ -2030,12 +2157,12 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_MAILBOX0); writel(upper_32_bits((u64)boot->libos_args_dma), bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_MAILBOX1); - pr_info("gsp-phys-boot: GSP MAILBOX0/1 = libos args DMA 0x%llx (LO=0x%08x HI=0x%08x)\n", + pr_info("vgsp-boot: GSP MAILBOX0/1 = libos args DMA 0x%llx (LO=0x%08x HI=0x%08x)\n", (u64)boot->libos_args_dma, readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_MAILBOX0), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_MAILBOX1)); - pr_info("gsp-phys-boot: Booter Load on SEC2: meta 0x%llx, image 0x%x (ns 0x%x@0x%x sec 0x%x@0x%x dmem 0x%x@0x%x), BOOTVEC=0\n", + pr_info("vgsp-boot: Booter Load on SEC2: meta 0x%llx, image 0x%x (ns 0x%x@0x%x sec 0x%x@0x%x dmem 0x%x@0x%x), BOOTVEC=0\n", (u64)boot->wpr_meta_dma, GSP_PHYS_BOOTER_LOAD_IMAGE_SIZE, GSP_PHYS_BOOTER_LOAD_NS_CODE_SIZE, GSP_PHYS_BOOTER_LOAD_NS_CODE_OFF, @@ -2045,7 +2172,7 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, GSP_PHYS_BOOTER_LOAD_DATA_OFF); ret = gsp_phys_falcon_reset(bar0, GSP_PHYS_SEC2_BASE); if (ret) { - pr_err("gsp-phys-boot: stage 3d FAILED: SEC2 falcon reset error %d\n", + pr_err("vgsp-boot: stage 3d FAILED: SEC2 falcon reset error %d\n", ret); return ret; } @@ -2070,7 +2197,7 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, writel(upper_32_bits((u64)boot->wpr_meta_dma), bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX1); cpuctl = readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_CPUCTL); - pr_info("gsp-phys-boot: SEC2 MAILBOX0/1 = WPR meta DMA 0x%llx (LO=0x%08x HI=0x%08x), BOOTVEC=0x%08x CPUCTL before start=0x%08x\n", + pr_info("vgsp-boot: SEC2 MAILBOX0/1 = WPR meta DMA 0x%llx (LO=0x%08x HI=0x%08x), BOOTVEC=0x%08x CPUCTL before start=0x%08x\n", (u64)boot->wpr_meta_dma, readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX0), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX1), @@ -2083,19 +2210,19 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, GSP_PHYS_BOOTER_HALT_TIMEOUT_MS); m0 = readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX0); m1 = readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX1); - pr_info("gsp-phys-boot: Booter Load done: SEC2 M0=0x%08x M1=0x%08x (success M0==0), CPUCTL=0x%08x\n", + pr_info("vgsp-boot: Booter Load done: SEC2 M0=0x%08x M1=0x%08x (success M0==0), CPUCTL=0x%08x\n", m0, m1, readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_CPUCTL)); gsp_phys_scratch14_log(bar0, "post-booter-halt"); if (ret) { gsp_phys_boot_telemetry(bar0); - pr_err("gsp-phys-boot: stage 3d FAILED: SEC2 did not halt within %u ms (M0=0x%08x M1=0x%08x)\n", + pr_err("vgsp-boot: stage 3d FAILED: SEC2 did not halt within %u ms (M0=0x%08x M1=0x%08x)\n", GSP_PHYS_BOOTER_HALT_TIMEOUT_MS, m0, m1); return ret; } if (m0 != 0) { gsp_phys_boot_telemetry(bar0); - pr_err("gsp-phys-boot: stage 3d FAILED: Booter Load refused the metadata (M0=0x%08x M1=0x%08x)\n", + pr_err("vgsp-boot: stage 3d FAILED: Booter Load refused the metadata (M0=0x%08x M1=0x%08x)\n", m0, m1); return -EIO; } @@ -2105,7 +2232,7 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, riscv = readl(bar0 + GSP_PHYS_RISCV_STATUS); if (!(riscv & GSP_PHYS_RISCV_ACTIVE)) { gsp_phys_boot_telemetry(bar0); - pr_err("gsp-phys-boot: stage 3d FAILED: RISC-V core not active after Booter Load (RISCV_STATUS=0x%08x)\n", + pr_err("vgsp-boot: stage 3d FAILED: RISC-V core not active after Booter Load (RISCV_STATUS=0x%08x)\n", riscv); return -ENODEV; } @@ -2114,7 +2241,7 @@ int gsp_phys_boot_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, boot_stage.ran = true; boot_stage.riscv_active = true; gsp_phys_boot_telemetry(bar0); - pr_info("gsp-phys-boot: stage 3d complete: Booter Load M0=0, RISC-V active (RISCV_STATUS=0x%08x), FALCON_OS=0x%08x (appVersion=%u), WPR2 up (LO=0x%08x HI=0x%08x), SEC2 M1=0x%08x\n", + pr_info("vgsp-boot: stage 3d complete: Booter Load M0=0, RISC-V active (RISCV_STATUS=0x%08x), FALCON_OS=0x%08x (appVersion=%u), WPR2 up (LO=0x%08x HI=0x%08x), SEC2 M1=0x%08x\n", riscv, readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_OS), GSP_PHYS_FMC_APP_VERSION, readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), @@ -2191,10 +2318,10 @@ static void gsp_phys_seq_log_buffer(const u8 *payload, u32 payload_off, u32 dump_dwords = min_t(u32, cmd_index, GSP_PHYS_SEQ_DUMP_DWORDS); u32 index = 0, ops = 0; - pr_info("gsp-phys-boot: stage 3e sequencer buffer (once per boot): payloadOff=%u bufferSizeDWord=%u cmdIndex=%u hexDump=%u dwords\n", + pr_info("vgsp-boot: stage 3e sequencer buffer (once per boot): payloadOff=%u bufferSizeDWord=%u cmdIndex=%u hexDump=%u dwords\n", payload_off, buffer_size, cmd_index, dump_dwords); if (dump_dwords) - print_hex_dump(KERN_INFO, "gsp-phys-boot: seq cmd: ", + print_hex_dump(KERN_INFO, "vgsp-boot: seq cmd: ", DUMP_PREFIX_OFFSET, 16, 4, cmd, dump_dwords * 4u, true); @@ -2207,7 +2334,7 @@ static void gsp_phys_seq_log_buffer(const u8 *payload, u32 payload_off, index++; if (args == U32_MAX || (u64)index + (u64)args > (u64)cmd_index) { - pr_info("gsp-phys-boot: stage 3e sequencer decode stopped at dword %u: opcode=%u args=%u remaining=%u\n", + pr_info("vgsp-boot: stage 3e sequencer decode stopped at dword %u: opcode=%u args=%u remaining=%u\n", at, opcode, args, cmd_index - at); break; } @@ -2221,34 +2348,34 @@ static void gsp_phys_seq_log_buffer(const u8 *payload, u32 payload_off, switch (opcode) { case GSP_PHYS_SEQ_OP_REG_WRITE: - pr_info("gsp-phys-boot: stage 3e seq op[%u] @dw%u: REG_WRITE(addr=0x%08x value=0x%08x)\n", + pr_info("vgsp-boot: stage 3e seq op[%u] @dw%u: REG_WRITE(addr=0x%08x value=0x%08x)\n", ops - 1, at, a0, a1); break; case GSP_PHYS_SEQ_OP_REG_MODIFY: - pr_info("gsp-phys-boot: stage 3e seq op[%u] @dw%u: REG_MODIFY(addr=0x%08x mask=0x%08x value=0x%08x)\n", + pr_info("vgsp-boot: stage 3e seq op[%u] @dw%u: REG_MODIFY(addr=0x%08x mask=0x%08x value=0x%08x)\n", ops - 1, at, a0, a1, a2); break; case GSP_PHYS_SEQ_OP_REG_POLL: - pr_info("gsp-phys-boot: stage 3e seq op[%u] @dw%u: REG_POLL(addr=0x%08x mask=0x%08x value=0x%08x timeoutUs=%u error=0x%x)\n", + pr_info("vgsp-boot: stage 3e seq op[%u] @dw%u: REG_POLL(addr=0x%08x mask=0x%08x value=0x%08x timeoutUs=%u error=0x%x)\n", ops - 1, at, a0, a1, a2, a3, a4); break; case GSP_PHYS_SEQ_OP_DELAY_US: - pr_info("gsp-phys-boot: stage 3e seq op[%u] @dw%u: DELAY_US(%u us)\n", + pr_info("vgsp-boot: stage 3e seq op[%u] @dw%u: DELAY_US(%u us)\n", ops - 1, at, a0); break; case GSP_PHYS_SEQ_OP_REG_STORE: - pr_info("gsp-phys-boot: stage 3e seq op[%u] @dw%u: REG_STORE(addr=0x%08x saveIndex=%u)\n", + pr_info("vgsp-boot: stage 3e seq op[%u] @dw%u: REG_STORE(addr=0x%08x saveIndex=%u)\n", ops - 1, at, a0, a1); break; default: - pr_info("gsp-phys-boot: stage 3e seq op[%u] @dw%u: %s operands=[0x%08x,0x%08x,0x%08x,0x%08x,0x%08x]\n", + pr_info("vgsp-boot: stage 3e seq op[%u] @dw%u: %s operands=[0x%08x,0x%08x,0x%08x,0x%08x,0x%08x]\n", ops - 1, at, gsp_phys_seq_op_name(opcode), a0, a1, a2, a3, a4); break; } } if (ops == GSP_PHYS_SEQ_DUMP_OPS && index < cmd_index) - pr_info("gsp-phys-boot: stage 3e sequencer opcode list truncated at %u ops (%u of %u command dwords decoded)\n", + pr_info("vgsp-boot: stage 3e sequencer opcode list truncated at %u ops (%u of %u command dwords decoded)\n", ops, index, cmd_index); } @@ -2260,16 +2387,16 @@ static bool gsp_phys_seq_addr_valid(void __iomem *bar0, resource_size_t bar0_len, u32 addr) { if (!bar0 || !bar0_len) { - pr_err("gsp-phys-boot: sequencer register access without a BAR0 window\n"); + pr_err("vgsp-boot: sequencer register access without a BAR0 window\n"); return false; } if (addr & 0x3u) { - pr_err("gsp-phys-boot: sequencer register address 0x%08x is not 4-byte aligned\n", + pr_err("vgsp-boot: sequencer register address 0x%08x is not 4-byte aligned\n", addr); return false; } if ((u64)addr + 4u > (u64)bar0_len) { - pr_err("gsp-phys-boot: sequencer register address 0x%08x is outside BAR0 (len 0x%llx)\n", + pr_err("vgsp-boot: sequencer register address 0x%08x is outside BAR0 (len 0x%llx)\n", addr, (u64)bar0_len); return false; } @@ -2300,7 +2427,7 @@ static int gsp_phys_seq_reg_poll(void __iomem *bar0, u32 addr, u32 mask, observed = readl(bar0 + addr); while ((observed & mask) != val) { if (time_after_eq(jiffies, deadline)) { - pr_err("gsp-phys-boot: stage 3e sequencer REG_POLL timeout after %u us: addr=0x%08x mask=0x%08x want=0x%08x observed=0x%08x err=0x%x\n", + pr_err("vgsp-boot: stage 3e sequencer REG_POLL timeout after %u us: addr=0x%08x mask=0x%08x want=0x%08x observed=0x%08x err=0x%x\n", timeout_us, addr, mask, val, observed, error); return -ETIMEDOUT; } @@ -2325,11 +2452,11 @@ static int gsp_phys_seq_core_resume(struct gsp_phys_boot *boot, u32 m0, riscv; int ret; - pr_info("gsp-phys-boot: stage 3e sequencer CORE_RESUME: reset GSP into RISC-V, libos args 0x%llx, start SEC2 (GSP-RM reload)\n", + pr_info("vgsp-boot: stage 3e sequencer CORE_RESUME: reset GSP into RISC-V, libos args 0x%llx, start SEC2 (GSP-RM reload)\n", (u64)boot->libos_args_dma); ret = gsp_phys_falcon_reset(bar0, GSP_PHYS_GSP_BASE); if (ret) { - pr_err("gsp-phys-boot: stage 3e sequencer CORE_RESUME: GSP falcon reset failed (%d)\n", + pr_err("vgsp-boot: stage 3e sequencer CORE_RESUME: GSP falcon reset failed (%d)\n", ret); return ret; } @@ -2348,7 +2475,7 @@ static int gsp_phys_seq_core_resume(struct gsp_phys_boot *boot, break; if (time_after_eq(jiffies, deadline)) { gsp_phys_scratch14_log(bar0, "sequencer-resume-timeout"); - pr_err("gsp-phys-boot: stage 3e sequencer CORE_RESUME: SEC2 reload not complete within %u ms\n", + pr_err("vgsp-boot: stage 3e sequencer CORE_RESUME: SEC2 reload not complete within %u ms\n", GSP_PHYS_SEQ_RESUME_TIMEOUT_MS); return -ETIMEDOUT; } @@ -2357,18 +2484,18 @@ static int gsp_phys_seq_core_resume(struct gsp_phys_boot *boot, m0 = readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX0); if (m0 != 0) { - pr_err("gsp-phys-boot: stage 3e sequencer CORE_RESUME: SEC2 M0=0x%08x (want 0)\n", + pr_err("vgsp-boot: stage 3e sequencer CORE_RESUME: SEC2 M0=0x%08x (want 0)\n", m0); return -EIO; } riscv = readl(bar0 + GSP_PHYS_RISCV_STATUS); if (!(riscv & GSP_PHYS_RISCV_ACTIVE)) { - pr_err("gsp-phys-boot: stage 3e sequencer CORE_RESUME: RISC-V core not active (RISCV_STATUS=0x%08x)\n", + pr_err("vgsp-boot: stage 3e sequencer CORE_RESUME: RISC-V core not active (RISCV_STATUS=0x%08x)\n", riscv); return -ENODEV; } gsp_phys_scratch14_log(bar0, "sequencer-resume-done"); - pr_info("gsp-phys-boot: stage 3e sequencer CORE_RESUME complete: SEC2 M0=0, SEC2 M1=0x%08x, RISCV_STATUS=0x%08x\n", + pr_info("vgsp-boot: stage 3e sequencer CORE_RESUME complete: SEC2 M0=0, SEC2 M1=0x%08x, RISCV_STATUS=0x%08x\n", readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX1), riscv); return 0; @@ -2386,29 +2513,29 @@ static int gsp_phys_seq_parse_req(const u8 *payload, u32 payload_len, u32 bs, ci; if (elem_count != 1) { - pr_err("gsp-phys-boot: sequencer message spans %u elements; only single-element buffers are supported\n", + pr_err("vgsp-boot: sequencer message spans %u elements; only single-element buffers are supported\n", elem_count); return -EOPNOTSUPP; } if (payload_len < GSP_PHYS_SEQ_REQUEST_SIZE) { - pr_err("gsp-phys-boot: sequencer payload too small (%u bytes, need %u)\n", + pr_err("vgsp-boot: sequencer payload too small (%u bytes, need %u)\n", payload_len, GSP_PHYS_SEQ_REQUEST_SIZE); return -EINVAL; } bs = gsp_phys_seq_dw(payload, 0); ci = gsp_phys_seq_dw(payload, 1); if (bs == 0 || bs > GSP_PHYS_SEQ_MAX_BUFFER_DWORDS) { - pr_err("gsp-phys-boot: sequencer bufferSizeDWord=%u out of range (1..%u)\n", + pr_err("vgsp-boot: sequencer bufferSizeDWord=%u out of range (1..%u)\n", bs, GSP_PHYS_SEQ_MAX_BUFFER_DWORDS); return -EINVAL; } if (ci >= bs) { - pr_err("gsp-phys-boot: sequencer cmdIndex=%u is not below bufferSizeDWord=%u\n", + pr_err("vgsp-boot: sequencer cmdIndex=%u is not below bufferSizeDWord=%u\n", ci, bs); return -EINVAL; } if ((u64)GSP_PHYS_SEQ_REQUEST_SIZE + (u64)ci * 4u > (u64)payload_len) { - pr_err("gsp-phys-boot: sequencer cmdIndex=%u needs %llu payload bytes but the element holds %u\n", + pr_err("vgsp-boot: sequencer cmdIndex=%u needs %llu payload bytes but the element holds %u\n", ci, (u64)GSP_PHYS_SEQ_REQUEST_SIZE + (u64)ci * 4u, payload_len); return -EINVAL; @@ -2441,12 +2568,12 @@ static int gsp_phys_seq_execute_req(struct gsp_phys_boot *boot, index++; if (args == U32_MAX) { - pr_err("gsp-phys-boot: sequencer unknown opcode %u at dword %u\n", + pr_err("vgsp-boot: sequencer unknown opcode %u at dword %u\n", opcode, index - 1); return -EINVAL; } if ((u64)index + (u64)args > (u64)cmd_index) { - pr_err("gsp-phys-boot: sequencer opcode %u truncated at dword %u (cmdIndex=%u)\n", + pr_err("vgsp-boot: sequencer opcode %u truncated at dword %u (cmdIndex=%u)\n", opcode, index, cmd_index); return -EINVAL; } @@ -2485,7 +2612,7 @@ static int gsp_phys_seq_execute_req(struct gsp_phys_boot *boot, case GSP_PHYS_SEQ_OP_DELAY_US: if (a0 > GSP_PHYS_SEQ_DELAY_MAX_US) { - pr_info("gsp-phys-boot: sequencer DELAY_US %u clamped to %u us\n", + pr_info("vgsp-boot: sequencer DELAY_US %u clamped to %u us\n", a0, GSP_PHYS_SEQ_DELAY_MAX_US); a0 = GSP_PHYS_SEQ_DELAY_MAX_US; } @@ -2499,7 +2626,7 @@ static int gsp_phys_seq_execute_req(struct gsp_phys_boot *boot, if (!gsp_phys_seq_addr_valid(bar0, bar0_len, a0)) return -EINVAL; if (a1 >= GSP_PHYS_SEQ_REG_SAVE_SIZE) { - pr_err("gsp-phys-boot: sequencer REG_STORE index %u out of range (max %u)\n", + pr_err("vgsp-boot: sequencer REG_STORE index %u out of range (max %u)\n", a1, GSP_PHYS_SEQ_REG_SAVE_SIZE - 1); return -EINVAL; } @@ -2571,7 +2698,7 @@ static int gsp_phys_seq_run_buffer(struct gsp_phys_boot *boot, int ret; if (rpc_len < GSP_PHYS_MSG_RPC_HEADER_SIZE) { - pr_err("gsp-phys-boot: sequencer rpc.length=%u is smaller than the %u-byte rpc header\n", + pr_err("vgsp-boot: sequencer rpc.length=%u is smaller than the %u-byte rpc header\n", rpc_len, GSP_PHYS_MSG_RPC_HEADER_SIZE); return -EINVAL; } @@ -2602,20 +2729,20 @@ static int gsp_phys_seq_run_buffer(struct gsp_phys_boot *boot, elem_count, &buffer_size, &cmd_index); if (ret) { - pr_err("gsp-phys-boot: stage 3e sequencer: neither layout parses (element+%u failed, legacy element+%u failed %d, reference bufferSizeDWord=%u); refusing to execute\n", + pr_err("vgsp-boot: stage 3e sequencer: neither layout parses (element+%u failed, legacy element+%u failed %d, reference bufferSizeDWord=%u); refusing to execute\n", GSP_PHYS_MSG_ELEMENT_PAYLOAD_OFF, GSP_PHYS_MSG_ELEMENT_PAYLOAD_OFF_LEGACY, ret, ref_buffer_size); return ret; } legacy_layout = true; - pr_warn("gsp-phys-boot: stage 3e sequencer: reference element+%u implausible (bufferSizeDWord=%u); using legacy element+%u (rpc.length=%u)\n", + pr_warn("vgsp-boot: stage 3e sequencer: reference element+%u implausible (bufferSizeDWord=%u); using legacy element+%u (rpc.length=%u)\n", GSP_PHYS_MSG_ELEMENT_PAYLOAD_OFF, ref_buffer_size, GSP_PHYS_MSG_ELEMENT_PAYLOAD_OFF_LEGACY, rpc_len); } else { - pr_err("gsp-phys-boot: stage 3e sequencer: element+%u layout failed (%d) with a plausible bufferSizeDWord=%u; not trying the legacy layout (would execute a reinterpretation)\n", + pr_err("vgsp-boot: stage 3e sequencer: element+%u layout failed (%d) with a plausible bufferSizeDWord=%u; not trying the legacy layout (would execute a reinterpretation)\n", GSP_PHYS_MSG_ELEMENT_PAYLOAD_OFF, ret, ref_buffer_size); return ret; @@ -2632,7 +2759,7 @@ static int gsp_phys_seq_run_buffer(struct gsp_phys_boot *boot, gsp_phys_seq_log_buffer(payload, offset, buffer_size, cmd_index); } - pr_info("gsp-phys-boot: stage 3e sequencer: layout=%s element+%u (bufferSizeDWord=%u cmdIndex=%u)\n", + pr_info("vgsp-boot: stage 3e sequencer: layout=%s element+%u (bufferSizeDWord=%u cmdIndex=%u)\n", legacy_layout ? "legacy" : "reference", offset, buffer_size, cmd_index); @@ -2933,7 +3060,7 @@ static void gsp_phys_nocat_record(const struct gsp_phys_rx_record *rec) source, engine, rec->seq_num); if (gsp_phys_nocat_param) - pr_info("gsp-nocat: rec seq=%u recType=%u errorCode=0x%llx subsystem=0x%x bugcheck=0x%x payload=%u source=\"%s\" faultingEngine=\"%s\"\n", + pr_info("vgsp-nocat: rec seq=%u recType=%u errorCode=0x%llx subsystem=0x%x bugcheck=0x%x payload=%u source=\"%s\" faultingEngine=\"%s\"\n", rec->seq_num, rec_type, error_code, subsystem, bugcheck, len, source, engine); } @@ -2942,14 +3069,14 @@ static void gsp_phys_nocat_summary_dump(void) { u32 i; - pr_info("gsp-nocat: summary: %u unique, %u total, %u overflow\n", + pr_info("vgsp-nocat: summary: %u unique, %u total, %u overflow\n", gsp_phys_nocat_slot_count, gsp_phys_nocat_record_count, gsp_phys_nocat_overflow); for (i = 0; i < gsp_phys_nocat_slot_count; i++) { const struct gsp_phys_nocat_slot *slot = &gsp_phys_nocat_slots[i]; - pr_info("gsp-nocat: entry[%u]: count=%u recType=%u errorCode=0x%llx subsystem=0x%x bugcheck=0x%x firstSeq=%u lastSeq=%u source=\"%s\" faultingEngine=\"%s\"\n", + pr_info("vgsp-nocat: entry[%u]: count=%u recType=%u errorCode=0x%llx subsystem=0x%x bugcheck=0x%x firstSeq=%u lastSeq=%u source=\"%s\" faultingEngine=\"%s\"\n", i, slot->count, slot->rec_type, slot->error_code, slot->subsystem, slot->bugcheck, slot->first_seq, slot->last_seq, slot->source, slot->faulting_engine); @@ -3008,7 +3135,7 @@ static int gsp_phys_status_queue_link(struct gsp_phys_status_queue *sq, * consumed records (GSP-RM derives its free space from it). */ if (boot_stage.status_read_ptr >= msg_count) { - pr_warn("gsp-phys-boot: status queue persisted readPtr=%u outside the ring (msgCount=%u); restarting at slot 0\n", + pr_warn("vgsp-boot: status queue persisted readPtr=%u outside the ring (msgCount=%u); restarting at slot 0\n", boot_stage.status_read_ptr, msg_count); boot_stage.status_read_ptr = 0; } @@ -3018,7 +3145,7 @@ static int gsp_phys_status_queue_link(struct gsp_phys_status_queue *sq, sq->read_ptr = boot_stage.status_read_ptr; sq->last_wp = wp; sq->last_wp_logged = wp; - pr_info("gsp-phys-boot: status queue TX header linked (host read-only): size=0x%x msgSize=%u msgCount=%u flags=0x%x rxHdrOff=0x%x entryOff=0x%x writePtr slot=%u (%s from slot %u)\n", + pr_info("vgsp-boot: status queue TX header linked (host read-only): size=0x%x msgSize=%u msgCount=%u flags=0x%x rxHdrOff=0x%x entryOff=0x%x writePtr slot=%u (%s from slot %u)\n", size, msg_size, msg_count, le32_to_cpu(READ_ONCE(tx->flags)), rx_hdr_off, entry_off, wp, sq->read_ptr == 0 ? "initial, scanning" : "resuming", @@ -3026,7 +3153,7 @@ static int gsp_phys_status_queue_link(struct gsp_phys_status_queue *sq, return 0; } if (wp != sq->last_wp_logged) { - pr_info("gsp-phys-boot: status queue writePtr=%u but TX header not linked yet (version=%u size=0x%x msgSize=%u msgCount=%u)\n", + pr_info("vgsp-boot: status queue writePtr=%u but TX header not linked yet (version=%u size=0x%x msgSize=%u msgCount=%u)\n", wp, version, size, msg_size, msg_count); sq->last_wp_logged = wp; } @@ -3061,12 +3188,12 @@ static int gsp_phys_status_queue_next(struct gsp_phys_status_queue *sq, (stat + GSP_PHYS_MSGQ_TX_WRITEPTR_OFF))); dma_rmb(); if (wp >= sq->msg_count) { - pr_err("gsp-phys-boot: status queue writePtr=%u outside the ring (msgCount=%u); refusing to walk\n", + pr_err("vgsp-boot: status queue writePtr=%u outside the ring (msgCount=%u); refusing to walk\n", wp, sq->msg_count); return -EIO; } if (wp != sq->last_wp) { - pr_info("gsp-phys-boot: status queue writePtr (ring slot) %u -> %u\n", + pr_info("vgsp-boot: status queue writePtr (ring slot) %u -> %u\n", sq->last_wp, wp); sq->last_wp = wp; } @@ -3089,19 +3216,19 @@ static int gsp_phys_status_queue_next(struct gsp_phys_status_queue *sq, dma_rmb(); rpc_length = le32_to_cpu(READ_ONCE(e->rpc_length)); if (elem_count == 0 || elem_count > GSP_PHYS_MSG_ELEMENTS_MAX) { - pr_err("gsp-phys-boot: status queue slot %u elemCount=%u is out of range (1..%u); refusing to walk\n", + pr_err("vgsp-boot: status queue slot %u elemCount=%u is out of range (1..%u); refusing to walk\n", slot, elem_count, GSP_PHYS_MSG_ELEMENTS_MAX); return -EIO; } if (elem_count > available) { - pr_err("gsp-phys-boot: status queue slot %u elemCount=%u exceeds the %u published slot(s); refusing to walk\n", + pr_err("vgsp-boot: status queue slot %u elemCount=%u exceeds the %u published slot(s); refusing to walk\n", slot, elem_count, available); return -EIO; } if (rpc_length < GSP_PHYS_MSG_RPC_HEADER_SIZE || (u64)GSP_PHYS_MSG_RPC_HEADER_OFF + rpc_length > (u64)elem_count * GSP_PHYS_MSG_SIZE) { - pr_err("gsp-phys-boot: status queue slot %u rpc.length=%u does not fit %u element(s); refusing to walk\n", + pr_err("vgsp-boot: status queue slot %u rpc.length=%u does not fit %u element(s); refusing to walk\n", slot, rpc_length, elem_count); return -EIO; } @@ -3220,7 +3347,7 @@ static int gsp_phys_status_wait_locked(struct gsp_phys_status_queue *sq, gsp_phys_fault_observe(&one, &fi); gsp_phys_fault_wait_unmatched++; } else { - pr_debug("gsp-phys-boot: status wait: dropping unmatched record slot %u (seqNum=%u rpc.len=%u checksum=0x%08x): function=0x%x rpc_result=%u\n", + pr_debug("vgsp-boot: status wait: dropping unmatched record slot %u (seqNum=%u rpc.len=%u checksum=0x%08x): function=0x%x rpc_result=%u\n", one.first_slot, one.seq_num, one.rpc_length, one.checksum, one.function, one.rpc_result); } @@ -3270,13 +3397,13 @@ static void gsp_phys_rx_readptr_publish(u32 read_ptr) if (!(flags & GSP_PHYS_MSG_FLAGS_SWAP_RX) || rx_hdr_off < GSP_PHYS_MSGQ_TX_WRITEPTR_OFF + 4 || rx_hdr_off + 4 > entry_off) { - pr_warn("gsp-phys-boot: cannot publish the status-queue readPtr (%u): cmd TX flags=0x%x rxHdrOff=0x%x entryOff=0x%x\n", + pr_warn("vgsp-boot: cannot publish the status-queue readPtr (%u): cmd TX flags=0x%x rxHdrOff=0x%x entryOff=0x%x\n", read_ptr, flags, rx_hdr_off, entry_off); return; } rx_ptr = (__le32 *)((u8 *)cmd_hdr + rx_hdr_off); - pr_debug("gsp-phys-boot: status-queue readPtr -> %u (cmd+0x%x)\n", + pr_debug("vgsp-boot: status-queue readPtr -> %u (cmd+0x%x)\n", read_ptr, rx_hdr_off); WRITE_ONCE(*rx_ptr, cpu_to_le32(read_ptr)); dma_wmb(); @@ -3311,7 +3438,7 @@ static void gsp_phys_rx_readptr_publish(u32 read_ptr) #define GSP_PHYS_OSERR_LEN_ERRSTRING 256 #define GSP_PHYS_OSERR_OFF_PREVXID 268 -/* One decoded line: "gsp-phys-status:" prefix in dmesg and in the seq_file. */ +/* One decoded line: "vgsp-status:" prefix in dmesg and in the seq_file. */ static void gsp_phys_status_emit(struct seq_file *m, const char *fmt, ...) { char line[GSP_PHYS_STATUS_LINE_MAX]; @@ -3323,9 +3450,9 @@ static void gsp_phys_status_emit(struct seq_file *m, const char *fmt, ...) va_end(args); if (n <= 0) return; - pr_info("gsp-phys-status: %s\n", line); + pr_info("vgsp-status: %s\n", line); if (m) - seq_printf(m, "gsp-phys-status: %s\n", line); + seq_printf(m, "vgsp-status: %s\n", line); } /* @@ -3465,7 +3592,7 @@ static void gsp_phys_fault_observe(const struct gsp_phys_rx_record *rec, gsp_phys_fault_seen++; gsp_phys_fault_epoch++; if (gsp_phys_fault_relay_enabled()) - pr_info_ratelimited("gsp-phys-fault: func=0x1006 seq=%u exceptType=0x%x runlistId=%u chid=%u prevXid=0x%x errString=\"%s\"\n", + pr_info_ratelimited("vgsp-fault: func=0x1006 seq=%u exceptType=0x%x runlistId=%u chid=%u prevXid=0x%x errString=\"%s\"\n", rec->seq_num, out->except_type, out->runlist_id, out->chid, out->prev_xid, out->err); } @@ -3774,7 +3901,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, * so a failed boot always leaves the NOCAT record summary in dmesg. */ if (!boot || !boot_stage.ran) { - pr_warn("gsp-phys-boot: stage 3e skipped: stage 3d did not complete\n"); + pr_warn("vgsp-boot: stage 3e skipped: stage 3d did not complete\n"); gsp_phys_nocat_reset(); goto out; } @@ -3783,7 +3910,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, gsp_phys_status_queue_init(&sq); start_jiffies = jiffies; deadline = start_jiffies + msecs_to_jiffies(GSP_PHYS_RM_INIT_TIMEOUT_MS); - pr_info("gsp-phys-boot: stage 3e: polling status queue at shared+0x%x (writePtr @ +0x%x), timeout %u ms\n", + pr_info("vgsp-boot: stage 3e: polling status queue at shared+0x%x (writePtr @ +0x%x), timeout %u ms\n", GSP_PHYS_QUEUE_STAT_OFF, GSP_PHYS_MSGQ_TX_WRITEPTR_OFF, GSP_PHYS_RM_INIT_TIMEOUT_MS); @@ -3799,12 +3926,12 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, if (rret == -EAGAIN) break; if (rret) { - pr_err("gsp-phys-boot: stage 3e incomplete: status-queue record walk failed (%d); stage 3d done, WPR2 teardown remains valid\n", + pr_err("vgsp-boot: stage 3e incomplete: status-queue record walk failed (%d); stage 3d done, WPR2 teardown remains valid\n", rret); goto out; } - pr_info("gsp-phys-boot: status queue element slot %u (seqNum=%u elemCount=%u): function=0x%x rpc_result=%u\n", + pr_info("vgsp-boot: status queue element slot %u (seqNum=%u elemCount=%u): function=0x%x rpc_result=%u\n", rec.first_slot, rec.seq_num, rec.elem_count, rec.function, rec.rpc_result); @@ -3828,7 +3955,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, int sret; if (!bar0 || !bar0_len) { - pr_err("gsp-phys-boot: stage 3e incomplete: sequencer 0x%x arrived without a BAR0 window; stage 3d done, WPR2 teardown remains valid\n", + pr_err("vgsp-boot: stage 3e incomplete: sequencer 0x%x arrived without a BAR0 window; stage 3d done, WPR2 teardown remains valid\n", rec.function); gsp_phys_rx_record_free(&rec); goto out; @@ -3836,7 +3963,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, if (rec.rpc_length > GSP_PHYS_MSG_SIZE - GSP_PHYS_MSG_RPC_HEADER_OFF) { - pr_err("gsp-phys-boot: stage 3e incomplete: sequencer 0x%x rpc.length=%u exceeds the %u-byte element (slot %u); stage 3d done, WPR2 teardown remains valid\n", + pr_err("vgsp-boot: stage 3e incomplete: sequencer 0x%x rpc.length=%u exceeds the %u-byte element (slot %u); stage 3d done, WPR2 teardown remains valid\n", rec.function, rec.rpc_length, GSP_PHYS_MSG_SIZE, @@ -3852,7 +3979,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, &seq_buffer, &seq_index, &seq_cmds, &seq_off); if (sret) { - pr_err("gsp-phys-boot: stage 3e incomplete: sequencer 0x%x execution failed (%d) at slot %u seqNum=%u; stage 3d done, WPR2 teardown remains valid\n", + pr_err("vgsp-boot: stage 3e incomplete: sequencer 0x%x execution failed (%d) at slot %u seqNum=%u; stage 3d done, WPR2 teardown remains valid\n", rec.function, sret, rec.first_slot, rec.seq_num); @@ -3861,7 +3988,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, } seq_payload = rec.buf + seq_off; gsp_phys_fwsec_scratch14_read(bar0, &s14); - pr_info("gsp-phys-boot: stage 3e: ran GSP-RM sequencer (cmdIndex=%u, %u cmds): bufferSizeDWord=0x%x rpcLength=0x%x payloadOff=%u regSaveArea={0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x} RISCV_STATUS=0x%x scratch14=0x%08x\n", + pr_info("vgsp-boot: stage 3e: ran GSP-RM sequencer (cmdIndex=%u, %u cmds): bufferSizeDWord=0x%x rpcLength=0x%x payloadOff=%u regSaveArea={0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x} RISCV_STATUS=0x%x scratch14=0x%08x\n", seq_index, seq_cmds, seq_buffer, rec.rpc_length, seq_off, gsp_phys_seq_dw(seq_payload, 2), @@ -3879,7 +4006,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, GSP_PHYS_MSG_FUNC_GSP_INIT_DONE) { if (rec.rpc_result == 0) { boot_stage.rm_init_done = true; - pr_info("gsp-phys-boot: stage 3e complete: GSP-RM init event 0x%x (rpc_result=0, seqNum=%u) after %u ms (writePtr slot=%u)\n", + pr_info("vgsp-boot: stage 3e complete: GSP-RM init event 0x%x (rpc_result=0, seqNum=%u) after %u ms (writePtr slot=%u)\n", rec.function, rec.seq_num, jiffies_to_msecs(jiffies - @@ -3888,7 +4015,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, gsp_phys_rx_record_free(&rec); goto out; } - pr_info("gsp-phys-boot: stage 3e incomplete: GSP-RM reported init failure (function=0x%x rpc_result=0x%x, seqNum=%u); stage 3d done, WPR2 teardown remains valid\n", + pr_info("vgsp-boot: stage 3e incomplete: GSP-RM reported init failure (function=0x%x rpc_result=0x%x, seqNum=%u); stage 3d done, WPR2 teardown remains valid\n", rec.function, rec.rpc_result, rec.seq_num); gsp_phys_rx_record_free(&rec); @@ -3899,7 +4026,7 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, } if (time_after_eq(jiffies, deadline)) { - pr_info("gsp-phys-boot: stage 3e incomplete: no GSP-RM init event 0x%x in %u ms (writePtr=%u; stage 3d done, WPR2 teardown remains valid)\n", + pr_info("vgsp-boot: stage 3e incomplete: no GSP-RM init event 0x%x in %u ms (writePtr=%u; stage 3d done, WPR2 teardown remains valid)\n", GSP_PHYS_MSG_FUNC_GSP_INIT_DONE, GSP_PHYS_RM_INIT_TIMEOUT_MS, sq.linked ? sq.last_wp : 0); @@ -3959,11 +4086,11 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, bool stat_linked, stat_rx_swapped, peer_from_status; if (!bar0 || !boot_stage.primed || !q->pages) { - pr_err("gsp-phys-boot: TX refused: command-queue staging is not primed\n"); + pr_err("vgsp-boot: TX refused: command-queue staging is not primed\n"); return -EINVAL; } if (payload_len > GSP_PHYS_MSG_PAYLOAD_MAX) { - pr_err("gsp-phys-boot: TX refused: payload %u exceeds %u bytes\n", + pr_err("vgsp-boot: TX refused: payload %u exceeds %u bytes\n", payload_len, GSP_PHYS_MSG_PAYLOAD_MAX); return -EINVAL; } @@ -3972,7 +4099,7 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, aligned_len = (msg_len + 7u) & ~7u; elem_count = DIV_ROUND_UP(msg_len, GSP_PHYS_MSG_SIZE); if (elem_count == 0 || elem_count > GSP_PHYS_MSG_ELEMENTS_MAX) { - pr_err("gsp-phys-boot: TX refused: message spans %u elements (max %u)\n", + pr_err("vgsp-boot: TX refused: message spans %u elements (max %u)\n", elem_count, GSP_PHYS_MSG_ELEMENTS_MAX); return -EINVAL; } @@ -3996,7 +4123,7 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, entry_off != GSP_PHYS_PAGE_SIZE || rx_hdr_off < GSP_PHYS_MSGQ_TX_WRITEPTR_OFF + 4 || rx_hdr_off + 4 > entry_off || wp >= msg_count) { - pr_err("gsp-phys-boot: TX refused: command-queue TX header mismatch (version=%u size=0x%x msgSize=%u msgCount=%u entryOff=0x%x rxHdrOff=0x%x writePtr=%u); GSP-RM did not link the staged header\n", + pr_err("vgsp-boot: TX refused: command-queue TX header mismatch (version=%u size=0x%x msgSize=%u msgCount=%u entryOff=0x%x rxHdrOff=0x%x writePtr=%u); GSP-RM did not link the staged header\n", version, size, msg_size, msg_count, entry_off, rx_hdr_off, wp); return -EIO; @@ -4040,7 +4167,7 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, */ if (stat_linked) { if (cmd_read >= msg_count) { - pr_err("gsp-phys-boot: TX refused: peer readPtr=%u is outside the command ring (msgCount=%u)\n", + pr_err("vgsp-boot: TX refused: peer readPtr=%u is outside the command ring (msgCount=%u)\n", cmd_read, msg_count); return -EIO; } @@ -4048,7 +4175,7 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, if (tx_free >= msg_count) tx_free -= msg_count; if (tx_free < elem_count) { - pr_err("gsp-phys-boot: TX refused: command queue full (txFree=%u < elemCount=%u; peer readPtr=%u writePtr=%u msgCount=%u)\n", + pr_err("vgsp-boot: TX refused: command queue full (txFree=%u < elemCount=%u; peer readPtr=%u writePtr=%u msgCount=%u)\n", tx_free, elem_count, cmd_read, wp, msg_count); return -EBUSY; } @@ -4056,7 +4183,7 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, tx_free = msg_count - 1; } - pr_info("gsp-phys-boot: TX preflight: cmd hdr v%u size=0x%x msgSize=%u msgCount=%u entryOff=0x%x rxHdrOff=0x%x writePtr(slot)=%u txFree=%u; peer readPtr candidates: cmd+0x%x=%u, status+0x%x=%u (status flags=0x%x swapRx=%u) -> %s; status hdr v%u writePtr=%u msgCount=%u %s\n", + pr_info("vgsp-boot: TX preflight: cmd hdr v%u size=0x%x msgSize=%u msgCount=%u entryOff=0x%x rxHdrOff=0x%x writePtr(slot)=%u txFree=%u; peer readPtr candidates: cmd+0x%x=%u, status+0x%x=%u (status flags=0x%x swapRx=%u) -> %s; status hdr v%u writePtr=%u msgCount=%u %s\n", version, size, msg_size, msg_count, entry_off, rx_hdr_off, wp, tx_free, rx_hdr_off, cmd_read_cmd, stat_rx_hdr_off, cmd_read_status, stat_flags, stat_rx_swapped, @@ -4133,7 +4260,7 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, */ writel(0, bar0 + GSP_PHYS_QUEUE_HEAD_REG); - pr_info("gsp-phys-boot: TX submitted: function=%u (0x%x) slot=%u length=%u (rpc.length=%u elemCount=%u seqNum=%u checksum=0x%08x) writePtr slot %u -> %u; doorbell QUEUE_HEAD(%u)@0x%x<-0\n", + pr_info("vgsp-boot: TX submitted: function=%u (0x%x) slot=%u length=%u (rpc.length=%u elemCount=%u seqNum=%u checksum=0x%08x) writePtr slot %u -> %u; doorbell QUEUE_HEAD(%u)@0x%x<-0\n", function, function, slot, msg_len, GSP_PHYS_MSG_RPC_HEADER_SIZE + payload_len, elem_count, boot_stage.tx_seq_num, checksum, wp, new_wp, @@ -4460,7 +4587,7 @@ static void gsp_phys_preinit_fill_system_info( mirror_id = ioread32(bar0 + GSP_PHYS_PCI_CONFIG_MIRROR_BASE); mirror_rev = ioread32(bar0 + GSP_PHYS_PCI_CONFIG_MIRROR_BASE + 0x08); mirror_sub = ioread32(bar0 + GSP_PHYS_PCI_CONFIG_MIRROR_BASE + 0x2c); - pr_info("gsp-phys-boot: NV_PCFG mirror @0x%x: id=0x%08x rev=0x%08x sub=0x%08x (config @0x00/0x08/0x2c: 0x%08x/0x%08x/0x%08x)\n", + pr_info("vgsp-boot: NV_PCFG mirror @0x%x: id=0x%08x rev=0x%08x sub=0x%08x (config @0x00/0x08/0x2c: 0x%08x/0x%08x/0x%08x)\n", GSP_PHYS_PCI_CONFIG_MIRROR_BASE, mirror_id, mirror_rev, mirror_sub, cfg_id, cfg_rev, cfg_sub); info->oor_arch = 0; /* OOR_ARCH_X86_64 */ @@ -4560,7 +4687,7 @@ static u64 gsp_phys_timer_set_current_time(void __iomem *bar0) plm = readl(bar0 + GSP_PHYS_PTIMER_TIME_PRIV_LEVEL_MASK); if (!(plm & GSP_PHYS_PTIMER_WRITE_PROT_LEVEL0)) { - pr_warn("gsp-phys-boot: tmrSetCurrentTime skipped: PTIMER level-0 write protection is not enabled (PLM=0x%08x)\n", + pr_warn("vgsp-boot: tmrSetCurrentTime skipped: PTIMER level-0 write protection is not enabled (PLM=0x%08x)\n", plm); return 0; } @@ -4573,7 +4700,7 @@ static u64 gsp_phys_timer_set_current_time(void __iomem *bar0) writel(upper_32_bits(ns), bar0 + GSP_PHYS_PTIMER_TIME_1); writel(lower_32_bits(ns), bar0 + GSP_PHYS_PTIMER_TIME_0); - pr_info("gsp-phys-boot: tmrSetCurrentTime: PTIMER_TIME_1/0 = 0x%08x%08x (%llu ns wall clock, %u s + %u us); sysTimerOffsetNs=0 (GV100/TU10x HAL programs PTIMER directly)\n", + pr_info("vgsp-boot: tmrSetCurrentTime: PTIMER_TIME_1/0 = 0x%08x%08x (%llu ns wall clock, %u s + %u us); sysTimerOffsetNs=0 (GV100/TU10x HAL programs PTIMER directly)\n", upper_32_bits(ns), lower_32_bits(ns), ns, seconds, useconds); return 0; } @@ -4593,6 +4720,8 @@ static u64 gsp_phys_timer_set_current_time(void __iomem *bar0) static int gsp_phys_preinit_rpcs(void __iomem *bar0, struct pci_dev *pdev) { struct gsp_phys_gsp_system_info *info; + const u8 *reg_img; + u32 reg_len; u64 sys_timer_offset_ns; int ret; @@ -4602,7 +4731,7 @@ static int gsp_phys_preinit_rpcs(void __iomem *bar0, struct pci_dev *pdev) if (!info) return -ENOMEM; gsp_phys_preinit_fill_system_info(info, pdev, bar0, sys_timer_offset_ns); - pr_info("gsp-phys-boot: pre-boot GSP_SET_SYSTEM_INFO (fn%u) prepared: gpuPhys=0x%llx fb=0x%llx inst=0x%llx io=0x%llx dbf=0x%llx mirror=0x%x/0x%x ids=%08x:%08x:%08x maxUserVa=0x%llx pageSize=0x%llx flr=%u behindBridge=%u l1ss=0x%x lnkCap=0x%x primary=%u sysTimerOffsetNs=0x%llx\n", + pr_info("vgsp-boot: pre-boot GSP_SET_SYSTEM_INFO (fn%u) prepared: gpuPhys=0x%llx fb=0x%llx inst=0x%llx io=0x%llx dbf=0x%llx mirror=0x%x/0x%x ids=%08x:%08x:%08x maxUserVa=0x%llx pageSize=0x%llx flr=%u behindBridge=%u l1ss=0x%x lnkCap=0x%x primary=%u sysTimerOffsetNs=0x%llx\n", GSP_PHYS_RPC_FUNC_GSP_SET_SYSTEM_INFO, le64_to_cpu(info->gpu_phys_addr), le64_to_cpu(info->gpu_phys_fb_addr), @@ -4621,7 +4750,7 @@ static int gsp_phys_preinit_rpcs(void __iomem *bar0, struct pci_dev *pdev) le32_to_cpu(info->pcie_config_reg_link_cap), info->b_is_primary, le64_to_cpu(info->sys_timer_offset_ns)); - pr_info("gsp-phys-boot: pre-boot GSP_SET_SYSTEM_INFO (fn%u) chipset block: clPdbProperties=0x%llx chipset=%u (CS_UNKNOWN) FHBBusInfo=%04x:%04x sub=%04x:%04x rev=%02x chipsetIDInfo=%04x:%04x sub=%04x:%04x rev=%02x acpiMethodData bValid=0 (676-byte body zeroed; host ACPI not read)\n", + pr_info("vgsp-boot: pre-boot GSP_SET_SYSTEM_INFO (fn%u) chipset block: clPdbProperties=0x%llx chipset=%u (CS_UNKNOWN) FHBBusInfo=%04x:%04x sub=%04x:%04x rev=%02x chipsetIDInfo=%04x:%04x sub=%04x:%04x rev=%02x acpiMethodData bValid=0 (676-byte body zeroed; host ACPI not read)\n", GSP_PHYS_RPC_FUNC_GSP_SET_SYSTEM_INFO, le64_to_cpu(info->cl_pdb_properties), le32_to_cpu(info->chipset), @@ -4640,7 +4769,7 @@ static int gsp_phys_preinit_rpcs(void __iomem *bar0, struct pci_dev *pdev) info, sizeof(*info)); kfree(info); if (ret) { - pr_err("gsp-phys-boot: pre-boot GSP_SET_SYSTEM_INFO (fn%u) submit failed: %d\n", + pr_err("vgsp-boot: pre-boot GSP_SET_SYSTEM_INFO (fn%u) submit failed: %d\n", GSP_PHYS_RPC_FUNC_GSP_SET_SYSTEM_INFO, ret); return ret; } @@ -4655,22 +4784,36 @@ static int gsp_phys_preinit_rpcs(void __iomem *bar0, struct pci_dev *pdev) * the record is 8-byte aligned (1392) and the TX producer zero-pads * any tail and folds the checksum over the padded length, matching the * reference checksum. + * + * With gsp_phys_srv_ctxbuf=1 the variant table is sent instead: + * RMSetClientRMAllocatedCtxBuffer=0, which makes the GSP-RM manage the + * GR context buffers on the server (the physical-RM path) instead of + * requiring a client-owned-buffer GPU_PROMOTE_CTX. The rest of the + * profile is byte-identical. */ - pr_info("gsp-phys-boot: pre-boot SET_REGISTRY (fn%u) prepared: size=%u numEntries=%u (host default profile + RMDevidCheckIgnore=1, display enabled)\n", - GSP_PHYS_RPC_FUNC_SET_REGISTRY, - (unsigned int)GSP_PHYS_REGISTRY_IMAGE_SIZE, - get_unaligned_le32(gsp_phys_registry_image + 4)); + if (gsp_phys_srv_ctxbuf_value()) { + reg_img = gsp_phys_registry_image_srvctx; + reg_len = GSP_PHYS_REGISTRY_IMAGE_SRVCTX_SIZE; + } else { + reg_img = gsp_phys_registry_image; + reg_len = GSP_PHYS_REGISTRY_IMAGE_SIZE; + } + pr_info("vgsp-boot: pre-boot SET_REGISTRY (fn%u) prepared: size=%u numEntries=%u (%s + RMDevidCheckIgnore=1, display enabled)\n", + GSP_PHYS_RPC_FUNC_SET_REGISTRY, (unsigned int)reg_len, + get_unaligned_le32(reg_img + 4), + gsp_phys_srv_ctxbuf_value() ? + "server-managed ctx buffers (RMSetClientRMAllocatedCtxBuffer=0)" : + "host default profile"); ret = gsp_phys_queue_tx_submit(bar0, GSP_PHYS_RPC_FUNC_SET_REGISTRY, - gsp_phys_registry_image, - GSP_PHYS_REGISTRY_IMAGE_SIZE); + reg_img, reg_len); if (ret) { - pr_err("gsp-phys-boot: pre-boot SET_REGISTRY (fn%u) submit failed: %d\n", + pr_err("vgsp-boot: pre-boot SET_REGISTRY (fn%u) submit failed: %d\n", GSP_PHYS_RPC_FUNC_SET_REGISTRY, ret); return ret; } - pr_info("gsp-phys-boot: pre-boot async init RPCs queued (fn%u then fn%u); GSP-RM will consume them at early init before OBJGPU creation\n", + pr_info("vgsp-boot: pre-boot async init RPCs queued (fn%u then fn%u); GSP-RM will consume them at early init before OBJGPU creation\n", GSP_PHYS_RPC_FUNC_GSP_SET_SYSTEM_INFO, GSP_PHYS_RPC_FUNC_SET_REGISTRY); return 0; @@ -4696,7 +4839,7 @@ int gsp_phys_boot_rm_unload(void __iomem *bar0) * calls this unconditionally on a healthy board. */ if (!boot_stage.primed || !boot_stage.ran) { - pr_debug("gsp-phys-boot: UNLOADING_GUEST_DRIVER skipped: stage 3d did not run (primed=%u ran=%u)\n", + pr_debug("vgsp-boot: UNLOADING_GUEST_DRIVER skipped: stage 3d did not run (primed=%u ran=%u)\n", boot_stage.primed, boot_stage.ran); ret = -EINVAL; goto out; @@ -4709,14 +4852,14 @@ int gsp_phys_boot_rm_unload(void __iomem *bar0) * falls through to quiesce + the existing fail-safe. */ if (!boot_stage.rm_init_done) { - pr_debug("gsp-phys-boot: UNLOADING_GUEST_DRIVER skipped: GSP-RM init-done (function 0x%x) was not observed (primed=%u ran=%u)\n", + pr_debug("vgsp-boot: UNLOADING_GUEST_DRIVER skipped: GSP-RM init-done (function 0x%x) was not observed (primed=%u ran=%u)\n", GSP_PHYS_MSG_FUNC_GSP_INIT_DONE, boot_stage.primed, boot_stage.ran); ret = -EINVAL; goto out; } if (boot_stage.rm_unload_submitted) { - pr_info("gsp-phys-boot: UNLOADING_GUEST_DRIVER already submitted for this boot; not sending it twice\n"); + pr_info("vgsp-boot: UNLOADING_GUEST_DRIVER already submitted for this boot; not sending it twice\n"); ret = -EALREADY; goto out; } @@ -4724,13 +4867,13 @@ int gsp_phys_boot_rm_unload(void __iomem *bar0) /* Normal unload: bInPMTransition=0, bGc6Entering=0, newLevel=0. */ memset(¶ms, 0, sizeof(params)); gsp_phys_scratch14_log(bar0, "pre-unload-rpc"); - pr_info("gsp-phys-boot: sending UNLOADING_GUEST_DRIVER (function %u): bInPMTransition=0 bGc6Entering=0 newLevel=0\n", + pr_info("vgsp-boot: sending UNLOADING_GUEST_DRIVER (function %u): bInPMTransition=0 bGc6Entering=0 newLevel=0\n", GSP_PHYS_RPC_FUNC_UNLOADING_GUEST_DRIVER); ret = gsp_phys_queue_tx_submit(bar0, GSP_PHYS_RPC_FUNC_UNLOADING_GUEST_DRIVER, ¶ms, sizeof(params)); if (ret) { - pr_err("gsp-phys-boot: UNLOADING_GUEST_DRIVER submit failed: %d; GSP-RM stays up, WPR2 teardown keeps its existing fail-safe\n", + pr_err("vgsp-boot: UNLOADING_GUEST_DRIVER submit failed: %d; GSP-RM stays up, WPR2 teardown keeps its existing fail-safe\n", ret); goto out; } @@ -4748,7 +4891,7 @@ int gsp_phys_boot_rm_unload(void __iomem *bar0) if (time_after_eq(jiffies, deadline)) { gsp_phys_scratch14_log(bar0, "unload-rpc-suspend-timeout"); - pr_err("gsp-phys-boot: GSP-RM processor suspend not observed within %u ms (GSP MAILBOX0=0x%08x, want 0x%08x); the unload RPC may have been dropped (checksum/seqNum/link) or GSP-RM is stuck\n", + pr_err("vgsp-boot: GSP-RM processor suspend not observed within %u ms (GSP MAILBOX0=0x%08x, want 0x%08x); the unload RPC may have been dropped (checksum/seqNum/link) or GSP-RM is stuck\n", GSP_PHYS_RM_UNLOAD_TIMEOUT_MS, mailbox, GSP_PHYS_LIBOS_PROCESSOR_SUSPENDED); ret = -ETIMEDOUT; @@ -4763,10 +4906,10 @@ int gsp_phys_boot_rm_unload(void __iomem *bar0) all_done = s14.booter_load && s14.ahesasc_booter_reload && s14.booter_reload_acr_unload && s14.acr_unload_booter_unload; gsp_phys_scratch14_log(bar0, "post-unload-rpc"); - pr_info("gsp-phys-boot: UNLOADING_GUEST_DRIVER done: GSP-RM processor suspended (GSP MAILBOX0=0x%08x) after %u ms; scratch14 handoffs 24|25|26|27 all DONE=%u\n", + pr_info("vgsp-boot: UNLOADING_GUEST_DRIVER done: GSP-RM processor suspended (GSP MAILBOX0=0x%08x) after %u ms; scratch14 handoffs 24|25|26|27 all DONE=%u\n", mailbox, jiffies_to_msecs(jiffies - start), all_done); if (!all_done) { - pr_err("gsp-phys-boot: GSP-RM suspended but scratch14 handoff bits are not all DONE; the booter-unload gate will refuse (WPR2 stays up, fail-safe keeps the hand-back)\n"); + pr_err("vgsp-boot: GSP-RM suspended but scratch14 handoff bits are not all DONE; the booter-unload gate will refuse (WPR2 stays up, fail-safe keeps the hand-back)\n"); ret = -EIO; goto out; } @@ -4844,18 +4987,18 @@ static void gsp_phys_sci_decode(const u8 *p, u32 len) gsp_phys_sci_string(short_name, sizeof(short_name), p, len, GSP_PHYS_SCI_GPU_SHORT_NAME_OFF); - pr_info("gsp-phys-boot: rm-probe: static-info raw payload=%u bytes (struct min %u)%s\n", + pr_info("vgsp-boot: rm-probe: static-info raw payload=%u bytes (struct min %u)%s\n", len, GSP_PHYS_SCI_MIN_SIZE, len < GSP_PHYS_SCI_MIN_SIZE ? " SHORT: only present fields are decoded" : ""); - pr_info("gsp-phys-boot: rm-probe: static-info internal: hClient=0x%08x hDevice=0x%08x hSubdevice=0x%08x bSplitVasBetweenServerClientRm=%u bSelfHostedMode=%u bAtsSupported=%u\n", + pr_info("vgsp-boot: rm-probe: static-info internal: hClient=0x%08x hDevice=0x%08x hSubdevice=0x%08x bSplitVasBetweenServerClientRm=%u bSelfHostedMode=%u bAtsSupported=%u\n", gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_H_INTERNAL_CLIENT_OFF), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_H_INTERNAL_DEVICE_OFF), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_H_INTERNAL_SUBDEVICE_OFF), gsp_phys_sci_u8(p, len, GSP_PHYS_SCI_SPLIT_VAS_OFF), gsp_phys_sci_u8(p, len, GSP_PHYS_SCI_SELF_HOSTED_OFF), gsp_phys_sci_u8(p, len, GSP_PHYS_SCI_ATS_SUPPORTED_OFF)); - pr_info("gsp-phys-boot: rm-probe: static-info fb: bar1PdeBase=0x%016llx bar2PdeBase=0x%016llx fb_length=0x%llx fbio_mask=0x%llx fbp_mask=0x%llx busWidth=%u ramType=%u l2CacheSize=%u\n", + pr_info("vgsp-boot: rm-probe: static-info fb: bar1PdeBase=0x%016llx bar2PdeBase=0x%016llx fb_length=0x%llx fbio_mask=0x%llx fbp_mask=0x%llx busWidth=%u ramType=%u l2CacheSize=%u\n", gsp_phys_sci_u64(p, len, GSP_PHYS_SCI_BAR1_PDE_BASE_OFF), gsp_phys_sci_u64(p, len, GSP_PHYS_SCI_BAR2_PDE_BASE_OFF), gsp_phys_sci_u64(p, len, GSP_PHYS_SCI_FB_LENGTH_OFF), @@ -4864,7 +5007,7 @@ static void gsp_phys_sci_decode(const u8 *p, u32 len) gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_FB_BUS_WIDTH_OFF), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_FB_RAM_TYPE_OFF), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_L2_CACHE_SIZE_OFF)); - pr_info("gsp-phys-boot: rm-probe: static-info gpu: name='%s' short='%s' sriovMaxGfid=%u poisonFuse=%u bPageRetirement=%u bVbiosValid=%u vbiosSubVendor=0x%04x vbiosSubDevice=0x%04x\n", + pr_info("vgsp-boot: rm-probe: static-info gpu: name='%s' short='%s' sriovMaxGfid=%u poisonFuse=%u bPageRetirement=%u bVbiosValid=%u vbiosSubVendor=0x%04x vbiosSubDevice=0x%04x\n", name, short_name, gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_SRIOV_MAX_GFID_OFF), gsp_phys_sci_u8(p, len, GSP_PHYS_SCI_POISON_FUSE_OFF), @@ -4872,7 +5015,7 @@ static void gsp_phys_sci_decode(const u8 *p, u32 len) gsp_phys_sci_u8(p, len, GSP_PHYS_SCI_VBIOS_VALID_OFF), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_VBIOS_SUB_VENDOR_OFF), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_VBIOS_SUB_DEVICE_OFF)); - pr_info("gsp-phys-boot: rm-probe: static-info engineCaps=[0x%08x,0x%08x,0x%08x] rtd3BoardPower=%u rtd3PerstDelay=%u fwWpr{nonWpr=0x%llx frts=0x%llx} bIsGpuUefi=%u bIsEfiInit=%u bClRootportNeedsNosnoopWAR=%u\n", + pr_info("vgsp-boot: rm-probe: static-info engineCaps=[0x%08x,0x%08x,0x%08x] rtd3BoardPower=%u rtd3PerstDelay=%u fwWpr{nonWpr=0x%llx frts=0x%llx} bIsGpuUefi=%u bIsEfiInit=%u bClRootportNeedsNosnoopWAR=%u\n", gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_ENGINE_CAPS_OFF), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_ENGINE_CAPS_OFF + 4), gsp_phys_sci_u32(p, len, GSP_PHYS_SCI_ENGINE_CAPS_OFF + 8), @@ -4979,7 +5122,7 @@ static void gsp_phys_sci_decode(const u8 *p, u32 len) gsp_phys_sci_u8(p, len, GSP_PHYS_SCI_EFI_INIT_OFF); gsp_phys_backend_static.valid = boot_stage.rm_probe_internal_valid; - pr_info("gsp-phys-boot: rm-probe: static snapshot cached: generation=%u fw_crc32=0x%08x payload=%u name='%s' handles=0x%08x/0x%08x/0x%08x valid=%u\n", + pr_info("vgsp-boot: rm-probe: static snapshot cached: generation=%u fw_crc32=0x%08x payload=%u name='%s' handles=0x%08x/0x%08x/0x%08x valid=%u\n", gsp_phys_backend_static.generation, gsp_phys_backend_static.fw_crc32, gsp_phys_backend_static.payload_len, @@ -5027,11 +5170,11 @@ static int gsp_phys_rm_probe_fn65(void __iomem *bar0, bool after_fn1) req, GSP_PHYS_SCI_MIN_SIZE); kvfree(req); if (ret) { - pr_err("gsp-phys-boot: rm-probe: GET_GSP_STATIC_INFO (65) submit failed: %d\n", + pr_err("vgsp-boot: rm-probe: GET_GSP_STATIC_INFO (65) submit failed: %d\n", ret); return ret; } - pr_info("gsp-phys-boot: rm-probe: GET_GSP_STATIC_INFO (65) request submitted (payload %u B, rpc.sequence=0, txSeqNum=%u%s); waiting up to %u ms for the reply\n", + pr_info("vgsp-boot: rm-probe: GET_GSP_STATIC_INFO (65) request submitted (payload %u B, rpc.sequence=0, txSeqNum=%u%s); waiting up to %u ms for the reply\n", GSP_PHYS_SCI_MIN_SIZE, tx_seq, after_fn1 ? ", after SET_GUEST_SYSTEM_INFO" : "", GSP_PHYS_RM_PROBE_TIMEOUT_MS); @@ -5042,12 +5185,12 @@ static int gsp_phys_rm_probe_fn65(void __iomem *bar0, bool after_fn1) false, 0, GSP_PHYS_RM_PROBE_TIMEOUT_MS, &rec); if (ret) { - pr_err("gsp-phys-boot: rm-probe: GET_GSP_STATIC_INFO (65) no reply within %u ms (%d)\n", + pr_err("vgsp-boot: rm-probe: GET_GSP_STATIC_INFO (65) no reply within %u ms (%d)\n", GSP_PHYS_RM_PROBE_TIMEOUT_MS, ret); return ret; } - pr_info("gsp-phys-boot: rm-probe: GET_GSP_STATIC_INFO (65) reply: rpc.length=%u payload=%u B elemCount=%u seqNum=%u rpc.seq=%u rpc_result=%u rpc_result_private=0x%x checksum=0x%08x%s\n", + pr_info("vgsp-boot: rm-probe: GET_GSP_STATIC_INFO (65) reply: rpc.length=%u payload=%u B elemCount=%u seqNum=%u rpc.seq=%u rpc_result=%u rpc_result_private=0x%x checksum=0x%08x%s\n", rec.rpc_length, rec.payload_len, rec.elem_count, rec.seq_num, rec.rpc_sequence, rec.rpc_result, rec.rpc_result_private, rec.checksum, @@ -5057,7 +5200,7 @@ static int gsp_phys_rm_probe_fn65(void __iomem *bar0, bool after_fn1) boot_stage.rm_probe_last_payload_len = rec.payload_len; if (rec.rpc_result != 0) { - pr_err("gsp-phys-boot: rm-probe: GET_GSP_STATIC_INFO (65) server rpc_result=0x%x (not success); no decode\n", + pr_err("vgsp-boot: rm-probe: GET_GSP_STATIC_INFO (65) server rpc_result=0x%x (not success); no decode\n", rec.rpc_result); gsp_phys_rm_probe_internal_clear(); gsp_phys_rx_record_free(&rec); @@ -5105,11 +5248,11 @@ static int gsp_phys_rm_probe_fn1(void __iomem *bar0) req, sizeof(*req)); kvfree(req); if (ret) { - pr_err("gsp-phys-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) submit failed: %d\n", + pr_err("vgsp-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) submit failed: %d\n", ret); return ret; } - pr_info("gsp-phys-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) request submitted (payload %zu B: vgx 41.12, cl %u); waiting up to %u ms for the reply\n", + pr_info("vgsp-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) request submitted (payload %zu B: vgx 41.12, cl %u); waiting up to %u ms for the reply\n", sizeof(*req), 35817632, GSP_PHYS_RM_PROBE_FN1_TIMEOUT_MS); gsp_phys_status_queue_init(&sq); @@ -5118,11 +5261,11 @@ static int gsp_phys_rm_probe_fn1(void __iomem *bar0) false, 0, GSP_PHYS_RM_PROBE_FN1_TIMEOUT_MS, &rec); if (ret) { - pr_err("gsp-phys-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) no reply within %u ms (%d)\n", + pr_err("vgsp-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) no reply within %u ms (%d)\n", GSP_PHYS_RM_PROBE_FN1_TIMEOUT_MS, ret); return ret; } - pr_info("gsp-phys-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) reply: rpc.length=%u payload=%u B elemCount=%u seqNum=%u rpc.seq=%u rpc_result=%u rpc_result_private=0x%x checksum=0x%08x\n", + pr_info("vgsp-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) reply: rpc.length=%u payload=%u B elemCount=%u seqNum=%u rpc.seq=%u rpc_result=%u rpc_result_private=0x%x checksum=0x%08x\n", rec.rpc_length, rec.payload_len, rec.elem_count, rec.seq_num, rec.rpc_sequence, rec.rpc_result, rec.rpc_result_private, rec.checksum); @@ -5157,7 +5300,7 @@ static int gsp_phys_rm_probe_cycle(void __iomem *bar0) * init-done, so sending here could be dropped. */ if (!boot_stage.rm_init_done) { - pr_info("gsp-phys-boot: rm-probe: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed\n", + pr_info("vgsp-boot: rm-probe: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed\n", GSP_PHYS_MSG_FUNC_GSP_INIT_DONE); return -EINVAL; } @@ -5170,7 +5313,7 @@ static int gsp_phys_rm_probe_cycle(void __iomem *bar0) boot_stage.rm_probe_attempts++; fn1_ret = gsp_phys_rm_probe_fn1(bar0); if (fn1_ret) - pr_err("gsp-phys-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) attempt returned %d; issuing GET_GSP_STATIC_INFO (65) anyway\n", + pr_err("vgsp-boot: rm-probe: SET_GUEST_SYSTEM_INFO (1) attempt returned %d; issuing GET_GSP_STATIC_INFO (65) anyway\n", fn1_ret); ret = gsp_phys_rm_probe_fn65(bar0, true); boot_stage.rm_probe_done = true; @@ -5217,7 +5360,7 @@ int gsp_phys_backend_rpc(u32 function, const void *req, u32 req_len, if (gsp_phys_backend_state() != GSP_PHYS_BACKEND_READY || !gsp_phys_gpu_claimed() || !boot_stage.rm_init_done || boot_stage.rm_unload_submitted) { - pr_info("gsp-phys-boot: backend rpc fn%u refused: not ready (state=%d claimed=%u rm_init_done=%u unload_submitted=%u)\n", + pr_info("vgsp-boot: backend rpc fn%u refused: not ready (state=%d claimed=%u rm_init_done=%u unload_submitted=%u)\n", function, gsp_phys_backend_state(), gsp_phys_gpu_claimed(), boot_stage.rm_init_done, boot_stage.rm_unload_submitted); @@ -5227,7 +5370,7 @@ int gsp_phys_backend_rpc(u32 function, const void *req, u32 req_len, generation = gsp_phys_backend_generation(); bar0 = gsp_phys_gpu_bar0(); if (!bar0) { - pr_info("gsp-phys-boot: backend rpc fn%u refused: no BAR0\n", + pr_info("vgsp-boot: backend rpc fn%u refused: no BAR0\n", function); return -ENODEV; } @@ -5239,7 +5382,7 @@ int gsp_phys_backend_rpc(u32 function, const void *req, u32 req_len, u32 gen_now = gsp_phys_backend_generation(); mutex_unlock(&gsp_phys_rm_lock); - pr_info("gsp-phys-boot: backend rpc fn%u refused: session changed while waiting for the GSP lock (generation %u -> %u)\n", + pr_info("vgsp-boot: backend rpc fn%u refused: session changed while waiting for the GSP lock (generation %u -> %u)\n", function, generation, gen_now); return -EAGAIN; } @@ -5247,7 +5390,7 @@ int gsp_phys_backend_rpc(u32 function, const void *req, u32 req_len, ret = gsp_phys_queue_tx_submit(bar0, function, req, req_len); if (ret) { mutex_unlock(&gsp_phys_rm_lock); - pr_err("gsp-phys-boot: backend rpc fn%u submit refused: %d\n", + pr_err("vgsp-boot: backend rpc fn%u submit refused: %d\n", function, ret); return ret; } @@ -5257,17 +5400,17 @@ int gsp_phys_backend_rpc(u32 function, const void *req, u32 req_len, ret = gsp_phys_status_wait(&sq, function, false, 0, timeout_ms, &rec); if (ret) { mutex_unlock(&gsp_phys_rm_lock); - pr_err("gsp-phys-boot: backend rpc fn%u no reply within %u ms (%d)\n", + pr_err("vgsp-boot: backend rpc fn%u no reply within %u ms (%d)\n", function, timeout_ms, ret); return ret; } - pr_info("gsp-phys-boot: backend rpc fn%u reply: payload=%u B seqNum=%u rpc.seq=%u rpc_result=0x%x private=0x%x checksum=0x%08x\n", + pr_info("vgsp-boot: backend rpc fn%u reply: payload=%u B seqNum=%u rpc.seq=%u rpc_result=0x%x private=0x%x checksum=0x%08x\n", function, rec.payload_len, rec.seq_num, rec.rpc_sequence, rec.rpc_result, rec.rpc_result_private, rec.checksum); if (rec.rpc_result != 0) { - pr_err("gsp-phys-boot: backend rpc fn%u server rpc_result=0x%x (not success)\n", + pr_err("vgsp-boot: backend rpc fn%u server rpc_result=0x%x (not success)\n", function, rec.rpc_result); ret = -EIO; goto out; @@ -5382,7 +5525,7 @@ int gsp_phys_backend_static_get(struct gsp_phys_backend_static_config *out) if (!gsp_phys_backend_static.valid || gsp_phys_backend_static.generation != generation) { mutex_unlock(&gsp_phys_rm_lock); - pr_debug("gsp-phys-boot: backend static snapshot: no valid cache for generation %u\n", + pr_debug("vgsp-boot: backend static snapshot: no valid cache for generation %u\n", generation); return -ENODATA; } @@ -5663,6 +5806,41 @@ struct gsp_phys_rmcall_promote_params { struct gsp_phys_rmcall_promote_entry entry[16]; }; +/* + * NV2080_CTRL_GPU_INITIALIZE_CTX_PARAMS (56 bytes, ctrl2080gpu.h:1051-1063): + * engineType/hClient/ChID/hChanClient/hObject/hVirtMemory, physAddress, + * physAttr, hDmaHandle, index, size. Mode 10 sends it before the promote to + * install the physical context memdesc on the GraphicsContext. + */ +struct gsp_phys_rmcall_init_ctx_params { + __le32 engine_type; + __le32 h_client; + __le32 ch_id; + __le32 h_chan_client; + __le32 h_object; + __le32 h_virt_memory; + __le64 phys_address; + __le32 phys_attr; + __le32 h_dma_handle; + __le32 index; + __le32 pad; + __le64 size; +}; + +/* + * NV_MEMORY_VIRTUAL_ALLOCATION_PARAMS (cl0070.h:66-70), 24 bytes: a VA-range + * reservation object (class NV01_MEMORY_VIRTUAL 0x70). mode 6 allocates one + * on the ladder VAS at the context window and passes its handle as + * PROMOTE_CTX hVirtMemory, so the server creates the memdesc/vaList entry for + * the range itself (the documented no-entry branch; ctrl2080gpu.h:934-947). + */ +struct gsp_phys_rmcall_mem_virtual_params { + __le64 offset; + __le64 limit; + __le32 h_va_space; + __le32 pad; +}; + /* NV2080_CTRL_GR_CTX_BUFFER_INFO (88 bytes), * ctrl/ctrl2080/ctrl2080gr.h:1066-1081. */ struct gsp_phys_rmcall_ctx_buffer_info { @@ -5734,7 +5912,7 @@ static void gsp_phys_rmcall_dump_reply(const struct gsp_phys_rx_record *rec) if (!rec->buf || !rec->payload_len) return; n = min_t(u32, 48u, rec->payload_len); - print_hex_dump_debug("gsp-phys-boot: rm-call: reply: ", + print_hex_dump_debug("vgsp-boot: rm-call: reply: ", DUMP_PREFIX_OFFSET, 16, 4, rec->buf + GSP_PHYS_MSG_ELEMENT_PAYLOAD_OFF, n, false); @@ -5766,12 +5944,12 @@ gsp_phys_rmcall_dump_failed_reply(const struct gsp_phys_rx_record *rec) words = shown / 4; if (rec->function == GSP_PHYS_RMCALL_FUNC_GSP_RM_ALLOC) - pr_info("gsp-phys-boot: rm-call: failed reply (fn103) payload=%u: [0](request hClient)=0x%08x [16](status)=0x%08x [32](params[0])=0x%08x%s\n", + pr_info("vgsp-boot: rm-call: failed reply (fn103) payload=%u: [0](request hClient)=0x%08x [16](status)=0x%08x [32](params[0])=0x%08x%s\n", rec->payload_len, gsp_phys_rmcall_reply_u32(rec, 0), gsp_phys_rmcall_reply_u32(rec, 16), gsp_phys_rmcall_reply_u32(rec, 32), tail); else - pr_info("gsp-phys-boot: rm-call: failed reply (fn%u) payload=%u: raw words [0]=0x%08x [16]=0x%08x [32]=0x%08x%s\n", + pr_info("vgsp-boot: rm-call: failed reply (fn%u) payload=%u: raw words [0]=0x%08x [16]=0x%08x [32]=0x%08x%s\n", rec->function, rec->payload_len, gsp_phys_rmcall_reply_u32(rec, 0), gsp_phys_rmcall_reply_u32(rec, 16), @@ -5782,7 +5960,7 @@ gsp_phys_rmcall_dump_failed_reply(const struct gsp_phys_rx_record *rec) pos += scnprintf(hex + pos, sizeof(hex) - pos, "%08x", gsp_phys_rmcall_reply_u32(rec, i * 4)); if (pos) - pr_info("gsp-phys-boot: rm-call: hex=%s\n", hex); + pr_info("vgsp-boot: rm-call: hex=%s\n", hex); } /* @@ -5805,7 +5983,7 @@ static int gsp_phys_rmcall_rpc(void __iomem *bar0, u32 function, memset(rec, 0, sizeof(*rec)); ret = gsp_phys_queue_tx_submit(bar0, function, req, req_len); if (ret) { - pr_err("gsp-phys-boot: rm-call: fn%u submit refused: %d\n", + pr_err("vgsp-boot: rm-call: fn%u submit refused: %d\n", function, ret); return ret; } @@ -5815,12 +5993,12 @@ static int gsp_phys_rmcall_rpc(void __iomem *bar0, u32 function, ret = gsp_phys_status_wait(&sq, function, false, 0, GSP_PHYS_RMCALL_TIMEOUT_MS, rec); if (ret) { - pr_err("gsp-phys-boot: rm-call: fn%u no reply within %u ms (%d)\n", + pr_err("vgsp-boot: rm-call: fn%u no reply within %u ms (%d)\n", function, GSP_PHYS_RMCALL_TIMEOUT_MS, ret); return ret; } - pr_info("gsp-phys-boot: rm-call: fn%u (txSeqNum=%u) reply: rpc.length=%u payload=%u seqNum=%u rpc.seq=%u rpc_result=0x%x private=0x%x checksum=0x%08x\n", + pr_info("vgsp-boot: rm-call: fn%u (txSeqNum=%u) reply: rpc.length=%u payload=%u seqNum=%u rpc.seq=%u rpc_result=0x%x private=0x%x checksum=0x%08x\n", function, tx_seq, rec->rpc_length, rec->payload_len, rec->seq_num, rec->rpc_sequence, rec->rpc_result, rec->rpc_result_private, rec->checksum); @@ -5829,7 +6007,7 @@ static int gsp_phys_rmcall_rpc(void __iomem *bar0, u32 function, gsp_phys_rmcall_dump_reply(rec); if (rec->rpc_result != 0) { - pr_err("gsp-phys-boot: rm-call: fn%u server rpc_result=0x%x (%s, not success)\n", + pr_err("vgsp-boot: rm-call: fn%u server rpc_result=0x%x (%s, not success)\n", function, rec->rpc_result, gsp_phys_rmcall_status_str(rec->rpc_result)); if (dump_on_fail) @@ -5837,7 +6015,7 @@ static int gsp_phys_rmcall_rpc(void __iomem *bar0, u32 function, return -EIO; } if (rec->payload_len < reply_min) { - pr_err("gsp-phys-boot: rm-call: fn%u reply payload %u B shorter than the %u B this step needs\n", + pr_err("vgsp-boot: rm-call: fn%u reply payload %u B shorter than the %u B this step needs\n", function, rec->payload_len, reply_min); return -EIO; } @@ -5879,7 +6057,7 @@ static int gsp_phys_rmcall_alloc(void __iomem *bar0, u32 h_client, out_rpc_result); kvfree(req); if (ret) { - pr_err("gsp-phys-boot: rm-call: %s (hClass=0x%x) RPC failed: %d\n", + pr_err("vgsp-boot: rm-call: %s (hClass=0x%x) RPC failed: %d\n", what, h_class, ret); gsp_phys_rx_record_free(&rec); return ret; @@ -5891,7 +6069,7 @@ static int gsp_phys_rmcall_alloc(void __iomem *bar0, u32 h_client, * read; the rpc helper already guaranteed >= 20 B for status. */ if (object_is_out && rec.payload_len < 36) { - pr_err("gsp-phys-boot: rm-call: %s reply payload %u B does not carry the chosen handle\n", + pr_err("vgsp-boot: rm-call: %s reply payload %u B does not carry the chosen handle\n", what, rec.payload_len); gsp_phys_rx_record_free(&rec); return -EIO; @@ -5901,16 +6079,16 @@ static int gsp_phys_rmcall_alloc(void __iomem *bar0, u32 h_client, *out_status = status; if (object_is_out) { *out_object = gsp_phys_rmcall_reply_u32(&rec, 32); - pr_info("gsp-phys-boot: rm-call: %s alloc: hClass=0x%x status=0x%x -> hObject=0x%x\n", + pr_info("vgsp-boot: rm-call: %s alloc: hClass=0x%x status=0x%x -> hObject=0x%x\n", what, h_class, status, *out_object); } else { - pr_info("gsp-phys-boot: rm-call: %s alloc: hParent=0x%x hObject=0x%x hClass=0x%x status=0x%x\n", + pr_info("vgsp-boot: rm-call: %s alloc: hParent=0x%x hObject=0x%x hClass=0x%x status=0x%x\n", what, h_parent, h_object, h_class, status); } gsp_phys_rx_record_free(&rec); if (status != 0) { - pr_err("gsp-phys-boot: rm-call: %s alloc server status=0x%x (%s)\n", + pr_err("vgsp-boot: rm-call: %s alloc server status=0x%x (%s)\n", what, status, gsp_phys_rmcall_status_str(status)); return -EIO; } @@ -5952,7 +6130,7 @@ static int gsp_phys_rmcall_register_mem(void __iomem *bar0, u32 index) req, (u32)req_len, 0, &rec, true, NULL); kvfree(req); if (ret) { - pr_err("gsp-phys-boot: rm-call: ALLOC_MEMORY buffer %u (hMemory=0x%x %u page(s) dma=0x%llx) failed: %d\n", + pr_err("vgsp-boot: rm-call: ALLOC_MEMORY buffer %u (hMemory=0x%x %u page(s) dma=0x%llx) failed: %d\n", index, handle, pages, (u64)gsp_phys_chunk_page_dma(c, 0), ret); gsp_phys_rx_record_free(&rec); @@ -5962,7 +6140,7 @@ static int gsp_phys_rmcall_register_mem(void __iomem *bar0, u32 index) boot_stage.rmcall_mem_handles[index] = handle; boot_stage.rmcall_mem_registered[index] = true; - pr_info("gsp-phys-boot: rm-call: ALLOC_MEMORY buffer %u registered: hMemory=0x%x class=0x%x %u page(s) dma=0x%llx%s\n", + pr_info("vgsp-boot: rm-call: ALLOC_MEMORY buffer %u registered: hMemory=0x%x class=0x%x %u page(s) dma=0x%llx%s\n", index, handle, GSP_PHYS_RMCALL_CLASS_MEMLIST_SYSTEM, pages, (u64)gsp_phys_chunk_page_dma(c, 0), c->page_dma ? " (per-page PTEs, noncontiguous flag)" : @@ -6028,7 +6206,7 @@ static int gsp_phys_rmcall_alloc_notifier_mem(void __iomem *bar0) req, req_len, 20, &rec, true, NULL); kvfree(req); if (ret) { - pr_err("gsp-phys-boot: rm-call: FBMEM error-notifier alloc (hMemory=0x%x class=0x40 size=0x%x) RPC failed: %d\n", + pr_err("vgsp-boot: rm-call: FBMEM error-notifier alloc (hMemory=0x%x class=0x40 size=0x%x) RPC failed: %d\n", GSP_PHYS_RMCALL_HANDLE_NOTIFIER_MEM, GSP_PHYS_RMCALL_NOTIFIER_SIZE, ret); gsp_phys_rx_record_free(&rec); @@ -6039,7 +6217,7 @@ static int gsp_phys_rmcall_alloc_notifier_mem(void __iomem *bar0) if (status != 0 || rec.payload_len < 32 + offsetof(struct gsp_phys_rmcall_memory_alloc_params, offset) + 8) { - pr_err("gsp-phys-boot: rm-call: FBMEM error-notifier alloc rejected: status=0x%x payload=%u B (need the echoed params through offset at +%zu)\n", + pr_err("vgsp-boot: rm-call: FBMEM error-notifier alloc rejected: status=0x%x payload=%u B (need the echoed params through offset at +%zu)\n", status, rec.payload_len, offsetof(struct gsp_phys_rmcall_memory_alloc_params, offset) + 8); @@ -6054,13 +6232,82 @@ static int gsp_phys_rmcall_alloc_notifier_mem(void __iomem *bar0) boot_stage.rmcall_notifier_mem = GSP_PHYS_RMCALL_HANDLE_NOTIFIER_MEM; boot_stage.rmcall_notifier_base = base; boot_stage.rmcall_notifier_valid = true; - pr_info("gsp-phys-boot: rm-call: FBMEM error-notifier allocated: hMemory=0x%x class=0x40 size=0x%x FB base=0x%llx (notifyIndex=%u)\n", + pr_info("vgsp-boot: rm-call: FBMEM error-notifier allocated: hMemory=0x%x class=0x40 size=0x%x FB base=0x%llx (notifyIndex=%u)\n", boot_stage.rmcall_notifier_mem, GSP_PHYS_RMCALL_NOTIFIER_SIZE, boot_stage.rmcall_notifier_base, GSP_PHYS_RMCALL_NOTIF_INDEX); return 0; } /* + * Allocate a server-owned FBMEM buffer through GSP_RM_ALLOC class + * NV01_MEMORY_LOCAL_USER (0x40), same shape as the error-notifier + * allocation. Mode 11 uses it for the GR context buffer so the KMD promote + * path sees a VIDMEM context memdesc; returns the frame-buffer base offset + * the server echoed in NV_MEMORY_ALLOCATION_PARAMS.offset. + */ +static int gsp_phys_rmcall_alloc_fb_mem(void __iomem *bar0, u32 handle, + u32 size, u64 *out_base, + const char *what) +{ + struct gsp_phys_rmcall_memory_alloc_params mem; + struct gsp_phys_rmcall_rm_alloc_req *req; + struct gsp_phys_rx_record rec; + u32 req_len = sizeof(*req) + sizeof(mem); + u32 status; + u64 base; + int ret; + + memset(&mem, 0, sizeof(mem)); + mem.owner = cpu_to_le32(GSP_PHYS_RMCALL_HEAP_OWNER_RM_CLIENT_GENERIC); + mem.type = cpu_to_le32(GSP_PHYS_RMCALL_OS32_TYPE_IMAGE); + mem.size = cpu_to_le64(size); + mem.attr = cpu_to_le32(GSP_PHYS_RMCALL_OS32_ATTR_VIDMEM_UNCACHED); + mem.internalflags = + cpu_to_le32(GSP_PHYS_RMCALL_OS32_INTERNAL_FLAG_SKIP_SCRUB); + + req = kvzalloc(req_len, GFP_KERNEL); + if (!req) + return -ENOMEM; + req->h_client = cpu_to_le32(boot_stage.rmcall_client); + req->h_parent = cpu_to_le32(boot_stage.rmcall_device); + req->h_object = cpu_to_le32(handle); + req->h_class = cpu_to_le32(GSP_PHYS_RMCALL_CLASS_MEMORY_LOCAL_USER); + req->params_size = cpu_to_le32(sizeof(mem)); + memcpy(req->params, &mem, sizeof(mem)); + + ret = gsp_phys_rmcall_rpc(bar0, GSP_PHYS_RMCALL_FUNC_GSP_RM_ALLOC, + req, req_len, 20, &rec, true, NULL); + kvfree(req); + if (ret) { + pr_err("vgsp-boot: rm-call: %s FBMEM alloc (hObject=0x%x class=0x40 size=0x%x) RPC failed: %d\n", + what, handle, size, ret); + gsp_phys_rx_record_free(&rec); + return ret; + } + + status = gsp_phys_rmcall_reply_u32(&rec, 16); + if (status != 0 || + rec.payload_len < 32 + offsetof(struct gsp_phys_rmcall_memory_alloc_params, + offset) + 8) { + pr_err("vgsp-boot: rm-call: %s FBMEM alloc rejected: status=0x%x payload=%u B (need the echoed params through offset at +%zu)\n", + what, status, rec.payload_len, + offsetof(struct gsp_phys_rmcall_memory_alloc_params, + offset) + 8); + gsp_phys_rx_record_free(&rec); + return -EIO; + } + base = get_unaligned_le64(rec.buf + GSP_PHYS_MSG_ELEMENT_PAYLOAD_OFF + 32 + + offsetof(struct gsp_phys_rmcall_memory_alloc_params, + offset)); + gsp_phys_rx_record_free(&rec); + + *out_base = base; + pr_info("vgsp-boot: rm-call: %s FBMEM allocated: hObject=0x%x class=0x40 size=0x%x FB base=0x%llx\n", + what, handle, size, base); + return 0; +} + +/* * One GSP_RM_CONTROL (76). Reply status at payload+12, echoed params at * payload+24 (rpcRmApiControl_GSP, rpc.c:9797-10031). out_status (optional) * receives the server control status even when it is nonzero; the echoed @@ -6098,7 +6345,7 @@ static int gsp_phys_rmcall_control(void __iomem *bar0, u32 h_object, u32 cmd, out_rpc_result); kvfree(req); if (ret) { - pr_err("gsp-phys-boot: rm-call: %s ctrl 0x%x (hObject=0x%x) RPC failed: %d\n", + pr_err("vgsp-boot: rm-call: %s ctrl 0x%x (hObject=0x%x) RPC failed: %d\n", what, cmd, h_object, ret); gsp_phys_rx_record_free(&rec); return ret; @@ -6106,7 +6353,7 @@ static int gsp_phys_rmcall_control(void __iomem *bar0, u32 h_object, u32 cmd, /* Bound the status read by the received payload (reply_min >= 16). */ if (rec.payload_len < 16) { - pr_err("gsp-phys-boot: rm-call: %s ctrl 0x%x reply payload %u B carries no status word\n", + pr_err("vgsp-boot: rm-call: %s ctrl 0x%x reply payload %u B carries no status word\n", what, cmd, rec.payload_len); gsp_phys_rx_record_free(&rec); return -EIO; @@ -6121,10 +6368,10 @@ static int gsp_phys_rmcall_control(void __iomem *bar0, u32 h_object, u32 cmd, } gsp_phys_rx_record_free(&rec); - pr_info("gsp-phys-boot: rm-call: %s ctrl 0x%x (hObject=0x%x, params %u B) status=0x%x\n", + pr_info("vgsp-boot: rm-call: %s ctrl 0x%x (hObject=0x%x, params %u B) status=0x%x\n", what, cmd, h_object, params_len, status); if (status != 0) { - pr_err("gsp-phys-boot: rm-call: %s server status=0x%x (%s)\n", + pr_err("vgsp-boot: rm-call: %s server status=0x%x (%s)\n", what, status, gsp_phys_rmcall_status_str(status)); return -EIO; } @@ -6178,7 +6425,7 @@ static int gsp_phys_rmcall_stage1(void __iomem *bar0) return ret; boot_stage.rmcall_subdevice = GSP_PHYS_RMCALL_HANDLE_SUBDEVICE; - pr_info("gsp-phys-boot: rm-call: stage 1 complete: hClient=0x%x hDevice=0x%x hSubdevice=0x%x\n", + pr_info("vgsp-boot: rm-call: stage 1 complete: hClient=0x%x hDevice=0x%x hSubdevice=0x%x\n", boot_stage.rmcall_client, boot_stage.rmcall_device, boot_stage.rmcall_subdevice); return 0; @@ -6200,12 +6447,12 @@ static int gsp_phys_rmcall_alloc_chunks(void) if (c->pages) continue; if (!boot_stage.pdev) { - pr_err("gsp-phys-boot: rm-call: no claimed pci_dev for chunk %u\n", + pr_err("vgsp-boot: rm-call: no claimed pci_dev for chunk %u\n", i); return -EINVAL; } if (gsp_phys_chunk_alloc(boot_stage.pdev, c, 1u)) { - pr_err("gsp-phys-boot: rm-call: buffer %u allocation failed\n", + pr_err("vgsp-boot: rm-call: buffer %u allocation failed\n", i); return -ENOMEM; } @@ -6239,13 +6486,13 @@ static int gsp_phys_rmcall_stage2(void __iomem *bar0) continue; ret = gsp_phys_rmcall_register_mem(bar0, i); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 2 aborted at buffer %u\n", + pr_err("vgsp-boot: rm-call: stage 2 aborted at buffer %u\n", i); return ret; } } - pr_info("gsp-phys-boot: rm-call: stage 2 complete: %u buffers registered (src=0xa5, dst/sem/pb/gpfifo/userd/instance/ramfc/mthdbuf/vaspdb/pd2/pd1/pd0/pt/guest_pt0..15 zeroed)\n", + pr_info("vgsp-boot: rm-call: stage 2 complete: %u buffers registered (src=0xa5, dst/sem/pb/gpfifo/userd/instance/ramfc/mthdbuf/vaspdb/pd2/pd1/pd0/pt/guest_pt0..15 zeroed)\n", GSP_PHYS_RMCALL_BUF_COUNT); return 0; } @@ -6307,6 +6554,25 @@ gsp_phys_rmcall_channel_variants[] = { }; /* + * Mode-8 channel variant (GR ladder only): the V5 shape (TSG parent, + * page-directory-backed VAS, client memdescs, SKIP_SCRUBBER, privilege + * kernel) plus NVOS04_FLAGS_SKIP_CTXBUFFER_ALLOC, which marks the channel as + * a KMD-managed virtual context whose engine context buffer the client owns + * and promotes. It is kept out of the shared variant walk so the COPY0 + * ladder and promote modes 0-7 keep their exact historical variant sequence; + * only gsp_phys_rmcall_alloc_channel selects it, and only for promote mode + * 8. + */ +static const struct gsp_phys_rmcall_channel_variant +gsp_phys_rmcall_channel_variant_skipctx = { + "tsg-vas-pdb-skip-ctxbuf-alloc", 6, true, + GSP_PHYS_RMCALL_CHANNEL_FLAG_SKIP_SCRUBBER | + GSP_PHYS_RMCALL_CHANNEL_FLAG_SKIP_CTXBUFFER_ALLOC, + GSP_PHYS_RMCALL_CHANNEL_INTERNALFLAGS_PRIV_KERNEL, false, + GSP_PHYS_RMCALL_HANDLE_CHANNEL_V6, +}; + +/* * H1 engine snapshot. gsp_phys_rmcall_engine is a load-time module * parameter (0=COPY0, 1=GR0); the ladder snapshots it when stage 3 starts * and every later step uses the snapshot, so a runtime sysfs change can @@ -6325,13 +6591,13 @@ static void gsp_phys_rmcall_engine_snapshot(void) boot_stage.rmcall_engine = GSP_PHYS_RMCALL_ENGINE_GR0; } else { if (v != 0) - pr_warn("gsp-phys-boot: rm-call: gsp_phys_rmcall_engine=%d is neither 0 (COPY0) nor 1 (GR0); using COPY0\n", + pr_warn("vgsp-boot: rm-call: gsp_phys_rmcall_engine=%d is neither 0 (COPY0) nor 1 (GR0); using COPY0\n", v); boot_stage.rmcall_engine = GSP_PHYS_RMCALL_ENGINE_COPY0; } boot_stage.rmcall_engine_valid = true; if (boot_stage.rmcall_engine == GSP_PHYS_RMCALL_ENGINE_GR0) - pr_info("gsp-phys-boot: rm-call: engine snapshot: gsp_phys_rmcall_engine=1 -> GR0 (TSG/channel engineType=0x1, TURING_COMPUTE_A 0xc5c0, BIND 0x1, GR semaphore release)\n"); + pr_info("vgsp-boot: rm-call: engine snapshot: gsp_phys_rmcall_engine=1 -> GR0 (TSG/channel engineType=0x1, TURING_COMPUTE_A 0xc5c0, BIND 0x1, GR semaphore release)\n"); } static bool gsp_phys_rmcall_engine_is_gr(void) @@ -6356,7 +6622,7 @@ static void gsp_phys_rmcall_engine_check_change(void) boot_stage.rmcall_engine_change_logged) return; boot_stage.rmcall_engine_change_logged = true; - pr_warn("gsp-phys-boot: rm-call: gsp_phys_rmcall_engine changed to %d after the stage-3 snapshot; the ladder keeps engine=%s for the rest of this staging (mid-session changes are ignored)\n", + pr_warn("vgsp-boot: rm-call: gsp_phys_rmcall_engine changed to %d after the stage-3 snapshot; the ladder keeps engine=%s for the rest of this staging (mid-session changes are ignored)\n", v, gsp_phys_rmcall_engine_name()); } @@ -6369,6 +6635,34 @@ static const char *gsp_phys_rmcall_gr_promote_name(void) return "two-phase PA-only nonmapped then VA-only"; case GSP_PHYS_RMCALL_GR_PROMOTE_SINGLE_RAW: return "single-entry bInitialize=1 bNonmapped=0 size=raw"; + case GSP_PHYS_RMCALL_GR_PROMOTE_VA_ZERO: + return "two-phase PA-only nonmapped then zero-field VA-only"; + case GSP_PHYS_RMCALL_GR_PROMOTE_BATCHED: + return "batched entryCount=2 PA-only init + zero-field VA-only"; + case GSP_PHYS_RMCALL_GR_PROMOTE_HVIRT: + return "no-entry hVirtMemory (NV01_MEMORY_VIRTUAL on the VAS)"; + case GSP_PHYS_RMCALL_GR_PROMOTE_BARE_VA: + return "no-entry bare virtAddress+size"; + case GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_SINGLE: + return "KMD-managed channel (V6 SKIP_CTXBUFFER_ALLOC) + single-entry MAIN init+VA"; + case GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_VA: + return "KMD-managed channel (V6 SKIP_CTXBUFFER_ALLOC) + zero-field VA-only MAIN entry"; + case GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_VA: + return "KMD-managed channel (V6 SKIP_CTXBUFFER_ALLOC) + GPU_INITIALIZE_CTX then bare VA+size promote"; + case GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_FB: + return "as mode 10 with a server FBMEM context buffer (VIDMEM physAttr 0x4, local-aperture PTEs)"; + case GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY: + return "V5 UVM-faithful PA-only MAIN entry (bInitialize=1 bNonmapped=1), no VA, continue"; + case GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH: + return "as mode 12 plus a PATCH PA-only promote first"; + case GSP_PHYS_RMCALL_GR_PROMOTE_KMD: + return "KMD channel (V6) + PATCH PA-only then single-entry MAIN init+VA"; + case GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB: + return "as mode 14 with a server FBMEM MAIN context buffer (VIDMEM physAttr 0x4)"; + case GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM: + return "as mode 14 plus a PM ctxsw PA-only promote first"; + case GSP_PHYS_RMCALL_GR_PROMOTE_SERVER: + return "no client promote; server-managed ctx buffers (gsp_phys_srv_ctxbuf=1)"; default: return "off (PROMOTE_CTX never sent)"; } @@ -6376,7 +6670,7 @@ static const char *gsp_phys_rmcall_gr_promote_name(void) /* * H1 GR context-promote bisection snapshot. gsp_phys_rmcall_gr_promote is a - * load-time module parameter (0..3, see gsp_phys_gpu.c); stage 3 snapshots it + * load-time module parameter (0..13, see gsp_phys_gpu.c); stage 3 snapshots it * next to the engine so every later step of this staging uses one shape. The * module parameter's set callback already clamps out-of-range values with a * warning; the check here is a second line of defense against a future @@ -6391,15 +6685,15 @@ static void gsp_phys_rmcall_gr_promote_snapshot(void) return; v = gsp_phys_rmcall_gr_promote_value(); if (v < 0 || v > (int)GSP_PHYS_RMCALL_GR_PROMOTE_MAX) { - pr_warn("gsp-phys-boot: rm-call: gsp_phys_rmcall_gr_promote=%d is outside 0..3; clamping to 0 (no PROMOTE_CTX)\n", - v); + pr_warn("vgsp-boot: rm-call: gsp_phys_rmcall_gr_promote=%d is outside 0..%u; clamping to 0 (no PROMOTE_CTX)\n", + v, GSP_PHYS_RMCALL_GR_PROMOTE_MAX); v = 0; } boot_stage.rmcall_gr_promote = (u32)v; boot_stage.rmcall_gr_promote_valid = true; if (!gsp_phys_rmcall_engine_is_gr()) return; - pr_info("gsp-phys-boot: rm-call: stage-3 gr_promote_param=%d (%s); PROMOTE_CTX is opt-in, every attempt warns (a failed promote can wedge GSP-RM)\n", + pr_info("vgsp-boot: rm-call: stage-3 gr_promote_param=%d (%s); PROMOTE_CTX is opt-in, every attempt warns (a failed promote can wedge GSP-RM)\n", v, gsp_phys_rmcall_gr_promote_name()); } @@ -6414,7 +6708,7 @@ static void gsp_phys_rmcall_gr_promote_check_change(void) boot_stage.rmcall_gr_promote_change_logged) return; boot_stage.rmcall_gr_promote_change_logged = true; - pr_warn("gsp-phys-boot: rm-call: gsp_phys_rmcall_gr_promote changed to %d after the stage-3 snapshot; the ladder keeps gr_promote_param=%u for the rest of this staging (mid-session changes are ignored; reload the module for another variant)\n", + pr_warn("vgsp-boot: rm-call: gsp_phys_rmcall_gr_promote changed to %d after the stage-3 snapshot; the ladder keeps gr_promote_param=%u for the rest of this staging (mid-session changes are ignored; reload the module for another variant)\n", v, boot_stage.rmcall_gr_promote); } @@ -6430,7 +6724,7 @@ static bool gsp_phys_rmcall_gr_ce_refuse(const char *what) return false; if (!boot_stage.rmcall_gr_ce_refused_logged) { boot_stage.rmcall_gr_ce_refused_logged = true; - pr_info("gsp-phys-work: %s refused: the ladder channel is a %s engine channel (gsp_phys_rmcall_engine snapshot); CE methods are never submitted on a GR channel (logged once per staging)\n", + pr_info("vgsp-work: %s refused: the ladder channel is a %s engine channel (gsp_phys_rmcall_engine snapshot); CE methods are never submitted on a GR channel (logged once per staging)\n", what, gsp_phys_rmcall_engine_name()); } return true; @@ -6502,6 +6796,8 @@ gsp_phys_rmcall_channel_params_init(struct gsp_phys_rmcall_channel_params *ch, static int gsp_phys_rmcall_alloc_channel(void __iomem *bar0) { struct gsp_phys_rmcall_channel_params ch; + const struct gsp_phys_rmcall_channel_variant *vars = + gsp_phys_rmcall_channel_variants; u32 v_rpc[ARRAY_SIZE(gsp_phys_rmcall_channel_variants)]; u32 v_status[ARRAY_SIZE(gsp_phys_rmcall_channel_variants)]; u32 attempts = gsp_phys_rmcall_engine_is_gr() ? 1u : @@ -6509,10 +6805,52 @@ static int gsp_phys_rmcall_alloc_channel(void __iomem *bar0) u32 i; int ret; + /* + * Modes 8/9/10/11 are the client-context-buffer shapes: only the V6 + * variant (V5 plus SKIP_CTXBUFFER_ALLOC) makes the server treat the + * channel as KMD-managed and route the single MAIN promote entry to + * its client-context-buffer path (or let the old-interface + * INITIALIZE_CTX+PROMOTE flow bind a client-owned buffer). It is + * tried alone, with no fallback: a V5 win would put the promote back + * on the VA/bookkeeping resolve that asserts GSP-RM in modes 1/2/4. + */ + if (gsp_phys_rmcall_engine_is_gr() && + (boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_SINGLE || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_VA || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_VA || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_FB || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_KMD || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM)) { + vars = &gsp_phys_rmcall_channel_variant_skipctx; + attempts = 1; + } + /* + * Modes 12/13 are the non-KMD UVM/vGPU-faithful PA-only flow + * (bInitialize=1 bNonmapped=1): the mode-2 step-1 entry was ACCEPTED + * on the V5 channel, so pin the walk to that exact winning variant + * with no fallback. The V6 skip-ctx channel would route the MAIN + * entry to the KMD client-context path instead. + */ + if (gsp_phys_rmcall_engine_is_gr() && + (boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH)) { + vars = &gsp_phys_rmcall_channel_variants[0]; + attempts = 1; + } + ret = -EIO; for (i = 0; i < attempts; i++) { - const struct gsp_phys_rmcall_channel_variant *v = - &gsp_phys_rmcall_channel_variants[i]; + const struct gsp_phys_rmcall_channel_variant *v = &vars[i]; u32 parent = v->tsg_parent ? boot_stage.rmcall_tsg : boot_stage.rmcall_device; @@ -6525,7 +6863,7 @@ static int gsp_phys_rmcall_alloc_channel(void __iomem *bar0) GSP_PHYS_RMCALL_CLASS_CHANNEL, &ch, sizeof(ch), false, NULL, v->name, false, &v_rpc[i], &v_status[i]); - pr_info("gsp-phys-boot: rm-call: stage 3 channel variant V%u (%u/%zu, %s): hParent=0x%x hObject=0x%x flags=0x%x internalFlags=0x%x ret=%d rpc_result=0x%x status=0x%x\n", + pr_info("vgsp-boot: rm-call: stage 3 channel variant V%u (%u/%zu, %s): hParent=0x%x hObject=0x%x flags=0x%x internalFlags=0x%x ret=%d rpc_result=0x%x status=0x%x\n", v->id, i + 1, ARRAY_SIZE(gsp_phys_rmcall_channel_variants), v->name, parent, v->handle, v->flags, @@ -6534,16 +6872,15 @@ static int gsp_phys_rmcall_alloc_channel(void __iomem *bar0) boot_stage.rmcall_channel = v->handle; boot_stage.rmcall_channel_variant = v->id; boot_stage.rmcall_channel_server_mem = v->server_mem; - pr_info("gsp-phys-boot: rm-call: stage 3 channel variant V%u (%s) WON: hChannel=0x%x\n", + pr_info("vgsp-boot: rm-call: stage 3 channel variant V%u (%s) WON: hChannel=0x%x\n", v->id, v->name, v->handle); return 0; } } if (attempts == 1) { - pr_err("gsp-phys-boot: rm-call: stage 3: the single GR0 channel attempt (V%u %s) failed (ret=%d rpc_result=0x%x status=0x%x); the GR ladder aborts with no fallback variants and no retry\n", - gsp_phys_rmcall_channel_variants[0].id, - gsp_phys_rmcall_channel_variants[0].name, ret, + pr_err("vgsp-boot: rm-call: stage 3: the single GR0 channel attempt (V%u %s) failed (ret=%d rpc_result=0x%x status=0x%x); the GR ladder aborts with no fallback variants and no retry\n", + vars[0].id, vars[0].name, ret, v_rpc[0], v_status[0]); return ret; } @@ -6559,7 +6896,7 @@ static int gsp_phys_rmcall_alloc_channel(void __iomem *bar0) gsp_phys_rmcall_channel_variants[i].id, gsp_phys_rmcall_channel_variants[i].name, v_rpc[i], v_status[i]); - pr_err("gsp-phys-boot: rm-call: stage 3: all %zu channel variants failed: %s\n", + pr_err("vgsp-boot: rm-call: stage 3: all %zu channel variants failed: %s\n", ARRAY_SIZE(gsp_phys_rmcall_channel_variants), summary); } return ret; @@ -6594,7 +6931,7 @@ static int gsp_phys_rmcall_alloc_gr_object(void __iomem *bar0) GSP_PHYS_RMCALL_CLASS_COMPUTE, &gr, sizeof(gr), false, NULL, "TURING_COMPUTE_A", true, NULL, &status); - pr_info("gsp-phys-boot: rm-call: TURING_COMPUTE_A alloc: hClass=0x%x status=0x%x -> hObject=0x%x (hParent=hChannel=0x%x params={version=%u flags=0x%x size=0x%x caps=0x%x}%s)\n", + pr_info("vgsp-boot: rm-call: TURING_COMPUTE_A alloc: hClass=0x%x status=0x%x -> hObject=0x%x (hParent=hChannel=0x%x params={version=%u flags=0x%x size=0x%x caps=0x%x}%s)\n", GSP_PHYS_RMCALL_CLASS_COMPUTE, status, GSP_PHYS_RMCALL_HANDLE_GR_OBJ, boot_stage.rmcall_channel, GSP_PHYS_RMCALL_GR_PARAM_VERSION, 0u, @@ -6628,6 +6965,18 @@ static u64 gsp_phys_rmcall_pte(u64 pa) } /* + * GP10X leaf PTE for a frame-buffer (VIDEO_MEMORY aperture 0) address: + * VALID=1 (bit 0), APERTURE=0 (bits 2:1), VOL=1 (bit 3), frame-buffer byte + * offset >> 12 in the VIDEO address field (bits 32:8; dev_mmu.h:592-595, + * uvm_pascal_mmu.c:235-303). Used for the mode-11 FBMEM context buffer; the + * page-table pages that hold these PTEs stay sysmem. + */ +static u64 gsp_phys_rmcall_pte_vid(u64 fb_offset) +{ + return 0x9ull | ((fb_offset >> 12) << 8); +} + +/* * Build the channel's page-directory hierarchy around the 2 MB VA window * GSP_PHYS_RMCALL_VA_BASE that maps the GPFIFO, pushbuffer and the CE copy's * src/dst/semaphore sysmem pages: @@ -6746,10 +7095,10 @@ static void gsp_phys_rmcall_pdb_build(void) put_unaligned_le64(guest_pte, (u8 *)gsp_phys_chunk_page_va(pt, 0) + (size_t)((GSP_PHYS_RMCALL_VA_GUEST_R >> 12) & 0x1ffu) * 8); - pr_info("gsp-phys-boot: rm-call: guest PDB slots pre-built: gpa=0x%llx hpa=0x%llx slots=0x105/0x106\n", + pr_info("vgsp-boot: rm-call: guest PDB slots pre-built: gpa=0x%llx hpa=0x%llx slots=0x105/0x106\n", boot_stage.rmcall_guest_gpa, guest_hpa); } else { - pr_warn("gsp-phys-boot: rm-call: guest PDB pre-build skipped: GPA 0x%llx -> HPA translation failed (%d); slots 0x105/0x106 stay zero\n", + pr_warn("vgsp-boot: rm-call: guest PDB pre-build skipped: GPA 0x%llx -> HPA translation failed (%d); slots 0x105/0x106 stay zero\n", boot_stage.rmcall_guest_gpa, gpa_ret); } } @@ -6804,22 +7153,31 @@ static void gsp_phys_rmcall_pdb_build(void) for (i = 0; i < boot_stage.rmcall_ctx_pages; i++) { u32 pt_page = i / (GSP_PHYS_PAGE_SIZE / 8u); u32 pt_slot = i % (GSP_PHYS_PAGE_SIZE / 8u); - u64 ctx_pte = gsp_phys_rmcall_pte( - (u64)gsp_phys_chunk_page_dma( - &boot_stage.rmcall_ctx, i)); + u64 ctx_pte; + + if (boot_stage.rmcall_ctx_fbmem) + ctx_pte = gsp_phys_rmcall_pte_vid( + boot_stage.rmcall_ctx_pa + + (u64)i * GSP_PHYS_PAGE_SIZE); + else + ctx_pte = gsp_phys_rmcall_pte( + (u64)gsp_phys_chunk_page_dma( + &boot_stage.rmcall_ctx, i)); put_unaligned_le64(ctx_pte, (u8 *)gsp_phys_chunk_page_va( &boot_stage.rmcall_ctx_pt[pt_page], 0) + (size_t)pt_slot * 8); } - pr_info("gsp-phys-boot: rm-call: GR ctx PDB mapped: va=0x%llx size=0x%x pages=%u ptPages=%u pd0Entries=%u..%u (fresh slots above the scratch pool; no fetched line rewritten)\n", + pr_info("vgsp-boot: rm-call: GR ctx PDB mapped: va=0x%llx size=0x%x pages=%u ptPages=%u pd0Entries=%u..%u (%s; fresh slots above the scratch pool; no fetched line rewritten)\n", GSP_PHYS_RMCALL_VA_GR_CTX, boot_stage.rmcall_ctx_size, boot_stage.rmcall_ctx_pages, boot_stage.rmcall_ctx_pt_pages, (u32)((GSP_PHYS_RMCALL_VA_GR_CTX >> 21) & 0xffu), (u32)((GSP_PHYS_RMCALL_VA_GR_CTX >> 21) & 0xffu) + - boot_stage.rmcall_ctx_pt_pages - 1); + boot_stage.rmcall_ctx_pt_pages - 1, + boot_stage.rmcall_ctx_fbmem ? + "VIDMEM aperture PTEs" : "sysmem PTEs"); } dma_wmb(); @@ -6837,7 +7195,7 @@ static void gsp_phys_rmcall_pdb_build(void) boot_stage.rmcall_pt_gpfifo = pt_gpfifo; boot_stage.rmcall_pt_pb = pt_pb; - pr_info("gsp-phys-boot: rm-call: channel PDB built: vaBase=0x%llx vaGpfifo=0x%llx vaPb=0x%llx vaSrc=0x%llx vaDst=0x%llx vaSem=0x%llx gpFifoOffset=0x%llx root dma=0x%llx pd2 dma=0x%llx pd1 dma=0x%llx pd0 dma=0x%llx pt dma=0x%llx\n", + pr_info("vgsp-boot: rm-call: channel PDB built: vaBase=0x%llx vaGpfifo=0x%llx vaPb=0x%llx vaSrc=0x%llx vaDst=0x%llx vaSem=0x%llx gpFifoOffset=0x%llx root dma=0x%llx pd2 dma=0x%llx pd1 dma=0x%llx pd0 dma=0x%llx pt dma=0x%llx\n", GSP_PHYS_RMCALL_VA_BASE, GSP_PHYS_RMCALL_VA_GPFIFO, GSP_PHYS_RMCALL_VA_PB, GSP_PHYS_RMCALL_VA_SRC, GSP_PHYS_RMCALL_VA_DST, GSP_PHYS_RMCALL_VA_SEM, @@ -6847,9 +7205,9 @@ static void gsp_phys_rmcall_pdb_build(void) (u64)gsp_phys_chunk_page_dma(pd1, 0), (u64)gsp_phys_chunk_page_dma(pd0, 0), (u64)gsp_phys_chunk_page_dma(pt, 0)); - pr_info("gsp-phys-boot: rm-call: channel PDB entries: root[0]=0x%016llx pd2[0]=0x%016llx pd1[0]=0x%016llx pd0[0].small=0x%016llx\n", + pr_info("vgsp-boot: rm-call: channel PDB entries: root[0]=0x%016llx pd2[0]=0x%016llx pd1[0]=0x%016llx pd0[0].small=0x%016llx\n", root_ent, pd2_ent, pd1_ent, pd0_small); - pr_info("gsp-phys-boot: rm-call: channel PDB PT: pt[%u]=0x%016llx (gpfifo dma=0x%llx) pt[%u]=0x%016llx (pb dma=0x%llx)\n", + pr_info("vgsp-boot: rm-call: channel PDB PT: pt[%u]=0x%016llx (gpfifo dma=0x%llx) pt[%u]=0x%016llx (pb dma=0x%llx)\n", gpfifo_idx, pt_gpfifo, (u64)gsp_phys_chunk_page_dma( &boot_stage.rmcall_chunks[GSP_PHYS_RMCALL_BUF_GPFIFO], @@ -6857,11 +7215,11 @@ static void gsp_phys_rmcall_pdb_build(void) pb_idx, pt_pb, (u64)gsp_phys_chunk_page_dma( &boot_stage.rmcall_chunks[GSP_PHYS_RMCALL_BUF_PB], 0)); - pr_info("gsp-phys-boot: rm-call: channel PDB CE PT: pt[%u]=0x%016llx (src dma=0x%llx) pt[%u]=0x%016llx (dst dma=0x%llx) pt[%u]=0x%016llx (sem dma=0x%llx)\n", + pr_info("vgsp-boot: rm-call: channel PDB CE PT: pt[%u]=0x%016llx (src dma=0x%llx) pt[%u]=0x%016llx (dst dma=0x%llx) pt[%u]=0x%016llx (sem dma=0x%llx)\n", src_idx, pt_src, (u64)gsp_phys_chunk_page_dma(src, 0), dst_idx, pt_dst, (u64)gsp_phys_chunk_page_dma(dst, 0), sem_idx, pt_sem, (u64)gsp_phys_chunk_page_dma(sem, 0)); - pr_info("gsp-phys-boot: rm-call: guest scratch PT built: pages=%u vaBase=0x%llx capacity=%u\n", + pr_info("vgsp-boot: rm-call: guest scratch PT built: pages=%u vaBase=0x%llx capacity=%u\n", GSP_PHYS_RMCALL_GUEST_PT_PAGES, GSP_PHYS_RMCALL_VA_GUEST_PT_BASE, GSP_PHYS_RMCALL_GUEST_PT_PAGES * @@ -6903,7 +7261,7 @@ static int gsp_phys_rmcall_gr_ctx_prepare(void __iomem *bar0) * not allocate over the live chunks: reuse the prepared geometry. */ if (boot_stage.rmcall_ctx_prepared) { - pr_info("gsp-phys-boot: rm-call: GR ctx already prepared (pa=0x%llx va=0x%llx size=0x%x); reusing\n", + pr_info("vgsp-boot: rm-call: GR ctx already prepared (pa=0x%llx va=0x%llx size=0x%x); reusing\n", boot_stage.rmcall_ctx_pa, boot_stage.rmcall_ctx_va, boot_stage.rmcall_ctx_size); return 0; @@ -6918,13 +7276,13 @@ static int gsp_phys_rmcall_gr_ctx_prepare(void __iomem *bar0) "GR_GET_ENGINE_CONTEXT_PROPERTIES"); raw = le32_to_cpu(props.size); alignment = le32_to_cpu(props.alignment); - pr_info("gsp-phys-boot: rm-call: GR ctx geometry: engineId=%u rawSize=0x%x alignment=0x%x status=0x%x rpc_result=0x%x (hDevice=0x%x)\n", + pr_info("vgsp-boot: rm-call: GR ctx geometry: engineId=%u rawSize=0x%x alignment=0x%x status=0x%x rpc_result=0x%x (hDevice=0x%x)\n", GSP_PHYS_RMCALL_GR_CTX_ENGINE_ID, raw, alignment, status, rpc_result, boot_stage.rmcall_device); if (ret) return ret; if (!raw || alignment < GSP_PHYS_PAGE_SIZE) { - pr_err("gsp-phys-boot: rm-call: GR ctx geometry invalid (rawSize=0x%x alignment=0x%x); aborting the ladder with no retry\n", + pr_err("vgsp-boot: rm-call: GR ctx geometry invalid (rawSize=0x%x alignment=0x%x); aborting the ladder with no retry\n", raw, alignment); return -EIO; } @@ -6944,7 +7302,7 @@ static int gsp_phys_rmcall_gr_ctx_prepare(void __iomem *bar0) fifo, sizeof(*fifo), &rpc_result, &status, "GR_FIFO_GET_INFO_MAX_SUBCONTEXT"); max_subctx = le32_to_cpu(fifo->fifo_info_tbl[0].data); - pr_info("gsp-phys-boot: rm-call: GR ctx maxSubctx=%u (index=%u engineType=0x%x status=0x%x rpc_result=0x%x hSubdevice=0x%x)\n", + pr_info("vgsp-boot: rm-call: GR ctx maxSubctx=%u (index=%u engineType=0x%x status=0x%x rpc_result=0x%x hSubdevice=0x%x)\n", max_subctx, GSP_PHYS_RMCALL_FIFO_INFO_MAX_SUBCONTEXT, GSP_PHYS_RMCALL_ENGINE_GR0, status, rpc_result, boot_stage.rmcall_subdevice); @@ -6955,14 +7313,14 @@ static int gsp_phys_rmcall_gr_ctx_prepare(void __iomem *bar0) total = ALIGN((u64)raw, GSP_PHYS_PAGE_SIZE) + (u64)max_subctx * GSP_PHYS_PAGE_SIZE; if (!total || total > GSP_PHYS_RMCALL_GR_CTX_MAX_SIZE) { - pr_err("gsp-phys-boot: rm-call: GR ctx MAIN size 0x%llx (raw=0x%x maxSubctx=%u) is outside the 1..0x%x sanity bound; aborting the ladder with no retry\n", + pr_err("vgsp-boot: rm-call: GR ctx MAIN size 0x%llx (raw=0x%x maxSubctx=%u) is outside the 1..0x%x sanity bound; aborting the ladder with no retry\n", total, raw, max_subctx, GSP_PHYS_RMCALL_GR_CTX_MAX_SIZE); return -E2BIG; } pages = (u32)(total / GSP_PHYS_PAGE_SIZE); pt_pages = DIV_ROUND_UP(pages, GSP_PHYS_PAGE_SIZE / 8u); if (pt_pages > GSP_PHYS_RMCALL_GR_CTX_PT_MAX) { - pr_err("gsp-phys-boot: rm-call: GR ctx MAIN needs %u PT pages, above the %u-page window (size=0x%x); aborting the ladder with no retry\n", + pr_err("vgsp-boot: rm-call: GR ctx MAIN needs %u PT pages, above the %u-page window (size=0x%x); aborting the ladder with no retry\n", pt_pages, GSP_PHYS_RMCALL_GR_CTX_PT_MAX, (u32)total); return -E2BIG; } @@ -6975,44 +7333,71 @@ static int gsp_phys_rmcall_gr_ctx_prepare(void __iomem *bar0) GSP_PHYS_RMCALL_GR_PROMOTE_SINGLE_RAW) ? raw : (u32)total; boot_stage.rmcall_gr_promote_size = entry_size; - pr_info("gsp-phys-boot: rm-call: GR ctx MAIN: raw=0x%x align=0x%x maxSubctx=%u total=0x%x pages=%u ptPages=%u gr_promote_param=%u entrySize=0x%x\n", + pr_info("vgsp-boot: rm-call: GR ctx MAIN: raw=0x%x align=0x%x maxSubctx=%u total=0x%x pages=%u ptPages=%u gr_promote_param=%u entrySize=0x%x\n", raw, alignment, max_subctx, (u32)total, pages, pt_pages, boot_stage.rmcall_gr_promote, entry_size); - ret = gsp_phys_chunk_alloc(boot_stage.pdev, ctx, pages); - if (ret) { - pr_err("gsp-phys-boot: rm-call: GR ctx buffer allocation (%u pages, 0x%x bytes) failed: %d; aborting the ladder with no retry\n", - pages, (u32)total, ret); - return ret; - } - if (ctx->page_dma) { - pr_err("gsp-phys-boot: rm-call: GR ctx buffer is not physically contiguous (per-page fallback); PROMOTE_CTX takes one PA+size, so the GR context cannot be promoted; aborting the ladder with no retry\n"); - gsp_phys_chunk_free(boot_stage.pdev, ctx); - return -ENOMEM; + /* + * Modes 11/15 back the context buffer with a server-owned FBMEM + * allocation (VIDMEM aperture, the shape the KMD promote path + * expects); every other mode keeps the host sysmem chunk. The PT + * pages are always host sysmem pages behind the sysmem-aperture PD0. + */ + if (boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_FB || + boot_stage.rmcall_gr_promote == + GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB) { + u64 fb_base = 0; + + ret = gsp_phys_rmcall_alloc_fb_mem(bar0, + GSP_PHYS_RMCALL_HANDLE_CTX_FB, (u32)total, + &fb_base, "GR ctx"); + if (ret) { + pr_err("vgsp-boot: rm-call: GR ctx FBMEM allocation (0x%x bytes) failed: %d; aborting the ladder with no retry\n", + (u32)total, ret); + return ret; + } + boot_stage.rmcall_ctx_fbmem = true; + boot_stage.rmcall_ctx_pa = fb_base; + } else { + ret = gsp_phys_chunk_alloc(boot_stage.pdev, ctx, pages); + if (ret) { + pr_err("vgsp-boot: rm-call: GR ctx buffer allocation (%u pages, 0x%x bytes) failed: %d; aborting the ladder with no retry\n", + pages, (u32)total, ret); + return ret; + } + if (ctx->page_dma) { + pr_err("vgsp-boot: rm-call: GR ctx buffer is not physically contiguous (per-page fallback); PROMOTE_CTX takes one PA+size, so the GR context cannot be promoted; aborting the ladder with no retry\n"); + gsp_phys_chunk_free(boot_stage.pdev, ctx); + return -ENOMEM; + } + gsp_phys_chunk_zero(ctx); + boot_stage.rmcall_ctx_pa = (u64)ctx->dma; } - gsp_phys_chunk_zero(ctx); for (i = 0; i < pt_pages; i++) { ret = gsp_phys_chunk_alloc(boot_stage.pdev, &boot_stage.rmcall_ctx_pt[i], 1u); if (ret) { - pr_err("gsp-phys-boot: rm-call: GR ctx PT page %u/%u allocation failed: %d; aborting the ladder with no retry\n", + pr_err("vgsp-boot: rm-call: GR ctx PT page %u/%u allocation failed: %d; aborting the ladder with no retry\n", i, pt_pages, ret); goto err_free; } gsp_phys_chunk_zero(&boot_stage.rmcall_ctx_pt[i]); } - boot_stage.rmcall_ctx_pa = (u64)ctx->dma; boot_stage.rmcall_ctx_va = GSP_PHYS_RMCALL_VA_GR_CTX; boot_stage.rmcall_ctx_size = (u32)total; boot_stage.rmcall_ctx_pages = pages; boot_stage.rmcall_ctx_pt_pages = pt_pages; boot_stage.rmcall_ctx_prepared = true; - pr_info("gsp-phys-boot: rm-call: GR ctx buffer prepared: total=0x%x pages=%u ptPages=%u pa=0x%llx va=0x%llx (contiguous, zeroed; PDB mapping in gsp_phys_rmcall_pdb_build)\n", + pr_info("vgsp-boot: rm-call: GR ctx buffer prepared: total=0x%x pages=%u ptPages=%u pa=0x%llx va=0x%llx (%s; PDB mapping in gsp_phys_rmcall_pdb_build)\n", boot_stage.rmcall_ctx_size, boot_stage.rmcall_ctx_pages, boot_stage.rmcall_ctx_pt_pages, boot_stage.rmcall_ctx_pa, - boot_stage.rmcall_ctx_va); + boot_stage.rmcall_ctx_va, + boot_stage.rmcall_ctx_fbmem ? + "server FBMEM, VIDMEM aperture PTEs" : + "host sysmem, contiguous, zeroed"); return 0; err_free: @@ -7024,23 +7409,178 @@ err_free: } /* - * Fill the single MAIN promote entry with the prepared PA/VA and the - * snapshot's entry size. initialize/nonmapped carry the bisection shape: - * mode 1/3 use {1,0} (PA+VA in one control), mode 2 step 1 uses {1,1} (PA - * only, va=0) and step 2 uses {0,0} (VA only, same PA/size). + * Auxiliary GR context-buffer prepare (PATCH/PM): query the save size for + * `engine_id` (GET_ENGINE_CONTEXT_PROPERTIES), allocate a zeroed physically + * contiguous sysmem buffer and record its PA/size. The real client allocates + * and PA-promotes the PATCH buffer for every GR object and pre-allocates the + * PM ctxsw buffer when the VAS is externally owned + * (kernel_graphics_context.c:1407-1419,2583-2607); the promote-time + * preemption/commit HALs consume them. Lazy: only runs when the mode reaches + * the promote step; a failure aborts the ladder with no retry. + */ +static int gsp_phys_rmcall_gr_aux_prepare(void __iomem *bar0, + struct gsp_phys_boot_chunk *chunk, + u32 engine_id, const char *name, + u64 *pa_out, u32 *size_out, + bool *prepared) +{ + struct gsp_phys_rmcall_engine_ctx_props props; + u32 pages, raw, rpc_result = 0, status = 0; + int ret; + + if (!boot_stage.pdev) + return -EINVAL; + if (*prepared) { + pr_info("vgsp-boot: rm-call: GR %s already prepared (pa=0x%llx size=0x%x); reusing\n", + name, *pa_out, *size_out); + return 0; + } + + memset(&props, 0, sizeof(props)); + props.engine_id = cpu_to_le32(engine_id); + ret = gsp_phys_rmcall_control(bar0, boot_stage.rmcall_device, + GSP_PHYS_RMCALL_CTRL_FIFO_GET_ENGINE_CONTEXT_PROPERTIES, + &props, sizeof(props), 24 + sizeof(props), + &props, sizeof(props), &rpc_result, &status, + "GR_GET_ENGINE_CONTEXT_PROPERTIES (aux)"); + raw = le32_to_cpu(props.size); + pr_info("vgsp-boot: rm-call: GR %s geometry: engineId=0x%x rawSize=0x%x alignment=0x%x status=0x%x rpc_result=0x%x\n", + name, engine_id, raw, le32_to_cpu(props.alignment), + status, rpc_result); + if (ret) + return ret; + if (!raw || raw > GSP_PHYS_RMCALL_GR_CTX_MAX_SIZE) { + pr_err("vgsp-boot: rm-call: GR %s size 0x%x is outside the 1..0x%x sanity bound; aborting the ladder with no retry\n", + name, raw, GSP_PHYS_RMCALL_GR_CTX_MAX_SIZE); + return -E2BIG; + } + + pages = DIV_ROUND_UP(raw, GSP_PHYS_PAGE_SIZE); + ret = gsp_phys_chunk_alloc(boot_stage.pdev, chunk, pages); + if (ret) { + pr_err("vgsp-boot: rm-call: GR %s buffer allocation (%u pages, 0x%x bytes) failed: %d; aborting the ladder with no retry\n", + name, pages, raw, ret); + return ret; + } + if (chunk->page_dma) { + pr_err("vgsp-boot: rm-call: GR %s buffer is not physically contiguous (per-page fallback); the PA-only promote takes one PA+size; aborting the ladder with no retry\n", + name); + gsp_phys_chunk_free(boot_stage.pdev, chunk); + return -ENOMEM; + } + gsp_phys_chunk_zero(chunk); + *pa_out = (u64)chunk->dma; + *size_out = raw; + *prepared = true; + pr_info("vgsp-boot: rm-call: GR %s buffer prepared: size=0x%x pages=%u pa=0x%llx va=0 (PA-only promote, no PDB mapping needed)\n", + name, raw, pages, *pa_out); + return 0; +} + +static int gsp_phys_rmcall_gr_patch_prepare(void __iomem *bar0) +{ + return gsp_phys_rmcall_gr_aux_prepare(bar0, &boot_stage.rmcall_patch, + GSP_PHYS_RMCALL_GR_PATCH_ENGINE_ID, "PATCH", + &boot_stage.rmcall_patch_pa, + &boot_stage.rmcall_patch_size, + &boot_stage.rmcall_patch_prepared); +} + +static int gsp_phys_rmcall_gr_pm_prepare(void __iomem *bar0) +{ + return gsp_phys_rmcall_gr_aux_prepare(bar0, &boot_stage.rmcall_pm, + GSP_PHYS_RMCALL_GR_PM_ENGINE_ID, "PM", + &boot_stage.rmcall_pm_pa, + &boot_stage.rmcall_pm_size, + &boot_stage.rmcall_pm_prepared); +} + +/* + * Fill one MAIN promote entry with the prepared PA/VA and the snapshot's + * entry size. initialize/nonmapped carry the bisection shape: modes 1/3/5 + * entry 0 and mode 2 step 1 use a full field set; mode 2 step 2 repeats the + * full PA/VA/size; modes 4 and 5 entry 1 use gsp_phys_rmcall_gr_promote_ + * entry_zero_idx() instead, which matches the reference client's zeroed + * second entry (portMemSet params, only bufferId/gpuVirtAddr/bNonmapped set). */ +static void gsp_phys_rmcall_gr_promote_entry_idx( + struct gsp_phys_rmcall_promote_params *p, unsigned int idx, u64 va, + u8 initialize, u8 nonmapped) +{ + p->entry[idx].gpu_phys_addr = cpu_to_le64(boot_stage.rmcall_ctx_pa); + p->entry[idx].gpu_virt_addr = cpu_to_le64(va); + p->entry[idx].size = cpu_to_le64(boot_stage.rmcall_gr_promote_size); + p->entry[idx].phys_attr = cpu_to_le32(GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR); + p->entry[idx].buffer_id = cpu_to_le16( + GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_MAIN); + p->entry[idx].b_initialize = initialize; + p->entry[idx].b_nonmapped = nonmapped; +} + static void gsp_phys_rmcall_gr_promote_entry( struct gsp_phys_rmcall_promote_params *p, u64 va, u8 initialize, u8 nonmapped) { - p->entry[0].gpu_phys_addr = cpu_to_le64(boot_stage.rmcall_ctx_pa); - p->entry[0].gpu_virt_addr = cpu_to_le64(va); - p->entry[0].size = cpu_to_le64(boot_stage.rmcall_gr_promote_size); - p->entry[0].phys_attr = cpu_to_le32(GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR); - p->entry[0].buffer_id = cpu_to_le16( - GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_MAIN); - p->entry[0].b_initialize = initialize; - p->entry[0].b_nonmapped = nonmapped; + gsp_phys_rmcall_gr_promote_entry_idx(p, 0, va, initialize, nonmapped); +} + +/* + * Reference-client zero-field entry: only bufferId, gpuVirtAddr and + * bNonmapped are set; PA/size/physAttr stay zero (the client zeroes the + * whole params struct first and the VA-only prepare path writes only those + * three fields). + */ +static void gsp_phys_rmcall_gr_promote_entry_zero_idx( + struct gsp_phys_rmcall_promote_params *p, unsigned int idx, u64 va, + u8 initialize, u8 nonmapped) +{ + struct gsp_phys_rmcall_promote_entry *e = &p->entry[idx]; + + memset(e, 0, sizeof(*e)); + e->gpu_virt_addr = cpu_to_le64(va); + e->buffer_id = cpu_to_le16(GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_MAIN); + e->b_initialize = initialize; + e->b_nonmapped = nonmapped; +} + +/* + * Mode 6 setup: reserve the context VA window on the ladder VAS with a + * class-0x70 NV01_MEMORY_VIRTUAL object so the no-entry PROMOTE_CTX + * hVirtMemory branch can ask the server to create the memdesc/vaList entry + * for the range itself (ctrl2080gpu.h:934-947). One allocation per staging; + * a failure aborts mode 6 before any promote, with no retry. + */ +static int gsp_phys_rmcall_alloc_gr_hvirt(void __iomem *bar0) +{ + struct gsp_phys_rmcall_mem_virtual_params v; + u32 rpc_result = 0, status = 0; + u64 limit; + int ret; + + if (boot_stage.rmcall_gr_hvirt) + return 0; + + limit = boot_stage.rmcall_ctx_va + (u64)boot_stage.rmcall_ctx_size; + memset(&v, 0, sizeof(v)); + v.offset = cpu_to_le64(boot_stage.rmcall_ctx_va); + v.limit = cpu_to_le64(limit); + v.h_va_space = cpu_to_le32(boot_stage.rmcall_vas); + + ret = gsp_phys_rmcall_alloc(bar0, boot_stage.rmcall_client, + boot_stage.rmcall_device, + GSP_PHYS_RMCALL_HANDLE_MEM_VIRT, + GSP_PHYS_RMCALL_CLASS_MEMORY_VIRTUAL, + &v, sizeof(v), false, NULL, + "NV01_MEMORY_VIRTUAL", true, + &rpc_result, &status); + if (ret) { + pr_err("vgsp-boot: rm-call: mode 6 aborted: NV01_MEMORY_VIRTUAL alloc on hVas=0x%x offset=0x%llx limit=0x%llx failed (rpc_result=0x%x status=0x%x); no PROMOTE_CTX is sent and the ladder aborts with no retry\n", + boot_stage.rmcall_vas, boot_stage.rmcall_ctx_va, limit, + rpc_result, status); + return ret; + } + boot_stage.rmcall_gr_hvirt = GSP_PHYS_RMCALL_HANDLE_MEM_VIRT; + return 0; } /* @@ -7051,22 +7591,55 @@ static void gsp_phys_rmcall_gr_promote_entry( * - mode 2: reference external-VAS shape, a PA-only nonmapped control * (bInitialize=1/bNonmapped=1, no VA) followed - only on success - by a * VA-only control (bInitialize=0/bNonmapped=0, same PA/VA/size); - * - mode 3: like 1 but the entry size is the exact raw save size. + * - mode 3: like 1 but the entry size is the exact raw save size; + * - mode 4: like 2 but step 2 is the reference client's zero-field VA-only + * entry (only bufferId/gpuVirtAddr/bNonmapped set; PA/size/physAttr 0); + * - mode 5: one control, entryCount=2 - entry 0 the PA-only nonmapped + * initialize entry, entry 1 the zero-field VA-only entry; + * - mode 6: no promoteEntry at all; first allocate an NV01_MEMORY_VIRTUAL + * (class 0x70) VA-range object on the ladder VAS at the context window, + * then one PROMOTE_CTX with hVirtMemory = that handle, virtAddress/size + * set and entryCount=0, so the server creates the memdesc/vaList entry + * itself; + * - mode 7: no promoteEntry and no hVirtMemory; one PROMOTE_CTX with the + * bare (virtAddress, size) pair and entryCount=0 (the documented other + * no-entry branch); + * - mode 8: mode 1's single MAIN entry (PA + external-VAS VA + size, + * bInitialize=1, bNonmapped=0) on the V6 KMD-managed channel + * (SKIP_CTXBUFFER_ALLOC): the server routes the single MAIN entry to + * its client-context-buffer path, initializes the context into the + * physical buffer, creates the virtual memdesc itself and commits it, + * with no VA/bookkeeping resolve; + * - mode 9: the stock 570 client's KMD-managed shape - the same V6 + * channel, but the single MAIN entry is the zero-field VA-only entry + * (bInitialize=0, bNonmapped=0, PA/size/physAttr zero) the client + * sends when `kchannelIsCtxBufferAllocSkipped` makes it skip the + * initialize entry; + * - mode 10: the old-interface client-managed flow on the same V6 + * channel - GPU_INITIALIZE_CTX (0x2080012d) with the physical context + * buffer first (installs the PA/size/physAttr memdesc the promote's + * client-memdesc path requires), then PROMOTE_CTX with entryCount=0 + * and the bare (virtAddress, size) pair; + * - mode 11: mode 10 with the context buffer backing swapped to a + * server-owned FBMEM allocation (VIDMEM physAttr 0x4, local-aperture + * leaf PTEs) instead of host sysmem. * Mode 0 never reaches this function (stage 3 stops before it); the early * return is a belt-and-braces no-op. Success means the server installed the * context memdesc, added the VA to the engine-context vaList, committed the * context (ENG_CTX_VALID=1) and ran the GR golden-image bind; only then may * stage 4 BIND/submit run. * - * OBSERVED WEDGE: mode 1 asserted GSP-RM on submission (NOCAT recType=5 - * errorCode=0x52a8b04 source="ASSERT", then no fn76 reply within the 2000 ms - * bound; no 0x1006, no engine fault) and WPR2 could not be cleared afterwards - * (fuse-locked PLM -> reboot with human approval). The first promote control - * of any staging is therefore warned once below; on failure the function - * aborts with no retry, reports exactly which step was last accepted and - * leaves the context buffer allocated until staging free/rmmod. The control - * targets the subdevice, like the reference client promote - * (kernel_graphics_object.c:134-139; kernel_falcon.c:271-272). + * OBSERVED WEDGE: modes 1, 2 and 4 asserted GSP-RM on submission (NOCAT + * recType=5 errorCode=0x52a8b04 source="ASSERT", then no fn76 reply within + * the 2000 ms bound; no 0x1006, no engine fault) and WPR2 could not be + * cleared afterwards (fuse-locked PLM -> reboot with human approval); the + * PA-only nonmapped step of modes 2/4 is accepted every time, and the + * LOGINIT ring shows NV_ERR_OBJECT_NOT_FOUND (0x57) on the VA resolve. The + * first promote control of any staging is therefore warned once below; on + * failure the function aborts with no retry, reports exactly which step was + * last accepted and leaves the context buffer allocated until staging + * free/rmmod. The control targets the subdevice, like the reference client + * promote (kernel_graphics_object.c:134-139; kernel_falcon.c:271-272). */ static int gsp_phys_rmcall_gr_ctx_promote(void __iomem *bar0) { @@ -7081,9 +7654,48 @@ static int gsp_phys_rmcall_gr_ctx_promote(void __iomem *bar0) return -EINVAL; if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_OFF) return -EOPNOTSUPP; + /* + * Modes 8/9/10 must run on the V6 channel: without the + * SKIP_CTXBUFFER_ALLOC bit the promote takes the VA/bookkeeping + * route that asserted GSP-RM in modes 1/2/4 (or rejects the + * hVirtMemory/bare-VA memdesc with INVALID_ARGUMENT). The variant is + * selected at channel alloc and recorded here; a mismatch aborts + * before any PROMOTE_CTX instead of risking a wedge. + */ + if ((mode == GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_SINGLE || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_VA || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_VA || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_FB || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM) && + boot_stage.rmcall_channel_variant != + gsp_phys_rmcall_channel_variant_skipctx.id) { + pr_err("vgsp-boot: rm-call: mode %u requires the SKIP_CTXBUFFER_ALLOC channel (V%u %s); winning variant is V%u; no PROMOTE_CTX is sent and the ladder aborts with no retry\n", + mode, gsp_phys_rmcall_channel_variant_skipctx.id, + gsp_phys_rmcall_channel_variant_skipctx.name, + boot_stage.rmcall_channel_variant); + return -EINVAL; + } + /* + * Modes 12/13 must run on the V5 channel: the mode-2 step-1 PA-only + * entry was accepted there, and the V6 skip-ctx channel would take the + * KMD client-context-buffer route instead (which stayed at 0x40 in + * modes 8-11). + */ + if ((mode == GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH) && + boot_stage.rmcall_channel_variant != + gsp_phys_rmcall_channel_variants[0].id) { + pr_err("vgsp-boot: rm-call: mode %u requires the V5 channel (V%u %s); winning variant is V%u; no PROMOTE_CTX is sent and the ladder aborts with no retry\n", + mode, gsp_phys_rmcall_channel_variants[0].id, + gsp_phys_rmcall_channel_variants[0].name, + boot_stage.rmcall_channel_variant); + return -EINVAL; + } if (!boot_stage.rmcall_gr_promote_warned) { boot_stage.rmcall_gr_promote_warned = true; - pr_warn("gsp-phys-boot: rm-call: WARNING: gr_promote_param=%u sends GPU_PROMOTE_CTX: a failed GR context promote can assert GSP-RM (NOCAT recType=5 errorCode=0x52a8b04) and wedge the device with WPR2 left up and teardown unable to clear it; recovery requires a reboot with human approval - run only when reboot readiness is confirmed\n", + pr_warn("vgsp-boot: rm-call: WARNING: gr_promote_param=%u sends GPU_PROMOTE_CTX: a failed GR context promote can assert GSP-RM (NOCAT recType=5 errorCode=0x52a8b04) and wedge the device with WPR2 left up and teardown unable to clear it; recovery requires a reboot with human approval - run only when reboot readiness is confirmed\n", mode); } @@ -7101,7 +7713,40 @@ static int gsp_phys_rmcall_gr_ctx_promote(void __iomem *bar0) p->size = cpu_to_le64(0); p->entry_count = cpu_to_le32(1); - if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_TWO_PHASE) { + if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_BATCHED) { + /* + * Mode 5: one control, entryCount=2 - entry 0 the PA-only + * nonmapped initialize entry, entry 1 the reference client's + * zero-field VA-only promote entry. This mirrors the client + * batching both entries into one params struct when a MAIN + * buffer is both initialized and promoted in the same call. + */ + p->entry_count = cpu_to_le32(2); + gsp_phys_rmcall_gr_promote_entry_idx(p, 0, 0, 1, 1); + gsp_phys_rmcall_gr_promote_entry_zero_idx(p, 1, + boot_stage.rmcall_ctx_va, 0, 0); + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &rpc_result, &status, + "GPU_PROMOTE_CTX (batched init+VA)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX batched: entryCount=2 entry0{pa=0x%llx va=0 size=0x%x physAttr=0x%x bInitialize=1 bNonmapped=1} entry1{pa=0 va=0x%llx size=0 physAttr=0 bInitialize=0 bNonmapped=0} status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x bufferId=MAIN gr_promote_param=%u)\n", + boot_stage.rmcall_ctx_pa, size, + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR, + boot_stage.rmcall_ctx_va, status, rpc_result, + boot_stage.rmcall_channel, boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX batched failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: none (0/1); the GR context is not committed and the ladder aborts before BIND with no retry\n", + status, rpc_result, + gsp_phys_rmcall_status_str(status), ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 2; + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_TWO_PHASE || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_VA_ZERO) { /* Step 1/2: PA-only nonmapped entry (no VA). */ gsp_phys_rmcall_gr_promote_entry(p, 0, 1, 1); ret = gsp_phys_rmcall_control(bar0, @@ -7110,12 +7755,12 @@ static int gsp_phys_rmcall_gr_ctx_promote(void __iomem *bar0) p, sizeof(*p), 24, NULL, 0, &rpc_result, &status, "GPU_PROMOTE_CTX (PA-only)"); - pr_info("gsp-phys-boot: rm-call: PROMOTE_CTX PA-only (step 1/2): pa=0x%llx va=0 size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=1 bNonmapped=1 gr_promote_param=%u)\n", + pr_info("vgsp-boot: rm-call: PROMOTE_CTX PA-only (step 1/2): pa=0x%llx va=0 size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=1 bNonmapped=1 gr_promote_param=%u)\n", boot_stage.rmcall_ctx_pa, size, status, rpc_result, boot_stage.rmcall_channel, boot_stage.rmcall_client, GSP_PHYS_RMCALL_ENGINE_GR0, mode); if (ret) { - pr_err("gsp-phys-boot: rm-call: PROMOTE_CTX PA-only (step 1/2) failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: none (0/2); no further controls are sent and the ladder aborts before BIND with no retry\n", + pr_err("vgsp-boot: rm-call: PROMOTE_CTX PA-only (step 1/2) failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: none (0/2); no further controls are sent and the ladder aborts before BIND with no retry\n", status, rpc_result, gsp_phys_rmcall_status_str(status), ret); kvfree(p); @@ -7123,9 +7768,18 @@ static int gsp_phys_rmcall_gr_ctx_promote(void __iomem *bar0) } boot_stage.rmcall_gr_promote_step = 1; - /* Step 2/2: VA-only entry (same PA/VA/size, initialize off). */ - gsp_phys_rmcall_gr_promote_entry(p, boot_stage.rmcall_ctx_va, - 0, 0); + /* + * Step 2/2: VA-only entry. Mode 2 repeats the full PA/VA/ + * size; mode 4 sends the reference client's zero-field shape + * (only bufferId/gpuVirtAddr/bNonmapped set) to isolate + * whether the VA path objects to the repeated PA/size. + */ + if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_VA_ZERO) + gsp_phys_rmcall_gr_promote_entry_zero_idx(p, 0, + boot_stage.rmcall_ctx_va, 0, 0); + else + gsp_phys_rmcall_gr_promote_entry(p, + boot_stage.rmcall_ctx_va, 0, 0); rpc_result = 0; status = 0; ret = gsp_phys_rmcall_control(bar0, @@ -7134,24 +7788,201 @@ static int gsp_phys_rmcall_gr_ctx_promote(void __iomem *bar0) p, sizeof(*p), 24, NULL, 0, &rpc_result, &status, "GPU_PROMOTE_CTX (VA-only)"); - pr_info("gsp-phys-boot: rm-call: PROMOTE_CTX VA-only (step 2/2): pa=0x%llx va=0x%llx size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=0 bNonmapped=0 gr_promote_param=%u)\n", - boot_stage.rmcall_ctx_pa, boot_stage.rmcall_ctx_va, - size, status, rpc_result, boot_stage.rmcall_channel, + pr_info("vgsp-boot: rm-call: PROMOTE_CTX VA-only (step 2/2): pa=0x%llx va=0x%llx size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=0 bNonmapped=0 gr_promote_param=%u)\n", + mode == GSP_PHYS_RMCALL_GR_PROMOTE_VA_ZERO ? 0 : + boot_stage.rmcall_ctx_pa, + boot_stage.rmcall_ctx_va, + mode == GSP_PHYS_RMCALL_GR_PROMOTE_VA_ZERO ? 0 : size, + status, rpc_result, boot_stage.rmcall_channel, boot_stage.rmcall_client, GSP_PHYS_RMCALL_ENGINE_GR0, mode); if (ret) { - pr_err("gsp-phys-boot: rm-call: PROMOTE_CTX VA-only (step 2/2) failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: PA-only nonmapped accepted (1/2); no further controls are sent and the ladder aborts before BIND with no retry\n", + pr_err("vgsp-boot: rm-call: PROMOTE_CTX VA-only (step 2/2) failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: PA-only nonmapped accepted (1/2); no further controls are sent and the ladder aborts before BIND with no retry\n", status, rpc_result, gsp_phys_rmcall_status_str(status), ret); kvfree(p); return ret; } boot_stage.rmcall_gr_promote_step = 2; - } else { + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_HVIRT || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_BARE_VA) { /* - * Modes 1 and 3: one MAIN entry carrying both the PA + * Modes 6/7: the documented no-entry branches. Mode 6 first + * reserves the context window with an NV01_MEMORY_VIRTUAL + * object on the ladder VAS and passes it as hVirtMemory + * (hClient is its owner); mode 7 sends the bare + * (virtAddress, size) pair with no hVirtMemory. entryCount=0 + * in both, so the server creates the memdesc/vaList entry + * instead of resolving one of our raw-PTE entries. + */ + if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_HVIRT) { + ret = gsp_phys_rmcall_alloc_gr_hvirt(bar0); + if (ret) { + kvfree(p); + return ret; + } + p->h_client = cpu_to_le32(boot_stage.rmcall_client); + p->h_virt_memory = + cpu_to_le32(boot_stage.rmcall_gr_hvirt); + } + p->virt_address = cpu_to_le64(boot_stage.rmcall_ctx_va); + p->size = cpu_to_le64(boot_stage.rmcall_ctx_size); + p->entry_count = cpu_to_le32(0); + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &rpc_result, &status, + mode == GSP_PHYS_RMCALL_GR_PROMOTE_HVIRT ? + "GPU_PROMOTE_CTX (hVirtMemory)" : + "GPU_PROMOTE_CTX (bare VA+size)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX %s: entryCount=0 hVirtMemory=0x%x virtAddress=0x%llx size=0x%x status=0x%x rpc_result=0x%x (hClient=0x%x hObject=0x%x hChanClient=0x%x engineType=0x%x gr_promote_param=%u)\n", + mode == GSP_PHYS_RMCALL_GR_PROMOTE_HVIRT ? + "hVirtMemory" : "bare VA+size", + le32_to_cpu(p->h_virt_memory), + boot_stage.rmcall_ctx_va, boot_stage.rmcall_ctx_size, + status, rpc_result, le32_to_cpu(p->h_client), + boot_stage.rmcall_channel, boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX %s failed (status=0x%x rpc_result=0x%x, %s, ret=%d); the GR context is not committed and the ladder aborts before BIND with no retry\n", + mode == GSP_PHYS_RMCALL_GR_PROMOTE_HVIRT ? + "hVirtMemory" : "bare VA+size", + status, rpc_result, + gsp_phys_rmcall_status_str(status), ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 2; + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_VA) { + /* + * Mode 9: the stock 570 client's KMD-managed channel shape. + * `kgrctxPrepareInitializeCtxBuffer` returns without filling + * the MAIN entry when `kchannelIsCtxBufferAllocSkipped`, then + * `kgrctxPreparePromoteCtxBuffer` fills only the VA fields, so + * the client sends entryCount=1, bufferId=MAIN, bInitialize=0, + * bNonmapped=0, gpuVirtAddr set and PA/size/physAttr zero. On + * the V6 channel the server routes this to its + * client-context-buffer path and binds without the PA + * initialization or the VA/bookkeeping resolve. + */ + gsp_phys_rmcall_gr_promote_entry_zero_idx(p, 0, + boot_stage.rmcall_ctx_va, 0, 0); + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &rpc_result, &status, + "GPU_PROMOTE_CTX (KMD VA-only)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX KMD VA-only: pa=0 va=0x%llx size=0 status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=0 bNonmapped=0 gr_promote_param=%u)\n", + boot_stage.rmcall_ctx_va, status, rpc_result, + boot_stage.rmcall_channel, boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX KMD VA-only failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: none (0/1); the GR context is not committed and the ladder aborts before BIND with no retry\n", + status, rpc_result, + gsp_phys_rmcall_status_str(status), ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 1; + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_VA || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_FB) { + /* + * Modes 10/11: the old-interface client-managed flow. Step 1 + * sends GPU_INITIALIZE_CTX (0x2080012d) with the physical + * context buffer, which installs the PA/size/physAttr + * memdesc on the GraphicsContext (grctxInitializeAPI) that + * the following promote's client-memdesc path requires. + * Mode 11's buffer is the server FBMEM allocation with the + * VIDMEM physAttr (0x4); mode 10's is the host sysmem chunk + * with NCOH_SYS (0x6). Step 2 sends PROMOTE_CTX with + * entryCount=0 and the bare (virtAddress, size) pair; the + * server builds the virtual memdesc itself and, on the V6 + * KMD-managed channel, binds it without the VA/bookkeeping + * resolve. + */ + struct gsp_phys_rmcall_init_ctx_params *ic; + u32 ic_phys_attr = (mode == + GSP_PHYS_RMCALL_GR_PROMOTE_OLDIFACE_FB) ? + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR_FB : + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR; + u32 ic_rpc = 0, ic_status = 0; + + ic = kvzalloc(sizeof(*ic), GFP_KERNEL); + if (!ic) { + kvfree(p); + return -ENOMEM; + } + ic->engine_type = cpu_to_le32(GSP_PHYS_RMCALL_ENGINE_GR0); + ic->h_client = cpu_to_le32(0); + ic->ch_id = cpu_to_le32(0); + ic->h_chan_client = cpu_to_le32(boot_stage.rmcall_client); + ic->h_object = cpu_to_le32(boot_stage.rmcall_channel); + ic->h_virt_memory = cpu_to_le32(0); + ic->phys_address = cpu_to_le64(boot_stage.rmcall_ctx_pa); + ic->phys_attr = cpu_to_le32(ic_phys_attr); + ic->h_dma_handle = cpu_to_le32(0); + ic->index = cpu_to_le32(0); + ic->size = cpu_to_le64(boot_stage.rmcall_ctx_size); + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_INITIALIZE_CTX, + ic, sizeof(*ic), 24, NULL, 0, + &ic_rpc, &ic_status, + "GPU_INITIALIZE_CTX (old interface)"); + kvfree(ic); + pr_info("vgsp-boot: rm-call: INITIALIZE_CTX: pa=0x%llx size=0x%x physAttr=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x hVirtMemory=0 gr_promote_param=%u)\n", + boot_stage.rmcall_ctx_pa, boot_stage.rmcall_ctx_size, + ic_phys_attr, ic_status, ic_rpc, + boot_stage.rmcall_channel, boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: INITIALIZE_CTX failed (status=0x%x rpc_result=0x%x, %s, ret=%d); no PROMOTE_CTX is sent and the ladder aborts with no retry\n", + ic_status, ic_rpc, + gsp_phys_rmcall_status_str(ic_status), ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 1; + + /* Step 2: PROMOTE_CTX entryCount=0, bare (virtAddress, size). */ + p->virt_address = cpu_to_le64(boot_stage.rmcall_ctx_va); + p->size = cpu_to_le64(boot_stage.rmcall_ctx_size); + p->entry_count = cpu_to_le32(0); + rpc_result = 0; + status = 0; + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &rpc_result, &status, + "GPU_PROMOTE_CTX (KMD bare VA+size after init)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX bare VA+size after init: entryCount=0 virtAddress=0x%llx size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x gr_promote_param=%u)\n", + boot_stage.rmcall_ctx_va, boot_stage.rmcall_ctx_size, + status, rpc_result, boot_stage.rmcall_channel, + boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX bare VA+size failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: INITIALIZE_CTX accepted (1/2); the GR context is not committed and the ladder aborts before BIND with no retry\n", + status, rpc_result, + gsp_phys_rmcall_status_str(status), ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 2; + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_SINGLE || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_SINGLE_RAW || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_SKIPCTX_SINGLE) { + /* + * Modes 1, 3 and 8: one MAIN entry carrying both the PA * (bInitialize=1) and the external-VAS VA (bNonmapped=0); - * mode 3 carries the exact raw size. + * mode 3 carries the exact raw size. Mode 8 runs on the V6 + * KMD-managed channel, so the server takes its + * client-context-buffer path: it initializes the context into + * our physical buffer, creates the virtual context memdesc + * itself and commits it, without resolving the VA against a + * server-side booking (the mode-1/2/4 assert). */ gsp_phys_rmcall_gr_promote_entry(p, boot_stage.rmcall_ctx_va, 1, 0); @@ -7160,19 +7991,257 @@ static int gsp_phys_rmcall_gr_ctx_promote(void __iomem *bar0) GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, p, sizeof(*p), 24, NULL, 0, &rpc_result, &status, "GPU_PROMOTE_CTX MAIN"); - pr_info("gsp-phys-boot: rm-call: PROMOTE_CTX MAIN: pa=0x%llx va=0x%llx size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=1 bNonmapped=0 gr_promote_param=%u)\n", + pr_info("vgsp-boot: rm-call: PROMOTE_CTX MAIN: pa=0x%llx va=0x%llx size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=1 bNonmapped=0 gr_promote_param=%u)\n", boot_stage.rmcall_ctx_pa, boot_stage.rmcall_ctx_va, size, status, rpc_result, boot_stage.rmcall_channel, boot_stage.rmcall_client, GSP_PHYS_RMCALL_ENGINE_GR0, mode); if (ret) { - pr_err("gsp-phys-boot: rm-call: PROMOTE_CTX MAIN failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: none (0/1); the GR context is not committed and the ladder aborts before BIND with no retry (read the failed-reply dump above: 0x23 invalid client, 0x36 invalid parent, 0x56 not supported)\n", + pr_err("vgsp-boot: rm-call: PROMOTE_CTX MAIN failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: none (0/1); the GR context is not committed and the ladder aborts before BIND with no retry (read the failed-reply dump above: 0x23 invalid client, 0x36 invalid parent, 0x56 not supported)\n", status, rpc_result, gsp_phys_rmcall_status_str(status), ret); kvfree(p); return ret; } boot_stage.rmcall_gr_promote_step = 1; + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH) { + /* + * Modes 12/13: the UVM/vGPU-faithful PA-only flow. On an + * externally-owned VAS the real client never promotes context + * VAs; it sends bInitialize=1 bNonmapped=1 entries so the + * server installs the memdescs and commits the engine context, + * while the page tables stay externally owned. The mode-2 + * step-1 MAIN entry in exactly this shape was ACCEPTED on the + * V5 channel (status=0x0); only the follow-up VA step wedged. + * Mode 13 first promotes the PATCH buffer the real client + * always allocates (PA-only, same shape), because its absence + * is the leading candidate for the 0x40 the KMD modes return. + * No VA promote is ever sent; on acceptance the ladder + * continues to BIND/SCHEDULE/submit. + */ + if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH) { + struct gsp_phys_rmcall_promote_entry *e = &p->entry[0]; + u32 patch_rpc = 0, patch_status = 0; + + ret = gsp_phys_rmcall_gr_patch_prepare(bar0); + if (ret) { + kvfree(p); + return ret; + } + memset(e, 0, sizeof(*e)); + e->gpu_phys_addr = + cpu_to_le64(boot_stage.rmcall_patch_pa); + e->size = cpu_to_le64(boot_stage.rmcall_patch_size); + e->phys_attr = cpu_to_le32( + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR); + e->buffer_id = cpu_to_le16( + GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_PATCH); + e->b_initialize = 1; + e->b_nonmapped = 1; + p->entry_count = cpu_to_le32(1); + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &patch_rpc, &patch_status, + "GPU_PROMOTE_CTX (PATCH PA-only)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX PATCH PA-only: pa=0x%llx size=0x%x physAttr=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=PATCH bInitialize=1 bNonmapped=1 gr_promote_param=%u)\n", + boot_stage.rmcall_patch_pa, + boot_stage.rmcall_patch_size, + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR, patch_status, + patch_rpc, boot_stage.rmcall_channel, + boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX PATCH PA-only failed (status=0x%x rpc_result=0x%x, %s, ret=%d); no MAIN promote is sent and the ladder aborts with no retry\n", + patch_status, patch_rpc, + gsp_phys_rmcall_status_str(patch_status), + ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 1; + } + + /* MAIN PA-only nonmapped entry: exactly mode 2 step 1. */ + gsp_phys_rmcall_gr_promote_entry(p, 0, 1, 1); + rpc_result = 0; + status = 0; + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &rpc_result, &status, + "GPU_PROMOTE_CTX (MAIN PA-only)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX MAIN PA-only: pa=0x%llx va=0 size=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=1 bNonmapped=1 gr_promote_param=%u); no VA promote is sent, continuing to BIND/SCHEDULE/submit\n", + boot_stage.rmcall_ctx_pa, size, status, rpc_result, + boot_stage.rmcall_channel, boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX MAIN PA-only failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: %s; the ladder aborts before BIND with no retry\n", + status, rpc_result, + gsp_phys_rmcall_status_str(status), ret, + mode == GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH ? + "PATCH PA-only accepted (1/2)" : "none (0/1)"); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = + (mode == GSP_PHYS_RMCALL_GR_PROMOTE_PA_ONLY_PATCH) ? + 2 : 1; + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB || + mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM) { + /* + * Modes 14/15/16: the KMD client-context-buffer path (V6) with + * the auxiliary buffers promoted first. The single MAIN entry + * carries both PA (bInitialize=1) and the external-VAS VA + * (bNonmapped=0): the server builds its own virtual memdesc + * via kchannelSetEngineContextMemDesc, which books the VA in + * the engine-context vaList the commit needs (the V5 PA-only + * modes stayed CTXNOTVALID because no VA was ever booked). + * PATCH is the real client's always-present buffer; mode 16 + * also promotes the PM ctxsw buffer, which the client + * pre-allocates for externally-owned VAS and the promote-time + * preemption/commit HALs consume. Mode 15 uses the server + * FBMEM context buffer with the VIDMEM physAttr 0x4 (a vGPU + * host context buffer type). + */ + struct gsp_phys_rmcall_promote_entry *e = &p->entry[0]; + u32 aux_rpc = 0, aux_status = 0; + + ret = gsp_phys_rmcall_gr_patch_prepare(bar0); + if (ret) { + kvfree(p); + return ret; + } + memset(e, 0, sizeof(*e)); + e->gpu_phys_addr = cpu_to_le64(boot_stage.rmcall_patch_pa); + e->size = cpu_to_le64(boot_stage.rmcall_patch_size); + e->phys_attr = cpu_to_le32( + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR); + e->buffer_id = cpu_to_le16( + GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_PATCH); + e->b_initialize = 1; + e->b_nonmapped = 1; + p->entry_count = cpu_to_le32(1); + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &aux_rpc, &aux_status, + "GPU_PROMOTE_CTX (PATCH PA-only, KMD)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX PATCH PA-only (KMD): pa=0x%llx size=0x%x physAttr=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=PATCH bInitialize=1 bNonmapped=1 gr_promote_param=%u)\n", + boot_stage.rmcall_patch_pa, + boot_stage.rmcall_patch_size, + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR, aux_status, + aux_rpc, boot_stage.rmcall_channel, + boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX PATCH PA-only (KMD) failed (status=0x%x rpc_result=0x%x, %s, ret=%d); no MAIN promote is sent and the ladder aborts with no retry\n", + aux_status, aux_rpc, + gsp_phys_rmcall_status_str(aux_status), ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 1; + + if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM) { + ret = gsp_phys_rmcall_gr_pm_prepare(bar0); + if (ret) { + kvfree(p); + return ret; + } + memset(e, 0, sizeof(*e)); + e->gpu_phys_addr = + cpu_to_le64(boot_stage.rmcall_pm_pa); + e->size = cpu_to_le64(boot_stage.rmcall_pm_size); + e->phys_attr = cpu_to_le32( + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR); + e->buffer_id = cpu_to_le16( + GSP_PHYS_RMCALL_GR_CTX_BUFFER_ID_PM); + e->b_initialize = 1; + e->b_nonmapped = 1; + p->entry_count = cpu_to_le32(1); + aux_rpc = 0; + aux_status = 0; + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &aux_rpc, &aux_status, + "GPU_PROMOTE_CTX (PM PA-only, KMD)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX PM PA-only (KMD): pa=0x%llx size=0x%x physAttr=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=PM bInitialize=1 bNonmapped=1 gr_promote_param=%u)\n", + boot_stage.rmcall_pm_pa, + boot_stage.rmcall_pm_size, + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR, aux_status, + aux_rpc, boot_stage.rmcall_channel, + boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX PM PA-only (KMD) failed (status=0x%x rpc_result=0x%x, %s, ret=%d); no MAIN promote is sent and the ladder aborts with no retry\n", + aux_status, aux_rpc, + gsp_phys_rmcall_status_str(aux_status), + ret); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = 2; + } + + /* MAIN single entry: the mode-8 shape (PA + VA + init). */ + gsp_phys_rmcall_gr_promote_entry(p, + boot_stage.rmcall_ctx_va, 1, 0); + if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB) + p->entry[0].phys_attr = cpu_to_le32( + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR_FB); + rpc_result = 0; + status = 0; + ret = gsp_phys_rmcall_control(bar0, + boot_stage.rmcall_subdevice, + GSP_PHYS_RMCALL_CTRL_GPU_PROMOTE_CTX, + p, sizeof(*p), 24, NULL, 0, + &rpc_result, &status, + "GPU_PROMOTE_CTX (KMD MAIN init+VA)"); + pr_info("vgsp-boot: rm-call: PROMOTE_CTX KMD MAIN: pa=0x%llx va=0x%llx size=0x%x physAttr=0x%x status=0x%x rpc_result=0x%x (hObject=0x%x hChanClient=0x%x engineType=0x%x entryCount=1 bufferId=MAIN bInitialize=1 bNonmapped=0 gr_promote_param=%u)\n", + boot_stage.rmcall_ctx_pa, boot_stage.rmcall_ctx_va, + size, + mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_FB ? + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR_FB : + GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR, + status, rpc_result, boot_stage.rmcall_channel, + boot_stage.rmcall_client, + GSP_PHYS_RMCALL_ENGINE_GR0, mode); + if (ret) { + pr_err("vgsp-boot: rm-call: PROMOTE_CTX KMD MAIN failed (status=0x%x rpc_result=0x%x, %s, ret=%d); last completed promote step: %s; the ladder aborts before BIND with no retry\n", + status, rpc_result, + gsp_phys_rmcall_status_str(status), ret, + mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM ? + "PATCH+PM PA-only accepted (2/3)" : + "PATCH PA-only accepted (1/2)"); + kvfree(p); + return ret; + } + boot_stage.rmcall_gr_promote_step = + (mode == GSP_PHYS_RMCALL_GR_PROMOTE_KMD_PM) ? 3 : 2; + } else if (mode == GSP_PHYS_RMCALL_GR_PROMOTE_SERVER) { + /* + * Mode 17: server-managed ctx buffers. No client PROMOTE_CTX is + * sent; the GSP-RM allocated and committed the engine context + * itself (RMSetClientRMAllocatedCtxBuffer=0 in the pre-boot + * registry profile, gsp_phys_srv_ctxbuf=1). The ladder proceeds + * straight to BIND/SCHEDULE/submit. If the committed context is + * valid this is where REAL GR SEM OK should appear. + */ + pr_info("vgsp-boot: rm-call: gr_promote_param=17: no client PROMOTE_CTX is sent; the context buffers are server-managed (gsp_phys_srv_ctxbuf registry profile) and the server commits the engine context itself; continuing to BIND/SCHEDULE/submit\n"); + boot_stage.rmcall_gr_promote_step = 0; + } else { + pr_err("vgsp-boot: rm-call: unknown gr_promote_param=%u reached the promote step; no PROMOTE_CTX is sent and the ladder aborts with no retry\n", + mode); + kvfree(p); + return -EINVAL; } kvfree(p); @@ -7196,7 +8265,7 @@ static void gsp_phys_rmcall_gr_ctx_info(void __iomem *bar0) p = kvzalloc(sizeof(*p), GFP_KERNEL); if (!p) { - pr_warn("gsp-phys-boot: rm-call: GR ctx info skipped: no memory for the %zu-byte best-effort query\n", + pr_warn("vgsp-boot: rm-call: GR ctx info skipped: no memory for the %zu-byte best-effort query\n", sizeof(*p)); return; } @@ -7208,7 +8277,7 @@ static void gsp_phys_rmcall_gr_ctx_info(void __iomem *bar0) p, sizeof(*p), &rpc_result, &status, "GR_GET_CTX_BUFFER_INFO"); if (ret) { - pr_warn("gsp-phys-boot: rm-call: GR ctx info (best effort) failed: status=0x%x rpc_result=0x%x ret=%d; the promote result stands\n", + pr_warn("vgsp-boot: rm-call: GR ctx info (best effort) failed: status=0x%x rpc_result=0x%x ret=%d; the promote result stands\n", status, rpc_result, ret); kvfree(p); return; @@ -7216,13 +8285,13 @@ static void gsp_phys_rmcall_gr_ctx_info(void __iomem *bar0) count = le32_to_cpu(p->buffer_count); shown = min_t(u32, count, 4u); - pr_info("gsp-phys-boot: rm-call: GR_GET_CTX_BUFFER_INFO: bufferCount=%u (showing %u)\n", + pr_info("vgsp-boot: rm-call: GR_GET_CTX_BUFFER_INFO: bufferCount=%u (showing %u)\n", count, shown); for (i = 0; i < shown; i++) { const struct gsp_phys_rmcall_ctx_buffer_info *ci = &p->ctx_buffer_info[i]; - pr_info("gsp-phys-boot: rm-call: GR ctx[%u]: bufferType=%u physAddr=0x%llx aperture=%u size=0x%llx pageCount=0x%llx alignment=0x%llx contiguous=%u\n", + pr_info("vgsp-boot: rm-call: GR ctx[%u]: bufferType=%u physAddr=0x%llx aperture=%u size=0x%llx pageCount=0x%llx alignment=0x%llx contiguous=%u\n", i, le32_to_cpu(ci->buffer_type), le64_to_cpu(ci->phys_addr), le32_to_cpu(ci->aperture), le64_to_cpu(ci->size), @@ -7295,7 +8364,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) "FERMI_VASPACE_A", true, &vas_rpc, &vas_status); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 3 aborted: FERMI_VASPACE_A alloc failed (rpc_result=0x%x status=0x%x); no VAS for the channel\n", + pr_err("vgsp-boot: rm-call: stage 3 aborted: FERMI_VASPACE_A alloc failed (rpc_result=0x%x status=0x%x); no VAS for the channel\n", vas_rpc, vas_status); return ret; } @@ -7316,7 +8385,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) &pdb, sizeof(pdb), 16, NULL, 0, &pdb_rpc, NULL, "DMA_SET_PAGE_DIRECTORY"); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 3 aborted: DMA_SET_PAGE_DIRECTORY on hVas=0x%x numEntries=%u failed (rpc_result=0x%x); the VAS has no page-directory base\n", + pr_err("vgsp-boot: rm-call: stage 3 aborted: DMA_SET_PAGE_DIRECTORY on hVas=0x%x numEntries=%u failed (rpc_result=0x%x); the VAS has no page-directory base\n", boot_stage.rmcall_vas, le32_to_cpu(pdb.num_entries), pdb_rpc); return ret; @@ -7332,7 +8401,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) if (gsp_phys_rmcall_engine_is_gr()) { ret = gsp_phys_rmcall_gr_ctx_prepare(bar0); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 3 aborted: GR context buffer prepare failed (%d); the GR context is not committed and the ladder aborts with no retry\n", + pr_err("vgsp-boot: rm-call: stage 3 aborted: GR context buffer prepare failed (%d); the GR context is not committed and the ladder aborts with no retry\n", ret); return ret; } @@ -7377,7 +8446,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) */ ret = gsp_phys_rmcall_alloc_notifier_mem(bar0); if (ret) - pr_warn("gsp-phys-boot: rm-call: FBMEM error-notifier allocation failed (%d); channel allocs carry a zeroed notifier memdesc and only the stage-4 token recovery can save the token\n", + pr_warn("vgsp-boot: rm-call: FBMEM error-notifier allocation failed (%d); channel allocs carry a zeroed notifier memdesc and only the stage-4 token recovery can save the token\n", ret); ret = gsp_phys_rmcall_alloc_channel(bar0); @@ -7396,7 +8465,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) if (gsp_phys_rmcall_engine_is_gr()) { ret = gsp_phys_rmcall_alloc_gr_object(bar0); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 3 aborted: TURING_COMPUTE_A (0xc5c0) engine object alloc failed (%d); the GR ladder has no engine object to bind and is not retried\n", + pr_err("vgsp-boot: rm-call: stage 3 aborted: TURING_COMPUTE_A (0xc5c0) engine object alloc failed (%d); the GR ladder has no engine object to bind and is not retried\n", ret); return ret; } @@ -7410,7 +8479,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) */ if (boot_stage.rmcall_gr_promote == GSP_PHYS_RMCALL_GR_PROMOTE_OFF) { - pr_info("gsp-phys-boot: rm-call: gr_promote_param=0: GPU_PROMOTE_CTX not sent; GR ctx prepared (pa=0x%llx va=0x%llx size=0x%x) and PDB-mapped, but not committed; the ladder stops before BIND/SCHEDULE/submit (safe half complete; set gsp_phys_rmcall_gr_promote=1/2/3 and reload to attempt the promote)\n", + pr_info("vgsp-boot: rm-call: gr_promote_param=0: GPU_PROMOTE_CTX not sent; GR ctx prepared (pa=0x%llx va=0x%llx size=0x%x) and PDB-mapped, but not committed; the ladder stops before BIND/SCHEDULE/submit (safe half complete; set gsp_phys_rmcall_gr_promote=1/2/3 and reload to attempt the promote)\n", boot_stage.rmcall_ctx_pa, boot_stage.rmcall_ctx_va, boot_stage.rmcall_ctx_size); @@ -7418,7 +8487,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) } ret = gsp_phys_rmcall_gr_ctx_promote(bar0); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 3 aborted: GPU_PROMOTE_CTX failed (%d); the GR context is not committed and BIND/SCHEDULE/submit are not attempted (no retry; UNLOAD + rmmod remains the fail-safe)\n", + pr_err("vgsp-boot: rm-call: stage 3 aborted: GPU_PROMOTE_CTX failed (%d); the GR context is not committed and BIND/SCHEDULE/submit are not attempted (no retry; UNLOAD + rmmod remains the fail-safe)\n", ret); return ret; } @@ -7433,7 +8502,7 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0) boot_stage.rmcall_gr_promote_size); else promote_suffix[0] = '\0'; - pr_info("gsp-phys-boot: rm-call: stage 3 complete: hVas=0x%x hTsg=0x%x hChannel=0x%x variant=V%u notifier=%s base=0x%llx userd=sysmem (host-writable) engine=%s%s%s (cid is server-assigned, request value ignored; token is requested in stage 4)\n", + pr_info("vgsp-boot: rm-call: stage 3 complete: hVas=0x%x hTsg=0x%x hChannel=0x%x variant=V%u notifier=%s base=0x%llx userd=sysmem (host-writable) engine=%s%s%s (cid is server-assigned, request value ignored; token is requested in stage 4)\n", boot_stage.rmcall_vas, boot_stage.rmcall_tsg, boot_stage.rmcall_channel, boot_stage.rmcall_channel_variant, boot_stage.rmcall_notifier_valid ? "FBMEM" : "none", @@ -7641,7 +8710,7 @@ static int gsp_phys_rmcall_ce_submit_locked(void __iomem *bar0, u64 src_va, gpput = get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPPUT_OFF); gpget = get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPGET_OFF); if (gpput >= GSP_PHYS_RMCALL_GPFIFO_ENTRIES) { - pr_err("gsp-phys-boot: rm-call: USERD GP_PUT=%u is outside the %u-entry ring; refusing to submit\n", + pr_err("vgsp-boot: rm-call: USERD GP_PUT=%u is outside the %u-entry ring; refusing to submit\n", gpput, GSP_PHYS_RMCALL_GPFIFO_ENTRIES); return -EIO; } @@ -7662,7 +8731,7 @@ static int gsp_phys_rmcall_ce_submit_locked(void __iomem *bar0, u64 src_va, */ e0 = (u32)pb_gpu_va & ~3u; if (unlikely(e0 != (u32)((pb_gpu_va >> 2) << 2))) - pr_err("gsp-phys-boot: rm-call: GPFIFO GET encode mismatch: e0=0x%08x decodes to fetch 0x%llx, expected pb VA 0x%llx\n", + pr_err("vgsp-boot: rm-call: GPFIFO GET encode mismatch: e0=0x%08x decodes to fetch 0x%llx, expected pb VA 0x%llx\n", e0, (u64)(e0 & ~3u), pb_gpu_va); e1 = (u32)((pb_gpu_va >> 32) & 0xffu) | (words << 10); put_unaligned_le32(e0, (u8 *)ring_va + slot * 8); @@ -7686,7 +8755,7 @@ static int gsp_phys_rmcall_ce_submit_locked(void __iomem *bar0, u64 src_va, ch_id = boot_stage.rmcall_token & 0xfffu; doorbell = ((runlist_id << 16) & 0x7f00000u) | (ch_id & 0xfffu); if (doorbell != boot_stage.rmcall_token) - pr_warn("gsp-phys-boot: rm-call: token 0x%x carries bits outside runlistId[22:16]|chId[11:0]; writing the recomposed doorbell 0x%x\n", + pr_warn("vgsp-boot: rm-call: token 0x%x carries bits outside runlistId[22:16]|chId[11:0]; writing the recomposed doorbell 0x%x\n", boot_stage.rmcall_token, doorbell); /* * C3: snapshot the fault epoch immediately before the doorbell, so a @@ -7746,13 +8815,13 @@ static int gsp_phys_rmcall_gr_sem_push_locked(void __iomem *bar0) GSP_PHYS_RMCALL_SEM_PAYLOAD, true, &sub); if (ret) { - pr_err("gsp-phys-boot: rm-call: GR submission refused before the doorbell (%d)\n", + pr_err("vgsp-boot: rm-call: GR submission refused before the doorbell (%d)\n", ret); return ret; } userd = gsp_phys_chunk_page_va(userd_c, 0); - pr_info("gsp-phys-boot: rm-call: GR submitted: pb=0x%llx pbVa=0x%llx gpFifoVa=0x%llx vaSem=0x%llx vaSrc=0x%llx vaDst=0x%llx userd=sysmem (host-writable) words=%u slot=%u (was GPGet=%u GPPut=%u) e0=0x%08x e1=0x%08x token=0x%08x (runlistId=%u chId=0x%x) doorbell=0x%08x @0x%x; polling sem=0x%llx for 0x%08x (<=%u ms)\n", + pr_info("vgsp-boot: rm-call: GR submitted: pb=0x%llx pbVa=0x%llx gpFifoVa=0x%llx vaSem=0x%llx vaSrc=0x%llx vaDst=0x%llx userd=sysmem (host-writable) words=%u slot=%u (was GPGet=%u GPPut=%u) e0=0x%08x e1=0x%08x token=0x%08x (runlistId=%u chId=0x%x) doorbell=0x%08x @0x%x; polling sem=0x%llx for 0x%08x (<=%u ms)\n", sub.pb_dma, GSP_PHYS_RMCALL_VA_PB, GSP_PHYS_RMCALL_VA_GPFIFO, GSP_PHYS_RMCALL_VA_SEM, GSP_PHYS_RMCALL_VA_SRC, GSP_PHYS_RMCALL_VA_DST, sub.words, sub.slot, sub.gpget, @@ -7771,7 +8840,7 @@ static int gsp_phys_rmcall_gr_sem_push_locked(void __iomem *bar0) GSP_PHYS_RMCALL_USERD_GPGET_OFF); gpput = get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPPUT_OFF); - pr_err("gsp-phys-boot: rm-call: REAL GR SEM FAILED: no release within %u ms (sem=0x%08x want=0x%08x GPGet=%u GPPut=%u engine=%s); the channel did not execute the GR block\n", + pr_err("vgsp-boot: rm-call: REAL GR SEM FAILED: no release within %u ms (sem=0x%08x want=0x%08x GPGet=%u GPPut=%u engine=%s); the channel did not execute the GR block\n", GSP_PHYS_RMCALL_TIMEOUT_MS, poll, GSP_PHYS_RMCALL_SEM_PAYLOAD, gpget, gpput, gsp_phys_rmcall_engine_name()); @@ -7782,7 +8851,7 @@ static int gsp_phys_rmcall_gr_sem_push_locked(void __iomem *bar0) } gpget = get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPGET_OFF); - pr_info("gsp-phys-boot: rm-call: REAL GR SEM OK sem=0x%08x want=0x%08x GPGet=%u GPPut=%u words=%u token=0x%08x\n", + pr_info("vgsp-boot: rm-call: REAL GR SEM OK sem=0x%08x want=0x%08x GPGet=%u GPPut=%u words=%u token=0x%08x\n", poll, GSP_PHYS_RMCALL_SEM_PAYLOAD, gpget, get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPPUT_OFF), sub.words, boot_stage.rmcall_token); @@ -7957,7 +9026,7 @@ int gsp_phys_backend_ce_copy_submit(u64 src_va, u64 dst_va, u64 sem_va, mutex_unlock(&gsp_phys_rm_lock); gsp_phys_work_refused++; if ((gsp_phys_work_refused & 63) == 1) - pr_info("gsp-phys-work: shadow submit refused before the doorbell (backend changed) refused=%llu\n", + pr_info("vgsp-work: shadow submit refused before the doorbell (backend changed) refused=%llu\n", gsp_phys_work_refused); return -EAGAIN; } @@ -7969,7 +9038,7 @@ int gsp_phys_backend_ce_copy_submit(u64 src_va, u64 dst_va, u64 sem_va, if (ret) { gsp_phys_work_refused++; if ((gsp_phys_work_refused & 63) == 1) - pr_info("gsp-phys-work: shadow submit refused (ret %d) refused=%llu\n", + pr_info("vgsp-work: shadow submit refused (ret %d) refused=%llu\n", ret, gsp_phys_work_refused); return ret; } @@ -7987,7 +9056,7 @@ int gsp_phys_backend_ce_copy_submit(u64 src_va, u64 dst_va, u64 sem_va, if (time_after_eq(jiffies, deadline)) { gsp_phys_work_timed_out++; if ((gsp_phys_work_timed_out & 63) == 1) - pr_info("gsp-phys-work: shadow copy timeout after %u ms (sem=0x%08x want=0x%08x) timeouts=%llu\n", + pr_info("vgsp-work: shadow copy timeout after %u ms (sem=0x%08x want=0x%08x) timeouts=%llu\n", poll_ms, poll, GSP_PHYS_RMCALL_SEM_PAYLOAD, gsp_phys_work_timed_out); @@ -8007,7 +9076,7 @@ int gsp_phys_backend_ce_copy_submit(u64 src_va, u64 dst_va, u64 sem_va, memcmp(gsp_phys_chunk_page_va(src, 0), gsp_phys_chunk_page_va(dst, 0), bytes) != 0) { gsp_phys_work_refused++; - pr_info("gsp-phys-work: semaphore observed but the destination does not match the source after %u bytes (refused=%llu)\n", + pr_info("vgsp-work: semaphore observed but the destination does not match the source after %u bytes (refused=%llu)\n", bytes, gsp_phys_work_refused); return -EIO; } @@ -8333,7 +9402,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, (u64)src_off + bytes > GSP_PHYS_RMCALL_COPY_SIZE || (u64)dst_off + bytes > GSP_PHYS_RMCALL_COPY_SIZE) { gsp_phys_guest_refused++; - pr_err("gsp-phys-work: GUEST CE COPY FAILED: invalid operands src_hpa=0x%llx src_off=%u dst_hpa=0x%llx dst_off=%u bytes=%u (want page-aligned HPAs, 4..%u bytes, 4-aligned, in-page)\n", + pr_err("vgsp-work: GUEST CE COPY FAILED: invalid operands src_hpa=0x%llx src_off=%u dst_hpa=0x%llx dst_off=%u bytes=%u (want page-aligned HPAs, 4..%u bytes, 4-aligned, in-page)\n", src_hpa, src_off, dst_hpa, dst_off, bytes, GSP_PHYS_RMCALL_COPY_SIZE); ret = -EINVAL; @@ -8343,7 +9412,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, (!IS_ALIGNED(sem_hpa, GSP_PHYS_PAGE_SIZE) || (u64)sem_off + 4 > bytes || !sem_payload)) { gsp_phys_relay_refused++; - pr_err("gsp-phys-work: GUEST CE RELAY FAILED: invalid semaphore relay sem_hpa=0x%llx sem_off=%u sem_payload=0x%08x bytes=%u (want a page-aligned HPA, sem_off+4 <= copy size, nonzero payload)\n", + pr_err("vgsp-work: GUEST CE RELAY FAILED: invalid semaphore relay sem_hpa=0x%llx sem_off=%u sem_payload=0x%08x bytes=%u (want a page-aligned HPA, sem_off+4 <= copy size, nonzero payload)\n", sem_hpa, sem_off, sem_payload, bytes); ret = -EINVAL; goto out; @@ -8353,7 +9422,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, if (!pfn_valid(pfn)) { gsp_phys_relay_refused++; - pr_err("gsp-phys-work: GUEST CE RELAY FAILED: semaphore HPA 0x%llx is not a valid RAM page\n", + pr_err("vgsp-work: GUEST CE RELAY FAILED: semaphore HPA 0x%llx is not a valid RAM page\n", sem_hpa); ret = -EINVAL; goto out; @@ -8413,14 +9482,14 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, if (relay) { gsp_phys_relay_pool_exhausted++; if ((gsp_phys_relay_pool_exhausted & 63) == 1) - pr_err("gsp-phys-work: GUEST CE RELAY FAILED: scratch-PT pool exhausted (no line reuse) pool_exhausted=%llu capacity=%u; falling back to the software release\n", + pr_err("vgsp-work: GUEST CE RELAY FAILED: scratch-PT pool exhausted (no line reuse) pool_exhausted=%llu capacity=%u; falling back to the software release\n", gsp_phys_relay_pool_exhausted, GSP_PHYS_RMCALL_GUEST_PT_PAGES * GSP_PHYS_RMCALL_GUEST_PT_LINES_PER_PAGE); } else { gsp_phys_guest_pool_exhausted++; if ((gsp_phys_guest_pool_exhausted & 63) == 1) - pr_err("gsp-phys-work: GUEST CE COPY FAILED: scratch-PT pool exhausted (no line reuse) pool_exhausted=%llu capacity=%u; falling back to the ladder path\n", + pr_err("vgsp-work: GUEST CE COPY FAILED: scratch-PT pool exhausted (no line reuse) pool_exhausted=%llu capacity=%u; falling back to the ladder path\n", gsp_phys_guest_pool_exhausted, GSP_PHYS_RMCALL_GUEST_PT_PAGES * GSP_PHYS_RMCALL_GUEST_PT_LINES_PER_PAGE); @@ -8430,7 +9499,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, gsp_phys_relay_refused++; else gsp_phys_guest_refused++; - pr_err("gsp-phys-work: GUEST CE COPY FAILED: scratch PT not usable (%d) src_hpa=0x%llx dst_hpa=0x%llx\n", + pr_err("vgsp-work: GUEST CE COPY FAILED: scratch PT not usable (%d) src_hpa=0x%llx dst_hpa=0x%llx\n", ret, src_hpa, dst_hpa); } mutex_unlock(&gsp_phys_rm_lock); @@ -8458,7 +9527,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, gsp_phys_relay_refused++; else gsp_phys_guest_refused++; - pr_err("gsp-phys-work: GUEST CE COPY FAILED: submit refused (%d) src_hpa=0x%llx dst_hpa=0x%llx bytes=%u\n", + pr_err("vgsp-work: GUEST CE COPY FAILED: submit refused (%d) src_hpa=0x%llx dst_hpa=0x%llx bytes=%u\n", ret, src_hpa, dst_hpa, bytes); goto out; } @@ -8481,7 +9550,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, if (time_after_eq(jiffies, deadline)) { if (relay) { gsp_phys_relay_timed_out++; - pr_err("gsp-phys-work: GUEST CE RELAY FAILED: timeout after %u ms (guest sem=0x%08x want=0x%08x) sem_hpa=0x%llx+%u src_hpa=0x%llx dst_hpa=0x%llx bytes=%u\n", + pr_err("vgsp-work: GUEST CE RELAY FAILED: timeout after %u ms (guest sem=0x%08x want=0x%08x) sem_hpa=0x%llx+%u src_hpa=0x%llx dst_hpa=0x%llx bytes=%u\n", poll_ms, poll, sem_payload, sem_hpa, sem_off, src_hpa, dst_hpa, bytes); /* @@ -8510,7 +9579,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, } } else { gsp_phys_guest_refused++; - pr_err("gsp-phys-work: GUEST CE COPY FAILED: timeout after %u ms (sem=0x%08x want=0x%08x) src_hpa=0x%llx dst_hpa=0x%llx bytes=%u\n", + pr_err("vgsp-work: GUEST CE COPY FAILED: timeout after %u ms (sem=0x%08x want=0x%08x) src_hpa=0x%llx dst_hpa=0x%llx bytes=%u\n", poll_ms, poll, GSP_PHYS_RMCALL_SEM_PAYLOAD, src_hpa, dst_hpa, bytes); @@ -8532,7 +9601,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, (u8 *)__va(src_hpa) + src_off, bytes) != 0) { if (!relay) { gsp_phys_guest_verify_fail++; - pr_err("gsp-phys-work: GUEST CE COPY FAILED: semaphore released (sem=0x%08x) but HPA dst 0x%llx+%u does not match src 0x%llx+%u after %u bytes\n", + pr_err("vgsp-work: GUEST CE COPY FAILED: semaphore released (sem=0x%08x) but HPA dst 0x%llx+%u does not match src 0x%llx+%u after %u bytes\n", poll, dst_hpa, dst_off, src_hpa, src_off, bytes); ret = -EIO; @@ -8578,7 +9647,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, snap_dst_diff = memcmp(dp, snap, bytes) != 0; } - pr_err("gsp-phys-work: GUEST CE RELAY FAILED: semaphore released (sem=0x%08x) but HPA dst 0x%llx+%u does not match src 0x%llx+%u after %u bytes (retried after 2 ms) diff@%u dst=%s src=%s snap=%s src_mutated=%u snap_vs_dst=%u sem_hpa=0x%llx+%u payload=0x%08x poll=0x%08x elapsed_ms=%u verify_fail=%llu verify_transient=%llu\n", + pr_err("vgsp-work: GUEST CE RELAY FAILED: semaphore released (sem=0x%08x) but HPA dst 0x%llx+%u does not match src 0x%llx+%u after %u bytes (retried after 2 ms) diff@%u dst=%s src=%s snap=%s src_mutated=%u snap_vs_dst=%u sem_hpa=0x%llx+%u payload=0x%08x poll=0x%08x elapsed_ms=%u verify_fail=%llu verify_transient=%llu\n", poll, dst_hpa, dst_off, src_hpa, src_off, bytes, diff, dbuf, sbuf, snap_str, src_mutated, snap_dst_diff, @@ -8592,7 +9661,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, } gsp_phys_relay_verify_transient++; if ((gsp_phys_relay_verify_transient & 63) == 1) - pr_info("gsp-phys-work: GUEST CE RELAY transient data mismatch resolved on retry src_hpa=0x%llx dst_hpa=0x%llx bytes=%u transient=%llu\n", + pr_info("vgsp-work: GUEST CE RELAY transient data mismatch resolved on retry src_hpa=0x%llx dst_hpa=0x%llx bytes=%u transient=%llu\n", src_hpa, dst_hpa, bytes, gsp_phys_relay_verify_transient); } @@ -8602,7 +9671,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, if (relay) { gsp_phys_relay_ok++; if (gsp_phys_relay_ok == 1 || (gsp_phys_relay_ok & 63) == 0) - pr_info("gsp-phys-work: GUEST CE RELAY OK src_hpa=0x%llx dst_hpa=0x%llx bytes=%u sem_hpa=0x%llx+%u sem=0x%08x relays=%llu\n", + pr_info("vgsp-work: GUEST CE RELAY OK src_hpa=0x%llx dst_hpa=0x%llx bytes=%u sem_hpa=0x%llx+%u sem=0x%08x relays=%llu\n", src_hpa, dst_hpa, bytes, sem_hpa, sem_off, poll, gsp_phys_relay_ok); } else { @@ -8610,7 +9679,7 @@ static int gsp_phys_guest_ce_copy_common(u64 src_hpa, u32 src_off, u64 dst_hpa, gsp_phys_guest_fwd_ok++; if (gsp_phys_guest_fwd_ok == 1 || (gsp_phys_guest_fwd_ok & 63) == 0) - pr_info("gsp-phys-work: GUEST CE COPY OK src_hpa=0x%llx dst_hpa=0x%llx bytes=%u sem=0x%08x verify_ok=1 copied=%llu\n", + pr_info("vgsp-work: GUEST CE COPY OK src_hpa=0x%llx dst_hpa=0x%llx bytes=%u sem=0x%08x verify_ok=1 copied=%llu\n", src_hpa, dst_hpa, bytes, poll, gsp_phys_guest_fwd_ok); } @@ -8722,18 +9791,18 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) * submitted. Distinct error, nothing is scheduled or rung. */ if (boot_stage.rmcall_channel_server_mem) { - pr_err("gsp-phys-boot: rm-call: stage 4 unavailable: winning channel variant V%u (server-allocated mem) has no client GPFIFO/USERD; submission requires a client-memory variant (V5 tsg-vas-pdb-skip-scrubber, V1 ref-device-skip-scrubber or V4 current-control)\n", + pr_err("vgsp-boot: rm-call: stage 4 unavailable: winning channel variant V%u (server-allocated mem) has no client GPFIFO/USERD; submission requires a client-memory variant (V5 tsg-vas-pdb-skip-scrubber, V1 ref-device-skip-scrubber or V4 current-control)\n", boot_stage.rmcall_channel_variant); return -EOPNOTSUPP; } if (!boot_stage.pdev) { - pr_err("gsp-phys-boot: rm-call: stage 4 has no claimed pci_dev for the BAR0 length\n"); + pr_err("vgsp-boot: rm-call: stage 4 has no claimed pci_dev for the BAR0 length\n"); return -EINVAL; } bar0_len = pci_resource_len(boot_stage.pdev, 0); if (bar0_len < GSP_PHYS_RMCALL_DOORBELL_OFF + 4) { - pr_err("gsp-phys-boot: rm-call: BAR0 length 0x%llx does not cover the PF doorbell at 0x%x\n", + pr_err("vgsp-boot: rm-call: BAR0 length 0x%llx does not cover the PF doorbell at 0x%x\n", (u64)bar0_len, GSP_PHYS_RMCALL_DOORBELL_OFF); return -EIO; } @@ -8747,7 +9816,7 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) NULL, 0, &rpc_result, &status, "BIND_CHANNEL"); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 4 aborted before the doorbell: BIND_CHANNEL (0xa06f0104 engineType=0x%x) failed (rpc_result=0x%x status=0x%x)\n", + pr_err("vgsp-boot: rm-call: stage 4 aborted before the doorbell: BIND_CHANNEL (0xa06f0104 engineType=0x%x) failed (rpc_result=0x%x status=0x%x)\n", bind_params, rpc_result, status); return ret; } @@ -8761,7 +9830,7 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) NULL, 0, &rpc_result, &status, "GPFIFO_SCHEDULE"); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 4 aborted before the doorbell: GPFIFO_SCHEDULE (0xa06f0103 bEnable=1 bSkipSubmit=0) failed (rpc_result=0x%x status=0x%x)\n", + pr_err("vgsp-boot: rm-call: stage 4 aborted before the doorbell: GPFIFO_SCHEDULE (0xa06f0103 bEnable=1 bSkipSubmit=0) failed (rpc_result=0x%x status=0x%x)\n", rpc_result, status); return ret; } @@ -8784,10 +9853,10 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) NULL, 0, &rpc_result, &status, "TSG_GPFIFO_SCHEDULE"); if (ret) - pr_warn("gsp-phys-boot: rm-call: TSG_GPFIFO_SCHEDULE (0xa06c0101 bEnable=1 bSkipSubmit=0 on hTsg=0x%x) advisory failure: rpc_result=0x%x status=0x%x; the channel-level schedule already set RUNLIST_SET, continuing\n", + pr_warn("vgsp-boot: rm-call: TSG_GPFIFO_SCHEDULE (0xa06c0101 bEnable=1 bSkipSubmit=0 on hTsg=0x%x) advisory failure: rpc_result=0x%x status=0x%x; the channel-level schedule already set RUNLIST_SET, continuing\n", boot_stage.rmcall_tsg, rpc_result, status); else - pr_info("gsp-phys-boot: rm-call: TSG_GPFIFO_SCHEDULE 0xa06c0101 on hTsg=0x%x accepted (rpc_result=0x%x status=0x%x)\n", + pr_info("vgsp-boot: rm-call: TSG_GPFIFO_SCHEDULE 0xa06c0101 on hTsg=0x%x accepted (rpc_result=0x%x status=0x%x)\n", boot_stage.rmcall_tsg, rpc_result, status); /* @@ -8806,10 +9875,10 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) NULL, 0, &rpc_result, &status, "SET_WORK_SUBMIT_TOKEN_NOTIF_INDEX"); if (ret) - pr_warn("gsp-phys-boot: rm-call: SET_WORK_SUBMIT_TOKEN_NOTIF_INDEX (0xc36f010a index=%u) advisory failure: rpc_result=0x%x status=0x%x (no error-context object: hErrorContext=0); the work-submit token is generated independently of the notifier, continuing to GET_WORK_SUBMIT_TOKEN\n", + pr_warn("vgsp-boot: rm-call: SET_WORK_SUBMIT_TOKEN_NOTIF_INDEX (0xc36f010a index=%u) advisory failure: rpc_result=0x%x status=0x%x (no error-context object: hErrorContext=0); the work-submit token is generated independently of the notifier, continuing to GET_WORK_SUBMIT_TOKEN\n", notif_index, rpc_result, status); else - pr_info("gsp-phys-boot: rm-call: SET_WORK_SUBMIT_TOKEN_NOTIF_INDEX 0xc36f010a index=%u accepted (rpc_result=0x%x status=0x%x)\n", + pr_info("vgsp-boot: rm-call: SET_WORK_SUBMIT_TOKEN_NOTIF_INDEX 0xc36f010a index=%u accepted (rpc_result=0x%x status=0x%x)\n", notif_index, rpc_result, status); /* @@ -8828,17 +9897,17 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) sizeof(token), &rpc_result, &status, "GET_WORK_SUBMIT_TOKEN"); if (ret && token != 0) { - pr_warn("gsp-phys-boot: rm-call: GET_WORK_SUBMIT_TOKEN failed (rpc_result=0x%x status=0x%x) but the echoed params carry token=0x%x; the server wrote it before the notifier update, proceeding to submission\n", + pr_warn("vgsp-boot: rm-call: GET_WORK_SUBMIT_TOKEN failed (rpc_result=0x%x status=0x%x) but the echoed params carry token=0x%x; the server wrote it before the notifier update, proceeding to submission\n", rpc_result, status, token); ret = 0; } if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 4 aborted before the doorbell: GET_WORK_SUBMIT_TOKEN (0xc36f0108 after BIND/SCHEDULE/notif-index=%u) failed (rpc_result=0x%x status=0x%x token=0x%x); refusing to ring the doorbell\n", + pr_err("vgsp-boot: rm-call: stage 4 aborted before the doorbell: GET_WORK_SUBMIT_TOKEN (0xc36f0108 after BIND/SCHEDULE/notif-index=%u) failed (rpc_result=0x%x status=0x%x token=0x%x); refusing to ring the doorbell\n", notif_index, rpc_result, status, token); return ret; } if (!token) { - pr_err("gsp-phys-boot: rm-call: stage 4 aborted before the doorbell: GET_WORK_SUBMIT_TOKEN returned a zero token; refusing to ring the doorbell\n"); + pr_err("vgsp-boot: rm-call: stage 4 aborted before the doorbell: GET_WORK_SUBMIT_TOKEN returned a zero token; refusing to ring the doorbell\n"); return -EIO; } boot_stage.rmcall_token = token; @@ -8853,7 +9922,7 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) if (gsp_phys_rmcall_engine_is_gr()) { ret = gsp_phys_rmcall_gr_sem_push_locked(bar0); if (ret) - pr_err("gsp-phys-boot: rm-call: stage 4 GR path failed (%d); no retry\n", + pr_err("vgsp-boot: rm-call: stage 4 GR path failed (%d); no retry\n", ret); return ret; } @@ -8874,12 +9943,12 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) GSP_PHYS_RMCALL_SEM_PAYLOAD, false, &sub); if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 4 aborted before the doorbell: submission refused (%d)\n", + pr_err("vgsp-boot: rm-call: stage 4 aborted before the doorbell: submission refused (%d)\n", ret); return ret; } - pr_info("gsp-phys-boot: rm-call: submitted: pb=0x%llx pbVa=0x%llx gpFifoVa=0x%llx vaSrc=0x%llx vaDst=0x%llx vaSem=0x%llx userd=sysmem (host-writable) words=%u slot=%u (was GPGet=%u GPPut=%u) e0=0x%08x e1=0x%08x token=0x%08x (runlistId=%u chId=0x%x) doorbell=0x%08x @0x%x; polling sem=0x%llx for 0x%08x (<=%u ms)\n", + pr_info("vgsp-boot: rm-call: submitted: pb=0x%llx pbVa=0x%llx gpFifoVa=0x%llx vaSrc=0x%llx vaDst=0x%llx vaSem=0x%llx userd=sysmem (host-writable) words=%u slot=%u (was GPGet=%u GPPut=%u) e0=0x%08x e1=0x%08x token=0x%08x (runlistId=%u chId=0x%x) doorbell=0x%08x @0x%x; polling sem=0x%llx for 0x%08x (<=%u ms)\n", sub.pb_dma, GSP_PHYS_RMCALL_VA_PB, GSP_PHYS_RMCALL_VA_GPFIFO, GSP_PHYS_RMCALL_VA_SRC, GSP_PHYS_RMCALL_VA_DST, GSP_PHYS_RMCALL_VA_SEM, @@ -8898,7 +9967,7 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) GSP_PHYS_RMCALL_USERD_GPGET_OFF); gpput = get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPPUT_OFF); - pr_err("gsp-phys-boot: rm-call: no semaphore release within %u ms (sem=0x%08x want=0x%08x GPGet=%u GPPut=%u); the channel did not execute the CE block\n", + pr_err("vgsp-boot: rm-call: no semaphore release within %u ms (sem=0x%08x want=0x%08x GPGet=%u GPPut=%u); the channel did not execute the CE block\n", GSP_PHYS_RMCALL_TIMEOUT_MS, poll, GSP_PHYS_RMCALL_SEM_PAYLOAD, gpget, gpput); /* @@ -8917,13 +9986,13 @@ static int gsp_phys_rmcall_stage4(void __iomem *bar0) if (memcmp(gsp_phys_chunk_page_va(src, 0), gsp_phys_chunk_page_va(dst, 0), GSP_PHYS_RMCALL_COPY_SIZE) != 0) { - pr_err("gsp-phys-boot: rm-call: semaphore released but the destination does not match the source after %u bytes\n", + pr_err("vgsp-boot: rm-call: semaphore released but the destination does not match the source after %u bytes\n", GSP_PHYS_RMCALL_COPY_SIZE); return -EIO; } gpget = get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPGET_OFF); - pr_info("gsp-phys-boot: rm-call: REAL COPY OK sem=0x%08x src=0x%llx dst=0x%llx bytes=%u GPGet=%u GPPut=%u words=%u token=0x%08x\n", + pr_info("vgsp-boot: rm-call: REAL COPY OK sem=0x%08x src=0x%llx dst=0x%llx bytes=%u GPGet=%u GPPut=%u words=%u token=0x%08x\n", poll, sub.src_dma, sub.dst_dma, GSP_PHYS_RMCALL_COPY_SIZE, gpget, get_unaligned_le32((u8 *)userd + GSP_PHYS_RMCALL_USERD_GPPUT_OFF), sub.words, boot_stage.rmcall_token); @@ -8951,7 +10020,7 @@ static int gsp_phys_rmcall_gr_sem_rerun(void __iomem *bar0) !boot_stage.rmcall_channel || !boot_stage.rmcall_gr_object || !boot_stage.rmcall_token || boot_stage.rmcall_stage < 3) { mutex_unlock(&gsp_phys_rm_lock); - pr_info("gsp-phys-boot: gsp-phys-rm-call: trigger 9 no-op: requires the GR ladder through stage 3 (gr=%u claimed=%u init_done=%u unload=%u hChannel=0x%x hGr=0x%x token=0x%x stage=%u)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: trigger 9 no-op: requires the GR ladder through stage 3 (gr=%u claimed=%u init_done=%u unload=%u hChannel=0x%x hGr=0x%x token=0x%x stage=%u)\n", gsp_phys_rmcall_engine_is_gr(), gsp_phys_gpu_claimed(), boot_stage.rm_init_done, boot_stage.rm_unload_submitted, boot_stage.rmcall_channel, boot_stage.rmcall_gr_object, @@ -8979,12 +10048,12 @@ static int gsp_phys_rmcall_stage5(void __iomem *bar0) if (!boot_stage.rm_probe_done || !boot_stage.rm_probe_internal_valid) { u32 tx_before = boot_stage.tx_seq_num; - pr_info("gsp-phys-boot: rm-call: stage 5: no persisted static-config handles in this session; running the rm-probe cycle inline (fn1 then fn65)\n"); + pr_info("vgsp-boot: rm-call: stage 5: no persisted static-config handles in this session; running the rm-probe cycle inline (fn1 then fn65)\n"); ret = gsp_phys_rm_probe_cycle(bar0); /* Count the inline probe's submitted RPCs in the ladder total. */ boot_stage.rmcall_rpcs += boot_stage.tx_seq_num - tx_before; if (ret) { - pr_err("gsp-phys-boot: rm-call: stage 5: inline rm-probe failed (%d); cannot adopt internal handles\n", + pr_err("vgsp-boot: rm-call: stage 5: inline rm-probe failed (%d); cannot adopt internal handles\n", ret); return ret; } @@ -8994,7 +10063,7 @@ static int gsp_phys_rmcall_stage5(void __iomem *bar0) !boot_stage.rm_probe_h_internal_client || !boot_stage.rm_probe_h_internal_device || !boot_stage.rm_probe_h_internal_subdevice) { - pr_err("gsp-phys-boot: rm-call: stage 5: static config carries no usable internal handles (valid=%u hClient=0x%x hDevice=0x%x hSubdevice=0x%x)\n", + pr_err("vgsp-boot: rm-call: stage 5: static config carries no usable internal handles (valid=%u hClient=0x%x hDevice=0x%x hSubdevice=0x%x)\n", boot_stage.rm_probe_internal_valid, boot_stage.rm_probe_h_internal_client, boot_stage.rm_probe_h_internal_device, @@ -9005,7 +10074,7 @@ static int gsp_phys_rmcall_stage5(void __iomem *bar0) boot_stage.rmcall_client = boot_stage.rm_probe_h_internal_client; boot_stage.rmcall_device = boot_stage.rm_probe_h_internal_device; boot_stage.rmcall_subdevice = boot_stage.rm_probe_h_internal_subdevice; - pr_info("gsp-phys-boot: rm-call: stage 5: adopted server internal handles: hClient=0x%x hDevice=0x%x hSubdevice=0x%x (stage 1 satisfied by adoption; write 4 to run stages 2-4 with them)\n", + pr_info("vgsp-boot: rm-call: stage 5: adopted server internal handles: hClient=0x%x hDevice=0x%x hSubdevice=0x%x (stage 1 satisfied by adoption; write 4 to run stages 2-4 with them)\n", boot_stage.rmcall_client, boot_stage.rmcall_device, boot_stage.rmcall_subdevice); return 0; @@ -9048,7 +10117,7 @@ static void gsp_phys_rmcall_guest_hpa_note(u64 gpa, u64 hpa) boot_stage.rmcall_guest_hpa_note_logged) return; boot_stage.rmcall_guest_hpa_note_logged = true; - pr_info("gsp-phys-boot: rm-call: guest HPA changed: gpa=0x%llx was 0x%llx now 0x%llx (re-translated at trigger time; informational, not a failure)\n", + pr_info("vgsp-boot: rm-call: guest HPA changed: gpa=0x%llx was 0x%llx now 0x%llx (re-translated at trigger time; informational, not a failure)\n", gpa, boot_stage.rmcall_guest_hpa, hpa); } @@ -9065,14 +10134,14 @@ static int gsp_phys_rmcall_guest_g2h(void __iomem *bar0) dom = gsp_phys_dma_domain_identity(); if (dom != 1) { - pr_err("gsp-phys-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: physical device DMA domain is not identity (flag=%d); raw HPAs in the channel PTE would be interpreted as IOVAs\n", + pr_err("vgsp-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: physical device DMA domain is not identity (flag=%d); raw HPAs in the channel PTE would be interpreted as IOVAs\n", hpa, pte, dom); return -EIO; } ret = gsp_phys_gpa_to_hpa(gpa, &hpa); if (ret) { - pr_err("gsp-phys-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: GPA 0x%llx -> HPA translation failed (%d: no active mdev/VFIO domain, GPA unmapped, or not a RAM PFN)\n", + pr_err("vgsp-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: GPA 0x%llx -> HPA translation failed (%d: no active mdev/VFIO domain, GPA unmapped, or not a RAM PFN)\n", hpa, pte, gpa, ret); return -EIO; } @@ -9089,13 +10158,13 @@ static int gsp_phys_rmcall_guest_g2h(void __iomem *bar0) hpa, 0, (u64)gsp_phys_chunk_page_dma(dst, 0), 0, GSP_PHYS_RMCALL_COPY_SIZE, GSP_PHYS_RMCALL_GUEST_POLL_MS, &sem); if (ret) { - pr_err("gsp-phys-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: CE submit/poll failed (%d, sem=0x%08x want=0x%08x)\n", + pr_err("vgsp-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: CE submit/poll failed (%d, sem=0x%08x want=0x%08x)\n", hpa, pte, ret, sem, GSP_PHYS_RMCALL_SEM_PAYLOAD); return -EIO; } if (memcmp(dst_page, __va(hpa), GSP_PHYS_RMCALL_COPY_SIZE) != 0) { - pr_err("gsp-phys-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: semaphore released (sem=0x%08x) but DST does not match the guest page at hpa=0x%llx (gpa=0x%llx)\n", + pr_err("vgsp-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: semaphore released (sem=0x%08x) but DST does not match the guest page at hpa=0x%llx (gpa=0x%llx)\n", hpa, pte, sem, hpa, gpa); return -EIO; } @@ -9111,7 +10180,7 @@ static int gsp_phys_rmcall_guest_g2h(void __iomem *bar0) for (i = 0; i < GSP_PHYS_RMCALL_COPY_SIZE; i++) { if (dst_page[i] != (u8)(0xa5 ^ (i & 0xff))) { /* Dump both heads to tell a bad translation from a bad copy. */ - pr_err("gsp-phys-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: translated page at hpa=0x%llx (gpa=0x%llx) does not carry the guest probe pattern; refusing to arm the write direction; page[0..15]=%16phN dst[0..15]=%16phN\n", + pr_err("vgsp-boot: rm-call: GUEST G2H COPY FAILED: hpa=0x%llx pte=0x%016llx: translated page at hpa=0x%llx (gpa=0x%llx) does not carry the guest probe pattern; refusing to arm the write direction; page[0..15]=%16phN dst[0..15]=%16phN\n", hpa, pte, hpa, gpa, __va(hpa), dst_page); return -EIO; } @@ -9119,7 +10188,7 @@ static int gsp_phys_rmcall_guest_g2h(void __iomem *bar0) boot_stage.rmcall_guest_hpa = hpa; boot_stage.rmcall_guest_r_ok = true; - pr_info("gsp-phys-boot: rm-call: GUEST G2H COPY OK gpa=0x%llx hpa=0x%llx bytes=%u sem=0x%08x\n", + pr_info("vgsp-boot: rm-call: GUEST G2H COPY OK gpa=0x%llx hpa=0x%llx bytes=%u sem=0x%08x\n", gpa, hpa, GSP_PHYS_RMCALL_COPY_SIZE, sem); return 0; } @@ -9141,21 +10210,21 @@ static int gsp_phys_rmcall_guest_w2g(void __iomem *bar0) * guest memory. */ if (!boot_stage.rmcall_guest_r_ok) { - pr_err("gsp-phys-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: trigger 7 (G2H) has not proved the GPA->HPA translation in this boot; refusing to write the guest direction first\n", + pr_err("vgsp-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: trigger 7 (G2H) has not proved the GPA->HPA translation in this boot; refusing to write the guest direction first\n", hpa, pte); return -EIO; } dom = gsp_phys_dma_domain_identity(); if (dom != 1) { - pr_err("gsp-phys-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: physical device DMA domain is not identity (flag=%d); raw HPAs in the channel PTE would be interpreted as IOVAs\n", + pr_err("vgsp-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: physical device DMA domain is not identity (flag=%d); raw HPAs in the channel PTE would be interpreted as IOVAs\n", hpa, pte, dom); return -EIO; } ret = gsp_phys_gpa_to_hpa(gpa, &hpa); if (ret) { - pr_err("gsp-phys-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: GPA 0x%llx -> HPA translation failed (%d: no active mdev/VFIO domain, GPA unmapped, or not a RAM PFN)\n", + pr_err("vgsp-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: GPA 0x%llx -> HPA translation failed (%d: no active mdev/VFIO domain, GPA unmapped, or not a RAM PFN)\n", hpa, pte, gpa, ret); return -EIO; } @@ -9174,7 +10243,7 @@ static int gsp_phys_rmcall_guest_w2g(void __iomem *bar0) for (i = 0; i < GSP_PHYS_RMCALL_COPY_SIZE; i++) { if (((const u8 *)__va(hpa))[i] != (u8)(0xa5 ^ (i & 0xff))) { /* Dump the head so the stale contents can be compared. */ - pr_err("gsp-phys-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: guest page at hpa=0x%llx changed since the G2H proof; refusing to write; page[0..15]=%16phN\n", + pr_err("vgsp-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: guest page at hpa=0x%llx changed since the G2H proof; refusing to write; page[0..15]=%16phN\n", hpa, pte, hpa, __va(hpa)); return -EIO; } @@ -9188,20 +10257,20 @@ static int gsp_phys_rmcall_guest_w2g(void __iomem *bar0) (u64)gsp_phys_chunk_page_dma(src, 0), 0, hpa, 0, GSP_PHYS_RMCALL_COPY_SIZE, GSP_PHYS_RMCALL_GUEST_POLL_MS, &sem); if (ret) { - pr_err("gsp-phys-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: CE submit/poll failed (%d, sem=0x%08x want=0x%08x)\n", + pr_err("vgsp-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: CE submit/poll failed (%d, sem=0x%08x want=0x%08x)\n", hpa, pte, ret, sem, GSP_PHYS_RMCALL_SEM_PAYLOAD); return -EIO; } if (memcmp(__va(hpa), src_page, GSP_PHYS_RMCALL_COPY_SIZE) != 0) { - pr_err("gsp-phys-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: semaphore released (sem=0x%08x) but the guest page at hpa=0x%llx (gpa=0x%llx) does not match SRC\n", + pr_err("vgsp-boot: rm-call: GUEST W2G COPY FAILED: hpa=0x%llx pte=0x%016llx: semaphore released (sem=0x%08x) but the guest page at hpa=0x%llx (gpa=0x%llx) does not match SRC\n", hpa, pte, sem, hpa, gpa); return -EIO; } boot_stage.rmcall_guest_hpa = hpa; boot_stage.rmcall_guest_w2g_ok = true; - pr_info("gsp-phys-boot: rm-call: GUEST W2G COPY OK gpa=0x%llx hpa=0x%llx bytes=%u sem=0x%08x\n", + pr_info("vgsp-boot: rm-call: GUEST W2G COPY OK gpa=0x%llx hpa=0x%llx bytes=%u sem=0x%08x\n", gpa, hpa, GSP_PHYS_RMCALL_COPY_SIZE, sem); return 0; } @@ -9238,7 +10307,7 @@ static int gsp_phys_rmcall_guest_selftest(void __iomem *bar0) src_page = gsp_phys_chunk_page_va(src, 0); dst_page = gsp_phys_chunk_page_va(dst, 0); if (!src_page || !dst_page || !gsp_phys_chunk_page_va(pt, 0)) { - pr_err("gsp-phys-boot: rm-call: GUEST PTE SELFTEST FAILED: ladder chunk mapping missing (src=%p dst=%p pt=%p) src_dma=0x%llx\n", + pr_err("vgsp-boot: rm-call: GUEST PTE SELFTEST FAILED: ladder chunk mapping missing (src=%p dst=%p pt=%p) src_dma=0x%llx\n", src_page, dst_page, gsp_phys_chunk_page_va(pt, 0), src_dma); return -EIO; @@ -9257,20 +10326,20 @@ static int gsp_phys_rmcall_guest_selftest(void __iomem *bar0) GSP_PHYS_RMCALL_VA_SEM, GSP_PHYS_RMCALL_COPY_SIZE, &sem); if (ret) { - pr_err("gsp-phys-boot: rm-call: GUEST PTE SELFTEST FAILED: CE submit/poll failed (%d, sem=0x%08x want=0x%08x) src_dma=0x%llx pt[0x%x]=0x%016llx\n", + pr_err("vgsp-boot: rm-call: GUEST PTE SELFTEST FAILED: CE submit/poll failed (%d, sem=0x%08x want=0x%08x) src_dma=0x%llx pt[0x%x]=0x%016llx\n", ret, sem, GSP_PHYS_RMCALL_SEM_PAYLOAD, src_dma, pt_idx, pte); return -EIO; } if (memcmp(dst_page, src_page, GSP_PHYS_RMCALL_COPY_SIZE) != 0) { - pr_err("gsp-phys-boot: rm-call: GUEST PTE SELFTEST FAILED: semaphore released (sem=0x%08x) but DST does not match SRC src_dma=0x%llx pt[0x%x]=0x%016llx\n", + pr_err("vgsp-boot: rm-call: GUEST PTE SELFTEST FAILED: semaphore released (sem=0x%08x) but DST does not match SRC src_dma=0x%llx pt[0x%x]=0x%016llx\n", sem, src_dma, pt_idx, pte); return -EIO; } boot_stage.rmcall_guest_selftest_ok = true; - pr_info("gsp-phys-boot: rm-call: GUEST PTE SELFTEST OK src_dma=0x%llx sem=0x%08x\n", + pr_info("vgsp-boot: rm-call: GUEST PTE SELFTEST OK src_dma=0x%llx sem=0x%08x\n", src_dma, sem); return 0; } @@ -9289,7 +10358,7 @@ static int gsp_phys_rmcall_run(void __iomem *bar0, u32 target) */ if (!gsp_phys_gpu_claimed() || !boot_stage.rm_init_done || boot_stage.rm_unload_submitted) { - pr_info("gsp-phys-boot: rm-call: no-op: claimed=%u init_done=%u unload_submitted=%u\n", + pr_info("vgsp-boot: rm-call: no-op: claimed=%u init_done=%u unload_submitted=%u\n", gsp_phys_gpu_claimed(), boot_stage.rm_init_done, boot_stage.rm_unload_submitted); mutex_unlock(&gsp_phys_rm_lock); @@ -9304,18 +10373,18 @@ static int gsp_phys_rmcall_run(void __iomem *bar0, u32 target) */ boot_stage.rmcall_last_stage = 5; if (boot_stage.rmcall_stage >= 1) { - pr_info("gsp-phys-boot: rm-call: stage 5 skipped: stage 1 is already satisfied (hClient=0x%x hDevice=0x%x hSubdevice=0x%x); write 2/3/4 for the remaining stages\n", + pr_info("vgsp-boot: rm-call: stage 5 skipped: stage 1 is already satisfied (hClient=0x%x hDevice=0x%x hSubdevice=0x%x); write 2/3/4 for the remaining stages\n", boot_stage.rmcall_client, boot_stage.rmcall_device, boot_stage.rmcall_subdevice); } else { ret = gsp_phys_rmcall_stage5(bar0); if (ret) { - pr_err("gsp-phys-boot: rm-call: ladder aborted in stage 5 (ret %d, %u RPCs so far); no object teardown (UNLOAD + rmmod remains the fail-safe)\n", + pr_err("vgsp-boot: rm-call: ladder aborted in stage 5 (ret %d, %u RPCs so far); no object teardown (UNLOAD + rmmod remains the fail-safe)\n", ret, boot_stage.rmcall_rpcs); } else { boot_stage.rmcall_stage = 1; /* stage 1 satisfied */ - pr_info("gsp-phys-boot: rm-call: stage 5 (adopt) complete (%u RPCs so far); stage 2/3/4 will use the adopted handles\n", + pr_info("vgsp-boot: rm-call: stage 5 (adopt) complete (%u RPCs so far); stage 2/3/4 will use the adopted handles\n", boot_stage.rmcall_rpcs); } } @@ -9340,16 +10409,16 @@ static int gsp_phys_rmcall_run(void __iomem *bar0, u32 target) break; } if (ret) { - pr_err("gsp-phys-boot: rm-call: ladder aborted in stage %u (ret %d, %u RPCs so far); no object teardown (UNLOAD + rmmod remains the fail-safe)\n", + pr_err("vgsp-boot: rm-call: ladder aborted in stage %u (ret %d, %u RPCs so far); no object teardown (UNLOAD + rmmod remains the fail-safe)\n", stage, ret, boot_stage.rmcall_rpcs); break; } boot_stage.rmcall_stage = stage; - pr_info("gsp-phys-boot: rm-call: stage %u complete (%u RPCs so far)\n", + pr_info("vgsp-boot: rm-call: stage %u complete (%u RPCs so far)\n", stage, boot_stage.rmcall_rpcs); } if (!ret && target <= boot_stage.rmcall_stage) - pr_info("gsp-phys-boot: rm-call: ladder at stage %u (target %u; %u RPCs)\n", + pr_info("vgsp-boot: rm-call: ladder at stage %u (target %u; %u RPCs)\n", boot_stage.rmcall_stage, target, boot_stage.rmcall_rpcs); } @@ -9376,6 +10445,8 @@ static void gsp_phys_rmcall_fini(struct pci_dev *pdev) gsp_phys_chunk_free(pdev, &boot_stage.rmcall_ctx); for (i = 0; i < GSP_PHYS_RMCALL_GR_CTX_PT_MAX; i++) gsp_phys_chunk_free(pdev, &boot_stage.rmcall_ctx_pt[i]); + gsp_phys_chunk_free(pdev, &boot_stage.rmcall_patch); + gsp_phys_chunk_free(pdev, &boot_stage.rmcall_pm); gsp_phys_rmcall_reset(); } @@ -9413,7 +10484,7 @@ static bool gsp_phys_state_tx_header(struct seq_file *m, const char *tag, } /* - * Read-only snapshot for /sys/kernel/debug/open-iov-vfio/gsp-phys-state. + * Read-only snapshot for /sys/kernel/debug/vgsp/gsp-phys-state. * Touches the device only when the boot/claim is live AND the stage-3d * staging is primed; otherwise it returns a one-line status and no hardware * access. No register or queue state is written and nothing is consumed: the @@ -9432,12 +10503,12 @@ static int gsp_phys_state_show(struct seq_file *m, void *v) if (!gsp_phys_gpu_claimed() || !bar0) { seq_puts(m, - "gsp-phys-state: inactive: physical GPU not claimed or BAR0 not owned (gsp_phys_gpu=0 or claim inactive); no device state\n"); + "vgsp-state: inactive: physical GPU not claimed or BAR0 not owned (gsp_phys_gpu=0 or claim inactive); no device state\n"); return 0; } if (!boot_stage.primed) { seq_printf(m, - "gsp-phys-state: inactive: stage-3d staging not primed (kicked=%u ran=%u rm_init_done=%u dryrun=%u rm_unload_submitted=%u); no device access\n", + "vgsp-state: inactive: stage-3d staging not primed (kicked=%u ran=%u rm_init_done=%u dryrun=%u rm_unload_submitted=%u); no device access\n", boot_stage.kicked, boot_stage.ran, boot_stage.rm_init_done, boot_stage.dryrun, boot_stage.rm_unload_submitted); @@ -9453,7 +10524,7 @@ static int gsp_phys_state_show(struct seq_file *m, void *v) GSP_PHYS_FALCON_CPUCTL); gsp_phys_fwsec_scratch14_read(bar0, &s14); - seq_printf(m, "gsp-phys-state: claimed=1 boot_param=%u dryrun_param=%u\n", + seq_printf(m, "vgsp-state: claimed=1 boot_param=%u dryrun_param=%u\n", gsp_phys_boot_enabled(), gsp_phys_boot_dryrun_enabled()); seq_printf(m, "stage: primed=%u kicked=%u ran=%u riscv_active=%u rm_init_done=%u rm_unload_submitted=%u dryrun=%u tx_seq_num=%u\n", @@ -9493,7 +10564,7 @@ static int gsp_phys_state_show(struct seq_file *m, void *v) /* COPY0 sessions print no line (byte-identical state output). */ if (boot_stage.rmcall_ctx_prepared) seq_printf(m, - "rm_call_ctx: prepared=%u valid=%u pa=0x%llx va=0x%llx size=0x%x pages=%u ptPages=%u gr_promote_param=%u step=%u entrySize=0x%x\n", + "rm_call_ctx: prepared=%u valid=%u pa=0x%llx va=0x%llx size=0x%x pages=%u ptPages=%u gr_promote_param=%u step=%u entrySize=0x%x hVirt=0x%x\n", boot_stage.rmcall_ctx_prepared, boot_stage.rmcall_ctx_valid, boot_stage.rmcall_ctx_pa, boot_stage.rmcall_ctx_va, @@ -9502,7 +10573,8 @@ static int gsp_phys_state_show(struct seq_file *m, void *v) boot_stage.rmcall_ctx_pt_pages, boot_stage.rmcall_gr_promote, boot_stage.rmcall_gr_promote_step, - boot_stage.rmcall_gr_promote_size); + boot_stage.rmcall_gr_promote_size, + boot_stage.rmcall_gr_hvirt); seq_printf(m, "rm_call_guest: gpa=0x%llx hpa=0x%llx g2h_ok=%u w2g_ok=%u selftest_ok=%u gpa_valid=%u phys_domain_identity=%d\n", boot_stage.rmcall_guest_gpa, boot_stage.rmcall_guest_hpa, @@ -9911,14 +10983,14 @@ static int gsp_phys_log_dump_show(struct seq_file *m, void *v) if (!gsp_phys_gpu_claimed() || !boot_stage.primed || !boot_stage.login.pages || !boot_stage.logrm.pages) { seq_printf(m, - "gsp-phys-log-dump: inactive: claimed=%u primed=%u login_pages=%u logrm_pages=%u; no log buffers to dump\n", + "vgsp-log-dump: inactive: claimed=%u primed=%u login_pages=%u logrm_pages=%u; no log buffers to dump\n", gsp_phys_gpu_claimed(), boot_stage.primed, boot_stage.login.pages, boot_stage.logrm.pages); return 0; } seq_puts(m, - "gsp-phys-boot: libos task log buffers (read-only; raw hex is authoritative, decode offline with backups/evidence-*/decode_logs.py)\n"); + "vgsp-boot: libos task log buffers (read-only; raw hex is authoritative, decode offline with backups/evidence-*/decode_logs.py)\n"); gsp_phys_log_dump_raw(m, "LOGINIT", &boot_stage.login); gsp_phys_log_dump_raw(m, "LOGRM", &boot_stage.logrm); gsp_phys_log_dump_decoded(m, "LOGINIT", &boot_stage.login); @@ -9954,7 +11026,7 @@ static int gsp_phys_status_drain_show(struct seq_file *m, void *v) if (!gsp_phys_gpu_claimed() || !boot_stage.primed || !boot_stage.queue.pages) { seq_printf(m, - "gsp-phys-status: inactive: claimed=%u primed=%u queue_pages=%u; no status queue to drain\n", + "vgsp-status: inactive: claimed=%u primed=%u queue_pages=%u; no status queue to drain\n", gsp_phys_gpu_claimed(), boot_stage.primed, boot_stage.queue.pages); return 0; @@ -10001,37 +11073,37 @@ static ssize_t gsp_phys_unload_rpc_write(struct file *file, if (kstrtoul(strim(buf), 0, &value)) return -EINVAL; if (value != 1) { - pr_info("gsp-phys-boot: gsp-phys-unload-rpc: write ignored (write \"1\" to trigger)\n"); + pr_info("vgsp-boot: gsp-phys-unload-rpc: write ignored (write \"1\" to trigger)\n"); return len; } if (!gsp_phys_boot_enabled()) { - pr_info("gsp-phys-boot: gsp-phys-unload-rpc: no-op: gsp_phys_boot is not enabled\n"); + pr_info("vgsp-boot: gsp-phys-unload-rpc: no-op: gsp_phys_boot is not enabled\n"); return len; } if (!gsp_phys_gpu_claimed()) { - pr_info("gsp-phys-boot: gsp-phys-unload-rpc: no-op: the physical GPU is not claimed\n"); + pr_info("vgsp-boot: gsp-phys-unload-rpc: no-op: the physical GPU is not claimed\n"); return len; } if (!boot_stage.ran) { - pr_info("gsp-phys-boot: gsp-phys-unload-rpc: no-op: stage 3d did not run (primed=%u kicked=%u dryrun=%u)\n", + pr_info("vgsp-boot: gsp-phys-unload-rpc: no-op: stage 3d did not run (primed=%u kicked=%u dryrun=%u)\n", boot_stage.primed, boot_stage.kicked, boot_stage.dryrun); return len; } if (!boot_stage.rm_init_done) { - pr_info("gsp-phys-boot: gsp-phys-unload-rpc: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed (primed=%u ran=%u); sending UNLOADING_GUEST_DRIVER before init-done can be dropped\n", + pr_info("vgsp-boot: gsp-phys-unload-rpc: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed (primed=%u ran=%u); sending UNLOADING_GUEST_DRIVER before init-done can be dropped\n", GSP_PHYS_MSG_FUNC_GSP_INIT_DONE, boot_stage.primed, boot_stage.ran); return len; } bar0 = gsp_phys_gpu_bar0(); if (!bar0) { - pr_warn("gsp-phys-boot: gsp-phys-unload-rpc: no-op: BAR0 is not mapped\n"); + pr_warn("vgsp-boot: gsp-phys-unload-rpc: no-op: BAR0 is not mapped\n"); return len; } ret = gsp_phys_boot_rm_unload(bar0); - pr_info("gsp-phys-boot: gsp-phys-unload-rpc: UNLOADING_GUEST_DRIVER attempt returned %d (WPR2 untouched; run release/rmmod to tear down WPR2)\n", + pr_info("vgsp-boot: gsp-phys-unload-rpc: UNLOADING_GUEST_DRIVER attempt returned %d (WPR2 untouched; run release/rmmod to tear down WPR2)\n", ret); return len; } @@ -10069,37 +11141,37 @@ static ssize_t gsp_phys_rm_probe_write(struct file *file, if (kstrtoul(strim(buf), 0, &value)) return -EINVAL; if (value != 1) { - pr_info("gsp-phys-boot: gsp-phys-rm-probe: write ignored (write \"1\" to probe)\n"); + pr_info("vgsp-boot: gsp-phys-rm-probe: write ignored (write \"1\" to probe)\n"); return len; } if (!gsp_phys_boot_enabled()) { - pr_info("gsp-phys-boot: gsp-phys-rm-probe: no-op: gsp_phys_boot is not enabled\n"); + pr_info("vgsp-boot: gsp-phys-rm-probe: no-op: gsp_phys_boot is not enabled\n"); return len; } if (!gsp_phys_gpu_claimed()) { - pr_info("gsp-phys-boot: gsp-phys-rm-probe: no-op: the physical GPU is not claimed\n"); + pr_info("vgsp-boot: gsp-phys-rm-probe: no-op: the physical GPU is not claimed\n"); return len; } if (!boot_stage.ran) { - pr_info("gsp-phys-boot: gsp-phys-rm-probe: no-op: stage 3d did not run (primed=%u kicked=%u dryrun=%u)\n", + pr_info("vgsp-boot: gsp-phys-rm-probe: no-op: stage 3d did not run (primed=%u kicked=%u dryrun=%u)\n", boot_stage.primed, boot_stage.kicked, boot_stage.dryrun); return len; } if (!boot_stage.rm_init_done) { - pr_info("gsp-phys-boot: gsp-phys-rm-probe: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed (primed=%u ran=%u); RM RPCs before init-done can be dropped\n", + pr_info("vgsp-boot: gsp-phys-rm-probe: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed (primed=%u ran=%u); RM RPCs before init-done can be dropped\n", GSP_PHYS_MSG_FUNC_GSP_INIT_DONE, boot_stage.primed, boot_stage.ran); return len; } bar0 = gsp_phys_gpu_bar0(); if (!bar0) { - pr_warn("gsp-phys-boot: gsp-phys-rm-probe: no-op: BAR0 is not mapped\n"); + pr_warn("vgsp-boot: gsp-phys-rm-probe: no-op: BAR0 is not mapped\n"); return len; } ret = gsp_phys_rm_probe(bar0); - pr_info("gsp-phys-boot: gsp-phys-rm-probe: probe returned %d (last reply function=%u payload=%u B; WPR2 untouched)\n", + pr_info("vgsp-boot: gsp-phys-rm-probe: probe returned %d (last reply function=%u payload=%u B; WPR2 untouched)\n", ret, boot_stage.rm_probe_last_function, boot_stage.rm_probe_last_payload_len); return len; @@ -10149,44 +11221,44 @@ static ssize_t gsp_phys_rm_call_write(struct file *file, if (kstrtoul(strim(buf), 0, &value)) return -EINVAL; if (value < 1 || value > 9) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: write ignored (write 1..4 to run stages 1..N, 5 to adopt the static-config handles, 6/7 for the guest W2G/G2H directions, 8 for the guest PTE self-test, or 9 to re-run one GR semaphore release on a GR ladder; 6-8 need gsp_phys_guest_mem=1)\n"); + pr_info("vgsp-boot: gsp-phys-rm-call: write ignored (write 1..4 to run stages 1..N, 5 to adopt the static-config handles, 6/7 for the guest W2G/G2H directions, 8 for the guest PTE self-test, or 9 to re-run one GR semaphore release on a GR ladder; 6-8 need gsp_phys_guest_mem=1)\n"); return len; } if (!gsp_phys_boot_enabled()) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: gsp_phys_boot is not enabled\n"); + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: gsp_phys_boot is not enabled\n"); return len; } if (!gsp_phys_gpu_claimed()) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: the physical GPU is not claimed\n"); + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: the physical GPU is not claimed\n"); return len; } if (!boot_stage.primed) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: stage-3d staging is not primed\n"); + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: stage-3d staging is not primed\n"); return len; } if (!boot_stage.ran) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: stage 3d did not run (primed=%u kicked=%u dryrun=%u)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: stage 3d did not run (primed=%u kicked=%u dryrun=%u)\n", boot_stage.primed, boot_stage.kicked, boot_stage.dryrun); return len; } if (!boot_stage.rm_init_done) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed (primed=%u ran=%u); RM RPCs before init-done can be dropped\n", + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: GSP-RM init-done (function 0x%x, rpc_result 0) was not observed (primed=%u ran=%u); RM RPCs before init-done can be dropped\n", GSP_PHYS_MSG_FUNC_GSP_INIT_DONE, boot_stage.primed, boot_stage.ran); return len; } if (boot_stage.rm_unload_submitted) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: UNLOADING_GUEST_DRIVER was already submitted; GSP-RM is suspending\n"); + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: UNLOADING_GUEST_DRIVER was already submitted; GSP-RM is suspending\n"); return len; } if (!boot_stage.pdev) { - pr_warn("gsp-phys-boot: gsp-phys-rm-call: no-op: no claimed pci_dev for chunk allocation\n"); + pr_warn("vgsp-boot: gsp-phys-rm-call: no-op: no claimed pci_dev for chunk allocation\n"); return len; } bar0 = gsp_phys_gpu_bar0(); if (!bar0) { - pr_warn("gsp-phys-boot: gsp-phys-rm-call: no-op: BAR0 is not mapped\n"); + pr_warn("vgsp-boot: gsp-phys-rm-call: no-op: BAR0 is not mapped\n"); return len; } @@ -10200,7 +11272,7 @@ static ssize_t gsp_phys_rm_call_write(struct file *file, */ if (value == 9) { ret = gsp_phys_rmcall_gr_sem_rerun(bar0); - pr_info("gsp-phys-boot: gsp-phys-rm-call: trigger 9 returned %d (GR semaphore re-run; WPR2 untouched)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: trigger 9 returned %d (GR semaphore re-run; WPR2 untouched)\n", ret); return len; } @@ -10214,22 +11286,22 @@ static ssize_t gsp_phys_rm_call_write(struct file *file, * no-op; the engine is never touched from here. */ if (!gsp_phys_guest_mem_enabled()) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: trigger %lu requires gsp_phys_guest_mem=1\n", + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: trigger %lu requires gsp_phys_guest_mem=1\n", value); return len; } if (gsp_phys_backend_state() != GSP_PHYS_BACKEND_READY) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: trigger %lu requires a live READY backend claim (state=%d)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: trigger %lu requires a live READY backend claim (state=%d)\n", value, gsp_phys_backend_state()); return len; } if (boot_stage.rmcall_stage < 3) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: trigger %lu requires ladder stage >= 3 (real channel built; currently %u)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: trigger %lu requires ladder stage >= 3 (real channel built; currently %u)\n", value, boot_stage.rmcall_stage); return len; } if (value != 8 && !boot_stage.rmcall_guest_gpa_valid) { - pr_info("gsp-phys-boot: gsp-phys-rm-call: no-op: trigger %lu requires a pinned guest GPA (write it to gsp-phys-guest-gpa first)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: no-op: trigger %lu requires a pinned guest GPA (write it to gsp-phys-guest-gpa first)\n", value); return len; } @@ -10241,7 +11313,7 @@ static ssize_t gsp_phys_rm_call_write(struct file *file, else ret = gsp_phys_rmcall_guest_selftest(bar0); - pr_info("gsp-phys-boot: gsp-phys-rm-call: trigger %lu returned %d (guest gpa=0x%llx hpa=0x%llx g2h_ok=%u w2g_ok=%u selftest_ok=%u; WPR2 untouched)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: trigger %lu returned %d (guest gpa=0x%llx hpa=0x%llx g2h_ok=%u w2g_ok=%u selftest_ok=%u; WPR2 untouched)\n", value, ret, boot_stage.rmcall_guest_gpa, boot_stage.rmcall_guest_hpa, boot_stage.rmcall_guest_r_ok, @@ -10251,7 +11323,7 @@ static ssize_t gsp_phys_rm_call_write(struct file *file, } ret = gsp_phys_rmcall_run(bar0, (u32)value); - pr_info("gsp-phys-boot: gsp-phys-rm-call: trigger %lu returned %d (stage=%u last_stage=%u %u RPCs; WPR2 untouched)\n", + pr_info("vgsp-boot: gsp-phys-rm-call: trigger %lu returned %d (stage=%u last_stage=%u %u RPCs; WPR2 untouched)\n", value, ret, boot_stage.rmcall_stage, boot_stage.rmcall_last_stage, boot_stage.rmcall_rpcs); return len; @@ -10288,24 +11360,24 @@ static ssize_t gsp_phys_guest_gpa_write(struct file *file, buf[len] = '\0'; if (kstrtoull(strim(buf), 0, &gpa)) { - pr_info("gsp-phys-boot: gsp-phys-guest-gpa: write ignored: expected \"0x<hex GPA>\"\n"); + pr_info("vgsp-boot: gsp-phys-guest-gpa: write ignored: expected \"0x<hex GPA>\"\n"); return -EINVAL; } if (!PAGE_ALIGNED(gpa)) { - pr_info("gsp-phys-boot: gsp-phys-guest-gpa: write ignored: GPA 0x%llx is not 4 KB page-aligned\n", + pr_info("vgsp-boot: gsp-phys-guest-gpa: write ignored: GPA 0x%llx is not 4 KB page-aligned\n", gpa); return -EINVAL; } if (boot_stage.rmcall_guest_gpa_valid && boot_stage.rmcall_guest_gpa != gpa) { - pr_err("gsp-phys-boot: gsp-phys-guest-gpa: refused: this boot already pinned GPA 0x%llx; one GPA per boot (stale GMMU TLB safety). Reuse that GPA, or release/reboot before changing it\n", + pr_err("vgsp-boot: gsp-phys-guest-gpa: refused: this boot already pinned GPA 0x%llx; one GPA per boot (stale GMMU TLB safety). Reuse that GPA, or release/reboot before changing it\n", boot_stage.rmcall_guest_gpa); return -EBUSY; } boot_stage.rmcall_guest_gpa = gpa; boot_stage.rmcall_guest_gpa_valid = true; - pr_info("gsp-phys-boot: gsp-phys-guest-gpa: pinned guest GPA 0x%llx for this boot (gsp_phys_rm-call triggers 6/7 translate it through the active mdev's VFIO domain)\n", + pr_info("vgsp-boot: gsp-phys-guest-gpa: pinned guest GPA 0x%llx for this boot (gsp_phys_rm-call triggers 6/7 translate it through the active mdev's VFIO domain)\n", gpa); return len; } @@ -10358,34 +11430,34 @@ static ssize_t gsp_phys_guest_ram_write(struct file *file, p = strim(buf); if (!strcmp(p, "-")) { gsp_phys_guest_ram_clear(); - pr_info("gsp-phys-boot: gsp-phys-guest-ram: cleared the guest RAM file configuration\n"); + pr_info("vgsp-boot: gsp-phys-guest-ram: cleared the guest RAM file configuration\n"); return len; } path = gsp_phys_guest_ram_token(&p); tok = gsp_phys_guest_ram_token(&p); if (!path || !tok || kstrtoull(tok, 0, &gpa_base)) { - pr_info("gsp-phys-boot: gsp-phys-guest-ram: write ignored: expected \"<path> <gpa_base_hex> <file_offset_hex> <size_hex>\" or \"-\"\n"); + pr_info("vgsp-boot: gsp-phys-guest-ram: write ignored: expected \"<path> <gpa_base_hex> <file_offset_hex> <size_hex>\" or \"-\"\n"); return -EINVAL; } tok = gsp_phys_guest_ram_token(&p); if (!tok || kstrtoull(tok, 0, &file_offset)) { - pr_info("gsp-phys-boot: gsp-phys-guest-ram: write ignored: expected a hex file offset after the GPA\n"); + pr_info("vgsp-boot: gsp-phys-guest-ram: write ignored: expected a hex file offset after the GPA\n"); return -EINVAL; } tok = gsp_phys_guest_ram_token(&p); if (!tok || kstrtoull(tok, 0, &size)) { - pr_info("gsp-phys-boot: gsp-phys-guest-ram: write ignored: expected a hex size after the file offset\n"); + pr_info("vgsp-boot: gsp-phys-guest-ram: write ignored: expected a hex size after the file offset\n"); return -EINVAL; } ret = gsp_phys_guest_ram_configure(path, gpa_base, file_offset, size); if (ret) { - pr_err("gsp-phys-boot: gsp-phys-guest-ram: configure failed: path=%s gpa=0x%llx off=0x%llx size=0x%llx ret=%d\n", + pr_err("vgsp-boot: gsp-phys-guest-ram: configure failed: path=%s gpa=0x%llx off=0x%llx size=0x%llx ret=%d\n", path, gpa_base, file_offset, size, ret); return ret; } - pr_info("gsp-phys-boot: gsp-phys-guest-ram: configured path=%s gpa=0x%llx off=0x%llx size=0x%llx\n", + pr_info("vgsp-boot: gsp-phys-guest-ram: configured path=%s gpa=0x%llx off=0x%llx size=0x%llx\n", path, gpa_base, file_offset, size); return len; } @@ -10401,13 +11473,13 @@ int gsp_phys_boot_debugfs_init(void) { struct dentry *file; - gsp_phys_debugfs_root = debugfs_create_dir("open-iov-vfio", NULL); + gsp_phys_debugfs_root = debugfs_create_dir("vgsp", NULL); if (IS_ERR_OR_NULL(gsp_phys_debugfs_root)) { long err = IS_ERR(gsp_phys_debugfs_root) ? PTR_ERR(gsp_phys_debugfs_root) : -ENODEV; gsp_phys_debugfs_root = NULL; - pr_warn("gsp-phys-boot: debugfs dir open-iov-vfio creation failed: %ld\n", + pr_warn("vgsp-boot: debugfs dir vgsp creation failed: %ld\n", err); return (int)err; } @@ -10419,7 +11491,7 @@ int gsp_phys_boot_debugfs_init(void) debugfs_remove_recursive(gsp_phys_debugfs_root); gsp_phys_debugfs_root = NULL; - pr_warn("gsp-phys-boot: debugfs file gsp-phys-unload-rpc creation failed: %ld\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-unload-rpc creation failed: %ld\n", err); return (int)err; } @@ -10433,7 +11505,7 @@ int gsp_phys_boot_debugfs_init(void) * Keep the existing trigger registered: only the snapshot is * missing. The caller's warning covers both files. */ - pr_warn("gsp-phys-boot: debugfs file gsp-phys-state creation failed: %ld (gsp-phys-unload-rpc stays available)\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-state creation failed: %ld (gsp-phys-unload-rpc stays available)\n", err); return (int)err; } @@ -10447,7 +11519,7 @@ int gsp_phys_boot_debugfs_init(void) * The probe trigger is optional: the unload trigger and the * state snapshot stay registered. */ - pr_warn("gsp-phys-boot: debugfs file gsp-phys-rm-probe creation failed: %ld (unload trigger and state snapshot stay available)\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-rm-probe creation failed: %ld (unload trigger and state snapshot stay available)\n", err); return (int)err; } @@ -10461,7 +11533,7 @@ int gsp_phys_boot_debugfs_init(void) * The RM-client ladder is optional: the other triggers and * the state snapshot stay registered. */ - pr_warn("gsp-phys-boot: debugfs file gsp-phys-rm-call creation failed: %ld (other triggers and state snapshot stay available)\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-rm-call creation failed: %ld (other triggers and state snapshot stay available)\n", err); return (int)err; } @@ -10475,7 +11547,7 @@ int gsp_phys_boot_debugfs_init(void) * The guest-GPA pin is optional: the other triggers and the * state snapshot stay registered. */ - pr_warn("gsp-phys-boot: debugfs file gsp-phys-guest-gpa creation failed: %ld (other triggers and state snapshot stay available)\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-guest-gpa creation failed: %ld (other triggers and state snapshot stay available)\n", err); return (int)err; } @@ -10489,7 +11561,7 @@ int gsp_phys_boot_debugfs_init(void) * The guest-RAM backing file is optional: the other triggers * and the state snapshot stay registered. */ - pr_warn("gsp-phys-boot: debugfs file gsp-phys-guest-ram creation failed: %ld (other triggers and state snapshot stay available)\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-guest-ram creation failed: %ld (other triggers and state snapshot stay available)\n", err); return (int)err; } @@ -10503,7 +11575,7 @@ int gsp_phys_boot_debugfs_init(void) * The log dump is diagnostic; the triggers and the state * snapshot stay registered. */ - pr_warn("gsp-phys-boot: debugfs file gsp-phys-log-dump creation failed: %ld (triggers and state snapshot stay available)\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-log-dump creation failed: %ld (triggers and state snapshot stay available)\n", err); return (int)err; } @@ -10517,11 +11589,11 @@ int gsp_phys_boot_debugfs_init(void) * The status-queue drain is diagnostic; the triggers, the * log dump and the state snapshot stay registered. */ - pr_warn("gsp-phys-boot: debugfs file gsp-phys-status-drain creation failed: %ld (triggers, log dump and state snapshot stay available)\n", + pr_warn("vgsp-boot: debugfs file gsp-phys-status-drain creation failed: %ld (triggers, log dump and state snapshot stay available)\n", err); return (int)err; } - pr_info("gsp-phys-boot: debugfs files /sys/kernel/debug/open-iov-vfio/{gsp-phys-state read-only, gsp-phys-log-dump read-only, gsp-phys-status-drain read-only, gsp-phys-unload-rpc write-only, gsp-phys-rm-probe write-only, gsp-phys-rm-call write-only, gsp-phys-guest-gpa write-only, gsp-phys-guest-ram write-only} ready\n"); + pr_info("vgsp-boot: debugfs files /sys/kernel/debug/vgsp/{gsp-phys-state read-only, gsp-phys-log-dump read-only, gsp-phys-status-drain read-only, gsp-phys-unload-rpc write-only, gsp-phys-rm-probe write-only, gsp-phys-rm-call write-only, gsp-phys-guest-gpa write-only, gsp-phys-guest-ram write-only} ready\n"); return 0; } @@ -10539,21 +11611,21 @@ void gsp_phys_boot_quiesce(void __iomem *bar0) if (!boot_stage.kicked) return; - pr_info("gsp-phys-boot: release: stage 3d issued a Booter Load kick (RISC-V active=%u); quiescing the GSP falcon before the WPR2 teardown\n", + pr_info("vgsp-boot: release: stage 3d issued a Booter Load kick (RISC-V active=%u); quiescing the GSP falcon before the WPR2 teardown\n", boot_stage.riscv_active); gsp_phys_scratch14_log(bar0, "quiesce-pre-reset"); gsp_phys_falcon_reset(bar0, GSP_PHYS_GSP_BASE); gsp_phys_scratch14_log(bar0, "quiesce-post-reset"); - pr_info("gsp-phys-boot: release quiesce: GSP_CPUCTL=0x%08x RISCV_STATUS=0x%08x FALCON_OS=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x\n", + pr_info("vgsp-boot: release quiesce: GSP_CPUCTL=0x%08x RISCV_STATUS=0x%08x FALCON_OS=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x\n", readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_CPUCTL), readl(bar0 + GSP_PHYS_RISCV_STATUS), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_OS), readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), readl(bar0 + GSP_PHYS_WPR2_ADDR_HI)); if (gsp_phys_fwsec_wpr2_up(bar0)) - pr_info("gsp-phys-boot: release: WPR2 still up after the quiesce; the fwsec teardown below owns it\n"); + pr_info("vgsp-boot: release: WPR2 still up after the quiesce; the fwsec teardown below owns it\n"); else - pr_info("gsp-phys-boot: release: WPR2 already down after the quiesce\n"); + pr_info("vgsp-boot: release: WPR2 already down after the quiesce\n"); } void gsp_phys_boot_staging_free(struct pci_dev *pdev) @@ -10566,7 +11638,7 @@ void gsp_phys_boot_staging_free(struct pci_dev *pdev) boot_stage.queue.pages || boot_stage.radix3.table.pages || boot_stage.login.pages || boot_stage.logrm.pages || boot_stage.radix3.nr_chunks || boot_stage.rmcall_chunks[0].pages) - pr_info("gsp-phys-boot: release: freeing stage-3d staging (radix3 data + tables, FMC, signature, queue, LOGINIT, LOGRM) and any rm-call ladder buffers\n"); + pr_info("vgsp-boot: release: freeing stage-3d staging (radix3 data + tables, FMC, signature, queue, LOGINIT, LOGRM) and any rm-call ladder buffers\n"); gsp_phys_rmcall_fini(pdev); gsp_phys_radix3_free(pdev, &boot_stage.radix3); diff --git a/kernel/gsp_phys_booter.h b/kernel/gsp_phys_booter.h index 3a19060..f462c4e 100644 --- a/kernel/gsp_phys_booter.h +++ b/kernel/gsp_phys_booter.h @@ -360,7 +360,7 @@ int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function, int gsp_phys_boot_rm_unload(void __iomem *bar0); /* - * Module-owned debugfs files (dir "open-iov-vfio"), registered by + * Module-owned debugfs files (dir "vgsp"), registered by * nv_vgpu_init() and removed by nv_vgpu_exit(). All file_operations carry * .owner = THIS_MODULE so an open fd pins the module: * - "gsp-phys-unload-rpc" (write-only, mode 0200): writing "1" runs diff --git a/kernel/gsp_phys_fwsec.c b/kernel/gsp_phys_fwsec.c index c20758b..c20543c 100644 --- a/kernel/gsp_phys_fwsec.c +++ b/kernel/gsp_phys_fwsec.c @@ -306,7 +306,7 @@ bool gsp_phys_fwsec_board_debug(void __iomem *bar0) u32 fuse = readl(bar0 + GSP_PHYS_FUSE_SECURE_GSP_DEBUG_DIS); bool debug = !(fuse & GSP_PHYS_FUSE_SECURE_GSP_DEBUG_DIS_FIELD); - pr_info("gsp-phys-fwsec: fuse SECURE_GSP_DEBUG_DIS=0x%08x -> %s board mode\n", + pr_info("vgsp-fwsec: fuse SECURE_GSP_DEBUG_DIS=0x%08x -> %s board mode\n", fuse, debug ? "debug" : "production"); return debug; } @@ -348,7 +348,7 @@ static bool gsp_phys_fwsec_scratch14_all_done(void __iomem *bar0) static void gsp_phys_fwsec_dump_state(void __iomem *bar0, const char *what) { - pr_info("gsp-phys-fwsec: %s: GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x GSP_BOOTVEC=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x scratch0E=0x%08x scratch15=0x%08x GFW_BOOT=0x%08x SEC2_M0=0x%08x SEC2_M1=0x%08x\n", + pr_info("vgsp-fwsec: %s: GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x GSP_BOOTVEC=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x scratch0E=0x%08x scratch15=0x%08x GFW_BOOT=0x%08x SEC2_M0=0x%08x SEC2_M1=0x%08x\n", what, readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_CPUCTL), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_CPUCTL), @@ -392,7 +392,7 @@ int gsp_phys_falcon_reset(void __iomem *bar0, u32 base) GSP_PHYS_DMACTL_IMEM_SCRUBBING))) break; if (time_after_eq(jiffies, deadline)) { - pr_err("gsp-phys-fwsec: falcon@0x%x reset scrub not done (DMACTL=0x%08x)\n", + pr_err("vgsp-fwsec: falcon@0x%x reset scrub not done (DMACTL=0x%08x)\n", base, value); ret = -ETIMEDOUT; break; @@ -405,7 +405,7 @@ int gsp_phys_falcon_reset(void __iomem *bar0, u32 base) writel(readl(bar0 + GSP_PHYS_PMC_BOOT_0), bar0 + base + GSP_PHYS_FALCON_RM); - pr_info("gsp-phys-fwsec: falcon@0x%x reset: DMACTL=0x%08x FALCON_RM=0x%08x (PMC_BOOT_0) ENGINE=0x%08x\n", + pr_info("vgsp-fwsec: falcon@0x%x reset: DMACTL=0x%08x FALCON_RM=0x%08x (PMC_BOOT_0) ENGINE=0x%08x\n", base, readl(bar0 + base + GSP_PHYS_FALCON_DMACTL), readl(bar0 + base + GSP_PHYS_FALCON_RM), readl(bar0 + base + GSP_PHYS_FALCON_ENGINE)); @@ -426,7 +426,7 @@ void gsp_phys_falcon_disable_ctx_req(void __iomem *bar0, u32 base, bar0 + fbif + GSP_PHYS_FBIF_CTL); writel(0, bar0 + base + GSP_PHYS_FALCON_DMACTL); - pr_info("gsp-phys-fwsec: falcon@0x%x FBIF_CTL=0x%08x (ALLOW_PHYS_NO_CTX) DMACTL=0x%08x\n", + pr_info("vgsp-fwsec: falcon@0x%x FBIF_CTL=0x%08x (ALLOW_PHYS_NO_CTX) DMACTL=0x%08x\n", base, readl(bar0 + fbif + GSP_PHYS_FBIF_CTL), readl(bar0 + base + GSP_PHYS_FALCON_DMACTL)); } @@ -505,7 +505,7 @@ void gsp_phys_falcon_start_cpu(void __iomem *bar0, u32 base) u32 cpuctl = readl(bar0 + base + GSP_PHYS_FALCON_CPUCTL); if (cpuctl & GSP_PHYS_CPUCTL_ALIAS_EN) { - pr_info("gsp-phys-fwsec: falcon@0x%x ALIAS_EN set, starting via CPUCTL_ALIAS\n", + pr_info("vgsp-fwsec: falcon@0x%x ALIAS_EN set, starting via CPUCTL_ALIAS\n", base); writel(GSP_PHYS_CPUCTL_STARTCPU, bar0 + base + GSP_PHYS_FALCON_CPUCTL_ALIAS); @@ -526,7 +526,7 @@ int gsp_phys_falcon_wait_halt(void __iomem *bar0, u32 base, if (cpuctl & GSP_PHYS_CPUCTL_HALTED) return 0; if (time_after_eq(jiffies, deadline)) { - pr_err("gsp-phys-fwsec: falcon@0x%x did not halt (CPUCTL=0x%08x, timeout %ums)\n", + pr_err("vgsp-fwsec: falcon@0x%x did not halt (CPUCTL=0x%08x, timeout %ums)\n", base, cpuctl, timeout_ms); return -ETIMEDOUT; } @@ -555,7 +555,7 @@ static int gsp_phys_fwsec_wait_gfw_boot(void __iomem *bar0) if ((cpuctl & GSP_PHYS_CPUCTL_HALTED) && (plm & GSP_PHYS_GFW_PLM_LEVEL0) && progress == GSP_PHYS_GFW_BOOT_COMPLETED) { - pr_info("gsp-phys-fwsec: GFW boot complete: CPUCTL=0x%08x (halted) PLM=0x%08x progress=0xff\n", + pr_info("vgsp-fwsec: GFW boot complete: CPUCTL=0x%08x (halted) PLM=0x%08x progress=0xff\n", cpuctl, plm); return 0; } @@ -564,7 +564,7 @@ static int gsp_phys_fwsec_wait_gfw_boot(void __iomem *bar0) msleep(1); } - pr_err("gsp-phys-fwsec: GFW boot not complete (CPUCTL=0x%08x PLM=0x%08x progress=0x%x, timeout %ums); not resetting or kicking the falcon\n", + pr_err("vgsp-fwsec: GFW boot not complete (CPUCTL=0x%08x PLM=0x%08x progress=0x%x, timeout %ums); not resetting or kicking the falcon\n", cpuctl, plm, progress, GSP_PHYS_GFW_BOOT_TIMEOUT_MS); return -ETIMEDOUT; } @@ -597,14 +597,14 @@ static int gsp_phys_fwsec_patch_interface(struct gsp_phys_fwsec_ucode *u, if (interface_offset > mapped_size || sizeof(*hdr) > mapped_size - interface_offset) { - pr_err("gsp-phys-fwsec: interface offset 0x%x outside DMEM image 0x%x\n", + pr_err("vgsp-fwsec: interface offset 0x%x outside DMEM image 0x%x\n", interface_offset, mapped_size); return -EINVAL; } hdr = (struct gsp_phys_fwsec_intf_header *)(data + interface_offset); if (hdr->entry_count < 2) { - pr_err("gsp-phys-fwsec: interface at 0x%x has only %u entries\n", + pr_err("vgsp-fwsec: interface at 0x%x has only %u entries\n", interface_offset, hdr->entry_count); return -EINVAL; } @@ -628,18 +628,18 @@ static int gsp_phys_fwsec_patch_interface(struct gsp_phys_fwsec_ucode *u, } if (!mapper) { - pr_err("gsp-phys-fwsec: no DMEM mapper entry for cmd 0x%x\n", + pr_err("vgsp-fwsec: no DMEM mapper entry for cmd 0x%x\n", cmd); return -EINVAL; } mapper->init_cmd = cmd; if (mapper->cmd_in_buffer_size < cmd_size) - pr_warn("gsp-phys-fwsec: interface input buffer 0x%x smaller than cmd 0x%x (0x%x bytes)\n", + pr_warn("vgsp-fwsec: interface input buffer 0x%x smaller than cmd 0x%x (0x%x bytes)\n", mapper->cmd_in_buffer_size, cmd, cmd_size); if (mapper->cmd_in_buffer_offset > mapped_size || cmd_size > mapped_size - mapper->cmd_in_buffer_offset) { - pr_err("gsp-phys-fwsec: cmd buffer 0x%x+0x%x outside DMEM image 0x%x\n", + pr_err("vgsp-fwsec: cmd buffer 0x%x+0x%x outside DMEM image 0x%x\n", mapper->cmd_in_buffer_offset, cmd_size, mapped_size); return -EINVAL; } @@ -647,7 +647,7 @@ static int gsp_phys_fwsec_patch_interface(struct gsp_phys_fwsec_ucode *u, memcpy(data + mapper->cmd_in_buffer_offset, cmd_buf, cmd_size); if (cmd_offset) *cmd_offset = mapper->cmd_in_buffer_offset; - pr_info("gsp-phys-fwsec: interface patched: mapper@0x%x init_cmd=0x%x cmd@0x%x (0x%x bytes), out buffer 0x%x/0x%x\n", + pr_info("vgsp-fwsec: interface patched: mapper@0x%x init_cmd=0x%x cmd@0x%x (0x%x bytes), out buffer 0x%x/0x%x\n", (u32)((u8 *)mapper - data), cmd, mapper->cmd_in_buffer_offset, cmd_size, mapper->cmd_out_buffer_offset, mapper->cmd_out_buffer_size); @@ -669,7 +669,7 @@ static int gsp_phys_fwsec_bl_desc_fill(const struct gsp_phys_fwsec_ucode *u, secure_off64 = (s64)d->imem_sec_base - d->imem_virt_base + d->imem_phys_base; if (secure_off64 < 0) { - pr_err("gsp-phys-fwsec: secure IMEM offset underflows (base=0x%x virt=0x%x phys=0x%x)\n", + pr_err("vgsp-fwsec: secure IMEM offset underflows (base=0x%x virt=0x%x phys=0x%x)\n", d->imem_sec_base, d->imem_virt_base, d->imem_phys_base); return -EINVAL; @@ -679,7 +679,7 @@ static int gsp_phys_fwsec_bl_desc_fill(const struct gsp_phys_fwsec_ucode *u, if (secure_off + secure_size > u->code_size || d->imem_phys_base + d->imem_load_size > u->code_size) { - pr_err("gsp-phys-fwsec: code placement invalid (phys=0x%x load=0x%x secOff=0x%x secSize=0x%x alloc=0x%zx)\n", + pr_err("vgsp-fwsec: code placement invalid (phys=0x%x load=0x%x secOff=0x%x secSize=0x%x alloc=0x%zx)\n", d->imem_phys_base, d->imem_load_size, secure_off, secure_size, u->code_size); return -EINVAL; @@ -726,24 +726,24 @@ static void gsp_phys_fwsec_dump_kick_state(void __iomem *bar0, if (fwsec.pdev) pci_read_config_word(fwsec.pdev, PCI_COMMAND, &pci_cmd); - pr_info("gsp-phys-fwsec: FAILDUMP PCI_COMMAND=0x%04x [bus_master=%s mem=%s io=%s]\n", + pr_info("vgsp-fwsec: FAILDUMP PCI_COMMAND=0x%04x [bus_master=%s mem=%s io=%s]\n", pci_cmd, pci_cmd & PCI_COMMAND_MASTER ? "on" : "OFF", pci_cmd & PCI_COMMAND_MEMORY ? "on" : "off", pci_cmd & PCI_COMMAND_IO ? "on" : "off"); - pr_info("gsp-phys-fwsec: FAILDUMP GSP CPUCTL=0x%08x HWCFG=0x%08x HWCFG2=0x%08x ENGINE=0x%08x DMACTL=0x%08x BOOTVEC=0x%08x\n", + pr_info("vgsp-fwsec: FAILDUMP GSP CPUCTL=0x%08x HWCFG=0x%08x HWCFG2=0x%08x ENGINE=0x%08x DMACTL=0x%08x BOOTVEC=0x%08x\n", readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_CPUCTL), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_HWCFG), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_HWCFG2), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_ENGINE), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_DMACTL), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_BOOTVEC)); - pr_info("gsp-phys-fwsec: FAILDUMP GSP MBOX0=0x%08x MBOX1=0x%08x FALCON_OS=0x%08x FALCON_RM=0x%08x\n", + pr_info("vgsp-fwsec: FAILDUMP GSP MBOX0=0x%08x MBOX1=0x%08x FALCON_OS=0x%08x FALCON_RM=0x%08x\n", readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_MAILBOX0), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_MAILBOX1), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_OS), readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_RM)); - pr_info("gsp-phys-fwsec: FAILDUMP SEC2 CPUCTL=0x%08x HWCFG=0x%08x ENGINE=0x%08x MBOX0=0x%08x MBOX1=0x%08x FALCON_OS=0x%08x\n", + pr_info("vgsp-fwsec: FAILDUMP SEC2 CPUCTL=0x%08x HWCFG=0x%08x ENGINE=0x%08x MBOX0=0x%08x MBOX1=0x%08x FALCON_OS=0x%08x\n", readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_CPUCTL), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_HWCFG), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_ENGINE), @@ -751,7 +751,7 @@ static void gsp_phys_fwsec_dump_kick_state(void __iomem *bar0, readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX1), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_OS)); - pr_info("gsp-phys-fwsec: FAILDUMP state WPR2_LO raw=0x%08x VAL=0x%x WPR2_HI raw=0x%08x VAL=0x%x PLM=0x%08x GFW_BOOT=0x%08x SCRATCH_0E=0x%08x FRTS_ERR=0x%x SCRATCH_15=0x%08x SB_ERR=0x%x RISCV_STATUS=0x%08x\n", + pr_info("vgsp-fwsec: FAILDUMP state WPR2_LO raw=0x%08x VAL=0x%x WPR2_HI raw=0x%08x VAL=0x%x PLM=0x%08x GFW_BOOT=0x%08x SCRATCH_0E=0x%08x FRTS_ERR=0x%x SCRATCH_15=0x%08x SB_ERR=0x%x RISCV_STATUS=0x%08x\n", readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), gsp_phys_fwsec_wpr2_lo_val(bar0), readl(bar0 + GSP_PHYS_WPR2_ADDR_HI), @@ -766,14 +766,14 @@ static void gsp_phys_fwsec_dump_kick_state(void __iomem *bar0, for (i = 0; i < GSP_PHYS_VBIOS_SCRATCH_WORDS; i++) words[i] = readl(bar0 + GSP_PHYS_VBIOS_SCRATCH_BASE + i * 4); - pr_info("gsp-phys-fwsec: FAILDUMP scratch 0x1400..0x143f: %*ph\n", + pr_info("vgsp-fwsec: FAILDUMP scratch 0x1400..0x143f: %*ph\n", 64, (const u8 *)words); - pr_info("gsp-phys-fwsec: FAILDUMP scratch 0x1440..0x147f: %*ph\n", + pr_info("vgsp-fwsec: FAILDUMP scratch 0x1440..0x147f: %*ph\n", 64, (const u8 *)words + 64); gsp_phys_falcon_dmem_read(bar0, GSP_PHYS_GSP_BASE, 0, words, sizeof(*bl) / 4); - pr_info("gsp-phys-fwsec: FAILDUMP DMEM0 (84 B): %*ph\n", + pr_info("vgsp-fwsec: FAILDUMP DMEM0 (84 B): %*ph\n", (int)sizeof(*bl), (const u8 *)words); desc_intact = memcmp(words, bl, sizeof(*bl)) == 0; data_image = u->data_va && @@ -784,7 +784,7 @@ static void gsp_phys_fwsec_dump_kick_state(void __iomem *bar0, gsp_phys_falcon_imem_read(bar0, GSP_PHYS_GSP_BASE, bl_dst, words, 4); bl_intact = words[0] == expected_bl0; - pr_info("gsp-phys-fwsec: FAILDUMP IMEM BL @0x%x: %08x %08x %08x %08x (word0 want 0x%08x -> %s)\n", + pr_info("vgsp-fwsec: FAILDUMP IMEM BL @0x%x: %08x %08x %08x %08x (word0 want 0x%08x -> %s)\n", bl_dst, words[0], words[1], words[2], words[3], expected_bl0, bl_intact ? "intact" : "CHANGED"); @@ -796,7 +796,7 @@ static void gsp_phys_fwsec_dump_kick_state(void __iomem *bar0, gsp_phys_falcon_imem_read(bar0, GSP_PHYS_GSP_BASE, u->desc.imem_phys_base, words, 4); code_loaded = have_expected_code && words[0] == expected_code0; - pr_info("gsp-phys-fwsec: FAILDUMP IMEM ns code @0x%x: %08x %08x %08x %08x (word0 want 0x%08x -> %s)\n", + pr_info("vgsp-fwsec: FAILDUMP IMEM ns code @0x%x: %08x %08x %08x %08x (word0 want 0x%08x -> %s)\n", u->desc.imem_phys_base, words[0], words[1], words[2], words[3], expected_code0, code_loaded ? "loaded" : "NOT loaded"); @@ -804,7 +804,7 @@ static void gsp_phys_fwsec_dump_kick_state(void __iomem *bar0, u->data_size >= (size_t)fwsec.cmd_offset + 48) { gsp_phys_falcon_dmem_read(bar0, GSP_PHYS_GSP_BASE, fwsec.cmd_offset, words, 12); - pr_info("gsp-phys-fwsec: FAILDUMP interface patch @DMEM 0x%x (48 B): %*ph\n", + pr_info("vgsp-fwsec: FAILDUMP interface patch @DMEM 0x%x (48 B): %*ph\n", fwsec.cmd_offset, 48, (const u8 *)words); } @@ -816,7 +816,7 @@ static void gsp_phys_fwsec_dump_kick_state(void __iomem *bar0, verdict = "BL descriptor intact, code not loaded -> stalled at the code DMA (or the BL never entered; check bus_master and TRANSCFG)"; else verdict = "DMEM0 matches neither the BL descriptor nor the FWSEC data image"; - pr_info("gsp-phys-fwsec: FAILDUMP verdict: %s\n", verdict); + pr_info("vgsp-fwsec: FAILDUMP verdict: %s\n", verdict); } /* @@ -847,14 +847,14 @@ static int gsp_phys_fwsec_exec_with_loader(void __iomem *bar0, GSP_PHYS_FBIF_TRANSCFG_MEM_TYPE; writel(transcfg, bar0 + GSP_PHYS_GSP_FBIF_BASE + GSP_PHYS_FBIF_TRANSCFG(4)); - pr_info("gsp-phys-fwsec: TRANSCFG[4]@0x%x = 0x%08x (coherent sysmem, physical)\n", + pr_info("vgsp-fwsec: TRANSCFG[4]@0x%x = 0x%08x (coherent sysmem, physical)\n", GSP_PHYS_GSP_FBIF_BASE + GSP_PHYS_FBIF_TRANSCFG(4), readl(bar0 + GSP_PHYS_GSP_FBIF_BASE + GSP_PHYS_FBIF_TRANSCFG(4))); gsp_phys_falcon_dmem_copy(bar0, GSP_PHYS_GSP_BASE, 0, (const u8 *)&bl, sizeof(bl)); - pr_info("gsp-phys-fwsec: BL descriptor at DMEM0: ctxDma=%u codeDma=0x%llx nsOff/Size=0x%x/0x%x secOff/Size=0x%x/0x%x dataDma=0x%llx dataSize=0x%x\n", + pr_info("vgsp-fwsec: BL descriptor at DMEM0: ctxDma=%u codeDma=0x%llx nsOff/Size=0x%x/0x%x secOff/Size=0x%x/0x%x dataDma=0x%llx dataSize=0x%x\n", bl.ctx_dma, (u64)u->code_dma, bl.non_secure_code_off, bl.non_secure_code_size, bl.secure_code_off, bl.secure_code_size, (u64)u->data_dma, bl.data_size); @@ -862,7 +862,7 @@ static int gsp_phys_fwsec_exec_with_loader(void __iomem *bar0, block_count = readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_HWCFG) & GSP_PHYS_HWCFG_IMEM_SIZE; if (block_count * 256 < GSP_PHYS_SEC2_BL_CODE_SIZE) { - pr_err("gsp-phys-fwsec: GSP IMEM too small for the boot-loader (%u blocks)\n", + pr_err("vgsp-fwsec: GSP IMEM too small for the boot-loader (%u blocks)\n", block_count); return -EINVAL; } @@ -871,7 +871,7 @@ static int gsp_phys_fwsec_exec_with_loader(void __iomem *bar0, gsp_phys_sec2_bl_image, GSP_PHYS_SEC2_BL_CODE_SIZE, false, GSP_PHYS_SEC2_BL_START_TAG << 8); - pr_info("gsp-phys-fwsec: generic SEC2 BL code 0x%x bytes at IMEM 0x%x (IMEM_SIZE=%u blocks, 256-byte blocks, tag 0x%x)\n", + pr_info("vgsp-fwsec: generic SEC2 BL code 0x%x bytes at IMEM 0x%x (IMEM_SIZE=%u blocks, 256-byte blocks, tag 0x%x)\n", GSP_PHYS_SEC2_BL_CODE_SIZE, bl_dst, block_count, GSP_PHYS_SEC2_BL_START_TAG); @@ -890,7 +890,7 @@ static int gsp_phys_fwsec_exec_with_loader(void __iomem *bar0, imem_rd, 4); if (memcmp(dmem_rd, &bl, sizeof(dmem_rd)) || memcmp(imem_rd, gsp_phys_sec2_bl_image, sizeof(imem_rd))) { - pr_err("gsp-phys-fwsec: staging not visible before kick (DMEM0 %08x/%08x/%08x/%08x IMEM %08x/%08x/%08x/%08x); the falcon is not accepting DMA - aborting before STARTCPU\n", + pr_err("vgsp-fwsec: staging not visible before kick (DMEM0 %08x/%08x/%08x/%08x IMEM %08x/%08x/%08x/%08x); the falcon is not accepting DMA - aborting before STARTCPU\n", dmem_rd[0], dmem_rd[1], dmem_rd[2], dmem_rd[3], imem_rd[0], imem_rd[1], imem_rd[2], imem_rd[3]); return -EIO; @@ -900,14 +900,14 @@ static int gsp_phys_fwsec_exec_with_loader(void __iomem *bar0, writel(GSP_PHYS_SEC2_BL_START_TAG << 8, bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_BOOTVEC); cpuctl = readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_CPUCTL); - pr_info("gsp-phys-fwsec: BOOTVEC=0x%08x CPUCTL before start=0x%08x\n", + pr_info("vgsp-fwsec: BOOTVEC=0x%08x CPUCTL before start=0x%08x\n", readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_BOOTVEC), cpuctl); gsp_phys_falcon_start_cpu(bar0, GSP_PHYS_GSP_BASE); ret = gsp_phys_falcon_wait_halt(bar0, GSP_PHYS_GSP_BASE, GSP_PHYS_FWSEC_HALT_TIMEOUT_MS); - pr_info("gsp-phys-fwsec: GSP CPUCTL after FWSEC kick=0x%08x\n", + pr_info("vgsp-fwsec: GSP CPUCTL after FWSEC kick=0x%08x\n", readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_CPUCTL)); if (ret || gsp_phys_fwsec_verbose_param) gsp_phys_fwsec_dump_kick_state(bar0, &bl, u, bl_dst); @@ -962,25 +962,25 @@ static int gsp_phys_fwsec_ucode_stage(struct pci_dev *pdev, desc->imem_load_size > code_alloc - desc->imem_phys_base || secure_off >= code_alloc || secure_size > code_alloc - secure_off) { - pr_err("gsp-phys-fwsec: FWSEC IMEM does not fit the code allocation (phys=0x%x load=0x%x secOff=0x%x secSize=0x%x alloc=0x%x)\n", + pr_err("vgsp-fwsec: FWSEC IMEM does not fit the code allocation (phys=0x%x load=0x%x secOff=0x%x secSize=0x%x alloc=0x%x)\n", desc->imem_phys_base, desc->imem_load_size, secure_off, secure_size, code_alloc); return -EINVAL; } if (desc->dmem_phys_base >= data_alloc || desc->dmem_load_size > data_alloc - desc->dmem_phys_base) { - pr_err("gsp-phys-fwsec: FWSEC DMEM does not fit the data allocation (phys=0x%x load=0x%x alloc=0x%x)\n", + pr_err("vgsp-fwsec: FWSEC DMEM does not fit the data allocation (phys=0x%x load=0x%x alloc=0x%x)\n", desc->dmem_phys_base, desc->dmem_load_size, data_alloc); return -EINVAL; } if (desc->dmem_phys_base != 0) - pr_warn("gsp-phys-fwsec: FWSEC DMEM physical base is 0x%x (not 0); interface patching uses the image-buffer offsets as the distribution driver does\n", + pr_warn("vgsp-fwsec: FWSEC DMEM physical base is 0x%x (not 0); interface patching uses the image-buffer offsets as the distribution driver does\n", desc->dmem_phys_base); if (image_start + desc->imem_load_size > vbios->size || image_start + desc->dmem_offset + desc->dmem_load_size > vbios->size) { - pr_err("gsp-phys-fwsec: FWSEC images outside the VBIOS copy\n"); + pr_err("vgsp-fwsec: FWSEC images outside the VBIOS copy\n"); return -EINVAL; } @@ -990,14 +990,14 @@ static int gsp_phys_fwsec_ucode_stage(struct pci_dev *pdev, u->code_va = dma_alloc_coherent(&pdev->dev, code_alloc, &u->code_dma, GFP_KERNEL); if (!u->code_va) { - pr_err("gsp-phys-fwsec: FWSEC code allocation (0x%x) failed\n", + pr_err("vgsp-fwsec: FWSEC code allocation (0x%x) failed\n", code_alloc); return -ENOMEM; } u->data_va = dma_alloc_coherent(&pdev->dev, data_alloc, &u->data_dma, GFP_KERNEL); if (!u->data_va) { - pr_err("gsp-phys-fwsec: FWSEC data allocation (0x%x) failed\n", + pr_err("vgsp-fwsec: FWSEC data allocation (0x%x) failed\n", data_alloc); gsp_phys_fwsec_ucode_free(pdev, u); return -ENOMEM; @@ -1011,7 +1011,7 @@ static int gsp_phys_fwsec_ucode_stage(struct pci_dev *pdev, vbios->data + image_start + desc->dmem_offset, desc->dmem_load_size); - pr_info("gsp-phys-fwsec: staged FWSEC: code alloc 0x%x dma=0x%llx (imemLoad=0x%x secOff/Size=0x%x/0x%x), data alloc 0x%x dma=0x%llx (dmemLoad=0x%x)\n", + pr_info("vgsp-fwsec: staged FWSEC: code alloc 0x%x dma=0x%llx (imemLoad=0x%x secOff/Size=0x%x/0x%x), data alloc 0x%x dma=0x%llx (dmemLoad=0x%x)\n", code_alloc, (u64)u->code_dma, desc->imem_load_size, secure_off, secure_size, data_alloc, (u64)u->data_dma, desc->dmem_load_size); @@ -1090,7 +1090,7 @@ static bool gsp_phys_booter_seed_sequence_state(void __iomem *bar0) (after & (GSP_PHYS_SCRATCH14_BOOTER_VERSION_MASK | GSP_PHYS_SCRATCH14_HANDOFF_MASK)); - pr_info("gsp-phys-fwsec: booter sequence seed: PLM@0x%x 0x%08x (host-open=%s, restored 0x%08x), scratch14 0x%08x -> 0x%08x (booterVersion=%u want %u, handoffs 0x%x) -> %s\n", + pr_info("vgsp-fwsec: booter sequence seed: PLM@0x%x 0x%08x (host-open=%s, restored 0x%08x), scratch14 0x%08x -> 0x%08x (booterVersion=%u want %u, handoffs 0x%x) -> %s\n", plm_addr, plm_orig, opened ? "yes" : "no", readl(bar0 + plm_addr), before, readback, (readback & GSP_PHYS_SCRATCH14_BOOTER_VERSION_MASK) >> @@ -1101,7 +1101,7 @@ static bool gsp_phys_booter_seed_sequence_state(void __iomem *bar0) seeded ? "SEEDED" : "NOT SEEDED (host write blocked)"); if (!seeded) - pr_warn("gsp-phys-fwsec: scratch14 write protection is not host-open; the booter unload handoff gate cannot be satisfied in a FWSEC-only carve\n"); + pr_warn("vgsp-fwsec: scratch14 write protection is not host-open; the booter unload handoff gate cannot be satisfied in a FWSEC-only carve\n"); return seeded; } @@ -1125,7 +1125,7 @@ static int gsp_phys_booter_unload(void __iomem *bar0) u32 m0, m1, scratch; int ret; - pr_info("gsp-phys-fwsec: booter unload: resetting SEC2 falcon\n"); + pr_info("vgsp-fwsec: booter unload: resetting SEC2 falcon\n"); ret = gsp_phys_falcon_reset(bar0, GSP_PHYS_SEC2_BASE); if (ret) return ret; @@ -1152,7 +1152,7 @@ static int gsp_phys_booter_unload(void __iomem *bar0) writel(GSP_PHYS_BOOTER_UNLOAD_MBOX, bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX1); - pr_info("gsp-phys-fwsec: booter unload: image 0x%zx bytes (ns 0x%x, sec 0x%x, data 0x%x), MAILBOX0/1=0xff, BOOTVEC=0\n", + pr_info("vgsp-fwsec: booter unload: image 0x%zx bytes (ns 0x%x, sec 0x%x, data 0x%x), MAILBOX0/1=0xff, BOOTVEC=0\n", sizeof(gsp_phys_booter_unload_image), GSP_PHYS_BOOTER_UNLOAD_NS_CODE_SIZE, GSP_PHYS_BOOTER_UNLOAD_SEC_CODE_SIZE, @@ -1167,17 +1167,17 @@ static int gsp_phys_booter_unload(void __iomem *bar0) scratch = readl(bar0 + GSP_PHYS_BSI_VPR_SECURE_SCRATCH_14); m0 = readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX0); m1 = readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_MAILBOX1); - pr_info("gsp-phys-fwsec: booter unload done: SEC2 M0=0x%08x M1=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x scratch14=0x%08x\n", + pr_info("vgsp-fwsec: booter unload done: SEC2 M0=0x%08x M1=0x%08x WPR2_LO=0x%08x WPR2_HI=0x%08x scratch14=0x%08x\n", m0, m1, readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), readl(bar0 + GSP_PHYS_WPR2_ADDR_HI), scratch); - pr_info("gsp-phys-fwsec: booter unload scratch14: booterVersion=%u handoffs=0x%x (unload clears both)\n", + pr_info("vgsp-fwsec: booter unload scratch14: booterVersion=%u handoffs=0x%x (unload clears both)\n", (scratch & GSP_PHYS_SCRATCH14_BOOTER_VERSION_MASK) >> GSP_PHYS_SCRATCH14_BOOTER_VERSION_SHIFT, (scratch & GSP_PHYS_SCRATCH14_HANDOFF_MASK) >> GSP_PHYS_SCRATCH14_HANDOFF_SHIFT); if (m0 != 0) { - pr_err("gsp-phys-fwsec: booter unload reported error 0x%x\n", + pr_err("vgsp-fwsec: booter unload reported error 0x%x\n", m0); return -EIO; } @@ -1204,12 +1204,12 @@ static void gsp_phys_host_wpr2_unlock(void __iomem *bar0) fuse = readl(bar0 + GSP_PHYS_FUSE_SECURE_MMU_PLM_WR_SECURE); opened = gsp_phys_plm_open(bar0, plm_addr, &plm_orig); - pr_info("gsp-phys-fwsec: host WPR2 unlock: MMU PLM@0x%x 0x%08x -> 0x%08x (host-open=%s), fuse SECURE_MMU_PLM_WR_SECURE=0x%08x\n", + pr_info("vgsp-fwsec: host WPR2 unlock: MMU PLM@0x%x 0x%08x -> 0x%08x (host-open=%s), fuse SECURE_MMU_PLM_WR_SECURE=0x%08x\n", plm_addr, plm_orig, readl(bar0 + plm_addr), opened ? "yes" : "no", fuse); if (!opened) { writel(plm_orig, bar0 + plm_addr); - pr_warn("gsp-phys-fwsec: MMU PLM write protection is fuse-locked (restored 0x%08x); not touching WPR2 (fail-safe stays in force, reboot with approval may be required)\n", + pr_warn("vgsp-fwsec: MMU PLM write protection is fuse-locked (restored 0x%08x); not touching WPR2 (fail-safe stays in force, reboot with approval may be required)\n", readl(bar0 + plm_addr)); return; } @@ -1242,7 +1242,7 @@ static void gsp_phys_host_wpr2_unlock(void __iomem *bar0) writel(reg & ~GSP_PHYS_PFB_MMU_WPR2_ALLOW_MASK, bar0 + GSP_PHYS_PFB_MMU_WPR_ALLOW_WRITE); - pr_info("gsp-phys-fwsec: host WPR2 unlock applied: WPR2_LO=0x%08x WPR2_HI=0x%08x ALLOW_READ=0x%08x ALLOW_WRITE=0x%08x\n", + pr_info("vgsp-fwsec: host WPR2 unlock applied: WPR2_LO=0x%08x WPR2_HI=0x%08x ALLOW_READ=0x%08x ALLOW_WRITE=0x%08x\n", readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), readl(bar0 + GSP_PHYS_WPR2_ADDR_HI), readl(bar0 + GSP_PHYS_PFB_MMU_WPR_ALLOW_READ), @@ -1250,7 +1250,7 @@ static void gsp_phys_host_wpr2_unlock(void __iomem *bar0) /* Restore the board's original privilege mask (best effort). */ writel(plm_orig, bar0 + plm_addr); - pr_info("gsp-phys-fwsec: host WPR2 unlock: MMU PLM restored to 0x%08x\n", + pr_info("vgsp-fwsec: host WPR2 unlock: MMU PLM restored to 0x%08x\n", readl(bar0 + plm_addr)); } @@ -1266,21 +1266,21 @@ static int gsp_phys_fwsec_teardown(void __iomem *bar0) int ret; if (!gsp_phys_fwsec_wpr2_up(bar0)) { - pr_info("gsp-phys-fwsec: teardown: WPR2 already down; resetting the GSP falcon only\n"); + pr_info("vgsp-fwsec: teardown: WPR2 already down; resetting the GSP falcon only\n"); gsp_phys_falcon_reset(bar0, GSP_PHYS_GSP_BASE); return 0; } if (fwsec.ucode.code_va) { gsp_phys_read_vbios_desc_init(&sb_cmd); - pr_info("gsp-phys-fwsec: FWSEC-SB cmd 0x%x (readVbiosDesc version=%u size=%u flags=%u)\n", + pr_info("vgsp-fwsec: FWSEC-SB cmd 0x%x (readVbiosDesc version=%u size=%u flags=%u)\n", GSP_PHYS_FWSEC_CMD_SB, sb_cmd.version, sb_cmd.size, sb_cmd.flags); ret = gsp_phys_fwsec_exec_cmd(bar0, &fwsec.ucode, GSP_PHYS_FWSEC_CMD_SB, &sb_cmd, sizeof(sb_cmd)); if (ret) { - pr_err("gsp-phys-fwsec: FWSEC-SB execution failed: %d; continuing to booter unload\n", + pr_err("vgsp-fwsec: FWSEC-SB execution failed: %d; continuing to booter unload\n", ret); } else { plm = readl(bar0 + GSP_PHYS_GFW_PLM); @@ -1288,33 +1288,33 @@ static int gsp_phys_fwsec_teardown(void __iomem *bar0) GSP_PHYS_GFW_BOOT_PROGRESS_MASK; scratch = readl(bar0 + GSP_PHYS_VBIOS_SCRATCH_15); sb_err = scratch & 0xffff; - pr_info("gsp-phys-fwsec: FWSEC-SB done: SB_ERR=0x%x PLM_LEVEL0=%u GFW_progress=0x%x\n", + pr_info("vgsp-fwsec: FWSEC-SB done: SB_ERR=0x%x PLM_LEVEL0=%u GFW_progress=0x%x\n", sb_err, !!(plm & GSP_PHYS_GFW_PLM_LEVEL0), progress); if (sb_err != 0) - pr_warn("gsp-phys-fwsec: FWSEC-SB reported error 0x%x\n", + pr_warn("vgsp-fwsec: FWSEC-SB reported error 0x%x\n", sb_err); } } else { - pr_warn("gsp-phys-fwsec: no staged FWSEC ucode for FWSEC-SB; running booter unload only\n"); + pr_warn("vgsp-fwsec: no staged FWSEC ucode for FWSEC-SB; running booter unload only\n"); } ret = gsp_phys_booter_unload(bar0); if (ret) - pr_err("gsp-phys-fwsec: booter unload failed: %d\n", ret); + pr_err("vgsp-fwsec: booter unload failed: %d\n", ret); if (gsp_phys_fwsec_wpr2_up(bar0)) { - pr_warn("gsp-phys-fwsec: booter unload left WPR2 up (its handoff gate is unsatisfiable after a FWSEC-only carve); trying the host-side WPR2 unlock\n"); + pr_warn("vgsp-fwsec: booter unload left WPR2 up (its handoff gate is unsatisfiable after a FWSEC-only carve); trying the host-side WPR2 unlock\n"); gsp_phys_host_wpr2_unlock(bar0); } if (gsp_phys_fwsec_wpr2_up(bar0)) { - pr_err("gsp-phys-fwsec: teardown did not clear WPR2 (HI=0x%08x)\n", + pr_err("vgsp-fwsec: teardown did not clear WPR2 (HI=0x%08x)\n", readl(bar0 + GSP_PHYS_WPR2_ADDR_HI)); return -EIO; } - pr_info("gsp-phys-fwsec: teardown complete: WPR2 down\n"); + pr_info("vgsp-fwsec: teardown complete: WPR2 down\n"); return 0; } @@ -1331,28 +1331,28 @@ int gsp_phys_fwsec_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, if (!boot || !pdev || !bar0) return -EINVAL; if (!boot->initialized) { - pr_err("gsp-phys-fwsec: boot layout not initialised; refusing stage 3c\n"); + pr_err("vgsp-fwsec: boot layout not initialised; refusing stage 3c\n"); return -EINVAL; } if (boot->frts_size != ((u64)GSP_PHYS_FRTS_REGION_SIZE_4K << 12)) { - pr_err("gsp-phys-fwsec: FRTS region size mismatch: boot layout 0x%llx, FWSEC constant 0x%llx; refusing stage 3c\n", + pr_err("vgsp-fwsec: FRTS region size mismatch: boot layout 0x%llx, FWSEC constant 0x%llx; refusing stage 3c\n", boot->frts_size, (u64)GSP_PHYS_FRTS_REGION_SIZE_4K << 12); return -EINVAL; } - pr_info("gsp-phys-fwsec: stage 3c FWSEC/FRTS on %s: frtsOffset=0x%llx frtsSize=0x%llx\n", + pr_info("vgsp-fwsec: stage 3c FWSEC/FRTS on %s: frtsOffset=0x%llx frtsSize=0x%llx\n", pci_name(pdev), boot->frts_offset, boot->frts_size); /* Precondition 1: WPR2 must be down. */ wpr2_hi = gsp_phys_fwsec_wpr2_hi_val(bar0); wpr2_lo = gsp_phys_fwsec_wpr2_lo_val(bar0); - pr_info("gsp-phys-fwsec: precondition WPR2: LO=0x%08x (VAL=0x%x) HI=0x%08x (VAL=0x%x), must be down\n", + pr_info("vgsp-fwsec: precondition WPR2: LO=0x%08x (VAL=0x%x) HI=0x%08x (VAL=0x%x), must be down\n", readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), wpr2_lo, readl(bar0 + GSP_PHYS_WPR2_ADDR_HI), wpr2_hi); if (wpr2_hi != 0) { - pr_err("gsp-phys-fwsec: unexpected WPR2 already up; the GPU is in a bad state, refusing FWSEC\n"); + pr_err("vgsp-fwsec: unexpected WPR2 already up; the GPU is in a bad state, refusing FWSEC\n"); return -EBUSY; } @@ -1364,11 +1364,11 @@ int gsp_phys_fwsec_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, /* Precondition 3: the RISC-V core exists (HWCFG2.RISCV). */ hwcfg2 = readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_HWCFG2); if (!(hwcfg2 & BIT(10))) { - pr_err("gsp-phys-fwsec: RISC-V core not enabled (HWCFG2=0x%08x); refusing FWSEC\n", + pr_err("vgsp-fwsec: RISC-V core not enabled (HWCFG2=0x%08x); refusing FWSEC\n", hwcfg2); return -ENODEV; } - pr_info("gsp-phys-fwsec: precondition RISC-V enabled (HWCFG2=0x%08x)\n", + pr_info("vgsp-fwsec: precondition RISC-V enabled (HWCFG2=0x%08x)\n", hwcfg2); /* Read and parse the VBIOS for the FWSEC image. */ @@ -1378,14 +1378,14 @@ int gsp_phys_fwsec_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, fuse = readl(bar0 + GSP_PHYS_FUSE_SECURE_GSP_DEBUG_DIS); use_debug_app = !(fuse & GSP_PHYS_FUSE_SECURE_GSP_DEBUG_DIS_FIELD); - pr_info("gsp-phys-fwsec: fuse SECURE_GSP_DEBUG_DIS=0x%08x -> %s FWSEC image (appId 0x%x)\n", + pr_info("vgsp-fwsec: fuse SECURE_GSP_DEBUG_DIS=0x%08x -> %s FWSEC image (appId 0x%x)\n", fuse, use_debug_app ? "debug" : "production", use_debug_app ? GSP_PHYS_FWSEC_APPID_DEBUG : GSP_PHYS_FWSEC_APPID_PROD); ret = gsp_phys_vbios_parse_fwsec(&vbios, use_debug_app, &desc); if (ret) { - pr_err("gsp-phys-fwsec: FWSEC parse from VBIOS failed: %d\n", ret); + pr_err("vgsp-fwsec: FWSEC parse from VBIOS failed: %d\n", ret); gsp_phys_vbios_free(&vbios); return ret; } @@ -1407,7 +1407,7 @@ int gsp_phys_fwsec_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, frts.frts_region_desc.frts_region_size = GSP_PHYS_FRTS_REGION_SIZE_4K; frts.frts_region_desc.frts_region_media_type = GSP_PHYS_FRTS_REGION_MEDIA_FB; - pr_info("gsp-phys-fwsec: FRTS cmd: readVbiosDesc{version=%u size=%u flags=%u}, region{offset4K=0x%x size=0x%x(4K) media=FB}\n", + pr_info("vgsp-fwsec: FRTS cmd: readVbiosDesc{version=%u size=%u flags=%u}, region{offset4K=0x%x size=0x%x(4K) media=FB}\n", frts.read_vbios_desc.version, frts.read_vbios_desc.size, frts.read_vbios_desc.flags, frts.frts_region_desc.frts_region_offset4k, @@ -1417,7 +1417,7 @@ int gsp_phys_fwsec_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, GSP_PHYS_FWSEC_CMD_FRTS, &frts, sizeof(frts)); if (ret) { - pr_err("gsp-phys-fwsec: FWSEC/FRTS execution failed: %d\n", ret); + pr_err("vgsp-fwsec: FWSEC/FRTS execution failed: %d\n", ret); goto recover; } @@ -1427,27 +1427,27 @@ int gsp_phys_fwsec_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, wpr2_hi = gsp_phys_fwsec_wpr2_hi_val(bar0); wpr2_lo = gsp_phys_fwsec_wpr2_lo_val(bar0); gsp_phys_fwsec_dump_state(bar0, "after FWSEC/FRTS"); - pr_info("gsp-phys-fwsec: checks: FRTS_ERR_CODE=0x%x (want 0), WPR2_HI VAL=0x%x (want nonzero), WPR2_LO VAL=0x%x (want 0x%x)\n", + pr_info("vgsp-fwsec: checks: FRTS_ERR_CODE=0x%x (want 0), WPR2_HI VAL=0x%x (want nonzero), WPR2_LO VAL=0x%x (want 0x%x)\n", frts_err, wpr2_hi, wpr2_lo, (u32)(boot->frts_offset >> 12)); if (frts_err != 0 || wpr2_hi == 0 || wpr2_lo != (u32)(boot->frts_offset >> 12)) { - pr_err("gsp-phys-fwsec: stage 3c FWSEC/FRTS checks FAILED\n"); + pr_err("vgsp-fwsec: stage 3c FWSEC/FRTS checks FAILED\n"); ret = -EIO; goto recover; } - pr_info("gsp-phys-fwsec: stage 3c complete: WPR2 up at frtsOffset=0x%llx; device stays WPR2-owned until release tears it down\n", + pr_info("vgsp-fwsec: stage 3c complete: WPR2 up at frtsOffset=0x%llx; device stays WPR2-owned until release tears it down\n", boot->frts_offset); return 0; recover: - pr_err("gsp-phys-fwsec: running WPR2 teardown (FWSEC-SB + booter unload)\n"); + pr_err("vgsp-fwsec: running WPR2 teardown (FWSEC-SB + booter unload)\n"); recover_ret = gsp_phys_fwsec_teardown(bar0); if (recover_ret) { - pr_err("gsp-phys-fwsec: teardown FAILED: WPR2 is still up; release will refuse the hand-back (reboot may be required; do not retry in this boot)\n"); + pr_err("vgsp-fwsec: teardown FAILED: WPR2 is still up; release will refuse the hand-back (reboot may be required; do not retry in this boot)\n"); } else { - pr_info("gsp-phys-fwsec: teardown complete after failure: WPR2 down; the GPU can be handed back at release\n"); + pr_info("vgsp-fwsec: teardown complete after failure: WPR2 down; the GPU can be handed back at release\n"); } gsp_phys_fwsec_dump_state(bar0, "after teardown"); return ret; @@ -1482,48 +1482,48 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, return -EINVAL; if (gsp_phys_fwsec_param) { - pr_err("gsp-phys-fwsec-dryrun: gsp_phys_fwsec=1 is also set; the device-writing FWSEC run and this read-only dry-run are mutually exclusive - refusing both\n"); + pr_err("vgsp-fwsec-dryrun: gsp_phys_fwsec=1 is also set; the device-writing FWSEC run and this read-only dry-run are mutually exclusive - refusing both\n"); return -EINVAL; } if (!boot->initialized) { - pr_err("gsp-phys-fwsec-dryrun: boot layout not initialised; refusing dry-run\n"); + pr_err("vgsp-fwsec-dryrun: boot layout not initialised; refusing dry-run\n"); return -EINVAL; } if (boot->frts_size != ((u64)GSP_PHYS_FRTS_REGION_SIZE_4K << 12)) { - pr_err("gsp-phys-fwsec-dryrun: FRTS region size mismatch: boot layout 0x%llx, FWSEC constant 0x%llx; refusing dry-run\n", + pr_err("vgsp-fwsec-dryrun: FRTS region size mismatch: boot layout 0x%llx, FWSEC constant 0x%llx; refusing dry-run\n", boot->frts_size, (u64)GSP_PHYS_FRTS_REGION_SIZE_4K << 12); return -EINVAL; } - pr_info("gsp-phys-fwsec-dryrun: READ-ONLY stage 3c validation on %s: frtsOffset=0x%llx frtsSize=0x%llx (no BAR0 writes, no falcon reset, no DMA kick)\n", + pr_info("vgsp-fwsec-dryrun: READ-ONLY stage 3c validation on %s: frtsOffset=0x%llx frtsSize=0x%llx (no BAR0 writes, no falcon reset, no DMA kick)\n", pci_name(pdev), boot->frts_offset, boot->frts_size); /* Read-only preconditions, each pass/fail. */ wpr2_lo = gsp_phys_fwsec_wpr2_lo_val(bar0); wpr2_hi = gsp_phys_fwsec_wpr2_hi_val(bar0); - pr_info("gsp-phys-fwsec-dryrun: precondition WPR2 down: LO raw=0x%08x VAL=0x%x HI raw=0x%08x VAL=0x%x -> %s\n", + pr_info("vgsp-fwsec-dryrun: precondition WPR2 down: LO raw=0x%08x VAL=0x%x HI raw=0x%08x VAL=0x%x -> %s\n", readl(bar0 + GSP_PHYS_WPR2_ADDR_LO), wpr2_lo, readl(bar0 + GSP_PHYS_WPR2_ADDR_HI), wpr2_hi, wpr2_hi == 0 ? "PASS" : "FAIL"); if (wpr2_hi != 0) { - pr_err("gsp-phys-fwsec-dryrun: WPR2 already up; a real stage 3c would refuse, dry-run stops here\n"); + pr_err("vgsp-fwsec-dryrun: WPR2 already up; a real stage 3c would refuse, dry-run stops here\n"); return -EBUSY; } ret = gsp_phys_fwsec_wait_gfw_boot(bar0); - pr_info("gsp-phys-fwsec-dryrun: precondition GFW boot complete (halted + PLM level0 + progress 0xff) -> %s\n", + pr_info("vgsp-fwsec-dryrun: precondition GFW boot complete (halted + PLM level0 + progress 0xff) -> %s\n", ret ? "FAIL" : "PASS"); if (ret) return ret; hwcfg2 = readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_HWCFG2); - pr_info("gsp-phys-fwsec-dryrun: precondition RISC-V core enabled (HWCFG2[10]): HWCFG2=0x%08x -> %s\n", + pr_info("vgsp-fwsec-dryrun: precondition RISC-V core enabled (HWCFG2[10]): HWCFG2=0x%08x -> %s\n", hwcfg2, (hwcfg2 & BIT(10)) ? "PASS" : "FAIL"); if (!(hwcfg2 & BIT(10))) return -ENODEV; - pr_info("gsp-phys-fwsec-dryrun: precondition falcon state (read-only): GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x\n", + pr_info("vgsp-fwsec-dryrun: precondition falcon state (read-only): GSP_CPUCTL=0x%08x SEC2_CPUCTL=0x%08x\n", readl(bar0 + GSP_PHYS_GSP_BASE + GSP_PHYS_FALCON_CPUCTL), readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_CPUCTL)); @@ -1537,7 +1537,7 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, ret = gsp_phys_vbios_parse_fwsec(&vbios, use_debug_app, &desc); if (ret) { - pr_err("gsp-phys-fwsec-dryrun: FWSEC parse from VBIOS failed: %d\n", + pr_err("vgsp-fwsec-dryrun: FWSEC parse from VBIOS failed: %d\n", ret); gsp_phys_vbios_free(&vbios); return ret; @@ -1547,17 +1547,17 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, image_start = desc.desc_offset + desc.desc_size; data_start = image_start + desc.dmem_offset; - pr_info("gsp-phys-fwsec-dryrun: VBIOS summary: ROM size=0x%zx pciOffset=0x%x expansionRomOffset=0x%x IFRversion=%u VBIOSversion=0x%llx\n", + pr_info("vgsp-fwsec-dryrun: VBIOS summary: ROM size=0x%zx pciOffset=0x%x expansionRomOffset=0x%x IFRversion=%u VBIOSversion=0x%llx\n", vbios.size, vbios.pci_offset, vbios.expansion_rom_offset, vbios.ifr_version, vbios.version); - pr_info("gsp-phys-fwsec-dryrun: BIT summary: header@0x%x tokenType=%u-byte (%s) tokens=%u; selected entry appId=0x%x targetId=%u (%s, fuse SECURE_GSP_DEBUG_DIS=0x%08x)\n", + pr_info("vgsp-fwsec-dryrun: BIT summary: header@0x%x tokenType=%u-byte (%s) tokens=%u; selected entry appId=0x%x targetId=%u (%s, fuse SECURE_GSP_DEBUG_DIS=0x%08x)\n", vbios.bit_addr, vbios.bit_token_size, vbios.bit_token_size >= GSP_PHYS_BIT_TOKEN_SIZE_8 ? "2b1w1d u32 DataPtr" : "2b2w u16 DataPtr", vbios.bit_token_entries, desc.app_id, desc.target_id, is_fallback ? "fallback FIRMWARE_SEC_LIC 0x05" : (use_debug_app ? "debug 0x45" : "production 0x85"), fuse); - pr_info("gsp-phys-fwsec-dryrun: FWSEC descriptor type=V%u size=%u at 0x%x; ucode code at 0x%x size=0x%x, data at 0x%x size=0x%x, interfaceOff=0x%x entry=0x%x\n", + pr_info("vgsp-fwsec-dryrun: FWSEC descriptor type=V%u size=%u at 0x%x; ucode code at 0x%x size=0x%x, data at 0x%x size=0x%x, interfaceOff=0x%x entry=0x%x\n", desc.desc_version, desc.desc_size, desc.desc_offset, image_start, desc.imem_load_size, data_start, desc.dmem_load_size, desc.interface_offset, @@ -1569,7 +1569,7 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, desc.imem_load_size < 16 || data_start > vbios.size || desc.dmem_load_size > vbios.size - data_start) { - pr_err("gsp-phys-fwsec-dryrun: FWSEC image outside the ROM copy (image=0x%x imem=0x%x data=0x%x dmem=0x%x rom=0x%zx); refusing\n", + pr_err("vgsp-fwsec-dryrun: FWSEC image outside the ROM copy (image=0x%x imem=0x%x data=0x%x dmem=0x%x rom=0x%zx); refusing\n", image_start, desc.imem_load_size, data_start, desc.dmem_load_size, vbios.size); gsp_phys_vbios_free(&vbios); @@ -1579,15 +1579,15 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, code = vbios.data + image_start; code_crc = crc32_le(0, code, desc.imem_load_size); data_crc = crc32_le(0, vbios.data + data_start, desc.dmem_load_size); - pr_info("gsp-phys-fwsec-dryrun: ucode first 4 words: %08x %08x %08x %08x\n", + pr_info("vgsp-fwsec-dryrun: ucode first 4 words: %08x %08x %08x %08x\n", get_unaligned_le32(code), get_unaligned_le32(code + 4), get_unaligned_le32(code + 8), get_unaligned_le32(code + 12)); - pr_info("gsp-phys-fwsec-dryrun: ucode last 4 words: %08x %08x %08x %08x\n", + pr_info("vgsp-fwsec-dryrun: ucode last 4 words: %08x %08x %08x %08x\n", get_unaligned_le32(code + desc.imem_load_size - 16), get_unaligned_le32(code + desc.imem_load_size - 12), get_unaligned_le32(code + desc.imem_load_size - 8), get_unaligned_le32(code + desc.imem_load_size - 4)); - pr_info("gsp-phys-fwsec-dryrun: CRC32 code(0x%x bytes)=0x%08x data(0x%x bytes)=0x%08x\n", + pr_info("vgsp-fwsec-dryrun: CRC32 code(0x%x bytes)=0x%08x data(0x%x bytes)=0x%08x\n", desc.imem_load_size, code_crc, desc.dmem_load_size, data_crc); /* Capacity registers the staging/placement math depends on. */ @@ -1595,13 +1595,13 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, imem_blocks = gsp_hwcfg & GSP_PHYS_HWCFG_IMEM_SIZE; bl_blocks = imem_blocks >= GSP_PHYS_SEC2_BL_CODE_SIZE / 256 ? imem_blocks - GSP_PHYS_SEC2_BL_CODE_SIZE / 256 : 0; - pr_info("gsp-phys-fwsec-dryrun: GSP falcon HWCFG=0x%08x IMEM_SIZE=%u blocks (256 B) -> generic BL at block %u (IMEM addr 0x%x), tag 0x%x, fits=%s\n", + pr_info("vgsp-fwsec-dryrun: GSP falcon HWCFG=0x%08x IMEM_SIZE=%u blocks (256 B) -> generic BL at block %u (IMEM addr 0x%x), tag 0x%x, fits=%s\n", gsp_hwcfg, imem_blocks, bl_blocks, bl_blocks << 8, GSP_PHYS_SEC2_BL_START_TAG, imem_blocks * 256 >= GSP_PHYS_SEC2_BL_CODE_SIZE ? "yes" : "no"); if (imem_blocks * 256 < GSP_PHYS_SEC2_BL_CODE_SIZE) { - pr_err("gsp-phys-fwsec-dryrun: GSP IMEM too small for the generic boot-loader (%u blocks); refusing\n", + pr_err("vgsp-fwsec-dryrun: GSP IMEM too small for the generic boot-loader (%u blocks); refusing\n", imem_blocks); gsp_phys_vbios_free(&vbios); return -EINVAL; @@ -1610,19 +1610,19 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, sec2_hwcfg = readl(bar0 + GSP_PHYS_SEC2_BASE + GSP_PHYS_FALCON_HWCFG); dmem_blocks = (sec2_hwcfg & GSP_PHYS_HWCFG_DMEM_SIZE) >> GSP_PHYS_HWCFG_DMEM_SIZE_SHIFT; - pr_info("gsp-phys-fwsec-dryrun: SEC2 falcon HWCFG=0x%08x IMEM_SIZE=%u blocks DMEM_SIZE=%u blocks (0x%x bytes) vs booter-unload DMEM data 0x%x -> %s\n", + pr_info("vgsp-fwsec-dryrun: SEC2 falcon HWCFG=0x%08x IMEM_SIZE=%u blocks DMEM_SIZE=%u blocks (0x%x bytes) vs booter-unload DMEM data 0x%x -> %s\n", sec2_hwcfg, sec2_hwcfg & GSP_PHYS_HWCFG_IMEM_SIZE, dmem_blocks, dmem_blocks * 256, GSP_PHYS_BOOTER_UNLOAD_DATA_SIZE, dmem_blocks * 256 >= GSP_PHYS_BOOTER_UNLOAD_DATA_SIZE ? "PASS" : "FAIL"); if (dmem_blocks == 0) { - pr_err("gsp-phys-fwsec-dryrun: SEC2 HWCFG DMEM_SIZE (bits 17:9) decodes to zero - the capacity is not readable/reporting on this part; refusing\n"); + pr_err("vgsp-fwsec-dryrun: SEC2 HWCFG DMEM_SIZE (bits 17:9) decodes to zero - the capacity is not readable/reporting on this part; refusing\n"); gsp_phys_vbios_free(&vbios); return -ENODEV; } if (dmem_blocks * 256 < GSP_PHYS_BOOTER_UNLOAD_DATA_SIZE) { - pr_err("gsp-phys-fwsec-dryrun: Booter-Unload DMEM data 0x%x does not fit SEC2 DMEM 0x%x; the unload split would not load; refusing\n", + pr_err("vgsp-fwsec-dryrun: Booter-Unload DMEM data 0x%x does not fit SEC2 DMEM 0x%x; the unload split would not load; refusing\n", GSP_PHYS_BOOTER_UNLOAD_DATA_SIZE, dmem_blocks * 256); gsp_phys_vbios_free(&vbios); return -ENOSPC; @@ -1652,11 +1652,11 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, if (ret) goto out_free; - pr_info("gsp-phys-fwsec-dryrun: staging plan (host DMA only): code alloc=0x%zx dma=0x%llx (imemLoad=0x%x secOff/Size=0x%x/0x%x), data alloc=0x%zx dma=0x%llx (dmemLoad=0x%x)\n", + pr_info("vgsp-fwsec-dryrun: staging plan (host DMA only): code alloc=0x%zx dma=0x%llx (imemLoad=0x%x secOff/Size=0x%x/0x%x), data alloc=0x%zx dma=0x%llx (dmemLoad=0x%x)\n", u.code_size, (u64)u.code_dma, u.desc.imem_load_size, bl.secure_code_off, bl.secure_code_size, u.data_size, (u64)u.data_dma, u.desc.dmem_load_size); - pr_info("gsp-phys-fwsec-dryrun: 84-byte BL descriptor: reserved[4]=0 signature[4]=0 ctxDma=%u codeDma=0x%llx nsOff/Size=0x%x/0x%x secOff/Size=0x%x/0x%x entry=0x%x dataDma=0x%llx dataSize=0x%x argc=%u argv=%u\n", + pr_info("vgsp-fwsec-dryrun: 84-byte BL descriptor: reserved[4]=0 signature[4]=0 ctxDma=%u codeDma=0x%llx nsOff/Size=0x%x/0x%x secOff/Size=0x%x/0x%x entry=0x%x dataDma=0x%llx dataSize=0x%x argc=%u argv=%u\n", bl.ctx_dma, ((u64)bl.code_dma_hi << 32) | bl.code_dma_lo, bl.non_secure_code_off, bl.non_secure_code_size, @@ -1664,24 +1664,24 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, bl.code_entry_point, ((u64)bl.data_dma_hi << 32) | bl.data_dma_lo, bl.data_size, bl.argc, bl.argv); - pr_info("gsp-phys-fwsec-dryrun: generic-BL placement from real HWCFG: block %u IMEM addr 0x%x BOOTVEC=0x%x code 0x%x bytes tag 0x%x\n", + pr_info("vgsp-fwsec-dryrun: generic-BL placement from real HWCFG: block %u IMEM addr 0x%x BOOTVEC=0x%x code 0x%x bytes tag 0x%x\n", bl_blocks, bl_blocks << 8, GSP_PHYS_SEC2_BL_START_TAG << 8, GSP_PHYS_SEC2_BL_CODE_SIZE, GSP_PHYS_SEC2_BL_START_TAG); - pr_info("gsp-phys-fwsec-dryrun: FRTS region: frtsOffset>>12=0x%x size4K=0x%x media=FB(%u); readVbiosDesc{version=%u size=%u flags=%u}\n", + pr_info("vgsp-fwsec-dryrun: FRTS region: frtsOffset>>12=0x%x size4K=0x%x media=FB(%u); readVbiosDesc{version=%u size=%u flags=%u}\n", frts.frts_region_desc.frts_region_offset4k, frts.frts_region_desc.frts_region_size, frts.frts_region_desc.frts_region_media_type, frts.read_vbios_desc.version, frts.read_vbios_desc.size, frts.read_vbios_desc.flags); - pr_info("gsp-phys-fwsec-dryrun: interface-patch block at DMEM 0x%x (0x%zx bytes): %*ph\n", + pr_info("vgsp-fwsec-dryrun: interface-patch block at DMEM 0x%x (0x%zx bytes): %*ph\n", cmd_off, sizeof(frts), (int)sizeof(frts), (const u8 *)u.data_va + cmd_off); - pr_info("gsp-phys-fwsec-dryrun: expected WPR2 after a real run: HI VAL nonzero; LO VAL=0x%x raw encoding=0x%08x\n", + pr_info("vgsp-fwsec-dryrun: expected WPR2 after a real run: HI VAL nonzero; LO VAL=0x%x raw encoding=0x%08x\n", (u32)(boot->frts_offset >> 12), (u32)((boot->frts_offset >> 12) << 4)); /* Bindata header/size/tag verification (compile-time vs image). */ - pr_info("gsp-phys-fwsec-dryrun: generic SEC2 BL bindata: image=0x%zx code=0x%x at 0 data=0x100 at 0x200 blStartTag=0x%x blDmemDescLoadOff=0 -> %s\n", + pr_info("vgsp-fwsec-dryrun: generic SEC2 BL bindata: image=0x%zx code=0x%x at 0 data=0x100 at 0x200 blStartTag=0x%x blDmemDescLoadOff=0 -> %s\n", sizeof(gsp_phys_sec2_bl_image), GSP_PHYS_SEC2_BL_CODE_SIZE, GSP_PHYS_SEC2_BL_START_TAG, sizeof(gsp_phys_sec2_bl_image) == 0x300 && @@ -1700,7 +1700,7 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, GSP_PHYS_BOOTER_UNLOAD_DATA_OFF + GSP_PHYS_BOOTER_UNLOAD_DATA_SIZE == GSP_PHYS_BOOTER_UNLOAD_IMAGE_SIZE; - pr_info("gsp-phys-fwsec-dryrun: Booter-Unload bindata: image=0x%zx nsCode=0x%x@0x%x secCode=0x%x@0x%x codeEnd=0x%x data=0x%x@0x%x dataEnd=0x%x mailboxTag=0x%x/0x%x sig@0x4e00=%08x -> %s\n", + pr_info("vgsp-fwsec-dryrun: Booter-Unload bindata: image=0x%zx nsCode=0x%x@0x%x secCode=0x%x@0x%x codeEnd=0x%x data=0x%x@0x%x dataEnd=0x%x mailboxTag=0x%x/0x%x sig@0x4e00=%08x -> %s\n", sizeof(gsp_phys_booter_unload_image), GSP_PHYS_BOOTER_UNLOAD_NS_CODE_SIZE, GSP_PHYS_BOOTER_UNLOAD_NS_CODE_OFF, @@ -1717,7 +1717,7 @@ int gsp_phys_fwsec_dryrun_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, uload_ok ? "PASS" : "FAIL"); gsp_phys_fwsec_ucode_free(pdev, &u); - pr_info("gsp-phys-fwsec-dryrun: stage 3c dry-run complete: VBIOS/BIT/FWSEC parse, capacity registers, staging and placement plan validated; no device writes (WPR2 stays down, no falcon reset, no DMA kick)\n"); + pr_info("vgsp-fwsec-dryrun: stage 3c dry-run complete: VBIOS/BIT/FWSEC parse, capacity registers, staging and placement plan validated; no device writes (WPR2 stays down, no falcon reset, no DMA kick)\n"); return 0; out_free: @@ -1736,25 +1736,25 @@ int gsp_phys_fwsec_release(struct gsp_phys_boot *boot, struct pci_dev *pdev, return 0; if (!gsp_phys_fwsec_wpr2_up(bar0)) { - pr_info("gsp-phys-fwsec: release: WPR2 already down; freeing FWSEC staging and handing back\n"); + pr_info("vgsp-fwsec: release: WPR2 already down; freeing FWSEC staging and handing back\n"); gsp_phys_fwsec_ucode_free(pdev, &fwsec.ucode); fwsec.touched = false; return 0; } - pr_info("gsp-phys-fwsec: release: WPR2 is up; tearing down before hand-back\n"); - pr_info("gsp-phys-fwsec: release: booter-unload gate input: scratch14 handoff bits all four DONE=%u\n", + pr_info("vgsp-fwsec: release: WPR2 is up; tearing down before hand-back\n"); + pr_info("vgsp-fwsec: release: booter-unload gate input: scratch14 handoff bits all four DONE=%u\n", gsp_phys_fwsec_scratch14_all_done(bar0)); ret = gsp_phys_fwsec_teardown(bar0); gsp_phys_fwsec_ucode_free(pdev, &fwsec.ucode); if (ret || gsp_phys_fwsec_wpr2_up(bar0)) { - pr_err("gsp-phys-fwsec: release: WPR2 still up after teardown (HI=0x%08x); refusing the hand-back to the distribution driver\n", + pr_err("vgsp-fwsec: release: WPR2 still up after teardown (HI=0x%08x); refusing the hand-back to the distribution driver\n", readl(bar0 + GSP_PHYS_WPR2_ADDR_HI)); return -EIO; } - pr_info("gsp-phys-fwsec: release: WPR2 down after teardown; hand-back is safe\n"); + pr_info("vgsp-fwsec: release: WPR2 down after teardown; hand-back is safe\n"); fwsec.touched = false; return 0; } diff --git a/kernel/gsp_phys_fwsec.h b/kernel/gsp_phys_fwsec.h index d603a81..a336690 100644 --- a/kernel/gsp_phys_fwsec.h +++ b/kernel/gsp_phys_fwsec.h @@ -66,7 +66,7 @@ int gsp_phys_fwsec_run(struct gsp_phys_boot *boot, struct pci_dev *pdev, * Read-only subset of stage 3c: VBIOS/PROM read, IFR/expansion-ROM/BIT * parse, FWSEC ucode extraction, capacity-register reads and the complete * staging/placement computation, logged under the - * "gsp-phys-fwsec-dryrun:" prefix. No BAR0 writes, no falcon resets, no DMA + * "vgsp-fwsec-dryrun:" prefix. No BAR0 writes, no falcon resets, no DMA * kicks; readl() of state registers is the only device interaction. Mutually * exclusive with gsp_phys_fwsec=1 (both set is a hard refusal). */ diff --git a/kernel/gsp_phys_gpu.c b/kernel/gsp_phys_gpu.c index a52714c..d8eed89 100644 --- a/kernel/gsp_phys_gpu.c +++ b/kernel/gsp_phys_gpu.c @@ -162,6 +162,26 @@ bool gsp_phys_ctrl_forward_enabled(void) EXPORT_SYMBOL_GPL(gsp_phys_ctrl_forward_enabled); /* + * Server-managed GR context buffers (default 0). When set, the pre-boot + * SET_REGISTRY profile is the variant with RMSetClientRMAllocatedCtxBuffer=0: + * the GSP-RM allocates and commits the GR engine context on the physical-RM + * path instead of requiring a client-owned-buffer GPU_PROMOTE_CTX (the flow + * that kept returning NV_ERR_INVALID_STATE in every promote shape). The + * registry key is read once at GPU init, so the profile is selected at boot + * prime; a runtime change has no effect until the next boot. + */ +static bool gsp_phys_srv_ctxbuf_param; +module_param_named(gsp_phys_srv_ctxbuf, gsp_phys_srv_ctxbuf_param, bool, 0644); +MODULE_PARM_DESC(gsp_phys_srv_ctxbuf, + "Send the SET_REGISTRY profile with RMSetClientRMAllocatedCtxBuffer=0 so the GSP-RM manages the GR context buffers (default 0: host default profile, client-managed ctx buffers)"); + +bool gsp_phys_srv_ctxbuf_value(void) +{ + return gsp_phys_srv_ctxbuf_param; +} +EXPORT_SYMBOL_GPL(gsp_phys_srv_ctxbuf_value); + +/* * P5 wave-1 shadow work forwarding (default 0). When set, the sema service * requests one real CE copy on the debugfs ladder's channel for each decoded * guest CE push, using only the ladder's module-owned buffers; the software @@ -350,8 +370,43 @@ EXPORT_SYMBOL_GPL(gsp_phys_rmcall_engine_value); * queries, the context buffer/PT allocation, the PDB mapping and the * channel/compute alloc, then stops before BIND with a clear log); * 1 = single MAIN entry, bInitialize=1/bNonmapped=0, size raw+subctx; - * 2 = two-phase external-VAS shape (PA-only nonmapped first, then VA-only); - * 3 = single MAIN entry like 1 but with size = the exact raw save size. + * 2 = two-phase external-VAS shape (PA-only nonmapped first, then VA-only + * with the same PA/VA/size); + * 3 = single MAIN entry like 1 but with size = the exact raw save size; + * 4 = like 2 but the VA-only step is the reference client's zero-field + * entry (only bufferId/gpuVirtAddr/bNonmapped are set); + * 5 = one control with entryCount=2: PA-only init + zero-field VA-only; + * 6 = no-entry hVirtMemory: first allocate an NV01_MEMORY_VIRTUAL + * (class 0x70) VA-range object on the ladder VAS at the context + * window, then PROMOTE_CTX with hVirtMemory, virtAddress/size and + * entryCount=0 (the server creates the memdesc/vaList entry); + * 7 = no-entry bare (virtAddress, size) with entryCount=0 and no + * hVirtMemory (the other documented no-entry branch); + * 8 = single MAIN entry like 1 but on the KMD-managed channel variant V6 + * (V5 plus NVOS04_FLAGS_SKIP_CTXBUFFER_ALLOC): the server takes its + * client-context-buffer path and creates the virtual context memdesc + * itself, instead of resolving our raw-PTE VA against a server-side + * booking (the mode-1/2/4 assert); + * 9 = the stock 570 client's KMD-managed shape: the same V6 channel with + * the zero-field VA-only MAIN entry (bInitialize=0, bNonmapped=0, + * PA/size/physAttr zero) the client sends when the channel skips the + * context-buffer allocation; + * 10 = the old-interface client-managed flow on the same V6 channel: + * GPU_INITIALIZE_CTX (0x2080012d) installs the physical context + * memdesc first, then PROMOTE_CTX with entryCount=0 and the bare + * (virtAddress, size) pair builds the virtual memdesc and binds it; + * 11 = mode 10 with a server-owned FBMEM context buffer (VIDMEM physAttr + * 0x4, local-aperture leaf PTEs) instead of host sysmem. + * Live results: modes 1, 2 step 2 and 4 asserted GSP-RM (0x52a8b04) and + * wedged the device; the PA-only nonmapped steps were accepted; mode 6 + * (hVirtMemory) was refused cleanly with NV_ERR_INVALID_ARGUMENT and a clean + * release (no wedge) because the channel was not KMD-managed; mode 8 (V6 + * channel, init+VA entry) and mode 9 (V6 channel, zero-field VA-only entry) + * both reached the KMD-managed path and were refused cleanly with + * NV_ERR_INVALID_STATE (0x40), again with clean releases; mode 10's + * GPU_INITIALIZE_CTX was accepted (status 0) but the following bare-VA + * promote returned the same clean 0x40, pointing at the sysmem context + * buffer the KMD machinery refuses - which mode 11 replaces with FBMEM. * The set callback clamps out-of-range values to 0 and warns on every nonzero * enable: a failed GR context promote can wedge the device and needs a reboot * with human approval, so run it only when reboot readiness is confirmed. @@ -363,19 +418,19 @@ static int gsp_phys_rmcall_gr_promote_param; static int gsp_phys_rmcall_gr_promote_set(const char *val, const struct kernel_param *kp) { - int ret; + int ret = param_set_int(val, kp); - ret = param_set_int(val, kp); if (ret) return ret; + if (gsp_phys_rmcall_gr_promote_param < 0 || - gsp_phys_rmcall_gr_promote_param > 3) { - pr_warn("gsp-phys: gsp_phys_rmcall_gr_promote=%d is outside 0..3; clamping to 0 (no PROMOTE_CTX)\n", + gsp_phys_rmcall_gr_promote_param > 17) { + pr_warn("vgsp: gsp_phys_rmcall_gr_promote=%d is outside 0..17; clamping to 0 (no PROMOTE_CTX)\n", gsp_phys_rmcall_gr_promote_param); gsp_phys_rmcall_gr_promote_param = 0; } if (gsp_phys_rmcall_gr_promote_param != 0) - pr_warn("gsp-phys: WARNING: gsp_phys_rmcall_gr_promote=%d enabled: a failed GR context promote can assert GSP-RM (NOCAT recType=5 errorCode=0x52a8b04) and wedge the device with WPR2 left up and teardown unable to clear it; recovery requires a reboot with human approval - run only when reboot readiness is confirmed\n", + pr_warn("vgsp: WARNING: gsp_phys_rmcall_gr_promote=%d enabled: a failed GR context promote can assert GSP-RM (NOCAT recType=5 errorCode=0x52a8b04) and wedge the device with WPR2 left up and teardown unable to clear it; recovery requires a reboot with human approval - run only when reboot readiness is confirmed\n", gsp_phys_rmcall_gr_promote_param); return 0; } @@ -389,7 +444,7 @@ module_param_cb(gsp_phys_rmcall_gr_promote, &gsp_phys_rmcall_gr_promote_ops, &gsp_phys_rmcall_gr_promote_param, 0644); MODULE_PARM_DESC(gsp_phys_rmcall_gr_promote, - "GR context-promote bisection (default 0: never send PROMOTE_CTX; 1: single entry init+nonmapped=0 size=raw+subctx, the p6h1b shape; 2: two-phase PA-only nonmapped then VA-only; 3: single entry size=raw); values outside 0..3 clamp to 0 with a warning"); + "GR context-promote bisection (default 0: never send PROMOTE_CTX; 1: single entry init+nonmapped=0 size=raw+subctx, the p6h1b shape; 2: two-phase PA-only nonmapped then VA-only with the same fields; 3: single entry size=raw; 4: two-phase with a zero-field VA-only step; 5: batched entryCount=2 PA-only init + zero-field VA-only; 6: no-entry hVirtMemory, NV01_MEMORY_VIRTUAL (class 0x70) on the VAS at the context window + PROMOTE_CTX entryCount=0; 7: no-entry bare virtAddress+size, entryCount=0; 8: single MAIN entry like 1 on the KMD-managed channel (V6 SKIP_CTXBUFFER_ALLOC), server creates the virtual context memdesc itself; 9: same V6 channel with the stock client's zero-field VA-only MAIN entry, bInitialize=0; 10: same V6 channel, GPU_INITIALIZE_CTX (0x2080012d) installs the physical context memdesc then PROMOTE_CTX entryCount=0 bare virtAddress+size; 11: mode 10 with a server FBMEM context buffer, VIDMEM physAttr 0x4; 12: V5 UVM/vGPU-faithful PA-only MAIN entry (bInitialize=1 bNonmapped=1, no VA) and continue to BIND/SCHEDULE/submit; 13: mode 12 plus a PATCH PA-only promote first, sized from GET_ENGINE_CONTEXT_PROPERTIES engineId 0x10; 14: KMD channel (V6) + PATCH PA-only then the single-entry MAIN init+VA (the flow that books the context VA and commits ENG_CTX_VALID); 15: mode 14 with a server FBMEM MAIN context buffer and VIDMEM physAttr 0x4; 16: mode 14 plus a PM ctxsw PA-only promote first; 17: no client PROMOTE_CTX, paired with gsp_phys_srv_ctxbuf=1 so the GSP-RM server-manages and commits the context); values outside 0..17 clamp to 0 with a warning"); int gsp_phys_rmcall_gr_promote_value(void) { @@ -572,7 +627,7 @@ int gsp_phys_guest_ram_configure(const char *path, u64 gpa_base, goto out; } if (!S_ISREG(file_inode(f)->i_mode)) { - pr_err("gsp-phys: guest RAM %s is not a regular file; refusing\n", + pr_err("vgsp: guest RAM %s is not a regular file; refusing\n", path); ret = -EINVAL; goto out_fput; @@ -584,7 +639,7 @@ int gsp_phys_guest_ram_configure(const char *path, u64 gpa_base, */ if (file_offset + size < file_offset || i_size_read(file_inode(f)) < file_offset + size) { - pr_err("gsp-phys: guest RAM range (off=0x%llx size=0x%llx) does not fit %s (file size=0x%llx); refusing\n", + pr_err("vgsp: guest RAM range (off=0x%llx size=0x%llx) does not fit %s (file size=0x%llx); refusing\n", file_offset, size, path, (u64)i_size_read(file_inode(f))); ret = -ERANGE; @@ -593,7 +648,7 @@ int gsp_phys_guest_ram_configure(const char *path, u64 gpa_base, guest_ram_file = f; strscpy(guest_ram_path, path, sizeof(guest_ram_path)); } else if (strcmp(guest_ram_path, path)) { - pr_err("gsp-phys: guest RAM already configured from %s; one file per module cycle (reload to switch); refusing %s\n", + pr_err("vgsp: guest RAM already configured from %s; one file per module cycle (reload to switch); refusing %s\n", guest_ram_path, path); ret = -EBUSY; goto out; @@ -616,7 +671,7 @@ int gsp_phys_guest_ram_configure(const char *path, u64 gpa_base, range->file_offset = file_offset; range->size = size; - pr_info("gsp-phys: guest RAM configured: path=%s gpa=0x%llx off=0x%llx size=0x%llx (ranges=%u)\n", + pr_info("vgsp: guest RAM configured: path=%s gpa=0x%llx off=0x%llx size=0x%llx (ranges=%u)\n", guest_ram_path, gpa_base, file_offset, size, guest_ram_ranges_n); @@ -639,7 +694,7 @@ void gsp_phys_guest_ram_clear(void) { mutex_lock(&guest_ram_lock); if (guest_ram_file) { - pr_info("gsp-phys: guest RAM released: path=%s ranges=%u\n", + pr_info("vgsp: guest RAM released: path=%s ranges=%u\n", guest_ram_path, guest_ram_ranges_n); fput(guest_ram_file); guest_ram_file = NULL; @@ -835,7 +890,7 @@ static void gsp_phys_runtime_ref_hold(struct pci_dev *pdev) { pm_runtime_get_noresume(&pdev->dev); phys.runtime_ref_held = true; - pr_debug("gsp-phys: runtime-PM reference held on %s\n", pci_name(pdev)); + pr_debug("vgsp: runtime-PM reference held on %s\n", pci_name(pdev)); } static void gsp_phys_runtime_ref_drop(struct pci_dev *pdev) @@ -845,7 +900,7 @@ static void gsp_phys_runtime_ref_drop(struct pci_dev *pdev) pm_runtime_put(&pdev->dev); phys.runtime_ref_held = false; - pr_debug("gsp-phys: runtime-PM reference dropped on %s\n", + pr_debug("vgsp: runtime-PM reference dropped on %s\n", pci_name(pdev)); } @@ -896,7 +951,7 @@ static int gsp_phys_fw_load(void) ret = request_firmware(&phys.fw, gsp_phys_fw_name, phys.pdev ? &phys.pdev->dev : NULL); if (ret) { - pr_err("gsp-phys-fw: request_firmware(%s) failed: %d\n", + pr_err("vgsp-fw: request_firmware(%s) failed: %d\n", gsp_phys_fw_name, ret); return ret; } @@ -904,13 +959,13 @@ static int gsp_phys_fw_load(void) eh = (const Elf64_Ehdr *)phys.fw->data; if (phys.fw->size < sizeof(*eh) || memcmp(eh->e_ident, ELFMAG, SELFMAG)) { - pr_err("gsp-phys-fw: %s is not an ELF image (%zu bytes)\n", + pr_err("vgsp-fw: %s is not an ELF image (%zu bytes)\n", gsp_phys_fw_name, phys.fw->size); goto err; } if (eh->e_ident[EI_CLASS] != ELFCLASS64 || eh->e_machine != EM_RISCV) { - pr_err("gsp-phys-fw: unexpected ELF (class=%u machine=%u)\n", + pr_err("vgsp-fw: unexpected ELF (class=%u machine=%u)\n", eh->e_ident[EI_CLASS], eh->e_machine); goto err; } @@ -918,7 +973,7 @@ static int gsp_phys_fw_load(void) phys.fw_crc32 = crc32_le(0, phys.fw->data, phys.fw->size); phys.fw_loaded = true; - pr_info("gsp-phys-fw: loaded %s: %zu bytes, ELF64 RISC-V, " + pr_info("vgsp-fw: loaded %s: %zu bytes, ELF64 RISC-V, " "entry=0x%llx shnum=%u crc32=0x%08x\n", gsp_phys_fw_name, phys.fw->size, (u64)eh->e_entry, eh->e_shnum, phys.fw_crc32); @@ -946,18 +1001,18 @@ static int gsp_phys_fw_load(void) phys.fw_sig_offset = sh->sh_offset; phys.fw_sig_size = sh->sh_size; } - pr_info("gsp-phys-fw: [%02u] %-24s type=%u addr=0x%llx " + pr_info("vgsp-fw: [%02u] %-24s type=%u addr=0x%llx " "off=0x%llx size=0x%llx\n", i, name, sh->sh_type, (u64)sh->sh_addr, (u64)sh->sh_offset, (u64)sh->sh_size); } if (phys.fw_image_size) - pr_info("gsp-phys-fw: GSP-RM image section .fwimage " + pr_info("vgsp-fw: GSP-RM image section .fwimage " "off=0x%llx size=0x%llx (boot-layout input)\n", phys.fw_image_offset, phys.fw_image_size); if (phys.fw_sig_size) - pr_info("gsp-phys-fw: boot signature section %s " + pr_info("vgsp-fw: boot signature section %s " "off=0x%llx size=0x%llx (boot input)\n", GSP_PHYS_FW_SIGNATURE_SECTION, phys.fw_sig_offset, phys.fw_sig_size); @@ -1008,16 +1063,16 @@ static void gsp_phys_dump_falcon(void) u32 wpr2_lo = readl(phys.bar0 + GSP_PHYS_WPR2_ADDR_LO); u32 wpr2_hi = readl(phys.bar0 + GSP_PHYS_WPR2_ADDR_HI); - pr_info("gsp-phys: GSP falcon CPUCTL=0x%08x [%s%s]\n", gsp_cpuctl, + pr_info("vgsp: GSP falcon CPUCTL=0x%08x [%s%s]\n", gsp_cpuctl, gsp_cpuctl & GSP_PHYS_CPUCTL_STARTCPU ? "started " : "", gsp_cpuctl & GSP_PHYS_CPUCTL_HALTED ? "halted" : "running"); - pr_info("gsp-phys: SEC2 falcon CPUCTL=0x%08x [%s%s] MAILBOX0=0x%08x " + pr_info("vgsp: SEC2 falcon CPUCTL=0x%08x [%s%s] MAILBOX0=0x%08x " "MAILBOX1=0x%08x\n", sec2_cpuctl, sec2_cpuctl & GSP_PHYS_CPUCTL_STARTCPU ? "started " : "", sec2_cpuctl & GSP_PHYS_CPUCTL_HALTED ? "halted" : "running", readl(phys.bar0 + GSP_PHYS_SEC2_MAILBOX0), readl(phys.bar0 + GSP_PHYS_SEC2_MAILBOX1)); - pr_info("gsp-phys: RISCV_STATUS=0x%08x [%sactive] WPR2_LO=0x%08x " + pr_info("vgsp: RISCV_STATUS=0x%08x [%sactive] WPR2_LO=0x%08x " "WPR2_HI=0x%08x [%s]\n", riscv, riscv & GSP_PHYS_RISCV_ACTIVE ? "" : "not ", wpr2_lo, wpr2_hi, wpr2_hi ? "up" : "down"); @@ -1029,11 +1084,11 @@ static int gsp_phys_probe(struct pci_dev *pdev, const struct pci_device_id *id) u16 pci_cmd = 0; int ret; - pr_info("gsp-phys: probe %s\n", pci_name(pdev)); + pr_info("vgsp: probe %s\n", pci_name(pdev)); ret = pci_enable_device(pdev); if (ret) { - pr_err("gsp-phys: pci_enable_device failed: %d\n", ret); + pr_err("vgsp: pci_enable_device failed: %d\n", ret); return ret; } phys.enabled = true; @@ -1047,7 +1102,7 @@ static int gsp_phys_probe(struct pci_dev *pdev, const struct pci_device_id *id) */ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (ret) { - pr_err("gsp-phys: dma_set_mask_and_coherent(DMA_BIT_MASK(64)) failed: %d\n", + pr_err("vgsp: dma_set_mask_and_coherent(DMA_BIT_MASK(64)) failed: %d\n", ret); goto err_unmap; } @@ -1065,14 +1120,14 @@ static int gsp_phys_probe(struct pci_dev *pdev, const struct pci_device_id *id) */ pci_set_master(pdev); pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); - pr_info("gsp-phys: claim PCI_COMMAND=0x%04x [bus_master=%s mem=%s io=%s] dev->is_busmaster=%u\n", + pr_info("vgsp: claim PCI_COMMAND=0x%04x [bus_master=%s mem=%s io=%s] dev->is_busmaster=%u\n", pci_cmd, pci_cmd & PCI_COMMAND_MASTER ? "on" : "OFF", pci_cmd & PCI_COMMAND_MEMORY ? "on" : "off", pci_cmd & PCI_COMMAND_IO ? "on" : "off", pdev->is_busmaster); ret = pci_request_regions(pdev, "open-iov-gsp-phys"); if (ret) { - pr_err("gsp-phys: pci_request_regions failed: %d\n", ret); + pr_err("vgsp: pci_request_regions failed: %d\n", ret); goto err_unmap; } phys.regions = true; @@ -1080,32 +1135,32 @@ static int gsp_phys_probe(struct pci_dev *pdev, const struct pci_device_id *id) phys.bar0 = pci_iomap(pdev, 0, 0); phys.bar0_len = pci_resource_len(pdev, 0); if (!phys.bar0) { - pr_err("gsp-phys: BAR0 map failed\n"); + pr_err("vgsp: BAR0 map failed\n"); ret = -ENOMEM; goto err_unmap; } phys.bar1 = pci_iomap(pdev, 1, 0); phys.bar1_len = pci_resource_len(pdev, 1); if (!phys.bar1) { - pr_err("gsp-phys: BAR1 map failed\n"); + pr_err("vgsp: BAR1 map failed\n"); ret = -ENOMEM; goto err_unmap; } phys.bar3 = pci_iomap(pdev, 3, 0); phys.bar3_len = pci_resource_len(pdev, 3); if (!phys.bar3) { - pr_err("gsp-phys: BAR3 map failed\n"); + pr_err("vgsp: BAR3 map failed\n"); ret = -ENOMEM; goto err_unmap; } boot0 = readl(phys.bar0 + GSP_PHYS_BOOT_0); boot1 = readl(phys.bar0 + GSP_PHYS_BOOT_1); - pr_info("gsp-phys: BAR0 len=0x%llx BAR1 len=0x%llx BAR3 len=0x%llx\n", + pr_info("vgsp: BAR0 len=0x%llx BAR1 len=0x%llx BAR3 len=0x%llx\n", (u64)phys.bar0_len, (u64)phys.bar1_len, (u64)phys.bar3_len); - pr_info("gsp-phys: BOOT0=0x%08x BOOT1=0x%08x (chip family in BOOT0[15:4])\n", + pr_info("vgsp: BOOT0=0x%08x BOOT1=0x%08x (chip family in BOOT0[15:4])\n", boot0, boot1); - pr_info("gsp-phys: GSP_CPUCTL=0x%08x MAILBOX0=0x%08x MAILBOX1=0x%08x " + pr_info("vgsp: GSP_CPUCTL=0x%08x MAILBOX0=0x%08x MAILBOX1=0x%08x " "ENGINE=0x%08x FALCON_OS=0x%08x\n", readl(phys.bar0 + GSP_PHYS_GSP_CPUCTL), readl(phys.bar0 + GSP_PHYS_GSP_MAILBOX0), @@ -1117,7 +1172,7 @@ static int gsp_phys_probe(struct pci_dev *pdev, const struct pci_device_id *id) phys.pdev = pdev; phys.claimed = true; - pr_info("gsp-phys: claimed %s\n", pci_name(pdev)); + pr_info("vgsp: claimed %s\n", pci_name(pdev)); return 0; err_unmap: @@ -1127,7 +1182,7 @@ err_unmap: static void gsp_phys_remove(struct pci_dev *pdev) { - pr_info("gsp-phys: remove %s\n", pci_name(pdev)); + pr_info("vgsp: remove %s\n", pci_name(pdev)); phys.claimed = false; gsp_phys_unmap(pdev); @@ -1161,7 +1216,7 @@ static bool gsp_phys_power_lock_one(struct pci_dev *pdev) struct gsp_phys_power_lock *lock; if (phys.nr_locks >= ARRAY_SIZE(phys.locks)) { - pr_warn("gsp-phys: power-lock table full, %s left unlocked\n", + pr_warn("vgsp: power-lock table full, %s left unlocked\n", pci_name(pdev)); return false; } @@ -1174,7 +1229,7 @@ static bool gsp_phys_power_lock_one(struct pci_dev *pdev) pm_runtime_forbid(&pdev->dev); pci_d3cold_disable(pdev); - pr_info("gsp-phys: power domain locked: %s (runtime_auto was %d, d3cold was %d)\n", + pr_info("vgsp: power domain locked: %s (runtime_auto was %d, d3cold was %d)\n", pci_name(pdev), lock->was_runtime_auto, lock->was_d3cold_enabled); return true; @@ -1226,10 +1281,10 @@ static void gsp_phys_power_unlock(void) if (lock->was_d3cold_enabled) pci_d3cold_enable(lock->pdev); - pr_info("gsp-phys: power domain released: %s\n", + pr_info("vgsp: power domain released: %s\n", pci_name(lock->pdev)); } else { - pr_info("gsp-phys: power domain left LOCKED (gsp_phys_repower=0): %s\n", + pr_info("vgsp: power domain left LOCKED (gsp_phys_repower=0): %s\n", pci_name(lock->pdev)); } pci_dev_put(lock->pdev); @@ -1282,7 +1337,7 @@ static int gsp_phys_board_check(struct pci_dev *pdev, const char *phase) ret = pci_read_config_dword(pdev, PCI_VENDOR_ID, &id); if (ret != PCIBIOS_SUCCESSFUL || PCI_POSSIBLE_ERROR(id) || (id & 0xffff) != GSP_PHYS_VENDOR) { - WARN(1, "gsp-phys: board unresponsive %s: %s config id=0x%08x rc=%d; aborting - do not retry in this boot\n", + WARN(1, "vgsp: board unresponsive %s: %s config id=0x%08x rc=%d; aborting - do not retry in this boot\n", phase, pci_name(pdev), id, ret); return -EIO; } @@ -1290,16 +1345,16 @@ static int gsp_phys_board_check(struct pci_dev *pdev, const char *phase) if (root && pci_is_pcie(root)) { ret = pcie_capability_read_word(root, PCI_EXP_LNKSTA, &lnksta); if (ret != PCIBIOS_SUCCESSFUL) - pr_warn("gsp-phys: %s: root port %s link status read failed (rc=%d)\n", + pr_warn("vgsp: %s: root port %s link status read failed (rc=%d)\n", phase, pci_name(root), ret); else - pr_info("gsp-phys: board check %s: %s id=%04x:%04x, root %s link speed %s width x%u\n", + pr_info("vgsp: board check %s: %s id=%04x:%04x, root %s link speed %s width x%u\n", phase, pci_name(pdev), id & 0xffff, id >> 16, pci_name(root), gsp_phys_link_speed(lnksta), (lnksta & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT); } else { - pr_info("gsp-phys: board check %s: %s id=%04x:%04x (no PCIe root port)\n", + pr_info("vgsp: board check %s: %s id=%04x:%04x (no PCIe root port)\n", phase, pci_name(pdev), id & 0xffff, id >> 16); } @@ -1325,10 +1380,10 @@ static void gsp_phys_claim_failed(struct pci_dev *pdev) ret = device_attach(&pdev->dev); drv = pdev->dev.driver; if (drv) - pr_info("gsp-phys: claim aborted; %s rebound to %s (rc=%d)\n", + pr_info("vgsp: claim aborted; %s rebound to %s (rc=%d)\n", pci_name(pdev), drv->name, ret); else - pr_warn("gsp-phys: claim aborted; %s has no driver (rc=%d)\n", + pr_warn("vgsp: claim aborted; %s has no driver (rc=%d)\n", pci_name(pdev), ret); msleep(GSP_PHYS_POWER_SETTLE_MS); @@ -1352,13 +1407,13 @@ int gsp_phys_gpu_claim(void) return 0; if (!gsp_phys_hazard_ack) { - pr_err("gsp-phys: REFUSED: claiming the physical GPU unbinds the distribution NVIDIA driver; on this host that can leave the dGPU unresponsive and hard-freeze the system (observed 2026-09-30, no crash record). Pass gsp_phys_hazard_ack=1 only with a reviewed recovery plan and no other work on the host.\n"); + pr_err("vgsp: REFUSED: claiming the physical GPU unbinds the distribution NVIDIA driver; on this host that can leave the dGPU unresponsive and hard-freeze the system (observed 2026-09-30, no crash record). Pass gsp_phys_hazard_ack=1 only with a reviewed recovery plan and no other work on the host.\n"); return -EPERM; } pdev = pci_get_device(GSP_PHYS_VENDOR, GSP_PHYS_DEVICE, NULL); if (!pdev) { - pr_err("gsp-phys: device %04x:%04x not found\n", + pr_err("vgsp: device %04x:%04x not found\n", GSP_PHYS_VENDOR, GSP_PHYS_DEVICE); return -ENODEV; } @@ -1372,7 +1427,7 @@ int gsp_phys_gpu_claim(void) if (pdev->dev.power.runtime_status == RPM_SUSPENDED || (pci_upstream_bridge(pdev) && pci_upstream_bridge(pdev)->dev.power.runtime_status == RPM_SUSPENDED)) { - pr_err("gsp-phys: refusing claim: GPU or root port already runtime-suspended; the board may be power-gated (refusing to resume it)\n"); + pr_err("vgsp: refusing claim: GPU or root port already runtime-suspended; the board may be power-gated (refusing to resume it)\n"); pci_dev_put(pdev); return -EBUSY; } @@ -1406,7 +1461,7 @@ int gsp_phys_gpu_claim(void) } if (READ_ONCE(pdev->dev.power.runtime_status) != RPM_ACTIVE || (root && READ_ONCE(root->dev.power.runtime_status) != RPM_ACTIVE)) { - pr_err("gsp-phys: refusing to unbind: GPU/root port did not reach D0 (status GPU=%d port=%d)\n", + pr_err("vgsp: refusing to unbind: GPU/root port did not reach D0 (status GPU=%d port=%d)\n", pdev->dev.power.runtime_status, root ? root->dev.power.runtime_status : -1); ret = -EBUSY; @@ -1418,12 +1473,12 @@ int gsp_phys_gpu_claim(void) msleep(100); if (pdev->dev.driver) { - pr_info("gsp-phys: unbinding %s from %s\n", + pr_info("vgsp: unbinding %s from %s\n", pdev->dev.driver->name, pci_name(pdev)); device_release_driver(&pdev->dev); } if (pdev->dev.driver) { - pr_err("gsp-phys: %s still bound after unbind (usage count?)\n", + pr_err("vgsp: %s still bound after unbind (usage count?)\n", pdev->dev.driver->name); ret = -EBUSY; goto err_recover; @@ -1431,13 +1486,13 @@ int gsp_phys_gpu_claim(void) ret = pci_register_driver(&gsp_phys_driver); if (ret) { - pr_err("gsp-phys: register driver failed: %d\n", ret); + pr_err("vgsp: register driver failed: %d\n", ret); goto err_recover; } phys.drv_registered = true; if (!phys.claimed) { - pr_err("gsp-phys: our driver did not bind %s\n", pci_name(pdev)); + pr_err("vgsp: our driver did not bind %s\n", pci_name(pdev)); ret = -ENODEV; goto err_recover; } @@ -1454,12 +1509,12 @@ int gsp_phys_gpu_claim(void) gsp_phys_runtime_ref_hold(pdev); pci_dev_put(pdev); - pr_info("gsp-phys: physical GPU claimed (backend rung 1)\n"); + pr_info("vgsp: physical GPU claimed (backend rung 1)\n"); if (gsp_phys_fw_load()) { - pr_warn("gsp-phys: firmware load failed; backend stays at rung 1\n"); + pr_warn("vgsp: firmware load failed; backend stays at rung 1\n"); } else { - pr_info("gsp-phys: real GSP firmware staged (backend rung 2)\n"); + pr_info("vgsp: real GSP firmware staged (backend rung 2)\n"); { bool boot = gsp_phys_boot_enabled(); @@ -1477,51 +1532,51 @@ int gsp_phys_gpu_claim(void) */ if ((boot && boot_dry) || (boot && fwsec_dry) || (boot_dry && fwsec)) { - pr_err("gsp-phys: REFUSED: conflicting stage parameters (gsp_phys_boot=%u gsp_phys_boot_dryrun=%u gsp_phys_fwsec=%u gsp_phys_fwsec_dryrun=%u); refusing all stages (nothing written)\n", + pr_err("vgsp: REFUSED: conflicting stage parameters (gsp_phys_boot=%u gsp_phys_boot_dryrun=%u gsp_phys_fwsec=%u gsp_phys_fwsec_dryrun=%u); refusing all stages (nothing written)\n", (unsigned int)boot, (unsigned int)boot_dry, (unsigned int)fwsec, (unsigned int)fwsec_dry); } else if (fwsec && !boot) { - pr_err("gsp-phys-fwsec: REFUSED: FWSEC-only carve is not host-recoverable; use gsp_phys_boot=1 (full boot lifecycle) or gsp_phys_fwsec_dryrun=1 (read-only)\n"); + pr_err("vgsp-fwsec: REFUSED: FWSEC-only carve is not host-recoverable; use gsp_phys_boot=1 (full boot lifecycle) or gsp_phys_fwsec_dryrun=1 (read-only)\n"); } else if (gsp_phys_layout_enabled() || gsp_phys_boot_requested() || fwsec_dry) { if (!gsp_phys_layout_enabled() && !gsp_phys_boot_requested() && fwsec_dry) - pr_info("gsp-phys: gsp_phys_fwsec_dryrun set without gsp_phys_layout (or gsp_phys_boot); initialising the stage-3b boot layout for the read-only dry-run (nothing written)\n"); + pr_info("vgsp: gsp_phys_fwsec_dryrun set without gsp_phys_layout (or gsp_phys_boot); initialising the stage-3b boot layout for the read-only dry-run (nothing written)\n"); if (gsp_phys_boot_layout_init(&phys.boot, phys.pdev, phys.bar0, phys.fw_image_size, phys.bar1_len)) { - pr_warn("gsp-phys: boot layout/allocation failed; backend stays at rung 2\n"); + pr_warn("vgsp: boot layout/allocation failed; backend stays at rung 2\n"); } else if (boot) { struct gsp_phys_boot_sources src; if (!phys.fw_loaded || !phys.fw_image_size || !phys.fw_sig_size) { - pr_err("gsp-phys: gsp_phys_boot=1 but the staged firmware lacks .fwimage/%s; refusing the boot stages (no writes)\n", + pr_err("vgsp: gsp_phys_boot=1 but the staged firmware lacks .fwimage/%s; refusing the boot stages (no writes)\n", GSP_PHYS_FW_SIGNATURE_SECTION); } else if (gsp_phys_fwsec_board_debug(phys.bar0)) { - pr_err("gsp-phys: gsp_phys_boot=1 on a debug-fuse board but only production boot images are staged; refusing all boot stages before FWSEC (nothing written)\n"); + pr_err("vgsp: gsp_phys_boot=1 on a debug-fuse board but only production boot images are staged; refusing all boot stages before FWSEC (nothing written)\n"); } else if (gsp_phys_fwsec_run(&phys.boot, phys.pdev, phys.bar0)) { - pr_warn("gsp-phys: stage 3c FWSEC failed (see recovery log above)\n"); + pr_warn("vgsp: stage 3c FWSEC failed (see recovery log above)\n"); } else { gsp_phys_fw_boot_sources(&src); - pr_info("gsp-phys: stage 3c FWSEC complete (WPR2 up; release will tear it down)\n"); + pr_info("vgsp: stage 3c FWSEC complete (WPR2 up; release will tear it down)\n"); if (gsp_phys_boot_prime(&phys.boot, phys.pdev, phys.bar0, &src, false)) { - pr_warn("gsp-phys: stage 3d boot staging failed (see log above)\n"); + pr_warn("vgsp: stage 3d boot staging failed (see log above)\n"); } else if (gsp_phys_boot_run(&phys.boot, phys.pdev, phys.bar0)) { - pr_warn("gsp-phys: stage 3d boot failed (see log above); release runs the existing WPR2 teardown\n"); + pr_warn("vgsp: stage 3d boot failed (see log above); release runs the existing WPR2 teardown\n"); } else { - pr_info("gsp-phys: stage 3d boot complete\n"); + pr_info("vgsp: stage 3d boot complete\n"); gsp_phys_boot_rmwait(&phys.boot, phys.bar0, phys.bar0_len); @@ -1534,15 +1589,15 @@ int gsp_phys_gpu_claim(void) if (gsp_phys_fwsec_dryrun_run( &phys.boot, phys.pdev, phys.bar0)) - pr_warn("gsp-phys: stage 3c dry-run failed (read-only; see log above)\n"); + pr_warn("vgsp: stage 3c dry-run failed (read-only; see log above)\n"); else - pr_info("gsp-phys: stage 3c dry-run complete (read-only; nothing written)\n"); + pr_info("vgsp: stage 3c dry-run complete (read-only; nothing written)\n"); } if (boot_dry) { if (!phys.fw_loaded || !phys.fw_image_size || !phys.fw_sig_size) { - pr_warn("gsp-phys: stage 3d dry-run unavailable: staged firmware lacks .fwimage/%s (read-only)\n", + pr_warn("vgsp: stage 3d dry-run unavailable: staged firmware lacks .fwimage/%s (read-only)\n", GSP_PHYS_FW_SIGNATURE_SECTION); } else { gsp_phys_fw_boot_sources(&src); @@ -1552,9 +1607,9 @@ int gsp_phys_gpu_claim(void) phys.bar0, &src, true)) - pr_warn("gsp-phys: stage 3d dry-run prime failed (read-only; see log above)\n"); + pr_warn("vgsp: stage 3d dry-run prime failed (read-only; see log above)\n"); else - pr_info("gsp-phys: stage 3d dry-run prime complete (read-only; nothing written)\n"); + pr_info("vgsp: stage 3d dry-run prime complete (read-only; nothing written)\n"); } } } @@ -1575,7 +1630,7 @@ err_board: * has nothing to drop. The D0 locks are intentionally left in * place. */ - pr_err("gsp-phys: claim aborted with the power domain LOCKED and no driver on %s; not rebinding the distribution driver (do not retry in this boot)\n", + pr_err("vgsp: claim aborted with the power domain LOCKED and no driver on %s; not rebinding the distribution driver (do not retry in this boot)\n", pci_name(pdev)); pci_dev_put(pdev); return ret; @@ -1667,10 +1722,10 @@ void gsp_phys_gpu_release(void) * abort. */ if (wpr2_ret) { - pr_err("gsp-phys: NOT rebinding %s: WPR2 teardown did not complete (WPR2 still up or board unresponsive); do not boot the distribution driver against it; power domain stays LOCKED (reboot with approval; do not retry in this boot)\n", + pr_err("vgsp: NOT rebinding %s: WPR2 teardown did not complete (WPR2 still up or board unresponsive); do not boot the distribution driver against it; power domain stays LOCKED (reboot with approval; do not retry in this boot)\n", pci_name(pdev)); if (phys.runtime_ref_held) - pr_debug("gsp-phys: keeping the runtime-PM reference on %s held (WPR2 still up)\n", + pr_debug("vgsp: keeping the runtime-PM reference on %s held (WPR2 still up)\n", pci_name(pdev)); pci_dev_put(pdev); return; @@ -1683,7 +1738,7 @@ void gsp_phys_gpu_release(void) * driverless board cannot be power-gated again. */ if (gsp_phys_board_check(pdev, "before rebind")) { - pr_err("gsp-phys: NOT rebinding %s: board unresponsive; power domain stays LOCKED (do not retry in this boot)\n", + pr_err("vgsp: NOT rebinding %s: board unresponsive; power domain stays LOCKED (do not retry in this boot)\n", pci_name(pdev)); /* * Intentional imbalance: the claim's runtime-PM @@ -1693,7 +1748,7 @@ void gsp_phys_gpu_release(void) * drops it; otherwise it stays held until reboot. */ if (phys.runtime_ref_held) - pr_debug("gsp-phys: keeping the runtime-PM reference on %s held (intentional abort)\n", + pr_debug("vgsp: keeping the runtime-PM reference on %s held (intentional abort)\n", pci_name(pdev)); pci_dev_put(pdev); return; @@ -1702,7 +1757,7 @@ void gsp_phys_gpu_release(void) ret = device_attach(&pdev->dev); drv = pdev->dev.driver; if (!drv) { - pr_err("gsp-phys: %s did not rebind (rc=%d); power domain stays LOCKED; rebind the distribution driver manually (e.g. `modprobe nvidia`), then unload\n", + pr_err("vgsp: %s did not rebind (rc=%d); power domain stays LOCKED; rebind the distribution driver manually (e.g. `modprobe nvidia`), then unload\n", pci_name(pdev), ret); /* * Same intentional imbalance as the unresponsive-board @@ -1710,13 +1765,13 @@ void gsp_phys_gpu_release(void) * the runtime-PM reference stays held with them. */ if (phys.runtime_ref_held) - pr_debug("gsp-phys: keeping the runtime-PM reference on %s held (no rebind)\n", + pr_debug("vgsp: keeping the runtime-PM reference on %s held (no rebind)\n", pci_name(pdev)); pci_dev_put(pdev); return; } - pr_info("gsp-phys: released %s; rebound to %s (rc=%d)\n", + pr_info("vgsp: released %s; rebound to %s (rc=%d)\n", pci_name(pdev), drv->name, ret); /* @@ -1734,7 +1789,7 @@ void gsp_phys_gpu_release(void) msleep(GSP_PHYS_REBIND_GATE_POLL_MS); } if (i == GSP_PHYS_REBIND_GATE_TRIES) { - pr_err("gsp-phys: %s did not resume after the rebind (driver=%s status=%d); power domain stays LOCKED (do not retry in this boot)\n", + pr_err("vgsp: %s did not resume after the rebind (driver=%s status=%d); power domain stays LOCKED (do not retry in this boot)\n", pci_name(pdev), pdev->dev.driver ? pdev->dev.driver->name : "none", pdev->dev.power.runtime_status); @@ -1745,7 +1800,7 @@ void gsp_phys_gpu_release(void) * again. It stays held until reboot. */ if (phys.runtime_ref_held) - pr_debug("gsp-phys: keeping the runtime-PM reference on %s held (rebind gate timeout)\n", + pr_debug("vgsp: keeping the runtime-PM reference on %s held (rebind gate timeout)\n", pci_name(pdev)); pci_dev_put(pdev); return; @@ -1848,7 +1903,7 @@ static void gsp_phys_backend_static_probe_work(struct work_struct *work) ret = gsp_phys_backend_static_probe(); if (ret) - pr_warn("gsp-phys: static-config probe failed: %d; the static overlay keeps the emulated model\n", + pr_warn("vgsp: static-config probe failed: %d; the static overlay keeps the emulated model\n", ret); } @@ -1873,19 +1928,19 @@ static bool gsp_phys_backend_claim_release_locked(const char *who) if (backend.state == GSP_PHYS_BACKEND_OFF) return false; if (backend.module_owned) { - pr_info("gsp-phys: backend %s: module-owned claim stays up (released at rmmod)\n", + pr_info("vgsp: backend %s: module-owned claim stays up (released at rmmod)\n", who); return false; } if (backend.releasing) { - pr_info("gsp-phys: backend %s: release already in progress\n", + pr_info("vgsp: backend %s: release already in progress\n", who); return false; } if (backend.state != GSP_PHYS_BACKEND_STOPPING) { WRITE_ONCE(backend.state, GSP_PHYS_BACKEND_STOPPING); backend.generation++; - pr_info("gsp-phys: backend %s: STOPPING (generation=%u, refcount=%u)\n", + pr_info("vgsp: backend %s: STOPPING (generation=%u, refcount=%u)\n", who, backend.generation, backend.refcount); } backend.releasing = true; @@ -1918,7 +1973,7 @@ static void gsp_phys_backend_release_run(void) backend.releasing = false; WRITE_ONCE(backend.state, GSP_PHYS_BACKEND_OFF); mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend release: OFF (owner=mdev)\n"); + pr_info("vgsp: backend release: OFF (owner=mdev)\n"); } int gsp_phys_backend_start(void) @@ -1929,13 +1984,13 @@ int gsp_phys_backend_start(void) if (backend.state == GSP_PHYS_BACKEND_STOPPING) { mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend start refused: session is STOPPING\n"); + pr_info("vgsp: backend start refused: session is STOPPING\n"); return -EAGAIN; } if (backend.state != GSP_PHYS_BACKEND_OFF) { backend.refcount++; - pr_info("gsp-phys: backend start: joining live session (state=%d, refcount=%u, owner=%s)\n", + pr_info("vgsp: backend start: joining live session (state=%d, refcount=%u, owner=%s)\n", backend.state, backend.refcount, backend.module_owned ? "module" : "mdev"); mutex_unlock(&gsp_phys_session_lock); @@ -1953,7 +2008,7 @@ int gsp_phys_backend_start(void) was_claimed = gsp_phys_gpu_claimed(); if (!was_claimed && !gsp_phys_gpu_enabled()) { mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend start refused: gsp_phys_gpu=0, no claim requested (guest stays on emulation)\n"); + pr_info("vgsp: backend start refused: gsp_phys_gpu=0, no claim requested (guest stays on emulation)\n"); return -EOPNOTSUPP; } @@ -1962,7 +2017,7 @@ int gsp_phys_backend_start(void) if (was_claimed) { if (!gsp_phys_boot_rm_ready()) - pr_warn("gsp-phys: backend start: joined the live module-owned claim but the GSP-RM session is not ready (init-done/unload bits); module-owned release is handled at rmmod\n"); + pr_warn("vgsp: backend start: joined the live module-owned claim but the GSP-RM session is not ready (init-done/unload bits); module-owned release is handled at rmmod\n"); /* * A new READY session: bump the generation (so a cache left * from an earlier session can never match) and fill the @@ -1971,7 +2026,7 @@ int gsp_phys_backend_start(void) backend.generation++; gsp_phys_backend_static_invalidate(); WRITE_ONCE(backend.state, GSP_PHYS_BACKEND_READY); - pr_info("gsp-phys: backend start: joined the live module-owned claim (READY, generation=%u)\n", + pr_info("vgsp: backend start: joined the live module-owned claim (READY, generation=%u)\n", backend.generation); gsp_phys_backend_static_probe_schedule(); mutex_unlock(&gsp_phys_session_lock); @@ -1981,7 +2036,7 @@ int gsp_phys_backend_start(void) backend.generation++; gsp_phys_backend_static_invalidate(); WRITE_ONCE(backend.state, GSP_PHYS_BACKEND_CLAIMING); - pr_info("gsp-phys: backend start: mdev-owned claim+boot scheduled (refcount=1, generation=%u)\n", + pr_info("vgsp: backend start: mdev-owned claim+boot scheduled (refcount=1, generation=%u)\n", backend.generation); schedule_work(&gsp_phys_backend_start_work_item); mutex_unlock(&gsp_phys_session_lock); @@ -2013,13 +2068,13 @@ static void gsp_phys_backend_start_work(struct work_struct *work) mutex_lock(&gsp_phys_session_lock); if (backend.state != GSP_PHYS_BACKEND_CLAIMING) { mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend start: worker aborted, session state=%d\n", + pr_info("vgsp: backend start: worker aborted, session state=%d\n", backend.state); return; } mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend start: claiming + booting the physical GPU (mdev-owned)\n"); + pr_info("vgsp: backend start: claiming + booting the physical GPU (mdev-owned)\n"); ret = gsp_phys_gpu_claim(); @@ -2031,7 +2086,7 @@ static void gsp_phys_backend_start_work(struct work_struct *work) WRITE_ONCE(backend.state, GSP_PHYS_BACKEND_OFF); mutex_unlock(&gsp_phys_session_lock); gsp_phys_backend_static_invalidate(); - pr_err("gsp-phys: backend start: claim/boot failed: %d; backend OFF, guest stays on emulation\n", + pr_err("vgsp: backend start: claim/boot failed: %d; backend OFF, guest stays on emulation\n", ret); return; } @@ -2046,7 +2101,7 @@ static void gsp_phys_backend_start_work(struct work_struct *work) gsp_phys_boot_rm_flags(&rm_init_done, &rm_unload_submitted); mutex_unlock(&gsp_phys_session_lock); - pr_err("gsp-phys: backend start: claim succeeded but the live GSP-RM session is not ready (rm_init_done=%u unload_submitted=%u); releasing the claim (fail-open)\n", + pr_err("vgsp: backend start: claim succeeded but the live GSP-RM session is not ready (rm_init_done=%u unload_submitted=%u); releasing the claim (fail-open)\n", rm_init_done, rm_unload_submitted); if (gsp_phys_gpu_claimed()) gsp_phys_gpu_release(); @@ -2061,11 +2116,11 @@ static void gsp_phys_backend_start_work(struct work_struct *work) } if (backend.state == GSP_PHYS_BACKEND_STOPPING) { mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend start: claim completed while STOPPING; release deferred to the stopper\n"); + pr_info("vgsp: backend start: claim completed while STOPPING; release deferred to the stopper\n"); return; } WRITE_ONCE(backend.state, GSP_PHYS_BACKEND_READY); - pr_info("gsp-phys: backend start: READY (owner=mdev, refcount=%u)\n", + pr_info("vgsp: backend start: READY (owner=mdev, refcount=%u)\n", backend.refcount); /* * Fill the static-config snapshot once for this generation before any @@ -2083,13 +2138,13 @@ void gsp_phys_backend_stop(void) mutex_lock(&gsp_phys_session_lock); if (backend.state == GSP_PHYS_BACKEND_OFF) { mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend stop: already OFF\n"); + pr_info("vgsp: backend stop: already OFF\n"); return; } if (backend.refcount) backend.refcount--; if (backend.refcount) { - pr_info("gsp-phys: backend stop: refcount=%u, session stays up (owner=%s)\n", + pr_info("vgsp: backend stop: refcount=%u, session stays up (owner=%s)\n", backend.refcount, backend.module_owned ? "module" : "mdev"); mutex_unlock(&gsp_phys_session_lock); @@ -2126,13 +2181,13 @@ void gsp_phys_backend_begin_stop(void) } if (backend.module_owned) { mutex_unlock(&gsp_phys_session_lock); - pr_info("gsp-phys: backend begin stop: module-owned claim; no state change\n"); + pr_info("vgsp: backend begin stop: module-owned claim; no state change\n"); return; } if (backend.state != GSP_PHYS_BACKEND_STOPPING) { WRITE_ONCE(backend.state, GSP_PHYS_BACKEND_STOPPING); backend.generation++; - pr_info("gsp-phys: backend begin stop: STOPPING (generation=%u, refcount=%u)\n", + pr_info("vgsp: backend begin stop: STOPPING (generation=%u, refcount=%u)\n", backend.generation, backend.refcount); } mutex_unlock(&gsp_phys_session_lock); diff --git a/kernel/gsp_phys_gpu.h b/kernel/gsp_phys_gpu.h index 4e5e823..7d9b695 100644 --- a/kernel/gsp_phys_gpu.h +++ b/kernel/gsp_phys_gpu.h @@ -78,6 +78,7 @@ bool gsp_phys_static_live_enabled(void); * emulated per-command handler on any miss. */ bool gsp_phys_ctrl_forward_enabled(void); +bool gsp_phys_srv_ctxbuf_value(void); /* * True when the gsp_phys_work_forward module parameter is set (default 0: the @@ -188,8 +189,18 @@ int gsp_phys_rmcall_engine_value(void); * 2 = reference external-VAS two-phase shape: a PA-only nonmapped entry * (bInitialize=1/bNonmapped=1, no VA) first, then a VA-only entry * (bInitialize=0/bNonmapped=0) with the same PA/VA/size; - * 3 = single MAIN entry like 1 but with size = the exact raw save size. - * The parameter's set callback clamps any value outside 0..3 to 0 with a + * 3 = single MAIN entry like 1 but with size = the exact raw save size; + * 4 = like 2 but the VA-only step uses the reference client's zero-field + * entry (only bufferId/gpuVirtAddr/bNonmapped set); + * 5 = one control, entryCount=2: PA-only nonmapped init entry followed by + * the zero-field VA-only entry; + * 6 = no-entry hVirtMemory: allocate an NV01_MEMORY_VIRTUAL (class 0x70) + * VA-range object on the ladder VAS at the context window, then + * PROMOTE_CTX with hVirtMemory, virtAddress/size and entryCount=0, so + * the server creates the memdesc/vaList entry itself; + * 7 = no-entry bare (virtAddress, size): PROMOTE_CTX with entryCount=0 and + * no hVirtMemory (the other documented no-entry branch). + * The parameter's set callback clamps any value outside 0..7 to 0 with a * warning and warns on every nonzero enable (a failed promote can assert * GSP-RM and wedge the device; recovery needs a reboot with human approval). * The booter snapshots the value when the rm-call ladder's stage 3 starts diff --git a/kernel/gsp_phys_registry_img_srvctx.h b/kernel/gsp_phys_registry_img_srvctx.h new file mode 100644 index 0000000..b90041d --- /dev/null +++ b/kernel/gsp_phys_registry_img_srvctx.h @@ -0,0 +1,138 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * SET_REGISTRY (function 73) payload variant: the default host registry + * profile with RMSetClientRMAllocatedCtxBuffer=0 (server-managed GR context + * buffers), used by gsp_phys_srv_ctxbuf=1. Entry 24 + * (EnablePCIERelaxedOrderingMode, off by default) is repurposed to carry the + * key; the table size/entry count/layout are unchanged. + * + * Server-managed ctx buffers are the physical-RM path: the GSP-RM allocates + * and commits the engine context itself instead of requiring a + * client-owned-buffer GPU_PROMOTE_CTX. + * + * Generated table; do not edit by hand. + */ + +#ifndef GSP_PHYS_REGISTRY_IMG_SRVCTX_H +#define GSP_PHYS_REGISTRY_IMG_SRVCTX_H + +#include <linux/types.h> + +#define GSP_PHYS_REGISTRY_IMAGE_SRVCTX_SIZE 1344 + +static const u8 gsp_phys_registry_image_srvctx[GSP_PHYS_REGISTRY_IMAGE_SRVCTX_SIZE] = { + 0x40, 0x05, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, + 0x59, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x63, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x83, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xb6, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xc2, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x04, 0x00, 0x00, 0x00, 0xd8, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xe2, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xf1, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x26, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x36, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x49, 0x03, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x62, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x85, 0x03, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xa4, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xbe, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xe6, 0x03, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xfd, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x28, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3a, 0x04, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x58, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x6b, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7d, 0x04, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x93, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xae, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xc2, 0x04, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xde, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xef, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x13, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x2d, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x52, 0x65, 0x73, 0x6d, + 0x61, 0x6e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, + 0x00, 0x52, 0x6d, 0x4c, 0x6f, 0x67, 0x6f, 0x6e, 0x52, 0x43, 0x00, 0x4d, + 0x6f, 0x64, 0x69, 0x66, 0x79, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x00, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x46, + 0x69, 0x6c, 0x65, 0x55, 0x49, 0x44, 0x00, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x46, 0x69, 0x6c, 0x65, 0x47, 0x49, 0x44, 0x00, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x00, + 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x41, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x00, 0x55, 0x73, + 0x65, 0x50, 0x61, 0x67, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x00, 0x45, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x4d, 0x53, 0x49, 0x00, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x50, 0x43, 0x49, 0x65, 0x47, 0x65, 0x6e, 0x33, 0x00, 0x4d, 0x65, 0x6d, + 0x6f, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x00, + 0x4b, 0x4d, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x48, 0x65, 0x61, 0x70, 0x4d, + 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x56, 0x4d, 0x61, 0x6c, 0x6c, + 0x6f, 0x63, 0x48, 0x65, 0x61, 0x70, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, + 0x65, 0x00, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x4d, 0x4d, 0x49, 0x4f, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x00, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x6d, 0x4f, 0x50, 0x73, + 0x00, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4e, + 0x55, 0x4d, 0x41, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x00, 0x4e, 0x76, 0x4c, 0x69, 0x6e, 0x6b, 0x44, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x00, 0x52, 0x6d, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x69, 0x6e, 0x67, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, + 0x00, 0x50, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x56, 0x69, 0x64, + 0x65, 0x6f, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x00, 0x45, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x53, 0x30, 0x69, 0x78, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x53, 0x30, + 0x69, 0x78, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x4d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, + 0x64, 0x00, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x6f, 0x77, + 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x6f, 0x77, 0x65, + 0x72, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x56, + 0x69, 0x64, 0x65, 0x6f, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x54, 0x68, + 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x00, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x50, 0x43, 0x49, 0x44, 0x72, 0x69, 0x76, 0x65, + 0x72, 0x00, 0x52, 0x4d, 0x53, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x52, 0x4d, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x43, 0x74, 0x78, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x00, 0x61, 0x62, + 0x6c, 0x65, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x61, 0x62, 0x6c, 0x65, 0x42, + 0x61, 0x72, 0x00, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x70, 0x75, + 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x00, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x47, 0x70, 0x75, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, + 0x72, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x00, 0x52, 0x6d, 0x4e, 0x76, 0x6c, + 0x69, 0x6e, 0x6b, 0x42, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, + 0x4c, 0x69, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x00, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x44, 0x62, 0x67, 0x42, 0x72, 0x65, 0x61, 0x6b, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x00, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x6d, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x6e, 0x73, 0x75, 0x70, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x64, 0x47, 0x70, 0x75, 0x73, 0x00, 0x44, 0x6d, + 0x61, 0x52, 0x65, 0x6d, 0x61, 0x70, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x6d, + 0x69, 0x6f, 0x00, 0x49, 0x6d, 0x65, 0x78, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x00, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x49, 0x6d, 0x65, 0x78, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x30, 0x00, 0x47, 0x72, 0x64, 0x6d, 0x61, 0x50, 0x63, 0x69, 0x54, + 0x6f, 0x70, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4f, 0x76, 0x65, 0x72, + 0x72, 0x69, 0x64, 0x65, 0x00, 0x52, 0x4d, 0x44, 0x65, 0x76, 0x69, 0x64, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x00, +}; + +#endif /* GSP_PHYS_REGISTRY_IMG_SRVCTX_H */ diff --git a/kernel/gsp_phys_vbios.c b/kernel/gsp_phys_vbios.c index 50b17df..e42e277 100644 --- a/kernel/gsp_phys_vbios.c +++ b/kernel/gsp_phys_vbios.c @@ -197,7 +197,7 @@ static int gsp_phys_vbios_find_pci_header(void __iomem *bar0, u32 *pci_offset, &directory_sig)) return -EIO; if (directory_sig != GSP_PHYS_ROM_DIRECTORY_IDENTIFIER) { - pr_err("gsp-phys-vbios: ROM directory not found (0x%08x)\n", + pr_err("vgsp-vbios: ROM directory not found (0x%08x)\n", directory_sig); return -EINVAL; } @@ -208,18 +208,18 @@ static int gsp_phys_vbios_find_pci_header(void __iomem *bar0, u32 *pci_offset, return -EIO; break; default: - pr_err("gsp-phys-vbios: unsupported IFR version %u\n", version); + pr_err("vgsp-vbios: unsupported IFR version %u\n", version); return -EINVAL; } if (image_offset & 0x3) { - pr_err("gsp-phys-vbios: IFR image offset 0x%x is not 4-byte aligned\n", + pr_err("vgsp-vbios: IFR image offset 0x%x is not 4-byte aligned\n", image_offset); return -EINVAL; } if (image_offset > GSP_PHYS_VBIOS_MAX_SIZE - sizeof(u32)) { - pr_err("gsp-phys-vbios: IFR image offset 0x%x out of range\n", + pr_err("vgsp-vbios: IFR image offset 0x%x out of range\n", image_offset); return -EINVAL; } @@ -269,7 +269,7 @@ static int gsp_phys_vbios_locate_expansion_roms(void __iomem *bar0, if (!gsp_phys_prom_read32(bar0, base, &sig)) return -EIO; if (!gsp_phys_pci_data_sig_valid(sig)) { - pr_err("gsp-phys-vbios: invalid PCI data signature 0x%08x at 0x%x\n", + pr_err("vgsp-vbios: invalid PCI data signature 0x%08x at 0x%x\n", sig, base); return -EINVAL; } @@ -341,7 +341,7 @@ static int gsp_phys_vbios_locate_expansion_roms(void __iomem *bar0, break; if (sub_img_len == 0) { - pr_err("gsp-phys-vbios: zero-sized ROM block at 0x%x\n", + pr_err("vgsp-vbios: zero-sized ROM block at 0x%x\n", curr_block); return -EINVAL; } @@ -436,7 +436,7 @@ int gsp_phys_vbios_read(struct gsp_phys_vbios *img, struct pci_dev *pdev, if (rom_sig != GSP_PHYS_ROM_SIG_STD && rom_sig != GSP_PHYS_ROM_SIG_NV && rom_sig != GSP_PHYS_ROM_SIG_NV2) { - pr_err("gsp-phys-vbios: no valid ROM signature at offset 0x%x (0x%04x)\n", + pr_err("vgsp-vbios: no valid ROM signature at offset 0x%x (0x%04x)\n", pci_offset, rom_sig); return -EINVAL; } @@ -445,12 +445,12 @@ int gsp_phys_vbios_read(struct gsp_phys_vbios *img, struct pci_dev *pdev, &bios_size, &expansion_rom_offset); if (ret) { - pr_err("gsp-phys-vbios: expansion ROM walk failed: %d\n", ret); + pr_err("vgsp-vbios: expansion ROM walk failed: %d\n", ret); return ret; } if (check_add_overflow(pci_offset, bios_size, &rom_end) || rom_end > GSP_PHYS_VBIOS_MAX_SIZE) { - pr_err("gsp-phys-vbios: expansion ROM span 0x%x+0x%x exceeds the window\n", + pr_err("vgsp-vbios: expansion ROM span 0x%x+0x%x exceeds the window\n", pci_offset, bios_size); return -EINVAL; } @@ -462,7 +462,7 @@ int gsp_phys_vbios_read(struct gsp_phys_vbios *img, struct pci_dev *pdev, img->ifr_version = ifr_version; img->expansion_rom_offset = expansion_rom_offset; - pr_info("gsp-phys-vbios: ROM on %s: pciOffset=0x%x size=0x%x expansionRomOffset=0x%x IFRversion=%u\n", + pr_info("vgsp-vbios: ROM on %s: pciOffset=0x%x size=0x%x expansionRomOffset=0x%x IFRversion=%u\n", pci_name(pdev), pci_offset, bios_size, expansion_rom_offset, ifr_version); return 0; @@ -541,7 +541,7 @@ static int gsp_phys_vbios_parse_desc(const struct gsp_phys_vbios *img, size = (vdesc >> 16) & 0xffff; if (version == 3 && size >= GSP_PHYS_FALCON_UCODE_DESC_V3_SIZE) { - pr_err("gsp-phys-vbios: FWSEC appId=0x%x is a V3 (boot-from-HS) descriptor; this GPU generation boots FWSEC with the generic SEC2 boot-loader (V2) only - cannot proceed\n", + pr_err("vgsp-vbios: FWSEC appId=0x%x is a V3 (boot-from-HS) descriptor; this GPU generation boots FWSEC with the generic SEC2 boot-loader (V2) only - cannot proceed\n", app_id); return -EOPNOTSUPP; } @@ -579,12 +579,12 @@ static int gsp_phys_vbios_parse_desc(const struct gsp_phys_vbios *img, desc->dmem_load_size = fields[11]; if (desc->imem_load_size == 0 || desc->dmem_load_size == 0) { - pr_err("gsp-phys-vbios: FWSEC descriptor has a zero-sized IMEM/DMEM image (imem=0x%x dmem=0x%x)\n", + pr_err("vgsp-vbios: FWSEC descriptor has a zero-sized IMEM/DMEM image (imem=0x%x dmem=0x%x)\n", desc->imem_load_size, desc->dmem_load_size); return -EINVAL; } if (desc->imem_sec_size > desc->imem_load_size) { - pr_err("gsp-phys-vbios: FWSEC secure IMEM size 0x%x exceeds load size 0x%x\n", + pr_err("vgsp-vbios: FWSEC secure IMEM size 0x%x exceeds load size 0x%x\n", desc->imem_sec_size, desc->imem_load_size); return -EINVAL; } @@ -593,30 +593,30 @@ static int gsp_phys_vbios_parse_desc(const struct gsp_phys_vbios *img, image_start = desc_offset + size; if (image_start > img->size || desc->imem_load_size > img->size - image_start) { - pr_err("gsp-phys-vbios: FWSEC IMEM image runs past the ROM copy\n"); + pr_err("vgsp-vbios: FWSEC IMEM image runs past the ROM copy\n"); return -EINVAL; } if (desc->dmem_offset > img->size - image_start) { - pr_err("gsp-phys-vbios: FWSEC DMEM offset runs past the ROM copy\n"); + pr_err("vgsp-vbios: FWSEC DMEM offset runs past the ROM copy\n"); return -EINVAL; } image_end = image_start + desc->dmem_offset; if (desc->dmem_load_size > img->size - image_end) { - pr_err("gsp-phys-vbios: FWSEC DMEM image runs past the ROM copy\n"); + pr_err("vgsp-vbios: FWSEC DMEM image runs past the ROM copy\n"); return -EINVAL; } if (desc->interface_offset >= desc->dmem_load_size) { - pr_err("gsp-phys-vbios: FWSEC interface offset 0x%x outside DMEM image (0x%x)\n", + pr_err("vgsp-vbios: FWSEC interface offset 0x%x outside DMEM image (0x%x)\n", desc->interface_offset, desc->dmem_load_size); return -EINVAL; } - pr_info("gsp-phys-vbios: FWSEC entry appId=0x%x targetId=%u desc=V%u size=%u at 0x%x\n", + pr_info("vgsp-vbios: FWSEC entry appId=0x%x targetId=%u desc=V%u size=%u at 0x%x\n", app_id, target_id, version, size, desc_offset); - pr_info("gsp-phys-vbios: FWSEC image: code at 0x%x (0x%x bytes) data at 0x%x (0x%x bytes)\n", + pr_info("vgsp-vbios: FWSEC image: code at 0x%x (0x%x bytes) data at 0x%x (0x%x bytes)\n", image_start, desc->imem_load_size, image_start + desc->dmem_offset, desc->dmem_load_size); - pr_info("gsp-phys-vbios: FWSEC IMEM base/load/virt/secBase/secSize=0x%x/0x%x/0x%x/0x%x/0x%x DMEM off/phys/load=0x%x/0x%x/0x%x interfaceOff=0x%x entry=0x%x\n", + pr_info("vgsp-vbios: FWSEC IMEM base/load/virt/secBase/secSize=0x%x/0x%x/0x%x/0x%x/0x%x DMEM off/phys/load=0x%x/0x%x/0x%x interfaceOff=0x%x entry=0x%x\n", desc->imem_phys_base, desc->imem_load_size, desc->imem_virt_base, desc->imem_sec_base, desc->imem_sec_size, desc->dmem_offset, @@ -644,7 +644,7 @@ int gsp_phys_vbios_parse_fwsec(struct gsp_phys_vbios *img, ret = gsp_phys_vbios_find_bit(img, &bit_addr); if (ret) { - pr_err("gsp-phys-vbios: BIT header not found in %zu-byte ROM image\n", + pr_err("vgsp-vbios: BIT header not found in %zu-byte ROM image\n", img->size); return ret; } @@ -655,7 +655,7 @@ int gsp_phys_vbios_parse_fwsec(struct gsp_phys_vbios *img, &token_size) || !gsp_phys_img_read(img, bit_addr + GSP_PHYS_BIT_TOKEN_ENTRIES_OFF, 1, &token_entries)) { - pr_err("gsp-phys-vbios: truncated BIT header at 0x%x\n", + pr_err("vgsp-vbios: truncated BIT header at 0x%x\n", bit_addr); return -EINVAL; } @@ -664,14 +664,14 @@ int gsp_phys_vbios_parse_fwsec(struct gsp_phys_vbios *img, img->bit_token_size = token_size; img->bit_token_entries = token_entries; - pr_info("gsp-phys-vbios: BIT header at 0x%x headerSize=%u tokenSize=%u tokens=%u\n", + pr_info("vgsp-vbios: BIT header at 0x%x headerSize=%u tokenSize=%u tokens=%u\n", bit_addr, header_size, token_size, token_entries); - pr_info("gsp-phys-vbios: BIT token type: %u-byte tokens (%s)\n", + pr_info("vgsp-vbios: BIT token type: %u-byte tokens (%s)\n", token_size, token_size >= GSP_PHYS_BIT_TOKEN_SIZE_8 ? "DataPtr u32 at offset 4" : "DataPtr u16 at offset 4"); if (token_size < GSP_PHYS_BIT_TOKEN_SIZE_6) { - pr_err("gsp-phys-vbios: invalid BIT token size %u\n", + pr_err("vgsp-vbios: invalid BIT token size %u\n", token_size); return -EINVAL; } @@ -778,7 +778,7 @@ int gsp_phys_vbios_parse_fwsec(struct gsp_phys_vbios *img, app_id, use_debug_app)) continue; - pr_info("gsp-phys-vbios: BIT falcon entry %u: appId=0x%x targetId=%u descPtr=0x%x\n", + pr_info("vgsp-vbios: BIT falcon entry %u: appId=0x%x targetId=%u descPtr=0x%x\n", j, app_id, target_id, desc_ptr); ret = gsp_phys_vbios_parse_desc( @@ -789,7 +789,7 @@ int gsp_phys_vbios_parse_fwsec(struct gsp_phys_vbios *img, if (ret < 0) return ret; if (ret == 0) { - pr_info("gsp-phys-vbios: VBIOS version (binver<<8|oem) = 0x%llx\n", + pr_info("vgsp-vbios: VBIOS version (binver<<8|oem) = 0x%llx\n", version); return 0; } @@ -798,7 +798,7 @@ int gsp_phys_vbios_parse_fwsec(struct gsp_phys_vbios *img, } } - pr_err("gsp-phys-vbios: no usable FWSEC V2 descriptor in the BIT (debug app %s)\n", + pr_err("vgsp-vbios: no usable FWSEC V2 descriptor in the BIT (debug app %s)\n", use_debug_app ? "wanted" : "not wanted"); return -ENOENT; } diff --git a/kernel/gsp_rm_emulation.c b/kernel/gsp_rm_emulation.c index b0ad98f..ad0b4f5 100644 --- a/kernel/gsp_rm_emulation.c +++ b/kernel/gsp_rm_emulation.c @@ -90,13 +90,13 @@ int gsp_rm_scan_guest_ram(struct nv_vgpu_device *vgpu, u64 needle, memcpy(&v32, buf + off, 4); if (v == needle) { - pr_info("gsp-resman-vfio: scan: u64 0x%llx at gpa 0x%llx (page off 0x%x)\n", + pr_info("vgsp-rm: scan: u64 0x%llx at gpa 0x%llx (page off 0x%x)\n", needle, gpa + off, off); if (++hits >= max_hits) break; } if (v32 == (u32)needle && needle <= 0xffffffffULL) { - pr_info("gsp-resman-vfio: scan: u32 0x%x at gpa 0x%llx (page off 0x%x)\n", + pr_info("vgsp-rm: scan: u32 0x%x at gpa 0x%llx (page off 0x%x)\n", (u32)needle, gpa + off, off); if (++hits >= max_hits) break; @@ -105,7 +105,7 @@ int gsp_rm_scan_guest_ram(struct nv_vgpu_device *vgpu, u64 needle, } kfree(buf); - pr_info("gsp-resman-vfio: scan: needle=0x%llx range=0x%llx..0x%llx hits=%u\n", + pr_info("vgsp-rm: scan: needle=0x%llx range=0x%llx..0x%llx hits=%u\n", needle, start, end, hits); return hits; } @@ -141,13 +141,13 @@ int gsp_rm_scan_guest_ram_masked(struct nv_vgpu_device *vgpu, u64 value, memcpy(&v64, buf + off, 8); memcpy(&v32, buf + off, 4); if ((v64 & mask) == value) { - pr_info("nvidia-vgpu-vfio: masked scan: u64 0x%llx at gpa 0x%llx (off 0x%x)\n", + pr_info("vgsp-rm: masked scan: u64 0x%llx at gpa 0x%llx (off 0x%x)\n", v64, gpa + off, off); if (++hits >= max_hits) break; } if ((v32 & (u32)mask) == (u32)value) { - pr_info("nvidia-vgpu-vfio: masked scan: u32 0x%x at gpa 0x%llx (off 0x%x)\n", + pr_info("vgsp-rm: masked scan: u32 0x%x at gpa 0x%llx (off 0x%x)\n", v32, gpa + off, off); if (++hits >= max_hits) break; @@ -156,7 +156,7 @@ int gsp_rm_scan_guest_ram_masked(struct nv_vgpu_device *vgpu, u64 value, } kfree(buf); - pr_info("nvidia-vgpu-vfio: masked scan: value=0x%llx mask=0x%llx hits=%u\n", + pr_info("vgsp-rm: masked scan: value=0x%llx mask=0x%llx hits=%u\n", value, mask, hits); return hits; } @@ -194,13 +194,13 @@ int gsp_rm_scan_guest_ram_pt(struct nv_vgpu_device *vgpu, u64 pa, memcpy(&v64, buf + off, 8); memcpy(&v32, buf + off, 4); if ((v64 & 0xfffffffffffff000ULL) == pa_page) { - pr_info("gsp-resman-vfio: pt scan: u64 pte 0x%llx at gpa 0x%llx (off 0x%x)\n", + pr_info("vgsp-rm: pt scan: u64 pte 0x%llx at gpa 0x%llx (off 0x%x)\n", v64, gpa + off, off); if (++hits >= max_hits) break; } if ((v32 & 0xfffff000U) == (u32)pa_page) { - pr_info("gsp-resman-vfio: pt scan: u32 pte 0x%x at gpa 0x%llx (off 0x%x)\n", + pr_info("vgsp-rm: pt scan: u32 pte 0x%x at gpa 0x%llx (off 0x%x)\n", v32, gpa + off, off); if (++hits >= max_hits) break; @@ -209,7 +209,7 @@ int gsp_rm_scan_guest_ram_pt(struct nv_vgpu_device *vgpu, u64 pa, } kfree(buf); - pr_info("gsp-resman-vfio: pt scan: pa=0x%llx hits=%u\n", pa, hits); + pr_info("vgsp-rm: pt scan: pa=0x%llx hits=%u\n", pa, hits); return hits; } @@ -252,7 +252,7 @@ int gsp_rm_scan_guest_ram_seq(struct nv_vgpu_device *vgpu, const u32 *pat, } } if (ok) { - pr_info("gsp-resman-vfio: seq scan: hit in guest RAM at gpa 0x%llx (page off 0x%x)\n", + pr_info("vgsp-rm: seq scan: hit in guest RAM at gpa 0x%llx (page off 0x%x)\n", gpa + off, off); if (++hits >= max_hits) break; @@ -261,7 +261,7 @@ int gsp_rm_scan_guest_ram_seq(struct nv_vgpu_device *vgpu, const u32 *pat, } kfree(buf); - pr_info("gsp-resman-vfio: seq scan: range=0x%llx..0x%llx hits=%u\n", + pr_info("vgsp-rm: seq scan: range=0x%llx..0x%llx hits=%u\n", start, end, hits); return hits; }static u64 gsp_rm_off_to_gpa(struct gsp_rm_emu *rm, u64 off) @@ -400,7 +400,7 @@ static u32 gsp_rm_build_record(struct gsp_rm_emu *rm, u8 *buf, u32 buf_size, elem_count = 1; if (elem_count * GSPRM_QUEUE_ELEMENT_SIZE > buf_size) { - pr_err("GSPRM: build_record overflow: need %u have %u\n", + pr_err("vgsp-rm: build_record overflow: need %u have %u\n", elem_count * GSPRM_QUEUE_ELEMENT_SIZE, buf_size); return 0; } @@ -494,7 +494,7 @@ static int gsp_rm_send(struct gsp_emu_context *ctx, u32 function, if (rm->events_dropped <= 8 || (rm->events_dropped % 1000) == 0) nv_vgpu_info(ctx->vgpu, - "GSPRM: event burst capped (%u), dropped total=%llu", + "vgsp-rm: event burst capped (%u), dropped total=%llu", GSPRM_EVENT_BURST_MAX, rm->events_dropped); mutex_unlock(&rm->stat_lock); @@ -517,7 +517,7 @@ static int gsp_rm_send(struct gsp_emu_context *ctx, u32 function, /* Check we don't overflow the status queue */ if (elem_count > rm->stat_msgcount) { - nv_vgpu_err(ctx->vgpu, "GSPRM: record too large: %u elements > queue %u", + nv_vgpu_err(ctx->vgpu, "vgsp-rm: record too large: %u elements > queue %u", elem_count, rm->stat_msgcount); kfree(buf); mutex_unlock(&rm->stat_lock); @@ -539,7 +539,7 @@ static int gsp_rm_send(struct gsp_emu_context *ctx, u32 function, ret = gsp_rm_write_buf(ctx, rec_off, buf, first_chunk * GSPRM_QUEUE_ELEMENT_SIZE); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: status write failed off=0x%llx ret=%d", + nv_vgpu_err(ctx->vgpu, "vgsp-rm: status write failed off=0x%llx ret=%d", rec_off, ret); kfree(buf); mutex_unlock(&rm->stat_lock); @@ -551,7 +551,7 @@ static int gsp_rm_send(struct gsp_emu_context *ctx, u32 function, buf + first_chunk * GSPRM_QUEUE_ELEMENT_SIZE, second_chunk * GSPRM_QUEUE_ELEMENT_SIZE); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: status wrap write failed ret=%d", + nv_vgpu_err(ctx->vgpu, "vgsp-rm: status wrap write failed ret=%d", ret); kfree(buf); mutex_unlock(&rm->stat_lock); @@ -574,7 +574,7 @@ static int gsp_rm_send(struct gsp_emu_context *ctx, u32 function, ret = gsp_rm_write_buf(ctx, rm->stat_off + 0x10, &new_wp, sizeof(new_wp)); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: status writePtr update failed ret=%d", ret); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: status writePtr update failed ret=%d", ret); mutex_unlock(&rm->stat_lock); return ret; } @@ -656,7 +656,7 @@ int gsp_rm_post_channel_event(struct nv_vgpu_device *vgpu, u32 h_src) if (gsp_sema_dbg && (rm->events_posted <= 32 || (rm->events_posted % 5000) == 0)) nv_vgpu_info(vgpu, - "GSPRM: post_event hSrc=0x%x posted=%d total=%llu", + "vgsp-rm: post_event hSrc=0x%x posted=%d total=%llu", h_src, posted, rm->events_posted); } return posted ? 0 : -ENOENT; @@ -775,7 +775,7 @@ int gsp_rm_dump_state(struct nv_vgpu_device *vgpu) gsp_rm_read_buf(ctx, rm->stat_off + stat_rxoff, &our_cmd_read, 4); nv_vgpu_info(vgpu, - "GSPRM: rmstate cmd{gpa=0x%llx->0x%llx off=0x%llx size=0x%x mc=%u ptes=%u read=%d our_read=%u hdr{wr=%u fl=0x%x rxoff=0x%x entryoff=0x%x}} " + "vgsp-rm: rmstate cmd{gpa=0x%llx->0x%llx off=0x%llx size=0x%x mc=%u ptes=%u read=%d our_read=%u hdr{wr=%u fl=0x%x rxoff=0x%x entryoff=0x%x}} " "stat{gpa=0x%llx->0x%llx off=0x%llx size=0x%x mc=%u read=%d our_write=%u seq=%u hdr{wr=%u fl=0x%x rxoff=0x%x ours_written=%u} guest_read=%u gr_ret=%d}", rm->cmd_gpa, cmd_gpa_now, rm->cmd_off, rm->cmd_size, rm->cmd_msgcount, rm->mq.pageTableEntryCount, cmd_ret, @@ -786,14 +786,14 @@ int gsp_rm_dump_state(struct nv_vgpu_device *vgpu) guest_read, gr_ret); - nv_vgpu_info(vgpu, "GSPRM: rmstate events_n=%u posted=%llu", + nv_vgpu_info(vgpu, "vgsp-rm: rmstate events_n=%u posted=%llu", rm->events_n, rm->events_posted); for (i = 0; i < rm->events_n && i < GSPRM_MAX_EVENTS; i++) { if (!rm->events[i].valid) continue; nv_vgpu_info(vgpu, - "GSPRM: event[%u] hClient=0x%x hEvent=0x%x hSrc=0x%x notifyIndex=0x%x data=0x%x", + "vgsp-rm: event[%u] hClient=0x%x hEvent=0x%x hSrc=0x%x notifyIndex=0x%x data=0x%x", i, rm->events[i].h_client, rm->events[i].h_event, rm->events[i].h_src, rm->events[i].notify_index, rm->events[i].data); @@ -823,7 +823,7 @@ static int gsp_rm_parse_queue_chain(struct gsp_emu_context *ctx) ret = gsp_rm_read(ctx, rm->libos_args_gpa, regions, GSPRM_MAX_LIBOS_REGIONS * sizeof(*regions)); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: libos args read failed gpa=0x%llx ret=%d", + nv_vgpu_err(ctx->vgpu, "vgsp-rm: libos args read failed gpa=0x%llx ret=%d", rm->libos_args_gpa, ret); goto out; } @@ -832,14 +832,14 @@ static int gsp_rm_parse_queue_chain(struct gsp_emu_context *ctx) for (i = 0; i < GSPRM_MAX_LIBOS_REGIONS; i++) { if (regions[i].id8 == 0) break; - nv_vgpu_info(ctx->vgpu, "GSPRM: libos region[%d] id8=0x%llx pa=0x%llx size=0x%llx kind=%u loc=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: libos region[%d] id8=0x%llx pa=0x%llx size=0x%llx kind=%u loc=%u", i, regions[i].id8, regions[i].pa, regions[i].size, regions[i].kind, regions[i].loc); if (regions[i].id8 == GSPRM_LIBOS_ID_RMARGS) gsp_args_gpa = regions[i].pa; } if (!gsp_args_gpa) { - nv_vgpu_err(ctx->vgpu, "GSPRM: RMARGS region not found"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: RMARGS region not found"); ret = -ENOENT; goto out; } @@ -848,11 +848,11 @@ static int gsp_rm_parse_queue_chain(struct gsp_emu_context *ctx) /* 3. Read GSP_ARGUMENTS_CACHED (MESSAGE_QUEUE_INIT_ARGUMENTS first) */ ret = gsp_rm_read(ctx, gsp_args_gpa, &rm->mq, sizeof(rm->mq)); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: GSP_ARGUMENTS_CACHED read failed ret=%d", ret); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: GSP_ARGUMENTS_CACHED read failed ret=%d", ret); goto out; } - nv_vgpu_info(ctx->vgpu, "GSPRM: queue args sharedPA=0x%llx ptes=%u cmdOff=0x%llx statOff=0x%llx hdrSize=0x%llx elemMin=0x%llx elemMax=0x%llx hdrAlign=%u elemAlign=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: queue args sharedPA=0x%llx ptes=%u cmdOff=0x%llx statOff=0x%llx hdrSize=0x%llx elemMin=0x%llx elemMax=0x%llx hdrAlign=%u elemAlign=%u", rm->mq.sharedMemPhysAddr, rm->mq.pageTableEntryCount, rm->mq.cmdQueueOffset, rm->mq.statQueueOffset, rm->mq.queueElementHdrSize, rm->mq.queueElementSizeMin, @@ -863,7 +863,7 @@ static int gsp_rm_parse_queue_chain(struct gsp_emu_context *ctx) if (!rm->mq.sharedMemPhysAddr || !rm->mq.pageTableEntryCount || rm->mq.pageTableEntryCount > 1024) { - nv_vgpu_err(ctx->vgpu, "GSPRM: invalid queue args"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: invalid queue args"); ret = -EINVAL; goto out; } @@ -878,7 +878,7 @@ static int gsp_rm_parse_queue_chain(struct gsp_emu_context *ctx) ret = gsp_rm_read(ctx, rm->mq.sharedMemPhysAddr, rm->ptes, rm->mq.pageTableEntryCount * sizeof(u64)); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: page table read failed ret=%d", ret); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: page table read failed ret=%d", ret); goto out; } @@ -897,14 +897,14 @@ static int gsp_rm_parse_queue_chain(struct gsp_emu_context *ctx) rm->stat_msgcount = (rm->stat_size - rm->entry_off) / GSPRM_QUEUE_ELEMENT_SIZE; if (!rm->cmd_gpa || !rm->stat_gpa || !rm->cmd_msgcount || !rm->stat_msgcount) { - nv_vgpu_err(ctx->vgpu, "GSPRM: bad queue geometry cmd_gpa=0x%llx stat_gpa=0x%llx cmd_mc=%u stat_mc=%u", + nv_vgpu_err(ctx->vgpu, "vgsp-rm: bad queue geometry cmd_gpa=0x%llx stat_gpa=0x%llx cmd_mc=%u stat_mc=%u", rm->cmd_gpa, rm->stat_gpa, rm->cmd_msgcount, rm->stat_msgcount); ret = -EINVAL; goto out; } - nv_vgpu_info(ctx->vgpu, "GSPRM: cmd queue gpa=0x%llx size=0x%x mc=%u; status queue gpa=0x%llx size=0x%x mc=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: cmd queue gpa=0x%llx size=0x%x mc=%u; status queue gpa=0x%llx size=0x%x mc=%u", rm->cmd_gpa, rm->cmd_size, rm->cmd_msgcount, rm->stat_gpa, rm->stat_size, rm->stat_msgcount); @@ -936,7 +936,7 @@ static int gsp_rm_link_status_queue(struct gsp_emu_context *ctx) ret = gsp_rm_write_buf(ctx, rm->stat_off, &tx, sizeof(tx)); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: status TX header write failed ret=%d", ret); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: status TX header write failed ret=%d", ret); return ret; } @@ -944,11 +944,11 @@ static int gsp_rm_link_status_queue(struct gsp_emu_context *ctx) ret = gsp_rm_write_buf(ctx, rm->stat_off + tx.rxHdrOff, &zero, sizeof(zero)); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: status RX header write failed ret=%d", ret); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: status RX header write failed ret=%d", ret); return ret; } - nv_vgpu_info(ctx->vgpu, "GSPRM: status queue linked (size=0x%x msgCount=%u)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: status queue linked (size=0x%x msgCount=%u)", tx.size, tx.msgCount); return 0; } @@ -1001,18 +1001,18 @@ static void gsp_rm_handle_set_guest_system_info(struct gsp_emu_context *ctx, reply = kzalloc(GSPRM_SET_GUEST_INFO_SIZE, GFP_KERNEL); if (!reply) { - nv_vgpu_err(ctx->vgpu, "GSPRM: SET_GUEST_SYSTEM_INFO reply alloc failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: SET_GUEST_SYSTEM_INFO reply alloc failed"); return; } memcpy(reply + 0, &major, 4); memcpy(reply + 4, &minor, 4); - nv_vgpu_info(ctx->vgpu, "GSPRM: SET_GUEST_SYSTEM_INFO seq=%u -> VGX %u.%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: SET_GUEST_SYSTEM_INFO seq=%u -> VGX %u.%u", sequence, major, minor); if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_SET_GUEST_SYSTEM_INFO, sequence, 0, reply, GSPRM_SET_GUEST_INFO_SIZE)) - nv_vgpu_err(ctx->vgpu, "GSPRM: SET_GUEST_SYSTEM_INFO reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: SET_GUEST_SYSTEM_INFO reply send failed"); else rm->rpcs_replied++; @@ -1222,7 +1222,7 @@ static void gsp_rm_apply_static_overlay(struct gsp_emu_context *ctx, u8 *buf) rm->static_live++; nv_vgpu_info(ctx->vgpu, - "GSPRM: static-info overlay applied (generation=%u): name='%s' short='%s' vbiosValid=%u subVendor=0x%04x subDevice=0x%04x", + "vgsp-rm: static-info overlay applied (generation=%u): name='%s' short='%s' vbiosValid=%u subVendor=0x%04x subDevice=0x%04x", snap.generation, snap.gpu_name, snap.gpu_short_name, snap.b_vbios_valid, (u16)snap.vbios_sub_vendor, (u16)snap.vbios_sub_device); @@ -1236,20 +1236,20 @@ static void gsp_rm_handle_get_static_info(struct gsp_emu_context *ctx, reply = kzalloc(TU104_GSCI_SIZE, GFP_KERNEL); if (!reply) { - nv_vgpu_err(ctx->vgpu, "GSPRM: GET_GSP_STATIC_INFO reply alloc failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: GET_GSP_STATIC_INFO reply alloc failed"); return; } gsp_rm_build_static_info(reply); gsp_rm_apply_static_overlay(ctx, reply); - nv_vgpu_info(ctx->vgpu, "GSPRM: GET_GSP_STATIC_INFO seq=%u -> %u bytes (fb=%lluMB, engines=0x%x/0x%x)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: GET_GSP_STATIC_INFO seq=%u -> %u bytes (fb=%lluMB, engines=0x%x/0x%x)", sequence, TU104_GSCI_SIZE, 0x10000000ULL >> 20, 0x60003E02, 0x362020); if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_GET_GSP_STATIC_INFO, sequence, 0, reply, TU104_GSCI_SIZE)) - nv_vgpu_err(ctx->vgpu, "GSPRM: GET_GSP_STATIC_INFO reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: GET_GSP_STATIC_INFO reply send failed"); else rm->rpcs_replied++; @@ -1317,7 +1317,7 @@ static void gsp_rm_handle_fifo_device_table(struct gsp_emu_context *ctx, copy_count * sizeof(struct tu104_fifo_device_entry); *out_status = 0; /* NV_OK */ - nv_vgpu_info(ctx->vgpu, "GSPRM: FIFO_GET_DEVICE_INFO_TABLE base=%u count=%u more=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: FIFO_GET_DEVICE_INFO_TABLE base=%u count=%u more=%u", base, copy_count, fifo_params->bMore); } @@ -1370,7 +1370,7 @@ static void gsp_rm_handle_intr_kernel_table(struct gsp_emu_context *ctx, sizeof(intr_params->subtreeMap); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: INTR_GET_KERNEL_TABLE tableLen=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: INTR_GET_KERNEL_TABLE tableLen=%u", TU104_INTR_KERNEL_TABLE_SIZE); } @@ -1395,7 +1395,7 @@ static void gsp_rm_handle_constructed_falcon_info(struct gsp_emu_context *ctx, sizeof(struct tu104_constructed_falcon_info); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: GET_CONSTRUCTED_FALCON_INFO numFalcons=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: GET_CONSTRUCTED_FALCON_INFO numFalcons=%u", TU104_FALCON_TABLE_SIZE); } @@ -1420,7 +1420,7 @@ static void gsp_rm_handle_internal_device_table(struct gsp_emu_context *ctx, deviceInfoTable) + copy_size; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: INTERNAL_GET_DEVICE_INFO_TABLE numEntries=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: INTERNAL_GET_DEVICE_INFO_TABLE numEntries=%u", TU104_INTERNAL_DEVICE_TABLE_SIZE); } @@ -1454,7 +1454,7 @@ static void gsp_rm_handle_user_register_access_map(struct gsp_emu_context *ctx, *out_params_size = 8204; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: USER_REGISTER_ACCESS_MAP -> empty map"); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: USER_REGISTER_ACCESS_MAP -> empty map"); } /* @@ -1480,7 +1480,7 @@ static void gsp_rm_handle_fifo_get_num_channels(struct gsp_emu_context *ctx, *out_params_size = 8; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: FIFO_GET_NUM_CHANNELS -> %u", val32); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: FIFO_GET_NUM_CHANNELS -> %u", val32); } /* @@ -1525,7 +1525,7 @@ static void gsp_rm_handle_bus_get_pci_bar_info(struct gsp_emu_context *ctx, *out_params_size = 8 + 8 * 24; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: BUS_GET_PCI_BAR_INFO -> %u BARs (BAR1=%uMB)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: BUS_GET_PCI_BAR_INFO -> %u BARs (BAR1=%uMB)", count, (u32)(sizes[1] >> 20)); } @@ -1558,7 +1558,7 @@ static void gsp_rm_handle_display_get_static_info(struct gsp_emu_context *ctx, *out_params_size = 36; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: DISPLAY_GET_STATIC_INFO -> heads=1 dispChannels=1"); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: DISPLAY_GET_STATIC_INFO -> heads=1 dispChannels=1"); } /* @@ -1580,7 +1580,7 @@ static void gsp_rm_handle_display_get_ip_version(struct gsp_emu_context *ctx, *out_params_size = 4; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: DISPLAY_GET_IP_VERSION -> 0x%x", val32); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: DISPLAY_GET_IP_VERSION -> 0x%x", val32); } /* @@ -1604,7 +1604,7 @@ static void gsp_rm_handle_ce_get_fault_method_buffer_size( *out_params_size = 4; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: CE_GET_FAULT_METHOD_BUFFER_SIZE -> %u", val32); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: CE_GET_FAULT_METHOD_BUFFER_SIZE -> %u", val32); } /* @@ -1653,7 +1653,7 @@ static void gsp_rm_handle_ce_physical_caps(struct gsp_emu_context *ctx, } else { *out_status = 0x56; /* NV_ERR_NOT_SUPPORTED */ *out_params_size = req_size; - nv_vgpu_info(ctx->vgpu, "GSPRM: CE_GET_PHYSICAL_CAPS type=0x%x -> NOT_SUPPORTED", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: CE_GET_PHYSICAL_CAPS type=0x%x -> NOT_SUPPORTED", ce_type); return; } @@ -1661,7 +1661,7 @@ static void gsp_rm_handle_ce_physical_caps(struct gsp_emu_context *ctx, *out_params_size = req_size ? req_size : 8; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: CE_GET_PHYSICAL_CAPS type=0x%x -> caps=%02x %02x", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: CE_GET_PHYSICAL_CAPS type=0x%x -> caps=%02x %02x", ce_type, out_params[4], out_params[5]); } @@ -1691,7 +1691,7 @@ static void gsp_rm_handle_ce_all_caps(struct gsp_emu_context *ctx, *out_params_size = 136; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: CE_GET_ALL(_PHYSICAL)_CAPS -> %u CEs present=0x%llx", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: CE_GET_ALL(_PHYSICAL)_CAPS -> %u CEs present=0x%llx", TU104_NUM_CES, present); } @@ -1723,7 +1723,7 @@ static void gsp_rm_handle_ce_pce_mask(struct gsp_emu_context *ctx, *out_params_size = req_size ? req_size : 8; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: CE_GET_CE_PCE_MASK type=0x%x -> 0x%x", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: CE_GET_CE_PCE_MASK type=0x%x -> 0x%x", ce_type, mask); } @@ -1757,7 +1757,7 @@ static void gsp_rm_handle_gmmu_get_static_info(struct gsp_emu_context *ctx, *out_params_size = 16; *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: GMMU_GET_STATIC_INFO -> replayFaultBuf=0x%x nonReplayFaultBuf=0x%x", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: GMMU_GET_STATIC_INFO -> replayFaultBuf=0x%x nonReplayFaultBuf=0x%x", replay, nonreplay); } @@ -1805,7 +1805,7 @@ static void gsp_rm_handle_kgr_get_global_sm_order(struct gsp_emu_context *ctx, sizeof(struct tu104_gr_global_sm_order); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: KGR_GET_GLOBAL_SM_ORDER -> %u SMs, %u TPCs on GR0", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: KGR_GET_GLOBAL_SM_ORDER -> %u SMs, %u TPCs on GR0", TU104_NUM_SM, TU104_NUM_TPC); } @@ -1866,7 +1866,7 @@ static void gsp_rm_handle_kgr_get_info(struct gsp_emu_context *ctx, sizeof(struct tu104_gr_static_info); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: KGR_GET_INFO -> GR0 litter %uGPC/%uTPC/%uSM, maxSubctx=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: KGR_GET_INFO -> GR0 litter %uGPC/%uTPC/%uSM, maxSubctx=%u", TU104_NUM_GPC, TU104_TPC_PER_GPC, TU104_NUM_SM, TU104_MAX_SUBCONTEXT_COUNT); } @@ -1908,7 +1908,7 @@ static void gsp_rm_handle_kgr_get_floorsweeping_masks( sizeof(struct tu104_gr_floorsweeping_masks); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: KGR_GET_FLOORSWEEPING_MASKS -> gpcMask=0x%x tpc/gpc=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: KGR_GET_FLOORSWEEPING_MASKS -> gpcMask=0x%x tpc/gpc=%u", m->gpcMask, TU104_TPC_PER_GPC); } @@ -1975,7 +1975,7 @@ static void gsp_rm_handle_kgr_get_context_buffers_info( *out_params_size = sizeof(*info); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: KGR_GET_CONTEXT_BUFFERS_INFO -> main ctx 0x%x, patch 0x%x, pm 0x%x (engines=%u x %u)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: KGR_GET_CONTEXT_BUFFERS_INFO -> main ctx 0x%x, patch 0x%x, pm 0x%x (engines=%u x %u)", TU104_CTX_SIZE_MAIN, TU104_CTX_SIZE_PATCH, TU104_CTX_SIZE_PM, TU104_CTX_GPU_MAX_ENGINES, TU104_CTX_ENGINE_ID_COUNT); } @@ -2088,7 +2088,7 @@ static void gsp_rm_handle_fb_get_info_v2(struct gsp_emu_context *ctx, *out_params_size = sizeof(*reply); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: FB_GET_INFO_V2 -> %u entries populated (first idx=0x%x)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: FB_GET_INFO_V2 -> %u entries populated (first idx=0x%x)", count, count ? reply->fbInfoList[0].index : 0); } @@ -2142,7 +2142,7 @@ static void gsp_rm_handle_clk_domain_info(struct gsp_emu_context *ctx, u32 cmd, *out_status = 0; if (gsp_sema_dbg) - nv_vgpu_info(ctx->vgpu, "GSPRM: CLK domain info cmd=0x%x size=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: CLK domain info cmd=0x%x size=%u", cmd, n); } @@ -2217,10 +2217,10 @@ static void gsp_rm_handle_bus_get_info_v2(struct gsp_emu_context *ctx, *out_params_size = sizeof(*reply); *out_status = 0; - nv_vgpu_info(ctx->vgpu, "GSPRM: BUS_GET_INFO_V2 -> %u entries populated (first idx=0x%x)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: BUS_GET_INFO_V2 -> %u entries populated (first idx=0x%x)", count, count ? reply->busInfoList[0].index : 0); for (i = 0; i < count; i++) - nv_vgpu_info(ctx->vgpu, "GSPRM: bus[%u] idx=0x%x data=0x%x", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: bus[%u] idx=0x%x data=0x%x", i, reply->busInfoList[i].index, reply->busInfoList[i].data); } @@ -2278,7 +2278,7 @@ static void gsp_rm_handle_copy_server_pdes(struct gsp_emu_context *ctx, rm->pt.num_levels = num_levels; nv_vgpu_info(ctx->vgpu, - "GSPRM: COPY_SERVER_PDES va=[0x%llx..0x%llx] pageSize=0x%llx levels=%u", + "vgsp-rm: COPY_SERVER_PDES va=[0x%llx..0x%llx] pageSize=0x%llx levels=%u", va_lo, va_hi, page_size, num_levels); for (i = 0; i < num_levels; i++) { @@ -2303,7 +2303,7 @@ static void gsp_rm_handle_copy_server_pdes(struct gsp_emu_context *ctx, rm->pt.levels[i].page_shift = page_shift; nv_vgpu_info(ctx->vgpu, - "GSPRM: pt level[%u] phys=0x%llx size=0x%llx aperture=%u pageShift=%u", + "vgsp-rm: pt level[%u] phys=0x%llx size=0x%llx aperture=%u pageShift=%u", i, phys, size, aperture, page_shift); } } @@ -2402,7 +2402,7 @@ static void gsp_rm_handle_rm_alloc(struct gsp_emu_context *ctx, if (gsp_sema_dbg) nv_vgpu_info(ctx->vgpu, - "GSPRM: GSP_RM_ALLOC class=0x%x paramsSize=%u flags=0x%x hClient=0x%x hParent=0x%x hObject=0x%x", + "vgsp-rm: GSP_RM_ALLOC class=0x%x paramsSize=%u flags=0x%x hClient=0x%x hParent=0x%x hObject=0x%x", class_id, params_size, flags, hc, hp, ho); /* Full param dump for memory/channel classes and any class we have not @@ -2418,7 +2418,7 @@ static void gsp_rm_handle_rm_alloc(struct gsp_emu_context *ctx, u32 n = min(shown - off, (u32)64); nv_vgpu_info(ctx->vgpu, - "GSPRM: alloc class=0x%x params[%u..%u]=%*phN", + "vgsp-rm: alloc class=0x%x params[%u..%u]=%*phN", class_id, off, off + n, (int)n, params + off); } @@ -2477,7 +2477,7 @@ static void gsp_rm_handle_rm_alloc(struct gsp_emu_context *ctx, rm->events_n++; if (gsp_sema_dbg) nv_vgpu_info(ctx->vgpu, - "GSPRM: event registered hEvent=0x%x hSrc=0x%x notifyIndex=%u (off %d) params=%*phN", + "vgsp-rm: event registered hEvent=0x%x hSrc=0x%x notifyIndex=%u (off %d) params=%*phN", ho, h_src, notify_index, hc_off, (int)min(params_size, (u32)24), params); } @@ -2490,7 +2490,7 @@ static void gsp_rm_handle_rm_alloc(struct gsp_emu_context *ctx, reply = kmalloc(reply_len, GFP_KERNEL); if (!reply) { - nv_vgpu_err(ctx->vgpu, "GSPRM: GSP_RM_ALLOC reply alloc failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: GSP_RM_ALLOC reply alloc failed"); return; } @@ -2499,7 +2499,7 @@ static void gsp_rm_handle_rm_alloc(struct gsp_emu_context *ctx, if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_GSP_RM_ALLOC, sequence, 0, reply, reply_len)) - nv_vgpu_err(ctx->vgpu, "GSPRM: GSP_RM_ALLOC reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: GSP_RM_ALLOC reply send failed"); kfree(reply); } @@ -2521,7 +2521,7 @@ static void gsp_rm_handle_memsys_l2_invalidate_evict(struct gsp_emu_context *ctx */ const u32 *flags = (const u32 *)req_params; - nv_vgpu_info(ctx->vgpu, "GSPRM: MEMSYS_L2_INVALIDATE_EVICT flags=0x%x", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: MEMSYS_L2_INVALIDATE_EVICT flags=0x%x", params_size >= 4 ? *flags : 0); *out_status = 0; /* NV_OK */ @@ -2557,7 +2557,7 @@ static void gsp_rm_handle_gr_get_fecs_trace_hw_enable(struct gsp_emu_context *ct * NV2080_CTRL_GR_ROUTE_INFO = { NvU64 base, size, alignment; NvU32 addressSpace, cpuCacheAttrib; } */ - nv_vgpu_info(ctx->vgpu, "GSPRM: GR_GET_FECS_TRACE_HW_ENABLE params_size=%u", params_size); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: GR_GET_FECS_TRACE_HW_ENABLE params_size=%u", params_size); /* Return disabled (0) - no FECS tracing on vGPU */ memset(out, 0, sizeof(*out)); @@ -2589,7 +2589,7 @@ static void gsp_rm_handle_system_map_shared_data(struct gsp_emu_context *ctx, u8 bMap; } __attribute__((packed)) *in = (void *)req_params; - nv_vgpu_info(ctx->vgpu, "GSPRM: SYSTEM_MAP_SHARED_DATA base=0x%llx size=0x%llx subDev=%u bMap=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: SYSTEM_MAP_SHARED_DATA base=0x%llx size=0x%llx subDev=%u bMap=%u", in ? in->base : 0, in ? in->size : 0, in ? in->subDeviceInstance : 0, in ? in->bMap : 0); @@ -2663,7 +2663,7 @@ gsp_rm_handle_promote_fault_method_buffers(struct gsp_emu_context *ctx, memcpy(&m->e[i].address_space, p + 32 * i + 24, 4); if (gsp_sema_dbg) nv_vgpu_info(ctx->vgpu, - "GSPRM: FAULT_METHOD_BUFFER hObject=0x%x hClient=0x%x buf[%u] base=0x%llx size=%llu ap=%u", + "vgsp-rm: FAULT_METHOD_BUFFER hObject=0x%x hClient=0x%x buf[%u] base=0x%llx size=%llu ap=%u", req->hObject, req->hClient, i, m->e[i].base, m->e[i].size, m->e[i].address_space); @@ -2683,7 +2683,7 @@ static void gsp_rm_ctrl_forward_note(struct gsp_emu_context *ctx) if ((rm->ctrl_fwd_fallback && rm->ctrl_fwd_fallback <= 4) || (events && (events % 64) == 0)) nv_vgpu_info(ctx->vgpu, - "GSPRM: RM_CONTROL forward: ok=%llu fallback=%llu timeout=%llu", + "vgsp-rm: RM_CONTROL forward: ok=%llu fallback=%llu timeout=%llu", rm->ctrl_fwd_ok, rm->ctrl_fwd_fallback, rm->ctrl_fwd_timeout); } @@ -2802,7 +2802,7 @@ static bool gsp_rm_ctrl_forward(struct gsp_emu_context *ctx, if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_GSP_RM_CONTROL, sequence, 0, reply, GSP_RM_CTRL_HDR_SIZE + out_params_size)) { - nv_vgpu_err(ctx->vgpu, "GSPRM: RM_CONTROL forward reply send failed cmd=0x%x", + nv_vgpu_err(ctx->vgpu, "vgsp-rm: RM_CONTROL forward reply send failed cmd=0x%x", req->cmd); rm->ctrl_fwd_fallback++; } else { @@ -2834,7 +2834,7 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, memcpy(&req, req_data, GSP_RM_CTRL_HDR_SIZE); if (gsp_sema_dbg) - nv_vgpu_info(ctx->vgpu, "GSPRM: GSP_RM_CONTROL cmd=0x%x hClient=0x%x hObject=0x%x paramsSize=%u flags=0x%x", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: GSP_RM_CONTROL cmd=0x%x hClient=0x%x hObject=0x%x paramsSize=%u flags=0x%x", req.cmd, req.hClient, req.hObject, req.paramsSize, req.flags); @@ -2842,7 +2842,7 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, reply_data_len = GSP_RM_CTRL_HDR_SIZE + max(req.paramsSize, (u32)4096); reply = kzalloc(reply_data_len, GFP_KERNEL); if (!reply) { - nv_vgpu_err(ctx->vgpu, "GSPRM: RM_CONTROL reply alloc failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: RM_CONTROL reply alloc failed"); return; } @@ -3033,7 +3033,7 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, * stack structs as input (e.g. DISPLAY_GET_IP_VERSION), so an * echo hands the driver its own stack garbage as the answer. */ if (gsp_sema_dbg) - nv_vgpu_info(ctx->vgpu, "GSPRM: RM_CONTROL unknown cmd=0x%x -> generic SUCCESS", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: RM_CONTROL unknown cmd=0x%x -> generic SUCCESS", req.cmd); /* Dump small request params so mapping/alloc controls that * carry PAs can be identified (rate-limited). */ @@ -3041,7 +3041,7 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, rm->ctrl_param_dumps < 400) { rm->ctrl_param_dumps++; nv_vgpu_info(ctx->vgpu, - "GSPRM: ctrl 0x%x params[0..%u]=%*phN", + "vgsp-rm: ctrl 0x%x params[0..%u]=%*phN", req.cmd, req.paramsSize, req.paramsSize, req_data + GSP_RM_CTRL_HDR_SIZE); } @@ -3055,7 +3055,7 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, * and the calling ioctl never completes (nvidia-smi hang). * Echo the request's serialized params (valid stream) and * report NOT_SUPPORTED - headless vGPU has no DDC/I2C bus. */ - nv_vgpu_info(ctx->vgpu, "GSPRM: I2C_TRANSACTION -> NOT_SUPPORTED (echo)"); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: I2C_TRANSACTION -> NOT_SUPPORTED (echo)"); out_status = 0x56; /* NV_ERR_NOT_SUPPORTED */ out_params_size = req.paramsSize; if (req.paramsSize && @@ -3078,7 +3078,7 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, if (gsp_sema_dbg) nv_vgpu_info(ctx->vgpu, - "GSPRM: RM_CONTROL reply cmd=0x%x hClient=0x%x hObject=0x%x in=%u out=%u status=0x%x us=%llu", + "vgsp-rm: RM_CONTROL reply cmd=0x%x hClient=0x%x hObject=0x%x in=%u out=%u status=0x%x us=%llu", req.cmd, req.hClient, req.hObject, req.paramsSize, out_params_size, out_status, dt_us); @@ -3086,7 +3086,7 @@ static void gsp_rm_handle_rm_control(struct gsp_emu_context *ctx, if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_GSP_RM_CONTROL, sequence, 0, reply, GSP_RM_CTRL_HDR_SIZE + out_params_size)) - nv_vgpu_err(ctx->vgpu, "GSPRM: RM_CONTROL reply send failed cmd=0x%x", + nv_vgpu_err(ctx->vgpu, "vgsp-rm: RM_CONTROL reply send failed cmd=0x%x", req.cmd); else rm->rpcs_replied++; @@ -3144,11 +3144,11 @@ static void gsp_rm_handle_free(struct gsp_emu_context *ctx, const u8 *elem, } if (removed) nv_vgpu_info(ctx->vgpu, - "GSPRM: retired %u event record(s) on FREE hObjOld=0x%x hRoot=0x%x", + "vgsp-rm: retired %u event record(s) on FREE hObjOld=0x%x hRoot=0x%x", removed, hObjOld, hRoot); if (gsp_sema_dbg) - nv_vgpu_info(ctx->vgpu, "GSPRM: FREE hObjOld=0x%x seq=%u cmd_read=%u stat_write=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: FREE hObjOld=0x%x seq=%u cmd_read=%u stat_write=%u", hObjOld, sequence, rm->cmd_read, rm->stat_write); /* Small delay before FREE/UNLOADING replies: mitigates an intermittent @@ -3157,7 +3157,7 @@ static void gsp_rm_handle_free(struct gsp_emu_context *ctx, const u8 *elem, if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_FREE, sequence, 0, params, sizeof(params))) - nv_vgpu_err(ctx->vgpu, "GSPRM: FREE reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: FREE reply send failed"); else rm->rpcs_replied++; } @@ -3233,11 +3233,11 @@ static void gsp_rm_handle_set_page_directory(struct gsp_emu_context *ctx, v); } nv_vgpu_info(ctx->vgpu, - "GSPRM: SET_PAGE_DIRECTORY len=%u payload: %s", + "vgsp-rm: SET_PAGE_DIRECTORY len=%u payload: %s", length, dump); } nv_vgpu_info(ctx->vgpu, - "GSPRM: SET_PAGE_DIRECTORY pdb=0x%llx entries=%u flags=0x%x hVASpace=0x%x chId=0x%x subDev=%u pasid=%u len=%u", + "vgsp-rm: SET_PAGE_DIRECTORY pdb=0x%llx entries=%u flags=0x%x hVASpace=0x%x chId=0x%x subDev=%u pasid=%u len=%u", phys, num_entries, flags, h_vas, ch_id, subdev, pasid, length); @@ -3273,14 +3273,14 @@ static void gsp_rm_handle_set_page_directory(struct gsp_emu_context *ctx, o += snprintf(b + o, sizeof(b) - o, "%016llx ", peek[i]); nv_vgpu_info(ctx->vgpu, - "GSPRM: directory[0..3]: %s", b); + "vgsp-rm: directory[0..3]: %s", b); } } } if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_SET_PAGE_DIRECTORY, sequence, 0, NULL, 0)) - nv_vgpu_err(ctx->vgpu, "GSPRM: SET_PAGE_DIRECTORY reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: SET_PAGE_DIRECTORY reply send failed"); } static void gsp_rm_handle_unset_page_directory(struct gsp_emu_context *ctx, @@ -3295,13 +3295,13 @@ static void gsp_rm_handle_unset_page_directory(struct gsp_emu_context *ctx, memcpy(&h_vas, p, 4); nv_vgpu_info(ctx->vgpu, - "GSPRM: UNSET_PAGE_DIRECTORY hVASpace=0x%x len=%u", + "vgsp-rm: UNSET_PAGE_DIRECTORY hVASpace=0x%x len=%u", h_vas, length); gsp_sema_service_vaspace_del(h_vas); if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_UNSET_PAGE_DIRECTORY, sequence, 0, NULL, 0)) - nv_vgpu_err(ctx->vgpu, "GSPRM: UNSET_PAGE_DIRECTORY reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: UNSET_PAGE_DIRECTORY reply send failed"); } static void gsp_rm_handle_element(struct gsp_emu_context *ctx, const u8 *elem) @@ -3319,7 +3319,7 @@ static void gsp_rm_handle_element(struct gsp_emu_context *ctx, const u8 *elem) case GSPRM_RPC_FUNC_SET_REGISTRY: /* Async init RPCs - fire and forget, no reply expected. * Guest was treating SUCCESS replies as "unexpected events". */ - nv_vgpu_info(ctx->vgpu, "GSPRM: async RPC %s(%u) seq=%u len=%u -> NO REPLY (fire-and-forget)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: async RPC %s(%u) seq=%u len=%u -> NO REPLY (fire-and-forget)", gsp_rm_rpc_name(function), function, sequence, hdr->length); rm->rpcs_replied++; @@ -3327,11 +3327,11 @@ static void gsp_rm_handle_element(struct gsp_emu_context *ctx, const u8 *elem) case GSPRM_RPC_FUNC_CONTINUATION_RECORD: /* CONTINUATION_RECORD: driver expects a reply. Send SUCCESS. */ - nv_vgpu_info(ctx->vgpu, "GSPRM: async RPC %s(%u) seq=%u len=%u -> SUCCESS reply", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: async RPC %s(%u) seq=%u len=%u -> SUCCESS reply", gsp_rm_rpc_name(function), function, sequence, hdr->length); if (gsp_rm_send(ctx, function, sequence, 0, NULL, 0)) - nv_vgpu_err(ctx->vgpu, "GSPRM: reply send failed fn=%u", function); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: reply send failed fn=%u", function); else rm->rpcs_replied++; return; @@ -3367,24 +3367,24 @@ static void gsp_rm_handle_element(struct gsp_emu_context *ctx, const u8 *elem) case GSPRM_RPC_FUNC_UPDATE_BAR_PDE: /* UPDATE_BAR_PDE: guest updates BAR page directory entries. * For vGPU, we just acknowledge success. */ - nv_vgpu_info(ctx->vgpu, "GSPRM: RPC UPDATE_BAR_PDE(%u) seq=%u len=%u -> SUCCESS", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: RPC UPDATE_BAR_PDE(%u) seq=%u len=%u -> SUCCESS", function, sequence, hdr->length); if (gsp_rm_send(ctx, function, sequence, 0, NULL, 0)) - nv_vgpu_err(ctx->vgpu, "GSPRM: UPDATE_BAR_PDE reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: UPDATE_BAR_PDE reply send failed"); else rm->rpcs_replied++; return; case GSPRM_RPC_FUNC_UNLOADING_GUEST_DRIVER: /* UNLOADING_GUEST_DRIVER: log for unload-cycle debugging */ - nv_vgpu_info(ctx->vgpu, "GSPRM: RPC UNLOADING_GUEST_DRIVER(%u) seq=%u cmd_read=%u stat_write=%u stat_seq=%u", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: RPC UNLOADING_GUEST_DRIVER(%u) seq=%u cmd_read=%u stat_write=%u stat_seq=%u", function, sequence, rm->cmd_read, rm->stat_write, rm->stat_seq); /* Small delay before UNLOADING replies: mitigates an intermittent * driver-side reply-matching race in the cleanup path. */ udelay(2000); if (gsp_rm_send(ctx, function, sequence, 0, NULL, 0)) - nv_vgpu_err(ctx->vgpu, "GSPRM: UNLOADING reply send failed"); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: UNLOADING reply send failed"); else rm->rpcs_replied++; return; @@ -3394,11 +3394,11 @@ static void gsp_rm_handle_element(struct gsp_emu_context *ctx, const u8 *elem) * driver's rpcRecvPoll completes. */ rm->unknown_rpcs++; if (gsp_sema_dbg) - nv_vgpu_info(ctx->vgpu, "GSPRM: RPC %s(%u) seq=%u len=%u -> generic SUCCESS reply (unknown #%llu)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: RPC %s(%u) seq=%u len=%u -> generic SUCCESS reply (unknown #%llu)", gsp_rm_rpc_name(function), function, sequence, hdr->length, rm->unknown_rpcs); if (gsp_rm_send(ctx, function, sequence, 0, NULL, 0)) - nv_vgpu_err(ctx->vgpu, "GSPRM: reply send failed fn=%u", function); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: reply send failed fn=%u", function); else rm->rpcs_replied++; return; @@ -3431,7 +3431,7 @@ static void gsp_rm_poll_commands(struct gsp_emu_context *ctx) * without an observable GSP shutdown) - declare the emulated GSP * dead so the next probe's WPR2-up check passes and it re-boots. */ if (tx.writePtr >= rm->cmd_msgcount) { - nv_vgpu_warn(ctx->vgpu, "GSPRM: insane cmd writePtr %u (msgCount=%u), GSP boot declared dead", + nv_vgpu_warn(ctx->vgpu, "vgsp-rm: insane cmd writePtr %u (msgCount=%u), GSP boot declared dead", tx.writePtr, rm->cmd_msgcount); gsp_emu_clear_boot_state(ctx, "stale GSP-RM queue header"); gsp_rm_emu_reset(ctx); @@ -3469,7 +3469,7 @@ static void gsp_rm_poll_commands(struct gsp_emu_context *ctx) * via gsp_emu_clear_boot_state. This allows the * driver's cleanup frees to complete. */ if (gsp_sema_dbg) - nv_vgpu_info(ctx->vgpu, "GSPRM: garbage element idx=%u sig=0x%x elemCount=%u fn=%u, stopping poll (teardown?)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: garbage element idx=%u sig=0x%x elemCount=%u fn=%u, stopping poll (teardown?)", rm->cmd_read, signature, elem_count, hdr->function); kfree(elem); @@ -3532,7 +3532,7 @@ void gsp_rm_emu_reset(struct gsp_emu_context *ctx) if (!rm || !rm->parsed) return; - nv_vgpu_info(ctx->vgpu, "GSPRM: reset (rpcs=%llu replied=%llu unknown=%llu)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: reset (rpcs=%llu replied=%llu unknown=%llu)", rm->rpcs_seen, rm->rpcs_replied, rm->unknown_rpcs); kfree(rm->ptes); @@ -3573,17 +3573,17 @@ void gsp_rm_emu_on_booter_done(struct gsp_emu_context *ctx) mb_hi = gsp_emu_shadow_read32(ctx, GSP_EMU_REG_GSP_MAILBOX0 + 4); rm->libos_args_gpa = ((u64)mb_hi << 32) | mb_lo; - nv_vgpu_info(ctx->vgpu, "GSPRM: libos args at gpa=0x%llx (mailbox 0x%x:0x%x)", + nv_vgpu_info(ctx->vgpu, "vgsp-rm: libos args at gpa=0x%llx (mailbox 0x%x:0x%x)", rm->libos_args_gpa, mb_hi, mb_lo); if (!rm->libos_args_gpa) { - pr_warn_ratelimited("GSPRM: libos args GPA is 0, will retry\n"); + pr_warn_ratelimited("vgsp-rm: libos args GPA is 0, will retry\n"); return; } ret = gsp_rm_parse_queue_chain(ctx); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: queue chain parse failed: %d", ret); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: queue chain parse failed: %d", ret); return; } @@ -3598,12 +3598,12 @@ void gsp_rm_emu_on_booter_done(struct gsp_emu_context *ctx) ret = gsp_rm_send(ctx, GSPRM_RPC_EVENT_GSP_INIT_DONE, 0, 0, &b_is_d3hot, sizeof(b_is_d3hot)); if (ret) { - nv_vgpu_err(ctx->vgpu, "GSPRM: GSP_INIT_DONE send failed: %d", ret); + nv_vgpu_err(ctx->vgpu, "vgsp-rm: GSP_INIT_DONE send failed: %d", ret); return; } rm->init_done_sent = true; - nv_vgpu_info(ctx->vgpu, "GSPRM: GSP_INIT_DONE emitted, RPC loop active"); + nv_vgpu_info(ctx->vgpu, "vgsp-rm: GSP_INIT_DONE emitted, RPC loop active"); } void gsp_rm_emu_poll(struct gsp_emu_context *ctx) diff --git a/kernel/gsp_rpc_client.c b/kernel/gsp_rpc_client.c index eb3d85d..0b7f7a2 100644 --- a/kernel/gsp_rpc_client.c +++ b/kernel/gsp_rpc_client.c @@ -237,7 +237,7 @@ int gsp_rpc_alloc(struct gsp_client *client, return ret; if (response.status) { - pr_err("GSP ALLOC failed: status=%d\n", response.status); + pr_err("vgsp-rpc: GSP ALLOC failed: status=%d\n", response.status); return -EIO; } @@ -390,7 +390,7 @@ int gsp_rpc_bar_trap(struct gsp_client *client, * synchronous MMIO via the shadow mapping and never needs this RPC. * Real shadow-register handlers are TODO; fail fast and loudly. */ if (gsp_rpc_emulation_is_enabled()) { - pr_warn_ratelimited("gsp_rpc_bar_trap: not supported in emulation mode (bar=%u addr=0x%llx)\n", + pr_warn_ratelimited("vgsp-rpc-bar-trap: not supported in emulation mode (bar=%u addr=0x%llx)\n", bar_num, bar_addr); return -ENOTSUPP; } @@ -432,7 +432,7 @@ int gsp_rpc_migrate_save(struct gsp_client *client, * Live migration over the emulated vGPU is not yet implemented; * see kernel/migration.c for the 4-phase host-side protocol work. */ if (gsp_rpc_emulation_is_enabled()) { - pr_warn_ratelimited("gsp_rpc_migrate_save: not supported in emulation mode\n"); + pr_warn_ratelimited("vgsp-rpc-migrate-save: not supported in emulation mode\n"); return -ENOTSUPP; } @@ -470,7 +470,7 @@ int gsp_rpc_migrate_restore(struct gsp_client *client, /* Emulation mode: no real firmware; see gsp_rpc_migrate_save note. */ if (gsp_rpc_emulation_is_enabled()) { - pr_warn_ratelimited("gsp_rpc_migrate_restore: not supported in emulation mode\n"); + pr_warn_ratelimited("vgsp-rpc-migrate-restore: not supported in emulation mode\n"); return -ENOTSUPP; } @@ -1035,7 +1035,7 @@ struct gsp_client *gsp_client_init(struct device *dev, phys_addr_t fw_base, phys } client->initialized = true; - pr_info("GSP RPC client initialized: fw_base=%pa, doorbell=%pa\n", &fw_base, &doorbell); + pr_info("vgsp-rpc: GSP RPC client initialized: fw_base=%pa, doorbell=%pa\n", &fw_base, &doorbell); return client; } @@ -1076,7 +1076,7 @@ struct gsp_client *gsp_client_init_emulation(struct device *dev, void __iomem *f client->initialized = true; client->emulation_mode = true; - pr_info("GSP RPC client initialized (emulation): fw_base=%p, doorbell=%p\n", fw_base_virt, doorbell_virt); + pr_info("vgsp-rpc: GSP RPC client initialized (emulation): fw_base=%p, doorbell=%p\n", fw_base_virt, doorbell_virt); return client; } diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index d42edab..ae74881 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -30,7 +30,7 @@ * open-iov/docs/03-architecture/06-host-module-and-hybrid-model.md. */ -#define pr_fmt(fmt) "gsp-resman-vfio: " fmt +#define pr_fmt(fmt) "vgsp-sema: " fmt #include <linux/kthread.h> #include <linux/bitmap.h> @@ -6072,7 +6072,7 @@ static void svc_fwd_fault_deliver(struct nv_vgpu_device *vgpu, if (f->runlist_id != want_rl || f->chid != want_chid) { svc.fwd_fault_unmatched++; if ((svc.fwd_fault_unmatched & 15) == 1) - pr_info("gsp-phys-fault: FAULT RELAY refused ch=0x%x hwchid=%u rl=%u want_chid=%u want_rl=%u except=0x%x unmatched=%llu\n", + pr_info("vgsp-fault: FAULT RELAY refused ch=0x%x hwchid=%u rl=%u want_chid=%u want_rl=%u except=0x%x unmatched=%llu\n", ch->h_object, f->chid, f->runlist_id, want_chid, want_rl, f->except_type, svc.fwd_fault_unmatched); @@ -6090,7 +6090,7 @@ static void svc_fwd_fault_deliver(struct nv_vgpu_device *vgpu, rr = &svc_fwd_hold.rel[svc_fwd_hold.relay_index]; if (rr && !svc_sem_read(vgpu, rr->va, &cur) && cur >= rr->payload) { svc.fwd_fault_late_release++; - pr_info("gsp-phys-fault: FAULT RELAY late release ch=0x%x sem=0x%08x payload=0x%08x late_release=%llu\n", + pr_info("vgsp-fault: FAULT RELAY late release ch=0x%x sem=0x%08x payload=0x%08x late_release=%llu\n", ch->h_object, cur, rr->payload, svc.fwd_fault_late_release); return; @@ -6108,7 +6108,7 @@ static void svc_fwd_fault_deliver(struct nv_vgpu_device *vgpu, ret = svc_write_ap(vgpu, ch->notifier_pa, ch->notifier_as, notif, sizeof(notif)); if (ret) { - pr_err_ratelimited("gsp-phys-fault: FAULT RELAY notifier write failed ch=0x%x pa=0x%llx as=%u ret=%d\n", + pr_err_ratelimited("vgsp-fault: FAULT RELAY notifier write failed ch=0x%x pa=0x%llx as=%u ret=%d\n", ch->h_object, ch->notifier_pa, ch->notifier_as, ret); return; @@ -6119,7 +6119,7 @@ static void svc_fwd_fault_deliver(struct nv_vgpu_device *vgpu, ch->notifier_err_put = ch->put_prev; svc.fwd_fault_delivered++; if ((svc.fwd_fault_delivered & 15) == 1) - pr_info("gsp-phys-fault: FAULT RELAY ch=0x%x hwchid=%u rl=%u except=0x%x engine=%u delivered=%llu\n", + pr_info("vgsp-fault: FAULT RELAY ch=0x%x hwchid=%u rl=%u except=0x%x engine=%u delivered=%llu\n", ch->h_object, f->chid, f->runlist_id, f->except_type, engine, svc.fwd_fault_delivered); /* @@ -6141,7 +6141,7 @@ static void svc_fwd_fault_deliver(struct nv_vgpu_device *vgpu, else why = "event-post-send-failed"; svc.fwd_fault_no_event++; - pr_info("gsp-phys-fault: FAULT RELAY no event ch=0x%x hwchid=%u rl=%u except=0x%x reason=%s ret=%d no_event=%llu\n", + pr_info("vgsp-fault: FAULT RELAY no event ch=0x%x hwchid=%u rl=%u except=0x%x reason=%s ret=%d no_event=%llu\n", ch->h_object, f->chid, f->runlist_id, f->except_type, why, ret, svc.fwd_fault_no_event); } @@ -6269,7 +6269,7 @@ static bool svc_fwd_hold_poll(struct nv_vgpu_device *vgpu, svc_fwd_hold.nrel); svc.fwd_rel_applied++; if ((svc.fwd_relay_verify_fail & 15) == 1) - pr_err("gsp-phys-work: RELAY VERIFY FAILED: guest sem va=0x%llx cur=0x%08x payload=0x%08x; software applied all releases\n", + pr_err("vgsp-work: RELAY VERIFY FAILED: guest sem va=0x%llx cur=0x%08x payload=0x%08x; software applied all releases\n", rr->va, cur, rr->payload); } } else { @@ -6490,7 +6490,7 @@ static void svc_fwd_work_fn(struct work_struct *work) hw_rc = -EINVAL; svc.fwd_relay_resolve_fail++; if (svc.fwd_relay_resolve_fail <= 16) - pr_info("gsp-phys-work: relay semaphore resolve failed: kind=%u page=0x%llx off=%u rc=%d; software release stays authoritative\n", + pr_info("vgsp-work: relay semaphore resolve failed: kind=%u page=0x%llx off=%u rc=%d; software release stays authoritative\n", svc_fwd_req.relay_kind, svc_fwd_req.relay_page, svc_fwd_req.relay_off, sem_rc); @@ -6513,7 +6513,7 @@ static void svc_fwd_work_fn(struct work_struct *work) svc.fwd_guest_resolve_fail++; svc.fwd_guest_resolve_log++; if (svc.fwd_guest_resolve_log <= 16) - pr_info("gsp-phys-work: guest candidate resolve failed: src kind=%u pa=0x%llx off=%u rc=%d dst kind=%u pa=0x%llx off=%u rc=%d vgpu=%d bytes=%u\n", + pr_info("vgsp-work: guest candidate resolve failed: src kind=%u pa=0x%llx off=%u rc=%d dst kind=%u pa=0x%llx off=%u rc=%d vgpu=%d bytes=%u\n", svc_fwd_req.src_kind, svc_fwd_req.src_page, svc_fwd_req.src_off, src_rc, @@ -6533,7 +6533,7 @@ static void svc_fwd_work_fn(struct work_struct *work) if (hw_rc) { svc.fwd_guest_fallback++; if ((svc.fwd_guest_fallback & SVC_FWD_LOG_MASK) == 1) - pr_info("gsp-phys-work: guest copy failed rc=%d, held releases will be applied by the service (req=%llu ok=%llu fallback=%llu resolve_fail=%llu)\n", + pr_info("vgsp-work: guest copy failed rc=%d, held releases will be applied by the service (req=%llu ok=%llu fallback=%llu resolve_fail=%llu)\n", hw_rc, svc.fwd_guest_req, svc.fwd_guest_ok, svc.fwd_guest_fallback, @@ -6557,7 +6557,7 @@ static void svc_fwd_work_fn(struct work_struct *work) } svc.fwd_guest_fallback++; if ((svc.fwd_guest_fallback & SVC_FWD_LOG_MASK) == 1) - pr_info("gsp-phys-work: guest copy fell back to the ladder copy (req=%llu ok=%llu fallback=%llu resolve_fail=%llu)\n", + pr_info("vgsp-work: guest copy fell back to the ladder copy (req=%llu ok=%llu fallback=%llu resolve_fail=%llu)\n", svc.fwd_guest_req, svc.fwd_guest_ok, svc.fwd_guest_fallback, svc.fwd_guest_resolve_fail); @@ -6572,7 +6572,7 @@ static void svc_fwd_work_fn(struct work_struct *work) &bytes)) { svc_fwd_dropped++; if ((svc_fwd_dropped & SVC_FWD_LOG_MASK) == 1) - pr_info("gsp-phys-work: shadow copy dropped before submit (backend not ready) dropped=%llu\n", + pr_info("vgsp-work: shadow copy dropped before submit (backend not ready) dropped=%llu\n", svc_fwd_dropped); clear_bit_unlock(SVC_FWD_INFLIGHT, &svc_fwd_state); return; @@ -6581,7 +6581,7 @@ static void svc_fwd_work_fn(struct work_struct *work) ret = gsp_phys_backend_ce_copy_submit(src_va, dst_va, sem_va, bytes, GSP_PHYS_BACKEND_WORK_POLL_MS); if (!ret) - pr_info("gsp-phys-work: REAL CE COPY OK bytes=%u elapsed=%u ms (requests=%llu dropped=%llu)\n", + pr_info("vgsp-work: REAL CE COPY OK bytes=%u elapsed=%u ms (requests=%llu dropped=%llu)\n", bytes, jiffies_to_msecs(jiffies - start), svc_fwd_requests, svc_fwd_dropped); /* Timeout/refusal counters and their rate-limited logs are in the @@ -6659,7 +6659,7 @@ static bool svc_fwd_request(struct nv_vgpu_device *vgpu, if (!gsp_phys_backend_work_ready()) { svc_fwd_dropped++; if ((svc_fwd_dropped & SVC_FWD_LOG_MASK) == 1) - pr_info("gsp-phys-work: shadow request dropped (backend not ready) dropped=%llu\n", + pr_info("vgsp-work: shadow request dropped (backend not ready) dropped=%llu\n", svc_fwd_dropped); return false; } @@ -6671,7 +6671,7 @@ static bool svc_fwd_request(struct nv_vgpu_device *vgpu, if (svc_fwd_hold.active) { svc_fwd_dropped++; if ((svc_fwd_dropped & SVC_FWD_LOG_MASK) == 1) - pr_info("gsp-phys-work: shadow request dropped (release hold active) dropped=%llu\n", + pr_info("vgsp-work: shadow request dropped (release hold active) dropped=%llu\n", svc_fwd_dropped); return false; } @@ -6680,7 +6680,7 @@ static bool svc_fwd_request(struct nv_vgpu_device *vgpu, mutex_unlock(&svc_fwd_lock); svc_fwd_dropped++; if ((svc_fwd_dropped & SVC_FWD_LOG_MASK) == 1) - pr_info("gsp-phys-work: shadow request dropped (forwarding paused for release) dropped=%llu\n", + pr_info("vgsp-work: shadow request dropped (forwarding paused for release) dropped=%llu\n", svc_fwd_dropped); return false; } @@ -6688,7 +6688,7 @@ static bool svc_fwd_request(struct nv_vgpu_device *vgpu, mutex_unlock(&svc_fwd_lock); svc_fwd_dropped++; if ((svc_fwd_dropped & SVC_FWD_LOG_MASK) == 1) - pr_info("gsp-phys-work: shadow request dropped (one in flight) dropped=%llu\n", + pr_info("vgsp-work: shadow request dropped (one in flight) dropped=%llu\n", svc_fwd_dropped); return false; } diff --git a/kernel/include/nvidia-vgpu-vfio.h b/kernel/include/nvidia-vgpu-vfio.h index aed3dc5..1c2f67b 100644 --- a/kernel/include/nvidia-vgpu-vfio.h +++ b/kernel/include/nvidia-vgpu-vfio.h @@ -11,11 +11,11 @@ #include <linux/dma-mapping.h> #include <linux/atomic.h> -#define OPEN_IOV_VFIO_VERSION "0.1.0" -#define OPEN_IOV_VFIO_NAME "open-iov-vfio" +#define VGSP_VERSION "0.1.0" +#define VGSP_NAME "vgsp" -#define NVIDIA_VGPU_VFIO_VERSION OPEN_IOV_VFIO_VERSION -#define NVIDIA_VGPU_VFIO_NAME OPEN_IOV_VFIO_NAME +#define NVIDIA_VGPU_VFIO_VERSION VGSP_VERSION +#define NVIDIA_VGPU_VFIO_NAME VGSP_NAME #define NVIDIA_VGPU_MAX_VF_COUNT 32 #define NVIDIA_VGPU_MAX_REGIONS 8 @@ -209,30 +209,30 @@ static inline struct nv_vgpu_device *mdev_to_vgpu(struct mdev_device *mdev) * (e.g. unit tests, early init) - fall back to plain pr_*. */ #define nv_vgpu_dbg(vgpu, fmt, ...) do { \ if (vgpu) \ - dev_dbg(&(vgpu)->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \ + dev_dbg(&(vgpu)->dev, KBUILD_MODNAME ": %s: " fmt, __func__, ##__VA_ARGS__); \ else \ pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #define nv_vgpu_info(vgpu, fmt, ...) do { \ if (vgpu) \ - dev_info(&(vgpu)->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \ + dev_info(&(vgpu)->dev, KBUILD_MODNAME ": %s: " fmt, __func__, ##__VA_ARGS__); \ else \ - pr_info("%s: " fmt, __func__, ##__VA_ARGS__); \ + pr_info(KBUILD_MODNAME ": %s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #define nv_vgpu_warn(vgpu, fmt, ...) do { \ if (vgpu) \ - dev_warn(&(vgpu)->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \ + dev_warn(&(vgpu)->dev, KBUILD_MODNAME ": %s: " fmt, __func__, ##__VA_ARGS__); \ else \ - pr_warn("%s: " fmt, __func__, ##__VA_ARGS__); \ + pr_warn(KBUILD_MODNAME ": %s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #define nv_vgpu_err(vgpu, fmt, ...) do { \ if (vgpu) \ - dev_err(&(vgpu)->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \ + dev_err(&(vgpu)->dev, KBUILD_MODNAME ": %s: " fmt, __func__, ##__VA_ARGS__); \ else \ - pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \ + pr_err(KBUILD_MODNAME ": %s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #endif
\ No newline at end of file diff --git a/kernel/ioctl.c b/kernel/ioctl.c index 387a249..754857d 100644 --- a/kernel/ioctl.c +++ b/kernel/ioctl.c @@ -298,10 +298,10 @@ int nv_vgpu_ioctl_register_vgpu_type(void __user *arg) mdev_unregister_driver(&nv_vgpu_mdev_driver); ret = mdev_register_driver(&nv_vgpu_mdev_driver); if (ret) { - pr_err("Failed to re-register mdev driver: %d\n", ret); + pr_err("vgsp-ioctl: Failed to re-register mdev driver: %d\n", ret); return ret; } - pr_info("vGPU type '%s' registered via ioctl\n", info.name); + pr_info("vgsp-ioctl: vGPU type '%s' registered via ioctl\n", info.name); return 0; }
\ No newline at end of file diff --git a/kernel/main.c b/kernel/main.c index fbeb7e3..39c71c3 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -175,7 +175,7 @@ static NV_STATUS nv_vgpu_create_callback(struct pci_dev *pdev, const NvU8 *uuid, NvU32 type_id, NvU16 *vgpu_id, NvU32 *gpu_pci_id, NvU32 gpu_pci_bdf) { - pr_info("gsp-resman-vfio: vgpu_create callback: type_id=%u\n", type_id); + pr_info("vgsp: vgpu_create callback: type_id=%u\n", type_id); if (vgpu_id) *vgpu_id = 1; if (gpu_pci_id) @@ -185,14 +185,14 @@ static NV_STATUS nv_vgpu_create_callback(struct pci_dev *pdev, const NvU8 *uuid, static NV_STATUS nv_vgpu_delete_callback(const NvU8 *uuid, NvU16 vgpu_id) { - pr_info("gsp-resman-vfio: vgpu_delete callback: vgpu_id=%u\n", vgpu_id); + pr_info("vgsp: vgpu_delete callback: vgpu_id=%u\n", vgpu_id); return NV_OK; } static NV_STATUS nv_vgpu_bar_info_callback(struct pci_dev *pdev, const NvU8 *uuid, NvU64 *size, NvU32 bar_index, void *vgpu_dev) { - pr_info("gsp-resman-vfio: vgpu_bar_info callback: bar_index=%u\n", bar_index); + pr_info("vgsp: vgpu_bar_info callback: bar_index=%u\n", bar_index); if (size) { switch (bar_index) { case 0: @@ -217,7 +217,7 @@ static NV_STATUS nv_vgpu_bar_info_callback(struct pci_dev *pdev, const NvU8 *uui static NV_STATUS nv_vgpu_get_name_callback(struct pci_dev *pdev, NvU32 type_id, char *buf) { - pr_info("gsp-resman-vfio: get_name callback: type_id=%u\n", type_id); + pr_info("vgsp: get_name callback: type_id=%u\n", type_id); if (buf) { switch (type_id) { case 0: /* Ampere */ @@ -242,7 +242,7 @@ static NV_STATUS nv_vgpu_get_name_callback(struct pci_dev *pdev, NvU32 type_id, static NV_STATUS nv_vgpu_get_description_callback(struct pci_dev *pdev, NvU32 type_id, char *buf) { - pr_info("gsp-resman-vfio: get_description callback: type_id=%u\n", type_id); + pr_info("vgsp: get_description callback: type_id=%u\n", type_id); if (buf) { switch (type_id) { case 0: @@ -267,7 +267,7 @@ static NV_STATUS nv_vgpu_get_description_callback(struct pci_dev *pdev, NvU32 ty static NV_STATUS nv_vgpu_get_instances_callback(struct pci_dev *pdev, NvU32 type_id, char *buf) { - pr_info("gsp-resman-vfio: get_instances callback: type_id=%u\n", type_id); + pr_info("vgsp: get_instances callback: type_id=%u\n", type_id); if (buf) strcpy(buf, "1"); return NV_OK; @@ -277,13 +277,13 @@ static void nv_vgpu_update_request_callback(const NvU8 *uuid, NvU64 *vgpu_dev, NvU64 *vgpu_vm, VGPU_DEVICE_STATE device_state, const char *params) { - pr_info("gsp-resman-vfio: update_request callback: state=%u\n", device_state); + pr_info("vgsp: update_request callback: state=%u\n", device_state); } static NV_STATUS nv_vgpu_start_callback(const NvU8 *uuid, void *wait_queue, NvS32 *return_status, NvU8 *vm_name, NvU32 qemu_pid) { - pr_info("gsp-resman-vfio: vgpu_start callback: qemu_pid=%u\n", qemu_pid); + pr_info("vgsp: vgpu_start callback: qemu_pid=%u\n", qemu_pid); if (return_status) *return_status = 0; return NV_OK; @@ -292,7 +292,7 @@ static NV_STATUS nv_vgpu_start_callback(const NvU8 *uuid, void *wait_queue, NvS3 static NV_STATUS nv_vgpu_sparse_mmap_callback(struct pci_dev *pdev, const NvU8 *uuid, NvU64 **pages, NvU64 **offsets, NvU32 *count) { - pr_info("gsp-resman-vfio: sparse_mmap callback\n"); + pr_info("vgsp: sparse_mmap callback\n"); if (count) *count = 0; return NV_OK; @@ -345,7 +345,7 @@ int nv_vgpu_register_type_info(struct nv_vgpu_type_info *info) mutex_unlock(&g_vgpu_type_lock); - pr_info("Registered vGPU type: name='%s', vdev=0x%llx, pdev=0x%llx, max_inst=%u\n", + pr_info("vgsp: Registered vGPU type: name='%s', vdev=0x%llx, pdev=0x%llx, max_inst=%u\n", info->name, info->vdev_id, info->pdev_id, info->max_instances); return 0; } @@ -436,7 +436,7 @@ NV_STATUS nvidia_vgpu_vfio_get_ops(rm_vgpu_vfio_ops_t *ops) populate_rm_ops(); memcpy(ops, &g_rm_vgpu_vfio_ops, sizeof(rm_vgpu_vfio_ops_t)); - pr_info("gsp-resman-vfio: get_ops provided RM ops\n"); + pr_info("vgsp: get_ops provided RM ops\n"); return NV_OK; } EXPORT_SYMBOL(nvidia_vgpu_vfio_get_ops); @@ -448,7 +448,7 @@ NV_STATUS nvidia_vgpu_vfio_set_ops(vgpu_vfio_ops_t *ops) return NV_ERR_INVALID_ARGUMENT; g_vgpu_vfio_ops = ops; - pr_info("gsp-resman-vfio: set_ops received VFIO ops\n"); + pr_info("vgsp: set_ops received VFIO ops\n"); return NV_OK; } EXPORT_SYMBOL(nvidia_vgpu_vfio_set_ops); @@ -456,14 +456,14 @@ EXPORT_SYMBOL(nvidia_vgpu_vfio_set_ops); /* mdev driver registration - called by nvidia.ko */ int nv_vgpu_mdev_driver_register(void) { - pr_info("gsp-resman-vfio: mdev driver register\n"); + pr_info("vgsp: mdev driver register\n"); return mdev_register_driver(&nv_vgpu_mdev_driver); } EXPORT_SYMBOL(nv_vgpu_mdev_driver_register); void nv_vgpu_mdev_driver_unregister(void) { - pr_info("gsp-resman-vfio: mdev driver unregister\n"); + pr_info("vgsp: mdev driver unregister\n"); mdev_unregister_driver(&nv_vgpu_mdev_driver); } EXPORT_SYMBOL(nv_vgpu_mdev_driver_unregister); @@ -475,10 +475,10 @@ int nv_vgpu_mdev_register_parent(struct pci_dev *pdev) struct mdev_parent *parent; int ret; - pr_info("gsp-resman-vfio: mdev parent register for %s\n", pci_name(pdev)); + pr_info("vgsp: mdev parent register for %s\n", pci_name(pdev)); if (g_mdev_parent) { - pr_warn("mdev parent already registered\n"); + pr_warn("vgsp: mdev parent already registered\n"); return 0; } @@ -491,25 +491,25 @@ int nv_vgpu_mdev_register_parent(struct pci_dev *pdev) ret = mdev_register_parent(parent, &pdev->dev, &nv_vgpu_mdev_driver, nv_vgpu_mdev_types, g_num_vgpu_types); if (ret) { - pr_err("Failed to register mdev parent: %d\n", ret); + pr_err("vgsp: Failed to register mdev parent: %d\n", ret); kfree(parent); return ret; } g_mdev_parent = parent; - pr_info("mdev parent registered successfully with %d types\n", g_num_vgpu_types); + pr_info("vgsp: mdev parent registered successfully with %d types\n", g_num_vgpu_types); return 0; } EXPORT_SYMBOL(nv_vgpu_mdev_register_parent); void nv_vgpu_mdev_unregister_parent(struct pci_dev *pdev) { - pr_info("gsp-resman-vfio: mdev parent unregister for %s\n", pci_name(pdev)); + pr_info("vgsp: mdev parent unregister for %s\n", pci_name(pdev)); if (g_mdev_parent) { - pr_info("gsp-resman-vfio: mdev_unregister_parent: entering\n"); + pr_info("vgsp: mdev_unregister_parent: entering\n"); mdev_unregister_parent(g_mdev_parent); - pr_info("gsp-resman-vfio: mdev_unregister_parent: returned\n"); + pr_info("vgsp: mdev_unregister_parent: returned\n"); kfree(g_mdev_parent); g_mdev_parent = NULL; } @@ -519,12 +519,12 @@ EXPORT_SYMBOL(nv_vgpu_mdev_unregister_parent); /* NOTE: No MODULE_SOFTDEP on nvidia - this module is fully standalone. * It exports the nvidia_vgpu_vfio_* interface (nvidia.ko imports it when * present) and registers the mdev parent on the physical GPU directly. - * Load order for the matched stack: open-iov-vfio.ko BEFORE nvidia.ko. */ + * Load order for the matched stack: vgsp.ko BEFORE nvidia.ko. */ MODULE_AUTHOR("Open-IOV Project"); MODULE_DESCRIPTION("Open-IOV vGPU VFIO Mediated Device Driver"); MODULE_LICENSE("GPL v2"); -MODULE_VERSION(OPEN_IOV_VFIO_VERSION); +MODULE_VERSION(VGSP_VERSION); struct nv_vgpu_driver_data nv_vgpu_driver = { .lock = __MUTEX_INITIALIZER(nv_vgpu_driver.lock), @@ -620,12 +620,12 @@ static void nv_vgpu_mdev_remove(struct mdev_device *mdev) long timeout; if (!vgpu) { - printk(KERN_ERR "gsp-resman-vfio: No vGPU device data found for mdev %s\n", + printk(KERN_ERR "vgsp: No vGPU device data found for mdev %s\n", dev_name(&mdev->dev)); return; } - pr_info("gsp-resman-vfio: mdev remove started for %s\n", dev_name(&mdev->dev)); + pr_info("vgsp: mdev remove started for %s\n", dev_name(&mdev->dev)); /* Cancel pending/running init work first */ cancel_work_sync(&vgpu->init_work); @@ -635,17 +635,17 @@ static void nv_vgpu_mdev_remove(struct mdev_device *mdev) * otherwise vfio_device_group_unregister can crash with NULL pointer deref. * vfio_unregister_group_dev() itself blocks until fds drain, so this * pre-wait exists to surface a clear warning if userspace is stuck. */ - pr_info("gsp-resman-vfio: waiting for vfio_dev_open_count to reach 0 (current: %d)\n", + pr_info("vgsp: waiting for vfio_dev_open_count to reach 0 (current: %d)\n", atomic_read(&vgpu->vfio_dev_open_count)); timeout = wait_event_timeout(vgpu->vfio_dev_close_wait, atomic_read(&vgpu->vfio_dev_open_count) == 0, msecs_to_jiffies(5000)); if (timeout == 0) { - pr_warn("gsp-resman-vfio: timeout waiting for vfio device close (open_count=%d), proceeding anyway\n", + pr_warn("vgsp: timeout waiting for vfio device close (open_count=%d), proceeding anyway\n", atomic_read(&vgpu->vfio_dev_open_count)); } else { - pr_info("gsp-resman-vfio: all vfio device file descriptors closed\n"); + pr_info("vgsp: all vfio device file descriptors closed\n"); } /* Unregister the VFIO device. This removes it from its IOMMU group, @@ -674,26 +674,26 @@ static void nv_vgpu_mdev_remove(struct mdev_device *mdev) * the vfio_device refcount drops to zero (ops->release fires first). */ vfio_put_device(&vgpu->vfio_dev); - pr_info("gsp-resman-vfio: mdev remove callback completed for %s\n", dev_name(&mdev->dev)); + pr_info("vgsp: mdev remove callback completed for %s\n", dev_name(&mdev->dev)); } /* VFIO device operations implementations */ static int nv_vgpu_vfio_dev_init(struct vfio_device *vdev) { - pr_info("gsp-resman-vfio: VFIO device init\n"); + pr_info("vgsp: VFIO device init\n"); return 0; } static void nv_vgpu_vfio_dev_release(struct vfio_device *vdev) { - pr_info("gsp-resman-vfio: VFIO device release\n"); + pr_info("vgsp: VFIO device release\n"); } static int nv_vgpu_vfio_dev_open(struct vfio_device *vdev) { struct nv_vgpu_device *vgpu = container_of(vdev, struct nv_vgpu_device, vfio_dev); - pr_info("gsp-resman-vfio: VFIO device open\n"); + pr_info("vgsp: VFIO device open\n"); atomic_inc(&vgpu->vfio_dev_open_count); return 0; } @@ -703,7 +703,7 @@ static void nv_vgpu_vfio_dev_close(struct vfio_device *vdev) struct nv_vgpu_device *vgpu = container_of(vdev, struct nv_vgpu_device, vfio_dev); int i; - pr_info("gsp-resman-vfio: VFIO device close\n"); + pr_info("vgsp: VFIO device close\n"); /* Release eventfd trigger references wired via SET_IRQS; the next * opener re-wires its own. Prevents fd/ctx leaks across VM restarts. */ @@ -725,7 +725,7 @@ static ssize_t nv_vgpu_vfio_dev_read(struct vfio_device *vdev, char __user *buf, loff_t pos = *ppos; if (gsp_sema_dbg) - pr_info("gsp-resman-vfio: VFIO device read count=%zu pos=%lld (0x%llx)\n", + pr_info("vgsp: VFIO device read count=%zu pos=%lld (0x%llx)\n", count, pos, pos); /* Config space region: VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_CONFIG_REGION_INDEX) = 0x70000000000 */ @@ -782,7 +782,7 @@ static ssize_t nv_vgpu_vfio_dev_write(struct vfio_device *vdev, const char __use loff_t pos = *ppos; if (gsp_sema_dbg) - pr_info_ratelimited("gsp-resman-vfio: VFIO device write count=%zu pos=%lld (0x%llx)\n", + pr_info_ratelimited("vgsp: VFIO device write count=%zu pos=%lld (0x%llx)\n", count, pos, pos); /* Config space region - route through the per-register filter so the @@ -821,14 +821,14 @@ static ssize_t nv_vgpu_vfio_dev_write(struct vfio_device *vdev, const char __use if ((u64)pos == 0x88704) { if (gsp_sema_dbg && db_log < 512) { - pr_info("gsp-resman-vfio: DOORBELL write pos=0x%llx size=%zu val=0x%llx\n", + pr_info("vgsp: DOORBELL write pos=0x%llx size=%zu val=0x%llx\n", (u64)pos, count, v); db_log++; } if (count == 4) gsp_sema_service_doorbell((u32)v); } else { - pr_info("gsp-resman-vfio: BAR0 write pos=0x%llx size=%zu val=0x%llx\n", + pr_info("vgsp: BAR0 write pos=0x%llx size=%zu val=0x%llx\n", (u64)pos, count, v); bar0_log++; } @@ -853,7 +853,7 @@ static ssize_t nv_vgpu_vfio_dev_write(struct vfio_device *vdev, const char __use memcpy(&v, buf, count); - pr_info("gsp-resman-vfio: BAR1 write off=0x%llx size=%zu val=0x%llx\n", + pr_info("vgsp: BAR1 write off=0x%llx size=%zu val=0x%llx\n", bar1_off, count, v); bar1_log++; } @@ -874,24 +874,24 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, unsigned long minsz; int ret; - pr_info("gsp-resman-vfio: VFIO device ioctl cmd=0x%x\n", cmd); + pr_info("vgsp: VFIO device ioctl cmd=0x%x\n", cmd); if (cmd == VFIO_DEVICE_GET_INFO) { struct vfio_device_info info; minsz = offsetofend(struct vfio_device_info, num_irqs); - pr_info("gsp-resman-vfio: VFIO_DEVICE_GET_INFO minsz=%lu argsz=%u\n", minsz, info.argsz); + pr_info("vgsp: VFIO_DEVICE_GET_INFO minsz=%lu argsz=%u\n", minsz, info.argsz); if (copy_from_user(&info, (void __user *)arg, minsz)) { - pr_err("gsp-resman-vfio: VFIO_DEVICE_GET_INFO copy_from_user failed\n"); + pr_err("vgsp: VFIO_DEVICE_GET_INFO copy_from_user failed\n"); return -EFAULT; } - pr_info("gsp-resman-vfio: VFIO_DEVICE_GET_INFO argsz=%u minsz=%lu\n", info.argsz, minsz); + pr_info("vgsp: VFIO_DEVICE_GET_INFO argsz=%u minsz=%lu\n", info.argsz, minsz); if (info.argsz < minsz) { - pr_err("gsp-resman-vfio: VFIO_DEVICE_GET_INFO argsz too small\n"); + pr_err("vgsp: VFIO_DEVICE_GET_INFO argsz too small\n"); return -EINVAL; } @@ -899,11 +899,11 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, info.num_regions = VFIO_PCI_NUM_REGIONS; info.num_irqs = VFIO_PCI_NUM_IRQS; - pr_info("gsp-resman-vfio: VFIO_DEVICE_GET_INFO returning flags=0x%x num_regions=%u num_irqs=%u\n", + pr_info("vgsp: VFIO_DEVICE_GET_INFO returning flags=0x%x num_regions=%u num_irqs=%u\n", info.flags, info.num_regions, info.num_irqs); ret = copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; - pr_info("gsp-resman-vfio: VFIO_DEVICE_GET_INFO copy_to_user ret=%d\n", ret); + pr_info("vgsp: VFIO_DEVICE_GET_INFO copy_to_user ret=%d\n", ret); return ret; } @@ -1061,42 +1061,42 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, unsigned long minsz = offsetof(struct vfio_irq_set, data); int *fds = NULL; - pr_info("gsp-resman-vfio: VFIO_DEVICE_SET_IRQS\n"); + pr_info("vgsp: VFIO_DEVICE_SET_IRQS\n"); /* First copy the fixed part to get argsz */ if (copy_from_user(&irq_set_hdr, (void __user *)arg, minsz)) { - pr_err("gsp-resman-vfio: SET_IRQS copy_from_user hdr failed\n"); + pr_err("vgsp: SET_IRQS copy_from_user hdr failed\n"); return -EFAULT; } - pr_info("gsp-resman-vfio: SET_IRQS hdr: argsz=%u flags=0x%x index=%u start=%u count=%u\n", + pr_info("vgsp: SET_IRQS hdr: argsz=%u flags=0x%x index=%u start=%u count=%u\n", irq_set_hdr.argsz, irq_set_hdr.flags, irq_set_hdr.index, irq_set_hdr.start, irq_set_hdr.count); if (irq_set_hdr.argsz < minsz) { - pr_err("gsp-resman-vfio: SET_IRQS argsz too small: %u < %lu\n", irq_set_hdr.argsz, minsz); + pr_err("vgsp: SET_IRQS argsz too small: %u < %lu\n", irq_set_hdr.argsz, minsz); return -EINVAL; } /* Allocate buffer for full struct including data array */ irq_set_ptr = kmalloc(irq_set_hdr.argsz, GFP_KERNEL); if (!irq_set_ptr) { - pr_err("gsp-resman-vfio: SET_IRQS kmalloc failed\n"); + pr_err("vgsp: SET_IRQS kmalloc failed\n"); return -ENOMEM; } if (copy_from_user(irq_set_ptr, (void __user *)arg, irq_set_hdr.argsz)) { - pr_err("gsp-resman-vfio: SET_IRQS copy_from_user full failed\n"); + pr_err("vgsp: SET_IRQS copy_from_user full failed\n"); kfree(irq_set_ptr); return -EFAULT; } - pr_info("gsp-resman-vfio: SET_IRQS full: argsz=%u flags=0x%x index=%u start=%u count=%u\n", + pr_info("vgsp: SET_IRQS full: argsz=%u flags=0x%x index=%u start=%u count=%u\n", irq_set_ptr->argsz, irq_set_ptr->flags, irq_set_ptr->index, irq_set_ptr->start, irq_set_ptr->count); /* Validate data type */ if ((irq_set_ptr->flags & VFIO_IRQ_SET_DATA_TYPE_MASK) == 0 || (irq_set_ptr->flags & VFIO_IRQ_SET_ACTION_TYPE_MASK) == 0) { - pr_err("gsp-resman-vfio: SET_IRQS invalid flags\n"); + pr_err("vgsp: SET_IRQS invalid flags\n"); kfree(irq_set_ptr); return -EINVAL; } @@ -1112,7 +1112,7 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, if (irq_set_ptr->index > VFIO_PCI_REQ_IRQ_INDEX || irq_set_ptr->start + irq_set_ptr->count > NV_VGPU_MAX_IRQS) { - pr_err("gsp-resman-vfio: SET_IRQS out of range: index=%u start=%u count=%u\n", + pr_err("vgsp: SET_IRQS out of range: index=%u start=%u count=%u\n", irq_set_ptr->index, irq_set_ptr->start, irq_set_ptr->count); kfree(irq_set_ptr); return -EINVAL; @@ -1126,7 +1126,7 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, /* Copy eventfds directly from userspace (after the fixed header) */ if (copy_from_user(fds, (void __user *)arg + minsz, irq_set_ptr->count * sizeof(int))) { - pr_err("gsp-resman-vfio: SET_IRQS copy_from_user data failed\n"); + pr_err("vgsp: SET_IRQS copy_from_user data failed\n"); kfree(fds); kfree(irq_set_ptr); return -EFAULT; @@ -1144,7 +1144,7 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, trigger = eventfd_ctx_fdget(fds[i]); if (IS_ERR(trigger)) { - pr_err("gsp-resman-vfio: SET_IRQS bad eventfd %d for vector %d\n", + pr_err("vgsp: SET_IRQS bad eventfd %d for vector %d\n", fds[i], idx); continue; } @@ -1161,7 +1161,7 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, } } - pr_info("gsp-resman-vfio: SET_IRQS wired %d/%d eventfds (index=%d start=%d)\n", + pr_info("vgsp: SET_IRQS wired %d/%d eventfds (index=%d start=%d)\n", wired, irq_set_ptr->count, irq_set_ptr->index, irq_set_ptr->start); kfree(fds); @@ -1171,7 +1171,7 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, /* Handle DATA_NONE (mask/unmask) */ if (irq_set_ptr->flags & VFIO_IRQ_SET_DATA_NONE) { - pr_info("gsp-resman-vfio: SET_IRQS DATA_NONE index=%d start=%d count=%d action=%x\n", + pr_info("vgsp: SET_IRQS DATA_NONE index=%d start=%d count=%d action=%x\n", irq_set_ptr->index, irq_set_ptr->start, irq_set_ptr->count, irq_set_ptr->flags & VFIO_IRQ_SET_ACTION_TYPE_MASK); kfree(irq_set_ptr); return 0; @@ -1179,7 +1179,7 @@ static long nv_vgpu_vfio_dev_ioctl(struct vfio_device *vdev, unsigned int cmd, /* Handle DATA_BOOL */ if (irq_set_ptr->flags & VFIO_IRQ_SET_DATA_BOOL) { - pr_info("gsp-resman-vfio: SET_IRQS DATA_BOOL index=%d start=%d count=%d\n", + pr_info("vgsp: SET_IRQS DATA_BOOL index=%d start=%d count=%d\n", irq_set_ptr->index, irq_set_ptr->start, irq_set_ptr->count); kfree(irq_set_ptr); return 0; @@ -1216,7 +1216,7 @@ static int nv_vgpu_vfio_dev_mmap(struct vfio_device *vdev, struct vm_area_struct unsigned long region_base; unsigned long region_size; - pr_info("gsp-resman-vfio: VFIO device mmap offset=0x%lx size=0x%lx\n", offset, size); + pr_info("vgsp: VFIO device mmap offset=0x%lx size=0x%lx\n", offset, size); /* Config space region */ region_base = VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_CONFIG_REGION_INDEX); @@ -1253,7 +1253,7 @@ static int nv_vgpu_vfio_dev_mmap(struct vfio_device *vdev, struct vm_area_struct } /* Debug: log PRAMIN window mapping for BAR2 verify debugging */ if (shadow_off <= 0x70e000 && shadow_off + size > 0x70e000) { - pr_info("gsp-resman-vfio: BAR0 mmap covers PRAMIN[0xe000] shadow_off=0x%lx size=0x%lx\n", + pr_info("vgsp: BAR0 mmap covers PRAMIN[0xe000] shadow_off=0x%lx size=0x%lx\n", shadow_off, size); } return 0; @@ -1362,13 +1362,13 @@ static int nv_vgpu_vfio_dev_mmap(struct vfio_device *vdev, struct vm_area_struct return -EINVAL; } - pr_err("gsp-resman-vfio: mmap failed for unknown offset 0x%lx\n", offset); + pr_err("vgsp: mmap failed for unknown offset 0x%lx\n", offset); return -EINVAL; } static void nv_vgpu_vfio_dev_dma_unmap(struct vfio_device *vdev, u64 iova, u64 length) { - pr_info("gsp-resman-vfio: VFIO device dma_unmap iova=0x%llx len=0x%llx\n", iova, length); + pr_info("vgsp: VFIO device dma_unmap iova=0x%llx len=0x%llx\n", iova, length); } static int nv_vgpu_vfio_dev_match(struct vfio_device *vdev, char *buf) @@ -1393,51 +1393,51 @@ static int __init nv_vgpu_init(void) int ret; struct pci_dev *pdev = NULL; - pr_info("gsp-resman-vfio: init started\n"); + pr_info("vgsp: init started\n"); nv_vgpu_driver.class = class_create("nvidia-vgpu"); if (IS_ERR(nv_vgpu_driver.class)) { ret = PTR_ERR(nv_vgpu_driver.class); - pr_err("Failed to create nvidia-vgpu class: %d\n", ret); + pr_err("vgsp: Failed to create nvidia-vgpu class: %d\n", ret); return ret; } - pr_info("gsp-resman-vfio: class created\n"); + pr_info("vgsp: class created\n"); /* Create static vGPU types as fallback (userspace can override via ioctl) */ nv_vgpu_create_static_types(); - pr_info("gsp-resman-vfio: static types created\n"); + pr_info("vgsp: static types created\n"); /* Create mdev types from registered vGPU types */ ret = nv_vgpu_create_mdev_types(); if (ret) { - pr_err("Failed to create mdev types: %d\n", ret); + pr_err("vgsp: Failed to create mdev types: %d\n", ret); goto err_class; } - pr_info("gsp-resman-vfio: mdev types created\n"); + pr_info("vgsp: mdev types created\n"); /* Find the parent PCI device to register mdev parent */ pdev = pci_get_device(0x10de, 0x1ed3, NULL); if (!pdev) { - pr_err("Failed to find NVIDIA GPU (10de:1ed3) for mdev parent registration\n"); + pr_err("vgsp: Failed to find NVIDIA GPU (10de:1ed3) for mdev parent registration\n"); ret = -ENODEV; goto err_types; } - pr_info("gsp-resman-vfio: found GPU %s\n", pci_name(pdev)); + pr_info("vgsp: found GPU %s\n", pci_name(pdev)); /* Register mdev parent via nvidia.ko */ ret = nv_vgpu_mdev_register_parent(pdev); if (ret) { - pr_err("Failed to register mdev parent: %d\n", ret); + pr_err("vgsp: Failed to register mdev parent: %d\n", ret); goto err_put_pdev; } - pr_info("gsp-resman-vfio: mdev parent registered\n"); + pr_info("vgsp: mdev parent registered\n"); ret = mdev_register_driver(&nv_vgpu_mdev_driver); if (ret) { - pr_err("Failed to register mdev driver: %d\n", ret); + pr_err("vgsp: Failed to register mdev driver: %d\n", ret); goto err_types; } - pr_info("gsp-resman-vfio: mdev driver registered\n"); + pr_info("vgsp: mdev driver registered\n"); pci_dev_put(pdev); pdev = NULL; @@ -1445,15 +1445,15 @@ static int __init nv_vgpu_init(void) /* Provide VFIO ops to host driver (nvidia.ko) */ ret = nvidia_vgpu_vfio_set_ops(&nv_vgpu_vfio_ops); if (ret) { - pr_err("Failed to set VFIO ops: %d\n", ret); + pr_err("vgsp: Failed to set VFIO ops: %d\n", ret); goto err_driver; } - pr_info("gsp-resman-vfio: VFIO ops set\n"); + pr_info("vgsp: VFIO ops set\n"); if (gsp_phys_gpu_param && !gsp_phys_mdev_owned_enabled()) { ret = gsp_phys_gpu_claim(); if (ret) { - pr_warn("gsp-resman-vfio: physical GPU claim failed: %d\n", + pr_warn("vgsp: physical GPU claim failed: %d\n", ret); } else { /* @@ -1466,13 +1466,13 @@ static int __init nv_vgpu_init(void) */ ret = gsp_phys_backend_start(); if (ret) - pr_warn("gsp-resman-vfio: physical backend start failed: %d\n", + pr_warn("vgsp: physical backend start failed: %d\n", ret); } } else if (gsp_phys_gpu_param) { - pr_info("gsp-resman-vfio: gsp_phys_mdev_owned=1: physical GPU claim+boot deferred to the first mdev create\n"); + pr_info("vgsp: gsp_phys_mdev_owned=1: physical GPU claim+boot deferred to the first mdev create\n"); } else if (gsp_phys_mdev_owned_enabled()) { - pr_warn("gsp-resman-vfio: gsp_phys_mdev_owned=1 requires gsp_phys_gpu=1; physical backend stays off\n"); + pr_warn("vgsp: gsp_phys_mdev_owned=1 requires gsp_phys_gpu=1; physical backend stays off\n"); } /* Test-enabling trigger for the GSP-RM unload RPC plus the read-only @@ -1480,17 +1480,17 @@ static int __init nv_vgpu_init(void) * (gsp_phys_boot=1). Removed on module exit. Creation failure is * non-fatal. */ if (gsp_phys_boot_debugfs_init()) - pr_warn("gsp-resman-vfio: gsp-phys debugfs files unavailable\n"); + pr_warn("vgsp: gsp-phys debugfs files unavailable\n"); - pr_info("NVIDIA vGPU VFIO driver loaded (version %s)\n", NVIDIA_VGPU_VFIO_VERSION); + pr_info("vgsp: NVIDIA vGPU VFIO driver loaded (version %s)\n", NVIDIA_VGPU_VFIO_VERSION); /* Start the emulated-GPU progress service: it discovers the guest's * GPU-VA -> guest-PA map and applies copy-engine semaphore releases so * the guest's UVM waits complete. Idle until a VM opens a device. */ ret = gsp_sema_service_start(); if (ret) - pr_warn("gsp-resman-vfio: sema service start failed: %d\n", ret); + pr_warn("vgsp: sema service start failed: %d\n", ret); - pr_info("gsp-resman-vfio: init complete\n"); + pr_info("vgsp: init complete\n"); return 0; err_driver: @@ -1510,12 +1510,12 @@ static void __exit nv_vgpu_exit(void) struct pci_dev *pdev = NULL; bool mdev_owned = gsp_phys_mdev_owned_enabled(); - pr_info("gsp-resman-vfio: nv_vgpu_exit: starting cleanup\n"); + pr_info("vgsp: nv_vgpu_exit: starting cleanup\n"); /* Break circular dependency with nvidia.ko FIRST * by clearing the VFIO ops pointer. This signals nvidia.ko * to release its references to our module. */ - pr_info("gsp-resman-vfio: nv_vgpu_exit: clearing VFIO ops to break circular dependency\n"); + pr_info("vgsp: nv_vgpu_exit: clearing VFIO ops to break circular dependency\n"); g_vgpu_vfio_ops = NULL; gsp_phys_boot_debugfs_fini(); @@ -1563,15 +1563,15 @@ static void __exit nv_vgpu_exit(void) pdev = pci_get_device(0x10de, 0x1ed3, NULL); } - pr_info("gsp-resman-vfio: nv_vgpu_exit: stopping sema service\n"); + pr_info("vgsp: nv_vgpu_exit: stopping sema service\n"); gsp_sema_service_stop(); - pr_info("gsp-resman-vfio: nv_vgpu_exit: sema service stopped\n"); + pr_info("vgsp: nv_vgpu_exit: sema service stopped\n"); - pr_info("gsp-resman-vfio: nv_vgpu_exit: unregistering mdev driver\n"); + pr_info("vgsp: nv_vgpu_exit: unregistering mdev driver\n"); /* Unregister mdev driver FIRST, then mdev parent. This drains the * mdev remove callbacks, hence the emulation threads. */ mdev_unregister_driver(&nv_vgpu_mdev_driver); - pr_info("gsp-resman-vfio: nv_vgpu_exit: mdev driver unregistered\n"); + pr_info("vgsp: nv_vgpu_exit: mdev driver unregistered\n"); if (mdev_owned) { /* Drain complete: release the mdev-owned claim (no-op when @@ -1581,22 +1581,22 @@ static void __exit nv_vgpu_exit(void) /* Unregister mdev parent via nvidia.ko */ if (pdev) { - pr_info("gsp-resman-vfio: nv_vgpu_exit: unregistering mdev parent\n"); + pr_info("vgsp: nv_vgpu_exit: unregistering mdev parent\n"); nv_vgpu_mdev_unregister_parent(pdev); - pr_info("gsp-resman-vfio: mdev parent unregistered for %s\n", dev_name(&pdev->dev)); + pr_info("vgsp: mdev parent unregistered for %s\n", dev_name(&pdev->dev)); pci_dev_put(pdev); pdev = NULL; } - pr_info("gsp-resman-vfio: nv_vgpu_exit: destroying class\n"); + pr_info("vgsp: nv_vgpu_exit: destroying class\n"); class_destroy(nv_vgpu_driver.class); - pr_info("gsp-resman-vfio: nv_vgpu_exit: class destroyed\n"); + pr_info("vgsp: nv_vgpu_exit: class destroyed\n"); - pr_info("gsp-resman-vfio: nv_vgpu_exit: freeing type info\n"); + pr_info("vgsp: nv_vgpu_exit: freeing type info\n"); nv_vgpu_free_type_info(); - pr_info("gsp-resman-vfio: nv_vgpu_exit: type info freed\n"); + pr_info("vgsp: nv_vgpu_exit: type info freed\n"); - pr_info("NVIDIA vGPU VFIO driver unloaded\n"); + pr_info("vgsp: NVIDIA vGPU VFIO driver unloaded\n"); } static void nv_vgpu_device_init_work(struct work_struct *work) @@ -1708,20 +1708,20 @@ static void nv_vgpu_device_cleanup_work(struct work_struct *work) static NV_STATUS nv_vgpu_vfio_probe(struct pci_dev *pdev, NvU32 vgpu_type_id, NvU32 *vgpu_id) { - pr_info("gsp-resman-vfio: VFIO probe called for vGPU type %u\n", vgpu_type_id); + pr_info("vgsp: VFIO probe called for vGPU type %u\n", vgpu_type_id); return NV_OK; } static void nv_vgpu_vfio_remove(struct pci_dev *pdev) { - pr_info("gsp-resman-vfio: VFIO remove called\n"); + pr_info("vgsp: VFIO remove called\n"); /* Clear VFIO ops to break circular dependency with nvidia.ko */ g_vgpu_vfio_ops = NULL; } static NV_STATUS nv_vgpu_vfio_inject_interrupt(void *vgpu_dev) { - pr_info("gsp-resman-vfio: VFIO inject interrupt called\n"); + pr_info("vgsp: VFIO inject interrupt called\n"); return NV_OK; } @@ -2106,14 +2106,14 @@ static ssize_t nv_vgpu_config_write(struct nv_vgpu_device *vgpu, const char __us NV_STATUS nvidia_vgpu_vfio_probe(struct pci_dev *pdev) { - pr_info("gsp-resman-vfio: nvidia_vgpu_vfio_probe called for %s\n", pci_name(pdev)); + pr_info("vgsp: nvidia_vgpu_vfio_probe called for %s\n", pci_name(pdev)); return NV_OK; } EXPORT_SYMBOL(nvidia_vgpu_vfio_probe); void nvidia_vgpu_vfio_remove(struct pci_dev *pdev, NvBool remove_device) { - pr_info("gsp-resman-vfio: nvidia_vgpu_vfio_remove called for %s, remove_device=%d\n", + pr_info("vgsp: nvidia_vgpu_vfio_remove called for %s, remove_device=%d\n", pci_name(pdev), remove_device); } EXPORT_SYMBOL(nvidia_vgpu_vfio_remove); @@ -2121,7 +2121,7 @@ EXPORT_SYMBOL(nvidia_vgpu_vfio_remove); /* * Debug: scan the guest's RAM for a 64-bit value to locate guest structures * without knowing the guest's GPU page tables (see handoff PART 6). - * echo 0x121000000 > /sys/module/open_iov_vfio/parameters/scan_guest_ram + * echo 0x121000000 > /sys/module/vgsp/parameters/scan_guest_ram * Scans 0..8GB of guest physical address space, 4KB at a time. * * The scan MUST run in a kthread: vfio_iommu_type1_dma_rw only works when @@ -2181,7 +2181,7 @@ MODULE_PARM_DESC(scan_guest_ram, "Scan guest RAM for a 64-bit value (hex)"); * Debug: scan the emulated vidmem (BAR1 shadow, 256MB host buffer) for a * 32/64-bit value. Used to find guest page tables / channel structures that * the guest writes into its vidmem aperture. - * echo 0x21000000 > /sys/module/open_iov_vfio/parameters/scan_vidmem + * echo 0x21000000 > /sys/module/vgsp/parameters/scan_vidmem */ static int nv_vgpu_scan_vidmem_set(const char *val, const struct kernel_param *kp) { @@ -2210,17 +2210,17 @@ static int nv_vgpu_scan_vidmem_set(const char *val, const struct kernel_param *k memcpy(&v64, base + off, 8); memcpy(&v32, base + off, 4); if (v64 == needle) { - pr_info("gsp-resman-vfio: vidmem scan: u64 0x%llx at vidmem off 0x%zx\n", + pr_info("vgsp: vidmem scan: u64 0x%llx at vidmem off 0x%zx\n", needle, off); hits++; } if (v32 == (u32)needle) { - pr_info("gsp-resman-vfio: vidmem scan: u32 0x%x at vidmem off 0x%zx\n", + pr_info("vgsp: vidmem scan: u32 0x%x at vidmem off 0x%zx\n", (u32)needle, off); hits++; } } - pr_info("gsp-resman-vfio: vidmem scan: needle=0x%llx size=0x%zx hits=%u\n", + pr_info("vgsp: vidmem scan: needle=0x%llx size=0x%zx hits=%u\n", needle, size, hits); } mutex_unlock(&nv_vgpu_driver.lock); @@ -2313,12 +2313,12 @@ static int nv_vgpu_scan_seq_set(const char *val, const struct kernel_param *kp) } } if (ok && hits < 8) { - pr_info("gsp-resman-vfio: seq scan: hit in vidmem at off 0x%zx\n", + pr_info("vgsp: seq scan: hit in vidmem at off 0x%zx\n", off); hits++; } } - pr_info("gsp-resman-vfio: seq scan: vidmem hits=%u\n", hits); + pr_info("vgsp: seq scan: vidmem hits=%u\n", hits); } } mutex_unlock(&nv_vgpu_driver.lock); @@ -2369,7 +2369,7 @@ static int nv_vgpu_shadow_dump_set(const char *val, const struct kernel_param *k u32 i; if (!base || off + (u64)n * 4 > size) { - pr_info("gsp-resman-vfio: shadow dump: bar%u bad (base=%p size=0x%llx)\n", + pr_info("vgsp: shadow dump: bar%u bad (base=%p size=0x%llx)\n", bar, base, size); continue; } @@ -2377,7 +2377,7 @@ static int nv_vgpu_shadow_dump_set(const char *val, const struct kernel_param *k u32 v; memcpy(&v, base + off + i * 4, 4); - pr_info("gsp-resman-vfio: shadow bar%u[0x%llx+%u] = 0x%08x\n", + pr_info("vgsp: shadow bar%u[0x%llx+%u] = 0x%08x\n", bar, off, i, v); } } @@ -2436,13 +2436,13 @@ static int nv_vgpu_shadow_scan_set(const char *val, const struct kernel_param *k } } if (ok && hits < 8) { - pr_info("gsp-resman-vfio: shadow scan: bar%u hit at 0x%llx\n", + pr_info("vgsp: shadow scan: bar%u hit at 0x%llx\n", b, off); hits++; } } if (hits) - pr_info("gsp-resman-vfio: shadow scan: bar%u hits=%u\n", + pr_info("vgsp: shadow scan: bar%u hits=%u\n", b, hits); } } @@ -2837,19 +2837,19 @@ static int nv_vgpu_scan_pt_set(const char *val, const struct kernel_param *kp) memcpy(&v64, base + off, 8); memcpy(&v32, base + off, 4); if ((v64 & 0xfffffffffffff000ULL) == pa_page) { - pr_info("gsp-resman-vfio: pt scan: vidmem u64 pte 0x%llx at off 0x%zx\n", + pr_info("vgsp: pt scan: vidmem u64 pte 0x%llx at off 0x%zx\n", v64, off); if (++hits >= 16) break; } if ((v32 & 0xfffff000U) == (u32)pa_page) { - pr_info("gsp-resman-vfio: pt scan: vidmem u32 pte 0x%x at off 0x%zx\n", + pr_info("vgsp: pt scan: vidmem u32 pte 0x%x at off 0x%zx\n", v32, off); if (++hits >= 16) break; } } - pr_info("gsp-resman-vfio: pt scan: vidmem pa=0x%llx hits=%u\n", + pr_info("vgsp: pt scan: vidmem pa=0x%llx hits=%u\n", pa, hits); } } @@ -2947,7 +2947,7 @@ static int nv_vgpu_fill_vidmem_set(const char *val, const struct kernel_param *k continue; for (o = 0; o + 4 <= size; o += 4) memcpy(base + o, &value, 4); - pr_info("gsp-resman-vfio: fill_vidmem value=0x%x size=0x%zx done\n", + pr_info("vgsp: fill_vidmem value=0x%x size=0x%zx done\n", value, size); } mutex_unlock(&nv_vgpu_driver.lock); @@ -2986,7 +2986,7 @@ static int nv_vgpu_poke_thread(void *arg) } req->rc = vfio_dma_rw(&vgpu->vfio_dev, req->gpa, &req->value, sizeof(req->value), true); - pr_info("gsp-resman-vfio: poke gpa=0x%llx value=0x%x rc=%d\n", + pr_info("vgsp: poke gpa=0x%llx value=0x%x rc=%d\n", req->gpa, req->value, req->rc); } mutex_unlock(&nv_vgpu_driver.lock); @@ -3048,7 +3048,7 @@ static int nv_vgpu_poke_fill_thread(void *arg) req->rc = vfio_dma_rw(&vgpu->vfio_dev, req->gpa, nv_vgpu_fill_buf, nv_vgpu_fill_count * sizeof(u32), true); - pr_info("gsp-resman-vfio: poke_fill gpa=0x%llx count=%u rc=%d\n", + pr_info("vgsp: poke_fill gpa=0x%llx count=%u rc=%d\n", req->gpa, nv_vgpu_fill_count, req->rc); } mutex_unlock(&nv_vgpu_driver.lock); @@ -3138,12 +3138,12 @@ static int nv_vgpu_dump_vidmem_set(const char *val, const struct kernel_param *k memcpy(&v, base + o, 4); if (v) { if (nz < 32) - pr_info("gsp-resman-vfio: vidmem nz[0x%zx]=0x%x\n", + pr_info("vgsp: vidmem nz[0x%zx]=0x%x\n", o, v); nz++; } } - pr_info("gsp-resman-vfio: vidmem summary: size=0x%zx nonzero_dwords=%u\n", + pr_info("vgsp: vidmem summary: size=0x%zx nonzero_dwords=%u\n", size, nz); } mutex_unlock(&nv_vgpu_driver.lock); @@ -3173,7 +3173,7 @@ static int nv_vgpu_dump_vidmem_set(const char *val, const struct kernel_param *k for (o = 0; o < len; o += 64) { u32 n = min_t(unsigned long, len - o, 64); - pr_info("gsp-resman-vfio: vidmem[0x%lx..0x%lx]=%*phN\n", + pr_info("vgsp: vidmem[0x%lx..0x%lx]=%*phN\n", off + o, off + o + n, (int)n, base + off + o); } } @@ -3231,7 +3231,7 @@ static int nv_vgpu_dump_bar0_set(const char *val, const struct kernel_param *kp) for (o = 0; o < len; o += 64) { u32 n = min_t(unsigned long, len - o, 64); - pr_info("gsp-resman-vfio: bar0[0x%lx..0x%lx]=%*phN\n", + pr_info("vgsp: bar0[0x%lx..0x%lx]=%*phN\n", off + o, off + o + n, (int)n, base + off + o); } } @@ -3271,12 +3271,12 @@ static int nv_vgpu_scan_bar0_set(const char *val, const struct kernel_param *kp) memcpy(&v, base + o, 4); if (v == (u32)needle) { - pr_info("gsp-resman-vfio: bar0 scan: 0x%x at off 0x%zx\n", + pr_info("vgsp: bar0 scan: 0x%x at off 0x%zx\n", v, o); hits++; } } - pr_info("gsp-resman-vfio: bar0 scan: needle=0x%lx hits=%u\n", + pr_info("vgsp: bar0 scan: needle=0x%lx hits=%u\n", needle, hits); } mutex_unlock(&nv_vgpu_driver.lock); @@ -3321,11 +3321,11 @@ static int nv_vgpu_find_userd_set(const char *val, const struct kernel_param *kp if (get > put) continue; if (shown < 32) - pr_info("gsp-resman-vfio: userd cand off=0x%zx get=%u put=%u\n", + pr_info("vgsp: userd cand off=0x%zx get=%u put=%u\n", off, get, put); shown++; } - pr_info("gsp-resman-vfio: userd scan: candidates=%d\n", shown); + pr_info("vgsp: userd scan: candidates=%d\n", shown); } mutex_unlock(&nv_vgpu_driver.lock); return 0; @@ -3361,7 +3361,7 @@ static int nv_vgpu_poke_vidmem_set(const char *val, const struct kernel_param *k break; } memcpy(vgpu->bars[1].vaddr + off, &value, 4); - pr_info("poke_vidmem: [0x%llx] = 0x%llx\n", off, value); + pr_info("vgsp-poke-vidmem: [0x%llx] = 0x%llx\n", off, value); break; } mutex_unlock(&nv_vgpu_driver.lock); @@ -3403,7 +3403,7 @@ static int nv_vgpu_dump_guest_thread(void *arg) if (atomic_read(&vgpu->vfio_dev_open_count) <= 0) continue; - pr_info("gsp-resman-vfio: guest dump 0x%llx..0x%llx\n", + pr_info("vgsp: guest dump 0x%llx..0x%llx\n", req->gpa, req->gpa + req->len); for (o = 0; o < req->len; o += 256) { unsigned long chunk = min_t(unsigned long, 256, @@ -3411,12 +3411,12 @@ static int nv_vgpu_dump_guest_thread(void *arg) if (vfio_dma_rw(&vgpu->vfio_dev, req->gpa + o, buf, chunk, false)) { - pr_info("gsp-resman-vfio: guest dump read failed at 0x%llx\n", + pr_info("vgsp: guest dump read failed at 0x%llx\n", req->gpa + o); break; } for (i = 0; i < chunk / 4; i += 4) - pr_info("gsp-resman-vfio: 0x%llx: %08x %08x %08x %08x\n", + pr_info("vgsp: 0x%llx: %08x %08x %08x %08x\n", req->gpa + o + i * 4, buf[i], buf[i + 1], buf[i + 2], buf[i + 3]); } @@ -3501,7 +3501,7 @@ static int nv_vgpu_inject_irq_set(const char *val, const struct kernel_param *kp trigger = vgpu->irqs[idx].trigger; if (trigger) eventfd_signal(trigger); - pr_info("gsp-resman-vfio: inject_irq %lu (trigger %s)\n", + pr_info("vgsp: inject_irq %lu (trigger %s)\n", idx, trigger ? "fired" : "missing"); ret = 0; } @@ -3581,7 +3581,7 @@ static int nv_vgpu_rmpost_thread(void *arg) if (atomic_read(&vgpu->vfio_dev_open_count) <= 0) continue; req->rc = gsp_rm_force_post(vgpu, req->idx); - pr_info("gsp-resman-vfio: rmpost idx=%u -> %d\n", + pr_info("vgsp: rmpost idx=%u -> %d\n", req->idx, req->rc); } mutex_unlock(&nv_vgpu_driver.lock); diff --git a/kernel/tests/Makefile b/kernel/tests/Makefile index 56c819a..f681086 100644 --- a/kernel/tests/Makefile +++ b/kernel/tests/Makefile @@ -2,7 +2,7 @@ obj-m += gsp_emulation_test.o ccflags-y := -I$(PWD)/../ -I$(PWD)/../include -# Resolve open-iov-vfio.ko exports (gsp_emu_process_rpc, +# Resolve vgsp.ko exports (gsp_emu_process_rpc, # gsp_client_init_emulation, gsp_rpc_emulation_set, ...). # Requires 'make kernel' (or 'make -C kernel') to have run first. KBUILD_EXTRA_SYMBOLS := $(abspath $(PWD)/../Module.symvers) @@ -16,7 +16,7 @@ all: clean: $(MAKE) -C $(KDIR) M=$(PWD) clean -# Requires open-iov-vfio.ko loaded first (symbol dependency) +# Requires vgsp.ko loaded first (symbol dependency) install: sudo insmod gsp_emulation_test.ko diff --git a/kernel/tests/gsp_emulation_test.c b/kernel/tests/gsp_emulation_test.c index d63fcdb..973d26f 100644 --- a/kernel/tests/gsp_emulation_test.c +++ b/kernel/tests/gsp_emulation_test.c @@ -15,9 +15,11 @@ * Those paths are exercised by the live QEMU guest integration test * (scripts/test_vgpu_stack.sh). * - * Requires open-iov-vfio.ko loaded first (links against its exports). + * Requires vgsp.ko loaded first (links against its exports). */ +#define pr_fmt(fmt) "" fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -29,7 +31,7 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Open-IOV"); MODULE_DESCRIPTION("GSP Emulation Unit Tests"); -MODULE_SOFTDEP("pre: open_iov_vfio"); +MODULE_SOFTDEP("pre: vgsp"); #define SHMEM_SIZE 4096 #define RSP_OFFSET 0x80 @@ -44,7 +46,7 @@ static int test_failures; #define T_CHECK(cond, name, ...) do { \ if (!(cond)) { \ - pr_err("GSP_EMU_TEST: FAIL %s: " #name ": " __VA_ARGS__); \ + pr_err("FAIL %s: " #name ": " __VA_ARGS__); \ test_failures++; \ return -1; \ } \ @@ -72,7 +74,7 @@ static int run_rpc(u32 type, u32 subcmd, const void *payload, size_t plen, memcpy(rsp, r, sizeof(*rsp)); if (rsp->seq_id != msg->seq_id) { - pr_err("GSP_EMU_TEST: response seq mismatch (got %u, want %u)\n", + pr_err("response seq mismatch (got %u, want %u)\n", rsp->seq_id, msg->seq_id); return -EBADMSG; } @@ -85,7 +87,7 @@ static int test_seq_id_zero(void) struct gsp_rpc_msg *msg = test_shmem; int ret; - pr_info("GSP_EMU_TEST: Testing seq_id=0 rejection...\n"); + pr_info("Testing seq_id=0 rejection...\n"); memset(test_shmem, 0, SHMEM_SIZE); msg->type = GSP_RPC_YIELD; @@ -94,7 +96,7 @@ static int test_seq_id_zero(void) ret = gsp_emu_process_rpc(test_ctx); T_CHECK(ret == -EINVAL, seq_zero, "expected -EINVAL, got %d\n", ret); - pr_info("GSP_EMU_TEST: seq_id=0 correctly rejected\n"); + pr_info("seq_id=0 correctly rejected\n"); return 0; } @@ -104,7 +106,7 @@ static int test_uninitialized_ctx(void) struct gsp_emu_context *bad; int ret; - pr_info("GSP_EMU_TEST: Testing uninitialized ctx rejection...\n"); + pr_info("Testing uninitialized ctx rejection...\n"); bad = kzalloc(sizeof(*bad), GFP_KERNEL); T_CHECK(bad != NULL, alloc, "out of memory\n"); @@ -114,7 +116,7 @@ static int test_uninitialized_ctx(void) kfree(bad); T_CHECK(ret == -ENODEV, uninit, "expected -ENODEV, got %d\n", ret); - pr_info("GSP_EMU_TEST: uninitialized ctx correctly rejected\n"); + pr_info("uninitialized ctx correctly rejected\n"); return 0; } @@ -124,7 +126,7 @@ static int test_unknown_type(void) struct gsp_rpc_response rsp; int ret; - pr_info("GSP_EMU_TEST: Testing unknown type rejection...\n"); + pr_info("Testing unknown type rejection...\n"); ret = run_rpc(UNKNOWN_TYPE, 0, NULL, 0, &rsp); T_CHECK(ret == -ENOTSUPP, unkret, "expected -ENOTSUPP, got %d\n", ret); @@ -133,7 +135,7 @@ static int test_unknown_type(void) T_CHECK(rsp.type == UNKNOWN_TYPE, unktype, "expected type echo 0x%x, got 0x%x\n", UNKNOWN_TYPE, rsp.type); - pr_info("GSP_EMU_TEST: unknown type correctly rejected\n"); + pr_info("unknown type correctly rejected\n"); return 0; } @@ -143,7 +145,7 @@ static int test_schedule(void) struct gsp_rpc_response rsp; int ret; - pr_info("GSP_EMU_TEST: Testing SCHEDULE...\n"); + pr_info("Testing SCHEDULE...\n"); sreq.work_handle = 0x1234; sreq.callback = 0; /* emulation worker never invokes callback */ @@ -158,7 +160,7 @@ static int test_schedule(void) T_CHECK(rsp.type == GSP_RPC_SCHEDULE, schedtype, "type echo 0x%x\n", rsp.type); - pr_info("GSP_EMU_TEST: SCHEDULE succeeded\n"); + pr_info("SCHEDULE succeeded\n"); return 0; } @@ -167,14 +169,14 @@ static int test_yield(void) struct gsp_rpc_response rsp; int ret; - pr_info("GSP_EMU_TEST: Testing YIELD...\n"); + pr_info("Testing YIELD...\n"); ret = run_rpc(GSP_RPC_YIELD, 0, NULL, 0, &rsp); T_CHECK(ret == 0, yieldret, "dispatch returned %d\n", ret); T_CHECK((s32)rsp.status == 0, yieldstatus, "status %d\n", (s32)rsp.status); - pr_info("GSP_EMU_TEST: YIELD succeeded\n"); + pr_info("YIELD succeeded\n"); return 0; } @@ -183,7 +185,7 @@ static int test_notify(void) struct gsp_rpc_response rsp; int ret; - pr_info("GSP_EMU_TEST: Testing NOTIFY...\n"); + pr_info("Testing NOTIFY...\n"); /* subcmd carries the event type; dispatch is log-only, must succeed * even with a NULL vgpu (exercises NULL-safe logging macros). */ @@ -192,7 +194,7 @@ static int test_notify(void) T_CHECK((s32)rsp.status == 0, notifystatus, "status %d\n", (s32)rsp.status); - pr_info("GSP_EMU_TEST: NOTIFY succeeded\n"); + pr_info("NOTIFY succeeded\n"); return 0; } @@ -201,14 +203,14 @@ static int test_debug(void) struct gsp_rpc_response rsp; int ret; - pr_info("GSP_EMU_TEST: Testing DEBUG...\n"); + pr_info("Testing DEBUG...\n"); ret = run_rpc(GSP_RPC_DEBUG, 0, NULL, 0, &rsp); T_CHECK(ret == 0, dbgret, "dispatch returned %d\n", ret); T_CHECK((s32)rsp.status == 0, dbgstatus, "status %d\n", (s32)rsp.status); - pr_info("GSP_EMU_TEST: DEBUG succeeded\n"); + pr_info("DEBUG succeeded\n"); return 0; } @@ -219,7 +221,7 @@ static int test_dispatch_stress(void) struct gsp_rpc_response rsp; int i, ret; - pr_info("GSP_EMU_TEST: Testing dispatch stress (100 iterations)...\n"); + pr_info("Testing dispatch stress (100 iterations)...\n"); sreq.work_handle = 0xBEEF; sreq.priority = 5; @@ -235,7 +237,7 @@ static int test_dispatch_stress(void) "iteration %d status %d\n", i, (s32)rsp.status); } - pr_info("GSP_EMU_TEST: dispatch stress passed (100/100)\n"); + pr_info("dispatch stress passed (100/100)\n"); return 0; } @@ -274,7 +276,7 @@ static int init_test_context(void) test_ctx->initialized = true; /* msix_trigger[] zeroed by kzalloc; eventfd_signal is guarded */ - pr_info("GSP_EMU_TEST: Test context initialized\n"); + pr_info("Test context initialized\n"); return 0; err_client: @@ -303,7 +305,7 @@ static void cleanup_test_context(void) test_shmem = NULL; } gsp_rpc_emulation_set(false); - pr_info("GSP_EMU_TEST: Test context cleaned up\n"); + pr_info("Test context cleaned up\n"); } static int run_all_tests(void) @@ -311,7 +313,7 @@ static int run_all_tests(void) test_failures = 0; if (init_test_context()) { - pr_err("GSP_EMU_TEST: Failed to initialize test context\n"); + pr_err("Failed to initialize test context\n"); return -1; } @@ -327,23 +329,23 @@ static int run_all_tests(void) cleanup_test_context(); if (test_failures == 0) { - pr_info("GSP_EMU_TEST: ALL TESTS PASSED\n"); + pr_info("ALL TESTS PASSED\n"); return 0; } - pr_err("GSP_EMU_TEST: %d TEST(S) FAILED\n", test_failures); + pr_err("%d TEST(S) FAILED\n", test_failures); return -1; } static int __init gsp_emulation_test_init(void) { - pr_info("GSP_EMU_TEST: Starting GSP emulation unit tests...\n"); + pr_info("Starting GSP emulation unit tests...\n"); return run_all_tests(); } static void __exit gsp_emulation_test_exit(void) { - pr_info("GSP_EMU_TEST: Module unloaded\n"); + pr_info("Module unloaded\n"); } module_init(gsp_emulation_test_init); diff --git a/kernel/tests/gsp_rpc_test.c b/kernel/tests/gsp_rpc_test.c index f609066..f78526e 100644 --- a/kernel/tests/gsp_rpc_test.c +++ b/kernel/tests/gsp_rpc_test.c @@ -3,6 +3,8 @@ * Tests message encoding/decoding, RPC structure validation */ +#define pr_fmt(fmt) "vgsp-rpc-test: " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> diff --git a/sbom/open-iov-0.1.0.cdx.json b/sbom/open-iov-0.1.0.cdx.json index 1db09d3..f13d37d 100644 --- a/sbom/open-iov-0.1.0.cdx.json +++ b/sbom/open-iov-0.1.0.cdx.json @@ -47,13 +47,13 @@ "components": [ { "type": "application", - "bom-ref": "pkg:generic/open-iov-vfio@0.1.0", - "name": "open-iov-vfio", + "bom-ref": "pkg:generic/vgsp@0.1.0", + "name": "vgsp", "version": "0.1.0", "description": "Host VFIO mdev kernel module: virtual GPU device, GSP/GSP-RM emulation, semaphore service, memory model, physical-GPU backend.", "supplier": { "name": "The Open-IOV Project" }, "licenses": [ { "license": { "id": "GPL-2.0-only" } } ], - "purl": "pkg:generic/open-iov-vfio@0.1.0", + "purl": "pkg:generic/vgsp@0.1.0", "properties": [ { "name": "open-iov:path", "value": "kernel/**" } ] }, { @@ -532,7 +532,7 @@ { "ref": "pkg:generic/open-iov@0.1.0", "dependsOn": [ - "pkg:generic/open-iov-vfio@0.1.0", + "pkg:generic/vgsp@0.1.0", "pkg:generic/libiov@0.1.0", "pkg:generic/open-iov-example@0.1.0", "pkg:generic/open-iov-userspace-tests@0.1.0", @@ -558,7 +558,7 @@ ] }, { - "ref": "pkg:generic/open-iov-vfio@0.1.0", + "ref": "pkg:generic/vgsp@0.1.0", "dependsOn": [ "dep:linux-kernel", "dep:vfio-mdev", diff --git a/scripts/browse-project.py b/scripts/browse-project.py index b757d50..72ee46c 100755 --- a/scripts/browse-project.py +++ b/scripts/browse-project.py @@ -1323,7 +1323,7 @@ COMPONENTS = { children=[], ), "module": dict( - title="open-iov-vfio.ko", + title="vgsp.ko", status="[wip]", desc="The only host component. Virtual device + emulation core + memory " "model + work path + (planned) execution backend.", diff --git a/scripts/build_nvidia_openrm.sh b/scripts/build_nvidia_openrm.sh index 89e058b..6772d64 100755 --- a/scripts/build_nvidia_openrm.sh +++ b/scripts/build_nvidia_openrm.sh @@ -14,10 +14,10 @@ echo "Open-IOV root: $OPEN_IOV_ROOT" echo "NVIDIA OpenRM dir: $NVIDIA_OPENRM_DIR" echo "Kernel Module.symvers: $SYMVERS_FILE" -# Check if open-iov-vfio.ko has been built (provides Module.symvers) +# Check if vgsp.ko has been built (provides Module.symvers) if [ ! -f "$SYMVERS_FILE" ]; then echo "ERROR: $SYMVERS_FILE not found!" - echo "Please build open-iov-vfio.ko first: cd $OPEN_IOV_ROOT && make kernel" + echo "Please build vgsp.ko first: cd $OPEN_IOV_ROOT && make kernel" exit 1 fi @@ -55,7 +55,7 @@ echo "nvidia.ko location: $NVIDIA_OPENRM_DIR/kernel-open/nvidia.ko" echo "" echo "To load the stack:" echo " sudo insmod $NVIDIA_OPENRM_DIR/kernel-open/nvidia.ko" -echo " sudo insmod $KERNEL_DIR/open-iov-vfio.ko" +echo " sudo insmod $KERNEL_DIR/vgsp.ko" echo " sudo cp $OPEN_IOV_ROOT/firmware/57X-GSP/570.144/gsp-570.144.fwimage.bin /lib/firmware/" echo " ./scripts/create_mdev.sh" echo " ./scripts/launch_qemu_vgpu.sh"
\ No newline at end of file diff --git a/scripts/load_vgpu_stack.sh b/scripts/load_vgpu_stack.sh index fcabb06..bce2ec2 100755 --- a/scripts/load_vgpu_stack.sh +++ b/scripts/load_vgpu_stack.sh @@ -8,7 +8,7 @@ FIRMWARE_NAME="${1:-gsp-570.144.fwimage.bin}" BASE_DIR="${OPEN_IOV_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" NVIDIA_KO="$BASE_DIR/nvidia-open-gpu-kernel-modules/kernel-open/nvidia.ko" -VFIO_KO="$BASE_DIR/kernel/open-iov-vfio.ko" +VFIO_KO="$BASE_DIR/kernel/vgsp.ko" FIRMWARE_PATH="$BASE_DIR/firmware/57X-GSP/570.144/$FIRMWARE_NAME" echo "==========================================" @@ -25,11 +25,11 @@ for f in "$NVIDIA_KO" "$VFIO_KO" "$FIRMWARE_PATH"; do fi done -# Load open-iov-vfio.ko FIRST (provides symbols nvidia.ko needs) -if lsmod | grep -q "^open_iov_vfio "; then - echo "open-iov-vfio.ko already loaded" +# Load vgsp.ko FIRST (provides symbols nvidia.ko needs) +if lsmod | grep -q "^vgsp "; then + echo "vgsp.ko already loaded" else - echo "Loading open-iov-vfio.ko..." + echo "Loading vgsp.ko..." sudo insmod "$VFIO_KO" echo " OK" fi diff --git a/scripts/stack_manager.sh b/scripts/stack_manager.sh index 5598817..294a0ee 100755 --- a/scripts/stack_manager.sh +++ b/scripts/stack_manager.sh @@ -6,7 +6,7 @@ set -euo pipefail BASE_DIR="${OPEN_IOV_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" NVIDIA_KO="$BASE_DIR/nvidia-open-gpu-kernel-modules/kernel-open/nvidia.ko" -VFIO_KO="$BASE_DIR/kernel/open-iov-vfio.ko" +VFIO_KO="$BASE_DIR/kernel/vgsp.ko" FIRMWARE_PATH="$BASE_DIR/firmware/57X-GSP/570.144/gsp-570.144.fwimage.bin" FIRMWARE_DEST="/lib/firmware/gsp-570.144.fwimage.bin" @@ -32,10 +32,10 @@ log_err() { echo -e "${color_red}[ERROR]${color_nc} $*"; } # ============================================================ cmd_build_kernel() { - log_info "Building open-iov-vfio.ko (kernel module)..." + log_info "Building vgsp.ko (kernel module)..." cd "$BASE_DIR" make kernel - log_ok "open-iov-vfio.ko built" + log_ok "vgsp.ko built" } cmd_build_nvidia() { @@ -101,12 +101,12 @@ cmd_load_open_iov() { log_err "Missing $VFIO_KO - run 'build' first" return 1 fi - if ! lsmod | grep -q "^open_iov_vfio "; then - log_info "Loading open-iov-vfio.ko..." - sudo insmod "$VFIO_KO" || { log_err "Failed to load open-iov-vfio.ko"; return 1; } - log_ok "open-iov-vfio.ko loaded" + if ! lsmod | grep -q "^vgsp "; then + log_info "Loading vgsp.ko..." + sudo insmod "$VFIO_KO" || { log_err "Failed to load vgsp.ko"; return 1; } + log_ok "vgsp.ko loaded" else - log_ok "open-iov-vfio.ko already loaded" + log_ok "vgsp.ko already loaded" fi } @@ -117,9 +117,9 @@ cmd_load_nvidia() { fi if lsmod | grep -q "^nvidia "; then # A module named 'nvidia' is already loaded. For QEMU/vGPU with - # open-iov-vfio.ko (emulated VFIO device), we do NOT need our + # vgsp.ko (emulated VFIO device), we do NOT need our # submodule nvidia.ko on the host - the apt nvidia driver manages - # the physical GPU and open-iov-vfio handles the emulated vGPU. + # the physical GPU and vgsp handles the emulated vGPU. # Loading our submodule would conflict with the apt driver and # potentially crash the GSP (WPR2 stuck). Skip it. local loaded_ver @@ -153,7 +153,7 @@ cmd_load_stack() { cmd_install_firmware # NOTE: NVIDIA submodule NOT loaded for QEMU/vGPU work. # apt nvidia (570.211.01) manages the physical GPU; - # open-iov-vfio handles the emulated vGPU. + # vgsp handles the emulated vGPU. log_ok "=== DRIVER STACK LOADED ===" lsmod | grep -E "nvidia|open_iov|vfio|mdev" } @@ -205,10 +205,10 @@ cmd_unload_stack() { fi fi - if lsmod | grep -qE "^open_iov_vfio\>"; then - log_info "Unloading open-iov-vfio.ko..." - sudo rmmod open_iov_vfio || { log_err "Failed to unload open-iov-vfio.ko"; return 1; } - log_ok "open-iov-vfio.ko unloaded" + if lsmod | grep -qE "^vgsp\>"; then + log_info "Unloading vgsp.ko..." + sudo rmmod vgsp || { log_err "Failed to unload vgsp.ko"; return 1; } + log_ok "vgsp.ko unloaded" fi sudo modprobe -r vfio_mdev vfio_pci vfio_iommu_type1 vfio mdev 2>/dev/null || true @@ -329,14 +329,14 @@ USAGE: ./stack_manager.sh <command> [options] BUILD COMMANDS (run in order): - build-kernel Build open-iov-vfio.ko (generates Module.symvers) + build-kernel Build vgsp.ko (generates Module.symvers) build-nvidia Build NVIDIA OpenRM with KBUILD_EXTRA_SYMBOLS build-userspace Build libiov.so + examples build-all Run all three build steps in correct order LOAD COMMANDS (run in order): load-prereqs Load vfio, vfio_iommu_type1, vfio_pci, mdev, vfio_mdev - load-open-iov Load open-iov-vfio.ko + load-open-iov Load vgsp.ko load-nvidia Load nvidia.ko (OpenRM) install-firmware Copy GSP firmware to /lib/firmware/ load-stack Run all four load steps in correct order @@ -386,10 +386,10 @@ EXAMPLES: NOTE: - Requires root for module operations - - BUILD ORDER: open-iov-vfio.ko FIRST (generates Module.symvers), + - BUILD ORDER: vgsp.ko FIRST (generates Module.symvers), THEN nvidia.ko with KBUILD_EXTRA_SYMBOLS - - LOAD ORDER: vfio/mdev prerequisites -> open-iov-vfio.ko -> nvidia.ko - - UNLOAD ORDER: remove mdevs -> open-iov-vfio.ko -> nvidia.ko + - LOAD ORDER: vfio/mdev prerequisites -> vgsp.ko -> nvidia.ko + - UNLOAD ORDER: remove mdevs -> vgsp.ko -> nvidia.ko - NEVER REBOOT without explicit approval EOF } diff --git a/scripts/test_gsp_emu.sh b/scripts/test_gsp_emu.sh index 1f6bc6f..0f80c30 100755 --- a/scripts/test_gsp_emu.sh +++ b/scripts/test_gsp_emu.sh @@ -41,10 +41,10 @@ echo "=== Test Results ===" dmesg -T | grep -i "gsp_emu_test" | tail -30 # Check if tests passed -if dmesg -T | grep -q "GSP_EMU_TEST: ALL TESTS PASSED"; then +if dmesg -T | grep -q "vgsp-emu-test: ALL TESTS PASSED"; then echo "✓ ALL TESTS PASSED" RESULT=0 -elif dmesg -T | grep -q "GSP_EMU_TEST:.*TEST.S. FAILED"; then +elif dmesg -T | grep -q "vgsp-emu-test:.*TEST.S. FAILED"; then echo "✗ SOME TESTS FAILED" RESULT=1 else diff --git a/scripts/unload_vgpu_stack.sh b/scripts/unload_vgpu_stack.sh index e02474a..1cb484a 100755 --- a/scripts/unload_vgpu_stack.sh +++ b/scripts/unload_vgpu_stack.sh @@ -20,7 +20,7 @@ for mdev in /sys/bus/mdev/devices/*/; do done # Unload modules in reverse order -for mod in gsp_vgpu open_iov_vfio nvidia; do +for mod in gsp_vgpu vgsp nvidia; do if lsmod | grep -q "^$mod "; then echo "Unloading $mod.ko..." sudo rmmod "$mod" 2>/dev/null || echo " WARNING: $mod still in use" diff --git a/tools/failure_analyzer.py b/tools/failure_analyzer.py index 7ffb776..11351da 100644 --- a/tools/failure_analyzer.py +++ b/tools/failure_analyzer.py @@ -126,7 +126,7 @@ class FailureAnalyzer: def _load_recommendations(self) -> Dict: return { "PCI_PROBE_FAILURE": [ - "Check PCI config space emulation in open-iov-vfio.ko (main.c)", + "Check PCI config space emulation in vgsp.ko (main.c)", "Verify BAR sizes match physical GPU (16MB/256MB/32MB/32MB)", "Check MSI-X capability pointer (0x70) and table/PBA offsets", "Ensure mdev parent registered with NVIDIA host driver", @@ -157,7 +157,7 @@ class FailureAnalyzer: "Check for IOMMU faults in dmesg", ], "VGPU_VFIO_FAILURE": [ - "Verify nvidia.ko loaded before open-iov-vfio.ko", + "Verify nvidia.ko loaded before vgsp.ko", "Check KBUILD_EXTRA_SYMBOLS points to nvidia.ko Module.symvers", "Verify nvidia_vgpu_vfio_get_ops exported by nvidia.ko", "Check mdev parent registration callback", diff --git a/tools/guest-diag/README.md b/tools/guest-diag/README.md index ea5ac14..7686ecd 100644 --- a/tools/guest-diag/README.md +++ b/tools/guest-diag/README.md @@ -31,7 +31,7 @@ syscall instruction). Kept only as documentation of that fact. ## vmcycle.sh - reload cycle -pkill QEMU -> remove mdevs -> rmmod/insmod open-iov-vfio.ko -> create a fresh +pkill QEMU -> remove mdevs -> rmmod/insmod vgsp.ko -> create a fresh `nvidia-nvidia-vgpu-turing` mdev -> patch its UUID into launch_qemu_rootport.sh -> relaunch. Guest boots in ~60-75 s. diff --git a/tools/guest-diag/bridge_sems.sh b/tools/guest-diag/bridge_sems.sh index f54801d..a024524 100755 --- a/tools/guest-diag/bridge_sems.sh +++ b/tools/guest-diag/bridge_sems.sh @@ -33,7 +33,7 @@ for i in $(seq 1 "$ITER"); do for l in "${lines[@]}"; do va=${l%%,*} pa=${l##*,} - echo "$va,$pa,0x1000,1" | sudo tee /sys/module/open_iov_vfio/parameters/sema_map_add >/dev/null + echo "$va,$pa,0x1000,1" | sudo tee /sys/module/vgsp/parameters/sema_map_add >/dev/null done total=$((total + ${#lines[@]})) last_va=${lines[-1]%%,*} diff --git a/tools/guest-diag/cycle_cdt.sh b/tools/guest-diag/cycle_cdt.sh index 009bdfc..3aaa723 100755 --- a/tools/guest-diag/cycle_cdt.sh +++ b/tools/guest-diag/cycle_cdt.sh @@ -39,7 +39,7 @@ for i in $(seq 1 24); do done # if UVM's tracking semaphore lags, poke it forward -SEMAPA=$(sudo sh -c 'echo 0x121000010,1 > /sys/module/open_iov_vfio/parameters/sema_probe' 2>/dev/null; sleep 2; sudo dmesg -T | grep -A2 "sema-probe: va=0x121000010" | grep -oE "pa=0x[0-9a-f]+" | head -1 | cut -d= -f2) +SEMAPA=$(sudo sh -c 'echo 0x121000010,1 > /sys/module/vgsp/parameters/sema_probe' 2>/dev/null; sleep 2; sudo dmesg -T | grep -A2 "sema-probe: va=0x121000010" | grep -oE "pa=0x[0-9a-f]+" | head -1 | cut -d= -f2) if [ -n "$SEMAPA" ]; then CUR=$(sudo dmesg -T | grep -A3 "sema-probe: va=0x121000010" | grep -oE "\[0\] 0x[0-9a-f]+" | tail -1 | awk '{print $2}') echo "[*] UVM tracking sema pa=$SEMAPA value=$CUR" diff --git a/tools/guest-diag/inject_counters.sh b/tools/guest-diag/inject_counters.sh index 6586a95..5ee60fd 100755 --- a/tools/guest-diag/inject_counters.sh +++ b/tools/guest-diag/inject_counters.sh @@ -30,7 +30,7 @@ set -uo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" VMEXEC="$HERE/../../scripts/vgpu_vm.py" -PARAM=/sys/module/open_iov_vfio/parameters +PARAM=/sys/module/vgsp/parameters DONE=/tmp/inject_counters.done PID="${1:-}" diff --git a/tools/guest-diag/inject_maps.sh b/tools/guest-diag/inject_maps.sh index 2973311..6dcabb5 100755 --- a/tools/guest-diag/inject_maps.sh +++ b/tools/guest-diag/inject_maps.sh @@ -12,7 +12,7 @@ LOG=/tmp/inject_maps.log : > "$LOG" map_add() { # map_add <va-hex> <pa-hex> - echo "0x$1,0x$2" | sudo tee /sys/module/open_iov_vfio/parameters/sema_map_add >/dev/null 2>&1 + echo "0x$1,0x$2" | sudo tee /sys/module/vgsp/parameters/sema_map_add >/dev/null 2>&1 } inject_list() { # inject_list <va...> diff --git a/tools/guest-diag/inject_tracker.sh b/tools/guest-diag/inject_tracker.sh index a563b0d..0a292e4 100755 --- a/tools/guest-diag/inject_tracker.sh +++ b/tools/guest-diag/inject_tracker.sh @@ -25,6 +25,6 @@ print('PA=0x%x'%((pfn<<12)|(va&0xfff))) [ -n "$PA" ] || { echo "NO PA FOUND"; exit 1; } echo "target pa=$PA" -sudo sh -c "echo 0x$VALPTR_HEX,$PA > /sys/module/open_iov_vfio/parameters/sema_map_add" || exit 1 +sudo sh -c "echo 0x$VALPTR_HEX,$PA > /sys/module/vgsp/parameters/sema_map_add" || exit 1 sleep 1 sudo dmesg -T | grep "injected mapping" | tail -1 diff --git a/tools/guest-diag/pdwatch_cycle.sh b/tools/guest-diag/pdwatch_cycle.sh index 45d08cc..fe758fd 100755 --- a/tools/guest-diag/pdwatch_cycle.sh +++ b/tools/guest-diag/pdwatch_cycle.sh @@ -21,15 +21,15 @@ for i in $(seq 1 30); do done echo "[*] $(date +%T) params: sema_dbg=Y, dst watch 0x200000 + 0x208000" -sudo sh -c "echo Y > /sys/module/open_iov_vfio/parameters/sema_dbg; \ -echo N > /sys/module/open_iov_vfio/parameters/sema_fake_rel; \ -echo N > /sys/module/open_iov_vfio/parameters/sema_skip_ops; \ -echo 64 > /sys/module/open_iov_vfio/parameters/sema_ops_log; \ -echo 0 > /sys/module/open_iov_vfio/parameters/sema_copy_watch; \ -echo 0 > /sys/module/open_iov_vfio/parameters/sema_copy_pat; \ -echo 0x200000 > /sys/module/open_iov_vfio/parameters/sema_copy_dst; \ -echo 0x208000 > /sys/module/open_iov_vfio/parameters/sema_copy_dst2; \ -echo 8000 > /sys/module/open_iov_vfio/parameters/sema_ce_grace_ms" +sudo sh -c "echo Y > /sys/module/vgsp/parameters/sema_dbg; \ +echo N > /sys/module/vgsp/parameters/sema_fake_rel; \ +echo N > /sys/module/vgsp/parameters/sema_skip_ops; \ +echo 64 > /sys/module/vgsp/parameters/sema_ops_log; \ +echo 0 > /sys/module/vgsp/parameters/sema_copy_watch; \ +echo 0 > /sys/module/vgsp/parameters/sema_copy_pat; \ +echo 0x200000 > /sys/module/vgsp/parameters/sema_copy_dst; \ +echo 0x208000 > /sys/module/vgsp/parameters/sema_copy_dst2; \ +echo 8000 > /sys/module/vgsp/parameters/sema_ce_grace_ms" echo "[*] $(date +%T) push tools" timeout 600 "$HERE/push_guest_tools.sh" >/dev/null 2>&1 || echo " push failed" @@ -59,7 +59,7 @@ done echo "[*] $(date +%T) shadow dumps during park" for a in 0x200000 0x201000 0x202000 0x203000 0x208000; do echo " -- $a" - sudo sh -c "echo '$a,64' > /sys/module/open_iov_vfio/parameters/sema_vidmem_dump" 2>/dev/null + sudo sh -c "echo '$a,64' > /sys/module/vgsp/parameters/sema_vidmem_dump" 2>/dev/null sleep 0.2 done sudo dmesg | grep -a "sema-vidmem\|sema-walk-probe\|sema-svc: VA space" | tail -40 > "$OUT/pdwatch_park_dmesg.txt" @@ -70,8 +70,8 @@ echo " devptr=$DEV" if [ -n "${DEV:-}" ]; then STG=$(printf '0x%x' $((DEV+0x3c00100))) echo " staging=$STG" - echo " -- walk_probe staging"; sudo sh -c "echo $STG > /sys/module/open_iov_vfio/parameters/walk_probe"; sleep 1 - echo " -- walk_probe devptr"; sudo sh -c "echo $DEV > /sys/module/open_iov_vfio/parameters/walk_probe"; sleep 1 + echo " -- walk_probe staging"; sudo sh -c "echo $STG > /sys/module/vgsp/parameters/walk_probe"; sleep 1 + echo " -- walk_probe devptr"; sudo sh -c "echo $DEV > /sys/module/vgsp/parameters/walk_probe"; sleep 1 fi echo " -- copy-dst lines so far" sudo dmesg | grep -aE "sema-copy-dst|sema-svc: applied|sema-256" | tail -30 @@ -87,7 +87,7 @@ echo "[*] $(date +%T) post-run: walk state + copy-dst log" cp "$SER" "$OUT/pdwatch_serial.log" 2>/dev/null sudo dmesg > "$OUT/pdwatch_dmesg.log" 2>/dev/null if [ -n "${STG:-}" ]; then - echo " -- post walk_probe staging"; sudo sh -c "echo $STG > /sys/module/open_iov_vfio/parameters/walk_probe"; sleep 1 + echo " -- post walk_probe staging"; sudo sh -c "echo $STG > /sys/module/vgsp/parameters/walk_probe"; sleep 1 sudo dmesg | tail -12 fi echo " -- copy-dst summary" diff --git a/tools/guest-diag/phys_claim_cycle.sh b/tools/guest-diag/phys_claim_cycle.sh index 0e00ae8..e89fbfc 100755 --- a/tools/guest-diag/phys_claim_cycle.sh +++ b/tools/guest-diag/phys_claim_cycle.sh @@ -2,7 +2,7 @@ # phys_claim_cycle.sh - supervised physical-GPU claim/release cycle harness. # # Drives one or more full "D0 pre-lock" cycles of the physical-ownership -# backend (open-iov-vfio + gsp_phys_gpu=1 + gsp_phys_hazard_ack=1): +# backend (vgsp + gsp_phys_gpu=1 + gsp_phys_hazard_ack=1): # # start persistenced -> wait GPU+root port active -> power/control=on on # GPU+port -> dmesg -C -> (stop persistenced && insmod) as ONE command -> @@ -33,7 +33,7 @@ # --dryrun also pass gsp_phys_fwsec_dryrun=1 (implies --layout): run the # READ-ONLY stage-3c validation (VBIOS/BIT/FWSEC parse and the # staging/placement plan, no device writes); expects the -# "gsp-phys-fwsec-dryrun:" and "stage 3c dry-run complete" +# "vgsp-fwsec-dryrun:" and "stage 3c dry-run complete" # lines. It is also implied by --boot-dryrun (alias) # --boot-dryrun implies --dryrun and also passes gsp_phys_boot_dryrun=1 # (implies --layout): host-memory-only stage-3d staging @@ -60,13 +60,13 @@ # this fused part: it left WPR2 up and was not host-recoverable. # It is refused immediately and never reaches insmod. Use # --boot; never stop after FWSEC alone on this host. -# --ko PATH module to insmod (default kernel/open-iov-vfio.ko) +# --ko PATH module to insmod (default kernel/vgsp.ko) # --fw NAME GSP firmware to stage (request_firmware name under # /lib/firmware; default: the module's own default, currently # nvidia/570.211.01/gsp_tu10x.bin) # --nocat pass gsp_phys_nocat=1: during --boot, log every GSP-RM NOCAT # journal record (status-queue function 0x1020) to dmesg with -# the "gsp-nocat:" prefix. The unique-record summary is +# the "vgsp-nocat:" prefix. The unique-record summary is # printed at the end of stage 3e (success or failure) with or # without this flag; per-record logging is verbose. # --restore-power restore power/control=auto and restart persistenced at @@ -106,7 +106,7 @@ BOOT_DRYRUN=0 NOCAT=0 KEEP=0 RESTORE_POWER=0 -KO="$REPO_ROOT/kernel/open-iov-vfio.ko" +KO="$REPO_ROOT/kernel/vgsp.ko" FW="" GPU_BDF="${GPU_BDF:-0000:01:00.0}" @@ -247,8 +247,8 @@ if [ -n "$WATCH_PIDS" ]; then pre_fail "stale watcher process(es) running; stop them first" fi -if lsmod 2>/dev/null | awk '{print $1}' | grep -qx open_iov_vfio; then - pre_fail "open_iov_vfio is already loaded; rmmod it first" +if lsmod 2>/dev/null | awk '{print $1}' | grep -qx vgsp; then + pre_fail "vgsp is already loaded; rmmod it first" fi command -v lspci >/dev/null 2>&1 || pre_fail "lspci not found" @@ -380,10 +380,10 @@ for n in $(seq 1 "$CYCLES"); do sleep 1 save_dmesg "$DLOG" - if grep -q "gsp-phys: refusing claim" "$DLOG" 2>/dev/null; then + if grep -q "vgsp: refusing claim" "$DLOG" 2>/dev/null; then echo "PRECONDITION FAIL: cycle $n: module refused the claim (GPU/port were already runtime-suspended)" >&2 warn "no claim was taken; unloading the module is safe" - timeout 60 sudo rmmod open_iov_vfio 2>/dev/null || true + timeout 60 sudo rmmod vgsp 2>/dev/null || true save_dmesg "$DLOG" exit 3 fi @@ -405,7 +405,7 @@ for n in $(seq 1 "$CYCLES"); do OK_DRYRUN=1 if [ "$DRYRUN" -eq 1 ]; then OK_DRYRUN=0 - if grep -q "gsp-phys-fwsec-dryrun:" "$DLOG" && \ + if grep -q "vgsp-fwsec-dryrun:" "$DLOG" && \ grep -q "stage 3c dry-run complete" "$DLOG"; then OK_DRYRUN=1 fi @@ -437,7 +437,7 @@ for n in $(seq 1 "$CYCLES"); do if [ "$NR_LOCKS" -eq 0 ] && [ "$OK_CLAIM" -eq 0 ]; then echo "ABORT: cycle $n: no locks and no claim took effect" >&2 warn "no D0 locks were taken; unloading the module is safe" - timeout 60 sudo rmmod open_iov_vfio 2>/dev/null || true + timeout 60 sudo rmmod vgsp 2>/dev/null || true save_dmesg "$DLOG" exit 2 fi @@ -454,7 +454,7 @@ for n in $(seq 1 "$CYCLES"); do warn "cycle $n: gsp_phys_layout=1 but no 'stage 3b complete' line" fi if [ "$DRYRUN" -eq 1 ] && [ "$OK_DRYRUN" -ne 1 ]; then - warn "cycle $n: gsp_phys_fwsec_dryrun=1 but the read-only dry-run did not complete (missing 'gsp-phys-fwsec-dryrun:'/'stage 3c dry-run complete')" + warn "cycle $n: gsp_phys_fwsec_dryrun=1 but the read-only dry-run did not complete (missing 'vgsp-fwsec-dryrun:'/'stage 3c dry-run complete')" fi if [ "$BOOT_DRYRUN" -eq 1 ] && [ "$OK_BOOTPRIME" -ne 1 ]; then warn "cycle $n: gsp_phys_boot_dryrun=1 but 'stage 3d prime complete' is missing (staging rehearsal did not complete)" @@ -504,9 +504,9 @@ for n in $(seq 1 "$CYCLES"); do lspci: $LSPCI_NN driver=$DRV gpu=$RSTAT_GPU port=$RSTAT_PORT power/control=on (GPU $GPU_BDF and port $PORT_BDF) - nvidia-persistenced stopped; open_iov_vfio loaded and holding the claim. + nvidia-persistenced stopped; vgsp loaded and holding the claim. To end the claimed session: - sudo rmmod open_iov_vfio + sudo rmmod vgsp echo auto | sudo tee /sys/bus/pci/devices/$GPU_BDF/power/control echo auto | sudo tee /sys/bus/pci/devices/$PORT_BDF/power/control sudo systemctl start nvidia-persistenced @@ -517,7 +517,7 @@ EOF exit 0 fi - timeout 60 sudo rmmod open_iov_vfio >/dev/null 2>&1 + timeout 60 sudo rmmod vgsp >/dev/null 2>&1 RMMOD_RC=$? sleep 1 save_dmesg "$DLOG" diff --git a/tools/guest-diag/pin_client_sems.sh b/tools/guest-diag/pin_client_sems.sh index 82d2789..af39fd1 100755 --- a/tools/guest-diag/pin_client_sems.sh +++ b/tools/guest-diag/pin_client_sems.sh @@ -34,7 +34,7 @@ pin_range() { # pin_range <lo-dec> <hi-dec> <label> mapfile -t lines < <(timeout 60 $VMEXEC exec --timeout 50 "sudo python3 /tmp/pmapall.py $PID $(printf '0x%x' "$cur") 32" 2>/dev/null | grep -aE '^0x[0-9a-f]+,0x[0-9a-f]+$') [ "${#lines[@]}" -gt 0 ] || break for l in "${lines[@]}"; do - echo "$l,0x1000,1" | sudo tee /sys/module/open_iov_vfio/parameters/sema_map_add >/dev/null + echo "$l,0x1000,1" | sudo tee /sys/module/vgsp/parameters/sema_map_add >/dev/null done total=$((total + ${#lines[@]})) local last=${lines[-1]%%,*} @@ -58,7 +58,7 @@ for it in $(seq 1 "$ITER"); do for va in $lines; do line=$(timeout 30 $VMEXEC exec --timeout 25 "sudo python3 /tmp/pmapall.py $PID $va 1" 2>/dev/null | grep -E '^0x[0-9a-f]+,0x[0-9a-f]+$' | head -1) [ -n "$line" ] || continue - echo "$line,0x1000,1" | sudo tee /sys/module/open_iov_vfio/parameters/sema_map_add >/dev/null || continue + echo "$line,0x1000,1" | sudo tee /sys/module/vgsp/parameters/sema_map_add >/dev/null || continue n=$((n + 1)) done echo "iter $it: pinned $n sem page(s) (pid $PID)" diff --git a/tools/guest-diag/pin_gr_stream.py b/tools/guest-diag/pin_gr_stream.py index a11bc84..d8b6b61 100644 --- a/tools/guest-diag/pin_gr_stream.py +++ b/tools/guest-diag/pin_gr_stream.py @@ -18,7 +18,7 @@ import time HERE = os.path.dirname(os.path.abspath(__file__)) VMEXEC = os.path.normpath(os.path.join(HERE, "..", "..", "scripts", "vgpu_vm.py")) -PARAM = "/sys/module/open_iov_vfio/parameters" +PARAM = "/sys/module/vgsp/parameters" GUEST_SCRIPT = os.path.join(HERE, "guest_pin_stream.py") PORT = int(os.environ.get("PINWIN_PORT", "45678")) diff --git a/tools/guest-diag/pin_gr_window.py b/tools/guest-diag/pin_gr_window.py index 26083f7..71f73d0 100644 --- a/tools/guest-diag/pin_gr_window.py +++ b/tools/guest-diag/pin_gr_window.py @@ -30,7 +30,7 @@ import time HERE = os.path.dirname(os.path.abspath(__file__)) VMEXEC = os.path.normpath(os.path.join(HERE, "..", "..", "scripts", "vgpu_vm.py")) -PARAM = "/sys/module/open_iov_vfio/parameters" +PARAM = "/sys/module/vgsp/parameters" HELPER = os.path.join(HERE, "guest_pmap_win.py") LO = int(os.environ.get("PINWIN_LO", "0x200400000"), 16) diff --git a/tools/guest-diag/pin_miss_pages.sh b/tools/guest-diag/pin_miss_pages.sh index 77268ef..fd7722a 100755 --- a/tools/guest-diag/pin_miss_pages.sh +++ b/tools/guest-diag/pin_miss_pages.sh @@ -45,7 +45,7 @@ for ((i = 1; i <= MAXMIN * 4; i++)); do line=$(EXEC "sudo python3 /tmp/pmapall.py $pid $page 1" | grep -aE "^$page,0x[0-9a-f]+$" | head -1) if [ -n "$line" ]; then - echo "$line,0x1000,1" | sudo tee /sys/module/open_iov_vfio/parameters/sema_map_add >/dev/null + echo "$line,0x1000,1" | sudo tee /sys/module/vgsp/parameters/sema_map_add >/dev/null echo "[$((i * 15))s] pinned $line (pid $pid)" seen="$seen $page" fi diff --git a/tools/guest-diag/pin_sem_fast.sh b/tools/guest-diag/pin_sem_fast.sh index e0e30f8..16cecc4 100755 --- a/tools/guest-diag/pin_sem_fast.sh +++ b/tools/guest-diag/pin_sem_fast.sh @@ -24,7 +24,7 @@ for ((i = 1; i <= N; i++)); do line=$(EXEC "sudo python3 /tmp/pmapall.py $pid 0x20400f000 1" | grep -aE "^0x20400f000,0x[0-9a-f]+$" | head -1) if [ -n "$line" ]; then - echo "$line,0x1000,1" | sudo tee /sys/module/open_iov_vfio/parameters/sema_map_add >/dev/null + echo "$line,0x1000,1" | sudo tee /sys/module/vgsp/parameters/sema_map_add >/dev/null pinned_pid="$pid" echo "[$((i * 2))s] pinned $line (pid $pid)" fi diff --git a/tools/guest-diag/run_cycle.sh b/tools/guest-diag/run_cycle.sh index d6ab63f..28ea18d 100755 --- a/tools/guest-diag/run_cycle.sh +++ b/tools/guest-diag/run_cycle.sh @@ -44,7 +44,7 @@ if [ "$DBG" != "Y" ] && { [ "$COPY_WATCH" != "0" ] || [ "$COPY_PAT" != "0" ] || DBG=Y fi echo " sema_dbg=$DBG" -sudo sh -c "echo $DBG > /sys/module/open_iov_vfio/parameters/sema_dbg; echo Y > /sys/module/open_iov_vfio/parameters/sema_fake_rel; echo $SKIP_OPS > /sys/module/open_iov_vfio/parameters/sema_skip_ops; echo $OPS_LOG > /sys/module/open_iov_vfio/parameters/sema_ops_log; echo $COPY_WATCH > /sys/module/open_iov_vfio/parameters/sema_copy_watch; echo $COPY_PAT > /sys/module/open_iov_vfio/parameters/sema_copy_pat; echo $COPY_DST > /sys/module/open_iov_vfio/parameters/sema_copy_dst; echo $COPY_DST2 > /sys/module/open_iov_vfio/parameters/sema_copy_dst2; echo $CE_GRACE > /sys/module/open_iov_vfio/parameters/sema_ce_grace_ms" +sudo sh -c "echo $DBG > /sys/module/vgsp/parameters/sema_dbg; echo Y > /sys/module/vgsp/parameters/sema_fake_rel; echo $SKIP_OPS > /sys/module/vgsp/parameters/sema_skip_ops; echo $OPS_LOG > /sys/module/vgsp/parameters/sema_ops_log; echo $COPY_WATCH > /sys/module/vgsp/parameters/sema_copy_watch; echo $COPY_PAT > /sys/module/vgsp/parameters/sema_copy_pat; echo $COPY_DST > /sys/module/vgsp/parameters/sema_copy_dst; echo $COPY_DST2 > /sys/module/vgsp/parameters/sema_copy_dst2; echo $CE_GRACE > /sys/module/vgsp/parameters/sema_ce_grace_ms" echo "[*] pushing guest tools" timeout 300 "$HERE/push_guest_tools.sh" >/dev/null 2>&1 || { echo "push failed"; exit 1; } diff --git a/tools/guest-diag/run_traced.sh b/tools/guest-diag/run_traced.sh index e8d3a09..009e20b 100755 --- a/tools/guest-diag/run_traced.sh +++ b/tools/guest-diag/run_traced.sh @@ -26,18 +26,18 @@ pfn=e & ((1<<55)-1) print('PA=0x%x'%((pfn<<12)|0xeb0)) \"" | grep -o 'PA=0x[0-9a-f]*' | head -1 | sed 's/PA=//') if [ -n "$PA" ]; then - sudo sh -c "echo 0x20480feb0,$PA > /sys/module/open_iov_vfio/parameters/sema_map_add" 2>/dev/null + sudo sh -c "echo 0x20480feb0,$PA > /sys/module/vgsp/parameters/sema_map_add" 2>/dev/null fi # nudge UVM's tracking semaphore forward when the sweep has stalled - sudo sh -c 'echo 0x121000010,1 > /sys/module/open_iov_vfio/parameters/sema_probe' 2>/dev/null + sudo sh -c 'echo 0x121000010,1 > /sys/module/vgsp/parameters/sema_probe' 2>/dev/null sleep 1 VALS=$(sudo dmesg -T | grep -A4 "sema-probe: va=0x121000010" | tail -4) SPA=$(echo "$VALS" | grep -oE "pa=0x[0-9a-f]+" | head -1 | cut -d= -f2) CUR=$(echo "$VALS" | grep -oE "\[0\] 0x[0-9a-f]+" | head -1 | awk '{print $2}') if [ -n "$SPA" ] && [ -n "$CUR" ]; then NEXT=$(printf '0x%x' $(( CUR + 1 ))) - sudo sh -c "echo 0x$SPA,$NEXT > /sys/module/open_iov_vfio/parameters/poke_guest" 2>/dev/null + sudo sh -c "echo 0x$SPA,$NEXT > /sys/module/vgsp/parameters/poke_guest" 2>/dev/null echo " [$((i*10))s] cdt=$PID sema $CUR -> $NEXT" else echo " [$((i*10))s] cdt=$PID (sema unresolved)" diff --git a/tools/guest-diag/semfix_uvmt.py b/tools/guest-diag/semfix_uvmt.py index 636e1f4..ba4f4f7 100755 --- a/tools/guest-diag/semfix_uvmt.py +++ b/tools/guest-diag/semfix_uvmt.py @@ -209,7 +209,7 @@ def dmesg_releases(seen): if not line or line in seen: continue seen.add(line) - log("push: %s" % line.replace("gsp-resman-vfio: ", "")) + log("push: %s" % line.replace("vgsp: ", "")) def cdt_pid(): diff --git a/tools/guest-diag/semfix_watch.py b/tools/guest-diag/semfix_watch.py index 1bb4b39..5740b42 100644 --- a/tools/guest-diag/semfix_watch.py +++ b/tools/guest-diag/semfix_watch.py @@ -42,7 +42,7 @@ import time HERE = os.path.dirname(os.path.abspath(__file__)) VMEXEC = os.path.normpath(os.path.join(HERE, "..", "..", "scripts", "vgpu_vm.py")) -PARAM = "/sys/module/open_iov_vfio/parameters" +PARAM = "/sys/module/vgsp/parameters" QMP_SOCK = os.environ.get("QMP_SOCK", "/tmp/qemu-qmp.sock") GPU_VA_LO = 0x100000000 diff --git a/tools/guest-diag/vmcycle.sh b/tools/guest-diag/vmcycle.sh index 6faaa75..d3dcbec 100755 --- a/tools/guest-diag/vmcycle.sh +++ b/tools/guest-diag/vmcycle.sh @@ -1,6 +1,6 @@ #!/bin/bash # vmcycle.sh - reload cycle for the emulated vGPU stack: -# stop QEMU -> remove mdevs -> rmmod/insmod open-iov-vfio.ko -> create a +# stop QEMU -> remove mdevs -> rmmod/insmod vgsp.ko -> create a # fresh mdev -> patch its UUID into the runtime launch script -> relaunch. # # ALL artifacts stay inside this directory (tools/guest-diag/) so nothing is @@ -17,7 +17,7 @@ set -e HERE="$(cd "$(dirname "$0")" && pwd)" TEMPLATE="$HERE/launch_qemu_rootport.sh" QEMU_SCRIPT="${QEMU_SCRIPT:-$HERE/launch_qemu_rootport.run.sh}" -MODULE="${MODULE:-$HERE/../../kernel/open-iov-vfio.ko}" +MODULE="${MODULE:-$HERE/../../kernel/vgsp.ko}" MDEV_PARENT="${MDEV_PARENT:-0000:01:00.0}" MDEV_TYPE="${MDEV_TYPE:-nvidia-nvidia-vgpu-turing}" RUNDIR="$HERE/run" @@ -30,7 +30,7 @@ sleep 4 for m in /sys/bus/mdev/devices/*; do [ -d "$m" ] && echo 1 | sudo tee "$m/remove" >/dev/null done -sudo rmmod open_iov_vfio 2>/dev/null || true +sudo rmmod vgsp 2>/dev/null || true sudo insmod "$MODULE" U=$(uuidgen) echo "$U" | sudo tee "/sys/class/mdev_bus/$MDEV_PARENT/mdev_supported_types/$MDEV_TYPE/create" >/dev/null diff --git a/tools/guest-diag/vmrestart.sh b/tools/guest-diag/vmrestart.sh index 8c15a89..f94521c 100755 --- a/tools/guest-diag/vmrestart.sh +++ b/tools/guest-diag/vmrestart.sh @@ -1,5 +1,5 @@ #!/bin/bash -# vmrestart.sh - stop QEMU, reload open-iov-vfio.ko from the tree, fresh mdev, +# vmrestart.sh - stop QEMU, reload vgsp.ko from the tree, fresh mdev, # relaunch the vGPU VM. Everything bounded so a stuck step cannot hang the # caller. set -u @@ -20,8 +20,8 @@ for m in /sys/bus/mdev/devices/*; do timeout 20 sudo sh -c "echo 1 > $m/remove" || echo "WARN: mdev remove timeout" done -timeout 30 sudo rmmod open_iov_vfio || { echo "ERROR: rmmod failed"; exit 1; } -sudo insmod kernel/open-iov-vfio.ko || { echo "ERROR: insmod failed"; exit 1; } +timeout 30 sudo rmmod vgsp || { echo "ERROR: rmmod failed"; exit 1; } +sudo insmod kernel/vgsp.ko || { echo "ERROR: insmod failed"; exit 1; } U=$(uuidgen) echo "$U" | sudo tee /sys/class/mdev_bus/0000:01:00.0/mdev_supported_types/nvidia-nvidia-vgpu-turing/create >/dev/null diff --git a/userspace/cuda/570.144/docs/ANALYSIS-cuctxcreate-segv.md b/userspace/cuda/570.144/docs/ANALYSIS-cuctxcreate-segv.md index 666a4e2..ce9872d 100644 --- a/userspace/cuda/570.144/docs/ANALYSIS-cuctxcreate-segv.md +++ b/userspace/cuda/570.144/docs/ANALYSIS-cuctxcreate-segv.md @@ -27,7 +27,7 @@ First analysis note for the CUDA userspace driver under Open-IOV. Companion to | `cuMemAlloc` / copies / `ALL OK` | not reached yet | Guest: Ubuntu 24.04, driver **570.144** (open kernel modules + libcuda -570.144), emulated TU104 `10de:1ed3` via `open-iov-vfio.ko`. +570.144), emulated TU104 `10de:1ed3` via `vgsp.ko`. Host oracle: RTX 2080 Super (cc 7.5), driver 570.211.01, CUDA toolkit 12.0. ## The crash, precisely diff --git a/userspace/cuda/docs/04-virtualization-and-emulation.md b/userspace/cuda/docs/04-virtualization-and-emulation.md index 6492a60..cb77652 100644 --- a/userspace/cuda/docs/04-virtualization-and-emulation.md +++ b/userspace/cuda/docs/04-virtualization-and-emulation.md @@ -94,7 +94,7 @@ stock** — but implements the host side differently: | Guest stack | stock | stock (identical constraint) | | Device presented | mediated PCI function with a vGPU profile, backed by host RM | emulated PCI function (mdev/VFIO) backed by the host module + GSP-RM emulation | | Where commands execute | physical GPU via host RM channels | host executes the work the guest encodes (e.g. memsets/copies/semaphore releases) or passes through, depending on the resource | -| Host-side control plane | vGPU manager daemon + VMIOP plugin + host RM | `open-iov-vfio.ko` emulating the GSP-RM interface and device model directly in the kernel | +| Host-side control plane | vGPU manager daemon + VMIOP plugin + host RM | `vgsp.ko` emulating the GSP-RM interface and device model directly in the kernel | | Licensing | GRID license server / vGPU licensing; CUDA gated on license state | no GRID licensing; the driver's vGPU detection must be answered in a way that does not gate CUDA (or the guest must not be told it is a licensed-vGPU-only environment) | | CUDA userspace | unmodified, capability-limited by vGPU profile | unmodified, no profile limits imposed | | Migration | vGPU-specific save/restore protocol with dirty-page tracking | 4-phase migration in the host module (project feature) | diff --git a/userspace/cuda/docs/08-virtualization-approaches.md b/userspace/cuda/docs/08-virtualization-approaches.md index e67f648..6e9702d 100644 --- a/userspace/cuda/docs/08-virtualization-approaches.md +++ b/userspace/cuda/docs/08-virtualization-approaches.md @@ -46,7 +46,7 @@ server. Approach E remains deployment-gated. **Stated architecture:** *emulate the interface, pass through the work, never patch anyone* — a mediated-passthrough vGPU where PCI config/BARs, the GSP boot handshake, the GSP-RM protocol and interrupt routing are emulated in -`open-iov-vfio.ko`, while real work is meant to execute on the physical GPU. +`vgsp.ko`, while real work is meant to execute on the physical GPU. The original decision procedure was to prototype A first for correctness; the interface analysis ([`../../../docs/03-architecture/08-physical-gpu-integration.md`](../../../docs/03-architecture/08-physical-gpu-integration.md)) |
