[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.2] honor ACPI v4 FADT flags



commit 1ae14344658bb3eaad1618d9ad29a57cedbd74ea
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Mar 7 17:58:19 2013 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Mar 7 17:58:19 2013 +0100

    honor ACPI v4 FADT flags
    
    - force use of physical APIC mode if indicated so (as we don't support
      xAPIC cluster mode, the respective flag is taken to force physical
      mode too)
    - don't use MSI if indicated so (implies no IOMMU)
    
    Both can be overridden on the command line, for the MSI case this at
    once adds a new command line option allowing to turn off PCI MSI (IOMMU
    and HPET are unaffected by this).
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
    master changeset: 992fdf6f46252a459c6b1b8d971b2c71f01460f8
    master date: 2013-02-22 11:56:54 +0100
---
 docs/misc/xen-command-line.markdown      |    7 +++++++
 xen/arch/x86/genapic/bigsmp.c            |    9 ++++++++-
 xen/arch/x86/genapic/x2apic.c            |    9 ++++++---
 xen/arch/x86/msi.c                       |   16 ++++++++++++++--
 xen/drivers/passthrough/amd/iommu_acpi.c |    3 +++
 xen/drivers/passthrough/vtd/iommu.c      |    6 ++++++
 6 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown 
b/docs/misc/xen-command-line.markdown
index ef411e1..fe6ae84 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -594,6 +594,13 @@ limit is ignored by Xen.
 
 Specify if the MMConfig space should be enabled.
 
+### msi
+> `= <boolean>`
+
+> Default: `true`
+
+Force Xen to (not) use PCI-MSI, even if ACPI FADT says otherwise.
+
 ### nmi
 > `= ignore | dom0 | fatal`
 
diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c
index 62d255e..96b23d6 100644
--- a/xen/arch/x86/genapic/bigsmp.c
+++ b/xen/arch/x86/genapic/bigsmp.c
@@ -40,7 +40,14 @@ static struct dmi_system_id __initdata bigsmp_dmi_table[] = {
 
 static __init int probe_bigsmp(void)
 { 
-       if (!def_to_bigsmp)
+       /*
+        * We don't implement cluster mode, so force use of
+        * physical mode in both cases.
+        */
+       if (acpi_gbl_FADT.flags &
+           (ACPI_FADT_APIC_CLUSTER | ACPI_FADT_APIC_PHYSICAL))
+               def_to_bigsmp = 1;
+       else if (!def_to_bigsmp)
                dmi_check_system(bigsmp_dmi_table);
        return def_to_bigsmp;
 } 
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index bfddc1e..2c54e7e 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -29,9 +29,6 @@
 #include <xen/smp.h>
 #include <asm/mach-default/mach_mpparse.h>
 
-static bool_t __initdata x2apic_phys; /* By default we use logical cluster 
mode. */
-boolean_param("x2apic_phys", x2apic_phys);
-
 static void init_apic_ldr_x2apic_phys(void)
 {
 }
@@ -121,8 +118,14 @@ static const struct genapic apic_x2apic_cluster = {
     .send_IPI_self = send_IPI_self_x2apic
 };
 
+static s8 __initdata x2apic_phys = -1; /* By default we use logical cluster 
mode. */
+boolean_param("x2apic_phys", x2apic_phys);
+
 const struct genapic *__init apic_x2apic_probe(void)
 {
+    if ( x2apic_phys < 0 )
+        x2apic_phys = !!(acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL);
+
     return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
 }
 
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index f982c45..7730641 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -31,6 +31,9 @@
 #include <xen/iommu.h>
 #include <xsm/xsm.h>
 
+static s8 __read_mostly use_msi = -1;
+boolean_param("msi", use_msi);
+
 /* bitmap indicate which fixed map is free */
 DEFINE_SPINLOCK(msix_fixmap_lock);
 DECLARE_BITMAP(msix_fixmap_pages, FIX_MSIX_MAX_PAGES);
@@ -958,6 +961,9 @@ int pci_enable_msi(struct msi_info *msi, struct msi_desc 
**desc)
 {
     ASSERT(spin_is_locked(&pcidevs_lock));
 
+    if ( !use_msi )
+        return -EPERM;
+
     return  msi->table_base ? __pci_enable_msix(msi, desc) :
         __pci_enable_msi(msi, desc);
 }
@@ -1003,7 +1009,10 @@ int pci_restore_msi_state(struct pci_dev *pdev)
 
     ASSERT(spin_is_locked(&pcidevs_lock));
 
-    if (!pdev)
+    if ( !use_msi )
+        return -EOPNOTSUPP;
+
+    if ( !pdev )
         return -EINVAL;
 
     ret = xsm_resource_setup_pci((pdev->seg << 16) | (pdev->bus << 8) | 
pdev->devfn);
@@ -1062,7 +1071,7 @@ unsigned int pci_msix_get_table_len(struct pci_dev *pdev)
     func = PCI_FUNC(pdev->devfn);
 
     pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
-    if ( !pos )
+    if ( !pos || !use_msi )
         return 0;
 
     control = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos));
@@ -1135,6 +1144,9 @@ static struct keyhandler dump_msi_keyhandler = {
 
 static int __init msi_setup_keyhandler(void)
 {
+    if ( use_msi < 0 )
+        use_msi = !(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI);
+
     register_keyhandler('M', &dump_msi_keyhandler);
     return 0;
 }
diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c 
b/xen/drivers/passthrough/amd/iommu_acpi.c
index da7d576..7205a5f 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -1066,5 +1066,8 @@ int __init amd_iommu_get_ivrs_dev_entries(void)
 
 int __init amd_iommu_update_ivrs_mapping_acpi(void)
 {
+    if ( unlikely(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) )
+        return -EPERM;
+
     return acpi_table_parse(ACPI_SIG_IVRS, parse_ivrs_table);
 }
diff --git a/xen/drivers/passthrough/vtd/iommu.c 
b/xen/drivers/passthrough/vtd/iommu.c
index e4f464a..b34081a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2133,6 +2133,12 @@ int __init intel_vtd_setup(void)
     if ( list_empty(&acpi_drhd_units) )
         return -ENODEV;
 
+    if ( unlikely(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) )
+    {
+        ret = -EPERM;
+        goto error;
+    }
+
     platform_quirks_init();
 
     /* We enable the following features only if they are supported by all VT-d
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.