[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH qemu v2 1/2] ppc: Define SETFIELD for the ppc target
From: |
Peter Maydell |
Subject: |
Re: [PATCH qemu v2 1/2] ppc: Define SETFIELD for the ppc target |
Date: |
Tue, 21 Jun 2022 13:59:14 +0100 |
On Fri, 17 Jun 2022 at 07:20, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>
> It keeps repeating, move it to the header. This uses __builtin_ctzl() to
> allow using the macros in #define.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> include/hw/pci-host/pnv_phb3_regs.h | 16 ----------------
> target/ppc/cpu.h | 5 +++++
> hw/intc/pnv_xive.c | 20 --------------------
> hw/intc/pnv_xive2.c | 20 --------------------
> hw/pci-host/pnv_phb4.c | 16 ----------------
> 5 files changed, 5 insertions(+), 72 deletions(-)
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 6d78078f379d..9a1f1e9999a3 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -47,6 +47,11 @@
> PPC_BIT32(bs))
> #define PPC_BITMASK8(bs, be) ((PPC_BIT8(bs) - PPC_BIT8(be)) |
> PPC_BIT8(bs))
>
> +#define GETFIELD(mask, word) \
> + (((word) & (mask)) >> __builtin_ctzl(mask))
> +#define SETFIELD(mask, word, val) \
> + (((word) & ~(mask)) | (((uint64_t)(val) << __builtin_ctzl(mask)) &
> (mask)))
Can we retain the explanatory comment that says why we don't
use the standard QEMU mechanism for field extraction
(ie the FIELD_EX*/FIELD_DP* macros and the extract64()/deposit64()
functions) ?
> -/*
> - * QEMU version of the GETFIELD/SETFIELD macros
> - *
> - * TODO: It might be better to use the existing extract64() and
> - * deposit64() but this means that all the register definitions will
> - * change and become incompatible with the ones found in skiboot.
> - *
> - * Keep it as it is for now until we find a common ground.
> - */
thanks
-- PMM
- Re: [PATCH qemu v2 2/2] ppc/spapr: Implement H_WATCHDOG, (continued)
[PATCH qemu v2 1/2] ppc: Define SETFIELD for the ppc target, Alexey Kardashevskiy, 2022/06/17
Re: [PATCH qemu v2 1/2] ppc: Define SETFIELD for the ppc target, Cédric Le Goater, 2022/06/18
Re: [PATCH qemu v2 1/2] ppc: Define SETFIELD for the ppc target,
Peter Maydell <=
Re: [PATCH qemu v2 1/2] ppc: Define SETFIELD for the ppc target, Daniel Henrique Barboza, 2022/06/24
Re: [PATCH qemu v2 0/2] ppc/spapr: Implement H_WATCHDOG, Daniel Henrique Barboza, 2022/06/17