linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: krishna kumar <krishnak@linux.ibm.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: nathanl@linux.ibm.com, aneesh.kumar@kernel.org,
	linux-kernel@vger.kernel.org, npiggin@gmail.com,
	gbatra@linux.ibm.com, bhelgaas@google.com,
	tpearson@raptorengineering.com, oohall@gmail.com,
	linux-pci@vger.kernel.org, brking@linux.vnet.ibm.com,
	mahesh.salgaonkar@in.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] arch/powerpc: hotplug driver bridge support
Date: Tue, 14 May 2024 17:35:48 +0530	[thread overview]
Message-ID: <704ab07c-73b2-459e-9cb0-c9e49938454e@linux.ibm.com> (raw)
In-Reply-To: <Zj8FVva9G9_r6-cZ@surfacebook.localdomain>

Thanks Andy for review. I have incorporated your comments and will be 
sending the patch soon.

On 5/11/24 11:12, Andy Shevchenko wrote:
> Thu, May 09, 2024 at 05:35:54PM +0530, Krishna Kumar kirjoitti:
>> There is an issue with the hotplug operation when it's done on the
>> bridge/switch slot. The bridge-port and devices behind the bridge, which
>> become offline by hot-unplug operation, don't get hot-plugged/enabled by
>> doing hot-plug operation on that slot. Only the first port of the bridge
>> gets enabled and the remaining port/devices remain unplugged. The hot
>> plug/unplug operation is done by the hotplug driver
>> (drivers/pci/hotplug/pnv_php.c).
>>
>> Root Cause Analysis: This behavior is due to missing code for the DPC
>> switch/bridge. The existing driver depends on pci_hp_add_devices()
>> function for device enablement. This function calls pci_scan_slot() on
>> only one device-node/port of the bridge, not on all the siblings'
>> device-node/port.
>>
>> The missing code needs to be added which will find all the sibling
>> device-nodes/bridge-ports and will run explicit pci_scan_slot() on
>> those.  A new function has been added for this purpose which gets
>> invoked from pci_hp_add_devices(). This new function
>> pci_traverse_sibling_nodes_and_scan_slot() gets all the sibling
>> bridge-ports by traversal and explicitly invokes pci_scan_slot on them.
>>
>>
> One blank line is enough here.
I have incorporated this.
>
>> Signed-off-by: Krishna Kumar <krishnak@linux.ibm.com>
> ...
>
>> +void *pci_traverse_sibling_nodes_and_scan_slot(struct device_node *start, struct pci_bus *bus)
>> +{
>> +	struct device_node *dn;
>> +	struct device_node *parent;
>> +	int slotno;
>> +
>> +	const __be32 *classp1;
>> +	u32 class1 = 0;
>> +	classp1 = of_get_property(start->child, "class-code", NULL);
>> +	if (classp1)
>> +		class1 = of_read_number(classp1, 1);
> What's wrong with of_property_read_u32()?
I have incorporated this.
>
>
>> +	/* Call of pci_scan_slot for non-bridge/EP case */
>> +	if (!((class1 >> 8) == PCI_CLASS_BRIDGE_PCI)) {
>> +		slotno = PCI_SLOT(PCI_DN(start->child)->devfn);
>> +		pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
>> +		return NULL;
>> +	}
>> +
>> +	/* Iterate all siblings */
>> +	parent = start;
>> +	for_each_child_of_node(parent, dn) {
>> +		const __be32 *classp;
>> +		u32 class = 0;
>> +
>> +		classp = of_get_property(dn, "class-code", NULL);
>> +		if (classp)
>> +			class = of_read_number(classp, 1);
> Ditto.
>
>> +		/* Call of pci_scan_slot on each sibling-nodes/bridge-ports */
>> +		if ((class >> 8) == PCI_CLASS_BRIDGE_PCI) {
>> +			slotno = PCI_SLOT(PCI_DN(dn)->devfn);
>> +			pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
>> +		}
>> +	}
>> +
>> +	return NULL;
>> +}

Best Regards,

Krishna


  reply	other threads:[~2024-05-14 12:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 12:05 [PATCH 0/2] PCI hotplug driver fixes Krishna Kumar
2024-05-09 12:05 ` [PATCH 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Krishna Kumar
2024-06-27 17:04   ` Shawn Anastasio
2024-05-09 12:05 ` [PATCH 2/2] arch/powerpc: hotplug driver bridge support Krishna Kumar
2024-05-11  5:42   ` Andy Shevchenko
2024-05-14 12:05     ` krishna kumar [this message]
2024-05-13  9:45   ` Sourabh Jain
2024-05-14 12:08     ` krishna kumar

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=704ab07c-73b2-459e-9cb0-c9e49938454e@linux.ibm.com \
    --to=krishnak@linux.ibm.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=gbatra@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mahesh.salgaonkar@in.ibm.com \
    --cc=nathanl@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=oohall@gmail.com \
    --cc=tpearson@raptorengineering.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).