Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Patel, Nirmal" <nirmal.patel@linux.intel.com>
Cc: Jon Derrick <jonathan.derrick@intel.com>, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 2/2] PCI: vmd: Issue vmd domain window reset
Date: Thu, 22 Jul 2021 14:04:41 -0500	[thread overview]
Message-ID: <20210722190441.GA327885@bjorn-Precision-5520> (raw)
In-Reply-To: <46f1b33c-ba82-a0df-cb66-01df04be52cb@linux.intel.com>

On Thu, Jul 22, 2021 at 11:47:06AM -0700, Patel, Nirmal wrote:
> On 7/20/2021 3:42 PM, Bjorn Helgaas wrote:
> > On Tue, Jul 20, 2021 at 01:50:09PM -0700, Nirmal Patel wrote:
> >> In order to properly re-initialize the VMD domain during repetitive driver
> >> attachment or reboot tests, ensure that the VMD root ports are re-initialized
> >> to a blank state that can be re-enumerated appropriately by the PCI core.
> >> This is performed by re-initializing all of the bridge windows to ensure
> >> that PCI core enumeration does not detect potentially invalid bridge windows
> >> and misinterpret them as firmware-assigned windows, when they simply may be
> >> invalid bridge window information from a previous boot.

> >> +static void vmd_domain_reset_windows(struct vmd_dev *vmd)
> >> +{
> >> +	u8 hdr_type;
> >> +	char __iomem *addr;
> >> +	int dev_seq;
> >> +	u8 functions;
> >> +	u8 fn_seq;
> >> +	int max_devs = resource_size(&vmd->resources[0]) * 32;
> >> +
> >> +	for (dev_seq = 0; dev_seq < max_devs; dev_seq++) {
> >> +		addr = VMD_DEVICE_BASE(vmd, dev_seq) + PCI_VENDOR_ID;
> >> +		if (readw(addr) != PCI_VENDOR_ID_INTEL)
> >> +			continue;
> >> +
> >> +		addr = VMD_DEVICE_BASE(vmd, dev_seq) + PCI_HEADER_TYPE;
> >> +		hdr_type = readb(addr) & PCI_HEADER_TYPE_MASK;
> >> +		if (hdr_type != PCI_HEADER_TYPE_BRIDGE)
> >> +			continue;
> >> +
> >> +		functions = !!(hdr_type & 0x80) ? 8 : 1;
> >> +		for (fn_seq = 0; fn_seq < functions; fn_seq++)
> >> +		{
> >
> > Looks quite parallel to vmd_domain_sbr(), except that here we iterate
> > through functions as well.  Why does vmd_domain_sbr() not need to
> > iterate through functions?
>
> I am not sure if there is VMD hardware with non zero functions.

I'm not sure either ;)  Hopefully you can resolve this one way or the
other.  It would be good to either make them the same or add a comment
about why they are different.  Otherwise it just looks like a possible
bug.

  reply	other threads:[~2021-07-22 19:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 20:50 [PATCH v2 0/2] Issue secondary bus reset and domain window reset Nirmal Patel
2021-07-20 20:50 ` [PATCH v2 1/2] PCI: vmd: Trigger secondary bus reset Nirmal Patel
2021-07-20 22:33   ` Bjorn Helgaas
2021-07-22 18:39     ` Patel, Nirmal
2021-07-21  5:45   ` Christoph Hellwig
2021-07-22 18:45     ` Patel, Nirmal
2021-07-21  8:50   ` Pali Rohár
2021-07-22 18:44     ` Patel, Nirmal
2021-07-22 19:11     ` Bjorn Helgaas
2021-07-20 20:50 ` [PATCH v2 2/2] PCI: vmd: Issue vmd domain window reset Nirmal Patel
2021-07-20 22:42   ` Bjorn Helgaas
2021-07-22 18:47     ` Patel, Nirmal
2021-07-22 19:04       ` Bjorn Helgaas [this message]
2021-07-20 21:25 ` [PATCH v2 0/2] Issue secondary bus reset and " Patel, Nirmal

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=20210722190441.GA327885@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=jonathan.derrick@intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=nirmal.patel@linux.intel.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