From patchwork Thu Oct 24 16:27:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 177581 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2478971ill; Thu, 24 Oct 2019 10:13:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL43vB1IworVx2pxnUG3Pu9Lb2hKA9HAsT1He7254JFyODYa09VfltXZF1AC+G3yXhmv7F X-Received: by 2002:a05:6402:b17:: with SMTP id bm23mr44058513edb.6.1571937194607; Thu, 24 Oct 2019 10:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571937194; cv=none; d=google.com; s=arc-20160816; b=j6JRMdBMKPaYc+fv31xlO241fHQPxRLa+/WFAxV6DrqNrCACUriAi7wp6wRnzV4pNR gla9mbFWaFwi2BFOEseojEPSgYlqOy0Bs/hFtaJ3KC8E5VxTQff968Z5p2tXElUq+HHB b7zn6n3hnOfJN8bMkVDpCnT+n5qBqJGa6Ho66YhZuE98v6UHAioFrFIGdjc629YPQi// 3C1tUZaUXyuH5feKmKqafA2SWKNRlGfyfuF5DfA/Lm7sdQTntlUPDjPRJLCl8cp2b9oJ l4+qw3N9f8ZEc35fUKZYCwLxrA9RVGTBwrSToXzBrqmF3Orhydj6qCjgVCuXK4C+UySs R7zA== 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=J21kyHeYFa+RY7GcWXJAZvmmTTUgznnvXHxn75vs05A=; b=UuWp+w24GkghhYv5ZNxcbS0V0mQsfwZ7YH1snns5yfu36ptitiOyy8ZqeWtTYjjlqR egDJ/MSsbhUO6U3r5a8d3V5GfyGfFZVBYwECSK5+s904Bnm8Yq27JcQrab0P91kwCGFG 0eGUz6t736IZmtzYr2eVBBrTZchLfBymd3tNTVPH++kqMOXJtJERS+Ffnl/1TXG6Yrq/ Cy10uvYLIWH61GZ7xtuheQSgK+Be7GaQta3bRqOOAhdD3H+yGgOQZJczp2ICNyN/5k0D kYLFyTpEYgWSao0pux1xzPHoGnT44zpORNlVktUae6Aq5iJdWQOylk8/QHDr/xfz9Ubk gzdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c1UvOL+Z; 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 w11si15066041eji.160.2019.10.24.10.13.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2019 10:13:14 -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=c1UvOL+Z; 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]:48416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNgfg-0007Rc-Ht for patch@linaro.org; Thu, 24 Oct 2019 13:13:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58148) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNfy7-0007z8-KI for qemu-devel@nongnu.org; Thu, 24 Oct 2019 12:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNfy6-0000xi-FA for qemu-devel@nongnu.org; Thu, 24 Oct 2019 12:28:11 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:39015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNfy6-0000xE-9N for qemu-devel@nongnu.org; Thu, 24 Oct 2019 12:28:10 -0400 Received: by mail-wr1-x442.google.com with SMTP id a11so10714966wra.6 for ; Thu, 24 Oct 2019 09:28:09 -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=J21kyHeYFa+RY7GcWXJAZvmmTTUgznnvXHxn75vs05A=; b=c1UvOL+ZcoyfHigvuNr9oOa5gz0YKfEj0cmPw1DuUWoh8Vs8g4zcGqK/GoizhB01UP 8xAwfC+vkMGHnUyb/m1jmCr291Rf+v8Ope1LltBpzSPj4WIJPVDRq/QNaZreT5XIm/+Q AVuYYP3aA0tMqDIqo25vzdFAhWGJj/1NHXBxPd6LgoPGIn5fTIb8PIomw6egGo/L7EE0 oxDnVPLalMSAbL1R4VQpCcf2FJX+rSFgT4PzbH/aAdmN6L8s/5PvdcUfdOSntg4p7B3i RoM7zlKrpqtkvEs1/I9gGZIrqNGecTdjCfjQVxtTWKLXrDK/SpZhtdWgAxg+EB1gbcK/ dowg== 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=J21kyHeYFa+RY7GcWXJAZvmmTTUgznnvXHxn75vs05A=; b=nTVFQvhvE/xcTeGfFk4MWdicMrLU2lylXFGzEi2cN4o4xNn3VodQyl7ZTAwzx9sTkU ThBEYhvGDjWeUkw0ZaNeRRfNZurAf7SZ6Xtb3KMVbw1VzE0l7KeiXgVpqkBytdjfQu/d uUtsx+B8ka1b6TTOBfICT+oUijY5OJ3ZCdalAKbZr6VfGFRJ+4wuB2QMDppj3dhysz4R iQ/tg0ySH0vHdBWzIFK9C+TLRL6JtcEfgVuQBMolmgYVbVKaCzzj/vDA6zPajTb1+4Xi 1dfYp+IuCN4QaKccMTL/ez3hmA/hLKABqulCXxdAAiINi+0G1JjKwT8JijyL/j8r5v9Y wsrw== X-Gm-Message-State: APjAAAUHaFmKAUy5EcBwBt3CyUzA7fzVF96zmjzjSByZjRSYVekd/PT9 bJHXhBhPFCv2IJwx31/Grri8+zNVl8E= X-Received: by 2002:adf:f04e:: with SMTP id t14mr4448645wro.106.1571934488067; Thu, 24 Oct 2019 09:28:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id r27sm42606124wrc.55.2019.10.24.09.28.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 09:28:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/51] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API Date: Thu, 24 Oct 2019 17:27:06 +0100 Message-Id: <20191024162724.31675-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191024162724.31675-1-peter.maydell@linaro.org> References: <20191024162724.31675-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::442 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 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 Reviewed-by: Thomas Huth Message-id: 20191021140600.10725-1-peter.maydell@linaro.org --- hw/m68k/mcf5206.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index a49096367cb..b155dd81705 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,10 +56,12 @@ 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) - return; + if ((s->tmr & TMR_RST) == 0) { + goto exit; + } prescale = (s->tmr >> 8) + 1; mode = (s->tmr >> 1) & 3; @@ -78,6 +79,8 @@ static void m5206_timer_recalibrate(m5206_timer_state *s) ptimer_set_limit(s->timer, s->trr, 0); ptimer_run(s->timer, 0); +exit: + ptimer_transaction_commit(s->timer); } static void m5206_timer_trigger(void *opaque) @@ -123,7 +126,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 +142,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;