* [PATCH] powerpc/hash: Skip non initialized page size in init_hpte_page_sizes
@ 2017-11-28 8:34 Aneesh Kumar K.V
2018-01-22 3:34 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2017-11-28 8:34 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
One of the easiest way to test config with 4K HPTE is to disable 64K hardware
page size like below.
int __init htab_dt_scan_page_sizes(unsigned long node,
size -= 3; prop += 3;
base_idx = get_idx_from_shift(base_shift);
- if (base_idx < 0) {
+ if (base_idx < 0 || base_idx == MMU_PAGE_64K) {
/* skip the pte encoding also */
prop += lpnum * 2; size -= lpnum * 2;
But then this results in error in other part of the code such as MPSS parsing
where we look at 4K base page size and 64K actual page size support.
This patch fix MPSS parsing by ignoring the actual page sizes marked
unsupported. In reality this can happen only with a corrupt device tree. But it
is good to tighten the error check.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/mm/hash_utils_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index e700660459c4..2ae18ff91390 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -601,7 +601,7 @@ static void init_hpte_page_sizes(void)
continue; /* not a supported page size */
for (ap = bp; ap < MMU_PAGE_COUNT; ++ap) {
penc = mmu_psize_defs[bp].penc[ap];
- if (penc == -1)
+ if (penc == -1 || !mmu_psize_defs[ap].shift)
continue;
shift = mmu_psize_defs[ap].shift - LP_SHIFT;
if (shift <= 0)
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: powerpc/hash: Skip non initialized page size in init_hpte_page_sizes
2017-11-28 8:34 [PATCH] powerpc/hash: Skip non initialized page size in init_hpte_page_sizes Aneesh Kumar K.V
@ 2018-01-22 3:34 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2018-01-22 3:34 UTC (permalink / raw)
To: Aneesh Kumar K.V, benh, paulus; +Cc: linuxppc-dev, Aneesh Kumar K.V
On Tue, 2017-11-28 at 08:34:40 UTC, "Aneesh Kumar K.V" wrote:
> One of the easiest way to test config with 4K HPTE is to disable 64K hardware
> page size like below.
>
> int __init htab_dt_scan_page_sizes(unsigned long node,
>
> size -= 3; prop += 3;
> base_idx = get_idx_from_shift(base_shift);
> - if (base_idx < 0) {
> + if (base_idx < 0 || base_idx == MMU_PAGE_64K) {
> /* skip the pte encoding also */
> prop += lpnum * 2; size -= lpnum * 2;
>
> But then this results in error in other part of the code such as MPSS parsing
> where we look at 4K base page size and 64K actual page size support.
>
> This patch fix MPSS parsing by ignoring the actual page sizes marked
> unsupported. In reality this can happen only with a corrupt device tree. But it
> is good to tighten the error check.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/10527e808123f4b12db604993638b3
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-22 3:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 8:34 [PATCH] powerpc/hash: Skip non initialized page size in init_hpte_page_sizes Aneesh Kumar K.V
2018-01-22 3:34 ` Michael Ellerman
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).