From patchwork Mon Oct 14 16:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 176269 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4719808ill; Mon, 14 Oct 2019 09:18:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/li6P64jSwzZ5DQYcZBO4mrayLRt+nNpCN/lff/1xordWGa3cPRGI8Y/rJe1LdLdq/ntm X-Received: by 2002:a0c:f251:: with SMTP id z17mr16107077qvl.90.1571069908455; Mon, 14 Oct 2019 09:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571069908; cv=none; d=google.com; s=arc-20160816; b=xmTPR4A4FmC+OlB0J8ryF+YYSfKkwkcas+0JPS3d5l3Jq06ZgP3zbLYDjSAQj/DhWH fOmLLEJOrxH3eFr2nee4Ta1s5TKWgVeJ0hsDu92T4jkoldDETqCCh1gh1sfK/ON2L5E3 BoIwP/Nshmf0BdIslLJ8YFR7ujWf365bzuwwbfY45mf8qYJzOrQVDErzTZtZtXBSOrKH bdtonq2AnS3qiH6KzGiP8TUIekSHM+A9bmJsou4Cjv0Y2BSPfUBq5ZQbNYCSRWtYFlAP DK+NqoV0wSkKYHqWcdwO9QJFbmbmSMqMb37JtE1tCp7L1sVAPMzONWdi8ipP51cOBNbI 7wCw== 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=93xF/zHlNMtx3KJOnjnh3nh2MFInn1otyO8XwLGexyQ=; b=n0I7bACDaVpW8WwvcLHkCF3VyHRVjsVLcyS2eGasSIbUHmCs9wvMQCdJUQTPGPxfKm doJBh0EZOYXdRGHSyeJm8bno1PoN4SXefubplBPbfiMIgSyQ7GT/8xu+GsGuowA04Gux P1je+gw/nLdWvzECKutM2IcBn5Q4w8OHAcBJPLIspuNN62E968sPkw18VgX43aPqwIKH kSDyR63W0upVfKriVbPtkigCIny0MKSuYw9goA5PbXtQRKTFrWIAZqp1MWYhBORhMrQ+ 5O+xoltDP4eIaRtLk+N0fsvrtu1ImL4PqK/bIVUlw6VeE+35QTm77v/7O4YaLzxP/Y4Q E3cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XyLlToMU; 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 v10si17855626qta.300.2019.10.14.09.18.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Oct 2019 09:18:28 -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=XyLlToMU; 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]:53014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK33D-0003Pr-Bh for patch@linaro.org; Mon, 14 Oct 2019 12:18:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36710) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK2ph-0003ap-0q for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iK2pf-00070B-NJ for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:28 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:40692) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iK2pf-0006za-H4 for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:27 -0400 Received: by mail-wr1-x443.google.com with SMTP id h4so20406868wrv.7 for ; Mon, 14 Oct 2019 09:04:27 -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=93xF/zHlNMtx3KJOnjnh3nh2MFInn1otyO8XwLGexyQ=; b=XyLlToMURoRWcdMIZSmORyHGgRPCoUAP/hCxC63hLYneQLTt8bK5x8hB4oJ7cE9CXN F7sykh0sPpu4+N01g9jVB4+K19URZcQFSnCn53+heuZQsSyGY/Yn6dHyuSsniVFRzXg0 iQUkIvMCzN5XD/Rr9bMAPwFVk6CZ/BdoGs+RSY2z4be67HMv4jxlbrDuPLOiMC1Vi+1h j0uTXKsgiGZgItjU+WFq1/1cmO+Bq0TsRvVqWfaMIjAjnCJ1UxnyRepMSqn5EN77IlOT b7IDHn+Bf4WOcOJbhDuZWFDsqmP+OvJwzfKbKpRRsRqzb5j6nNeZ0rUcqPGEQqIGOHUf /O7Q== 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=93xF/zHlNMtx3KJOnjnh3nh2MFInn1otyO8XwLGexyQ=; b=We0jcaBD67YTIVoqqITlO8XFM7ZbN6vkJgcIdwcEjZ/K21UsuE6Ydk6mpU7+IXw2HH 80Nn2z9x7/c6jTS1fP4tKN9Zidk3KTW+qMWquOSe2JNRER941WS/ACKEpEJrwI6a8K8u R+F3gCvFGX+5BIC2OUeewZN20z0YLf02ywKZ+XbFV94PuxOQaGL61mMuNkrVPJm4/W+5 9LKoM8Isu3mg9f7IvPkzfWkmaG1Hom4s/GEa+xjaLG7rELPjvUNjohP6w8FYNj/rcgPE Z0gIcZyMx4XaOZ/jln6BOWOXSSKyauNMPoDey2XIspd62+ADThRDqKDb/s4QJKMs8cAJ ulKg== X-Gm-Message-State: APjAAAXIMxOLXxO0yoOpAnuaeqQMpVnKOlwep/vky0jpoXif1+jofVea feJLts52RcyhMztN7ZoTQdnPV8voJ4fhZw== X-Received: by 2002:a5d:5705:: with SMTP id a5mr27497595wrv.112.1571069066129; Mon, 14 Oct 2019 09:04:26 -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.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 09:04:24 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/68] hw/arm/musicpal.c: Switch to transaction-based ptimer API Date: Mon, 14 Oct 2019 17:03:04 +0100 Message-Id: <20191014160404.19553-9-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::443 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 musicpal 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 Message-id: 20191008171740.9679-6-peter.maydell@linaro.org --- hw/arm/musicpal.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index b3624d5e280..f68a399a984 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -843,13 +843,10 @@ static void mv88w8618_timer_tick(void *opaque) static void mv88w8618_timer_init(SysBusDevice *dev, mv88w8618_timer_state *s, uint32_t freq) { - QEMUBH *bh; - sysbus_init_irq(dev, &s->irq); s->freq = freq; - bh = qemu_bh_new(mv88w8618_timer_tick, s); - s->ptimer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT); + s->ptimer = ptimer_init(mv88w8618_timer_tick, s, PTIMER_POLICY_DEFAULT); } static uint64_t mv88w8618_pit_read(void *opaque, hwaddr offset, @@ -879,16 +876,19 @@ static void mv88w8618_pit_write(void *opaque, hwaddr offset, case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH: t = &s->timer[offset >> 2]; t->limit = value; + ptimer_transaction_begin(t->ptimer); if (t->limit > 0) { ptimer_set_limit(t->ptimer, t->limit, 1); } else { ptimer_stop(t->ptimer); } + ptimer_transaction_commit(t->ptimer); break; case MP_PIT_CONTROL: for (i = 0; i < 4; i++) { t = &s->timer[i]; + ptimer_transaction_begin(t->ptimer); if (value & 0xf && t->limit > 0) { ptimer_set_limit(t->ptimer, t->limit, 0); ptimer_set_freq(t->ptimer, t->freq); @@ -896,6 +896,7 @@ static void mv88w8618_pit_write(void *opaque, hwaddr offset, } else { ptimer_stop(t->ptimer); } + ptimer_transaction_commit(t->ptimer); value >>= 4; } break; @@ -914,8 +915,11 @@ static void mv88w8618_pit_reset(DeviceState *d) int i; for (i = 0; i < 4; i++) { - ptimer_stop(s->timer[i].ptimer); - s->timer[i].limit = 0; + mv88w8618_timer_state *t = &s->timer[i]; + ptimer_transaction_begin(t->ptimer); + ptimer_stop(t->ptimer); + ptimer_transaction_commit(t->ptimer); + t->limit = 0; } }