From patchwork Thu Oct 17 13:29:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 176655 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp984300ill; Thu, 17 Oct 2019 07:11:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJYoh5USKbzRwoD2GTT/QklF/M2QXguoZu8ZxxnMT6ApI6gCfwTZE75GAJf2aVtEKeJAAe X-Received: by 2002:aa7:cf12:: with SMTP id a18mr4044378edy.278.1571321473229; Thu, 17 Oct 2019 07:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571321473; cv=none; d=google.com; s=arc-20160816; b=SL5wgG8Qxn6W9pHezS5iWQMw9LQLXtXYsboGHds0kTZo0aVLFBrBUCB6C4qPpXpqHN 3jfEzEk8y5dGJdyPVwvMtfHj45GchLDQTrD36pMm9C8CVTh3JczZo2lRbm/FrgFmVzJ7 XA/9lPHfzPRmMcB/8A7TFxcNBx0OFlaCl9hOOc9hWl5f3Rs9d+EWZemCQzG5qc4DzTXU mHpEFn9Eqqf7iVwtkkLadnNN6dbJyVg4TNC09XtgAthS28uPQIa8oNxHmC8o8QbPC21f ITZHGnzex7J6mljzvJ6jVfcyZCGFKvP8TROH0LSbE6YFlhPRD6TkjefgWDUE/opqzgnq bBrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=e4PVQeNvPwVNwMTizB+ixtPW1GcJ8H+hxCE9Nf1uwZo=; b=PPYCP9ghVYa4vC6vd8HiycWeyqCpIWZBB8mDsgnq/2QExCvP9KTba9QSliSy3h4Cbz thZGjWMgFtTEoXZeTvZJ+hjOGOcnydFf1t80Oz8RjhDpoWA9BqJ0SixzD0PgbMC77OU+ yFFBKiwtAOg4FLc629AxAW5bxeSfjzm5xvgzkMYt6r06MkioavemDH1oQvpK45x/iUX2 tw2SOUtUVr21OQrxmQyRoy+cKnqAeKB/mYCO3u9HxMVbU0iInC7XVP2XExgXSfwgjiR6 Gn2wi5xYgpkaJrEAdarRrTOkctpjs2MKbWr+xYJvRKipYC9a8yJ/HZaxft21IvU034I1 B3ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LTVhSUmr; 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 n9si1515439ejs.94.2019.10.17.07.11.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2019 07:11:13 -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=LTVhSUmr; 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]:48848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL6Uh-0006Ga-QP for patch@linaro.org; Thu, 17 Oct 2019 10:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36220) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5qC-0006yj-0y for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:29:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5qA-0002bf-Rr for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:29:19 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:40220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5qA-0002bR-Lp for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:29:18 -0400 Received: by mail-wr1-x444.google.com with SMTP id o28so2360387wro.7 for ; Thu, 17 Oct 2019 06:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e4PVQeNvPwVNwMTizB+ixtPW1GcJ8H+hxCE9Nf1uwZo=; b=LTVhSUmrGS1xl2gvrwdHQT+Vc74+4ZtJZ2uW6PT0tio9svC/AvljbsMEgxUigWt5xo hEfOogmKO6LHQHk1b8IusKuQAlPuxgGODuzODc0bmt2fO69+UhUdbTEx7zsUA0Zq04R1 P+D+TEMxAHp23GA1h7nL/XWbVXWVCvrS0FQjMSFavGnG0a9ga13SuMerFJ6b4IUGIVmh iTEu4n/mdWHuKRbzhTbzffXfb75ghkqtmvNV1WdhwP6dNVaDUuFomYmZK/aE2xYB5w78 767FbU220DPKaeR7PPgSjj343ED5/4mOxbvV9hbE2buZrOA2WMX7e4wE/AO0U3vBUbzs 8tlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e4PVQeNvPwVNwMTizB+ixtPW1GcJ8H+hxCE9Nf1uwZo=; b=NcusD80xm4rFqWZgisvJdgTMMOQX+wa3IAfN6PljNHx/j2rWG2vATK177E27AFWGOj YjAvUbgJHQTCl28AWU3D9JbhOydjAUx+ThUh8q+aW9VYso0Ss+Hw6+6/GdhH9qgSsZSi O9SGO7dLAza+aEk08hBOl3t43byndEWiYZe0lrfHYgJoTqmw+5U/lqUJCX1WAkETeHag 5yCvUSDN9FXwlqgcFAUjqgBlXWUjKRtoceAVTxjmzAtUn4JZKI/I8vywNGC6ZSc91L7s Ffd+NDLJ8nTwKYCoasQzhnw/NoougyLFzE9QTP6zgD1xjgV9qH/chuzxQgQ+Vsu5HIEE 68sA== X-Gm-Message-State: APjAAAW7UMOaYGue6BZXolUW6NCvRqmeI9DTcQdhe5DxXx+3/TlfQ8G2 Qbesd1AxjdW1rJ9DTVAnEdtt62ScjoqFkA== X-Received: by 2002:adf:e7c9:: with SMTP id e9mr2996023wrn.261.1571318957465; Thu, 17 Oct 2019 06:29:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id n15sm2703392wrw.47.2019.10.17.06.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:29:16 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 7/8] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API Date: Thu, 17 Oct 2019 14:29:04 +0100 Message-Id: <20191017132905.5604-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017132905.5604-1-peter.maydell@linaro.org> References: <20191017132905.5604-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: , Cc: Thomas Huth , "Edgar E. Iglesias" , Michael Walle , Guan Xuetao , Magnus Damm Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Switch the mcf5206 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 --- hw/m68k/mcf5206.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index a49096367cb..c05401e0e50 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -8,7 +8,6 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" -#include "qemu/main-loop.h" #include "cpu.h" #include "hw/hw.h" #include "hw/irq.h" @@ -57,6 +56,7 @@ static void m5206_timer_recalibrate(m5206_timer_state *s) int prescale; int mode; + ptimer_transaction_begin(s->timer); ptimer_stop(s->timer); if ((s->tmr & TMR_RST) == 0) @@ -78,6 +78,7 @@ static void m5206_timer_recalibrate(m5206_timer_state *s) ptimer_set_limit(s->timer, s->trr, 0); ptimer_run(s->timer, 0); + ptimer_transaction_commit(s->timer); } static void m5206_timer_trigger(void *opaque) @@ -123,7 +124,9 @@ static void m5206_timer_write(m5206_timer_state *s, uint32_t addr, uint32_t val) s->tcr = val; break; case 0xc: + ptimer_transaction_begin(s->timer); ptimer_set_count(s->timer, val); + ptimer_transaction_commit(s->timer); break; case 0x11: s->ter &= ~val; @@ -137,11 +140,9 @@ static void m5206_timer_write(m5206_timer_state *s, uint32_t addr, uint32_t val) static m5206_timer_state *m5206_timer_init(qemu_irq irq) { m5206_timer_state *s; - QEMUBH *bh; s = g_new0(m5206_timer_state, 1); - bh = qemu_bh_new(m5206_timer_trigger, s); - s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT); + s->timer = ptimer_init(m5206_timer_trigger, s, PTIMER_POLICY_DEFAULT); s->irq = irq; m5206_timer_reset(s); return s;