From nobody Thu Dec 18 19:36:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571751528; cv=none; d=zoho.com; s=zohoarc; b=JmFngawiVBhSEJFbaN/FSwusZsFrqQRnwR1T2D4mUo6xnZP61b4hH1ozpswCdakR69KeAOS3r0vxRUeAlTjJoScmxcw4Ildo7svMrWIPlLaQOg1ik6tsKPK+GxRp5HdX3nHGsEwWO6g4+LDbAAF4/zmc+La2r/JdM+ZHBMzhtc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571751528; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c/CnNVHFORCd4oE1CaU05xljf7UHrrubl901brpFpx8=; b=QxXZBz5OJRwKm8McHyPwkgov+CJRY+H8qw8c/ElqUmzibh43v0v+Vtf7DfC/m5r23mVYbtZY/DvhSWRgj6EVU9/Dm4qnLeKaw6Roj7WpZ9MOJ3lxKX776P4EqfIkwICUBkLUCnx7cJg79tO3A5rnbXCwHvAvjmEmQZGE7L8iFK8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571751528117579.7923233059176; Tue, 22 Oct 2019 06:38:48 -0700 (PDT) Received: from localhost ([::1]:57492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuN4-000283-Gj for importer@patchew.org; Tue, 22 Oct 2019 09:38:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36694) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuGc-0002T1-15 for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMuGa-0001Ev-KV for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:05 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:53086) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMuGZ-0001Eg-Tl for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:04 -0400 Received: by mail-wm1-x344.google.com with SMTP id r19so17321817wmh.2 for ; Tue, 22 Oct 2019 06:32:03 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id r2sm20263856wma.1.2019.10.22.06.32.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 06:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=c/CnNVHFORCd4oE1CaU05xljf7UHrrubl901brpFpx8=; b=bDjuAcZwrG2L0E+zhgbnXzRSlXp0zQbaQBvued8E766giyJPloeZh2zxlF1EosCXet AIzzX/amIY+mwhnMByzqpxqVPRn8PL+Zs41YG/aMuCeB03leQJ05tMyr+xDEPgbEwnPk Ve/0Oh3bkL6iKUkZm+xs5fL6sNdGfi/FhtsSSNelaGiUXQtAsk7RATN0uCuo+Z8gNQxB hIe/t2PejtpNp26p0CtZxwaoTlYjQ2gZMrbAt+4K76DTqObHdKc3SzgckpAHM4X/3nTg gFAsm7bMf2C6SrcyW43Rr1Q/q2vaOwWVYPyj9Wt8cqambFLX4LTVufkOk32Z9p2kFGmr F5tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c/CnNVHFORCd4oE1CaU05xljf7UHrrubl901brpFpx8=; b=Yze5Z4VfMMrC57/BWIwIZmFazrx7ii15EOuwaQ2ixh9FyhoDuY8qy/R1s7XJClefzR kkcD+af5yL7vy7FIleZbfo/OfIK5ByfXPr/8wtpTr7HTbwFIxJV8Vbqevs5fkVPRlntO lS0sr/G8Z/G/oR+hQJCEXhE/ezU/Vse25pH2Q0TrCjkau6bwPWva7lUqfZEC/OM9Ri+B WQtJ76Lpn/KZc4EfwyHtclc63z0btZfjJSANdjw91UJREFOF2EHaLi48S1fXXkZTWdvh 6Rf1M6kr1aC53/IjoFevUlYzBIC1gODbtoareTV8hTzmjJMTnSrNm4FeviLdyK2UOBrg 0sbg== X-Gm-Message-State: APjAAAU2LNjhvnAZ+e1eHLLza4bLDD3r+NAUqQ1rvX29sJN9cGam50hK loYNm1grm4HZb7UQyI2rwRSzi5OdJSE= X-Google-Smtp-Source: APXvYqxQRgdyvqkAXssBt2SyO5G906Jk+QDIsPEDz4CYVWM4QV7LY99rTYbKryPW3Sh1YhSbx9dn9w== X-Received: by 2002:a1c:6a04:: with SMTP id f4mr3151360wmc.60.1571751122530; Tue, 22 Oct 2019 06:32:02 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/41] hw/watchdog/etraxfs_timer.c: Switch to transaction-based ptimer API Date: Tue, 22 Oct 2019 14:31:02 +0100 Message-Id: <20191022133134.14487-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191022133134.14487-1-peter.maydell@linaro.org> References: <20191022133134.14487-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Switch the etraxfs_timer 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 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191017132905.5604-7-peter.maydell@linaro.org --- hw/timer/etraxfs_timer.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index ab27fe1895b..afe3d30a8ea 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -26,7 +26,6 @@ #include "hw/sysbus.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" -#include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/timer.h" #include "hw/irq.h" @@ -59,9 +58,6 @@ typedef struct ETRAXTimerState { qemu_irq irq; qemu_irq nmi; =20 - QEMUBH *bh_t0; - QEMUBH *bh_t1; - QEMUBH *bh_wd; ptimer_state *ptimer_t0; ptimer_state *ptimer_t1; ptimer_state *ptimer_wd; @@ -155,6 +151,7 @@ static void update_ctrl(ETRAXTimerState *t, int tnum) } =20 D(printf ("freq_hz=3D%d div=3D%d\n", freq_hz, div)); + ptimer_transaction_begin(timer); ptimer_set_freq(timer, freq_hz); ptimer_set_limit(timer, div, 0); =20 @@ -176,6 +173,7 @@ static void update_ctrl(ETRAXTimerState *t, int tnum) abort(); break; } + ptimer_transaction_commit(timer); } =20 static void timer_update_irq(ETRAXTimerState *t) @@ -240,6 +238,7 @@ static inline void timer_watchdog_update(ETRAXTimerStat= e *t, uint32_t value) =20 t->wd_hits =3D 0; =20 + ptimer_transaction_begin(t->ptimer_wd); ptimer_set_freq(t->ptimer_wd, 760); if (wd_cnt =3D=3D 0) wd_cnt =3D 256; @@ -250,6 +249,7 @@ static inline void timer_watchdog_update(ETRAXTimerStat= e *t, uint32_t value) ptimer_stop(t->ptimer_wd); =20 t->rw_wd_ctrl =3D value; + ptimer_transaction_commit(t->ptimer_wd); } =20 static void @@ -311,9 +311,15 @@ static void etraxfs_timer_reset(void *opaque) { ETRAXTimerState *t =3D opaque; =20 + ptimer_transaction_begin(t->ptimer_t0); ptimer_stop(t->ptimer_t0); + ptimer_transaction_commit(t->ptimer_t0); + ptimer_transaction_begin(t->ptimer_t1); ptimer_stop(t->ptimer_t1); + ptimer_transaction_commit(t->ptimer_t1); + ptimer_transaction_begin(t->ptimer_wd); ptimer_stop(t->ptimer_wd); + ptimer_transaction_commit(t->ptimer_wd); t->rw_wd_ctrl =3D 0; t->r_intr =3D 0; t->rw_intr_mask =3D 0; @@ -325,12 +331,9 @@ static void etraxfs_timer_realize(DeviceState *dev, Er= ror **errp) ETRAXTimerState *t =3D ETRAX_TIMER(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 - t->bh_t0 =3D qemu_bh_new(timer0_hit, t); - t->bh_t1 =3D qemu_bh_new(timer1_hit, t); - t->bh_wd =3D qemu_bh_new(watchdog_hit, t); - t->ptimer_t0 =3D ptimer_init_with_bh(t->bh_t0, PTIMER_POLICY_DEFAULT); - t->ptimer_t1 =3D ptimer_init_with_bh(t->bh_t1, PTIMER_POLICY_DEFAULT); - t->ptimer_wd =3D ptimer_init_with_bh(t->bh_wd, PTIMER_POLICY_DEFAULT); + t->ptimer_t0 =3D ptimer_init(timer0_hit, t, PTIMER_POLICY_DEFAULT); + t->ptimer_t1 =3D ptimer_init(timer1_hit, t, PTIMER_POLICY_DEFAULT); + t->ptimer_wd =3D ptimer_init(watchdog_hit, t, PTIMER_POLICY_DEFAULT); =20 sysbus_init_irq(sbd, &t->irq); sysbus_init_irq(sbd, &t->nmi); --=20 2.20.1