All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-mips: use CP0EnLo_XI instead of magic number
@ 2015-01-26 16:17 Leon Alrae
  2015-01-28 23:11 ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Alrae @ 2015-01-26 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: aurelien

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
---
 target-mips/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index 635192c..77d89be 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -4947,7 +4947,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
 #if defined(TARGET_MIPS64)
             if (ctx->rxi) {
                 TCGv tmp = tcg_temp_new();
-                tcg_gen_andi_tl(tmp, arg, (3ull << 62));
+                tcg_gen_andi_tl(tmp, arg, (3ull << CP0EnLo_XI));
                 tcg_gen_shri_tl(tmp, tmp, 32);
                 tcg_gen_or_tl(arg, arg, tmp);
                 tcg_temp_free(tmp);
@@ -5002,7 +5002,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
 #if defined(TARGET_MIPS64)
             if (ctx->rxi) {
                 TCGv tmp = tcg_temp_new();
-                tcg_gen_andi_tl(tmp, arg, (3ull << 62));
+                tcg_gen_andi_tl(tmp, arg, (3ull << CP0EnLo_XI));
                 tcg_gen_shri_tl(tmp, tmp, 32);
                 tcg_gen_or_tl(arg, arg, tmp);
                 tcg_temp_free(tmp);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] target-mips: use CP0EnLo_XI instead of magic number
  2015-01-26 16:17 [Qemu-devel] [PATCH] target-mips: use CP0EnLo_XI instead of magic number Leon Alrae
@ 2015-01-28 23:11 ` Maciej W. Rozycki
  2015-01-29 10:02   ` Leon Alrae
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2015-01-28 23:11 UTC (permalink / raw)
  To: Leon Alrae; +Cc: qemu-devel, Aurelien Jarno

On Mon, 26 Jan 2015, Leon Alrae wrote:

> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
> ---

 Enthusiastically:

Reviewed-by: Maciej W. Rozycki <macro@linux-mips.org>

 However...

> diff --git a/target-mips/translate.c b/target-mips/translate.c
> index 635192c..77d89be 100644
> --- a/target-mips/translate.c
> +++ b/target-mips/translate.c
> @@ -4947,7 +4947,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
>  #if defined(TARGET_MIPS64)
>              if (ctx->rxi) {
>                  TCGv tmp = tcg_temp_new();
> -                tcg_gen_andi_tl(tmp, arg, (3ull << 62));
> +                tcg_gen_andi_tl(tmp, arg, (3ull << CP0EnLo_XI));
>                  tcg_gen_shri_tl(tmp, tmp, 32);

... don't we need to do:

                tcg_gen_andi_tl(arg, arg, ~(3ull << CP0EnLo_XI));

here and for EntryLo1 as well (for LPA-enabled processors)?

>                  tcg_gen_or_tl(arg, arg, tmp);
>                  tcg_temp_free(tmp);

 And do we want to have CP0C3_LPA set in the few templates that do in the 
first place?  AFAICT we don't really implement LPA so this bit will 
confuse software.  Of course implementing it would be another option, not 
very complicated AFAICS, and if we can track the requirement to update 
MFC0 at that time, then the clean-up I mentioned above can be deferred 
until then.

  Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] target-mips: use CP0EnLo_XI instead of magic number
  2015-01-28 23:11 ` Maciej W. Rozycki
@ 2015-01-29 10:02   ` Leon Alrae
  2015-01-29 11:08     ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Alrae @ 2015-01-29 10:02 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: qemu-devel, Aurelien Jarno

On 28/01/2015 23:11, Maciej W. Rozycki wrote:
>> @@ -4947,7 +4947,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
>>  #if defined(TARGET_MIPS64)
>>              if (ctx->rxi) {
>>                  TCGv tmp = tcg_temp_new();
>> -                tcg_gen_andi_tl(tmp, arg, (3ull << 62));
>> +                tcg_gen_andi_tl(tmp, arg, (3ull << CP0EnLo_XI));
>>                  tcg_gen_shri_tl(tmp, tmp, 32);
> 
> ... don't we need to do:
> 
>                 tcg_gen_andi_tl(arg, arg, ~(3ull << CP0EnLo_XI));
> 
> here and for EntryLo1 as well (for LPA-enabled processors)?

Yes, this would be required if we supported LPA - good spot.

> 
>>                  tcg_gen_or_tl(arg, arg, tmp);
>>                  tcg_temp_free(tmp);
> 
>  And do we want to have CP0C3_LPA set in the few templates that do in the 
> first place?  AFAICT we don't really implement LPA so this bit will 
> confuse software.  Of course implementing it would be another option, not 
> very complicated AFAICS, and if we can track the requirement to update 
> MFC0 at that time, then the clean-up I mentioned above can be deferred 
> until then.

In general I don't think it's a good idea to indicate presence of a
feature in a CPU config if it isn't implemented at all in QEMU -- as you
said, it will confuse software. As far as LPA goes I've got already an
implementation of it (and XPA as well) which I haven't submitted
upstream yet. I'll make sure it contains the change you suggested.

Thanks,
Leon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] target-mips: use CP0EnLo_XI instead of magic number
  2015-01-29 10:02   ` Leon Alrae
@ 2015-01-29 11:08     ` Maciej W. Rozycki
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2015-01-29 11:08 UTC (permalink / raw)
  To: Leon Alrae; +Cc: qemu-devel, Aurelien Jarno

On Thu, 29 Jan 2015, Leon Alrae wrote:

> >  And do we want to have CP0C3_LPA set in the few templates that do in the 
> > first place?  AFAICT we don't really implement LPA so this bit will 
> > confuse software.  Of course implementing it would be another option, not 
> > very complicated AFAICS, and if we can track the requirement to update 
> > MFC0 at that time, then the clean-up I mentioned above can be deferred 
> > until then.
> 
> In general I don't think it's a good idea to indicate presence of a
> feature in a CPU config if it isn't implemented at all in QEMU -- as you
> said, it will confuse software. As far as LPA goes I've got already an
> implementation of it (and XPA as well) which I haven't submitted
> upstream yet. I'll make sure it contains the change you suggested.

 Great, I'll leave it to you to sort out then.  Thanks!

  Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-29 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 16:17 [Qemu-devel] [PATCH] target-mips: use CP0EnLo_XI instead of magic number Leon Alrae
2015-01-28 23:11 ` Maciej W. Rozycki
2015-01-29 10:02   ` Leon Alrae
2015-01-29 11:08     ` Maciej W. Rozycki

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.