Lines Matching refs:test
30 uint8_t test; member
107 static int pci_testdev_start(IOTest *test) in OBJECT_DECLARE_SIMPLE_TYPE()
109 test->hdr->count = 0; in OBJECT_DECLARE_SIMPLE_TYPE()
110 if (!test->hasnotifier) { in OBJECT_DECLARE_SIMPLE_TYPE()
113 event_notifier_test_and_clear(&test->notifier); in OBJECT_DECLARE_SIMPLE_TYPE()
114 memory_region_add_eventfd(test->mr, in OBJECT_DECLARE_SIMPLE_TYPE()
115 le32_to_cpu(test->hdr->offset), in OBJECT_DECLARE_SIMPLE_TYPE()
116 test->size, in OBJECT_DECLARE_SIMPLE_TYPE()
117 test->match_data, in OBJECT_DECLARE_SIMPLE_TYPE()
118 test->hdr->data, in OBJECT_DECLARE_SIMPLE_TYPE()
119 &test->notifier); in OBJECT_DECLARE_SIMPLE_TYPE()
123 static void pci_testdev_stop(IOTest *test) in pci_testdev_stop() argument
125 if (!test->hasnotifier) { in pci_testdev_stop()
128 memory_region_del_eventfd(test->mr, in pci_testdev_stop()
129 le32_to_cpu(test->hdr->offset), in pci_testdev_stop()
130 test->size, in pci_testdev_stop()
131 test->match_data, in pci_testdev_stop()
132 test->hdr->data, in pci_testdev_stop()
133 &test->notifier); in pci_testdev_stop()
146 static void pci_testdev_inc(IOTest *test, unsigned inc) in pci_testdev_inc() argument
148 uint32_t c = le32_to_cpu(test->hdr->count); in pci_testdev_inc()
149 test->hdr->count = cpu_to_le32(c + inc); in pci_testdev_inc()
157 IOTest *test; in pci_testdev_write() local
160 if (addr == offsetof(PCITestDevHdr, test)) { in pci_testdev_write()
176 test = &d->tests[d->current]; in pci_testdev_write()
177 if (addr != le32_to_cpu(test->hdr->offset)) { in pci_testdev_write()
180 if (test->match_data && test->size != size) { in pci_testdev_write()
183 if (test->match_data && val != test->hdr->data) { in pci_testdev_write()
186 pci_testdev_inc(test, 1); in pci_testdev_write()
194 IOTest *test; in pci_testdev_read() local
198 test = &d->tests[d->current]; in pci_testdev_read()
199 buf = (const char *)test->hdr; in pci_testdev_read()
200 if (addr + size >= test->bufsize) { in pci_testdev_read()
203 if (test->hasnotifier) { in pci_testdev_read()
204 event_notifier_test_and_clear(&test->notifier); in pci_testdev_read()
280 IOTest *test = &d->tests[i]; in pci_testdev_realize() local
282 test->bufsize = sizeof(PCITestDevHdr) + strlen(name) + 1; in pci_testdev_realize()
283 test->hdr = g_malloc0(test->bufsize); in pci_testdev_realize()
284 memcpy(test->hdr->name, name, strlen(name) + 1); in pci_testdev_realize()
286 test->hdr->offset = cpu_to_le32(IOTEST_SIZE(i) + i * IOTEST_ACCESS_WIDTH); in pci_testdev_realize()
287 test->match_data = strcmp(IOTEST_TEST(i), "wildcard-eventfd"); in pci_testdev_realize()
288 if (IOTEST_IS_MEM(i) && !test->match_data) { in pci_testdev_realize()
289 test->size = 0; in pci_testdev_realize()
291 test->size = IOTEST_ACCESS_WIDTH; in pci_testdev_realize()
293 test->hdr->test = i; in pci_testdev_realize()
294 test->hdr->data = test->match_data ? IOTEST_DATAMATCH : IOTEST_NOMATCH; in pci_testdev_realize()
295 test->hdr->width = IOTEST_ACCESS_WIDTH; in pci_testdev_realize()
296 test->mr = IOTEST_REGION(d, i); in pci_testdev_realize()
298 test->hasnotifier = false; in pci_testdev_realize()
301 r = event_notifier_init(&test->notifier, 0); in pci_testdev_realize()
303 test->hasnotifier = true; in pci_testdev_realize()