From patchwork Wed Mar 27 13:21:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10873473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B5DA1708 for ; Wed, 27 Mar 2019 13:21:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB97328657 for ; Wed, 27 Mar 2019 13:21:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFF8328BC0; Wed, 27 Mar 2019 13:21:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89BB628657 for ; Wed, 27 Mar 2019 13:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729766AbfC0NVN (ORCPT ); Wed, 27 Mar 2019 09:21:13 -0400 Received: from mail-eopbgr20057.outbound.protection.outlook.com ([40.107.2.57]:29764 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728790AbfC0NVM (ORCPT ); Wed, 27 Mar 2019 09:21:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LR48d2g1vkoK40i8uWTgFtA7Op5aZtshDE+l5myETRI=; b=NsUquUgNsTpO92i0D91klAb/ZbWbonUzt88kmQTOFrj6Ivummgv+OQ991xlu8cfXfb6kkeTvHrOUs8XhiU/ffe45YK5liMoi/ENj6bShG9YsBc0XyHbZgo80Jt/33mI8/F0xuYlU/OKxX+Sdk2YpcyXGnPIMaLP5S54ld3Hz3IA= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6051.eurprd04.prod.outlook.com (20.179.35.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Wed, 27 Mar 2019 13:21:08 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:08 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 1/7] sched: idle: Add sched get idle state helper Thread-Topic: [RFC 1/7] sched: idle: Add sched get idle state helper Thread-Index: AQHU5J/wYerhjHZf+0GO74u+rDGu6Q== Date: Wed, 27 Mar 2019 13:21:07 +0000 Message-ID: <1553692845-20983-2-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b86b3313-a923-40fb-4cc8-08d6b2b711ed x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB6051; x-ms-traffictypediagnostic: AM0PR04MB6051: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(396003)(346002)(376002)(199004)(189003)(25786009)(14444005)(68736007)(4326008)(6436002)(5660300002)(6116002)(71200400001)(71190400001)(3846002)(256004)(8936002)(8676002)(6636002)(2501003)(66066001)(305945005)(2906002)(53936002)(81156014)(6512007)(7736002)(81166006)(7416002)(97736004)(6486002)(36756003)(54906003)(44832011)(50226002)(486006)(106356001)(6506007)(386003)(186003)(110136005)(102836004)(446003)(14454004)(476003)(86362001)(99286004)(11346002)(52116002)(478600001)(316002)(2616005)(26005)(105586002)(76176011)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6051;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vmOOorQZXAGQNM5Depghx6Zq76DGExyX1Hv/jWWvLTso5nqYjGo/4ee2wHaBhccJRjZEryZyxd+Kx4tAerSosZjlLqQGoAkDNymzsNBogrl2Swj1BoCxc50jA3BF/Gx2/eqQ8nuSEjD+DwETAtX/SNY0vVHmeoaeFBM/ecUw1G10zSU/9BrOCXKp7ZqxdrwJ+orprLAJTnQ/zabmOQz15Tw8WL8aNyAEba4vGuK3EGWehHG/vgaJ3YU0GEL3FK1DTLzdOc43Yt6oOPUIirKygx/CCNrv7IWDy3qLGUUTBSdRLdfUgZDAQdl7zZSXfkKDAox9MGBZWDbWeefoqx28T3Dr+FyIAnmIB/I+L1TWVm5V2zp9px0Ur7ygWwcs7+8/A/JIejKKXrmOoCvtuJwvXYloaRWnezR0ZQIQKPycVFc= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b86b3313-a923-40fb-4cc8-08d6b2b711ed X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:08.2226 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6051 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This helper is useful in order to get the idle state of a specific cpu. Signed-off-by: Abel Vesa --- include/linux/cpuidle.h | 1 + kernel/sched/idle.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 3b39472..88a9119 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -211,6 +211,7 @@ static inline void cpuidle_use_deepest_state(bool enable) /* kernel/sched/idle.c */ extern void sched_idle_set_state(struct cpuidle_state *idle_state); +extern struct cpuidle_state *sched_idle_get_state(int cpu); extern void default_idle_call(void); #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index f5516ba..484825d 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -21,6 +21,17 @@ void sched_idle_set_state(struct cpuidle_state *idle_state) idle_set_state(this_rq(), idle_state); } +/** + * sched_idle_get_state - Get idle state for the specified CPU. + * @index: CPU index. + */ + +struct cpuidle_state *sched_idle_get_state(int cpu) +{ + return idle_get_state(cpu_rq(cpu)); +} + + static int __read_mostly cpu_idle_force_poll; void cpu_idle_poll_ctrl(bool enable) From patchwork Wed Mar 27 13:21:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10873469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C09641708 for ; Wed, 27 Mar 2019 13:21:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB33928657 for ; Wed, 27 Mar 2019 13:21:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F66D28BBF; Wed, 27 Mar 2019 13:21:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3130A28657 for ; Wed, 27 Mar 2019 13:21:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730507AbfC0NVs (ORCPT ); Wed, 27 Mar 2019 09:21:48 -0400 Received: from mail-eopbgr20057.outbound.protection.outlook.com ([40.107.2.57]:29764 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725829AbfC0NVS (ORCPT ); Wed, 27 Mar 2019 09:21:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mJoxWhmCyb3/U5EQiMFlg+3tnG1hrEoxJr+Q2jp8qb4=; b=F0FPr0vgVEoD406wyJs3lSN4FABwuOgxpn2IacEjm5eAAfLdvGLQQ6dTZs9mSppKTbFjP7ZIi3rYb+CXJhxCFkKX7LCcLx6UTzCS58ldIbwI5NFheKK3XOT2I9voyEFLxXw70diiVj6kcPRezU6YQu0jbKJay92Dsca/BIlzLFE= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6051.eurprd04.prod.outlook.com (20.179.35.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Wed, 27 Mar 2019 13:21:10 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:09 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 2/7] cpuidle: Add cpu poke support Thread-Topic: [RFC 2/7] cpuidle: Add cpu poke support Thread-Index: AQHU5J/xpRRIW2AJek+3mcOjLL/sJg== Date: Wed, 27 Mar 2019 13:21:09 +0000 Message-ID: <1553692845-20983-3-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3ab53a77-04b0-4d0c-da77-08d6b2b7138d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB6051; x-ms-traffictypediagnostic: AM0PR04MB6051: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(396003)(346002)(376002)(199004)(189003)(25786009)(14444005)(68736007)(4326008)(6436002)(5660300002)(6116002)(71200400001)(71190400001)(3846002)(256004)(8936002)(8676002)(6636002)(2501003)(66066001)(305945005)(2906002)(53936002)(81156014)(6512007)(7736002)(81166006)(7416002)(97736004)(6486002)(36756003)(54906003)(44832011)(50226002)(486006)(106356001)(6506007)(386003)(186003)(110136005)(102836004)(446003)(14454004)(476003)(86362001)(99286004)(11346002)(52116002)(478600001)(316002)(2616005)(26005)(105586002)(76176011)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6051;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TWH2+42YzTL6r44EZTcRdorG9+5Np9ttK6YSpIXGF/hrUeQvdfNgtu7oZUyCeQWDbW7dWBaqqOChfu+Hq0Klo9+F5IaA9IyoPzS/8eRFdmwo0QrjFSLcC8MynB7byLhB4w5gk2L4WMzw0mw8w+QCQ+O1f3utBRcRocvv0F6QQ5S3scocSOrvk/mEWuDxolBgfsLMRA5iI5LE4bug1qU3FgC6LTTkmDaZlX/cuIcTIvtGBoKDDX4bhzd8SIYBil/lTrpW7Sr+q8dH+fAG548PXvli26DFVu5vwTJaim6lnrgH6+sKwgyeN/tGFtYDIsXfkGDxZjhF9sI+0hYQPXtahAFb175eXZLSGX0YVuSt/rAZW4OA53rtfnffJwj8U0PHyJP4216wsMYLrZR/p7AFLWnNEGvXsyUhgEFXDkTphZ4= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ab53a77-04b0-4d0c-da77-08d6b2b7138d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:09.9348 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6051 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Having a poke operation per state, allows each cpuidle driver to implement, for each state, different ways of waking up (poking) cores. Signed-off-by: Abel Vesa --- drivers/cpuidle/cpuidle.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/cpuidle.h | 6 ++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 7f10830..fca5313 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -297,6 +297,29 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, } /** + * cpuidle_poke_single - poke the specified cpu to wake up from + * current idle state + * + * @dev: cpuidle device for this cpu + * @drv: cpuidle driver for this cpu + * @cpu: the index of the cpu + */ +int cpuidle_poke_single(struct cpuidle_driver *drv, struct cpuidle_device *dev, + int cpu) +{ + struct cpuidle_state *state; + + if (cpuidle_disabled()) + return 0; + + state = sched_idle_get_state(cpu); + if (state && state->poke) + return state->poke(dev, drv, cpu); + + return 0; +} + +/** * cpuidle_select - ask the cpuidle framework to choose an idle state * * @drv: the cpuidle driver @@ -414,6 +437,17 @@ void cpuidle_resume(void) mutex_unlock(&cpuidle_lock); } +void cpuidle_poke(const struct cpumask *mask) +{ + struct cpuidle_device *dev = cpuidle_get_device(); + struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); + int cpu; + + for_each_cpu(cpu, mask) { + WARN_ON(cpuidle_poke_single(drv, dev, cpu)); + } +} + /** * cpuidle_enable_device - enables idle PM for a CPU * @dev: the CPU diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 88a9119..0270771 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -55,6 +55,10 @@ struct cpuidle_state { struct cpuidle_driver *drv, int index); + int (*poke) (struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int cpu); + int (*enter_dead) (struct cpuidle_device *dev, int index); /* @@ -145,6 +149,7 @@ extern void cpuidle_unregister(struct cpuidle_driver *drv); extern void cpuidle_pause_and_lock(void); extern void cpuidle_resume_and_unlock(void); extern void cpuidle_pause(void); +extern void cpuidle_poke(const struct cpumask *mask); extern void cpuidle_resume(void); extern int cpuidle_enable_device(struct cpuidle_device *dev); extern void cpuidle_disable_device(struct cpuidle_device *dev); @@ -181,6 +186,7 @@ static inline void cpuidle_unregister(struct cpuidle_driver *drv) { } static inline void cpuidle_pause_and_lock(void) { } static inline void cpuidle_resume_and_unlock(void) { } static inline void cpuidle_pause(void) { } +static inline void cpuidle_poke(const struct cpumask *mask) { } static inline void cpuidle_resume(void) { } static inline int cpuidle_enable_device(struct cpuidle_device *dev) {return -ENODEV; } From patchwork Wed Mar 27 13:21:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10873471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B32E9139A for ; Wed, 27 Mar 2019 13:21:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D83F28657 for ; Wed, 27 Mar 2019 13:21:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9147F28BBF; Wed, 27 Mar 2019 13:21:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0291528657 for ; Wed, 27 Mar 2019 13:21:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729916AbfC0NVR (ORCPT ); Wed, 27 Mar 2019 09:21:17 -0400 Received: from mail-eopbgr150048.outbound.protection.outlook.com ([40.107.15.48]:27108 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729844AbfC0NVP (ORCPT ); Wed, 27 Mar 2019 09:21:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=40SFnIjgxvNsiI+hPmydu4vsYSvQXaeVREae9BA1guk=; b=qUcDrVbwdOIPa/unlw95cgpd++wsVSUabOXqR1DNk40QlBuiVmY6WyIuAZx9oEtlddmdw0y6iWqjLZYBmDYvOHTuXm1pWCU42kNdAAT/L2lsihK0+0dE/JUViUjrPf57svLpghdSf56oW1/aQdcBy7VKMsW+x0TATUtVXK26hKQ= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5907.eurprd04.prod.outlook.com (20.178.202.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Wed, 27 Mar 2019 13:21:11 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:11 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 3/7] smp: Poke the cores before requesting IPI Thread-Topic: [RFC 3/7] smp: Poke the cores before requesting IPI Thread-Index: AQHU5J/ysdAjuuc4sEaUwQd13R6FyA== Date: Wed, 27 Mar 2019 13:21:11 +0000 Message-ID: <1553692845-20983-4-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3c192940-a1a6-4210-a47b-08d6b2b71494 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB5907; x-ms-traffictypediagnostic: AM0PR04MB5907: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(366004)(376002)(346002)(39860400002)(396003)(199004)(189003)(25786009)(2906002)(26005)(386003)(54906003)(8676002)(68736007)(102836004)(6512007)(71200400001)(7416002)(71190400001)(446003)(5660300002)(8936002)(50226002)(4326008)(81166006)(2616005)(476003)(81156014)(44832011)(97736004)(11346002)(6116002)(3846002)(36756003)(105586002)(86362001)(106356001)(2501003)(6486002)(76176011)(6636002)(14454004)(478600001)(6506007)(316002)(52116002)(7736002)(186003)(53936002)(110136005)(6346003)(66066001)(99286004)(14444005)(256004)(486006)(6436002)(305945005)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5907;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: LIXKcyLEH5DsJVfS9zvLh5/J5opTWB/PenemuARDTF+AmBO4Q4NCoYADb/NIyx+O8V/QgE5dRnXNNyf7EGffnfU+iviK/h9RiIikETHSl1fhftjZmLa0zXiL7Wr2Ll2Dum+hS8d9gHZuk/je5ELQ2qXO16GEquxZOFq7IMpZ3owDpSUNpD2HAHSqrFi76Kx8yTh9jmO5sLHHuVhUqc1GLgGkKOiraoA1raHF+IlymRs5/KKRXBHtRw5C0PqhpgDs3otPCiN46+pqmER7YKA4+yHdDmEg9B7veSU2deD2Z20ePlYR4zgC+o/JiED6mEjNkAVpCGfDAUbwRqDM4hMCupQthT7KN1v6yXC3JQm3uYXsKpOIx3hGYEedtDotw/0Bgf1yhSdPfC2TkI83vJDUrXp8m2uJEYf21PAgBOfxgxk= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c192940-a1a6-4210-a47b-08d6b2b71494 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:11.6330 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5907 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Try poking the specified core(s) every time before requesting IPI, this way allowing the cpuidle driver to do its magic for the current idle state of the specified core(s), if there is such a need. Signed-off-by: Abel Vesa --- kernel/irq_work.c | 19 ++++++++++++++++--- kernel/sched/core.c | 16 +++++++++++----- kernel/smp.c | 10 +++++++++- kernel/time/tick-broadcast.c | 4 ++++ 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/kernel/irq_work.c b/kernel/irq_work.c index 6b7cdf1..deca898 100644 --- a/kernel/irq_work.c +++ b/kernel/irq_work.c @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -76,8 +77,12 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) if (!irq_work_claim(work)) return false; - if (llist_add(&work->llnode, &per_cpu(raised_list, cpu))) + if (llist_add(&work->llnode, &per_cpu(raised_list, cpu))) { + /* Poke the cpu through cpuidle first */ + cpuidle_poke(cpumask_of(cpu)); + arch_send_call_function_single_ipi(cpu); + } #else /* #ifdef CONFIG_SMP */ irq_work_queue(work); @@ -99,11 +104,19 @@ bool irq_work_queue(struct irq_work *work) /* If the work is "lazy", handle it from next tick if any */ if (work->flags & IRQ_WORK_LAZY) { if (llist_add(&work->llnode, this_cpu_ptr(&lazy_list)) && - tick_nohz_tick_stopped()) + tick_nohz_tick_stopped()) { + /* Poke the cpus through cpuidle first */ + cpuidle_poke(cpumask_of(smp_processor_id())); + arch_irq_work_raise(); + } } else { - if (llist_add(&work->llnode, this_cpu_ptr(&raised_list))) + if (llist_add(&work->llnode, this_cpu_ptr(&raised_list))) { + /* Poke the cpus through cpuidle first */ + cpuidle_poke(cpumask_of(smp_processor_id())); + arch_irq_work_raise(); + } } preempt_enable(); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4778c48..7be9dba 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -126,6 +126,12 @@ struct rq *task_rq_lock(struct task_struct *p, struct rq_flags *rf) } } +static void smp_poke_and_send_reschedule(int cpu) +{ + cpuidle_poke(cpumask_of(cpu)); + smp_send_reschedule(cpu); +} + /* * RQ-clock updating methods: */ @@ -511,7 +517,7 @@ void resched_curr(struct rq *rq) } if (set_nr_and_not_polling(curr)) - smp_send_reschedule(cpu); + smp_poke_and_send_reschedule(cpu); else trace_sched_wake_idle_without_ipi(cpu); } @@ -583,7 +589,7 @@ static void wake_up_idle_cpu(int cpu) return; if (set_nr_and_not_polling(rq->idle)) - smp_send_reschedule(cpu); + smp_poke_and_send_reschedule(cpu); else trace_sched_wake_idle_without_ipi(cpu); } @@ -1471,7 +1477,7 @@ void kick_process(struct task_struct *p) preempt_disable(); cpu = task_cpu(p); if ((cpu != smp_processor_id()) && task_curr(p)) - smp_send_reschedule(cpu); + smp_poke_and_send_reschedule(cpu); preempt_enable(); } EXPORT_SYMBOL_GPL(kick_process); @@ -1836,7 +1842,7 @@ static void ttwu_queue_remote(struct task_struct *p, int cpu, int wake_flags) if (llist_add(&p->wake_entry, &cpu_rq(cpu)->wake_list)) { if (!set_nr_if_polling(rq->idle)) - smp_send_reschedule(cpu); + smp_poke_and_send_reschedule(cpu); else trace_sched_wake_idle_without_ipi(cpu); } @@ -1857,7 +1863,7 @@ void wake_up_if_idle(int cpu) } else { rq_lock_irqsave(rq, &rf); if (is_idle_task(rq->curr)) - smp_send_reschedule(cpu); + smp_poke_and_send_reschedule(cpu); /* Else CPU is not idle, do nothing here: */ rq_unlock_irqrestore(rq, &rf); } diff --git a/kernel/smp.c b/kernel/smp.c index f4cf1b0..f6b2ce7 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -175,8 +176,12 @@ static int generic_exec_single(int cpu, call_single_data_t *csd, * locking and barrier primitives. Generic code isn't really * equipped to do the right thing... */ - if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) + if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) { + /* Poke the cpus through cpuidle first */ + cpuidle_poke(cpumask_of(cpu)); + arch_send_call_function_single_ipi(cpu); + } return 0; } @@ -457,6 +462,9 @@ void smp_call_function_many(const struct cpumask *mask, __cpumask_set_cpu(cpu, cfd->cpumask_ipi); } + /* Poke the cpus through cpuidle first */ + cpuidle_poke(cfd->cpumask_ipi); + /* Send a message to all CPUs in the map */ arch_send_call_function_ipi_mask(cfd->cpumask_ipi); diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 0283523..8bb7b2b 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "tick-internal.h" @@ -286,6 +287,9 @@ static bool tick_do_broadcast(struct cpumask *mask) } if (!cpumask_empty(mask)) { + /* Poke the cpus through cpuidle first */ + cpuidle_poke(mask); + /* * It might be necessary to actually check whether the devices * have different broadcast functions. For now, just use the From patchwork Wed Mar 27 13:21:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10873463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D03BD139A for ; Wed, 27 Mar 2019 13:21:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAB7728657 for ; Wed, 27 Mar 2019 13:21:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEC1228BC0; Wed, 27 Mar 2019 13:21:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D38128657 for ; Wed, 27 Mar 2019 13:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725797AbfC0NVk (ORCPT ); Wed, 27 Mar 2019 09:21:40 -0400 Received: from mail-eopbgr150048.outbound.protection.outlook.com ([40.107.15.48]:27108 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729924AbfC0NVT (ORCPT ); Wed, 27 Mar 2019 09:21:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6F10FU/nMBELMll6buxzdkIXlVxK85wRW3zUgJupC9Y=; b=lQHbIAXLjwEsMbk898r0shYoxQxw/1LaXT08YGpOonMAk2yb0yjmuS/q/zRE5GtlmTkjfRiJzXvM9bq2j/kOuHBgUd0nog7NZbkFsIXY+Yx4x8tpjQtkE2lGa/0GQqJXAHmTzy0pbpM4Plqam0EmOILTQddnX1dM75kgtkUyKnA= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5907.eurprd04.prod.outlook.com (20.178.202.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Wed, 27 Mar 2019 13:21:13 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:13 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 4/7] psci: Add cpu_poke ops to support core poking Thread-Topic: [RFC 4/7] psci: Add cpu_poke ops to support core poking Thread-Index: AQHU5J/zprrbGAWi1k63FnonWZEQSg== Date: Wed, 27 Mar 2019 13:21:13 +0000 Message-ID: <1553692845-20983-5-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dd29c57d-4a49-40a1-b67c-08d6b2b71594 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB5907; x-ms-traffictypediagnostic: AM0PR04MB5907: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(366004)(376002)(346002)(39860400002)(396003)(199004)(189003)(25786009)(2906002)(26005)(386003)(54906003)(8676002)(68736007)(102836004)(6512007)(71200400001)(7416002)(71190400001)(446003)(5660300002)(8936002)(50226002)(4326008)(81166006)(2616005)(476003)(81156014)(44832011)(97736004)(11346002)(6116002)(3846002)(36756003)(105586002)(86362001)(106356001)(2501003)(6486002)(76176011)(6636002)(14454004)(478600001)(6506007)(316002)(52116002)(7736002)(186003)(53936002)(110136005)(6346003)(66066001)(99286004)(14444005)(256004)(486006)(6436002)(305945005)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5907;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gh5VASb52UD4ucQoargW+Pj/M13yvK8y5tsNhjebMg1lP3FXxSLA8rfN3zoOV7LXV4d36KwR0oOSI3g2G5BsZwkouZ/+mIN/m6FzTaFJrLEMvzL79r9lFRAzwiP9ytO2lMqf6SntFsgsbBK4CWJXGIktpoOrQVigR2xm/i2AlM7An1z/1HRU91zG6t9aEoRB6lpW7lb6JkD3EE35xYuqtNUDldyh1y0/ABa/x7qhwJSDiV77QUNgS3X1+0/SzGsZeCtacqFy90YDXBWvBLt3PsJiIpHdUSMrAerqvMPjy3ZoczCsnnAS00MLV858kMP15IwpEMtM4GPtZWIJAyvv5sHzv9dkC6etHDPSMpxOuniHFpmvkMjpAIgvqwnldGBVfflkbmv9JOwprS2iPghzjOxIV2ohG2VVv8KcBlgPk0k= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd29c57d-4a49-40a1-b67c-08d6b2b71594 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:13.2882 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5907 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There can be platforms that need a dedicated work to be done in TF-A before the specified core can be woken up through an IPI. Allow those platforms to call into the TF-A to do that work by making use of the cpu_poke operation. Signed-off-by: Abel Vesa --- arch/arm64/include/asm/cpu_ops.h | 1 + arch/arm64/kernel/psci.c | 1 + drivers/firmware/psci.c | 6 ++++++ include/linux/psci.h | 1 + include/uapi/linux/psci.h | 2 ++ 5 files changed, 11 insertions(+) diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h index 8f03446..913afef 100644 --- a/arch/arm64/include/asm/cpu_ops.h +++ b/arch/arm64/include/asm/cpu_ops.h @@ -60,6 +60,7 @@ struct cpu_operations { #ifdef CONFIG_CPU_IDLE int (*cpu_init_idle)(unsigned int); int (*cpu_suspend)(unsigned long); + int (*cpu_poke)(unsigned int); #endif }; diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 8cdaf25..53227eb 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c @@ -115,6 +115,7 @@ const struct cpu_operations cpu_psci_ops = { #ifdef CONFIG_CPU_IDLE .cpu_init_idle = psci_cpu_init_idle, .cpu_suspend = psci_cpu_suspend_enter, + .cpu_poke = psci_cpu_suspend_exit, #endif .cpu_init = cpu_psci_cpu_init, .cpu_prepare = cpu_psci_cpu_prepare, diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index c80ec1d..282bc47 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -73,6 +73,7 @@ enum psci_function { PSCI_FN_CPU_ON, PSCI_FN_CPU_OFF, PSCI_FN_MIGRATE, + PSCI_FN_CPU_POKE, PSCI_FN_MAX, }; @@ -424,6 +425,11 @@ int psci_cpu_suspend_enter(unsigned long index) return ret; } +int psci_cpu_suspend_exit(unsigned int index) +{ + return invoke_psci_fn(PSCI_0_2_FN_CPU_POKE, index, 0, 0); +} + /* ARM specific CPU idle operations */ #ifdef CONFIG_ARM static const struct cpuidle_ops psci_cpuidle_ops __initconst = { diff --git a/include/linux/psci.h b/include/linux/psci.h index 8b1b3b5..d863733 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -24,6 +24,7 @@ bool psci_tos_resident_on(int cpu); int psci_cpu_init_idle(unsigned int cpu); int psci_cpu_suspend_enter(unsigned long index); +int psci_cpu_suspend_exit(unsigned int index); enum psci_conduit { PSCI_CONDUIT_NONE, diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index b3bcabe..19e7481 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -40,8 +40,10 @@ #define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) #define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) #define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) +#define PSCI_0_2_FN_CPU_POKE PSCI_0_2_FN(11) #define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) +#define PSCI_0_2_FN64_CPU_POKE PSCI_0_2_FN64(11) #define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) #define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) #define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) From patchwork Wed Mar 27 13:21:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10873459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A8BC1708 for ; Wed, 27 Mar 2019 13:21:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E911928657 for ; Wed, 27 Mar 2019 13:21:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC04528BBF; Wed, 27 Mar 2019 13:21:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C7D628657 for ; Wed, 27 Mar 2019 13:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728385AbfC0NVb (ORCPT ); Wed, 27 Mar 2019 09:21:31 -0400 Received: from mail-eopbgr150048.outbound.protection.outlook.com ([40.107.15.48]:27108 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730156AbfC0NVV (ORCPT ); Wed, 27 Mar 2019 09:21:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ro9O727XiFJ7pYrZbuEZxzdJtDA1YxkME8Y1TiR0iaw=; b=M3GiV2oj+EL1BHV0eEPpZnWCbbbmdv+Akvu7L+Ii/psActR/uNRH3MEnwR2g3mpeVO8YIxz29Qq9KoUKgOIR3CHhKNcLQYxvNLdLEDhV4gpUQ1bgNT6+rY6ox9sJBo30eCIgrx4DQn9g9zr3iNu9xa2Q+UPVmcSwKj8kScIQvDo= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5907.eurprd04.prod.outlook.com (20.178.202.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Wed, 27 Mar 2019 13:21:15 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:15 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 5/7] cpuidle-arm: Add ops to support poke alonside enter Thread-Topic: [RFC 5/7] cpuidle-arm: Add ops to support poke alonside enter Thread-Index: AQHU5J/0oZvb5mpe4UOY+zfz3ulcdA== Date: Wed, 27 Mar 2019 13:21:14 +0000 Message-ID: <1553692845-20983-6-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 31761e12-411b-4442-33d6-08d6b2b71690 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB5907; x-ms-traffictypediagnostic: AM0PR04MB5907: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(366004)(376002)(346002)(39860400002)(396003)(199004)(189003)(25786009)(2906002)(26005)(386003)(54906003)(8676002)(68736007)(102836004)(6512007)(71200400001)(7416002)(71190400001)(446003)(5660300002)(8936002)(50226002)(4326008)(81166006)(2616005)(476003)(81156014)(44832011)(97736004)(11346002)(6116002)(3846002)(36756003)(105586002)(86362001)(106356001)(2501003)(6486002)(76176011)(6636002)(14454004)(478600001)(6506007)(316002)(52116002)(7736002)(186003)(53936002)(110136005)(6346003)(66066001)(99286004)(14444005)(256004)(486006)(6436002)(305945005)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5907;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ms6hoU/zq6ahFQ6UiKW2lhRZHR966xH3XgXwf7jpcFj9HKf/1Q1TBxaipvjwvKM3j7ZRi+ifAf7KVB8olztyQW7L45ryhEO1jswLnfac5v3Ok4mbZk0WYX6wvgh+suAjXyPQKuZ+18EYwV/wZ/P4xVyNleN8DzMIxmgCqILiq2KoXV2LkICSTjc7QjNETAWteowAExlNgyI0WF61VDGOdSQzkfLyAYn0HBpP7gsJ+bm8U68vklFwg2jjFgIXrU93UoqQrz4R/0IWz4nSqiJh/Pl1VTGUR0sZHGOUZOGwOGyESnQvNCp6JTx+25jOcfPe1vNBYLkohfEFy4KObo/TplctKet1hHcwpGQy4cQGMDO3fy/ZKjQi5dxyGpPaU8qR2kfX380YUd6YqRt5rHC9KzmqbnndcA+nitZAErBAgdo= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31761e12-411b-4442-33d6-08d6b2b71690 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:14.9744 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5907 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to support poking alongside the enter operation, the cpuidle_dt_ops are added. On each state initialization, if the state has the property "local-wakeup-poke" set, then gets to have the poking mechanims enabled. For now, the arm_poke_idle_state doesn't do anything. Signed-off-by: Abel Vesa --- drivers/cpuidle/cpuidle-arm.c | 13 ++++++++++++- drivers/cpuidle/dt_idle_states.c | 15 ++++++++++----- drivers/cpuidle/dt_idle_states.h | 10 ++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 3a407a3..76ee7ac 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -45,6 +45,12 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, return CPU_PM_CPU_IDLE_ENTER(arm_cpuidle_suspend, idx); } +static int arm_poke_idle_state(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int cpu) +{ + return 0; +} + static struct cpuidle_driver arm_idle_driver __initdata = { .name = "arm_idle", .owner = THIS_MODULE, @@ -65,9 +71,14 @@ static struct cpuidle_driver arm_idle_driver __initdata = { } }; +static const struct cpuidle_dt_ops cpuidle_ops = { + .enter = arm_enter_idle_state, + .poke = arm_poke_idle_state +}; + static const struct of_device_id arm_idle_state_match[] __initconst = { { .compatible = "arm,idle-state", - .data = arm_enter_idle_state }, + .data = &cpuidle_ops }, { }, }; diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index add9569..6490ed4 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -27,19 +27,18 @@ static int init_state_node(struct cpuidle_state *idle_state, { int err; const char *desc; - + const struct cpuidle_dt_ops *ops = match_id->data; /* * CPUidle drivers are expected to initialize the const void *data - * pointer of the passed in struct of_device_id array to the idle - * state enter function. + * pointer of the passed in struct of_device_id array to the ops. */ - idle_state->enter = match_id->data; + idle_state->enter = ops->enter; /* * Since this is not a "coupled" state, it's safe to assume interrupts * won't be enabled when it exits allowing the tick to be frozen * safely. So enter() can be also enter_s2idle() callback. */ - idle_state->enter_s2idle = match_id->data; + idle_state->enter_s2idle = (void *)ops->enter; err = of_property_read_u32(state_node, "wakeup-latency-us", &idle_state->exit_latency); @@ -83,6 +82,12 @@ static int init_state_node(struct cpuidle_state *idle_state, idle_state->flags = 0; if (of_property_read_bool(state_node, "local-timer-stop")) idle_state->flags |= CPUIDLE_FLAG_TIMER_STOP; + + if (of_property_read_bool(state_node, "local-wakeup-poke")) { + WARN_ONCE(!ops->poke, "cpuidle driver: missing poke function\n"); + idle_state->poke = ops->poke; + } + /* * TODO: * replace with kstrdup and pointer assignment when name diff --git a/drivers/cpuidle/dt_idle_states.h b/drivers/cpuidle/dt_idle_states.h index 14ae88c..901a40e 100644 --- a/drivers/cpuidle/dt_idle_states.h +++ b/drivers/cpuidle/dt_idle_states.h @@ -2,6 +2,16 @@ #ifndef __DT_IDLE_STATES #define __DT_IDLE_STATES +struct cpuidle_dt_ops { + int (*enter) (struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index); + + int (*poke) (struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int cpu); +}; + int dt_init_idle_driver(struct cpuidle_driver *drv, const struct of_device_id *matches, unsigned int start_idx); From patchwork Wed Mar 27 13:21:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10873461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9532139A for ; Wed, 27 Mar 2019 13:21:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9462A28657 for ; Wed, 27 Mar 2019 13:21:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 888E728BBF; Wed, 27 Mar 2019 13:21:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 305BF28657 for ; Wed, 27 Mar 2019 13:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730241AbfC0NVV (ORCPT ); Wed, 27 Mar 2019 09:21:21 -0400 Received: from mail-eopbgr20057.outbound.protection.outlook.com ([40.107.2.57]:29764 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730114AbfC0NVU (ORCPT ); Wed, 27 Mar 2019 09:21:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NnnvC8rrbllreco+SztEGDJRUJfZW3+oDSGTnyNzkbg=; b=Ag2NwhrfQYTotQRRC/5XIW3pnNkdksFiYh9UzG9vffDxvfBdkfu9F80CWsDtdukXUnnLPYj53fpzZnQZsp/YXbEsOAK5+5UCsFIfjgEtYKUgOE0preqBpBCIcVs3qPxB97tJnP2oIy9ETULGFSYb8O0Qt0ECv4CWyau35tWOSAI= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6051.eurprd04.prod.outlook.com (20.179.35.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Wed, 27 Mar 2019 13:21:17 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:17 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 6/7] cpuidle-arm: Add arm64 wake helper for cpu_poke op Thread-Topic: [RFC 6/7] cpuidle-arm: Add arm64 wake helper for cpu_poke op Thread-Index: AQHU5J/1bOMxExZCXkCLbXm+Qvy5kg== Date: Wed, 27 Mar 2019 13:21:16 +0000 Message-ID: <1553692845-20983-7-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5ba16ad8-f60f-45a4-0f71-08d6b2b71798 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB6051; x-ms-traffictypediagnostic: AM0PR04MB6051: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(396003)(346002)(376002)(199004)(189003)(25786009)(14444005)(68736007)(4326008)(6436002)(5660300002)(6116002)(71200400001)(71190400001)(3846002)(256004)(8936002)(8676002)(6636002)(2501003)(66066001)(305945005)(2906002)(53936002)(81156014)(6512007)(7736002)(81166006)(7416002)(97736004)(6486002)(36756003)(54906003)(44832011)(50226002)(486006)(106356001)(6506007)(386003)(186003)(110136005)(102836004)(446003)(14454004)(476003)(86362001)(99286004)(11346002)(52116002)(478600001)(316002)(2616005)(26005)(105586002)(76176011)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6051;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: eSXvAMa0U6xLbvi2tcE/ajWZzzIv0+K15d7D82d/6eLP4dGOoihiAWS5FwjDTob5LuJSTiFDg/4vFkQhGPPDEuW34dJS3z31HPCtCZJNLt8bQU2evFJllwD2ssHV2IiqhOGcJW6n6iqWMq+VJHoSIN0rXksPwpAGjqqmzjz05/KxY7855UNzpFnN1YHx91/oQ/wH1UYke+GN5klQgHMn4shU+3y52h5yIuQxqGIGKdKBsgp4BX9X9VHW0LwlA1JY/UADPwlORki1mrCz9gTQ8z0/eMlPiiIxfca1dlhSztUOXNtkP0eJuOWA8CV5kjm4lVU0RYxSLUDSAzfWFp+y2BzbTxTb2jsrK84P06Y9a281PEOEMtyC3r7y+LuK8v5ckMYJ3DyLgmV7+pP+ByZfRB4Y9UHKvT8oOTbx0gpOdLM= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ba16ad8-f60f-45a4-0f71-08d6b2b71798 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:16.9428 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6051 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the arm_poke_idle_state gets called, the poking cpu_ops of the current core gets called, passing on the the index of the core to be poked. Signed-off-by: Abel Vesa --- arch/arm64/include/asm/cpuidle.h | 6 ++++++ arch/arm64/kernel/cpuidle.c | 8 ++++++++ drivers/cpuidle/cpuidle-arm.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h index 3c5ddb4..e637d4d 100644 --- a/arch/arm64/include/asm/cpuidle.h +++ b/arch/arm64/include/asm/cpuidle.h @@ -7,6 +7,7 @@ #ifdef CONFIG_CPU_IDLE extern int arm_cpuidle_init(unsigned int cpu); extern int arm_cpuidle_suspend(int index); +extern int arm_cpuidle_wake(int index); #else static inline int arm_cpuidle_init(unsigned int cpu) { @@ -17,5 +18,10 @@ static inline int arm_cpuidle_suspend(int index) { return -EOPNOTSUPP; } + +static inline int arm_cpuidle_wake(int index) +{ + return -EOPNOTSUPP; +} #endif #endif diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c index f2d1381..af00955 100644 --- a/arch/arm64/kernel/cpuidle.c +++ b/arch/arm64/kernel/cpuidle.c @@ -43,6 +43,14 @@ int arm_cpuidle_suspend(int index) return cpu_ops[cpu]->cpu_suspend(index); } +int arm_cpuidle_wake(int index) +{ + int cpu = smp_processor_id(); + + return cpu_ops[cpu]->cpu_poke(index); +} + + #ifdef CONFIG_ACPI #include diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 76ee7ac..d5d3eef 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -48,7 +48,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, static int arm_poke_idle_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, int cpu) { - return 0; + return arm_cpuidle_wake(cpu); } static struct cpuidle_driver arm_idle_driver __initdata = { From patchwork Wed Mar 27 13:21:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10873457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46FED139A for ; Wed, 27 Mar 2019 13:21:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31D4528657 for ; Wed, 27 Mar 2019 13:21:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 253FE28BBF; Wed, 27 Mar 2019 13:21:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B733728657 for ; Wed, 27 Mar 2019 13:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730114AbfC0NVX (ORCPT ); Wed, 27 Mar 2019 09:21:23 -0400 Received: from mail-eopbgr20057.outbound.protection.outlook.com ([40.107.2.57]:29764 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730179AbfC0NVW (ORCPT ); Wed, 27 Mar 2019 09:21:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=chzbau7PQniR3EdZFc5CRKQhYLFO8FHL1edsCSZByYQ=; b=bHBgFCWCuIE75sQYOIo8cpf8auZZVD8kQjRH1XXC/Vwa9tG9o6eLCQkjmi5u2YqWzWK/GfuV3KdXtkQrzYCTCcMv/At/YVy+/RxOl3Jr3LF+ewPrVey1v5D4tt/KMPvueqtFh4IhVfHCHoRTwq7qRZbpdqIbhElUwpe5qeo+h/8= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6051.eurprd04.prod.outlook.com (20.179.35.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Wed, 27 Mar 2019 13:21:18 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:18 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 7/7] arm64: dts: imx8mq: Add cpu-sleep state with poke wake-up enabled Thread-Topic: [RFC 7/7] arm64: dts: imx8mq: Add cpu-sleep state with poke wake-up enabled Thread-Index: AQHU5J/2q/iaUo72jkeAq5bzHgxofw== Date: Wed, 27 Mar 2019 13:21:18 +0000 Message-ID: <1553692845-20983-8-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 485101a1-9101-46ce-d4e1-08d6b2b718bf x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB6051; x-ms-traffictypediagnostic: AM0PR04MB6051: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(396003)(346002)(376002)(199004)(189003)(25786009)(14444005)(68736007)(4326008)(6436002)(5660300002)(6116002)(71200400001)(71190400001)(3846002)(256004)(8936002)(8676002)(6636002)(2501003)(66066001)(305945005)(2906002)(53936002)(81156014)(6512007)(7736002)(81166006)(7416002)(97736004)(6486002)(36756003)(54906003)(44832011)(50226002)(486006)(106356001)(6506007)(386003)(186003)(110136005)(102836004)(446003)(14454004)(476003)(86362001)(99286004)(11346002)(52116002)(478600001)(316002)(2616005)(26005)(105586002)(76176011)(32563001)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6051;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ID2ZJyjZo9PTVXPQW4fabxhcOhw3pmNuS0nO58cxyR9zuhf0jCZ865NAHs4S13YzBvq+vvV71PF95FGrOpkYRXfSdyUFt8rjvHpNOM2QzpruQtObJqmlHV+h1ZYs/OU5WjBw2++96VHrqMZMyDvGGu6k4TD4xV8a/+ZP4OQ6eGbmsN6JoleckDS4PA/7+EOEeZLTHQs4gN8rUtUaF9/NtmXZ2eUXMjrbODP+agBt0KeV0ioXt6kMsF95KxJv4YXbXhMZzabcftlwmCutcm0Qe7rZN8bM5aOAOfLrp+hQ+yskvnwWvDtMZKbZw+2Sz0FHV2REQECKTekF3BWDBsoRYGzaWJmkzS14knUTFZ5WCAOQ+WLnuqb3ttBcVYPgjj4y5j5xsd1TE4cOrFK4MNF748uqSpB4sSrro0stGHICLeQ= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 485101a1-9101-46ce-d4e1-08d6b2b718bf X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:18.6470 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6051 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the idle state cpu-sleep to each core. This idle state makes use of 'local-wakeup-poke' property which basically tells the cpuidle-arm driver to enable the poking for this state. Signed-off-by: Abel Vesa --- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi index 230f198..8b7303d 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -84,6 +84,22 @@ #address-cells = <1>; #size-cells = <0>; + idle-states { + entry-method = "psci"; + + CPU_SLEEP: cpu-sleep { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x0010033>; + local-timer-stop; + local-wakeup-poke; + entry-latency-us = <1000>; + exit-latency-us = <700>; + min-residency-us = <2700>; + wakeup-latency-us = <1500>; + }; + }; + + A53_0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a53"; @@ -94,6 +110,7 @@ next-level-cache = <&A53_L2>; operating-points-v2 = <&a53_opp_table>; #cooling-cells = <2>; + cpu-idle-states = <&CPU_SLEEP>; }; A53_1: cpu@1 { @@ -106,6 +123,7 @@ next-level-cache = <&A53_L2>; operating-points-v2 = <&a53_opp_table>; #cooling-cells = <2>; + cpu-idle-states = <&CPU_SLEEP>; }; A53_2: cpu@2 { @@ -118,6 +136,7 @@ next-level-cache = <&A53_L2>; operating-points-v2 = <&a53_opp_table>; #cooling-cells = <2>; + cpu-idle-states = <&CPU_SLEEP>; }; A53_3: cpu@3 { @@ -130,6 +149,7 @@ next-level-cache = <&A53_L2>; operating-points-v2 = <&a53_opp_table>; #cooling-cells = <2>; + cpu-idle-states = <&CPU_SLEEP>; }; A53_L2: l2-cache0 {