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

[Xen-devel] [PATCH v4 06/12] AMD/IOMMU: split amd_iommu_init_one()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Thu, 25 Jul 2019 13:31:21 +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=jSLH4pLR/49eYUIXhVFLXPI/eLj+gH5e6hTZ9TDCgt0=; b=Cw8PGHQN11VBxpXQmSkV4UuddOQrYIVaVRQIVrTGbyCDE8eEEUw5VrzLg23DhinBDCUGcYWd8kUOMMXlQVlOtwT75VjeImVYb8aY/+Qai5JYFa7JJmpt+CRf4u2gbylFdEhHbH9fSCNXgrmY7R+4Yzk98saMg+2vWUcQ3/mYa5gyO2p4eEmhyiRkM4JbMQ1EKN349uUTNDqB7cC0Thn5tiZ87+R/2UKSlcHw/yqBkTJt8FwZlxg7KYJyNF2cmygHQF3/VgcvZPqYhmpPjAYdd6UXyy7Kt4Dh1+sNwt/GUjs5vP8W3I3Uj0ynSEZe697lJNJIoR4bFctdC4LRAlZLsA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eCRpNyembBd5lvLwu+ilYT+NCSc6WyU6bC95/SrgeDe6rQU/h3lW7TNEAyDu2f9vyWPAz8NI3s2lNgqnjupcjS602uCDKfWWuNKjlGZePTA9F6YuFjGw+5BTlCNv6Z0D3tmtNhss5PMr/JxKY5WrF8hGbssJMvqGe1wRXRkh7RchT4UDW54piDq1hCiB4N6b5xN88XaudeYREGSlsSnJX8G9FaccqmMqhJr8kqw6aRJ4ZZDRUNWZgVh0OF3SGzmqb+sCY6Lg7U2H/wxOLqn2O8xeg8urO0AJy6+oeMgdPxn9eg+weVRgZYNDfIA6DgDOuZCskJRUsHeanGCxcIuVjQ==
  • 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: Thu, 25 Jul 2019 13:41:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVQu0/afOQjbo/SEW8vV3b2KmUNQ==
  • Thread-topic: [PATCH v4 06/12] 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>
Acked-by: Brian Woods <brian.woods@xxxxxxx>

--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -969,14 +969,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;
  
@@ -1201,6 +1193,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;
@@ -1231,7 +1240,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®.