From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 713895CDF1 for ; Fri, 24 Jul 2026 06:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784874675; cv=none; b=GmUXQK+Rxbz8n/Z0p1cfIm8a06jl7/V09irmEZdktFpySRSt8dAeFL2IJk0vuW5i7nK3BBOeC3bgRtlnzzT1RbF+TxFm/WKocI3mInNn2MBCpx4IhrOHbushIGg1uY6062C3RPS3nT390VbaxKwHJIOxEWuZk+iy+bFL3NFi+6I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784874675; c=relaxed/simple; bh=sRfoBdblXd+RtuBe1x/0/mPu5HhqCGK1+wikgXJqgtw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iFNMCb7Y3JeasMt9GW1KVoWVBugGuwQEkK1Td9pAMDDOFU+3Idryq23z/46wNB3OpL4R60oYAGeIKTq76B1RolVdwbnnAo8Sg0t88d093g2PIFfd18ou4zxhFrzFvasdtjh6bzgUQkGX+Ky3Tc0J0Uamu6RjFOpVBf5SmKzme4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=IGel+OV0; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="IGel+OV0" Received: from [10.94.177.11] (unknown [4.194.122.136]) by linux.microsoft.com (Postfix) with ESMTPSA id AEFCB20B7167; Thu, 23 Jul 2026 23:30:58 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AEFCB20B7167 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1784874660; bh=/Jh2uux1jBxLqToUKJECqMG2sK7Obcmqmg4feylgaU8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=IGel+OV0IHKY85p6P92wZjIKwhcuWVJFzLod6i5oBZEO+Noaj8LnAgTyG3GUMnXkk qpJwNDUNJzkUAmBz/eAPshQRfgwUSMxwGVHbQSX1dsAtXl6hE0m7MNQXqqytsXU9yp B5zC3+oiM2iimvE6hAqslOZojIm5kP/ZRyZU9ERI= Message-ID: Date: Fri, 24 Jul 2026 12:01:10 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/4] firmware: xilinx: Use TF-A feature check for TF-A specific APIs To: Jay Buddhabhatti , michal.simek@amd.com, git@amd.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260723124841.2567827-1-jay.buddhabhatti@amd.com> <20260723124841.2567827-5-jay.buddhabhatti@amd.com> Content-Language: en-US From: Prasanna Kumar T S M In-Reply-To: <20260723124841.2567827-5-jay.buddhabhatti@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Jay, On 23-07-2026 18:18, Jay Buddhabhatti wrote: > Currently, TF-A-specific APIs are validated using the firmware > PM_FEATURE_CHECK API, even though TF-A provides a dedicated mechanism via > PM_API_FEATURES API. Ideally it should use the TF-A feature check > (PM_API_FEATURES) for TF-A specific APIs. Update the feature check logic > for TF-A specific API calls to ensure it is validated using > PM_API_FEATURES. If this check fails, fall back to the legacy > PM_FEATURE_CHECK to support backward compatibility. > > When do_fw_call() fails, propagate the errno from zynqmp_pm_ret_code() > instead of always returning -EOPNOTSUPP. This applies to every module ID, > not only TF-A, because the rewrite sat in the common failure path. > Existing callers only test ret < 0 and are unchanged. > > Signed-off-by: Jay Buddhabhatti > --- > drivers/firmware/xilinx/zynqmp.c | 31 +++++++++++++++++-------------- > 1 file changed, 17 insertions(+), 14 deletions(-) > > diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c > index fc7212f554ee..0b6c20a1d8be 100644 > --- a/drivers/firmware/xilinx/zynqmp.c > +++ b/drivers/firmware/xilinx/zynqmp.c > @@ -224,34 +224,37 @@ static int __do_feature_check_call(const u32 api_id, u32 *ret_payload) > module_id = FIELD_GET(MODULE_ID_MASK, api_id); > > /* > - * Feature check of APIs belonging to PM, XSEM, and TF-A are handled by calling > + * Feature check of APIs belonging to PM and XSEM are handled by calling > * PM_FEATURE_CHECK API. For other modules, call PM_API_FEATURES API. > */ > - if (module_id == PM_MODULE_ID || module_id == XSEM_MODULE_ID || module_id == TF_A_MODULE_ID) > + if (module_id == PM_MODULE_ID || module_id == XSEM_MODULE_ID) > feature_check_api_id = PM_FEATURE_CHECK; > else > feature_check_api_id = PM_API_FEATURES; > > - /* > - * Feature check of TF-A APIs is done in the TF-A layer and it expects for > - * MODULE_ID_MASK bits of SMC's arg[0] to be the same as PM_MODULE_ID. > - */ > - if (module_id == TF_A_MODULE_ID) { > - module_id = PM_MODULE_ID; > + if (module_id == TF_A_MODULE_ID) > smc_arg[1] = api_id; > - } else { > + else > smc_arg[1] = (api_id & API_ID_MASK); > - } > > smc_arg[0] = PM_SIP_SVC | FIELD_PREP(MODULE_ID_MASK, module_id) | feature_check_api_id; > > ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]); > + > + /* > + * For TF-A APIs, if the feature check with PM_API_FEATURES fails, > + * retry with the legacy PM_FEATURE_CHECK for backward compatibility. > + */ > + if (module_id == TF_A_MODULE_ID && ret) { > + smc_arg[0] = PM_SIP_SVC | FIELD_PREP(MODULE_ID_MASK, PM_MODULE_ID) | > + PM_FEATURE_CHECK; > + ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]); > + } This looks like a general improvement unrelated to the other patches in this series. I think this should go as a separate patch (not as a part of this series). > + > if (ret) > - ret = -EOPNOTSUPP; > - else > - ret = ret_payload[1]; > + return ret; > > - return ret; > + return ret_payload[1]; > } > > static int do_feature_check_call(const u32 api_id) The return value change is separate improvement unrelated to the series or to the PM_API_FEATURES API usage. I think this change can be carved out to a separate patch. Except for the above nits, code looks good to me. Reviewed-by: Prasanna Kumar T S M Regards, Prasanna Kumar