Skip to content

Commit e58bd49

Browse files
committed
Merge tag 'mips-fixes-5.17_4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS fixes from Thomas Bogendoerfer: - Fix memory detection for MT7621 devices - Fix setnocoherentio kernel option - Fix warning when CONFIG_SCHED_CORE is enabled * tag 'mips-fixes-5.17_4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: ralink: mt7621: use bitwise NOT instead of logical mips: setup: fix setnocoherentio() boolean setting MIPS: smp: fill in sibling and core maps earlier MIPS: ralink: mt7621: do memory detection on KSEG1
2 parents 4d5ae23 + 5d89657 commit e58bd49

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

arch/mips/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ early_param("coherentio", setcoherentio);
803803

804804
static int __init setnocoherentio(char *str)
805805
{
806-
dma_default_coherent = true;
806+
dma_default_coherent = false;
807807
pr_info("Software DMA cache coherency (command line)\n");
808808
return 0;
809809
}

arch/mips/kernel/smp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ asmlinkage void start_secondary(void)
351351
cpu = smp_processor_id();
352352
cpu_data[cpu].udelay_val = loops_per_jiffy;
353353

354+
set_cpu_sibling_map(cpu);
355+
set_cpu_core_map(cpu);
356+
354357
cpumask_set_cpu(cpu, &cpu_coherent_mask);
355358
notify_cpu_starting(cpu);
356359

@@ -362,9 +365,6 @@ asmlinkage void start_secondary(void)
362365
/* The CPU is running and counters synchronised, now mark it online */
363366
set_cpu_online(cpu, true);
364367

365-
set_cpu_sibling_map(cpu);
366-
set_cpu_core_map(cpu);
367-
368368
calculate_cpu_foreign_map();
369369

370370
/*

arch/mips/ralink/mt7621.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
#include "common.h"
2424

25-
static void *detect_magic __initdata = detect_memory_region;
25+
#define MT7621_MEM_TEST_PATTERN 0xaa5555aa
26+
27+
static u32 detect_magic __initdata;
2628

2729
int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
2830
{
@@ -58,24 +60,32 @@ phys_addr_t mips_cpc_default_phys_base(void)
5860
panic("Cannot detect cpc address");
5961
}
6062

63+
static bool __init mt7621_addr_wraparound_test(phys_addr_t size)
64+
{
65+
void *dm = (void *)KSEG1ADDR(&detect_magic);
66+
67+
if (CPHYSADDR(dm + size) >= MT7621_LOWMEM_MAX_SIZE)
68+
return true;
69+
__raw_writel(MT7621_MEM_TEST_PATTERN, dm);
70+
if (__raw_readl(dm) != __raw_readl(dm + size))
71+
return false;
72+
__raw_writel(~MT7621_MEM_TEST_PATTERN, dm);
73+
return __raw_readl(dm) == __raw_readl(dm + size);
74+
}
75+
6176
static void __init mt7621_memory_detect(void)
6277
{
63-
void *dm = &detect_magic;
6478
phys_addr_t size;
6579

66-
for (size = 32 * SZ_1M; size < 256 * SZ_1M; size <<= 1) {
67-
if (!__builtin_memcmp(dm, dm + size, sizeof(detect_magic)))
68-
break;
80+
for (size = 32 * SZ_1M; size <= 256 * SZ_1M; size <<= 1) {
81+
if (mt7621_addr_wraparound_test(size)) {
82+
memblock_add(MT7621_LOWMEM_BASE, size);
83+
return;
84+
}
6985
}
7086

71-
if ((size == 256 * SZ_1M) &&
72-
(CPHYSADDR(dm + size) < MT7621_LOWMEM_MAX_SIZE) &&
73-
__builtin_memcmp(dm, dm + size, sizeof(detect_magic))) {
74-
memblock_add(MT7621_LOWMEM_BASE, MT7621_LOWMEM_MAX_SIZE);
75-
memblock_add(MT7621_HIGHMEM_BASE, MT7621_HIGHMEM_SIZE);
76-
} else {
77-
memblock_add(MT7621_LOWMEM_BASE, size);
78-
}
87+
memblock_add(MT7621_LOWMEM_BASE, MT7621_LOWMEM_MAX_SIZE);
88+
memblock_add(MT7621_HIGHMEM_BASE, MT7621_HIGHMEM_SIZE);
7989
}
8090

8191
void __init ralink_of_remap(void)

0 commit comments

Comments
 (0)