Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Miszczak <adam.miszczak@linux.intel.com>
To: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Cc: jakub1.kolakowski@intel.com, lukasz.laguna@intel.com,
	michal.wajdeczko@intel.com, michal.winiarski@intel.com,
	narasimha.c.v@intel.com, piotr.piorkowski@intel.com,
	satyanarayana.k.v.p@intel.com, tomasz.lis@intel.com
Subject: Re: [PATCH i-g-t 4/5] tests/intel/xe_sriov_flr: Verify full LMEM range
Date: Wed, 6 Nov 2024 09:31:20 +0100	[thread overview]
Message-ID: <9b8429ba-c36b-46a8-9e2e-64e943a0ce85@linux.intel.com> (raw)
In-Reply-To: <20241030193629.1238637-5-marcin.bernatowicz@linux.intel.com>

On 30.10.2024 20:36, Marcin Bernatowicz wrote:
> Read provisioned LMEM ranges from debugfs lmem_provisioned attribute
> and verify full LMEM ranges in clear-lmem subcheck.
>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
> Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
> Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Narasimha C V <narasimha.c.v@intel.com>
> Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
> Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Tomasz Lis <tomasz.lis@intel.com>
> ---
>   tests/intel/xe_sriov_flr.c | 59 +++++++++++++++++++++++++++++---------
>   1 file changed, 45 insertions(+), 14 deletions(-)
>
> diff --git a/tests/intel/xe_sriov_flr.c b/tests/intel/xe_sriov_flr.c
> index 5fc1baf96..f698eaf3d 100644
> --- a/tests/intel/xe_sriov_flr.c
> +++ b/tests/intel/xe_sriov_flr.c
> @@ -13,6 +13,8 @@
>   #include "linux_scaffold.h"
>   #include "xe/xe_mmio.h"
>   #include "xe/xe_query.h"
> +#include "xe/xe_sriov_provisioning.h"
> +#include "xe/xe_sriov_debugfs.h"
>   
>   /**
>    * TEST: xe_sriov_flr
> @@ -600,14 +602,6 @@ static void *mmap_vf_lmem(int pf_fd, int vf_num, size_t length, int prot, off_t
>   	return addr;
>   }
>   
> -static uint64_t get_vf_lmem_size(int pf_fd, int vf_num)
> -{
> -	/* limit to first two pages
> -	 * TODO: Extend to full range when the proper interface (lmem_provisioned) is added
> -	 */
> -	return SZ_4M;
> -}
> -
>   static void munmap_vf_lmem(struct lmem_info *lmem)
>   {
>   	igt_debug_on_f(munmap(lmem->addr, lmem->size),
> @@ -683,10 +677,49 @@ static bool lmem_mmap_write_munmap(int pf_fd, int vf_num, size_t length, char va
>   	return result;
>   }
>   
> -static void lmem_subcheck_init(struct subcheck_data *data)
> +static int populate_vf_lmem_sizes(struct subcheck_data *data)
>   {
>   	struct lmem_data *ldata = (struct lmem_data *)data;
> +	struct xe_sriov_provisioned_range *ranges;
> +	unsigned int nr_ranges, gt;
> +	int ret;
> +
> +	ldata->vf_lmem_size = calloc(data->num_vfs + 1, sizeof(size_t));
> +	igt_assert(ldata->vf_lmem_size);
> +
> +	xe_for_each_gt(data->pf_fd, gt) {
> +		ret = xe_sriov_pf_debugfs_read_provisioned_ranges(data->pf_fd,
> +								  XE_SRIOV_SHARED_RES_LMEM,
> +								  gt, &ranges, &nr_ranges);
> +		if (ret) {
> +			set_skip_reason(data, "Failed read %s on gt%u (%d)\n",
> +					xe_sriov_debugfs_provisioned_attr_name(XE_SRIOV_SHARED_RES_LMEM),
> +					gt, ret);
> +			return -1;
> +		}
> +
> +		for (unsigned int i = 0; i < nr_ranges; ++i) {
> +			const unsigned int vf_id = ranges[i].vf_id;
> +
> +			igt_assert(vf_id >= 1 && vf_id <= data->num_vfs);
> +			/* Sum the allocation for vf_id (inclusive range) */
> +			ldata->vf_lmem_size[vf_id] += ranges[i].end - ranges[i].start + 1;
> +		}
> +
> +		free(ranges);
> +	}
> +
> +	for (int vf_id = 1; vf_id <= data->num_vfs; ++vf_id)
> +		if (!ldata->vf_lmem_size[vf_id]) {
> +			set_skip_reason(data, "No LMEM provisioned for VF%u\n", vf_id);
> +			return -1;
> +		}
>   
> +	return 0;
> +}
> +
> +static void lmem_subcheck_init(struct subcheck_data *data)
> +{
>   	igt_assert_fd(data->pf_fd);
>   	igt_assert(data->num_vfs);
>   
> @@ -695,11 +728,9 @@ static void lmem_subcheck_init(struct subcheck_data *data)
>   		return;
>   	}
>   
> -	ldata->vf_lmem_size = calloc(data->num_vfs + 1, sizeof(size_t));
> -	igt_assert(ldata->vf_lmem_size);
> -
> -	for (int vf_id = 1; vf_id <= data->num_vfs; ++vf_id)
> -		ldata->vf_lmem_size[vf_id] = get_vf_lmem_size(ldata->base.pf_fd, vf_id);
> +	if (populate_vf_lmem_sizes(data))
> +		/* skip reason set in populate_vf_lmem_sizes */
> +		return;
>   }
>   
>   static void lmem_subcheck_prepare_vf(int vf_id, struct subcheck_data *data)
LGTM,
Reviewed-by: Adam Miszczak <adam.miszczak@linux.intel.com>

  reply	other threads:[~2024-11-06  8:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 19:36 [PATCH i-g-t 0/5] Add debugfs SR-IOV helpers; Improve clear-lmem check Marcin Bernatowicz
2024-10-30 19:36 ` [PATCH i-g-t 1/5] lib/xe_sriov_debugfs: add helper for opening attributes Marcin Bernatowicz
2024-10-31 10:28   ` Kamil Konieczny
2024-11-05  8:45   ` Adam Miszczak
2024-10-30 19:36 ` [PATCH i-g-t 2/5] lib/xe/xe_sriov_provisioning: Define resource types and provisioned range structure Marcin Bernatowicz
2024-11-05 11:21   ` Adam Miszczak
2024-11-06  9:09     ` Bernatowicz, Marcin
2024-10-30 19:36 ` [PATCH i-g-t 3/5] lib/xe/xe_sriov_debugfs: Add function to read provisioned ranges Marcin Bernatowicz
2024-11-05 11:39   ` Adam Miszczak
2024-10-30 19:36 ` [PATCH i-g-t 4/5] tests/intel/xe_sriov_flr: Verify full LMEM range Marcin Bernatowicz
2024-11-06  8:31   ` Adam Miszczak [this message]
2024-10-30 19:36 ` [PATCH i-g-t 5/5] lib/xe/xe_sriov_provisioning: Extract function to search provisioned PTE ranges Marcin Bernatowicz
2024-11-06  8:08   ` Adam Miszczak
2024-10-30 21:41 ` ✓ Fi.CI.BAT: success for Add debugfs SR-IOV helpers; Improve clear-lmem check Patchwork
2024-10-30 21:42 ` ✓ CI.xeBAT: " Patchwork
2024-10-30 23:20 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-31  7:15 ` ✗ Fi.CI.IGT: " 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=9b8429ba-c36b-46a8-9e2e-64e943a0ce85@linux.intel.com \
    --to=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=marcin.bernatowicz@linux.intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=michal.winiarski@intel.com \
    --cc=narasimha.c.v@intel.com \
    --cc=piotr.piorkowski@intel.com \
    --cc=satyanarayana.k.v.p@intel.com \
    --cc=tomasz.lis@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