ia64/xen-unstable

changeset 18626:3ff2461bb5a1

iommu: Move some 'boot_cpu_data.x86_vendor' related stuff into
arch-specific directory.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Oct 14 11:29:14 2008 +0100 (2008-10-14)
parents 0feedf7dcc73
children 7f9706875b5b
files xen/drivers/passthrough/iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/iommu.c	Tue Oct 14 11:28:37 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/iommu.c	Tue Oct 14 11:29:14 2008 +0100
     1.3 @@ -15,6 +15,7 @@
     1.4  
     1.5  #include <xen/sched.h>
     1.6  #include <xen/iommu.h>
     1.7 +#include <asm/hvm/iommu.h>
     1.8  #include <xen/paging.h>
     1.9  #include <xen/guest_access.h>
    1.10  
    1.11 @@ -77,18 +78,7 @@ int iommu_domain_init(struct domain *dom
    1.12      if ( !iommu_enabled )
    1.13          return 0;
    1.14  
    1.15 -    switch ( boot_cpu_data.x86_vendor )
    1.16 -    {
    1.17 -    case X86_VENDOR_INTEL:
    1.18 -        hd->platform_ops = &intel_iommu_ops;
    1.19 -        break;
    1.20 -    case X86_VENDOR_AMD:
    1.21 -        hd->platform_ops = &amd_iommu_ops;
    1.22 -        break;
    1.23 -    default:
    1.24 -        BUG();
    1.25 -    }
    1.26 -
    1.27 +    hd->platform_ops = iommu_get_ops();
    1.28      return hd->platform_ops->init(domain);
    1.29  }
    1.30  
    1.31 @@ -239,15 +229,7 @@ static int iommu_setup(void)
    1.32      if ( !iommu_enabled )
    1.33          goto out;
    1.34  
    1.35 -    switch ( boot_cpu_data.x86_vendor )
    1.36 -    {
    1.37 -    case X86_VENDOR_INTEL:
    1.38 -        rc = intel_vtd_setup();
    1.39 -        break;
    1.40 -    case X86_VENDOR_AMD:
    1.41 -        rc = amd_iov_detect();
    1.42 -        break;
    1.43 -    }
    1.44 +    rc = iommu_hardware_setup();
    1.45  
    1.46      iommu_enabled = (rc == 0);
    1.47  
    1.48 @@ -308,37 +290,13 @@ int iommu_get_device_group(struct domain
    1.49  void iommu_update_ire_from_apic(
    1.50      unsigned int apic, unsigned int reg, unsigned int value)
    1.51  {
    1.52 -    struct iommu_ops *ops = NULL;
    1.53 -
    1.54 -    switch ( boot_cpu_data.x86_vendor )
    1.55 -    {
    1.56 -    case X86_VENDOR_INTEL:
    1.57 -        ops = &intel_iommu_ops;
    1.58 -        break;
    1.59 -    case X86_VENDOR_AMD:
    1.60 -        ops = &amd_iommu_ops;
    1.61 -        break;
    1.62 -    default:
    1.63 -        BUG();
    1.64 -    }
    1.65 +    struct iommu_ops *ops = iommu_get_ops();
    1.66      ops->update_ire_from_apic(apic, reg, value);
    1.67  }
    1.68  void iommu_update_ire_from_msi(
    1.69      struct msi_desc *msi_desc, struct msi_msg *msg)
    1.70  {
    1.71 -    struct iommu_ops *ops = NULL;
    1.72 -
    1.73 -    switch ( boot_cpu_data.x86_vendor )
    1.74 -    {
    1.75 -    case X86_VENDOR_INTEL:
    1.76 -        ops = &intel_iommu_ops;
    1.77 -        break;
    1.78 -    case X86_VENDOR_AMD:
    1.79 -        ops = &amd_iommu_ops;
    1.80 -        break;
    1.81 -    default:
    1.82 -        BUG();
    1.83 -    }
    1.84 +    struct iommu_ops *ops = iommu_get_ops();
    1.85      ops->update_ire_from_msi(msi_desc, msg);
    1.86  }
    1.87  /*