From patchwork Tue Oct 22 13:31:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 177170 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp4882240ill; Tue, 22 Oct 2019 06:41:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOyj+dte5bjXDzKIDjpp9J+uLzoI0PWBHyckCx9rqHTkPC9LMoT3KalQHDCgYi953L7rUS X-Received: by 2002:a37:c44b:: with SMTP id h11mr2840576qkm.150.1571751709968; Tue, 22 Oct 2019 06:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571751709; cv=none; d=google.com; s=arc-20160816; b=DLTcuXUd484hODJTIBa9brTPmEpKaOCWuw2tcXGRTvfd3jQ9ehQcfdlSKcJryVi6n/ sG+ZVyvhZR5B8pXlL0S9g/VqmokAz+MqnRoqx5F5FuNM11r+tygqFyKcBo4qK1qgbo/8 YZsf0KcHLmmZMbrWsvvrXxCUjFO89qRRknPYYdtoi+ZlQ9Uzpd34txhghTLPdO/vVZml X7DrC9ha3upZhNb/dinMxGs38xJp6+kiGBYlXRjzTwQ98QDP/s/eOHoCgUKOLpossETW IONtTW5tmfzPBNipfEZa7h+Z/iPFlXmmrCCeZhOWuPOApJ3CFjXcU24+lkG6Ux5Tw7Lv 1MQQ== 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=Fwd2iBNusbM/OQvc1QbvND2II8QsKKZ6PUURuQhaBB0=; b=aeCNpUTI5W0SMao69Rs4LS73tmH8SuvPMhIHyAyJS9R5gPz6FJqsNIfgKfY2Pu/PgQ /4VVGVEVrjcCbPVsq208PsmOUtiu2Bsw0LjwB2O6CFg95VVerOLl/SmeDv5nYoJ1cBDn UrWG8goJKQJbGxJUF5Tpog98TYYgKCmjKT3xoi22MdF5PLYhF+kIM5rMEJByfwNmdTey IV4Gqc2bQxad/uIrjkmRPb8AYC6ffwWOKWNDOgYLE6Gg4PMIjpKHOyrU4sghcEOkuVjY hxrijfSmsmOjnR1hCdD7zf3YBkfGkMsk2miLFFKySDw1rcCRx52StMjoXZXMMTbmgyU/ pcrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XHjSRSNb; 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 v34si17592730qtd.70.2019.10.22.06.41.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Oct 2019 06:41:49 -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=XHjSRSNb; 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]:57552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuQ1-00060d-D4 for patch@linaro.org; Tue, 22 Oct 2019 09:41:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36706) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuGd-0002Tu-8c for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMuGb-0001FE-Ul for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:07 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35168) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMuGb-0001F1-OV for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:05 -0400 Received: by mail-wm1-x341.google.com with SMTP id v9so266503wml.0 for ; Tue, 22 Oct 2019 06:32:05 -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=Fwd2iBNusbM/OQvc1QbvND2II8QsKKZ6PUURuQhaBB0=; b=XHjSRSNbhRJY+4m6I3uwOrSX8IB4HQ+2R9Jwy5wfDz0Bk/vkpAAsW+RqC1KoFspqRC vt/PEbSbenMjJcKttgn/DYhdsMhIP4Gw2KYZxnCRaNgc8B8vaAY9Bbx/lZJ0cCPz48Mh gLLTuo7EIxwpVFkVu/6XhuflpMPjdx3EaYdlMvrDiBM4PleiXQMt17z99gnCZ5LdGTea 2wR8kARrS8zA3vwwbYd/cToTGZDEiNPiWuIOP9lLX+Fldq9dIWoT5GDmI/Fm1hwkBjVy AY9EuEXsqlWxOA1MEPWxQUsd5W4IL/KQIy+tr7UQbukk8x4CG058l/DBbe8vm7Z0VP2z j0SQ== 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=Fwd2iBNusbM/OQvc1QbvND2II8QsKKZ6PUURuQhaBB0=; b=dw2CSy2VLfDwwn+eSjGByMd3ZVx8BixjH5dYpfetCSEDen8Z4SW4/8i7lbZMqXWNSH 9k7RyXXWxyGBSHoIPaxOzGkDG3YJM3UtB4gxmcFckI6PRAIztfhCE3WeFPdhElmPvm9B 5EPNhuM6x4KmrAwRQFeom5+HQ+0Pz2/luh1LXQBmZ3vPv3Yl8lL9crfScL8Rc3RL6a8n owI6icJqqhgdF5GRNKXfPeaf40eX7pQbrUOridd7zSCtIegh3bhsfLQFhBtAUunLAhLx kUXL09AEdqb0Yjj5AwBpIlbwdNUzdQ+X/a9PcKIgwkw90JnubpYFS4IjVLppMWEomian eOjg== X-Gm-Message-State: APjAAAXzMlQlNYVZm5NgXNQmN7bwKMaIYxJFwFgNftV0WSQWiNutzDV4 LVKvn8JRELJXJ0cTmQX+zTGtbGv4Jso= X-Received: by 2002:a1c:7d95:: with SMTP id y143mr3197804wmc.143.1571751124203; Tue, 22 Oct 2019 06:32:04 -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.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 06:32:03 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/41] hw/m68k/mcf5208.c: Switch to transaction-based ptimer API Date: Tue, 22 Oct 2019 14:31:03 +0100 Message-Id: <20191022133134.14487-11-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 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 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 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Thomas Huth Message-id: 20191017132905.5604-9-peter.maydell@linaro.org --- hw/m68k/mcf5208.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.20.1 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,