diff mbox

agp/uninorth: Fix oops caused by flushing too much

Message ID 20100602053308.GA24509@drongo (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Paul Mackerras June 2, 2010, 5:33 a.m. UTC
This fixes a sporadic oops at boot on G5 Power Macs.  The table_end
variable has the address of the last byte of the table.  Adding on
PAGE_SIZE means we flush too much, and if the page after the table
is not mapped for any reason, the kernel will oops.  Instead we add
on 1 because flush_dcache_range() interprets its second argument as
the first byte past the range to be flushed.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---

Comments

Michel Dänzer June 8, 2010, 6:48 a.m. UTC | #1
On Mit, 2010-06-02 at 15:33 +1000, Paul Mackerras wrote: 
> This fixes a sporadic oops at boot on G5 Power Macs.  The table_end
> variable has the address of the last byte of the table.  Adding on
> PAGE_SIZE means we flush too much, and if the page after the table
> is not mapped for any reason, the kernel will oops.  Instead we add
> on 1 because flush_dcache_range() interprets its second argument as
> the first byte past the range to be flushed.
> 
> Signed-off-by: Paul Mackerras <paulus@samba.org>

Reviewed-by: Michel Dänzer <michel@daenzer.net>
Tested-by: Michel Dänzer <michel@daenzer.net>


Thanks for the good catch, Paul.


> ---
> 
> diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
> index 6f48931..9aaa0eb 100644
> --- a/drivers/char/agp/uninorth-agp.c
> +++ b/drivers/char/agp/uninorth-agp.c
> @@ -413,7 +413,7 @@ static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
>  	bridge->gatt_table_real = (u32 *) table;
>  	/* Need to clear out any dirty data still sitting in caches */
>  	flush_dcache_range((unsigned long)table,
> -			   (unsigned long)(table_end + PAGE_SIZE));
> +			   (unsigned long)table_end + 1);
>  	bridge->gatt_table = vmap(pages, (1 << page_order), 0, PAGE_KERNEL_NCG);
>  
>  	if (bridge->gatt_table == NULL)
diff mbox

Patch

diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 6f48931..9aaa0eb 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -413,7 +413,7 @@  static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
 	bridge->gatt_table_real = (u32 *) table;
 	/* Need to clear out any dirty data still sitting in caches */
 	flush_dcache_range((unsigned long)table,
-			   (unsigned long)(table_end + PAGE_SIZE));
+			   (unsigned long)table_end + 1);
 	bridge->gatt_table = vmap(pages, (1 << page_order), 0, PAGE_KERNEL_NCG);
 
 	if (bridge->gatt_table == NULL)