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

[Xen-devel] [PATCH v3 09/14] AMD/IOMMU: split amd_iommu_init_one()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Tue, 16 Jul 2019 16:39:10 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vg83EnRe07r+jRjZ/qwIpCyfBh20KxWeQ/+c3Wzs1Lc=; b=VijdwysAAIaWGC8XPsJOi71cP5GTlSPnXh+Ryn5MYQwYZfZ3dGwUfWgBr8qgd5X1lUeibXCaDooE934Xeo4xSdfhIg8EQ4fQIu4qpCmfe2waXRHrjhOgoj13q0Ji33zCh7BZk+QGt0lahVhsP4H+GXDG8c2yYbDX65IErPbZdxcFwVRUOnIvJqA5CAkaBgg3AcKMiwoKiciqah6pFao9bBFqJDY+JcxWweyUJKzryOXSHT3VFG7VlKMoGq1w8Z2jX8aqY7HxlfdtgQir3UXRhylKoSUwa5SygC72DHfBHmsb1+kRtW6Ez5963GlQhrLJeIY6vk3+vmIS/T3zUlZ8FQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cDMukGVLmmwS520wABqeEj/aFicL0n8jvZWOb0mXa3dKkI3PBOx6VDSII+WWRWAZdQGZun9iHHAkOqV+d6f+63Wt2RQf2vfqEFiEjdnnatRfzY9Ye5mM86d3jRXwAJppli/zbJq3NDUc7Ge2ksPLDNvaiDE7AigvELERAUCcmbPENgUunrfukTH+XSnnGR0AyKsbfqLk9tOly1vC/AkRJrQ9KdEa6LrAqN8o54zIeXXvARddHTawPHi76/VcMIYRXOSwiEfQZ786tUhkxEcScvsQhIpj7KRObRTkoAHLSZFHI8aXJyvI4hoSw8A/0BCQQb+qZUgA8pM3lMQMhFN00w==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Brian Woods <brian.woods@xxxxxxx>, Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
  • Delivery-date: Tue, 16 Jul 2019 16:40:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVO/T+l/L0RdzIkE6hk2D5aqFLVA==
  • Thread-topic: [PATCH v3 09/14] AMD/IOMMU: split amd_iommu_init_one()

Mapping the MMIO space and obtaining feature information needs to happen
slightly earlier, such that for x2APIC support we can set XTEn prior to
calling amd_iommu_update_ivrs_mapping_acpi() and
amd_iommu_setup_ioapic_remapping().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -970,14 +970,6 @@ static void * __init allocate_ppr_log(st
  
  static int __init amd_iommu_init_one(struct amd_iommu *iommu)
  {
-    if ( map_iommu_mmio_region(iommu) != 0 )
-        goto error_out;
-
-    get_iommu_features(iommu);
-
-    if ( iommu->features.raw )
-        iommuv2_enabled = 1;
-
      if ( allocate_cmd_buffer(iommu) == NULL )
          goto error_out;
  
@@ -1202,6 +1194,23 @@ static bool_t __init amd_sp5100_erratum2
      return 0;
  }
  
+static int __init amd_iommu_prepare_one(struct amd_iommu *iommu)
+{
+    int rc = alloc_ivrs_mappings(iommu->seg);
+
+    if ( !rc )
+        rc = map_iommu_mmio_region(iommu);
+    if ( rc )
+        return rc;
+
+    get_iommu_features(iommu);
+
+    if ( iommu->features.raw )
+        iommuv2_enabled = true;
+
+    return 0;
+}
+
  int __init amd_iommu_init(void)
  {
      struct amd_iommu *iommu;
@@ -1232,7 +1241,7 @@ int __init amd_iommu_init(void)
      radix_tree_init(&ivrs_maps);
      for_each_amd_iommu ( iommu )
      {
-        rc = alloc_ivrs_mappings(iommu->seg);
+        rc = amd_iommu_prepare_one(iommu);
          if ( rc )
              goto error_out;
      }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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