Reuse KVM_DEV_ASSIGN_ENABLE_IOMMU for an in-kernel struct didn't make much sense. Signed-off-by: Sheng Yang <sheng@xxxxxxxxxxxxxxx> --- include/linux/kvm_host.h | 1 + virt/kvm/assigned-dev.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 274655b..f09db87 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -500,6 +500,7 @@ struct kvm_guest_msix_entry { u16 flags; }; +#define KVM_ASSIGNED_ENABLED_IOMMU (1 << 0) struct kvm_assigned_dev_kernel { struct kvm_irq_ack_notifier ack_notifier; struct work_struct interrupt_work; diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 7c98928..5c6b96d 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -552,7 +552,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, match->host_segnr = assigned_dev->segnr; match->host_busnr = assigned_dev->busnr; match->host_devfn = assigned_dev->devfn; - match->flags = assigned_dev->flags; + if (assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU) + match->flags |= KVM_ASSIGNED_ENABLED_IOMMU; match->dev = dev; spin_lock_init(&match->assigned_dev_lock); match->irq_source_id = -1; @@ -563,7 +564,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, list_add(&match->list, &kvm->arch.assigned_dev_head); - if (assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU) { + if (assigned_dev->flags & KVM_ASSIGNED_ENABLED_IOMMU) { if (!kvm->arch.iommu_domain) { r = kvm_iommu_map_guest(kvm); if (r) @@ -609,7 +610,7 @@ static int kvm_vm_ioctl_deassign_device(struct kvm *kvm, goto out; } - if (match->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU) + if (match->flags & KVM_ASSIGNED_ENABLED_IOMMU) kvm_deassign_device(kvm, match); kvm_free_assigned_device(kvm, match); -- 1.7.0.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html