From: Alistair Francis <alistair23@gmail.com>
To: Alistair Francis <alistair.francis@xilinx.com>
Cc: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] [PATCH v2 1/1] hw: register: Run post_write hook on reset
Date: Thu, 15 Feb 2018 15:05:54 -0800 [thread overview]
Message-ID: <CAKmqyKOw-bced1cbcvJmJE_WM1_W5cEScOf8U+CaD3o9uyuXaw@mail.gmail.com> (raw)
In-Reply-To: <d131e24b911653a945e46ca2d8f90f572469e1dd.1517856214.git.alistair.francis@xilinx.com>
On Mon, Feb 5, 2018 at 10:44 AM, Alistair Francis
<alistair.francis@xilinx.com> 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.
>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Ping!
> ---
>
> V2:
> - Update the header documentation
>
> include/hw/register.h | 6 +++---
> hw/core/register.c | 8 ++++++++
> 2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/include/hw/register.h b/include/hw/register.h
> index de2414e6b4..5796584588 100644
> --- a/include/hw/register.h
> +++ b/include/hw/register.h
> @@ -34,7 +34,7 @@ typedef struct RegisterInfoArray RegisterInfoArray;
> * immediately before the actual write. The returned value is what is written,
> * giving the handler a chance to modify the written value.
> * @post_write: Post write callback. Passed the written value. Most write side
> - * effects should be implemented here.
> + * effects should be implemented here. This is called during device reset.
> *
> * @post_read: Post read callback. Passes the value that is about to be returned
> * for a read. The return value from this function is what is ultimately read,
> @@ -135,8 +135,8 @@ uint64_t register_read(RegisterInfo *reg, uint64_t re, const char* prefix,
> bool debug);
>
> /**
> - * reset a register
> - * @reg: register to reset
> + * Resets a register. This will also call the post_write hook if it exists.
> + * @reg: The register to reset.
> */
>
> void register_reset(RegisterInfo *reg);
> 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
>
next prev parent reply other threads:[~2018-02-15 23:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 18:44 [Qemu-devel] [PATCH v2 1/1] hw: register: Run post_write hook on reset Alistair Francis
2018-02-15 23:05 ` Alistair Francis [this message]
2018-02-22 19:45 ` Alistair Francis
2018-02-23 18:02 ` Peter Maydell
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=CAKmqyKOw-bced1cbcvJmJE_WM1_W5cEScOf8U+CaD3o9uyuXaw@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=alistair.francis@xilinx.com \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).