Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5260776imw; Wed, 20 Jul 2022 02:10:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tsv1pkzRh/e7pNTyTFx+vibMRCgW3L1YzbH4XgCtc3hObb+Ii2Ax6yduzXAy7GZNzuMIrz X-Received: by 2002:a65:6a04:0:b0:411:b3d3:a840 with SMTP id m4-20020a656a04000000b00411b3d3a840mr33576439pgu.99.1658308224431; Wed, 20 Jul 2022 02:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658308224; cv=none; d=google.com; s=arc-20160816; b=gn1lCc5Mz48JKMwC3Ouhi1WibLOVe+ZLW0QffJl5TXdD+1Al2VWGpvIKgJdtf8i0UW 2Kl58pcEZn/ztbeQPMKvl8PHbsokr3BEvAhVrzN0MxdMKd0GHHSkqP9ju+mETRQZEzlr q/ErZkfYKfU0hqWzqcJS6OEiLiqp+ErVoP0JAsvinXj+rO0e9LvipL/om3t7EVgKoDZD MJICOUszimO1uy/Wj9LGaR9mJAXOd0SYcT+rwrslcpkWs9swnjWF/x2dgbOBMx+TKZdt xjvDFwtkpvg04dmgwU0EXyGZDSdkQR+DrBFM2BVMYhpha0h0ciRqFl8JosiG1Y9439/t FS1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=70tfrtlQIRfo9UQNCDyey4vudsQdIX1CGyIvpiO9kZU=; b=mYWf70ZBM+2wc//vntzpbkvSq5ZGaEKfEjg7ad6yb+UApr8/ONqjoUIIgpowWEpCJo As4QjaKaLiJpB0Uu7utnq+WXQqP3ZxO1H69LEig3M0iG5R4Kd32lGQq+4yMjxosp6AP3 LTyuRbGXjbZZwhVV6mcPD3EEobkPVXNFsxaGuQJlG5GPVd+VnjHVzY1eOix7heFV8rY+ gitoNxGkD4uoks4EFmkKtQ6U4npiceHtYB3z15v3DVhLcbW5uB2fdLaKzU14xmVnPr/c 8bM/KOdvB85p1ovMcXiK9sLdcJSqkf686SfMwGBFt1cRSeMXEkdqVVSaEU699mku8reZ QGcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O5Wg1M9j; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a17090a4e0100b001f1fb8ef790si1792192pjh.22.2022.07.20.02.10.08; Wed, 20 Jul 2022 02:10:24 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O5Wg1M9j; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232233AbiGTJBS (ORCPT + 99 others); Wed, 20 Jul 2022 05:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbiGTJBR (ORCPT ); Wed, 20 Jul 2022 05:01:17 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 384C9419A4 for ; Wed, 20 Jul 2022 02:01:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6D88ACE1F2E for ; Wed, 20 Jul 2022 09:01:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85789C341D0 for ; Wed, 20 Jul 2022 09:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658307668; bh=vij3xEAreA0G5szeWk88+d4Xp57P6c4ll2m+XCxei8A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=O5Wg1M9j1o/NGtP/V0wOdyp6Sb/+31Lpnf5yGATdQVx9KdJpKYjCM8AY9dgsCVwD+ wLstczMebtKfXc0Ar3+/nu6UmkcmVtKrhOkDvh9VCdCPsJgH28tqLNu4JJA4sfAstZ 4Z0rOAnumJRejbI0Hz/ssEvWu5bbrjP6/KaZeUiDWlEbk8QcMKu7Ksu2IFyfIfhALS anK1PVDv/lbMA5Y7B6rQlFdKQCf7r+nPdybjbn7wAhORqKk1bpJaKCJ2+hYgaJFANr t68rdrPscBWD4TlC7i91tDrNtLShQEajiB4LtqCupFz2VGO5i/0p41heejm7CowMrI pCj0hJ7EPJBmA== Received: by mail-ua1-f53.google.com with SMTP id u12so7791640uap.11 for ; Wed, 20 Jul 2022 02:01:08 -0700 (PDT) X-Gm-Message-State: AJIora/BaBECgM9SRi+l1YYgg13QBD9XdsBv5IMdTsRVabwPiuCDzMcl HCgW4KVIH+S/ePAitsIJ93VEzm8Jzrt/CG8W1Ak= X-Received: by 2002:a9f:3253:0:b0:383:c330:68 with SMTP id y19-20020a9f3253000000b00383c3300068mr9795065uad.104.1658307666982; Wed, 20 Jul 2022 02:01:06 -0700 (PDT) MIME-Version: 1.0 References: <20220720072152.3894559-1-maobibo@loongson.cn> In-Reply-To: <20220720072152.3894559-1-maobibo@loongson.cn> From: Huacai Chen Date: Wed, 20 Jul 2022 17:00:54 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] LoongArch: Remove clock setting during cpu hotplug stage To: Bibo Mao Cc: WANG Xuerui , Jiaxun Yang , loongarch@lists.linux.dev, LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 Hi, Bibo, This series looks good to me, but I want to wait for some time to see if others have comments. Thanks. Huacai On Wed, Jul 20, 2022 at 3:22 PM Bibo Mao wrote: > > 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 > >