pci-testdev: add nodata test
PATCH 1/1 pci-testdev: add nodata test
Add nodata test where data length is ignored. Skip it for port IO since kvm does not support it there.
--- hw/misc/pci-testdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
hw/misc/pci-testdev.c +12 -3
@@ -45,6 +45,7 @@ typedef struct IOTest {#define IOTEST_DATAMATCH 0xFA#define IOTEST_NOMATCH 0xCE +#define IOTEST_NODATA 0xAB#define IOTEST_IOSIZE 128#define IOTEST_MEMSIZE 2048
@@ -52,7 +53,8 @@ typedef struct IOTest {static const char *iotest_test[] = {"no-eventfd" ,"wildcard-eventfd" , -"datamatch-eventfd" +"datamatch-eventfd" , +"nodata-eventfd" };static const char *iotest_type[] = {
@@ -261,12 +263,19 @@ static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)memcpy (test->hdr->name, name,strlen (name) +1 );g_free (name); test->hdr->offset =cpu_to_le32 (IOTEST_SIZE (i) + i *IOTEST_ACCESS_WIDTH ); - test->size =IOTEST_ACCESS_WIDTH ; - test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ); + test->size =strcmp (IOTEST_TEST (i),"nodata-eventfd" ) ?IOTEST_ACCESS_WIDTH :0 ; + + test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ) && +strcmp (IOTEST_TEST (i),"nodata-eventfd" ); test->hdr->test = i; test->hdr->data = test->match_data ?IOTEST_DATAMATCH :IOTEST_NOMATCH ; test->hdr->width =IOTEST_ACCESS_WIDTH ; test->mr =IOTEST_REGION (d, i); + +if (!test->size && !IOTEST_IS_MEM (i)) { + test->hasnotifier = false; +continue ; + }if (!strcmp (IOTEST_TEST (i),"no-eventfd" )) { test->hasnotifier = false;continue ;
Signature · 1 line
MST
Quoted 8 lines · Michael S. Tsirkin
Add nodata test where data length is ignored. Skip it for port IO since kvm does not support it there.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/misc/pci-testdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
Quoted 45 lines
hw/misc/pci-testdev.c +12
-3@@ -45,6 +45,7 @@ typedef struct IOTest {#define IOTEST_DATAMATCH 0xFA#define IOTEST_NOMATCH 0xCE +#define IOTEST_NODATA 0xAB#define IOTEST_IOSIZE 128#define IOTEST_MEMSIZE 2048@@ -52,7 +53,8 @@ typedef struct IOTest {static const char *iotest_test[] = {"no-eventfd" ,"wildcard-eventfd" , -"datamatch-eventfd" +"datamatch-eventfd" , +"nodata-eventfd" };static const char *iotest_type[] = {@@ -261,12 +263,19 @@ static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)memcpy (test->hdr->name, name,strlen (name) +1 );g_free (name); test->hdr->offset =cpu_to_le32 (IOTEST_SIZE (i) + i *IOTEST_ACCESS_WIDTH ); - test->size =IOTEST_ACCESS_WIDTH ; - test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ); + test->size =strcmp (IOTEST_TEST (i),"nodata-eventfd" ) ?IOTEST_ACCESS_WIDTH :0 ; + + test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ) && +strcmp (IOTEST_TEST (i),"nodata-eventfd" ); test->hdr->test = i; test->hdr->data = test->match_data ?IOTEST_DATAMATCH :IOTEST_NOMATCH ; test->hdr->width =IOTEST_ACCESS_WIDTH ; test->mr =IOTEST_REGION (d, i); + +if (!test->size && !IOTEST_IS_MEM (i)) { + test->hasnotifier = false; +continue ; + }if (!strcmp (IOTEST_TEST (i),"no-eventfd" )) { test->hasnotifier = false;continue ;
Quoted 13 lines · Michael S. Tsirkin
Add nodata test where data length is ignored. Skip it for port IO since kvm does not support it there.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/misc/pci-testdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)hw/misc/pci-testdev.c +0
-0
hw/misc/pci-testdev.c typedef struct IOTest { · line 48
Quoted 4 lines
hw/misc/pci-testdev.c +1
-0@@ -45,6 +45,7 @@ typedef struct IOTest {#define IOTEST_DATAMATCH 0xFA#define IOTEST_NOMATCH 0xCE +#define IOTEST_NODATA 0xAB
This is never used.
hw/misc/pci-testdev.c typedef struct IOTest { · line 57
Quoted 10 lines
hw/misc/pci-testdev.c +2
-1#define IOTEST_IOSIZE 128#define IOTEST_MEMSIZE 2048@@ -52,7 +53,8 @@ typedef struct IOTest {static const char *iotest_test[] = {"no-eventfd" ,"wildcard-eventfd" , -"datamatch-eventfd" +"datamatch-eventfd" , +"nodata-eventfd"
For PIO test, "nodata-eventfd" actually means "nodata-noeventfd".
Quoted 15 lines
hw/misc/pci-testdev.c +4
-2};static const char *iotest_type[] = {@@ -261,12 +263,19 @@ static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)memcpy (test->hdr->name, name,strlen (name) +1 );g_free (name); test->hdr->offset =cpu_to_le32 (IOTEST_SIZE (i) + i *IOTEST_ACCESS_WIDTH ); - test->size =IOTEST_ACCESS_WIDTH ; - test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ); + test->size =strcmp (IOTEST_TEST (i),"nodata-eventfd" ) ?IOTEST_ACCESS_WIDTH :0 ; + + test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ) && +strcmp (IOTEST_TEST (i),"nodata-eventfd" ); test->hdr->test = i; test->hdr->data = test->match_data ?IOTEST_DATAMATCH :IOTEST_NOMATCH ;
hw/misc/pci-testdev.c static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp) · line 281
Quoted 10 lines
hw/misc/pci-testdev.c +5
-0test->hdr->width =IOTEST_ACCESS_WIDTH ; test->mr =IOTEST_REGION (d, i); + +if (!test->size && !IOTEST_IS_MEM (i)) { + test->hasnotifier = false; +continue ; + }if (!strcmp (IOTEST_TEST (i),"no-eventfd" )) { test->hasnotifier = false;continue ;
Since you're at this, how about introduce a test that mixes datamatch and wildcard?
Quoted 24 lines · Jason Wang
Quoted 13 lines · Michael S. Tsirkin
Add nodata test where data length is ignored. Skip it for port IO since kvm does not support it there.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/misc/pci-testdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)hw/misc/pci-testdev.c +0
-0hw/misc/pci-testdev.c typedef struct IOTest { · line 48
Quoted 4 lines
hw/misc/pci-testdev.c +1
-0@@ -45,6 +45,7 @@ typedef struct IOTest {#define IOTEST_DATAMATCH 0xFA#define IOTEST_NOMATCH 0xCE +#define IOTEST_NODATA 0xABThis is never used.
Quoted 1 line
Quoted 11 lines
hw/misc/pci-testdev.c typedef struct IOTest { · line 57
Quoted 9 lines
#define
IOTEST_IOSIZE128
#defineIOTEST_MEMSIZE2048hw/misc/pci-testdev.c +2
-1@@ -52,7 +53,8 @@ typedef struct IOTest {static const char *iotest_test[] = {"no-eventfd" ,"wildcard-eventfd" , -"datamatch-eventfd" +"datamatch-eventfd" , +"nodata-eventfd" For PIO test, "nodata-eventfd" actually means "nodata-noeventfd".
Not really - this test is skipped completely for PIO, as kvm does not support it.
Quoted 20 lines
Quoted 20 lines
hw/misc/pci-testdev.c +7
-2};static const char *iotest_type[] = {@@ -261,12 +263,19 @@ static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)memcpy (test->hdr->name, name,strlen (name) +1 );g_free (name); test->hdr->offset =cpu_to_le32 (IOTEST_SIZE (i) + i *IOTEST_ACCESS_WIDTH ); - test->size =IOTEST_ACCESS_WIDTH ; - test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ); + test->size =strcmp (IOTEST_TEST (i),"nodata-eventfd" ) ?IOTEST_ACCESS_WIDTH :0 ; + + test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ) && +strcmp (IOTEST_TEST (i),"nodata-eventfd" ); test->hdr->test = i; test->hdr->data = test->match_data ?IOTEST_DATAMATCH :IOTEST_NOMATCH ; test->hdr->width =IOTEST_ACCESS_WIDTH ; test->mr =IOTEST_REGION (d, i); + +if (!test->size && !IOTEST_IS_MEM (i)) { + test->hasnotifier = false;
Quoted 8 lines
hw/misc/pci-testdev.c static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp) · line 281
Quoted 5 lines
hw/misc/pci-testdev.c +2
-0+continue ; + }if (!strcmp (IOTEST_TEST (i),"no-eventfd" )) { test->hasnotifier = false;continue ;Since you're at this, how about introduce a test that mixes datamatch and wildcard?
How do you mean? wildcard means ignore data ...
Quoted 33 lines · Michael S. Tsirkin
Quoted 22 lines · Jason Wang
Quoted 13 lines · Michael S. Tsirkin
Add nodata test where data length is ignored. Skip it for port IO since kvm does not support it there.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/misc/pci-testdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)hw/misc/pci-testdev.c +0
-0hw/misc/pci-testdev.c typedef struct IOTest { · line 48
Quoted 4 lines
hw/misc/pci-testdev.c +1
-0@@ -45,6 +45,7 @@ typedef struct IOTest {#define IOTEST_DATAMATCH 0xFA#define IOTEST_NOMATCH 0xCE +#define IOTEST_NODATA 0xABThis is never used.
Quoted 1 line
Quoted 10 lines
hw/misc/pci-testdev.c typedef struct IOTest { · line 57
Quoted 9 lines
#define
IOTEST_IOSIZE128
#defineIOTEST_MEMSIZE2048hw/misc/pci-testdev.c +2
-1@@ -52,7 +53,8 @@ typedef struct IOTest {static const char *iotest_test[] = {"no-eventfd" ,"wildcard-eventfd" , -"datamatch-eventfd" +"datamatch-eventfd" , +"nodata-eventfd" For PIO test, "nodata-eventfd" actually means "nodata-noeventfd".
Quoted 2 lines
Not really - this test is skipped completely for PIO, as kvm does not support it.
But I get:
...
portio-no-eventfd:pci-io 5024
portio-wildcard-eventfd:pci-io 1731
portio-datamatch-eventfd:pci-io 1731
portio-nodata-eventfd:pci-io 4967
...
Quoted 27 lines
Quoted 19 lines
Quoted 19 lines
hw/misc/pci-testdev.c +6
-2};static const char *iotest_type[] = {@@ -261,12 +263,19 @@ static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)memcpy (test->hdr->name, name,strlen (name) +1 );g_free (name); test->hdr->offset =cpu_to_le32 (IOTEST_SIZE (i) + i *IOTEST_ACCESS_WIDTH ); - test->size =IOTEST_ACCESS_WIDTH ; - test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ); + test->size =strcmp (IOTEST_TEST (i),"nodata-eventfd" ) ?IOTEST_ACCESS_WIDTH :0 ; + + test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ) && +strcmp (IOTEST_TEST (i),"nodata-eventfd" ); test->hdr->test = i; test->hdr->data = test->match_data ?IOTEST_DATAMATCH :IOTEST_NOMATCH ; test->hdr->width =IOTEST_ACCESS_WIDTH ; test->mr =IOTEST_REGION (d, i); + +if (!test->size && !IOTEST_IS_MEM (i)) {Quoted 8 lines
hw/misc/pci-testdev.c static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp) · line 281
Quoted 6 lines
hw/misc/pci-testdev.c +3
-0+ test->hasnotifier = false; +continue ; + }if (!strcmp (IOTEST_TEST (i),"no-eventfd" )) { test->hasnotifier = false;continue ;Since you're at this, how about introduce a test that mixes datamatch and wildcard?
Quoted 2 lines
How do you mean? wildcard means ignore data ...
I mean for example having both datamatch and wildcard eventfds in a single subtest. E.g in "datamatch-eventfd", registering 1 or more wildcard eventfd before doing the real tests.
Quoted 39 lines · Jason Wang
Quoted 33 lines · Michael S. Tsirkin
Quoted 22 lines · Jason Wang
Quoted 13 lines · Michael S. Tsirkin
Add nodata test where data length is ignored. Skip it for port IO since kvm does not support it there.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/misc/pci-testdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)hw/misc/pci-testdev.c +0
-0hw/misc/pci-testdev.c typedef struct IOTest { · line 48
Quoted 4 lines
hw/misc/pci-testdev.c +1
-0@@ -45,6 +45,7 @@ typedef struct IOTest {#define IOTEST_DATAMATCH 0xFA#define IOTEST_NOMATCH 0xCE +#define IOTEST_NODATA 0xABThis is never used.
Quoted 1 line
Quoted 10 lines
hw/misc/pci-testdev.c typedef struct IOTest { · line 57
Quoted 9 lines
#define
IOTEST_IOSIZE128
#defineIOTEST_MEMSIZE2048hw/misc/pci-testdev.c +2
-1@@ -52,7 +53,8 @@ typedef struct IOTest {static const char *iotest_test[] = {"no-eventfd" ,"wildcard-eventfd" , -"datamatch-eventfd" +"datamatch-eventfd" , +"nodata-eventfd" For PIO test, "nodata-eventfd" actually means "nodata-noeventfd".
Quoted 2 lines
Not really - this test is skipped completely for PIO, as kvm does not support it.
Quoted 8 lines
But I get:
...
portio-no-eventfd:pci-io 5024
portio-wildcard-eventfd:pci-io 1731
portio-datamatch-eventfd:pci-io 1731
portio-nodata-eventfd:pci-io 4967
...
Weird - I thought I fixed it, but now I see it too. I'll add code to drop portio-nodata-eventfd.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 15 lines
hw/misc/pci-testdev.c +4
-2};static const char *iotest_type[] = {@@ -261,12 +263,19 @@ static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)memcpy (test->hdr->name, name,strlen (name) +1 );g_free (name); test->hdr->offset =cpu_to_le32 (IOTEST_SIZE (i) + i *IOTEST_ACCESS_WIDTH ); - test->size =IOTEST_ACCESS_WIDTH ; - test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ); + test->size =strcmp (IOTEST_TEST (i),"nodata-eventfd" ) ?IOTEST_ACCESS_WIDTH :0 ; + + test->match_data =strcmp (IOTEST_TEST (i),"wildcard-eventfd" ) && +strcmp (IOTEST_TEST (i),"nodata-eventfd" ); test->hdr->test = i; test->hdr->data = test->match_data ?IOTEST_DATAMATCH :IOTEST_NOMATCH ;hw/misc/pci-testdev.c static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp) · line 281
Quoted 10 lines
hw/misc/pci-testdev.c +5
-0test->hdr->width =IOTEST_ACCESS_WIDTH ; test->mr =IOTEST_REGION (d, i); + +if (!test->size && !IOTEST_IS_MEM (i)) { + test->hasnotifier = false; +continue ; + }if (!strcmp (IOTEST_TEST (i),"no-eventfd" )) { test->hasnotifier = false;continue ;Since you're at this, how about introduce a test that mixes datamatch and wildcard?
Quoted 6 lines
Quoted 2 lines
How do you mean? wildcard means ignore data ...
I mean for example having both datamatch and wildcard eventfds in a single subtest. E.g in "datamatch-eventfd", registering 1 or more wildcard eventfd before doing the real tests.
For same address? We can't do that - kvm won't let us.
Signature · 1 line
MST
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Since you're at this, how about introduce a test that mixes datamatch
Quoted 3 lines
Quoted 1 line
Quoted 1 line
and wildcard?
How do you mean? wildcard means ignore data ...
I mean for example having both datamatch and wildcard eventfds in a single subtest. E.g in "datamatch-eventfd", registering 1 or more wildcard eventfd before doing the real tests.
For same address? We can't do that - kvm won't let us.
Not same. Which can make test to be more similar like real machine.