From nobody Wed Nov 12 15:02:12 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=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571320336; cv=none; d=zoho.com; s=zohoarc; b=H4iwuq1qOG3l39RvsiPYhhR5Rk8vz+6E5atrI+6LrWaetkc6/+4XqF22yn6+UCbZZKbpxm/RYVzemKAtm40WqYJLQdh8kZr6EhgXXwig7JPKz4EunVrDRdIMsOv5VElW00JxCmETxti/J4as3/I9XrZf1njuyln0kwlttHIKdnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571320336; h=Content-Transfer-Encoding:Cc: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=DQC4XpSmd8PGYvkUObRMkiwdpTVp4qnrLAv8MVPjMfc=; b=fRA/4jF9p6WSjLDTp6vz0rL46oV8HjaWvtprzQKtGgPA++bYixwPDlWnEiYqzrKqs4qY9cKm5FVLrenVOqWoaub3zPjBG3vQuReVt1h8QEzDWXNwJgqr5/h5dnY96WguV34kcApPvNI67wyypzjBY3/mdjUW55h7ilH3KMG/At0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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=fail 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 1571320336888673.4332994939483; Thu, 17 Oct 2019 06:52:16 -0700 (PDT) Received: from localhost ([::1]:48420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL6CN-0007xv-11 for importer@patchew.org; Thu, 17 Oct 2019 09:52:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34962) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5ic-00051M-HC for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:21:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5ib-0000Ox-5x for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:21:30 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:34289) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5ia-0000NA-Vz for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:21:29 -0400 Received: by mail-wm1-x342.google.com with SMTP id y135so7032247wmc.1 for ; Thu, 17 Oct 2019 06:21:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e9sm11543164wme.3.2019.10.17.06.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:21:27 -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=DQC4XpSmd8PGYvkUObRMkiwdpTVp4qnrLAv8MVPjMfc=; b=BXoRk4ipvCCHTzB5RH6mflZFBLDZYC2GIPWZuUYfvFaTPwMcEDViqdxSZo+QUkPufI niPgKR7Skh6NKKRwAtfthFcSPc38C0OgDt06iA89Z1tXnDJyBOgXt+wW40OIQI3Dmlj3 RkcRAWLWjpy6ltoaZrrE8UPBa6VAOdrY+CspInsGbIPB5RC3iXBmRcaNWOhiXDKsNdrU 93GaLbwRDIQIfnctVCd7SouAj71maxDOBx5purizGDt4zWlOiZpYJyQnW/ExQx9v5uWh kFWSMiRc1wtBny+TFLKicoCBYmdO5sfN6YplLZmDpSxFgM6/5tdNEUVYA9O7PmQvFpqB 6NQQ== 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=DQC4XpSmd8PGYvkUObRMkiwdpTVp4qnrLAv8MVPjMfc=; b=RvrOjGWk1C7dL9pzyd8OxFCi4pLbUagFnMcqq2hljDBTATcFNDuzF2M1w7YRCsgWJ5 cb4PkXhNcLfzqahGjNXqAI4+JrkhoQFHdtjBJMYgnnQb13BQmyI+yqf9opUo/tkpH5Pd KfUPOeP6dHTsHtO1KHf4ngwdnG2VLt4TppsQHG9UZ5PU6Su3NG56NryHG4Hiebsimsu4 pI/7+UdXtrLfM4zJqIo20A7Rtjo4UBx24hOzMT9/bBDtB4oYsWuW7tLHr/aC8MJ7b6AO MKraLjKwigLPprpVk80Sfhf4I+9xdwT76w0Hjx8BkXUdJrbo50g8zxdy2POaB/fpe/TJ 4IvQ== X-Gm-Message-State: APjAAAXOSueYP2dyia+5jSzJGjkW/FdkTzE9PyCXM8CIqYJd6gZWALKj 5QqUHi5Jz6/kH2JKDBf1yVaX40nnd8pAKA== X-Google-Smtp-Source: APXvYqxW/k0kSnsy2TV3ex98SGBPoAJS1zfNU5j5xKsAp0Lr/7nMlCQmKXphXax43zgqOzs7kJQR+Q== X-Received: by 2002:a7b:c444:: with SMTP id l4mr2915340wmi.49.1571318487648; Thu, 17 Oct 2019 06:21:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 2/3] hw/timer/xilinx_timer.c: Switch to transaction-based ptimer API Date: Thu, 17 Oct 2019 14:21:21 +0100 Message-Id: <20191017132122.4402-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017132122.4402-1-peter.maydell@linaro.org> References: <20191017132122.4402-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::342 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: Jason Wang , Alistair Francis , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, "Edgar E. Iglesias" , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Switch the xilinx_timer 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: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/timer/xilinx_timer.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c index 92dbff304d9..7191ea54f58 100644 --- a/hw/timer/xilinx_timer.c +++ b/hw/timer/xilinx_timer.c @@ -28,7 +28,6 @@ #include "hw/ptimer.h" #include "hw/qdev-properties.h" #include "qemu/log.h" -#include "qemu/main-loop.h" #include "qemu/module.h" =20 #define D(x) @@ -52,7 +51,6 @@ =20 struct xlx_timer { - QEMUBH *bh; ptimer_state *ptimer; void *parent; int nr; /* for debug. */ @@ -134,6 +132,7 @@ timer_read(void *opaque, hwaddr addr, unsigned int size) return r; } =20 +/* Must be called inside ptimer transaction block */ static void timer_enable(struct xlx_timer *xt) { uint64_t count; @@ -174,8 +173,11 @@ timer_write(void *opaque, hwaddr addr, value &=3D ~TCSR_TINT; =20 xt->regs[addr] =3D value & 0x7ff; - if (value & TCSR_ENT) + if (value & TCSR_ENT) { + ptimer_transaction_begin(xt->ptimer); timer_enable(xt); + ptimer_transaction_commit(xt->ptimer); + } break; =20 default: @@ -220,9 +222,10 @@ static void xilinx_timer_realize(DeviceState *dev, Err= or **errp) =20 xt->parent =3D t; xt->nr =3D i; - xt->bh =3D qemu_bh_new(timer_hit, xt); - xt->ptimer =3D ptimer_init_with_bh(xt->bh, PTIMER_POLICY_DEFAULT); + xt->ptimer =3D ptimer_init(timer_hit, xt, PTIMER_POLICY_DEFAULT); + ptimer_transaction_begin(xt->ptimer); ptimer_set_freq(xt->ptimer, t->freq_hz); + ptimer_transaction_commit(xt->ptimer); } =20 memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, "xlnx.xps-ti= mer", --=20 2.20.1