Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5198095imw; Wed, 20 Jul 2022 00:27:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tesKWZwtCDkrEES5++msgvN6BmZHt0s6LfDFWyGD1Boj+j5NgGWqdHPRbzuNTgsyvlhF3Q X-Received: by 2002:a05:6402:4245:b0:43a:961a:583f with SMTP id g5-20020a056402424500b0043a961a583fmr49120158edb.374.1658302066042; Wed, 20 Jul 2022 00:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658302066; cv=none; d=google.com; s=arc-20160816; b=AY2jHV1pwZCbEXRAz0rf+unO1aUJ2A4/6U0yFWj9XK4S3VO0YatMLyQEGU8bqqv70I WltZ+lR0r4iRb+bjc5dfiLprY8SiAuvLqMfeaelOS2u3i0gybKkgbGgWqZdxY7lgK4fV elzgQQDMxDKL5kZ3vPjfPSiZEo8gTINKGh05NrFr+WFZRU3bX9aL5UBymywuarucbM/X C/2oRInpOY4d2zF7L1vK9oISXMaK1S5n82gFgl9QWFDPuXLndsCx8Cf537KpPoInWHjk 7jG++CBRAjCEGaR4rwr+emWVzsRpsc342BRAOy2nZjmFvN/FSH4Y/+s7sQoozzpxeWa7 2FnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=vC/C3CfQCTS+vjCjnLDHOnfRkrTkp+uWXFO8jBH8Dxo=; b=rhpggBUDeFJtoMe8bltO59nW59Lp0QKXJUI8gbcnQvy9wgMmEwfHKLOwC9guhV04qa Mva7nQchn81XNZ8k+oNAnQFvYTB8D9GUPPdMvJ413yTvOsFDx3TUODbnLmW0TyTB2jrk x4PZa8Q6XJRSiaUSxCLvJPSGmSPfzYhnwYbcV6zP0nW4ER3xqtfObdpXnnxY6KzDvsA1 ddX5JA6nM3jJW5PaD+0siBEvFSFqeF2bpBR3wsK2C8YvnT/Hzb+wV+EMXUmDgfmz6vPF iS/fwqpm7/JfNeppeajMlv/yVnIiXkkoA7SygQmyDExharJVI/CgwcQ0e/I7W2w8qcMy DAjw== 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 qw29-20020a1709066a1d00b0072b83ed8d42si18298449ejc.82.2022.07.20.00.27.21; Wed, 20 Jul 2022 00:27:46 -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 S238439AbiGTHWF (ORCPT + 99 others); Wed, 20 Jul 2022 03:22:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238045AbiGTHWC (ORCPT ); Wed, 20 Jul 2022 03:22:02 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C12B766B83 for ; Wed, 20 Jul 2022 00:22:00 -0700 (PDT) Received: from localhost.localdomain (unknown [10.2.5.185]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxKeEQrddivyMqAA--.15305S2; Wed, 20 Jul 2022 15:21:53 +0800 (CST) From: Bibo Mao To: Huacai Chen Cc: WANG Xuerui , Jiaxun Yang , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] LoongArch: Remove clock setting during cpu hotplug stage Date: Wed, 20 Jul 2022 15:21:51 +0800 Message-Id: <20220720072152.3894559-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9AxKeEQrddivyMqAA--.15305S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Zw4UCw1rCF4UJrWftF4fXwb_yoW8trWrpr n3u3Z7KrWkKwn7uw1ktryDCr15Cwn7J343ZFy7Ga4rAFyDAr18uFy5tF97XFWft3sFvayF gr1ku3yYka4DWrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ 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 On physical machine we can save power by disabling clock of hot removed cpu. However there will be problem, since different platforms have different clock setting methods, the code is platform relative. Also it can be in firmware/pmu compoments or cpu regulator driver, rather than general loongarch cpu booting flow. Also on qemu virt machine, device clock/freq setting is not emulated, there is no such registers. This patch removes hard-coded register accessing in generic loongarch cpu boot flow. Signed-off-by: Bibo Mao --- arch/loongarch/kernel/smp.c | 29 ----------------------------- include/linux/cpuhotplug.h | 1 - 2 files changed, 30 deletions(-) diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index 73cec62504fb..98b3e059d344 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -359,35 +359,6 @@ void play_dead(void) play_dead_uncached(state_addr); } -static int loongson3_enable_clock(unsigned int cpu) -{ - uint64_t core_id = cpu_data[cpu].core; - uint64_t package_id = cpu_data[cpu].package; - - LOONGSON_FREQCTRL(package_id) |= 1 << (core_id * 4 + 3); - - return 0; -} - -static int loongson3_disable_clock(unsigned int cpu) -{ - uint64_t core_id = cpu_data[cpu].core; - uint64_t package_id = cpu_data[cpu].package; - - LOONGSON_FREQCTRL(package_id) &= ~(1 << (core_id * 4 + 3)); - - return 0; -} - -static int register_loongson3_notifier(void) -{ - return cpuhp_setup_state_nocalls(CPUHP_LOONGARCH_SOC_PREPARE, - "loongarch/loongson:prepare", - loongson3_enable_clock, - loongson3_disable_clock); -} -early_initcall(register_loongson3_notifier); - #endif /* diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 19f0dbfdd7fe..b66c5f389159 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -130,7 +130,6 @@ enum cpuhp_state { CPUHP_ZCOMP_PREPARE, CPUHP_TIMERS_PREPARE, CPUHP_MIPS_SOC_PREPARE, - CPUHP_LOONGARCH_SOC_PREPARE, CPUHP_BP_PREPARE_DYN, CPUHP_BP_PREPARE_DYN_END = CPUHP_BP_PREPARE_DYN + 20, CPUHP_BRINGUP_CPU, -- 2.31.1