Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	intel-xe@lists.freedesktop.org
Cc: "Michal Wajdeczko" <michal.wajdeczko@intel.com>,
	"Piotr Piórkowski" <piotr.piorkowski@intel.com>
Subject: Re: [PATCH 1/2] drm/xe/pf: Disable VFs on remove
Date: Thu, 27 Jun 2024 11:24:53 +0300	[thread overview]
Message-ID: <87frsydc8a.fsf@intel.com> (raw)
In-Reply-To: <20240626111827.1389-2-michal.wajdeczko@intel.com>

On Wed, 26 Jun 2024, Michal Wajdeczko <michal.wajdeczko@intel.com> wrote:
> We shouldn't leave VFs enabled when unloading the PF driver.
> Otherwise we will get a message like:
>
>  [ ] xe 0000:4d:00.0: driver left SR-IOV enabled after remove
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_pci.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index ebff5ea79b1d..4b91a9878f41 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -749,6 +749,11 @@ static void xe_pci_remove(struct pci_dev *pdev)
>  	if (!xe) /* driver load aborted, nothing to cleanup */
>  		return;
>  
> +#ifdef CONFIG_PCI_IOV
> +	if (IS_SRIOV_PF(xe))
> +		xe_pci_sriov_configure(pdev, 0);
> +#endif
> +

Please don't add inline #ifdefs.

IS_SRIOV_PF() works for CONFIG_PCI_IOV=n. xe_pci_sriov_configure()
should also have a stub for CONFIG_PCI_IOV=n.

Alternatively, if you also added a dedicated function for disabling VF,
you could have a stub for that, and

#define xe_pci_sriov_configure NULL

for CONFIG_PCI_IOV=n, so you wouldn't have to have inline #ifdefs in
xe_pci_driver initialization either.


BR,
Jani.


>  	xe_device_remove(xe);
>  	xe_pm_runtime_fini(xe);
>  	pci_set_drvdata(pdev, NULL);

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2024-06-27  8:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 11:18 [PATCH 0/2] drm/xe/pf: Disable VFs on remove Michal Wajdeczko
2024-06-26 11:18 ` [PATCH 1/2] " Michal Wajdeczko
2024-06-26 14:13   ` Piotr Piórkowski
2024-06-27  8:24   ` Jani Nikula [this message]
2024-06-27 10:48     ` Michal Wajdeczko
2024-06-26 11:18 ` [PATCH 2/2] HAX: Try SR-IOV on ADLP/ATSM Michal Wajdeczko
2024-06-26 11:45 ` ✓ CI.Patch_applied: success for drm/xe/pf: Disable VFs on remove Patchwork
2024-06-26 11:46 ` ✓ CI.checkpatch: " Patchwork
2024-06-26 11:47 ` ✓ CI.KUnit: " Patchwork
2024-06-26 11:59 ` ✓ CI.Build: " Patchwork
2024-06-26 12:01 ` ✓ CI.Hooks: " Patchwork
2024-06-26 12:02 ` ✓ CI.checksparse: " Patchwork
2024-06-26 12:26 ` ✓ CI.BAT: " Patchwork
2024-06-26 17:10 ` ✗ CI.FULL: failure " Patchwork
2024-06-26 17:35   ` Michal Wajdeczko

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=87frsydc8a.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=piotr.piorkowski@intel.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