This is a note to let you know that I've just added the patch titled iommu/amd: Fix error handling for pdev_pri_ats_enable() to the 6.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iommu-amd-fix-error-handling-for-pdev_pri_ats_enable.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 080920e52148b4fbbf9360d5345fdcd7846e4841 Mon Sep 17 00:00:00 2001 From: Vasant Hegde <vasant.hegde@xxxxxxx> Date: Wed, 11 Jan 2023 12:15:03 +0000 Subject: iommu/amd: Fix error handling for pdev_pri_ats_enable() From: Vasant Hegde <vasant.hegde@xxxxxxx> commit 080920e52148b4fbbf9360d5345fdcd7846e4841 upstream. Current code throws kernel warning if it fails to enable pasid/pri [1]. Do not call pci_disable_[pasid/pri] if pci_enable_[pasid/pri] failed. [1] https://lore.kernel.org/linux-iommu/15d0f9ff-2a56-b3e9-5b45-e6b23300ae3b@xxxxxxxxxxxxx/ Reported-by: Matt Fagnani <matt.fagnani@xxxxxxxx> Signed-off-by: Vasant Hegde <vasant.hegde@xxxxxxx> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> Link: https://lore.kernel.org/r/20230111121503.5931-1-vasant.hegde@xxxxxxx Signed-off-by: Joerg Roedel <jroedel@xxxxxxx> Cc: "Limonciello, Mario" <Mario.Limonciello@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/iommu/amd/iommu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -1702,27 +1702,29 @@ static int pdev_pri_ats_enable(struct pc /* Only allow access to user-accessible pages */ ret = pci_enable_pasid(pdev, 0); if (ret) - goto out_err; + return ret; /* First reset the PRI state of the device */ ret = pci_reset_pri(pdev); if (ret) - goto out_err; + goto out_err_pasid; /* Enable PRI */ /* FIXME: Hardcode number of outstanding requests for now */ ret = pci_enable_pri(pdev, 32); if (ret) - goto out_err; + goto out_err_pasid; ret = pci_enable_ats(pdev, PAGE_SHIFT); if (ret) - goto out_err; + goto out_err_pri; return 0; -out_err: +out_err_pri: pci_disable_pri(pdev); + +out_err_pasid: pci_disable_pasid(pdev); return ret; Patches currently in stable-queue which might be from vasant.hegde@xxxxxxx are queue-6.2/iommu-attach-device-group-to-old-domain-in-error-path.patch queue-6.2/iommu-amd-improve-page-fault-error-reporting.patch queue-6.2/iommu-amd-fix-error-handling-for-pdev_pri_ats_enable.patch queue-6.2/iommu-amd-skip-attach-device-domain-is-same-as-new-domain.patch