Amit Shah wrote: > * On Monday 29 Sep 2008 10:56:29 Zhang, Xiantao wrote: >> From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> >> Date: Sat, 27 Sep 2008 10:59:36 +0800 >> Subject: [PATCH] kvm: Moving device_assignment logic to kvm_main.c >> >> To share with other archs, this patch moves device_assignment >> logic to common parts. >> Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> > >> diff --git a/include/linux/kvm.h b/include/linux/kvm.h >> index 4269be1..9acf34a 100644 >> --- a/include/linux/kvm.h >> +++ b/include/linux/kvm.h >> @@ -383,7 +383,9 @@ struct kvm_trace_rec { >> #define KVM_CAP_MP_STATE 14 >> #define KVM_CAP_COALESCED_MMIO 15 >> #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected >> in guest */ +#ifdef CONFIG_X86 >> #define KVM_CAP_DEVICE_ASSIGNMENT 17 >> +#endif > > I didn't see this changed to also accomodate IA64 in the patchset. Since linux-ia64 DMAR is not ready in kvm.git, and it should be in linux-ia64.git. So it should be in kvm.git once Avi merged with upstream, so I didn't enable it for kvm/ia64 now. You know, S390 has no pci support, so if we put the code in kvm_mainc, we should use the macro to exclude other arch which doesn't need device assignments. If DMAR is ready for kvm.git, I will change this macro as following: #if defined(CONFIG_X86) || defined(CONFIG_IA64) #define KVM_CAP_DEVICE_ASSIGNMENT 17 #endif >> /* >> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h >> index 73b7c52..10c1146 100644 --- a/include/linux/kvm_host.h >> +++ b/include/linux/kvm_host.h >> @@ -281,6 +281,7 @@ void kvm_free_physmem(struct kvm *kvm); >> >> struct kvm *kvm_arch_create_vm(void); >> void kvm_arch_destroy_vm(struct kvm *kvm); >> +void kvm_free_all_assigned_devices(struct kvm *kvm); >> >> int kvm_cpu_get_interrupt(struct kvm_vcpu *v); >> int kvm_cpu_has_interrupt(struct kvm_vcpu *v); >> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c >> index 6cf0427..59e08a4 100644 >> --- a/virt/kvm/kvm_main.c >> +++ b/virt/kvm/kvm_main.c >> @@ -51,6 +51,12 @@ >> #include "coalesced_mmio.h" >> #endif >> >> +#ifdef KVM_CAP_DEVICE_ASSIGNMENT >> +#include <linux/pci.h> >> +#include <linux/interrupt.h> >> +#include "irq.h" >> +#endif >> + >> MODULE_AUTHOR("Qumranet"); >> MODULE_LICENSE("GPL"); >> >> @@ -71,6 +77,240 @@ static long kvm_vcpu_ioctl(struct file *file, >> unsigned int ioctl, >> >> bool kvm_rebooting; >> >> +#ifdef KVM_CAP_DEVICE_ASSIGNMENT > > Since you're doing this, you should also put the > kvm_free_all_assigned_devices in the #ifdef for x86. This function has been wrapped by KVM_CAP_DEVICE_ASSIGNMENT. Xiantao -- To unsubscribe from this list: send the line "unsubscribe kvm-ia64" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html