Message ID | 20201113110952.68086-4-tsbogend@alpha.franken.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 0df162e1377a585ced8adb932f7d6e4164e91ccf |
Headers | show |
Series | [1/4] MIPS: vdso: Use vma page protection for remapping | expand |
On Fri, Nov 13, 2020 at 12:09:52PM +0100, Thomas Bogendoerfer wrote: > Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC > and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while > setting up the page bits. So we just need one setup of protection map > and can drop the now unused (and broken for RIXI) PAGE_* defines. > > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> > --- > arch/mips/include/asm/pgtable.h | 8 ------ > arch/mips/mm/cache.c | 55 ++++++++++++++--------------------------- > 2 files changed, 18 insertions(+), 45 deletions(-) applied to mips-next. Thomas.
On Fri, Nov 13, 2020 at 12:09:52PM +0100, Thomas Bogendoerfer wrote: > Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC > and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while > setting up the page bits. So we just need one setup of protection map > and can drop the now unused (and broken for RIXI) PAGE_* defines. > > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> > --- This patch results in: drivers/video/fbdev/udlfb.c: In function 'dlfb_ops_mmap': drivers/video/fbdev/udlfb.c:343:52: error: 'PAGE_SHARED' undeclared (first use in this function) 343 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) | ^~~~~~~~~~~ when building mips:allmodconfig. Guenter --- bisect log: # bad: [3cc2bd440f2171f093b3a8480a4b54d8c270ed38] Add linux-next specific files for 20201211 # good: [0477e92881850d44910a7e94fc2c46f96faa131f] Linux 5.10-rc7 git bisect start 'HEAD' 'v5.10-rc7' # bad: [0a701401d4e29d9e73f0f3cc02179fc6c9191646] Merge remote-tracking branch 'crypto/master' git bisect bad 0a701401d4e29d9e73f0f3cc02179fc6c9191646 # bad: [196d9132cc82feb410b6386491de9ac5661b0b76] Merge remote-tracking branch 'printk/for-next' git bisect bad 196d9132cc82feb410b6386491de9ac5661b0b76 # good: [5bc192c72197553fe3b934830482caf931347c9c] Merge remote-tracking branch 'arm-soc/for-next' git bisect good 5bc192c72197553fe3b934830482caf931347c9c # bad: [24aa026d842ebfa5ff9cefe92bb3d6cc6a558206] Merge remote-tracking branch 'risc-v/for-next' git bisect bad 24aa026d842ebfa5ff9cefe92bb3d6cc6a558206 # good: [44e8eb23644eaf38dbfaf4a68d08b13c190f58c2] Merge remote-tracking branch 'm68knommu/for-next' git bisect good 44e8eb23644eaf38dbfaf4a68d08b13c190f58c2 # good: [ff57698a9610fcf7d9c4469bf68c881eff22e2f8] powerpc: Fix update form addressing in inline assembly git bisect good ff57698a9610fcf7d9c4469bf68c881eff22e2f8 # bad: [a7ab7f9e2de7e39cafa041fcba425935b2c188bf] Merge remote-tracking branch 'parisc-hd/for-next' git bisect bad a7ab7f9e2de7e39cafa041fcba425935b2c188bf # good: [724d554a117a0552c2c982f0b5cd1d685274d678] MIPS: vdso: Use vma page protection for remapping git bisect good 724d554a117a0552c2c982f0b5cd1d685274d678 # bad: [27f45b5690f7cfe916c83aaa7263ac3da7e251ee] Merge remote-tracking branch 'mips/mips-next' git bisect bad 27f45b5690f7cfe916c83aaa7263ac3da7e251ee # bad: [79109a515ac3f1009632f4a4c81597e9438a2d65] MIPS: configs: drop unused BACKLIGHT_GENERIC option git bisect bad 79109a515ac3f1009632f4a4c81597e9438a2d65 # bad: [74a2810b7c1fcd60c87a8c47f95660628e00e97c] MIPS: KASLR: Correct valid bits in apply_r_mips_26_rel() git bisect bad 74a2810b7c1fcd60c87a8c47f95660628e00e97c # bad: [0df162e1377a585ced8adb932f7d6e4164e91ccf] MIPS: mm: Clean up setup of protection map git bisect bad 0df162e1377a585ced8adb932f7d6e4164e91ccf # good: [ed2adb74217a4054a92e0a0746e31ec6f5e466c8] MIPS: mm: shorten lines by using macro git bisect good ed2adb74217a4054a92e0a0746e31ec6f5e466c8 # first bad commit: [0df162e1377a585ced8adb932f7d6e4164e91ccf] MIPS: mm: Clean up setup of protection map
On Sat, Dec 12, 2020 at 08:29:23AM -0800, Guenter Roeck wrote: > On Fri, Nov 13, 2020 at 12:09:52PM +0100, Thomas Bogendoerfer wrote: > > Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC > > and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while > > setting up the page bits. So we just need one setup of protection map > > and can drop the now unused (and broken for RIXI) PAGE_* defines. > > > > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> > > --- > > This patch results in: > > drivers/video/fbdev/udlfb.c: In function 'dlfb_ops_mmap': > drivers/video/fbdev/udlfb.c:343:52: error: 'PAGE_SHARED' undeclared (first use in this function) > 343 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) > | ^~~~~~~~~~~ > > when building mips:allmodconfig. thank you for the report, I've pushed a fix to mips-next. Thomas.
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index e5ef0fdd4838..158ba3aa3bf1 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -25,14 +25,6 @@ struct mm_struct; struct vm_area_struct; -#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_NO_READ | \ - _page_cachable_default) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_WRITE | \ - _page_cachable_default) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_NO_EXEC | \ - _page_cachable_default) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | \ - _page_cachable_default) #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ _PAGE_GLOBAL | _page_cachable_default) #define PAGE_KERNEL_NC __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index f66a8bfc030e..36bcf4e955e8 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c @@ -159,43 +159,24 @@ EXPORT_SYMBOL(_page_cachable_default); static inline void setup_protection_map(void) { - if (cpu_has_rixi) { - protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); - protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); - protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); - protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); - protection_map[4] = PM(_PAGE_PRESENT); - protection_map[5] = PM(_PAGE_PRESENT); - protection_map[6] = PM(_PAGE_PRESENT); - protection_map[7] = PM(_PAGE_PRESENT); - - protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); - protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); - protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ); - protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); - protection_map[12] = PM(_PAGE_PRESENT); - protection_map[13] = PM(_PAGE_PRESENT); - protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE); - protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE); - - } else { - protection_map[0] = PAGE_NONE; - protection_map[1] = PAGE_READONLY; - protection_map[2] = PAGE_COPY; - protection_map[3] = PAGE_COPY; - protection_map[4] = PAGE_READONLY; - protection_map[5] = PAGE_READONLY; - protection_map[6] = PAGE_COPY; - protection_map[7] = PAGE_COPY; - protection_map[8] = PAGE_NONE; - protection_map[9] = PAGE_READONLY; - protection_map[10] = PAGE_SHARED; - protection_map[11] = PAGE_SHARED; - protection_map[12] = PAGE_READONLY; - protection_map[13] = PAGE_READONLY; - protection_map[14] = PAGE_SHARED; - protection_map[15] = PAGE_SHARED; - } + protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); + protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); + protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); + protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); + protection_map[4] = PM(_PAGE_PRESENT); + protection_map[5] = PM(_PAGE_PRESENT); + protection_map[6] = PM(_PAGE_PRESENT); + protection_map[7] = PM(_PAGE_PRESENT); + + protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); + protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); + protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | + _PAGE_NO_READ); + protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); + protection_map[12] = PM(_PAGE_PRESENT); + protection_map[13] = PM(_PAGE_PRESENT); + protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE); + protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE); } #undef PM
Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while setting up the page bits. So we just need one setup of protection map and can drop the now unused (and broken for RIXI) PAGE_* defines. Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> --- arch/mips/include/asm/pgtable.h | 8 ------ arch/mips/mm/cache.c | 55 ++++++++++++++--------------------------- 2 files changed, 18 insertions(+), 45 deletions(-)