From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/5] drm/xe/pf: Introduce mutex to protect VFs configurations
Date: Wed, 10 Apr 2024 17:54:26 +0200 [thread overview]
Message-ID: <20240410155426.6orhsa264jvyw74b@intel.com> (raw)
In-Reply-To: <20240410123125.1155-2-michal.wajdeczko@intel.com>
Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on śro [2024-kwi-10 14:31:21 +0200]:
> PF driver will maintain configurations and resources for every VF
> and this data could span multiple tiles and/or GTs. Prepare mutex
> to protect data that we will add in upcoming patches.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_sriov.c | 7 +++++++
> drivers/gpu/drm/xe/xe_sriov_pf.c | 15 +++++++++++++++
> drivers/gpu/drm/xe/xe_sriov_pf.h | 6 ++++++
> drivers/gpu/drm/xe/xe_sriov_types.h | 4 ++++
> 4 files changed, 32 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
> index d324f131e3da..1b40f5de9ef5 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_sriov.c
> @@ -94,6 +94,13 @@ int xe_sriov_init(struct xe_device *xe)
> if (!IS_SRIOV(xe))
> return 0;
>
> + if (IS_SRIOV_PF(xe)) {
> + int err = xe_sriov_pf_init_early(xe);
> +
> + if (err)
> + return err;
> + }
> +
> xe_assert(xe, !xe->sriov.wq);
> xe->sriov.wq = alloc_workqueue("xe-sriov-wq", 0, 0);
> if (!xe->sriov.wq)
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c
> index 030c2b69ecc4..0f721ae17b26 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.c
> @@ -3,6 +3,8 @@
> * Copyright © 2023-2024 Intel Corporation
> */
>
> +#include <drm/drm_managed.h>
> +
> #include "xe_assert.h"
> #include "xe_device.h"
> #include "xe_module.h"
> @@ -70,6 +72,19 @@ bool xe_sriov_pf_readiness(struct xe_device *xe)
> return true;
> }
>
> +/**
> + * xe_sriov_pf_init_early - Initialize SR-IOV PF specific data.
> + * @xe: the &xe_device to initialize
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_pf_init_early(struct xe_device *xe)
> +{
> + xe_assert(xe, IS_SRIOV_PF(xe));
> +
> + return drmm_mutex_init(&xe->drm, &xe->sriov.pf.master_lock);
> +}
> +
> /**
> * xe_sriov_pf_print_vfs_summary - Print SR-IOV PF information.
> * @xe: the &xe_device to print info from
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.h b/drivers/gpu/drm/xe/xe_sriov_pf.h
> index ebef2e01838a..d1220e70e1c0 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.h
> @@ -13,12 +13,18 @@ struct xe_device;
>
> #ifdef CONFIG_PCI_IOV
> bool xe_sriov_pf_readiness(struct xe_device *xe);
> +int xe_sriov_pf_init_early(struct xe_device *xe);
> void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p);
> #else
> static inline bool xe_sriov_pf_readiness(struct xe_device *xe)
> {
> return false;
> }
> +
> +static inline int xe_sriov_pf_init_early(struct xe_device *xe)
> +{
> + return 0;
> +}
> #endif
>
> #endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_types.h b/drivers/gpu/drm/xe/xe_sriov_types.h
> index fa583e8fa0c2..c7b7ad4af5c8 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_types.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_types.h
> @@ -7,6 +7,7 @@
> #define _XE_SRIOV_TYPES_H_
>
> #include <linux/build_bug.h>
> +#include <linux/mutex.h>
> #include <linux/types.h>
>
> /**
> @@ -50,6 +51,9 @@ struct xe_device_pf {
>
> /** @driver_max_vfs: Maximum number of VFs supported by the driver. */
> u16 driver_max_vfs;
> +
> + /** @master_lock: protects all VFs configurations across GTs */
> + struct mutex master_lock;
> };
LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
>
> #endif
> --
> 2.43.0
>
--
next prev parent reply other threads:[~2024-04-10 15:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 12:31 [PATCH 0/5] PF: Add support to configure GuC SR-IOV policies Michal Wajdeczko
2024-04-10 12:31 ` [PATCH 1/5] drm/xe/pf: Introduce mutex to protect VFs configurations Michal Wajdeczko
2024-04-10 15:54 ` Piotr Piórkowski [this message]
2024-04-10 12:31 ` [PATCH 2/5] drm/xe/pf: Introduce helper functions for use by PF Michal Wajdeczko
2024-04-10 15:58 ` Piotr Piórkowski
2024-04-10 12:31 ` [PATCH 3/5] drm/xe/guc: Add PF2GUC_UPDATE_VGT_POLICY to ABI Michal Wajdeczko
2024-04-10 16:02 ` Piotr Piórkowski
2024-04-10 12:31 ` [PATCH 4/5] drm/xe/guc: Add helpers for GuC KLVs Michal Wajdeczko
2024-04-10 13:26 ` Ghimiray, Himal Prasad
2024-04-10 15:30 ` Piotr Piórkowski
2024-04-10 15:47 ` Michal Wajdeczko
2024-04-10 12:31 ` [PATCH 5/5] drm/xe/pf: Add support to configure GuC SR-IOV policies Michal Wajdeczko
2024-04-10 15:46 ` Piotr Piórkowski
2024-04-10 16:00 ` Michal Wajdeczko
2024-04-10 12:44 ` ✓ CI.Patch_applied: success for PF: " Patchwork
2024-04-10 12:45 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-10 12:45 ` ✓ CI.KUnit: success " Patchwork
2024-04-10 12:57 ` ✓ CI.Build: " Patchwork
2024-04-10 12:59 ` ✗ CI.Hooks: failure " Patchwork
2024-04-10 13:01 ` ✓ CI.checksparse: success " Patchwork
2024-04-10 13:27 ` ✓ CI.BAT: " Patchwork
2024-04-10 16:55 ` ✗ CI.FULL: failure " Patchwork
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=20240410155426.6orhsa264jvyw74b@intel.com \
--to=piotr.piorkowski@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.