diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 19:28:08 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 19:28:08 -0400 |
| commit | 179c0ac67b9d947d2de69e9f08a743e7c74a8dce (patch) | |
| tree | 3f3e22af02df6d8e685fb8aa89731f3746306e35 | |
| parent | ad15afb8b9e80bec6c4337369f63207ff59c44ae (diff) | |
| parent | 10cf15e1d1289aa0bf1d26e9f55176b4c7c5c512 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull Sparc fixes from David Miller:
"Hook up the memfd syscall, and properly claim all PCI resources
discovered when building the PCI device tree"
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
sparc: Hook up memfd_create system call.
sparc64: Properly claim resources as each PCI bus is probed.
sparc64: Skip bogus PCI bridge ranges.
sparc64: Expand PCI bridge probing debug logging.
| -rw-r--r-- | arch/sparc/include/uapi/asm/unistd.h | 3 | ||||
| -rw-r--r-- | arch/sparc/kernel/pci.c | 67 | ||||
| -rw-r--r-- | arch/sparc/kernel/systbls_32.S | 2 | ||||
| -rw-r--r-- | arch/sparc/kernel/systbls_64.S | 4 |
4 files changed, 71 insertions, 5 deletions
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h index 886cab456e1b..c842a89b1190 100644 --- a/arch/sparc/include/uapi/asm/unistd.h +++ b/arch/sparc/include/uapi/asm/unistd.h | |||
| @@ -413,8 +413,9 @@ | |||
| 413 | #define __NR_renameat2 345 | 413 | #define __NR_renameat2 345 |
| 414 | #define __NR_seccomp 346 | 414 | #define __NR_seccomp 346 |
| 415 | #define __NR_getrandom 347 | 415 | #define __NR_getrandom 347 |
| 416 | #define __NR_memfd_create 348 | ||
| 416 | 417 | ||
| 417 | #define NR_syscalls 348 | 418 | #define NR_syscalls 349 |
| 418 | 419 | ||
| 419 | /* Bitmask values returned from kern_features system call. */ | 420 | /* Bitmask values returned from kern_features system call. */ |
| 420 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 | 421 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 |
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 539babf00bb2..b36365f49478 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
| @@ -432,6 +432,11 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
| 432 | node->full_name); | 432 | node->full_name); |
| 433 | return; | 433 | return; |
| 434 | } | 434 | } |
| 435 | |||
| 436 | if (ofpci_verbose) | ||
| 437 | printk(" Bridge bus range [%u --> %u]\n", | ||
| 438 | busrange[0], busrange[1]); | ||
| 439 | |||
| 435 | ranges = of_get_property(node, "ranges", &len); | 440 | ranges = of_get_property(node, "ranges", &len); |
| 436 | simba = 0; | 441 | simba = 0; |
| 437 | if (ranges == NULL) { | 442 | if (ranges == NULL) { |
| @@ -451,6 +456,10 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
| 451 | pci_bus_insert_busn_res(bus, busrange[0], busrange[1]); | 456 | pci_bus_insert_busn_res(bus, busrange[0], busrange[1]); |
| 452 | bus->bridge_ctl = 0; | 457 | bus->bridge_ctl = 0; |
| 453 | 458 | ||
| 459 | if (ofpci_verbose) | ||
| 460 | printk(" Bridge ranges[%p] simba[%d]\n", | ||
| 461 | ranges, simba); | ||
| 462 | |||
| 454 | /* parse ranges property, or cook one up by hand for Simba */ | 463 | /* parse ranges property, or cook one up by hand for Simba */ |
| 455 | /* PCI #address-cells == 3 and #size-cells == 2 always */ | 464 | /* PCI #address-cells == 3 and #size-cells == 2 always */ |
| 456 | res = &dev->resource[PCI_BRIDGE_RESOURCES]; | 465 | res = &dev->resource[PCI_BRIDGE_RESOURCES]; |
| @@ -468,10 +477,29 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
| 468 | } | 477 | } |
| 469 | i = 1; | 478 | i = 1; |
| 470 | for (; len >= 32; len -= 32, ranges += 8) { | 479 | for (; len >= 32; len -= 32, ranges += 8) { |
| 480 | u64 start; | ||
| 481 | |||
| 482 | if (ofpci_verbose) | ||
| 483 | printk(" RAW Range[%08x:%08x:%08x:%08x:%08x:%08x:" | ||
| 484 | "%08x:%08x]\n", | ||
| 485 | ranges[0], ranges[1], ranges[2], ranges[3], | ||
| 486 | ranges[4], ranges[5], ranges[6], ranges[7]); | ||
| 487 | |||
| 471 | flags = pci_parse_of_flags(ranges[0]); | 488 | flags = pci_parse_of_flags(ranges[0]); |
| 472 | size = GET_64BIT(ranges, 6); | 489 | size = GET_64BIT(ranges, 6); |
| 473 | if (flags == 0 || size == 0) | 490 | if (flags == 0 || size == 0) |
| 474 | continue; | 491 | continue; |
| 492 | |||
| 493 | /* On PCI-Express systems, PCI bridges that have no devices downstream | ||
| 494 | * have a bogus size value where the first 32-bit cell is 0xffffffff. | ||
| 495 | * This results in a bogus range where start + size overflows. | ||
| 496 | * | ||
| 497 | * Just skip these otherwise the kernel will complain when the resource | ||
| 498 | * tries to be claimed. | ||
| 499 | */ | ||
| 500 | if (size >> 32 == 0xffffffff) | ||
| 501 | continue; | ||
| 502 | |||
| 475 | if (flags & IORESOURCE_IO) { | 503 | if (flags & IORESOURCE_IO) { |
| 476 | res = bus->resource[0]; | 504 | res = bus->resource[0]; |
| 477 | if (res->flags) { | 505 | if (res->flags) { |
| @@ -490,8 +518,13 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
| 490 | } | 518 | } |
| 491 | 519 | ||
| 492 | res->flags = flags; | 520 | res->flags = flags; |
| 493 | region.start = GET_64BIT(ranges, 1); | 521 | region.start = start = GET_64BIT(ranges, 1); |
| 494 | region.end = region.start + size - 1; | 522 | region.end = region.start + size - 1; |
| 523 | |||
| 524 | if (ofpci_verbose) | ||
| 525 | printk(" Using flags[%08x] start[%016llx] size[%016llx]\n", | ||
| 526 | flags, start, size); | ||
| 527 | |||
| 495 | pcibios_bus_to_resource(dev->bus, res, ®ion); | 528 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
| 496 | } | 529 | } |
| 497 | after_ranges: | 530 | after_ranges: |
| @@ -584,6 +617,36 @@ static void pci_bus_register_of_sysfs(struct pci_bus *bus) | |||
| 584 | pci_bus_register_of_sysfs(child_bus); | 617 | pci_bus_register_of_sysfs(child_bus); |
| 585 | } | 618 | } |
| 586 | 619 | ||
| 620 | static void pci_claim_bus_resources(struct pci_bus *bus) | ||
| 621 | { | ||
| 622 | struct pci_bus *child_bus; | ||
| 623 | struct pci_dev *dev; | ||
| 624 | |||
| 625 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
| 626 | int i; | ||
| 627 | |||
| 628 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
| 629 | struct resource *r = &dev->resource[i]; | ||
| 630 | |||
| 631 | if (r->parent || !r->start || !r->flags) | ||
| 632 | continue; | ||
| 633 | |||
| 634 | if (ofpci_verbose) | ||
| 635 | printk("PCI: Claiming %s: " | ||
| 636 | "Resource %d: %016llx..%016llx [%x]\n", | ||
| 637 | pci_name(dev), i, | ||
| 638 | (unsigned long long)r->start, | ||
| 639 | (unsigned long long)r->end, | ||
| 640 | (unsigned int)r->flags); | ||
| 641 | |||
| 642 | pci_claim_resource(dev, i); | ||
| 643 | } | ||
| 644 | } | ||
| 645 | |||
| 646 | list_for_each_entry(child_bus, &bus->children, node) | ||
| 647 | pci_claim_bus_resources(child_bus); | ||
| 648 | } | ||
| 649 | |||
| 587 | struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, | 650 | struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, |
| 588 | struct device *parent) | 651 | struct device *parent) |
| 589 | { | 652 | { |
| @@ -614,6 +677,8 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, | |||
| 614 | pci_bus_add_devices(bus); | 677 | pci_bus_add_devices(bus); |
| 615 | pci_bus_register_of_sysfs(bus); | 678 | pci_bus_register_of_sysfs(bus); |
| 616 | 679 | ||
| 680 | pci_claim_bus_resources(bus); | ||
| 681 | |||
| 617 | return bus; | 682 | return bus; |
| 618 | } | 683 | } |
| 619 | 684 | ||
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 217893e18d78..6a873c344bc0 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S | |||
| @@ -86,4 +86,4 @@ sys_call_table: | |||
| 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
| 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
| 88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
| 89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom | 89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create |
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index d93b49d1b420..d9151b6490d8 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
| @@ -87,7 +87,7 @@ sys_call_table32: | |||
| 87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime | 87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime |
| 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev | 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev |
| 89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
| 90 | .word sys32_renameat2, sys_seccomp, sys_getrandom | 90 | .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create |
| 91 | 91 | ||
| 92 | #endif /* CONFIG_COMPAT */ | 92 | #endif /* CONFIG_COMPAT */ |
| 93 | 93 | ||
| @@ -166,4 +166,4 @@ sys_call_table: | |||
| 166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
| 167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
| 168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
| 169 | .word sys_renameat2, sys_seccomp, sys_getrandom | 169 | .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create |
