LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86: amd_iommu: fix nasty bug that caused ILLEGAL_DEVICE_TABLE_ENTRY errors
@ 2008-10-16 14:27 Andreas Herrmann
  2008-10-16 14:59 ` Joerg Roedel
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Herrmann @ 2008-10-16 14:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel, iommu, Joerg Roedel

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.)

Cc: iommu@lists.linux-foundation.org
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>

---
 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

diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index a69cc0f..bccd0ef 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -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);
 
-- 
1.6.0.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: amd_iommu: fix nasty bug that caused ILLEGAL_DEVICE_TABLE_ENTRY errors
  2008-10-16 14:27 [PATCH] x86: amd_iommu: fix nasty bug that caused ILLEGAL_DEVICE_TABLE_ENTRY errors Andreas Herrmann
@ 2008-10-16 14:59 ` Joerg Roedel
  2008-10-20 16:06   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Joerg Roedel @ 2008-10-16 14:59 UTC (permalink / raw)
  To: Andreas Herrmann
  Cc: Ingo Molnar, Thomas Gleixner, iommu, linux-kernel, stable

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
stable@kernel.org.

On Thu, Oct 16, 2008 at 04:27:36PM +0200, Andreas Herrmann wrote:
> 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.)
> 
> Cc: iommu@lists.linux-foundation.org
> Cc: Joerg Roedel <joerg.roedel@amd.com>
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

> 
> ---
>  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
> 
> diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
> index a69cc0f..bccd0ef 100644
> --- a/arch/x86/kernel/amd_iommu_init.c
> +++ b/arch/x86/kernel/amd_iommu_init.c
> @@ -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);
>  
> -- 
> 1.6.0.2
> 
> 
> 
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: amd_iommu: fix nasty bug that caused ILLEGAL_DEVICE_TABLE_ENTRY errors
  2008-10-16 14:59 ` Joerg Roedel
@ 2008-10-20 16:06   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-10-20 16:06 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Andreas Herrmann, Thomas Gleixner, iommu, linux-kernel, stable


* Joerg Roedel <joro@8bytes.org> wrote:

> 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
> stable@kernel.org.
> 
> On Thu, Oct 16, 2008 at 04:27:36PM +0200, Andreas Herrmann wrote:
> > 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.)
> > 
> > Cc: iommu@lists.linux-foundation.org
> > Cc: Joerg Roedel <joerg.roedel@amd.com>
> > Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> 
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

applied to tip/x86/urgent, thanks guys!

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-20 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-16 14:27 [PATCH] x86: amd_iommu: fix nasty bug that caused ILLEGAL_DEVICE_TABLE_ENTRY errors Andreas Herrmann
2008-10-16 14:59 ` Joerg Roedel
2008-10-20 16:06   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).