* Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
From: Arnd Bergmann @ 2011-06-06 15:42 UTC (permalink / raw)
To: Timur Tabi
Cc: kumar.gala, linux-kernel, akpm, linux-console, greg, linuxppc-dev
In-Reply-To: <4DE8FD85.7000703@freescale.com>
On Friday 03 June 2011, Timur Tabi wrote:
> Arnd Bergmann wrote:
> >> > I don't think it's correct to think of a hypervisor as firmware, so I don't
> >> > think drivers/firmware is better.
> >> >
> >> > I'm not sure that creating virt/fsl and putting the driver in there is a good
> >> > idea, because it will be the only driver in that directory. Unlike KVM, this
> >> > driver is just a collection of front-ends to our hypervisor API. The actual
> >> > hypervisor is completely separate. That's why I put it in drivers/misc, because
> >> > it's just a single driver with a miscellaneous collection of interfaces.
>
> > Ok, fair enough. If nobody has a strong preference any other way, just make it
> > drivers/firmware then.
>
> Did you mean to say drivers/misc?
Sorry, I misread your first sentence above. I thought you said that you prefer
drivers/firmware over virt/fsl. drivers/misc is definitely the wrong
place for this, please choose a better one. Maybe drivers/virt/ ?
Arnd
^ permalink raw reply
* Re: [RFC][PATCH] powerpc: Use the #address-cells information to parsememory/reg
From: Suzuki Poulose @ 2011-06-06 11:29 UTC (permalink / raw)
To: David Laight
Cc: Sebastian Andrzej Siewior, kexec, lkml, Simon Horman,
linux ppc dev, Vivek Goyal
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6D8AD73@saturn3.aculab.com>
On 06/06/11 14:30, David Laight wrote:
>>> Changed the add_usable_mem_property() to accept FILE* fp instead of
> int fd,
>>> as most of the other users of read_memory_region_limits() deals with
> FILE*.
>>>
>>> Signed-off-by: Suzuki K. Poulose<suzuki@in.ibm.com>
>>
>> Could you please let me know your thoughts/comments about this patch ?
>
> Is the change to use 'FILE *' actually progress?
> I'd have thought that the randomly aligned read/lseek system calls
> that this allows to happen are not desirable for anything that
> isn't a true file.
I will revert the other users back to 'fd'
>
> I'd also suggest that the sizeof's should be applied to the
> actual type of the variable being read/written, not arbitrarily
> 'long' or 'int', and this probably ought to be some fixed size type.
I have used 'unsigned long'(for word sized values) or 'unsigned long long'
(for double words) just to make sure we get the right values. Is this OK ?
Thanks
Suzuki
^ permalink raw reply
* Re: [RFC][PATCH] powerpc: Use the #address-cells information to parse memory/reg
From: Suzuki Poulose @ 2011-06-06 11:02 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: kexec@lists.infradead.org, lkml, Simon Horman, linux ppc dev,
Vivek Goyal
In-Reply-To: <4DEC950E.1020105@linutronix.de>
On 06/06/11 14:21, Sebastian Andrzej Siewior wrote:
> Suzuki Poulose wrote:
>> Could you please let me know your thoughts/comments about this patch ?
>
> I'm mostly fine with it.
>
> Maaxim copied fs2dt.c from ppc64 to ppc. So I guess ppc64 has the same
> problem.
Yes, you are right. Porting this patch over to ppc64 is in my TODO list.
> ARM and MIPS is soon having DT support and kexec is probably also
> on their list so I would hate to see them to either copy the DT parsing
> file or having their own implementation.
>
> Maybe we should try to use libfdt for dt parsing. It has /proc import
> support so it should be fine for our needs. It is already in tree and used
> by ppc32 if a basic dtb is specified. I'm not sure if the /proc interface
> is part of dtc or libfdt.
>
> I'm not saying this has to be done now but maybe later before ARM and/or
> MIPS comes along needs something similar for their needs. If the libfdt is
> too complex for sucking in the dtb from /proc then maybe something else
> that generic and can be shared between booth ppc architectures and the
> other ones.
OK
>>> Index: kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.c
>>> ===================================================================
>>> --- kexec-tools-2.0.4.orig/kexec/arch/ppc/kexec-ppc.c
>>> +++ kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.c
>>> @@ -34,6 +35,92 @@ unsigned int rtas_base, rtas_size;
>>> int max_memory_ranges;
>>> const char *ramdisk;
>>>
>>> +/*
>>> + * Reads the #address-cells and #size-cells on this platform.
>>> + * This is used to parse the memory/reg info from the device-tree
>>> + */
>>> +int init_memory_region_info()
>>> +{
>>> + size_t res = 0;
>>> + FILE *fp;
>>> + char *file;
>>> +
>>> + file = "/proc/device-tree/#address-cells";
>>> + fp = fopen(file, "r");
>>> + if (!fp) {
>>> + fprintf(stderr,"Unable to open %s\n", file);
>>> + return -1;
>>> + }
>>> +
>>> + res = fread(&dt_address_cells,sizeof(unsigned long),1,fp);
>>> + if (res != 1) {
>>> + fprintf(stderr,"Error reading %s\n", file);
>>> + return -1;
>>> + }
>>> + fclose(fp);
>>> + dt_address_cells *= sizeof(unsigned long);
>
> This should be sizeof(unsigned int). I know we on 32bit.
>
OK. I was using (unsigned long) to get the word size on the machine. Given
this code is duplicated in ppc64, thought of having a generic code which works
fine for all ppcXX. As you mentioned, if we go about moving to a single copy of
fdt code, using long would help us.
>>> + file = "/proc/device-tree/#size-cells";
>>> + fp = fopen(file, "r");
>>> + if (!fp) {
>>> + fprintf(stderr,"Unable to open %s\n", file);
>>> + return -1;
>>> + }
>>> +
>>> + res = fread(&dt_size_cells,sizeof(unsigned long),1,fp);
>>> + if (res != 1) {
>>> + fprintf(stderr,"Error reading %s\n", file);
>>> + return -1;
>>> + }
>>> + fclose(fp);
>>> + dt_size_cells *= sizeof(unsigned long);
>
> same here.
Thanks
Suzuki
^ permalink raw reply
* RE: [RFC][PATCH] powerpc: Use the #address-cells information to parsememory/reg
From: David Laight @ 2011-06-06 9:00 UTC (permalink / raw)
To: Suzuki Poulose, Simon Horman
Cc: linux ppc dev, Sebastian Andrzej Siewior, kexec, lkml,
Vivek Goyal
In-Reply-To: <4DEC7F49.8060000@in.ibm.com>
> > Changed the add_usable_mem_property() to accept FILE* fp instead of
int fd,
> > as most of the other users of read_memory_region_limits() deals with
FILE*.
> >
> > Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
>=20
> Could you please let me know your thoughts/comments about this patch ?
Is the change to use 'FILE *' actually progress?
I'd have thought that the randomly aligned read/lseek system calls
that this allows to happen are not desirable for anything that
isn't a true file.
I'd also suggest that the sizeof's should be applied to the
actual type of the variable being read/written, not arbitrarily
'long' or 'int', and this probably ought to be some fixed size type.
David
^ permalink raw reply
* Re: [RFC][PATCH] powerpc: Use the #address-cells information to parse memory/reg
From: Sebastian Andrzej Siewior @ 2011-06-06 8:51 UTC (permalink / raw)
To: Suzuki Poulose
Cc: kexec@lists.infradead.org, lkml, Simon Horman, linux ppc dev,
Vivek Goyal
In-Reply-To: <4DEC7F49.8060000@in.ibm.com>
Suzuki Poulose wrote:
> Could you please let me know your thoughts/comments about this patch ?
I'm mostly fine with it.
Maaxim copied fs2dt.c from ppc64 to ppc. So I guess ppc64 has the same
problem. ARM and MIPS is soon having DT support and kexec is probably also
on their list so I would hate to see them to either copy the DT parsing
file or having their own implementation.
Maybe we should try to use libfdt for dt parsing. It has /proc import
support so it should be fine for our needs. It is already in tree and used
by ppc32 if a basic dtb is specified. I'm not sure if the /proc interface
is part of dtc or libfdt.
I'm not saying this has to be done now but maybe later before ARM and/or
MIPS comes along needs something similar for their needs. If the libfdt is
too complex for sucking in the dtb from /proc then maybe something else
that generic and can be shared between booth ppc architectures and the
other ones.
> Thanks
> Suzuki
>
>>
>> Index: kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.c
>> ===================================================================
>> --- kexec-tools-2.0.4.orig/kexec/arch/ppc/kexec-ppc.c
>> +++ kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.c
>> @@ -34,6 +35,92 @@ unsigned int rtas_base, rtas_size;
>> int max_memory_ranges;
>> const char *ramdisk;
>>
>> +/*
>> + * Reads the #address-cells and #size-cells on this platform.
>> + * This is used to parse the memory/reg info from the device-tree
>> + */
>> +int init_memory_region_info()
>> +{
>> + size_t res = 0;
>> + FILE *fp;
>> + char *file;
>> +
>> + file = "/proc/device-tree/#address-cells";
>> + fp = fopen(file, "r");
>> + if (!fp) {
>> + fprintf(stderr,"Unable to open %s\n", file);
>> + return -1;
>> + }
>> +
>> + res = fread(&dt_address_cells,sizeof(unsigned long),1,fp);
>> + if (res != 1) {
>> + fprintf(stderr,"Error reading %s\n", file);
>> + return -1;
>> + }
>> + fclose(fp);
>> + dt_address_cells *= sizeof(unsigned long);
This should be sizeof(unsigned int). I know we on 32bit.
>> + file = "/proc/device-tree/#size-cells";
>> + fp = fopen(file, "r");
>> + if (!fp) {
>> + fprintf(stderr,"Unable to open %s\n", file);
>> + return -1;
>> + }
>> +
>> + res = fread(&dt_size_cells,sizeof(unsigned long),1,fp);
>> + if (res != 1) {
>> + fprintf(stderr,"Error reading %s\n", file);
>> + return -1;
>> + }
>> + fclose(fp);
>> + dt_size_cells *= sizeof(unsigned long);
same here.
>> +
>> + return 0;
>> +}
>> +
Sebastian
^ permalink raw reply
* Re: [RFC][PATCH] powerpc: Use the #address-cells information to parse memory/reg
From: Suzuki Poulose @ 2011-06-06 7:18 UTC (permalink / raw)
To: Simon Horman
Cc: Sebastian Andrzej Siewior, kexec@lists.infradead.org, lkml,
linux ppc dev, Vivek Goyal
In-Reply-To: <4DE3396E.4090801@in.ibm.com>
On 05/30/11 12:00, Suzuki Poulose wrote:
> Use the #address-cells, #size-cells information to parse the memory/reg info
> from device tree.
>
> The format of memory/reg is based on the #address-cells,#size-cells. Currently,
> the kexec-tools doesn't use the above values in parsing the memory/reg values.
> Hence the kexec cannot handle cases where #address-cells, #size-cells are
> different, (for e.g, PPC440X ).
>
> This patch introduces a read_memory_region_limits(), which parses the
> memory/reg contents based on the values of #address-cells and #size-cells.
>
> Changed the add_usable_mem_property() to accept FILE* fp instead of int fd,
> as most of the other users of read_memory_region_limits() deals with FILE*.
>
> Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Could you please let me know your thoughts/comments about this patch ?
Thanks
Suzuki
>
> ---
> kexec/arch/ppc/crashdump-powerpc.c | 23 ------
> kexec/arch/ppc/fs2dt.c | 31 ++------
> kexec/arch/ppc/kexec-ppc.c | 136 ++++++++++++++++++++++++++-----------
> kexec/arch/ppc/kexec-ppc.h | 6 +
> 4 files changed, 118 insertions(+), 78 deletions(-)
>
> Index: kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.c
> ===================================================================
> --- kexec-tools-2.0.4.orig/kexec/arch/ppc/kexec-ppc.c
> +++ kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.c
> @@ -26,6 +26,7 @@
>
> #include "config.h"
>
> +unsigned long dt_address_cells = 0, dt_size_cells = 0;
> uint64_t rmo_top;
> unsigned long long crash_base = 0, crash_size = 0;
> unsigned long long initrd_base = 0, initrd_size = 0;
> @@ -34,6 +35,92 @@ unsigned int rtas_base, rtas_size;
> int max_memory_ranges;
> const char *ramdisk;
>
> +/*
> + * Reads the #address-cells and #size-cells on this platform.
> + * This is used to parse the memory/reg info from the device-tree
> + */
> +int init_memory_region_info()
> +{
> + size_t res = 0;
> + FILE *fp;
> + char *file;
> +
> + file = "/proc/device-tree/#address-cells";
> + fp = fopen(file, "r");
> + if (!fp) {
> + fprintf(stderr,"Unable to open %s\n", file);
> + return -1;
> + }
> +
> + res = fread(&dt_address_cells,sizeof(unsigned long),1,fp);
> + if (res != 1) {
> + fprintf(stderr,"Error reading %s\n", file);
> + return -1;
> + }
> + fclose(fp);
> + dt_address_cells *= sizeof(unsigned long);
> +
> + file = "/proc/device-tree/#size-cells";
> + fp = fopen(file, "r");
> + if (!fp) {
> + fprintf(stderr,"Unable to open %s\n", file);
> + return -1;
> + }
> +
> + res = fread(&dt_size_cells,sizeof(unsigned long),1,fp);
> + if (res != 1) {
> + fprintf(stderr,"Error reading %s\n", file);
> + return -1;
> + }
> + fclose(fp);
> + dt_size_cells *= sizeof(unsigned long);
> +
> + return 0;
> +}
> +
> +#define MAXBYTES 128
> +/*
> + * Reads the memory region info from the device-tree node pointed
> + * by @fp and fills the *start, *end with the boundaries of the region
> + */
> +int read_memory_region_limits(FILE* fp, unsigned long long *start,
> + unsigned long long *end)
> +{
> + char buf[MAXBYTES];
> + unsigned long *p;
> + unsigned long nbytes = dt_address_cells + dt_size_cells;
> +
> + if (fread(buf, 1, MAXBYTES, fp) != nbytes) {
> + fprintf(stderr, "Error reading the memory region info\n");
> + return -1;
> + }
> +
> + p = (unsigned long*)buf;
> + if (dt_address_cells == sizeof(unsigned long)) {
> + *start = p[0];
> + p++;
> + } else if (dt_address_cells == sizeof(unsigned long long)) {
> + *start = ((unsigned long long *)p)[0];
> + p = (unsigned long long *)p + 1;
> + } else {
> + fprintf(stderr,"Unsupported value for #address-cells : %ld\n",
> + dt_address_cells);
> + return -1;
> + }
> +
> + if (dt_size_cells == sizeof(unsigned long))
> + *end = *start + p[0];
> + else if (dt_size_cells == sizeof(unsigned long long))
> + *end = *start + ((unsigned long long *)p)[0];
> + else {
> + fprintf(stderr,"Unsupported value for #size-cells : %ld\n",
> + dt_size_cells);
> + return -1;
> + }
> +
> + return 0;
> +}
> +
> void arch_reuse_initrd(void)
> {
> reuse_initrd = 1;
> @@ -182,9 +269,6 @@ static int sort_base_ranges(void)
> return 0;
> }
>
> -
> -#define MAXBYTES 128
> -
> static int realloc_memory_ranges(void)
> {
> size_t memory_range_len;
> @@ -248,6 +332,8 @@ static int get_base_ranges(void)
> return -1;
> }
> while ((mentry = readdir(dmem)) != NULL) {
> + unsigned long long start, end;
> +
> if (strcmp(mentry->d_name, "reg"))
> continue;
> strcat(fname, "/reg");
> @@ -257,8 +343,7 @@ static int get_base_ranges(void)
> closedir(dir);
> return -1;
> }
> - if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
> - perror(fname);
> + if (read_memory_region_limits(file, &start, &end) != 0) {
> fclose(file);
> closedir(dmem);
> closedir(dir);
> @@ -271,24 +356,8 @@ static int get_base_ranges(void)
> }
> }
>
> - if (n == sizeof(uint32_t) * 2) {
> - base_memory_range[local_memory_ranges].start =
> - ((uint32_t *)buf)[0];
> - base_memory_range[local_memory_ranges].end =
> - base_memory_range[local_memory_ranges].start +
> - ((uint32_t *)buf)[1];
> - }
> - else if (n == sizeof(uint64_t) * 2) {
> - base_memory_range[local_memory_ranges].start =
> - ((uint64_t *)buf)[0];
> - base_memory_range[local_memory_ranges].end =
> - base_memory_range[local_memory_ranges].start +
> - ((uint64_t *)buf)[1];
> - }
> - else {
> - fprintf(stderr, "Mem node has invalid size: %d\n", n);
> - return -1;
> - }
> + base_memory_range[local_memory_ranges].start = start;
> + base_memory_range[local_memory_ranges].end = end;
> base_memory_range[local_memory_ranges].type = RANGE_RAM;
> local_memory_ranges++;
> dbgprintf("%016llx-%016llx : %x\n",
> @@ -577,20 +646,10 @@ static int get_devtree_details(unsigned
> perror(fname);
> goto error_opencdir;
> }
> - if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
> - perror(fname);
> - goto error_openfile;
> - }
> - if (n == sizeof(uint64_t)) {
> - rmo_base = ((uint32_t *)buf)[0];
> - rmo_top = rmo_base + ((uint32_t *)buf)[1];
> - } else if (n == 16) {
> - rmo_base = ((uint64_t *)buf)[0];
> - rmo_top = rmo_base + ((uint64_t *)buf)[1];
> - } else {
> - fprintf(stderr, "Mem node has invalid size: %d\n", n);
> + if (read_memory_region_limits(file, &rmo_base, &rmo_top) != 0) {
> goto error_openfile;
> }
> +
> if (rmo_top > 0x30000000UL)
> rmo_top = 0x30000000UL;
>
> @@ -664,7 +723,6 @@ error_opendir:
> return -1;
> }
>
> -
> /* Setup a sorted list of memory ranges. */
> static int setup_memory_ranges(unsigned long kexec_flags)
> {
> @@ -756,7 +814,6 @@ out:
> return -1;
> }
>
> -
> /* Return a list of valid memory ranges */
> int get_memory_ranges_dt(struct memory_range **range, int *ranges,
> unsigned long kexec_flags)
> @@ -778,6 +835,11 @@ int get_memory_ranges_dt(struct memory_r
> int get_memory_ranges(struct memory_range **range, int *ranges,
> unsigned long kexec_flags)
> {
> + int res = 0;
> +
> + res = init_memory_region_info();
> + if (res != 0)
> + return res;
> #ifdef WITH_GAMECUBE
> return get_memory_ranges_gc(range, ranges, kexec_flags);
> #else
> Index: kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.h
> ===================================================================
> --- kexec-tools-2.0.4.orig/kexec/arch/ppc/kexec-ppc.h
> +++ kexec-tools-2.0.4/kexec/arch/ppc/kexec-ppc.h
> @@ -69,6 +69,12 @@ extern unsigned long long initrd_base, i
> extern unsigned long long ramdisk_base, ramdisk_size;
> extern unsigned char reuse_initrd;
> extern const char *ramdisk;
> +
> +/* Method to parse the memory/reg nodes in device-tree */
> +extern unsigned long dt_address_cells, dt_size_cells;
> +extern int init_memory_region_info(void);
> +extern int read_memory_region_limits(FILE *fp, unsigned long long *start,
> + unsigned long long *end);
> #define COMMAND_LINE_SIZE 512 /* from kernel */
> /*fs2dt*/
> void reserve(unsigned long long where, unsigned long long length);
> Index: kexec-tools-2.0.4/kexec/arch/ppc/crashdump-powerpc.c
> ===================================================================
> --- kexec-tools-2.0.4.orig/kexec/arch/ppc/crashdump-powerpc.c
> +++ kexec-tools-2.0.4/kexec/arch/ppc/crashdump-powerpc.c
> @@ -130,9 +130,8 @@ static int get_crash_memory_ranges(struc
> closedir(dir);
> goto err;
> }
> - n = fread(buf, 1, MAXBYTES, file);
> - if (n < 0) {
> - perror(fname);
> + n = read_memory_region_limits(file, &start, &end);
> + if (n != 0) {
> fclose(file);
> closedir(dmem);
> closedir(dir);
> @@ -146,24 +145,6 @@ static int get_crash_memory_ranges(struc
> goto err;
> }
>
> - /*
> - * FIXME: This code fails on platforms that
> - * have more than one memory range specified
> - * in the device-tree's /memory/reg property.
> - * or where the #address-cells and #size-cells
> - * are not identical.
> - *
> - * We should interpret the /memory/reg property
> - * based on the values of the #address-cells and
> - * #size-cells properites.
> - */
> - if (n == (sizeof(unsigned long) * 2)) {
> - start = ((unsigned long *)buf)[0];
> - end = start + ((unsigned long *)buf)[1];
> - } else {
> - start = ((unsigned long long *)buf)[0];
> - end = start + ((unsigned long long *)buf)[1];
> - }
> if (start == 0 && end >= (BACKUP_SRC_END + 1))
> start = BACKUP_SRC_END + 1;
>
> Index: kexec-tools-2.0.4/kexec/arch/ppc/fs2dt.c
> ===================================================================
> --- kexec-tools-2.0.4.orig/kexec/arch/ppc/fs2dt.c
> +++ kexec-tools-2.0.4/kexec/arch/ppc/fs2dt.c
> @@ -122,7 +122,7 @@ static unsigned propnum(const char *name
> return offset;
> }
>
> -static void add_usable_mem_property(int fd, int len)
> +static void add_usable_mem_property(FILE* fp, int len)
> {
> char fname[MAXPATH], *bname;
> unsigned long buf[2];
> @@ -137,21 +137,11 @@ static void add_usable_mem_property(int
> if (strncmp(bname, "/memory@", 8) && strcmp(bname, "/memory"))
> return;
>
> - if (len < 2 * sizeof(unsigned long))
> - die("unrecoverable error: not enough data for mem property\n");
> - len = 2 * sizeof(unsigned long);
> -
> - if (lseek(fd, 0, SEEK_SET) < 0)
> + if (fseek(fp, 0, SEEK_SET) < 0)
> die("unrecoverable error: error seeking in \"%s\": %s\n",
> pathname, strerror(errno));
> - if (read(fd, buf, len) != len)
> - die("unrecoverable error: error reading \"%s\": %s\n",
> - pathname, strerror(errno));
> -
> - if (~0ULL - buf[0] < buf[1])
> - die("unrecoverable error: mem property overflow\n");
> - base = buf[0];
> - end = base + buf[1];
> + if (read_memory_region_limits(fp, &base, &end) != 0)
> + die("unrecoverable error: error parsing memory/reg limits\n");
>
> for (range = 0; range < usablemem_rgns.size; range++) {
> loc_base = usablemem_rgns.ranges[range].start;
> @@ -194,8 +184,9 @@ static void add_usable_mem_property(int
> static void putprops(char *fn, struct dirent **nlist, int numlist)
> {
> struct dirent *dp;
> - int i = 0, fd, len;
> + int i = 0, len;
> struct stat statbuf;
> + FILE *fp;
>
> for (i = 0; i < numlist; i++) {
> dp = nlist[i];
> @@ -243,12 +234,12 @@ static void putprops(char *fn, struct di
> *dt++ = len;
> *dt++ = propnum(fn);
>
> - fd = open(pathname, O_RDONLY);
> - if (fd == -1)
> + fp = fopen(pathname, "r");
> + if (fp == NULL)
> die("unrecoverable error: could not open \"%s\": %s\n",
> pathname, strerror(errno));
>
> - if (read(fd, dt, len) != len)
> + if (fread(dt, 1, len, fp) != len)
> die("unrecoverable error: could not read \"%s\": %s\n",
> pathname, strerror(errno));
>
> @@ -290,8 +281,8 @@ static void putprops(char *fn, struct di
>
> dt += (len + 3)/4;
> if (!strcmp(dp->d_name, "reg") && usablemem_rgns.size)
> - add_usable_mem_property(fd, len);
> - close(fd);
> + add_usable_mem_property(fp, len);
> + fclose(fp);
> }
>
> fn[0] = '\0';
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply
* Re: [PATCH] Fix build warning of the defconfigs
From: Hans-Christian Egtvedt @ 2011-06-06 6:24 UTC (permalink / raw)
To: Wanlong Gao
Cc: linux-mips, david.woodhouse, linux-sh, paulus, gxt, sam, linux,
manuel.lauss, rientjes, mingo, vapier, arnd, u.kleine-koenig,
anton, linux-arm-kernel, linux-kernel, ralf, lethal,
uclinux-dist-devel, akpm, linuxppc-dev
In-Reply-To: <1306945763-6583-1-git-send-email-wanlong.gao@gmail.com>
On Thu, 2011-06-02 at 00:29 +0800, Wanlong Gao wrote:
> RTC_CLASS is changed to bool.
> So value 'm' is invalid.
>
> Signed-off-by: Wanlong Gao <wanlong.gao@gmail.com>
<snipp>
> arch/avr32/configs/atngw100_mrmt_defconfig | 2 +-
>
For the AVR32 related changes.
Acked-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
<snipp>
--
Hans-Christian Egtvedt
^ permalink raw reply
* [PATCH][v2] powerpc/85xx: Add P1010RDB board support
From: Prabhakar Kushwaha @ 2011-06-06 4:45 UTC (permalink / raw)
To: linuxppc-dev, devicetree-discuss
Cc: meet2prabhu, Poonam Aggrwal, Prabhakar Kushwaha
P1010RDB Overview
-----------------
1Gbyte DDR3 (on board DDR)
32Mbyte 16bit NOR flash
32Mbyte SLC NAND Flash
256 Kbit M24256 I2C EEPROM
128 Mbit SPI Flash memory
I2C Board 128x8 bit memory
SD/MMC connector to interface with the SD memory card
2 SATA interface
1 internal SATA connect to 2.5. 160G SATA2 HDD
1 eSATA connector to rear panel
USB 2.0
x1 USB 2.0 port: connected via a UTMI PHY to Mini-AB interface.
x1 USB 2.0 port: directly connected to Mini-AB interface Ethernet
eTSEC1: Connected to RGMII PHY VSC8641XKO
eTSEC2: Connected to SGMII PHY VSC8221
eTSEC3: Connected to SGMII PHY VSC8221 eCAN
Two DB-9 female connectors for Field bus interface UART
DUART interface: supports two UARTs up to 115200 bps for console display
Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
Based upon http://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git (branch next)
Changes for v2:
- updated tbi-handle location
arch/powerpc/boot/dts/p1010rdb.dts | 278 +++++++++++++++++++++++
arch/powerpc/boot/dts/p1010si.dtsi | 378 ++++++++++++++++++++++++++++++++
arch/powerpc/configs/mpc85xx_defconfig | 1 +
arch/powerpc/platforms/85xx/Kconfig | 10 +
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/p1010rdb.c | 122 ++++++++++
6 files changed, 790 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/boot/dts/p1010rdb.dts
create mode 100644 arch/powerpc/boot/dts/p1010si.dtsi
create mode 100644 arch/powerpc/platforms/85xx/p1010rdb.c
diff --git a/arch/powerpc/boot/dts/p1010rdb.dts b/arch/powerpc/boot/dts/p1010rdb.dts
new file mode 100644
index 0000000..773cc16
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb.dts
@@ -0,0 +1,278 @@
+/*
+ * P1010 RDB Device Tree Source
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/include/ "p1010si.dtsi"
+
+/ {
+ model = "fsl,P1010RDB";
+ compatible = "fsl,P1010RDB";
+
+ aliases {
+ serial0 = &serial0;
+ serial1 = &serial1;
+ ethernet0 = &enet0;
+ ethernet1 = &enet1;
+ ethernet2 = &enet2;
+ pci0 = &pci0;
+ pci1 = &pci1;
+ };
+
+ memory {
+ device_type = "memory";
+ };
+
+ ifc@ffe1e000 {
+ /* NOR, NAND Flashes and CPLD on board */
+ ranges = <0x0 0x0 0x0 0xee000000 0x02000000
+ 0x1 0x0 0x0 0xff800000 0x00010000
+ 0x3 0x0 0x0 0xffb00000 0x00000020>;
+
+ nor@0,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "cfi-flash";
+ reg = <0x0 0x0 0x2000000>;
+ bank-width = <2>;
+ device-width = <1>;
+
+ partition@40000 {
+ /* 256KB for DTB Image */
+ reg = <0x00040000 0x00040000>;
+ label = "NOR DTB Image";
+ };
+
+ partition@80000 {
+ /* 7 MB for Linux Kernel Image */
+ reg = <0x00080000 0x00700000>;
+ label = "NOR Linux Kernel Image";
+ };
+
+ partition@800000 {
+ /* 20MB for JFFS2 based Root file System */
+ reg = <0x00800000 0x01400000>;
+ label = "NOR JFFS2 Root File System";
+ };
+
+ partition@1f00000 {
+ /* This location must not be altered */
+ /* 512KB for u-boot Bootloader Image */
+ /* 512KB for u-boot Environment Variables */
+ reg = <0x01f00000 0x00100000>;
+ label = "NOR U-Boot Image";
+ read-only;
+ };
+ };
+
+ nand@1,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,ifc-nand";
+ reg = <0x1 0x0 0x10000>;
+
+ partition@0 {
+ /* This location must not be altered */
+ /* 1MB for u-boot Bootloader Image */
+ reg = <0x0 0x00100000>;
+ label = "NAND U-Boot Image";
+ read-only;
+ };
+
+ partition@100000 {
+ /* 1MB for DTB Image */
+ reg = <0x00100000 0x00100000>;
+ label = "NAND DTB Image";
+ };
+
+ partition@200000 {
+ /* 4MB for Linux Kernel Image */
+ reg = <0x00200000 0x00400000>;
+ label = "NAND Linux Kernel Image";
+ };
+
+ partition@600000 {
+ /* 4MB for Compressed Root file System Image */
+ reg = <0x00600000 0x00400000>;
+ label = "NAND Compressed RFS Image";
+ };
+
+ partition@a00000 {
+ /* 15MB for JFFS2 based Root file System */
+ reg = <0x00a00000 0x00f00000>;
+ label = "NAND JFFS2 Root File System";
+ };
+
+ partition@1900000 {
+ /* 7MB for User Area */
+ reg = <0x01900000 0x00700000>;
+ label = "NAND User area";
+ };
+ };
+
+ cpld@3,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,p1010rdb-cpld";
+ reg = <0x3 0x0 0x0000020>;
+ bank-width = <1>;
+ device-width = <1>;
+ };
+ };
+
+ soc@ffe00000 {
+ spi@7000 {
+ flash@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "spansion,s25sl12801";
+ reg = <0>;
+ spi-max-frequency = <50000000>;
+
+ partition@0 {
+ /* 1MB for u-boot Bootloader Image */
+ /* 1MB for Environment */
+ reg = <0x0 0x00100000>;
+ label = "SPI Flash U-Boot Image";
+ read-only;
+ };
+
+ partition@100000 {
+ /* 512KB for DTB Image */
+ reg = <0x00100000 0x00080000>;
+ label = "SPI Flash DTB Image";
+ };
+
+ partition@180000 {
+ /* 4MB for Linux Kernel Image */
+ reg = <0x00180000 0x00400000>;
+ label = "SPI Flash Linux Kernel Image";
+ };
+
+ partition@580000 {
+ /* 4MB for Compressed RFS Image */
+ reg = <0x00580000 0x00400000>;
+ label = "SPI Flash Compressed RFSImage";
+ };
+
+ partition@980000 {
+ /* 6.5MB for JFFS2 based RFS */
+ reg = <0x00980000 0x00680000>;
+ label = "SPI Flash JFFS2 RFS";
+ };
+ };
+ };
+
+ can0@1c000 {
+ fsl,flexcan-clock-source = "platform";
+ };
+
+ can1@1d000 {
+ fsl,flexcan-clock-source = "platform";
+ };
+
+ usb@22000 {
+ phy_type = "utmi";
+ };
+
+ mdio@24000 {
+ phy0: ethernet-phy@0 {
+ interrupt-parent = <&mpic>;
+ interrupts = <3 1>;
+ reg = <0x1>;
+ };
+
+ phy1: ethernet-phy@1 {
+ interrupt-parent = <&mpic>;
+ interrupts = <2 1>;
+ reg = <0x0>;
+ };
+
+ phy2: ethernet-phy@2 {
+ interrupt-parent = <&mpic>;
+ interrupts = <2 1>;
+ reg = <0x2>;
+ };
+ };
+
+ enet0: ethernet@b0000 {
+ phy-handle = <&phy0>;
+ phy-connection-type = "rgmii-id";
+ };
+
+ enet1: ethernet@b1000 {
+ phy-handle = <&phy1>;
+ phy-connection-type = "sgmii";
+ };
+
+ enet2: ethernet@b2000 {
+ phy-handle = <&phy2>;
+ phy-connection-type = "sgmii";
+ };
+ };
+
+ pci0: pcie@ffe09000 {
+ ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
+ 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
+ pcie@0 {
+ reg = <0x0 0x0 0x0 0x0 0x0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ device_type = "pci";
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+ interrupt-map = <
+ /* IDSEL 0x0 */
+ 0000 0x0 0x0 0x1 &mpic 0x4 0x1
+ 0000 0x0 0x0 0x2 &mpic 0x5 0x1
+ 0000 0x0 0x0 0x3 &mpic 0x6 0x1
+ 0000 0x0 0x0 0x4 &mpic 0x7 0x1
+ >;
+
+ ranges = <0x2000000 0x0 0xa0000000
+ 0x2000000 0x0 0xa0000000
+ 0x0 0x20000000
+
+ 0x1000000 0x0 0x0
+ 0x1000000 0x0 0x0
+ 0x0 0x100000>;
+ };
+ };
+
+ pci1: pcie@ffe0a000 {
+ ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
+ 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
+ pcie@0 {
+ reg = <0x0 0x0 0x0 0x0 0x0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ device_type = "pci";
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+ interrupt-map = <
+ /* IDSEL 0x0 */
+ 0000 0x0 0x0 0x1 &mpic 0x4 0x1
+ 0000 0x0 0x0 0x2 &mpic 0x5 0x1
+ 0000 0x0 0x0 0x3 &mpic 0x6 0x1
+ 0000 0x0 0x0 0x4 &mpic 0x7 0x1
+ >;
+ ranges = <0x2000000 0x0 0x80000000
+ 0x2000000 0x0 0x80000000
+ 0x0 0x20000000
+
+ 0x1000000 0x0 0x0
+ 0x1000000 0x0 0x0
+ 0x0 0x100000>;
+ };
+ };
+};
diff --git a/arch/powerpc/boot/dts/p1010si.dtsi b/arch/powerpc/boot/dts/p1010si.dtsi
new file mode 100644
index 0000000..6e741ff
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010si.dtsi
@@ -0,0 +1,378 @@
+/*
+ * P1010si Device Tree Source
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+/ {
+ compatible = "fsl,P1010";
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ PowerPC,P1010@0 {
+ device_type = "cpu";
+ reg = <0x0>;
+ next-level-cache = <&L2>;
+ };
+ };
+
+ ifc@ffe1e000 {
+ #address-cells = <2>;
+ #size-cells = <1>;
+ compatible = "fsl,ifc", "simple-bus";
+ reg = <0x0 0xffe1e000 0 0x2000>;
+ interrupts = <16 2 19 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ soc@ffe00000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "soc";
+ compatible = "fsl,p1010-immr", "simple-bus";
+ ranges = <0x0 0x0 0xffe00000 0x100000>;
+ bus-frequency = <0>; // Filled out by uboot.
+
+ ecm-law@0 {
+ compatible = "fsl,ecm-law";
+ reg = <0x0 0x1000>;
+ fsl,num-laws = <12>;
+ };
+
+ ecm@1000 {
+ compatible = "fsl,p1010-ecm", "fsl,ecm";
+ reg = <0x1000 0x1000>;
+ interrupts = <16 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ memory-controller@2000 {
+ compatible = "fsl,p1010-memory-controller";
+ reg = <0x2000 0x1000>;
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+
+ i2c@3000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <0>;
+ compatible = "fsl-i2c";
+ reg = <0x3000 0x100>;
+ interrupts = <43 2>;
+ interrupt-parent = <&mpic>;
+ dfsrr;
+ };
+
+ i2c@3100 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <1>;
+ compatible = "fsl-i2c";
+ reg = <0x3100 0x100>;
+ interrupts = <43 2>;
+ interrupt-parent = <&mpic>;
+ dfsrr;
+ };
+
+ serial0: serial@4500 {
+ cell-index = <0>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <0x4500 0x100>;
+ clock-frequency = <0>;
+ interrupts = <42 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ serial1: serial@4600 {
+ cell-index = <1>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <0x4600 0x100>;
+ clock-frequency = <0>;
+ interrupts = <42 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ spi@7000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,mpc8536-espi";
+ reg = <0x7000 0x1000>;
+ interrupts = <59 0x2>;
+ interrupt-parent = <&mpic>;
+ fsl,espi-num-chipselects = <1>;
+ };
+
+ gpio: gpio-controller@f000 {
+ #gpio-cells = <2>;
+ compatible = "fsl,mpc8572-gpio";
+ reg = <0xf000 0x100>;
+ interrupts = <47 0x2>;
+ interrupt-parent = <&mpic>;
+ gpio-controller;
+ };
+
+ sata@18000 {
+ compatible = "fsl,pq-sata-v2";
+ reg = <0x18000 0x1000>;
+ cell-index = <1>;
+ interrupts = <74 0x2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ sata@19000 {
+ compatible = "fsl,pq-sata-v2";
+ reg = <0x19000 0x1000>;
+ cell-index = <2>;
+ interrupts = <41 0x2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ can0@1c000 {
+ compatible = "fsl,flexcan-v1.0";
+ reg = <0x1c000 0x1000>;
+ interrupts = <48 0x2>;
+ interrupt-parent = <&mpic>;
+ fsl,flexcan-clock-divider = <2>;
+ };
+
+ can1@1d000 {
+ compatible = "fsl,flexcan-v1.0";
+ reg = <0x1d000 0x1000>;
+ interrupts = <61 0x2>;
+ interrupt-parent = <&mpic>;
+ fsl,flexcan-clock-divider = <2>;
+ };
+
+ L2: l2-cache-controller@20000 {
+ compatible = "fsl,p1010-l2-cache-controller",
+ "fsl,p1014-l2-cache-controller";
+ reg = <0x20000 0x1000>;
+ cache-line-size = <32>; // 32 bytes
+ cache-size = <0x40000>; // L2,256K
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+
+ dma@21300 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,p1010-dma", "fsl,eloplus-dma";
+ reg = <0x21300 0x4>;
+ ranges = <0x0 0x21100 0x200>;
+ cell-index = <0>;
+ dma-channel@0 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x0 0x80>;
+ cell-index = <0>;
+ interrupt-parent = <&mpic>;
+ interrupts = <20 2>;
+ };
+ dma-channel@80 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x80 0x80>;
+ cell-index = <1>;
+ interrupt-parent = <&mpic>;
+ interrupts = <21 2>;
+ };
+ dma-channel@100 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x100 0x80>;
+ cell-index = <2>;
+ interrupt-parent = <&mpic>;
+ interrupts = <22 2>;
+ };
+ dma-channel@180 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x180 0x80>;
+ cell-index = <3>;
+ interrupt-parent = <&mpic>;
+ interrupts = <23 2>;
+ };
+ };
+
+ usb@22000 {
+ compatible = "fsl-usb2-dr";
+ reg = <0x22000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupt-parent = <&mpic>;
+ interrupts = <28 0x2>;
+ dr_mode = "host";
+ };
+
+ mdio@24000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,etsec2-mdio";
+ reg = <0x24000 0x1000 0xb0030 0x4>;
+ };
+
+ mdio@25000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,etsec2-tbi";
+ reg = <0x25000 0x1000 0xb1030 0x4>;
+ tbi0: tbi-phy@11 {
+ reg = <0x11>;
+ device_type = "tbi-phy";
+ };
+ };
+
+ mdio@26000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,etsec2-tbi";
+ reg = <0x26000 0x1000 0xb1030 0x4>;
+ tbi1: tbi-phy@11 {
+ reg = <0x11>;
+ device_type = "tbi-phy";
+ };
+ };
+
+ sdhci@2e000 {
+ compatible = "fsl,esdhc";
+ reg = <0x2e000 0x1000>;
+ interrupts = <72 0x8>;
+ interrupt-parent = <&mpic>;
+ /* Filled in by U-Boot */
+ clock-frequency = <0>;
+ fsl,sdhci-auto-cmd12;
+ };
+
+ enet0: ethernet@b0000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "fsl,etsec2";
+ fsl,num_rx_queues = <0x8>;
+ fsl,num_tx_queues = <0x8>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupt-parent = <&mpic>;
+
+ queue-group@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xb0000 0x1000>;
+ fsl,rx-bit-map = <0xff>;
+ fsl,tx-bit-map = <0xff>;
+ interrupts = <29 2 30 2 34 2>;
+ };
+
+ };
+
+ enet1: ethernet@b1000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "fsl,etsec2";
+ fsl,num_rx_queues = <0x8>;
+ fsl,num_tx_queues = <0x8>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupt-parent = <&mpic>;
+ tbi-handle = <&tbi0>;
+
+ queue-group@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xb1000 0x1000>;
+ fsl,rx-bit-map = <0xff>;
+ fsl,tx-bit-map = <0xff>;
+ interrupts = <35 2 36 2 40 2>;
+ };
+
+ };
+
+ enet2: ethernet@b2000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "fsl,etsec2";
+ fsl,num_rx_queues = <0x8>;
+ fsl,num_tx_queues = <0x8>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupt-parent = <&mpic>;
+ tbi-handle = <&tbi1>;
+
+ queue-group@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xb2000 0x1000>;
+ fsl,rx-bit-map = <0xff>;
+ fsl,tx-bit-map = <0xff>;
+ interrupts = <31 2 32 2 33 2>;
+ };
+
+ };
+
+ mpic: pic@40000 {
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ reg = <0x40000 0x40000>;
+ compatible = "chrp,open-pic";
+ device_type = "open-pic";
+ };
+
+ msi@41600 {
+ compatible = "fsl,p1010-msi", "fsl,mpic-msi";
+ reg = <0x41600 0x80>;
+ msi-available-ranges = <0 0x100>;
+ interrupts = <
+ 0xe0 0
+ 0xe1 0
+ 0xe2 0
+ 0xe3 0
+ 0xe4 0
+ 0xe5 0
+ 0xe6 0
+ 0xe7 0>;
+ interrupt-parent = <&mpic>;
+ };
+
+ global-utilities@e0000 { //global utilities block
+ compatible = "fsl,p1010-guts";
+ reg = <0xe0000 0x1000>;
+ fsl,has-rstcr;
+ };
+ };
+
+ pci0: pcie@ffe09000 {
+ compatible = "fsl,p1010-pcie", "fsl,qoriq-pcie-v2.3", "fsl,qoriq-pcie-v2.2";
+ device_type = "pci";
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <0 0xffe09000 0 0x1000>;
+ bus-range = <0 255>;
+ clock-frequency = <33333333>;
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+
+ pci1: pcie@ffe0a000 {
+ compatible = "fsl,p1010-pcie", "fsl,qoriq-pcie-v2.3", "fsl,qoriq-pcie-v2.2";
+ device_type = "pci";
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <0 0xffe0a000 0 0x1000>;
+ bus-range = <0 255>;
+ clock-frequency = <33333333>;
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+};
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 96b89df..306f4a0 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -25,6 +25,7 @@ CONFIG_MPC85xx_MDS=y
CONFIG_MPC8536_DS=y
CONFIG_MPC85xx_DS=y
CONFIG_MPC85xx_RDB=y
+CONFIG_P1010_RDB=y
CONFIG_P1022_DS=y
CONFIG_SOCRATES=y
CONFIG_KSI8560=y
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index b6976e1..07a3d29 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -67,6 +67,16 @@ config MPC85xx_RDB
help
This option enables support for the MPC85xx RDB (P2020 RDB) board
+config P1010_RDB
+ bool "Freescale P1010RDB"
+ select DEFAULT_UIMAGE
+ help
+ This option enables support for the MPC85xx RDB (P1010 RDB) board
+
+ P1010RDB contains P1010Si, which provides CPU performance up to 800
+ MHz and 1600 DMIPS, additional functionality and faster interfaces
+ (DDR3/3L, SATA II, and PCI Express).
+
config P1022_DS
bool "Freescale P1022 DS"
select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index dd70db7..07b40bf 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MPC8536_DS) += mpc8536_ds.o
obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o
obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
+obj-$(CONFIG_P1010_RDB) += p1010rdb.o
obj-$(CONFIG_P1022_DS) += p1022_ds.o
obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o
obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
new file mode 100644
index 0000000..d7387fa
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -0,0 +1,122 @@
+/*
+ * P1010RDB Board Setup
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/of_platform.h>
+
+#include <asm/system.h>
+#include <asm/time.h>
+#include <asm/machdep.h>
+#include <asm/pci-bridge.h>
+#include <mm/mmu_decl.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <asm/mpic.h>
+
+#include <sysdev/fsl_soc.h>
+#include <sysdev/fsl_pci.h>
+
+void __init p1010_rdb_pic_init(void)
+{
+ struct mpic *mpic;
+ struct resource r;
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "open-pic");
+ if (np == NULL) {
+ printk(KERN_ERR "Could not find open-pic node\n");
+ return;
+ }
+
+ if (of_address_to_resource(np, 0, &r)) {
+ printk(KERN_ERR "Failed to map mpic register space\n");
+ of_node_put(np);
+ return;
+ }
+
+ mpic = mpic_alloc(np, r.start, MPIC_PRIMARY | MPIC_WANTS_RESET |
+ MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
+ 0, 256, " OpenPIC ");
+
+ BUG_ON(mpic == NULL);
+ of_node_put(np);
+
+ mpic_init(mpic);
+
+}
+
+
+/*
+ * Setup the architecture
+ */
+static void __init p1010_rdb_setup_arch(void)
+{
+#ifdef CONFIG_PCI
+ struct device_node *np;
+#endif
+
+ if (ppc_md.progress)
+ ppc_md.progress("p1010_rdb_setup_arch()", 0);
+
+#ifdef CONFIG_PCI
+ for_each_node_by_type(np, "pci") {
+ if (of_device_is_compatible(np, "fsl,p1010-pcie"))
+ fsl_add_bridge(np, 0);
+ }
+
+#endif
+
+ printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
+}
+
+static struct of_device_id __initdata p1010rdb_ids[] = {
+ { .type = "soc", },
+ { .compatible = "soc", },
+ { .compatible = "simple-bus", },
+ {},
+};
+
+static int __init p1010rdb_publish_devices(void)
+{
+ return of_platform_bus_probe(NULL, p1010rdb_ids, NULL);
+}
+machine_device_initcall(p1010_rdb, p1010rdb_publish_devices);
+machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
+
+/*
+ * Called very early, device-tree isn't unflattened
+ */
+static int __init p1010_rdb_probe(void)
+{
+ unsigned long root = of_get_flat_dt_root();
+
+ if (of_flat_dt_is_compatible(root, "fsl,P1010RDB"))
+ return 1;
+ return 0;
+}
+
+define_machine(p1010_rdb) {
+ .name = "P1010 RDB",
+ .probe = p1010_rdb_probe,
+ .setup_arch = p1010_rdb_setup_arch,
+ .init_IRQ = p1010_rdb_pic_init,
+#ifdef CONFIG_PCI
+ .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
+#endif
+ .get_irq = mpic_get_irq,
+ .restart = fsl_rstcr_restart,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
--
1.7.3
^ permalink raw reply related
* Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout
From: Benjamin Herrenschmidt @ 2011-06-06 3:46 UTC (permalink / raw)
To: Christian Kujau; +Cc: zajec5, linux ppc dev, LKML
In-Reply-To: <alpine.DEB.2.01.1106051907190.21697@trent.utfs.org>
On Sun, 2011-06-05 at 19:11 -0700, Christian Kujau wrote:
> On Thu, 2 Jun 2011 at 17:33, Benjamin Herrenschmidt wrote:
> > It -looks- to me that something goes wrong in the tty code when a large
> > file is piped through a pty, causing the kernel to hang for minutes in
> > the workqueue / ldisk flush code. I've just sent an initial report to
> > Alan Cox about it and am currently bisecting it.
>
> This was the "tty vs workqueue oddities" thread, right? FWIW,
> 55db4c64eddf37 ("Revert "tty: make receive_buf() return the amout of bytes
> received"") seems to have fixed it on this powerpc machine as well.
Yup.
> With your "ssb: pci: Don't call PCIe specific workarounds on PCI cores"
> patch applied, powerpc32 seems to be quite happy with 3.0-rc1+
Good :-)
Cheers,
Ben.
^ permalink raw reply
* [PATCH] Fix doorbell type shift
From: Michael Neuling @ 2011-06-06 2:48 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Kumar Gala; +Cc: linuxppc-dev, Milton Miller
doorbell type is defined as bits 32:36 so should be shifted by 63-36 =
27 rather than 28.
We never noticed this bug as we've only every used type PPC_DBELL = 0.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/include/asm/dbell.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-ozlabs/arch/powerpc/include/asm/dbell.h
===================================================================
--- linux-ozlabs.orig/arch/powerpc/include/asm/dbell.h
+++ linux-ozlabs/arch/powerpc/include/asm/dbell.h
@@ -18,7 +18,7 @@
#include <asm/ppc-opcode.h>
#define PPC_DBELL_MSG_BRDCAST (0x04000000)
-#define PPC_DBELL_TYPE(x) (((x) & 0xf) << 28)
+#define PPC_DBELL_TYPE(x) (((x) & 0xf) << (63-36))
enum ppc_dbell {
PPC_DBELL = 0, /* doorbell */
PPC_DBELL_CRIT = 1, /* critical doorbell */
^ permalink raw reply
* Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout
From: Christian Kujau @ 2011-06-06 2:11 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: zajec5, linux ppc dev, LKML
In-Reply-To: <1307000008.29297.59.camel@pasglop>
On Thu, 2 Jun 2011 at 17:33, Benjamin Herrenschmidt wrote:
> It -looks- to me that something goes wrong in the tty code when a large
> file is piped through a pty, causing the kernel to hang for minutes in
> the workqueue / ldisk flush code. I've just sent an initial report to
> Alan Cox about it and am currently bisecting it.
This was the "tty vs workqueue oddities" thread, right? FWIW,
55db4c64eddf37 ("Revert "tty: make receive_buf() return the amout of bytes
received"") seems to have fixed it on this powerpc machine as well.
With your "ssb: pci: Don't call PCIe specific workarounds on PCI cores"
patch applied, powerpc32 seems to be quite happy with 3.0-rc1+
Thanks,
Christian.
--
BOFH excuse #382:
Someone was smoking in the computer room and set off the halon systems.
^ permalink raw reply
* [PATCH] powerpc/e5500: enable caam crypto driver by default
From: Kim Phillips @ 2011-06-05 22:39 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Kumar Gala
e55xx based SoCs have SEC4 h/w, so enable the SEC4 driver,
caam, and the algorithms it supports, and disable the
SEC2/3 driver, talitos.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
arch/powerpc/configs/e55xx_smp_defconfig | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/configs/e55xx_smp_defconfig b/arch/powerpc/configs/e55xx_smp_defconfig
index d322835..c92c204 100644
--- a/arch/powerpc/configs/e55xx_smp_defconfig
+++ b/arch/powerpc/configs/e55xx_smp_defconfig
@@ -100,5 +100,8 @@ CONFIG_DEBUG_INFO=y
CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_VIRQ_DEBUG=y
CONFIG_CRYPTO_PCBC=m
+CONFIG_CRYPTO_SHA256=y
+CONFIG_CRYPTO_SHA512=y
+CONFIG_CRYPTO_AES=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set
-CONFIG_CRYPTO_DEV_TALITOS=y
+CONFIG_CRYPTO_DEV_FSL_CAAM=y
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH -v2] Audit: push audit success and retcode into arch ptrace.h
From: Richard Weinberger @ 2011-06-04 22:36 UTC (permalink / raw)
To: Eric Paris
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, oleg, paulus,
hpa, sparclinux, linux-s390, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, tony.luck, linux-kernel, ralf, lethal, schwidefsky,
linux390, akpm, linuxppc-dev, davem
In-Reply-To: <20110603220451.23134.47368.stgit@paris.rdu.redhat.com>
Am Samstag 04 Juni 2011, 00:04:51 schrieb Eric Paris:
> The audit system previously expected arches calling to audit_syscall_exit
> to supply as arguments if the syscall was a success and what the return
> code was. Audit also provides a helper AUDITSC_RESULT which was supposed
> to simplify things by converting from negative retcodes to an audit
> internal magic value stating success or failure. This helper was wrong
> and could indicate that a valid pointer returned to userspace was a failed
> syscall. The fix is to fix the layering foolishness. We now pass
> audit_syscall_exit a struct pt_reg and it in turns calls back into arch
> code to collect the return value and to determine if the syscall was a
> success or failure. We also define a generic is_syscall_success() macro
> which determines success/failure based on if the value is < -MAX_ERRNO.
> This works for arches like x86 which do not use a separate mechanism to
> indicate syscall failure.
>
> In arch/sh/kernel/ptrace_64.c I see that we were using regs[9] in the old
> audit code as the return value. But the ptrace_64.h code defined the macro
> regs_return_value() as regs[3]. I have no idea which one is correct, but
> this patch now uses the regs_return_value() function, so it now uses
> regs[3].
>
> We make both the is_syscall_success() and regs_return_value() static
> inlines instead of macros. The reason is because the audit function must
> take a void* for the regs. (uml calls theirs struct uml_pt_regs instead
> of just struct pt_regs so audit_syscall_exit can't take a struct pt_regs).
> Since the audit function takes a void* we need to use static inlines to
> cast it back to the arch correct structure to dereference it.
>
> The other major change is that on some arches, like ia64, we change
> regs_return_value() to give us the negative value on syscall failure. The
> only other user of this macro, kretprobe_example.c, won't notice and it
> makes the value signed consistently for the audit functions across all
> archs.
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
> Acked-by: Acked-by: H. Peter Anvin <hpa@zytor.com> [for x86 portion]
The UML part is now fine for me. :-)
Acked-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
^ permalink raw reply
* [PATCH 7/8] arch/powerpc: use printk_ratelimited instead of printk_ratelimit
From: Christian Dietrich @ 2011-06-04 15:36 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Al Viro, Michael Ellerman,
Anton Blanchard, Kumar Gala, Alexey Kardashevskiy, Phil Carmody,
Milton Miller, Scott Wood, Meador Inge, linuxppc-dev,
linux-kernel, trivial
In-Reply-To: <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
Since printk_ratelimit() shouldn't be used anymore (see comment in
include/linux/printk.h), replace it with printk_ratelimited.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
arch/powerpc/kernel/signal_32.c | 57 +++++++++++++++++++++-----------------
arch/powerpc/kernel/signal_64.c | 17 ++++++-----
arch/powerpc/kernel/traps.c | 22 +++++++--------
arch/powerpc/mm/fault.c | 10 +++---
arch/powerpc/sysdev/mpic.c | 11 +++----
5 files changed, 60 insertions(+), 57 deletions(-)
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index b96a3a0..78b76dc 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -25,6 +25,7 @@
#include <linux/errno.h>
#include <linux/elf.h>
#include <linux/ptrace.h>
+#include <linux/ratelimit.h>
#ifdef CONFIG_PPC64
#include <linux/syscalls.h>
#include <linux/compat.h>
@@ -892,11 +893,12 @@ badframe:
printk("badframe in handle_rt_signal, regs=%p frame=%p newsp=%lx\n",
regs, frame, newsp);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in handle_rt_signal32: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- addr, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in handle_rt_signal32: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ addr, regs->nip, regs->link);
force_sigsegv(sig, current);
return 0;
@@ -1058,11 +1060,12 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
return 0;
bad:
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in sys_rt_sigreturn: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- rt_sf, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in sys_rt_sigreturn: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ rt_sf, regs->nip, regs->link);
force_sig(SIGSEGV, current);
return 0;
@@ -1149,12 +1152,12 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
* We kill the task with a SIGSEGV in this situation.
*/
if (do_setcontext(ctx, regs, 1)) {
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in "
- "sys_debug_setcontext: %p nip %08lx "
- "lr %08lx\n",
- current->comm, current->pid,
- ctx, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO "%s[%d]: bad frame in "
+ "sys_debug_setcontext: %p nip %08lx "
+ "lr %08lx\n",
+ current->comm, current->pid,
+ ctx, regs->nip, regs->link);
force_sig(SIGSEGV, current);
goto out;
@@ -1236,11 +1239,12 @@ badframe:
printk("badframe in handle_signal, regs=%p frame=%p newsp=%lx\n",
regs, frame, newsp);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in handle_signal32: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- frame, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in handle_signal32: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ frame, regs->nip, regs->link);
force_sigsegv(sig, current);
return 0;
@@ -1288,11 +1292,12 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
return 0;
badframe:
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in sys_sigreturn: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- addr, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in sys_sigreturn: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ addr, regs->nip, regs->link);
force_sig(SIGSEGV, current);
return 0;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index da989ff..e91c736 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -24,6 +24,7 @@
#include <linux/elf.h>
#include <linux/ptrace.h>
#include <linux/module.h>
+#include <linux/ratelimit.h>
#include <asm/sigcontext.h>
#include <asm/ucontext.h>
@@ -380,10 +381,10 @@ badframe:
printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n",
regs, uc, &uc->uc_mcontext);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
- current->comm, current->pid, "rt_sigreturn",
- (long)uc, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
+ current->comm, current->pid, "rt_sigreturn",
+ (long)uc, regs->nip, regs->link);
force_sig(SIGSEGV, current);
return 0;
@@ -468,10 +469,10 @@ badframe:
printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n",
regs, frame, newsp);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
- current->comm, current->pid, "setup_rt_frame",
- (long)frame, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
+ current->comm, current->pid, "setup_rt_frame",
+ (long)frame, regs->nip, regs->link);
force_sigsegv(signr, current);
return 0;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 0ff4ab9..7929aef 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -34,6 +34,7 @@
#include <linux/bug.h>
#include <linux/kdebug.h>
#include <linux/debugfs.h>
+#include <linux/ratelimit.h>
#include <asm/emulated_ops.h>
#include <asm/pgtable.h>
@@ -197,12 +198,11 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
if (die("Exception in kernel mode", regs, signr))
return;
} else if (show_unhandled_signals &&
- unhandled_signal(current, signr) &&
- printk_ratelimit()) {
- printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
- current->comm, current->pid, signr,
- addr, regs->nip, regs->link, code);
- }
+ unhandled_signal(current, signr)) {
+ printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
+ current->comm, current->pid, signr,
+ addr, regs->nip, regs->link, code);
+ }
memset(&info, 0, sizeof(info));
info.si_signo = signr;
@@ -1342,9 +1342,8 @@ void altivec_assist_exception(struct pt_regs *regs)
} else {
/* didn't recognize the instruction */
/* XXX quick hack for now: set the non-Java bit in the VSCR */
- if (printk_ratelimit())
- printk(KERN_ERR "Unrecognized altivec instruction "
- "in %s at %lx\n", current->comm, regs->nip);
+ printk_ratelimited(KERN_ERR "Unrecognized altivec instruction "
+ "in %s at %lx\n", current->comm, regs->nip);
current->thread.vscr.u[3] |= 0x10000;
}
}
@@ -1548,9 +1547,8 @@ u32 ppc_warn_emulated;
void ppc_warn_emulated_print(const char *type)
{
- if (printk_ratelimit())
- pr_warning("%s used emulated %s instruction\n", current->comm,
- type);
+ pr_warn_ratelimited("%s used emulated %s instruction\n", current->comm,
+ type);
}
static int __init ppc_warn_emulated_init(void)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 54f4fb9..ad35f66 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -31,6 +31,7 @@
#include <linux/kdebug.h>
#include <linux/perf_event.h>
#include <linux/magic.h>
+#include <linux/ratelimit.h>
#include <asm/firmware.h>
#include <asm/page.h>
@@ -346,11 +347,10 @@ bad_area_nosemaphore:
return 0;
}
- if (is_exec && (error_code & DSISR_PROTFAULT)
- && printk_ratelimit())
- printk(KERN_CRIT "kernel tried to execute NX-protected"
- " page (%lx) - exploit attempt? (uid: %d)\n",
- address, current_uid());
+ if (is_exec && (error_code & DSISR_PROTFAULT))
+ printk_ratelimited(KERN_CRIT "kernel tried to execute NX-protected"
+ " page (%lx) - exploit attempt? (uid: %d)\n",
+ address, current_uid());
return SIGSEGV;
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 3a8de5b..58d7a53 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -29,6 +29,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/syscore_ops.h>
+#include <linux/ratelimit.h>
#include <asm/ptrace.h>
#include <asm/signal.h>
@@ -1648,9 +1649,8 @@ static unsigned int _mpic_get_one_irq(struct mpic *mpic, int reg)
return NO_IRQ;
}
if (unlikely(mpic->protected && test_bit(src, mpic->protected))) {
- if (printk_ratelimit())
- printk(KERN_WARNING "%s: Got protected source %d !\n",
- mpic->name, (int)src);
+ printk_ratelimited(KERN_WARNING "%s: Got protected source %d !\n",
+ mpic->name, (int)src);
mpic_eoi(mpic);
return NO_IRQ;
}
@@ -1688,9 +1688,8 @@ unsigned int mpic_get_coreint_irq(void)
return NO_IRQ;
}
if (unlikely(mpic->protected && test_bit(src, mpic->protected))) {
- if (printk_ratelimit())
- printk(KERN_WARNING "%s: Got protected source %d !\n",
- mpic->name, (int)src);
+ printk_ratelimited(KERN_WARNING "%s: Got protected source %d !\n",
+ mpic->name, (int)src);
return NO_IRQ;
}
--
1.7.1
^ permalink raw reply related
* [PATCH 1/8] powerpc/rtas-rtc: remove sideeffects of printk_ratelimit
From: Christian Dietrich @ 2011-06-04 15:35 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
linux-kernel, trivial
In-Reply-To: <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
Don't use printk_ratelimit() as an additional condition for returning
on an error. Because when the ratelimit is reached, printk_ratelimit
will return 0 and e.g. in rtas_get_boot_time won't check for an error
condition.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
arch/powerpc/kernel/rtas-rtc.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/kernel/rtas-rtc.c b/arch/powerpc/kernel/rtas-rtc.c
index 77578c0..c57c193 100644
--- a/arch/powerpc/kernel/rtas-rtc.c
+++ b/arch/powerpc/kernel/rtas-rtc.c
@@ -4,6 +4,7 @@
#include <linux/init.h>
#include <linux/rtc.h>
#include <linux/delay.h>
+#include <linux/ratelimit.h>
#include <asm/prom.h>
#include <asm/rtas.h>
#include <asm/time.h>
@@ -29,9 +30,10 @@ unsigned long __init rtas_get_boot_time(void)
}
} while (wait_time && (get_tb() < max_wait_tb));
- if (error != 0 && printk_ratelimit()) {
- printk(KERN_WARNING "error: reading the clock failed (%d)\n",
- error);
+ if (error != 0) {
+ printk_ratelimited(KERN_WARNING
+ "error: reading the clock failed (%d)\n",
+ error);
return 0;
}
@@ -55,19 +57,21 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm)
wait_time = rtas_busy_delay_time(error);
if (wait_time) {
- if (in_interrupt() && printk_ratelimit()) {
+ if (in_interrupt()) {
memset(rtc_tm, 0, sizeof(struct rtc_time));
- printk(KERN_WARNING "error: reading clock"
- " would delay interrupt\n");
+ printk_ratelimited(KERN_WARNING
+ "error: reading clock "
+ "would delay interrupt\n");
return; /* delay not allowed */
}
msleep(wait_time);
}
} while (wait_time && (get_tb() < max_wait_tb));
- if (error != 0 && printk_ratelimit()) {
- printk(KERN_WARNING "error: reading the clock failed (%d)\n",
- error);
+ if (error != 0) {
+ printk_ratelimited(KERN_WARNING
+ "error: reading the clock failed (%d)\n",
+ error);
return;
}
@@ -99,9 +103,10 @@ int rtas_set_rtc_time(struct rtc_time *tm)
}
} while (wait_time && (get_tb() < max_wait_tb));
- if (error != 0 && printk_ratelimit())
- printk(KERN_WARNING "error: setting the clock failed (%d)\n",
- error);
+ if (error != 0)
+ printk_ratelimited(KERN_WARNING
+ "error: setting the clock failed (%d)\n",
+ error);
return 0;
}
--
1.7.1
^ permalink raw reply related
* [PATCH 0/8] Use printk_ratelimited instead of printk_ratelimit
From: Christian Dietrich @ 2011-06-04 15:35 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras,
Venkatesh Pallipadi (Venki), Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Avi Kivity, Marcelo Tosatti, Rusty Russell,
David Airlie, Neil Brown, Doug Gilbert, James E.J. Bottomley,
Greg Kroah-Hartman, Al Viro, Michael Ellerman, Anton Blanchard,
Kumar Gala, Alexey Kardashevskiy, Milton Miller, Scott Wood,
Meador Inge, Kevin Tian, Fengzhe Zhang, John Stultz,
Lucas De Marchi, David S. Miller, Grant Likely,
MichaÅ MirosÅaw, Richard Cochran,
linuxppc-dev, linux-kernel, kvm, lguest, dri-devel, linux-raid,
linux-scsi, devel, trivial
Hi,
since printk_ratelimit() shouldn't be used anymore, I replaced it at several
points, where it was possible with printk_ratelimited(FMT,...). This shouldn't
change the behaviour in most cases, except that the printk will use an local
ratelimit instead of an global one shared with all other printk_ratelimit
calls.
I just must made patches for a few places where it is used. If you think that
it is worth converting all printk_ratelimits, i will send more patches. The
changes where done against v3.0-rc1-106-g4f1ba49.
greetz chris
Christian Dietrich (8):
powerpc/rtas-rtc: remove sideeffects of printk_ratelimit
drivers/octeon: use printk_ratelimited instead of printk_ratelimit
scsi/sg: use printk_ratelimited instead of printk_ratelimit
md/raid: use printk_ratelimited instead of printk_ratelimit
drivers/char/rtc: use printk_ratelimited instead of printk_ratelimit
drivers/gpu/drm: use printk_ratelimited instead of printk_ratelimit
arch/powerpc: use printk_ratelimited instead of printk_ratelimit
arch/x86: use printk_ratelimited instead of printk_ratelimit
arch/powerpc/kernel/rtas-rtc.c | 29 +++++++++------
arch/powerpc/kernel/signal_32.c | 57 +++++++++++++++++--------------
arch/powerpc/kernel/signal_64.c | 17 +++++----
arch/powerpc/kernel/traps.c | 22 +++++------
arch/powerpc/mm/fault.c | 10 +++---
arch/powerpc/sysdev/mpic.c | 11 +++---
arch/x86/kernel/hpet.c | 6 ++--
arch/x86/kernel/irq.c | 9 ++---
arch/x86/kvm/i8259.c | 7 ++--
arch/x86/lguest/boot.c | 6 ++--
drivers/char/rtc.c | 7 ++--
drivers/gpu/drm/drm_ioc32.c | 9 +++--
drivers/md/raid1.c | 22 ++++++-----
drivers/md/raid10.c | 22 ++++++-----
drivers/md/raid5.c | 39 ++++++++++-----------
drivers/scsi/sg.c | 18 +++++----
drivers/staging/octeon/ethernet-mdio.c | 27 +++++++-------
drivers/staging/octeon/ethernet-rgmii.c | 33 +++++++++---------
drivers/staging/octeon/ethernet-rx.c | 24 +++++++------
drivers/staging/octeon/ethernet-sgmii.c | 14 ++++---
drivers/staging/octeon/ethernet-tx.c | 11 +++---
drivers/staging/octeon/ethernet-util.h | 4 --
drivers/staging/octeon/ethernet-xaui.c | 22 ++++++-----
23 files changed, 221 insertions(+), 205 deletions(-)
^ permalink raw reply
* debugging kernel oops
From: ps2k @ 2011-06-04 11:13 UTC (permalink / raw)
To: linuxppc-dev
Hi All,
I'm new to linux development. We are often seeing kernel oops and failure to
handle paging requests. Any idea how to debug these issues. We have a NAND
flash. I don't know how paging works on an embedded device with flash
memories and not sure why is it needed.
Any help would be greatly appreciated.
Thanks
psk
Jun 1 23:30:01 sbc kernel: [53181.318784] Call Trace:
Jun 1 23:30:01 sbc kernel: [53181.318793] [caab5c50] [c0008114]
show_stack+0x4c/0x1ac (unreliable)
Jun 1 23:30:01 sbc kernel: [53181.318828] [caab5c90] [c0045b4c]
__schedule_bug+0x64/0x78
Jun 1 23:30:01 sbc kernel: [53181.318852] [caab5ca0] [c027d774]
schedule+0x320/0x340
Jun 1 23:30:01 sbc kernel: [53181.318870] [caab5ce0] [c0045d94]
__cond_resched+0x24/0x50
Jun 1 23:30:01 sbc kernel: [53181.318888] [caab5cf0] [c027dd90]
cond_resched+0x50/0x58
Jun 1 23:30:01 sbc kernel: [53181.318906] [caab5d00] [c007bb50]
generic_file_buffered_write+0x1ac/0x67c
Jun 1 23:30:01 sbc kernel: [53181.318934] [caab5d90] [c007c2a8]
__generic_file_aio_write_nolock+0x288/0x50c
Jun 1 23:30:01 sbc kernel: [53181.318954] [caab5e00] [c007c594]
generic_file_aio_write+0x68/0xf8
Jun 1 23:30:01 sbc kernel: [53181.318974] [caab5e30] [c00a0c14]
do_sync_write+0xc4/0x138
Jun 1 23:30:01 sbc kernel: [53181.319000] [caab5ef0] [c00a15bc]
vfs_write+0xb4/0x108
Jun 1 23:30:01 sbc kernel: [53181.319018] [caab5f10] [c00a1ba8]
sys_write+0x4c/0x90
Jun 1 23:30:01 sbc kernel: [53181.319036] [caab5f40] [c00101b8]
ret_from_syscall+0x0/0x38
Jun 1 23:30:01 sbc kernel: [53181.319062] --- Exception: c01 at 0xfe506c4
Jun 1 23:30:01 sbc kernel: [53181.319076] LR = 0x10072040
Jun 1 23:30:01 sbc kernel: [53181.375060] Page fault in user mode
within_atomic() = 1 mm = d4cee5a0
Jun 1 23:30:01 sbc kernel: [53181.375091] NIP = fe51434 MSR = 2000f932
Jun 1 23:30:01 sbc kernel: [53181.375105] Oops: Weird page fault, sig: 11
[#1]
Jun 1 23:30:01 sbc kernel: [53181.375113] PREEMPT MPC836x RDK
Jun 1 23:30:01 sbc kernel: [53181.375123] Modules linked in:
Jun 1 23:30:01 sbc kernel: [53181.375134] NIP: 0fe51434 LR: 1006ce70 CTR:
0fe51434
Jun 1 23:30:01 sbc kernel: [53181.375148] REGS: caab5f50 TRAP: 0401 Not
tainted (2.6.24-sbc-2.0.2.7131)
Jun 1 23:30:01 sbc kernel: [53181.375159] MSR: 2000f932 <EE,PR,FP,ME,IR,DR>
CR: 48000442 XER: 00000000
Jun 1 23:30:01 sbc kernel: [53181.375188] TASK = d4cf0430[8646] 'cp'
THREAD: caab4000
Jun 1 23:30:01 sbc kernel: [53181.375246] NIP [0fe51434] 0xfe51434
Jun 1 23:30:01 sbc kernel: [53181.375260] LR [1006ce70] 0x1006ce70
Jun 1 23:30:01 sbc kernel: [53181.375271] Call Trace:
Jun 1 23:30:01 sbc kernel: [53181.375354] Call Trace:
Jun 1 23:30:01 sbc kernel: [53181.375362] [caab5c10] [c0008114]
show_stack+0x4c/0x1ac (unreliable)
Jun 1 23:30:01 sbc kernel: [53181.375394] [caab5c50] [c0045b4c]
__schedule_bug+0x64/0x78
Jun 1 23:30:01 sbc kernel: [53181.375417] [caab5c60] [c027d774]
schedule+0x320/0x340
Jun 1 23:30:01 sbc kernel: [53181.375435] [caab5ca0] [c0045d94]
__cond_resched+0x24/0x50
Jun 1 23:30:01 sbc kernel: [53181.375453] [caab5cb0] [c027dd90]
cond_resched+0x50/0x58
Jun 1 23:30:01 sbc kernel: [53181.375471] [caab5cc0] [c008a7d8]
unmap_vmas+0x5c4/0x5f4
Jun 1 23:30:01 sbc kernel: [53181.375493] [caab5d40] [c008e574]
exit_mmap+0x74/0x11c
Jun 1 23:30:01 sbc kernel: [53181.375513] [caab5d70] [c0048914]
mmput+0x50/0x108
Jun 1 23:30:01 sbc kernel: [53181.375532] [caab5d80] [c004d034]
exit_mm+0xa8/0x110
Jun 1 23:30:01 sbc kernel: [53181.375553] [caab5da0] [c004ecb8]
do_exit+0x13c/0x7bc
Jun 1 23:30:01 sbc kernel: [53181.375571] [caab5de0] [c000e160]
kernel_bad_stack+0x0/0x4c
Jun 1 23:30:01 sbc kernel: [53181.375593] [caab5e10] [c0013120]
do_page_fault+0xb8/0x4e4
Jun 1 23:30:01 sbc kernel: [53181.375611] [caab5f40] [c00105e8]
handle_page_fault+0xc/0x80
Jun 1 23:30:01 sbc kernel: [53181.375632] --- Exception: 401 at 0xfe51434
Jun 1 23:30:01 sbc kernel: [53181.375645] LR = 0x1006ce70
Jun 2 01:30:01 sbc kernel: [ 6381.530572] Unable to handle kernel paging
request for data at address 0xe1054000
Jun 2 01:30:01 sbc kernel: [ 6381.531024] Faulting instruction address:
0xc0149954
Jun 2 01:30:01 sbc kernel: [ 6381.531303] Oops: Kernel access of bad area,
sig: 11 [#1]
Jun 2 01:30:01 sbc kernel: [ 6381.531320] PREEMPT MPC836x RDK
Jun 2 01:30:01 sbc kernel: [ 6381.531329] Modules linked in:
Jun 2 01:30:01 sbc kernel: [ 6381.531340] NIP: c0149954 LR: c014990c CTR:
00000018
Jun 2 01:30:01 sbc kernel: [ 6381.531354] REGS: d21cdb10 TRAP: 0300 Not
tainted (2.6.24-sbc-2.0.2.7131)
Jun 2 01:30:01 sbc kernel: [ 6381.531365] MSR: 00009032 <EE,ME,IR,DR> CR:
48044448 XER: 20000000
Jun 2 01:30:01 sbc kernel: [ 6381.531388] DAR: e1054000, DSISR: 20000000
Jun 2 01:30:01 sbc kernel: [ 6381.531398] TASK = d8610450[1994] 'cp'
THREAD: d21cc000
Jun 2 01:30:01 sbc kernel: [ 6381.531507] NIP [c0149954]
deflate_fast+0x144/0x34c
Jun 2 01:30:01 sbc kernel: [ 6381.531534] LR [c014990c]
deflate_fast+0xfc/0x34c
Jun 2 01:30:01 sbc kernel: [ 6381.531548] Call Trace:
Jun 2 01:30:01 sbc kernel: [ 6381.531556] [d21cdbc0] [c0149ab8]
deflate_fast+0x2a8/0x34c (unreliable)
Jun 2 01:30:01 sbc kernel: [ 6381.531576] [d21cdbe0] [c0149e38]
zlib_deflate+0x110/0x334
Jun 2 01:30:01 sbc kernel: [ 6381.531593] [d21cdc00] [c012567c]
jffs2_zlib_compress+0xf8/0x1c4
Jun 2 01:30:01 sbc kernel: [ 6381.531620] [d21cdc30] [c0114ba4]
jffs2_compress+0xdc/0x1f0
Jun 2 01:30:01 sbc kernel: [ 6381.531637] [d21cdc60] [c011bfd0]
jffs2_write_inode_range+0xb0/0x34c
Jun 2 01:30:01 sbc kernel: [ 6381.531655] [d21cdcc0] [c0116580]
jffs2_write_end+0xd8/0x23c
Jun 2 01:30:01 sbc kernel: [ 6381.531672] [d21cdd00] [c007bb40]
generic_file_buffered_write+0x19c/0x67c
Jun 2 01:30:01 sbc kernel: [ 6381.531699] [d21cdd90] [c007c2a8]
__generic_file_aio_write_nolock+0x288/0x50c
Jun 2 01:30:01 sbc kernel: [ 6381.531719] [d21cde00] [c007c594]
generic_file_aio_write+0x68/0xf8
Jun 2 01:30:01 sbc kernel: [ 6381.531738] [d21cde30] [c00a0c14]
do_sync_write+0xc4/0x138
Jun 2 01:30:01 sbc kernel: [ 6381.531762] [d21cdef0] [c00a15bc]
vfs_write+0xb4/0x108
Jun 2 01:30:01 sbc kernel: [ 6381.531779] [d21cdf10] [c00a1ba8]
sys_write+0x4c/0x90
Jun 2 01:30:01 sbc kernel: [ 6381.531795] [d21cdf40] [c00101b8]
ret_from_syscall+0x0/0x38
Jun 2 01:30:01 sbc kernel: [ 6381.531820] --- Exception: c01 at 0xfe506c4
Jun 2 01:30:01 sbc kernel: [ 6381.531833] LR = 0x10072040
Jun 2 01:30:01 sbc kernel: [ 6381.531841] Instruction dump:
Jun 2 01:30:01 sbc kernel: [ 6381.531850] 419d0148 2b890002 409d0140
380bffff 901f0058 813f0064 817f0030 39090001
Jun 2 01:30:01 sbc kernel: [ 6381.531874] 815f0050 911f0064 7d685a14
813f0040 <880b0002> 7d295030 817f004c 7c004a78
--
View this message in context: http://old.nabble.com/debugging-kernel-oops-tp31771757p31771757.html
Sent from the linuxppc-dev mailing list archive at Nabble.com.
^ permalink raw reply
* [PATCH 1/2] ppc/85xx: create a platform node for PCI EDAC device
From: Dmitry Eremin-Solenikov @ 2011-06-04 10:42 UTC (permalink / raw)
To: bluesmoke-devel, linuxppc-dev, Benjamin Herrenschmidt,
Paul Mackerras
In-Reply-To: <20110602124823.3b814b3f@schlenkerla.am.freescale.net>
As a device for pci node isn't created, create a special platform_device
for PCI EDAC device on MPC85xx.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
arch/powerpc/sysdev/fsl_pci.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 68ca929..2498229 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -381,6 +381,34 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
return 0;
}
+static int __init fsl_add_pci_err(void)
+{
+ struct device_node *np;
+
+ /* Only PCI, not PCI Express! */
+ for_each_compatible_node(np, "pci", "fsl,mpc8540-pci") {
+ struct resource r[2] = {};
+
+ if (of_address_to_resource(np, 0, &r[0])) {
+ printk(KERN_WARNING
+ "Can't get register base for PCI EDAC!\n");
+ continue;
+ }
+ r[0].start += 0xe00;
+
+ if (of_irq_to_resource(np, 0, &r[1]) == NO_IRQ) {
+ printk(KERN_WARNING
+ "Can't get irq for PCI EDAC!\n");
+ continue;
+ }
+ platform_device_register_simple("mpc85xx_pci_err", -1,
+ r, ARRAY_SIZE(r));
+ }
+
+ return 0;
+}
+device_initcall(fsl_add_pci_err);
+
DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8548E, quirk_fsl_pcie_header);
DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8548, quirk_fsl_pcie_header);
DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8543E, quirk_fsl_pcie_header);
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH] Add cpufreq driver for Momentum Maple boards
From: Dmitry Eremin-Solenikov @ 2011-06-04 10:39 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Dave Jones, Paul Mackerras, linuxppc-dev, cpufreq
In-Reply-To: <1307183381.23876.27.camel@pasglop>
On 6/4/11, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Sat, 2011-06-04 at 13:00 +0400, Dmitry Eremin-Solenikov wrote:
>> On 5/30/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
>> > Hello,
>> >
>> > On 5/21/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
>> >> Add simple cpufreq driver for Maple-based boards (ppc970fx evaluation
>> >> kit and others). Driver is based on a cpufreq driver for 64-bit
>> >> powermac
>> >> boxes with all pmac-dependant features removed and simple cleanup
>> >> applied.
>> >>
>> >> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>> >> ---
>> >> arch/powerpc/kernel/misc_64.S | 4 +-
>> >> arch/powerpc/platforms/Kconfig | 8 +
>> >> arch/powerpc/platforms/maple/Makefile | 1 +
>> >> arch/powerpc/platforms/maple/cpufreq.c | 317
>> >> ++++++++++++++++++++++++++++++++
>> >> 4 files changed, 328 insertions(+), 2 deletions(-)
>> >> create mode 100644 arch/powerpc/platforms/maple/cpufreq.c
>> >
>> > What about this patch?
>>
>> Pinging again. Any problems/comments/objections to this patch?
>
> Well, obviously nobody had time to review it yet....
I'm just a bit impatient. It has been already two weeks...
--
With best wishes
Dmitry
^ permalink raw reply
* Re: [PATCH] Add cpufreq driver for Momentum Maple boards
From: Benjamin Herrenschmidt @ 2011-06-04 10:29 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: Dave Jones, Paul Mackerras, linuxppc-dev, cpufreq
In-Reply-To: <BANLkTik6Ln1JGmN7isQ1tWPAf0upzHMvkg@mail.gmail.com>
On Sat, 2011-06-04 at 13:00 +0400, Dmitry Eremin-Solenikov wrote:
> On 5/30/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
> > Hello,
> >
> > On 5/21/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
> >> Add simple cpufreq driver for Maple-based boards (ppc970fx evaluation
> >> kit and others). Driver is based on a cpufreq driver for 64-bit powermac
> >> boxes with all pmac-dependant features removed and simple cleanup
> >> applied.
> >>
> >> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> >> ---
> >> arch/powerpc/kernel/misc_64.S | 4 +-
> >> arch/powerpc/platforms/Kconfig | 8 +
> >> arch/powerpc/platforms/maple/Makefile | 1 +
> >> arch/powerpc/platforms/maple/cpufreq.c | 317
> >> ++++++++++++++++++++++++++++++++
> >> 4 files changed, 328 insertions(+), 2 deletions(-)
> >> create mode 100644 arch/powerpc/platforms/maple/cpufreq.c
> >
> > What about this patch?
>
> Pinging again. Any problems/comments/objections to this patch?
Well, obviously nobody had time to review it yet....
Cheers,
Ben.
^ permalink raw reply
* Re: PROBLEM: 2.6.39 doesn’t boot on POWER MAC
From: Andrey Gusev @ 2011-06-04 9:02 UTC (permalink / raw)
To: Giuliano Pochini; +Cc: linuxppc-dev, paulus, stable
In-Reply-To: <20110604003602.13bc1a55@Jay>
04.06.2011 02:36, Giuliano Pochini пишет:
> On Fri, 03 Jun 2011 13:10:45 +1000
> Benjamin Herrenschmidt<benh@kernel.crashing.org> wrote:
>
>> On Fri, 2011-06-03 at 12:41 +1000, Benjamin Herrenschmidt wrote:
>>> On Fri, 2011-06-03 at 00:00 +0200, Giuliano Pochini wrote:
>>>> On Sat, 28 May 2011 11:55:14 +0400
>>>> Andrey Gusev<ronne@list.ru> wrote:
>>>>
>>>>> Hi!
>>>>> A kernel 2.6.39 doesn't boot on my POWER MAC G4.
>>>> Same problem with my dual-G4 MDD. A few more infos:
>>>> The machine hangs just after the message "Returning from prom_init" (still
>>>> in the OF screen).
>>>> The kernel works fine with the option maxcpus=1, but it locks up as soon as
>>>> I try to enable the second CPU with echo 1> /sys.../online.
>>> I just verified that current upstream 3.0-rc1+ does boot fine.
>> The fix is:
>>
>> c560bbceaf6b06e52f1ef20131b76a3fdc0a2c19
>> powerpc/4xx: Fix regression in SMP on 476
>> [...]
> Yes, that patch fixed the problem. Thanks.
>
>
The upstream 3.0-rc1 boots on my machine fine too.
^ permalink raw reply
* Re: [PATCH] Add cpufreq driver for Momentum Maple boards
From: Dmitry Eremin-Solenikov @ 2011-06-04 9:00 UTC (permalink / raw)
To: cpufreq; +Cc: Dave Jones, Paul Mackerras, linuxppc-dev
In-Reply-To: <BANLkTikGyV8aG1twBt7Jt_=j-fSBDiGzAg@mail.gmail.com>
On 5/30/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
> Hello,
>
> On 5/21/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
>> Add simple cpufreq driver for Maple-based boards (ppc970fx evaluation
>> kit and others). Driver is based on a cpufreq driver for 64-bit powermac
>> boxes with all pmac-dependant features removed and simple cleanup
>> applied.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>> ---
>> arch/powerpc/kernel/misc_64.S | 4 +-
>> arch/powerpc/platforms/Kconfig | 8 +
>> arch/powerpc/platforms/maple/Makefile | 1 +
>> arch/powerpc/platforms/maple/cpufreq.c | 317
>> ++++++++++++++++++++++++++++++++
>> 4 files changed, 328 insertions(+), 2 deletions(-)
>> create mode 100644 arch/powerpc/platforms/maple/cpufreq.c
>
> What about this patch?
Pinging again. Any problems/comments/objections to this patch?
--
With best wishes
Dmitry
^ permalink raw reply
* Re: [PATCH -v2] Audit: push audit success and retcode into arch ptrace.h
From: Tony Luck @ 2011-06-03 22:52 UTC (permalink / raw)
To: Eric Paris
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, oleg, paulus,
hpa, sparclinux, linux-s390, richard, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, linux-kernel, ralf, lethal, schwidefsky, linux390, akpm,
linuxppc-dev, davem
In-Reply-To: <20110603220451.23134.47368.stgit@paris.rdu.redhat.com>
On Fri, Jun 3, 2011 at 3:04 PM, Eric Paris <eparis@redhat.com> wrote:
> The other major change is that on some arches, like ia64, we change
> regs_return_value() to give us the negative value on syscall failure. =A0=
The
> only other user of this macro, kretprobe_example.c, won't notice and it m=
akes
> the value signed consistently for the audit functions across all archs.
v2 builds and boots on ia64 now
Acked-by: Tony Luck <tony.luck@intel.com>
> Signed-off-by: Eric Paris <eparis@redhat.com>
> Acked-by: Acked-by: H. Peter Anvin <hpa@zytor.com> [for x86 portion]
^^^^^^^^^^^^^^^^^^^^ :-)
-Tony
^ permalink raw reply
* Re: PROBLEM: 2.6.39 doesn’t boot on POWER MAC
From: Giuliano Pochini @ 2011-06-03 22:36 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Andrey Gusev, paulus, stable
In-Reply-To: <1307070645.23876.9.camel@pasglop>
On Fri, 03 Jun 2011 13:10:45 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Fri, 2011-06-03 at 12:41 +1000, Benjamin Herrenschmidt wrote:
> > On Fri, 2011-06-03 at 00:00 +0200, Giuliano Pochini wrote:
> > > On Sat, 28 May 2011 11:55:14 +0400
> > > Andrey Gusev <ronne@list.ru> wrote:
> > >
> > > > Hi!
> > > > A kernel 2.6.39 doesn't boot on my POWER MAC G4.
> > >
> > > Same problem with my dual-G4 MDD. A few more infos:
> > > The machine hangs just after the message "Returning from prom_init" (still
> > > in the OF screen).
> > > The kernel works fine with the option maxcpus=1, but it locks up as soon as
> > > I try to enable the second CPU with echo 1 > /sys.../online.
> >
> > I just verified that current upstream 3.0-rc1+ does boot fine.
>
> The fix is:
>
> c560bbceaf6b06e52f1ef20131b76a3fdc0a2c19
> powerpc/4xx: Fix regression in SMP on 476
> [...]
Yes, that patch fixed the problem. Thanks.
--
Giuliano.
^ permalink raw reply
* [PATCH] powerpc/book3e-64: use a separate TLB handler when linear map is bolted
From: Scott Wood @ 2011-06-03 22:12 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev
On MMUs such as FSL where we can guarantee the entire linear mapping is
bolted, we don't need to worry about linear TLB misses. If on top of
that we do a full table walk, we get rid of all recursive TLB faults, and
can dispense with some state saving. This gains a few percent on
TLB-miss-heavy workloads, and around 50% on a benchmark that had a high
rate of virtual page table faults under the normal handler.
While touching the EX_TLB layout, remove EX_TLB_MMUCR0, EX_TLB_SRR0, and
EX_TLB_SRR1 as they're not used.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
This turned out to be a little faster than the virtual pmd approach
on the sort benchmark as well as lmbench's lat_mem_rd with page stride.
It's slightly slower than virtual pmd (around 1%), but still faster than
current code, on linear tests such as lmbench's bw_mem cp.
arch/powerpc/include/asm/exception-64e.h | 47 ++++---
arch/powerpc/include/asm/mmu_context.h | 2 +
arch/powerpc/mm/tlb_low_64e.S | 206 ++++++++++++++++++++++++++++++
arch/powerpc/mm/tlb_nohash.c | 30 +++-
4 files changed, 259 insertions(+), 26 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h
index 6d53f31..1e001f0 100644
--- a/arch/powerpc/include/asm/exception-64e.h
+++ b/arch/powerpc/include/asm/exception-64e.h
@@ -50,28 +50,26 @@
/* The TLB miss exception uses different slots */
-#define EX_TLB_R10 ( 0 * 8)
-#define EX_TLB_R11 ( 1 * 8)
-#define EX_TLB_R12 ( 2 * 8)
+#define EX_TLB_PGD ( 0 * 8)
+#define EX_TLB_R10 ( 1 * 8)
+#define EX_TLB_R11 ( 2 * 8)
#define EX_TLB_R13 ( 3 * 8)
#define EX_TLB_R14 ( 4 * 8)
#define EX_TLB_R15 ( 5 * 8)
#define EX_TLB_R16 ( 6 * 8)
#define EX_TLB_CR ( 7 * 8)
-#define EX_TLB_DEAR ( 8 * 8) /* Level 0 and 2 only */
-#define EX_TLB_ESR ( 9 * 8) /* Level 0 and 2 only */
-#define EX_TLB_SRR0 (10 * 8)
-#define EX_TLB_SRR1 (11 * 8)
-#define EX_TLB_MMUCR0 (12 * 8) /* Level 0 */
-#define EX_TLB_MAS1 (12 * 8) /* Level 0 */
-#define EX_TLB_MAS2 (13 * 8) /* Level 0 */
+#define EX_TLB_R12 ( 8 * 8)
+#define EX_TLB_DEAR ( 9 * 8) /* Level 0 and 2 only */
+#define EX_TLB_ESR (10 * 8) /* Level 0 and 2 only */
+#define EX_TLB_SRR0 (11 * 8)
+#define EX_TLB_SRR1 (12 * 8)
#ifdef CONFIG_BOOK3E_MMU_TLB_STATS
-#define EX_TLB_R8 (14 * 8)
-#define EX_TLB_R9 (15 * 8)
-#define EX_TLB_LR (16 * 8)
-#define EX_TLB_SIZE (17 * 8)
+#define EX_TLB_R8 (13 * 8)
+#define EX_TLB_R9 (14 * 8)
+#define EX_TLB_LR (15 * 8)
+#define EX_TLB_SIZE (16 * 8)
#else
-#define EX_TLB_SIZE (14 * 8)
+#define EX_TLB_SIZE (13 * 8)
#endif
#define START_EXCEPTION(label) \
@@ -168,6 +166,16 @@ exc_##label##_book3e:
ld r9,EX_TLB_R9(r12); \
ld r8,EX_TLB_R8(r12); \
mtlr r16;
+#define TLB_MISS_PROLOG_STATS_BOLTED \
+ mflr r10; \
+ std r8,PACA_EXTLB+EX_TLB_R8(r13); \
+ std r9,PACA_EXTLB+EX_TLB_R9(r13); \
+ std r10,PACA_EXTLB+EX_TLB_LR(r13);
+#define TLB_MISS_RESTORE_STATS_BOLTED \
+ ld r16,PACA_EXTLB+EX_TLB_LR(r13); \
+ ld r9,PACA_EXTLB+EX_TLB_R9(r13); \
+ ld r8,PACA_EXTLB+EX_TLB_R8(r13); \
+ mtlr r16;
#define TLB_MISS_STATS_D(name) \
addi r9,r13,MMSTAT_DSTATS+name; \
bl .tlb_stat_inc;
@@ -183,17 +191,20 @@ exc_##label##_book3e:
61: addi r9,r13,MMSTAT_ISTATS+name; \
62: bl .tlb_stat_inc;
#define TLB_MISS_STATS_SAVE_INFO \
- std r14,EX_TLB_ESR(r12); /* save ESR */ \
-
-
+ std r14,EX_TLB_ESR(r12); /* save ESR */
+#define TLB_MISS_STATS_SAVE_INFO_BOLTED \
+ std r14,PACA_EXTLB+EX_TLB_ESR(r13); /* save ESR */
#else
#define TLB_MISS_PROLOG_STATS
#define TLB_MISS_RESTORE_STATS
+#define TLB_MISS_PROLOG_STATS_BOLTED
+#define TLB_MISS_RESTORE_STATS_BOLTED
#define TLB_MISS_STATS_D(name)
#define TLB_MISS_STATS_I(name)
#define TLB_MISS_STATS_X(name)
#define TLB_MISS_STATS_Y(name)
#define TLB_MISS_STATS_SAVE_INFO
+#define TLB_MISS_STATS_SAVE_INFO_BOLTED
#endif
#define SET_IVOR(vector_number, vector_offset) \
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index a73668a..9d9e444 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -54,6 +54,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
/* 64-bit Book3E keeps track of current PGD in the PACA */
#ifdef CONFIG_PPC_BOOK3E_64
get_paca()->pgd = next->pgd;
+ get_paca()->extlb[0][EX_TLB_PGD / 8] = (unsigned long)next->pgd;
#endif
/* Nothing else to do if we aren't actually switching */
if (prev == next)
@@ -110,6 +111,7 @@ static inline void enter_lazy_tlb(struct mm_struct *mm,
/* 64-bit Book3E keeps track of current PGD in the PACA */
#ifdef CONFIG_PPC_BOOK3E_64
get_paca()->pgd = NULL;
+ get_paca()->extlb[0][EX_TLB_PGD / 8] = 0;
#endif
}
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index af08922..0f4ab86 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -30,6 +30,212 @@
#define VPTE_PGD_SHIFT (VPTE_PUD_SHIFT + PUD_INDEX_SIZE)
#define VPTE_INDEX_SIZE (VPTE_PGD_SHIFT + PGD_INDEX_SIZE)
+/**********************************************************************
+ * *
+ * TLB miss handling for Book3E with a bolted linear mapping *
+ * No virtual page table, no nested TLB misses *
+ * *
+ **********************************************************************/
+
+.macro tlb_prolog_bolted addr
+ mtspr SPRN_SPRG_TLB_SCRATCH,r13
+ mfspr r13,SPRN_SPRG_PACA
+ std r10,PACA_EXTLB+EX_TLB_R10(r13)
+ mfcr r10
+ std r11,PACA_EXTLB+EX_TLB_R11(r13)
+ mfspr r11,SPRN_SPRG_TLB_SCRATCH
+ std r16,PACA_EXTLB+EX_TLB_R16(r13)
+ mfspr r16,\addr /* get faulting address */
+ std r14,PACA_EXTLB+EX_TLB_R14(r13)
+ ld r14,PACA_EXTLB+EX_TLB_PGD(r13)
+ std r15,PACA_EXTLB+EX_TLB_R15(r13)
+ std r10,PACA_EXTLB+EX_TLB_CR(r13)
+ std r11,PACA_EXTLB+EX_TLB_R13(r13)
+ TLB_MISS_PROLOG_STATS_BOLTED
+.endm
+
+.macro tlb_epilog_bolted
+ ld r14,PACA_EXTLB+EX_TLB_CR(r13)
+ ld r10,PACA_EXTLB+EX_TLB_R10(r13)
+ ld r11,PACA_EXTLB+EX_TLB_R11(r13)
+ mtcr r14
+ ld r14,PACA_EXTLB+EX_TLB_R14(r13)
+ ld r15,PACA_EXTLB+EX_TLB_R15(r13)
+ TLB_MISS_RESTORE_STATS_BOLTED
+ ld r16,PACA_EXTLB+EX_TLB_R16(r13)
+ ld r13,PACA_EXTLB+EX_TLB_R13(r13)
+.endm
+
+/* Data TLB miss */
+ START_EXCEPTION(data_tlb_miss_bolted)
+ tlb_prolog_bolted SPRN_DEAR
+
+ /* We need _PAGE_PRESENT and _PAGE_ACCESSED set */
+
+ /* We do the user/kernel test for the PID here along with the RW test
+ */
+ /* We pre-test some combination of permissions to avoid double
+ * faults:
+ *
+ * We move the ESR:ST bit into the position of _PAGE_BAP_SW in the PTE
+ * ESR_ST is 0x00800000
+ * _PAGE_BAP_SW is 0x00000010
+ * So the shift is >> 19. This tests for supervisor writeability.
+ * If the page happens to be supervisor writeable and not user
+ * writeable, we will take a new fault later, but that should be
+ * a rare enough case.
+ *
+ * We also move ESR_ST in _PAGE_DIRTY position
+ * _PAGE_DIRTY is 0x00001000 so the shift is >> 11
+ *
+ * MAS1 is preset for all we need except for TID that needs to
+ * be cleared for kernel translations
+ */
+
+ mfspr r11,SPRN_ESR
+
+ srdi r15,r16,60 /* get region */
+ rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4
+ bne- dtlb_miss_fault_bolted
+
+ rlwinm r10,r11,32-19,27,27
+ rlwimi r10,r11,32-16,19,19
+ cmpwi r15,0
+ ori r10,r10,_PAGE_PRESENT
+ oris r11,r10,_PAGE_ACCESSED@h
+
+ TLB_MISS_STATS_SAVE_INFO_BOLTED
+ bne tlb_miss_kernel_bolted
+
+tlb_miss_common_bolted:
+/*
+ * This is the guts of the TLB miss handler for bolted-linear.
+ * We are entered with:
+ *
+ * r16 = faulting address
+ * r15 = crap (free to use)
+ * r14 = page table base
+ * r13 = PACA
+ * r11 = PTE permission mask
+ * r10 = crap (free to use)
+ */
+ rldicl r15,r16,64-PGDIR_SHIFT+3,64-PGD_INDEX_SIZE-3
+ cmpldi cr0,r14,0
+ clrrdi r15,r15,3
+ beq tlb_miss_fault_bolted
+
+BEGIN_MMU_FTR_SECTION
+ /* Set the TLB reservation and search for existing entry. Then load
+ * the entry.
+ */
+ PPC_TLBSRX_DOT(0,r16)
+ ldx r14,r14,r15
+ beq normal_tlb_miss_done
+MMU_FTR_SECTION_ELSE
+ ldx r14,r14,r15
+ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV)
+
+ rldicl r15,r16,64-PUD_SHIFT+3,64-PUD_INDEX_SIZE-3
+ clrrdi r15,r15,3
+
+ cmpldi cr0,r14,0
+ beq tlb_miss_fault_bolted
+
+ ldx r14,r14,r15
+
+ rldicl r15,r16,64-PMD_SHIFT+3,64-PMD_INDEX_SIZE-3
+ clrrdi r15,r15,3
+
+ cmpldi cr0,r14,0
+ beq tlb_miss_fault_bolted
+
+ ldx r14,r14,r15
+
+ rldicl r15,r16,64-PAGE_SHIFT+3,64-PTE_INDEX_SIZE-3
+ clrrdi r15,r15,3
+
+ cmpldi cr0,r14,0
+ beq tlb_miss_fault_bolted
+
+ ldx r14,r14,r15
+
+ /* Check if required permissions are met */
+ andc. r15,r11,r14
+ rldicr r15,r14,64-(PTE_RPN_SHIFT-PAGE_SHIFT),63-PAGE_SHIFT
+ bne- tlb_miss_fault_bolted
+
+ /* Now we build the MAS:
+ *
+ * MAS 0 : Fully setup with defaults in MAS4 and TLBnCFG
+ * MAS 1 : Almost fully setup
+ * - PID already updated by caller if necessary
+ * - TSIZE need change if !base page size, not
+ * yet implemented for now
+ * MAS 2 : Defaults not useful, need to be redone
+ * MAS 3+7 : Needs to be done
+ */
+ clrrdi r11,r16,12 /* Clear low crap in EA */
+ clrldi r15,r15,12 /* Clear crap at the top */
+ rlwimi r11,r14,32-19,27,31 /* Insert WIMGE */
+ rlwimi r15,r14,32-8,22,25 /* Move in U bits */
+ mtspr SPRN_MAS2,r11
+ andi. r11,r14,_PAGE_DIRTY
+ rlwimi r15,r14,32-2,26,31 /* Move in BAP bits */
+
+ /* Mask out SW and UW if !DIRTY (XXX optimize this !) */
+ bne 1f
+ li r11,MAS3_SW|MAS3_UW
+ andc r15,r15,r11
+1:
+ mtspr SPRN_MAS7_MAS3,r15
+ tlbwe
+
+ TLB_MISS_STATS_X(MMSTAT_TLB_MISS_NORM_OK)
+ tlb_epilog_bolted
+ rfi
+
+itlb_miss_kernel_bolted:
+ li r11,_PAGE_PRESENT|_PAGE_BAP_SX /* Base perm */
+ oris r11,r11,_PAGE_ACCESSED@h
+tlb_miss_kernel_bolted:
+ mfspr r10,SPRN_MAS1
+ ld r14,PACA_KERNELPGD(r13)
+ cmpldi cr0,r15,8 /* Check for vmalloc region */
+ rlwinm r10,r10,0,16,1 /* Clear TID */
+ mtspr SPRN_MAS1,r10
+ beq+ tlb_miss_common_bolted
+
+tlb_miss_fault_bolted:
+ /* We need to check if it was an instruction miss */
+ andi. r10,r11,_PAGE_EXEC|_PAGE_BAP_SX
+ bne itlb_miss_fault_bolted
+dtlb_miss_fault_bolted:
+ TLB_MISS_STATS_D(MMSTAT_TLB_MISS_NORM_FAULT)
+ tlb_epilog_bolted
+ b exc_data_storage_book3e
+itlb_miss_fault_bolted:
+ TLB_MISS_STATS_I(MMSTAT_TLB_MISS_NORM_FAULT)
+ tlb_epilog_bolted
+ b exc_instruction_storage_book3e
+
+/* Instruction TLB miss */
+ START_EXCEPTION(instruction_tlb_miss_bolted)
+ tlb_prolog_bolted SPRN_SRR0
+
+ rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4
+ srdi r15,r16,60 /* get region */
+ TLB_MISS_STATS_SAVE_INFO_BOLTED
+ bne- itlb_miss_fault_bolted
+
+ li r11,_PAGE_PRESENT|_PAGE_EXEC /* Base perm */
+
+ /* We do the user/kernel test for the PID here along with the RW test
+ */
+
+ cmpldi cr0,r15,0 /* Check for user region */
+ oris r11,r11,_PAGE_ACCESSED@h
+ beq tlb_miss_common_bolted
+ b itlb_miss_kernel_bolted
/**********************************************************************
* *
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 0bdad3a..2ba051e 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -443,14 +443,27 @@ static void setup_page_sizes(void)
}
}
-static void setup_mmu_htw(void)
+static void __patch_exception(int exc, unsigned long addr)
{
extern unsigned int interrupt_base_book3e;
- extern unsigned int exc_data_tlb_miss_htw_book3e;
- extern unsigned int exc_instruction_tlb_miss_htw_book3e;
+ unsigned int *ibase = &interrupt_base_book3e;
+
+ /* Our exceptions vectors start with a NOP and -then- a branch
+ * to deal with single stepping from userspace which stops on
+ * the second instruction. Thus we need to patch the second
+ * instruction of the exception, not the first one
+ */
+
+ patch_branch(ibase + (exc / 4) + 1, addr, 0);
+}
- unsigned int *ibase = &interrupt_base_book3e;
+#define patch_exception(exc, name) do { \
+ extern unsigned int name; \
+ __patch_exception((exc), (unsigned long)&name); \
+} while (0)
+static void setup_mmu_htw(void)
+{
/* Check if HW tablewalk is present, and if yes, enable it by:
*
* - patching the TLB miss handlers to branch to the
@@ -467,10 +480,8 @@ static void setup_mmu_htw(void)
* the second instruction. Thus we need to patch the second
* instruction of the exception, not the first one
*/
- patch_branch(ibase + (0x1c0 / 4) + 1,
- (unsigned long)&exc_data_tlb_miss_htw_book3e, 0);
- patch_branch(ibase + (0x1e0 / 4) + 1,
- (unsigned long)&exc_instruction_tlb_miss_htw_book3e, 0);
+ patch_exception(0x1c0, exc_data_tlb_miss_htw_book3e);
+ patch_exception(0x1e0, exc_instruction_tlb_miss_htw_book3e);
book3e_htw_enabled = 1;
}
pr_info("MMU: Book3E Page Tables %s\n",
@@ -549,6 +560,9 @@ static void __early_init_mmu(int boot_cpu)
/* limit memory so we dont have linear faults */
memblock_enforce_memory_limit(linear_map_top);
memblock_analyze();
+
+ patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e);
+ patch_exception(0x1e0, exc_instruction_tlb_miss_bolted_book3e);
}
#endif
--
1.7.4.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox