mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
c9eab58f64
Create a new header, and hide the device assignment functions there. Move struct kvm_assigned_dev_kernel to assigned-dev.c by modifying arch/x86/kvm/iommu.c to take a PCI device struct. Based on a patch by Radim Krcmar <rkrcmark@redhat.com>. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
33 lines
859 B
C
33 lines
859 B
C
#ifndef ARCH_X86_KVM_ASSIGNED_DEV_H
|
|
#define ARCH_X86_KVM_ASSIGNED_DEV_H
|
|
|
|
#include <linux/kvm_host.h>
|
|
|
|
#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
|
|
int kvm_assign_device(struct kvm *kvm, struct pci_dev *pdev);
|
|
int kvm_deassign_device(struct kvm *kvm, struct pci_dev *pdev);
|
|
|
|
int kvm_iommu_map_guest(struct kvm *kvm);
|
|
int kvm_iommu_unmap_guest(struct kvm *kvm);
|
|
|
|
long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
|
|
unsigned long arg);
|
|
|
|
void kvm_free_all_assigned_devices(struct kvm *kvm);
|
|
#else
|
|
static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
|
|
unsigned long arg)
|
|
{
|
|
return -ENOTTY;
|
|
}
|
|
|
|
static inline void kvm_free_all_assigned_devices(struct kvm *kvm) {}
|
|
#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
|
|
|
|
#endif /* ARCH_X86_KVM_ASSIGNED_DEV_H */
|