Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
	Felix Kuehling <felix.kuehling@amd.com>
Cc: "Bjorn Helgaas" <helgaas@kernel.org>,
	"Baolu Lu" <baolu.lu@linux.intel.com>,
	"Huang, Shimmer" <Shimmer.Huang@amd.com>,
	"Liu, Aaron" <Aaron.Liu@amd.com>,
	"Joerg Roedel" <jroedel@suse.de>,
	"regressions@lists.linux.dev" <regressions@lists.linux.dev>,
	"Thorsten Leemhuis" <regressions@leemhuis.info>,
	"Linux PCI" <linux-pci@vger.kernel.org>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	amd-gfx@lists.freedesktop.org,
	LKML <linux-kernel@vger.kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"Matt Fagnani" <matt.fagnani@bell.net>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [regression, bisected, pci/iommu] Bug 216865 - Black screen when amdgpu started during 6.2-rc1 boot with AMD IOMMU enabled
Date: Thu, 16 Feb 2023 11:07:06 +0530	[thread overview]
Message-ID: <9103b537-62c3-d6b2-b576-713406635455@amd.com> (raw)
In-Reply-To: <Y+18UuVTKIshk8EF@nvidia.com>

Hi Jason,


On 2/16/2023 6:14 AM, Jason Gunthorpe wrote:
> On Wed, Feb 15, 2023 at 07:35:45PM -0500, Felix Kuehling wrote:
>>
>> If I understand this correctly, the HW or the BIOS is doing something wrong
>> about reporting ACS. I don't know what the GPU driver can do other than add
>> some quirk to stop using AMD IOMMUv2 on this HW/BIOS.
> 
> How about this:
> 
> diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c
> index 864e4ffb6aa94e..cc027ce9a6e86f 100644
> --- a/drivers/iommu/amd/iommu_v2.c
> +++ b/drivers/iommu/amd/iommu_v2.c
> @@ -732,6 +732,7 @@ EXPORT_SYMBOL(amd_iommu_unbind_pasid);
>  
>  int amd_iommu_init_device(struct pci_dev *pdev, int pasids)
>  {
> +	struct iommu_dev_data *dev_data = dev_iommu_priv_get(&pdev->dev);
>  	struct device_state *dev_state;
>  	struct iommu_group *group;
>  	unsigned long flags;
> @@ -740,6 +741,9 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids)
>  
>  	might_sleep();
>  
> +	if (!dev_data->ats.enabled)
> +		return -EINVAL;
> +

Thanks for the proposed fix. But aactually this will not solve the issue because
current flow is :
  - in this function it tries to allocate new domain
  - Calls iommu_attach_group() which will call attach_device. In that path
    it will try to enable ATS/PASID and hitting error.

As I mentioned in other reply I think even current code returns error from
amd_iommu_init_device() to GPU. But the issue is, in __iommu_attach_group() path
it detached device from current domain, failed to attach to new domain and
returned error. We didn't put the device back to old domain thats causing the
issue. Below series should fix this issue.

https://lore.kernel.org/linux-iommu/20230215052642.6016-1-vasant.hegde@amd.com/

-Vasant


  reply	other threads:[~2023-02-16  5:37 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  8:18 [regression, bisected, pci/iommu] Bug 216865 - Black screen when amdgpu started during 6.2-rc1 boot with AMD IOMMU enabled Thorsten Leemhuis
2023-01-03 10:30 ` Joerg Roedel
2023-01-03 19:06 ` Matt Fagnani
     [not found] ` <5aa0e698-f715-0481-36e5-46505024ebc1@bell.net>
2023-01-04  6:54   ` Baolu Lu
2023-01-04 15:50     ` Vasant Hegde
2023-01-05  1:09       ` Matt Fagnani
2023-01-05 10:27         ` Vasant Hegde
2023-01-05 10:37           ` Baolu Lu
2023-01-05 10:46             ` Vasant Hegde
2023-01-05 14:46               ` Deucher, Alexander
2023-01-05 15:27                 ` Felix Kuehling
2023-01-06  5:48                   ` Baolu Lu
2023-02-15 15:39                     ` Bjorn Helgaas
2023-02-16  0:35                       ` Felix Kuehling
2023-02-16  0:44                         ` Jason Gunthorpe
2023-02-16  5:37                           ` Vasant Hegde [this message]
2023-02-16 14:55                             ` Felix Kuehling
2023-02-16 14:53                           ` Felix Kuehling
2023-02-16  5:25                         ` Vasant Hegde
     [not found]                           ` <40b2da4a-a205-3cf2-0c78-c94c28b2d3f4@bell.net>
2023-02-16 19:59                             ` Felix Kuehling
2023-02-17  5:36                               ` Vasant Hegde
2023-02-17  5:23                             ` Vasant Hegde
2023-01-05 19:51           ` Matt Fagnani
2023-01-06 14:14           ` Jason Gunthorpe
2023-01-07  2:44             ` Baolu Lu
2023-01-09 13:43               ` Jason Gunthorpe
2023-01-10  5:28                 ` Baolu Lu
2023-01-10  5:48             ` Baolu Lu
2023-01-10  8:06               ` Matt Fagnani
2023-01-10 13:25               ` Jason Gunthorpe
2023-01-10 13:45                 ` Christian König
2023-01-10 13:51                   ` Jason Gunthorpe
2023-01-10 13:56                     ` Christian König
2023-01-10 20:51                       ` Matt Fagnani
2023-01-11  8:35                         ` Christian König
2023-01-10 15:05                   ` Felix Kuehling
2023-01-10 15:19                     ` Jason Gunthorpe
2023-01-10 15:21                       ` Felix Kuehling
2023-01-11  3:16                 ` Baolu Lu
2023-01-11 13:08                   ` Jason Gunthorpe
     [not found]           ` <ff26929d-9fb0-3c85-2594-dc2937c1ba9a@bell.net>
2023-01-10 16:08             ` Vasant Hegde
2023-01-10 16:12               ` Vasant Hegde

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=9103b537-62c3-d6b2-b576-713406635455@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=Aaron.Liu@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Shimmer.Huang@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=christian.koenig@amd.com \
    --cc=felix.kuehling@amd.com \
    --cc=helgaas@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matt.fagnani@bell.net \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    /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