ia64/xen-unstable

changeset 18280:41b7d2e54588

iommu: Make the iommu boot parameters more generic and flexible

Make the 'iommu' boot parameter take a comma separated value
indicating whether iommu is required to boot and whether to enable
iommu for pv domains.

Signed-off-by: Espen Skoglund <espen.skoglund@netronome.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Aug 06 15:18:17 2008 +0100 (2008-08-06)
parents c329dcc9df04
children eff5fcfa69bc
files xen/drivers/passthrough/iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/iommu.c	Wed Aug 06 11:38:42 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/iommu.c	Wed Aug 06 15:18:17 2008 +0100
     1.3 @@ -20,18 +20,48 @@
     1.4  
     1.5  extern struct iommu_ops intel_iommu_ops;
     1.6  extern struct iommu_ops amd_iommu_ops;
     1.7 +static void parse_iommu_param(char *s);
     1.8  static int iommu_populate_page_table(struct domain *d);
     1.9  int intel_vtd_setup(void);
    1.10  int amd_iov_detect(void);
    1.11  
    1.12 +/*
    1.13 + * The 'iommu' parameter enables the IOMMU.  Optional comma separated
    1.14 + * value may contain:
    1.15 + *
    1.16 + *   off|no|false|disable       Disable IOMMU (default)
    1.17 + *   pv                         Enable IOMMU for PV domains
    1.18 + *   no-pv                      Disable IOMMU for PV domains (default)
    1.19 + *   force|required             Don't boot unless IOMMU is enabled
    1.20 + */
    1.21 +custom_param("iommu", parse_iommu_param);
    1.22  int iommu_enabled = 0;
    1.23 -boolean_param("iommu", iommu_enabled);
    1.24 -
    1.25  int iommu_pv_enabled = 0;
    1.26 -boolean_param("iommu_pv", iommu_pv_enabled);
    1.27 +int force_iommu = 0;
    1.28 +
    1.29 +static void __init parse_iommu_param(char *s)
    1.30 +{
    1.31 +    char *ss;
    1.32 +    iommu_enabled = 1;
    1.33 +
    1.34 +    do {
    1.35 +        ss = strchr(s, ',');
    1.36 +        if ( ss )
    1.37 +            *ss = '\0';
    1.38  
    1.39 -int force_iommu = 0;
    1.40 -boolean_param("force_iommu", force_iommu);
    1.41 +        if ( !strcmp(s, "off") || !strcmp(s, "no") || !strcmp(s, "false") ||
    1.42 +             !strcmp(s, "0") || !strcmp(s, "disable") )
    1.43 +            iommu_enabled = 0;
    1.44 +        else if ( !strcmp(s, "pv") )
    1.45 +            iommu_pv_enabled = 1;
    1.46 +        else if ( !strcmp(s, "no-pv") )
    1.47 +            iommu_pv_enabled = 0;
    1.48 +        else if ( !strcmp(s, "force") || !strcmp(s, "required") )
    1.49 +            force_iommu = 1;
    1.50 +
    1.51 +        s = ss + 1;
    1.52 +    } while ( ss );
    1.53 +}
    1.54  
    1.55  int iommu_domain_init(struct domain *domain)
    1.56  {