>From 682af63ae034814d7ed1be8a7e4c6cee3d8b26c1 Mon Sep 17 00:00:00 2001
From: Weidong Han <[EMAIL PROTECTED]>
Date: Mon, 23 Jun 2008 23:30:31 +0800
Subject: [PATCH] Use intel_iommu_domain to replace domain

"domain" is too generic.

Signed-off-by: Weidong Han <[EMAIL PROTECTED]>
---
 arch/x86/kvm/vtd.c         |   30 +++++++++++++++++-------------
 arch/x86/kvm/x86.c         |    2 +-
 include/asm-x86/kvm_host.h |    2 +-
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/arch/x86/kvm/vtd.c b/arch/x86/kvm/vtd.c
index 7bbd353..4387c25 100644
--- a/arch/x86/kvm/vtd.c
+++ b/arch/x86/kvm/vtd.c
@@ -34,7 +34,7 @@ int kvm_iommu_map_pages(struct kvm *kvm,
        struct page *page;
        int i, rc;
 
-       if (!kvm->arch.domain)
+       if (!kvm->arch.intel_iommu_domain)
                return -EFAULT;
 
        printk(KERN_DEBUG "kvm_iommu_map_page: gpa = %lx\n",
@@ -47,7 +47,8 @@ int kvm_iommu_map_pages(struct kvm *kvm,
        for (i = 0; i < npages; i++) {
                pfn = gfn_to_pfn(kvm, gfn);
                if (pfn_valid(pfn)) {
-                       rc =
kvm_intel_iommu_page_mapping(kvm->arch.domain,
+                       rc = kvm_intel_iommu_page_mapping(
+                               kvm->arch.intel_iommu_domain,
                                gfn << PAGE_SHIFT, pfn << PAGE_SHIFT,
                                PAGE_SIZE, DMA_PTE_READ |
DMA_PTE_WRITE);
                        if (rc) {
@@ -93,24 +94,26 @@ int kvm_iommu_map_guest(struct kvm *kvm,
                        (pdev->devfn == pci_pt_dev->host.devfn))
                        goto found;
        }
-       if (kvm->arch.domain) {
-               kvm_intel_iommu_domain_exit(kvm->arch.domain);
-               kvm->arch.domain = NULL;
+       if (kvm->arch.intel_iommu_domain) {
+
kvm_intel_iommu_domain_exit(kvm->arch.intel_iommu_domain);
+               kvm->arch.intel_iommu_domain = NULL;
        }
        return -ENODEV;
 found:
-       kvm->arch.domain = kvm_intel_iommu_domain_alloc(pdev);
-       if (kvm->arch.domain == NULL)
+       kvm->arch.intel_iommu_domain =
kvm_intel_iommu_domain_alloc(pdev);
+       if (kvm->arch.intel_iommu_domain == NULL)
                printk(KERN_ERR "kvm_iommu_map_guest: domain ==
NULL\n");
        else
-               printk("kvm_iommu_map_guest: domain = %p\n",
kvm->arch.domain);
+               printk("kvm_iommu_map_guest: domain = %p\n",
+                      kvm->arch.intel_iommu_domain);
 
        if (kvm_iommu_map_memslots(kvm)) {
                kvm_iommu_unmap_memslots(kvm);
                return -EFAULT;
        }
 
-       if (kvm_intel_iommu_context_mapping(kvm->arch.domain, pdev)) {
+       if (kvm_intel_iommu_context_mapping(
+               kvm->arch.intel_iommu_domain, pdev)) {
                printk(KERN_ERR "Domain context map for %s failed",
                       pci_name(pdev));
                return -EFAULT;
@@ -126,7 +129,7 @@ static int kvm_iommu_put_pages(struct kvm *kvm,
        struct page *page;
        int i;
 
-       if (!kvm->arch.domain)
+       if (!kvm->arch.intel_iommu_domain)
                return -EFAULT;
 
        printk(KERN_DEBUG "kvm_iommu_put_pages: gpa = %lx\n",
@@ -161,7 +164,7 @@ int kvm_iommu_unmap_guest(struct kvm *kvm)
        struct kvm_pci_pt_dev_list *entry;
        struct pci_dev *pdev = NULL;
 
-       if (!kvm->arch.domain)
+       if (!kvm->arch.intel_iommu_domain)
                return 0;
 
        list_for_each_entry(entry, &kvm->arch.pci_pt_dev_head, list) {
@@ -183,11 +186,12 @@ found:
                }
 
                /* detach kvm dmar domain */
-               kvm_intel_iommu_detach_dev(kvm->arch.domain,
+               kvm_intel_iommu_detach_dev(
+                               kvm->arch.intel_iommu_domain,
                                pdev->bus->number, pdev->devfn);
        }
        kvm_iommu_unmap_memslots(kvm);
-       kvm_intel_iommu_domain_exit(kvm->arch.domain);
+       kvm_intel_iommu_domain_exit(kvm->arch.intel_iommu_domain);
        return 0;
 }
 EXPORT_SYMBOL_GPL(kvm_iommu_unmap_guest);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 20a46fe..cdfbda6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -382,7 +382,7 @@ static void kvm_free_pci_passthrough(struct kvm
*kvm)
        write_unlock_irqrestore(&kvm_pci_pt_lock, flags);
 
        if (kvm_intel_iommu_found())
-               kvm->arch.domain = NULL;
+               kvm->arch.intel_iommu_domain = NULL;
 }
 
 unsigned long segment_base(u16 selector)
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 9159ad3..ab9581a 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -348,7 +348,7 @@ struct kvm_arch{
         */
        struct list_head active_mmu_pages;
        struct list_head pci_pt_dev_head;
-       struct dmar_domain *domain;
+       struct dmar_domain *intel_iommu_domain;
        struct kvm_pic *vpic;
        struct kvm_ioapic *vioapic;
        struct kvm_pit *vpit;
-- 
1.5.1
--
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