RE: [PATCH 1/4] KVM: support VT-d device hotplug

Han, Weidong
2008-11-18T03:32:30Z

Avi Kivity wrote:
> Han, Weidong wrote:
>>> This is how KVM_CAP_ works:
>>>
>>> - kvm.h defines KVM_CAP_DEVICE_ASSIGNMENT
>>> - userspace compiles device assignment code only if it sees
>>> KVM_CAP_DEVICE_ASSIGNMENT in kvm.h
>>> - kvm.ko returns nonzero to ioctl(KVM_CHECK_EXTENSION,
>>> KVM_CAP_DEVICE_ASSIGNMENT) if it supports device assignment (recent
>>> enough module, iommu found) - userspace runs device assignment code
>>> only if above ioctl passes
>>>
>>> We need something similar to deassignment, since it didn't arrive
>>> at the same time as assignment.
>>>
>>
>> In my patches, deassignment already does the similar thing as
>> assignment. Can you point out where it is missed?
>>
>
> It needs a new KVM_CAP_ symbol. 2.6.28 has KVM_CAP_DEVICE_ASSIGNMENT
> defined, but will not have the deassignment code.

In fact, without multiple device assignment, VT-d hotplug cannot be supported cleanly. Given hot add a device under a different iommu, it will be mapped in a wrong iommu, thus it won't work. I will start to implement multiple device assignment first.

Regards,
Weidong