diff options
Diffstat (limited to 'kernel/resource.c')
-rw-r--r-- | kernel/resource.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index e81b17b53fa5..92190f62ebc5 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -382,7 +382,7 @@ static int __walk_iomem_res_desc(resource_size_t start, resource_size_t end, | |||
382 | int (*func)(struct resource *, void *)) | 382 | int (*func)(struct resource *, void *)) |
383 | { | 383 | { |
384 | struct resource res; | 384 | struct resource res; |
385 | int ret = -1; | 385 | int ret = -EINVAL; |
386 | 386 | ||
387 | while (start < end && | 387 | while (start < end && |
388 | !find_next_iomem_res(start, end, flags, desc, first_lvl, &res)) { | 388 | !find_next_iomem_res(start, end, flags, desc, first_lvl, &res)) { |
@@ -452,6 +452,9 @@ int walk_mem_res(u64 start, u64 end, void *arg, | |||
452 | * This function calls the @func callback against all memory ranges of type | 452 | * This function calls the @func callback against all memory ranges of type |
453 | * System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY. | 453 | * System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY. |
454 | * It is to be used only for System RAM. | 454 | * It is to be used only for System RAM. |
455 | * | ||
456 | * This will find System RAM ranges that are children of top-level resources | ||
457 | * in addition to top-level System RAM resources. | ||
455 | */ | 458 | */ |
456 | int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, | 459 | int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, |
457 | void *arg, int (*func)(unsigned long, unsigned long, void *)) | 460 | void *arg, int (*func)(unsigned long, unsigned long, void *)) |
@@ -460,14 +463,14 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, | |||
460 | unsigned long flags; | 463 | unsigned long flags; |
461 | struct resource res; | 464 | struct resource res; |
462 | unsigned long pfn, end_pfn; | 465 | unsigned long pfn, end_pfn; |
463 | int ret = -1; | 466 | int ret = -EINVAL; |
464 | 467 | ||
465 | start = (u64) start_pfn << PAGE_SHIFT; | 468 | start = (u64) start_pfn << PAGE_SHIFT; |
466 | end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; | 469 | end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; |
467 | flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; | 470 | flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; |
468 | while (start < end && | 471 | while (start < end && |
469 | !find_next_iomem_res(start, end, flags, IORES_DESC_NONE, | 472 | !find_next_iomem_res(start, end, flags, IORES_DESC_NONE, |
470 | true, &res)) { | 473 | false, &res)) { |
471 | pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT; | 474 | pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT; |
472 | end_pfn = (res.end + 1) >> PAGE_SHIFT; | 475 | end_pfn = (res.end + 1) >> PAGE_SHIFT; |
473 | if (end_pfn > pfn) | 476 | if (end_pfn > pfn) |
@@ -1128,6 +1131,15 @@ struct resource * __request_region(struct resource *parent, | |||
1128 | conflict = __request_resource(parent, res); | 1131 | conflict = __request_resource(parent, res); |
1129 | if (!conflict) | 1132 | if (!conflict) |
1130 | break; | 1133 | break; |
1134 | /* | ||
1135 | * mm/hmm.c reserves physical addresses which then | ||
1136 | * become unavailable to other users. Conflicts are | ||
1137 | * not expected. Warn to aid debugging if encountered. | ||
1138 | */ | ||
1139 | if (conflict->desc == IORES_DESC_DEVICE_PRIVATE_MEMORY) { | ||
1140 | pr_warn("Unaddressable device %s %pR conflicts with %pR", | ||
1141 | conflict->name, conflict, res); | ||
1142 | } | ||
1131 | if (conflict != parent) { | 1143 | if (conflict != parent) { |
1132 | if (!(conflict->flags & IORESOURCE_BUSY)) { | 1144 | if (!(conflict->flags & IORESOURCE_BUSY)) { |
1133 | parent = conflict; | 1145 | parent = conflict; |