Message ID | 20241107190818.522639-9-ankur.a.arora@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2CD4D5D683 for <linux-arm-kernel@archiver.kernel.org>; Thu, 7 Nov 2024 19:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=H/q7eDW/ZTZz/lYx9cMAlhBkSvRSCxOpz53k9yto33k=; b=Y8N7vy+eZPuEcfT2CVZvMaJIU4 fzGCCXQFyqnuymVHwsTaJUpwrvISluFRDEpZAJfb+z+BO5ORjr9qZTCFrwTum2UNqhPaEokgEEkuj nkf0uOnirUBCINEtrleJIakYQiuLr1j6dHmx4YikA9qwZISR1/vEMHWWk2C0xJ4ivbVZf75OPliXO 9dcRvqLVJYLug89t1WZVW6Lr9mGkHWzZcMz9Nm1KQAw7su0mbZadfdkyrj7D1ljVqi8YhiI56hCxk XMuz+IhilRndwqIMXy1yUSNlTP0ClORQMP+J/dH2LgIK7F4NvedGjreyWwS8WqvujQc1Xb4nnBtMb pWiPocHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t98Iz-0000000865z-3UWP; Thu, 07 Nov 2024 19:36:33 +0000 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t97sl-000000081Hn-0Rhi for linux-arm-kernel@lists.infradead.org; Thu, 07 Nov 2024 19:09:28 +0000 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HBaMF025221; Thu, 7 Nov 2024 19:08:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=H/q7eDW/ZTZz/lYx9cMAlhBkSvRSCxOpz53k9yto33k=; b= gqNQqGAqt/CWQqJQrHRIQsR8WpHPMgup6OqdpcQ/E+S1lnEtI2bw2yIIimTHmP+U rdWZeyixBD3qfzfX+/BPpEh+1iamVjkg17vGa3sdxfWwrN61mlwfcgVOqZFTbIIF SCdi1yzjpWMLqQs2l4MN8Zu458fIg1EhzA3cijxvEXS9PNrmxmsAqSEzw8aRS/rm gBIO6PwDS5kFjWizTopG38VdpIjjeKOy6jmCzBjuQM0SfQjb9ra8DrKXTV3CxOBR m7IgHsxNgiyD25Bbcf/Gtz4doa+kmuEV+ibWPrQ5Zu0mPHb/q+iyl1HC5kfYUIyQ Y7LJvaUkkTUBY+jZATQ/qw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nav2beda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:53 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7HwLT0009736; Thu, 7 Nov 2024 19:08:52 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahgt619-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 19:08:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ru5VmeB1QXiwQ2l5Ms9NvUVnSyBITbafE9LrNplMygIdq5GRfTFeu2GVsurbKHBXnicbmVeXLijTGR1LbHJJIzf2XfPu6W+fKzTdg8SKmZqDiukHr+82BCBiXggICmJo+qJm3Uj6nQ3L2BmsgMXRARWp9RuW1YlWkAeI7NBYCNx9R9BGAq7mCpREf47M0yoqdnf8hp2TSWwcu/06o5a5vzjOUGtm57jO1EGoqUY7x6tApKnToUivhVwLHesWWbeSBRAhUWHwJjcsz4dB2VokoXxfGe/zdxdy6f1s0+nAElfStCj3LWIgI8c6Xfv2zlLHYosmGvK9DxMmnmjlURudkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H/q7eDW/ZTZz/lYx9cMAlhBkSvRSCxOpz53k9yto33k=; b=J6zK5KDniGABtXlE/o2mSYoENzbRS4hb8RrYek2m+FDIEiSpAZUXxl7iL7f25Od/VyAYaZ8Uie4+RtN2zvxf/cL6tNBmteMn4QY0DjKY3yRZh8VwAZPNEXu1P2s0Sx9pPvB1IrVVhHUNJGBbH7IjCxSZL69Xsv5ENsunPdnHcg3EIgf3xQ2KCOCD5XNcjUHUl+TJU4CTa+3y+o2Sb8dIhjDfHhLKKD8QYs2/KO3MnV6l2dHrnT4O8+TG7vjG96AezHhkURdFn2iwWihhNqbynrCWzWDU55i/W7BCOaw8oXpXhASmaTlKSkKxIvGD5oulCnT1ABfTF9zFIDA8S1Axjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H/q7eDW/ZTZz/lYx9cMAlhBkSvRSCxOpz53k9yto33k=; b=hPvGv8nWJ8KpqUuf3V0n6hTvpaepgjGSvcVkkWQUw5OOjPeFqwNmQuO6WbMg0HpPNCJkfQymGyxHjsBPxZUnD/JNr/H9rJmtKB/MdNXHmShLfGbDVu1SPfJOmhcebBlpM00om0rd4iaEoKFatap5sNvJwy+9p2o/nihIq0vHRww= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY8PR10MB7148.namprd10.prod.outlook.com (2603:10b6:930:71::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 19:08:42 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::25a9:32c2:a7b0:de9e%5]) with mapi id 15.20.8137.019; Thu, 7 Nov 2024 19:08:42 +0000 From: Ankur Arora <ankur.a.arora@oracle.com> To: linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, cl@gentwo.org, maz@kernel.org, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, zhenglifeng1@huawei.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: [PATCH v9 08/15] ACPI: processor_idle: Support polling state for LPI Date: Thu, 7 Nov 2024 11:08:11 -0800 Message-Id: <20241107190818.522639-9-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241107190818.522639-1-ankur.a.arora@oracle.com> References: <20241107190818.522639-1-ankur.a.arora@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW2PR16CA0034.namprd16.prod.outlook.com (2603:10b6:907::47) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY8PR10MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: 6521b7d1-605f-4d09-4b6f-08dcff5f9858 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: Okli0EHdgFuCgTYIDNkzqSi4bYC9eHI3xBxNU1kyA94cfJqRkdF912aYIV7h2ocJXtYzwvsIG1FntGi+TsZyP1qouTLvQ7KOEq9RbTD4kt1QUT0DQJfdoXc3k6d8LVgugZWgPpW/Ct8DdQoq0sjvkvM7sto6gwCyMKdy4sVO8KJW176KU1j8YFShyvdX8p4sGw/2xHb/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yJmTHQEBtfE5uqEt3pDtkC48q4gZNpoKH74pdRAt0j/qVpruvQgkvqz/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR10MB5409.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9hK+gYJZhKt12RKxn9waiHd/dO/BUGDxTwqxozldiXpkRO1os1qNvOL5VMftw7noeCYCav8DyH8UpUVQfjgt2JWC60D8NK5zDwWugx405afvGwax2w8HPSpW3109mgw1mYu6AIEnD+P2jAE4R0z8Ap2jvL79Nf8MOsSo0uPrTGrEf52CwDuv9aSKt/TgybZP0D63H7IFr2zkjVsadtdX7OHWeXIEYydk/UmHzAQOKUjG+9eFJ9goB2Pwvxz5D0qnH19xq3m8WwBRNGFQ8yTqLMjiJjIptgHbjJ7vvJzIOh0ykReApSWdXdl7ObdbR5L7857W+VrT9W+35XMM65J250QXKkMqPv+ZSQfWlPeBq3SJQ2auxgnsamvjgDXeiKPXNQt5wbBniIibPJRNsV7IqDB3Ukj8NKKPRGa4HXJeQpC914go8Xd0s420TDLAYixUpZq8lT4It60CsV+hXIoaNaB/OXJ+IVs2xuNTVmSJGP3E579iZi8hX78xtd7XUiBRQw9ByETEVPfIoA+LXF8wsfcBEeDNnT/J75rnSlAyCoP6McNVvZ9SaGpZ8XtcZVPKUDuN8wzEoSxGfCWXaaWgiGQP01H7S0KFYg3mwl9gRjn0UI1pGzID5e02KaiMG9FgYxNpkZxqCwCN1r+QryeQQ/P6G+p+OZ4WjKkoLiNQtzMM4mCfM/t90e8mz16k2c5pIK1SsGH2tf2H/3DfumH0eY1YQzJvfJvBMStn0+I6o8N+n7UasCbCmA8mNUdo7ZSADxJWlubVcDplgGXm8I5EI/m84c4vDZMINORzdvOnvmHa7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bNXEJi1DVMlw4fxpbZ82IndjO0/Ia3ZNaTLTypcML+xrId3RAiMPkJJ1W22/ITe6InB1xqbQsYwD6jm1hmtBhfkZcAwrByNTnjhzjvHZ5jP3z6ThrekR0JoU1Xr96fjuxID839mK1wP5XBzHBnJP0hONXG0QwmBqkK4yNq3s+n08o+yXh2fuB9xWmKkBWUrB0TzWGLuCh+1G5N5dah7jUQlUBG1OsY+Z18rYnuTUL76NMluo77xu7unZm7C8V3hsb/XQj/1iHJLb+PfUXlYmvcjh0AL4m6mqLuNYxMdgG0EdR/sLbtCH4J1qDWPF9NOkAAr6v+p/1Eif1lbnWkt7KFCrcUPkk0y6suobRtR5tCVtnjjKiiWG7lrUf04ryuZirq1dESek6DCtpMEGFcvzxkv18M8u+ZO/I= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6521b7d1-605f-4d09-4b6f-08dcff5f9858 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 19:08:42.4259 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uycSn3V+2FW5WwAvGqWc65I4Yo1/aLhf71m+JxipN/UPqFNii6veaRydg1jdwpQpRyn0cl6ou5jJr5ADS99JrIw7fwmkXg1kYgBCNNF8LAc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_08,2024-11-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070150 X-Proofpoint-GUID: M7SmEWZiPkj0hDBLZYlG7S7Y98kPcCId X-Proofpoint-ORIG-GUID: M7SmEWZiPkj0hDBLZYlG7S7Y98kPcCId X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241107_110927_279331_7D693A2D X-CRM114-Status: GOOD ( 18.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
arm64: support poll_idle()
|
expand
|
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 44096406d65d..d154b5d77328 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1194,20 +1194,46 @@ static int acpi_idle_lpi_enter(struct cpuidle_device *dev, return -EINVAL; } +/* To correctly reflect the entered state if the poll state is enabled. */ +static int acpi_idle_lpi_enter_with_poll_state(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + int entered_state; + + if (unlikely(index < 1)) + return -EINVAL; + + entered_state = acpi_idle_lpi_enter(dev, drv, index - 1); + if (entered_state < 0) + return entered_state; + + return entered_state + 1; +} + static int acpi_processor_setup_lpi_states(struct acpi_processor *pr) { - int i; + int i, count; struct acpi_lpi_state *lpi; struct cpuidle_state *state; struct cpuidle_driver *drv = &acpi_idle_driver; + typeof(state->enter) enter_method; if (!pr->flags.has_lpi) return -EOPNOTSUPP; + if (IS_ENABLED(CONFIG_ARCH_HAS_OPTIMIZED_POLL)) { + cpuidle_poll_state_init(drv); + count = 1; + enter_method = acpi_idle_lpi_enter_with_poll_state; + } else { + count = 0; + enter_method = acpi_idle_lpi_enter; + } + for (i = 0; i < pr->power.count && i < CPUIDLE_STATE_MAX; i++) { lpi = &pr->power.lpi_states[i]; - state = &drv->states[i]; + state = &drv->states[count]; snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i); strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); state->exit_latency = lpi->wake_latency; @@ -1215,11 +1241,14 @@ static int acpi_processor_setup_lpi_states(struct acpi_processor *pr) state->flags |= arch_get_idle_state_flags(lpi->arch_flags); if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH) state->flags |= CPUIDLE_FLAG_RCU_IDLE; - state->enter = acpi_idle_lpi_enter; - drv->safe_state_index = i; + state->enter = enter_method; + drv->safe_state_index = count; + count++; + if (count == CPUIDLE_STATE_MAX) + break; } - drv->state_count = i; + drv->state_count = count; return 0; }