All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v1 1/1] hw: register: Run post_write hook on reset
@ 2018-02-02 19:38 Alistair Francis
  2018-02-02 20:24 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Alistair Francis @ 2018-02-02 19:38 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: alistair.francis, alistair23

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.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
---

 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)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v1 1/1] hw: register: Run post_write hook on reset
  2018-02-02 19:38 [Qemu-devel] [PATCH v1 1/1] hw: register: Run post_write hook on reset Alistair Francis
@ 2018-02-02 20:24 ` Philippe Mathieu-Daudé
  2018-02-02 23:24   ` Alistair Francis
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-02-02 20:24 UTC (permalink / raw)
  To: Alistair Francis, qemu-devel, peter.maydell; +Cc: alistair23

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 <alistair.francis@xilinx.com>

with comment:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
> 
>  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)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v1 1/1] hw: register: Run post_write hook on reset
  2018-02-02 20:24 ` Philippe Mathieu-Daudé
@ 2018-02-02 23:24   ` Alistair Francis
  0 siblings, 0 replies; 3+ messages in thread
From: Alistair Francis @ 2018-02-02 23:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Alistair Francis, qemu-devel@nongnu.org Developers, Peter Maydell

On Fri, Feb 2, 2018 at 12:24 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> 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?

Yep, fixed in V2 which I'll send out next week.

Alistair

>
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>
> with comment:
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
>> ---
>>
>>  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)
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-02 23:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 19:38 [Qemu-devel] [PATCH v1 1/1] hw: register: Run post_write hook on reset Alistair Francis
2018-02-02 20:24 ` Philippe Mathieu-Daudé
2018-02-02 23:24   ` Alistair Francis

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.