From: James Hogan <james.hogan@imgtec.com>
To: Paul Burton <paul.burton@imgtec.com>
Cc: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>,
"Huacai Chen" <chenhc@lemote.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
<linux-kernel@vger.kernel.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH 11/12] MIPS: mm: Simplify build_update_entries
Date: Sat, 16 Apr 2016 00:09:50 +0100 [thread overview]
Message-ID: <20160415230950.GJ7859@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <1460716620-13382-12-git-send-email-paul.burton@imgtec.com>
[-- Attachment #1: Type: text/plain, Size: 3300 bytes --]
On Fri, Apr 15, 2016 at 11:36:59AM +0100, Paul Burton wrote:
> We can simplify build_update_entries by unifying the code for the 36 bit
> physical addressing with MIPS32 case with the general case, by using
> pte_off_ variables in all cases & handling the trivial
> _PAGE_GLOBAL_SHIFT == 0 case in build_convert_pte_to_entrylo. This
> leaves XPA as the only special case.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
>
> arch/mips/mm/tlbex.c | 38 +++++++++++++++++---------------------
> 1 file changed, 17 insertions(+), 21 deletions(-)
>
> diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
> index 0bd3755..45234ad 100644
> --- a/arch/mips/mm/tlbex.c
> +++ b/arch/mips/mm/tlbex.c
> @@ -626,6 +626,11 @@ static void build_tlb_write_entry(u32 **p, struct uasm_label **l,
> static __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
> unsigned int reg)
> {
> + if (_PAGE_GLOBAL_SHIFT == 0) {
> + /* pte_t is already in EntryLo format */
> + return;
> + }
> +
> if (cpu_has_rixi && _PAGE_NO_EXEC) {
> if (fill_includes_sw_bits) {
> UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL));
> @@ -1003,10 +1008,17 @@ static void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
>
> static void build_update_entries(u32 **p, unsigned int tmp, unsigned int ptep)
> {
> - if (config_enabled(CONFIG_XPA)) {
> - int pte_off_even = sizeof(pte_t) / 2;
> - int pte_off_odd = pte_off_even + sizeof(pte_t);
> + int pte_off_even = 0;
> + int pte_off_odd = sizeof(pte_t);
> +
> + if (config_enabled(CONFIG_PHYS_ADDR_T_64BIT) &&
> + config_enabled(CONFIG_32BIT)) {
> + /* The low 32 bits of EntryLo is stored in pte_high */
> + pte_off_even += offsetof(pte_t, pte_high);
> + pte_off_odd += offsetof(pte_t, pte_high);
pte_high doesn't exist unless CONFIG_CPU_MIPS32=y (e.g. you
can set CONFIG_CPU_MIPS64=y, CONFIG_CPU_MIPS32=n and CONFIG_32BIT=y).
With that fixed it looks good to me.
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cheers
James
> + }
>
> + if (config_enabled(CONFIG_XPA)) {
> uasm_i_lw(p, tmp, pte_off_even, ptep); /* even pte */
> UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL));
> UASM_i_MTC0(p, tmp, C0_ENTRYLO0);
> @@ -1025,24 +1037,8 @@ static void build_update_entries(u32 **p, unsigned int tmp, unsigned int ptep)
> return;
> }
>
> - /*
> - * 64bit address support (36bit on a 32bit CPU) in a 32bit
> - * Kernel is a special case. Only a few CPUs use it.
> - */
> - if (config_enabled(CONFIG_PHYS_ADDR_T_64BIT) && !cpu_has_64bits) {
> - int pte_off_even = sizeof(pte_t) / 2;
> - int pte_off_odd = pte_off_even + sizeof(pte_t);
> -
> - uasm_i_lw(p, tmp, pte_off_even, ptep); /* even pte */
> - UASM_i_MTC0(p, tmp, C0_ENTRYLO0);
> -
> - uasm_i_lw(p, ptep, pte_off_odd, ptep); /* odd pte */
> - UASM_i_MTC0(p, ptep, C0_ENTRYLO1);
> - return;
> - }
> -
> - UASM_i_LW(p, tmp, 0, ptep); /* get even pte */
> - UASM_i_LW(p, ptep, sizeof(pte_t), ptep); /* get odd pte */
> + UASM_i_LW(p, tmp, pte_off_even, ptep); /* get even pte */
> + UASM_i_LW(p, ptep, pte_off_odd, ptep); /* get odd pte */
> if (r45k_bvahwbug())
> build_tlb_probe_entry(p);
> build_convert_pte_to_entrylo(p, tmp);
> --
> 2.8.0
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-15 23:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1460716620-13382-1-git-send-email-paul.burton@imgtec.com>
2016-04-15 10:36 ` [PATCH 01/12] MIPS: Separate XPA CPU feature into LPA and MVH Paul Burton
2016-04-15 10:36 ` [PATCH 02/12] MIPS: Fix HTW config on XPA kernel without LPA enabled Paul Burton
2016-04-15 10:36 ` [PATCH 03/12] MIPS: Remove redundant asm/pgtable-bits.h inclusions Paul Burton
2016-04-15 19:16 ` James Hogan
2016-04-15 21:19 ` Paul Burton
2016-04-15 10:36 ` [PATCH 04/12] MIPS: Use enums to make asm/pgtable-bits.h readable Paul Burton
2016-04-15 20:29 ` James Hogan
2016-05-11 9:38 ` Ralf Baechle
2016-04-15 10:36 ` [PATCH 06/12] MIPS: mm: Unify pte_page definition Paul Burton
2016-04-15 23:16 ` James Hogan
2016-04-15 10:36 ` [PATCH 08/12] MIPS: mm: Don't clobber $1 on XPA TLB refill Paul Burton
2016-04-15 10:36 ` [PATCH 09/12] MIPS: mm: Pass scratch register through to iPTE_SW Paul Burton
2016-04-15 22:28 ` James Hogan
2016-04-15 10:36 ` [PATCH 10/12] MIPS: mm: Be more explicit about PTE mode bit handling Paul Burton
2016-04-15 10:36 ` [PATCH 11/12] MIPS: mm: Simplify build_update_entries Paul Burton
2016-04-15 23:09 ` James Hogan [this message]
2016-04-15 10:37 ` [PATCH 12/12] MIPS: mm: Don't do MTHC0 if XPA not present Paul Burton
2016-05-10 12:44 ` [PATCH 00/12] TLB/XPA fixes & cleanups Ralf Baechle
2016-05-10 17:47 ` Florian Fainelli
2016-05-11 10:03 ` Ralf Baechle
2016-05-11 19:17 ` Florian Fainelli
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=20160415230950.GJ7859@jhogan-linux.le.imgtec.org \
--to=james.hogan@imgtec.com \
--cc=chenhc@lemote.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=paul.burton@imgtec.com \
--cc=paul.gortmaker@windriver.com \
--cc=ralf@linux-mips.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome