linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Bharat Kumar Gogada <bharatku@xilinx.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ravikiran Gummaluri <rgummal@xilinx.com>
Subject: Re: [PATCH v4 2/2] PCI: xilinx-cpm: Add Versal CPM Root Port driver
Date: Wed, 29 Jan 2020 08:31:15 -0600	[thread overview]
Message-ID: <20200129143115.GA106689@google.com> (raw)
In-Reply-To: <MN2PR02MB6336D2BDBDF1B372AB5440BEA5050@MN2PR02MB6336.namprd02.prod.outlook.com>

On Wed, Jan 29, 2020 at 11:16:47AM +0000, Bharat Kumar Gogada wrote:
> > Subject: Re: [PATCH v4 2/2] PCI: xilinx-cpm: Add Versal CPM Root Port driver
> > 
> > On Tue, Jan 28, 2020 at 06:14:43PM +0530, Bharat Kumar Gogada wrote:
> > > - Add support for Versal CPM as Root Port.
> > > - The Versal ACAP devices include CCIX-PCIe Module (CPM). The integrated
> > >   block for CPM along with the integrated bridge can function
> > >   as PCIe Root Port.
> > > - CPM Versal uses GICv3 ITS feature for achieving assigning MSI/MSI-X
> > >   vectors and handling MSI/MSI-X interrupts.
> > > - Bridge error and legacy interrupts in Versal CPM are handled using
> > >   Versal CPM specific MISC interrupt line.
> > >
> > > Changes v4:
> > > - change commit subject.
> > > - Remove unnecessary comments and type cast.
> > > - Added comments for CPM block register access using readl/writel.
> > >
> > > Signed-off-by: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
> > > ...
> > 
> > > +static bool xilinx_cpm_pcie_valid_device(struct pci_bus *bus,
> > > +					 unsigned int devfn)
> > > +{
> > > +	struct xilinx_cpm_pcie_port *port = bus->sysdata;
> > > +
> > > +	/* Only one device down on each root port */
> > > +	if (bus->number == port->root_busno && devfn > 0)
> > > +		return false;
> > 
> > This whole *_valid_device() thing is a mess.  We shouldn't need it at all.  But if
> > we *do* need it, I don't think you should check the entire devfn because that
> > means you can't attach a multifunction device.
> > 
> > Several other drivers with similar *_valid_device() implementations check only
> > PCI_SLOT():
> > 
> >   dw_pcie_valid_device()
> >   advk_pcie_valid_device()
> >   pci_dw_valid_device()
> >   altera_pcie_valid_device()
> >   mobiveil_pcie_valid_device()
> >   rockchip_pcie_valid_device()
> > 
> > Even checking just PCI_SLOT() is problematic because I think an ARI device with
> > more than 8 functions will not work correctly.
> > 
> > What exactly happens if you omit this function, i.e., if we just go ahead and
> > attempt config accesses when the device is not present?  We
> > *should* get something like an Unsupported Request completion, and that
> > *should* be a recoverable error.  Most hardware turns this error into read data
> > of 0xffffffff.  The OS should be able to figure out that there's no device there
> > and continue with no ill effects.
> > 
> Thanks Bjorn. I did test and I do not see any issue without this. 
> Will resend patch with this change.

That's great, thanks for testing that!  I wonder how many other
drivers could just drop that code.

Bjorn

  reply	other threads:[~2020-01-29 14:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 12:44 [PATCH v4 0/2] Adding support for Versal CPM as Root Port driver Bharat Kumar Gogada
2020-01-28 12:44 ` [PATCH v4 1/2] PCI: xilinx-cpm: Add device tree binding for Versal CPM host bridge Bharat Kumar Gogada
2020-01-28 12:44 ` [PATCH v4 2/2] PCI: xilinx-cpm: Add Versal CPM Root Port driver Bharat Kumar Gogada
2020-01-28 14:04   ` Bjorn Helgaas
2020-01-29 11:16     ` Bharat Kumar Gogada
2020-01-29 14:31       ` Bjorn Helgaas [this message]
2020-01-28 14:04 ` [PATCH v4 0/2] Adding support for Versal CPM as " Bjorn Helgaas

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=20200129143115.GA106689@google.com \
    --to=helgaas@kernel.org \
    --cc=bharatku@xilinx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rgummal@xilinx.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;
as well as URLs for NNTP newsgroup(s).