Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3218503rwb; Mon, 7 Aug 2023 09:55:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQxqCq39uKV8+BuqmyfcWI0K0iBJYsKD8nY1ApGr4SM6YcYpOFiB6G1KA1IH871WHnto3r X-Received: by 2002:a05:6402:1acd:b0:523:2dd6:62bf with SMTP id ba13-20020a0564021acd00b005232dd662bfmr5331524edb.34.1691427312342; Mon, 07 Aug 2023 09:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691427312; cv=none; d=google.com; s=arc-20160816; b=j9vvq00YYgqsLQtuWQV05sBaN/OWvKcuXW9iYJ7C65CsxxM02Z0MxOtXfwE7/RlH8Y FaFKO2GJluHdWq49nCXE1DTX6OwkpbhSVqNoU1R6OhoA5t11TJqYsQThSxLgKcA4mwRj BG6LGdPI8JSQFdRlgEYRLfzAzb/xR/ezyU0qU2pUHojb9yv9dImiw1LhyE7arDM4PIyJ xeBnpwRwSg0Pcop3zCXBWk03or20RFpDE15tMLH0z0DkGS5yE4u526ov0xfIJbzjvk5s NqqrDEGTzwHRsBZ9mhl8LY6KOHN6Y+26T/1hSdG1uUjqHYcmMhLeHnDN4Ctrs1cXLlj7 jhGw== 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:to:from:dkim-signature; bh=ej8CF5GhCktPJJSZ11HMY+Tfu/94AshBJi447akjUWM=; fh=ssTttPOqEZ7REfB4bImHlQM/FcIqxz+2wwSEpXbbNo8=; b=NruaxwoIgpOS7PosTMLAJjbWsWBupda5vGbbz5zNLGVyZBqaHnHaT028sblcsy3uET a1+jE8HjI98WHEM45S44dBfeKIt4Wweib0v2tMAen5OGFkc8ZsOpojhEf5nmZJGDvClD mxJnUsbkmGtWJIRMa+P7vMq4TpYZRUIYptPp3SLVvZBQ4O9+vsFpF6WiIBSxt8N+r2s1 J8cZu06RMKXxqoK+IJzU2PiBnnerFuLnODd4boZgOJgWudv/cr3v48lgXIR2BQjJrYLP iSt/KhinJ3XE2GpeB9HQKXi5bdzOnzDHHq7K6Oog4lqzVhycuNmO2TkXnZ59ocwXCZC1 DOmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=heeUVz4Y; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e21-20020a056402149500b0052309c467c6si5793969edv.211.2023.08.07.09.54.47; Mon, 07 Aug 2023 09:55:12 -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=@quicinc.com header.s=qcppdkim1 header.b=heeUVz4Y; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231311AbjHGPs5 (ORCPT + 99 others); Mon, 7 Aug 2023 11:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231304AbjHGPsz (ORCPT ); Mon, 7 Aug 2023 11:48:55 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53ADEC4; Mon, 7 Aug 2023 08:48:54 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 377EVlp3011263; Mon, 7 Aug 2023 15:48:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=ej8CF5GhCktPJJSZ11HMY+Tfu/94AshBJi447akjUWM=; b=heeUVz4Y3oY34ggmunYQy5+nkvelBGlDMNkNz8qUasLXRUdgzAPQW5zMIZeaEcxBAxur vFXC1sUFyZynJ02jbziYYvP9VAzTyVdJtPm4dHmSqIHTEOtlvpvmq32gDaf9dgHvAOcP iqM2LQW8Ya/Y+l1LYE6GIAOCCjv2Xi6n15yvldKJ1pTtDU8+KWxW2RyeA+j2BzpMHa87 cxhF2g6WY3JVm2geMJGffW7LEnR6egKYZAOs/noyMrKTVuZeIbHFW598bYkmgAxcrXFr BPD1Yq5WRr/OgGVgCaK42UXoYEgmX7/iQLl5PvHxxUszfVR9/wk5NMDE+KUCiidsrhPV yw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s9deekwjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 15:48:36 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 377FmZRc011339 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 7 Aug 2023 15:48:35 GMT Received: from localhost (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Mon, 7 Aug 2023 08:48:34 -0700 From: Oza Pawandeep To: , , , , , , , , , Subject: [PATCH v2] cpuidle, ACPI: Evaluate LPI arch_flags for broadcast timer Date: Mon, 7 Aug 2023 08:48:34 -0700 Message-ID: <20230807154834.888328-1-quic_poza@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: XjRmU7sUpnLdOCAq34t6RZTxXTy8q1NZ X-Proofpoint-ORIG-GUID: XjRmU7sUpnLdOCAq34t6RZTxXTy8q1NZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-07_16,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 malwarescore=0 impostorscore=0 spamscore=0 clxscore=1015 mlxlogscore=231 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308070146 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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. Signed-off-by: Oza Pawandeep diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index bd68e1b7f29f..5493b044864f 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,27 @@ #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..60f17c99465b 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1471,6 +1471,15 @@ static inline int lpit_read_residency_count_address(u64 *address) } #endif +#ifndef arch_update_idle_state_flags +static __always_inline void arch_update_idle_state_flags(u32 arch_flags, + unsigned int *sflags) +{ + +} +#define arch_update_idle_state_flags arch_update_idle_state_flags +#endif + #ifdef CONFIG_ACPI_PPTT int acpi_pptt_cpu_is_thread(unsigned int cpu); int find_acpi_cpu_topology(unsigned int cpu, int level); -- 2.25.1