From patchwork Thu Sep 22 16:35:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 608243 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp493726pvb; Thu, 22 Sep 2022 11:08:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZrkRHhlidDbT4hvYyJzOmFhO13trLR62laoPqqQVmgZLzNs9cGqWASRPf9pQiD4iAwBS1 X-Received: by 2002:a37:a84a:0:b0:6cd:edee:f9af with SMTP id r71-20020a37a84a000000b006cdedeef9afmr3173582qke.600.1663870123215; Thu, 22 Sep 2022 11:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663870123; cv=none; d=google.com; s=arc-20160816; b=G5g8s0iKiZmfCnHT0Ryeo1pFlftwk7pM72k/3wkeyoTvXHW8Obs1T6xl38OeWjCfrs b0/Qq4WqKAlyWvuqx8um6vIDZ68muESxOplUnmGwUBSd+zO/UjGAv7G5hKuikesxYupp 0cUyA9FaH1qOPZT6DLAhttrT18K0EXmeSNzEwDUyADFq1+T5WdBDdzIVMfzOsJG/H61U ZD+3MJR4lZV3cv8IZ9NhqaKrmyxBovYVYGIa5X0Lza9RCXK36QBDFCieqkEVhxv2wiWI pDuEIlzdSBb92vLNlXuXvkAzWvwxudBCFMO773z8KIhRGqtJE0/2Q3ezegcauzpGi2l1 39Kw== 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=FWYlNaO7g+0N0S2l/ScS3UFVLAbgPMCsy0Gh9IEfsf0=; b=NRAL9suunY9U1hNzyBbbjNM13QDzeCB6PdE4AtqG9WTo2rElEu4OC/F3p/W5bprq5H hyEsQzm8yHvJdv0eul5A5RBWizS3qxyHUP0y3h4wStEq19KP2h8tN4vmkpKCvRHGVPk+ RucKZRhHGbTm/Dn9LrSAoDtkGycMDNAqzwPs1/PPiNI0g4rP1yofI01j5pXMXTtjrQ7w vOeeHM6nCVgJ1wcP3XFWVaAVxky3masQAYOizrZqMH6ZnuPqVfcRnfgDuvPt3yS3B5pD GhS+vRGYnfdkHf+nb3loIjcO8vPD9DzZLbLq/PzUPJ1Yp9byziCQUqV1mrsT7drC8IZu RG3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zRxJntQC; 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 d3-20020a05620a240300b006b5edff5426si3619512qkn.422.2022.09.22.11.08.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Sep 2022 11:08:43 -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=zRxJntQC; 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]:38548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obQcs-0000Pk-PH for patch@linaro.org; Thu, 22 Sep 2022 14:08:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPBG-0002Db-Io for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:11 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:35834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obPB7-0005RN-8L for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:03 -0400 Received: by mail-wr1-x431.google.com with SMTP id r7so16471511wrm.2 for ; Thu, 22 Sep 2022 09:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date; bh=FWYlNaO7g+0N0S2l/ScS3UFVLAbgPMCsy0Gh9IEfsf0=; b=zRxJntQCbPrjm3O51eIwYarHIbJemNdXUxwqpQFuuuFyN0Dv+5uKQwy8cjHpd+XB72 6zKj/HgP5De5jlyDtPSWiZiDwHBl9pTNyaE0y8aGykU5rBcmAEAO6SN6y1TM+EAn9gdD vuqLZiqDBGOalWX2OlK4P6wFKftRHmRMEehgLvB3daaNYAycvU8VxLcp7GfObbTJ6qPw ktjStNmpv+GEIT0d6Jwq9clr8crWa/sJ+WeePqmKx+dJuBkgSJU4HUqfZLFSeHYUw0Qv SF4sl3yjfyaxwdQ7eJ7WSu6Cm9GkFlxQO7EbX8EbLnvbGWvUl2iX8M51Rx4whGRoo9Q8 hX7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date; bh=FWYlNaO7g+0N0S2l/ScS3UFVLAbgPMCsy0Gh9IEfsf0=; b=wZ2B+8IJCr0ON+Pp3i/SwQUy0J4E2kzVDIkJy5zhm6DSw8am7Dp6rClhCFYXX/AvDv TLbZm+OgLA3T6Uro47vNBfqaa4wpE8PlTQACDZwAKth8FukhQ/FYQnow6i9fRYS0x0S4 hv74fQnks/NDrmQZ/tJv07qA/S68P4lc7nzqKi6aDSz/yEKltKDGb2C1Feq8WGxXAUHs UUqkvcv5bAa7VgYAQDcYQ75ioqLCBSLpnnmtdBaIGpsCcLnQ/z9Y8kyCUuJeXaATUW8P d1Tj9uDy7VkCI13RzhduFL/rRg0eIqTWDG3Wd14XN8oQFewzNQMCSI67CMNXFU3/nCGh Zh/A== X-Gm-Message-State: ACrzQf3wZu4oFUyvUL4t0jsiifohb1m/JoGAZc/U5+D/y5droF78I8Vv BQ8rNVikWJA/obI+bVqyYL/QOT4gGByyrw== X-Received: by 2002:a5d:5c0a:0:b0:228:db53:22cc with SMTP id cc10-20020a5d5c0a000000b00228db5322ccmr2476689wrb.126.1663864552267; Thu, 22 Sep 2022 09:35:52 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id iw1-20020a05600c54c100b003b3401f1e24sm6452599wmb.28.2022.09.22.09.35.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:35:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/39] hw/net/lan9118: Signal TSFL_INT flag when TX FIFO reaches specified level Date: Thu, 22 Sep 2022 17:35:18 +0100 Message-Id: <20220922163536.1096175-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922163536.1096175-1-peter.maydell@linaro.org> References: <20220922163536.1096175-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" From: Lucas Dietrich The LAN9118 allows the guest to specify a level for both the TX and RX FIFOs at which an interrupt will be generated. We implement the RSFL_INT interrupt for the RX FIFO but are missing the handling of the equivalent TSFL_INT for the TX FIFO. Add the missing test to set the interrupt if the TX FIFO has exceeded the guest-specified level. This flag is required for Micrium lan911x ethernet driver to work. Signed-off-by: Lucas Dietrich [PMM: Tweaked commit message and comment] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/net/lan9118.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 456ae38107b..f1cba559672 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -696,6 +696,14 @@ static void do_tx_packet(lan9118_state *s) n = (s->tx_status_fifo_head + s->tx_status_fifo_used) & 511; s->tx_status_fifo[n] = status; s->tx_status_fifo_used++; + + /* + * Generate TSFL interrupt if TX FIFO level exceeds the level + * specified in the FIFO_INT TX Status Level field. + */ + if (s->tx_status_fifo_used > ((s->fifo_int >> 16) & 0xff)) { + s->int_sts |= TSFL_INT; + } if (s->tx_status_fifo_used == 512) { s->int_sts |= TSFF_INT; /* TODO: Stop transmission. */