From cd88d35df2936795cddb1bb7cb0ddb93b4997709 Mon Sep 17 00:00:00 2001 From: Min Fanlei Date: Tue, 9 Sep 2025 16:40:49 +0800 Subject: [PATCH 01/14] sw64: kvm: add the C4 kvm_regs structure to uapi kvm.h Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- This patch adds the definition of struct kvm_regs to uapi kvm.h to expose it to userspace. Signed-off-by: Min Fanlei Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/include/uapi/asm/kvm.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/sw_64/include/uapi/asm/kvm.h b/arch/sw_64/include/uapi/asm/kvm.h index 8cc5f752bc6b..98f7611c36d3 100644 --- a/arch/sw_64/include/uapi/asm/kvm.h +++ b/arch/sw_64/include/uapi/asm/kvm.h @@ -2,6 +2,8 @@ #ifndef _UAPI_ASM_SW64_KVM_H #define _UAPI_ASM_SW64_KVM_H +#include + /* * KVM SW specific structures and definitions. */ @@ -24,6 +26,20 @@ enum SW64_KVM_IRQ { #define KVM_NR_IRQCHIPS 1 +#ifndef __KERNEL__ +struct kvm_regs { + union { + struct user_pt_regs regs; + struct { + unsigned long r[31]; + unsigned long pc; + unsigned long ps; + }; + }; + struct user_fpsimd_state fpstate; +}; +#endif + /* * for KVM_GET_FPU and KVM_SET_FPU */ -- Gitee From 35dc092908371cd5e65502be173844e4315720fe Mon Sep 17 00:00:00 2001 From: Gu Yuchen Date: Mon, 8 Sep 2025 12:33:59 +0800 Subject: [PATCH 02/14] sw64: fix unresolved reference error when close pci Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- The pcie_save and pcie_restore functions depend on CONFIG_PCI option, the subfunctions they call are only compiled when CONFIG_PCI option is enabled. This commit fixes the issue. Signed-off-by: Gu Yuchen Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/kernel/chip_setup.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/sw_64/kernel/chip_setup.c b/arch/sw_64/kernel/chip_setup.c index df98e141b14f..d4e5b1736bc1 100644 --- a/arch/sw_64/kernel/chip_setup.c +++ b/arch/sw_64/kernel/chip_setup.c @@ -90,6 +90,7 @@ static void i2c_srst(void) writeq(0x1, spbu_base + OFFSET_I2C2_SRST_L); } +#ifdef CONFIG_PCI static void pcie_save(void) { struct pci_controller *hose; @@ -130,6 +131,17 @@ static void pcie_restore(void) } } +#else +static void pcie_save(void) +{ + +} + +static void pcie_restore(void) +{ + +} +#endif static unsigned long saved_dvc_int, saved_long_time; -- Gitee From f203e10a80e29b4982913ed96764dbd3434daa3f Mon Sep 17 00:00:00 2001 From: Gao Chen Date: Wed, 24 Sep 2025 15:24:30 +0800 Subject: [PATCH 03/14] sw64: revert ioremap() to __va() in ioport_map() Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- Revert ioremap() to __va() in ioport_map() since devices like UHCI call it during interrupts where ioremap() is forbidden. Signed-off-by: Gao Chen Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/lib/iomap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sw_64/lib/iomap.c b/arch/sw_64/lib/iomap.c index 51e7600b0fec..c73004a87dcd 100644 --- a/arch/sw_64/lib/iomap.c +++ b/arch/sw_64/lib/iomap.c @@ -262,8 +262,8 @@ EXPORT_SYMBOL(_memset_c_io); void __iomem *ioport_map(unsigned long port, unsigned int size) { if (port >= 0x100000) - return ioremap(port, size); + return __va(port); - return ioremap((port << legacy_io_shift) | legacy_io_base, size); + return __va((port << legacy_io_shift) | legacy_io_base); } EXPORT_SYMBOL(ioport_map); -- Gitee From b3e34fd953318792916628432d1163aff1628df4 Mon Sep 17 00:00:00 2001 From: Mao Minkai Date: Mon, 14 Apr 2025 17:06:03 +0800 Subject: [PATCH 04/14] sw64: use orig_r0 as syscall nr Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- Use orig_r0 as syscall number to make sure we can get the correct number after syscall_set_return_value() which modifies the value of regs[0]. For backward compatibility, any modifications made to $0 and $19 at syscall entry are also reflected on orig_r0 and orig_r19. If users want to skip syscall and set return value directly at syscall entry, they can use PTRACE_POKEUSR to set $0 and orig_r0 first, then use PTRACE_SETREGSET to set orig_r0 only (note type NT_SW64_SYSTEM_CALL). Signed-off-by: Mao Minkai Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/include/asm/syscall.h | 2 +- arch/sw_64/kernel/ptrace.c | 22 ++++++++++++++++++---- arch/sw_64/kernel/sys_sw64.c | 4 +--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/arch/sw_64/include/asm/syscall.h b/arch/sw_64/include/asm/syscall.h index a821bf68be16..33b4101a81e4 100644 --- a/arch/sw_64/include/asm/syscall.h +++ b/arch/sw_64/include/asm/syscall.h @@ -13,7 +13,7 @@ extern syscall_fn_t sys_call_table[]; static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { - return regs->regs[0]; + return regs->orig_r0; } static inline long diff --git a/arch/sw_64/kernel/ptrace.c b/arch/sw_64/kernel/ptrace.c index 6b4f51c926b7..83431d5dec1f 100644 --- a/arch/sw_64/kernel/ptrace.c +++ b/arch/sw_64/kernel/ptrace.c @@ -146,6 +146,20 @@ put_reg(struct task_struct *task, unsigned long regno, unsigned long data) return PTR_ERR(addr); else { *addr = data; + + /* + * Any modifications made to $0 and $19 at syscall entry + * should also be reflected on orig_r0 and orig_r19. + * + * See syscall_set() for how to modify orig_r0 only. + */ + if (task->ptrace_message == PTRACE_EVENTMSG_SYSCALL_ENTRY) { + if (regno == PT_REG_BASE) + task_pt_regs(task)->orig_r0 = data; + if (regno == (PT_REG_BASE + 19)) + task_pt_regs(task)->orig_r19 = data; + } + return 0; } } @@ -423,7 +437,6 @@ long arch_ptrace(struct task_struct *child, long request, asmlinkage unsigned long syscall_trace_enter(void) { - unsigned long ret = 0; struct pt_regs *regs = current_pt_regs(); if (test_thread_flag(TIF_SYSCALL_TRACE) && @@ -437,9 +450,10 @@ asmlinkage unsigned long syscall_trace_enter(void) #endif if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) - trace_sys_enter(regs, regs->regs[0]); - audit_syscall_entry(regs->regs[0], regs->regs[16], regs->regs[17], regs->regs[18], regs->regs[19]); - return ret ?: regs->regs[0]; + trace_sys_enter(regs, regs->orig_r0); + audit_syscall_entry(regs->orig_r0, regs->regs[16], + regs->regs[17], regs->regs[18], regs->regs[19]); + return regs->orig_r0; } asmlinkage void diff --git a/arch/sw_64/kernel/sys_sw64.c b/arch/sw_64/kernel/sys_sw64.c index 1397d86ac7a2..09289be850fc 100644 --- a/arch/sw_64/kernel/sys_sw64.c +++ b/arch/sw_64/kernel/sys_sw64.c @@ -346,7 +346,7 @@ asmlinkage void noinstr do_entSys(struct pt_regs *regs) regs->orig_r0 = regs->regs[0]; regs->orig_r19 = regs->regs[19]; - nr = regs->regs[0]; + nr = regs->orig_r0; if (ti_flags & _TIF_SYSCALL_WORK) { nr = syscall_trace_enter(); @@ -369,8 +369,6 @@ asmlinkage void noinstr do_entSys(struct pt_regs *regs) syscall_set_return_value(current, regs, -ENOSYS, 0); if (nr == NO_SYSCALL) goto syscall_out; - regs->orig_r0 = regs->regs[0]; - regs->orig_r19 = regs->regs[19]; } if (nr < __NR_syscalls) { -- Gitee From 8dc021978c9f94594cd55538e4e6fb056689d318 Mon Sep 17 00:00:00 2001 From: Xu Yiwei Date: Mon, 29 Sep 2025 07:08:24 +0000 Subject: [PATCH 05/14] sw64: msi: fix affinity change of managed irq Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- If a managed irq's affinity does not intersect with cpu_online_mask, it should be disabled instead of migrating into one of the online cpus. This patch add a check to stop affinity mask of a managed_irq from changing into cpu_online_mask. Signed-off-by: Xu Yiwei Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- drivers/irqchip/irq-sunway-msi-v2.c | 3 +++ drivers/irqchip/irq-sunway-msi.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/irqchip/irq-sunway-msi-v2.c b/drivers/irqchip/irq-sunway-msi-v2.c index 8ac98399b5d9..b41da97eac9a 100644 --- a/drivers/irqchip/irq-sunway-msi-v2.c +++ b/drivers/irqchip/irq-sunway-msi-v2.c @@ -233,6 +233,9 @@ static int __assign_irq_vector(int virq, unsigned int nr_irqs, if (irqd_affinity_is_managed(irq_data)) { mask = irq_data_get_affinity_mask(irq_data); cpumask_and(&searchmask, mask, cpu_online_mask); + + if (cpumask_empty(&searchmask)) + return -EINVAL; } else { node = irq_data_get_node(irq_data); cpumask_copy(&searchmask, cpumask_of_node(node)); diff --git a/drivers/irqchip/irq-sunway-msi.c b/drivers/irqchip/irq-sunway-msi.c index 024d20c25dd7..8f248895825f 100644 --- a/drivers/irqchip/irq-sunway-msi.c +++ b/drivers/irqchip/irq-sunway-msi.c @@ -214,6 +214,9 @@ static int __assign_irq_vector(int virq, unsigned int nr_irqs, if (irqd_affinity_is_managed(irq_data)) { mask = irq_data_get_affinity_mask(irq_data); cpumask_and(&searchmask, mask, cpu_online_mask); + + if (cpumask_empty(&searchmask)) + return -EINVAL; } else { node = irq_data_get_node(irq_data); cpumask_copy(&searchmask, cpumask_of_node(node)); -- Gitee From 84315042360d13e141bef414ea608ff78a209e9d Mon Sep 17 00:00:00 2001 From: Xu Yiwei Date: Mon, 22 Sep 2025 06:54:19 +0000 Subject: [PATCH 06/14] sw64: irqchip: update effective affinity for INTx Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- As CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK is selected, it is necessary to update effective affinity when setting affinity for INTx. Signed-off-by: Xu Yiwei Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- drivers/irqchip/irq-sunway-pci-intx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/irqchip/irq-sunway-pci-intx.c b/drivers/irqchip/irq-sunway-pci-intx.c index 6b82872c2346..766de88170ef 100644 --- a/drivers/irqchip/irq-sunway-pci-intx.c +++ b/drivers/irqchip/irq-sunway-pci-intx.c @@ -60,6 +60,7 @@ static int __assign_piu_intx_config(struct intx_chip_data *chip_data, unsigned int cpu; int thread, node, core, rcid; unsigned int i; + struct irq_data *irq_data; if (is_guest_or_emul()) return 0; @@ -89,6 +90,9 @@ static int __assign_piu_intx_config(struct intx_chip_data *chip_data, (i << PCI_INTXCONFIG_OFFSET)); chip_data->intxconfig[i] = intxconfig; } + irq_data = irq_get_irq_data(hose->int_irq); + irq_data_update_effective_affinity(irq_data, cpumask_of(cpu)); + return 0; } -- Gitee From bf6fbb634b4e34d121f4af16e9a2efe6308ee200 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Sat, 11 Oct 2025 15:28:14 +0800 Subject: [PATCH 07/14] sw64: smp: fix unaligned access before trap_init() Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- Replace function sunway_machine_is_compatible() with function is_junzhang_v1() to avoid unaligned access before trap_init(). Signed-off-by: Jing Li Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sw_64/kernel/smp.c b/arch/sw_64/kernel/smp.c index 53aeb4c9792f..968772b7013f 100644 --- a/arch/sw_64/kernel/smp.c +++ b/arch/sw_64/kernel/smp.c @@ -72,7 +72,7 @@ static void upshift_freq(void) if (is_guest_or_emul()) return; - if (!sunway_machine_is_compatible("sunway,junzhang")) + if (!is_junzhang_v1()) return; cpu_num = sw64_chip->get_cpu_num(); @@ -95,7 +95,7 @@ static void downshift_freq(void) if (is_guest_or_emul()) return; - if (!sunway_machine_is_compatible("sunway,junzhang")) + if (!is_junzhang_v1()) return; for_each_online_cpu(cpu) { -- Gitee From d2afa43ebea2a7e3f04330464343af7808c60235 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Fri, 22 Aug 2025 09:07:31 +0800 Subject: [PATCH 08/14] sw64: powercap: avoid checking meaningless target freq Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- The target freq field is only meaningful when powercap is enabled and frequency limitation is required. Signed-off-by: Jing Li Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- drivers/platform/sw64/powercap.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/platform/sw64/powercap.c b/drivers/platform/sw64/powercap.c index 3f380ace5601..0bb62065065e 100644 --- a/drivers/platform/sw64/powercap.c +++ b/drivers/platform/sw64/powercap.c @@ -243,6 +243,16 @@ static inline bool is_powercap_cpu_match(const struct sunway_powercap_cpu *data, return true; } +static inline bool is_powercap_enabled(const struct sunway_powercap_freq *freq) +{ + return !!(freq->flags & FREQ_FLAG_ENABLE); +} + +static inline bool is_powercap_no_limit(const struct sunway_powercap_freq *freq) +{ + return !!(freq->flags & FREQ_FLAG_FREE); +} + static int sunway_powercap_validate_freq(const struct sunway_powercap_freq *freq, struct sunway_powercap_ack *ack) { @@ -268,6 +278,10 @@ static int sunway_powercap_validate_freq(const struct sunway_powercap_freq *freq ack->flags |= ACK_FLAG_VALID_NODE; ack->flags |= ACK_FLAG_VALID_CORE; + /* Make sure that the target freq field is meaningful */ + if (!is_powercap_enabled(freq) || is_powercap_no_limit(freq)) + return 0; + if (cpufreq_frequency_table_get_index(policy, target_freq) < 0) { pr_err("invalid target freq %u\n", target_freq); return -EINVAL; @@ -284,16 +298,6 @@ static int sunway_powercap_validate_freq(const struct sunway_powercap_freq *freq return -EINVAL; } -static inline bool is_powercap_enabled(const struct sunway_powercap_freq *freq) -{ - return !!(freq->flags & FREQ_FLAG_ENABLE); -} - -static inline bool is_powercap_no_limit(const struct sunway_powercap_freq *freq) -{ - return !!(freq->flags & FREQ_FLAG_FREE); -} - static inline bool is_powercap_freq_data_terminate(const struct sunway_powercap_freq *freq) { -- Gitee From 1d95f2762468c015a155666f74d7655276aa547e Mon Sep 17 00:00:00 2001 From: Jing Li Date: Thu, 18 Sep 2025 16:51:48 +0800 Subject: [PATCH 09/14] sw64: powercap: fix Kconfig dependency for SW64_POWERCAP Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- The function of Sunway powercap driver is built on the basis of Sunway cpufreq driver, so SW64_POWERCAP depends on SW64_CPUFREQ rather than the generic CPUFREQ. Furthermore, Sunway powercap driver will fail to link when CONFIG_IPMI_HANDLER=m, so directly select IPMI_HANDLER. Signed-off-by: Jing Li Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/sw_64/Kconfig b/arch/sw_64/Kconfig index 7af20faf9f43..75b3cf116dc8 100644 --- a/arch/sw_64/Kconfig +++ b/arch/sw_64/Kconfig @@ -682,8 +682,9 @@ config ARCH_HIBERNATION_POSSIBLE config SW64_POWERCAP bool "Sunway powercap driver" + select IPMI_HANDLER select IPMI_SI - depends on SW64 && CPU_FREQ && ACPI && IPMI_HANDLER + depends on SW64_CPUFREQ && ACPI help This enables support for the sunway powercap driver based on BMC and IPMI system interface. -- Gitee From 8f6f68ae85e986e6d1629fe3c0baff2f7a8367ab Mon Sep 17 00:00:00 2001 From: Jing Li Date: Thu, 18 Sep 2025 17:08:38 +0800 Subject: [PATCH 10/14] sw64: powercap: increase the interval of polling mode Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- The polling interval is too small, resulting in excessive occupation of IPMI bandwidth, thus increasing the polling interval. Signed-off-by: Jing Li Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- drivers/platform/sw64/powercap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/platform/sw64/powercap.c b/drivers/platform/sw64/powercap.c index 0bb62065065e..61eef4095203 100644 --- a/drivers/platform/sw64/powercap.c +++ b/drivers/platform/sw64/powercap.c @@ -18,6 +18,8 @@ #define SUNWAY_POWERCAP_ACPI_NOTIFY_VALUE 0x84 +#define POLL_INTERVAL_UNIT_10MS 10 + enum sunway_powercap_version { SUNWAY_POWERCAP_V1 = 1, SUNWAY_POWERCAP_VERSION_MAX, @@ -531,7 +533,7 @@ static int sunway_powercap_setup_cfg(const struct sunway_powercap_cfg *cfg) driver_data.version = cfg->version; driver_data.mode = cfg->mode; - driver_data.poll_interval = cfg->poll_interval; + driver_data.poll_interval = cfg->poll_interval * POLL_INTERVAL_UNIT_10MS; if (is_poll_mode) { timer_setup(&driver_data.timer, sunway_powercap_poll_func, 0); -- Gitee From 48a034bf25d96774235aedde4ee324e5dfac759e Mon Sep 17 00:00:00 2001 From: Jing Li Date: Thu, 18 Sep 2025 17:20:09 +0800 Subject: [PATCH 11/14] sw64: powercap: fix misuse of an uninitialized temporary variable Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- Due to typo, the temporary variable related_cpu is misused. Signed-off-by: Jing Li Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- drivers/platform/sw64/powercap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/sw64/powercap.c b/drivers/platform/sw64/powercap.c index 61eef4095203..b1856ca24ddc 100644 --- a/drivers/platform/sw64/powercap.c +++ b/drivers/platform/sw64/powercap.c @@ -704,10 +704,10 @@ static int sunway_powercap_probe(struct platform_device *pdev) struct freq_qos_request *req; /* Initial state */ - powercap_cpu_data[related_cpu].state = SUNWAY_POWERCAP_STATE_FREE; + powercap_cpu_data[cpu].state = SUNWAY_POWERCAP_STATE_FREE; - powercap_cpu_data[related_cpu].core = rcid_to_core_id(rcid); - powercap_cpu_data[related_cpu].node = rcid_to_domain_id(rcid); + powercap_cpu_data[cpu].core = rcid_to_core_id(rcid); + powercap_cpu_data[cpu].node = rcid_to_domain_id(rcid); if (powercap_cpu_data[cpu].policy) continue; -- Gitee From 163d26429f85338c6eed96ede3bfb561098c28cf Mon Sep 17 00:00:00 2001 From: Jing Li Date: Fri, 17 Oct 2025 17:34:43 +0800 Subject: [PATCH 12/14] sw64: efi: fix compile error when CONFIG_EFI=n Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- Signed-off-by: Jing Li Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/kernel/cpu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/sw_64/kernel/cpu.c b/arch/sw_64/kernel/cpu.c index 172cca36e42d..7683fedda70f 100644 --- a/arch/sw_64/kernel/cpu.c +++ b/arch/sw_64/kernel/cpu.c @@ -70,7 +70,7 @@ static int cpuinfo_cpu_online(unsigned int cpu) return 0; } -static const char * __init dmi_get_string(const struct dmi_header *dm, u8 s) +static __maybe_unused const char * __init dmi_get_string(const struct dmi_header *dm, u8 s) { const u8 *bp = ((u8 *) dm) + dm->length; const u8 *nsp; @@ -90,7 +90,7 @@ static const char * __init dmi_get_string(const struct dmi_header *dm, u8 s) return ""; } -static void __init find_dmi_processor_version(const struct dmi_header *dm, +static __maybe_unused void __init find_dmi_processor_version(const struct dmi_header *dm, void *private) { char *dmi_data = (char *)dm; @@ -113,10 +113,12 @@ static void __init get_model_id(void) int i; unsigned long val; +#ifdef CONFIG_EFI /* Prefer model id from SMBIOS */ if (!IS_ENABLED(CONFIG_SUBARCH_C3B) && sunway_bios_version) dmi_walk(find_dmi_processor_version, NULL); +#endif if (strlen(model_id) > 0) return; @@ -128,7 +130,7 @@ static void __init get_model_id(void) } } -static void __init find_dmi_processor_manufacturer(const struct dmi_header *dm, +static __maybe_unused void __init find_dmi_processor_manufacturer(const struct dmi_header *dm, void *private) { char *dmi_data = (char *)dm; @@ -151,10 +153,12 @@ static void __init get_vendor_id(void) int i; unsigned long val; +#ifdef CONFIG_EFI /* Prefer vendor id from SMBIOS */ if (!IS_ENABLED(CONFIG_SUBARCH_C3B) && sunway_bios_version) dmi_walk(find_dmi_processor_manufacturer, NULL); +#endif if (strlen(vendor_id) > 0) return; @@ -166,7 +170,7 @@ static void __init get_vendor_id(void) } } -static void __init find_dmi_processor_family(const struct dmi_header *dm, +static __maybe_unused void __init find_dmi_processor_family(const struct dmi_header *dm, void *private) { char *dmi_data = (char *)dm; @@ -182,10 +186,12 @@ static void __init find_dmi_processor_family(const struct dmi_header *dm, static void __init get_family(void) { +#ifdef CONFIG_EFI /* Prefer processor family from SMBIOS */ if (!IS_ENABLED(CONFIG_SUBARCH_C3B) && sunway_bios_version) dmi_walk(find_dmi_processor_family, NULL); +#endif if (family) return; -- Gitee From c6273b3f13181980dc242a2ae2a6e05fb52a8bc0 Mon Sep 17 00:00:00 2001 From: Gao Chen Date: Wed, 22 Oct 2025 16:51:50 +0800 Subject: [PATCH 13/14] sw64: fix the condition for enabling hw_una_enabled Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- The hw_una_enabled should be enabled by checking hmcode feature. Signed-off-by: Gao Chen Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sw_64/kernel/setup.c b/arch/sw_64/kernel/setup.c index 9fa107a5b17b..0c81ea65d187 100644 --- a/arch/sw_64/kernel/setup.c +++ b/arch/sw_64/kernel/setup.c @@ -577,7 +577,7 @@ static void __init setup_firmware_fdt(void) static void __init setup_cpu_caps(void) { - if (!IS_ENABLED(CONFIG_SUBARCH_C3B) && !is_junzhang_v1()) + if (cpuid(GET_FEATURES, 0) & CPU_FEAT_UNA) static_branch_enable(&hw_una_enabled); } -- Gitee From c4bd39992b3bd436dde6190507b463058698e91a Mon Sep 17 00:00:00 2001 From: Gu Zitao Date: Fri, 24 Oct 2025 09:30:37 +0800 Subject: [PATCH 14/14] sw64: add CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y to defconfig Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID3AUO -------------------------------- Enable CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y as default to fix compile errors. Signed-off-by: Gu Zitao Reviewed-by: He Sheng --- arch/sw_64/configs/junzhang_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sw_64/configs/junzhang_defconfig b/arch/sw_64/configs/junzhang_defconfig index c036ea36cda0..7bd439aaf2e7 100644 --- a/arch/sw_64/configs/junzhang_defconfig +++ b/arch/sw_64/configs/junzhang_defconfig @@ -679,5 +679,6 @@ CONFIG_CRYPTO_LZO=y CONFIG_CRC_ITU_T=y CONFIG_CONSOLE_LOGLEVEL_QUIET=7 CONFIG_SCHEDSTATS=y +CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y # CONFIG_RCU_TRACE is not set CONFIG_STACK_TRACER=y -- Gitee