diff mbox

[2/2] pci: test-dev: try to test fast mmio bus for wildcard mmio event

Message ID 1440583448-15797-2-git-send-email-jasowang@redhat.com
State New
Headers show

Commit Message

Jason Wang Aug. 26, 2015, 10:04 a.m. UTC
Test fast mmio by using zero size eventfd.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/misc/pci-testdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Michael S. Tsirkin Aug. 27, 2015, 10:28 a.m. UTC | #1
On Wed, Aug 26, 2015 at 06:04:08PM +0800, Jason Wang wrote:
> Test fast mmio by using zero size eventfd.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>

wildcard is not the same as ignoring length.
I think I have a nicer patch, will post now.

> ---
>  hw/misc/pci-testdev.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
> index 26b9b86..7bf67ed 100644
> --- a/hw/misc/pci-testdev.c
> +++ b/hw/misc/pci-testdev.c
> @@ -261,8 +261,12 @@ 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");
> +        if (!test->match_data && !strcmp(IOTEST_TYPE(i), "mmio")) {
> +            test->size = 0;
> +        } else {
> +            test->size = IOTEST_ACCESS_WIDTH;
> +        }
>          test->hdr->test = i;
>          test->hdr->data = test->match_data ? IOTEST_DATAMATCH : IOTEST_NOMATCH;
>          test->hdr->width = IOTEST_ACCESS_WIDTH;
> -- 
> 2.1.4
diff mbox

Patch

diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
index 26b9b86..7bf67ed 100644
--- a/hw/misc/pci-testdev.c
+++ b/hw/misc/pci-testdev.c
@@ -261,8 +261,12 @@  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");
+        if (!test->match_data && !strcmp(IOTEST_TYPE(i), "mmio")) {
+            test->size = 0;
+        } else {
+            test->size = IOTEST_ACCESS_WIDTH;
+        }
         test->hdr->test = i;
         test->hdr->data = test->match_data ? IOTEST_DATAMATCH : IOTEST_NOMATCH;
         test->hdr->width = IOTEST_ACCESS_WIDTH;