/* * hotplug_device tries to find changes in the device page. */ static void hotplug_devices(struct work_struct *dummy) { unsigned int i; struct kvm_device_desc *d; struct device *dev; for (i = 0; i < PAGE_SIZE; i += desc_size(d)) { d = kvm_devices + i; /* end of list */ if (d->type == 0) break; /* device already exists */ dev = device_find_child(kvm_root, d, match_desc); if (dev) { /* XXX check for hotplug remove */ put_device(dev); continue; } /* new device */ printk(KERN_INFO "Adding new virtio device %p\n", d); add_kvm_device(d, i); } }
/* * scan_devices() simply iterates through the device page. * The type 0 is reserved to mean "end of devices". */ static void scan_devices(void) { unsigned int i; struct kvm_device_desc *d; for (i = 0; i < PAGE_SIZE; i += desc_size(d)) { d = kvm_devices + i; if (d->type == 0) break; add_kvm_device(d, i); } }