[1/2] platform/x86/amd/pmf: Add debugging message for missing policy data

Message ID 20240217012205.113614-2-mario.limonciello@amd.com
State New
Headers
Series AMD PMF Smart PC error handling cleanups |

Commit Message

Mario Limonciello Feb. 17, 2024, 1:22 a.m. UTC
  If a machine advertises Smart PC support but is missing policy data
show a debugging message to help clarify why Smart PC wasn't enabled.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/platform/x86/amd/pmf/tee-if.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Hans de Goede Feb. 18, 2024, 10:26 a.m. UTC | #1
Hi,

On 2/17/24 02:22, Mario Limonciello wrote:
> If a machine advertises Smart PC support but is missing policy data
> show a debugging message to help clarify why Smart PC wasn't enabled.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  drivers/platform/x86/amd/pmf/tee-if.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
> index 8b7e3f87702e..1359ab340f7c 100644
> --- a/drivers/platform/x86/amd/pmf/tee-if.c
> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
> @@ -252,8 +252,10 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
>  	cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET);
>  	length = readl(dev->policy_buf + POLICY_COOKIE_LEN);
>  
> -	if (cookie != POLICY_SIGN_COOKIE || !length)
> +	if (cookie != POLICY_SIGN_COOKIE || !length) {
> +		dev_dbg(dev->dev, "cookie doesn't match\n");
>  		return -EINVAL;
> +	}
>  
>  	/* Update the actual length */
>  	dev->policy_sz = length + 512;
  

Patch

diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
index 8b7e3f87702e..1359ab340f7c 100644
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+++ b/drivers/platform/x86/amd/pmf/tee-if.c
@@ -252,8 +252,10 @@  static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
 	cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET);
 	length = readl(dev->policy_buf + POLICY_COOKIE_LEN);
 
-	if (cookie != POLICY_SIGN_COOKIE || !length)
+	if (cookie != POLICY_SIGN_COOKIE || !length) {
+		dev_dbg(dev->dev, "cookie doesn't match\n");
 		return -EINVAL;
+	}
 
 	/* Update the actual length */
 	dev->policy_sz = length + 512;