ia64/xen-unstable

changeset 17518:77dec8732cde

AMD IOV: Fix dom0 initialisation.
Signed-off-by: Wei Wang <wei.wang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 23 16:58:44 2008 +0100 (2008-04-23)
parents 2bc699de2297
children f73b9a286ee4
files xen/drivers/passthrough/amd/pci_amd_iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Wed Apr 23 16:57:23 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Wed Apr 23 16:58:44 2008 +0100
     1.3 @@ -290,9 +290,9 @@ static void amd_iommu_setup_domain_devic
     1.4      }
     1.5  }
     1.6  
     1.7 -static void __init amd_iommu_setup_dom0_devices(void)
     1.8 +static void amd_iommu_setup_dom0_devices(struct domain *d)
     1.9  {
    1.10 -    struct hvm_iommu *hd = domain_hvm_iommu(dom0);
    1.11 +    struct hvm_iommu *hd = domain_hvm_iommu(d);
    1.12      struct amd_iommu *iommu;
    1.13      struct pci_dev *pdev;
    1.14      int bus, dev, func;
    1.15 @@ -322,7 +322,7 @@ static void __init amd_iommu_setup_dom0_
    1.16                      find_iommu_for_device(bus, pdev->devfn) : NULL;
    1.17  
    1.18                  if ( iommu )
    1.19 -                    amd_iommu_setup_domain_device(dom0, iommu, bdf);
    1.20 +                    amd_iommu_setup_domain_device(d, iommu, bdf);
    1.21              }
    1.22          }
    1.23      }
    1.24 @@ -330,7 +330,6 @@ static void __init amd_iommu_setup_dom0_
    1.25  
    1.26  int amd_iov_detect(void)
    1.27  {
    1.28 -    unsigned long i;
    1.29      int last_bus;
    1.30      struct amd_iommu *iommu, *next;
    1.31  
    1.32 @@ -372,14 +371,6 @@ int amd_iov_detect(void)
    1.33          goto error_out;
    1.34      }
    1.35  
    1.36 -    if ( iommu_domain_init(dom0) != 0 )
    1.37 -        goto error_out;
    1.38 -
    1.39 -    /* setup 1:1 page table for dom0 */
    1.40 -    for ( i = 0; i < max_page; i++ )
    1.41 -        amd_iommu_map_page(dom0, i, i);
    1.42 -
    1.43 -    amd_iommu_setup_dom0_devices();
    1.44      return 0;
    1.45  
    1.46   error_out:
    1.47 @@ -451,10 +442,18 @@ static int amd_iommu_domain_init(struct 
    1.48          return -ENOMEM;
    1.49      }
    1.50  
    1.51 -    if ( is_hvm_domain(domain) )
    1.52 -        hd->paging_mode = IOMMU_PAGE_TABLE_LEVEL_4;
    1.53 -    else
    1.54 -        hd->paging_mode = get_paging_mode(max_page);
    1.55 +    hd->paging_mode = is_hvm_domain(domain)?
    1.56 +        IOMMU_PAGE_TABLE_LEVEL_4 : get_paging_mode(max_page);
    1.57 +
    1.58 +    if ( domain->domain_id == 0 )
    1.59 +    {
    1.60 +        unsigned long i; 
    1.61 +       /* setup 1:1 page table for dom0 */
    1.62 +        for ( i = 0; i < max_page; i++ )
    1.63 +            amd_iommu_map_page(domain, i, i);
    1.64 +
    1.65 +        amd_iommu_setup_dom0_devices(domain);
    1.66 +    }
    1.67  
    1.68      hd->domain_id = domain->domain_id;
    1.69