From: James Hogan <james.hogan@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>,
Ralf Baechle <ralf@linux-mips.org>, <linux-mips@linux-mips.org>
Subject: Re: [PATCH 1/9] MIPS: traps: 64bit kernels should read CP0_EBase 64bit
Date: Wed, 5 Oct 2016 16:56:54 +0100 [thread overview]
Message-ID: <20161005155653.GG15578@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <alpine.LFD.2.20.1610021038190.25303@eddie.linux-mips.org>
[-- Attachment #1: Type: text/plain, Size: 2138 bytes --]
Hi Maciej,
On Sun, Oct 02, 2016 at 11:30:13AM +0100, Maciej W. Rozycki wrote:
> On Wed, 21 Sep 2016, Matt Redfearn wrote:
>
> > > > When reading the CP0_EBase register containing the WG (write gate) bit,
> > > > the ebase variable should be set to the full value of the register, i.e.
> > > > on a 64-bit kernel the full 64-bit width of the register via
> > > > read_cp0_ebase_64(), and on a 32-bit kernel the full 32-bit width
> > > > including bits 31:30 which may be writeable.
> > > How about changing the definition of read/write_c0_ebase to
> > >
> > > #define read_c0_ebase() __read_ulong_c0_register($15, 1)
> > > #define write_c0_ebase(val) __write_ulong_c0_register($15, 1, val)
> >
> > James added the {read,write}_c0_ebase_64 functions in
> > 37fb60f8e3f011c25c120081a73886ad8dbc42fd, because performing a 64bit access to
> > 32bit cp0 registers (like ebase on 32bit cpus) was an undefined operation
> > pre-r6, so we can't always access them as longs.
>
> Well, `long' is 32-bit with 32-bit processors, however in older (as in:
> before 3.50) architecture revisions EBase was 32-bit even with 64-bit
> processors,
> so I take it you meant "like ebase on 64bit cpus", right?
>
> > > or using a new variant like
> > >
> > > #define read_c0_ebase_ulong() __read_ulong_c0_register($15, 1)
> > > #define write_c0_ebase_ulong(val) __write_ulong_c0_register($15, 1, val)
> > >
> > > to avoid the ifdefery? This could also make this bit
> > >
> > > ebase = cpu_has_mips64r6 ? read_c0_ebase_64()
> > > : (s32)read_c0_ebase();
> >
> > This relies on being able to determine a 64bit value for ebase, either by
> > reading it in its entirety on a 64bit cpu (including on a 32bit kernel) or sign
> > extending it from a 32bit read.
>
> This does look wrong to me, as I noted above EBase is 64-bit with MIPS64
> processors as from architecture revision 3.50. Also I don't think we want
MIPS64 PRA (I'm looking at r5 and r6) seems to allow for write-gate not
to be implemented, in which case the register is only 32-bits.
Cheers
James
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>,
Ralf Baechle <ralf@linux-mips.org>,
linux-mips@linux-mips.org
Subject: Re: [PATCH 1/9] MIPS: traps: 64bit kernels should read CP0_EBase 64bit
Date: Wed, 5 Oct 2016 16:56:54 +0100 [thread overview]
Message-ID: <20161005155653.GG15578@jhogan-linux.le.imgtec.org> (raw)
Message-ID: <20161005155654.wIgahK1UUNkDWswFNR_zwuz9TDHpm3Cug5kHQAKzqxA@z> (raw)
In-Reply-To: <alpine.LFD.2.20.1610021038190.25303@eddie.linux-mips.org>
[-- Attachment #1: Type: text/plain, Size: 2138 bytes --]
Hi Maciej,
On Sun, Oct 02, 2016 at 11:30:13AM +0100, Maciej W. Rozycki wrote:
> On Wed, 21 Sep 2016, Matt Redfearn wrote:
>
> > > > When reading the CP0_EBase register containing the WG (write gate) bit,
> > > > the ebase variable should be set to the full value of the register, i.e.
> > > > on a 64-bit kernel the full 64-bit width of the register via
> > > > read_cp0_ebase_64(), and on a 32-bit kernel the full 32-bit width
> > > > including bits 31:30 which may be writeable.
> > > How about changing the definition of read/write_c0_ebase to
> > >
> > > #define read_c0_ebase() __read_ulong_c0_register($15, 1)
> > > #define write_c0_ebase(val) __write_ulong_c0_register($15, 1, val)
> >
> > James added the {read,write}_c0_ebase_64 functions in
> > 37fb60f8e3f011c25c120081a73886ad8dbc42fd, because performing a 64bit access to
> > 32bit cp0 registers (like ebase on 32bit cpus) was an undefined operation
> > pre-r6, so we can't always access them as longs.
>
> Well, `long' is 32-bit with 32-bit processors, however in older (as in:
> before 3.50) architecture revisions EBase was 32-bit even with 64-bit
> processors,
> so I take it you meant "like ebase on 64bit cpus", right?
>
> > > or using a new variant like
> > >
> > > #define read_c0_ebase_ulong() __read_ulong_c0_register($15, 1)
> > > #define write_c0_ebase_ulong(val) __write_ulong_c0_register($15, 1, val)
> > >
> > > to avoid the ifdefery? This could also make this bit
> > >
> > > ebase = cpu_has_mips64r6 ? read_c0_ebase_64()
> > > : (s32)read_c0_ebase();
> >
> > This relies on being able to determine a 64bit value for ebase, either by
> > reading it in its entirety on a 64bit cpu (including on a 32bit kernel) or sign
> > extending it from a 32bit read.
>
> This does look wrong to me, as I noted above EBase is 64-bit with MIPS64
> processors as from architecture revision 3.50. Also I don't think we want
MIPS64 PRA (I'm looking at r5 and r6) seems to allow for write-gate not
to be implemented, in which case the register is only 32-bits.
Cheers
James
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-10-06 16:03 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 16:30 [PATCH 0/9] MIPS: General EVA fixes & cleanups James Hogan
2016-09-01 16:30 ` [PATCH 1/9] MIPS: traps: 64bit kernels should read CP0_EBase 64bit James Hogan
2016-09-01 16:30 ` James Hogan
2016-09-21 13:08 ` Ralf Baechle
2016-09-21 15:01 ` Matt Redfearn
2016-09-21 15:01 ` Matt Redfearn
2016-10-02 10:30 ` Maciej W. Rozycki
2016-10-05 15:56 ` James Hogan [this message]
2016-10-05 15:56 ` James Hogan
2016-10-06 16:18 ` Maciej W. Rozycki
2016-10-06 18:05 ` James Hogan
2016-10-06 18:05 ` James Hogan
2016-10-06 19:56 ` Maciej W. Rozycki
2016-10-06 20:19 ` James Hogan
2016-10-06 20:19 ` James Hogan
2016-10-06 22:41 ` Maciej W. Rozycki
2016-10-06 22:50 ` James Hogan
2016-10-06 22:50 ` James Hogan
2016-10-06 23:07 ` Maciej W. Rozycki
2016-10-07 15:35 ` David Daney
2016-10-07 15:41 ` David Daney
2016-10-07 17:39 ` Maciej W. Rozycki
2016-09-01 16:30 ` [PATCH 2/9] MIPS: traps: Convert ebase to KSeg0 James Hogan
2016-09-01 16:30 ` James Hogan
2016-09-01 16:30 ` [PATCH 3/9] MIPS: traps: Ensure full EBase is written James Hogan
2016-09-01 16:30 ` James Hogan
2016-09-21 13:19 ` Ralf Baechle
2016-09-01 16:30 ` [PATCH 4/9] MIPS: c-r4k: Drop bc_wback_inv() from icache flush James Hogan
2016-09-01 16:30 ` James Hogan
2016-09-01 16:30 ` [PATCH 5/9] MIPS: c-r4k: Split user/kernel flush_icache_range() James Hogan
2016-09-01 16:30 ` James Hogan
2016-09-01 16:30 ` [PATCH 6/9] MIPS: cacheflush: Use __flush_icache_user_range() James Hogan
2016-09-01 16:30 ` James Hogan
2016-09-01 16:30 ` [PATCH 7/9] MIPS: uprobes: Flush icache via kernel address James Hogan
2016-09-01 16:30 ` James Hogan
2016-09-21 13:26 ` Ralf Baechle
2016-09-21 18:15 ` Leonid Yegoshin
2016-09-21 18:15 ` Leonid Yegoshin
2016-09-22 21:15 ` James Hogan
2016-09-22 21:15 ` James Hogan
2016-09-22 21:38 ` Leonid Yegoshin
2016-09-22 21:38 ` Leonid Yegoshin
2016-09-22 21:42 ` Leonid Yegoshin
2016-09-22 21:42 ` Leonid Yegoshin
2016-09-22 22:13 ` James Hogan
2016-09-22 22:27 ` Leonid Yegoshin
2016-09-22 22:27 ` Leonid Yegoshin
2016-09-23 7:10 ` James Hogan
2016-09-01 16:30 ` [PATCH 8/9] MIPS: KVM: Use __local_flush_icache_user_range() James Hogan
2016-09-01 16:30 ` [PATCH 9/9] MIPS: c-r4k: Fix flush_icache_range() for EVA James Hogan
2016-09-01 16:30 ` James Hogan
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=20161005155653.GG15578@jhogan-linux.le.imgtec.org \
--to=james.hogan@imgtec.com \
--cc=linux-mips@linux-mips.org \
--cc=macro@linux-mips.org \
--cc=matt.redfearn@imgtec.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