On Saturday 21 June 2008 10:27:50 Han, Weidong wrote:
> Avi Kivity wrote:
> > Kay, Allen M wrote:
> >> vt-d hooks in generic KVM sources for mapping guest memory with vt-d
> >> page table.
> >>
> >> Signed-off-by: Allen M. Kay <[EMAIL PROTECTED]>
> >>
> >> diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
> >> index c97d35c..f635fb0 100644
> >> --- a/arch/x86/kvm/Makefile
> >> +++ b/arch/x86/kvm/Makefile
> >> @@ -10,7 +10,7 @@ endif
> >>  EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm
> >>
> >>  kvm-objs := $(common-objs) x86.o mmu.o x86_emulate.o i8259.o irq.o
> >> lapic.o \ -    i8254.o
> >> +    i8254.o vtd.o
> >
> > This breaks the build.
>
> Why does it break the build? It works for me.

The vtd.c file is introduced in the next patch (4/4). For a tree which only 
has the first three patches applied, the build would break.

> >> @@ -1958,6 +1961,11 @@ long kvm_arch_vm_ioctl(struct file *filp,
> >>          r = kvm_vm_ioctl_pci_pt_dev(kvm, &pci_pt_dev);          if
> >>              (r) goto out;
> >> +        if (kvm_intel_iommu_found()) {
> >> +            r = kvm_iommu_map_guest(kvm, &pci_pt_dev); +
> >> if (r) +                goto out;
> >> +        }
> >
> > Need to undo the effects of kvm_vm_ioctl_pci_pt_dev() on failure.
>
> kvm_vm_ioctl_pci_pt_dev() does cleanup work by itself when it's failed.

When the iommu is not found, there's no use in keeping the device assigned and 
all the memory held. Anyhow, moving this hunk into the 
kvm_vm_ioctl_pci_pt_dev() function is a better idea so that all the setup can 
be done there. In the current tree, this hunk is moved into 
kvm_vm_ioctl_pci_pt_dev().
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to