Linux IOMMU Development
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: iommu@lists.linux.dev, joro@8bytes.org
Cc: suravee.suthikulpanit@amd.com,
	Hamish McIntyre-Bhatty <kernel-bugzilla@regd.hamishmb.com>
Subject: Re: [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path
Date: Wed, 5 Feb 2025 15:23:12 +0530	[thread overview]
Message-ID: <5656bceb-645f-4063-a11e-89a0d1a634b4@amd.com> (raw)
In-Reply-To: <20250127094411.5931-1-vasant.hegde@amd.com>

Hi Joerg,

Ping. Since this is the Fix, can you please pick this for -rc ?

-Vasant

On 1/27/2025 3:14 PM, Vasant Hegde wrote:
> With recent kernel, AMDGPU failed to resume after suspend on certain laptop.
> 
> Sample log:
> -----------
> Nov 14 11:52:19 Thinkbook kernel: iommu ivhd0: AMD-Vi: Event logged [ILLEGAL_DEV_TABLE_ENTRY device=0000:06:00.0 pasid=0x00000 address=0x135300000 flags=0x0080]
> Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[0]: 7d90000000000003
> Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[1]: 0000100103fc0009
> Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[2]: 2000000117840013
> Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[3]: 0000000000000000
> 
> This is because in resume path, CNTRL[EPHEn] is not set. Fix this by
> setting CNTRL[EPHEn] to 1 in resume path if EFR[EPHSUP] is set.
> 
> Note
>   May be better approach is to save the control register in suspend path
>   and restore it in resume path instead of trying to set indivisual
>   bits. We will have separate patch for that.
> 
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219499
> Fixes: c4cb2311110 ("iommu/amd: Add support for enable/disable IOPF")
> Tested-by: Hamish McIntyre-Bhatty <kernel-bugzilla@regd.hamishmb.com>
> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
> ---
>  drivers/iommu/amd/amd_iommu_types.h | 1 +
>  drivers/iommu/amd/init.c            | 4 ++++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
> index 0bbda60d3cdc..23caea22f8dc 100644
> --- a/drivers/iommu/amd/amd_iommu_types.h
> +++ b/drivers/iommu/amd/amd_iommu_types.h
> @@ -175,6 +175,7 @@
>  #define CONTROL_GAM_EN		25
>  #define CONTROL_GALOG_EN	28
>  #define CONTROL_GAINT_EN	29
> +#define CONTROL_EPH_EN		45
>  #define CONTROL_XT_EN		50
>  #define CONTROL_INTCAPXT_EN	51
>  #define CONTROL_IRTCACHEDIS	59
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> index c5cd92edada0..438848b0682f 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -2653,6 +2653,10 @@ static void iommu_init_flags(struct amd_iommu *iommu)
>  
>  	/* Set IOTLB invalidation timeout to 1s */
>  	iommu_set_inv_tlb_timeout(iommu, CTRL_INV_TO_1S);
> +
> +	/* Enable Enhanced Peripheral Page Request Handling */
> +	if (check_feature(FEATURE_EPHSUP))
> +		iommu_feature_enable(iommu, CONTROL_EPH_EN);
>  }
>  
>  static void iommu_apply_resume_quirks(struct amd_iommu *iommu)


  reply	other threads:[~2025-02-05  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27  9:44 [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path Vasant Hegde
2025-02-05  9:53 ` Vasant Hegde [this message]
2025-02-10 13:51 ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5656bceb-645f-4063-a11e-89a0d1a634b4@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kernel-bugzilla@regd.hamishmb.com \
    --cc=suravee.suthikulpanit@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox