All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector
@ 2021-01-04 10:15 Łukasz Łaguna
  2021-01-04 10:49 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_device_scan: Add slot selector (rev2) Patchwork
  0 siblings, 1 reply; 7+ messages in thread
From: Łukasz Łaguna @ 2021-01-04 10:15 UTC (permalink / raw)
  To: igt-dev

Add selector for direct device selection, based on hardware (PCIe) path.
It allows to choose device in specified domain, bus, slot and function.

Example:
gem_exec_basic --device "pci:slot=0000:01:00.0"

Signed-off-by: Łukasz Łaguna <lukasz.laguna@intel.com>
---
 lib/igt_device_scan.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index b3b2bf4d..4704ba6f 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -83,9 +83,9 @@
  *   device selection, e.g. in automated execution setting. In such scenarios
  *   please consider using sys, pci or platform filters instead.
  *
- * - pci: select device using PCI vendor and device properties
+ * - pci: select device using PCI slot or vendor and device properties
  *   |[<!-- language="plain" -->
- *   pci:[vendor=%04x/name][,device=%04x][,card=%d]
+ *   pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]
  *   ]|
  *
  *   Filter allows device selection using vendor (hex or name), device id
@@ -117,6 +117,12 @@
  *
  *   It selects the second one.
  *
+ *   Another possibility is to select device using a PCI slot:
+ *
+ *   |[<!-- language="plain" -->
+ *   pci:slot=0000:01:00.0
+ *   ]|
+ *
  *   As order the on PCI bus doesn't change (unless you'll add new device or
  *   reorder existing one) device selection using this filter will always
  *   return you same device regardless the order of enumeration.
@@ -1138,6 +1144,7 @@ struct filter {
 		char *vendor;
 		char *device;
 		char *card;
+		char *slot;
 		char *drm;
 		char *driver;
 	} data;
@@ -1154,6 +1161,7 @@ static void fill_filter_data(struct filter *filter, const char *key, const char
 	__fill_key(vendor);
 	__fill_key(device);
 	__fill_key(card);
+	__fill_key(slot);
 	__fill_key(drm);
 	__fill_key(driver);
 #undef __fill_key
@@ -1271,6 +1279,10 @@ static struct igt_list_head *filter_pci(const struct filter_class *fcls,
 		if (!is_pci_subsystem(dev))
 			continue;
 
+		/* Skip if 'slot' doesn't match */
+		if (filter->data.slot && !strequal(filter->data.slot, dev->pci_slot_name))
+			continue;
+
 		/* Skip if 'vendor' doesn't match (hex or name) */
 		if (filter->data.vendor && !is_vendor_matched(dev, filter->data.vendor))
 			continue;
@@ -1325,7 +1337,7 @@ static struct filter_class filter_definition_list[] = {
 	{
 		.name = "pci",
 		.filter_function = filter_pci,
-		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d]",
+		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]",
 		.detail = "vendor is hex number or vendor name\n",
 	},
 	{
-- 
2.28.0

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN.
Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_device_scan: Add slot selector (rev2)
  2021-01-04 10:15 [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector Łukasz Łaguna
@ 2021-01-04 10:49 ` Patchwork
  0 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2021-01-04 10:49 UTC (permalink / raw)
  To: Łukasz Łaguna; +Cc: igt-dev


[-- Attachment #1.1: Type: text/plain, Size: 6553 bytes --]

== Series Details ==

Series: lib/igt_device_scan: Add slot selector (rev2)
URL   : https://patchwork.freedesktop.org/series/85435/
State : failure

== Summary ==

CI Bug Log - changes from IGT_5941 -> IGTPW_5347
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_5347 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_5347, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_5347:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live@requests:
    - fi-tgl-y:           [PASS][1] -> [INCOMPLETE][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5941/fi-tgl-y/igt@i915_selftest@live@requests.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-tgl-y/igt@i915_selftest@live@requests.html

  * igt@runner@aborted:
    - fi-tgl-y:           NOTRUN -> [FAIL][3]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-tgl-y/igt@runner@aborted.html

  
Known issues
------------

  Here are the changes found in IGTPW_5347 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@cs-gfx:
    - fi-hsw-4770:        NOTRUN -> [SKIP][4] ([fdo#109271]) +25 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-hsw-4770/igt@amdgpu/amd_basic@cs-gfx.html

  * igt@core_hotunplug@unbind-rebind:
    - fi-hsw-4770:        NOTRUN -> [WARN][5] ([i915#2283])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-hsw-4770/igt@core_hotunplug@unbind-rebind.html

  * igt@debugfs_test@read_all_entries:
    - fi-tgl-y:           [PASS][6] -> [DMESG-WARN][7] ([i915#402]) +2 similar issues
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5941/fi-tgl-y/igt@debugfs_test@read_all_entries.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-tgl-y/igt@debugfs_test@read_all_entries.html

  * igt@gem_exec_suspend@basic-s0:
    - fi-tgl-u2:          [PASS][8] -> [FAIL][9] ([i915#1888])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5941/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html

  * igt@gem_exec_suspend@basic-s3:
    - fi-tgl-y:           [PASS][10] -> [DMESG-WARN][11] ([i915#2411] / [i915#402])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5941/fi-tgl-y/igt@gem_exec_suspend@basic-s3.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-tgl-y/igt@gem_exec_suspend@basic-s3.html

  * igt@gem_huc_copy@huc-copy:
    - fi-bxt-dsi:         NOTRUN -> [SKIP][12] ([fdo#109271] / [i915#2190])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-bxt-dsi/igt@gem_huc_copy@huc-copy.html

  * igt@i915_selftest@live@sanitycheck:
    - fi-kbl-7500u:       [PASS][13] -> [DMESG-WARN][14] ([i915#2605])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5941/fi-kbl-7500u/igt@i915_selftest@live@sanitycheck.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-kbl-7500u/igt@i915_selftest@live@sanitycheck.html

  * igt@kms_chamelium@common-hpd-after-suspend:
    - fi-bxt-dsi:         NOTRUN -> [SKIP][15] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-bxt-dsi/igt@kms_chamelium@common-hpd-after-suspend.html
    - fi-hsw-4770:        NOTRUN -> [SKIP][16] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-hsw-4770/igt@kms_chamelium@common-hpd-after-suspend.html

  * igt@kms_force_connector_basic@force-load-detect:
    - fi-bxt-dsi:         NOTRUN -> [SKIP][17] ([fdo#109271]) +27 similar issues
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-bxt-dsi/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
    - fi-bxt-dsi:         NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#533])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-bxt-dsi/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html

  
#### Possible fixes ####

  * igt@kms_chamelium@dp-crc-fast:
    - fi-kbl-7500u:       [FAIL][19] ([i915#1161] / [i915#262]) -> [PASS][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5941/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html

  * igt@prime_vgem@basic-fence-flip:
    - fi-tgl-y:           [DMESG-WARN][21] ([i915#402]) -> [PASS][22] +2 similar issues
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5941/fi-tgl-y/igt@prime_vgem@basic-fence-flip.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/fi-tgl-y/igt@prime_vgem@basic-fence-flip.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1161]: https://gitlab.freedesktop.org/drm/intel/issues/1161
  [i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2283]: https://gitlab.freedesktop.org/drm/intel/issues/2283
  [i915#2411]: https://gitlab.freedesktop.org/drm/intel/issues/2411
  [i915#2605]: https://gitlab.freedesktop.org/drm/intel/issues/2605
  [i915#262]: https://gitlab.freedesktop.org/drm/intel/issues/262
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533


Participating hosts (38 -> 36)
------------------------------

  Additional (2): fi-hsw-4770 fi-bxt-dsi 
  Missing    (4): fi-ilk-m540 fi-dg1-1 fi-bsw-cyan fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_5941 -> IGTPW_5347

  CI-20190529: 20190529
  CI_DRM_9540: 031143817afd9bb0877e723f741fb711d4d0c55b @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_5347: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/index.html
  IGT_5941: 58b135e66be4fa4db8f668fa5d125b31537cb9a6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5347/index.html

[-- Attachment #1.2: Type: text/html, Size: 8067 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector
  2021-01-05 13:35 [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector Łukasz Łaguna
@ 2021-01-07  9:44 ` Zbigniew Kempczyński
  0 siblings, 0 replies; 7+ messages in thread
From: Zbigniew Kempczyński @ 2021-01-07  9:44 UTC (permalink / raw)
  To: Łukasz Łaguna; +Cc: igt-dev

On Tue, Jan 05, 2021 at 02:35:38PM +0100, Łukasz Łaguna wrote:
> Add selector for direct device selection, based on hardware (PCIe) path.
> It allows to choose device in specified domain, bus, slot and function.
> 
> Example:
> gem_exec_basic --device "pci:slot=0000:01:00.0"
> 
> Signed-off-by: Łukasz Łaguna <lukasz.laguna@intel.com>
> ---
>  lib/igt_device_scan.c | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index b3b2bf4d..2b7d9a3a 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -83,9 +83,9 @@
>   *   device selection, e.g. in automated execution setting. In such scenarios
>   *   please consider using sys, pci or platform filters instead.
>   *
> - * - pci: select device using PCI vendor and device properties
> + * - pci: select device using PCI slot or vendor and device properties
>   *   |[<!-- language="plain" -->
> - *   pci:[vendor=%04x/name][,device=%04x][,card=%d]
> + *   pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]
>   *   ]|
>   *
>   *   Filter allows device selection using vendor (hex or name), device id
> @@ -117,6 +117,12 @@
>   *
>   *   It selects the second one.
>   *
> + *   Another possibility is to select device using a PCI slot:
> + *
> + *   |[<!-- language="plain" -->
> + *   pci:slot=0000:01:00.0
> + *   ]|
> + *
>   *   As order the on PCI bus doesn't change (unless you'll add new device or
>   *   reorder existing one) device selection using this filter will always
>   *   return you same device regardless the order of enumeration.
> @@ -1138,6 +1144,7 @@ struct filter {
>  		char *vendor;
>  		char *device;
>  		char *card;
> +		char *slot;
>  		char *drm;
>  		char *driver;
>  	} data;
> @@ -1154,6 +1161,7 @@ static void fill_filter_data(struct filter *filter, const char *key, const char
>  	__fill_key(vendor);
>  	__fill_key(device);
>  	__fill_key(card);
> +	__fill_key(slot);
>  	__fill_key(drm);
>  	__fill_key(driver);
>  #undef __fill_key
> @@ -1258,6 +1266,11 @@ static struct igt_list_head *filter_pci(const struct filter_class *fcls,
>  
>  	DBG("filter pci\n");
>  
> +	if (filter->data.slot && (filter->data.vendor || filter->data.device || filter->data.card)) {
> +		fprintf(stderr, "Slot parameter can not be used with other parameters\n");
> +		exit(EXIT_FAILURE);
> +	}
> +
>  	if (filter->data.card) {
>  		sscanf(filter->data.card, "%d", &card);
>  		if (card < 0) {
> @@ -1271,6 +1284,10 @@ static struct igt_list_head *filter_pci(const struct filter_class *fcls,
>  		if (!is_pci_subsystem(dev))
>  			continue;
>  
> +		/* Skip if 'slot' doesn't match */
> +		if (filter->data.slot && !strequal(filter->data.slot, dev->pci_slot_name))
> +			continue;
> +
>  		/* Skip if 'vendor' doesn't match (hex or name) */
>  		if (filter->data.vendor && !is_vendor_matched(dev, filter->data.vendor))
>  			continue;
> @@ -1325,7 +1342,7 @@ static struct filter_class filter_definition_list[] = {
>  	{
>  		.name = "pci",
>  		.filter_function = filter_pci,
> -		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d]",
> +		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]",
>  		.detail = "vendor is hex number or vendor name\n",
>  	},
>  	{
> -- 
> 2.28.0
> 

Great, looks good. 

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector
  2021-01-04 13:33 ` Zbigniew Kempczyński
@ 2021-01-05 13:43   ` Laguna, Lukasz
  0 siblings, 0 replies; 7+ messages in thread
From: Laguna, Lukasz @ 2021-01-05 13:43 UTC (permalink / raw)
  To: Kempczynski, Zbigniew; +Cc: igt-dev

> -----Original Message-----
> From: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Sent: poniedziałek, 4 stycznia 2021 14:33
> To: Laguna, Lukasz <lukasz.laguna@intel.com>
> Cc: igt-dev@lists.freedesktop.org
> Subject: Re: [PATCH i-g-t] lib/igt_device_scan: Add slot selector
> 
> On Mon, Jan 04, 2021 at 10:34:41AM +0100, Łukasz Łaguna wrote:
> > Add selector for direct device selection, based on hardware (PCIe) path.
> > It allows to choose device in specified domain, bus, slot and function.
> >
> > Example:
> > gem_exec_basic --device "pci:slot=0000:01:00.0"
> >
> > Signed-off-by: Łukasz Łaguna <lukasz.laguna@intel.com>
> > ---
> >  lib/igt_device_scan.c | 18 +++++++++++++++---
> >  1 file changed, 15 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c index
> > b3b2bf4d..4704ba6f 100644
> > --- a/lib/igt_device_scan.c
> > +++ b/lib/igt_device_scan.c
> > @@ -83,9 +83,9 @@
> >   *   device selection, e.g. in automated execution setting. In such scenarios
> >   *   please consider using sys, pci or platform filters instead.
> >   *
> > - * - pci: select device using PCI vendor and device properties
> > + * - pci: select device using PCI slot or vendor and device
> > + properties
> >   *   |[<!-- language="plain" -->
> > - *   pci:[vendor=%04x/name][,device=%04x][,card=%d]
> > + *   pci:[vendor=%04x/name][,device=%04x][,card=%d] |
> [slot=%04x:%02x:%02x.%x]
> >   *   ]|
> >   *
> >   *   Filter allows device selection using vendor (hex or name), device id
> > @@ -117,6 +117,12 @@
> >   *
> >   *   It selects the second one.
> >   *
> > + *   Another possibility is to select device using a PCI slot:
> > + *
> > + *   |[<!-- language="plain" -->
> > + *   pci:slot=0000:01:00.0
> > + *   ]|
> > + *
> >   *   As order the on PCI bus doesn't change (unless you'll add new device or
> >   *   reorder existing one) device selection using this filter will always
> >   *   return you same device regardless the order of enumeration.
> > @@ -1138,6 +1144,7 @@ struct filter {
> >  		char *vendor;
> >  		char *device;
> >  		char *card;
> > +		char *slot;
> >  		char *drm;
> >  		char *driver;
> >  	} data;
> > @@ -1154,6 +1161,7 @@ static void fill_filter_data(struct filter *filter, const
> char *key, const char
> >  	__fill_key(vendor);
> >  	__fill_key(device);
> >  	__fill_key(card);
> > +	__fill_key(slot);
> >  	__fill_key(drm);
> >  	__fill_key(driver);
> >  #undef __fill_key
> > @@ -1271,6 +1279,10 @@ static struct igt_list_head *filter_pci(const struct
> filter_class *fcls,
> >  		if (!is_pci_subsystem(dev))
> >  			continue;
> >
> > +		/* Skip if 'slot' doesn't match */
> > +		if (filter->data.slot && !strequal(filter->data.slot, dev-
> >pci_slot_name))
> > +			continue;
> > +
> 
> selector - pci:[vendor=%04x/name][,device=%04x][,card=%d] |
> [slot=%04x:%02x:%02x.%x]
> 
> According to pci selector I assume you want to have:
> 
> 1. pci:vendor=...,device=...
> 
> or
> 
> 2. pci:slot=xxxx:xx:xx.x
> 
> So slot should be exclusive and no vendor/device/card parameters should be
> allowed and vice versa.
> 
> Now I'm able to pass:
> 
> pci:slot=0000:00:02.0,vendor=8081
> 
> but I expect vendor check shouldn't be processed here (passing slot gives
> you explicit device and according to selector description these two are
> exclusive).
> 
> So - disable vendor/device/card if slot is used and slot when
> vendor/device/card are used. I think you even should exit with an error in
> such case.

Thanks for comments. I've fixed it and sent next revision.

--
Łukasz
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN.
Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector
@ 2021-01-05 13:35 Łukasz Łaguna
  2021-01-07  9:44 ` Zbigniew Kempczyński
  0 siblings, 1 reply; 7+ messages in thread
From: Łukasz Łaguna @ 2021-01-05 13:35 UTC (permalink / raw)
  To: igt-dev

Add selector for direct device selection, based on hardware (PCIe) path.
It allows to choose device in specified domain, bus, slot and function.

Example:
gem_exec_basic --device "pci:slot=0000:01:00.0"

Signed-off-by: Łukasz Łaguna <lukasz.laguna@intel.com>
---
 lib/igt_device_scan.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index b3b2bf4d..2b7d9a3a 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -83,9 +83,9 @@
  *   device selection, e.g. in automated execution setting. In such scenarios
  *   please consider using sys, pci or platform filters instead.
  *
- * - pci: select device using PCI vendor and device properties
+ * - pci: select device using PCI slot or vendor and device properties
  *   |[<!-- language="plain" -->
- *   pci:[vendor=%04x/name][,device=%04x][,card=%d]
+ *   pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]
  *   ]|
  *
  *   Filter allows device selection using vendor (hex or name), device id
@@ -117,6 +117,12 @@
  *
  *   It selects the second one.
  *
+ *   Another possibility is to select device using a PCI slot:
+ *
+ *   |[<!-- language="plain" -->
+ *   pci:slot=0000:01:00.0
+ *   ]|
+ *
  *   As order the on PCI bus doesn't change (unless you'll add new device or
  *   reorder existing one) device selection using this filter will always
  *   return you same device regardless the order of enumeration.
@@ -1138,6 +1144,7 @@ struct filter {
 		char *vendor;
 		char *device;
 		char *card;
+		char *slot;
 		char *drm;
 		char *driver;
 	} data;
@@ -1154,6 +1161,7 @@ static void fill_filter_data(struct filter *filter, const char *key, const char
 	__fill_key(vendor);
 	__fill_key(device);
 	__fill_key(card);
+	__fill_key(slot);
 	__fill_key(drm);
 	__fill_key(driver);
 #undef __fill_key
@@ -1258,6 +1266,11 @@ static struct igt_list_head *filter_pci(const struct filter_class *fcls,
 
 	DBG("filter pci\n");
 
+	if (filter->data.slot && (filter->data.vendor || filter->data.device || filter->data.card)) {
+		fprintf(stderr, "Slot parameter can not be used with other parameters\n");
+		exit(EXIT_FAILURE);
+	}
+
 	if (filter->data.card) {
 		sscanf(filter->data.card, "%d", &card);
 		if (card < 0) {
@@ -1271,6 +1284,10 @@ static struct igt_list_head *filter_pci(const struct filter_class *fcls,
 		if (!is_pci_subsystem(dev))
 			continue;
 
+		/* Skip if 'slot' doesn't match */
+		if (filter->data.slot && !strequal(filter->data.slot, dev->pci_slot_name))
+			continue;
+
 		/* Skip if 'vendor' doesn't match (hex or name) */
 		if (filter->data.vendor && !is_vendor_matched(dev, filter->data.vendor))
 			continue;
@@ -1325,7 +1342,7 @@ static struct filter_class filter_definition_list[] = {
 	{
 		.name = "pci",
 		.filter_function = filter_pci,
-		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d]",
+		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]",
 		.detail = "vendor is hex number or vendor name\n",
 	},
 	{
-- 
2.28.0

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN.
Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector
  2021-01-04  9:34 Łukasz Łaguna
@ 2021-01-04 13:33 ` Zbigniew Kempczyński
  2021-01-05 13:43   ` Laguna, Lukasz
  0 siblings, 1 reply; 7+ messages in thread
From: Zbigniew Kempczyński @ 2021-01-04 13:33 UTC (permalink / raw)
  To: Łukasz Łaguna; +Cc: igt-dev

On Mon, Jan 04, 2021 at 10:34:41AM +0100, Łukasz Łaguna wrote:
> Add selector for direct device selection, based on hardware (PCIe) path.
> It allows to choose device in specified domain, bus, slot and function.
> 
> Example:
> gem_exec_basic --device "pci:slot=0000:01:00.0"
> 
> Signed-off-by: Łukasz Łaguna <lukasz.laguna@intel.com>
> ---
>  lib/igt_device_scan.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index b3b2bf4d..4704ba6f 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -83,9 +83,9 @@
>   *   device selection, e.g. in automated execution setting. In such scenarios
>   *   please consider using sys, pci or platform filters instead.
>   *
> - * - pci: select device using PCI vendor and device properties
> + * - pci: select device using PCI slot or vendor and device properties
>   *   |[<!-- language="plain" -->
> - *   pci:[vendor=%04x/name][,device=%04x][,card=%d]
> + *   pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]
>   *   ]|
>   *
>   *   Filter allows device selection using vendor (hex or name), device id
> @@ -117,6 +117,12 @@
>   *
>   *   It selects the second one.
>   *
> + *   Another possibility is to select device using a PCI slot:
> + *
> + *   |[<!-- language="plain" -->
> + *   pci:slot=0000:01:00.0
> + *   ]|
> + *
>   *   As order the on PCI bus doesn't change (unless you'll add new device or
>   *   reorder existing one) device selection using this filter will always
>   *   return you same device regardless the order of enumeration.
> @@ -1138,6 +1144,7 @@ struct filter {
>  		char *vendor;
>  		char *device;
>  		char *card;
> +		char *slot;
>  		char *drm;
>  		char *driver;
>  	} data;
> @@ -1154,6 +1161,7 @@ static void fill_filter_data(struct filter *filter, const char *key, const char
>  	__fill_key(vendor);
>  	__fill_key(device);
>  	__fill_key(card);
> +	__fill_key(slot);
>  	__fill_key(drm);
>  	__fill_key(driver);
>  #undef __fill_key
> @@ -1271,6 +1279,10 @@ static struct igt_list_head *filter_pci(const struct filter_class *fcls,
>  		if (!is_pci_subsystem(dev))
>  			continue;
>  
> +		/* Skip if 'slot' doesn't match */
> +		if (filter->data.slot && !strequal(filter->data.slot, dev->pci_slot_name))
> +			continue;
> +

selector - pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]

According to pci selector I assume you want to have:

1. pci:vendor=...,device=...
  
or 

2. pci:slot=xxxx:xx:xx.x 

So slot should be exclusive and no vendor/device/card parameters should be allowed
and vice versa. 

Now I'm able to pass:

pci:slot=0000:00:02.0,vendor=8081

but I expect vendor check shouldn't be processed here (passing slot gives you explicit
device and according to selector description these two are exclusive).

So - disable vendor/device/card if slot is used and slot when vendor/device/card
are used. I think you even should exit with an error in such case.

--
Zbigniew

>  		/* Skip if 'vendor' doesn't match (hex or name) */
>  		if (filter->data.vendor && !is_vendor_matched(dev, filter->data.vendor))
>  			continue;
> @@ -1325,7 +1337,7 @@ static struct filter_class filter_definition_list[] = {
>  	{
>  		.name = "pci",
>  		.filter_function = filter_pci,
> -		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d]",
> +		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]",
>  		.detail = "vendor is hex number or vendor name\n",
>  	},
>  	{
> -- 
> 2.28.0
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector
@ 2021-01-04  9:34 Łukasz Łaguna
  2021-01-04 13:33 ` Zbigniew Kempczyński
  0 siblings, 1 reply; 7+ messages in thread
From: Łukasz Łaguna @ 2021-01-04  9:34 UTC (permalink / raw)
  To: igt-dev

Add selector for direct device selection, based on hardware (PCIe) path.
It allows to choose device in specified domain, bus, slot and function.

Example:
gem_exec_basic --device "pci:slot=0000:01:00.0"

Signed-off-by: Łukasz Łaguna <lukasz.laguna@intel.com>
---
 lib/igt_device_scan.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index b3b2bf4d..4704ba6f 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -83,9 +83,9 @@
  *   device selection, e.g. in automated execution setting. In such scenarios
  *   please consider using sys, pci or platform filters instead.
  *
- * - pci: select device using PCI vendor and device properties
+ * - pci: select device using PCI slot or vendor and device properties
  *   |[<!-- language="plain" -->
- *   pci:[vendor=%04x/name][,device=%04x][,card=%d]
+ *   pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]
  *   ]|
  *
  *   Filter allows device selection using vendor (hex or name), device id
@@ -117,6 +117,12 @@
  *
  *   It selects the second one.
  *
+ *   Another possibility is to select device using a PCI slot:
+ *
+ *   |[<!-- language="plain" -->
+ *   pci:slot=0000:01:00.0
+ *   ]|
+ *
  *   As order the on PCI bus doesn't change (unless you'll add new device or
  *   reorder existing one) device selection using this filter will always
  *   return you same device regardless the order of enumeration.
@@ -1138,6 +1144,7 @@ struct filter {
 		char *vendor;
 		char *device;
 		char *card;
+		char *slot;
 		char *drm;
 		char *driver;
 	} data;
@@ -1154,6 +1161,7 @@ static void fill_filter_data(struct filter *filter, const char *key, const char
 	__fill_key(vendor);
 	__fill_key(device);
 	__fill_key(card);
+	__fill_key(slot);
 	__fill_key(drm);
 	__fill_key(driver);
 #undef __fill_key
@@ -1271,6 +1279,10 @@ static struct igt_list_head *filter_pci(const struct filter_class *fcls,
 		if (!is_pci_subsystem(dev))
 			continue;
 
+		/* Skip if 'slot' doesn't match */
+		if (filter->data.slot && !strequal(filter->data.slot, dev->pci_slot_name))
+			continue;
+
 		/* Skip if 'vendor' doesn't match (hex or name) */
 		if (filter->data.vendor && !is_vendor_matched(dev, filter->data.vendor))
 			continue;
@@ -1325,7 +1337,7 @@ static struct filter_class filter_definition_list[] = {
 	{
 		.name = "pci",
 		.filter_function = filter_pci,
-		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d]",
+		.help = "pci:[vendor=%04x/name][,device=%04x][,card=%d] | [slot=%04x:%02x:%02x.%x]",
 		.detail = "vendor is hex number or vendor name\n",
 	},
 	{
-- 
2.28.0

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN.
Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-07  9:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 10:15 [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector Łukasz Łaguna
2021-01-04 10:49 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_device_scan: Add slot selector (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2021-01-05 13:35 [igt-dev] [PATCH i-g-t] lib/igt_device_scan: Add slot selector Łukasz Łaguna
2021-01-07  9:44 ` Zbigniew Kempczyński
2021-01-04  9:34 Łukasz Łaguna
2021-01-04 13:33 ` Zbigniew Kempczyński
2021-01-05 13:43   ` Laguna, Lukasz

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.