]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
VT-d: section placement and type adjustments
authorJan Beulich <jbeulich@suse.com>
Tue, 13 Oct 2015 15:17:16 +0000 (17:17 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 13 Oct 2015 15:17:16 +0000 (17:17 +0200)
With x2APIC requiring iommu_supports_eim() to return true, we can
adjust a few conditonals such that both it and
platform_supports_x2apic() can be marked __init. For the latter as
well as for platform_supports_intremap() also change the return types
to bool_t.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Yang Zhang <yang.z.zhang@intel.com>
xen/drivers/passthrough/vtd/dmar.c
xen/drivers/passthrough/vtd/extern.h
xen/drivers/passthrough/vtd/intremap.c

index 34ec4c7b0d005ff4a538a50504154fbf735d2da4..7cad5930a75cdac34dc2503bc58bd7197b8d086f 100644 (file)
@@ -901,16 +901,17 @@ void acpi_dmar_zap(void)
         write_atomic((uint32_t*)&dmar_table->signature[0], sig);
 }
 
-int platform_supports_intremap(void)
+bool_t platform_supports_intremap(void)
 {
-    unsigned int mask = ACPI_DMAR_INTR_REMAP;
+    const unsigned int mask = ACPI_DMAR_INTR_REMAP;
 
     return (dmar_flags & mask) == ACPI_DMAR_INTR_REMAP;
 }
 
-int platform_supports_x2apic(void)
+bool_t __init platform_supports_x2apic(void)
 {
-    unsigned int mask = ACPI_DMAR_INTR_REMAP | ACPI_DMAR_X2APIC_OPT_OUT;
+    const unsigned int mask = ACPI_DMAR_INTR_REMAP | ACPI_DMAR_X2APIC_OPT_OUT;
+
     return cpu_has_x2apic && ((dmar_flags & mask) == ACPI_DMAR_INTR_REMAP);
 }
 
index fbfd9a6d5bedcfda74a8f58f7dbd2680155c37dc..cbe02866e4ae5ee928cc3dce5b70aa099589459b 100644 (file)
@@ -93,8 +93,8 @@ void vtd_ops_preamble_quirk(struct iommu* iommu);
 void vtd_ops_postamble_quirk(struct iommu* iommu);
 void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map);
 void pci_vtd_quirk(const struct pci_dev *);
-int platform_supports_intremap(void);
-int platform_supports_x2apic(void);
+bool_t platform_supports_intremap(void);
+bool_t platform_supports_x2apic(void);
 
 void vtd_set_hwdom_mapping(struct domain *d);
 
index f9ba0ceadd3bdf2c3a1d30e34a8dd0f0527449db..776ec54762f45925af7299ab902e882157d661b4 100644 (file)
@@ -143,7 +143,7 @@ static void set_hpet_source_id(unsigned int id, struct iremap_entry *ire)
     set_ire_sid(ire, SVT_VERIFY_SID_SQ, SQ_13_IGNORE_3, hpetid_to_bdf(id));
 }
 
-bool_t iommu_supports_eim(void)
+bool_t __init iommu_supports_eim(void)
 {
     struct acpi_drhd_unit *drhd;
     unsigned int apic;
@@ -832,11 +832,16 @@ int iommu_enable_x2apic_IR(void)
     struct acpi_drhd_unit *drhd;
     struct iommu *iommu;
 
-    if ( !iommu_supports_eim() )
-        return -EOPNOTSUPP;
+    if ( system_state < SYS_STATE_active )
+    {
+        if ( !iommu_supports_eim() )
+            return -EOPNOTSUPP;
 
-    if ( !platform_supports_x2apic() )
-        return -ENXIO;
+        if ( !platform_supports_x2apic() )
+            return -ENXIO;
+    }
+    else if ( !x2apic_enabled )
+        return -EOPNOTSUPP;
 
     for_each_drhd_unit ( drhd )
     {
@@ -888,7 +893,8 @@ void iommu_disable_x2apic_IR(void)
 {
     struct acpi_drhd_unit *drhd;
 
-    if ( !iommu_supports_eim() )
+    /* x2apic_enabled implies iommu_supports_eim(). */
+    if ( !x2apic_enabled )
         return;
 
     for_each_drhd_unit ( drhd )