Skip to content

Commit

Permalink
Automatic merge of 'next-test' into merge-test (2024-03-07 00:13)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpe committed Mar 6, 2024
2 parents 0b19214 + 5b9e00a commit 8ea9ce0
Show file tree
Hide file tree
Showing 47 changed files with 228 additions and 172 deletions.
32 changes: 20 additions & 12 deletions arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
# often slow when they are implemented at all
KBUILD_CFLAGS += $(call cc-option,-mno-string)

cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec)

# When using '-many -mpower4' gas will first try and find a matching power4
# mnemonic and failing that it will allow any valid mnemonic that GAS knows
# about. GCC will pass -many to GAS when assembling, clang does not.
# LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLinux/linux/issues/675
# but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
cpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many)

KBUILD_AFLAGS += $(cpu-as-y)
KBUILD_CFLAGS += $(cpu-as-y)

KBUILD_AFLAGS += $(aflags-y)
KBUILD_CFLAGS += $(cflags-y)

Expand Down Expand Up @@ -314,6 +302,26 @@ ppc32_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
-f $(srctree)/Makefile allmodconfig

generated_configs += ppc40x_allmodconfig
ppc40x_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/40x.config \
-f $(srctree)/Makefile allmodconfig

generated_configs += ppc44x_allmodconfig
ppc44x_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/44x.config \
-f $(srctree)/Makefile allmodconfig

generated_configs += ppc8xx_allmodconfig
ppc8xx_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/8xx.config \
-f $(srctree)/Makefile allmodconfig

generated_configs += ppc85xx_allmodconfig
ppc85xx_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-32bit.config \
-f $(srctree)/Makefile allmodconfig

generated_configs += ppc_defconfig
ppc_defconfig:
$(call merge_into_defconfig,book3s_32.config,)
Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/boot/simple_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ static void *simple_realloc(void *ptr, unsigned long size)
return ptr;

new = simple_malloc(size);
memcpy(new, ptr, p->size);
simple_free(ptr);
if (new) {
memcpy(new, ptr, p->size);
simple_free(ptr);
}

return new;
}

Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/configs/40x.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_PPC64=n
CONFIG_40x=y
2 changes: 2 additions & 0 deletions arch/powerpc/configs/44x.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_PPC64=n
CONFIG_44x=y
1 change: 1 addition & 0 deletions arch/powerpc/configs/85xx-32bit.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONFIG_PPC64=n
CONFIG_HIGHMEM=y
CONFIG_KEXEC=y
CONFIG_PPC_85xx=y
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/configs/8xx.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_PPC64=n
CONFIG_PPC_8xx=y
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct pci_host_bridge;
struct machdep_calls {
const char *name;
const char *compatible;
const char * const *compatibles;
#ifdef CONFIG_PPC64
#ifdef CONFIG_PM
void (*iommu_restore)(void);
Expand Down
20 changes: 19 additions & 1 deletion arch/powerpc/include/asm/ppc_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,25 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
*/
#define DCBT_BOOK3S_STOP_ALL_STREAM_IDS(scratch) \
lis scratch,0x60000000@h; \
dcbt 0,scratch,0b01010
.machine push; \
.machine power4; \
dcbt 0,scratch,0b01010; \
.machine pop;

#define DCBT_SETUP_STREAMS(from, from_parms, to, to_parms, scratch) \
lis scratch,0x8000; /* GO=1 */ \
clrldi scratch,scratch,32; \
.machine push; \
.machine power4; \
/* setup read stream 0 */ \
dcbt 0,from,0b01000; /* addr from */ \
dcbt 0,from_parms,0b01010; /* length and depth from */ \
/* setup write stream 1 */ \
dcbtst 0,to,0b01000; /* addr to */ \
dcbtst 0,to_parms,0b01010; /* length and depth to */ \
eieio; \
dcbt 0,scratch,0b01010; /* all streams GO */ \
.machine pop;

/*
* toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them
Expand Down
25 changes: 21 additions & 4 deletions arch/powerpc/include/asm/reg_fsl_emb.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,27 @@

#ifndef __ASSEMBLY__
/* Performance Monitor Registers */
#define mfpmr(rn) ({unsigned int rval; \
asm volatile("mfpmr %0," __stringify(rn) \
: "=r" (rval)); rval;})
#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
static __always_inline unsigned int mfpmr(unsigned int rn)
{
unsigned int rval;

asm (".machine push; "
".machine e300; "
"mfpmr %[rval], %[rn];"
".machine pop;"
: [rval] "=r" (rval) : [rn] "i" (rn));

return rval;
}

static __always_inline void mtpmr(unsigned int rn, unsigned int val)
{
asm (".machine push; "
".machine e300; "
"mtpmr %[rn], %[val];"
".machine pop;"
: [val] "=r" (val) : [rn] "i" (rn));
}
#endif /* __ASSEMBLY__ */

/* Freescale Book E Performance Monitor APU Registers */
Expand Down
5 changes: 2 additions & 3 deletions arch/powerpc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,14 @@ static __always_inline void call_do_irq(struct pt_regs *regs, void *sp)
void __do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
void *cursp, *irqsp, *sirqsp;
void *cursp, *irqsp;

/* Switch to the irq stack to handle this */
cursp = (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
irqsp = hardirq_ctx[raw_smp_processor_id()];
sirqsp = softirq_ctx[raw_smp_processor_id()];

/* Already there ? If not switch stack and call */
if (unlikely(cursp == irqsp || cursp == sirqsp))
if (unlikely(cursp == irqsp))
__do_irq(regs, current_stack_pointer);
else
call_do_irq(regs, irqsp);
Expand Down
8 changes: 6 additions & 2 deletions arch/powerpc/kernel/secure_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ bool is_ppc_secureboot_enabled(void)
if (enabled)
goto out;

if (!of_property_read_u32(of_root, "ibm,secure-boot", &secureboot))
node = of_find_node_by_path("/");
if (!of_property_read_u32(node, "ibm,secure-boot", &secureboot))
enabled = (secureboot > 1);
of_node_put(node);

out:
pr_info("Secure boot mode %s\n", enabled ? "enabled" : "disabled");
Expand All @@ -54,8 +56,10 @@ bool is_ppc_trustedboot_enabled(void)
if (enabled)
goto out;

if (!of_property_read_u32(of_root, "ibm,trusted-boot", &trustedboot))
node = of_find_node_by_path("/");
if (!of_property_read_u32(node, "ibm,trusted-boot", &trustedboot))
enabled = (trustedboot > 0);
of_node_put(node);

out:
pr_info("Trusted boot mode %s\n", enabled ? "enabled" : "disabled");
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ static __init void probe_machine(void)
DBG(" %s ...\n", machine_id->name);
if (machine_id->compatible && !of_machine_is_compatible(machine_id->compatible))
continue;
if (machine_id->compatibles && !of_machine_compatible_match(machine_id->compatibles))
continue;
memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
if (ppc_md.probe && !ppc_md.probe())
continue;
Expand Down
8 changes: 5 additions & 3 deletions arch/powerpc/kexec/ranges.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,16 @@ int add_opal_mem_range(struct crash_mem **mem_ranges)
int add_reserved_mem_ranges(struct crash_mem **mem_ranges)
{
int n_mem_addr_cells, n_mem_size_cells, i, len, cells, ret = 0;
struct device_node *root = of_find_node_by_path("/");
const __be32 *prop;

prop = of_get_property(of_root, "reserved-ranges", &len);
prop = of_get_property(root, "reserved-ranges", &len);
n_mem_addr_cells = of_n_addr_cells(root);
n_mem_size_cells = of_n_size_cells(root);
of_node_put(root);
if (!prop)
return 0;

n_mem_addr_cells = of_n_addr_cells(of_root);
n_mem_size_cells = of_n_size_cells(of_root);
cells = n_mem_addr_cells + n_mem_size_cells;

/* Each reserved range is an (address,size) pair */
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/kexec/relocate_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Author: Suzuki Poulose <[email protected]>
*/

#include <linux/objtool.h>
#include <asm/reg.h>
#include <asm/page.h>
#include <asm/mmu.h>
Expand Down Expand Up @@ -349,6 +350,7 @@ write_utlb:
cmpwi r10, PPC47x_TLB0_4K
bne 0f
li r10, 0x1000 /* r10 = 4k */
ANNOTATE_INTRA_FUNCTION_CALL
bl 1f

0:
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o

obj-$(CONFIG_ALTIVEC) += xor_vmx.o xor_vmx_glue.o
CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)
CFLAGS_xor_vmx.o += -mhard-float -maltivec $(call cc-option,-mabi=altivec)
# Enable <altivec.h>
CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include)

Expand Down
12 changes: 1 addition & 11 deletions arch/powerpc/lib/copypage_power7.S
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,7 @@ _GLOBAL(copypage_power7)
#endif
ori r10,r7,1 /* stream=1 */

lis r8,0x8000 /* GO=1 */
clrldi r8,r8,32

/* setup read stream 0 */
dcbt 0,r4,0b01000 /* addr from */
dcbt 0,r7,0b01010 /* length and depth from */
/* setup write stream 1 */
dcbtst 0,r9,0b01000 /* addr to */
dcbtst 0,r10,0b01010 /* length and depth to */
eieio
dcbt 0,r8,0b01010 /* all streams GO */
DCBT_SETUP_STREAMS(r4, r7, r9, r10, r8)

#ifdef CONFIG_ALTIVEC
mflr r0
Expand Down
12 changes: 1 addition & 11 deletions arch/powerpc/lib/copyuser_power7.S
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,7 @@ err1; stb r0,0(r3)
or r7,r7,r0
ori r10,r7,1 /* stream=1 */

lis r8,0x8000 /* GO=1 */
clrldi r8,r8,32

/* setup read stream 0 */
dcbt 0,r6,0b01000 /* addr from */
dcbt 0,r7,0b01010 /* length and depth from */
/* setup write stream 1 */
dcbtst 0,r9,0b01000 /* addr to */
dcbtst 0,r10,0b01010 /* length and depth to */
eieio
dcbt 0,r8,0b01010 /* all streams GO */
DCBT_SETUP_STREAMS(r6, r7, r9, r10, r8)

beq cr1,.Lunwind_stack_nonvmx_copy

Expand Down
10 changes: 1 addition & 9 deletions arch/powerpc/lib/memcpy_power7.S
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
or r7,r7,r0
ori r10,r7,1 /* stream=1 */

lis r8,0x8000 /* GO=1 */
clrldi r8,r8,32

dcbt 0,r6,0b01000
dcbt 0,r7,0b01010
dcbtst 0,r9,0b01000
dcbtst 0,r10,0b01010
eieio
dcbt 0,r8,0b01010 /* GO */
DCBT_SETUP_STREAMS(r6, r7, r9, r10, r8)

beq cr1,.Lunwind_stack_nonvmx_copy

Expand Down
15 changes: 6 additions & 9 deletions arch/powerpc/mm/book3s64/hash_hugepage.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,13 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,

rflags = htab_convert_pte_flags(new_pmd, flags);

#if 0
if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
/*
* THPs are only supported on platforms that can do mixed page size
* segments (MPSS) and all such platforms have coherent icache. Hence we
* don't need to do lazy icache flush (hash_page_do_lazy_icache()) on
* noexecute fault.
*/

/*
* No CPU has hugepages but lacks no execute, so we
* don't need to worry about that case
*/
rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
}
#endif
/*
* Find the slot index details for this ea, using base page size.
*/
Expand Down
10 changes: 5 additions & 5 deletions arch/powerpc/mm/drmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,17 +393,17 @@ static const __be32 *of_get_usable_memory(struct device_node *dn)
int walk_drmem_lmbs(struct device_node *dn, void *data,
int (*func)(struct drmem_lmb *, const __be32 **, void *))
{
struct device_node *root = of_find_node_by_path("/");
const __be32 *prop, *usm;
int ret = -ENODEV;

if (!of_root)
if (!root)
return ret;

/* Get the address & size cells */
of_node_get(of_root);
n_root_addr_cells = of_n_addr_cells(of_root);
n_root_size_cells = of_n_size_cells(of_root);
of_node_put(of_root);
n_root_addr_cells = of_n_addr_cells(root);
n_root_size_cells = of_n_size_cells(root);
of_node_put(root);

if (init_drmem_lmb_size(dn))
return ret;
Expand Down
6 changes: 4 additions & 2 deletions arch/powerpc/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)

static void __init find_possible_nodes(void)
{
struct device_node *rtas;
struct device_node *rtas, *root;
const __be32 *domains = NULL;
int prop_length, max_nodes;
u32 i;
Expand All @@ -1132,10 +1132,12 @@ static void __init find_possible_nodes(void)
* If the LPAR is migratable, new nodes might be activated after a LPM,
* so we should consider the max number in that case.
*/
if (!of_get_property(of_root, "ibm,migratable-partition", NULL))
root = of_find_node_by_path("/");
if (!of_get_property(root, "ibm,migratable-partition", NULL))
domains = of_get_property(rtas,
"ibm,current-associativity-domains",
&prop_length);
of_node_put(root);
if (!domains) {
domains = of_get_property(rtas, "ibm,max-associativity-domains",
&prop_length);
Expand Down
Loading

0 comments on commit 8ea9ce0

Please sign in to comment.