From patchwork Thu Oct 24 16:27:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 177574 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2471504ill; Thu, 24 Oct 2019 10:06:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfSqqJ4kCPkAkhNSLi9oQw34YvcSASGnbkUF9yves8/CmuBTzItYpIqa5twiXCaWQwlWTQ X-Received: by 2002:a17:906:f252:: with SMTP id gy18mr14874000ejb.224.1571936819162; Thu, 24 Oct 2019 10:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571936819; cv=none; d=google.com; s=arc-20160816; b=KT/U0DbCBG0IvNaaIlQXKd6cZLpBC8Ma5GoqG4ZJ1uXZ9wdKfbY/eLjYh/GgUrXuYa rhby23jd/cXcQatnWQV0FTitJPW7ECiuXj1Qry9j/WSi9nksOoj0VSDD+FJi5SOktd6C PgUPWultiYBpAhikrGn5xVoLNiDfwzz/MjUo4zTwX8blTHF4uiYEZ/XajXvOyoI1VcUk CrjRVsPXjtxOr7ADhSAwhl46NW1M4C0c5h7Zlqf7sVa1bywC2Yoma2uIxpQTtkaG9+/w WG9wBXlsVhm5iRO7uVloIjJE2jZP+umlJEAWPdneZmFA+Mao4JYWaIHHJRKV46WWD1CO TGmA== 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=uYiMMG2g4SkvD83lkxSsHqqS6mTu3zs23wVOsym/Wvk=; b=RaRw9XUlgHxtlBtTcI4lDUuH9ZjYrpLup5VrqAQ97jK3yBlSoCyZ+l2LjOyD0FzcwV mC7l1tlC0t+jhDHXYDDNh+X40OeZnZPUhT804E6/1Lv7zJ4qJxbW6Rqdx8TZxbClCbV1 Thc4YUjhsO+VFZxBwJVGvmJbFY3VMSmEvnJ5jGvHTA9Pudo/0fl5F9qS7DFrfDlI1TqZ uJ3FvkUG2gjZzXf48e/+bl8LHVr/X9nZseFTZzYG0jjjT7WZ3ylYz34OFosmcGRbWxeO W4ugPuNbru2kCW2eYyO9mfUV1bG4aewqdSFWniBoTZ3fTv2jLLGw3HUPzkxErjME5+cO gjIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGAt38FM; 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 j12si12667042ede.121.2019.10.24.10.06.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2019 10:06:59 -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=YGAt38FM; 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]:48310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNgZc-0002LH-NW for patch@linaro.org; Thu, 24 Oct 2019 13:06:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58041) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNfxz-0007io-0y for qemu-devel@nongnu.org; Thu, 24 Oct 2019 12:28:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNfxx-0000tL-PU for qemu-devel@nongnu.org; Thu, 24 Oct 2019 12:28:02 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:53657) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNfxx-0000so-JP for qemu-devel@nongnu.org; Thu, 24 Oct 2019 12:28:01 -0400 Received: by mail-wm1-x335.google.com with SMTP id n7so2717854wmc.3 for ; Thu, 24 Oct 2019 09:28:01 -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=uYiMMG2g4SkvD83lkxSsHqqS6mTu3zs23wVOsym/Wvk=; b=YGAt38FM7o8oUVR59UnnmmzkbFzAmnaIZxnUBJH6VKo1MzNxRxOTdY67M90w5P81cx JEa5pRgnv+YsIWkf6q4kRzDZrEhvetjMaYgwtVleJS6g3dSq6NUNJ8PbqKowh45oFBDZ Y8Ss6n4xbbwRiWm7cuMnX1L5gewDcVtdp1kVfg9hohP2+fgmm/AbDF/980hN/GkVQIPb xK6mk9JS+nZNeIhbq727+wgIgP7Ghl3M630OrlwsS/8g13Fj1uhpIyNSVB1J5Ki/IMpf VInc2J/nXEuHwagAht0th5U0jIFQmv64NnAPgO4xrsR74rZStfyznJzy55/AUq3QED8T SXPA== 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=uYiMMG2g4SkvD83lkxSsHqqS6mTu3zs23wVOsym/Wvk=; b=qUJ7qBQo5eZZcMELbO/yZcH//ik+zBPtFIKtvlHZmz3psSLQLpXXgD5wRplD9VC/gB SRU2S7myNFl3PSoibWMYNSnKl8kjkjyxJzdt3yhEZfjk5J+n52eziTZSOV0gCDziOVfx RnuMjHaZFeJeA9OXRrBKwCgXplXOONGJzV1tFC+a61K1GDBCt60JuhS/RUWiBuNTtLfJ qA5R1o+tudn0DbKoEHB6daH1Sn1GeI1tb/SAcgCO509PW6nyOzRYh8qMnaiwrcUgwRLe 3Lt1pWKsIi/2RDBmUkP/2D+Avuaru1ud8RYCTXUZWDHrTOQOOWKAjGwm9KCbt52UCYMh gmJw== X-Gm-Message-State: APjAAAV5eO8R7c0zW0EhQzF4L6ycEecNFSyLEM6Z+N0FEmohLd5nFoPl S5zWhX0em8R3lNOUGPqa7oTvQti2s7A= X-Received: by 2002:a05:600c:2056:: with SMTP id p22mr5677498wmg.44.1571934480301; Thu, 24 Oct 2019 09:28:00 -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.27.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 09:27:59 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/51] hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API Date: Thu, 24 Oct 2019 17:27:00 +0100 Message-Id: <20191024162724.31675-28-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::335 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 fsl_etsec 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é Reviewed-by: Alistair Francis Message-id: 20191017132122.4402-2-peter.maydell@linaro.org Signed-off-by: Peter Maydell --- hw/net/fsl_etsec/etsec.h | 1 - hw/net/fsl_etsec/etsec.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/hw/net/fsl_etsec/etsec.h b/hw/net/fsl_etsec/etsec.h index 09d05c21338..7951c3ad65f 100644 --- a/hw/net/fsl_etsec/etsec.h +++ b/hw/net/fsl_etsec/etsec.h @@ -141,7 +141,6 @@ typedef struct eTSEC { uint16_t phy_control; /* Polling */ - QEMUBH *bh; struct ptimer_state *ptimer; /* Whether we should flush the rx queue when buffer becomes available. */ diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index d9b3e8c691e..717de76569a 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -34,7 +34,6 @@ #include "etsec.h" #include "registers.h" #include "qemu/log.h" -#include "qemu/main-loop.h" #include "qemu/module.h" /* #define HEX_DUMP */ @@ -195,9 +194,11 @@ static void write_dmactrl(eTSEC *etsec, if (!(value & DMACTRL_WOP)) { /* Start polling */ + ptimer_transaction_begin(etsec->ptimer); ptimer_stop(etsec->ptimer); ptimer_set_count(etsec->ptimer, 1); ptimer_run(etsec->ptimer, 1); + ptimer_transaction_commit(etsec->ptimer); } } @@ -391,10 +392,10 @@ static void etsec_realize(DeviceState *dev, Error **errp) object_get_typename(OBJECT(dev)), dev->id, etsec); qemu_format_nic_info_str(qemu_get_queue(etsec->nic), etsec->conf.macaddr.a); - - etsec->bh = qemu_bh_new(etsec_timer_hit, etsec); - etsec->ptimer = ptimer_init_with_bh(etsec->bh, PTIMER_POLICY_DEFAULT); + etsec->ptimer = ptimer_init(etsec_timer_hit, etsec, PTIMER_POLICY_DEFAULT); + ptimer_transaction_begin(etsec->ptimer); ptimer_set_freq(etsec->ptimer, 100); + ptimer_transaction_commit(etsec->ptimer); } static void etsec_instance_init(Object *obj)