[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-7.1 07/11] hw/misc: Support 8-bytes memop in NPCM GCR mod
From: |
Peter Maydell |
Subject: |
Re: [PATCH for-7.1 07/11] hw/misc: Support 8-bytes memop in NPCM GCR module |
Date: |
Thu, 21 Apr 2022 12:04:28 +0100 |
On Tue, 5 Apr 2022 at 23:38, Hao Wu <wuhaotsh@google.com> wrote:
>
> The NPCM8xx GCR device can be accessed with 64-bit memory operations.
> This patch supports that.
>
> Signed-off-by: Hao Wu <wuhaotsh@google.com>
> Reviewed-by: Patrick Venture <venture@google.com>
> ---
> hw/misc/npcm_gcr.c | 98 +++++++++++++++++++++++++++++++++-----------
> hw/misc/trace-events | 4 +-
> 2 files changed, 77 insertions(+), 25 deletions(-)
>
> diff --git a/hw/misc/npcm_gcr.c b/hw/misc/npcm_gcr.c
> index 14c298602a..aa81db23d7 100644
> --- a/hw/misc/npcm_gcr.c
> +++ b/hw/misc/npcm_gcr.c
> @@ -201,6 +201,7 @@ static uint64_t npcm_gcr_read(void *opaque, hwaddr
> offset, unsigned size)
> uint32_t reg = offset / sizeof(uint32_t);
> NPCMGCRState *s = opaque;
> NPCMGCRClass *c = NPCM_GCR_GET_CLASS(s);
> + uint64_t value;
>
> if (reg >= c->nr_regs) {
> qemu_log_mask(LOG_GUEST_ERROR,
> @@ -209,9 +210,23 @@ static uint64_t npcm_gcr_read(void *opaque, hwaddr
> offset, unsigned size)
> return 0;
> }
>
> - trace_npcm_gcr_read(offset, s->regs[reg]);
> + switch (size) {
> + case 4:
> + value = s->regs[reg];
> + break;
> +
> + case 8:
> + value = s->regs[reg] + (((uint64_t)s->regs[reg + 1]) << 32);
> + break;
> +
> + default:
> + g_assert_not_reached();
> + }
>
> - return s->regs[reg];
> + if (s->regs[reg] != 0) {
Why are we now only tracing the read if it's not 0 ?
> + trace_npcm_gcr_read(offset, value);
> + }
> + return value;
> }
-- PMM
- [PATCH for-7.1 02/11] hw/ssi: Make flash size a property in NPCM7XX FIU, (continued)
- [PATCH for-7.1 02/11] hw/ssi: Make flash size a property in NPCM7XX FIU, Hao Wu, 2022/04/05
- [PATCH for-7.1 08/11] hw/net: Add NPCM8XX PCS Module, Hao Wu, 2022/04/05
- [PATCH for-7.1 11/11] hw/arm: Add NPCM845 Evaluation board, Hao Wu, 2022/04/05
- [PATCH for-7.1 10/11] hw/arm: Add NPCM8XX SoC, Hao Wu, 2022/04/05
- [PATCH for-7.1 03/11] hw/misc: Support NPCM8XX GCR module, Hao Wu, 2022/04/05
- [PATCH for-7.1 07/11] hw/misc: Support 8-bytes memop in NPCM GCR module, Hao Wu, 2022/04/05
- Re: [PATCH for-7.1 07/11] hw/misc: Support 8-bytes memop in NPCM GCR module,
Peter Maydell <=
- [PATCH for-7.1 09/11] pc-bios: Add NPCM8xx Bootrom, Hao Wu, 2022/04/05
- [PATCH for-7.1 04/11] hw/misc: Support NPCM8XX CLK Module Registers, Hao Wu, 2022/04/05
- Re: [PATCH for-7.1 00/11] hw/arm: Add NPCM8XX support, Peter Maydell, 2022/04/21