From patchwork Thu Oct 17 13:29:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 176660 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp999175ill; Thu, 17 Oct 2019 07:21:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQFIZ40SNNYP09R336atcnxZIYOAyLYOIbMUKQCXaUKlfdBxLbdmw6ZEHPMM0cVChwyA0r X-Received: by 2002:ad4:4431:: with SMTP id e17mr3995795qvt.78.1571322100514; Thu, 17 Oct 2019 07:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571322100; cv=none; d=google.com; s=arc-20160816; b=JvZ4HGa55eJgNiqoBBK7zIgmlgpz35hMGJ57ERtZOwtdGPCb2dLSmi7Qoh+N1Ykq54 N8wF1c0uxucJbMoB6d6hzcjYuIAdw6tK9sY9yIe1/9vh6AIQN8itK3NTMxq/IaKA7/pt KZb6UHJ6gBeX10URyj+qqdPmmJtTV4U0Sk1cynEkGCTC54FBMZ9XRgoUb852gcmkOgvD YOcYcGvqdE46AdDRLO/RbIe8oi/z4rbEx24L5lNZtEGiXf4A4bWl3gLBdXtN6nxWUcnt iM4vMJUe0FR13B/nlGuoAkFlTuIqkUw4i350Lt4Hfmzqs09snXUsEfPmRY7wJ10YGi1G yxww== 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=Ir767WHuQR1ReCBFZWeg1KIR738tHBrpLcvCZkSJv5k=; b=eKwO0EDi/eWw+C1m3LjFd7b71eSZdasmjJ6aYzbn8J+aGlQlYDNBxEQO/xXCkchDJE ltUNC7XFMV4Uvpcl5CLbfZnZLf0Zc/st2EyqmOVzf6Nqe7cTmD0uZQKWXYISCTjHMX5V YmImxpGrKe+YS6NGYmaM2w6r4wJDCrRDRFsmnB2JOl4JNICjSFp1Fp4B4plJRg7F7WLa tgKnw9QrzkHGkwZaMrD1qR9TmmJb2+/3nfsOGfs66c7voxvBQ4wbBGCxN2hdnnGQQwte umYSLCxVNut4oGMKhfjiTW8Ecm+coF6PcDoINT1q2FZ570iyjG53G/xJS4SinjBeZWcu K0JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r8Oo1LfX; 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 15si2485487qkb.282.2019.10.17.07.21.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2019 07:21:40 -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=r8Oo1LfX; 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]:49134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL6ep-0001w3-92 for patch@linaro.org; Thu, 17 Oct 2019 10:21:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36232) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5qD-00070a-5v for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:29:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5qB-0002by-W4 for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:29:21 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54156) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5qB-0002bo-Q2 for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:29:19 -0400 Received: by mail-wm1-x344.google.com with SMTP id i16so2578348wmd.3 for ; Thu, 17 Oct 2019 06:29:19 -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=Ir767WHuQR1ReCBFZWeg1KIR738tHBrpLcvCZkSJv5k=; b=r8Oo1LfXq/0y3GYC8eRuhsBXo+wJ1JrhKgjChbhyO5lMKQv0KRBDZX+FL9QpKSF4xz Vb5HFkfFryZyDfqH9uT+5ty+UvfimN8FykQcHB7sZH1otNwc28Vef22IzVdUuxctfURl htbVj8j9BST5mcquQ9T+eCWl37P3KGn36HcZcjBb/6D828z3j90k4s1Wz72xFsfpPKlo yiNLKWofh0iGCaAlBK1bZ85cgBkiAE5Ki7S5hYGfJIOsYLnIPKtqJU2pfcyFk4wV03mB nSqxY+rHN7qkDCdTY1k5vJ07JM19SzzAyBMdtKvkQiW2zXMkOIN02qKMGFP9f8rH80np 1xmA== 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=Ir767WHuQR1ReCBFZWeg1KIR738tHBrpLcvCZkSJv5k=; b=RgPfDDBOXi1Bbnrj6o6W8uG4xLqptod2tqMKm7x0Yha8l/M+700JdNMKymP/4Zvnm3 ImGMeOjtWiR5x5Sp5gYoVDWYE6r77bp2Ve0rsX4C3PLNP0ZGcvhIq1EBQevrXLH7NATf jmHwsuXkl/74hcRJl5E6xfA31N2s2ud0cZRs1x7WmBISL7pNsgYQQP/jqa8DDtt6pSpx iiPpwaEhoRtFq9pZyAr5Vp7Ajbq+0PiB18MWjRLmvh4DrV+kEbbHL9Mp9d9rh7q+TJWa LWPuSaDcel+XTC4t3AvYvolaaVNcIMTDDLBe1JzV5cbuUxw45AV7K0ZFvh6BKOkLO10S bEeA== X-Gm-Message-State: APjAAAXAr9HXOkGO8Kkb0kLJzYC07O5bjQpIOMQo1Un2OO9ZxGBv6Q3L 8GJTcfQKckqOPyQ+5TgPfufTPONfw1F/Uw== X-Received: by 2002:a1c:f212:: with SMTP id s18mr2808075wmc.72.1571318958591; Thu, 17 Oct 2019 06:29:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:29:18 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 8/8] hw/m68k/mcf5208.c: Switch to transaction-based ptimer API Date: Thu, 17 Oct 2019 14:29:05 +0100 Message-Id: <20191017132905.5604-9-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::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: , 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 mcf5208 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/mcf5208.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Thomas Huth diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index 34d34eba17c..158c5e4be75 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -9,7 +9,6 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/error-report.h" -#include "qemu/main-loop.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -79,6 +78,7 @@ static void m5208_timer_write(void *opaque, hwaddr offset, return; } + ptimer_transaction_begin(s->timer); if (s->pcsr & PCSR_EN) ptimer_stop(s->timer); @@ -94,8 +94,10 @@ static void m5208_timer_write(void *opaque, hwaddr offset, if (s->pcsr & PCSR_EN) ptimer_run(s->timer, 0); + ptimer_transaction_commit(s->timer); break; case 2: + ptimer_transaction_begin(s->timer); s->pmr = value; s->pcsr &= ~PCSR_PIF; if ((s->pcsr & PCSR_RLD) == 0) { @@ -104,6 +106,7 @@ static void m5208_timer_write(void *opaque, hwaddr offset, } else { ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW); } + ptimer_transaction_commit(s->timer); break; case 4: break; @@ -182,7 +185,6 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic) { MemoryRegion *iomem = g_new(MemoryRegion, 1); m5208_timer_state *s; - QEMUBH *bh; int i; /* SDRAMC. */ @@ -191,8 +193,7 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic) /* Timers. */ for (i = 0; i < 2; i++) { s = g_new0(m5208_timer_state, 1); - bh = qemu_bh_new(m5208_timer_trigger, s); - s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT); + s->timer = ptimer_init(m5208_timer_trigger, s, PTIMER_POLICY_DEFAULT); memory_region_init_io(&s->iomem, NULL, &m5208_timer_ops, s, "m5208-timer", 0x00004000); memory_region_add_subregion(address_space, 0xfc080000 + 0x4000 * i,