The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Ankit Agrawal <ankita@nvidia.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Yishai Hadas <yishaih@nvidia.com>,
	"shameerali.kolothum.thodi@huawei.com"
	<shameerali.kolothum.thodi@huawei.com>,
	"kevin.tian@intel.com" <kevin.tian@intel.com>,
	Zhi Wang <zhiw@nvidia.com>, Aniket Agashe <aniketa@nvidia.com>,
	Neo Jia <cjia@nvidia.com>, Kirti Wankhede <kwankhede@nvidia.com>,
	"Tarun Gupta (SW-GPU)" <targupta@nvidia.com>,
	Vikram Sethi <vsethi@nvidia.com>,
	Andy Currid <acurrid@nvidia.com>,
	Alistair Popple <apopple@nvidia.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Dan Williams <danw@nvidia.com>,
	"Anuj Aggarwal (SW-GPU)" <anuaggarwal@nvidia.com>,
	Matt Ochs <mochs@nvidia.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] vfio/nvgrace-gpu: Check the HBM training and C2C link status
Date: Fri, 17 Jan 2025 16:31:08 -0500	[thread overview]
Message-ID: <20250117163108.3f817d4d.alex.williamson@redhat.com> (raw)
In-Reply-To: <SA1PR12MB7199624F639518D3CA59C7F4B01B2@SA1PR12MB7199.namprd12.prod.outlook.com>

On Fri, 17 Jan 2025 21:13:52 +0000
Ankit Agrawal <ankita@nvidia.com> wrote:

> >> > We're accessing device memory here but afaict the memory enable bit of
> >> > the command register is in an indeterminate state.  What happens if you
> >> > use setpci to clear the memory enable bit or 'echo 0 > enable' before
> >> > binding the driver?  Thanks,
> >> >
> >> > Alex  
> >>
> >> Hi Alex, sorry I didn't understand how we are accessing device memory here if
> >> the C2C_LINK_BAR0_OFFSET and HBM_TRAINING_BAR0_OFFSET are BAR0 regs.
> >> But anyways, I tried 'echo 0 > <sysfs_path>/enable' before device bind. I am not
> >> observing any issue and the bind goes through.
> >>
> >> Or am I missing something?  
> >
> > BAR0 is what I'm referring to as device memory.  We cannot access
> > registers in BAR0 unless the memory space enable bit of the command
> > register is set.  The nvgrace-gpu driver makes no effort to enable this
> > and I don't think the PCI core does before probe either.  Disabling
> > through sysfs will only disable if it was previously enabled, so
> > possibly that test was invalid.  Please try with setpci:
> >
> > # Read command register
> > $ setpci -s xxxx:xx:xx.x COMMAND
> > # Clear memory enable
> > $ setpci -s xxxx:xx:xx.x COMMAND=0:2
> > # Re-read command register
> > $ setpci -s xxxx:xx:xx.x COMMAND
> >
> > Probe driver here now that the memory enable bit should re--back as
> > unset.  Thanks,
> >
> > Alex  
> 
> Ok, yeah. I tried to disable through setpci, and the probe is failing with ETIME.
> Should we check if disabled and return -EIO for such situation to differentiate
> from timeout?

No, the driver needs to enable memory on the device around the iomap
rather than assuming the initial state.  Thanks,

Alex


  reply	other threads:[~2025-01-17 21:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 15:23 [PATCH v3 0/3] vfio/nvgrace-gpu: Enable grace blackwell boards ankita
2025-01-17 15:23 ` [PATCH v3 1/3] vfio/nvgrace-gpu: Read dvsec register to determine need for uncached resmem ankita
2025-01-17 15:23 ` [PATCH v3 2/3] vfio/nvgrace-gpu: Expose the blackwell device PF BAR1 to the VM ankita
2025-01-17 18:06   ` Alex Williamson
2025-01-17 18:48     ` Ankit Agrawal
2025-01-17 15:23 ` [PATCH v3 3/3] vfio/nvgrace-gpu: Check the HBM training and C2C link status ankita
2025-01-17 18:27   ` Alex Williamson
2025-01-17 19:19     ` Ankit Agrawal
2025-01-17 19:39       ` Alex Williamson
2025-01-17 21:13         ` Ankit Agrawal
2025-01-17 21:31           ` Alex Williamson [this message]
2025-01-17 21:45             ` Ankit Agrawal
2025-01-17 21:56               ` Ankit Agrawal

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=20250117163108.3f817d4d.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=acurrid@nvidia.com \
    --cc=aniketa@nvidia.com \
    --cc=ankita@nvidia.com \
    --cc=anuaggarwal@nvidia.com \
    --cc=apopple@nvidia.com \
    --cc=cjia@nvidia.com \
    --cc=danw@nvidia.com \
    --cc=jgg@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochs@nvidia.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=targupta@nvidia.com \
    --cc=vsethi@nvidia.com \
    --cc=yishaih@nvidia.com \
    --cc=zhiw@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