From 601671ad13dbcb183fc331b050e5d21191517b04 Mon Sep 17 00:00:00 2001 From: Min Fanlei Date: Tue, 9 Sep 2025 16:40:49 +0800 Subject: [PATCH 01/13] anolis: sw64: kvm: add the C4 kvm_regs structure to uapi kvm.h ANBZ: #4688 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 52bc44a74715f15160a77e5d109de1214fd3cc08 Mon Sep 17 00:00:00 2001 From: Gu Yuchen Date: Mon, 8 Sep 2025 12:33:59 +0800 Subject: [PATCH 02/13] anolis: sw64: fix unresolved reference error when close pci ANBZ: #4688 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 9d22c7a8ec7a4a29cc8ee7aea8278a7943200aad Mon Sep 17 00:00:00 2001 From: Gao Chen Date: Wed, 24 Sep 2025 15:24:30 +0800 Subject: [PATCH 03/13] anolis: sw64: revert ioremap() to __va() in ioport_map() ANBZ: #4688 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 5320b82de110c34e2cd4f95773957704cad85c47 Mon Sep 17 00:00:00 2001 From: Mao Minkai Date: Mon, 14 Apr 2025 17:06:03 +0800 Subject: [PATCH 04/13] anolis: sw64: use orig_r0 as syscall nr ANBZ: #4688 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 a28a9daf893c..5a27cb51d38c 100644 --- a/arch/sw_64/kernel/ptrace.c +++ b/arch/sw_64/kernel/ptrace.c @@ -145,6 +145,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; } } @@ -422,7 +436,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) && @@ -436,9 +449,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 79d38ecec232aa6ae8dbdd0663cde300bd294d5c Mon Sep 17 00:00:00 2001 From: Xu Yiwei Date: Mon, 29 Sep 2025 07:08:24 +0000 Subject: [PATCH 05/13] anolis: sw64: msi: fix affinity change of managed irq ANBZ: #4688 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 69e09df59af4dce8ffc96ee8ee3483c8a762791e Mon Sep 17 00:00:00 2001 From: Xu Yiwei Date: Mon, 22 Sep 2025 06:54:19 +0000 Subject: [PATCH 06/13] anolis: sw64: irqchip: update effective affinity for INTx ANBZ: #4688 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 d8b645abe7ca8c6b8b7a0b66684173f61d53c598 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Sat, 11 Oct 2025 15:28:14 +0800 Subject: [PATCH 07/13] anolis: sw64: smp: fix unaligned access before trap_init() ANBZ: #4688 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 f31a7c589fb7..648698877476 100644 --- a/arch/sw_64/kernel/smp.c +++ b/arch/sw_64/kernel/smp.c @@ -73,7 +73,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(); @@ -96,7 +96,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 ad2a3bb26a2924d99c4a080a310c98cc86434cd2 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Fri, 22 Aug 2025 09:07:31 +0800 Subject: [PATCH 08/13] anolis: sw64: powercap: avoid checking meaningless target freq ANBZ: #4688 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 3edfc4672eff9798902e33e3049cc64e0a3160b4 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Thu, 18 Sep 2025 16:51:48 +0800 Subject: [PATCH 09/13] anolis: sw64: powercap: fix Kconfig dependency for SW64_POWERCAP ANBZ: #4688 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 7c2c2f7064b7..55bc5593618f 100644 --- a/arch/sw_64/Kconfig +++ b/arch/sw_64/Kconfig @@ -706,8 +706,9 @@ config ARCH_SELECT_MEMORY_MODEL 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 5aab1f58fbe8ef8e8e1059a194bdad7aa9b6ff34 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Thu, 18 Sep 2025 17:08:38 +0800 Subject: [PATCH 10/13] anolis: sw64: powercap: increase the interval of polling mode ANBZ: #4688 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 305805403c2f720eb314dd7dbfb0270a3a953b49 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Thu, 18 Sep 2025 17:20:09 +0800 Subject: [PATCH 11/13] anolis: sw64: powercap: fix misuse of an uninitialized temporary variable ANBZ: #4688 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 1457ed3e1b3d58dc5ad11631ceb5f7c325b7feca Mon Sep 17 00:00:00 2001 From: Jing Li Date: Fri, 17 Oct 2025 17:34:43 +0800 Subject: [PATCH 12/13] anolis: sw64: efi: fix compile error when CONFIG_EFI=n ANBZ: #4688 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 3d28135840e89b81b1d93bb82c6f0da3fafae055 Mon Sep 17 00:00:00 2001 From: Gao Chen Date: Wed, 22 Oct 2025 16:51:50 +0800 Subject: [PATCH 13/13] anolis: sw64: fix the condition for enabling hw_una_enabled ANBZ: #4688 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 8cfcc30aad2e..a026c90058c0 100644 --- a/arch/sw_64/kernel/setup.c +++ b/arch/sw_64/kernel/setup.c @@ -578,7 +578,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