[PATCH 3/3] drm/xe/vf: Add sanity check for GGTT configuration
K V P, Satyanarayana
satyanarayana.k.v.p at intel.com
Mon Jun 2 14:09:08 UTC 2025
Hi.
> -----Original Message-----
> From: Wajdeczko, Michal <Michal.Wajdeczko at intel.com>
> Sent: Monday, June 2, 2025 4:03 PM
> To: intel-xe at lists.freedesktop.org
> Cc: Wajdeczko, Michal <Michal.Wajdeczko at intel.com>; K V P, Satyanarayana
> <satyanarayana.k.v.p at intel.com>
> Subject: [PATCH 3/3] drm/xe/vf: Add sanity check for GGTT configuration
>
> The VF GGTT configuration was prepared by the PF, which should be
> trusted, was obtained from the GuC, which likely already did some
> sanity checks too, but since it's a received data, we should have
> our own sanity checks to detect early any misconfiguration.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
> ---
> drivers/gpu/drm/xe/xe_tile_sriov_vf.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_tile_sriov_vf.c
> b/drivers/gpu/drm/xe/xe_tile_sriov_vf.c
> index 88e832894432..f221dbed16f0 100644
> --- a/drivers/gpu/drm/xe/xe_tile_sriov_vf.c
> +++ b/drivers/gpu/drm/xe/xe_tile_sriov_vf.c
> @@ -11,6 +11,7 @@
> #include "xe_ggtt.h"
> #include "xe_gt_sriov_vf.h"
> #include "xe_sriov.h"
> +#include "xe_sriov_printk.h"
> #include "xe_tile_sriov_vf.h"
> #include "xe_wopcm.h"
>
> @@ -44,6 +45,7 @@ int xe_tile_sriov_vf_balloon_ggtt_locked(struct xe_tile
> *tile)
> u64 ggtt_base = xe_gt_sriov_vf_ggtt_base(tile->primary_gt);
> u64 ggtt_size = xe_gt_sriov_vf_ggtt(tile->primary_gt);
> struct xe_device *xe = tile_to_xe(tile);
> + u64 wopcm = xe_wopcm_size(xe);
> u64 start, end;
> int err;
>
> @@ -66,7 +68,14 @@ int xe_tile_sriov_vf_balloon_ggtt_locked(struct xe_tile
> *tile)
> * |<--- balloon[0] --->|<-- VF -->|<-- balloon[1] ->|
> */
>
> - start = xe_wopcm_size(xe);
> + if (ggtt_base < wopcm || ggtt_base > GUC_GGTT_TOP ||
> + ggtt_size > GUC_GGTT_TOP - ggtt_base) {
> + xe_sriov_err(xe, "tile%u: Invalid GGTT configuration: %#llx-
> %#llx\n",
> + tile->id, ggtt_base, ggtt_base + ggtt_size - 1);
> + return -ERANGE;
> + }
> +
> + start = wopcm;
> end = ggtt_base;
> if (end != start) {
> err = xe_ggtt_node_insert_balloon_locked(tile-
> >sriov.vf.ggtt_balloon[0],
LGTM.
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
> --
> 2.47.1
More information about the Intel-xe
mailing list