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

Han, Weidong
2008-11-17T14:21:59Z

Avi Kivity wrote:
> Han, Weidong wrote:
>> Avi Kivity wrote:
>>
>>> Han, Weidong wrote:
>>>
>>>>> Need a KVM_CAP_ to indicate this is available.
>>>>>
>>>>>
>>>>>
>>>> KVM_ASSIGN_PCI_DEVICE and KVM_ASSIGN_IRQ don't need a KVM_CAP_xxx.
>>>> Why do you need it for KVM_DEASSIGN_PCI_DEVICE?
>>>>
>>>>
>>>>
>>> #define KVM_CAP_DEVICE_ASSIGNMENT 17
>>>
>>
>> Do you mean add it like that:
>>
>> #ifdef KVM_CAP_DEVICE_ASSIGNMENT
>> #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
>> struct kvm_assigned_pci_dev)
>> #define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \
>> struct kvm_assigned_irq)
>> #define KVM_DEASSIGN_PCI_DEVICE _IOR(KVMIO, 0x71, \
>> struct kvm_assigned_pci_dev) #endif
>>
>
> No, sorry for being unclear. KVM_CAP_DEVICE_ASSIGNMENT already exists
> in kvm.h
>
> 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?

Regards,
Weidong