All of lore.kernel.org
 help / color / mirror / Atom feed
From: 黄沛 <huangpei@loongson.cn>
To: "周琰杰 (Zhou Yanjie)" <zhouyanjie@wanyeetech.com>,
	tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, paul.burton@mips.com,
	paul@crapouillou.net, siyanteng@loongson.cn, ira.weiny@intel.com,
	yangtiezhu@loongson.cn, zhouyanjie@wanyeetech.com,
	jun.jiang@ingenic.com, dongsheng.qiu@ingenic.com,
	aric.pzqi@ingenic.com, rick.tyliu@ingenic.com,
	sernia.zhou@foxmail.com
Subject: Re: [PATCH] Revert "MIPS: make userspace mapping young by default".
Date: Fri, 16 Apr 2021 17:20:03 +0800	[thread overview]
Message-ID: <20210416092003.5754967.19768.9603@loongson.cn> (raw)
In-Reply-To: <1618562868-91115-1-git-send-email-zhouyanjie@wanyeetech.com>

Is there any log about the panic?

  Original Message  
From: 周琰杰 (Zhou Yanjie)
Sent: 2021年4月16日星期五 16:48
To: tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org; linux-kernel@vger.kernel.org; akpm@linux-foundation.org; paul.burton@mips.com; paul@crapouillou.net; siyanteng@loongson.cn; huangpei@loongson.cn; ira.weiny@intel.com; yangtiezhu@loongson.cn; zhouyanjie@wanyeetech.com; jun.jiang@ingenic.com; dongsheng.qiu@ingenic.com; aric.pzqi@ingenic.com; rick.tyliu@ingenic.com; sernia.zhou@foxmail.com
Subject: [PATCH] Revert "MIPS: make userspace mapping young by default".

This reverts commit f685a533a7fab35c5d069dcd663f59c8e4171a75.

It cause kernel panic on Ingenic X1830, so let's revert it.

Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
---
arch/mips/mm/cache.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 7719d63..9cfd432 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -21,7 +21,6 @@
#include <asm/cpu.h>
#include <asm/cpu-features.h>
#include <asm/setup.h>
-#include <asm/pgtable.h>

/* Cache operations. */
void (*flush_cache_all)(void);
@@ -157,31 +156,29 @@ unsigned long _page_cachable_default;
EXPORT_SYMBOL(_page_cachable_default);

#define PM(p)	__pgprot(_page_cachable_default | (p))
-#define PVA(p)	PM(_PAGE_VALID | _PAGE_ACCESSED | (p))

static inline void setup_protection_map(void)
{
protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
-	protection_map[1] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC);
-	protection_map[2] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
-	protection_map[3] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC);
-	protection_map[4] = PVA(_PAGE_PRESENT);
-	protection_map[5] = PVA(_PAGE_PRESENT);
-	protection_map[6] = PVA(_PAGE_PRESENT);
-	protection_map[7] = PVA(_PAGE_PRESENT);
+	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] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC);
-	protection_map[10] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE |
+	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] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
-	protection_map[12] = PVA(_PAGE_PRESENT);
-	protection_map[13] = PVA(_PAGE_PRESENT);
-	protection_map[14] = PVA(_PAGE_PRESENT);
-	protection_map[15] = PVA(_PAGE_PRESENT);
+	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 _PVA
#undef PM

void cpu_cache_init(void)
-- 
2.7.4


  reply	other threads:[~2021-04-16  9:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  8:47 [PATCH] Revert "MIPS: make userspace mapping young by default" 周琰杰 (Zhou Yanjie)
2021-04-16  9:20 ` 黄沛 [this message]
     [not found]   ` <ae06522f-eda8-96d1-6f58-072905afa65c@wanyeetech.com>
2021-04-19  4:56     ` Huang Pei
2021-04-19 14:21       ` Zhou Yanjie
2021-04-20  2:48         ` Huang Pei
2021-04-20 13:47           ` Zhou Yanjie
2021-04-20 14:03           ` Zhou Yanjie
2021-04-23 14:51             ` Thomas Bogendoerfer
2021-04-24 11:24               ` Zhou Yanjie
2021-04-26 13:11                 ` Huang Pei
2021-04-29 18:04                   ` Thomas Bogendoerfer
2021-04-30  2:07                     ` Huang Pei
2021-05-08  8:48                     ` Zhou Yanjie
2021-05-26  9:43 Thomas Bogendoerfer
2021-05-26 20:49 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210416092003.5754967.19768.9603@loongson.cn \
    --to=huangpei@loongson.cn \
    --cc=akpm@linux-foundation.org \
    --cc=aric.pzqi@ingenic.com \
    --cc=dongsheng.qiu@ingenic.com \
    --cc=ira.weiny@intel.com \
    --cc=jun.jiang@ingenic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paul.burton@mips.com \
    --cc=paul@crapouillou.net \
    --cc=rick.tyliu@ingenic.com \
    --cc=sernia.zhou@foxmail.com \
    --cc=siyanteng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    --cc=yangtiezhu@loongson.cn \
    --cc=zhouyanjie@wanyeetech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.