Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3988079rdb; Wed, 30 Aug 2023 11:53:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGR02JN67VvG3FU2yCPVrCKgdY1bdU3KYhsRe0Qr1DGx7wOM5bDOzmoSov7Vgh48Xl+C971 X-Received: by 2002:a05:6358:52c9:b0:13e:bd8d:c2a7 with SMTP id z9-20020a05635852c900b0013ebd8dc2a7mr3612441rwz.5.1693421618585; Wed, 30 Aug 2023 11:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693421618; cv=none; d=google.com; s=arc-20160816; b=kzoirXgwLhAW/cmP1/1fXvlbojtsXCD2YbdE4K8yjhDHhcHbJxtbcv5Mpj3cFXLmIc 8ed4M24jY7+s59wCLkqkgYgMozSUSBjpe9DbHLR3Fsu3CUbpA5HbTRtoi98PkGK0FMwC 9dTik5BeIrhhFOhSyXbng2xNLnisL++enQnbIjDsKTLrzT6TsVW/7wXxsFJo4BfqikY/ EeBBM5OJZlH3fIey91LbEfU0syfQyh4aobB24JaCMdBqEAgt7vDXHE4F+sYVeKH4q/o5 3FtpNGsh8Wi5aQgh9shdDD7zPHkWi0SsiLzTyfWha/bn8e30hi3dkm2itzCYsJ6qyNBu W2Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vXfjiUBYvbnZKs85k8Dahu9Psa0xd+xsiuRjJQPP8iQ=; fh=u3LiZzCIOX1uHtebcR605vWmMvJ7sMgagmrC+5ybDIw=; b=lFBxEzHyNVGJ03k4UUvbglHYvD6FqskNzb/Qq8+fHRZkbK5x8o74YKPgzCDZwzHwnC y7097d6/aI/91dIdLX9wKLyMLGeerxsBgHqvdAwuLX90GPnIYxYr/1WNgzN4gkqpUkIk mK5yopOVy6ZfNvBKMrSFRlQqlxPaSHLyTbxiSrumSJqVYl+cF9P76V23FwobkQwM6B60 6hBzr0AQqXVx7/u5D1KiYQVVY5xKrfyy51Xh5MORLw4+tYm3AT797sP4DaQrCl8ZN0k5 JPUAcNyoNRdLeWwk2u7u1Jv6edp2hsvFmSe8mBnRzkAUsAC/DEZIIBCQTvMWOneidrrA Z3gg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 204-20020a6302d5000000b00563e6387a54si2920787pgc.258.2023.08.30.11.53.22; Wed, 30 Aug 2023 11:53:38 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243562AbjH3Sss (ORCPT + 99 others); Wed, 30 Aug 2023 14:48:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243388AbjH3Kwh (ORCPT ); Wed, 30 Aug 2023 06:52:37 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 26D1A1BE; Wed, 30 Aug 2023 03:52:34 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 12BDB2F4; Wed, 30 Aug 2023 03:53:12 -0700 (PDT) Received: from bogus (unknown [10.57.36.157]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7AF933F64C; Wed, 30 Aug 2023 03:52:31 -0700 (PDT) Date: Wed, 30 Aug 2023 11:51:34 +0100 From: Sudeep Holla To: Oza Pawandeep Cc: catalin.marinas@arm.com, will@kernel.org, rafael@kernel.org, lenb@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH v3] cpuidle, ACPI: Evaluate LPI arch_flags for broadcast timer Message-ID: <20230830105134.dskqqq55npsclibq@bogus> References: <20230829201101.3330337-1-quic_poza@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230829201101.3330337-1-quic_poza@quicinc.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 Tue, Aug 29, 2023 at 01:11:01PM -0700, Oza Pawandeep wrote: > Arm? Functional Fixed Hardware Specification defines LPI states, > which provide an architectural context loss flags field that can > be used to describe the context that might be lost when an LPI > state is entered. > > - Core context Lost > - General purpose registers. > - Floating point and SIMD registers. > - System registers, include the System register based > - generic timer for the core. > - Debug register in the core power domain. > - PMU registers in the core power domain. > - Trace register in the core power domain. > - Trace context loss > - GICR > - GICD > > Qualcomm's custom CPUs preserves the architectural state, > including keeping the power domain for local timers active. > when core is power gated, the local timers are sufficient to > wake the core up without needing broadcast timer. > > The patch fixes the evaluation of cpuidle arch_flags, and moves only to > broadcast timer if core context lost is defined in ACPI LPI. > > Reviewed-by: Sudeep Holla > Signed-off-by: Oza Pawandeep > > diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h > index bd68e1b7f29f..0d455b02971e 100644 > --- a/arch/arm64/include/asm/acpi.h > +++ b/arch/arm64/include/asm/acpi.h > @@ -9,6 +9,7 @@ > #ifndef _ASM_ACPI_H > #define _ASM_ACPI_H > > +#include > #include > #include > #include > @@ -42,6 +43,26 @@ > #define ACPI_MADT_GICC_SPE (offsetof(struct acpi_madt_generic_interrupt, \ > spe_interrupt) + sizeof(u16)) > > +/* > + * Arm? Functional Fixed Hardware Specification Version 1.2. > + * Table 2: Arm Architecture context loss flags > + */ > +#define CPUIDLE_CORE_CTXT BIT(0) /* Core context Lost */ > + > +#ifndef arch_update_idle_state_flags > +static __always_inline void _arch_update_idle_state_flags(u32 arch_flags, > + unsigned int *sflags) > +{ > + if (arch_flags & CPUIDLE_CORE_CTXT) > + *sflags |= CPUIDLE_FLAG_TIMER_STOP; > +} > +#define arch_update_idle_state_flags _arch_update_idle_state_flags > +#endif > + > +#define CPUIDLE_TRACE_CTXT BIT(1) /* Trace context loss */ > +#define CPUIDLE_GICR_CTXT BIT(2) /* GICR */ > +#define CPUIDLE_GICD_CTXT BIT(3) /* GICD */ > + > /* Basic configuration for ACPI */ > #ifdef CONFIG_ACPI > pgprot_t __acpi_get_mem_attribute(phys_addr_t addr); > diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c > index 9718d07cc2a2..420baec3465c 100644 > --- a/drivers/acpi/processor_idle.c > +++ b/drivers/acpi/processor_idle.c > @@ -1221,8 +1221,7 @@ static int acpi_processor_setup_lpi_states(struct acpi_processor *pr) > strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); > state->exit_latency = lpi->wake_latency; > state->target_residency = lpi->min_residency; > - if (lpi->arch_flags) > - state->flags |= CPUIDLE_FLAG_TIMER_STOP; > + arch_update_idle_state_flags(lpi->arch_flags, &state->flags); > if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH) > state->flags |= CPUIDLE_FLAG_RCU_IDLE; > state->enter = acpi_idle_lpi_enter; > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index d584f94409e1..d49488fdbc49 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -1471,6 +1471,10 @@ static inline int lpit_read_residency_count_address(u64 *address) > } > #endif > > +#ifndef arch_update_idle_state_flags > +#define arch_update_idle_state_flags do {} while (0); I think I suggested it in v2 as without that you will get the warnings the kernel build bot has posted now. #define arch_update_idle_state_flags(af, sf) do {} while (0) Add the parameters and drop the leading ';'. -- Regards, Sudeep