* [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible.
@ 2008-03-20 4:33 Tony Breeds
2008-03-20 4:33 ` [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine Tony Breeds
2008-03-20 9:41 ` [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Benjamin Herrenschmidt
0 siblings, 2 replies; 5+ messages in thread
From: Tony Breeds @ 2008-03-20 4:33 UTC (permalink / raw)
To: Paul Mackerras, linuxppc-dev; +Cc: Olof Johansson, Jan-Bernd Themann
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
arch/powerpc/kernel/prom.c | 21 ++++++++++++++-------
include/asm-powerpc/prom.h | 2 ++
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index eac97f4..f73e18b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -205,25 +205,32 @@ void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
} while(1);
}
-int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+int __init of_flat_dt_search(unsigned long node, const char *str,
+ const char *prop_name)
{
- const char* cp;
- unsigned long cplen, l;
+ const char *cp;
+ unsigned long plen, l;
- cp = of_get_flat_dt_prop(node, "compatible", &cplen);
+ cp = of_get_flat_dt_prop(node, prop_name, &plen);
if (cp == NULL)
return 0;
- while (cplen > 0) {
- if (strncasecmp(cp, compat, strlen(compat)) == 0)
+ while (plen > 0) {
+ if (strncasecmp(cp, str, strlen(str)) == 0)
return 1;
l = strlen(cp) + 1;
cp += l;
- cplen -= l;
+ plen -= l;
}
return 0;
}
+int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+{
+
+ return of_flat_dt_search(node, compat, "compatible");
+}
+
static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
unsigned long align)
{
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 78b7b0d..7b587f1 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -134,6 +134,8 @@ extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
void *data);
extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
unsigned long *size);
+extern int __init of_flat_dt_search(unsigned long node, const char *str,
+ const char *prop_name);
extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
extern unsigned long __init of_get_flat_dt_root(void);
--
1.5.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine.
2008-03-20 4:33 [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Tony Breeds
@ 2008-03-20 4:33 ` Tony Breeds
2008-03-20 7:18 ` Nathan Lynch
2008-03-20 9:41 ` [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Benjamin Herrenschmidt
1 sibling, 1 reply; 5+ messages in thread
From: Tony Breeds @ 2008-03-20 4:33 UTC (permalink / raw)
To: Paul Mackerras, linuxppc-dev; +Cc: Olof Johansson, Jan-Bernd Themann
eHEA doesn't work with 64k iopages, If an eHEA /can/ be present in the system
limit iopages to 4k.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
arch/powerpc/mm/hash_utils_64.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 590f1f6..4fd5e8a 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -302,14 +302,37 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
return 0;
}
+#if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_PPC_64K_PAGES)
+static int __init scan_dt_for_ehea(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ if (depth != 0)
+ return 0;
+
+ if (of_flat_dt_search(node, "HEA ", "ibm,drc-names"))
+ return 1;
+
+ return 0;
+}
+#endif
+
+
static void __init htab_init_page_sizes(void)
{
int rc;
+#ifdef CONFIG_PPC_64K_PAGES
+ int has_ehea = 0;
+#endif
/* Default to 4K pages only */
memcpy(mmu_psize_defs, mmu_psize_defaults_old,
sizeof(mmu_psize_defaults_old));
+#if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_PPC_64K_PAGES)
+ /* Scan to see if this system can have an EHEA, if so we'll
+ * demote io_psize to 4K */
+ has_ehea = of_scan_flat_dt(scan_dt_for_ehea, NULL);
+#endif
/*
* Try to find the available page sizes in the device-tree
*/
@@ -351,9 +374,10 @@ static void __init htab_init_page_sizes(void)
mmu_vmalloc_psize = MMU_PAGE_64K;
if (mmu_linear_psize == MMU_PAGE_4K)
mmu_linear_psize = MMU_PAGE_64K;
- if (cpu_has_feature(CPU_FTR_CI_LARGE_PAGE))
- mmu_io_psize = MMU_PAGE_64K;
- else
+ if (cpu_has_feature(CPU_FTR_CI_LARGE_PAGE)) {
+ if (!has_ehea)
+ mmu_io_psize = MMU_PAGE_64K;
+ } else
mmu_ci_restrictions = 1;
}
#endif /* CONFIG_PPC_64K_PAGES */
--
1.5.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine.
2008-03-20 4:33 ` [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine Tony Breeds
@ 2008-03-20 7:18 ` Nathan Lynch
2008-03-20 9:23 ` Paul Mackerras
0 siblings, 1 reply; 5+ messages in thread
From: Nathan Lynch @ 2008-03-20 7:18 UTC (permalink / raw)
To: Tony Breeds
Cc: Johansson, linuxppc-dev, Paul Mackerras, Olof, Jan-Bernd Themann
Tony Breeds wrote:
>
> +#if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_PPC_64K_PAGES)
> +static int __init scan_dt_for_ehea(unsigned long node, const char *uname,
> + int depth, void *data)
> +{
> + if (depth != 0)
> + return 0;
> +
> + if (of_flat_dt_search(node, "HEA ", "ibm,drc-names"))
> + return 1;
> +
> + return 0;
> +}
> +#endif
Searching ibm,drc-names is necessary, but is it sufficient? That is,
can there be a system that has an HEA adapter without that property
being present? Thinking in particular about single-partition systems
that run without an HMC attached.
> static void __init htab_init_page_sizes(void)
> {
> int rc;
> +#ifdef CONFIG_PPC_64K_PAGES
> + int has_ehea = 0;
> +#endif
>
> /* Default to 4K pages only */
> memcpy(mmu_psize_defs, mmu_psize_defaults_old,
> sizeof(mmu_psize_defaults_old));
>
> +#if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_PPC_64K_PAGES)
> + /* Scan to see if this system can have an EHEA, if so we'll
> + * demote io_psize to 4K */
> + has_ehea = of_scan_flat_dt(scan_dt_for_ehea, NULL);
> +#endif
I'm wondering if some of the ifdef stuff could be avoided if you used
a firmware feature bit to signify the limitation (or the lack of it).
The bit could be set during pSeries_probe. Just an idea; I don't feel
that strongly about it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine.
2008-03-20 7:18 ` Nathan Lynch
@ 2008-03-20 9:23 ` Paul Mackerras
0 siblings, 0 replies; 5+ messages in thread
From: Paul Mackerras @ 2008-03-20 9:23 UTC (permalink / raw)
To: Nathan Lynch; +Cc: Olof Johansson, linuxppc-dev, Jan-Bernd Themann
Nathan Lynch writes:
> Searching ibm,drc-names is necessary, but is it sufficient? That is,
> can there be a system that has an HEA adapter without that property
> being present? Thinking in particular about single-partition systems
> that run without an HMC attached.
PAPR doesn't seem to say clearly one way or the other. For 2.6.25,
the best thing is probably just to force 4k pages on all pSeries
machines. Given that this is only for access to PCI devices, the
actual access is going to be slow enough that an extra TLB miss here
or there won't matter too much.
Paul.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible.
2008-03-20 4:33 [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Tony Breeds
2008-03-20 4:33 ` [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine Tony Breeds
@ 2008-03-20 9:41 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2008-03-20 9:41 UTC (permalink / raw)
To: Tony Breeds
Cc: Olof Johansson, linuxppc-dev, Paul Mackerras, Jan-Bernd Themann
On Thu, 2008-03-20 at 15:33 +1100, Tony Breeds wrote:
> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
> ---
What about a comment ? :-)
> arch/powerpc/kernel/prom.c | 21 ++++++++++++++-------
> include/asm-powerpc/prom.h | 2 ++
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index eac97f4..f73e18b 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -205,25 +205,32 @@ void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
> } while(1);
> }
>
> -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> +int __init of_flat_dt_search(unsigned long node, const char *str,
> + const char *prop_name)
> {
> - const char* cp;
> - unsigned long cplen, l;
> + const char *cp;
> + unsigned long plen, l;
>
> - cp = of_get_flat_dt_prop(node, "compatible", &cplen);
> + cp = of_get_flat_dt_prop(node, prop_name, &plen);
> if (cp == NULL)
> return 0;
> - while (cplen > 0) {
> - if (strncasecmp(cp, compat, strlen(compat)) == 0)
> + while (plen > 0) {
> + if (strncasecmp(cp, str, strlen(str)) == 0)
> return 1;
> l = strlen(cp) + 1;
> cp += l;
> - cplen -= l;
> + plen -= l;
> }
>
> return 0;
> }
>
> +int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> +{
> +
> + return of_flat_dt_search(node, compat, "compatible");
> +}
> +
> static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> unsigned long align)
> {
> diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
> index 78b7b0d..7b587f1 100644
> --- a/include/asm-powerpc/prom.h
> +++ b/include/asm-powerpc/prom.h
> @@ -134,6 +134,8 @@ extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
> void *data);
> extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
> unsigned long *size);
> +extern int __init of_flat_dt_search(unsigned long node, const char *str,
> + const char *prop_name);
> extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
> extern unsigned long __init of_get_flat_dt_root(void);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-03-20 10:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20 4:33 [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Tony Breeds
2008-03-20 4:33 ` [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine Tony Breeds
2008-03-20 7:18 ` Nathan Lynch
2008-03-20 9:23 ` Paul Mackerras
2008-03-20 9:41 ` [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).