qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: Glenn Miles <milesg@linux.ibm.com>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, clg@redhat.com, npiggin@gmail.com,
	thuth@redhat.com,  rathc@linux.ibm.com,
	richard.henderson@linaro.org
Subject: Re: [PATCH v6 7/9] hw/ppc: Support for an IBM PPE42 CPU decrementer
Date: Sun, 28 Sep 2025 23:21:33 +0530	[thread overview]
Message-ID: <f023d7c8-1556-448b-8cf6-1ee1cc2f7b50@linux.ibm.com> (raw)
In-Reply-To: <20250925201758.652077-8-milesg@linux.ibm.com>



On 9/26/25 01:47, Glenn Miles wrote:
> The IBM PPE42 processors support a 32-bit decrementer
> that can raise an external interrupt when DEC[0]
> transitions from a 0 to a 1 (a non-negative value to a

I guess it was meant to be 0 to -1 (0xffffffff)?
No need to re-spin just for that though.

> negative value).  It also continues decrementing
> even after this condition is met.
> 
> The BookE timer is slightly different in that it
> raises an interrupt when the DEC value reaches 0
> and stops decrementing at that point.
> 
> Support a PPE42 version of the BookE timer by
> adding a new PPC_TIMER_PPE flag that has the timer
> code look for the transition from a non-negative value
> to a negative value and allows the value to
> continue decrementing.
> 
> Signed-off-by: Glenn Miles <milesg@linux.ibm.com>

Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

> ---
>   hw/ppc/ppc_booke.c   | 7 ++++++-
>   include/hw/ppc/ppc.h | 1 +
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c
> index 3872ae2822..13403a56b1 100644
> --- a/hw/ppc/ppc_booke.c
> +++ b/hw/ppc/ppc_booke.c
> @@ -352,7 +352,12 @@ void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags)
>       booke_timer = g_new0(booke_timer_t, 1);
>   
>       cpu->env.tb_env = tb_env;
> -    tb_env->flags = flags | PPC_TIMER_BOOKE | PPC_DECR_ZERO_TRIGGERED;
> +    if (flags & PPC_TIMER_PPE) {
> +        /* PPE's use a modified version of the booke behavior */
> +        tb_env->flags = flags | PPC_DECR_UNDERFLOW_TRIGGERED;
> +    } else {
> +        tb_env->flags = flags | PPC_TIMER_BOOKE | PPC_DECR_ZERO_TRIGGERED;
> +    }
>   
>       tb_env->tb_freq    = freq;
>       tb_env->decr_freq  = freq;
> diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
> index 8a14d623f8..cb51d704c6 100644
> --- a/include/hw/ppc/ppc.h
> +++ b/include/hw/ppc/ppc.h
> @@ -52,6 +52,7 @@ struct ppc_tb_t {
>   #define PPC_DECR_UNDERFLOW_LEVEL     (1 << 4) /* Decr interrupt active when
>                                                  * the most significant bit is 1.
>                                                  */
> +#define PPC_TIMER_PPE                (1 << 5) /* Enable PPE support */
>   
>   uint64_t cpu_ppc_get_tb(ppc_tb_t *tb_env, uint64_t vmclk, int64_t tb_offset);
>   void cpu_ppc_tb_init(CPUPPCState *env, uint32_t freq);


  reply	other threads:[~2025-09-28 17:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25 20:17 [PATCH v6 0/9] Add IBM PPE42 CPU support Glenn Miles
2025-09-25 20:17 ` [PATCH v6 1/9] target/ppc: IBM PPE42 general regs and flags Glenn Miles
2025-09-25 20:17 ` [PATCH v6 2/9] target/ppc: Add IBM PPE42 family of processors Glenn Miles
2025-09-26 15:47   ` Chinmay Rath
2025-09-25 20:17 ` [PATCH v6 3/9] target/ppc: IBM PPE42 exception flags and regs Glenn Miles
2025-09-25 20:17 ` [PATCH v6 4/9] target/ppc: Add IBM PPE42 exception model Glenn Miles
2025-09-25 20:17 ` [PATCH v6 5/9] target/ppc: Support for IBM PPE42 MMU Glenn Miles
2025-09-25 20:17 ` [PATCH v6 6/9] target/ppc: Add IBM PPE42 special instructions Glenn Miles
2025-09-25 20:17 ` [PATCH v6 7/9] hw/ppc: Support for an IBM PPE42 CPU decrementer Glenn Miles
2025-09-28 17:51   ` Harsh Prateek Bora [this message]
2025-09-28 19:27     ` Richard Henderson
2025-09-28 19:33       ` Harsh Prateek Bora
2025-09-25 20:17 ` [PATCH v6 8/9] hw/ppc: Add a test machine for the IBM PPE42 CPU Glenn Miles
2025-09-25 20:17 ` [PATCH v6 9/9] tests/functional: Add test for IBM PPE42 instructions Glenn Miles

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=f023d7c8-1556-448b-8cf6-1ee1cc2f7b50@linux.ibm.com \
    --to=harshpb@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=milesg@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rathc@linux.ibm.com \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).