[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] pci-testdev: add nodata test
From: |
Gonglei |
Subject: |
Re: [Qemu-devel] [PATCH] pci-testdev: add nodata test |
Date: |
Thu, 27 Aug 2015 19:47:03 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 2015/8/27 18:30, Michael S. Tsirkin wrote:
> 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 <address@hidden>
> ---
> hw/misc/pci-testdev.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
Reviewed-by: Gonglei <address@hidden>
> diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
> index 26b9b86..b6e11d6 100644
> --- a/hw/misc/pci-testdev.c
> +++ b/hw/misc/pci-testdev.c
> @@ -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;
>