Skip to content

Commit d5fd43b

Browse files
committed
Merge tag 'for-5.18/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull more parisc architecture updates from Helge Deller: - Revert a patch to the invalidate/flush vmap routines which broke kernel patching functions on older PA-RISC machines. - Fix the kernel patching code wrt locking and flushing. Works now on B160L machine as well. - Fix CPU IRQ affinity for LASI, WAX and Dino chips - Add CPU hotplug support - Detect the hppa-suse-linux-gcc compiler when cross-compiling * tag 'for-5.18/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Fix patch code locking and flushing parisc: Find a new timesync master if current CPU is removed parisc: Move common_stext into .text section when CONFIG_HOTPLUG_CPU=y parisc: Rewrite arch_cpu_idle_dead() for CPU hotplugging parisc: Implement __cpu_die() and __cpu_disable() for CPU hotplugging parisc: Add PDC locking functions for rendezvous code parisc: Move disable_sr_hashing_asm() into .text section parisc: Move CPU startup-related functions into .text section parisc: Move store_cpu_topology() into text section parisc: Switch from GENERIC_CPU_DEVICES to GENERIC_ARCH_TOPOLOGY parisc: Ensure set_firmware_width() is called only once parisc: Add constants for control registers and clean up mfctl() parisc: Detect hppa-suse-linux-gcc compiler for cross-building parisc: Clean up cpu_check_affinity() and drop cpu_set_affinity_irq() parisc: Fix CPU affinity for Lasi, WAX and Dino chips Revert "parisc: Fix invalidate/flush vmap routines"
2 parents 57c06b6 + a9fe7fa commit d5fd43b

File tree

25 files changed

+312
-206
lines changed

25 files changed

+312
-206
lines changed

arch/parisc/Kconfig

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ config PARISC
3737
select GENERIC_PCI_IOMAP
3838
select ARCH_HAVE_NMI_SAFE_CMPXCHG
3939
select GENERIC_SMP_IDLE_THREAD
40-
select GENERIC_CPU_DEVICES
40+
select GENERIC_ARCH_TOPOLOGY if SMP
4141
select GENERIC_LIB_DEVMEM_IS_ALLOWED
4242
select SYSCTL_ARCH_UNALIGN_ALLOW
4343
select SYSCTL_EXCEPTION_TRACE
@@ -56,6 +56,7 @@ config PARISC
5656
select HAVE_ARCH_TRACEHOOK
5757
select HAVE_REGS_AND_STACK_ACCESS_API
5858
select GENERIC_SCHED_CLOCK
59+
select GENERIC_IRQ_MIGRATION if SMP
5960
select HAVE_UNSTABLE_SCHED_CLOCK if SMP
6061
select LEGACY_TIMER_TICK
6162
select CPU_NO_EFFICIENT_FFS
@@ -279,16 +280,9 @@ config SMP
279280

280281
If you don't know what to do here, say N.
281282

282-
config PARISC_CPU_TOPOLOGY
283-
bool "Support cpu topology definition"
284-
depends on SMP
285-
default y
286-
help
287-
Support PARISC cpu topology definition.
288-
289283
config SCHED_MC
290284
bool "Multi-core scheduler support"
291-
depends on PARISC_CPU_TOPOLOGY && PA8X00
285+
depends on GENERIC_ARCH_TOPOLOGY && PA8X00
292286
help
293287
Multi-core scheduler support improves the CPU scheduler's decision
294288
making when dealing with multi-core CPU chips at a cost of slightly

arch/parisc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export LD_BFD
4242

4343
# Set default 32 bits cross compilers for vdso
4444
CC_ARCHES_32 = hppa hppa2.0 hppa1.1
45-
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
45+
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
4646
CROSS32_COMPILE := $(call cc-cross-prefix, \
4747
$(foreach a,$(CC_ARCHES_32), \
4848
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
@@ -52,7 +52,7 @@ export CROSS32CC
5252
# Set default cross compiler for kernel build
5353
ifdef cross_compiling
5454
ifeq ($(CROSS_COMPILE),)
55-
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
55+
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
5656
CROSS_COMPILE := $(call cc-cross-prefix, \
5757
$(foreach a,$(CC_ARCHES), \
5858
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))

arch/parisc/include/asm/pdc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
9494
unsigned long glob_cfg);
9595

9696
int __pdc_cpu_rendezvous(void);
97+
void pdc_cpu_rendezvous_lock(void);
98+
void pdc_cpu_rendezvous_unlock(void);
99+
97100
static inline char * os_id_to_string(u16 os_id) {
98101
switch(os_id) {
99102
case OS_ID_NONE: return "No OS";

arch/parisc/include/asm/pdcpat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
#define PDC_PAT_CPU_RENDEZVOUS 6L /* Rendezvous CPU */
8484
#define PDC_PAT_CPU_GET_CLOCK_INFO 7L /* Return CPU Clock info */
8585
#define PDC_PAT_CPU_GET_RENDEZVOUS_STATE 8L /* Return Rendezvous State */
86+
#define PDC_PAT_CPU_GET_PDC_ENTRYPOINT 11L /* Return PDC Entry point */
8687
#define PDC_PAT_CPU_PLUNGE_FABRIC 128L /* Plunge Fabric */
8788
#define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache
8889
* Cleansing Mode */
@@ -356,7 +357,7 @@ struct pdc_pat_cell_mod_maddr_block { /* PDC_PAT_CELL_MODULE */
356357

357358
typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
358359

359-
360+
extern int pdc_pat_get_PDC_entrypoint(unsigned long *pdc_entry);
360361
extern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
361362
extern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
362363
extern int pdc_pat_cell_info(struct pdc_pat_cell_info_rtn_block *info,

arch/parisc/include/asm/processor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ struct cpuinfo_parisc {
9595

9696
extern struct system_cpuinfo_parisc boot_cpu_data;
9797
DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data);
98+
extern int time_keeper_id; /* CPU used for timekeeping */
9899

99100
#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
100101

arch/parisc/include/asm/smp.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ static inline void smp_send_all_nop(void) { return; }
4444

4545
#define NO_PROC_ID 0xFF /* No processor magic marker */
4646
#define ANY_PROC_ID 0xFF /* Any processor magic marker */
47-
static inline int __cpu_disable (void) {
48-
return 0;
49-
}
50-
static inline void __cpu_die (unsigned int cpu) {
51-
while(1)
52-
;
53-
}
47+
int __cpu_disable(void);
48+
void __cpu_die(unsigned int cpu);
5449

5550
#endif /* __ASM_SMP_H */

arch/parisc/include/asm/special_insns.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
pa; \
3131
})
3232

33+
#define CR_EIEM 15 /* External Interrupt Enable Mask */
34+
#define CR_CR16 16 /* CR16 Interval Timer */
35+
#define CR_EIRR 23 /* External Interrupt Request Register */
36+
3337
#define mfctl(reg) ({ \
3438
unsigned long cr; \
3539
__asm__ __volatile__( \
36-
"mfctl " #reg ",%0" : \
37-
"=r" (cr) \
40+
"mfctl %1,%0" : \
41+
"=r" (cr) : "i" (reg) \
3842
); \
3943
cr; \
4044
})
@@ -44,13 +48,8 @@
4448
: /* no outputs */ \
4549
: "r" (gr), "i" (cr) : "memory")
4650

47-
/* these are here to de-mystefy the calling code, and to provide hooks */
48-
/* which I needed for debugging EIEM problems -PB */
49-
#define get_eiem() mfctl(15)
50-
static inline void set_eiem(unsigned long val)
51-
{
52-
mtctl(val, 15);
53-
}
51+
#define get_eiem() mfctl(CR_EIEM)
52+
#define set_eiem(val) mtctl(val, CR_EIEM)
5453

5554
#define mfsp(reg) ({ \
5655
unsigned long cr; \

arch/parisc/include/asm/topology.h

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
#ifndef _ASM_PARISC_TOPOLOGY_H
22
#define _ASM_PARISC_TOPOLOGY_H
33

4-
#ifdef CONFIG_PARISC_CPU_TOPOLOGY
4+
#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
55

66
#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);
7+
#include <linux/arch_topology.h>
268

279
#else
2810

2911
static inline void init_cpu_topology(void) { }
3012
static inline void store_cpu_topology(unsigned int cpuid) { }
13+
static inline void reset_cpu_topology(void) { }
3114

3215
#endif
3316

arch/parisc/kernel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ obj-$(CONFIG_AUDIT) += audit.o
3131
obj64-$(CONFIG_AUDIT) += compat_audit.o
3232
# only supported for PCX-W/U in 64-bit mode at the moment
3333
obj-$(CONFIG_64BIT) += perf.o perf_asm.o $(obj64-y)
34-
obj-$(CONFIG_PARISC_CPU_TOPOLOGY) += topology.o
34+
obj-$(CONFIG_GENERIC_ARCH_TOPOLOGY) += topology.o
3535
obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o
3636
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
3737
obj-$(CONFIG_JUMP_LABEL) += jump_label.o

arch/parisc/kernel/cache.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ parisc_cache_init(void)
273273
}
274274
}
275275

276-
void __init disable_sr_hashing(void)
276+
void disable_sr_hashing(void)
277277
{
278278
int srhash_type, retval;
279279
unsigned long space_bits;
@@ -611,8 +611,8 @@ void
611611
flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)
612612
{
613613
if (pfn_valid(pfn)) {
614-
flush_tlb_page(vma, vmaddr);
615614
if (likely(vma->vm_mm->context.space_id)) {
615+
flush_tlb_page(vma, vmaddr);
616616
__flush_cache_page(vma, vmaddr, PFN_PHYS(pfn));
617617
} else {
618618
__purge_cache_page(vma, vmaddr, PFN_PHYS(pfn));
@@ -624,7 +624,6 @@ void flush_kernel_vmap_range(void *vaddr, int size)
624624
{
625625
unsigned long start = (unsigned long)vaddr;
626626
unsigned long end = start + size;
627-
unsigned long flags, physaddr;
628627

629628
if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
630629
(unsigned long)size >= parisc_cache_flush_threshold) {
@@ -633,22 +632,15 @@ void flush_kernel_vmap_range(void *vaddr, int size)
633632
return;
634633
}
635634

636-
while (start < end) {
637-
physaddr = lpa(start);
638-
purge_tlb_start(flags);
639-
pdtlb(SR_KERNEL, start);
640-
purge_tlb_end(flags);
641-
flush_dcache_page_asm(physaddr, start);
642-
start += PAGE_SIZE;
643-
}
635+
flush_kernel_dcache_range_asm(start, end);
636+
flush_tlb_kernel_range(start, end);
644637
}
645638
EXPORT_SYMBOL(flush_kernel_vmap_range);
646639

647640
void invalidate_kernel_vmap_range(void *vaddr, int size)
648641
{
649642
unsigned long start = (unsigned long)vaddr;
650643
unsigned long end = start + size;
651-
unsigned long flags, physaddr;
652644

653645
if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
654646
(unsigned long)size >= parisc_cache_flush_threshold) {
@@ -657,13 +649,7 @@ void invalidate_kernel_vmap_range(void *vaddr, int size)
657649
return;
658650
}
659651

660-
while (start < end) {
661-
physaddr = lpa(start);
662-
purge_tlb_start(flags);
663-
pdtlb(SR_KERNEL, start);
664-
purge_tlb_end(flags);
665-
purge_dcache_page_asm(physaddr, start);
666-
start += PAGE_SIZE;
667-
}
652+
purge_kernel_dcache_range_asm(start, end);
653+
flush_tlb_kernel_range(start, end);
668654
}
669655
EXPORT_SYMBOL(invalidate_kernel_vmap_range);

arch/parisc/kernel/firmware.c

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ extern unsigned long pdc_result2[NUM_PDC_RESULT];
8383

8484
/* Firmware needs to be initially set to narrow to determine the
8585
* actual firmware width. */
86-
int parisc_narrow_firmware __ro_after_init = 1;
86+
int parisc_narrow_firmware __ro_after_init = 2;
8787
#endif
8888

8989
/* On most currently-supported platforms, IODC I/O calls are 32-bit calls
@@ -174,6 +174,11 @@ void set_firmware_width_unlocked(void)
174174
void set_firmware_width(void)
175175
{
176176
unsigned long flags;
177+
178+
/* already initialized? */
179+
if (parisc_narrow_firmware != 2)
180+
return;
181+
177182
spin_lock_irqsave(&pdc_lock, flags);
178183
set_firmware_width_unlocked();
179184
spin_unlock_irqrestore(&pdc_lock, flags);
@@ -324,7 +329,44 @@ int __pdc_cpu_rendezvous(void)
324329
return mem_pdc_call(PDC_PROC, 1, 0);
325330
}
326331

332+
/**
333+
* pdc_cpu_rendezvous_lock - Lock PDC while transitioning to rendezvous state
334+
*/
335+
void pdc_cpu_rendezvous_lock(void)
336+
{
337+
spin_lock(&pdc_lock);
338+
}
339+
340+
/**
341+
* pdc_cpu_rendezvous_unlock - Unlock PDC after reaching rendezvous state
342+
*/
343+
void pdc_cpu_rendezvous_unlock(void)
344+
{
345+
spin_unlock(&pdc_lock);
346+
}
347+
348+
/**
349+
* pdc_pat_get_PDC_entrypoint - Get PDC entry point for current CPU
350+
* @retval: -1 on error, 0 on success
351+
*/
352+
int pdc_pat_get_PDC_entrypoint(unsigned long *pdc_entry)
353+
{
354+
int retval = 0;
355+
unsigned long flags;
356+
357+
if (!IS_ENABLED(CONFIG_SMP) || !is_pdc_pat()) {
358+
*pdc_entry = MEM_PDC;
359+
return 0;
360+
}
361+
362+
spin_lock_irqsave(&pdc_lock, flags);
363+
retval = mem_pdc_call(PDC_PAT_CPU, PDC_PAT_CPU_GET_PDC_ENTRYPOINT,
364+
__pa(pdc_result));
365+
*pdc_entry = pdc_result[0];
366+
spin_unlock_irqrestore(&pdc_lock, flags);
327367

368+
return retval;
369+
}
328370
/**
329371
* pdc_chassis_warn - Fetches chassis warnings
330372
* @retval: -1 on error, 0 on success

arch/parisc/kernel/head.S

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ $pgt_fill_loop:
162162
/* FALLTHROUGH */
163163
.procend
164164

165+
#ifdef CONFIG_HOTPLUG_CPU
166+
/* common_stext is far away in another section... jump there */
167+
load32 PA(common_stext), %rp
168+
bv,n (%rp)
169+
170+
/* common_stext and smp_slave_stext needs to be in text section */
171+
.text
172+
#endif
173+
165174
/*
166175
** Code Common to both Monarch and Slave processors.
167176
** Entry:
@@ -371,8 +380,6 @@ smp_slave_stext:
371380
.procend
372381
#endif /* CONFIG_SMP */
373382

374-
ENDPROC(parisc_kernel_start)
375-
376383
#ifndef CONFIG_64BIT
377384
.section .data..ro_after_init
378385

arch/parisc/kernel/irq.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,12 @@ int cpu_check_affinity(struct irq_data *d, const struct cpumask *dest)
105105
if (irqd_is_per_cpu(d))
106106
return -EINVAL;
107107

108-
/* whatever mask they set, we just allow one CPU */
109-
cpu_dest = cpumask_next_and(d->irq & (num_online_cpus()-1),
110-
dest, cpu_online_mask);
108+
cpu_dest = cpumask_first_and(dest, cpu_online_mask);
111109
if (cpu_dest >= nr_cpu_ids)
112-
cpu_dest = cpumask_first_and(dest, cpu_online_mask);
110+
cpu_dest = cpumask_first(cpu_online_mask);
113111

114112
return cpu_dest;
115113
}
116-
117-
static int cpu_set_affinity_irq(struct irq_data *d, const struct cpumask *dest,
118-
bool force)
119-
{
120-
int cpu_dest;
121-
122-
cpu_dest = cpu_check_affinity(d, dest);
123-
if (cpu_dest < 0)
124-
return -1;
125-
126-
cpumask_copy(irq_data_get_affinity_mask(d), dest);
127-
128-
return 0;
129-
}
130114
#endif
131115

132116
static struct irq_chip cpu_interrupt_type = {
@@ -135,9 +119,6 @@ static struct irq_chip cpu_interrupt_type = {
135119
.irq_unmask = cpu_unmask_irq,
136120
.irq_ack = cpu_ack_irq,
137121
.irq_eoi = cpu_eoi_irq,
138-
#ifdef CONFIG_SMP
139-
.irq_set_affinity = cpu_set_affinity_irq,
140-
#endif
141122
/* XXX: Needs to be written. We managed without it so far, but
142123
* we really ought to write it.
143124
*/
@@ -582,7 +563,7 @@ static void claim_cpu_irqs(void)
582563
#endif
583564
}
584565

585-
void __init init_IRQ(void)
566+
void init_IRQ(void)
586567
{
587568
local_irq_disable(); /* PARANOID - should already be disabled */
588569
mtctl(~0UL, 23); /* EIRR : clear all pending external intr */

0 commit comments

Comments
 (0)