From a7bda851fc7938555eaaf69b062f49efb9d90ece Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Tue, 22 Sep 2026 10:59:59 -0400 Subject: PRAMIN window translation + queue state preservation on Booter-unload Fixes the BAR2 verify test failure (kbusVerifyBar2_GM107): - GSP emulation thread now watches NV_PBUS_BAR0_WINDOW (BAR0+0x1700) for base/target changes and syncs the PRAMIN window (BAR0+0x700000) from the emulated BAR1 (vidmem) at (base << 16). This makes PRAMIN reads return correct vidmem content for the BAR2 verify test. Fixes the fn-10 FREE timeout during driver cleanup: - gsp_emu_clear_boot_state no longer resets the GSP-RM queue state on Booter-unload kick. The driver sends cleanup FREEs AFTER the Booter-unload kick; resetting the queue here caused those frees to time out. - Queue state is now only reset on: ENGINE reset (full GPU reset) or genuine queue death (insane writePtr). Both call gsp_rm_emu_reset explicitly. Also fixes rmq tool ioctl encoding: - Use _IOWR('F', nr, type) encoding for NVIDIA ioctls (was raw numbers) - Open /dev/nvidiactl (not /dev/nvidia0) for RM_ALLOC - Add NVOS64_PARAMETERS (48 bytes) for device/subdevice allocs Verified: BAR2 verify test passes, INSTLOC regkey read, driver probes past RmInitNvDevice bus init, reaches fn-10 FREE timeout during cleanup (same as handoff's characterized blocker). --- kernel/gsp_emulation.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kernel/gsp_emulation.h') diff --git a/kernel/gsp_emulation.h b/kernel/gsp_emulation.h index 6fa69b1..801ea78 100644 --- a/kernel/gsp_emulation.h +++ b/kernel/gsp_emulation.h @@ -129,6 +129,11 @@ struct gsp_emu_context { /* GSP-RM msgq emulation (physical path, guest-sysmem queues) */ struct gsp_rm_emu *rm_emu; + + /* PRAMIN window translation state (BAR0 window -> emulated vidmem) */ + u32 bar0_window_base; /* last-seen NV_PBUS_BAR0_WINDOW BASE (page) */ + u32 bar0_window_target; /* last-seen TARGET (0=vidmem, 2/3=sysmem) */ + bool bar0_window_valid; /* base/target captured at least once */ }; /* Shadow accessors shared with gsp_rm_emulation.c */ -- cgit v1.2.3