On Sun, Apr 26, 2009 at 10:38:39AM +0300, Michael S. Tsirkin wrote: > Make kvm configure script and Makefile work again after things have been > moved around, so that you can do 'cd kvm && ./configure' to get a > kvm-enabled qemu. > > Also, guard against infinite recursion in case of 'cd' commands failing. > I suppose changes under kvm/kernel/* are not relevant to this goal. Also for me running ./configure --kerneldir=/path/to/kernel at top dir works. (/path/to/kernel should be absolute though, otherwise kernel include path is incorrect). > Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> > > -- > > On Thu, Apr 23, 2009 at 06:40:00PM +0300, Avi Kivity wrote: > > After a lengthy testing phase, qemu-kvm.git has replaced > > kvm-userspace.git as the source repository for kvm userspace development. > > This patch makes cd kvm; ./configure work. > Is this the expected mode of operation? > > diff --git a/kvm/Makefile b/kvm/Makefile > index 617504c..1ef6493 100644 > --- a/kvm/Makefile > +++ b/kvm/Makefile > @@ -7,29 +7,29 @@ rpmrelease = devel > > sane-arch = $(subst i386,x86,$(subst x86_64,x86,$(subst s390x,s390,$(ARCH)))) > > -.PHONY: kernel user libkvm qemu bios vgabios extboot clean libfdt cscope > +.PHONY: kernel user libkvm ${QEMU_DIR} bios vgabios extboot clean libfdt cscope > > -all: libkvm qemu > +all: libkvm ${QEMU_DIR} > ifneq '$(filter $(ARCH), x86_64 i386 ia64)' '' > all: $(if $(WANT_MODULE), kernel) user > endif > > kcmd = $(if $(WANT_MODULE),,@\#) > > -qemu kernel user libkvm: > +${QEMU_DIR} kernel user libkvm: > $(MAKE) -C $@ > > -qemu: libkvm > +${QEMU_DIR}: libkvm > ifneq '$(filter $(ARCH), i386 x86_64)' '' > - qemu: extboot > + ${QEMU_DIR}: extboot > endif > ifneq '$(filter $(ARCH), powerpc ia64)' '' > - qemu: libfdt > + ${QEMU_DIR}: libfdt > endif > user: libkvm > > # sync if kernel/Makefile exists and if using --with-patched-kernel > -user libkvm qemu: header-sync-$(if $(wildcard kernel/Makefile),$(if $(WANT_MODULE),n,y),n) > +user libkvm ${QEMU_DIR}: header-sync-$(if $(wildcard kernel/Makefile),$(if $(WANT_MODULE),n,y),n) > > header-sync-n: > > @@ -42,18 +42,18 @@ header-sync-y: > > bios: > $(MAKE) -C $@ > - cp bios/BIOS-bochs-latest qemu/pc-bios/bios.bin > + cp bios/BIOS-bochs-latest ${QEMU_DIR}/pc-bios/bios.bin > > vgabios: > $(MAKE) -C $@ > - cp vgabios/VGABIOS-lgpl-latest.bin qemu/pc-bios/vgabios.bin > - cp vgabios/VGABIOS-lgpl-latest.cirrus.bin qemu/pc-bios/vgabios-cirrus.bin > + cp vgabios/VGABIOS-lgpl-latest.bin ${QEMU_DIR}/pc-bios/vgabios.bin > + cp vgabios/VGABIOS-lgpl-latest.cirrus.bin ${QEMU_DIR}/pc-bios/vgabios-cirrus.bin > > extboot: > $(MAKE) -C $@ > - if ! [ -f qemu/pc-bios/extboot.bin ] \ > - || ! cmp -s qemu/pc-bios/extboot.bin extboot/extboot.bin; then \ > - cp extboot/extboot.bin qemu/pc-bios/extboot.bin; \ > + if ! [ -f ${QEMU_DIR}/pc-bios/extboot.bin ] \ > + || ! cmp -s ${QEMU_DIR}/pc-bios/extboot.bin extboot/extboot.bin; then \ > + cp extboot/extboot.bin ${QEMU_DIR}/pc-bios/extboot.bin; \ > fi > libfdt: > $(MAKE) -C $@ > @@ -75,7 +75,7 @@ install-rpm: > mkdir -p $(DESTDIR)/$(initdir) > mkdir -p $(DESTDIR)/$(utilsdir) > mkdir -p $(DESTDIR)/etc/udev/rules.d > - make -C qemu DESTDIR=$(DESTDIR)/ install > + make -C ${QEMU_DIR} DESTDIR=$(DESTDIR)/ install > ln -sf /usr/kvm/bin/qemu-system-x86_64 $(DESTDIR)/$(bin) > install -m 755 kvm_stat $(DESTDIR)/$(bindir)/kvm_stat > cp scripts/kvm $(DESTDIR)/$(initdir)/kvm > @@ -85,7 +85,7 @@ install-rpm: > install: > $(kcmd)make -C kernel DESTDIR="$(DESTDIR)" install > make -C libkvm DESTDIR="$(DESTDIR)" install > - make -C qemu DESTDIR="$(DESTDIR)" install > + make -C ${QEMU_DIR} DESTDIR="$(DESTDIR)" install > > tmpspec = .tmp.kvm.spec > RPMTOPDIR = $$(pwd)/rpmtop > @@ -100,7 +100,7 @@ rpm: srpm > srpm: > mkdir -p $(RPMTOPDIR)/{SOURCES,SRPMS} > sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec > $(tmpspec) > - tar czf $(RPMTOPDIR)/SOURCES/kvm.tar.gz qemu > + tar czf $(RPMTOPDIR)/SOURCES/kvm.tar.gz ${QEMU_DIR} > tar czf $(RPMTOPDIR)/SOURCES/user.tar.gz user > tar czf $(RPMTOPDIR)/SOURCES/libkvm.tar.gz libkvm > tar czf $(RPMTOPDIR)/SOURCES/kernel.tar.gz kernel > @@ -111,7 +111,7 @@ srpm: > $(RM) $(tmpspec) > > clean: > - for i in $(if $(WANT_MODULE), kernel) user libkvm qemu libfdt; do \ > + for i in $(if $(WANT_MODULE), kernel) user libkvm ${QEMU_DIR} libfdt; do \ > make -C $$i clean; \ > done > rm -f ./cscope.* > diff --git a/kvm/configure b/kvm/configure > index 249c743..f4873c1 100755 > --- a/kvm/configure > +++ b/kvm/configure > @@ -14,6 +14,7 @@ qemu_opts=() > cross_prefix= > arch=`uname -m` > target_exec= > +qemu_directory=$PWD/.. > # don't use uname if kerneldir is set > no_uname= > if [ -z "TMPDIR" ] ; then > @@ -41,8 +42,7 @@ usage() { > Any additional option is given to qemu's configure verbatim; including: > > EOF > - cd qemu > - ./configure --help | egrep "enable-|disable-" \ > + cd $qemu_directory && ./configure --help | egrep "enable-|disable-" \ > | grep -v user | grep -v system | grep -v kqemu | grep -v kvm \ > | sed -e "s/^ / /g" \ > | sed -e"s/ enable/enable/g" | sed -e "s/ disable/disable/g" > @@ -117,7 +117,7 @@ processor=${arch#*-} > arch=${arch%%-*} > > #configure kernel module > -[ -e kernel/Makefile ] && (cd kernel; > +[ -e kernel/Makefile ] && (cd kernel && > ./configure \ > --kerneldir="$kerneldir" \ > --arch="$arch" \ > @@ -127,15 +127,15 @@ arch=${arch%%-*} > ) > > #configure user dir > -(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \ > +(cd user && ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \ > --arch="$arch" --processor="$processor" \ > ${cross_prefix:+"--cross-prefix=$cross_prefix"}) > > #configure qemu > -(cd qemu; ./configure --target-list=$target_exec \ > +(cd $qemu_directory && ./configure --target-list=$target_exec \ > --disable-kqemu \ > - --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \ > - --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \ > + --extra-cflags="-I $PWD/libkvm $qemu_cflags" \ > + --extra-ldflags="-L $PWD/libkvm $qemu_ldflags" \ > --kerneldir="$libkvm_kerneldir" \ > --prefix="$prefix" \ > ${cross_prefix:+"--cross-prefix=$cross_prefix"} \ > @@ -144,6 +144,7 @@ arch=${arch%%-*} > > > cat <<EOF > config.mak > +QEMU_DIR=$qemu_directory > ARCH=$arch > PROCESSOR=$processor > PREFIX=$prefix > diff --git a/kvm/kernel/include/asm-x86/kvm.h b/kvm/kernel/include/asm-x86/kvm.h > index dc90c47..8dfd630 100644 > --- a/kvm/kernel/include/asm-x86/kvm.h > +++ b/kvm/kernel/include/asm-x86/kvm.h > @@ -56,7 +56,6 @@ > #define __KVM_HAVE_MSI > #define __KVM_HAVE_USER_NMI > #define __KVM_HAVE_GUEST_DEBUG > -#define __KVM_HAVE_MSIX > > /* Architectural interrupt line count. */ > #define KVM_NR_INTERRUPTS 256 > diff --git a/kvm/kernel/include/asm-x86/kvm_host.h b/kvm/kernel/include/asm-x86/kvm_host.h > index 07e1058..aa87be7 100644 > --- a/kvm/kernel/include/asm-x86/kvm_host.h > +++ b/kvm/kernel/include/asm-x86/kvm_host.h > @@ -225,7 +225,6 @@ union kvm_mmu_page_role { > unsigned access:3; > unsigned invalid:1; > unsigned cr4_pge:1; > - unsigned nxe:1; > }; > }; > > @@ -253,6 +252,7 @@ struct kvm_mmu_page { > int multimapped; /* More than one parent_pte? */ > int root_count; /* Currently serving as active root */ > bool unsync; > + bool global; > unsigned int unsync_children; > union { > u64 *parent_pte; /* !multimapped */ > @@ -301,7 +301,6 @@ struct kvm_mmu { > union kvm_mmu_page_role base_role; > > u64 *pae_root; > - u64 rsvd_bits_mask[2][4]; > }; > > struct kvm_vcpu_arch { > @@ -327,7 +326,6 @@ struct kvm_vcpu_arch { > u64 shadow_efer; > u64 apic_base; > struct kvm_lapic *apic; /* kernel irqchip context */ > - int32_t apic_arb_prio; > int mp_state; > int sipi_vector; > u64 ia32_misc_enable_msr; > @@ -434,6 +432,7 @@ struct kvm_arch{ > */ > struct list_head active_mmu_pages; > struct list_head assigned_dev_head; > + struct list_head oos_global_pages; > struct iommu_domain *iommu_domain; > struct kvm_pic *vpic; > struct kvm_ioapic *vioapic; > @@ -441,6 +440,7 @@ struct kvm_arch{ > struct hlist_head irq_ack_notifier_list; > int vapics_in_nmi_mode; > > + int round_robin_prev_vcpu; > unsigned int tss_addr; > struct page *apic_access_page; > > @@ -463,6 +463,7 @@ struct kvm_vm_stat { > u32 mmu_recycled; > u32 mmu_cache_miss; > u32 mmu_unsync; > + u32 mmu_unsync_global; > u32 remote_tlb_flush; > u32 lpages; > }; > @@ -560,7 +561,7 @@ struct kvm_x86_ops { > void (*inject_pending_irq)(struct kvm_vcpu *vcpu); > void (*inject_pending_vectors)(struct kvm_vcpu *vcpu, > struct kvm_run *run); > - int (*interrupt_allowed)(struct kvm_vcpu *vcpu); > + > int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); > int (*get_tdp_level)(void); > int (*get_mt_mask_shift)(void); > @@ -602,7 +603,6 @@ enum emulation_result { > > #define EMULTYPE_NO_DECODE (1 << 0) > #define EMULTYPE_TRAP_UD (1 << 1) > -#define EMULTYPE_SKIP (1 << 2) > int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run, > unsigned long cr2, u16 error_code, int emulation_type); > void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context); > @@ -678,6 +678,7 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu); > int kvm_mmu_load(struct kvm_vcpu *vcpu); > void kvm_mmu_unload(struct kvm_vcpu *vcpu); > void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu); > +void kvm_mmu_sync_global(struct kvm_vcpu *vcpu); > > int kvm_emulate_hypercall(struct kvm_vcpu *vcpu); > > @@ -830,6 +831,5 @@ asmlinkage void kvm_handle_fault_on_reboot(void); > #define KVM_ARCH_WANT_MMU_NOTIFIER > int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); > int kvm_age_hva(struct kvm *kvm, unsigned long hva); > -int cpuid_maxphyaddr(struct kvm_vcpu *vcpu); > > #endif /* _ASM_X86_KVM_HOST_H */ > diff --git a/kvm/kernel/include/asm-x86/svm.h b/kvm/kernel/include/asm-x86/svm.h > index 5a34c94..ae5aa0d 100644 > --- a/kvm/kernel/include/asm-x86/svm.h > +++ b/kvm/kernel/include/asm-x86/svm.h > @@ -265,7 +265,6 @@ struct __attribute__ ((__packed__)) vmcb { > #define SVM_EVTINJ_VALID_ERR (1 << 11) > > #define SVM_EXITINTINFO_VEC_MASK SVM_EVTINJ_VEC_MASK > -#define SVM_EXITINTINFO_TYPE_MASK SVM_EVTINJ_TYPE_MASK > > #define SVM_EXITINTINFO_TYPE_INTR SVM_EVTINJ_TYPE_INTR > #define SVM_EXITINTINFO_TYPE_NMI SVM_EVTINJ_TYPE_NMI > diff --git a/kvm/kernel/include/linux/kvm.h b/kvm/kernel/include/linux/kvm.h > index f5e9d66..0746631 100644 > --- a/kvm/kernel/include/linux/kvm.h > +++ b/kvm/kernel/include/linux/kvm.h > @@ -159,7 +159,7 @@ struct kvm_run { > __u32 error_code; > } ex; > /* KVM_EXIT_IO */ > - struct { > + struct kvm_io { > #define KVM_EXIT_IO_IN 0 > #define KVM_EXIT_IO_OUT 1 > __u8 direction; > @@ -264,10 +264,10 @@ struct kvm_interrupt { > /* for KVM_GET_DIRTY_LOG */ > struct kvm_dirty_log { > __u32 slot; > - __u32 padding1; > + __u32 padding; > union { > void *dirty_bitmap; /* one bit per page */ > - __u64 padding2; > + __u64 padding; > }; > }; > > @@ -449,12 +449,6 @@ struct kvm_trace_rec { > #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT > #define KVM_CAP_DEVICE_DEASSIGNMENT 27 > #endif > -#ifdef __KVM_HAVE_MSIX > -#define KVM_CAP_DEVICE_MSIX 28 > -#endif > -#define KVM_CAP_ASSIGN_DEV_IRQ 29 > -/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ > -#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 > > #ifdef KVM_CAP_IRQ_ROUTING > > @@ -526,18 +520,11 @@ struct kvm_irq_routing { > #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ > struct kvm_assigned_pci_dev) > #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) > -/* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ > #define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ > struct kvm_assigned_irq) > -#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) > #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) > #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ > struct kvm_assigned_pci_dev) > -#define KVM_ASSIGN_SET_MSIX_NR \ > - _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr) > -#define KVM_ASSIGN_SET_MSIX_ENTRY \ > - _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry) > -#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) > > /* > * ioctls for vcpu fds > @@ -628,8 +615,6 @@ struct kvm_debug_guest { > #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) > #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) > > -#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) > - > struct kvm_assigned_pci_dev { > __u32 assigned_dev_id; > __u32 busnr; > @@ -640,17 +625,6 @@ struct kvm_assigned_pci_dev { > }; > }; > > -#define KVM_DEV_IRQ_HOST_INTX (1 << 0) > -#define KVM_DEV_IRQ_HOST_MSI (1 << 1) > -#define KVM_DEV_IRQ_HOST_MSIX (1 << 2) > - > -#define KVM_DEV_IRQ_GUEST_INTX (1 << 8) > -#define KVM_DEV_IRQ_GUEST_MSI (1 << 9) > -#define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) > - > -#define KVM_DEV_IRQ_HOST_MASK 0x00ff > -#define KVM_DEV_IRQ_GUEST_MASK 0xff00 > - > struct kvm_assigned_irq { > __u32 assigned_dev_id; > __u32 host_irq; > @@ -666,19 +640,9 @@ struct kvm_assigned_irq { > }; > }; > > +#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) > > -struct kvm_assigned_msix_nr { > - __u32 assigned_dev_id; > - __u16 entry_nr; > - __u16 padding; > -}; > - > -#define KVM_MAX_MSIX_PER_DEV 512 > -struct kvm_assigned_msix_entry { > - __u32 assigned_dev_id; > - __u32 gsi; > - __u16 entry; /* The index of entry in the MSI-X table */ > - __u16 padding[3]; > -}; > +#define KVM_DEV_IRQ_ASSIGN_MSI_ACTION KVM_DEV_IRQ_ASSIGN_ENABLE_MSI > +#define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0) > > #endif > diff --git a/kvm/kernel/include/linux/kvm_host.h b/kvm/kernel/include/linux/kvm_host.h > index 0c3c5b1..965f186 100644 > --- a/kvm/kernel/include/linux/kvm_host.h > +++ b/kvm/kernel/include/linux/kvm_host.h > @@ -338,7 +338,6 @@ int kvm_arch_hardware_setup(void); > void kvm_arch_hardware_unsetup(void); > void kvm_arch_check_processor_compat(void *rtn); > int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); > -int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); > > void kvm_free_physmem(struct kvm *kvm); > > @@ -360,13 +359,6 @@ struct kvm_irq_ack_notifier { > void (*irq_acked)(struct kvm_irq_ack_notifier *kian); > }; > > -#define KVM_ASSIGNED_MSIX_PENDING 0x1 > -struct kvm_guest_msix_entry { > - u32 vector; > - u16 entry; > - u16 flags; > -}; > - > struct kvm_assigned_dev_kernel { > struct kvm_irq_ack_notifier ack_notifier; > struct work_struct interrupt_work; > @@ -374,12 +366,13 @@ struct kvm_assigned_dev_kernel { > int assigned_dev_id; > int host_busnr; > int host_devfn; > - unsigned int entries_nr; > int host_irq; > bool host_irq_disabled; > - struct msix_entry *host_msix_entries; > int guest_irq; > - struct kvm_guest_msix_entry *guest_msix_entries; > +#define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0) > +#define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1) > +#define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8) > +#define KVM_ASSIGNED_DEV_HOST_MSI (1 << 9) > unsigned long irq_requested_type; > int irq_source_id; > int flags; > @@ -399,11 +392,6 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, > struct kvm_irq_mask_notifier *kimn); > void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask); > > -#ifdef __KVM_HAVE_IOAPIC > -void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, > - union kvm_ioapic_redirect_entry *entry, > - unsigned long *deliver_bitmask); > -#endif > int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); > void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); > void kvm_register_irq_ack_notifier(struct kvm *kvm, > diff --git a/kvm/kernel/include/linux/kvm_types.h b/kvm/kernel/include/linux/kvm_types.h > index c65f89e..e204dd3 100644 > --- a/kvm/kernel/include/linux/kvm_types.h > +++ b/kvm/kernel/include/linux/kvm_types.h > @@ -80,31 +80,4 @@ typedef unsigned long hfn_t; > > typedef hfn_t pfn_t; > > -union kvm_ioapic_redirect_entry { > - u64 bits; > - struct { > - u8 vector; > - u8 delivery_mode:3; > - u8 dest_mode:1; > - u8 delivery_status:1; > - u8 polarity:1; > - u8 remote_irr:1; > - u8 trig_mode:1; > - u8 mask:1; > - u8 reserve:7; > - u8 reserved[4]; > - u8 dest_id; > - } fields; > -}; > - > -struct kvm_lapic_irq { > - u32 vector; > - u32 delivery_mode; > - u32 dest_mode; > - u32 level; > - u32 trig_mode; > - u32 shorthand; > - u32 dest_id; > -}; > - > #endif /* __KVM_TYPES_H__ */ > -- > 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 -- Gleb. -- 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