diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2012-06-14 06:21:55 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2012-07-17 06:14:57 -0400 |
commit | 4d121c3256edc66fe8a8e7f975eba72add120a26 (patch) | |
tree | e85d2c2a72462128e8c012d127269358b5ffc726 /drivers/iommu/amd_iommu_init.c | |
parent | 23c742db217113585ccc6c4a9b6ff96d642b6158 (diff) |
iommu/amd: Move informational prinks out of iommu_enable
This function will be called before the PCI subsystem is
initialized. Therefore dev_name doen't work and IOMMU
information can't be printed to the klog as before. Move the
code to print that information to a later point where PCI
initializtion has already happened.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
-rw-r--r-- | drivers/iommu/amd_iommu_init.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index c3d650dea240..b18034a8fdb3 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -312,23 +312,6 @@ static void iommu_set_inv_tlb_timeout(struct amd_iommu *iommu, int timeout) | |||
312 | /* Function to enable the hardware */ | 312 | /* Function to enable the hardware */ |
313 | static void iommu_enable(struct amd_iommu *iommu) | 313 | static void iommu_enable(struct amd_iommu *iommu) |
314 | { | 314 | { |
315 | static const char * const feat_str[] = { | ||
316 | "PreF", "PPR", "X2APIC", "NX", "GT", "[5]", | ||
317 | "IA", "GA", "HE", "PC", NULL | ||
318 | }; | ||
319 | int i; | ||
320 | |||
321 | printk(KERN_INFO "AMD-Vi: Enabling IOMMU at %s cap 0x%hx", | ||
322 | dev_name(&iommu->dev->dev), iommu->cap_ptr); | ||
323 | |||
324 | if (iommu->cap & (1 << IOMMU_CAP_EFR)) { | ||
325 | printk(KERN_CONT " extended features: "); | ||
326 | for (i = 0; feat_str[i]; ++i) | ||
327 | if (iommu_feature(iommu, (1ULL << i))) | ||
328 | printk(KERN_CONT " %s", feat_str[i]); | ||
329 | } | ||
330 | printk(KERN_CONT "\n"); | ||
331 | |||
332 | iommu_feature_enable(iommu, CONTROL_IOMMU_EN); | 315 | iommu_feature_enable(iommu, CONTROL_IOMMU_EN); |
333 | } | 316 | } |
334 | 317 | ||
@@ -1096,6 +1079,31 @@ static int iommu_init_pci(struct amd_iommu *iommu) | |||
1096 | return pci_enable_device(iommu->dev); | 1079 | return pci_enable_device(iommu->dev); |
1097 | } | 1080 | } |
1098 | 1081 | ||
1082 | static void print_iommu_info(void) | ||
1083 | { | ||
1084 | static const char * const feat_str[] = { | ||
1085 | "PreF", "PPR", "X2APIC", "NX", "GT", "[5]", | ||
1086 | "IA", "GA", "HE", "PC" | ||
1087 | }; | ||
1088 | struct amd_iommu *iommu; | ||
1089 | |||
1090 | for_each_iommu(iommu) { | ||
1091 | int i; | ||
1092 | |||
1093 | pr_info("AMD-Vi: Found IOMMU at %s cap 0x%hx\n", | ||
1094 | dev_name(&iommu->dev->dev), iommu->cap_ptr); | ||
1095 | |||
1096 | if (iommu->cap & (1 << IOMMU_CAP_EFR)) { | ||
1097 | pr_info("AMD-Vi: Extended features: "); | ||
1098 | for (i = 0; ARRAY_SIZE(feat_str); ++i) { | ||
1099 | if (iommu_feature(iommu, (1ULL << i))) | ||
1100 | pr_cont(" %s", feat_str[i]); | ||
1101 | } | ||
1102 | } | ||
1103 | pr_cont("\n"); | ||
1104 | } | ||
1105 | } | ||
1106 | |||
1099 | static int amd_iommu_init_pci(void) | 1107 | static int amd_iommu_init_pci(void) |
1100 | { | 1108 | { |
1101 | struct amd_iommu *iommu; | 1109 | struct amd_iommu *iommu; |
@@ -1112,6 +1120,8 @@ static int amd_iommu_init_pci(void) | |||
1112 | 1120 | ||
1113 | ret = amd_iommu_init_devices(); | 1121 | ret = amd_iommu_init_devices(); |
1114 | 1122 | ||
1123 | print_iommu_info(); | ||
1124 | |||
1115 | return ret; | 1125 | return ret; |
1116 | } | 1126 | } |
1117 | 1127 | ||