From nobody Wed Sep 25 09:37:56 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 4XDBVD5q7gz5XDdH; Wed, 25 Sep 2024 09:37:56 +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 4XDBVD5JFSz4Wsy; Wed, 25 Sep 2024 09:37:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727257076; 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=qaskU+XS46JKphl3xEXWNRCxvNLg/3qyYu+8G2VjDfo=; b=fQhZYukCwn4ci9ihldBEaax5K2By2i0snW1DGTM639l5yUR+WBwMliIY7FzXTH9///WQnF LKBTI4NHAHvoPBA3i1RpKTycEacRhdvVXh+4pHiICNlBy3JhrJGTgJGaNobY9pwkEfNr42 WRkgJjJLswVo4weqr6ga5AdHbuFBzxYwT+dhj8rma9v/9YRM9ChTm27uvJkDSwDBRVJ0+D mjHsBSmCAFBTfZnWvu39CAsH1AVZYVt4MBoFeZlDCKyZT5Ah5LvWt6yr/jQRowctOXof7Z 6hf3Eh95gY7FQI6tSZUVeRfm8UVgPJouSRl+gzK+Ez48j8GkbUCxdl8GwbnqiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727257076; a=rsa-sha256; cv=none; b=DN2IpRZsxH367A1sUjH9XzKKBnItiDWc/9L21Y0omrQWc3CrUQkHEiW7ITKTz7ZUd44G/S 4/1P1jLYukCThAImu++vdJdGf6iFzsfZ6aG2AbUtqDpQz4gTVNn1kyuk8X7qoNyW2uSfyU pzzM4Bn2jkYCfxCy2tUxl2jQySkhw7NHtdokDHT53jsBH1sgzLhdxjonYE6gz741y7OUJC GfJBr+iozgoUL12L7Qne2uXBALLQGclFImRzrO66PuvIUU2vwSG3RYPqmJK9E3w2o0GTNU jKK769rCHNZeYyLUaGRH1BEYCcBA5KgjtbzHDLJe/crowd24IGe+9L7HGX+UOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727257076; 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=qaskU+XS46JKphl3xEXWNRCxvNLg/3qyYu+8G2VjDfo=; b=HjgnEdtwPBYPMCXK5F0eSwazqitFoclZaTGQsr/1Mx9BoJJ8Phv2wNi/rSW3dmiNHpXaPv 7oySkaxU/mSMjXHXY7aH5R0P3POZeFDucv9RtqAaVfiygT1mrZOrpVKAimxbZiqK8JMJla JV8RaggixrM5jwXb5haxLEj3g4qJp94O03GPodj5nsZBRjiEo157cLwNsgW8NT8l1wv7QZ lZPzlLWSZ0S8VwssUkg2Fh3eJRah6XrZlL3Qw17ikcuA2VfF9iKgwEwnJXUd2aZI7iHuAo EpLMJMUI/YMcOF+VfB7ry272H2IEPj7smlgBAfYra3nKXsFhVlLLBbFYoc/mjw== 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 4XDBVD4kp0z16CW; Wed, 25 Sep 2024 09:37:56 +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 48P9buZ4067259; Wed, 25 Sep 2024 09:37:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48P9buYL067256; Wed, 25 Sep 2024 09:37:56 GMT (envelope-from git) Date: Wed, 25 Sep 2024 09:37:56 GMT Message-Id: <202409250937.48P9buYL067256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 930a1e6f3d2d - main - 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/main X-Git-Reftype: branch X-Git-Commit: 930a1e6f3d2dd629774f1b48b1acf7ba482ab659 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=930a1e6f3d2dd629774f1b48b1acf7ba482ab659 commit 930a1e6f3d2dd629774f1b48b1acf7ba482ab659 Author: Joyu Liao AuthorDate: 2024-09-25 09:19:13 +0000 Commit: Kevin Bowling CommitDate: 2024-09-25 09:37:37 +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 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42920 --- 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 bddb97afd8b9..893979025f01 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));