* [PATCH] MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET
@ 2010-03-09 14:46 Florian Fainelli
2010-03-09 21:03 ` peter fuerst
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2010-03-09 14:46 UTC (permalink / raw)
To: linux-mips; +Cc: ralf
On AR7, we already redefine PHYS_OFFSET to match the system specifities, it is
however not sufficient when unsing dma_{map,unmap}_single, specifically in the
Ethernet driver, we must also adjust CAC_ADDR and UNCAC_ADDR for DMA to work
correctly. This patch fixes the following issue, seen in cpmac_open:
ops[#1]:
Cpu 0
$ 0 : 00000000 10008400 a0f5b120 00000000
$ 4 : 94c59000 94270f64 00000020 00000010
$ 8 : 00000010 94103ce0 0000000a 94c03400
$12 : ffffffff 94c03408 94c03410 00000001
$16 : a0f5ba20 00000041 94c592c0 94c59200
$20 : 94c59000 000005ee 00002000 9438c8f0
$24 : 00000010 00000000
$28 : 94fac000 94fadd58 94390000 942724a8
Hi : 00000000
Lo : 00000001
epc : 94272518 cpmac_open+0x208/0x3f8
Not tainted
ra : 942724a8 cpmac_open+0x198/0x3f8
Status: 10008403 KERNEL EXL IE
Cause : 3080000c
BadVA : 00000000
PrId : 00018448 (MIPS 4KEc)
Modules linked in:
Process ifconfig (pid: 278, threadinfo=94fac000, task=94e79590, tls=00000000)
Stack : 7f8da120 2ab05cb0 94c59000 943356f0 00000000 943d0000 94c59000 943356f0
94c59030 943d0000 943c27c0 94fade10 00000000 94fade20 94c59000 9428e5a4
00000000 94c59000 00000041 94289768 94c59000 00000041 00001002 00001043
00000000 9428d810 00000000 94fade10 7f8da4e8 9428e6b8 00000000 7f8da4a8
7f8da4e8 00008914 00000000 942f7f2c 00000000 00000008 00408000 00008913
...
Call Trace:
[<94272518>] cpmac_open+0x208/0x3f8
[<9428e5a4>] dev_open+0x164/0x264
[<9428d810>] dev_change_flags+0xd0/0x1bc
[<942f7f2c>] devinet_ioctl+0x2d8/0x908
[<942771f8>] sock_ioctl+0x29c/0x2fc
[<941a0fb4>] vfs_ioctl+0x2c/0x7c
[<941a16ec>] do_vfs_ioctl+0x5dc/0x630
[<941a1790>] sys_ioctl+0x50/0x88
[<94101e10>] stack_done+0x20/0x3c
Signed-off-by: Regards, Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index ac32572..7b11df5 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -188,8 +188,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
-#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
+#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE + \
+ PHYS_OFFSET)
+#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET + \
+ PHYS_OFFSET)
#include <asm-generic/memory_model.h>
#include <asm-generic/getorder.h>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET
2010-03-09 14:46 [PATCH] MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET Florian Fainelli
@ 2010-03-09 21:03 ` peter fuerst
2010-03-09 21:23 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: peter fuerst @ 2010-03-09 21:03 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-mips, ralf
Hi Florian, thats funny!
On Tue, 9 Mar 2010, Florian Fainelli wrote:
> Date: Tue, 9 Mar 2010 15:46:01 +0100
> From: Florian Fainelli <florian@openwrt.org>
> To: linux-mips@linux-mips.org
> Cc: ralf@linux-mips.org
> Subject: [PATCH] MIPS: make CAC_ADDR and UNCAC_ADDR account for
> PHYS_OFFSET
>
> On AR7, ...
>
> Signed-off-by: Regards, Florian Fainelli <florian@openwrt.org>
> ---
> diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
> index ac32572..7b11df5 100644
> --- a/arch/mips/include/asm/page.h
> +++ b/arch/mips/include/asm/page.h
> @@ -188,8 +188,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
> #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
> VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
>
> -#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
> -#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
> +#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE + \
> + PHYS_OFFSET)
> +#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET + \
> + PHYS_OFFSET)
>
> #include <asm-generic/memory_model.h>
> #include <asm-generic/getorder.h>
>
I assume, you don't want "+" PHYS_OFFSET in both defines.
Two years and a month ago almost the same patch (which used to work on
the machine that needed it :) was submitted:
--- a/linux-2.6.24/include/asm-mips/page.h Fri Jan 25 12:23:51 2008
+++ b/linux-2.6.24/include/asm-mips/page.h Wed Feb 6 23:26:31 2008
@@ -184,8 +184,8 @@
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
-#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
+#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + PHYS_OFFSET + UNCAC_BASE)
+#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET - PHYS_OFFSET)
#include <asm-generic/memory_model.h>
#include <asm-generic/page.h>
But correct versions of these macros seem to be essential for very
"exotic" systems only ;-)
kind regards
peter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET
2010-03-09 21:03 ` peter fuerst
@ 2010-03-09 21:23 ` Florian Fainelli
0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2010-03-09 21:23 UTC (permalink / raw)
To: peter fuerst; +Cc: linux-mips, ralf
[-- Attachment #1: Type: Text/Plain, Size: 2666 bytes --]
Le mardi 9 mars 2010 22:03:27, peter fuerst a écrit :
> Hi Florian, thats funny!
>
> On Tue, 9 Mar 2010, Florian Fainelli wrote:
> > Date: Tue, 9 Mar 2010 15:46:01 +0100
> > From: Florian Fainelli <florian@openwrt.org>
> > To: linux-mips@linux-mips.org
> > Cc: ralf@linux-mips.org
> > Subject: [PATCH] MIPS: make CAC_ADDR and UNCAC_ADDR account for
> > PHYS_OFFSET
> >
> > On AR7, ...
> >
> > Signed-off-by: Regards, Florian Fainelli <florian@openwrt.org>
> > ---
> > diff --git a/arch/mips/include/asm/page.h
> > b/arch/mips/include/asm/page.h index ac32572..7b11df5 100644
> > --- a/arch/mips/include/asm/page.h
> > +++ b/arch/mips/include/asm/page.h
> > @@ -188,8 +188,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
> > #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
> > VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
> >
> > -#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
> > -#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
> > +#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE + \
> > + PHYS_OFFSET)
> > +#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET + \
> > + PHYS_OFFSET)
> >
> > #include <asm-generic/memory_model.h>
> > #include <asm-generic/getorder.h>
>
> I assume, you don't want "+" PHYS_OFFSET in both defines.
>
> Two years and a month ago almost the same patch (which used to work on
> the machine that needed it :) was submitted:
Oh I actually did even search for that one.
>
> --- a/linux-2.6.24/include/asm-mips/page.h Fri Jan 25 12:23:51 2008
> +++ b/linux-2.6.24/include/asm-mips/page.h Wed Feb 6 23:26:31 2008
> @@ -184,8 +184,8 @@
> #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
> VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
>
> -#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
> -#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
> +#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + PHYS_OFFSET +
> UNCAC_BASE) +#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET -
> PHYS_OFFSET)
>
> #include <asm-generic/memory_model.h>
> #include <asm-generic/page.h>
>
> But correct versions of these macros seem to be essential for very
> "exotic" systems only ;-)
You are right. This is actually needed when people do weird designs, and that
happens ;) Will resubmit with the proper fixing.
--
Best regards, Florian Fainelli
Email: florian@openwrt.org
Web: http://openwrt.org
IRC: [florian] on irc.freenode.net
-------------------------------
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-09 21:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 14:46 [PATCH] MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET Florian Fainelli
2010-03-09 21:03 ` peter fuerst
2010-03-09 21:23 ` Florian Fainelli
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).