Fix "ibm,processor-radix-AP-encodings"
PATCH 1/1 Fix "ibm,processor-radix-AP-encodings"
The top 3 bits of the lower order byte should contain the AP encoding, we assume the top 3 bits of the MSB.
---
- Detected while reviewing Chris Smart's patch to add radix-AP-encoding to skiboot
- Also fixed typo (sift/shift)
arch/powerpc/mm/pgtable-radix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/mm/pgtable-radix.c +4 -4
@@ -245,10 +245,10 @@ static int __init radix_dt_scan_page_sizes(unsigned long node,struct mmu_psize_def *def; -/* top 3 bit is AP encoding */ - shift =be32_to_cpu (prop[0 ]) & ~(0xe <<28 ); - ap =be32_to_cpu (prop[0 ]) >>29 ; -pr_info ("Page size sift = %d AP=0x%x\n" , shift, ap); +/* top 3 bits of the lower order byte is AP encoding */ + shift =be32_to_cpu (prop[0 ]) &0x1f ; + ap = (be32_to_cpu (prop[0 ]) >>5 ) &0x7 ; +pr_info ("Page size shift = %d AP=0x%x\n" , shift, ap); idx =get_idx_from_shift (shift);if (idx <0 )
Signature · 1 line
2.5.5
Quoted 2 lines · Balbir Singh
The top 3 bits of the lower order byte should contain the AP encoding, we assume the top 3 bits of the MSB.
Are you sure, Power architecture documents always confuse about MSB vs lowe order bytes. ?
Quoted 20 lines
Signed-off-by Balbir Singh <[email protected]>---
- Detected while reviewing Chris Smart's patch to add radix-AP-encoding to skiboot
- Also fixed typo (sift/shift)arch/powerpc/mm/pgtable-radix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)arch/powerpc/mm/pgtable-radix.c +0
-1@@ -245,10 +245,10 @@ static int __init radix_dt_scan_page_sizes(unsigned long node,struct mmu_psize_def *def; -/* top 3 bit is AP encoding */
arch/powerpc/mm/pgtable-radix.c static int __init radix_dt_scan_page_sizes(unsigned long node, · line 254
Quoted 10 lines
arch/powerpc/mm/pgtable-radix.c +4
-3- shift =be32_to_cpu (prop[0 ]) & ~(0xe <<28 ); - ap =be32_to_cpu (prop[0 ]) >>29 ; -pr_info ("Page size sift = %d AP=0x%x\n" , shift, ap); +/* top 3 bits of the lower order byte is AP encoding */ + shift =be32_to_cpu (prop[0 ]) &0x1f ; + ap = (be32_to_cpu (prop[0 ]) >>5 ) &0x7 ; +pr_info ("Page size shift = %d AP=0x%x\n" , shift, ap); idx =get_idx_from_shift (shift);if (idx <0 )
-aneesh
Oliver O'Halloran
Reviewed-byQuoted 4 lines · Aneesh Kumar K.V
Quoted 2 lines · Balbir Singh
The top 3 bits of the lower order byte should contain the AP encoding, we assume the top 3 bits of the MSB.
Balbir, could you reword this so it says "Currently we wrongly assume <blah>" or similar. The current commit message made me think you were changing it to look at the top 3 bits of the MSB rather than changing it look at the LSB.
Quoted 2 lines
Are you sure, Power architecture documents always confuse about MSB vs lowe order bytes. ?
PAPR seems to be pretty consistent about "low order" meaning "least significant." Additionally the PAPR that describes ibm,processor-radix-AP-encodings says that it is formatted this way so it can be used when constructing the register argument to tlbie. The modes of tlbie that use the AP field place it in bits 56:59 so I think Balbir's fix is correct.
Michael Ellerman
reviewerQuoted 11 lines · Oliver O'Halloran
Quoted 4 lines · Aneesh Kumar K.V
Quoted 2 lines · Balbir Singh
The top 3 bits of the lower order byte should contain the AP encoding, we assume the top 3 bits of the MSB.
Balbir, could you reword this so it says "Currently we wrongly assume <blah>" or similar. The current commit message made me think you were changing it to look at the top 3 bits of the MSB rather than changing it look at the LSB.
Yeah please reword it to describe what the current code does, why it's incorrect, and how we are fixing it.
cheers
Quoted 9 lines · Michael Ellerman
Quoted 7 lines · Oliver O'Halloran
Quoted 4 lines · Aneesh Kumar K.V
Quoted 2 lines · Balbir Singh
The top 3 bits of the lower order byte should contain the AP encoding, we assume the top 3 bits of the MSB.
Quoted 8 lines
Quoted 4 lines
Balbir, could you reword this so it says "Currently we wrongly assume <blah>" or similar. The current commit message made me think you were changing it to look at the top 3 bits of the MSB rather than changing it look at the LSB.
Yeah please reword it to describe what the current code does, why it's incorrect, and how we are fixing it.
I have an updated patch for this, which redo the AP-encoding parsing based on spec update. Wil send it to the list once we finalize the details
-aneesh