[PATCH 2/5] drm/xe: Move PF and VF device types to separate headers

Piotr Piórkowski piotr.piorkowski at intel.com
Wed Jun 25 15:17:15 UTC 2025


Michal Wajdeczko <michal.wajdeczko at intel.com> wrote on wto [2025-cze-24 22:09:20 +0200]:
> We plan to add more PF and VF types and mixing them in a single
> file is not desired.  Move them out to new dedicated files.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device_types.h   |  2 ++
>  drivers/gpu/drm/xe/xe_sriov_pf_types.h | 29 +++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_sriov_types.h    | 36 --------------------------
>  drivers/gpu/drm/xe/xe_sriov_vf_types.h | 27 +++++++++++++++++++
>  4 files changed, 58 insertions(+), 36 deletions(-)
>  create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_types.h
>  create mode 100644 drivers/gpu/drm/xe/xe_sriov_vf_types.h
> 
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> index 962acd451734..64a7e4c52a11 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -21,7 +21,9 @@
>  #include "xe_platform_types.h"
>  #include "xe_pmu_types.h"
>  #include "xe_pt_types.h"
> +#include "xe_sriov_pf_types.h"
>  #include "xe_sriov_types.h"
> +#include "xe_sriov_vf_types.h"
>  #include "xe_step_types.h"
>  #include "xe_survivability_mode_types.h"
>  #include "xe_ttm_vram_mgr_types.h"
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_types.h b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> new file mode 100644
> index 000000000000..918dc089eb1d
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> @@ -0,0 +1,29 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023-2025 Intel Corporation
> + */
> +
> +#ifndef _XE_SRIOV_PF_TYPES_H_
> +#define _XE_SRIOV_PF_TYPES_H_
> +
> +#include <linux/mutex.h>
> +#include <linux/types.h>
> +
> +/**
> + * struct xe_device_pf - Xe PF related data
> + *
> + * The data in this structure is valid only if driver is running in the
> + * @XE_SRIOV_MODE_PF mode.
> + */
> +struct xe_device_pf {
> +	/** @device_total_vfs: Maximum number of VFs supported by the device. */
> +	u16 device_total_vfs;
> +
> +	/** @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;
> +};
> +
> +#endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_types.h b/drivers/gpu/drm/xe/xe_sriov_types.h
> index ca94382a721e..1a138108d139 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_types.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_types.h
> @@ -7,9 +7,6 @@
>  #define _XE_SRIOV_TYPES_H_
>  
>  #include <linux/build_bug.h>
> -#include <linux/mutex.h>
> -#include <linux/types.h>
> -#include <linux/workqueue_types.h>
>  
>  /**
>   * VFID - Virtual Function Identifier
> @@ -40,37 +37,4 @@ enum xe_sriov_mode {
>  };
>  static_assert(XE_SRIOV_MODE_NONE);
>  
> -/**
> - * struct xe_device_pf - Xe PF related data
> - *
> - * The data in this structure is valid only if driver is running in the
> - * @XE_SRIOV_MODE_PF mode.
> - */
> -struct xe_device_pf {
> -	/** @device_total_vfs: Maximum number of VFs supported by the device. */
> -	u16 device_total_vfs;
> -
> -	/** @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;
> -};
> -
> -/**
> - * struct xe_device_vf - Xe Virtual Function related data
> - *
> - * The data in this structure is valid only if driver is running in the
> - * @XE_SRIOV_MODE_VF mode.
> - */
> -struct xe_device_vf {
> -	/** @migration: VF Migration state data */
> -	struct {
> -		/** @migration.worker: VF migration recovery worker */
> -		struct work_struct worker;
> -		/** @migration.gt_flags: Per-GT request flags for VF migration recovery */
> -		unsigned long gt_flags;
> -	} migration;
> -};
> -
>  #endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_types.h b/drivers/gpu/drm/xe/xe_sriov_vf_types.h
> new file mode 100644
> index 000000000000..55c2421d4b2e
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sriov_vf_types.h
> @@ -0,0 +1,27 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023-2025 Intel Corporation
> + */
> +
> +#ifndef _XE_SRIOV_VF_TYPES_H_
> +#define _XE_SRIOV_VF_TYPES_H_
> +
> +#include <linux/workqueue_types.h>
> +
> +/**
> + * struct xe_device_vf - Xe Virtual Function related data
> + *
> + * The data in this structure is valid only if driver is running in the
> + * @XE_SRIOV_MODE_VF mode.
> + */
> +struct xe_device_vf {
> +	/** @migration: VF Migration state data */
> +	struct {
> +		/** @migration.worker: VF migration recovery worker */
> +		struct work_struct worker;
> +		/** @migration.gt_flags: Per-GT request flags for VF migration recovery */
> +		unsigned long gt_flags;
> +	} migration;
> +};
> +
> +#endif

LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski at intel.com>

> -- 
> 2.47.1
> 

-- 


More information about the Intel-xe mailing list