From: Andrea Parri <parri.andrea@gmail.com>
To: Alex Williamson <alex@shazbot.org>, Ankit Agrawal <ankita@nvidia.com>
Cc: Andrea Parri <parri.andrea@gmail.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Yishai Hadas <yishaih@nvidia.com>,
Shameer Kolothum <skolothumtho@nvidia.com>,
Kevin Tian <kevin.tian@intel.com>,
Jiaqi Yan <jiaqiyan@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] vfio/nvgrace-gpu: Drop the usemem length check in open_device
Date: Thu, 15 Oct 2026 10:19:35 +0200 [thread overview]
Message-ID: <20261015081937.405320-3-parri.andrea@gmail.com> (raw)
In-Reply-To: <20261015081937.405320-1-parri.andrea@gmail.com>
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 <parri.andrea@gmail.com>
---
v2: New patch
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 208463c218088..8dc792b4fe7ac 100644
--- a/drivers/vfio/pci/nvgrace-gpu/main.c
+++ b/drivers/vfio/pci/nvgrace-gpu/main.c
@@ -185,10 +185,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.
--
2.53.0
prev parent reply other threads:[~2026-10-15 8:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 8:19 [PATCH v2 0/2] vfio/nvgrace-gpu: Separate the fallback-mode open_device Andrea Parri
2026-10-15 8:19 ` [PATCH v2 1/2] vfio/nvgrace-gpu: Use a core-only open_device in fallback mode Andrea Parri
2026-10-15 8:19 ` Andrea Parri [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261015081937.405320-3-parri.andrea@gmail.com \
--to=parri.andrea@gmail.com \
--cc=alex@shazbot.org \
--cc=ankita@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=jiaqiyan@google.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skolothumtho@nvidia.com \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®