qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>,
	Alistair Francis <alistair@alistair23.me>,
	qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH 1/3] hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API
Date: Thu, 17 Oct 2019 16:57:47 +0200	[thread overview]
Message-ID: <d95174ee-9ee1-f977-8755-2f9b3de01e0c@redhat.com> (raw)
In-Reply-To: <20191017132122.4402-2-peter.maydell@linaro.org>

On 10/17/19 3:21 PM, Peter Maydell wrote:
> Switch the fsl_etsec code away from bottom-half based ptimers to
> the new transaction-based ptimer API.  This just requires adding
> begin/commit calls around the various places that modify the ptimer
> state, and using the new ptimer_init() function to create the timer.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/net/fsl_etsec/etsec.h | 1 -
>   hw/net/fsl_etsec/etsec.c | 9 +++++----
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/net/fsl_etsec/etsec.h b/hw/net/fsl_etsec/etsec.h
> index 09d05c21338..7951c3ad65f 100644
> --- a/hw/net/fsl_etsec/etsec.h
> +++ b/hw/net/fsl_etsec/etsec.h
> @@ -141,7 +141,6 @@ typedef struct eTSEC {
>       uint16_t phy_control;
>   
>       /* Polling */
> -    QEMUBH *bh;
>       struct ptimer_state *ptimer;
>   
>       /* Whether we should flush the rx queue when buffer becomes available. */
> diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
> index d9b3e8c691e..717de76569a 100644
> --- a/hw/net/fsl_etsec/etsec.c
> +++ b/hw/net/fsl_etsec/etsec.c
> @@ -34,7 +34,6 @@
>   #include "etsec.h"
>   #include "registers.h"
>   #include "qemu/log.h"
> -#include "qemu/main-loop.h"
>   #include "qemu/module.h"
>   
>   /* #define HEX_DUMP */
> @@ -195,9 +194,11 @@ static void write_dmactrl(eTSEC          *etsec,
>   
>       if (!(value & DMACTRL_WOP)) {
>           /* Start polling */
> +        ptimer_transaction_begin(etsec->ptimer);
>           ptimer_stop(etsec->ptimer);
>           ptimer_set_count(etsec->ptimer, 1);
>           ptimer_run(etsec->ptimer, 1);
> +        ptimer_transaction_commit(etsec->ptimer);
>       }
>   }
>   
> @@ -391,10 +392,10 @@ static void etsec_realize(DeviceState *dev, Error **errp)
>                                 object_get_typename(OBJECT(dev)), dev->id, etsec);
>       qemu_format_nic_info_str(qemu_get_queue(etsec->nic), etsec->conf.macaddr.a);
>   
> -
> -    etsec->bh     = qemu_bh_new(etsec_timer_hit, etsec);
> -    etsec->ptimer = ptimer_init_with_bh(etsec->bh, PTIMER_POLICY_DEFAULT);
> +    etsec->ptimer = ptimer_init(etsec_timer_hit, etsec, PTIMER_POLICY_DEFAULT);
> +    ptimer_transaction_begin(etsec->ptimer);
>       ptimer_set_freq(etsec->ptimer, 100);
> +    ptimer_transaction_commit(etsec->ptimer);
>   }
>   
>   static void etsec_instance_init(Object *obj)
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  parent reply	other threads:[~2019-10-17 15:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 13:21 [PATCH 0/3] Convert ppc and microblaze devices to new ptimer API Peter Maydell
2019-10-17 13:21 ` [PATCH 1/3] hw/net/fsl_etsec/etsec.c: Switch to transaction-based " Peter Maydell
2019-10-17 14:13   ` Richard Henderson
2019-10-17 14:57   ` Philippe Mathieu-Daudé [this message]
2019-10-17 22:00   ` Alistair Francis
2019-10-17 13:21 ` [PATCH 2/3] hw/timer/xilinx_timer.c: " Peter Maydell
2019-10-17 14:14   ` Richard Henderson
2019-10-17 14:56   ` Philippe Mathieu-Daudé
2019-10-17 15:03     ` Peter Maydell
2019-10-17 15:24       ` Philippe Mathieu-Daudé
2019-10-17 22:00   ` Alistair Francis
2019-10-17 13:21 ` [PATCH 3/3] hw/dma/xilinx_axidma.c: " Peter Maydell
2019-10-17 14:16   ` Richard Henderson
2019-10-17 15:01   ` Philippe Mathieu-Daudé
2019-10-17 15:06     ` Peter Maydell
2019-10-17 15:25       ` Philippe Mathieu-Daudé
2019-10-17 22:02   ` Alistair Francis
2019-10-24 12:16 ` [PATCH 0/3] Convert ppc and microblaze devices to new " 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=d95174ee-9ee1-f977-8755-2f9b3de01e0c@redhat.com \
    --to=philmd@redhat.com \
    --cc=alistair@alistair23.me \
    --cc=david@gibson.dropbear.id.au \
    --cc=edgar.iglesias@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).