[PATCH] iommu/amd: Enable PCIe ACS only if AMD IOMMU is on

Jinhui Guo posted 1 patch 4 months, 1 week ago
drivers/iommu/amd/init.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH] iommu/amd: Enable PCIe ACS only if AMD IOMMU is on
Posted by Jinhui Guo 4 months, 1 week ago
To preserve PCIe performance, ACS is enabled only when
AMD IOMMU is not disabled.

Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
---
 drivers/iommu/amd/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index ba9e582a8bbe..6e9eab365123 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -3212,8 +3212,10 @@ static bool __init detect_ivrs(void)
 	}
 
 out:
-	/* Make sure ACS will be enabled during PCI probe */
-	pci_request_acs();
+	if (!amd_iommu_disabled || amd_iommu_force_enable) {
+		/* Make sure ACS will be enabled during PCI probe */
+		pci_request_acs();
+	}
 
 	return true;
 }
-- 
2.20.1
Re: [PATCH] iommu/amd: Enable PCIe ACS only if AMD IOMMU is on
Posted by Suthikulpanit, Suravee 4 months ago

On 9/28/2025 2:52 AM, Jinhui Guo wrote:
> To preserve PCIe performance, ACS is enabled only when
> AMD IOMMU is not disabled.
> 
> Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
> ---
>   drivers/iommu/amd/init.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> index ba9e582a8bbe..6e9eab365123 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -3212,8 +3212,10 @@ static bool __init detect_ivrs(void)
>   	}
>   
>   out:
> -	/* Make sure ACS will be enabled during PCI probe */
> -	pci_request_acs();
> +	if (!amd_iommu_disabled || amd_iommu_force_enable) {

You should not need to check the amd_iommu_force_enable since it is used 
only to skip a workaround logic within the same function. You can simply 
just do

	if (!amd_iommu_disabled)
		/* Make sure ACS will be enabled during PCI probe */
		pci_request_acs();

With that

Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

Thanks,
Suravee

> +		/* Make sure ACS will be enabled during PCI probe */
> +		pci_request_acs();
> +	}
>   
>   	return true;
>   }