* [PATCH v2] target/ppc: Integrate icount to purr, vtb, and tbu40
@ 2020-08-11 15:32 Gustavo Romero
2020-08-12 21:33 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Gustavo Romero @ 2020-08-11 15:32 UTC (permalink / raw)
To: qemu-ppc; +Cc: peter.maydell, clg, david, qemu-devel, gromero
Currently if option '-icount auto' is passed to the QEMU TCG to enable
counting instructions the VM crashes with the following error report when
Linux runs on it:
qemu-system-ppc64: Bad icount read
This happens because read/write access to the SPRs PURR, VTB, and TBU40
is not integrated to the icount framework.
This commit fixes that issue by making the read/write access of these
SPRs aware of icount framework, adding the proper gen_io_start() calls
before calling the helpers to load/store these SPRs in TCG and ensuring
that the associated TBs end immediately after, accordingly to what's in
docs/devel/tcg-icount.rst.
Signed-off-by: Gustavo Romero <gromero@linux.ibm.com>
---
target/ppc/translate_init.inc.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
index 7e66822b5d..ccf9ce3441 100644
--- a/target/ppc/translate_init.inc.c
+++ b/target/ppc/translate_init.inc.c
@@ -284,12 +284,24 @@ static void spr_write_atbu(DisasContext *ctx, int sprn, int gprn)
ATTRIBUTE_UNUSED
static void spr_read_purr(DisasContext *ctx, int gprn, int sprn)
{
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_helper_load_purr(cpu_gpr[gprn], cpu_env);
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_stop_exception(ctx);
+ }
}
static void spr_write_purr(DisasContext *ctx, int sprn, int gprn)
{
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_helper_store_purr(cpu_env, cpu_gpr[gprn]);
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_stop_exception(ctx);
+ }
}
/* HDECR */
@@ -319,17 +331,35 @@ static void spr_write_hdecr(DisasContext *ctx, int sprn, int gprn)
static void spr_read_vtb(DisasContext *ctx, int gprn, int sprn)
{
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_helper_load_vtb(cpu_gpr[gprn], cpu_env);
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_stop_exception(ctx);
+ }
}
static void spr_write_vtb(DisasContext *ctx, int sprn, int gprn)
{
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_helper_store_vtb(cpu_env, cpu_gpr[gprn]);
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_stop_exception(ctx);
+ }
}
static void spr_write_tbu40(DisasContext *ctx, int sprn, int gprn)
{
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_helper_store_tbu40(cpu_env, cpu_gpr[gprn]);
+ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+ gen_stop_exception(ctx);
+ }
}
#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] target/ppc: Integrate icount to purr, vtb, and tbu40
2020-08-11 15:32 [PATCH v2] target/ppc: Integrate icount to purr, vtb, and tbu40 Gustavo Romero
@ 2020-08-12 21:33 ` Richard Henderson
2020-08-13 0:03 ` David Gibson
0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2020-08-12 21:33 UTC (permalink / raw)
To: Gustavo Romero, qemu-ppc; +Cc: qemu-devel, peter.maydell, clg, david
On 8/11/20 8:32 AM, Gustavo Romero wrote:
> Currently if option '-icount auto' is passed to the QEMU TCG to enable
> counting instructions the VM crashes with the following error report when
> Linux runs on it:
>
> qemu-system-ppc64: Bad icount read
>
> This happens because read/write access to the SPRs PURR, VTB, and TBU40
> is not integrated to the icount framework.
>
> This commit fixes that issue by making the read/write access of these
> SPRs aware of icount framework, adding the proper gen_io_start() calls
> before calling the helpers to load/store these SPRs in TCG and ensuring
> that the associated TBs end immediately after, accordingly to what's in
> docs/devel/tcg-icount.rst.
>
> Signed-off-by: Gustavo Romero <gromero@linux.ibm.com>
> ---
> target/ppc/translate_init.inc.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] target/ppc: Integrate icount to purr, vtb, and tbu40
2020-08-12 21:33 ` Richard Henderson
@ 2020-08-13 0:03 ` David Gibson
2020-08-13 2:42 ` Gustavo Romero
0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2020-08-13 0:03 UTC (permalink / raw)
To: Richard Henderson
Cc: qemu-devel, peter.maydell, qemu-ppc, clg, Gustavo Romero
[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]
On Wed, Aug 12, 2020 at 02:33:33PM -0700, Richard Henderson wrote:
> On 8/11/20 8:32 AM, Gustavo Romero wrote:
> > Currently if option '-icount auto' is passed to the QEMU TCG to enable
> > counting instructions the VM crashes with the following error report when
> > Linux runs on it:
> >
> > qemu-system-ppc64: Bad icount read
> >
> > This happens because read/write access to the SPRs PURR, VTB, and TBU40
> > is not integrated to the icount framework.
> >
> > This commit fixes that issue by making the read/write access of these
> > SPRs aware of icount framework, adding the proper gen_io_start() calls
> > before calling the helpers to load/store these SPRs in TCG and ensuring
> > that the associated TBs end immediately after, accordingly to what's in
> > docs/devel/tcg-icount.rst.
> >
> > Signed-off-by: Gustavo Romero <gromero@linux.ibm.com>
> > ---
> > target/ppc/translate_init.inc.c | 30 ++++++++++++++++++++++++++++++
> > 1 file changed, 30 insertions(+)
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Applied to ppc-for-5.2, thanks.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] target/ppc: Integrate icount to purr, vtb, and tbu40
2020-08-13 0:03 ` David Gibson
@ 2020-08-13 2:42 ` Gustavo Romero
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo Romero @ 2020-08-13 2:42 UTC (permalink / raw)
To: David Gibson, Richard Henderson
Cc: peter.maydell, Gustavo Romero, qemu-ppc, qemu-devel, clg
On 8/12/20 9:03 PM, David Gibson wrote:
> On Wed, Aug 12, 2020 at 02:33:33PM -0700, Richard Henderson wrote:
>> On 8/11/20 8:32 AM, Gustavo Romero wrote:
>>> Currently if option '-icount auto' is passed to the QEMU TCG to enable
>>> counting instructions the VM crashes with the following error report when
>>> Linux runs on it:
>>>
>>> qemu-system-ppc64: Bad icount read
>>>
>>> This happens because read/write access to the SPRs PURR, VTB, and TBU40
>>> is not integrated to the icount framework.
>>>
>>> This commit fixes that issue by making the read/write access of these
>>> SPRs aware of icount framework, adding the proper gen_io_start() calls
>>> before calling the helpers to load/store these SPRs in TCG and ensuring
>>> that the associated TBs end immediately after, accordingly to what's in
>>> docs/devel/tcg-icount.rst.
>>>
>>> Signed-off-by: Gustavo Romero <gromero@linux.ibm.com>
>>> ---
>>> target/ppc/translate_init.inc.c | 30 ++++++++++++++++++++++++++++++
>>> 1 file changed, 30 insertions(+)
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> Applied to ppc-for-5.2, thanks.
Thanks Peter, Richard and David.
Best regards,
Gustavo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-13 2:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 15:32 [PATCH v2] target/ppc: Integrate icount to purr, vtb, and tbu40 Gustavo Romero
2020-08-12 21:33 ` Richard Henderson
2020-08-13 0:03 ` David Gibson
2020-08-13 2:42 ` Gustavo Romero
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.