From 076d7e989cb69f6ded7d60f2a080eb909930061b Mon Sep 17 00:00:00 2001 From: Andrea Parri Date: Thu, 15 Oct 2026 10:19:35 +0200 Subject: [PATCH] vfio/nvgrace-gpu: Drop the usemem length check in open_device nvgrace_gpu_open_device() sets up the fake BAR registers and remap_lock only when usemem.memlength is nonzero. The check exists for fallback mode, which used to share this open path. Fallback mode now has its own open_device, so only devices with ACPI memory properties reach this one. For those devices usemem.memlength is never zero: an empty region from nvgrace_gpu_fetch_memory_property() selects fallback mode, and probe fails when nvgrace_gpu_init_nvdev_struct() rounds usemem down to nothing. Do the setup unconditionally. Assisted-by: LLM Signed-off-by: Andrea Parri Reviewed-by: Ankit Agrawal Link: https://lore.kernel.org/r/20261015081937.405320-3-parri.andrea@gmail.com Signed-off-by: Alex Williamson --- drivers/vfio/pci/nvgrace-gpu/main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c b/drivers/vfio/pci/nvgrace-gpu/main.c index 846a1e354c26..5ddec340b73b 100644 --- a/drivers/vfio/pci/nvgrace-gpu/main.c +++ b/drivers/vfio/pci/nvgrace-gpu/main.c @@ -188,10 +188,8 @@ static int nvgrace_gpu_open_device(struct vfio_device *core_vdev) if (ret) return ret; - if (nvdev->usemem.memlength) { - nvgrace_gpu_init_fake_bar_emu_regs(core_vdev); - mutex_init(&nvdev->remap_lock); - } + nvgrace_gpu_init_fake_bar_emu_regs(core_vdev); + mutex_init(&nvdev->remap_lock); /* * GPU readiness is checked by reading the BAR0 registers.