[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 1/1] hw: register: Run post_write hook on res
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH v1 1/1] hw: register: Run post_write hook on reset |
Date: |
Fri, 2 Feb 2018 17:24:08 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
Hi Alistair,
On 02/02/2018 04:38 PM, Alistair Francis wrote:
> Ensure that the post write hook is called during reset. This allows us
> to rely on the post write functions instead of having to call them from
> the reset() function.
This makes sens. Can you add a comment about this new behavior in
include/hw/register.h?
>
> Signed-off-by: Alistair Francis <address@hidden>
with comment:
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>
> hw/core/register.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/core/register.c b/hw/core/register.c
> index 900294b9c4..0741a1af32 100644
> --- a/hw/core/register.c
> +++ b/hw/core/register.c
> @@ -159,13 +159,21 @@ uint64_t register_read(RegisterInfo *reg, uint64_t re,
> const char* prefix,
>
> void register_reset(RegisterInfo *reg)
> {
> + const RegisterAccessInfo *ac;
> +
> g_assert(reg);
>
> if (!reg->data || !reg->access) {
> return;
> }
>
> + ac = reg->access;
> +
> register_write_val(reg, reg->access->reset);
> +
> + if (ac->post_write) {
> + ac->post_write(reg, reg->access->reset);
> + }
> }
>
> void register_init(RegisterInfo *reg)
>