From nobody Thu Dec 18 19:31:19 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=1571070509; cv=none; d=zoho.com; s=zohoarc; b=YUtsBF+jIMVzxC4n8exuXmVJyADgPH9/lSM8/f7U5+YTghB1jj5QAjtB0vLd8jwN63DwcJzQ2v0dK/tSpDxyulTFaKRGKqS2sJr/mu9fYytklYz2yTeCn60WUgFIvAZvS1T9Jzvj1TYBa1KeYizzoMrV3zK14ftepG5gbV+Dgu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571070509; h=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=D1T0sRshIfauupw08gYj0ltIR4hTWZeyzFS6T8DV5wA=; b=IB6Ke05GcoYzxqR82FGrl17uGAKpMXDZdo1rb5Bm14XC6WHMMBzLuenSyoKo1ohoQj+TSlCgyxPUWhAfvtspqONnO2mVn9fCKF2z8uztz/NwQSr1IZr9fuAitxQb4rvzZl386pEae0swQ/hsb252yqIIIfUs9MddTYR1Vq6Sw9w= 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 1571070509469607.2741486626376; Mon, 14 Oct 2019 09:28:29 -0700 (PDT) Received: from localhost ([::1]:53268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK3Cu-0000bd-5g for importer@patchew.org; Mon, 14 Oct 2019 12:28:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36834) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK2pv-0003wJ-8l for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iK2pt-0007GZ-Qi for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:43 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:36790) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iK2pt-0007Fz-K2 for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:41 -0400 Received: by mail-wr1-x444.google.com with SMTP id y19so20399567wrd.3 for ; Mon, 14 Oct 2019 09:04:41 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 5sm18029779wrk.86.2019.10.14.09.04.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 09:04:39 -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=D1T0sRshIfauupw08gYj0ltIR4hTWZeyzFS6T8DV5wA=; b=DAsPp9cW9JxxsjwbxVGbBS1018ipzNVUQu5R66E7LoCUS0Lqs/GAOSIm+BXtm04eUP DaWym72i3cOr/qWbRJ82g7rpDSyZwfX8lG1KxZmOdUgrHUI+dTd7M2k3FzYYEfDCvybj bqvuPo07ZTC/aD1FNYcLMgvsp+pqTMakmz8ZKA6ksTIIPveCNhB1q8eQatYChimNDZg5 aFVwTlZoeyhrcGLJAGAKqaQAi1TBbEc4ZAugGBm7OdmqmG6ft3fwJxApDtnnlfbt+XaR 7VFtnJfMFaYmp6FVo+v6nmJX6NoauG7muKXXulTnhrfpxFhouw/ycztYHqWNvLPbgexS 7sIg== 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=D1T0sRshIfauupw08gYj0ltIR4hTWZeyzFS6T8DV5wA=; b=V/ieE/LUJ7VVMtaHJmCTgBtPn/q+tGZ4I1jaevoMg3DaY3NLtCQLakcA3tvdGRlPgW qU/pSr2Wp43/APM+2xUojkHuUas36oDLIp/oM/oByZBaKpV/uvA1q0bzsE54unvNREEt blERm8SSdxGmzC1gGBsPC1juCoxUs/qiVI3eQqofVGYqOcj/k6O2lg08XsrOLVT7tc3O MNkkAfJz0FY+F1Xxn4AnIdhZtsXprzJpnsjuyGzMlW305I25L0O15wZFRWy4GgfCLsRL ryOu3GHBRtpqPCcaw+wVD8kBWFgJe2ipNHsRfeLi/0A+w5sg6vyiXmOosS1H/5M9ucoG WcpQ== X-Gm-Message-State: APjAAAW7t0Xkz5BZJ9/zO0TNvc2ODr3S3MVlGfUUynHzTb4mEHh9ZNy7 zedXO4JQiSsJ0YLZd/3zE9QwIAkJh4WMLA== X-Google-Smtp-Source: APXvYqyz0dlQR/9z5rh4I78d1P4217yw1e32Xu55L70vugcZ/DTQrigVUgHRBY8JwO9lSV3uKqkwig== X-Received: by 2002:adf:e2c5:: with SMTP id d5mr12602152wrj.283.1571069079977; Mon, 14 Oct 2019 09:04:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/68] hw/timer/exynos4210_mct.c: Switch ltick to transaction-based ptimer API Date: Mon, 14 Oct 2019 17:03:12 +0100 Message-Id: <20191014160404.19553-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014160404.19553-1-peter.maydell@linaro.org> References: <20191014160404.19553-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::444 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) Content-Type: text/plain; charset="utf-8" Switch the ltick ptimer over to the ptimer transaction API. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20191008171740.9679-14-peter.maydell@linaro.org --- hw/timer/exynos4210_mct.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 82803ef9a02..72257584145 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -58,7 +58,6 @@ #include "hw/sysbus.h" #include "migration/vmstate.h" #include "qemu/timer.h" -#include "qemu/main-loop.h" #include "qemu/module.h" #include "hw/ptimer.h" =20 @@ -735,6 +734,7 @@ static uint32_t exynos4210_ltick_int_get_cnto(struct ti= ck_timer *s) =20 /* * Start local tick cnt timer. + * Must be called within exynos4210_ltick_tx_begin/commit block. */ static void exynos4210_ltick_cnt_start(struct tick_timer *s) { @@ -750,6 +750,7 @@ static void exynos4210_ltick_cnt_start(struct tick_time= r *s) =20 /* * Stop local tick cnt timer. + * Must be called within exynos4210_ltick_tx_begin/commit block. */ static void exynos4210_ltick_cnt_stop(struct tick_timer *s) { @@ -767,6 +768,18 @@ static void exynos4210_ltick_cnt_stop(struct tick_time= r *s) } } =20 +/* Start ptimer transaction for local tick timer */ +static void exynos4210_ltick_tx_begin(struct tick_timer *s) +{ + ptimer_transaction_begin(s->ptimer_tick); +} + +/* Commit ptimer transaction for local tick timer */ +static void exynos4210_ltick_tx_commit(struct tick_timer *s) +{ + ptimer_transaction_commit(s->ptimer_tick); +} + /* * Get counter for CNT timer */ @@ -812,6 +825,7 @@ static uint32_t exynos4210_ltick_cnt_get_cnto(struct ti= ck_timer *s) =20 /* * Set new values of counters for CNT and INT timers + * Must be called within exynos4210_ltick_tx_begin/commit block. */ static void exynos4210_ltick_set_cntb(struct tick_timer *s, uint32_t new_c= nt, uint32_t new_int) @@ -885,7 +899,9 @@ static void exynos4210_ltick_recalc_count(struct tick_t= imer *s) static void exynos4210_ltick_timer_init(struct tick_timer *s) { exynos4210_ltick_int_stop(s); + exynos4210_ltick_tx_begin(s); exynos4210_ltick_cnt_stop(s); + exynos4210_ltick_tx_commit(s); =20 s->count =3D 0; s->distance =3D 0; @@ -995,9 +1011,9 @@ static void exynos4210_mct_update_freq(Exynos4210MCTSt= ate *s) tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq); =20 /* local timer */ - ptimer_set_freq(s->l_timer[0].tick_timer.ptimer_tick, s->freq); + tx_ptimer_set_freq(s->l_timer[0].tick_timer.ptimer_tick, s->freq); tx_ptimer_set_freq(s->l_timer[0].ptimer_frc, s->freq); - ptimer_set_freq(s->l_timer[1].tick_timer.ptimer_tick, s->freq); + tx_ptimer_set_freq(s->l_timer[1].tick_timer.ptimer_tick, s->freq); tx_ptimer_set_freq(s->l_timer[1].ptimer_frc, s->freq); } } @@ -1304,6 +1320,7 @@ static void exynos4210_mct_write(void *opaque, hwaddr= offset, s->l_timer[lt_i].reg.wstat |=3D L_WSTAT_TCON_WRITE; s->l_timer[lt_i].reg.tcon =3D value; =20 + exynos4210_ltick_tx_begin(&s->l_timer[lt_i].tick_timer); /* Stop local CNT */ if ((value & L_TCON_TICK_START) < (old_val & L_TCON_TICK_START)) { @@ -1331,6 +1348,7 @@ static void exynos4210_mct_write(void *opaque, hwaddr= offset, DPRINTF("local timer[%d] start int\n", lt_i); exynos4210_ltick_int_start(&s->l_timer[lt_i].tick_timer); } + exynos4210_ltick_tx_commit(&s->l_timer[lt_i].tick_timer); =20 /* Start or Stop local FRC if TCON changed */ exynos4210_lfrc_tx_begin(&s->l_timer[lt_i]); @@ -1356,8 +1374,10 @@ static void exynos4210_mct_write(void *opaque, hwadd= r offset, * Due to this we should reload timer to nearest moment when CNT is * expired and then in event handler update tcntb to new TCNTB val= ue. */ + exynos4210_ltick_tx_begin(&s->l_timer[lt_i].tick_timer); exynos4210_ltick_set_cntb(&s->l_timer[lt_i].tick_timer, value, s->l_timer[lt_i].tick_timer.icntb); + exynos4210_ltick_tx_commit(&s->l_timer[lt_i].tick_timer); =20 s->l_timer[lt_i].reg.wstat |=3D L_WSTAT_TCNTB_WRITE; s->l_timer[lt_i].reg.cnt[L_REG_CNT_TCNTB] =3D value; @@ -1486,7 +1506,6 @@ static void exynos4210_mct_init(Object *obj) int i; Exynos4210MCTState *s =3D EXYNOS4210_MCT(obj); SysBusDevice *dev =3D SYS_BUS_DEVICE(obj); - QEMUBH *bh[2]; =20 /* Global timer */ s->g_timer.ptimer_frc =3D ptimer_init(exynos4210_gfrc_event, s, @@ -1495,9 +1514,9 @@ static void exynos4210_mct_init(Object *obj) =20 /* Local timers */ for (i =3D 0; i < 2; i++) { - bh[0] =3D qemu_bh_new(exynos4210_ltick_event, &s->l_timer[i]); s->l_timer[i].tick_timer.ptimer_tick =3D - ptimer_init_with_bh(bh[0], PTIMER_POLICY_DEFAULT); + ptimer_init(exynos4210_ltick_event, &s->l_timer[i], + PTIMER_POLICY_DEFAULT); s->l_timer[i].ptimer_frc =3D ptimer_init(exynos4210_lfrc_event, &s->l_timer[i], PTIMER_POLICY_DEFAULT); --=20 2.20.1