AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Victor Zhao <Victor.Zhao@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: skip pci_restore_state under sriov during device init
Date: Thu, 24 Oct 2024 12:19:01 +0530	[thread overview]
Message-ID: <cc4c4f4c-1b8b-4f0e-ac8d-6cf3af338bd8@amd.com> (raw)
In-Reply-To: <20241024054920.3011641-1-Victor.Zhao@amd.com>



On 10/24/2024 11:19 AM, Victor Zhao wrote:
> during device init, under sriov, pci_restore_state happens after
> fullaccess released, and it can have race condition with mmio protection
> enable from host side.
> 
> Since msix was toggled during pci_restore_state, if mmio protection
> happens during this time, guest side msix will not be properly
> programmed and leading to missing interrupts.
> 
> So skip pci_restore_state during device init.
> 
> Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 6c0ff1c2ae4c..52803cd91ef5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4524,7 +4524,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>  		dev_err(adev->dev, "amdgpu_pmu_init failed\n");
>  
>  	/* Have stored pci confspace at hand for restore in sudden PCI error */
> -	if (amdgpu_device_cache_pci_state(adev->pdev))
> +	if (!amdgpu_sriov_vf(adev) && amdgpu_device_cache_pci_state(adev->pdev))

This also prevents caching the state. If the intention is that way, put
the check inside amdgpu_device_cache_pci_state to make it explicit that
VFs avoid caching config space.

Thanks,
Lijo

>  		pci_restore_state(pdev);
>  
>  	/* if we have > 1 VGA cards, then disable the amdgpu VGA resources */

      reply	other threads:[~2024-10-24  6:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24  5:49 [PATCH] drm/amdgpu: skip pci_restore_state under sriov during device init Victor Zhao
2024-10-24  6:49 ` Lazar, Lijo [this message]

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=cc4c4f4c-1b8b-4f0e-ac8d-6cf3af338bd8@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=Victor.Zhao@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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