From patchwork Fri Oct 7 10:32:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mykyta Poturai X-Patchwork-Id: 13000973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 D2763C433F5 for ; Fri, 7 Oct 2022 10:33:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.417690.662479 (Exim 4.92) (envelope-from ) id 1ogkfH-0007MB-On; Fri, 07 Oct 2022 10:33:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 417690.662479; Fri, 07 Oct 2022 10:33:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ogkfH-0007FY-4K; Fri, 07 Oct 2022 10:33:11 +0000 Received: by outflank-mailman (input) for mailman id 417690; Fri, 07 Oct 2022 10:33:04 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ogkf9-0004PE-BW for xen-devel@lists.xenproject.org; Fri, 07 Oct 2022 10:33:03 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 693c3526-462b-11ed-9377-c1cf23e5d27e; Fri, 07 Oct 2022 12:32:59 +0200 (CEST) Received: from pps.filterd (m0174680.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2977q6QY027397; Fri, 7 Oct 2022 10:32:56 GMT Received: from eur01-db5-obe.outbound.protection.outlook.com (mail-db5eur01lp2055.outbound.protection.outlook.com [104.47.2.55]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3k208bupyb-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Oct 2022 10:32:56 +0000 Received: from VI1PR03MB3758.eurprd03.prod.outlook.com (2603:10a6:803:33::29) by DBBPR03MB6716.eurprd03.prod.outlook.com (2603:10a6:10:207::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.38; Fri, 7 Oct 2022 10:32:52 +0000 Received: from VI1PR03MB3758.eurprd03.prod.outlook.com ([fe80::77e8:5cf6:210:7273]) by VI1PR03MB3758.eurprd03.prod.outlook.com ([fe80::77e8:5cf6:210:7273%5]) with mapi id 15.20.5676.038; Fri, 7 Oct 2022 10:32:52 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 693c3526-462b-11ed-9377-c1cf23e5d27e ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MfPdjuuE9j3LU/YVeOAlGdAUaRqOVYY/GLDpNjS2NoBTHaQM0HaOCqhBmq6gKeF6/LivQxnnLO9asZXPuK6KX3vQMRRgX0+EKh/dWj9/FfKApm4jo0i+uRifQcyl8DbkrLWA70LeQaNwLxCHHVh4yH4fXRQEHNpXT63TQEStJcCpm7wuiLyKNvH+9ZD6ht1Zk72LQwQcoY+hITrQdemcYIaw90XngCAidHv8WeuX7YZS+VxIjb/aXTGCvLYRZjc8bNqP1gM5peeOtEPcmS9OMdg5PzUX67O46HgBFj7bv99f+ZOVPFGISINp4jGkgX02DSUPM8EMRr5gH3sWQiRfJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=unz+jrtnrI+CjltUTU38KqHD4hMG6m3HsyrrTQHSbvw=; b=HR9uyYUA+pcvzG/g3WEelzFgquVGiXRBMDaEfNVdJ/uQv3HsGyYq1jNL5RdSqN/YY+hy5L3QmbTdOm9+TfglKRUfUNX7WGditEwn/SQJMokuIuwXncNfQV/YObzD8on8bSxUOZZjcexF5Q1U3qMwUK+vZeu7vxpNKFWhDGg4GXCSM4vG3KpB/nB+FornvJsBs0Ov9zO2y3D+WpDpZFQCqiZJhLjaJiiIoGvDELKsG6OMXdbE7ynzmYi95swOF7qyq7jBR1C41B49hhpRHRH8YfeovJ4mRbqU+rSKEqnCKXUe+BkmURRE7qNr85wHg0Dxq1HfFTuiHnggsghVZ0Cm3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=unz+jrtnrI+CjltUTU38KqHD4hMG6m3HsyrrTQHSbvw=; b=M9msj1BE3qxjEupp/yZZTPoAkipuOoxSeZeJiRug7Ud1Cj+KH88y2uSHAUUYvB02akWLfVRjWpL74+wX5z0bklSk8+ZIZnZBYfy+zZ+KmlXnh30sQYDUBPCT25NNZTrOyTKLtgXwthc74IMKR9TjiJhNMnBuE2lerX+roWzRgtbXXrXeYVAiExBwtS420TrL/A+QxwZqTBzSyVUI+CtqciudUpOdJ8amyT7K4TW4EPsSaXsswSe0D2EDDS9U5h0ja0QChy2MfrTV8YcxVEw/VEUF8O+6xE6BwCQ6JlbA8tMcnxPiIGcSWxLRntf5u8ag2shqXDBwosRqlhhcRqz7TA== From: Mykyta Poturai To: "xen-devel@lists.xenproject.org" CC: Mirela Simonovic , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Saeed Nowshadi , Mykyta Poturai Subject: [PATCH 12/19] xen/arm: Implement PSCI SYSTEM_SUSPEND call (physical interface) Thread-Topic: [PATCH 12/19] xen/arm: Implement PSCI SYSTEM_SUSPEND call (physical interface) Thread-Index: AQHY2jglXt2WenDZ1Uub9jvAfdfdiQ== Date: Fri, 7 Oct 2022 10:32:49 +0000 Message-ID: <3c5ec1f22e9ae6bac7ee98f63a0a700d7c3ec11f.1665137247.git.mykyta_poturai@epam.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3758:EE_|DBBPR03MB6716:EE_ x-ms-office365-filtering-correlation-id: cadc161e-6439-4a3a-deb9-08daa84f4a00 x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: W/RhVCMWheAiOuatjlYbhbK82rGRxdS4LnZPLGLf77Cr4X/PTh8XFVHGGHTFTcX95t3MaVaLU/BYQJurQ+0f8flhdHxrQlb45wWYoGSoWsiv7w1zFdUifoi8qjgIALMvyiC7zHM3HWwLTQpaUrzekyC452keDvQMBcpbEat8kFzsB/RdAl4hYF6tuzA4moRBqinkPykPO5gN1ju/wOUnqZSmn5QeQUBYr1ZEOcKIxLNZmy2JRAHmjS/Ed8LgMaHG+I3krY+PYpSc6dD7b8XFKADnxm3gImRX/aqHIiyssLS5uXw4kgT5VTwynQ8xvF2HUJua7TXEbqziQjcayJIL5ejZsq9XQsLoXqBPQfIyG/OkOnCZCZbyASZ4Zf0CsdLry7i4KDBiqVQFg9nre79Al86579DSx/AcN3Ym/XJVg3yQdhh/+ZCJh0ZTUnSWC2brBVKTAHxINTK97xFIShg2iy3RJHetWZahaMolxhlVU2mVtRMSC/1/LisG88iZ9a4cAyJX+2jTfT/Ql7hlCnGxCtm37QW1xHuALxxSwTNtsFi8eei8H16NX7s8osiRkjU4cn/xeOQIewKBHj8kEdOQ+64JJjvBEqrEXRfzWQOjaksCHWGTLNCU4lhQvXEYsWxHKvd6CFHkmQI57seJsjZukogGzjphfEVjB4rqq1RbuosFDyoKnnQr4eTWDImzuA2Lic9glkv3nYo4Wufqdc1b9gVcVDvLsHDewGO8Vfey+Zs6AmFVSKj0lnrjFZV3sInEKovCNIIaU0ExKt8rmC59pw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3758.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(136003)(396003)(366004)(376002)(346002)(451199015)(2616005)(186003)(83380400001)(107886003)(38100700002)(38070700005)(122000001)(41300700001)(2906002)(5660300002)(8936002)(55236004)(6486002)(26005)(6666004)(71200400001)(6506007)(316002)(478600001)(8676002)(54906003)(76116006)(91956017)(4326008)(64756008)(66446008)(66476007)(66946007)(66556008)(6916009)(6512007)(36756003)(86362001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?oLF5zdZIwQ61uoiGz9x9VeL?= =?iso-8859-1?q?95J0qey94TadFHNnfGDsAZczeTHwTpFRYa9YTxEne2gOD8s0/nRrRW1/Y15T?= =?iso-8859-1?q?x6boUIbWVLL51OWqKDAM69iW29T9R0qMX0HaDM6YECEwFirA+9BNXRMT5puV?= =?iso-8859-1?q?hacEFsxVyD1EK0wmFzJM5KMRapBczi6+BV0aRJorfMVNuXhwymeIlvOKDmQL?= =?iso-8859-1?q?uAS8UJpyV+Pxh6v0caZvu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F+9pVaXGWDqXIKVIbZ?= =?iso-8859-1?q?94SSc5KeIrvmH7GQixEBM6nScyRzXVMzPPicitBweoTzfw872P8j7zTksGk/?= =?iso-8859-1?q?Up1qL36kaiIWRlwNAmsXz9lXT/rWm4S8SUj9OiY8fLrLJ1kgR13JIy8ZNlgO?= =?iso-8859-1?q?mAPsrCiovtTmNILZGRwYudSEQIPsMW0pkd8WOHjEQThNbERw24xhhQ34vQbf?= =?iso-8859-1?q?tIxFZqA2Hge2TYcs8Jr9B7EN0hp0MFoXqTCd5PtYk04MhGHAMUQpxadtO97X?= =?iso-8859-1?q?NEw2y524o2R/m+gsafWSw020RlDhEDbLb9E7VFxC4ygpzB2zUS0AfkE2CR6m?= =?iso-8859-1?q?2Jng7AEaIRi8jSGXZl4Ey3lOZb02LiIHJG/5+SMuZYlhi9+Ge5DErpNprBvW?= =?iso-8859-1?q?JRmYgFo+VD4I0Aby8Ztu+8RyW583Nn+Q1DbCDel8FaOIiIKemUMU+TrbKYP8?= =?iso-8859-1?q?0yOeHsH+Tqb5jJ7goEl2eMyIDaMoTE44eYzBKuLUtw2ZkZX3ApYw5kV06+sB?= =?iso-8859-1?q?LV1MewB/bVniEALDFnHGUgXWeQ6MhLUetvyamxg=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3758.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cadc161e-6439-4a3a-deb9-08daa84f4a00 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2022 10:32:49.7083 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: haPwk+HeC6NjZhQbbI1qXuUU6DfMM6vmanzcnUy5/Fg72CeJXTonsb8+Ur09uU7PWrfjmyb7u4jjBwQjfRYxCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB6716 X-Proofpoint-GUID: lv8on0Bzs9Gnx-_bIOHkvxt5fn3yGKU0 X-Proofpoint-ORIG-GUID: lv8on0Bzs9Gnx-_bIOHkvxt5fn3yGKU0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-06_05,2022-10-07_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=969 adultscore=0 bulkscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210070064 From: Mirela Simonovic PSCI system suspend function shall be invoked to finalize Xen suspend procedure. Resume entry point, which needs to be passed via 1st argument of PSCI system suspend call to the EL3, is hyp_resume. For now, hyp_resume is just a placeholder that will be implemented in assembly. Context ID, which is 2nd argument of system suspend PSCI call, is unused, as in Linux. Update: moved hyp_resume to head.S to place it near the rest of the start code Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai --- xen/arch/arm/arm64/head.S | 3 +++ xen/arch/arm/psci.c | 16 ++++++++++++++++ xen/arch/arm/suspend.c | 4 ++++ xen/include/asm-arm/psci.h | 1 + xen/include/asm-arm/suspend.h | 1 + 5 files changed, 25 insertions(+) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index aa1f88c764..8857955699 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -957,6 +957,9 @@ ENTRY(efi_xen_start) b real_start_efi ENDPROC(efi_xen_start) +ENTRY(hyp_resume) + b . + /* * Local variables: * mode: ASM diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c index 0c90c2305c..43a67eb345 100644 --- a/xen/arch/arm/psci.c +++ b/xen/arch/arm/psci.c @@ -25,6 +25,7 @@ #include #include #include +#include /* * While a 64-bit OS can make calls with SMC32 calling conventions, for @@ -68,6 +69,21 @@ void call_psci_cpu_off(void) } } +int call_psci_system_suspend(void) +{ +#ifdef CONFIG_ARM_64 + struct arm_smccc_res res; + + /* 2nd argument (context ID) is not used */ + arm_smccc_smc(PSCI_1_0_FN64_SYSTEM_SUSPEND, __pa(hyp_resume), &res); + + return PSCI_RET(res); +#else + /* not supported */ + return 1; +#endif +} + void call_psci_system_off(void) { if ( psci_ver > PSCI_VERSION(0, 1) ) diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c index 05c43ce502..a0258befc9 100644 --- a/xen/arch/arm/suspend.c +++ b/xen/arch/arm/suspend.c @@ -161,6 +161,10 @@ static long system_suspend(void *data) goto resume_irqs; } + status = call_psci_system_suspend(); + if ( status ) + dprintk(XENLOG_ERR, "PSCI system suspend failed, err=%d\n", status); + system_state = SYS_STATE_resume; gic_resume(); diff --git a/xen/include/asm-arm/psci.h b/xen/include/asm-arm/psci.h index 26462d0c47..9f6116a224 100644 --- a/xen/include/asm-arm/psci.h +++ b/xen/include/asm-arm/psci.h @@ -20,6 +20,7 @@ extern uint32_t psci_ver; int psci_init(void); int call_psci_cpu_on(int cpu); +int call_psci_system_suspend(void); void call_psci_cpu_off(void); void call_psci_system_off(void); void call_psci_system_reset(void); diff --git a/xen/include/asm-arm/suspend.h b/xen/include/asm-arm/suspend.h index fbaa414f0c..29420e27fa 100644 --- a/xen/include/asm-arm/suspend.h +++ b/xen/include/asm-arm/suspend.h @@ -3,6 +3,7 @@ int32_t domain_suspend(register_t epoint, register_t cid); void vcpu_resume(struct vcpu *v); +void hyp_resume(void); #endif