From nobody Fri Jun 19 07:17:14 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 050C4C433EF for ; Wed, 6 Apr 2022 13:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233585AbiDFNqB (ORCPT ); Wed, 6 Apr 2022 09:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233516AbiDFNpv (ORCPT ); Wed, 6 Apr 2022 09:45:51 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2053.outbound.protection.outlook.com [40.107.244.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D8E02F3D3A for ; Wed, 6 Apr 2022 03:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l/+yO1RUMjJNCZMLWeV1nHL1K/rRA2VdVT78WhJJsNZqAf1M82aHY9GK28mTSSAJJ9fxrEdvdaYgEPR2kE7jLmZYtSAbRKBzTwokITHTUCN9mPuVqlIocalwZFngs4u6U21C6nb/4A3gs7a3Yi5q7wl46xHhtNj1EYUPPiVH3Rw7ECtqVc2mumJJQITLvNe9aL9CK/4LBxkqOjVOy9AQYVLmOkvOWcvwxu3Xd88oECZgeeNNa/cbCrY47UUS9fLtjAKafWcByL6rD2VTpXXxXr1AIdLE9Je3i7UDGzbb9KmFtmCFvxomsON6xlQ+AHEz6I8TWMYqvQ23EATcLefh2Q== 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=nO+jUIaGvM5ZJK+HD/Jm6o7kbY8rMhX74xWFDbh+/pM=; b=gFB0csABya8HBFeG2F+ObM+Z1JoNNJFcvNfOcGFzq1pxrXCxaKDrtQLBnHNOTvtZ0UPe47BqyvqYw+WfiovhyoH6XXS6E1b8xiPYexpHSElSpnmu7+4y1NOMgn0Qf+ZGUImWwVrCToU3r6b53jxDHeho/WHI1BaG/SUKtLHXE/w5W6yDchb9RH7Stk0N+erGRIhrcbuGqXX+llfUYC6VyH764/8l3EQCeGUtbCqTyAL1RViaCktN27zKE6StCc8Am3esGILSdpJZ2ffYq/VCcHwBxwTY+3E9Elvz0qmBU3NZ5w27Sef3K6zuTIOL0jM/U1bn5+0igxBf3QA3qYT2aA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nO+jUIaGvM5ZJK+HD/Jm6o7kbY8rMhX74xWFDbh+/pM=; b=szJieitmDNl8dAFz+c7qPD+f+bBsEcDkQNURDnxYWC7rypvV+ViO2FYfgmW9HEQujHf3Iqs0UGjCJyJQ3J6PqnRsrOoz24cx2VFu7O76c/A7NRZxbiXvewYvVbZKfxNFGm+aLzNZWguA4FRE8P9l7Vz/hX+sq5zR1h5ar7WRTx0= Received: from DS7PR03CA0115.namprd03.prod.outlook.com (2603:10b6:5:3b7::30) by SN4PR0201MB3438.namprd02.prod.outlook.com (2603:10b6:803:48::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Wed, 6 Apr 2022 10:55:37 +0000 Received: from DM3NAM02FT019.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::5d) by DS7PR03CA0115.outlook.office365.com (2603:10b6:5:3b7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31 via Frontend Transport; Wed, 6 Apr 2022 10:55:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT019.mail.protection.outlook.com (10.13.4.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5144.21 via Frontend Transport; Wed, 6 Apr 2022 10:55:37 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 6 Apr 2022 03:55:33 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 6 Apr 2022 03:55:33 -0700 Envelope-to: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, corbet@lwn.net, linux-arm-kernel@lists.infradead.org, arnd@arndb.de Received: from [172.19.2.243] (port=36060 helo=xsjwillw50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nc3K1-0007fI-Fy; Wed, 06 Apr 2022 03:55:33 -0700 From: Ronak Jain To: , CC: , , , , , , Ronak Jain Subject: [PATCH 1/4] firmware: xilinx: add support for IOCTL and QUERY ID feature check Date: Wed, 6 Apr 2022 03:55:23 -0700 Message-ID: <1649242526-17493-2-git-send-email-ronak.jain@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> References: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79b984c1-245c-499b-fde0-08da17bbfb9f X-MS-TrafficTypeDiagnostic: SN4PR0201MB3438:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tsopqFQ5aNaPie63WnQuJXKjIUKAz45AdY9jC2FkR7S/LXNI3w+I6EZ+6a8+wN8K0KnEeB8JLCeZEOVQUi7/9BcQgFU+QDZBwL7Ttke+NLJW4YGkYzK5LoLsxPglq3LsF0RnpmcPsRkRMSy5HeYrUFKceWX8T8qWUGlsimUV6tkkJ4xB3xVrCB0234s5315TWyGH27ZyvQst4gPziS2+AFqpmdoXyy6DH885ESffXi6g2Z3YewSzXhkkvfF3MSCyO/dHTVfGn26J3IcyYJaq/SsZMcHg0b5tv7dcIoA4fl7kTlw+W5WFspXk0GoiZii4++Mbwpx3gSKA5YVeRu4wzD+Uwy7GhZtqt0DrtwmqDkcNQRW4ivW6L76ET/LvGANxzV0bl+6vtVEz2PVRhWCdsC70fN7CSOMK6vybdG5ROcv9MgHZcLXnupdvfQTjRwkOi856EZ7G1q3TENzslaJWEWSMH+emvM1fQEKETjzmMc5spZj4Ztm3zuH+2b5v5JHMpkSmYTwMKYPzPns5D1ICCHracbEVkIPb8tef0JaTOlk7RG39M/R1rxbyxEw/UhOHaIBqWDYlteoFEZg43eSSOh08JzkJsowgIwCfuwrlPfYwAusbx1MMeZc1rPBBgDVbzQTyu8mDXLqrdaG6jLplx6oFweGtv5Taabo9RYP0kxrfxKsAj0v01NXhdvxu7TcvPxTGkK1yTo1jZGKKwRd6kg== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(7636003)(107886003)(508600001)(6666004)(110136005)(44832011)(316002)(2616005)(5660300002)(336012)(83380400001)(426003)(54906003)(26005)(40460700003)(36756003)(82310400005)(7696005)(8676002)(2906002)(4326008)(70586007)(36860700001)(47076005)(356005)(70206006)(8936002)(186003)(9786002)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2022 10:55:37.3454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79b984c1-245c-499b-fde0-08da17bbfb9f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT019.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0201MB3438 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support to check if IOCTL ID or QUERY ID is supported in firmware or not. Signed-off-by: Ronak Jain Acked-by: Michal Simek --- drivers/firmware/xilinx/zynqmp.c | 62 ++++++++++++++++++++++++++++++++= +++- include/linux/firmware/xlnx-zynqmp.h | 11 +++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zyn= qmp.c index f21ece56695e..41ca41697790 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -36,8 +36,16 @@ /* BOOT_PIN_CTRL_MASK- out_val[11:8], out_en[3:0] */ #define CRL_APB_BOOTPIN_CTRL_MASK 0xF0FU =20 +/* IOCTL/QUERY feature payload size */ +#define FEATURE_PAYLOAD_SIZE 2 + +/* Firmware feature check version mask */ +#define FIRMWARE_VERSION_MASK GENMASK(15, 0) + static bool feature_check_enabled; static DEFINE_HASHTABLE(pm_api_features_map, PM_API_FEATURE_CHECK_MAX_ORDE= R); +static u32 ioctl_features[FEATURE_PAYLOAD_SIZE]; +static u32 query_features[FEATURE_PAYLOAD_SIZE]; =20 static struct platform_device *em_dev; =20 @@ -168,7 +176,8 @@ static noinline int do_fw_call_hvc(u64 arg0, u64 arg1, = u64 arg2, } =20 /** - * zynqmp_pm_feature() - Check weather given feature is supported or not + * zynqmp_pm_feature() - Check whether given feature is supported or not a= nd + * store supported IOCTL/QUERY ID mask * @api_id: API ID to check * * Return: Returns status, either success or error+reason @@ -208,11 +217,62 @@ int zynqmp_pm_feature(const u32 api_id) feature_data->feature_status =3D ret; hash_add(pm_api_features_map, &feature_data->hentry, api_id); =20 + if (api_id =3D=3D PM_IOCTL) + /* Store supported IOCTL IDs mask */ + memcpy(ioctl_features, &ret_payload[2], FEATURE_PAYLOAD_SIZE * 4); + else if (api_id =3D=3D PM_QUERY_DATA) + /* Store supported QUERY IDs mask */ + memcpy(query_features, &ret_payload[2], FEATURE_PAYLOAD_SIZE * 4); + return ret; } EXPORT_SYMBOL_GPL(zynqmp_pm_feature); =20 /** + * zynqmp_pm_is_function_supported() - Check whether given IOCTL/QUERY fun= ction + * is supported or not + * @api_id: PM_IOCTL or PM_QUERY_DATA + * @id: IOCTL or QUERY function IDs + * + * Return: Returns status, either success or error+reason + */ +int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id) +{ + int ret; + u32 *bit_mask; + + /* Input arguments validation */ + if (id >=3D 64 || (api_id !=3D PM_IOCTL && api_id !=3D PM_QUERY_DATA)) + return -EINVAL; + + /* Check feature check API version */ + ret =3D zynqmp_pm_feature(PM_FEATURE_CHECK); + if (ret < 0) + return ret; + + /* Check if feature check version 2 is supported or not */ + if ((ret & FIRMWARE_VERSION_MASK) =3D=3D PM_API_VERSION_2) { + /* + * Call feature check for IOCTL/QUERY API to get IOCTL ID or + * QUERY ID feature status. + */ + ret =3D zynqmp_pm_feature(api_id); + if (ret < 0) + return ret; + + bit_mask =3D (api_id =3D=3D PM_IOCTL) ? ioctl_features : query_features; + + if ((bit_mask[(id / 32)] & BIT((id % 32))) =3D=3D 0U) + return -EOPNOTSUPP; + } else { + return -ENODATA; + } + + return 0; +} +EXPORT_SYMBOL_GPL(zynqmp_pm_is_function_supported); + +/** * zynqmp_pm_invoke_fn() - Invoke the system-level platform management lay= er * caller function depending on the configuration * @pm_api_id: Requested PM-API call diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/= xlnx-zynqmp.h index 14f00a7672d1..1ec73d5352c3 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -29,6 +29,11 @@ =20 /* SMC SIP service Call Function Identifier Prefix */ #define PM_SIP_SVC 0xC2000000 + +/* PM API versions */ +#define PM_API_VERSION_2 2 + +/* ATF only commands */ #define PM_GET_TRUSTZONE_VERSION 0xa03 #define PM_SET_SUSPEND_MODE 0xa02 #define GET_CALLBACK_DATA 0xa01 @@ -460,6 +465,7 @@ int zynqmp_pm_load_pdi(const u32 src, const u64 address= ); int zynqmp_pm_register_notifier(const u32 node, const u32 event, const u32 wake, const u32 enable); int zynqmp_pm_feature(const u32 api_id); +int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value); int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payloa= d); #else @@ -678,6 +684,11 @@ static inline int zynqmp_pm_pinctrl_get_function(const= u32 pin, u32 *id) return -ENODEV; } =20 +static inline int zynqmp_pm_is_function_supported(const u32 api_id, const = u32 id) +{ + return -ENODEV; +} + static inline int zynqmp_pm_pinctrl_set_function(const u32 pin, const u32 = id) { return -ENODEV; --=20 2.7.4 From nobody Fri Jun 19 07:17:14 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F71FC433EF for ; Wed, 6 Apr 2022 13:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233651AbiDFNqE (ORCPT ); Wed, 6 Apr 2022 09:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233508AbiDFNpv (ORCPT ); Wed, 6 Apr 2022 09:45:51 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2063.outbound.protection.outlook.com [40.107.244.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC219319E for ; Wed, 6 Apr 2022 03:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hI+HSwdB+xqYaJK5Sil4Z+s+UwFz1nzVM8pp8TKdhk1caGL+ijmyb2tR0kONyDpLlyNAOC2wo4vvTS9ImGmo+gfR7LTX/+6OsS+Ig3uQ/kZn4/W7FjSUiwF+afnxlJr3ByuqeNxUHEu/4ziyLUj6+0PxrgvXGeMVvxv2h71zuUJmBuoxrJShiN29o1Ae84fZ7OlVMeUJc7XpbnHRdVW5PCVZsv3wx7jKNTerI9p1hUDbpstxOFF3HvXXVPhgPFaPUI364nMtQoBDFdsiQ/aaXpjGdTgDV/bcjWNXKdy6C57wn+npw3AecVC7eW+mNUii5QrFZak8kcjrG0xMJew6hQ== 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=0dNOROgwWaKb/XeZ2AEYZ8G4UBcBsUX9iIkwlWX4Xn8=; b=Lws4sknobqXsPe5jRKsaNxd5zSFdqCjcBvJHggwSWXEHNWSc0MObv8hNVAvfaWsvMZKetTUE0sLFnXp8XrOM2671l0zIWH+n88HKd0j/7fTnZJZPGEpbKn1Q/K3tzu43CIi1N3LAM4Fn2o74XxxDep6LvU7Y2XdHr+abZ1gaQgKRNEKXqXWLpuBClTunMdh0Vvk8G9DVfWDgXcmZzeDMxQ3ycRXDY2AmWXok0SsbYXh5FjfW9ieFxMYF2aoZg9IPRWxw82opI+g0mBYnw59Zr6poVjXTV2+WRfuctKTzLSQWSzX5OK0heorNF2DE1QYSMEkHUtUk/X0W1WM39QU4tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0dNOROgwWaKb/XeZ2AEYZ8G4UBcBsUX9iIkwlWX4Xn8=; b=dl6y8Q+MXQrl1NCZDo5ySN5BVh47a5t9iR/Tew6sTczWZpvs+Df/a7Qf/kQcCUi5iX8rqBISt84njpVXIhzHrXBzguOsPKhdclAMnWkx/xu/NTajREn2K9nGVVEkQBFYujPdunzRNb6u/fABS1M71rz3795zKUfn2Fmze+RX9NI= Received: from DS7PR03CA0115.namprd03.prod.outlook.com (2603:10b6:5:3b7::30) by MWHPR0201MB3433.namprd02.prod.outlook.com (2603:10b6:301:7c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Wed, 6 Apr 2022 10:55:37 +0000 Received: from DM3NAM02FT019.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::49) by DS7PR03CA0115.outlook.office365.com (2603:10b6:5:3b7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31 via Frontend Transport; Wed, 6 Apr 2022 10:55:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT019.mail.protection.outlook.com (10.13.4.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5144.21 via Frontend Transport; Wed, 6 Apr 2022 10:55:36 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 6 Apr 2022 03:55:33 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 6 Apr 2022 03:55:33 -0700 Envelope-to: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, corbet@lwn.net, linux-arm-kernel@lists.infradead.org, arnd@arndb.de Received: from [172.19.2.243] (port=36060 helo=xsjwillw50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nc3K1-0007fI-Gp; Wed, 06 Apr 2022 03:55:33 -0700 From: Ronak Jain To: , CC: , , , , , , Ronak Jain Subject: [PATCH 2/4] firmware: xilinx: add new function for do_feature_check_call Date: Wed, 6 Apr 2022 03:55:24 -0700 Message-ID: <1649242526-17493-3-git-send-email-ronak.jain@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> References: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38675bc7-1d08-42f7-8d1a-08da17bbfb4c X-MS-TrafficTypeDiagnostic: MWHPR0201MB3433:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LZt6WI1FpqCuz2VWNtX2JXS8we1BQP6RJJrBwUMlsKT0fmI51if0oYyFcWzWZ1e2lNYDBFxf/wY1LgjhFaZ2JbkRjCKk8HTCkY9LoTcqU4LKZD8xWe0C/AbiEJKrtXY2jBJuayimZdqoVSYFTmgPwRU2P3GC/asl13f/yUl2vwuGXCxYYtw/wUIocCdXla6jJiSXRd96GN0RycWpl2TGSl33xWlHiGDkFK/n5x8qD44DDl1/jltICWgDdFkjhlgYFzM7z2oi0pbfOg9QmbPHonNqCDkUc8u0x4I034WKU44I0Z01jSsQ7k3knzymL+n0T8MF0oZTPlGQEToYGpkYydKwMGswVwgubVT7zS8vnVfoERWjHRamj4xg/bRc/8AuRy9WDOTiuOhtC8XbdDTczlpLwFE7/WiNPbKamWqPSiQUrzUqbXteLM6ZpyMutI3VxM/RpI1EDPfAJNstyxKVjTcnJoYa5Qnkip6wkS55IehbSdjZKbLTmIxjbqY+yLeLjSCu5s5drPIYznj/lToRvqGvoSyxPfIWKrBrvp4SjCyWXxNOc6FqML7mJKOZcWafoZdMgFB8JJSOeKRVoX6+cgLlrxVIkAjdh9DSmsJzp2klDVkb4ZwSYM3U1RKg469UlPlhWCqnFG5Ir07Vjjh/bnIuUcECH2unJPN9ktZiO+DXkkIHQK12jNK5b72yh1ymQqkR5/52tF/V+4Qsj80LvA== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(5660300002)(36756003)(110136005)(7696005)(9786002)(6666004)(47076005)(4326008)(44832011)(54906003)(83380400001)(40460700003)(2906002)(8936002)(26005)(186003)(7636003)(508600001)(426003)(2616005)(336012)(82310400005)(316002)(36860700001)(356005)(8676002)(70206006)(70586007)(107886003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2022 10:55:36.7830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38675bc7-1d08-42f7-8d1a-08da17bbfb4c X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT019.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0201MB3433 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add new function for sending feature check request to firmware and call it from zynqmp_pm_feature(). Signed-off-by: Ronak Jain Acked-by: Michal Simek --- drivers/firmware/xilinx/zynqmp.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zyn= qmp.c index 41ca41697790..d27a3b20227b 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -175,6 +175,23 @@ static noinline int do_fw_call_hvc(u64 arg0, u64 arg1,= u64 arg2, return zynqmp_pm_ret_code((enum pm_ret_status)res.a0); } =20 +static int do_feature_check_call(const u32 api_id, u32 *ret_payload) +{ + int ret; + u64 smc_arg[2]; + + smc_arg[0] =3D PM_SIP_SVC | PM_FEATURE_CHECK; + smc_arg[1] =3D api_id; + + ret =3D do_fw_call(smc_arg[0], smc_arg[1], 0, ret_payload); + if (ret) + ret =3D -EOPNOTSUPP; + else + ret =3D ret_payload[1]; + + return ret; +} + /** * zynqmp_pm_feature() - Check whether given feature is supported or not a= nd * store supported IOCTL/QUERY ID mask @@ -186,7 +203,6 @@ int zynqmp_pm_feature(const u32 api_id) { int ret; u32 ret_payload[PAYLOAD_ARG_CNT]; - u64 smc_arg[2]; struct pm_api_feature_data *feature_data; =20 if (!feature_check_enabled) @@ -205,14 +221,7 @@ int zynqmp_pm_feature(const u32 api_id) return -ENOMEM; =20 feature_data->pm_api_id =3D api_id; - smc_arg[0] =3D PM_SIP_SVC | PM_FEATURE_CHECK; - smc_arg[1] =3D api_id; - - ret =3D do_fw_call(smc_arg[0], smc_arg[1], 0, ret_payload); - if (ret) - ret =3D -EOPNOTSUPP; - else - ret =3D ret_payload[1]; + ret =3D do_feature_check_call(api_id, ret_payload); =20 feature_data->feature_status =3D ret; hash_add(pm_api_features_map, &feature_data->hentry, api_id); --=20 2.7.4 From nobody Fri Jun 19 07:17:14 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04378C433F5 for ; Wed, 6 Apr 2022 13:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233598AbiDFNqd (ORCPT ); Wed, 6 Apr 2022 09:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233761AbiDFNpv (ORCPT ); Wed, 6 Apr 2022 09:45:51 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2061.outbound.protection.outlook.com [40.107.101.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33D5E4929DE for ; Wed, 6 Apr 2022 03:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MTFyj10kXNa7dEixZIVdCTicMC9sc+b/2PeLkjR7wTLmmsZYptZu82aXQrz6y6BQCA0535NQwNztgo/qv+G5RdLdm0+K0ilQpjzo/+fN22FNVKCB33nT8Ckj5z2Q2GfRxITb4qHdErWg0cX9UE5E+68mENg9Wy7cXlNLXwM4pGTvKgA1ldEic+q768tAHuPftnPsCoQcmV16qrS+MiVrPxsgjwjS+CfC3Ot4+k2eSefoC1Y0MNNmV/T7u67ZVaUWsPJaxRbGYu4brBfiPZUt4GN+6Uha7edydvIKj7XTW7B2/H6eeKPei2nUonGry+r/iE58WkQntR89RtY706MBNg== 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=8Kb4qgkPNYfnJXYITzcIgPlcdEHsRWEqrpEcR8+j3dc=; b=eo3aF8t6vCi53Vjw+lkYJrIoT/SbFsQ02aEsAYYCBZSAyQtVN3nCHHujW6MxxGJOP/AcHiST7DQiDam4VdUxt8pITy7YaHkoE8RG8XLPdouhhlsQ5unT5146/xqlbWOr5kn5OeRG13dRE1vD4n381yMVgiOuqDM3ZItpw09xla0OkjMofYrB95MXOHRJxZZloTX1gzRs3TDxHdJyxEJvJN8PNUOQwiz0NVhHFQnzVBYQbsIXvdHRpAS1k56hsTGyUhPlxXgC47ZdRqXrZN5OX4GzSgr1oYnGWPGXDTn76NDUJf+ujqeBuymstXvR4dCcG1Zc6aubX61XTXSVkClUfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8Kb4qgkPNYfnJXYITzcIgPlcdEHsRWEqrpEcR8+j3dc=; b=FUaBosFC18cL6scVQHWP7xz30Oq4fKCX8mwi7tEOwNEYtw0KEa7hTDSdZyI30DOc16YNHnufO92L9Bdv8FVEv0RYpaxnO55qSFOZ3vSbt50lcx49N9qJYWmKEzRqXXl5Ju8qLC2jGicy8PXTDN/Vec8AEgOtXKj8MixaJBXaKGw= Received: from DS7PR03CA0102.namprd03.prod.outlook.com (2603:10b6:5:3b7::17) by DM6PR02MB6155.namprd02.prod.outlook.com (2603:10b6:5:1fb::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Wed, 6 Apr 2022 10:55:39 +0000 Received: from DM3NAM02FT019.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::1b) by DS7PR03CA0102.outlook.office365.com (2603:10b6:5:3b7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31 via Frontend Transport; Wed, 6 Apr 2022 10:55:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT019.mail.protection.outlook.com (10.13.4.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5144.21 via Frontend Transport; Wed, 6 Apr 2022 10:55:38 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 6 Apr 2022 03:55:33 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 6 Apr 2022 03:55:33 -0700 Envelope-to: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, corbet@lwn.net, linux-arm-kernel@lists.infradead.org, arnd@arndb.de Received: from [172.19.2.243] (port=36060 helo=xsjwillw50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nc3K1-0007fI-Hf; Wed, 06 Apr 2022 03:55:33 -0700 From: Ronak Jain To: , CC: , , , , , , Ronak Jain Subject: [PATCH 3/4] firmware: xilinx: always check API version for IOCTL/QUERY Date: Wed, 6 Apr 2022 03:55:25 -0700 Message-ID: <1649242526-17493-4-git-send-email-ronak.jain@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> References: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 862daafb-8489-4cf1-b277-08da17bbfc9c X-MS-TrafficTypeDiagnostic: DM6PR02MB6155:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bTG/kox1+vX69OfpQakPeXuj03j7WLlFd6Z2AZ+fBITC1VJQ7Tu8W2yy5Ic6aHkFRq4yV3RCb7idokDTi1MC0GnpNPsXEqWCQbptMjm6fWOf/yDsLIRIG+rQOnfboN/cYLr9wNJBQG1F+MUQL3YjBvUXnGhGLZBppFwKrKbgUVVEltPwZH5aRYNP+6xMdZ02lHs8C6eLsX0G7eZDt6Axg9asVIT+1EOVpe68v0cB7jIgVzIWvS2h81fsg4/ngzuCmK/9Pg7tsTh26z3hNHqDX8sANcca855V9ymEuVzJLK/p7gE2y+4A67rm6WSVLlDYXTLZW8gAh2OSr9Nc8Ksxcr5yFkdqkWSJLJE8oqDFy+fHAS7mqa6nwSGJRo2cTQBArB39/ddcULhtLQ+BVtURFnQsH9SuUUQitO94WGGyCIzZZBKASHt0xQHLnchYcubYsCBmMP8NSX4odqwfoHASDaM2kH6JA+iARE96kmc/OzJiq0blU7xkLTIYPIFpi0Ct1UZTVMcon+N/PdQRRaYju7sz1O+Pe2iOZVpGsDosfh9pnakx24VTbw2MpmgLV0HDg7ftZaMthRO78EjKjNgrJLH8Byu9VBSbaDAGDrMD9vYLq+JqPUhPTKPD7nE3uCjSgucu6qXdT2yq+UwEzgkS8vAUhnzK4f9MLcr/1hbnuOpPrWXuypE+df0OCWr9VnFXocXaR10L97V8bCPgtVm+qw== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8936002)(26005)(9786002)(186003)(36860700001)(316002)(336012)(54906003)(83380400001)(107886003)(36756003)(44832011)(2906002)(426003)(6666004)(70586007)(8676002)(5660300002)(7636003)(82310400005)(47076005)(4326008)(70206006)(508600001)(110136005)(7696005)(356005)(2616005)(40460700003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2022 10:55:38.9860 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 862daafb-8489-4cf1-b277-08da17bbfc9c X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT019.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6155 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, we are not checking feature check version for PM APIs as the support may or may not there in the firmware. To check the whether the feature check API is supported or not in the firmware, allow checking for its own version. Signed-off-by: Ronak Jain Acked-by: Michal Simek --- drivers/firmware/xilinx/zynqmp.c | 39 ++++++++++++++++++++++++------------= --- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zyn= qmp.c index d27a3b20227b..6ee94f31ac98 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -175,7 +175,7 @@ static noinline int do_fw_call_hvc(u64 arg0, u64 arg1, = u64 arg2, return zynqmp_pm_ret_code((enum pm_ret_status)res.a0); } =20 -static int do_feature_check_call(const u32 api_id, u32 *ret_payload) +static int __do_feature_check_call(const u32 api_id, u32 *ret_payload) { int ret; u64 smc_arg[2]; @@ -192,22 +192,12 @@ static int do_feature_check_call(const u32 api_id, u3= 2 *ret_payload) return ret; } =20 -/** - * zynqmp_pm_feature() - Check whether given feature is supported or not a= nd - * store supported IOCTL/QUERY ID mask - * @api_id: API ID to check - * - * Return: Returns status, either success or error+reason - */ -int zynqmp_pm_feature(const u32 api_id) +static int do_feature_check_call(const u32 api_id) { int ret; u32 ret_payload[PAYLOAD_ARG_CNT]; struct pm_api_feature_data *feature_data; =20 - if (!feature_check_enabled) - return 0; - /* Check for existing entry in hash table for given api */ hash_for_each_possible(pm_api_features_map, feature_data, hentry, api_id) { @@ -221,7 +211,7 @@ int zynqmp_pm_feature(const u32 api_id) return -ENOMEM; =20 feature_data->pm_api_id =3D api_id; - ret =3D do_feature_check_call(api_id, ret_payload); + ret =3D __do_feature_check_call(api_id, ret_payload); =20 feature_data->feature_status =3D ret; hash_add(pm_api_features_map, &feature_data->hentry, api_id); @@ -238,6 +228,25 @@ int zynqmp_pm_feature(const u32 api_id) EXPORT_SYMBOL_GPL(zynqmp_pm_feature); =20 /** + * zynqmp_pm_feature() - Check whether given feature is supported or not a= nd + * store supported IOCTL/QUERY ID mask + * @api_id: API ID to check + * + * Return: Returns status, either success or error+reason + */ +int zynqmp_pm_feature(const u32 api_id) +{ + int ret; + + if (!feature_check_enabled) + return 0; + + ret =3D do_feature_check_call(api_id); + + return ret; +} + +/** * zynqmp_pm_is_function_supported() - Check whether given IOCTL/QUERY fun= ction * is supported or not * @api_id: PM_IOCTL or PM_QUERY_DATA @@ -255,7 +264,7 @@ int zynqmp_pm_is_function_supported(const u32 api_id, c= onst u32 id) return -EINVAL; =20 /* Check feature check API version */ - ret =3D zynqmp_pm_feature(PM_FEATURE_CHECK); + ret =3D do_feature_check_call(PM_FEATURE_CHECK); if (ret < 0) return ret; =20 @@ -265,7 +274,7 @@ int zynqmp_pm_is_function_supported(const u32 api_id, c= onst u32 id) * Call feature check for IOCTL/QUERY API to get IOCTL ID or * QUERY ID feature status. */ - ret =3D zynqmp_pm_feature(api_id); + ret =3D do_feature_check_call(api_id); if (ret < 0) return ret; =20 --=20 2.7.4 From nobody Fri Jun 19 07:17:14 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F249CC433EF for ; Wed, 6 Apr 2022 14:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234837AbiDFOdq (ORCPT ); Wed, 6 Apr 2022 10:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234956AbiDFOdX (ORCPT ); Wed, 6 Apr 2022 10:33:23 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCF4A4D2757 for ; Wed, 6 Apr 2022 03:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vz10Dy+89MLxg18JfYmzCtx6Kz1MXMYGcBdcILuzAkfk6rwS8ZJOssbnDSHzMdSLhkhcnyRr+SP2zYaczKUq4/4dpFYxcXIKiBB5WoH8yX5Z9hnO8SPSbxtZpSgln2Rf+EI+M/RGDr/g7YCGrz95+o1PBphrb60mXKZ6blQT12OLH6agfmULyUgH86dnpm23/vugkdQLj246Bub7vZoVLSCgsaO0oK+hOXGpv4nV/nIMqr6ol+xnRwGHwuhoiQNMppK99TJnge30R8le20GhgkdFRC6ZvjM+3NxrXCFNdV9oGwt6g3E+4PFiHlUlEXDCvLj3nRbvl+++lR3RNxIyyA== 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=rFVW/PsGy90COQ1+V+xVBCjd5AF8+iTJMoukAU8I5EE=; b=fEpzJzS2QwmlVGV6Aijao0R582D8ww65ermCUxQ2xYnElY1q9JUNcPuQymW6mkfu1IkcspH54cCIXPfKZgIlcAi6CpM53TYF6nmMgZug05tqBFuGJc8yRSnQ1JyoVYgG+euannjxmVWHB64NWf7FX1qr8H4mCn7FcJ0W6SS9v7zPz0RWXuMANIzYLBvtrDsUucQvwqnT7vtigDWh4kQhj2DL2oZvn8WyumiArmBOldxtQbXaqCIF6wAbJ/72tk3b9yLx51RxoOGqCOwoPgAqM5Av6a6A9AHsY8a49kP4WkRhcs+8cwNtrEg1efSbinPMBgK84CHP5CG9EOTeyUXR0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rFVW/PsGy90COQ1+V+xVBCjd5AF8+iTJMoukAU8I5EE=; b=hEHPrUi8TLUEzSNiDX4zgjvP/lFnq8sGgiNpBX51XJZCl+IKAlgSkFR+seN04SWVDbih/FuptvqajFmqTrmJ9biArUQRA1nBXvO9nb3sNxYfiB3goyp1e8yx4k0DvAVJJXAuSSUnGi7UHaQ7J+79cY3RDPmhgHpQ8VGdUA1ayDs= Received: from SA9PR03CA0027.namprd03.prod.outlook.com (2603:10b6:806:20::32) by SN4PR0201MB3566.namprd02.prod.outlook.com (2603:10b6:803:51::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Wed, 6 Apr 2022 10:55:59 +0000 Received: from SN1NAM02FT0036.eop-nam02.prod.protection.outlook.com (2603:10b6:806:20:cafe::bc) by SA9PR03CA0027.outlook.office365.com (2603:10b6:806:20::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31 via Frontend Transport; Wed, 6 Apr 2022 10:55:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0036.mail.protection.outlook.com (10.97.4.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5144.21 via Frontend Transport; Wed, 6 Apr 2022 10:55:59 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 6 Apr 2022 03:55:33 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 6 Apr 2022 03:55:33 -0700 Envelope-to: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, corbet@lwn.net, linux-arm-kernel@lists.infradead.org, arnd@arndb.de Received: from [172.19.2.243] (port=36060 helo=xsjwillw50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nc3K1-0007fI-Ic; Wed, 06 Apr 2022 03:55:33 -0700 From: Ronak Jain To: , CC: , , , , , , Ronak Jain Subject: [PATCH 4/4] firmware: xilinx: enable feature check for ZynqMP Date: Wed, 6 Apr 2022 03:55:26 -0700 Message-ID: <1649242526-17493-5-git-send-email-ronak.jain@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> References: <1649242526-17493-1-git-send-email-ronak.jain@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0165b6cd-4197-4a5f-bd4c-08da17bc08cc X-MS-TrafficTypeDiagnostic: SN4PR0201MB3566:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5pff+5lqmCjoYU+vqoEtY0AY0/L+99X2iNLnyfhHnq/ZIhRW8abK51ZnN+pzjo0Nv53Ihvc2AeTXeiwIeSr0fdXnBv68o4hQT1VkixyqplGc4WD0tmtCL0TuZRXKcq9/EzDcy52vXvbgjU7DvZu+xlNd03134lJVYCN9c+wNYThsRLoiW5B0pkkq/VKZfm4woCqAfVWGreNEsZlpjlP925sHuKl4C5tatD85mJyBZ8AZGySHb5WOOCHgI0HZTFgYra6wvy9qlRUiFZQgMayWFrDlbnfWLw3rJiu8odllWt8X5PZCFa5PBxvWqaLaB5TuVRc7vuyl8IQKa6NHgxqw/4HDZhExMJX8NEmCBgV5x3qh+GwSO/ah/OstN5ce0nVIcibC8aK0NDWL/O8F73TNhlsdjBz9RC+SOnq0xaYhSrR7ovZESaBR5HR3CckzyN+/b6XUfgI/gtQy5KMuk42u4SmwEYTl1mXM4QW+ZrjK6z1ngHCohXGeMUL54qdkmtgWFQlAKheHORKWFjGZJR4UBBbSB9CC94Vj90u6AGWvlAB6x+lwInGh3pUbP+O/+dVEpoNxo/1qXZA0vh0RJiJ6VFnvf3HAr6ZchVhlppTYolFEmbNWcas/Y/f2ewe1+saXsRfh3QIzqGYHi/Yb8r+HqP0mw/ysXKxYNgV57gqwMd1VBdbvwif2rXI+26KQjSXIbcFGfzJJp+up2MYfIkqUJg== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(186003)(54906003)(47076005)(316002)(36756003)(7696005)(40460700003)(2616005)(508600001)(110136005)(336012)(26005)(107886003)(4326008)(2906002)(8936002)(356005)(70206006)(82310400005)(8676002)(70586007)(44832011)(36860700001)(9786002)(6666004)(426003)(5660300002)(7636003)(83380400001)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2022 10:55:59.4491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0165b6cd-4197-4a5f-bd4c-08da17bc08cc X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0036.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0201MB3566 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable the feature check if the PM_FEATURE_CHECK API returns success with the supported version for the ZynqMP. Currently, it is enabled for Versal only. Move get_set_conduit_method() at the beginning as the Linux is requesting to TF-A for the PM_FEATURE_CHECK API version for which the interface should be enabled with TF-A. Signed-off-by: Ronak Jain Acked-by: Michal Simek --- drivers/firmware/xilinx/zynqmp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zyn= qmp.c index 6ee94f31ac98..7977a494a651 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -1662,6 +1662,10 @@ static int zynqmp_firmware_probe(struct platform_dev= ice *pdev) struct zynqmp_devinfo *devinfo; int ret; =20 + ret =3D get_set_conduit_method(dev->of_node); + if (ret) + return ret; + np =3D of_find_compatible_node(NULL, NULL, "xlnx,zynqmp"); if (!np) { np =3D of_find_compatible_node(NULL, NULL, "xlnx,versal"); @@ -1670,11 +1674,14 @@ static int zynqmp_firmware_probe(struct platform_de= vice *pdev) =20 feature_check_enabled =3D true; } - of_node_put(np); =20 - ret =3D get_set_conduit_method(dev->of_node); - if (ret) - return ret; + if (!feature_check_enabled) { + ret =3D do_feature_check_call(PM_FEATURE_CHECK); + if (ret >=3D 0) + feature_check_enabled =3D true; + } + + of_node_put(np); =20 devinfo =3D devm_kzalloc(dev, sizeof(*devinfo), GFP_KERNEL); if (!devinfo) --=20 2.7.4