From nobody Tue Feb 10 19:49:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673670034; cv=none; d=zohomail.com; s=zohoarc; b=F9sYv1n6OfOoZnsB50vt0t1WaSkU9HHYMH8PdYOSNccr9577CGMzS7AjlI6f54wvJXkTwKDz6oAc+EjRHHWJyKiS0YzP8odaa3GZxw59sJJGiwUZR8r9NZTDEcrJlyTEHscE5jQF/1svG75zX88ooKG7HzzP7Sl2u5yilBsN8nw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673670034; 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; bh=VWqHO+rRahXUGWAQnJsH+iI5jUXWsg5ZhWUH3RvHdms=; b=QLuDjjGPc08qA5C5wmjT2Ttl/ieFAiEk42JXy2FL5DsmMzq6j1Ug6t/PdJ6F60+CMl3seb0zYc4pSb6a3WxUFSu54bW4CXHSao/lBYPTzYbVKg7khd2oLm9A6P3jWogCJmU1G+K1cbelbqDJrwEEIxl7m8OYSFq9Ye5pmzwJg38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1673670034043318.33968776001564; Fri, 13 Jan 2023 20:20:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGXj6-0000a4-IJ; Fri, 13 Jan 2023 23:01:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGXiU-0000Dn-En for qemu-devel@nongnu.org; Fri, 13 Jan 2023 23:00:27 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGXiQ-0005cG-De for qemu-devel@nongnu.org; Fri, 13 Jan 2023 23:00:25 -0500 Received: by mail-pl1-x62e.google.com with SMTP id y1so25334211plb.2 for ; Fri, 13 Jan 2023 20:00:21 -0800 (PST) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:4457:c267:5e09:481b]) by smtp.gmail.com with ESMTPSA id g15-20020a170902868f00b00189fdadef9csm910894plo.107.2023.01.13.20.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 20:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VWqHO+rRahXUGWAQnJsH+iI5jUXWsg5ZhWUH3RvHdms=; b=A0pYoJF3BSw2Yn7oGLt3wXxqH1cY3E+C70uY3O7Bgl6hvE8uOp4Z/IA8+pX1CcyWXj zleBmKYH16FDJoDkhPalRDrzv8j0pkntHsjIStQ9lFt7ozdA7HvwHiz5V5ReAuMLmi7M rAd20NQOijW684wLuDv/WThOH1xsHLIOPckBn7h80Trx4WXAtF6ROiPMvLX/hbmLNvow ab2Q2P7v34eIj6dsOQ9scJ/mFAQJD9zE6bjgAwu4kJotlVW8ovnExrKL3i7vViZpnbzL SlWMaBIv55s3bSGgWesc0H/IZyEJp+U5ocYejLt0bnlUa6rtA0ivSLC3vHwXcr7c4kfZ T6Gg== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VWqHO+rRahXUGWAQnJsH+iI5jUXWsg5ZhWUH3RvHdms=; b=BhDeqe4wV+7y12KtxG34jq399SPUFk/KtT0BdjjtdKRFFGJXDcxZ/17HNMCWgpbTPw bsLCbKwxVmAqp0oKTKQ2y3tJwpOd5jUmwStbHAvB7upzhl2fplWfOgZYpClfrw9lPo3h p2eJFBUlaH1uOvIGG5gaED/BE2t0DESwxIb6W0+3XcXgswIYKd6kdmk7jPxXISzW9B9k 7zT4nhHSTqZINPIm5JL/c/M4EW5Y6fKwRiA4kwVMi2c+A9nmZCx1Q7Zyy7nxBYZ2Ymml DmWI0Bh2Umz+Tibb8HraaS26zLiVCO4n8FEP3sMJy+5YrT5h/eDMscWpaBqCmH2O1ix4 bNag== X-Gm-Message-State: AFqh2kqQQs1O3gb2WcHauxOyxrWUc/6XvygG6FN+ys7g0Lxqb1d/DZqz Hj60qdaqwE2yPbryOjlFq9iAUQ== X-Google-Smtp-Source: AMrXdXsoiGiI6wemy6R8CjyazemhTEP5b25VJvzR3O8EQMjORoruzbJF9OxI/8QEnLtLCz/+er3xOQ== X-Received: by 2002:a17:902:b486:b0:192:751c:6e8d with SMTP id y6-20020a170902b48600b00192751c6e8dmr13152200plr.58.1673668820337; Fri, 13 Jan 2023 20:00:20 -0800 (PST) From: Akihiko Odaki To: Cc: Jason Wang , Dmitry Fleytman , Thomas Huth , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki Subject: [PATCH 12/19] e1000e: Improve software reset Date: Sat, 14 Jan 2023 12:59:12 +0900 Message-Id: <20230114035919.35251-13-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114035919.35251-1-akihiko.odaki@daynix.com> References: <20230114035919.35251-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::62e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1673670036124100001 Content-Type: text/plain; charset="utf-8" This change makes e1000e reset more things when software reset was triggered. Some registers are exempted from software reset in the datasheet and this change also implements the behavior accordingly. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 37aec6a970..b8670662c8 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -58,6 +58,8 @@ static inline void e1000e_set_interrupt_cause(E1000ECore *core, uint32_t val); =20 +static void e1000e_reset(E1000ECore *core, bool sw); + static inline void e1000e_process_ts_option(E1000ECore *core, struct e1000_tx_desc *dp) { @@ -1882,7 +1884,7 @@ e1000e_set_ctrl(E1000ECore *core, int index, uint32_t= val) =20 if (val & E1000_CTRL_RST) { trace_e1000e_core_ctrl_sw_reset(); - e1000x_reset_mac_addr(core->owner_nic, core->mac, core->permanent_= mac); + e1000e_reset(core, true); } =20 if (val & E1000_CTRL_PHY_RST) { @@ -3488,8 +3490,7 @@ static const uint32_t e1000e_mac_reg_init[] =3D { [EITR...EITR + E1000E_MSIX_VEC_NUM - 1] =3D E1000E_MIN_XITR, }; =20 -void -e1000e_core_reset(E1000ECore *core) +static void e1000e_reset(E1000ECore *core, bool sw) { int i; =20 @@ -3499,8 +3500,15 @@ e1000e_core_reset(E1000ECore *core) =20 memset(core->phy, 0, sizeof core->phy); memcpy(core->phy, e1000e_phy_reg_init, sizeof e1000e_phy_reg_init); - memset(core->mac, 0, sizeof core->mac); - memcpy(core->mac, e1000e_mac_reg_init, sizeof e1000e_mac_reg_init); + + for (i =3D 0; i < E1000E_MAC_SIZE; i++) { + if (sw && (i =3D=3D PBA || i =3D=3D PBS || i =3D=3D FLA)) { + continue; + } + + core->mac[i] =3D i < ARRAY_SIZE(e1000e_mac_reg_init) ? + e1000e_mac_reg_init[i] : 0; + } =20 core->rxbuf_min_shift =3D 1 + E1000_RING_DESC_LEN_SHIFT; =20 @@ -3517,6 +3525,12 @@ e1000e_core_reset(E1000ECore *core) } } =20 +void +e1000e_core_reset(E1000ECore *core) +{ + e1000e_reset(core, false); +} + void e1000e_core_pre_save(E1000ECore *core) { int i; --=20 2.39.0