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: 10873481 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 12D21139A for ; Wed, 27 Mar 2019 13:22:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE52128657 for ; Wed, 27 Mar 2019 13:22:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1D6028BB9; Wed, 27 Mar 2019 13:22:50 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 61E9E28657 for ; Wed, 27 Mar 2019 13:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=477LM4e9xIT1bFTnNz9GXOlSm7kKXtxetxr0hQBE+/s=; b=QGO0XNl1o0metd TXUQo5eusPjcBDEOgQS21rrpyQCf0ydegZJSMwdAT9Fza6CaOnlVjWdoM8OBtK12YK9mOHASGcseK CeUj/OLf2wNjkQmsLNq2x8f8PnGtltCC7FBojcb/urtAdwEoOU0U6XPfcOCCf5eXoV0utu0lOagUc N0A0X+YFutaVyYDach0BIj6ue7VN356veNX5xj9YfRwrD56zMn+YsvVBdWC+yOcNwxf1gu1GEraSQ E674WdtSruxwUDQp/oH5mLu+cISdUMI1Kxlnh5EF2r0ieoSW4CQqSNidefzTZSnRi5p38ht3iYNSw wfQM6YEs6gDFqbTdUCdQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h98Vn-0004tx-9N; Wed, 27 Mar 2019 13:22:35 +0000 Received: from mail-db5eur01on0618.outbound.protection.outlook.com ([2a01:111:f400:fe02::618] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h98Uh-0003YO-LH for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2019 13:21:30 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190327_062127_994463_EBEF9CED X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Abel Vesa , "linux-pm@vger.kernel.org" , dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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)