From nobody Wed Oct 02 19:56:01 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XJltB0M2Sz5Y1Bd; Wed, 02 Oct 2024 19:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XJlt968q4z4ZZd; Wed, 2 Oct 2024 19:56:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727898961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/LX2wJHmvKpRNU7Osoi4YEk74szlAd/R9w2Um6AYRFk=; b=tR9MCd8Fwc5B72Yi6mT/b+qMJuGi53LbhQD4BGmv2/WVnB3ikaJOz/a65QeBQLUFf/ClUq IcOlbLBn2SL1vwrs0COENLAmBfYT1qbuzvfLerp6IB3Zyym8EW8H8E86I7eMY6xFKVHiIg qdIekBreNXbBNZ1Ip6xM4Gf6C32gvFGCtdastgjxCnH024I50df4ViT/4SfpysYMmAJeIA zApassZ3J5O2IlaJ4mQ/az4985BtETaDgQ0tSUyD/9kATBzybM32+99oJNbZjxC7WzfiTq kTJL5309jI1+juRWZRFOZlQSQB2N8125AQO2CQzC38Rg3Hs0T0svxRXveLCDVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727898961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/LX2wJHmvKpRNU7Osoi4YEk74szlAd/R9w2Um6AYRFk=; b=A2lKZVa0stuMwg2Ybw3tbCjRpfF6V2Ef8VgBZ/b+SgePCATJHyTydq+rSQRZ1I6VUmtpFA rExExWjzDStQXgPgKSqpTlBAQ7tF79yDClJUempmY3vuAXl0Sq3WtA+gL9ijnZINC/LuPB ymC2OaZdTjczDS9pakOTyk9LR+klP2btOOuk17XHWVwZDuaIkhptvC/ZP0w5Jgd2QYpyLj ZOIed6JcgbioaLuZXxmjVzJZYuwDL2xU3aTVO8KCKtQ5g90hyFGVNyli8e+Hi5EKaolvHu 2Dwn6zSfFZlr0Z+SrWSEssrujTdmO5zxqd6HEG667CFEgq6uUQcXYJ+GkloCqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727898961; a=rsa-sha256; cv=none; b=xqutvpGZL/Nw6b/VOthKSc4fTOS6qAbP5MeR5Gu37kO/xL4mRZQ4yRnrPY3T0nwswocIBt iELvv7lxpX2xbLBZDi+qOSOW+VpKP4N+nA5Ov4rYeL7kESbZU/6Ge0tsUTKO7qWFJzvsHJ AFzkiFkijF2lyJNtM0M/DB827bbf+eRPR/REa9umsSuyQEQtrLvgq3WvVqL1OE5Dr08xxm /V5dEtP/vj0PUNkoFGHtV++0FQmYJNkNG3P3KILxISv7p5BD8gxvR9qKwJMiT29wOzNI4V 77XX5L+QLkUdCeEzJUnFUnEJ/3J/VluV9til1aCdrx84xg3U9hBvEpp9peLV5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XJlt95BrGzKTQ; Wed, 2 Oct 2024 19:56:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 492Ju1Pf061572; Wed, 2 Oct 2024 19:56:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 492Ju1UG061569; Wed, 2 Oct 2024 19:56:01 GMT (envelope-from git) Date: Wed, 2 Oct 2024 19:56:01 GMT Message-Id: <202410021956.492Ju1UG061569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 2e3489289853 - stable/13 - e1000: Delay safe_pause switch until SI_SUB_CLOCKS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e3489289853557277c29fce1a9816918cba576e Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=2e3489289853557277c29fce1a9816918cba576e commit 2e3489289853557277c29fce1a9816918cba576e Author: Joyu Liao AuthorDate: 2024-09-25 09:19:13 +0000 Commit: Kevin Bowling CommitDate: 2024-10-02 19:55:23 +0000 e1000: Delay safe_pause switch until SI_SUB_CLOCKS Based on sysinit_sub_id, SI_SUB_CLOCKS is after SI_SUB_CONFIGURE. SI_SUB_CONFIGURE  = 0x3800000,  /* Configure devices */   At this stage, the variable “cold” will be set to 0. SI_SUB_CLOCKS    = 0x4800000,  /* real-time and stat clocks*/ At this stage, the clock configuration will be done, and the real-time clock can be used. In the e1000 driver, if the API safe_pause_* are called between SI_SUB_CONFIGURE and SI_SUB_CLOCKS stages, it will choose the wrong clock source. The API safe_pause_* uses “cold” the value of which is updated in SI_SUB_CONFIGURE, to decide if the real-time clock source is ready. However, the real-time clock is not ready til the SI_SUB_CLOCKS routines are done. Obtained from: Juniper Networks Differential Revision: https://reviews.freebsd.org/D42920 (cherry picked from commit 930a1e6f3d2dd629774f1b48b1acf7ba482ab659) --- sys/dev/e1000/e1000_osdep.c | 10 ++++++++++ sys/dev/e1000/e1000_osdep.h | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_osdep.c b/sys/dev/e1000/e1000_osdep.c index 8016ee352068..8b598f18cf12 100644 --- a/sys/dev/e1000/e1000_osdep.c +++ b/sys/dev/e1000/e1000_osdep.c @@ -34,6 +34,16 @@ #include "e1000_api.h" +int e1000_use_pause_delay = 0; + +static void +e1000_enable_pause_delay(void *use_pause_delay) +{ + *((int *)use_pause_delay) = 1; +} + +SYSINIT(enable_pause_delay, SI_SUB_CLOCKS, SI_ORDER_ANY, e1000_enable_pause_delay, &e1000_use_pause_delay); + /* * NOTE: the following routines using the e1000 * naming style are provided to the shared diff --git a/sys/dev/e1000/e1000_osdep.h b/sys/dev/e1000/e1000_osdep.h index 2af2746dfadf..a64344a24998 100644 --- a/sys/dev/e1000/e1000_osdep.h +++ b/sys/dev/e1000/e1000_osdep.h @@ -79,9 +79,11 @@ ms_scale(int x) { } } +extern int e1000_use_pause_delay; + static inline void safe_pause_us(int x) { - if (cold) { + if (!e1000_use_pause_delay) { DELAY(x); } else { pause("e1000_delay", max(1, x/(1000000/hz))); @@ -90,7 +92,7 @@ safe_pause_us(int x) { static inline void safe_pause_ms(int x) { - if (cold) { + if (!e1000_use_pause_delay) { DELAY(x*1000); } else { pause("e1000_delay", ms_scale(x));