Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/loongarch/configs/loongson3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ CONFIG_PRINTK_TIME=y
CONFIG_PRINTK_CALLER=y
CONFIG_BOOT_PRINTK_DELAY=y
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_DEBUG_INFO_BTF=y
CONFIG_FRAME_WARN=4096
CONFIG_STRIP_ASM_SYMS=y
Expand Down
1 change: 0 additions & 1 deletion arch/loongarch/include/asm/numa.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <linux/nodemask.h>

#define NODE_ADDRSPACE_SHIFT 44
#define NODES_PER_FLATMODE_NODE 4

#define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
#define nid_to_addrbase(nid) (_ULCAST_(nid) << NODE_ADDRSPACE_SHIFT)
Expand Down
22 changes: 16 additions & 6 deletions arch/loongarch/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,36 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
return ioremap_cache(phys, size);
}

static int cpu_enumerated = 0;

#ifdef CONFIG_SMP
int set_processor_mask(u32 id, u32 flags)
{

int nr_cpus;
int cpu, cpuid = id;

if (num_processors >= nr_cpu_ids) {
pr_warn(PREFIX "nr_cpus/possible_cpus limit of %i reached."
" processor 0x%x ignored.\n", nr_cpu_ids, cpuid);
if (!cpu_enumerated)
nr_cpus = NR_CPUS;
else
nr_cpus = nr_cpu_ids;

if (num_processors >= nr_cpus) {
pr_warn(PREFIX "nr_cpus limit of %i reached."
" processor 0x%x ignored.\n", nr_cpus, cpuid);

return -ENODEV;

}
if (cpuid == loongson_sysconf.boot_cpu_id)
cpu = 0;
else
cpu = cpumask_next_zero(-1, cpu_present_mask);
cpu = find_first_zero_bit(cpumask_bits(cpu_present_mask), NR_CPUS);

if (!cpu_enumerated)
set_cpu_possible(cpu, true);

if (flags & ACPI_MADT_ENABLED) {
num_processors++;
set_cpu_possible(cpu, true);
set_cpu_present(cpu, true);
__cpu_number_map[cpuid] = cpu;
__cpu_logical_map[cpu] = cpuid;
Expand Down Expand Up @@ -143,6 +152,7 @@ static void __init acpi_process_madt(void)
acpi_table_parse_madt(ACPI_MADT_TYPE_EIO_PIC,
acpi_parse_eio_master, MAX_IO_PICS);

cpu_enumerated = 1;
loongson_sysconf.nr_cpus = num_processors;
}

Expand Down
7 changes: 7 additions & 0 deletions arch/loongarch/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ void __init init_IRQ(void)
int i, ret;
unsigned int order = get_order(IRQ_STACK_SIZE);
struct page *page;
unsigned long node;

if (!acpi_gbl_reduced_hardware) {
for_each_node(node)
writel(0x40000000 | (node << 12),
(volatile void __iomem *)(0x80000efdfb000274UL + (node<<44)));
}

clear_csr_ecfg(ECFG0_IM);
clear_csr_estat(ESTATF_IP);
Expand Down
26 changes: 26 additions & 0 deletions arch/loongarch/kernel/relocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,32 @@ static inline __init bool kaslr_disabled(void)
if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' '))
return true;

#ifdef CONFIG_HIBERNATION
str = strstr(builtin_cmdline, "nohibernate");
if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' '))
return false;

str = strstr(boot_command_line, "nohibernate");
if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' '))
return false;

str = strstr(builtin_cmdline, "noresume");
if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' '))
return false;

str = strstr(boot_command_line, "noresume");
if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' '))
return false;

str = strstr(builtin_cmdline, "resume=");
if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' '))
return true;

str = strstr(boot_command_line, "resume=");
if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' '))
return true;
#endif

return false;
}

Expand Down
4 changes: 3 additions & 1 deletion arch/loongarch/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,10 @@ static void __init prefill_possible_map(void)

for (i = 0; i < possible; i++)
set_cpu_possible(i, true);
for (; i < NR_CPUS; i++)
for (; i < NR_CPUS; i++) {
set_cpu_present(i, false);
set_cpu_possible(i, false);
}

set_nr_cpu_ids(possible);
}
Expand Down
7 changes: 3 additions & 4 deletions arch/loongarch/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,10 @@ static void __init fdt_smp_setup(void)
if (cpuid >= nr_cpu_ids)
continue;

if (cpuid == loongson_sysconf.boot_cpu_id) {
if (cpuid == loongson_sysconf.boot_cpu_id)
cpu = 0;
} else {
cpu = cpumask_next_zero(-1, cpu_present_mask);
}
else
cpu = find_first_zero_bit(cpumask_bits(cpu_present_mask), NR_CPUS);

num_processors++;
set_cpu_possible(cpu, true);
Expand Down
5 changes: 3 additions & 2 deletions drivers/irqchip/irq-loongson-eiointc.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/kernel.h>
#include <linux/syscore_ops.h>
#include <asm/numa.h>

#define EIOINTC_REG_NODEMAP 0x14a0
#define EIOINTC_REG_IPMAP 0x14c0
Expand Down Expand Up @@ -375,7 +376,7 @@ int __init pch_msi_parse_madt(union acpi_subtable_headers *header,
int node;

if (cpu_has_flatmode)
node = eiointc_priv[nr_pics - 1]->node / NODES_PER_FLATMODE_NODE;
node = early_cpu_to_node(eiointc_priv[nr_pics - 1]->node * CORES_PER_EIO_NODE);
else
node = eiointc_priv[nr_pics - 1]->node;

Expand Down Expand Up @@ -478,7 +479,7 @@ int __init eiointc_acpi_init(struct irq_domain *parent,
goto out_free_handle;

if (cpu_has_flatmode)
node = acpi_eiointc->node / NODES_PER_FLATMODE_NODE;
node = early_cpu_to_node(acpi_eiointc->node * CORES_PER_EIO_NODE);
else
node = acpi_eiointc->node;
acpi_set_vec_parent(node, priv->eiointc_domain, pch_group);
Expand Down