Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'kvm-x86-no_assignment-6.17' of https://github.com/kvm-x86/linux into HEAD

KVM VFIO device assignment cleanups for 6.17

Kill off kvm_arch_{start,end}_assignment() and x86's associated tracking now
that KVM no longer uses assigned_device_count as a bad heuristic for "VM has
an irqbypass producer" or for "VM has access to host MMIO".

+1 -49
-2
arch/x86/include/asm/kvm_host.h
··· 1387 1387 1388 1388 #define __KVM_HAVE_ARCH_NONCOHERENT_DMA 1389 1389 atomic_t noncoherent_dma_count; 1390 - #define __KVM_HAVE_ARCH_ASSIGNED_DEVICE 1391 - atomic_t assigned_device_count; 1392 1390 unsigned long nr_possible_bypass_irqs; 1393 1391 1394 1392 #ifdef CONFIG_KVM_IOAPIC
+1 -8
arch/x86/kvm/irq.c
··· 565 565 struct kvm *kvm = irqfd->kvm; 566 566 int ret = 0; 567 567 568 - kvm_arch_start_assignment(irqfd->kvm); 569 - 570 568 spin_lock_irq(&kvm->irqfds.lock); 571 569 irqfd->producer = prod; 572 570 ··· 573 575 574 576 if (irqfd->irq_entry.type == KVM_IRQ_ROUTING_MSI) { 575 577 ret = kvm_pi_update_irte(irqfd, &irqfd->irq_entry); 576 - if (ret) { 578 + if (ret) 577 579 kvm->arch.nr_possible_bypass_irqs--; 578 - kvm_arch_end_assignment(irqfd->kvm); 579 - } 580 580 } 581 581 spin_unlock_irq(&kvm->irqfds.lock); 582 582 ··· 610 614 kvm->arch.nr_possible_bypass_irqs--; 611 615 612 616 spin_unlock_irq(&kvm->irqfds.lock); 613 - 614 - 615 - kvm_arch_end_assignment(irqfd->kvm); 616 617 } 617 618 618 619 void kvm_arch_update_irqfd_routing(struct kvm_kernel_irqfd *irqfd,
-18
arch/x86/kvm/x86.c
··· 13444 13444 return kvm_lapic_enabled(vcpu) && apf_pageready_slot_free(vcpu); 13445 13445 } 13446 13446 13447 - void kvm_arch_start_assignment(struct kvm *kvm) 13448 - { 13449 - atomic_inc(&kvm->arch.assigned_device_count); 13450 - } 13451 - EXPORT_SYMBOL_GPL(kvm_arch_start_assignment); 13452 - 13453 - void kvm_arch_end_assignment(struct kvm *kvm) 13454 - { 13455 - atomic_dec(&kvm->arch.assigned_device_count); 13456 - } 13457 - EXPORT_SYMBOL_GPL(kvm_arch_end_assignment); 13458 - 13459 - bool noinstr kvm_arch_has_assigned_device(struct kvm *kvm) 13460 - { 13461 - return raw_atomic_read(&kvm->arch.assigned_device_count); 13462 - } 13463 - EXPORT_SYMBOL_GPL(kvm_arch_has_assigned_device); 13464 - 13465 13447 static void kvm_noncoherent_dma_assignment_start_or_stop(struct kvm *kvm) 13466 13448 { 13467 13449 /*
-18
include/linux/kvm_host.h
··· 1690 1690 return false; 1691 1691 } 1692 1692 #endif 1693 - #ifdef __KVM_HAVE_ARCH_ASSIGNED_DEVICE 1694 - void kvm_arch_start_assignment(struct kvm *kvm); 1695 - void kvm_arch_end_assignment(struct kvm *kvm); 1696 - bool kvm_arch_has_assigned_device(struct kvm *kvm); 1697 - #else 1698 - static inline void kvm_arch_start_assignment(struct kvm *kvm) 1699 - { 1700 - } 1701 - 1702 - static inline void kvm_arch_end_assignment(struct kvm *kvm) 1703 - { 1704 - } 1705 - 1706 - static __always_inline bool kvm_arch_has_assigned_device(struct kvm *kvm) 1707 - { 1708 - return false; 1709 - } 1710 - #endif 1711 1693 1712 1694 static inline struct rcuwait *kvm_arch_vcpu_get_wait(struct kvm_vcpu *vcpu) 1713 1695 {
-3
virt/kvm/vfio.c
··· 175 175 kvf->file = get_file(filp); 176 176 list_add_tail(&kvf->node, &kv->file_list); 177 177 178 - kvm_arch_start_assignment(dev->kvm); 179 178 kvm_vfio_file_set_kvm(kvf->file, dev->kvm); 180 179 kvm_vfio_update_coherency(dev); 181 180 ··· 204 205 continue; 205 206 206 207 list_del(&kvf->node); 207 - kvm_arch_end_assignment(dev->kvm); 208 208 #ifdef CONFIG_SPAPR_TCE_IOMMU 209 209 kvm_spapr_tce_release_vfio_group(dev->kvm, kvf); 210 210 #endif ··· 334 336 fput(kvf->file); 335 337 list_del(&kvf->node); 336 338 kfree(kvf); 337 - kvm_arch_end_assignment(dev->kvm); 338 339 } 339 340 340 341 kvm_vfio_update_coherency(dev);