x86: amd_iommu: fix nasty bug that caused ILLEGAL_DEVICE_TABLE_ENTRY errors
PATCH 1/1 x86: amd_iommu: fix nasty bug that caused ILLEGAL_DEVICE_TABLE_ENTRY errors
We are on 64-bit so better use u64 instead of u32 to deal with addresses:
static void __init iommu_set_device_table(struct amd_iommu *iommu)
{
u64 entry;
...
entry = virt_to_phys(amd_iommu_dev_table);...
(I am wondering why gcc 4.2.x did not warn about the assignment between u32 and unsigned long.)
--- arch/x86/kernel/amd_iommu_init.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Patch is against today's tip/x86/amd-iommu Joerg is on vacation. That is why I post this patch directly to you.
Regards,
Andreas
arch/x86/kernel/amd_iommu_init.c +1 -1
@@ -210,7 +210,7 @@ static void __init iommu_set_exclusion_range(struct amd_iommu *iommu)/* Programs the physical address of the device table into the IOMMU hardware */ static void __init iommu_set_device_table (struct amd_iommu *iommu) { -u32 entry; +u64 entry;BUG_ON (iommu->mmio_base ==NULL );
Signature · 1 line
1.6.0.2
Argh. Very stupid bug. This explains why it worked on my system with 1G RAM and failed on some others with more. Thanks for the fix. I also CC [email protected].
Quoted 8 lines · Andreas Herrmann
We are on 64-bit so better use u64 instead of u32 to deal with addresses:
static void
__initiommu_set_device_table(struct amd_iommu *iommu){ u64 entry; ... entry = virt_to_phys(amd_iommu_dev_table);
Quoted 8 lines
...
(I am wondering why gcc 4.2.x did not warn about the assignment between u32 and unsigned long.)
Cc Joerg Roedel <[email protected]>Signed-off-by Andreas Herrmann <[email protected]>
Quoted 35 lines
--- arch/x86/kernel/amd_iommu_init.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Patch is against today's tip/x86/amd-iommu Joerg is on vacation. That is why I post this patch directly to you.
Regards,
Andreas
arch/x86/kernel/amd_iommu_init.c +1
-1@@ -210,7 +210,7 @@ static void __init iommu_set_exclusion_range(struct amd_iommu *iommu)/* Programs the physical address of the device table into the IOMMU hardware */ static void __init iommu_set_device_table (struct amd_iommu *iommu) { -u32 entry; +u64 entry;BUG_ON (iommu->mmio_base ==NULL );Signature · 8 lines
1.6.0.2 _______________________________________________ iommu mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/iommu
Ingo Molnar
AppliedQuoted 15 lines · Joerg Roedel
Argh. Very stupid bug. This explains why it worked on my system with 1G RAM and failed on some others with more. Thanks for the fix. I also CC [email protected].
Quoted 10 lines · Andreas Herrmann
We are on 64-bit so better use u64 instead of u32 to deal with addresses:
static void
__initiommu_set_device_table(struct amd_iommu *iommu){ u64 entry; ... entry = virt_to_phys(amd_iommu_dev_table);...
Quoted 8 lines
Quoted 6 lines
(I am wondering why gcc 4.2.x did not warn about the assignment between u32 and unsigned long.)
Cc Joerg Roedel <[email protected]>Signed-off-by Andreas Herrmann <[email protected]>Signed-off-by Joerg Roedel <[email protected]>
applied to tip/x86/urgent, thanks guys!
Ingo