Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'parisc-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc updates from Helge Deller:
"Highlights:

- one important fix from Dave to prevent kernel crash when userspace
hands over invalid values to our in-kernel CAS implementation.

- added CPU topology support, including multi-core scheduler support
on PA8900 CPUs

Minor changes:

- minor fixes for sparse (from Luc)

- drop duplicates for CPU_BIG_ENDIAN from parisc and sparc top
Kconfig files (from Babu)

- reorganized parisc PDC (firmware-access) header files for usage
from userspace. Required for upcoming qemu parisc emulator and
SeaBIOS fork to support parisc"

* 'parisc-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
arch: Fix duplicates in Kconfig for parisc and sparc
parisc: Make some PDC structures accessible in uapi headers
parisc: Pass endianness info to sparse
parisc: Add CPU topology support
parisc: Fix validity check of pointer size argument in new CAS implementation

+454 -299
+16 -3
arch/parisc/Kconfig
··· 32 32 select GENERIC_PCI_IOMAP 33 33 select ARCH_HAVE_NMI_SAFE_CMPXCHG 34 34 select GENERIC_SMP_IDLE_THREAD 35 + select GENERIC_CPU_DEVICES 35 36 select GENERIC_STRNCPY_FROM_USER 36 37 select SYSCTL_ARCH_UNALIGN_ALLOW 37 38 select SYSCTL_EXCEPTION_TRACE ··· 57 56 in many of their workstations & servers (HP9000 700 and 800 series, 58 57 and later HP3000 series). The PA-RISC Linux project home page is 59 58 at <http://www.parisc-linux.org/>. 60 - 61 - config CPU_BIG_ENDIAN 62 - def_bool y 63 59 64 60 config CPU_BIG_ENDIAN 65 61 def_bool y ··· 285 287 available at <http://www.tldp.org/docs.html#howto>. 286 288 287 289 If you don't know what to do here, say N. 290 + 291 + config PARISC_CPU_TOPOLOGY 292 + bool "Support cpu topology definition" 293 + depends on SMP 294 + default y 295 + help 296 + Support PARISC cpu topology definition. 297 + 298 + config SCHED_MC 299 + bool "Multi-core scheduler support" 300 + depends on PARISC_CPU_TOPOLOGY && PA8X00 301 + help 302 + Multi-core scheduler support improves the CPU scheduler's decision 303 + making when dealing with multi-core CPU chips at a cost of slightly 304 + increased overhead in some places. If unsure say N here. 288 305 289 306 config IRQSTACKS 290 307 bool "Use separate kernel stacks when processing interrupts"
+1 -1
arch/parisc/Makefile
··· 22 22 KBUILD_DEFCONFIG := default_defconfig 23 23 24 24 NM = sh $(srctree)/arch/parisc/nm 25 - CHECKFLAGS += -D__hppa__=1 25 + CHECKFLAGS += -D__hppa__=1 -mbig-endian 26 26 LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 27 27 export LIBGCC 28 28
-255
arch/parisc/include/asm/pdc.h
··· 18 18 #define PDC_TYPE_SYSTEM_MAP 1 /* 32-bit, but supports PDC_SYSTEM_MAP */ 19 19 #define PDC_TYPE_SNAKE 2 /* Doesn't support SYSTEM_MAP */ 20 20 21 - struct pdc_chassis_info { /* for PDC_CHASSIS_INFO */ 22 - unsigned long actcnt; /* actual number of bytes returned */ 23 - unsigned long maxcnt; /* maximum number of bytes that could be returned */ 24 - }; 25 - 26 - struct pdc_coproc_cfg { /* for PDC_COPROC_CFG */ 27 - unsigned long ccr_functional; 28 - unsigned long ccr_present; 29 - unsigned long revision; 30 - unsigned long model; 31 - }; 32 - 33 - struct pdc_model { /* for PDC_MODEL */ 34 - unsigned long hversion; 35 - unsigned long sversion; 36 - unsigned long hw_id; 37 - unsigned long boot_id; 38 - unsigned long sw_id; 39 - unsigned long sw_cap; 40 - unsigned long arch_rev; 41 - unsigned long pot_key; 42 - unsigned long curr_key; 43 - }; 44 - 45 - struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */ 46 - unsigned long 47 - #ifdef CONFIG_64BIT 48 - cc_padW:32, 49 - #endif 50 - cc_alias: 4, /* alias boundaries for virtual addresses */ 51 - cc_block: 4, /* to determine most efficient stride */ 52 - cc_line : 3, /* maximum amount written back as a result of store (multiple of 16 bytes) */ 53 - cc_shift: 2, /* how much to shift cc_block left */ 54 - cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */ 55 - cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */ 56 - cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */ 57 - cc_pad1 : 10, /* reserved */ 58 - cc_hv : 3; /* hversion dependent */ 59 - }; 60 - 61 - struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */ 62 - unsigned long tc_pad0:12, /* reserved */ 63 - #ifdef CONFIG_64BIT 64 - tc_padW:32, 65 - #endif 66 - tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */ 67 - tc_hv : 1, /* HV */ 68 - tc_page : 1, /* 0 = 2K page-size-machine, 1 = 4k page size */ 69 - tc_cst : 3, /* 0 = incoherent operations, else coherent operations */ 70 - tc_aid : 5, /* ITLB: width of access ids of processor (encoded!) */ 71 - tc_sr : 8; /* ITLB: width of space-registers (encoded) */ 72 - }; 73 - 74 - struct pdc_cache_info { /* main-PDC_CACHE-structure (caches & TLB's) */ 75 - /* I-cache */ 76 - unsigned long ic_size; /* size in bytes */ 77 - struct pdc_cache_cf ic_conf; /* configuration */ 78 - unsigned long ic_base; /* base-addr */ 79 - unsigned long ic_stride; 80 - unsigned long ic_count; 81 - unsigned long ic_loop; 82 - /* D-cache */ 83 - unsigned long dc_size; /* size in bytes */ 84 - struct pdc_cache_cf dc_conf; /* configuration */ 85 - unsigned long dc_base; /* base-addr */ 86 - unsigned long dc_stride; 87 - unsigned long dc_count; 88 - unsigned long dc_loop; 89 - /* Instruction-TLB */ 90 - unsigned long it_size; /* number of entries in I-TLB */ 91 - struct pdc_tlb_cf it_conf; /* I-TLB-configuration */ 92 - unsigned long it_sp_base; 93 - unsigned long it_sp_stride; 94 - unsigned long it_sp_count; 95 - unsigned long it_off_base; 96 - unsigned long it_off_stride; 97 - unsigned long it_off_count; 98 - unsigned long it_loop; 99 - /* data-TLB */ 100 - unsigned long dt_size; /* number of entries in D-TLB */ 101 - struct pdc_tlb_cf dt_conf; /* D-TLB-configuration */ 102 - unsigned long dt_sp_base; 103 - unsigned long dt_sp_stride; 104 - unsigned long dt_sp_count; 105 - unsigned long dt_off_base; 106 - unsigned long dt_off_stride; 107 - unsigned long dt_off_count; 108 - unsigned long dt_loop; 109 - }; 110 - 111 - #if 0 112 - /* If you start using the next struct, you'll have to adjust it to 113 - * work with 64-bit firmware I think -PB 114 - */ 115 - struct pdc_iodc { /* PDC_IODC */ 116 - unsigned char hversion_model; 117 - unsigned char hversion; 118 - unsigned char spa; 119 - unsigned char type; 120 - unsigned int sversion_rev:4; 121 - unsigned int sversion_model:19; 122 - unsigned int sversion_opt:8; 123 - unsigned char rev; 124 - unsigned char dep; 125 - unsigned char features; 126 - unsigned char pad1; 127 - unsigned int checksum:16; 128 - unsigned int length:16; 129 - unsigned int pad[15]; 130 - } __attribute__((aligned(8))) ; 131 - #endif 132 - 133 - #ifndef CONFIG_PA20 134 - /* no BLTBs in pa2.0 processors */ 135 - struct pdc_btlb_info_range { 136 - __u8 res00; 137 - __u8 num_i; 138 - __u8 num_d; 139 - __u8 num_comb; 140 - }; 141 - 142 - struct pdc_btlb_info { /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */ 143 - unsigned int min_size; /* minimum size of BTLB in pages */ 144 - unsigned int max_size; /* maximum size of BTLB in pages */ 145 - struct pdc_btlb_info_range fixed_range_info; 146 - struct pdc_btlb_info_range variable_range_info; 147 - }; 148 - 149 - #endif /* !CONFIG_PA20 */ 150 - 151 - struct pdc_mem_retinfo { /* PDC_MEM/PDC_MEM_MEMINFO (return info) */ 152 - unsigned long pdt_size; 153 - unsigned long pdt_entries; 154 - unsigned long pdt_status; 155 - unsigned long first_dbe_loc; 156 - unsigned long good_mem; 157 - }; 158 - 159 - struct pdc_mem_read_pdt { /* PDC_MEM/PDC_MEM_READ_PDT (return info) */ 160 - unsigned long pdt_entries; 161 - }; 162 - 163 - #ifdef CONFIG_64BIT 164 - struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */ 165 - unsigned long entries_returned; 166 - unsigned long entries_total; 167 - }; 168 - 169 - struct pdc_memory_table { /* PDC_MEM/PDC_MEM_TABLE (arguments) */ 170 - unsigned long paddr; 171 - unsigned int pages; 172 - unsigned int reserved; 173 - }; 174 - #endif /* CONFIG_64BIT */ 175 - 176 - struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */ 177 - unsigned long mod_addr; 178 - unsigned long mod_pgs; 179 - unsigned long add_addrs; 180 - }; 181 - 182 - struct pdc_system_map_addr_info { /* PDC_SYSTEM_MAP/FIND_ADDRESS */ 183 - unsigned long mod_addr; 184 - unsigned long mod_pgs; 185 - }; 186 - 187 - struct pdc_initiator { /* PDC_INITIATOR */ 188 - int host_id; 189 - int factor; 190 - int width; 191 - int mode; 192 - }; 193 - 194 - struct hardware_path { 195 - char flags; /* see bit definitions below */ 196 - char bc[6]; /* Bus Converter routing info to a specific */ 197 - /* I/O adaptor (< 0 means none, > 63 resvd) */ 198 - char mod; /* fixed field of specified module */ 199 - }; 200 - 201 - /* 202 - * Device path specifications used by PDC. 203 - */ 204 - struct pdc_module_path { 205 - struct hardware_path path; 206 - unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */ 207 - }; 208 - 209 - #ifndef CONFIG_PA20 210 - /* Only used on some pre-PA2.0 boxes */ 211 - struct pdc_memory_map { /* PDC_MEMORY_MAP */ 212 - unsigned long hpa; /* mod's register set address */ 213 - unsigned long more_pgs; /* number of additional I/O pgs */ 214 - }; 215 - #endif 216 - 217 - struct pdc_tod { 218 - unsigned long tod_sec; 219 - unsigned long tod_usec; 220 - }; 221 - 222 - /* architected results from PDC_PIM/transfer hpmc on a PA1.1 machine */ 223 - 224 - struct pdc_hpmc_pim_11 { /* PDC_PIM */ 225 - __u32 gr[32]; 226 - __u32 cr[32]; 227 - __u32 sr[8]; 228 - __u32 iasq_back; 229 - __u32 iaoq_back; 230 - __u32 check_type; 231 - __u32 cpu_state; 232 - __u32 rsvd1; 233 - __u32 cache_check; 234 - __u32 tlb_check; 235 - __u32 bus_check; 236 - __u32 assists_check; 237 - __u32 rsvd2; 238 - __u32 assist_state; 239 - __u32 responder_addr; 240 - __u32 requestor_addr; 241 - __u32 path_info; 242 - __u64 fr[32]; 243 - }; 244 - 245 - /* 246 - * architected results from PDC_PIM/transfer hpmc on a PA2.0 machine 247 - * 248 - * Note that PDC_PIM doesn't care whether or not wide mode was enabled 249 - * so the results are different on PA1.1 vs. PA2.0 when in narrow mode. 250 - * 251 - * Note also that there are unarchitected results available, which 252 - * are hversion dependent. Do a "ser pim 0 hpmc" after rebooting, since 253 - * the firmware is probably the best way of printing hversion dependent 254 - * data. 255 - */ 256 - 257 - struct pdc_hpmc_pim_20 { /* PDC_PIM */ 258 - __u64 gr[32]; 259 - __u64 cr[32]; 260 - __u64 sr[8]; 261 - __u64 iasq_back; 262 - __u64 iaoq_back; 263 - __u32 check_type; 264 - __u32 cpu_state; 265 - __u32 cache_check; 266 - __u32 tlb_check; 267 - __u32 bus_check; 268 - __u32 assists_check; 269 - __u32 assist_state; 270 - __u32 path_info; 271 - __u64 responder_addr; 272 - __u64 requestor_addr; 273 - __u64 fr[32]; 274 - }; 275 - 276 21 void pdc_console_init(void); /* in pdc_console.c */ 277 22 void pdc_console_restart(void); 278 23
+36
arch/parisc/include/asm/topology.h
··· 1 + #ifndef _ASM_PARISC_TOPOLOGY_H 2 + #define _ASM_PARISC_TOPOLOGY_H 3 + 4 + #ifdef CONFIG_PARISC_CPU_TOPOLOGY 5 + 6 + #include <linux/cpumask.h> 7 + 8 + struct cputopo_parisc { 9 + int thread_id; 10 + int core_id; 11 + int socket_id; 12 + cpumask_t thread_sibling; 13 + cpumask_t core_sibling; 14 + }; 15 + 16 + extern struct cputopo_parisc cpu_topology[NR_CPUS]; 17 + 18 + #define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id) 19 + #define topology_core_id(cpu) (cpu_topology[cpu].core_id) 20 + #define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling) 21 + #define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling) 22 + 23 + void init_cpu_topology(void); 24 + void store_cpu_topology(unsigned int cpuid); 25 + const struct cpumask *cpu_coregroup_mask(int cpu); 26 + 27 + #else 28 + 29 + static inline void init_cpu_topology(void) { } 30 + static inline void store_cpu_topology(unsigned int cpuid) { } 31 + 32 + #endif 33 + 34 + #include <asm-generic/topology.h> 35 + 36 + #endif /* _ASM_ARM_TOPOLOGY_H */
+250 -6
arch/parisc/include/uapi/asm/pdc.h
··· 16 16 #define PDC_ERROR -3 /* Call could not complete without an error */ 17 17 #define PDC_NE_MOD -5 /* Module not found */ 18 18 #define PDC_NE_CELL_MOD -7 /* Cell module not found */ 19 + #define PDC_NE_BOOTDEV -9 /* Cannot locate a console device or boot device */ 19 20 #define PDC_INVALID_ARG -10 /* Called with an invalid argument */ 20 21 #define PDC_BUS_POW_WARN -12 /* Call could not complete in allowed power budget */ 21 22 #define PDC_NOT_NARROW -17 /* Narrow mode not supported */ ··· 341 340 342 341 #if !defined(__ASSEMBLY__) 343 342 344 - #include <linux/types.h> 345 - 346 - 347 343 /* flags of the device_path */ 348 344 #define PF_AUTOBOOT 0x80 349 345 #define PF_AUTOSEARCH 0x40 ··· 416 418 int pad430[116]; 417 419 418 420 /* [0x600] processor dependent */ 419 - __u32 pad600[1]; 420 - __u32 proc_sti; /* pointer to STI ROM */ 421 - __u32 pad608[126]; 421 + unsigned int pad600[1]; 422 + unsigned int proc_sti; /* pointer to STI ROM */ 423 + unsigned int pad608[126]; 424 + }; 425 + 426 + struct pdc_chassis_info { /* for PDC_CHASSIS_INFO */ 427 + unsigned long actcnt; /* actual number of bytes returned */ 428 + unsigned long maxcnt; /* maximum number of bytes that could be returned */ 429 + }; 430 + 431 + struct pdc_coproc_cfg { /* for PDC_COPROC_CFG */ 432 + unsigned long ccr_functional; 433 + unsigned long ccr_present; 434 + unsigned long revision; 435 + unsigned long model; 436 + }; 437 + 438 + struct pdc_model { /* for PDC_MODEL */ 439 + unsigned long hversion; 440 + unsigned long sversion; 441 + unsigned long hw_id; 442 + unsigned long boot_id; 443 + unsigned long sw_id; 444 + unsigned long sw_cap; 445 + unsigned long arch_rev; 446 + unsigned long pot_key; 447 + unsigned long curr_key; 448 + }; 449 + 450 + struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */ 451 + unsigned long 452 + #ifdef __LP64__ 453 + cc_padW:32, 454 + #endif 455 + cc_alias: 4, /* alias boundaries for virtual addresses */ 456 + cc_block: 4, /* to determine most efficient stride */ 457 + cc_line : 3, /* maximum amount written back as a result of store (multiple of 16 bytes) */ 458 + cc_shift: 2, /* how much to shift cc_block left */ 459 + cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */ 460 + cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */ 461 + cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */ 462 + cc_pad1 : 10, /* reserved */ 463 + cc_hv : 3; /* hversion dependent */ 464 + }; 465 + 466 + struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */ 467 + unsigned long tc_pad0:12, /* reserved */ 468 + #ifdef __LP64__ 469 + tc_padW:32, 470 + #endif 471 + tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */ 472 + tc_hv : 1, /* HV */ 473 + tc_page : 1, /* 0 = 2K page-size-machine, 1 = 4k page size */ 474 + tc_cst : 3, /* 0 = incoherent operations, else coherent operations */ 475 + tc_aid : 5, /* ITLB: width of access ids of processor (encoded!) */ 476 + tc_sr : 8; /* ITLB: width of space-registers (encoded) */ 477 + }; 478 + 479 + struct pdc_cache_info { /* main-PDC_CACHE-structure (caches & TLB's) */ 480 + /* I-cache */ 481 + unsigned long ic_size; /* size in bytes */ 482 + struct pdc_cache_cf ic_conf; /* configuration */ 483 + unsigned long ic_base; /* base-addr */ 484 + unsigned long ic_stride; 485 + unsigned long ic_count; 486 + unsigned long ic_loop; 487 + /* D-cache */ 488 + unsigned long dc_size; /* size in bytes */ 489 + struct pdc_cache_cf dc_conf; /* configuration */ 490 + unsigned long dc_base; /* base-addr */ 491 + unsigned long dc_stride; 492 + unsigned long dc_count; 493 + unsigned long dc_loop; 494 + /* Instruction-TLB */ 495 + unsigned long it_size; /* number of entries in I-TLB */ 496 + struct pdc_tlb_cf it_conf; /* I-TLB-configuration */ 497 + unsigned long it_sp_base; 498 + unsigned long it_sp_stride; 499 + unsigned long it_sp_count; 500 + unsigned long it_off_base; 501 + unsigned long it_off_stride; 502 + unsigned long it_off_count; 503 + unsigned long it_loop; 504 + /* data-TLB */ 505 + unsigned long dt_size; /* number of entries in D-TLB */ 506 + struct pdc_tlb_cf dt_conf; /* D-TLB-configuration */ 507 + unsigned long dt_sp_base; 508 + unsigned long dt_sp_stride; 509 + unsigned long dt_sp_count; 510 + unsigned long dt_off_base; 511 + unsigned long dt_off_stride; 512 + unsigned long dt_off_count; 513 + unsigned long dt_loop; 514 + }; 515 + 516 + /* Might need adjustment to work with 64-bit firmware */ 517 + struct pdc_iodc { /* PDC_IODC */ 518 + unsigned char hversion_model; 519 + unsigned char hversion; 520 + unsigned char spa; 521 + unsigned char type; 522 + unsigned int sversion_rev:4; 523 + unsigned int sversion_model:19; 524 + unsigned int sversion_opt:8; 525 + unsigned char rev; 526 + unsigned char dep; 527 + unsigned char features; 528 + unsigned char pad1; 529 + unsigned int checksum:16; 530 + unsigned int length:16; 531 + unsigned int pad[15]; 532 + } __attribute__((aligned(8))) ; 533 + 534 + /* no BLTBs in pa2.0 processors */ 535 + struct pdc_btlb_info_range { 536 + unsigned char res00; 537 + unsigned char num_i; 538 + unsigned char num_d; 539 + unsigned char num_comb; 540 + }; 541 + 542 + struct pdc_btlb_info { /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */ 543 + unsigned int min_size; /* minimum size of BTLB in pages */ 544 + unsigned int max_size; /* maximum size of BTLB in pages */ 545 + struct pdc_btlb_info_range fixed_range_info; 546 + struct pdc_btlb_info_range variable_range_info; 547 + }; 548 + 549 + struct pdc_mem_retinfo { /* PDC_MEM/PDC_MEM_MEMINFO (return info) */ 550 + unsigned long pdt_size; 551 + unsigned long pdt_entries; 552 + unsigned long pdt_status; 553 + unsigned long first_dbe_loc; 554 + unsigned long good_mem; 555 + }; 556 + 557 + struct pdc_mem_read_pdt { /* PDC_MEM/PDC_MEM_READ_PDT (return info) */ 558 + unsigned long pdt_entries; 559 + }; 560 + 561 + #ifdef __LP64__ 562 + struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */ 563 + unsigned long entries_returned; 564 + unsigned long entries_total; 565 + }; 566 + 567 + struct pdc_memory_table { /* PDC_MEM/PDC_MEM_TABLE (arguments) */ 568 + unsigned long paddr; 569 + unsigned int pages; 570 + unsigned int reserved; 571 + }; 572 + #endif /* __LP64__ */ 573 + 574 + struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */ 575 + unsigned long mod_addr; 576 + unsigned long mod_pgs; 577 + unsigned long add_addrs; 578 + }; 579 + 580 + struct pdc_system_map_addr_info { /* PDC_SYSTEM_MAP/FIND_ADDRESS */ 581 + unsigned long mod_addr; 582 + unsigned long mod_pgs; 583 + }; 584 + 585 + struct pdc_initiator { /* PDC_INITIATOR */ 586 + int host_id; 587 + int factor; 588 + int width; 589 + int mode; 590 + }; 591 + 592 + struct hardware_path { 593 + char flags; /* see bit definitions below */ 594 + char bc[6]; /* Bus Converter routing info to a specific */ 595 + /* I/O adaptor (< 0 means none, > 63 resvd) */ 596 + char mod; /* fixed field of specified module */ 597 + }; 598 + 599 + /* 600 + * Device path specifications used by PDC. 601 + */ 602 + struct pdc_module_path { 603 + struct hardware_path path; 604 + unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */ 605 + }; 606 + 607 + /* Only used on some pre-PA2.0 boxes */ 608 + struct pdc_memory_map { /* PDC_MEMORY_MAP */ 609 + unsigned long hpa; /* mod's register set address */ 610 + unsigned long more_pgs; /* number of additional I/O pgs */ 611 + }; 612 + 613 + struct pdc_tod { 614 + unsigned long tod_sec; 615 + unsigned long tod_usec; 616 + }; 617 + 618 + /* architected results from PDC_PIM/transfer hpmc on a PA1.1 machine */ 619 + 620 + struct pdc_hpmc_pim_11 { /* PDC_PIM */ 621 + unsigned int gr[32]; 622 + unsigned int cr[32]; 623 + unsigned int sr[8]; 624 + unsigned int iasq_back; 625 + unsigned int iaoq_back; 626 + unsigned int check_type; 627 + unsigned int cpu_state; 628 + unsigned int rsvd1; 629 + unsigned int cache_check; 630 + unsigned int tlb_check; 631 + unsigned int bus_check; 632 + unsigned int assists_check; 633 + unsigned int rsvd2; 634 + unsigned int assist_state; 635 + unsigned int responder_addr; 636 + unsigned int requestor_addr; 637 + unsigned int path_info; 638 + unsigned long long fr[32]; 639 + }; 640 + 641 + /* 642 + * architected results from PDC_PIM/transfer hpmc on a PA2.0 machine 643 + * 644 + * Note that PDC_PIM doesn't care whether or not wide mode was enabled 645 + * so the results are different on PA1.1 vs. PA2.0 when in narrow mode. 646 + * 647 + * Note also that there are unarchitected results available, which 648 + * are hversion dependent. Do a "ser pim 0 hpmc" after rebooting, since 649 + * the firmware is probably the best way of printing hversion dependent 650 + * data. 651 + */ 652 + 653 + struct pdc_hpmc_pim_20 { /* PDC_PIM */ 654 + unsigned long long gr[32]; 655 + unsigned long long cr[32]; 656 + unsigned long long sr[8]; 657 + unsigned long long iasq_back; 658 + unsigned long long iaoq_back; 659 + unsigned int check_type; 660 + unsigned int cpu_state; 661 + unsigned int cache_check; 662 + unsigned int tlb_check; 663 + unsigned int bus_check; 664 + unsigned int assists_check; 665 + unsigned int assist_state; 666 + unsigned int path_info; 667 + unsigned long long responder_addr; 668 + unsigned long long requestor_addr; 669 + unsigned long long fr[32]; 422 670 }; 423 671 424 672 #endif /* !defined(__ASSEMBLY__) */
+2 -2
arch/parisc/kernel/Makefile
··· 9 9 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ 10 10 ptrace.o hardware.o inventory.o drivers.o \ 11 11 signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \ 12 - process.o processor.o pdc_cons.o pdc_chassis.o unwind.o \ 13 - topology.o 12 + process.o processor.o pdc_cons.o pdc_chassis.o unwind.o 14 13 15 14 ifdef CONFIG_FUNCTION_TRACER 16 15 # Do not profile debug and lowlevel utilities ··· 29 30 obj64-$(CONFIG_AUDIT) += compat_audit.o 30 31 # only supported for PCX-W/U in 64-bit mode at the moment 31 32 obj-$(CONFIG_64BIT) += perf.o perf_asm.o $(obj64-y) 33 + obj-$(CONFIG_PARISC_CPU_TOPOLOGY) += topology.o 32 34 obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o 33 35 obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
+13
arch/parisc/kernel/processor.c
··· 184 184 p->txn_addr = txn_addr; /* save CPU IRQ address */ 185 185 p->cpu_num = cpu_info.cpu_num; 186 186 p->cpu_loc = cpu_info.cpu_loc; 187 + 188 + store_cpu_topology(cpuid); 189 + 187 190 #ifdef CONFIG_SMP 188 191 /* 189 192 ** FIXME: review if any other initialization is clobbered ··· 328 325 set_firmware_width(); 329 326 ret = pdc_coproc_cfg(&coproc_cfg); 330 327 328 + store_cpu_topology(cpunum); 329 + 331 330 if(ret >= 0 && coproc_cfg.ccr_functional) { 332 331 mtctl(coproc_cfg.ccr_functional, 10); /* 10 == Coprocessor Control Reg */ 333 332 ··· 392 387 seq_printf(m, "cpu MHz\t\t: %d.%06d\n", 393 388 boot_cpu_data.cpu_hz / 1000000, 394 389 boot_cpu_data.cpu_hz % 1000000 ); 390 + 391 + #ifdef CONFIG_PARISC_CPU_TOPOLOGY 392 + seq_printf(m, "physical id\t: %d\n", 393 + topology_physical_package_id(cpu)); 394 + seq_printf(m, "siblings\t: %d\n", 395 + cpumask_weight(topology_core_cpumask(cpu))); 396 + seq_printf(m, "core id\t\t: %d\n", topology_core_id(cpu)); 397 + #endif 395 398 396 399 seq_printf(m, "capabilities\t:"); 397 400 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32)
+2
arch/parisc/kernel/setup.c
··· 408 408 409 409 cpunum = smp_processor_id(); 410 410 411 + init_cpu_topology(); 412 + 411 413 set_firmware_width_unlocked(); 412 414 413 415 ret = pdc_coproc_cfg_unlocked(&coproc_cfg);
+3 -3
arch/parisc/kernel/syscall.S
··· 690 690 /* ELF32 Process entry path */ 691 691 lws_compare_and_swap_2: 692 692 #ifdef CONFIG_64BIT 693 - /* Clip the input registers */ 693 + /* Clip the input registers. We don't need to clip %r23 as we 694 + only use it for word operations */ 694 695 depdi 0, 31, 32, %r26 695 696 depdi 0, 31, 32, %r25 696 697 depdi 0, 31, 32, %r24 697 - depdi 0, 31, 32, %r23 698 698 #endif 699 699 700 700 /* Check the validity of the size pointer */ 701 - subi,>>= 4, %r23, %r0 701 + subi,>>= 3, %r23, %r0 702 702 b,n lws_exit_nosys 703 703 704 704 /* Jump to the functions which will load the old and new values into
+131 -26
arch/parisc/kernel/topology.c
··· 1 1 /* 2 - * arch/parisc/kernel/topology.c - Populate sysfs with topology information 2 + * arch/parisc/kernel/topology.c 3 3 * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License as published by 6 - * the Free Software Foundation; either version 2 of the License, or 7 - * (at your option) any later version. 4 + * Copyright (C) 2017 Helge Deller <deller@gmx.de> 8 5 * 9 - * This program is distributed in the hope that it will be useful, but 10 - * WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 12 - * NON INFRINGEMENT. See the GNU General Public License for more 13 - * details. 6 + * based on arch/arm/kernel/topology.c 14 7 * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 8 + * This file is subject to the terms and conditions of the GNU General Public 9 + * License. See the file "COPYING" in the main directory of this archive 10 + * for more details. 18 11 */ 19 12 20 - #include <linux/init.h> 21 - #include <linux/smp.h> 22 - #include <linux/cpu.h> 23 - #include <linux/cache.h> 13 + #include <linux/percpu.h> 14 + #include <linux/sched.h> 15 + #include <linux/sched/topology.h> 24 16 25 - static DEFINE_PER_CPU(struct cpu, cpu_devices); 17 + #include <asm/topology.h> 26 18 27 - static int __init topology_init(void) 19 + /* 20 + * cpu topology table 21 + */ 22 + struct cputopo_parisc cpu_topology[NR_CPUS] __read_mostly; 23 + EXPORT_SYMBOL_GPL(cpu_topology); 24 + 25 + const struct cpumask *cpu_coregroup_mask(int cpu) 28 26 { 29 - int num; 30 - 31 - for_each_present_cpu(num) { 32 - register_cpu(&per_cpu(cpu_devices, num), num); 33 - } 34 - return 0; 27 + return &cpu_topology[cpu].core_sibling; 35 28 } 36 29 37 - subsys_initcall(topology_init); 30 + static void update_siblings_masks(unsigned int cpuid) 31 + { 32 + struct cputopo_parisc *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; 33 + int cpu; 34 + 35 + /* update core and thread sibling masks */ 36 + for_each_possible_cpu(cpu) { 37 + cpu_topo = &cpu_topology[cpu]; 38 + 39 + if (cpuid_topo->socket_id != cpu_topo->socket_id) 40 + continue; 41 + 42 + cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); 43 + if (cpu != cpuid) 44 + cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); 45 + 46 + if (cpuid_topo->core_id != cpu_topo->core_id) 47 + continue; 48 + 49 + cpumask_set_cpu(cpuid, &cpu_topo->thread_sibling); 50 + if (cpu != cpuid) 51 + cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling); 52 + } 53 + smp_wmb(); 54 + } 55 + 56 + static int dualcores_found __initdata; 57 + 58 + /* 59 + * store_cpu_topology is called at boot when only one cpu is running 60 + * and with the mutex cpu_hotplug.lock locked, when several cpus have booted, 61 + * which prevents simultaneous write access to cpu_topology array 62 + */ 63 + void __init store_cpu_topology(unsigned int cpuid) 64 + { 65 + struct cputopo_parisc *cpuid_topo = &cpu_topology[cpuid]; 66 + struct cpuinfo_parisc *p; 67 + int max_socket = -1; 68 + unsigned long cpu; 69 + 70 + /* If the cpu topology has been already set, just return */ 71 + if (cpuid_topo->core_id != -1) 72 + return; 73 + 74 + /* create cpu topology mapping */ 75 + cpuid_topo->thread_id = -1; 76 + cpuid_topo->core_id = 0; 77 + 78 + p = &per_cpu(cpu_data, cpuid); 79 + for_each_online_cpu(cpu) { 80 + const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu); 81 + 82 + if (cpu == cpuid) /* ignore current cpu */ 83 + continue; 84 + 85 + if (cpuinfo->cpu_loc == p->cpu_loc) { 86 + cpuid_topo->core_id = cpu_topology[cpu].core_id; 87 + if (p->cpu_loc) { 88 + cpuid_topo->core_id++; 89 + cpuid_topo->socket_id = cpu_topology[cpu].socket_id; 90 + dualcores_found = 1; 91 + continue; 92 + } 93 + } 94 + 95 + if (cpuid_topo->socket_id == -1) 96 + max_socket = max(max_socket, cpu_topology[cpu].socket_id); 97 + } 98 + 99 + if (cpuid_topo->socket_id == -1) 100 + cpuid_topo->socket_id = max_socket + 1; 101 + 102 + update_siblings_masks(cpuid); 103 + 104 + pr_info("CPU%u: thread %d, cpu %d, socket %d\n", 105 + cpuid, cpu_topology[cpuid].thread_id, 106 + cpu_topology[cpuid].core_id, 107 + cpu_topology[cpuid].socket_id); 108 + } 109 + 110 + static struct sched_domain_topology_level parisc_mc_topology[] = { 111 + #ifdef CONFIG_SCHED_MC 112 + { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) }, 113 + #endif 114 + 115 + { cpu_cpu_mask, SD_INIT_NAME(DIE) }, 116 + { NULL, }, 117 + }; 118 + 119 + /* 120 + * init_cpu_topology is called at boot when only one cpu is running 121 + * which prevent simultaneous write access to cpu_topology array 122 + */ 123 + void __init init_cpu_topology(void) 124 + { 125 + unsigned int cpu; 126 + 127 + /* init core mask and capacity */ 128 + for_each_possible_cpu(cpu) { 129 + struct cputopo_parisc *cpu_topo = &(cpu_topology[cpu]); 130 + 131 + cpu_topo->thread_id = -1; 132 + cpu_topo->core_id = -1; 133 + cpu_topo->socket_id = -1; 134 + cpumask_clear(&cpu_topo->core_sibling); 135 + cpumask_clear(&cpu_topo->thread_sibling); 136 + } 137 + smp_wmb(); 138 + 139 + /* Set scheduler topology descriptor */ 140 + if (dualcores_found) 141 + set_sched_topology(parisc_mc_topology); 142 + }
-3
arch/sparc/Kconfig
··· 96 96 config CPU_BIG_ENDIAN 97 97 def_bool y 98 98 99 - config CPU_BIG_ENDIAN 100 - def_bool y 101 - 102 99 config ARCH_ATU 103 100 bool 104 101 default y if SPARC64