Re: How to reserve pci bus numbers for hotplug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 12, 2013 at 11:56 AM, Andreas Noever
<andreas.noever@xxxxxxxxx> wrote:
> On Thu, Dec 12, 2013 at 1:21 AM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
>> On Wed, Dec 11, 2013 at 3:37 PM, Andreas Noever
>> <andreas.noever@xxxxxxxxx> wrote:
>>
>>> If I could get Linux to assign enough resources (bus numbers for now)
>>> then I could drop the acpi_osi parameter and make thunderbolt work
>>> after suspend... So, is there an easy way to fix this? (Quirks,
>>> reconfiguring bus number assignments from a platform driver, ...?)
>>
>> please check if busn_alloc at
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git
>> for-pci-busn-alloc-3.14
>>
>> could help.
>
> It seems to help. The initial assignment looks good:
>            +-01.1-[05-9b]----00.0-[06-27]--+-00.0-[07]----00.0  Intel
> Corporation DSL3510 Thunderbolt Port [Cactus Ridge]
>            |                               +-03.0-[08-0f]--
>            |                               +-04.0-[10-17]--
>            |                               +-05.0-[18-1f]--
>            |                               \-06.0-[20-27]--
> After hotplug it looks like this:
>            +-01.1-[05-9b]----00.0-[06-29]--+-00.0-[07]----00.0  Intel
> Corporation DSL3510 Thunderbolt Port [Cactus Ridge]
>            |
> +-03.0-[08-11]----00.0-[09-11]----00.0-[0a-11]----00.0  Broadcom
> Corporation NetXtreme BCM57762 Gigabit Ethernet PCIe
>            |                               +-04.0-[10-17]--
>            |                               +-05.0-[18-1f]--
>            |                               \-06.0-[20-27]--
> (Note that the bridge numbers are not disjoint)

it should not extend to [08-11] or [06-29]

Please check attached patch that should address bus number wrong extending.
--- missed checking before going up one level ...wrong assumption ...

Thanks

Yinghai
---
 kernel/resource.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Index: linux-2.6/kernel/resource.c
===================================================================
--- linux-2.6.orig/kernel/resource.c
+++ linux-2.6/kernel/resource.c
@@ -1130,7 +1130,9 @@ int probe_resource(struct resource *b_re
 	/* Probe extended range above top */
 	memset(busn_res, 0, sizeof(struct resource));
 	parent_res = b_res;
-	while (parent_res && !(parent_res->flags & stop_flags)) {
+	while (!(parent_res->flags & stop_flags)) {
+		struct resource *up_parent_res;
+
 		ret = __adjust_resource(parent_res, parent_res->start,
 			resource_size(parent_res) + (needed_size - n_size));
 		if (!ret) {
@@ -1151,7 +1153,11 @@ int probe_resource(struct resource *b_re
 			/* ret must be 0 here*/
 			goto out;
 		}
-		parent_res = parent_res->parent;
+		/* before go up, need to make sure at the same end */
+		up_parent_res = parent_res->parent;
+		if (!up_parent_res || up_parent_res->end != parent_res->end)
+			goto out;
+		parent_res = up_parent_res;
 	}
 
 out:

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux