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>,
"Adam Buchbinder" <adam.buchbinder@gmail.com>,
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 09/12] MIPS: mm: Pass scratch register through to iPTE_SW
Date: Fri, 15 Apr 2016 23:28:54 +0100 [thread overview]
Message-ID: <20160415222854.GI7859@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <1460716620-13382-10-git-send-email-paul.burton@imgtec.com>
[-- Attachment #1: Type: text/plain, Size: 4724 bytes --]
On Fri, Apr 15, 2016 at 11:36:57AM +0100, Paul Burton wrote:
> Rather than hardcode a scratch register for the XPA case in iPTE_SW,
> pass one through from the work registers allocated by the caller. This
> allows for the XPA path to function correctly regardless of the work
> registers in use.
Looks good to me, although probably worth mentioning that the current
behaviour uses the $1 register, so this fixes another case of $1
clobbering.
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cheers
James
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
>
> arch/mips/mm/tlbex.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
> index 004cd9f..d7a7b3d 100644
> --- a/arch/mips/mm/tlbex.c
> +++ b/arch/mips/mm/tlbex.c
> @@ -1526,14 +1526,12 @@ iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr)
>
> static void
> iPTE_SW(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr,
> - unsigned int mode)
> + unsigned int mode, unsigned int scratch)
> {
> #ifdef CONFIG_PHYS_ADDR_T_64BIT
> unsigned int hwmode = mode & (_PAGE_VALID | _PAGE_DIRTY);
>
> if (config_enabled(CONFIG_XPA) && !cpu_has_64bits) {
> - const int scratch = 1; /* Our extra working register */
> -
> uasm_i_lui(p, scratch, (mode >> 16));
> uasm_i_or(p, pte, pte, scratch);
> } else
> @@ -1630,11 +1628,11 @@ build_pte_present(u32 **p, struct uasm_reloc **r,
> /* Make PTE valid, store result in PTR. */
> static void
> build_make_valid(u32 **p, struct uasm_reloc **r, unsigned int pte,
> - unsigned int ptr)
> + unsigned int ptr, unsigned int scratch)
> {
> unsigned int mode = _PAGE_VALID | _PAGE_ACCESSED;
>
> - iPTE_SW(p, r, pte, ptr, mode);
> + iPTE_SW(p, r, pte, ptr, mode, scratch);
> }
>
> /*
> @@ -1670,12 +1668,12 @@ build_pte_writable(u32 **p, struct uasm_reloc **r,
> */
> static void
> build_make_write(u32 **p, struct uasm_reloc **r, unsigned int pte,
> - unsigned int ptr)
> + unsigned int ptr, unsigned int scratch)
> {
> unsigned int mode = (_PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID
> | _PAGE_DIRTY);
>
> - iPTE_SW(p, r, pte, ptr, mode);
> + iPTE_SW(p, r, pte, ptr, mode, scratch);
> }
>
> /*
> @@ -1780,7 +1778,7 @@ static void build_r3000_tlb_load_handler(void)
> build_r3000_tlbchange_handler_head(&p, K0, K1);
> build_pte_present(&p, &r, K0, K1, -1, label_nopage_tlbl);
> uasm_i_nop(&p); /* load delay */
> - build_make_valid(&p, &r, K0, K1);
> + build_make_valid(&p, &r, K0, K1, -1);
> build_r3000_tlb_reload_write(&p, &l, &r, K0, K1);
>
> uasm_l_nopage_tlbl(&l, p);
> @@ -1811,7 +1809,7 @@ static void build_r3000_tlb_store_handler(void)
> build_r3000_tlbchange_handler_head(&p, K0, K1);
> build_pte_writable(&p, &r, K0, K1, -1, label_nopage_tlbs);
> uasm_i_nop(&p); /* load delay */
> - build_make_write(&p, &r, K0, K1);
> + build_make_write(&p, &r, K0, K1, -1);
> build_r3000_tlb_reload_write(&p, &l, &r, K0, K1);
>
> uasm_l_nopage_tlbs(&l, p);
> @@ -1842,7 +1840,7 @@ static void build_r3000_tlb_modify_handler(void)
> build_r3000_tlbchange_handler_head(&p, K0, K1);
> build_pte_modifiable(&p, &r, K0, K1, -1, label_nopage_tlbm);
> uasm_i_nop(&p); /* load delay */
> - build_make_write(&p, &r, K0, K1);
> + build_make_write(&p, &r, K0, K1, -1);
> build_r3000_pte_reload_tlbwi(&p, K0, K1);
>
> uasm_l_nopage_tlbm(&l, p);
> @@ -2010,7 +2008,7 @@ static void build_r4000_tlb_load_handler(void)
> }
> uasm_l_tlbl_goaround1(&l, p);
> }
> - build_make_valid(&p, &r, wr.r1, wr.r2);
> + build_make_valid(&p, &r, wr.r1, wr.r2, wr.r3);
> build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
>
> #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
> @@ -2124,7 +2122,7 @@ static void build_r4000_tlb_store_handler(void)
> build_pte_writable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbs);
> if (m4kc_tlbp_war())
> build_tlb_probe_entry(&p);
> - build_make_write(&p, &r, wr.r1, wr.r2);
> + build_make_write(&p, &r, wr.r1, wr.r2, wr.r3);
> build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
>
> #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
> @@ -2180,7 +2178,7 @@ static void build_r4000_tlb_modify_handler(void)
> if (m4kc_tlbp_war())
> build_tlb_probe_entry(&p);
> /* Present and writable bits set, set accessed and dirty bits. */
> - build_make_write(&p, &r, wr.r1, wr.r2);
> + build_make_write(&p, &r, wr.r1, wr.r2, wr.r3);
> build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
>
> #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
> --
> 2.8.0
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-15 22:28 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 [this message]
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
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=20160415222854.GI7859@jhogan-linux.le.imgtec.org \
--to=james.hogan@imgtec.com \
--cc=adam.buchbinder@gmail.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
all inboxes | Powered by JetHome®