diff mbox

[v2] Setup disabled bridges even if buses are added.

Message ID 20090403111102.0975.27C06F64@necst.nec.co.jp (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Yuji Shimada April 3, 2009, 2:12 a.m. UTC
This patch setups disabled bridges even if buses have already been
added.

pci_assign_unassigned_resources is called after buses are added.
pci_assign_unassigned_resources calls pci_bus_assign_resources.
pci_bus_assign_resources calls pci_setup_bridge to configure BARs of
bridges.

Currently pci_setup_bridge returns immediately if the bus have already
been added. So pci_assign_unassigned_resources can't configure BARs of
bridge.

The patch fixes the issue.

On logical hot-add, we need to prevent the kernel from re-initializing
bridges that have already been initialized. To achieve this,
pci_setup_bridge returns immediately if the bridge have already been
enabled.

We don't need to check whether the specified bus is a root bus or not.
pci_setup_bridge is not called on a root bus, because a root bus does
not have a bridge.

Thanks,
--
Yuji Shimada


Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Alexander Chiang April 3, 2009, 2:32 a.m. UTC | #1
* Yuji Shimada <shimada-yxb@necst.nec.co.jp>:
> This patch setups disabled bridges even if buses have already been
> added.
> 
> pci_assign_unassigned_resources is called after buses are added.
> pci_assign_unassigned_resources calls pci_bus_assign_resources.
> pci_bus_assign_resources calls pci_setup_bridge to configure BARs of
> bridges.
> 
> Currently pci_setup_bridge returns immediately if the bus have already
> been added. So pci_assign_unassigned_resources can't configure BARs of
> bridge.
> 
> The patch fixes the issue.
> 
> On logical hot-add, we need to prevent the kernel from re-initializing
> bridges that have already been initialized. To achieve this,
> pci_setup_bridge returns immediately if the bridge have already been
> enabled.
> 
> We don't need to check whether the specified bus is a root bus or not.
> pci_setup_bridge is not called on a root bus, because a root bus does
> not have a bridge.

Ok, thank you for your analysis in your last email.

One small comment...

> Thanks,
> --
> Yuji Shimada
> 
> 
> Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
> 
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 334285a..bfc3b5e 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -144,7 +144,7 @@ static void pci_setup_bridge(struct pci_bus *bus)
>  	struct pci_bus_region region;
>  	u32 l, bu, lu, io_upper16;
>  
> -	if (!pci_is_root_bus(bus) && bus->is_added)
> +	if (atomic_read(&bridge->enable_cnt) != 0)

We are now using this test in pci_setup_bridge() and in
pci_enable_bridges().

Can you create a new helper function and have those functions use
it?

static inline int is_pci_dev_enabled(struct pci_dev *pdev)
{
	return (atomic_read(&pdev->enable_cnt) > 0);
}

Thanks.

/ac

>  		return;
>  
>  	dev_info(&bridge->dev, "PCI bridge, secondary bus %04x:%02x\n",
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 334285a..bfc3b5e 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -144,7 +144,7 @@  static void pci_setup_bridge(struct pci_bus *bus)
 	struct pci_bus_region region;
 	u32 l, bu, lu, io_upper16;
 
-	if (!pci_is_root_bus(bus) && bus->is_added)
+	if (atomic_read(&bridge->enable_cnt) != 0)
 		return;
 
 	dev_info(&bridge->dev, "PCI bridge, secondary bus %04x:%02x\n",