2 * Copyright (c) 2007, Neocleus Corporation.
3 * Copyright (c) 2007, Intel Corporation.
5 * This work is licensed under the terms of the GNU GPL, version 2. See
6 * the COPYING file in the top-level directory.
8 * Alex Novik <alex@neocleus.com>
9 * Allen Kay <allen.m.kay@intel.com>
10 * Guy Zana <guy@neocleus.com>
12 * This file implements direct PCI assignment to a HVM guest
16 * Interrupt Disable policy:
19 * Initialize(register_real_device)
20 * Map INTx(xc_physdev_map_pirq):
22 * - Set real Interrupt Disable bit to '1'.
23 * - Set machine_irq and assigned_device->machine_irq to '0'.
26 * Bind INTx(xc_domain_bind_pt_pci_irq):
28 * - Set real Interrupt Disable bit to '1'.
30 * - Decrement xen_pt_mapped_machine_irq[machine_irq]
31 * - Set assigned_device->machine_irq to '0'.
33 * Write to Interrupt Disable bit by guest software(xen_pt_cmd_reg_write)
35 * - Set real bit to '0' if assigned_device->machine_irq isn't '0'.
38 * - Set real bit to '1'.
41 * Initialize MSI register(xen_pt_msi_setup, xen_pt_msi_update)
42 * Bind MSI(xc_domain_update_msi_irq)
45 * - Set dev->msi->pirq to '-1'.
48 * Initialize MSI-X register(xen_pt_msix_update_one)
49 * Bind MSI-X(xc_domain_update_msi_irq)
52 * - Set entry->pirq to '-1'.
55 #include <sys/ioctl.h>
59 #include "xen_backend.h"
62 #include "exec/address-spaces.h"
64 #define XEN_PT_NR_IRQS (256)
65 static uint8_t xen_pt_mapped_machine_irq[XEN_PT_NR_IRQS] = {0};
67 void xen_pt_log(const PCIDevice *d, const char *f, ...)
73 fprintf(stderr, "[%02x:%02x.%d] ", pci_bus_num(d->bus),
74 PCI_SLOT(d->devfn), PCI_FUNC(d->devfn));
76 vfprintf(stderr, f, ap);
82 static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len)
84 /* check offset range */
86 XEN_PT_ERR(d, "Failed to access register with offset exceeding 0xFF. "
87 "(addr: 0x%02x, len: %d)\n", addr, len);
92 if ((len != 1) && (len != 2) && (len != 4)) {
93 XEN_PT_ERR(d, "Failed to access register with invalid access length. "
94 "(addr: 0x%02x, len: %d)\n", addr, len);
98 /* check offset alignment */
99 if (addr & (len - 1)) {
100 XEN_PT_ERR(d, "Failed to access register with invalid access size "
101 "alignment. (addr: 0x%02x, len: %d)\n", addr, len);
108 int xen_pt_bar_offset_to_index(uint32_t offset)
112 /* check Exp ROM BAR */
113 if (offset == PCI_ROM_ADDRESS) {
117 /* calculate BAR index */
118 index = (offset - PCI_BASE_ADDRESS_0) >> 2;
119 if (index >= PCI_NUM_REGIONS) {
126 static uint32_t xen_pt_pci_read_config(PCIDevice *d, uint32_t addr, int len)
128 XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d);
130 XenPTRegGroup *reg_grp_entry = NULL;
131 XenPTReg *reg_entry = NULL;
134 uint32_t find_addr = addr;
136 if (xen_pt_pci_config_access_check(d, addr, len)) {
140 /* find register group entry */
141 reg_grp_entry = xen_pt_find_reg_grp(s, addr);
143 /* check 0-Hardwired register group */
144 if (reg_grp_entry->reg_grp->grp_type == XEN_PT_GRP_TYPE_HARDWIRED) {
145 /* no need to emulate, just return 0 */
151 /* read I/O device register value */
152 rc = xen_host_pci_get_block(&s->real_device, addr, (uint8_t *)&val, len);
154 XEN_PT_ERR(d, "pci_read_block failed. return value: %d.\n", rc);
155 memset(&val, 0xff, len);
158 /* just return the I/O device register value for
159 * passthrough type register group */
160 if (reg_grp_entry == NULL) {
164 /* adjust the read value to appropriate CFC-CFF window */
165 val <<= (addr & 3) << 3;
168 /* loop around the guest requested size */
169 while (emul_len > 0) {
170 /* find register entry to be emulated */
171 reg_entry = xen_pt_find_reg(reg_grp_entry, find_addr);
173 XenPTRegInfo *reg = reg_entry->reg;
174 uint32_t real_offset = reg_grp_entry->base_offset + reg->offset;
175 uint32_t valid_mask = 0xFFFFFFFF >> ((4 - emul_len) << 3);
176 uint8_t *ptr_val = NULL;
178 valid_mask <<= (find_addr - real_offset) << 3;
179 ptr_val = (uint8_t *)&val + (real_offset & 3);
181 /* do emulation based on register size */
185 rc = reg->u.b.read(s, reg_entry, ptr_val, valid_mask);
190 rc = reg->u.w.read(s, reg_entry,
191 (uint16_t *)ptr_val, valid_mask);
195 if (reg->u.dw.read) {
196 rc = reg->u.dw.read(s, reg_entry,
197 (uint32_t *)ptr_val, valid_mask);
203 xen_shutdown_fatal_error("Internal error: Invalid read "
204 "emulation. (%s, rc: %d)\n",
209 /* calculate next address to find */
210 emul_len -= reg->size;
212 find_addr = real_offset + reg->size;
215 /* nothing to do with passthrough type register,
216 * continue to find next byte */
222 /* need to shift back before returning them to pci bus emulator */
223 val >>= ((addr & 3) << 3);
226 XEN_PT_LOG_CONFIG(d, addr, val, len);
230 static void xen_pt_pci_write_config(PCIDevice *d, uint32_t addr,
231 uint32_t val, int len)
233 XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d);
235 XenPTRegGroup *reg_grp_entry = NULL;
237 uint32_t read_val = 0;
239 XenPTReg *reg_entry = NULL;
240 uint32_t find_addr = addr;
241 XenPTRegInfo *reg = NULL;
243 if (xen_pt_pci_config_access_check(d, addr, len)) {
247 XEN_PT_LOG_CONFIG(d, addr, val, len);
249 /* check unused BAR register */
250 index = xen_pt_bar_offset_to_index(addr);
251 if ((index >= 0) && (val > 0 && val < XEN_PT_BAR_ALLF) &&
252 (s->bases[index].bar_flag == XEN_PT_BAR_FLAG_UNUSED)) {
253 XEN_PT_WARN(d, "Guest attempt to set address to unused Base Address "
254 "Register. (addr: 0x%02x, len: %d)\n", addr, len);
257 /* find register group entry */
258 reg_grp_entry = xen_pt_find_reg_grp(s, addr);
260 /* check 0-Hardwired register group */
261 if (reg_grp_entry->reg_grp->grp_type == XEN_PT_GRP_TYPE_HARDWIRED) {
262 /* ignore silently */
263 XEN_PT_WARN(d, "Access to 0-Hardwired register. "
264 "(addr: 0x%02x, len: %d)\n", addr, len);
269 rc = xen_host_pci_get_block(&s->real_device, addr,
270 (uint8_t *)&read_val, len);
272 XEN_PT_ERR(d, "pci_read_block failed. return value: %d.\n", rc);
273 memset(&read_val, 0xff, len);
276 /* pass directly to the real device for passthrough type register group */
277 if (reg_grp_entry == NULL) {
281 memory_region_transaction_begin();
282 pci_default_write_config(d, addr, val, len);
284 /* adjust the read and write value to appropriate CFC-CFF window */
285 read_val <<= (addr & 3) << 3;
286 val <<= (addr & 3) << 3;
289 /* loop around the guest requested size */
290 while (emul_len > 0) {
291 /* find register entry to be emulated */
292 reg_entry = xen_pt_find_reg(reg_grp_entry, find_addr);
294 reg = reg_entry->reg;
295 uint32_t real_offset = reg_grp_entry->base_offset + reg->offset;
296 uint32_t valid_mask = 0xFFFFFFFF >> ((4 - emul_len) << 3);
297 uint8_t *ptr_val = NULL;
299 valid_mask <<= (find_addr - real_offset) << 3;
300 ptr_val = (uint8_t *)&val + (real_offset & 3);
302 /* do emulation based on register size */
305 if (reg->u.b.write) {
306 rc = reg->u.b.write(s, reg_entry, ptr_val,
307 read_val >> ((real_offset & 3) << 3),
312 if (reg->u.w.write) {
313 rc = reg->u.w.write(s, reg_entry, (uint16_t *)ptr_val,
314 (read_val >> ((real_offset & 3) << 3)),
319 if (reg->u.dw.write) {
320 rc = reg->u.dw.write(s, reg_entry, (uint32_t *)ptr_val,
321 (read_val >> ((real_offset & 3) << 3)),
328 xen_shutdown_fatal_error("Internal error: Invalid write"
329 " emulation. (%s, rc: %d)\n",
334 /* calculate next address to find */
335 emul_len -= reg->size;
337 find_addr = real_offset + reg->size;
340 /* nothing to do with passthrough type register,
341 * continue to find next byte */
347 /* need to shift back before passing them to xen_host_pci_device */
348 val >>= (addr & 3) << 3;
350 memory_region_transaction_commit();
353 if (!(reg && reg->no_wb)) {
354 /* unknown regs are passed through */
355 rc = xen_host_pci_set_block(&s->real_device, addr,
356 (uint8_t *)&val, len);
359 XEN_PT_ERR(d, "pci_write_block failed. return value: %d.\n", rc);
364 /* register regions */
366 static uint64_t xen_pt_bar_read(void *o, hwaddr addr,
370 /* if this function is called, that probably means that there is a
371 * misconfiguration of the IOMMU. */
372 XEN_PT_ERR(d, "Should not read BAR through QEMU. @0x"TARGET_FMT_plx"\n",
376 static void xen_pt_bar_write(void *o, hwaddr addr, uint64_t val,
380 /* Same comment as xen_pt_bar_read function */
381 XEN_PT_ERR(d, "Should not write BAR through QEMU. @0x"TARGET_FMT_plx"\n",
385 static const MemoryRegionOps ops = {
386 .endianness = DEVICE_NATIVE_ENDIAN,
387 .read = xen_pt_bar_read,
388 .write = xen_pt_bar_write,
391 static int xen_pt_register_regions(XenPCIPassthroughState *s)
394 XenHostPCIDevice *d = &s->real_device;
396 /* Register PIO/MMIO BARs */
397 for (i = 0; i < PCI_ROM_SLOT; i++) {
398 XenHostPCIIORegion *r = &d->io_regions[i];
401 if (r->base_addr == 0 || r->size == 0) {
405 s->bases[i].access.u = r->base_addr;
407 if (r->type & XEN_HOST_PCI_REGION_TYPE_IO) {
408 type = PCI_BASE_ADDRESS_SPACE_IO;
410 type = PCI_BASE_ADDRESS_SPACE_MEMORY;
411 if (r->type & XEN_HOST_PCI_REGION_TYPE_PREFETCH) {
412 type |= PCI_BASE_ADDRESS_MEM_PREFETCH;
414 if (r->type & XEN_HOST_PCI_REGION_TYPE_MEM_64) {
415 type |= PCI_BASE_ADDRESS_MEM_TYPE_64;
419 memory_region_init_io(&s->bar[i], &ops, &s->dev,
420 "xen-pci-pt-bar", r->size);
421 pci_register_bar(&s->dev, i, type, &s->bar[i]);
423 XEN_PT_LOG(&s->dev, "IO region %i registered (size=0x%lx"PRIx64
424 " base_addr=0x%lx"PRIx64" type: %#x)\n",
425 i, r->size, r->base_addr, type);
428 /* Register expansion ROM address */
429 if (d->rom.base_addr && d->rom.size) {
430 uint32_t bar_data = 0;
432 /* Re-set BAR reported by OS, otherwise ROM can't be read. */
433 if (xen_host_pci_get_long(d, PCI_ROM_ADDRESS, &bar_data)) {
436 if ((bar_data & PCI_ROM_ADDRESS_MASK) == 0) {
437 bar_data |= d->rom.base_addr & PCI_ROM_ADDRESS_MASK;
438 xen_host_pci_set_long(d, PCI_ROM_ADDRESS, bar_data);
441 s->bases[PCI_ROM_SLOT].access.maddr = d->rom.base_addr;
443 memory_region_init_rom_device(&s->rom, NULL, NULL,
444 "xen-pci-pt-rom", d->rom.size);
445 pci_register_bar(&s->dev, PCI_ROM_SLOT, PCI_BASE_ADDRESS_MEM_PREFETCH,
448 XEN_PT_LOG(&s->dev, "Expansion ROM registered (size=0x%08"PRIx64
449 " base_addr=0x%08"PRIx64")\n",
450 d->rom.size, d->rom.base_addr);
456 static void xen_pt_unregister_regions(XenPCIPassthroughState *s)
458 XenHostPCIDevice *d = &s->real_device;
461 for (i = 0; i < PCI_NUM_REGIONS - 1; i++) {
462 XenHostPCIIORegion *r = &d->io_regions[i];
464 if (r->base_addr == 0 || r->size == 0) {
468 memory_region_destroy(&s->bar[i]);
470 if (d->rom.base_addr && d->rom.size) {
471 memory_region_destroy(&s->rom);
477 static int xen_pt_bar_from_region(XenPCIPassthroughState *s, MemoryRegion *mr)
481 for (i = 0; i < PCI_NUM_REGIONS - 1; i++) {
482 if (mr == &s->bar[i]) {
493 * This function checks if an io_region overlaps an io_region from another
494 * device. The io_region to check is provided with (addr, size and type)
495 * A callback can be provided and will be called for every region that is
497 * The return value indicates if the region is overlappsed */
498 struct CheckBarArgs {
499 XenPCIPassthroughState *s;
505 static void xen_pt_check_bar_overlap(PCIBus *bus, PCIDevice *d, void *opaque)
507 struct CheckBarArgs *arg = opaque;
508 XenPCIPassthroughState *s = arg->s;
509 uint8_t type = arg->type;
512 if (d->devfn == s->dev.devfn) {
516 /* xxx: This ignores bridges. */
517 for (i = 0; i < PCI_NUM_REGIONS; i++) {
518 const PCIIORegion *r = &d->io_regions[i];
523 if ((type & PCI_BASE_ADDRESS_SPACE_IO)
524 != (r->type & PCI_BASE_ADDRESS_SPACE_IO)) {
528 if (ranges_overlap(arg->addr, arg->size, r->addr, r->size)) {
530 "Overlapped to device [%02x:%02x.%d] Region: %i"
531 " (addr: %#"FMT_PCIBUS", len: %#"FMT_PCIBUS")\n",
532 pci_bus_num(bus), PCI_SLOT(d->devfn),
533 PCI_FUNC(d->devfn), i, r->addr, r->size);
539 static void xen_pt_region_update(XenPCIPassthroughState *s,
540 MemoryRegionSection *sec, bool adding)
542 PCIDevice *d = &s->dev;
543 MemoryRegion *mr = sec->mr;
546 int op = adding ? DPCI_ADD_MAPPING : DPCI_REMOVE_MAPPING;
547 struct CheckBarArgs args = {
549 .addr = sec->offset_within_address_space,
554 bar = xen_pt_bar_from_region(s, mr);
555 if (bar == -1 && (!s->msix || &s->msix->mmio != mr)) {
559 if (s->msix && &s->msix->mmio == mr) {
561 s->msix->mmio_base_addr = sec->offset_within_address_space;
562 rc = xen_pt_msix_update_remap(s, s->msix->bar_index);
567 args.type = d->io_regions[bar].type;
568 pci_for_each_device(d->bus, pci_bus_num(d->bus),
569 xen_pt_check_bar_overlap, &args);
571 XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS
572 ", len: %#"FMT_PCIBUS") is overlapped.\n",
573 bar, sec->offset_within_address_space, sec->size);
576 if (d->io_regions[bar].type & PCI_BASE_ADDRESS_SPACE_IO) {
577 uint32_t guest_port = sec->offset_within_address_space;
578 uint32_t machine_port = s->bases[bar].access.pio_base;
579 uint32_t size = sec->size;
580 rc = xc_domain_ioport_mapping(xen_xc, xen_domid,
581 guest_port, machine_port, size,
584 XEN_PT_ERR(d, "%s ioport mapping failed! (rc: %i)\n",
585 adding ? "create new" : "remove old", rc);
588 pcibus_t guest_addr = sec->offset_within_address_space;
589 pcibus_t machine_addr = s->bases[bar].access.maddr
590 + sec->offset_within_region;
591 pcibus_t size = sec->size;
592 rc = xc_domain_memory_mapping(xen_xc, xen_domid,
593 XEN_PFN(guest_addr + XC_PAGE_SIZE - 1),
594 XEN_PFN(machine_addr + XC_PAGE_SIZE - 1),
595 XEN_PFN(size + XC_PAGE_SIZE - 1),
598 XEN_PT_ERR(d, "%s mem mapping failed! (rc: %i)\n",
599 adding ? "create new" : "remove old", rc);
604 static void xen_pt_region_add(MemoryListener *l, MemoryRegionSection *sec)
606 XenPCIPassthroughState *s = container_of(l, XenPCIPassthroughState,
609 xen_pt_region_update(s, sec, true);
612 static void xen_pt_region_del(MemoryListener *l, MemoryRegionSection *sec)
614 XenPCIPassthroughState *s = container_of(l, XenPCIPassthroughState,
617 xen_pt_region_update(s, sec, false);
620 static void xen_pt_io_region_add(MemoryListener *l, MemoryRegionSection *sec)
622 XenPCIPassthroughState *s = container_of(l, XenPCIPassthroughState,
625 xen_pt_region_update(s, sec, true);
628 static void xen_pt_io_region_del(MemoryListener *l, MemoryRegionSection *sec)
630 XenPCIPassthroughState *s = container_of(l, XenPCIPassthroughState,
633 xen_pt_region_update(s, sec, false);
636 static const MemoryListener xen_pt_memory_listener = {
637 .region_add = xen_pt_region_add,
638 .region_del = xen_pt_region_del,
642 static const MemoryListener xen_pt_io_listener = {
643 .region_add = xen_pt_io_region_add,
644 .region_del = xen_pt_io_region_del,
650 static int xen_pt_initfn(PCIDevice *d)
652 XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d);
654 uint8_t machine_irq = 0;
655 int pirq = XEN_PT_UNASSIGNED_PIRQ;
657 /* register real device */
658 XEN_PT_LOG(d, "Assigning real physical device %02x:%02x.%d"
660 s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function,
663 rc = xen_host_pci_device_get(&s->real_device,
664 s->hostaddr.domain, s->hostaddr.bus,
665 s->hostaddr.slot, s->hostaddr.function);
667 XEN_PT_ERR(d, "Failed to \"open\" the real pci device. rc: %i\n", rc);
671 s->is_virtfn = s->real_device.is_virtfn;
673 XEN_PT_LOG(d, "%04x:%02x:%02x.%d is a SR-IOV Virtual Function\n",
674 s->real_device.domain, bus, slot, func);
677 /* Initialize virtualized PCI configuration (Extended 256 Bytes) */
678 if (xen_host_pci_get_block(&s->real_device, 0, d->config,
679 PCI_CONFIG_SPACE_SIZE) == -1) {
680 xen_host_pci_device_put(&s->real_device);
684 s->memory_listener = xen_pt_memory_listener;
685 s->io_listener = xen_pt_io_listener;
687 /* Handle real device's MMIO/PIO BARs */
688 xen_pt_register_regions(s);
690 /* reinitialize each config register to be emulated */
691 if (xen_pt_config_init(s)) {
692 XEN_PT_ERR(d, "PCI Config space initialisation failed.\n");
693 xen_host_pci_device_put(&s->real_device);
698 if (!s->dev.config[PCI_INTERRUPT_PIN]) {
699 XEN_PT_LOG(d, "no pin interrupt\n");
703 machine_irq = s->real_device.irq;
704 rc = xc_physdev_map_pirq(xen_xc, xen_domid, machine_irq, &pirq);
707 XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (rc: %d)\n",
708 machine_irq, pirq, rc);
710 /* Disable PCI intx assertion (turn on bit10 of devctl) */
711 xen_host_pci_set_word(&s->real_device,
713 pci_get_word(s->dev.config + PCI_COMMAND)
714 | PCI_COMMAND_INTX_DISABLE);
719 s->machine_irq = pirq;
720 xen_pt_mapped_machine_irq[machine_irq]++;
723 /* bind machine_irq to device */
724 if (machine_irq != 0) {
725 uint8_t e_intx = xen_pt_pci_intx(s);
727 rc = xc_domain_bind_pt_pci_irq(xen_xc, xen_domid, machine_irq,
732 XEN_PT_ERR(d, "Binding of interrupt %i failed! (rc: %d)\n",
735 /* Disable PCI intx assertion (turn on bit10 of devctl) */
736 xen_host_pci_set_word(&s->real_device, PCI_COMMAND,
737 *(uint16_t *)(&s->dev.config[PCI_COMMAND])
738 | PCI_COMMAND_INTX_DISABLE);
739 xen_pt_mapped_machine_irq[machine_irq]--;
741 if (xen_pt_mapped_machine_irq[machine_irq] == 0) {
742 if (xc_physdev_unmap_pirq(xen_xc, xen_domid, machine_irq)) {
743 XEN_PT_ERR(d, "Unmapping of machine interrupt %i failed!"
744 " (rc: %d)\n", machine_irq, rc);
752 memory_listener_register(&s->memory_listener, &address_space_memory);
753 memory_listener_register(&s->io_listener, &address_space_io);
754 XEN_PT_LOG(d, "Real physical device %02x:%02x.%d registered successfuly!\n",
760 static void xen_pt_unregister_device(PCIDevice *d)
762 XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d);
763 uint8_t machine_irq = s->machine_irq;
764 uint8_t intx = xen_pt_pci_intx(s);
768 rc = xc_domain_unbind_pt_irq(xen_xc, xen_domid, machine_irq,
771 PCI_SLOT(s->dev.devfn),
775 XEN_PT_ERR(d, "unbinding of interrupt INT%c failed."
776 " (machine irq: %i, rc: %d)"
777 " But bravely continuing on..\n",
778 'a' + intx, machine_irq, rc);
783 xen_pt_msi_disable(s);
786 xen_pt_msix_disable(s);
790 xen_pt_mapped_machine_irq[machine_irq]--;
792 if (xen_pt_mapped_machine_irq[machine_irq] == 0) {
793 rc = xc_physdev_unmap_pirq(xen_xc, xen_domid, machine_irq);
796 XEN_PT_ERR(d, "unmapping of interrupt %i failed. (rc: %d)"
797 " But bravely continuing on..\n",
803 /* delete all emulated config registers */
804 xen_pt_config_delete(s);
806 xen_pt_unregister_regions(s);
807 memory_listener_unregister(&s->memory_listener);
808 memory_listener_unregister(&s->io_listener);
810 xen_host_pci_device_put(&s->real_device);
813 static Property xen_pci_passthrough_properties[] = {
814 DEFINE_PROP_PCI_HOST_DEVADDR("hostaddr", XenPCIPassthroughState, hostaddr),
815 DEFINE_PROP_END_OF_LIST(),
818 static void xen_pci_passthrough_class_init(ObjectClass *klass, void *data)
820 DeviceClass *dc = DEVICE_CLASS(klass);
821 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
823 k->init = xen_pt_initfn;
824 k->exit = xen_pt_unregister_device;
825 k->config_read = xen_pt_pci_read_config;
826 k->config_write = xen_pt_pci_write_config;
827 dc->desc = "Assign an host PCI device with Xen";
828 dc->props = xen_pci_passthrough_properties;
831 static TypeInfo xen_pci_passthrough_info = {
832 .name = "xen-pci-passthrough",
833 .parent = TYPE_PCI_DEVICE,
834 .instance_size = sizeof(XenPCIPassthroughState),
835 .class_init = xen_pci_passthrough_class_init,
838 static void xen_pci_passthrough_register_types(void)
840 type_register_static(&xen_pci_passthrough_info);
843 type_init(xen_pci_passthrough_register_types)