Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2995913rwb; Sat, 8 Oct 2022 19:18:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64rfOQekz/hZ42Ptrm3xAndHVk9h1GbXKG1QsVjxpwdQi34FbZMtoERqyoN8XvBZnv6Men X-Received: by 2002:a05:6402:3705:b0:454:e006:82 with SMTP id ek5-20020a056402370500b00454e0060082mr11310221edb.360.1665281917523; Sat, 08 Oct 2022 19:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665281917; cv=none; d=google.com; s=arc-20160816; b=UrhCJmfa4F9VR4Q64/uMOGK+hhHD1Um2VuLSfDYfZgvFzbYS29rBikcHIoxIUudbny LbjE4sGYQ12jekcm5y+5fdW5O7puHCUFTbtWbXFkh5gYX7xQwyLyCbJE/MW1E6ywHKOk +aPPTd1YUVHtbTOpC1IG/9hIe1OllHm3EEaqjlklmBmurfHVkramU7MSEgUNhZ+Oy5FB bqmNahM2H+C73hH2xTJUK8C/iQglmnkY38NoCP5Te0TwaoCpVZdMs/UnfCQ1iUlHiyBp P+KM5+zyQOgUaP3a3Eq73SL8YwwxL1pGtMbgqrUS+PLe1tB83sLW73htgxGZoFrROqJF NZFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=E4g/mc4V/ETW9BBUWRmSoCpmnfZEdqCev+n1qFBd74M=; b=0wwlAkqWOtjPsBHekaB9ueq42B2p+KOM9RbwvN0dOXMtaBwBdGK76++9Jm1v8qRv5/ xCV3f+kTk53quRRQBkBh1dLaO3V+/RhJEGX+dfRBhjsMvIVYsXjUhVUJ2+9ISX0tmoar Pvy6tywitVUN+YXh9ZN3L1RgHucWWTWNe/6lT+IlDoNJ5Ioy58bQ0oFnknbgDQk20+oK EJFuRgTYWDjp6kXpfgQhVIOAAg1g3dgkBaiQ/W1i8kF+/s3yjLCeleuLp5ZxChzE4hwL 3g7lUobOmXz5DvRW/xMss+bBCrRHXKkdTlE4IPEECq/zb+ig6n3jRI9nDuWzD8h/jtIE JDnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne12-20020a1709077b8c00b00780cb1272eesi7003654ejc.466.2022.10.08.19.18.12; Sat, 08 Oct 2022 19:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbiJIBXI (ORCPT + 99 others); Sat, 8 Oct 2022 21:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbiJIBXH (ORCPT ); Sat, 8 Oct 2022 21:23:07 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9558B1572E for ; Sat, 8 Oct 2022 18:23:05 -0700 (PDT) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx5OF3IkJjsvkoAA--.18413S2; Sun, 09 Oct 2022 09:23:04 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] LoongArch: Do not create sysfs control file for io master CPUs Date: Sun, 9 Oct 2022 09:23:02 +0800 Message-Id: <1665278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VC2 z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUg9mRDUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now io master CPUs are not hotpluggable on LoongArch, in the current code, only /sys/devices/system/cpu/cpu0/online is not created, let us set the hotpluggable field of all the io master CPUs as 0, then prevent to create sysfs control file for the other io master CPUs which confuses some user space tools. This is similar with commit 9cce844abf07 ("MIPS: CPU#0 is not hotpluggable"). Signed-off-by: Tiezhu Yang --- arch/loongarch/include/asm/bootinfo.h | 5 +++++ arch/loongarch/kernel/smp.c | 5 ----- arch/loongarch/kernel/topology.c | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/loongarch/include/asm/bootinfo.h b/arch/loongarch/include/asm/bootinfo.h index 8e5881b..ed0910e 100644 --- a/arch/loongarch/include/asm/bootinfo.h +++ b/arch/loongarch/include/asm/bootinfo.h @@ -40,4 +40,9 @@ extern unsigned long fw_arg0, fw_arg1, fw_arg2; extern struct loongson_board_info b_info; extern struct loongson_system_configuration loongson_sysconf; +static inline bool io_master(int cpu) +{ + return test_bit(cpu, &loongson_sysconf.cores_io_master); +} + #endif /* _ASM_BOOTINFO_H */ diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index b5fab30..781a4d4 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -240,11 +240,6 @@ void loongson3_smp_finish(void) #ifdef CONFIG_HOTPLUG_CPU -static bool io_master(int cpu) -{ - return test_bit(cpu, &loongson_sysconf.cores_io_master); -} - int loongson3_cpu_disable(void) { unsigned long flags; diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c index ab1a75c..caa7cd8 100644 --- a/arch/loongarch/kernel/topology.c +++ b/arch/loongarch/kernel/topology.c @@ -5,6 +5,7 @@ #include #include #include +#include static DEFINE_PER_CPU(struct cpu, cpu_devices); @@ -40,7 +41,7 @@ static int __init topology_init(void) for_each_present_cpu(i) { struct cpu *c = &per_cpu(cpu_devices, i); - c->hotpluggable = !!i; + c->hotpluggable = !io_master(i); ret = register_cpu(c, i); if (ret < 0) pr_warn("topology_init: register_cpu %d failed (%d)\n", i, ret); -- 2.1.0