diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2011-04-11 05:03:18 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-04-12 03:21:51 -0400 |
commit | d99ddec3eee0be8a43b2c1ff624b9dfaaa26b959 (patch) | |
tree | a87ad31dc20c42346f05bf74f98aa84243bf50a4 /arch/x86/kernel/amd_iommu_init.c | |
parent | 7d0c5cc5be73f7ce26fdcca7b8ec2203f661eb93 (diff) |
x86/amd-iommu: Add extended feature detection
This patch adds detection of the extended features of an
AMD IOMMU. The available features are printed to dmesg on
boot.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/kernel/amd_iommu_init.c')
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 8848dda808e..047905dc3e1 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -299,9 +299,23 @@ static void iommu_feature_disable(struct amd_iommu *iommu, u8 bit) | |||
299 | /* Function to enable the hardware */ | 299 | /* Function to enable the hardware */ |
300 | static void iommu_enable(struct amd_iommu *iommu) | 300 | static void iommu_enable(struct amd_iommu *iommu) |
301 | { | 301 | { |
302 | printk(KERN_INFO "AMD-Vi: Enabling IOMMU at %s cap 0x%hx\n", | 302 | static const char * const feat_str[] = { |
303 | "PreF", "PPR", "X2APIC", "NX", "GT", "[5]", | ||
304 | "IA", "GA", "HE", "PC", NULL | ||
305 | }; | ||
306 | int i; | ||
307 | |||
308 | printk(KERN_INFO "AMD-Vi: Enabling IOMMU at %s cap 0x%hx", | ||
303 | dev_name(&iommu->dev->dev), iommu->cap_ptr); | 309 | dev_name(&iommu->dev->dev), iommu->cap_ptr); |
304 | 310 | ||
311 | if (iommu->cap & (1 << IOMMU_CAP_EFR)) { | ||
312 | printk(KERN_CONT " extended features: "); | ||
313 | for (i = 0; feat_str[i]; ++i) | ||
314 | if (iommu_feature(iommu, (1ULL << i))) | ||
315 | printk(KERN_CONT " %s", feat_str[i]); | ||
316 | } | ||
317 | printk(KERN_CONT "\n"); | ||
318 | |||
305 | iommu_feature_enable(iommu, CONTROL_IOMMU_EN); | 319 | iommu_feature_enable(iommu, CONTROL_IOMMU_EN); |
306 | } | 320 | } |
307 | 321 | ||
@@ -657,7 +671,7 @@ static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m) | |||
657 | static void __init init_iommu_from_pci(struct amd_iommu *iommu) | 671 | static void __init init_iommu_from_pci(struct amd_iommu *iommu) |
658 | { | 672 | { |
659 | int cap_ptr = iommu->cap_ptr; | 673 | int cap_ptr = iommu->cap_ptr; |
660 | u32 range, misc; | 674 | u32 range, misc, low, high; |
661 | int i, j; | 675 | int i, j; |
662 | 676 | ||
663 | pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET, | 677 | pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET, |
@@ -673,6 +687,12 @@ static void __init init_iommu_from_pci(struct amd_iommu *iommu) | |||
673 | MMIO_GET_LD(range)); | 687 | MMIO_GET_LD(range)); |
674 | iommu->evt_msi_num = MMIO_MSI_NUM(misc); | 688 | iommu->evt_msi_num = MMIO_MSI_NUM(misc); |
675 | 689 | ||
690 | /* read extended feature bits */ | ||
691 | low = readl(iommu->mmio_base + MMIO_EXT_FEATURES); | ||
692 | high = readl(iommu->mmio_base + MMIO_EXT_FEATURES + 4); | ||
693 | |||
694 | iommu->features = ((u64)high << 32) | low; | ||
695 | |||
676 | if (!is_rd890_iommu(iommu->dev)) | 696 | if (!is_rd890_iommu(iommu->dev)) |
677 | return; | 697 | return; |
678 | 698 | ||