From: Ira W. Snyder <hidden> Date: 2009-07-08 16:19:57
Add support for the Freescale MPC83xx memory controller to the existing
driver for the Freescale MPC85xx memory controller. The only difference
between the two processors are in the CS_BNDS register parsing code.
The L2 cache controller does not exist on the MPC83xx, but the OF subsystem
will not use the driver if the device is not present in the OF device tree.
Signed-off-by: Ira W. Snyder <redacted>
---
This was tested on an MPC8349EMDS-based board.
I don't really like how the MCE disable works on mpc85xx (clearing the
HID1 register), but this can be revisited when mpc86xx support gets
added. It sucks to have this happen before the probe() routine is called
and we know what kind of hardware we're actually running on.
drivers/edac/Kconfig | 6 +++---
drivers/edac/mpc85xx_edac.c | 38 ++++++++++++++++++++++++++++----------
drivers/edac/mpc85xx_edac.h | 3 +++
3 files changed, 34 insertions(+), 13 deletions(-)
From: Kumar Gala <hidden> Date: 2009-07-08 18:12:09
On Jul 8, 2009, at 11:19 AM, Ira W. Snyder wrote:
Add support for the Freescale MPC83xx memory controller to the
existing
driver for the Freescale MPC85xx memory controller. The only
difference
between the two processors are in the CS_BNDS register parsing code.
The L2 cache controller does not exist on the MPC83xx, but the OF
subsystem
will not use the driver if the device is not present in the OF
device tree.
Signed-off-by: Ira W. Snyder <redacted>
---
This was tested on an MPC8349EMDS-based board.
I don't really like how the MCE disable works on mpc85xx (clearing the
HID1 register), but this can be revisited when mpc86xx support gets
added. It sucks to have this happen before the probe() routine is
called
and we know what kind of hardware we're actually running on.
drivers/edac/Kconfig | 6 +++---
drivers/edac/mpc85xx_edac.c | 38 +++++++++++++++++++++++++++
+----------
drivers/edac/mpc85xx_edac.h | 3 +++
3 files changed, 34 insertions(+), 13 deletions(-)
[snip]
quoted hunk
/************************ MC SYSFS parts
***********************************/
I don't understand this at all.. The only difference between 83xx &
85xx is that we should have an extra 4-bits for 36-bit physical
addresses.
We should be able to write this code in such a way that it works for
both 83xx & 85xx.
start = (cs_bnds & 0xffff0000) >> 16;
end = (cs_bnds & 0xffff);
if (start == end)
continue;
start <<= (20 - PAGE_SHIFT);
end <<= (20 - PAGE_SHIFT);
end |= (1 << (20 - PAGE_SHIFT)) - 1;
- k
From: Ira W. Snyder <hidden> Date: 2009-07-08 19:33:59
On Wed, Jul 08, 2009 at 01:09:39PM -0500, Kumar Gala wrote:
On Jul 8, 2009, at 11:19 AM, Ira W. Snyder wrote:
quoted
Add support for the Freescale MPC83xx memory controller to the
existing
driver for the Freescale MPC85xx memory controller. The only
difference
between the two processors are in the CS_BNDS register parsing code.
The L2 cache controller does not exist on the MPC83xx, but the OF
subsystem
will not use the driver if the device is not present in the OF device
tree.
Signed-off-by: Ira W. Snyder <redacted>
---
This was tested on an MPC8349EMDS-based board.
I don't really like how the MCE disable works on mpc85xx (clearing the
HID1 register), but this can be revisited when mpc86xx support gets
added. It sucks to have this happen before the probe() routine is
called
and we know what kind of hardware we're actually running on.
drivers/edac/Kconfig | 6 +++---
drivers/edac/mpc85xx_edac.c | 38 +++++++++++++++++++++++++++
+----------
drivers/edac/mpc85xx_edac.h | 3 +++
3 files changed, 34 insertions(+), 13 deletions(-)
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
I don't understand this at all.. The only difference between 83xx & 85xx
is that we should have an extra 4-bits for 36-bit physical addresses.
We should be able to write this code in such a way that it works for
both 83xx & 85xx.
start = (cs_bnds & 0xffff0000) >> 16;
end = (cs_bnds & 0xffff);
if (start == end)
continue;
start <<= (20 - PAGE_SHIFT);
end <<= (20 - PAGE_SHIFT);
end |= (1 << (20 - PAGE_SHIFT)) - 1;
Sorry, I don't know a thing about PAGE_SHIFT. Looking in
arch/powerpc/platforms/Kconfig.cputype, PPC_85xx doesn't seem to imply a
change in PAGE_SIZE, which changes the PAGE_SHIFT in
arch/powerpc/include/asm/page.h.
Also, are you sure you cannot use 4K pages on an 85xx? If you can use 4K
pages on 85xx, then PAGE_SHIFT == 12, and your solution breaks.
I admit I don't know much about all of the different powerpc platforms.
Ira
From: Kumar Gala <hidden> Date: 2009-07-08 20:58:53
On Jul 8, 2009, at 2:33 PM, Ira W. Snyder wrote:
On Wed, Jul 08, 2009 at 01:09:39PM -0500, Kumar Gala wrote:
quoted
On Jul 8, 2009, at 11:19 AM, Ira W. Snyder wrote:
quoted
Add support for the Freescale MPC83xx memory controller to the
existing
driver for the Freescale MPC85xx memory controller. The only
difference
between the two processors are in the CS_BNDS register parsing code.
The L2 cache controller does not exist on the MPC83xx, but the OF
subsystem
will not use the driver if the device is not present in the OF
device
tree.
Signed-off-by: Ira W. Snyder <redacted>
---
This was tested on an MPC8349EMDS-based board.
I don't really like how the MCE disable works on mpc85xx (clearing
the
HID1 register), but this can be revisited when mpc86xx support gets
added. It sucks to have this happen before the probe() routine is
called
and we know what kind of hardware we're actually running on.
drivers/edac/Kconfig | 6 +++---
drivers/edac/mpc85xx_edac.c | 38 +++++++++++++++++++++++++++
+----------
drivers/edac/mpc85xx_edac.h | 3 +++
3 files changed, 34 insertions(+), 13 deletions(-)
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
I don't understand this at all.. The only difference between 83xx &
85xx
is that we should have an extra 4-bits for 36-bit physical addresses.
We should be able to write this code in such a way that it works for
both 83xx & 85xx.
start = (cs_bnds & 0xffff0000) >> 16;
end = (cs_bnds & 0xffff);
if (start == end)
continue;
start <<= (20 - PAGE_SHIFT);
end <<= (20 - PAGE_SHIFT);
end |= (1 << (20 - PAGE_SHIFT)) - 1;
Sorry, I don't know a thing about PAGE_SHIFT. Looking in
arch/powerpc/platforms/Kconfig.cputype, PPC_85xx doesn't seem to
imply a
change in PAGE_SIZE, which changes the PAGE_SHIFT in
arch/powerpc/include/asm/page.h.
Also, are you sure you cannot use 4K pages on an 85xx? If you can
use 4K
pages on 85xx, then PAGE_SHIFT == 12, and your solution breaks.
I admit I don't know much about all of the different powerpc
platforms.
PAGE_SHIFT is the same.. I was folding in the code from below the diff:
csrow->first_page = start >> PAGE_SHIFT;
csrow->last_page = end >> PAGE_SHIFT;
into the calculation of start/end. I know PAGE_SHIFT is a minimum 12
on any PPC based system (and at this point its always 12 on 85xx/
83xx). The idea is to ensure that when shift start/end up that it
still fits in 32-bits. This is to handle the case of >4G of memory.
- k
From: Ira W. Snyder <hidden> Date: 2009-07-09 16:58:48
On Wed, Jul 08, 2009 at 03:58:02PM -0500, Kumar Gala wrote:
On Jul 8, 2009, at 2:33 PM, Ira W. Snyder wrote:
quoted
On Wed, Jul 08, 2009 at 01:09:39PM -0500, Kumar Gala wrote:
quoted
On Jul 8, 2009, at 11:19 AM, Ira W. Snyder wrote:
quoted
Add support for the Freescale MPC83xx memory controller to the
existing
driver for the Freescale MPC85xx memory controller. The only
difference
between the two processors are in the CS_BNDS register parsing code.
The L2 cache controller does not exist on the MPC83xx, but the OF
subsystem
will not use the driver if the device is not present in the OF
device
tree.
Signed-off-by: Ira W. Snyder <redacted>
---
This was tested on an MPC8349EMDS-based board.
I don't really like how the MCE disable works on mpc85xx (clearing
the
HID1 register), but this can be revisited when mpc86xx support gets
added. It sucks to have this happen before the probe() routine is
called
and we know what kind of hardware we're actually running on.
drivers/edac/Kconfig | 6 +++---
drivers/edac/mpc85xx_edac.c | 38 +++++++++++++++++++++++++++
+----------
drivers/edac/mpc85xx_edac.h | 3 +++
3 files changed, 34 insertions(+), 13 deletions(-)
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
I don't understand this at all.. The only difference between 83xx &
85xx
is that we should have an extra 4-bits for 36-bit physical addresses.
We should be able to write this code in such a way that it works for
both 83xx & 85xx.
start = (cs_bnds & 0xffff0000) >> 16;
end = (cs_bnds & 0xffff);
if (start == end)
continue;
start <<= (20 - PAGE_SHIFT);
end <<= (20 - PAGE_SHIFT);
end |= (1 << (20 - PAGE_SHIFT)) - 1;
Sorry, I don't know a thing about PAGE_SHIFT. Looking in
arch/powerpc/platforms/Kconfig.cputype, PPC_85xx doesn't seem to imply
a
change in PAGE_SIZE, which changes the PAGE_SHIFT in
arch/powerpc/include/asm/page.h.
Also, are you sure you cannot use 4K pages on an 85xx? If you can use
4K
pages on 85xx, then PAGE_SHIFT == 12, and your solution breaks.
I admit I don't know much about all of the different powerpc
platforms.
PAGE_SHIFT is the same.. I was folding in the code from below the diff:
csrow->first_page = start >> PAGE_SHIFT;
csrow->last_page = end >> PAGE_SHIFT;
into the calculation of start/end. I know PAGE_SHIFT is a minimum 12 on
any PPC based system (and at this point its always 12 on 85xx/83xx). The
idea is to ensure that when shift start/end up that it still fits in
32-bits. This is to handle the case of >4G of memory.
Hello Kumar,
I must not understand something going on here. Your proposed code
doesn't work at all on my board. The
/sys/devices/system/edac/mc/mc0/size_mb doesn't come out correctly.
The attached patch DOES work on my board, but I'm confident that it does
NOT work on a system with PAGE_SIZE != 4096. Any idea what I did wrong?
If I'm reading things correctly:
csrow->first_page full address of the first page (NOT pfn)
csrow->last_page full address of the last page (NOT pfn)
csrow->nr_pages number of pages
The EDAC subsystem does csrow->nr_pages * PAGE_SIZE to get the size_mb
sysfs value.
If csrow->first_page and csrow->last_page ARE supposed to be the pfn,
then I think the original code got it wrong, and the calculation for
csrow->nr_pages needs to be changed.
Thanks,
Ira
From a442c2e5a1cfbe29ea9d2ea7d45237677ff7899d Mon Sep 17 00:00:00 2001
From: Ira W. Snyder <redacted>
Date: Wed, 8 Jul 2009 08:59:16 -0700
Subject: [PATCH] edac: mpc85xx: add support for mpc83xx memory controller
Add support for the Freescale MPC83xx memory controller to the existing
driver for the Freescale MPC85xx memory controller. The only difference
between the two processors are in the CS_BNDS register parsing code, which
has been changed so it will work on both processors.
The L2 cache controller does not exist on the MPC83xx, but the OF subsystem
will not use the driver if the device is not present in the OF device tree.
Signed-off-by: Ira W. Snyder <redacted>
---
drivers/edac/Kconfig | 6 +++---
drivers/edac/mpc85xx_edac.c | 30 ++++++++++++++++++++----------
2 files changed, 23 insertions(+), 13 deletions(-)
From: Kumar Gala <hidden> Date: 2009-07-09 18:00:25
Hello Kumar,
I must not understand something going on here. Your proposed code
doesn't work at all on my board. The
/sys/devices/system/edac/mc/mc0/size_mb doesn't come out correctly.
What does it come out as? How much memory do you have in the system?
The attached patch DOES work on my board, but I'm confident that it
does
NOT work on a system with PAGE_SIZE != 4096. Any idea what I did
wrong?
If I'm reading things correctly:
csrow->first_page full address of the first page (NOT pfn)
csrow->last_page full address of the last page (NOT pfn)
csrow->nr_pages number of pages
The EDAC subsystem does csrow->nr_pages * PAGE_SIZE to get the size_mb
sysfs value.
If csrow->first_page and csrow->last_page ARE supposed to be the pfn,
then I think the original code got it wrong, and the calculation for
csrow->nr_pages needs to be changed.
Thanks,
Ira
[snip]
quoted hunk
/************************ MC SYSFS parts
***********************************/
From: Ira W. Snyder <hidden> Date: 2009-07-09 18:17:09
On Thu, Jul 09, 2009 at 12:58:53PM -0500, Kumar Gala wrote:
quoted
Hello Kumar,
I must not understand something going on here. Your proposed code
doesn't work at all on my board. The
/sys/devices/system/edac/mc/mc0/size_mb doesn't come out correctly.
What does it come out as? How much memory do you have in the system?
The size_mb shows as 0 with your code. See the explanation below. With
my code it shows as 256MB, as expected.
I have 256MB memory in the system.
quoted
The attached patch DOES work on my board, but I'm confident that it
does
NOT work on a system with PAGE_SIZE != 4096. Any idea what I did
wrong?
If I'm reading things correctly:
csrow->first_page full address of the first page (NOT pfn)
csrow->last_page full address of the last page (NOT pfn)
csrow->nr_pages number of pages
The EDAC subsystem does csrow->nr_pages * PAGE_SIZE to get the size_mb
sysfs value.
If csrow->first_page and csrow->last_page ARE supposed to be the pfn,
then I think the original code got it wrong, and the calculation for
csrow->nr_pages needs to be changed.
Thanks,
Ira
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
The calculation is unchanged here from the original code. Due to the
">> PAGE_SHIFT", nr_pages ends up as 1 in your version.
MY VERSION
nr_pages == 0xffff + 1 - 0 == 0x10000
0x10000 * 4096 / 1024 / 1024 == 256 MB
YOUR VERSION
nr_pages == 0x0 + 1 - 0x0 == 1
0x1 * 4096 / 1024 / 1024 == 0MB
quoted
csrow->grain = 8;
csrow->mtype = mtype;
Lets get some real values on the table for your system so I can get a
sense of what's really going on.
From: Kumar Gala <hidden> Date: 2009-07-09 18:26:28
On Jul 9, 2009, at 1:17 PM, Ira W. Snyder wrote:
On Thu, Jul 09, 2009 at 12:58:53PM -0500, Kumar Gala wrote:
quoted
quoted
Hello Kumar,
I must not understand something going on here. Your proposed code
doesn't work at all on my board. The
/sys/devices/system/edac/mc/mc0/size_mb doesn't come out correctly.
What does it come out as? How much memory do you have in the system?
The size_mb shows as 0 with your code. See the explanation below. With
my code it shows as 256MB, as expected.
I have 256MB memory in the system.
quoted
quoted
The attached patch DOES work on my board, but I'm confident that it
does
NOT work on a system with PAGE_SIZE != 4096. Any idea what I did
wrong?
If I'm reading things correctly:
csrow->first_page full address of the first page (NOT pfn)
csrow->last_page full address of the last page (NOT pfn)
csrow->nr_pages number of pages
The EDAC subsystem does csrow->nr_pages * PAGE_SIZE to get the
size_mb
sysfs value.
If csrow->first_page and csrow->last_page ARE supposed to be the
pfn,
then I think the original code got it wrong, and the calculation for
csrow->nr_pages needs to be changed.
Thanks,
Ira
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
The calculation is unchanged here from the original code. Due to the
">> PAGE_SHIFT", nr_pages ends up as 1 in your version.
MY VERSION
nr_pages == 0xffff + 1 - 0 == 0x10000
0x10000 * 4096 / 1024 / 1024 == 256 MB
YOUR VERSION
nr_pages == 0x0 + 1 - 0x0 == 1
0x1 * 4096 / 1024 / 1024 == 0MB
quoted
quoted
csrow->grain = 8;
csrow->mtype = mtype;
Lets get some real values on the table for your system so I can get a
sense of what's really going on.
From: Ira W. Snyder <hidden> Date: 2009-07-09 19:35:23
On Thu, Jul 09, 2009 at 01:25:43PM -0500, Kumar Gala wrote:
On Jul 9, 2009, at 1:17 PM, Ira W. Snyder wrote:
quoted
On Thu, Jul 09, 2009 at 12:58:53PM -0500, Kumar Gala wrote:
quoted
quoted
Hello Kumar,
I must not understand something going on here. Your proposed code
doesn't work at all on my board. The
/sys/devices/system/edac/mc/mc0/size_mb doesn't come out correctly.
What does it come out as? How much memory do you have in the system?
The size_mb shows as 0 with your code. See the explanation below. With
my code it shows as 256MB, as expected.
I have 256MB memory in the system.
quoted
quoted
The attached patch DOES work on my board, but I'm confident that it
does
NOT work on a system with PAGE_SIZE != 4096. Any idea what I did
wrong?
If I'm reading things correctly:
csrow->first_page full address of the first page (NOT pfn)
csrow->last_page full address of the last page (NOT pfn)
csrow->nr_pages number of pages
The EDAC subsystem does csrow->nr_pages * PAGE_SIZE to get the
size_mb
sysfs value.
If csrow->first_page and csrow->last_page ARE supposed to be the
pfn,
then I think the original code got it wrong, and the calculation for
csrow->nr_pages needs to be changed.
Thanks,
Ira
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
This is the same in both our versions.
start == 0x0
end == 0xF
quoted
quoted
if (start == end)
continue; /* not populated */
- csrow->first_page = start >> PAGE_SHIFT;
- csrow->last_page = end >> PAGE_SHIFT;
+ start <<= PAGE_SHIFT;
+ end <<= PAGE_SHIFT;
+ end |= (1 << PAGE_SHIFT) - 1;
+
MY VERSION
start == 0x0
end == 0xffff
first_page == 0x0
last_page == 0xffff
YOUR VERSION (<<= (20 - PAGE_SHIFT), etc.)
My math was wrong it should be ( <<= (24 - PAGE_SHIFT) )
With that I think things work out.
Yep, that works out great. This solution is much better than my original
code. The 83xx doesn't need to be special-cased anymore.
I checked the math for a 85xx with 64GB of memory. Assuming it uses 64K
pages (PAGE_SHIFT == 16), then everything works out.
I'll submit a new patch now.
Thanks for the help,
Ira
From: Kumar Gala <hidden> Date: 2009-07-09 20:17:28
On Jul 9, 2009, at 2:35 PM, Ira W. Snyder wrote:
On Thu, Jul 09, 2009 at 01:25:43PM -0500, Kumar Gala wrote:
quoted
On Jul 9, 2009, at 1:17 PM, Ira W. Snyder wrote:
quoted
On Thu, Jul 09, 2009 at 12:58:53PM -0500, Kumar Gala wrote:
quoted
quoted
Hello Kumar,
I must not understand something going on here. Your proposed code
doesn't work at all on my board. The
/sys/devices/system/edac/mc/mc0/size_mb doesn't come out
correctly.
What does it come out as? How much memory do you have in the
system?
The size_mb shows as 0 with your code. See the explanation below.
With
my code it shows as 256MB, as expected.
I have 256MB memory in the system.
quoted
quoted
The attached patch DOES work on my board, but I'm confident that
it
does
NOT work on a system with PAGE_SIZE != 4096. Any idea what I did
wrong?
If I'm reading things correctly:
csrow->first_page full address of the first page (NOT pfn)
csrow->last_page full address of the last page (NOT pfn)
csrow->nr_pages number of pages
The EDAC subsystem does csrow->nr_pages * PAGE_SIZE to get the
size_mb
sysfs value.
If csrow->first_page and csrow->last_page ARE supposed to be the
pfn,
then I think the original code got it wrong, and the calculation
for
csrow->nr_pages needs to be changed.
Thanks,
Ira
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
This is the same in both our versions.
start == 0x0
end == 0xF
quoted
quoted
if (start == end)
continue; /* not populated */
- csrow->first_page = start >> PAGE_SHIFT;
- csrow->last_page = end >> PAGE_SHIFT;
+ start <<= PAGE_SHIFT;
+ end <<= PAGE_SHIFT;
+ end |= (1 << PAGE_SHIFT) - 1;
+
MY VERSION
start == 0x0
end == 0xffff
first_page == 0x0
last_page == 0xffff
YOUR VERSION (<<= (20 - PAGE_SHIFT), etc.)
My math was wrong it should be ( <<= (24 - PAGE_SHIFT) )
With that I think things work out.
Yep, that works out great. This solution is much better than my
original
code. The 83xx doesn't need to be special-cased anymore.
I checked the math for a 85xx with 64GB of memory. Assuming it uses
64K
pages (PAGE_SHIFT == 16), then everything works out.
Does the math work for a 64GB system w/4K pages?
- k
From: Ira W. Snyder <hidden> Date: 2009-07-09 21:38:37
On Thu, Jul 09, 2009 at 03:15:29PM -0500, Kumar Gala wrote:
On Jul 9, 2009, at 2:35 PM, Ira W. Snyder wrote:
quoted
On Thu, Jul 09, 2009 at 01:25:43PM -0500, Kumar Gala wrote:
quoted
On Jul 9, 2009, at 1:17 PM, Ira W. Snyder wrote:
quoted
On Thu, Jul 09, 2009 at 12:58:53PM -0500, Kumar Gala wrote:
quoted
quoted
Hello Kumar,
I must not understand something going on here. Your proposed code
doesn't work at all on my board. The
/sys/devices/system/edac/mc/mc0/size_mb doesn't come out
correctly.
What does it come out as? How much memory do you have in the
system?
The size_mb shows as 0 with your code. See the explanation below.
With
my code it shows as 256MB, as expected.
I have 256MB memory in the system.
quoted
quoted
The attached patch DOES work on my board, but I'm confident
that it
does
NOT work on a system with PAGE_SIZE != 4096. Any idea what I did
wrong?
If I'm reading things correctly:
csrow->first_page full address of the first page (NOT pfn)
csrow->last_page full address of the last page (NOT pfn)
csrow->nr_pages number of pages
The EDAC subsystem does csrow->nr_pages * PAGE_SIZE to get the
size_mb
sysfs value.
If csrow->first_page and csrow->last_page ARE supposed to be the
pfn,
then I think the original code got it wrong, and the
calculation for
csrow->nr_pages needs to be changed.
Thanks,
Ira
[snip]
quoted
/************************ MC SYSFS parts
***********************************/
This is the same in both our versions.
start == 0x0
end == 0xF
quoted
quoted
if (start == end)
continue; /* not populated */
- csrow->first_page = start >> PAGE_SHIFT;
- csrow->last_page = end >> PAGE_SHIFT;
+ start <<= PAGE_SHIFT;
+ end <<= PAGE_SHIFT;
+ end |= (1 << PAGE_SHIFT) - 1;
+
MY VERSION
start == 0x0
end == 0xffff
first_page == 0x0
last_page == 0xffff
YOUR VERSION (<<= (20 - PAGE_SHIFT), etc.)
My math was wrong it should be ( <<= (24 - PAGE_SHIFT) )
With that I think things work out.
Yep, that works out great. This solution is much better than my
original
code. The 83xx doesn't need to be special-cased anymore.
I checked the math for a 85xx with 64GB of memory. Assuming it uses
64K
pages (PAGE_SHIFT == 16), then everything works out.
Does the math work for a 64GB system w/4K pages?
Yes, the math works there too. I just double-checked by hand. The v2
patch should work fine on both the 83xx and 85xx (both 4K and 64K
pages).
Thanks again for the help on this one.
Ira