Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	<igt-dev@lists.freedesktop.org>,
	Matthew Auld <matthew.auld@intel.com>,
	Pallavi Mishra <pallavi.mishra@intel.com>
Subject: Re: [PATCH i-g-t v2 1/2] tests/intel/xe_create: sanity check all MBZ fields
Date: Fri, 8 Dec 2023 14:33:20 +0100	[thread overview]
Message-ID: <ZXMbIDIsYGiB2PoL@fdugast-desk.home> (raw)
In-Reply-To: <20231201145815.b74e75efkyvsrdst@kamilkon-desk.igk.intel.com>

Hi Matt,

On Fri, Dec 01, 2023 at 03:58:15PM +0100, Kamil Konieczny wrote:
> Hi Matthew,
> On 2023-11-30 at 17:18:49 +0000, Matthew Auld wrote:
> > Explicitly check that all MBZ (must-be-zero) fields are currently
> > rejected, including the currently unused extensions.
> > 
> > v2: (Kamil)
> >   - Various improvements
> > 
> > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> > Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> > Cc: Pallavi Mishra <pallavi.mishra@intel.com>
> > Cc: Francois Dugast <francois.dugast@intel.com>
> 
> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> 
> Please wait with merge or talk to Francios as he prepared xe-uapi change.
> 
> Regards,
> Kamil

Thanks for doing this, this is great and we should do this for all
structs. The test must be updated now that the pad is __u16 pad[3]
but after this is done, no reason to hold the merge from my side.

Francois

> 
> > ---
> >  tests/intel/xe_create.c | 59 +++++++++++++++++++++++++++++++++++++----
> >  1 file changed, 54 insertions(+), 5 deletions(-)
> > 
> > diff --git a/tests/intel/xe_create.c b/tests/intel/xe_create.c
> > index bb55a15e1..986b078dd 100644
> > --- a/tests/intel/xe_create.c
> > +++ b/tests/intel/xe_create.c
> > @@ -18,6 +18,18 @@
> >  
> >  #define PAGE_SIZE 0x1000
> >  
> > +static int __ioctl_create(int fd, struct drm_xe_gem_create *create)
> > +{
> > +	int ret = 0;
> > +
> > +	if (igt_ioctl(fd, DRM_IOCTL_XE_GEM_CREATE, create)) {
> > +		ret = -errno;
> > +		errno = 0;
> > +	}
> > +
> > +	return ret;
> > +}
> > +
> >  static int __create_bo(int fd, uint32_t vm, uint64_t size, uint32_t flags,
> >  		       uint32_t *handlep)
> >  {
> > @@ -27,14 +39,11 @@ static int __create_bo(int fd, uint32_t vm, uint64_t size, uint32_t flags,
> >  		.flags = flags,
> >  		.cpu_caching = __xe_default_cpu_caching_from_flags(fd, flags),
> >  	};
> > -	int ret = 0;
> > +	int ret;
> >  
> >  	igt_assert(handlep);
> >  
> > -	if (igt_ioctl(fd, DRM_IOCTL_XE_GEM_CREATE, &create)) {
> > -		ret = -errno;
> > -		errno = 0;
> > -	}
> > +	ret = __ioctl_create(fd, &create);
> >  	*handlep = create.handle;
> >  
> >  	return ret;
> > @@ -88,6 +97,43 @@ static void create_invalid_size(int fd)
> >  	xe_vm_destroy(fd, vm);
> >  }
> >  
> > +/**
> > + * SUBTEST: create-invalid-mbz
> > + * Functionality: ioctl
> > + * Test category: negative test
> > + * Description: Verifies xe bo create returns expected error code on all MBZ fields.
> > + */
> > +static void create_invalid_mbz(int fd)
> > +{
> > +	struct drm_xe_gem_create create = {
> > +		.size = PAGE_SIZE,
> > +		.flags = system_memory(fd),
> > +		.cpu_caching = DRM_XE_GEM_CPU_CACHING_WB,
> > +	};
> > +	int i;
> > +
> > +	/* Make sure the baseline passes */
> > +	igt_assert_eq(__ioctl_create(fd, &create), 0);
> > +	gem_close(fd, create.handle);
> > +	create.handle = 0;
> > +
> > +	/* No supported extensions yet */
> > +	create.extensions = -1;
> > +	igt_assert_eq(__ioctl_create(fd, &create), -EINVAL);
> > +	create.extensions = 0;
> > +
> > +	/* Make sure KMD rejects non-zero padding/reserved fields */
> > +	create.pad = -1;
> > +	igt_assert_eq(__ioctl_create(fd, &create), -EINVAL);
> > +	create.pad = 0;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(create.reserved); i++) {
> > +		create.reserved[i] = -1;
> > +		igt_assert_eq(__ioctl_create(fd, &create), -EINVAL);
> > +		create.reserved[i] = 0;
> > +	}
> > +}
> > +
> >  enum exec_queue_destroy {
> >  	NOLEAK,
> >  	LEAK
> > @@ -222,6 +268,9 @@ igt_main
> >  	igt_fixture
> >  		xe = drm_open_driver(DRIVER_XE);
> >  
> > +	igt_subtest("create-invalid-mbz")
> > +		create_invalid_mbz(xe);
> > +
> >  	igt_subtest("create-invalid-size") {
> >  		create_invalid_size(xe);
> >  	}
> > -- 
> > 2.43.0
> > 

  reply	other threads:[~2023-12-08 13:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 17:18 [igt-dev] [PATCH i-g-t v2 1/2] tests/intel/xe_create: sanity check all MBZ fields Matthew Auld
2023-11-30 17:18 ` [igt-dev] [PATCH i-g-t v2 2/2] tests/intel-ci/xe-fast-feedback: add create-invalid-mbz Matthew Auld
2023-11-30 18:15   ` Kamil Konieczny
2023-11-30 18:39 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] tests/intel/xe_create: sanity check all MBZ fields Patchwork
2023-11-30 21:55 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-12-01 14:58 ` [igt-dev] [PATCH i-g-t v2 1/2] " Kamil Konieczny
2023-12-08 13:33   ` Francois Dugast [this message]
2023-12-01 20:31 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,v2,1/2] " Patchwork
2023-12-04 10:17   ` Kamil Konieczny
2023-12-05 12:55 ` Patchwork
2023-12-05 14:02 ` [igt-dev] ✓ Fi.CI.IGT: success " 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=ZXMbIDIsYGiB2PoL@fdugast-desk.home \
    --to=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=matthew.auld@intel.com \
    --cc=pallavi.mishra@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