From patchwork Mon Oct 14 16:03:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 176279 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4727174ill; Mon, 14 Oct 2019 09:24:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXrUgD7wPKDeaGYNGHg2swMkoy7SXgiHofwwVbQZantgwD8H9f0jqts3vy5Tyh+bb0wDGG X-Received: by 2002:a17:906:f54:: with SMTP id h20mr30053107ejj.55.1571070288680; Mon, 14 Oct 2019 09:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571070288; cv=none; d=google.com; s=arc-20160816; b=nbFsksl0kNJ84JZS2mGFtZM1rEJFyxlW7HTL9e8+3Fi+X9QZVimYiEyRfAxUGJ0vW1 PJhdXUAv1JQWLaruK5921NvUBVAoPbQOBjtpq9QLvHU61HlYfX9pT0dlYSLlM74wY+IS nkrkmDVomSl4R842TyIhXce+AE1wYHDb+gtvWoqQLBYh2DQkGolGCCz29t022+IeTqXD NaPfId+znLn9X41ublUKe07Ub6NRZpoC3fvqmlk7TLRNMECYhqBkcOvXOXGirDn93Q1w ANzQcKJyev+w3B2FLioAnbRAWHGBBvno8XhniXSPFZjXvcAHlXV4a2sXiAjKESK478uv +NwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XztpDdqm9Po0sAJXUNM0F/wIrobkc8nBWqHQKQVJHg8=; b=Y64KiajWVwPxXyLfRLSnZ62r1aEzeSyig6NfxwthaCCaUNLEJYeHPGZ9RsmggJLhWE II6lDzub8rq4BXZyusJHF3vCoSY8GaAtEYCsXvkIozaY7WPt/pCmB3l7PE7haUujV49Q 4zcagPv0c1X1jtdSn6/2n3kYi7MWsgr4Q36Zt7rerVmnPaPgfNetO7ydeMYCj68zK6eI XEJOl7eSQ3gjMG9c8rRkuPlqMoBiRQB6OJjMV/AF9+mjuJ2MSWYTxKozSNvUwUk6kObW 2UjqOYVHhn77Q+YMJrlMEeq0puOQPvtLCa2nT4utoySLv4iCwAU3clPMFafop8oWmoth hbcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zv1cEVIo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ch10si11164595ejb.89.2019.10.14.09.24.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Oct 2019 09:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zv1cEVIo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK39L-0003j5-5D for patch@linaro.org; Mon, 14 Oct 2019 12:24:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36822) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK2pu-0003uZ-Bv for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iK2pt-0007Fp-0z for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:42 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:43504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iK2ps-0007FE-Qt for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:40 -0400 Received: by mail-wr1-x444.google.com with SMTP id j18so20368510wrq.10 for ; Mon, 14 Oct 2019 09:04:40 -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=XztpDdqm9Po0sAJXUNM0F/wIrobkc8nBWqHQKQVJHg8=; b=Zv1cEVIokJbosWXeOopOUneuxpQyAJ5/XZmBtfjIiZIvtynD0vU6eahPrF7ZEbCVl/ 8sWHtoMBDJWiD3AUEKEAxysc0KX6odd/0MRUMgteNGpAIQU36WrWrfY0KLrCI+gc46hs MuzxFjQvO8iHutn7QKDVFczYhNU4UqyuF8MgfHi4/ajjjuB4fjHGOruX83X/TaJxTJRW G7aC7/hyO+cpZtDx74EOXjpmI3kflesN8xe8jrekYgDF/HMuwNJ9kfgXho8ivYbi7mMS XLGCspHz3VAjIBfKsmlaR1ht4GXBNaNCKkK2AqMbhJi6WJWTQmgEBwD47S81oTGZQyPi BLVg== 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=XztpDdqm9Po0sAJXUNM0F/wIrobkc8nBWqHQKQVJHg8=; b=iN0Wlf8lN63hqnVdJHXol+uE+bsQ8mKkx2tz2OWcXZzBRhdTepML2KqKE1CtrqiwO3 UtZc/xldzlJWor+owz3bFhEBh34rBvtEhn4vE5AolylZiKomsB+oDNyi+SPpXlxPQmVK EdBW3kS8va/6k1ZjfPiQI/kLCmSez0UyRUt6laoEYCd3E5YiWge5qsN/s8nX2O9wdmHy yhMA7BVoGW/+6uM5WcAZLj6QoNMlaeka94vn4MHmgnGfCfUtvVVg/h7pDOGfkvWuFlUg 5aec5yODkq9FnoYr48khwNZ5lDpRDCub53y8Mx81jgukwdXmV3LPxAIs7jrTGj98FRFJ ZFZw== X-Gm-Message-State: APjAAAW5bUSbuyAfpaDsZoWSFMqI+JmAN/b814wMB3tDh3fzIS6ajJZ3 5H1XSLxMbfixHSRteAHdQgbz6Jf7mulYxA== X-Received: by 2002:adf:d845:: with SMTP id k5mr13672425wrl.141.1571069078659; Mon, 14 Oct 2019 09:04:38 -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.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 09:04:37 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/68] hw/timer/exynos4210_mct.c: Switch LFRC to transaction-based ptimer API Date: Mon, 14 Oct 2019 17:03:11 +0100 Message-Id: <20191014160404.19553-16-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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Switch the exynos MCT LFRC timers over to the ptimer transaction API. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20191008171740.9679-13-peter.maydell@linaro.org --- hw/timer/exynos4210_mct.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index fcf91c75cc5..82803ef9a02 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -608,6 +608,7 @@ static uint64_t exynos4210_lfrc_get_count(Exynos4210MCTLT *s) /* * Set counter of FRC local timer. + * Must be called from within exynos4210_lfrc_tx_begin/commit block. */ static void exynos4210_lfrc_update_count(Exynos4210MCTLT *s) { @@ -620,6 +621,7 @@ static void exynos4210_lfrc_update_count(Exynos4210MCTLT *s) /* * Start local FRC timer + * Must be called from within exynos4210_lfrc_tx_begin/commit block. */ static void exynos4210_lfrc_start(Exynos4210MCTLT *s) { @@ -628,12 +630,25 @@ static void exynos4210_lfrc_start(Exynos4210MCTLT *s) /* * Stop local FRC timer + * Must be called from within exynos4210_lfrc_tx_begin/commit block. */ static void exynos4210_lfrc_stop(Exynos4210MCTLT *s) { ptimer_stop(s->ptimer_frc); } +/* Start ptimer transaction for local FRC timer */ +static void exynos4210_lfrc_tx_begin(Exynos4210MCTLT *s) +{ + ptimer_transaction_begin(s->ptimer_frc); +} + +/* Commit ptimer transaction for local FRC timer */ +static void exynos4210_lfrc_tx_commit(Exynos4210MCTLT *s) +{ + ptimer_transaction_commit(s->ptimer_frc); +} + /* * Local timer free running counter tick handler */ @@ -981,9 +996,9 @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s) /* local timer */ ptimer_set_freq(s->l_timer[0].tick_timer.ptimer_tick, s->freq); - ptimer_set_freq(s->l_timer[0].ptimer_frc, 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); - ptimer_set_freq(s->l_timer[1].ptimer_frc, s->freq); + tx_ptimer_set_freq(s->l_timer[1].ptimer_frc, s->freq); } } @@ -1012,7 +1027,9 @@ static void exynos4210_mct_reset(DeviceState *d) s->l_timer[i].tick_timer.count = 0; s->l_timer[i].tick_timer.distance = 0; s->l_timer[i].tick_timer.progress = 0; + exynos4210_lfrc_tx_begin(&s->l_timer[i]); ptimer_stop(s->l_timer[i].ptimer_frc); + exynos4210_lfrc_tx_commit(&s->l_timer[i]); exynos4210_ltick_timer_init(&s->l_timer[i].tick_timer); } @@ -1316,6 +1333,7 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, } /* Start or Stop local FRC if TCON changed */ + exynos4210_lfrc_tx_begin(&s->l_timer[lt_i]); if ((value & L_TCON_FRC_START) > (s->l_timer[lt_i].reg.tcon & L_TCON_FRC_START)) { DPRINTF("local timer[%d] start frc\n", lt_i); @@ -1326,6 +1344,7 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, DPRINTF("local timer[%d] stop frc\n", lt_i); exynos4210_lfrc_stop(&s->l_timer[lt_i]); } + exynos4210_lfrc_tx_commit(&s->l_timer[lt_i]); break; case L0_TCNTB: case L1_TCNTB: @@ -1477,11 +1496,11 @@ static void exynos4210_mct_init(Object *obj) /* Local timers */ for (i = 0; i < 2; i++) { bh[0] = qemu_bh_new(exynos4210_ltick_event, &s->l_timer[i]); - bh[1] = qemu_bh_new(exynos4210_lfrc_event, &s->l_timer[i]); s->l_timer[i].tick_timer.ptimer_tick = ptimer_init_with_bh(bh[0], PTIMER_POLICY_DEFAULT); s->l_timer[i].ptimer_frc = - ptimer_init_with_bh(bh[1], PTIMER_POLICY_DEFAULT); + ptimer_init(exynos4210_lfrc_event, &s->l_timer[i], + PTIMER_POLICY_DEFAULT); s->l_timer[i].id = i; }