From nobody Thu Dec 18 22:21:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571071675; cv=none; d=zoho.com; s=zohoarc; b=Zh28JJ1ij6yLJgG3DvvyGotDhjb9zBBmbJtT1yNWVpYPekWi9XvcvU/nzR1qOwAQ8/op7ZAhsbuI/s7BYD0hu6DxsOAw+4ClfBeAN4Y/UUB0t17RSHtqPxRkCB8FkiBmdfRyjRtnDIeM6hDt0CPZvYMotYPNDFSXViiiNhm2XwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571071675; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eX98tShlaGosGwXWI3AYl+CKzaAZcJwin0vuso2eEqw=; b=oOEPUvnEKhn4i2TUZQFmMKVGrDueyiVTO/NmMa38vhPLdNNga40yLgqtcgyZbcxmF2RoyDv16CpBhQQuo/R2TvAaL/8PUYRF9/8/FpQubqvFKUpjou6r6ycWaMH46D8bbUuWdQPF9kumt+YZGCKlpn0za55MTf6kMZu9D+gHJGE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571071675800913.8791483399282; Mon, 14 Oct 2019 09:47:55 -0700 (PDT) Received: from localhost ([::1]:53640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK3Vi-0008DK-IB for importer@patchew.org; Mon, 14 Oct 2019 12:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36983) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK2q6-0004G7-K6 for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iK2q5-0007TF-B3 for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:54 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:33026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iK2q5-0007SR-4n for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:53 -0400 Received: by mail-wr1-x443.google.com with SMTP id b9so20411748wrs.0 for ; Mon, 14 Oct 2019 09:04:53 -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.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 09:04:51 -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=eX98tShlaGosGwXWI3AYl+CKzaAZcJwin0vuso2eEqw=; b=GCIDQ9bUDATqUyy8JB8e0XHbqhoyjCiPpxZvB+J1lG26vJMvC0q/YJ83P2ftVkJ8Nu cfHjwQeUr/U+N5JMVd7YxctCEiLamGmYpJHkaTkeKU5LOSKHjCOXVNarvu/qCneUOF/1 OnKDENRx1yBzLIZ2MF+t05kps3yp95VYErECktx+ZCD7AzT5lwwWP7+HKyrp2jz9Aeqg v/IRn2Ll5Yj65BQDDYBKWaz8YI9mMIflr5akIY6l4HhvM1IjT8yfi5kMagpjDGHnfd2m PGwqcrQqvb0g/qMmXVO8WwYARlkuiM3Qv7scF5fESF5KdG91Ff1FWgbaBaA6lcIOwcK5 0diw== 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=eX98tShlaGosGwXWI3AYl+CKzaAZcJwin0vuso2eEqw=; b=lyPGnj0nGJTFz4SflAM+Ly91kW57qcatTSznVrsp0fjSPJa/NGPwkwERgxLt2I4r34 GFqsSEyZQIC3I03OkcVF7fMvI8IGNBUOHTFvpr6VPqvWAAMn0n/6i1ht8zM4EzeTECXE dBXMFP7MSY+QqIz/IL1xD92ncn/XlhWzjM3q2G4yX9+FVY6XO9f8Q6JeBOnKV3fV83zo RlYgbIeMlUuEP5CifaVNhPFB7UvbCWX8q/xMelTZ/3eXpRlH2ow1iB4fguCkni/3oSlP 4vL9VvuUq6DXs4vgf4iwO6B8xYTlUrKDyGNWAZwPjujbRGrtlDcyCIGqYb5I5pFINGts jUcA== X-Gm-Message-State: APjAAAWnDQ6GawRQmg5k7QbyzEHE41tocGBZoaavsQcnqmzNUsmUl1/p YOG64B1Yhpa4E5MSM0Du331IDdxErXc6WQ== X-Google-Smtp-Source: APXvYqz5jAxy2M9b3C/16TKvWnMFPMkQXRgGCgA7LmnoX4FdKh2IKCleTqT4Dw8oAeU24xiDsGjyAw== X-Received: by 2002:adf:e688:: with SMTP id r8mr28619127wrm.342.1571069091899; Mon, 14 Oct 2019 09:04:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/68] hw/net/lan9118.c: Switch to transaction-based ptimer API Date: Mon, 14 Oct 2019 17:03:20 +0100 Message-Id: <20191014160404.19553-25-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 Content-Transfer-Encoding: quoted-printable 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Switch the cmsdk-apb-watchdog 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-22-peter.maydell@linaro.org --- hw/net/lan9118.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 0ea51433dca..ed551f2178b 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -21,7 +21,6 @@ #include "hw/ptimer.h" #include "hw/qdev-properties.h" #include "qemu/log.h" -#include "qemu/main-loop.h" #include "qemu/module.h" /* For crc32 */ #include @@ -450,8 +449,10 @@ static void lan9118_reset(DeviceState *d) s->e2p_data =3D 0; s->free_timer_start =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / 40; =20 + ptimer_transaction_begin(s->timer); ptimer_stop(s->timer); ptimer_set_count(s->timer, 0xffff); + ptimer_transaction_commit(s->timer); s->gpt_cfg =3D 0xffff; =20 s->mac_cr =3D MAC_CR_PRMS; @@ -1100,6 +1101,7 @@ static void lan9118_writel(void *opaque, hwaddr offse= t, break; case CSR_GPT_CFG: if ((s->gpt_cfg ^ val) & GPT_TIMER_EN) { + ptimer_transaction_begin(s->timer); if (val & GPT_TIMER_EN) { ptimer_set_count(s->timer, val & 0xffff); ptimer_run(s->timer, 0); @@ -1107,6 +1109,7 @@ static void lan9118_writel(void *opaque, hwaddr offse= t, ptimer_stop(s->timer); ptimer_set_count(s->timer, 0xffff); } + ptimer_transaction_commit(s->timer); } s->gpt_cfg =3D val & (GPT_TIMER_EN | 0xffff); break; @@ -1328,7 +1331,6 @@ static void lan9118_realize(DeviceState *dev, Error *= *errp) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); lan9118_state *s =3D LAN9118(dev); - QEMUBH *bh; int i; const MemoryRegionOps *mem_ops =3D s->mode_16bit ? &lan9118_16bit_mem_ops : &lan9118_mem_ops; @@ -1349,10 +1351,11 @@ static void lan9118_realize(DeviceState *dev, Error= **errp) s->pmt_ctrl =3D 1; s->txp =3D &s->tx_packet; =20 - bh =3D qemu_bh_new(lan9118_tick, s); - s->timer =3D ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT); + s->timer =3D ptimer_init(lan9118_tick, s, PTIMER_POLICY_DEFAULT); + ptimer_transaction_begin(s->timer); ptimer_set_freq(s->timer, 10000); ptimer_set_limit(s->timer, 0xffff, 1); + ptimer_transaction_commit(s->timer); } =20 static Property lan9118_properties[] =3D { --=20 2.20.1