powerpc: Fix invalid page flags in create TLB CAM path for PTE_64BIT
PATCH 1/1 powerpc: Fix invalid page flags in create TLB CAM path for PTE_64BIT
From: Tiejun Chen <[email protected]>
There exists a four line chunk of code, which when configured for 64 bit address space, can incorrectly set certain page flags during the TLB creation. It turns out that this is legacy code that is no longer required, but since it isn't obvious why this is legacy code or why it causes problems, the below description covers both in detail.
For powerpc bootstrap, the physical memory (at most 768M), is mapped into the kernel space via the following path:
MMU_init()
|
+ adjust_total_lowmem()
|
+ map_mem_in_cams()
|
+ settlbcam(i, virt, phys, cam_sz, PAGE_KERNEL_X, 0);
On settlbcam(), the kernel will create TLB entries according to the flag, PAGE_KERNEL_X.
settlbcam()
{
...
TLBCAM[index].MAS1 = MAS1_VALID
| MAS1_IPROT | MAS1_TSIZE(tsize) | MAS1_TID(pid);
^
These entries cannot be invalidated by the
kernel since MAS1_IPROT is set on TLB property.
...
if (flags & _PAGE_USER) {
TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
}For classic BookE (flags & _PAGE_USER) is 'zero' so it's fine. But on boards like the the Freescale P4080, we want to support 36-bit physical address on it. So the following options may be set:
CONFIG_FSL_BOOKE=yCONFIG_PTE_64BIT=yCONFIG_PHYS_64BIT=y
As a result, boards like the P4080 will introduce PTE format as Book3E. As per the file: arch/powerpc/include/asm/pgtable-ppc32.h
* #elif defined(CONFIG_FSL_BOOKE) && defined(CONFIG_PTE_64BIT)
* #include <asm/pte-book3e.h>
So PAGE_KERNEL_X is __pgprot(_PAGE_BASE | _PAGE_KERNEL_RWX) and the book3E version of _PAGE_KERNEL_RWX is defined with:
(_PAGE_BAP_SW | _PAGE_BAP_SR | _PAGE_DIRTY | _PAGE_BAP_SX)
Note the _PAGE_BAP_SR, which is also defined in the book3E _PAGE_USER:
#define _PAGE_USER (_PAGE_BAP_UR | _PAGE_BAP_SR) /* Can be read */
So the possibility exists to wrongly assign the user MAS3_U<RWX> bits to kernel (PAGE_KERNEL_X) address space via the following code fragment:
if (flags & _PAGE_USER) {
TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
}Here is a dump of the TLB info from Simics with the above code present:
------
L2 TLB1
GT SSS UUU V I
Row Logical Physical SS TLPID TID WIMGE XWR XWR F P V ----- ----------------- ------------------- -- ----- ----- ----- --- --- - - - 0 c0000000-cfffffff 000000000-00fffffff 00 0 0 M XWR XWR 0 1 1 1 d0000000-dfffffff 010000000-01fffffff 00 0 0 M XWR XWR 0 1 1 2 e0000000-efffffff 020000000-02fffffff 00 0 0 M XWR XWR 0 1 1
Actually this conditional code was only used for two legacy functions:
1: support KGDB to set break point.
KGDB already dropped this; now uses its core write to set break point.
2: io_block_mapping() to create TLB in segmentation size (not PAGE_SIZE)
for device IO space.
This use case is also removed from the latest PowerPC kernel.
So it looks like the deletion of these 4 lines of code was simply overlooked when the above two cases went away.
With the code deleted, the TLB appears without U having XWR as below:
-------
L2 TLB1
GT SSS UUU V I
Row Logical Physical SS TLPID TID WIMGE XWR XWR F P V ----- ----------------- ------------------- -- ----- ----- ----- --- --- - - - 0 c0000000-cfffffff 000000000-00fffffff 00 0 0 M XWR 0 1 1 1 d0000000-dfffffff 010000000-01fffffff 00 0 0 M XWR 0 1 1 2 e0000000-efffffff 020000000-02fffffff 00 0 0 M XWR 0 1 1
--- arch/powerpc/mm/fsl_booke_mmu.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
arch/powerpc/mm/fsl_booke_mmu.c +0 -5
@@ -136,11 +136,6 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,if (mmu_has_feature (MMU_FTR_BIG_PHYS ))TLBCAM [index].MAS7 = (u64 )phys >>32 ; -if (flags & _PAGE_USER) { -TLBCAM [index].MAS3 |=MAS3_UX |MAS3_UR ; -TLBCAM [index].MAS3 |= ((flags & _PAGE_RW) ?MAS3_UW :0 ); - } - tlbcam_addrs[index].start = virt; tlbcam_addrs[index].limit = virt + size -1 ; tlbcam_addrs[index].phys = phys;
Signature · 1 line
1.7.2.1
Quoted 18 lines · On Thu, 23 Sep 2010 16:10:15 -0400 Paul Gortmaker…
So the possibility exists to wrongly assign the user MAS3_U<RWX> bits to kernel (
PAGE_KERNEL_X) address space via the following code fragment:if (flags & _PAGE_USER) { TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR; TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0); }Here is a dump of the TLB info from Simics with the above code present:
------
L2 TLB1
GT SSS UUU V IRow Logical Physical SS TLPID TID WIMGE XWR XWR F P V ----- ----------------- ------------------- -- ----- ----- ----- --- --- - - - 0 c0000000-cfffffff 000000000-00fffffff 00 0 0 M XWR XWR 0 1 1 1 d0000000-dfffffff 010000000-01fffffff 00 0 0 M XWR XWR 0 1 1 2 e0000000-efffffff 020000000-02fffffff 00 0 0 M XWR XWR 0 1 1
Quoted 8 lines
Actually this conditional code was only used for two legacy functions:
1: support KGDB to set break point.
KGDB already dropped this; now uses its core write to set break point.2:
io_block_mapping()to create TLB in segmentation size (notPAGE_SIZE)
for device IO space.
This use case is also removed from the latest PowerPC kernel.
io_block_mapping() went away, but the feature itself is still useful and might come back with something like this:
http://www.mail-archive.com/[email protected]/msg33851.html
...though I'm not sure why such mappings would ever have user access.
This could end up being used for large user pages by something like hugetlbfs or KVM, though. I don't think we want to make large user pages fail, especailly if it just happens with the 32-bit page table format (which i may not what the person adding such a feature tests with).
I don't see a generic accessor that can test PTE flags for user access -- in the absence of one, I guess we need an ifdef here. Or at least put in a comment so anyone who adds a userspace use knows they need to fix it.
-Scott
Quoted 4 lines · Scott Wood
I don't see a generic accessor that can test PTE flags for user access -- in the absence of one, I guess we need an ifdef here. Or at least put in a comment so anyone who adds a userspace use knows they need to fix it.
We could make up one in powerpc arch at least
#define pte_user(val) ((val & _PAGE_USER) == _PAGE_USER)
would do
Cheers,
Ben.
RE: [PATCH] powerpc: Fix invalid page flags in create TLB CAM pathfor PTE_64BIT
Quoted 17 lines
-----Original Message-----
From:=20 [email protected] g=20 [mailto:[email protected] zlabs.org] On Behalf Of Benjamin Herrenschmidt
Sent: Friday, September 24, 2010 5:59 AM
To: Scott Wood
Cc: Gortmaker, Paul; [email protected]
Subject: Re: [PATCH] powerpc: Fix invalid page flags in=20 create TLB CAM pathforPTE_64BIT
=20Quoted 1 line · Scott Wood
I don't see a generic accessor that can test PTE flags for=20
user access=20
Quoted 1 line
-- in the absence of one, I guess we need an ifdef here. =20
Or at least=20
Quoted 8 lines
Quoted 1 line
put in a comment so anyone who adds a userspace use knows=20
they need to=20
Quoted 1 line
fix it.
=20
We could make up one in powerpc arch at least
=20
#definepte_user(val)((val &_PAGE_USER) =3D=3D_PAGE_USER) =20
Looks good.=20
Ben and Scott,
But for the patched issue we're discussing we have to do #ifdef that as my original modification. Right? Or do you have other suggestion? Then I can improve that as v2.
Thanks
Tiejun=20
Quoted 11 lines
would do
=20
Cheers,
Ben.
=20
=20
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
=20
Re: [PATCH] powerpc: Fix invalid page flags in create TLB CAM pathfor PTE_64BIT
Quoted 26 lines · Tiejun
Quoted 16 lines
-----Original Message-----
From:
[email protected] g [mailto:[email protected] zlabs.org] On Behalf Of Benjamin Herrenschmidt
Sent: Friday, September 24, 2010 5:59 AM
To: Scott Wood
Cc: Gortmaker, Paul; [email protected]
Subject: Re: [PATCH] powerpc: Fix invalid page flags in create TLB CAM pathforPTE_64BITQuoted 1 line · Scott Wood
I don't see a generic accessor that can test PTE flags for
user access
Quoted 1 line
-- in the absence of one, I guess we need an ifdef here.
Quoted 9 lines
Or at least
Quoted 1 line
put in a comment so anyone who adds a userspace use knows
they need to
Quoted 1 line
fix it.
We could make up one in powerpc arch at least
#define
pte_user(val)((val &_PAGE_USER) ==_PAGE_USER)
Quoted 7 lines
Looks good.
Ben and Scott,
But for the patched issue we're discussing we have to do #ifdef that as my original modification. Right? Or do you have other suggestion? Then I can improve that as v2.
Ben's version should work without any ifdef, since it makes sure all bits of _PAGE_USER are set.
-Scott
Quoted 11 lines · [Re: [PATCH] powerpc: Fix invalid page flags in create TLB CAM path for…
Quoted 4 lines · Scott Wood
I don't see a generic accessor that can test PTE flags for user access -- in the absence of one, I guess we need an ifdef here. Or at least put in a comment so anyone who adds a userspace use knows they need to fix it.
We could make up one in powerpc arch at least
#define
pte_user(val)((val &_PAGE_USER) ==_PAGE_USER)would do
I've put the above into pte-common.h, restored the deleted code block which now uses pte_user() and I've updated the commit header to match. Passes sanity boot test on an sbc8548 both with and without PTE_64BIT.
Thanks for the feedback.
Paul.
Quoted 1 line
From
d48ebb58b8214f9faec775a5e06902f638f165cfMon Sep 17 00:00:00 2001
From: Tiejun Chen <[email protected]>
Date: Tue, 21 Sep 2010 19:31:31 +0800
Subject: [PATCH] powerpc: Fix invalid page flags in create TLB CAM path for PTE_64BIT
There exists a four line chunk of code, which when configured for 64 bit address space, can incorrectly set certain page flags during the TLB creation. It turns out that this is code which isn't used, but might still serve a purpose. Since it isn't obvious why it exists or why it causes problems, the below description covers both in detail.
For powerpc bootstrap, the physical memory (at most 768M), is mapped into the kernel space via the following path:
MMU_init()
|
+ adjust_total_lowmem()
|
+ map_mem_in_cams()
|
+ settlbcam(i, virt, phys, cam_sz, PAGE_KERNEL_X, 0);
On settlbcam(), the kernel will create TLB entries according to the flag, PAGE_KERNEL_X.
settlbcam()
{
...
TLBCAM[index].MAS1 = MAS1_VALID
| MAS1_IPROT | MAS1_TSIZE(tsize) | MAS1_TID(pid);
^
These entries cannot be invalidated by the
kernel since MAS1_IPROT is set on TLB property.
...
if (flags & _PAGE_USER) {
TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
}For classic BookE (flags & _PAGE_USER) is 'zero' so it's fine. But on boards like the the Freescale P4080, we want to support 36-bit physical address on it. So the following options may be set:
CONFIG_FSL_BOOKE=yCONFIG_PTE_64BIT=yCONFIG_PHYS_64BIT=y
As a result, boards like the P4080 will introduce PTE format as Book3E. As per the file: arch/powerpc/include/asm/pgtable-ppc32.h
* #elif defined(CONFIG_FSL_BOOKE) && defined(CONFIG_PTE_64BIT)
* #include <asm/pte-book3e.h>
So PAGE_KERNEL_X is __pgprot(_PAGE_BASE | _PAGE_KERNEL_RWX) and the book3E version of _PAGE_KERNEL_RWX is defined with:
(_PAGE_BAP_SW | _PAGE_BAP_SR | _PAGE_DIRTY | _PAGE_BAP_SX)
Note the _PAGE_BAP_SR, which is also defined in the book3E _PAGE_USER:
#define _PAGE_USER (_PAGE_BAP_UR | _PAGE_BAP_SR) /* Can be read */
So the possibility exists to wrongly assign the user MAS3_U<RWX> bits to kernel (PAGE_KERNEL_X) address space via the following code fragment:
if (flags & _PAGE_USER) {
TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
}Here is a dump of the TLB info from Simics with the above code present:
------
L2 TLB1
GT SSS UUU V I
Row Logical Physical SS TLPID TID WIMGE XWR XWR F P V ----- ----------------- ------------------- -- ----- ----- ----- --- --- - - - 0 c0000000-cfffffff 000000000-00fffffff 00 0 0 M XWR XWR 0 1 1 1 d0000000-dfffffff 010000000-01fffffff 00 0 0 M XWR XWR 0 1 1 2 e0000000-efffffff 020000000-02fffffff 00 0 0 M XWR XWR 0 1 1
Actually this conditional code was used for two legacy functions:
1: support KGDB to set break point.
KGDB already dropped this; now uses its core write to set break point.
2: io_block_mapping() to create TLB in segmentation size (not PAGE_SIZE)
for device IO space.
This use case is also removed from the latest PowerPC kernel.
However, there may still be a use case for it in the future, like large user pages, so we can't remove it entirely. As an alternative, we match on all bits of _PAGE_USER instead of just any bits, so the case where just _PAGE_BAP_SR is set can't sneak through.
With this done, the TLB appears without U having XWR as below:
-------
L2 TLB1
GT SSS UUU V I
Row Logical Physical SS TLPID TID WIMGE XWR XWR F P V ----- ----------------- ------------------- -- ----- ----- ----- --- --- - - - 0 c0000000-cfffffff 000000000-00fffffff 00 0 0 M XWR 0 1 1 1 d0000000-dfffffff 010000000-01fffffff 00 0 0 M XWR 0 1 1 2 e0000000-efffffff 020000000-02fffffff 00 0 0 M XWR 0 1 1
--- arch/powerpc/include/asm/pte-common.h | 7 +++++++ arch/powerpc/mm/fsl_booke_mmu.c | 3 ++- 2 files changed, 9 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/pte-common.h +7 -0
@@ -171,6 +171,13 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);/* Make modules code happy. We don't set RO yet */ #define PAGE_KERNEL_EXEC PAGE_KERNEL_X +/* +* Don't just check for any non zero bits in __PAGE_USER, since for book3e +* and PTE_64BIT, PAGE_KERNEL_X contains _PAGE_BAP_SR which is also in +* _PAGE_USER. Need to explictly match _PAGE_BAP_UR bit in that case too. +*/ +#define pte_user (val) ((val & _PAGE_USER) == _PAGE_USER) +/* Advertise special mapping type for AGP */ #define PAGE_AGP (PAGE_KERNEL_NC)#define HAVE_PAGE_AGP
arch/powerpc/mm/fsl_booke_mmu.c +2 -1
@@ -137,7 +137,8 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,if (mmu_has_feature (MMU_FTR_BIG_PHYS ))TLBCAM [index].MAS7 = (u64 )phys >>32 ; -if (flags & _PAGE_USER) { +/* Below is unlikely -- only for large user pages or similar */ +if (pte_user (flags)) {TLBCAM [index].MAS3 |=MAS3_UX |MAS3_UR ;TLBCAM [index].MAS3 |= ((flags & _PAGE_RW) ?MAS3_UW :0 ); }
Signature · 1 line
1.7.2.1
Kumar Gala
AppliedQuoted 2 lines · Paul Gortmaker
Quoted 2 lines
=20
=46romd48ebb58b8214f9faec775a5e06902f638f165cfMon Sep 17 00:00:00 =
2001
Quoted 3 lines
From: Tiejun Chen <[email protected]>
Date: Tue, 21 Sep 2010 19:31:31 +0800
Subject: [PATCH] powerpc: Fix invalid page flags in create TLB CAM =
path for PTE_64BIT
Quoted 6 lines
=20
There exists a four line chunk of code, which when configured for 64 bit address space, can incorrectly set certain page flags during the TLB creation. It turns out that this is code which isn't used, but might still serve a purpose. Since it isn't obvious why it exists or why it causes problems, the below description covers both in =
detail.
Quoted 11 lines
=20
For powerpc bootstrap, the physical memory (at most 768M), is mapped into the kernel space via the following path:
=20MMU_init()
|
+adjust_total_lowmem()
|
+map_mem_in_cams()
|
+ settlbcam(i, virt, phys,cam_sz,PAGE_KERNEL_X, =
0);
Quoted 2 lines
=20
Onsettlbcam(), the kernel will create TLB entries according to the =
flag,
Quoted 7 lines
PAGE_KERNEL_X.
=20settlbcam(){ ... TLBCAM[index].MAS1 =3D MAS1_VALID | MAS1_IPROT | MAS1_TSIZE(tsize) | =
MAS1_TID(pid);
Quoted 8 lines
^
These entries cannot be invalidated by the
kernel since MAS1_IPROT is set on TLB property.
...
if (flags & _PAGE_USER) {
TLBCAM[index].MAS3 |=3D MAS3_UX | MAS3_UR;
TLBCAM[index].MAS3 |=3D ((flags & _PAGE_RW) ? MAS3_UW : 0);
}Quoted 10 lines
=20
For classic BookE (flags &_PAGE_USER) is 'zero' so it's fine. But on boards like the the Freescale P4080, we want to support 36-bit physical address on it. So the following options may be set:
=20CONFIG_FSL_BOOKE=3DyCONFIG_PTE_64BIT=3DyCONFIG_PHYS_64BIT=3Dy
=20
As a result, boards like the P4080 will introduce PTE format as =
Book3E.
Quoted 5 lines
As per the file:
arch/powerpc/include/asm/pgtable-ppc32.h=20
* #elifdefined(CONFIG_FSL_BOOKE)&&defined(CONFIG_PTE_64BIT)
* #include <asm/pte-book3e.h>
=20
Quoted 8 lines
So
PAGE_KERNEL_Xis__pgprot(_PAGE_BASE | _PAGE_KERNEL_RWX)and the book3E version of_PAGE_KERNEL_RWXis defined with:
=20
(_PAGE_BAP_SW|_PAGE_BAP_SR|_PAGE_DIRTY|_PAGE_BAP_SX)
=20
Note the_PAGE_BAP_SR, which is also defined in the book3E_PAGE_USER:
=20
#define_PAGE_USER(_PAGE_BAP_UR|_PAGE_BAP_SR) /* Can be =
read */
Quoted 3 lines
=20
So the possibility exists to wrongly assign the user MAS3_U<RWX> bits to kernel (PAGE_KERNEL_X) address space via the following code =
fragment:
Quoted 7 lines
=20
if (flags & _PAGE_USER) { TLBCAM[index].MAS3 |=3D MAS3_UX | MAS3_UR; TLBCAM[index].MAS3 |=3D ((flags & _PAGE_RW) ? MAS3_UW : 0); }=20
Here is a dump of the TLB info from Simics with the above code =
present:
Quoted 3 lines
------
L2 TLB1
GT SSS =
UUU V I
Quoted 1 line
Row Logical Physical SS TLPID TID WIMGE XWR =
XWR F P V
Quoted 1 line
----- ----------------- ------------------- -- ----- ----- ----- --- =
--- - - -
Quoted 1 line
0 c0000000-cfffffff 000000000-00fffffff 00 0 0 M XWR =
XWR 0 1 1
Quoted 1 line
1 d0000000-dfffffff 010000000-01fffffff 00 0 0 M XWR =
XWR 0 1 1
Quoted 1 line
2 e0000000-efffffff 020000000-02fffffff 00 0 0 M XWR =
XWR 0 1 1
Quoted 5 lines
=20
Actually this conditional code was used for two legacy functions:
=20
1: support KGDB to set break point.
KGDB already dropped this; now uses its core write to set break =
point.
Quoted 2 lines
=20
2:io_block_mapping()to create TLB in segmentation size (not =
PAGE_SIZE)
Quoted 5 lines
for device IO space.
This use case is also removed from the latest PowerPC kernel.
=20
However, there may still be a use case for it in the future, like large user pages, so we can't remove it entirely. As an alternative,
Quoted 8 lines
we match on all bits of
_PAGE_USERinstead of just any bits, so the case where just_PAGE_BAP_SRis set can't sneak through. =20
With this done, the TLB appears without U having XWR as below:
=20
-------
L2 TLB1
GT SSS =
UUU V I
Quoted 1 line
Row Logical Physical SS TLPID TID WIMGE XWR =
XWR F P V
Quoted 1 line
----- ----------------- ------------------- -- ----- ----- ----- --- =
--- - - -
Quoted 1 line
0 c0000000-cfffffff 000000000-00fffffff 00 0 0 M XWR =
0 1 1 > 1 d0000000-dfffffff 010000000-01fffffff 00 0 0 M XWR = 0 1 1 > 2 e0000000-efffffff 020000000-02fffffff 00 0 0 M XWR = 0 1 1
Quoted 7 lines
=20
Signed-off-by Tiejun Chen <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>---
arch/powerpc/include/asm/pte-common.h | 7 +++++++ arch/powerpc/mm/fsl_booke_mmu.c | 3 ++- 2 files changed, 9 insertions(+), 1 deletions(-)
applied to next
- k
RE: [PATCH] powerpc: Fix invalid page flags in create TLB CAM pathfor PTE_64BIT
In reply to Scott WoodQuoted 5 lines
-----Original Message-----
From:=20 [email protected] g=20 [mailto:[email protected]
zlabs.org] On Behalf Of Scott Wood
Quoted 9 lines
Sent: Friday, September 24, 2010 4:34 AM
To: Gortmaker, Paul
Cc: [email protected]
Subject: Re: [PATCH] powerpc: Fix invalid page flags in=20 create TLB CAM pathforPTE_64BIT
=20
On Thu, 23 Sep 2010 16:10:15 -0400
Paul Gortmaker <[email protected]> wrote:
=20
Quoted 8 lines
Quoted 1 line
So the possibility exists to wrongly assign the user=20
MAS3_U<RWX> bits=20
Quoted 1 line
to kernel (
PAGE_KERNEL_X) address space via the following=20code fragment:
Quoted 4 lines
=20
if (flags & _PAGE_USER) { TLBCAM[index].MAS3 |=3D MAS3_UX | MAS3_UR; TLBCAM[index].MAS3 |=3D ((flags & _PAGE_RW) ? MAS3_UW : =
0);
Quoted 27 lines
Quoted 3 lines
}=20
Here is a dump of the TLB info from Simics with the above=20code present:
Quoted 3 lines
------
L2 TLB1
GT =20SSS UUU V I
Quoted 1 line
Row Logical Physical SS TLPID TID =20
WIMGE XWR XWR F P V
Quoted 1 line
----- ----------------- ------------------- -- ----- -----=20
----- --- --- - - -
Quoted 1 line
0 c0000000-cfffffff 000000000-00fffffff 00 0 0 =20
M XWR XWR 0 1 1
Quoted 1 line
1 d0000000-dfffffff 010000000-01fffffff 00 0 0 =20
M XWR XWR 0 1 1
Quoted 1 line
2 e0000000-efffffff 020000000-02fffffff 00 0 0 =20
M XWR XWR 0 1 1
Quoted 2 lines
=20
Actually this conditional code was only used for two legacy=20functions:
Quoted 3 lines
=20
1: support KGDB to set break point.
KGDB already dropped this; now uses its core write to=20set break point.
Quoted 2 lines
=20
2:io_block_mapping()to create TLB in segmentation size=20
Quoted 8 lines
(not
PAGE_SIZE)Quoted 2 lines
for device IO space.
This use case is also removed from the latest PowerPC kernel.=20
io_block_mapping()went away, but the feature itself is still=20 useful and might come back with something like this:
=20
http://www.mail-archive.com/[email protected]/msg3
3851.html
Quoted 6 lines
=20
...though I'm not sure why such mappings would ever have user access. =20
This could end up being used for large user pages by=20 something like hugetlbfs or KVM, though. I don't think we=20 want to make large user pages fail, especailly if it just=20
Understand.=20
Actually the following is my original modification.=20 =3D=3D=3D=3D=3D=3D
+#if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_PTE_64BIT)
+ /* On there _PAGE_BAP_UR is always integrated into flag,
_PAGE_KERNEL_RWX=20
+ * and _PAGE_USER here. So we have to only check _PAGE_BAP_UR as
the condition.
+ */
+ if (flags & _PAGE_BAP_UR) {
+#else
if (flags & _PAGE_USER) {+#endif
But I find there is no any usage for this, except for the above #1> KGDB and #2 io_block_mapping(). So I think it's possible to remove this completely :)
Quoted 7 lines
happens with the 32-bit page table format (which i may not=20 what the person adding such a feature tests with). =20
I don't see a generic accessor that can test PTE flags for=20 user access -- in the absence of one, I guess we need an=20 ifdef here. Or at least put in a comment so anyone who adds=20 a userspace use knows they need to fix it.
I already notice Ben's advice and looks fine to us.
Tiejun
Quoted 8 lines
=20
-Scott
=20
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
=20