* [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-06 19:59 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
@ 2023-11-06 19:59 ` Lukasz Laguna
2023-11-06 22:59 ` Michal Wajdeczko
0 siblings, 1 reply; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-06 19:59 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Test enables VFs in range <1..totalvfs>, bind driver to all of them and
then unbind driver from all of them.
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
---
tests/sriov_basic.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
index fc0914962..179731daf 100644
--- a/tests/sriov_basic.c
+++ b/tests/sriov_basic.c
@@ -61,6 +61,38 @@ static void probe_disable_vfs(int pf_fd, unsigned int num_vfs)
igt_assert(!err);
}
+/**
+ * SUBTEST: enable-vfs-bind-all-unbind-all
+ * Description:
+ * Verify VFs enabling, binding the driver and then unbinding it from all of them
+ */
+static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
+{
+ igt_debug("Using num_vfs=%u\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+ igt_warn_on(!igt_sriov_disable_driver_autoprobe(pf_fd));
+ igt_skip_on(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
+
+ igt_warn_on(!igt_sriov_enable_vfs(pf_fd, num_vfs));
+ igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(pf_fd));
+ igt_warn_on(!igt_sriov_enable_driver_autoprobe(pf_fd));
+ igt_assert(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ igt_assert(igt_sriov_bind_vf_drm_driver(pf_fd, i));
+ igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(igt_sriov_unbind_vf_drm_driver(pf_fd, i));
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ igt_assert(igt_sriov_disable_vfs(pf_fd));
+}
+
igt_main
{
int pf_fd;
@@ -113,6 +145,25 @@ igt_main
}
}
+ igt_describe("Verify VFs enabling, binding the driver and then unbinding it from all of them");
+ igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ }
+
igt_fixture {
igt_sriov_disable_vfs(pf_fd);
/* abort to avoid execution of next tests with enabled VFs */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-06 19:59 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
@ 2023-11-06 22:59 ` Michal Wajdeczko
2023-11-09 7:06 ` Laguna, Lukasz
0 siblings, 1 reply; 22+ messages in thread
From: Michal Wajdeczko @ 2023-11-06 22:59 UTC (permalink / raw)
To: Lukasz Laguna, igt-dev
On 06.11.2023 20:59, Lukasz Laguna wrote:
> From: Katarzyna Dec <katarzyna.dec@intel.com>
>
> Test enables VFs in range <1..totalvfs>, bind driver to all of them and
> then unbind driver from all of them.
commit message seems outdated
>
> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> ---
> tests/sriov_basic.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
>
> diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
> index fc0914962..179731daf 100644
> --- a/tests/sriov_basic.c
> +++ b/tests/sriov_basic.c
> @@ -61,6 +61,38 @@ static void probe_disable_vfs(int pf_fd, unsigned int num_vfs)
> igt_assert(!err);
> }
>
> +/**
> + * SUBTEST: enable-vfs-bind-all-unbind-all
> + * Description:
> + * Verify VFs enabling, binding the driver and then unbinding it from all of them
> + */
> +static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
> +{
> + igt_debug("Using num_vfs=%u\n", num_vfs);
nit: "Testing %u VFs" ?
> +
> + igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
duplicates main fixture
> + igt_warn_on(!igt_sriov_disable_driver_autoprobe(pf_fd));
> + igt_skip_on(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
why do we need warn/skip here ?
can't we just assert that 'disable' worked ?
> +
> + igt_warn_on(!igt_sriov_enable_vfs(pf_fd, num_vfs));
can't we just assert ?
> + igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(pf_fd));
why we care here ? if not all are enabled then we fail just later
and this is not a test for "enable VFs" that enabled==requested
> + igt_warn_on(!igt_sriov_enable_driver_autoprobe(pf_fd));
> + igt_assert(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
can't we just warn ?
if that we fail to enable then probe below will fail anyway
> +
> + for (int i = 1; i <= num_vfs; i++) {
> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
> + igt_assert(igt_sriov_bind_vf_drm_driver(pf_fd, i));
> + igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
shouldn't we just "expect" to make sure to call "disable VFs" ?
> + }
> +
> + for (int i = 1; i <= num_vfs; i++) {
> + igt_assert(igt_sriov_unbind_vf_drm_driver(pf_fd, i));
> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
do we need to have all VFs loaded ?
maybe for BAT test we can just bind/unload one VF at the time ?
otherwise it will be almost the same level of stress as in
"enable-vfs-autoprobe-on" but with 'manual probe' loop of all VFs
> + }
> +
> + igt_assert(igt_sriov_disable_vfs(pf_fd));
> +}
> +
> igt_main
> {
> int pf_fd;
> @@ -113,6 +145,25 @@ igt_main
> }
> }
>
> + igt_describe("Verify VFs enabling, binding the driver and then unbinding it from all of them");
> + igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
> + for_each_num_vfs(pf_fd, num_vfs) {
> + igt_dynamic_f("numvfs-%u", num_vfs) {
> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
> + }
> + }
> + for_random_num_vfs(pf_fd, num_vfs) {
> + igt_dynamic_f("numvfs-random") {
> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
> + }
> + }
> + for_max_num_vfs(pf_fd, num_vfs) {
> + igt_dynamic_f("numvfs-all") {
> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
> + }
> + }
> + }
> +
> igt_fixture {
> igt_sriov_disable_vfs(pf_fd);
> /* abort to avoid execution of next tests with enabled VFs */
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-09 6:51 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
@ 2023-11-09 6:51 ` Lukasz Laguna
0 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-09 6:51 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Test enables VFs in range <1..totalvfs>, bind driver to all of them and
then unbind driver from all of them.
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
---
tests/sriov_basic.c | 48 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
index 8717d2186..a10b7a290 100644
--- a/tests/sriov_basic.c
+++ b/tests/sriov_basic.c
@@ -59,6 +59,35 @@ static void enable_vfs_autoprobe_on(int pf_fd, unsigned int num_vfs)
igt_assert(!err);
}
+/**
+ * SUBTEST: enable-vfs-bind-all-unbind-all
+ * Description:
+ * Verify VFs enabling, binding the driver and then unbinding it from all of them
+ */
+static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
+{
+ igt_debug("Testing %u VFs\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+
+ igt_assert(igt_sriov_disable_driver_autoprobe(pf_fd));
+ igt_assert(igt_sriov_enable_vfs(pf_fd, num_vfs));
+ igt_assert(igt_sriov_enable_driver_autoprobe(pf_fd));
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ igt_assert(igt_sriov_bind_vf_drm_driver(pf_fd, i));
+ igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(igt_sriov_unbind_vf_drm_driver(pf_fd, i));
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ igt_assert(igt_sriov_disable_vfs(pf_fd));
+}
+
igt_main
{
int pf_fd;
@@ -111,6 +140,25 @@ igt_main
}
}
+ igt_describe("Verify VFs enabling, binding the driver and then unbinding it from all of them");
+ igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ }
+
igt_fixture {
igt_sriov_disable_vfs(pf_fd);
/* abort to avoid execution of next tests with enabled VFs */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-06 22:59 ` Michal Wajdeczko
@ 2023-11-09 7:06 ` Laguna, Lukasz
2023-11-10 19:44 ` Michal Wajdeczko
0 siblings, 1 reply; 22+ messages in thread
From: Laguna, Lukasz @ 2023-11-09 7:06 UTC (permalink / raw)
To: Michal Wajdeczko, igt-dev
On 11/6/2023 23:59, Michal Wajdeczko wrote:
>
> On 06.11.2023 20:59, Lukasz Laguna wrote:
>> From: Katarzyna Dec <katarzyna.dec@intel.com>
>>
>> Test enables VFs in range <1..totalvfs>, bind driver to all of them and
>> then unbind driver from all of them.
> commit message seems outdated
What do you mean? I don't see anything wrong
>
>> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
>> Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
>> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
>> Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>> ---
>> tests/sriov_basic.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 51 insertions(+)
>>
>> diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
>> index fc0914962..179731daf 100644
>> --- a/tests/sriov_basic.c
>> +++ b/tests/sriov_basic.c
>> @@ -61,6 +61,38 @@ static void probe_disable_vfs(int pf_fd, unsigned int num_vfs)
>> igt_assert(!err);
>> }
>>
>> +/**
>> + * SUBTEST: enable-vfs-bind-all-unbind-all
>> + * Description:
>> + * Verify VFs enabling, binding the driver and then unbinding it from all of them
>> + */
>> +static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
>> +{
>> + igt_debug("Using num_vfs=%u\n", num_vfs);
> nit: "Testing %u VFs" ?
Done
>
>> +
>> + igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
> duplicates main fixture
As already answered in different patch - first fixtureis not executed
between dynamic subtests.
>
>> + igt_warn_on(!igt_sriov_disable_driver_autoprobe(pf_fd));
>> + igt_skip_on(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
> why do we need warn/skip here ?
> can't we just assert that 'disable' worked ?
Done
>
>> +
>> + igt_warn_on(!igt_sriov_enable_vfs(pf_fd, num_vfs));
> can't we just assert ?
Done
>
>> + igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(pf_fd));
> why we care here ? if not all are enabled then we fail just later
> and this is not a test for "enable VFs" that enabled==requested
Done
>
>> + igt_warn_on(!igt_sriov_enable_driver_autoprobe(pf_fd));
>> + igt_assert(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
> can't we just warn ?
> if that we fail to enable then probe below will fail anyway
Done
>
>> +
>> + for (int i = 1; i <= num_vfs; i++) {
>> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
>> + igt_assert(igt_sriov_bind_vf_drm_driver(pf_fd, i));
>> + igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
> shouldn't we just "expect" to make sure to call "disable VFs" ?
VFs will be disabled in exit fixture. VFs disabling in subtest is needed
between dynamic subtests.
>
>> + }
>> +
>> + for (int i = 1; i <= num_vfs; i++) {
>> + igt_assert(igt_sriov_unbind_vf_drm_driver(pf_fd, i));
>> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
> do we need to have all VFs loaded ?
> maybe for BAT test we can just bind/unload one VF at the time ?
We have such test as well:
[PATCH i-g-t 8/8] tests/sriov_basic: add more tests for VF driver binding
SUBTEST: enable-vfs-bind-unbind-each
SUBTEST: bind-unbind-vf
>
> otherwise it will be almost the same level of stress as in
> "enable-vfs-autoprobe-on" but with 'manual probe' loop of all VFs
>
>> + }
>> +
>> + igt_assert(igt_sriov_disable_vfs(pf_fd));
>> +}
>> +
>> igt_main
>> {
>> int pf_fd;
>> @@ -113,6 +145,25 @@ igt_main
>> }
>> }
>>
>> + igt_describe("Verify VFs enabling, binding the driver and then unbinding it from all of them");
>> + igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
>> + for_each_num_vfs(pf_fd, num_vfs) {
>> + igt_dynamic_f("numvfs-%u", num_vfs) {
>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>> + }
>> + }
>> + for_random_num_vfs(pf_fd, num_vfs) {
>> + igt_dynamic_f("numvfs-random") {
>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>> + }
>> + }
>> + for_max_num_vfs(pf_fd, num_vfs) {
>> + igt_dynamic_f("numvfs-all") {
>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>> + }
>> + }
>> + }
>> +
>> igt_fixture {
>> igt_sriov_disable_vfs(pf_fd);
>> /* abort to avoid execution of next tests with enabled VFs */
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-09 7:06 ` Laguna, Lukasz
@ 2023-11-10 19:44 ` Michal Wajdeczko
2023-11-20 14:31 ` Laguna, Lukasz
0 siblings, 1 reply; 22+ messages in thread
From: Michal Wajdeczko @ 2023-11-10 19:44 UTC (permalink / raw)
To: Laguna, Lukasz, igt-dev
On 09.11.2023 08:06, Laguna, Lukasz wrote:
>
> On 11/6/2023 23:59, Michal Wajdeczko wrote:
>>
>> On 06.11.2023 20:59, Lukasz Laguna wrote:
>>> From: Katarzyna Dec <katarzyna.dec@intel.com>
>>>
>>> Test enables VFs in range <1..totalvfs>, bind driver to all of them and
>>> then unbind driver from all of them.
>> commit message seems outdated
> What do you mean? I don't see anything wrong
>>
>>> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
>>> Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
>>> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
>>> Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>>> ---
>>> tests/sriov_basic.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 51 insertions(+)
>>>
>>> diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
>>> index fc0914962..179731daf 100644
>>> --- a/tests/sriov_basic.c
>>> +++ b/tests/sriov_basic.c
>>> @@ -61,6 +61,38 @@ static void probe_disable_vfs(int pf_fd, unsigned
>>> int num_vfs)
>>> igt_assert(!err);
>>> }
>>> +/**
>>> + * SUBTEST: enable-vfs-bind-all-unbind-all
>>> + * Description:
>>> + * Verify VFs enabling, binding the driver and then unbinding it
>>> from all of them
>>> + */
>>> +static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int
>>> num_vfs)
>>> +{
>>> + igt_debug("Using num_vfs=%u\n", num_vfs);
>> nit: "Testing %u VFs" ?
> Done
>>
>>> +
>>> + igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
>> duplicates main fixture
> As already answered in different patch - first fixtureis not executed
> between dynamic subtests.
>>
>>> + igt_warn_on(!igt_sriov_disable_driver_autoprobe(pf_fd));
>>> + igt_skip_on(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
>> why do we need warn/skip here ?
>> can't we just assert that 'disable' worked ?
> Done
>>
>>> +
>>> + igt_warn_on(!igt_sriov_enable_vfs(pf_fd, num_vfs));
>> can't we just assert ?
> Done
>>
>>> + igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(pf_fd));
>> why we care here ? if not all are enabled then we fail just later
>> and this is not a test for "enable VFs" that enabled==requested
> Done
>>
>>> + igt_warn_on(!igt_sriov_enable_driver_autoprobe(pf_fd));
>>> + igt_assert(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
>> can't we just warn ?
>> if that we fail to enable then probe below will fail anyway
> Done
>>
>>> +
>>> + for (int i = 1; i <= num_vfs; i++) {
>>> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
>>> + igt_assert(igt_sriov_bind_vf_drm_driver(pf_fd, i));
>>> + igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
>> shouldn't we just "expect" to make sure to call "disable VFs" ?
> VFs will be disabled in exit fixture. VFs disabling in subtest is needed
> between dynamic subtests.
but if test passed, then it should do a proper cleanup
maybe problem is that if something went wrong, your igt_assert() aborts
current test which doesn't have a chance to do proper cleanup ?
or maybe that cleanup should be in some mid-test fixture ?
anyway, just seems broken that we need to duplicate the code/logic every
time
>>
>>> + }
>>> +
>>> + for (int i = 1; i <= num_vfs; i++) {
>>> + igt_assert(igt_sriov_unbind_vf_drm_driver(pf_fd, i));
>>> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
>> do we need to have all VFs loaded ?
>> maybe for BAT test we can just bind/unload one VF at the time ?
> We have such test as well:
> [PATCH i-g-t 8/8] tests/sriov_basic: add more tests for VF driver binding
> SUBTEST: enable-vfs-bind-unbind-each
> SUBTEST: bind-unbind-vf
that's good
but the question is still open?
what the benefit of having this test which just open-coded the VF probe
loop that would be otherwise done by the PCI subsystem ?
and again, like autoprobe-on, this doesn't seem good candidate for "BAT"
runs, more like a "STRESS"
>>
>> otherwise it will be almost the same level of stress as in
>> "enable-vfs-autoprobe-on" but with 'manual probe' loop of all VFs
>>
>>> + }
>>> +
>>> + igt_assert(igt_sriov_disable_vfs(pf_fd));
>>> +}
>>> +
>>> igt_main
>>> {
>>> int pf_fd;
>>> @@ -113,6 +145,25 @@ igt_main
>>> }
>>> }
>>> + igt_describe("Verify VFs enabling, binding the driver and then
>>> unbinding it from all of them");
>>> + igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
>>> + for_each_num_vfs(pf_fd, num_vfs) {
>>> + igt_dynamic_f("numvfs-%u", num_vfs) {
>>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>>> + }
>>> + }
>>> + for_random_num_vfs(pf_fd, num_vfs) {
>>> + igt_dynamic_f("numvfs-random") {
>>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>>> + }
>>> + }
>>> + for_max_num_vfs(pf_fd, num_vfs) {
>>> + igt_dynamic_f("numvfs-all") {
>>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>>> + }
>>> + }
>>> + }
>>> +
>>> igt_fixture {
>>> igt_sriov_disable_vfs(pf_fd);
>>> /* abort to avoid execution of next tests with enabled VFs */
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation
@ 2023-11-20 14:14 Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 1/8] lib/igt_sriov_device: add core SR-IOV helpers Lukasz Laguna
` (10 more replies)
0 siblings, 11 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
Series introduces a basic SR-IOV test that validates VFs enabling in
different scenarios together with VF DRM driver binding. Implemented
library helpers rely on generic PCI device attributes defined in ABI.
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
Daniel Mrzyglod (1):
lib/igt_sriov_device: add helper for checking if VF DRM driver is
probed
Katarzyna Dec (4):
lib/igt_sriov_device: add core SR-IOV helpers
lib/igt_sriov_device: add helper for opening VF device
tests/sriov_basic: add basic tests for enabling SR-IOV VFs
tests/sriov_basic: validate driver binding to VFs
Lukasz Laguna (3):
lib/igt_sriov_device: add helpers for operations in different VFs
scenarios
lib/igt_sriov_device: add helpers for VF DRM driver bind and unbind
tests/sriov_basic: add more tests for VF driver binding
lib/drmtest.c | 17 +-
lib/drmtest.h | 1 +
lib/igt_sriov_device.c | 341 +++++++++++++++++++++++++++++++++++++++++
lib/igt_sriov_device.h | 74 +++++++++
lib/meson.build | 1 +
tests/meson.build | 1 +
tests/sriov_basic.c | 262 +++++++++++++++++++++++++++++++
7 files changed, 693 insertions(+), 4 deletions(-)
create mode 100644 lib/igt_sriov_device.c
create mode 100644 lib/igt_sriov_device.h
create mode 100644 tests/sriov_basic.c
--
2.40.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 1/8] lib/igt_sriov_device: add core SR-IOV helpers
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 2/8] lib/igt_sriov_device: add helper for opening VF device Lukasz Laguna
` (9 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Create lib for core SR-IOV (Single Root I/O Virtualization) helpers
that allow to manage SR-IOV devices.
v2:
- change functions description (Michal)
v3:
- decipher SR-IOV shortcut in commit message (Kamil)
- add SR-IOV description in header file (Kamil)
- remove old r-b and add cc (Kamil)
- return bool result in functions prefixed with "__" (Kamil)
- add brief description in functions documentation (Michal)
- add asserts in helpers (Michal)
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
lib/igt_sriov_device.c | 213 +++++++++++++++++++++++++++++++++++++++++
lib/igt_sriov_device.h | 29 ++++++
lib/meson.build | 1 +
3 files changed, 243 insertions(+)
create mode 100644 lib/igt_sriov_device.c
create mode 100644 lib/igt_sriov_device.h
diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
new file mode 100644
index 000000000..c5c594c2c
--- /dev/null
+++ b/lib/igt_sriov_device.c
@@ -0,0 +1,213 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright(c) 2023 Intel Corporation. All rights reserved.
+ */
+
+#include <errno.h>
+
+#include "igt_core.h"
+#include "igt_sriov_device.h"
+#include "igt_sysfs.h"
+
+/**
+ * igt_sriov_is_pf - Check if device is PF
+ * @device: device file descriptor
+ *
+ * Determine if device is PF by checking existence of sriov_totalvfs file.
+ *
+ * Return:
+ * True if device is PF, false otherwise.
+ */
+bool igt_sriov_is_pf(int device)
+{
+ int sysfs;
+ bool ret;
+
+ sysfs = igt_sysfs_open(device);
+ igt_assert_fd(sysfs);
+
+ ret = igt_sysfs_has_attr(sysfs, "device/sriov_totalvfs");
+ close(sysfs);
+
+ return ret;
+}
+
+static bool __pf_attr_get_u32(int pf, const char *attr, uint32_t *value)
+{
+ int sysfs;
+ bool ret;
+
+ igt_assert(igt_sriov_is_pf(pf));
+
+ sysfs = igt_sysfs_open(pf);
+ igt_assert_fd(sysfs);
+
+ ret = __igt_sysfs_get_u32(sysfs, attr, value);
+ close(sysfs);
+
+ return ret;
+}
+
+static uint32_t pf_attr_get_u32(int pf, const char *attr)
+{
+ uint32_t value;
+
+ igt_assert_f(__pf_attr_get_u32(pf, attr, &value),
+ "Failed to read %s attribute (%s)\n", attr, strerror(errno));
+
+ return value;
+}
+
+static bool __pf_attr_set_u32(int pf, const char *attr, uint32_t value)
+{
+ int sysfs;
+ bool ret;
+
+ igt_assert(igt_sriov_is_pf(pf));
+
+ sysfs = igt_sysfs_open(pf);
+ igt_assert_fd(sysfs);
+
+ ret = __igt_sysfs_set_u32(sysfs, attr, value);
+ close(sysfs);
+
+ return ret;
+}
+
+static void pf_attr_set_u32(int pf, const char *attr, uint32_t value)
+{
+ igt_assert_f(__pf_attr_set_u32(pf, attr, value),
+ "Failed to write %u to %s attribute (%s)\n", value, attr, strerror(errno));
+}
+
+/**
+ * igt_sriov_vfs_supported - Check if VFs are supported
+ * @pf: PF device file descriptor
+ *
+ * Determine VFs support by checking if value of sriov_totalvfs attribute
+ * corresponding to @pf device is bigger than 0.
+ *
+ * Return:
+ * True if VFs are supported, false otherwise.
+ */
+bool igt_sriov_vfs_supported(int pf)
+{
+ uint32_t totalvfs;
+
+ if (!__pf_attr_get_u32(pf, "device/sriov_totalvfs", &totalvfs))
+ return false;
+
+ return totalvfs > 0;
+}
+
+/**
+ * igt_sriov_get_totalvfs - Get maximum number of VFs that can be enabled
+ * @pf: PF device file descriptor
+ *
+ * Maximum number of VFs that can be enabled is checked by reading
+ * sriov_totalvfs attribute corresponding to @pf device.
+ *
+ * It asserts on failure.
+ *
+ * Return:
+ * Maximum number of VFs that can be associated with given PF.
+ */
+unsigned int igt_sriov_get_total_vfs(int pf)
+{
+ return pf_attr_get_u32(pf, "device/sriov_totalvfs");
+}
+
+/**
+ * igt_sriov_get_numvfs - Get number of enabled VFs
+ * @pf: PF device file descriptor
+ *
+ * Number of enabled VFs is checked by reading sriov_numvfs attribute
+ * corresponding to @pf device.
+ *
+ * It asserts on failure.
+ *
+ * Return:
+ * Number of VFs enabled by given PF.
+ */
+unsigned int igt_sriov_get_enabled_vfs(int pf)
+{
+ return pf_attr_get_u32(pf, "device/sriov_numvfs");
+}
+
+/**
+ * igt_sriov_enable_vfs - Enable VFs
+ * @pf: PF device file descriptor
+ * @num_vfs: Number of virtual functions to be enabled
+ *
+ * Enable VFs by writing @num_vfs to sriov_numvfs attribute corresponding to
+ * @pf device.
+ * It asserts on failure.
+ */
+void igt_sriov_enable_vfs(int pf, unsigned int num_vfs)
+{
+ igt_assert(num_vfs > 0);
+
+ igt_debug("Enabling %u VFs\n", num_vfs);
+ pf_attr_set_u32(pf, "device/sriov_numvfs", num_vfs);
+}
+
+/**
+ * igt_sriov_disable_vfs - Disable VFs
+ * @pf: PF device file descriptor
+ *
+ * Disable VFs by writing 0 to sriov_numvfs attribute corresponding to @pf
+ * device.
+ * It asserts on failure.
+ */
+void igt_sriov_disable_vfs(int pf)
+{
+ pf_attr_set_u32(pf, "device/sriov_numvfs", 0);
+}
+
+/**
+ * igt_sriov_is_driver_autoprobe_enabled - Get VF driver autoprobe setting
+ * @pf: PF device file descriptor
+ *
+ * Get current VF driver autoprobe setting by reading sriov_drivers_autoprobe
+ * attribute corresponding to @pf device.
+ *
+ * It asserts on failure.
+ *
+ * Return:
+ * True if autoprobe is enabled, false otherwise.
+ */
+bool igt_sriov_is_driver_autoprobe_enabled(int pf)
+{
+ return pf_attr_get_u32(pf, "device/sriov_drivers_autoprobe");
+}
+
+/**
+ * igt_sriov_enable_driver_autoprobe - Enable VF driver autoprobe
+ * @pf: PF device file descriptor
+ *
+ * Enable VF driver autoprobe setting by writing 1 to sriov_drivers_autoprobe
+ * attribute corresponding to @pf device.
+ *
+ * If successful, kernel will automatically bind VFs to a compatible driver
+ * immediately after they are enabled.
+ * It asserts on failure.
+ */
+void igt_sriov_enable_driver_autoprobe(int pf)
+{
+ pf_attr_set_u32(pf, "device/sriov_drivers_autoprobe", true);
+}
+
+/**
+ * igt_sriov_disable_driver_autoprobe - Disable VF driver autoprobe
+ * @pf: PF device file descriptor
+ *
+ * Disable VF driver autoprobe setting by writing 0 to sriov_drivers_autoprobe
+ * attribute corresponding to @pf device.
+ *
+ * During VFs enabling driver won't be bound to VFs.
+ * It asserts on failure.
+ */
+void igt_sriov_disable_driver_autoprobe(int pf)
+{
+ pf_attr_set_u32(pf, "device/sriov_drivers_autoprobe", false);
+}
diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
new file mode 100644
index 000000000..337fdf84b
--- /dev/null
+++ b/lib/igt_sriov_device.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright(c) 2023 Intel Corporation. All rights reserved.
+ */
+
+#ifndef __IGT_SRIOV_DEVICE_H__
+#define __IGT_SRIOV_DEVICE_H__
+
+/* Library for managing SR-IOV (Single Root I/O Virtualization)
+ * devices.
+ *
+ * SR-IOV is a specification that allows a single PCIe physical
+ * device to appear as a physical function (PF) and multiple virtual
+ * functions (VFs) to the operating system.
+ */
+
+#include <stdint.h>
+
+bool igt_sriov_is_pf(int device);
+bool igt_sriov_vfs_supported(int pf);
+unsigned int igt_sriov_get_total_vfs(int pf);
+unsigned int igt_sriov_get_enabled_vfs(int pf);
+void igt_sriov_enable_vfs(int pf, unsigned int num_vfs);
+void igt_sriov_disable_vfs(int pf);
+bool igt_sriov_is_driver_autoprobe_enabled(int pf);
+void igt_sriov_enable_driver_autoprobe(int pf);
+void igt_sriov_disable_driver_autoprobe(int pf);
+
+#endif /* __IGT_SRIOV_DEVICE_H__ */
diff --git a/lib/meson.build b/lib/meson.build
index a7bccafc3..083baa68a 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -38,6 +38,7 @@ lib_sources = [
'igt_primes.c',
'igt_pci.c',
'igt_rand.c',
+ 'igt_sriov_device.c',
'igt_stats.c',
'igt_syncobj.c',
'igt_sysfs.c',
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 2/8] lib/igt_sriov_device: add helper for opening VF device
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 1/8] lib/igt_sriov_device: add core SR-IOV helpers Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-23 9:21 ` Kamil Konieczny
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 3/8] lib/igt_sriov_device: add helper for checking if VF DRM driver is probed Lukasz Laguna
` (8 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Helper opens DRM device node and returns its file descriptor.
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
lib/drmtest.c | 17 +++++++++++----
lib/drmtest.h | 1 +
lib/igt_sriov_device.c | 47 ++++++++++++++++++++++++++++++++++++++++++
lib/igt_sriov_device.h | 1 +
4 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index f0b97e362..d8b7aace5 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -245,7 +245,16 @@ static void log_opened_device_path(const char *device_path)
igt_info("Opened device: %s\n", item->path);
}
-static int open_device(const char *name, unsigned int chipset)
+/**
+ * drm_open_device:
+ * @name: DRM node name
+ * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
+ *
+ * Open a drm legacy device node.
+ *
+ * Returns: DRM file descriptor or -1 on error
+ */
+int drm_open_device(const char *name, unsigned int chipset)
{
const char *forced;
char dev_name[16] = "";
@@ -350,7 +359,7 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset,
if (_is_already_opened(name, as_idx))
continue;
- fd = open_device(name, chipset);
+ fd = drm_open_device(name, chipset);
if (fd != -1)
return fd;
}
@@ -392,13 +401,13 @@ static int __open_driver_exact(const char *name, unsigned int chipset)
{
int fd;
- fd = open_device(name, chipset);
+ fd = drm_open_device(name, chipset);
if (fd != -1)
return fd;
drm_load_module(chipset);
- return open_device(name, chipset);
+ return drm_open_device(name, chipset);
}
/*
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 909a0c12c..9c040a136 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -98,6 +98,7 @@ void __set_forced_driver(const char *name);
*/
#define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
+int drm_open_device(const char *name, unsigned int chipset);
void drm_load_module(unsigned int chipset);
int drm_open_driver(int chipset);
int drm_open_driver_master(int chipset);
diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
index c5c594c2c..cd00c7c5d 100644
--- a/lib/igt_sriov_device.c
+++ b/lib/igt_sriov_device.c
@@ -3,8 +3,10 @@
* Copyright(c) 2023 Intel Corporation. All rights reserved.
*/
+#include <dirent.h>
#include <errno.h>
+#include "drmtest.h"
#include "igt_core.h"
#include "igt_sriov_device.h"
#include "igt_sysfs.h"
@@ -211,3 +213,48 @@ void igt_sriov_disable_driver_autoprobe(int pf)
{
pf_attr_set_u32(pf, "device/sriov_drivers_autoprobe", false);
}
+
+/**
+ * igt_sriov_open_vf_drm_device - Open VF DRM device node
+ * @pf: PF device file descriptor
+ * @vf_num: VF number (1-based to identify single VF)
+ *
+ * Open DRM device node for given VF.
+ *
+ * Return:
+ * VF file descriptor or -1 on error.
+ */
+int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num)
+{
+ char dir_path[PATH_MAX], path[PATH_MAX], dev_name[16];
+ DIR *dir;
+ struct dirent *de;
+ bool found = false;
+
+ igt_assert(vf_num > 0);
+
+ if (!igt_sysfs_path(pf, dir_path, sizeof(dir_path)))
+ return -1;
+ /* vf_num is 1-based, but virtfn is 0-based */
+ snprintf(path, sizeof(path), "/device/virtfn%u/drm", vf_num - 1);
+ strncat(dir_path, path, sizeof(dir_path) - strlen(dir_path));
+
+ dir = opendir(dir_path);
+ if (!dir)
+ return -1;
+ while ((de = readdir(dir))) {
+ unsigned int card_num;
+
+ if (sscanf(de->d_name, "card%d", &card_num) == 1) {
+ snprintf(dev_name, sizeof(dev_name), "/dev/dri/card%u", card_num);
+ found = true;
+ break;
+ }
+ }
+ closedir(dir);
+
+ if (!found)
+ return -1;
+
+ return drm_open_device(dev_name, DRIVER_ANY);
+}
diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
index 337fdf84b..4e57f0dcb 100644
--- a/lib/igt_sriov_device.h
+++ b/lib/igt_sriov_device.h
@@ -25,5 +25,6 @@ void igt_sriov_disable_vfs(int pf);
bool igt_sriov_is_driver_autoprobe_enabled(int pf);
void igt_sriov_enable_driver_autoprobe(int pf);
void igt_sriov_disable_driver_autoprobe(int pf);
+int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num);
#endif /* __IGT_SRIOV_DEVICE_H__ */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 3/8] lib/igt_sriov_device: add helper for checking if VF DRM driver is probed
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 1/8] lib/igt_sriov_device: add core SR-IOV helpers Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 2/8] lib/igt_sriov_device: add helper for opening VF device Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 4/8] lib/igt_sriov_device: add helpers for operations in different VFs scenarios Lukasz Laguna
` (7 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
From: Daniel Mrzyglod <daniel.t.mrzyglod@intel.com>
Probe check is based on existence of the DRM subsystem attribute in
sysfs.
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Daniel Mrzyglod <daniel.t.mrzyglod@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
lib/igt_sriov_device.c | 29 +++++++++++++++++++++++++++++
lib/igt_sriov_device.h | 1 +
2 files changed, 30 insertions(+)
diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
index cd00c7c5d..315de353a 100644
--- a/lib/igt_sriov_device.c
+++ b/lib/igt_sriov_device.c
@@ -258,3 +258,32 @@ int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num)
return drm_open_device(dev_name, DRIVER_ANY);
}
+
+/**
+ * igt_sriov_is_vf_drm_driver_probed - Check if VF DRM driver is probed
+ * @pf: PF device file descriptor
+ * @vf_num: VF number (1-based to identify single VF)
+ *
+ * Verify if DRM driver is bound to VF device. Probe check is based on
+ * existence of the DRM subsystem attribute in sysfs.
+ *
+ * Returns:
+ * True if VF has DRM driver loaded, false if not.
+ */
+bool igt_sriov_is_vf_drm_driver_probed(int pf, unsigned int vf_num)
+{
+ char path[PATH_MAX];
+ int sysfs;
+ bool ret;
+
+ igt_assert(vf_num > 0);
+
+ sysfs = igt_sysfs_open(pf);
+ igt_assert_fd(sysfs);
+ /* vf_num is 1-based, but virtfn is 0-based */
+ snprintf(path, sizeof(path), "device/virtfn%u/drm", vf_num - 1);
+ ret = igt_sysfs_has_attr(sysfs, path);
+ close(sysfs);
+
+ return ret;
+}
diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
index 4e57f0dcb..84f033f52 100644
--- a/lib/igt_sriov_device.h
+++ b/lib/igt_sriov_device.h
@@ -26,5 +26,6 @@ bool igt_sriov_is_driver_autoprobe_enabled(int pf);
void igt_sriov_enable_driver_autoprobe(int pf);
void igt_sriov_disable_driver_autoprobe(int pf);
int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num);
+bool igt_sriov_is_vf_drm_driver_probed(int pf, unsigned int vf_num);
#endif /* __IGT_SRIOV_DEVICE_H__ */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 4/8] lib/igt_sriov_device: add helpers for operations in different VFs scenarios
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (2 preceding siblings ...)
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 3/8] lib/igt_sriov_device: add helper for checking if VF DRM driver is probed Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 5/8] tests/sriov_basic: add basic tests for enabling SR-IOV VFs Lukasz Laguna
` (6 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
Added helpers:
- for_each_vf and for_each_num_vfs
- for_random_vf and for_random_num_vfs
- for_last_vf and for_max_num_vfs
v2:
- document helpers (Michal)
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
lib/igt_sriov_device.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
index 84f033f52..3ab984720 100644
--- a/lib/igt_sriov_device.h
+++ b/lib/igt_sriov_device.h
@@ -28,4 +28,45 @@ void igt_sriov_disable_driver_autoprobe(int pf);
int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num);
bool igt_sriov_is_vf_drm_driver_probed(int pf, unsigned int vf_num);
+/**
+ * for_each_vf - Helper for running code on each VF
+ * @__pf_fd: PF device file descriptor
+ * @__vf_num: VFs iterator
+ *
+ * For loop that iterates over all VFs associated with given PF @__pf_fd.
+ */
+#define for_each_vf(__pf_fd, __vf_num) \
+ for (unsigned int __vf_num = 1, __total_vfs = igt_sriov_get_total_vfs(__pf_fd); \
+ __vf_num <= __total_vfs; \
+ ++__vf_num)
+#define for_each_num_vfs for_each_vf
+
+/**
+ * for_random_vf - Helper for running code on random VF
+ * @__pf_fd: PF device file descriptor
+ * @__vf_num: stores random VF
+ *
+ * Helper allows to run code using random VF number (stored in @__vf_num)
+ * picked from the range of all VFs associated with given PF @__pf_fd.
+ */
+#define for_random_vf(__pf_fd, __vf_num) \
+ for (unsigned int __vf_num = 1 + random() % igt_sriov_get_total_vfs(__pf_fd), __tmp = 0; \
+ __tmp < 1; \
+ ++__tmp)
+#define for_random_num_vfs for_random_vf
+
+/**
+ * for_last_vf - Helper for running code on last VF
+ * @__pf_fd: PF device file descriptor
+ * @__vf_num: stores last VF number
+ *
+ * Helper allows to run code using last VF number (stored in @__vf_num)
+ * associated with given PF @__pf_fd.
+ */
+#define for_last_vf(__pf_fd, __vf_num) \
+ for (unsigned int __vf_num = igt_sriov_get_total_vfs(__pf_fd), __tmp = 0; \
+ __tmp < 1; \
+ ++__tmp)
+#define for_max_num_vfs for_last_vf
+
#endif /* __IGT_SRIOV_DEVICE_H__ */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 5/8] tests/sriov_basic: add basic tests for enabling SR-IOV VFs
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (3 preceding siblings ...)
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 4/8] lib/igt_sriov_device: add helpers for operations in different VFs scenarios Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 6/8] lib/igt_sriov_device: add helpers for VF DRM driver bind and unbind Lukasz Laguna
` (5 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Add subtests that validate SR-IOV VFs enabling in two variants: with
autoprobe disabled and enabled.
v2:
- rename function (Michal)
- remove checks that are outside the scope of the test (Michal)
v3:
- change run type of enable-vfs-autoprobe-on subtest (Michal)
- don't init random seed in test code (Michal)
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
tests/meson.build | 1 +
tests/sriov_basic.c | 123 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+)
create mode 100644 tests/sriov_basic.c
diff --git a/tests/meson.build b/tests/meson.build
index 3e4d54601..928753098 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -71,6 +71,7 @@ test_progs = [
'panfrost_submit',
'prime_udl',
'prime_vgem',
+ 'sriov_basic',
'syncobj_basic',
'syncobj_eventfd',
'syncobj_wait',
diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
new file mode 100644
index 000000000..ce75f4198
--- /dev/null
+++ b/tests/sriov_basic.c
@@ -0,0 +1,123 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright(c) 2023 Intel Corporation. All rights reserved.
+ */
+
+#include "drmtest.h"
+#include "igt_core.h"
+#include "igt_sriov_device.h"
+
+IGT_TEST_DESCRIPTION("Basic tests for enabling SR-IOV Virtual Functions");
+
+/**
+ * TEST: sriov_basic
+ * Category: Software building block
+ * Mega feature: SR-IOV
+ * Sub-category: VFs enabling
+ * Description: Validate SR-IOV VFs enabling
+ */
+
+/**
+ * SUBTEST: enable-vfs-autoprobe-off
+ * Description:
+ * Verify VFs enabling without probing VF driver
+ * Run type: BAT
+ */
+static void enable_vfs_autoprobe_off(int pf_fd, unsigned int num_vfs)
+{
+ igt_debug("Testing %u VFs\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+ igt_sriov_disable_driver_autoprobe(pf_fd);
+ igt_sriov_enable_vfs(pf_fd, num_vfs);
+ igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(pf_fd));
+ igt_sriov_disable_vfs(pf_fd);
+}
+
+/**
+ * SUBTEST: enable-vfs-autoprobe-on
+ * Description:
+ * Verify VFs enabling and auto-probing VF driver
+ * Run type: FULL
+ */
+static void enable_vfs_autoprobe_on(int pf_fd, unsigned int num_vfs)
+{
+ bool err = false;
+
+ igt_debug("Testing %u VFs\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+ igt_sriov_enable_driver_autoprobe(pf_fd);
+ igt_sriov_enable_vfs(pf_fd, num_vfs);
+ igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(pf_fd));
+ for (int vf_num = 1; vf_num <= num_vfs; ++vf_num) {
+ if (!igt_sriov_is_vf_drm_driver_probed(pf_fd, vf_num)) {
+ igt_debug("VF%u probe failed\n", vf_num);
+ err = true;
+ }
+ }
+ igt_sriov_disable_vfs(pf_fd);
+ igt_assert(!err);
+}
+
+igt_main
+{
+ int pf_fd;
+ bool autoprobe;
+
+ igt_fixture {
+ pf_fd = drm_open_driver(DRIVER_ANY);
+ igt_require(igt_sriov_is_pf(pf_fd));
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+ autoprobe = igt_sriov_is_driver_autoprobe_enabled(pf_fd);
+ }
+
+ igt_describe("Verify VFs enabling without probing VF driver");
+ igt_subtest_with_dynamic("enable-vfs-autoprobe-off") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_autoprobe_off(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_autoprobe_off(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_autoprobe_off(pf_fd, num_vfs);
+ }
+ }
+ }
+
+ igt_describe("Verify VFs enabling and auto-probing VF driver");
+ igt_subtest_with_dynamic("enable-vfs-autoprobe-on") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_autoprobe_on(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_autoprobe_on(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_autoprobe_on(pf_fd, num_vfs);
+ }
+ }
+ }
+
+ igt_fixture {
+ igt_sriov_disable_vfs(pf_fd);
+ /* abort to avoid execution of next tests with enabled VFs */
+ igt_abort_on_f(igt_sriov_get_enabled_vfs(pf_fd) > 0, "Failed to disable VF(s)");
+ autoprobe ? igt_sriov_enable_driver_autoprobe(pf_fd) :
+ igt_sriov_disable_driver_autoprobe(pf_fd);
+ igt_abort_on_f(autoprobe != igt_sriov_is_driver_autoprobe_enabled(pf_fd),
+ "Failed to restore sriov_drivers_autoprobe value\n");
+ close(pf_fd);
+ }
+}
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 6/8] lib/igt_sriov_device: add helpers for VF DRM driver bind and unbind
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (4 preceding siblings ...)
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 5/8] tests/sriov_basic: add basic tests for enabling SR-IOV VFs Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
` (4 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
Helpers allow to bind and unbind a DRM driver for specified VF of a
given PF device.
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
lib/igt_sriov_device.c | 52 ++++++++++++++++++++++++++++++++++++++++++
lib/igt_sriov_device.h | 2 ++
2 files changed, 54 insertions(+)
diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
index 315de353a..c53f8696f 100644
--- a/lib/igt_sriov_device.c
+++ b/lib/igt_sriov_device.c
@@ -5,9 +5,11 @@
#include <dirent.h>
#include <errno.h>
+#include <pciaccess.h>
#include "drmtest.h"
#include "igt_core.h"
+#include "igt_device.h"
#include "igt_sriov_device.h"
#include "igt_sysfs.h"
@@ -287,3 +289,53 @@ bool igt_sriov_is_vf_drm_driver_probed(int pf, unsigned int vf_num)
return ret;
}
+
+static bool __igt_sriov_bind_vf_drm_driver(int pf, unsigned int vf_num, bool bind)
+{
+ int sysfs, ret;
+ struct pci_device *pci_dev;
+ char pci_slot[14];
+
+ igt_assert(vf_num > 0);
+
+ pci_dev = __igt_device_get_pci_device(pf, vf_num);
+ igt_assert_f(pci_dev, "No PCI device for given VF number: %d\n", vf_num);
+ sprintf(pci_slot, "%04x:%02x:%02x.%x",
+ pci_dev->domain_16, pci_dev->bus, pci_dev->dev, pci_dev->func);
+
+ sysfs = igt_sysfs_open(pf);
+ igt_assert_fd(sysfs);
+
+ igt_debug("vf_num: %u, pci_slot: %s\n", vf_num, pci_slot);
+ ret = igt_sysfs_set(sysfs, bind ? "device/driver/bind" : "device/driver/unbind", pci_slot);
+
+ close(sysfs);
+
+ return ret;
+}
+
+/**
+ * igt_sriov_bind_vf_drm_driver - Bind DRM driver to VF
+ * @pf: PF device file descriptor
+ * @vf_num: VF number (1-based to identify single VF)
+ *
+ * Bind the DRM driver to given VF.
+ * It asserts on failure.
+ */
+void igt_sriov_bind_vf_drm_driver(int pf, unsigned int vf_num)
+{
+ igt_assert(__igt_sriov_bind_vf_drm_driver(pf, vf_num, true));
+}
+
+/**
+ * igt_sriov_unbind_vf_drm_driver - Unbind DRM driver from VF
+ * @pf: PF device file descriptor
+ * @vf_num: VF number (1-based to identify single VF)
+ *
+ * Unbind the DRM driver from given VF.
+ * It asserts on failure.
+ */
+void igt_sriov_unbind_vf_drm_driver(int pf, unsigned int vf_num)
+{
+ igt_assert(__igt_sriov_bind_vf_drm_driver(pf, vf_num, false));
+}
diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
index 3ab984720..354beb23d 100644
--- a/lib/igt_sriov_device.h
+++ b/lib/igt_sriov_device.h
@@ -27,6 +27,8 @@ void igt_sriov_enable_driver_autoprobe(int pf);
void igt_sriov_disable_driver_autoprobe(int pf);
int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num);
bool igt_sriov_is_vf_drm_driver_probed(int pf, unsigned int vf_num);
+void igt_sriov_bind_vf_drm_driver(int pf, unsigned int vf_num);
+void igt_sriov_unbind_vf_drm_driver(int pf, unsigned int vf_num);
/**
* for_each_vf - Helper for running code on each VF
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (5 preceding siblings ...)
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 6/8] lib/igt_sriov_device: add helpers for VF DRM driver bind and unbind Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 8/8] tests/sriov_basic: add more tests for VF driver binding Lukasz Laguna
` (3 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Test enables VFs in range <1..totalvfs>, bind driver to all of them and
then unbind driver from all of them.
v2:
- remove checks that are outside the scope of the test (Michal)
- change subtest run type (Michal)
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
tests/sriov_basic.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
index ce75f4198..866bb88e4 100644
--- a/tests/sriov_basic.c
+++ b/tests/sriov_basic.c
@@ -60,6 +60,36 @@ static void enable_vfs_autoprobe_on(int pf_fd, unsigned int num_vfs)
igt_assert(!err);
}
+/**
+ * SUBTEST: enable-vfs-bind-all-unbind-all
+ * Description:
+ * Verify VFs enabling, binding the driver and then unbinding it from all of them
+ * Run type: FULL
+ */
+static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
+{
+ igt_debug("Testing %u VFs\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+
+ igt_sriov_disable_driver_autoprobe(pf_fd);
+ igt_sriov_enable_vfs(pf_fd, num_vfs);
+ igt_sriov_enable_driver_autoprobe(pf_fd);
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ igt_sriov_bind_vf_drm_driver(pf_fd, i);
+ igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_sriov_unbind_vf_drm_driver(pf_fd, i);
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ igt_sriov_disable_vfs(pf_fd);
+}
+
igt_main
{
int pf_fd;
@@ -110,6 +140,25 @@ igt_main
}
}
+ igt_describe("Verify VFs enabling, binding the driver and then unbinding it from all of them");
+ igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ }
+
igt_fixture {
igt_sriov_disable_vfs(pf_fd);
/* abort to avoid execution of next tests with enabled VFs */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 8/8] tests/sriov_basic: add more tests for VF driver binding
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (6 preceding siblings ...)
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
@ 2023-11-20 14:14 ` Lukasz Laguna
2023-11-20 19:11 ` [igt-dev] ✓ Fi.CI.BAT: success for Initial SR-IOV validation (rev3) Patchwork
` (2 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-20 14:14 UTC (permalink / raw)
To: igt-dev
- bind-unbind-vf: validate driver binding and unbinding to specified VF
- enable-vfs-bind-unbind-each: validate driver binding and unbinding to
VFs from specified range.
v2:
- remove checks that are outside the scope of the test (Michal)
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
tests/sriov_basic.c | 90 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
index 866bb88e4..72541fe2f 100644
--- a/tests/sriov_basic.c
+++ b/tests/sriov_basic.c
@@ -90,6 +90,58 @@ static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
igt_sriov_disable_vfs(pf_fd);
}
+/**
+ * SUBTEST: enable-vfs-bind-unbind-each
+ * Description:
+ * Verify VFs enabling with binding and unbinding the driver one be one to each of them
+ * Run type: BAT
+ */
+static void enable_vfs_bind_unbind_each(int pf_fd, unsigned int num_vfs)
+{
+ igt_debug("Testing %u VFs\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+
+ igt_sriov_disable_driver_autoprobe(pf_fd);
+ igt_sriov_enable_vfs(pf_fd, num_vfs);
+ igt_sriov_enable_driver_autoprobe(pf_fd);
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ igt_sriov_bind_vf_drm_driver(pf_fd, i);
+ igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ igt_sriov_unbind_vf_drm_driver(pf_fd, i);
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ igt_sriov_disable_vfs(pf_fd);
+}
+
+/**
+ * SUBTEST: bind-unbind-vf
+ * Description:
+ * Verify binding and unbinding the driver to specific VF
+ * Run type: BAT
+ */
+static void bind_unbind_vf(int pf_fd, unsigned int vf_num)
+{
+ igt_debug("Testing VF%u\n", vf_num);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+
+ igt_sriov_disable_driver_autoprobe(pf_fd);
+ igt_sriov_enable_vfs(pf_fd, vf_num);
+ igt_sriov_enable_driver_autoprobe(pf_fd);
+
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, vf_num));
+ igt_sriov_bind_vf_drm_driver(pf_fd, vf_num);
+ igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, vf_num));
+ igt_sriov_unbind_vf_drm_driver(pf_fd, vf_num);
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, vf_num));
+
+ igt_sriov_disable_vfs(pf_fd);
+}
+
igt_main
{
int pf_fd;
@@ -159,6 +211,44 @@ igt_main
}
}
+ igt_describe("Verify VFs enabling with binding and unbinding the driver one be one to each of them");
+ igt_subtest_with_dynamic("enable-vfs-bind-unbind-each") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_bind_unbind_each(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_bind_unbind_each(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_bind_unbind_each(pf_fd, num_vfs);
+ }
+ }
+ }
+
+ igt_describe("Test binds and unbinds the driver to specific VF");
+ igt_subtest_with_dynamic("bind-unbind-vf") {
+ for_each_vf(pf_fd, vf) {
+ igt_dynamic_f("vf-%u", vf) {
+ bind_unbind_vf(pf_fd, vf);
+ }
+ }
+ for_random_vf(pf_fd, vf) {
+ igt_dynamic_f("vf-random") {
+ bind_unbind_vf(pf_fd, vf);
+ }
+ }
+ for_last_vf(pf_fd, vf) {
+ igt_dynamic_f("vf-last") {
+ bind_unbind_vf(pf_fd, vf);
+ }
+ }
+ }
+
igt_fixture {
igt_sriov_disable_vfs(pf_fd);
/* abort to avoid execution of next tests with enabled VFs */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-10 19:44 ` Michal Wajdeczko
@ 2023-11-20 14:31 ` Laguna, Lukasz
0 siblings, 0 replies; 22+ messages in thread
From: Laguna, Lukasz @ 2023-11-20 14:31 UTC (permalink / raw)
To: Michal Wajdeczko, igt-dev
On 11/10/2023 20:44, Michal Wajdeczko wrote:
>
> On 09.11.2023 08:06, Laguna, Lukasz wrote:
>> On 11/6/2023 23:59, Michal Wajdeczko wrote:
>>> On 06.11.2023 20:59, Lukasz Laguna wrote:
>>>> From: Katarzyna Dec <katarzyna.dec@intel.com>
>>>>
>>>> Test enables VFs in range <1..totalvfs>, bind driver to all of them and
>>>> then unbind driver from all of them.
>>> commit message seems outdated
>> What do you mean? I don't see anything wrong
>>>> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
>>>> Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
>>>> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
>>>> Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>>>> ---
>>>> tests/sriov_basic.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
>>>> 1 file changed, 51 insertions(+)
>>>>
>>>> diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
>>>> index fc0914962..179731daf 100644
>>>> --- a/tests/sriov_basic.c
>>>> +++ b/tests/sriov_basic.c
>>>> @@ -61,6 +61,38 @@ static void probe_disable_vfs(int pf_fd, unsigned
>>>> int num_vfs)
>>>> igt_assert(!err);
>>>> }
>>>> +/**
>>>> + * SUBTEST: enable-vfs-bind-all-unbind-all
>>>> + * Description:
>>>> + * Verify VFs enabling, binding the driver and then unbinding it
>>>> from all of them
>>>> + */
>>>> +static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int
>>>> num_vfs)
>>>> +{
>>>> + igt_debug("Using num_vfs=%u\n", num_vfs);
>>> nit: "Testing %u VFs" ?
>> Done
>>>> +
>>>> + igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
>>> duplicates main fixture
>> As already answered in different patch - first fixtureis not executed
>> between dynamic subtests.
>>>> + igt_warn_on(!igt_sriov_disable_driver_autoprobe(pf_fd));
>>>> + igt_skip_on(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
>>> why do we need warn/skip here ?
>>> can't we just assert that 'disable' worked ?
>> Done
>>>> +
>>>> + igt_warn_on(!igt_sriov_enable_vfs(pf_fd, num_vfs));
>>> can't we just assert ?
>> Done
>>>> + igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(pf_fd));
>>> why we care here ? if not all are enabled then we fail just later
>>> and this is not a test for "enable VFs" that enabled==requested
>> Done
>>>> + igt_warn_on(!igt_sriov_enable_driver_autoprobe(pf_fd));
>>>> + igt_assert(igt_sriov_is_driver_autoprobe_enabled(pf_fd));
>>> can't we just warn ?
>>> if that we fail to enable then probe below will fail anyway
>> Done
>>>> +
>>>> + for (int i = 1; i <= num_vfs; i++) {
>>>> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
>>>> + igt_assert(igt_sriov_bind_vf_drm_driver(pf_fd, i));
>>>> + igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
>>> shouldn't we just "expect" to make sure to call "disable VFs" ?
>> VFs will be disabled in exit fixture. VFs disabling in subtest is needed
>> between dynamic subtests.
> but if test passed, then it should do a proper cleanup
>
> maybe problem is that if something went wrong, your igt_assert() aborts
> current test which doesn't have a chance to do proper cleanup ?
>
> or maybe that cleanup should be in some mid-test fixture ?
>
> anyway, just seems broken that we need to duplicate the code/logic every
> time
>
>>>> + }
>>>> +
>>>> + for (int i = 1; i <= num_vfs; i++) {
>>>> + igt_assert(igt_sriov_unbind_vf_drm_driver(pf_fd, i));
>>>> + igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
>>> do we need to have all VFs loaded ?
>>> maybe for BAT test we can just bind/unload one VF at the time ?
>> We have such test as well:
>> [PATCH i-g-t 8/8] tests/sriov_basic: add more tests for VF driver binding
>> SUBTEST: enable-vfs-bind-unbind-each
>> SUBTEST: bind-unbind-vf
> that's good
>
> but the question is still open?
> what the benefit of having this test which just open-coded the VF probe
> loop that would be otherwise done by the PCI subsystem ?
>
> and again, like autoprobe-on, this doesn't seem good candidate for "BAT"
> runs, more like a "STRESS"
Done
>>> otherwise it will be almost the same level of stress as in
>>> "enable-vfs-autoprobe-on" but with 'manual probe' loop of all VFs
>>>
>>>> + }
>>>> +
>>>> + igt_assert(igt_sriov_disable_vfs(pf_fd));
>>>> +}
>>>> +
>>>> igt_main
>>>> {
>>>> int pf_fd;
>>>> @@ -113,6 +145,25 @@ igt_main
>>>> }
>>>> }
>>>> + igt_describe("Verify VFs enabling, binding the driver and then
>>>> unbinding it from all of them");
>>>> + igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
>>>> + for_each_num_vfs(pf_fd, num_vfs) {
>>>> + igt_dynamic_f("numvfs-%u", num_vfs) {
>>>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>>>> + }
>>>> + }
>>>> + for_random_num_vfs(pf_fd, num_vfs) {
>>>> + igt_dynamic_f("numvfs-random") {
>>>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>>>> + }
>>>> + }
>>>> + for_max_num_vfs(pf_fd, num_vfs) {
>>>> + igt_dynamic_f("numvfs-all") {
>>>> + enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
>>>> + }
>>>> + }
>>>> + }
>>>> +
>>>> igt_fixture {
>>>> igt_sriov_disable_vfs(pf_fd);
>>>> /* abort to avoid execution of next tests with enabled VFs */
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for Initial SR-IOV validation (rev3)
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (7 preceding siblings ...)
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 8/8] tests/sriov_basic: add more tests for VF driver binding Lukasz Laguna
@ 2023-11-20 19:11 ` Patchwork
2023-11-22 13:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for Initial SR-IOV validation (rev4) Patchwork
2023-11-22 15:16 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
10 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2023-11-20 19:11 UTC (permalink / raw)
To: Laguna, Lukasz; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 8890 bytes --]
== Series Details ==
Series: Initial SR-IOV validation (rev3)
URL : https://patchwork.freedesktop.org/series/126034/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_13900 -> IGTPW_10217
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/index.html
Participating hosts (33 -> 34)
------------------------------
Additional (2): bat-dg2-8 fi-hsw-4770
Missing (1): fi-snb-2520m
Known issues
------------
Here are the changes found in IGTPW_10217 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_mmap@basic:
- bat-dg2-8: NOTRUN -> [SKIP][1] ([i915#4083])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@gem_mmap@basic.html
* igt@gem_mmap_gtt@basic:
- bat-dg2-8: NOTRUN -> [SKIP][2] ([i915#4077]) +2 other tests skip
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@gem_mmap_gtt@basic.html
* igt@gem_tiled_pread_basic:
- bat-dg2-8: NOTRUN -> [SKIP][3] ([i915#4079]) +1 other test skip
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@gem_tiled_pread_basic.html
* igt@i915_pm_rps@basic-api:
- bat-dg2-8: NOTRUN -> [SKIP][4] ([i915#6621])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@i915_pm_rps@basic-api.html
* igt@i915_suspend@basic-s3-without-i915:
- bat-dg2-8: NOTRUN -> [SKIP][5] ([i915#6645])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@i915_suspend@basic-s3-without-i915.html
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- fi-hsw-4770: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#5190])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/fi-hsw-4770/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html
- bat-dg2-8: NOTRUN -> [SKIP][7] ([i915#5190])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html
* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][8] ([i915#4215] / [i915#5190])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_addfb_basic@basic-y-tiled-legacy.html
* igt@kms_addfb_basic@framebuffer-vs-set-tiling:
- bat-dg2-8: NOTRUN -> [SKIP][9] ([i915#4212]) +6 other tests skip
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_addfb_basic@framebuffer-vs-set-tiling.html
* igt@kms_addfb_basic@tile-pitch-mismatch:
- bat-dg2-8: NOTRUN -> [SKIP][10] ([i915#4212] / [i915#5608])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_addfb_basic@tile-pitch-mismatch.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][11] ([i915#4103] / [i915#4213] / [i915#5608]) +1 other test skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy.html
* igt@kms_force_connector_basic@force-load-detect:
- bat-dg2-8: NOTRUN -> [SKIP][12] ([fdo#109285])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_force_connector_basic@force-load-detect.html
* igt@kms_force_connector_basic@prune-stale-modes:
- bat-dg2-8: NOTRUN -> [SKIP][13] ([i915#5274])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_force_connector_basic@prune-stale-modes.html
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12@pipe-a-vga-1:
- fi-hsw-4770: NOTRUN -> [SKIP][14] ([fdo#109271]) +12 other tests skip
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/fi-hsw-4770/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12@pipe-a-vga-1.html
* igt@kms_pipe_crc_basic@read-crc-frame-sequence:
- bat-dg2-11: NOTRUN -> [SKIP][15] ([i915#1845] / [i915#9197])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-11/igt@kms_pipe_crc_basic@read-crc-frame-sequence.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg2-8: NOTRUN -> [SKIP][16] ([i915#3555] / [i915#4098])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@kms_setmode@basic-clone-single-crtc.html
* igt@prime_vgem@basic-fence-flip:
- bat-dg2-8: NOTRUN -> [SKIP][17] ([i915#3708])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@prime_vgem@basic-fence-flip.html
* igt@prime_vgem@basic-fence-mmap:
- bat-dg2-8: NOTRUN -> [SKIP][18] ([i915#3708] / [i915#4077]) +1 other test skip
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@prime_vgem@basic-fence-mmap.html
* igt@prime_vgem@basic-write:
- bat-dg2-8: NOTRUN -> [SKIP][19] ([i915#3291] / [i915#3708]) +2 other tests skip
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-dg2-8/igt@prime_vgem@basic-write.html
#### Possible fixes ####
* igt@i915_selftest@live@gt_heartbeat:
- fi-apl-guc: [DMESG-FAIL][20] ([i915#5334]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13900/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
* igt@i915_selftest@live@gt_mocs:
- bat-mtlp-6: [DMESG-WARN][22] -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13900/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
* {igt@kms_psr@psr_cursor_plane_move@edp-1}:
- bat-jsl-1: [SKIP][24] ([i915#9648]) -> [PASS][25] +2 other tests pass
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13900/bat-jsl-1/igt@kms_psr@psr_cursor_plane_move@edp-1.html
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/bat-jsl-1/igt@kms_psr@psr_cursor_plane_move@edp-1.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5608]: https://gitlab.freedesktop.org/drm/intel/issues/5608
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7359]: https://gitlab.freedesktop.org/drm/intel/issues/7359
[i915#8981]: https://gitlab.freedesktop.org/drm/intel/issues/8981
[i915#9197]: https://gitlab.freedesktop.org/drm/intel/issues/9197
[i915#9648]: https://gitlab.freedesktop.org/drm/intel/issues/9648
[i915#9673]: https://gitlab.freedesktop.org/drm/intel/issues/9673
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7595 -> IGTPW_10217
CI-20190529: 20190529
CI_DRM_13900: 7e7a522c80874faff37a7a66bdaff0747f978e11 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_10217: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/index.html
IGT_7595: cfa00d99b1dfa0621ea552d1ed54907798da1a1a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+igt@sriov_basic@bind-unbind-vf
+igt@sriov_basic@enable-vfs-autoprobe-off
+igt@sriov_basic@enable-vfs-autoprobe-on
+igt@sriov_basic@enable-vfs-bind-all-unbind-all
+igt@sriov_basic@enable-vfs-bind-unbind-each
-igt@kms_big_joiner@simultaneous-modeset
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10217/index.html
[-- Attachment #2: Type: text/html, Size: 10331 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for Initial SR-IOV validation (rev4)
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (8 preceding siblings ...)
2023-11-20 19:11 ` [igt-dev] ✓ Fi.CI.BAT: success for Initial SR-IOV validation (rev3) Patchwork
@ 2023-11-22 13:51 ` Patchwork
2023-11-22 15:16 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
10 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2023-11-22 13:51 UTC (permalink / raw)
To: Lukasz Laguna; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 8139 bytes --]
== Series Details ==
Series: Initial SR-IOV validation (rev4)
URL : https://patchwork.freedesktop.org/series/126034/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13910 -> IGTPW_10239
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_10239 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_10239, please notify your bug team (lgci.bug.filing@intel.com) 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_10239/index.html
Participating hosts (38 -> 37)
------------------------------
Additional (1): bat-dg1-7
Missing (2): bat-rpls-1 fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_10239:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@execlists:
- fi-bsw-nick: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13910/fi-bsw-nick/igt@i915_selftest@live@execlists.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/fi-bsw-nick/igt@i915_selftest@live@execlists.html
Known issues
------------
Here are the changes found in IGTPW_10239 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@fbdev@info:
- bat-dg1-7: NOTRUN -> [SKIP][3] ([i915#1849] / [i915#2582])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@fbdev@info.html
* igt@fbdev@write:
- bat-dg1-7: NOTRUN -> [SKIP][4] ([i915#2582]) +3 other tests skip
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@fbdev@write.html
* igt@gem_mmap@basic:
- bat-dg1-7: NOTRUN -> [SKIP][5] ([i915#4083])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@gem_mmap@basic.html
* igt@gem_tiled_fence_blits@basic:
- bat-dg1-7: NOTRUN -> [SKIP][6] ([i915#4077]) +2 other tests skip
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@gem_tiled_fence_blits@basic.html
* igt@gem_tiled_pread_basic:
- bat-dg1-7: NOTRUN -> [SKIP][7] ([i915#4079]) +1 other test skip
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@gem_tiled_pread_basic.html
* igt@i915_pm_rps@basic-api:
- bat-dg1-7: NOTRUN -> [SKIP][8] ([i915#6621])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@i915_pm_rps@basic-api.html
* igt@kms_addfb_basic@addfb25-x-tiled-mismatch-legacy:
- bat-dg1-7: NOTRUN -> [SKIP][9] ([i915#4212]) +7 other tests skip
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_addfb_basic@addfb25-x-tiled-mismatch-legacy.html
* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg1-7: NOTRUN -> [SKIP][10] ([i915#4215])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_addfb_basic@basic-y-tiled-legacy.html
* igt@kms_busy@basic:
- bat-dg1-7: NOTRUN -> [SKIP][11] ([i915#1845] / [i915#4303])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_busy@basic.html
* igt@kms_flip@basic-flip-vs-wf_vblank:
- bat-dg1-7: NOTRUN -> [SKIP][12] ([i915#3637] / [i915#4078]) +2 other tests skip
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_flip@basic-flip-vs-wf_vblank.html
* igt@kms_flip@basic-plain-flip:
- bat-dg1-7: NOTRUN -> [SKIP][13] ([i915#4078])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_flip@basic-plain-flip.html
* igt@kms_force_connector_basic@force-load-detect:
- bat-dg1-7: NOTRUN -> [SKIP][14] ([fdo#109285])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_force_connector_basic@force-load-detect.html
* igt@kms_frontbuffer_tracking@basic:
- bat-dg1-7: NOTRUN -> [SKIP][15] ([i915#4078] / [i915#4342])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_frontbuffer_tracking@basic.html
* igt@kms_hdmi_inject@inject-audio:
- bat-dg1-7: NOTRUN -> [SKIP][16] ([i915#433])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_hdmi_inject@inject-audio.html
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-xr24:
- bat-dg1-7: NOTRUN -> [SKIP][17] ([i915#1845]) +10 other tests skip
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-xr24.html
* igt@kms_pipe_crc_basic@nonblocking-crc:
- bat-dg1-7: NOTRUN -> [SKIP][18] ([i915#1845] / [i915#4078]) +5 other tests skip
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_pipe_crc_basic@nonblocking-crc.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg1-7: NOTRUN -> [SKIP][19] ([i915#3555])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@kms_setmode@basic-clone-single-crtc.html
* igt@prime_vgem@basic-fence-flip:
- bat-dg1-7: NOTRUN -> [SKIP][20] ([i915#1845] / [i915#3708])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@prime_vgem@basic-fence-flip.html
* igt@prime_vgem@basic-fence-mmap:
- bat-dg1-7: NOTRUN -> [SKIP][21] ([i915#3708] / [i915#4077]) +1 other test skip
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@prime_vgem@basic-fence-mmap.html
* igt@prime_vgem@basic-fence-read:
- bat-dg1-7: NOTRUN -> [SKIP][22] ([i915#3708]) +2 other tests skip
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/bat-dg1-7/igt@prime_vgem@basic-fence-read.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4303]: https://gitlab.freedesktop.org/drm/intel/issues/4303
[i915#433]: https://gitlab.freedesktop.org/drm/intel/issues/433
[i915#4342]: https://gitlab.freedesktop.org/drm/intel/issues/4342
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#9673]: https://gitlab.freedesktop.org/drm/intel/issues/9673
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7595 -> IGTPW_10239
CI-20190529: 20190529
CI_DRM_13910: a6fa1fefc44d92897a3be86430dde647f665f3a3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_10239: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/index.html
IGT_7595: cfa00d99b1dfa0621ea552d1ed54907798da1a1a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+igt@sriov_basic@bind-unbind-vf
+igt@sriov_basic@enable-vfs-autoprobe-off
+igt@sriov_basic@enable-vfs-autoprobe-on
+igt@sriov_basic@enable-vfs-bind-all-unbind-all
+igt@sriov_basic@enable-vfs-bind-unbind-each
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/index.html
[-- Attachment #2: Type: text/html, Size: 9840 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] ✓ CI.xeBAT: success for Initial SR-IOV validation (rev4)
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
` (9 preceding siblings ...)
2023-11-22 13:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for Initial SR-IOV validation (rev4) Patchwork
@ 2023-11-22 15:16 ` Patchwork
10 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2023-11-22 15:16 UTC (permalink / raw)
To: Lukasz Laguna; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 7296 bytes --]
== Series Details ==
Series: Initial SR-IOV validation (rev4)
URL : https://patchwork.freedesktop.org/series/126034/
State : success
== Summary ==
CI Bug Log - changes from XEIGT_7595_BAT -> XEIGTPW_10239_BAT
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (4 -> 4)
------------------------------
No changes in participating hosts
Known issues
------------
Here are the changes found in XEIGTPW_10239_BAT that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@core_hotunplug@unbind-rebind:
- bat-adlp-7: [PASS][1] -> [DMESG-WARN][2] ([Intel XE#939])
[1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-adlp-7/igt@core_hotunplug@unbind-rebind.html
[2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-adlp-7/igt@core_hotunplug@unbind-rebind.html
- bat-dg2-oem2: NOTRUN -> [DMESG-WARN][3] ([Intel XE#939])
[3]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@core_hotunplug@unbind-rebind.html
* igt@xe_exec_fault_mode@many-basic:
- bat-dg2-oem2: NOTRUN -> [SKIP][4] ([Intel XE#288]) +17 other tests skip
[4]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@xe_exec_fault_mode@many-basic.html
* igt@xe_guc_pc@freq_basic_api:
- bat-adlp-7: [PASS][5] -> [FAIL][6] ([Intel XE#935])
[5]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-adlp-7/igt@xe_guc_pc@freq_basic_api.html
[6]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-adlp-7/igt@xe_guc_pc@freq_basic_api.html
- bat-pvc-2: [PASS][7] -> [FAIL][8] ([Intel XE#935])
[7]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-pvc-2/igt@xe_guc_pc@freq_basic_api.html
[8]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-pvc-2/igt@xe_guc_pc@freq_basic_api.html
- bat-dg2-oem2: [PASS][9] -> [FAIL][10] ([Intel XE#935])
[9]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-dg2-oem2/igt@xe_guc_pc@freq_basic_api.html
[10]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@xe_guc_pc@freq_basic_api.html
- bat-atsm-2: [PASS][11] -> [FAIL][12] ([Intel XE#935])
[11]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-atsm-2/igt@xe_guc_pc@freq_basic_api.html
[12]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-atsm-2/igt@xe_guc_pc@freq_basic_api.html
* igt@xe_guc_pc@freq_fixed_idle:
- bat-atsm-2: [PASS][13] -> [FAIL][14] ([Intel XE#940]) +1 other test fail
[13]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-atsm-2/igt@xe_guc_pc@freq_fixed_idle.html
[14]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-atsm-2/igt@xe_guc_pc@freq_fixed_idle.html
- bat-dg2-oem2: [PASS][15] -> [FAIL][16] ([Intel XE#940]) +1 other test fail
[15]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-dg2-oem2/igt@xe_guc_pc@freq_fixed_idle.html
[16]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@xe_guc_pc@freq_fixed_idle.html
* igt@xe_guc_pc@freq_range_idle:
- bat-adlp-7: [PASS][17] -> [FAIL][18] ([Intel XE#940]) +1 other test fail
[17]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-adlp-7/igt@xe_guc_pc@freq_range_idle.html
[18]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-adlp-7/igt@xe_guc_pc@freq_range_idle.html
#### Possible fixes ####
* igt@kms_cursor_legacy@basic-flip-before-cursor-legacy:
- bat-adlp-7: [FAIL][19] ([i915#2346]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-adlp-7/igt@kms_cursor_legacy@basic-flip-before-cursor-legacy.html
[20]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-adlp-7/igt@kms_cursor_legacy@basic-flip-before-cursor-legacy.html
* igt@kms_pipe_crc_basic@hang-read-crc:
- bat-dg2-oem2: [INCOMPLETE][21] ([Intel XE#749]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-dg2-oem2/igt@kms_pipe_crc_basic@hang-read-crc.html
[22]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@kms_pipe_crc_basic@hang-read-crc.html
* igt@kms_pipe_crc_basic@hang-read-crc@pipe-a-dp-3:
- bat-dg2-oem2: [INCOMPLETE][23] ([Intel XE#545]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-dg2-oem2/igt@kms_pipe_crc_basic@hang-read-crc@pipe-a-dp-3.html
[24]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@kms_pipe_crc_basic@hang-read-crc@pipe-a-dp-3.html
#### Warnings ####
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12:
- bat-dg2-oem2: [TIMEOUT][25] ([Intel XE#430] / [Intel XE#530]) -> [FAIL][26] ([Intel XE#400] / [Intel XE#616])
[25]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-dg2-oem2/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12.html
[26]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12.html
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12@pipe-d-dp-3:
- bat-dg2-oem2: [TIMEOUT][27] ([Intel XE#530]) -> [FAIL][28] ([Intel XE#400] / [Intel XE#616])
[27]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7595/bat-dg2-oem2/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12@pipe-d-dp-3.html
[28]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/bat-dg2-oem2/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12@pipe-d-dp-3.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[Intel XE#288]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/288
[Intel XE#400]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/400
[Intel XE#430]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/430
[Intel XE#524]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/524
[Intel XE#530]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/530
[Intel XE#545]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/545
[Intel XE#616]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/616
[Intel XE#749]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/749
[Intel XE#929]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/929
[Intel XE#935]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/935
[Intel XE#939]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/939
[Intel XE#940]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/940
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
Build changes
-------------
* IGT: IGT_7595 -> IGTPW_10239
* Linux: xe-505-b25aa17bffa88c86fec716e40bdb3848eea17b23 -> xe-515-a9ee4928479a5449991149cc38747e8e20376db9
IGTPW_10239: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_10239/index.html
IGT_7595: cfa00d99b1dfa0621ea552d1ed54907798da1a1a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
xe-505-b25aa17bffa88c86fec716e40bdb3848eea17b23: b25aa17bffa88c86fec716e40bdb3848eea17b23
xe-515-a9ee4928479a5449991149cc38747e8e20376db9: a9ee4928479a5449991149cc38747e8e20376db9
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_10239/index.html
[-- Attachment #2: Type: text/html, Size: 8671 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/8] lib/igt_sriov_device: add helper for opening VF device
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 2/8] lib/igt_sriov_device: add helper for opening VF device Lukasz Laguna
@ 2023-11-23 9:21 ` Kamil Konieczny
2023-11-24 8:58 ` Laguna, Lukasz
0 siblings, 1 reply; 22+ messages in thread
From: Kamil Konieczny @ 2023-11-23 9:21 UTC (permalink / raw)
To: igt-dev
Hi Lukasz,
On 2023-11-20 at 15:14:53 +0100, Lukasz Laguna wrote:
> From: Katarzyna Dec <katarzyna.dec@intel.com>
>
> Helper opens DRM device node and returns its file descriptor.
>
> Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
> lib/drmtest.c | 17 +++++++++++----
> lib/drmtest.h | 1 +
> lib/igt_sriov_device.c | 47 ++++++++++++++++++++++++++++++++++++++++++
> lib/igt_sriov_device.h | 1 +
> 4 files changed, 62 insertions(+), 4 deletions(-)
>
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index f0b97e362..d8b7aace5 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -245,7 +245,16 @@ static void log_opened_device_path(const char *device_path)
> igt_info("Opened device: %s\n", item->path);
> }
>
> -static int open_device(const char *name, unsigned int chipset)
> +/**
> + * drm_open_device:
> + * @name: DRM node name
> + * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
> + *
> + * Open a drm legacy device node.
> + *
> + * Returns: DRM file descriptor or -1 on error
> + */
> +int drm_open_device(const char *name, unsigned int chipset)
Please name it __drm_open_device as this function will not assert.
> {
> const char *forced;
> char dev_name[16] = "";
> @@ -350,7 +359,7 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset,
> if (_is_already_opened(name, as_idx))
> continue;
>
> - fd = open_device(name, chipset);
> + fd = drm_open_device(name, chipset);
> if (fd != -1)
> return fd;
> }
> @@ -392,13 +401,13 @@ static int __open_driver_exact(const char *name, unsigned int chipset)
> {
> int fd;
>
> - fd = open_device(name, chipset);
> + fd = drm_open_device(name, chipset);
> if (fd != -1)
> return fd;
>
> drm_load_module(chipset);
>
> - return open_device(name, chipset);
> + return drm_open_device(name, chipset);
> }
>
> /*
> diff --git a/lib/drmtest.h b/lib/drmtest.h
> index 909a0c12c..9c040a136 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -98,6 +98,7 @@ void __set_forced_driver(const char *name);
> */
> #define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
>
> +int drm_open_device(const char *name, unsigned int chipset);
> void drm_load_module(unsigned int chipset);
> int drm_open_driver(int chipset);
> int drm_open_driver_master(int chipset);
> diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
> index c5c594c2c..cd00c7c5d 100644
> --- a/lib/igt_sriov_device.c
> +++ b/lib/igt_sriov_device.c
> @@ -3,8 +3,10 @@
> * Copyright(c) 2023 Intel Corporation. All rights reserved.
> */
>
> +#include <dirent.h>
> #include <errno.h>
>
> +#include "drmtest.h"
> #include "igt_core.h"
> #include "igt_sriov_device.h"
> #include "igt_sysfs.h"
> @@ -211,3 +213,48 @@ void igt_sriov_disable_driver_autoprobe(int pf)
> {
> pf_attr_set_u32(pf, "device/sriov_drivers_autoprobe", false);
> }
> +
> +/**
> + * igt_sriov_open_vf_drm_device - Open VF DRM device node
> + * @pf: PF device file descriptor
> + * @vf_num: VF number (1-based to identify single VF)
> + *
> + * Open DRM device node for given VF.
> + *
> + * Return:
> + * VF file descriptor or -1 on error.
> + */
> +int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num)
> +{
> + char dir_path[PATH_MAX], path[PATH_MAX], dev_name[16];
> + DIR *dir;
> + struct dirent *de;
> + bool found = false;
> +
> + igt_assert(vf_num > 0);
> +
> + if (!igt_sysfs_path(pf, dir_path, sizeof(dir_path)))
> + return -1;
> + /* vf_num is 1-based, but virtfn is 0-based */
> + snprintf(path, sizeof(path), "/device/virtfn%u/drm", vf_num - 1);
> + strncat(dir_path, path, sizeof(dir_path) - strlen(dir_path));
--- ^^^^^^^
Make it in one go with snprintf above.
snprintf(path, sizeof(path), "%s/device/virtfn%u/drm", dir_path, vf_num - 1);
Then:
dir = opendir(path);
Regards,
Kamil
> +
> + dir = opendir(dir_path);
> + if (!dir)
> + return -1;
> + while ((de = readdir(dir))) {
> + unsigned int card_num;
> +
> + if (sscanf(de->d_name, "card%d", &card_num) == 1) {
> + snprintf(dev_name, sizeof(dev_name), "/dev/dri/card%u", card_num);
> + found = true;
> + break;
> + }
> + }
> + closedir(dir);
> +
> + if (!found)
> + return -1;
> +
> + return drm_open_device(dev_name, DRIVER_ANY);
> +}
> diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
> index 337fdf84b..4e57f0dcb 100644
> --- a/lib/igt_sriov_device.h
> +++ b/lib/igt_sriov_device.h
> @@ -25,5 +25,6 @@ void igt_sriov_disable_vfs(int pf);
> bool igt_sriov_is_driver_autoprobe_enabled(int pf);
> void igt_sriov_enable_driver_autoprobe(int pf);
> void igt_sriov_disable_driver_autoprobe(int pf);
> +int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num);
>
> #endif /* __IGT_SRIOV_DEVICE_H__ */
> --
> 2.40.0
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-24 8:52 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
@ 2023-11-24 8:52 ` Lukasz Laguna
0 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-24 8:52 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Test enables VFs in range <1..totalvfs>, bind driver to all of them and
then unbind driver from all of them.
v2:
- remove checks that are outside the scope of the test (Michal)
- change subtest run type (Michal)
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
tests/sriov_basic.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
index ce75f4198..866bb88e4 100644
--- a/tests/sriov_basic.c
+++ b/tests/sriov_basic.c
@@ -60,6 +60,36 @@ static void enable_vfs_autoprobe_on(int pf_fd, unsigned int num_vfs)
igt_assert(!err);
}
+/**
+ * SUBTEST: enable-vfs-bind-all-unbind-all
+ * Description:
+ * Verify VFs enabling, binding the driver and then unbinding it from all of them
+ * Run type: FULL
+ */
+static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
+{
+ igt_debug("Testing %u VFs\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+
+ igt_sriov_disable_driver_autoprobe(pf_fd);
+ igt_sriov_enable_vfs(pf_fd, num_vfs);
+ igt_sriov_enable_driver_autoprobe(pf_fd);
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ igt_sriov_bind_vf_drm_driver(pf_fd, i);
+ igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_sriov_unbind_vf_drm_driver(pf_fd, i);
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ igt_sriov_disable_vfs(pf_fd);
+}
+
igt_main
{
int pf_fd;
@@ -110,6 +140,25 @@ igt_main
}
}
+ igt_describe("Verify VFs enabling, binding the driver and then unbinding it from all of them");
+ igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ }
+
igt_fixture {
igt_sriov_disable_vfs(pf_fd);
/* abort to avoid execution of next tests with enabled VFs */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/8] lib/igt_sriov_device: add helper for opening VF device
2023-11-23 9:21 ` Kamil Konieczny
@ 2023-11-24 8:58 ` Laguna, Lukasz
0 siblings, 0 replies; 22+ messages in thread
From: Laguna, Lukasz @ 2023-11-24 8:58 UTC (permalink / raw)
To: Kamil Konieczny, igt-dev, marcin.bernatowicz, michal.wajdeczko
On 11/23/2023 10:21, Kamil Konieczny wrote:
> Hi Lukasz,
Hi Kamil,
> On 2023-11-20 at 15:14:53 +0100, Lukasz Laguna wrote:
>> From: Katarzyna Dec <katarzyna.dec@intel.com>
>>
>> Helper opens DRM device node and returns its file descriptor.
>>
>> Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
>> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
>> ---
>> lib/drmtest.c | 17 +++++++++++----
>> lib/drmtest.h | 1 +
>> lib/igt_sriov_device.c | 47 ++++++++++++++++++++++++++++++++++++++++++
>> lib/igt_sriov_device.h | 1 +
>> 4 files changed, 62 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/drmtest.c b/lib/drmtest.c
>> index f0b97e362..d8b7aace5 100644
>> --- a/lib/drmtest.c
>> +++ b/lib/drmtest.c
>> @@ -245,7 +245,16 @@ static void log_opened_device_path(const char *device_path)
>> igt_info("Opened device: %s\n", item->path);
>> }
>>
>> -static int open_device(const char *name, unsigned int chipset)
>> +/**
>> + * drm_open_device:
>> + * @name: DRM node name
>> + * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
>> + *
>> + * Open a drm legacy device node.
>> + *
>> + * Returns: DRM file descriptor or -1 on error
>> + */
>> +int drm_open_device(const char *name, unsigned int chipset)
> Please name it __drm_open_device as this function will not assert.
Done
>> {
>> const char *forced;
>> char dev_name[16] = "";
>> @@ -350,7 +359,7 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset,
>> if (_is_already_opened(name, as_idx))
>> continue;
>>
>> - fd = open_device(name, chipset);
>> + fd = drm_open_device(name, chipset);
>> if (fd != -1)
>> return fd;
>> }
>> @@ -392,13 +401,13 @@ static int __open_driver_exact(const char *name, unsigned int chipset)
>> {
>> int fd;
>>
>> - fd = open_device(name, chipset);
>> + fd = drm_open_device(name, chipset);
>> if (fd != -1)
>> return fd;
>>
>> drm_load_module(chipset);
>>
>> - return open_device(name, chipset);
>> + return drm_open_device(name, chipset);
>> }
>>
>> /*
>> diff --git a/lib/drmtest.h b/lib/drmtest.h
>> index 909a0c12c..9c040a136 100644
>> --- a/lib/drmtest.h
>> +++ b/lib/drmtest.h
>> @@ -98,6 +98,7 @@ void __set_forced_driver(const char *name);
>> */
>> #define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
>>
>> +int drm_open_device(const char *name, unsigned int chipset);
>> void drm_load_module(unsigned int chipset);
>> int drm_open_driver(int chipset);
>> int drm_open_driver_master(int chipset);
>> diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
>> index c5c594c2c..cd00c7c5d 100644
>> --- a/lib/igt_sriov_device.c
>> +++ b/lib/igt_sriov_device.c
>> @@ -3,8 +3,10 @@
>> * Copyright(c) 2023 Intel Corporation. All rights reserved.
>> */
>>
>> +#include <dirent.h>
>> #include <errno.h>
>>
>> +#include "drmtest.h"
>> #include "igt_core.h"
>> #include "igt_sriov_device.h"
>> #include "igt_sysfs.h"
>> @@ -211,3 +213,48 @@ void igt_sriov_disable_driver_autoprobe(int pf)
>> {
>> pf_attr_set_u32(pf, "device/sriov_drivers_autoprobe", false);
>> }
>> +
>> +/**
>> + * igt_sriov_open_vf_drm_device - Open VF DRM device node
>> + * @pf: PF device file descriptor
>> + * @vf_num: VF number (1-based to identify single VF)
>> + *
>> + * Open DRM device node for given VF.
>> + *
>> + * Return:
>> + * VF file descriptor or -1 on error.
>> + */
>> +int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num)
>> +{
>> + char dir_path[PATH_MAX], path[PATH_MAX], dev_name[16];
>> + DIR *dir;
>> + struct dirent *de;
>> + bool found = false;
>> +
>> + igt_assert(vf_num > 0);
>> +
>> + if (!igt_sysfs_path(pf, dir_path, sizeof(dir_path)))
>> + return -1;
>> + /* vf_num is 1-based, but virtfn is 0-based */
>> + snprintf(path, sizeof(path), "/device/virtfn%u/drm", vf_num - 1);
>> + strncat(dir_path, path, sizeof(dir_path) - strlen(dir_path));
> --- ^^^^^^^
>
> Make it in one go with snprintf above.
> snprintf(path, sizeof(path), "%s/device/virtfn%u/drm", dir_path, vf_num - 1);
>
> Then:
> dir = opendir(path);
Done
Regards,
Lukasz
> Regards,
> Kamil
>
>> +
>> + dir = opendir(dir_path);
>> + if (!dir)
>> + return -1;
>> + while ((de = readdir(dir))) {
>> + unsigned int card_num;
>> +
>> + if (sscanf(de->d_name, "card%d", &card_num) == 1) {
>> + snprintf(dev_name, sizeof(dev_name), "/dev/dri/card%u", card_num);
>> + found = true;
>> + break;
>> + }
>> + }
>> + closedir(dir);
>> +
>> + if (!found)
>> + return -1;
>> +
>> + return drm_open_device(dev_name, DRIVER_ANY);
>> +}
>> diff --git a/lib/igt_sriov_device.h b/lib/igt_sriov_device.h
>> index 337fdf84b..4e57f0dcb 100644
>> --- a/lib/igt_sriov_device.h
>> +++ b/lib/igt_sriov_device.h
>> @@ -25,5 +25,6 @@ void igt_sriov_disable_vfs(int pf);
>> bool igt_sriov_is_driver_autoprobe_enabled(int pf);
>> void igt_sriov_enable_driver_autoprobe(int pf);
>> void igt_sriov_disable_driver_autoprobe(int pf);
>> +int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num);
>>
>> #endif /* __IGT_SRIOV_DEVICE_H__ */
>> --
>> 2.40.0
>>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs
2023-11-30 12:48 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
@ 2023-11-30 12:48 ` Lukasz Laguna
0 siblings, 0 replies; 22+ messages in thread
From: Lukasz Laguna @ 2023-11-30 12:48 UTC (permalink / raw)
To: igt-dev
From: Katarzyna Dec <katarzyna.dec@intel.com>
Test enables VFs in range <1..totalvfs>, bind driver to all of them and
then unbind driver from all of them.
v2:
- remove checks that are outside the scope of the test (Michal)
- change subtest run type (Michal)
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
tests/sriov_basic.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
index ce75f4198..866bb88e4 100644
--- a/tests/sriov_basic.c
+++ b/tests/sriov_basic.c
@@ -60,6 +60,36 @@ static void enable_vfs_autoprobe_on(int pf_fd, unsigned int num_vfs)
igt_assert(!err);
}
+/**
+ * SUBTEST: enable-vfs-bind-all-unbind-all
+ * Description:
+ * Verify VFs enabling, binding the driver and then unbinding it from all of them
+ * Run type: FULL
+ */
+static void enable_vfs_bind_all_unbind_all(int pf_fd, unsigned int num_vfs)
+{
+ igt_debug("Testing %u VFs\n", num_vfs);
+
+ igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+
+ igt_sriov_disable_driver_autoprobe(pf_fd);
+ igt_sriov_enable_vfs(pf_fd, num_vfs);
+ igt_sriov_enable_driver_autoprobe(pf_fd);
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ igt_sriov_bind_vf_drm_driver(pf_fd, i);
+ igt_assert(igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ for (int i = 1; i <= num_vfs; i++) {
+ igt_sriov_unbind_vf_drm_driver(pf_fd, i);
+ igt_assert(!igt_sriov_is_vf_drm_driver_probed(pf_fd, i));
+ }
+
+ igt_sriov_disable_vfs(pf_fd);
+}
+
igt_main
{
int pf_fd;
@@ -110,6 +140,25 @@ igt_main
}
}
+ igt_describe("Verify VFs enabling, binding the driver and then unbinding it from all of them");
+ igt_subtest_with_dynamic("enable-vfs-bind-all-unbind-all") {
+ for_each_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-%u", num_vfs) {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_random_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-random") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ for_max_num_vfs(pf_fd, num_vfs) {
+ igt_dynamic_f("numvfs-all") {
+ enable_vfs_bind_all_unbind_all(pf_fd, num_vfs);
+ }
+ }
+ }
+
igt_fixture {
igt_sriov_disable_vfs(pf_fd);
/* abort to avoid execution of next tests with enabled VFs */
--
2.40.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2023-11-30 12:50 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 14:14 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 1/8] lib/igt_sriov_device: add core SR-IOV helpers Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 2/8] lib/igt_sriov_device: add helper for opening VF device Lukasz Laguna
2023-11-23 9:21 ` Kamil Konieczny
2023-11-24 8:58 ` Laguna, Lukasz
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 3/8] lib/igt_sriov_device: add helper for checking if VF DRM driver is probed Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 4/8] lib/igt_sriov_device: add helpers for operations in different VFs scenarios Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 5/8] tests/sriov_basic: add basic tests for enabling SR-IOV VFs Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 6/8] lib/igt_sriov_device: add helpers for VF DRM driver bind and unbind Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
2023-11-20 14:14 ` [igt-dev] [PATCH i-g-t 8/8] tests/sriov_basic: add more tests for VF driver binding Lukasz Laguna
2023-11-20 19:11 ` [igt-dev] ✓ Fi.CI.BAT: success for Initial SR-IOV validation (rev3) Patchwork
2023-11-22 13:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for Initial SR-IOV validation (rev4) Patchwork
2023-11-22 15:16 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-11-30 12:48 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
2023-11-30 12:48 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
2023-11-24 8:52 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
2023-11-24 8:52 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
2023-11-09 6:51 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
2023-11-09 6:51 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
2023-11-06 19:59 [igt-dev] [PATCH i-g-t 0/8] Initial SR-IOV validation Lukasz Laguna
2023-11-06 19:59 ` [igt-dev] [PATCH i-g-t 7/8] tests/sriov_basic: validate driver binding to VFs Lukasz Laguna
2023-11-06 22:59 ` Michal Wajdeczko
2023-11-09 7:06 ` Laguna, Lukasz
2023-11-10 19:44 ` Michal Wajdeczko
2023-11-20 14:31 ` Laguna, Lukasz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox