From nobody Sat Sep 30 18:31:26 2023 X-Original-To: dev-commits-src-main@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 4RybQR00SCz4vgZg; Sat, 30 Sep 2023 18:31:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RybQQ6bkdz4fkT; Sat, 30 Sep 2023 18:31:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696098686; 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=GzKxeCB9LNSXj4+Ber+w70hNN6p9GjQTUL295xS3I7c=; b=Jh9CPm4raSwjEabFuZSTNLpFgQpt5aaYlNvfgxmCaxCnqN+B0Nq+Cc6pOTPhBNhRbOQHtp 3NFmfpHtsQVR1skCtUSRXqv0Cavp0i6VitgF6C8RVQcG+UmeQvZVeur4fEjujh6af5vp5M qfuPV+LQzzzHvHPSzNwG7TznyMNjWExoiLrUE5lmNf/p7nXohywSHUTEZLt05fFWYXuxVy xnFCSiU6N58j7NH67kgwGPthPBxmpeGToQORwJfZAGUu1R6avH/oGzpmA64fdx6z36q4hu yvbFz//I5J6qoTTc9BQdYYvU78AdSqW+AlkqD13njMtgGzUAPkmbFSygMPBL0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696098686; a=rsa-sha256; cv=none; b=WtuykOX1AEk1La75VUSRM9ErWuGnl7ggGLIiI1m4vh58BhpvZGZzZQQGeHkshUhsP5clpj sIL0GJ4ntAx29m3qG+ZQEmkj1/P4w0BUUm336DG/RtlyNVtxkG+gRG2iivCTLblQVesJvK fkunJ+8Aphr9vyiJgXpe4Woh7bp20c6f4IWXqWVDm3PnV0fZrtM6ergjHpXlFqBcxWFrDy 7KzADgcbBmrEdkIv09cLw/K++8u0vvgYU7mV6igczPp6mVt8cHQX+RhbYH8gSYzI0KzqZL irUftpg66AM9ffZwIDojdrNOgifcQ5GuBSEB8VXK0TL1wA+PVX+ZSC1DhUesTA== 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=1696098686; 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=GzKxeCB9LNSXj4+Ber+w70hNN6p9GjQTUL295xS3I7c=; b=kcKLQ9VyzWazlO+uFg0NSbRqxX1dLOuMzjCblROvEmgc+FcZUPEE3tAqFLNPBi/0/w6ILs lWTSb0+9vnVwglPenyS7ejQWwD3augVyUK5bHi4e1rxPIIj6ckpzvY+rDVpBkSqfAxcAkH ssUbC33eQPZUiAnVtmFvEkVOFe32p8ZXMiq88QLpvM5iuQYsqwmSMxWuWJhdJMCZrKaazS Z8YfgRdrnur8n9OsjgdxHRMabwkKYElb8ktnff6mD1Vb1t3nve03IaPqqMYYyoxhgJvMuY Dp93edl7oUnaxVDLgFT3g5BNX749BN2q3Vjj15JEp60FrCY6DmfpkW9W8zh8SQ== 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 4RybQQ5M7kzy5D; Sat, 30 Sep 2023 18:31:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38UIVQu1007242; Sat, 30 Sep 2023 18:31:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38UIVQrc007239; Sat, 30 Sep 2023 18:31:26 GMT (envelope-from git) Date: Sat, 30 Sep 2023 18:31:26 GMT Message-Id: <202309301831.38UIVQrc007239@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 8a77bc5e1be1 - main - makefs/zfs: fix build with gcc 12 after b5a2bf512dbe List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a77bc5e1be1a999f2f8d9df0c01fe01fb5a0787 Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=8a77bc5e1be1a999f2f8d9df0c01fe01fb5a0787 commit 8a77bc5e1be1a999f2f8d9df0c01fe01fb5a0787 Author: Dimitry Andric AuthorDate: 2023-09-30 18:27:20 +0000 Commit: Dimitry Andric CommitDate: 2023-09-30 18:27:20 +0000 makefs/zfs: fix build with gcc 12 after b5a2bf512dbe Due to integer promotion rules, dn_nlevels (uint8_t) gets promoted to a plain int, resulting in -Werror warnings with gcc 12: In file included from /workspace/src/usr.sbin/makefs/zfs.c:35: /workspace/src/usr.sbin/makefs/zfs.c: In function '_dnode_cursor_flush': /workspace/src/usr.sbin/makefs/zfs.c:684:23: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare] 684 | assert(levels <= c->dnode->dn_nlevels - 1); | ^~ /workspace/src/usr.sbin/makefs/zfs.c:691:27: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare] 691 | if (level == c->dnode->dn_nlevels - 1) { | ^~ /workspace/src/usr.sbin/makefs/zfs.c: In function 'dnode_cursor_next': /workspace/src/usr.sbin/makefs/zfs.c:739:41: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare] 739 | for (levels = 0; levels < c->dnode->dn_nlevels - 1; levels++) { | ^ Fix it by subtracting 1U instead of 1. Fixes: b5a2bf512dbe MFC after: 3 days --- usr.sbin/makefs/zfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/makefs/zfs.c b/usr.sbin/makefs/zfs.c index db302fe1e760..b16a48564f04 100644 --- a/usr.sbin/makefs/zfs.c +++ b/usr.sbin/makefs/zfs.c @@ -681,14 +681,14 @@ _dnode_cursor_flush(zfs_opt_t *zfs, struct dnode_cursor *c, unsigned int levels) off_t blkid, blksz, loc; assert(levels > 0); - assert(levels <= c->dnode->dn_nlevels - 1); + assert(levels <= c->dnode->dn_nlevels - 1U); blksz = MAXBLOCKSIZE; blkid = (c->dataoff / c->datablksz) / BLKPTR_PER_INDIR; for (unsigned int level = 1; level <= levels; level++) { buf = c->inddir[level - 1]; - if (level == c->dnode->dn_nlevels - 1) { + if (level == c->dnode->dn_nlevels - 1U) { pbp = &c->dnode->dn_blkptr[0]; } else { uint64_t iblkid; @@ -736,7 +736,7 @@ dnode_cursor_next(zfs_opt_t *zfs, struct dnode_cursor *c, off_t off) /* Do we need to flush any full indirect blocks? */ if (off > 0) { blkid = off / c->datablksz; - for (levels = 0; levels < c->dnode->dn_nlevels - 1; levels++) { + for (levels = 0; levels < c->dnode->dn_nlevels - 1U; levels++) { if (blkid % BLKPTR_PER_INDIR != 0) break; blkid /= BLKPTR_PER_INDIR; From nobody Sun Oct 1 21:37:28 2023 X-Original-To: dev-commits-src-main@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 4RzHVc6484z4vr3w; Sun, 1 Oct 2023 21:37:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzHVc5XN6z4brT; Sun, 1 Oct 2023 21:37:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696196248; 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=X5mvlGdzWyFVSrV/nTF+S8Sm3FkSZmEC9IeTNr3TgKg=; b=wtqcQ1stmY8JzcsY2TbeZRzs7Ny96m5wkTuwGclFZad9zeEpFiQNUpO/+6WM6EBJx/9Kje MAstnty9JlYw8b4qbjxAQWxGD29KbA7rFMQTZJDEc4PuNhrVShvjKcYrkppD3dhkEySwXi qAC1fEGEb9Oe+C2dhlHITVcF968rOZPFgf7ZVAmxEUlvax9jw7KRNDqzK4sL1LhFbSiFcG x86yL3NQf+aOkrNbuSQsaC00TLsDao9AWCdqgHKNztmUcVTYrXO27i0mICgDj0/vozjrJk u4gJqwxn1muz4mfev9npQk0fTT/5xPTiLB1on5K55KkvkFt4hDxvGcxd/bN/Aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696196248; a=rsa-sha256; cv=none; b=FQerlEeyUNW97IuUg41sjXnwXPsKMMynjZ0mU95ADq+p/WTgNoME0FU7ol1Dsc3xPcKzOM QrSlK7FaNoSo/JfcL+Ohs0LwJLuhs6R7pxls89VJoaR/ZFh1RAM1Rft55i/lCYCKMh6k+B JxnZfVl1opREL8l7dDeRpazp60+UYtqjHmeWuqldmdMAGcipKlck56UCn5JznekkBVTmFe zOhvvafDU0k/fYfYd+SahMJaH7KZhwt4WDhn8MVUKhhFRUjsucppNcj5Ay4L/78Nao10TX /xtzSNoNvGHBx8TRTTpvfUbZcTFb2CD7unEyh/DYttEe00BpfNKeX3xM74X3yg== 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=1696196248; 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=X5mvlGdzWyFVSrV/nTF+S8Sm3FkSZmEC9IeTNr3TgKg=; b=cRvbJX3nQ16vqatVlD77VPxmax5vssXW0V6bLiY+hqoKXvQ+7adaWU493/0d9M9fywa/fG WYb7m44KIcQ03GXFxiVduW37BiHaFWidg4eSyiWiNYhYPPGKysQRXbOux8ghWZp3I9S7om arvJuqdXv8U9vPMNIk4jsVlG1/CffdS6YcWRMh/hnI+TmJpQe7uw0nPwmmgKYwFloDonLI Kw/dPqSUft4HWGpHI6svUw6fJCgXsez2IYAkqVB/YITYGza7K7OJkL57/WEEkQVnij1Bj3 fICWQJN3ClyaBi69p7pDMaeBrVexMdVGGNPKGltbAOugb1Uyj71jBrO/qPlQyg== 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 4RzHVc4bMqzmNT; Sun, 1 Oct 2023 21:37:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 391LbSR9004355; Sun, 1 Oct 2023 21:37:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 391LbSul004352; Sun, 1 Oct 2023 21:37:28 GMT (envelope-from git) Date: Sun, 1 Oct 2023 21:37:28 GMT Message-Id: <202310012137.391LbSul004352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Kubaj Subject: git: 4cf8075264c9 - main - ObsoleteFiles.inc: only leave ofwdump.8.gz when WITH_FDT is set List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4cf8075264c9db8f3e39a1f17def58cda8803853 Auto-Submitted: auto-generated The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=4cf8075264c9db8f3e39a1f17def58cda8803853 commit 4cf8075264c9db8f3e39a1f17def58cda8803853 Author: Piotr Kubaj AuthorDate: 2023-10-01 21:36:37 +0000 Commit: Piotr Kubaj CommitDate: 2023-10-01 21:36:37 +0000 ObsoleteFiles.inc: only leave ofwdump.8.gz when WITH_FDT is set Approved by: mhorne Differential Revision: https://reviews.freebsd.org/D41905 MFC after: 3 days --- ObsoleteFiles.inc | 5 ----- tools/build/mk/OptionalObsoleteFiles.inc | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index ff7e4e497fad..763578aeb652 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -17664,11 +17664,6 @@ OLD_FILES+=usr/share/man/man5/usbd.conf.5.gz .if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64" OLD_FILES+=usr/share/man/man8/boot_i386.8.gz .endif -.if ${TARGET_ARCH} != "aarch64" && ${TARGET} != "arm" && \ - ${TARGET_ARCH} != "powerpc" && ${TARGET_ARCH} != "powerpc64" && \ - ${TARGET_ARCH} != "sparc64" && ${TARGET} != "mips" -OLD_FILES+=usr/share/man/man8/ofwdump.8.gz -.endif OLD_FILES+=usr/share/man/man8/mount_reiserfs.8.gz OLD_FILES+=usr/share/man/man9/VFS_START.9.gz OLD_FILES+=usr/share/man/man9/cpu_critical_exit.9.gz diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 99efa469c0e7..9af0a319171a 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -2015,6 +2015,10 @@ OLD_DIRS+=usr/share/examples/uefisign OLD_DIRS+=usr/share/examples/ypldap .endif +.if ${MK_FDT} == no +OLD_FILES+=usr/share/man/man8/ofwdump.8.gz +.endif + .if ${MK_FINGER} == no OLD_FILES+=usr/bin/finger OLD_FILES+=usr/share/man/man1/finger.1.gz From nobody Mon Oct 2 11:50:46 2023 X-Original-To: dev-commits-src-main@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 4RzfRB5kBgz4w0Rl; Mon, 2 Oct 2023 11:50:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzfRB4zCwz3HbS; Mon, 2 Oct 2023 11:50:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696247446; 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=zQLbI1o0wxbq+n9XEuyb6CkWdBPtJ0X3rxDQYA/j2j8=; b=acTZuUXM/PTZw1XxVhkk190h8yPcQFgyryX/raFIfo8YR98oguCaYpDOcb4wqpLwpSHKYW dEVxxQ9Owh4saTmQWxaFlOCYrRK+8vObYyXRERlKP/nqTIiEbLf3rGrHfnmbWZDWkVJjRZ cWh+iyNGMsKlNmO+pBoA5mXprvXvEF/FTN73OzpG+l4pBJA+332THdhaepcRhDI53nNaBB kDB4yKAmBDGDuWTD+kRdwKWX6RaJR9act94QV9FIfztdP5+GtOHIGkOvQfO2dhdehTDdwQ 4luyp/+taq01hhW0ixy484upbXKquoqYGiNf34fy01r9raU9Gshpn4+Xr7l59Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696247446; a=rsa-sha256; cv=none; b=BttS9IN0EpD/0NdN/mnmlPmPWIidI8B9/B6Gdq5S0kGYZ6kJkbiULoX/eK4ryidj3lUsDf FyI4HGDJebpaJUcXF6w3WCleEJnXyvyl9sR4RADbRcUGFDCA+d/md8OPRXboLLk1ZZq8Sd q4olw8m1q8y9m/hfrsf4foLYSugzP4oPeFtNYTeMQiPYXisgWJabY+e5J+YZ/7PLOVKOz0 x87geTo6gqysEPrKd6pcd6GfWO5aHA02d3fMz5O87oJ1bG+uLUJIgG2FVjt1aZyq5LFDSI 7N9YHbrZVz6969+fzjeGzUEi7FP05M0/51OpADwFGwgT9S7gBUPxCKu44OqCXQ== 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=1696247446; 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=zQLbI1o0wxbq+n9XEuyb6CkWdBPtJ0X3rxDQYA/j2j8=; b=DWeRYwDlmbVrokcK7VVrn8vCZuxHVL1sdiLLXCcDSzo9NBN2ksCg6YxD5cS3sQV/VyiDix 9uY9SSjnjLg32UdIQg61btjzV6AmpvVZQpbBEoPitHOZHtQzGVCqug0tvPEiUwEERMqfEy ELco9fp6bGwgpVkLBWHhRynlAsbCAFFSChdHpH1scLhfP9WtF+1ueXBSo5aLfGszFhnQCl rMwHT2YCz3LmVvgSBiGp23RpFvYB6rNHGMiF8iQruMvbifcf2xvDip/UMeQYbxMxScayKu yLp+d1fJXDrqK+XyEqvND04GvIAaLGdQdUcMWuFpfpvqzhE3hEMl4vVSIeElIQ== 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 4RzfRB43ZJz19R9; Mon, 2 Oct 2023 11:50:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392BokwM028390; Mon, 2 Oct 2023 11:50:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392BokhA028387; Mon, 2 Oct 2023 11:50:46 GMT (envelope-from git) Date: Mon, 2 Oct 2023 11:50:46 GMT Message-Id: <202310021150.392BokhA028387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e61568aeeec7 - main - swap_pager: Fix a race in swap_pager_swapoff_object() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e61568aeeec7667789e6c9d4837e074edecc990e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e61568aeeec7667789e6c9d4837e074edecc990e commit e61568aeeec7667789e6c9d4837e074edecc990e Author: Mark Johnston AuthorDate: 2023-10-02 11:49:27 +0000 Commit: Mark Johnston CommitDate: 2023-10-02 11:49:52 +0000 swap_pager: Fix a race in swap_pager_swapoff_object() When we disable swapping to a device, we scan the full VM object list looking for objects with swap trie nodes that reference the device in question. The pages corresponding to those nodes are paged in. While paging in, we drop the VM object lock. Moreover, we do not hold a reference for the object; swap_pager_swapoff_object() merely bumps the paging-in-progress counter. vm_object_terminate() waits for this counter to drain before proceeding and freeing pages. However, swap_pager_swapoff_object() decrements the counter before re-acquiring the VM object lock, which means that vm_object_terminate() can race to acquire the lock and free the pages. Then, swap_pager_swapoff_object() ends up unbusying a freed page. Fix the problem by acquiring the lock before waking up sleepers. PR: 273610 Reported by: Graham Perrin Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42029 --- sys/vm/swap_pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index e548c2d16a0b..38151b3be96f 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1890,8 +1890,8 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) if (rv != VM_PAGER_OK) panic("%s: read from swap failed: %d", __func__, rv); - vm_object_pip_wakeupn(object, 1); VM_OBJECT_WLOCK(object); + vm_object_pip_wakeupn(object, 1); vm_page_xunbusy(m); /* From nobody Mon Oct 2 12:09:55 2023 X-Original-To: dev-commits-src-main@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 4RzfsH2K16z4w1Nw; Mon, 2 Oct 2023 12:09:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzfsH1m88z3Kqf; Mon, 2 Oct 2023 12:09:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696248595; 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=bbxFeYwcD2kkCjy43uLku2aexFM9/bc3iUTucSb9L9s=; b=yicxgLJWc/vJ55q7JRR1IaLpMJAW9cHEa+15W9H1OW0h93E84HZIuLTBpAu5Jb35vQW4k9 jHQU9h3aHz2wCAGLwsKNZKm737Qu6CDIw36STDnxKjsyYMYAvqgTWo6iDK2WJ40BQSMP6Z 58YSQspwv/zYaHG6nU9EV18kqw1jPaKV3Et8h8f/KRjosJLjPSltfaS/tIG5rL4JkL0xkH zu5BNXE0DMsG3zD3bS/gThVrEbdQilTz03+4uhLXwIDNFbEBOqg+upRM5wzaEiMMcXmchG kg19z662McET0kxV/ctK9pmRgUqmzdchSvoCaT4h9HfxWBL1dNxRM7kcFKp9TQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696248595; a=rsa-sha256; cv=none; b=PYm9+1WuiltbaAFxW2sMhnh2qi0phQqZy+N+2D5wTB35IeP3/r+bHDIaAJ6cWoCCsqPa8T HN6gzB9aQiRvYmZKUaUk2xhsEmO9vvYkEZenjZ4eTyz/q1y7ZJ5ISXa+Vhj9nchs3NCNmW uVp7AMnNW/8cqaVFQYws9gv3Qf0/LjqZqVghngg4sWFiprprrGoC7tWy5Cz6NhDUgx32rs HihzGjuP7xCmiWcTkq32yFd7I0B2ePudA3npsI9L8v91Kt6S9blub9jGi87/iYQ6HpFK/7 YnMnaSMCVdUxnIQP/3RgWBT/txE8Bag7wxqgWkE90VCzs4rx6s3bMTpzHyHElA== 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=1696248595; 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=bbxFeYwcD2kkCjy43uLku2aexFM9/bc3iUTucSb9L9s=; b=LgMBUCdqBZy/qGWUJGDvKJlxXL/HVDC1l8Xb28d2lUW9foxBZ+iV/TK/3i7Gp6ytpYk3DQ 93oWx6zhiFtCZQ94alDC51qcw6eaAs7hCjFoZpTpUur/v5+/HoJfQvlbdJafbXmrUX1Tv9 kHLhUse4/HLpTKUxk5Cpf4ahB5kEcxtBAGhwqONPJoLGcOuSohEoZk93Q6AtVFXB1PWGa5 DImFV6tEoCi2N8qf6h1BZQCpgk8U8YE36bkgk7LB5gE0EZ4moLLVaIMNjSD20zk+/Dj9hz rn+JDUMP9mATuP3ROQuzKUQ9IZpibsod2Q4m5YUzeiFgKd1XFEN9ljP0ImW1zQ== 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 4RzfsH0pqNz1B1h; Mon, 2 Oct 2023 12:09:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392C9tKJ054179; Mon, 2 Oct 2023 12:09:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392C9t0x054176; Mon, 2 Oct 2023 12:09:55 GMT (envelope-from git) Date: Mon, 2 Oct 2023 12:09:55 GMT Message-Id: <202310021209.392C9t0x054176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d94d07d58141 - main - netdump: Check the return value of ifunit_ref() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d94d07d58141dcff48f01c6b3e5a31de9d7a7938 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d94d07d58141dcff48f01c6b3e5a31de9d7a7938 commit d94d07d58141dcff48f01c6b3e5a31de9d7a7938 Author: Mark Johnston AuthorDate: 2023-10-02 12:08:20 +0000 Commit: Mark Johnston CommitDate: 2023-10-02 12:09:26 +0000 netdump: Check the return value of ifunit_ref() We may fail to match if the specific interface doesn't exist or was renamed. PR: 273715 Reported by: grembo MFC after: 1 week --- sys/netinet/netdump/netdump_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet/netdump/netdump_client.c b/sys/netinet/netdump/netdump_client.c index 35167f690ed2..0f0cf4dbb79f 100644 --- a/sys/netinet/netdump/netdump_client.c +++ b/sys/netinet/netdump/netdump_client.c @@ -451,6 +451,8 @@ netdump_configure(struct diocskerneldump_arg *conf, struct thread *td) CURVNET_SET(vnet0); ifp = ifunit_ref(conf->kda_iface); CURVNET_RESTORE(); + if (ifp == NULL) + return (ENODEV); if (!DEBUGNET_SUPPORTED_NIC(ifp)) { if_rele(ifp); return (ENODEV); From nobody Mon Oct 2 13:41:19 2023 X-Original-To: dev-commits-src-main@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 4Rzhtl6Ngkz4w5lZ; Mon, 2 Oct 2023 13:41:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rzhtl5pPPz3Ww9; Mon, 2 Oct 2023 13:41:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696254079; 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=lrT5bdAtR6+4DsSiUPVp1jk0I5dyhKpKUvT6c3ytH78=; b=DPbbuPiNLvb7LBiTIlvupcrTxAp/MBwH1DUZxpmFfp8imYR5RDjgUILyxyZa90kHfpsQ0B rn2zkXY4ow6gxL7P2hPOEXnnZbV/QLovMxxLoe1QzlCiqsF5Zc6p1zDuvJQOkNNYHWmBbo KQjEtlegu5C3T5wuLjvRDAnMa8+Q6FI1xUi3e6z89SWffCJO6VJbX42yI83uu8zjEgM+e9 04u8hkXLVPg1faVx9d8CtYxKrERwM+BMs3+O/EDeFQ5fKMEaiZiWJRUsxtKnL1OuioNU4Y TQTlAKeBYLgJ1IkrJhJO3ZW5KlT6Lp0SNQc+u1YHHxV1yZ6qJjK5jc5vXtJ/xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696254079; a=rsa-sha256; cv=none; b=cexxSguVbOFdlhf7hNvLvBKDz1jwMid0VcTzBR0kifb2bmDdbljH3CpXSu3HnnGctmV4th 4gcoFlbzKdXakHOuKvNeaVHrmdJhyJuplmWGqInLhKtDy0YumCXUteWBV5C5+zMvQalAMV Q0FFzQFllQIglIhI4YKjs0mBAA/0IUkdd5h1FtVZi3k+qH8DSLY9if2jVjOhUU+yPBBovS 6m03SyB5V6jouFK6okiTNb3N6RN9vfNqev0XjO3RgiqgWS5EpmIB7res4/oIsnVVqLkd+r EJ/+BH4YrBq/KbZEiaxp8iizSImWReBU8otEqjZX1MjWdFhIz2H7Vavs0C1nBA== 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=1696254079; 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=lrT5bdAtR6+4DsSiUPVp1jk0I5dyhKpKUvT6c3ytH78=; b=fYt2tzoD3ENENpudx6+E+rS5TFft+FeXb4l93NtjosDEDwQcWGpogGw7sWeDzOxXEV8hxz G99L8nhDJUOaooT3PQLRk0yB2S4cUrQHyVEcCbAtNX0Yw1ZOiPAVkb3aI7g7J1Y1iC+mMZ JQGAudrNIpsnTvV3kmJMj/K36z6Pq8JwmYOsEDkMji3rKVu2MnI9HsNNIE7trzoeEkGOx9 Of0Q+vZHxG2BOtnyKcjHOvKrhF6giOZFNbTxqyU38v84rwKOSnRPRPUOKutIJM81rPbL3f VVufE0qVX2dyK5iKOlK6d4JiaMr83CIYHk7P25PchqJeMLkebcg7TFS+T8SDsA== 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 4Rzhtl4tDXzFn; Mon, 2 Oct 2023 13:41:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392DfJ9T012864; Mon, 2 Oct 2023 13:41:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392DfJAu012861; Mon, 2 Oct 2023 13:41:19 GMT (envelope-from git) Date: Mon, 2 Oct 2023 13:41:19 GMT Message-Id: <202310021341.392DfJAu012861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 773606fcdfae - main - ofwdump: install dependent on MK_FDT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 773606fcdfae00a3f850bcd39969a63d9a8fb129 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=773606fcdfae00a3f850bcd39969a63d9a8fb129 commit 773606fcdfae00a3f850bcd39969a63d9a8fb129 Author: Mitchell Horne AuthorDate: 2023-10-02 13:40:18 +0000 Commit: Mitchell Horne CommitDate: 2023-10-02 13:40:18 +0000 ofwdump: install dependent on MK_FDT The utility depends on the presence of the openfirm(4) pseudo-device, which is gated by the FDT kernel option. The MK_FDT knob is correctly set to "yes" for FDT/OFW-enabled platforms (powerpc* included); use it to install the utility and eliminate the arch-specific Makefile logic. No functional change intended. Reviewed by: emaste, pkubaj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41977 --- tools/build/mk/OptionalObsoleteFiles.inc | 1 + usr.sbin/Makefile | 1 + usr.sbin/Makefile.aarch64 | 1 - usr.sbin/Makefile.arm | 2 -- usr.sbin/Makefile.powerpc | 1 - usr.sbin/Makefile.riscv | 2 -- 6 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 9af0a319171a..fb22d56d53e0 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -2016,6 +2016,7 @@ OLD_DIRS+=usr/share/examples/ypldap .endif .if ${MK_FDT} == no +OLD_FILES+=usr/sbin/ofwdump OLD_FILES+=usr/share/man/man8/ofwdump.8.gz .endif diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index b836bd412077..ca8b87a134eb 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -133,6 +133,7 @@ SUBDIR.${MK_EFI}+= efivar efidp efibootmgr efitable efiwake .if ${MK_OPENSSL} != "no" SUBDIR.${MK_EFI}+= uefisign .endif +SUBDIR.${MK_FDT}+= ofwdump SUBDIR.${MK_FLOPPY}+= fdcontrol SUBDIR.${MK_FLOPPY}+= fdformat SUBDIR.${MK_FLOPPY}+= fdread diff --git a/usr.sbin/Makefile.aarch64 b/usr.sbin/Makefile.aarch64 index e819369f4340..a72a085ff618 100644 --- a/usr.sbin/Makefile.aarch64 +++ b/usr.sbin/Makefile.aarch64 @@ -2,4 +2,3 @@ .if ${MK_ACPI} != "no" SUBDIR+= acpi .endif -SUBDIR+= ofwdump diff --git a/usr.sbin/Makefile.arm b/usr.sbin/Makefile.arm deleted file mode 100644 index 3767c8c9e1ca..000000000000 --- a/usr.sbin/Makefile.arm +++ /dev/null @@ -1,2 +0,0 @@ - -SUBDIR+= ofwdump diff --git a/usr.sbin/Makefile.powerpc b/usr.sbin/Makefile.powerpc index a6d5b3b35ad4..d6b05857e152 100644 --- a/usr.sbin/Makefile.powerpc +++ b/usr.sbin/Makefile.powerpc @@ -2,4 +2,3 @@ .if ${MACHINE_ARCH} != "powerpcspe" SUBDIR+= nvram .endif -SUBDIR+= ofwdump diff --git a/usr.sbin/Makefile.riscv b/usr.sbin/Makefile.riscv deleted file mode 100644 index 3767c8c9e1ca..000000000000 --- a/usr.sbin/Makefile.riscv +++ /dev/null @@ -1,2 +0,0 @@ - -SUBDIR+= ofwdump From nobody Mon Oct 2 14:06:01 2023 X-Original-To: dev-commits-src-main@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 4RzjRG0dr9z4w6k8; Mon, 2 Oct 2023 14:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzjRF74Ypz3YlG; Mon, 2 Oct 2023 14:06:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696255562; 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=C6FHhII8e83sLatnG5C9rAdQ3uLORkN5xX2cd33YQ3c=; b=R5QJfRLUwRJ1i8ksZHw65P28oCwbdKcjRugRR/fekcPVE1t6EIm4a27RrBfwjjPoxvOt2K zxIv/YplcivFF7wBz/ymqNFW1WkgFXP/oAAO3foOXzeBPz4v+BwF9/rTZcmmzDoeyvBwNy eFPbqOF3QHhy2uvMRlecQvJwTn21RJ1TDvwCR+9//0rERR4VVc9gv49xdXg6rG0VQZBrIR PkuUeV6miYzE+XuoOAwywAn3OnCQWJCGcg5dWEX9v6khBLE5FZ8neHlH1widT78W2oW1pW 5WgoJsFXsbFHoMIdKjTwTUCL4YFLWiCZbvMTd070D8TslmRXQK+XtI7wI7d8EA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696255562; a=rsa-sha256; cv=none; b=kpSPRBsyoAXW4ve0+l4PB8dxaKXOy9J1Sf/1WhbIGmwd1jlqcjmKxm62xbnkxSSXmaxi6b w2uleKxCL9MwFcS2SgECZS/uuJzmzff/ljtiwo8ER0ur2tU2CRerUi29c4N2wEtU/yzesg wEOS8ULudnGadx9UakXA3S3OhL7Ifd9NFD2vdTWbcVri0kwSesx0tuFjShagXXh9mTiQSf xhg9NLk2PS2Cf/hDtZU7anHwxtARQFTCcQYAvYd1k+aK45K7DNwn5ng7pRs9FoDQsqi5lJ +XTpfrTPWaST2NCK66OywYAv0A5AsUnYtuf9eb+LIqoSg2VxA95xdTbrhrt3gw== 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=1696255562; 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=C6FHhII8e83sLatnG5C9rAdQ3uLORkN5xX2cd33YQ3c=; b=HrGduCM9laMS2dCiDeZDAt4NCMSwks2wglspGckRECdSRkK+kLD2vcANcmfCz1tuQNkcQG VHqEeNtkG93vON40jLKF2BhLLYOf325At4ko3n4yx1y3DeWQVqAckBn4CMAH6XQUjJGsyi OlG3KSQrsawTyA1EoTSAjj8+wDk5vZ2MlyNBKc6a7532LsASD6ydLrClun47ZImC1IMHX1 y33Gj1ld7BAUZx9LMnc7xItFWrhEa2R1Hur3dQKED2+Lp9gNTG+FIpaF6/13udI5DblRMG ncmlrEJSwZM4FdDNzJraIIlrNwHlTJathOKlk6rKQu/TiMGMxwcGFrSYTE3Xeg== 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 4RzjRF629XztS; Mon, 2 Oct 2023 14:06:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392E61dh052465; Mon, 2 Oct 2023 14:06:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392E61bQ052462; Mon, 2 Oct 2023 14:06:01 GMT (envelope-from git) Date: Mon, 2 Oct 2023 14:06:01 GMT Message-Id: <202310021406.392E61bQ052462@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4ed35b7d1eb5 - main - net80211: improve ddb output for sta and rate List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ed35b7d1eb5dddfd04f574ac122651d532d2df9 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4ed35b7d1eb5dddfd04f574ac122651d532d2df9 commit 4ed35b7d1eb5dddfd04f574ac122651d532d2df9 Author: Bjoern A. Zeeb AuthorDate: 2023-10-02 13:53:33 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-02 14:03:55 +0000 net80211: improve ddb output for sta and rate Add more missing fields to the ddb output of sta (including spares so people will notice if they use them to adjust ddb as well). There are still more missing fields (some left as reminder in an uncompiled __notyet__ block). Add _db_show_rate() to print iv_rate as well optionally including function pointers. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/net80211/ieee80211_ddb.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c index 525814d202b1..e4a09a58049b 100644 --- a/sys/net80211/ieee80211_ddb.c +++ b/sys/net80211/ieee80211_ddb.c @@ -48,6 +48,7 @@ #include #include +#include #ifdef IEEE80211_SUPPORT_TDMA #include #endif @@ -327,6 +328,31 @@ _db_show_sta(const struct ieee80211_node *ni) ni->ni_vht_pad1, ni->ni_vht_spare[0], ni->ni_vht_spare[1], ni->ni_vht_spare[2], ni->ni_vht_spare[3], ni->ni_vht_spare[4], ni->ni_vht_spare[5], ni->ni_vht_spare[6], ni->ni_vht_spare[7]); + + db_printf("\tni_tx_superg[] = {"); + for (i = 0; i < WME_NUM_TID; i++) + db_printf(" %p%s", ni->ni_tx_superg[i], (i == 0) ? "" : ","); + db_printf(" }\n"); + + db_printf("\tni_rctls = %p", ni->ni_rctls); + db_printf("\tni_drv_data = %p", ni->ni_drv_data); + db_printf("\n"); + + db_printf("\tni_spare[3] = { %#jx %#jx %#jx }", + ni->ni_spare[0], ni->ni_spare[1], ni->ni_spare[2]); + db_printf("\n"); + +#ifdef __notyet__ + struct ieee80211_psq ni_psq; /* power save queue */ + struct ieee80211_nodestats ni_stats; /* per-node statistics */ + + /* quiet time IE state for the given node */ + uint32_t ni_quiet_ie_set; /* Quiet time IE was seen */ + struct ieee80211_quiet_ie ni_quiet_ie; /* last seen quiet IE */ + + /* U-APSD */ + uint8_t ni_uapsd; /* U-APSD per-node flags matching WMM STA QoS Info field */ +#endif } #ifdef IEEE80211_SUPPORT_TDMA @@ -403,6 +429,31 @@ _db_show_scan(const struct ieee80211_scan_state *ss, int showprocs) db_printf("\n"); } +static void +_db_show_rate(const struct ieee80211_ratectl *rate, const void *rs, + const int showprocs) +{ + + db_printf("\tiv_rate %p", rate); + db_printf(" iv_rs %p", rs); + db_printf("\n"); + if (showprocs) { + db_printf("\t ir_name %s", rate->ir_name); + db_printf("\n"); + DB_PRINTSYM("\t ", "ir_attach", rate->ir_attach); + DB_PRINTSYM("\t ", "ir_detach", rate->ir_detach); + DB_PRINTSYM("\t ", "ir_init", rate->ir_init); + DB_PRINTSYM("\t ", "ir_deinit", rate->ir_deinit); + DB_PRINTSYM("\t ", "ir_node_init", rate->ir_node_init); + DB_PRINTSYM("\t ", "ir_node_deinit", rate->ir_node_deinit); + DB_PRINTSYM("\t ", "ir_rate", rate->ir_rate); + DB_PRINTSYM("\t ", "ir_tx_complete", rate->ir_tx_complete); + DB_PRINTSYM("\t ", "ir_tx_update", rate->ir_tx_update); + DB_PRINTSYM("\t ", "ir_setinterval", rate->ir_setinterval); + DB_PRINTSYM("\t ", "ir_node_stats", rate->ir_node_stats); + } +} + static void _db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs) { @@ -569,6 +620,8 @@ _db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs) db_printf(" lastnonerp %d", vap->iv_lastnonerp); db_printf(" lastnonht %d", vap->iv_lastnonht); db_printf("\n"); + if (vap->iv_rate != NULL) + _db_show_rate(vap->iv_rate, vap->iv_rs, showprocs); if (showprocs) { DB_PRINTSYM("\t", "iv_key_alloc", vap->iv_key_alloc); From nobody Mon Oct 2 14:06:02 2023 X-Original-To: dev-commits-src-main@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 4RzjRH1pMcz4w6kC; Mon, 2 Oct 2023 14:06:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzjRH0lcLz3Yqp; Mon, 2 Oct 2023 14:06:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696255563; 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=/YxTmVGFgkPF8qwsdIUa2KJYTj/LgcXAZZPg1ilfKj0=; b=AES7uOClVm1WLaNWFw1NmdLcYP3D+r415BGgCpYgK2bEw22IwtqTznnqzlkdkUUzjy3WSG 9+EuLR/zggNCUxvcoFOdqbird8bH0QdUaqGmqEoWIKSEtx5AmpHmXPgri2gfQoQfgNZ4VM zxAwNM8zmglYHDJSq+mwmxERCSuH0AZLuM8nQH7vswuh3jkgtIVl1//Zy5bfd44ZdvLoCn mNSxFuQCKsyXxWvefR6Xs4Jgk8EzgCiH4tQEdhnHGbqdLrU8V4NHkMvBGoEwDR3wQQtl0b h3Z2M1ViJfJUiEY20keawmgV4AkR8n4KrAsYKBc8S9CVIKXT1+Hy3FE8Ak+0Nw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696255563; a=rsa-sha256; cv=none; b=OSlFOhDgJDRoITPoPc+xwWHBCwTKl7sry1cQt2mL6Sprs5CF26C6kScoJnozHfgS0DxxXy eGUwHypkgVK3a/gnkFjWBRDMX7gLysJAVAe2nLOORAFDRbaFgC5WSxoJtHalmBxfcPXSzj EZyw0lJh2pZ35H6d+2uzd3gjja+oiKslat8dkofpzGUIkPoq8VuVUKP43e/uoY7zNQpRcB BCOMpsJXg22bRU4XFaFxTiba/afSpQ+4FL334kef2I4E/3InmlQ+j0L1vA2t2rHZwcr/7j gJ0K9MFLtCqzjyEStczflbiO71D45FEFWnV8gct+RPjb/Xzo58djO/q8yUoPVw== 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=1696255563; 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=/YxTmVGFgkPF8qwsdIUa2KJYTj/LgcXAZZPg1ilfKj0=; b=gVr44jiOfeqQ6xk3/2AZmmih3uz/tpp0JkIidYDo8080I4xe3qh9Xifv3a5+l3Ss4mivT7 +Vxj992ZX+i2s3Pt8HHOWhS4G/M1Q/oSb8F5CQpi/q393GqohgYwBT//BxmNRt6iUCcNSz I3cgwP/9LUjzLaSR4x/Lu/teYvSDeggBSpk+uz4pR+IC5sN9JwE68kONmW67YpeinrFVYb 9sbFB0lGSFWl7EHSp6777SAkn3Fe+sGyfMZ2lhobYSB7UrIQUDcd0Gh/qyVVsO8PlALhz3 Xda1xHJ5hgycKSVLWbxS/Uqby/7lwJBwDe1zEmd8pQRPTkuoQOv+1UB+KZa/6w== 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 4RzjRG6NdLz17P; Mon, 2 Oct 2023 14:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392E629r052508; Mon, 2 Oct 2023 14:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392E62du052505; Mon, 2 Oct 2023 14:06:02 GMT (envelope-from git) Date: Mon, 2 Oct 2023 14:06:02 GMT Message-Id: <202310021406.392E62du052505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: db195a523f9b - main - net80211: make ieee80211_alloc_node() private List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db195a523f9bbeb111b621d2c2c7a46d8b921631 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=db195a523f9bbeb111b621d2c2c7a46d8b921631 commit db195a523f9bbeb111b621d2c2c7a46d8b921631 Author: Bjoern A. Zeeb AuthorDate: 2023-10-02 13:57:45 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-02 14:05:03 +0000 net80211: make ieee80211_alloc_node() private Looking through the allocation/free and reference cycle of nodes we have a few (publicly) (almost) unused macros and functions. Start making them private and reducing the amount of entry paths to the same/similar functionality. First is to make ieee80211_alloc_node() static as it is nowhere used in the tree outside this file. Sponsored by: The FreeBSD Foundation X-MFC: no --- sys/net80211/ieee80211_node.c | 5 ++++- sys/net80211/ieee80211_node.h | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 39b411059cf1..b7cdc5090c96 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -82,6 +82,9 @@ CTASSERT((IEEE80211_NODE_HASHSIZE & (IEEE80211_NODE_HASHSIZE-1)) == 0); static int ieee80211_sta_join1(struct ieee80211_node *); +static struct ieee80211_node *ieee80211_alloc_node( + struct ieee80211_node_table *, struct ieee80211vap *, + const uint8_t macaddr[IEEE80211_ADDR_LEN]); static struct ieee80211_node *node_alloc(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); static int node_init(struct ieee80211_node *); @@ -1396,7 +1399,7 @@ ieee80211_del_node_nt(struct ieee80211_node_table *nt, ni->ni_table = NULL; } -struct ieee80211_node * +static struct ieee80211_node * ieee80211_alloc_node(struct ieee80211_node_table *nt, struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN]) { diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 7c9ff70bcb71..826ecccb1238 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -395,9 +395,6 @@ struct ieee80211_node_table { int nt_inact_init; /* initial node inact setting */ }; -struct ieee80211_node *ieee80211_alloc_node(struct ieee80211_node_table *, - struct ieee80211vap *, - const uint8_t macaddr[IEEE80211_ADDR_LEN]); struct ieee80211_node *ieee80211_tmp_node(struct ieee80211vap *, const uint8_t macaddr[IEEE80211_ADDR_LEN]); struct ieee80211_node *ieee80211_dup_bss(struct ieee80211vap *, From nobody Mon Oct 2 14:54:24 2023 X-Original-To: dev-commits-src-main@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 4RzkW435V9z4w9G4; Mon, 2 Oct 2023 14:54:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzkW42VlFz3g7l; Mon, 2 Oct 2023 14:54:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696258464; 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=cNecSndGzZ0H/Uo9dQXUGp7dBF1X2G3gcZUsinT5GOw=; b=VaGfXaFTengEKBpH2qidzRrwoYcEfmqFgeeYtPwRbThR8l0aKDjFo+SrFwPzLr/IMKlgL+ +deQIhHW2iL+aOUJ1iGtopMMpFX1bWEJvw6XgWPTeyBVGJDpAPpUXnNFYF11Jbdn1meGm+ DkZPK8xSu+RAm/usIE15dBvvTWp5BBIL4EiKgkCse5YSci3ssq4KzKwSHn3//05mmD0+Lc ZSj6Zcx3yvCOQVrCUTbEhyT13Tk26yZ2DuGK0efAymorag1aOCkHUKeAAwTbTg9rkcKMPU 3+bn7kmTNPvIIQk7hh6QiVrG8CNi3FhkU7JJpk0ZNM2OnL61klZPbWjXsfAUaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696258464; a=rsa-sha256; cv=none; b=XMu+I5Ffkm55ZDDu/dkefw/agdY7CDyp2b/NxvdDL0MynX5+w9slMKmdVj5DE6JgWQLLDA E51iNgHjTrh+syZNzRhHtrLqZwnVpu4EuKNyqqCTrDWbkSnSTEKOXtW7Ao5sQXbyMUOQzc pjWpEgN3LxGJXB2Q6UX3SVGqWGuXkcW0JruY6dVCzvRaOOb9zhT6xKwX3X3sTdAwsInl1K NMQbquEW4Wz1SaM553/9GuAAQkfXwzJGjDWRndXFn1cgbyO529KuUilN8XIKIjTAvJoj2Z U/QJZAneGCpRemHdXIm6cryLcQrUZCciOwD/9egl0UEZqzoP2EI3KltmrgGFtQ== 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=1696258464; 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=cNecSndGzZ0H/Uo9dQXUGp7dBF1X2G3gcZUsinT5GOw=; b=gjlb51obDv9d9Mmuunzxi3TxW5G+PQuOxMI2/e5RDkh2C6wAl0sKOAZqXSoMNqyo4DzIFm T7ETqyeQJOB8y4YCqsGHgJAy3iYjEWsUmfR6Y4q7gwOjdQxGxn8/q8welShKtSjIX7v3kU Q2RBpJRr5sTTqJCz+TDWeADiTdleLmfdSzsXSTkcpCMcLtif1YBAtB2YaT7rvtir1/50iy NJsXTo6+czjl2DvH61tXij1mIvzhMeRalXo0ycvVm/SYCVhyUeTuPbvJGhub69FAZTB4oi rW40q+NDzDUT9TewUvXu+5np1ew1fdufAjWHHheDxoIE0wOVsj3Jnqs+PBSb+Q== 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 4RzkW41FGfz1wZ; Mon, 2 Oct 2023 14:54:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392EsOIU035309; Mon, 2 Oct 2023 14:54:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392EsOgQ035306; Mon, 2 Oct 2023 14:54:24 GMT (envelope-from git) Date: Mon, 2 Oct 2023 14:54:24 GMT Message-Id: <202310021454.392EsOgQ035306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f156cd892b55 - main - net80211 / drivers: remove public use of ieee80211_node_incref() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f156cd892b55c04a39fa06d1899e6e316de77f03 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f156cd892b55c04a39fa06d1899e6e316de77f03 commit f156cd892b55c04a39fa06d1899e6e316de77f03 Author: Bjoern A. Zeeb AuthorDate: 2023-10-02 14:44:29 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-02 14:52:57 +0000 net80211 / drivers: remove public use of ieee80211_node_incref() ieee80211_node_incref() is the FreeBSD implementation of ieee80211_ref_node(). Not being interested in the node returned it was used as a shortcut in 3 drivers (ath, uath, wpi). Replace the call with the public KPI of ieee80211_ref_node() and ignore the result. This leaves us with the single internal call going ieee80211_ref_node() -> ieee80211_node_incref() and that should help increasing portability but also limiting the places to trace for node reference operations. Sponsored by: The FreeBSD Foundation MFC after: 4 weeks --- sys/dev/ath/if_ath_tx.c | 2 +- sys/dev/usb/wlan/if_uath.c | 2 +- sys/dev/wpi/if_wpi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c index 1fd3adef738e..69d0b5c00848 100644 --- a/sys/dev/ath/if_ath_tx.c +++ b/sys/dev/ath/if_ath_tx.c @@ -288,7 +288,7 @@ ath_txfrag_setup(struct ath_softc *sc, ath_bufhead *frags, ath_txfrag_cleanup(sc, frags, ni); break; } - ieee80211_node_incref(ni); + (void) ieee80211_ref_node(ni); TAILQ_INSERT_TAIL(frags, bf, bf_list); } ATH_TXBUF_UNLOCK(sc); diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c index 378dd717a3eb..04190821d9b9 100644 --- a/sys/dev/usb/wlan/if_uath.c +++ b/sys/dev/usb/wlan/if_uath.c @@ -1657,7 +1657,7 @@ uath_txfrag_setup(struct uath_softc *sc, uath_datahead *frags, uath_txfrag_cleanup(sc, frags, ni); break; } - ieee80211_node_incref(ni); + (void) ieee80211_ref_node(ni); STAILQ_INSERT_TAIL(frags, bf, next); } diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index c9c2a8f6854e..5ceb037803b8 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -2768,7 +2768,7 @@ wpi_cmd2(struct wpi_softc *sc, struct wpi_buf *buf) ring->pending = 0; sc->sc_update_tx_ring(sc, ring); } else - ieee80211_node_incref(data->ni); + (void) ieee80211_ref_node(data->ni); end: DPRINTF(sc, WPI_DEBUG_TRACE, error ? TRACE_STR_END_ERR : TRACE_STR_END, __func__); From nobody Mon Oct 2 16:05:47 2023 X-Original-To: dev-commits-src-main@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 4Rzm5R4TmGz4wDLl; Mon, 2 Oct 2023 16:05:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rzm5R3fbxz4JxD; Mon, 2 Oct 2023 16:05:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696262747; 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=PT6uWIaYLYHilwiKWaqUYLIOpOyrO0r8z2qWrdS7zso=; b=FP3zsVarw1bs43DYHerSjTMbscljvXG05bvMKx3TnbwnWrPzc/r7hgW/9s8d1rKb6NdP8S 1B0LWYsG9moK3yBwTzQ4jjXLIpji92wEfLa61oEJEpVexPMuleotp2hMvoBYbXp0vyeceu y2AHszn4USByc0ilhy5ROZE0qKz4GrRNTYc/at+jeOnIeYBTYWAnizUN1qvUn6uG7M3A9v vTGPjF+2zSstt3/R+1+gzAbCnU219Fl7U9F/IzO2YhK2PjU5zt+G6ml+5hr1hkWK61mCPK TapXTgEDFJ7aQxaE/StbBoN3RuxMvpBLIDioqt+C8dIwMjuv5LQ/unPKfu9mOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696262747; a=rsa-sha256; cv=none; b=gJ4GNTHASYw+Dv8YI9rknBc4OShiufye1pACsiqY5TR7ajPxMeifdmpIK1HRYZ97XCCgPc 50F06qg5PJBIAvFNBd81aZqe8YcP60M/KICfG4DoqRbtE0ENZ5o3B46Z2buamxOM+uY/CV sewr2ctDruV2LBN0Q1zPuid3nX4Wri/DhHIlcHjYQ1M021GLdLtGCarWOZPclL6nPQyK9A ODqODD38RD5/8kFSPGJZSJfeIJ30gGV1eIiGvj8EyqCdXSwD6DxxpGmw/53lskBWZKTeWV VT5YC/eI8NtJ7UFxcJKnCxXuASE8XYi2nXKEE8WRu96Lzws04uPsOb9E3qSWdQ== 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=1696262747; 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=PT6uWIaYLYHilwiKWaqUYLIOpOyrO0r8z2qWrdS7zso=; b=SYpg2yA7hRoMz8aEG7C7n99wkI8Ne34S16VEvjXZmj7DM/uvo3Z6BA3a6iSqbE7GemV7Tj bsCGbzlCxuHAlyfNfGjngaPFhKwCMXOwj52UvtPVLjMX1v4PESNACZuztt0m4rx8l4DSPu D9YMz7dx4NHUmrkCHo2oSNwk5NmWARxlkhnNhQyH+DeRInqWLU9sMe94UNQ7AF2gpp04AW ez3r4qrAGLe1E0qc/Ci3H0rxfhDu3y7hKst5onM12qnrv+6wqBp/kI6mEuwXFjrbVXwTUq oly/jvjv796qeqGS319ko2p9mndMMe4wT9gu3ubN2qkI0pA1xHSHnCQvpHnNWw== 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 4Rzm5R2jbkz3wY; Mon, 2 Oct 2023 16:05:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392G5lYv053063; Mon, 2 Oct 2023 16:05:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392G5lmI053060; Mon, 2 Oct 2023 16:05:47 GMT (envelope-from git) Date: Mon, 2 Oct 2023 16:05:47 GMT Message-Id: <202310021605.392G5lmI053060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7ea866eb14f8 - main - nvme: Fix memory leak in pt ioctl commands List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ea866eb14f8ec869a525442c03228b6701e1dab Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7ea866eb14f8ec869a525442c03228b6701e1dab commit 7ea866eb14f8ec869a525442c03228b6701e1dab Author: David Sloan AuthorDate: 2023-09-07 16:22:21 +0000 Commit: Mark Johnston CommitDate: 2023-10-02 15:50:14 +0000 nvme: Fix memory leak in pt ioctl commands When running nvme passthrough commands through the ioctl interface memory is mapped with vmapbuf() but not unmapped. This results in leaked memory whenever a process executes an nvme passthrough command with a data buffer. This can be replicated with a simple c function (error checks skipped for brevity): void leak_memory(int nvme_ns_fd, uint16_t nblocks) { struct nvme_pt_command pt = { .cmd = { .opc = NVME_OPC_READ, .cdw12 = nblocks - 1, }, .len = nblocks * 512, // Assumes devices with 512 byte lba .is_read = 1, // Reads and writes should both trigger leak } void *buf; posix_memalign(&buf, nblocks * 512); pt.buf = buf; ioctl(nvme_ns_fd, NVME_PASSTHROUGH_COMMAND, &pt); free(buf); } Signed-off-by: David Sloan PR: 273626 Reviewed by: imp, markj MFC after: 1 week --- sys/dev/nvme/nvme_ctrlr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 30a5ee81b2a4..ef4d7daa6efa 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1334,8 +1334,9 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr, mtx_sleep(pt, mtx, PRIBIO, "nvme_pt", 0); mtx_unlock(mtx); -err: if (buf != NULL) { + vunmapbuf(buf); +err: uma_zfree(pbuf_zone, buf); PRELE(curproc); } From nobody Mon Oct 2 16:13:45 2023 X-Original-To: dev-commits-src-main@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 4RzmGd5LM4z4wDkr; Mon, 2 Oct 2023 16:13:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzmGd3vklz4LGt; Mon, 2 Oct 2023 16:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696263225; 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=aqCB4Mwn8BkjvWGJVaHaEROra8pMhzJR+ZA4b1tW43U=; b=Vb4hyI2gq/4+Ua1IiqnKuLZlNjFuCqD7JS9SAEHfcklMHzjwGzHeKlg/AdxToqiUszP2ua mn1K0leG5DCZgUM7WhtiRGvgciiELok/MzH7Eizr5a0bfW00Sx1G4MMVHKMbbSivAslg03 tlXiMLY5ZxR/64wlr55kI+njKYglny2qVGdd1dT3ic5oF+slLqRhxP2qiWOaBNdpCBBaMS QoBKvES+5qIhi0XwDAIfHckMHGZipBap8g0n6UWYe/omwaOd8bivLTCfBpHeLzfWGhlelU quuuLh7EPfnhFeNS5cFYe4KgGzwiamqJ92iWCuZoG3MyMRaFnDs7oG9+kfd/Ig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696263225; a=rsa-sha256; cv=none; b=TvK++d8wd8Zc6DGUHe17KPIxLLprkb9G0qHhWr2y08enWrJO3NQD3K5Sq34eLu3W9GfmQe uTBhXFG9EFch57kWbMwNCBvtgUCoaljdKWqTeIxBocSAExTKs4nbP5yg3r4Ec3rM/9UdsA zoWvrlH/H4DnLqHyRVnPYrwg5S2pog6ma9qML8B9A+whSKGjYqXSFH7diZp1UgTgB/oN1/ OBfEFSkgsBmTSf9XzKVfkO5U+dC3qRnKJytdA06RDXNNi6v5xYCKoCkauLl2/To8e2x0xy CWB+yVz3wo2lBoWIIFgADrhxebNW96dDjCLtvtZ6YVev5J+0bOnfXec48iytHw== 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=1696263225; 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=aqCB4Mwn8BkjvWGJVaHaEROra8pMhzJR+ZA4b1tW43U=; b=wmXmHXWUwQ8TUgYIfNV4JNod+ufWTcOqG9F9qhOd/mxgwDHiGV1phq0rv6ec9fO7WZAqPl 1lbk4g666RLiPBt4D4FeuLODBPeQKiLU+yzxodHQGh0b6X2IoIKe5uF330taQcSKf4YbDh iTGEaqr8AGzSG+mEbi2HuSmGLS8BCKUx96JNKsjlX+o/pUU9QaL2VTrSD55TijQZRfPBn8 hLn06bYPxZRtrOJ9bKaCHyVOIEwblmgbUyaQu0Muy8XHRlrHv5GpKrsqOWLkEzmOsgQN4R Upo8fGz8ty/vezLehIEGhuVuEfJWxZZ+QjrQEgpvE4pDDb4jK5MWog9qjVIVNg== 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 4RzmGd30Jwz3fY; Mon, 2 Oct 2023 16:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392GDjMv068908; Mon, 2 Oct 2023 16:13:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392GDj7R068905; Mon, 2 Oct 2023 16:13:45 GMT (envelope-from git) Date: Mon, 2 Oct 2023 16:13:45 GMT Message-Id: <202310021613.392GDj7R068905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 1bd9ca8b7548 - main - aarch64: support BTI and pointer authentication in assembly List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1bd9ca8b7548e5f573ae8186f3519f4bedff3a92 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1bd9ca8b7548e5f573ae8186f3519f4bedff3a92 commit 1bd9ca8b7548e5f573ae8186f3519f4bedff3a92 Author: Russ Butler AuthorDate: 2021-08-28 18:57:09 +0000 Commit: Andrew Turner CommitDate: 2023-10-02 16:12:49 +0000 aarch64: support BTI and pointer authentication in assembly This change adds optional support for - Armv8.3-A Pointer Authentication (PAuth) and - Armv8.5-A Branch Target Identification (BTI) features to the perl scripts. Both features can be enabled with additional compiler flags. Unless any of these are enabled explicitly there is no code change at all. The extensions are briefly described below. Please read the appropriate chapters of the Arm Architecture Reference Manual for the complete specification. Scope ----- This change only affects generated assembly code. Armv8.3-A Pointer Authentication -------------------------------- Pointer Authentication extension supports the authentication of the contents of registers before they are used for indirect branching or load. PAuth provides a probabilistic method to detect corruption of register values. PAuth signing instructions generate a Pointer Authentication Code (PAC) based on the value of a register, a seed and a key. The generated PAC is inserted into the original value in the register. A PAuth authentication instruction recomputes the PAC, and if it matches the PAC in the register, restores its original value. In case of a mismatch, an architecturally unmapped address is generated instead. With PAuth, mitigation against ROP (Return-oriented Programming) attacks can be implemented. This is achieved by signing the contents of the link-register (LR) before it is pushed to stack. Once LR is popped, it is authenticated. This way a stack corruption which overwrites the LR on the stack is detectable. The PAuth extension adds several new instructions, some of which are not recognized by older hardware. To support a single codebase for both pre Armv8.3-A targets and newer ones, only NOP-space instructions are added by this patch. These instructions are treated as NOPs on hardware which does not support Armv8.3-A. Furthermore, this patch only considers cases where LR is saved to the stack and then restored before branching to its content. There are cases in the code where LR is pushed to stack but it is not used later. We do not address these cases as they are not affected by PAuth. There are two keys available to sign an instruction address: A and B. PACIASP and PACIBSP only differ in the used keys: A and B, respectively. The keys are typically managed by the operating system. To enable generating code for PAuth compile with -mbranch-protection=: - standard or pac-ret: add PACIASP and AUTIASP, also enables BTI (read below) - pac-ret+b-key: add PACIBSP and AUTIBSP Armv8.5-A Branch Target Identification -------------------------------------- Branch Target Identification features some new instructions which protect the execution of instructions on guarded pages which are not intended branch targets. If Armv8.5-A is supported by the hardware, execution of an instruction changes the value of PSTATE.BTYPE field. If an indirect branch lands on a guarded page the target instruction must be one of the BTI flavors, or in case of a direct call or jump it can be any other instruction. If the target instruction is not compatible with the value of PSTATE.BTYPE a Branch Target Exception is generated. In short, indirect jumps are compatible with BTI and while indirect calls are compatible with BTI and . Please refer to the specification for the details. Armv8.3-A PACIASP and PACIBSP are implicit branch target identification instructions which are equivalent with BTI c or BTI jc depending on system register configuration. BTI is used to mitigate JOP (Jump-oriented Programming) attacks by limiting the set of instructions which can be jumped to. BTI requires active linker support to mark the pages with BTI-enabled code as guarded. For ELF64 files BTI compatibility is recorded in the .note.gnu.property section. For a shared object or static binary it is required that all linked units support BTI. This means that even a single assembly file without the required note section turns-off BTI for the whole binary or shared object. The new BTI instructions are treated as NOPs on hardware which does not support Armv8.5-A or on pages which are not guarded. To insert this new and optional instruction compile with -mbranch-protection=standard (also enables PAuth) or +bti. When targeting a guarded page from a non-guarded page, weaker compatibility restrictions apply to maintain compatibility between legacy and new code. For detailed rules please refer to the Arm ARM. Compiler support ---------------- Compiler support requires understanding '-mbranch-protection=' and emitting the appropriate feature macros (__ARM_FEATURE_BTI_DEFAULT and __ARM_FEATURE_PAC_DEFAULT). The current state is the following: ------------------------------------------------------- | Compiler | -mbranch-protection | Feature macros | +----------+---------------------+--------------------+ | clang | 9.0.0 | 11.0.0 | +----------+---------------------+--------------------+ | gcc | 9 | expected in 10.1+ | ------------------------------------------------------- Available Platforms ------------------ Arm Fast Model and QEMU support both extensions. https://developer.arm.com/tools-and-software/simulation-models/fast-models https://www.qemu.org/ Implementation Notes -------------------- This change adds BTI landing pads even to assembly functions which are likely to be directly called only. In these cases, landing pads might be superfluous depending on what code the linker generates. Code size and performance impact for these cases would be negligible. Interaction with C code ----------------------- Pointer Authentication is a per-frame protection while Branch Target Identification can be turned on and off only for all code pages of a whole shared object or static binary. Because of these properties if C/C++ code is compiled without any of the above features but assembly files support any of them unconditionally there is no incompatibility between the two. Useful Links ------------ To fully understand the details of both PAuth and BTI it is advised to read the related chapters of the Arm Architecture Reference Manual (Arm ARM): https://developer.arm.com/documentation/ddi0487/latest/ Additional materials: "Providing protection for complex software" https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software Arm Compiler Reference Guide Version 6.14: -mbranch-protection https://developer.arm.com/documentation/101754/0614/armclang-Reference/armclang-Command-line-Options/-mbranch-protection?lang=en Arm C Language Extensions (ACLE) https://developer.arm.com/docs/101028/latest Addional Notes -------------- This patch is a copy of the work done by Tamas Petz in boringssl. It contains the changes from the following commits: aarch64: support BTI and pointer authentication in assembly Change-Id: I4335f92e2ccc8e209c7d68a0a79f1acdf3aeb791 URL: https://boringssl-review.googlesource.com/c/boringssl/+/42084 aarch64: Improve conditional compilation Change-Id: I14902a64e5f403c2b6a117bc9f5fb1a4f4611ebf URL: https://boringssl-review.googlesource.com/c/boringssl/+/43524 aarch64: Fix name of gnu property note section Change-Id: I6c432d1c852129e9c273f6469a8b60e3983671ec URL: https://boringssl-review.googlesource.com/c/boringssl/+/44024 Change-Id: I2d95ebc5e4aeb5610d3b226f9754ee80cf74a9af Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/16674) Reviewed by: emaste, Pierre Pronchery Obtained from: OpenSSL 19e277dd19f2 Differential Revision: https://reviews.freebsd.org/D41940 --- crypto/openssl/crypto/aes/asm/aesv8-armx.pl | 18 +++++- crypto/openssl/crypto/aes/asm/vpaes-armv8.pl | 39 +++++++------ crypto/openssl/crypto/aes/build.info | 1 + crypto/openssl/crypto/arm64cpuid.pl | 10 ++++ crypto/openssl/crypto/arm_arch.h | 58 ++++++++++++++++++++ crypto/openssl/crypto/bn/asm/armv8-mont.pl | 19 +++++-- crypto/openssl/crypto/chacha/asm/chacha-armv8.pl | 18 +++--- crypto/openssl/crypto/ec/asm/ecp_nistz256-armv8.pl | 64 +++++++++++++--------- .../openssl/crypto/modes/asm/aes-gcm-armv8_64.pl | 6 ++ crypto/openssl/crypto/modes/asm/ghashv8-armx.pl | 11 ++++ .../openssl/crypto/poly1305/asm/poly1305-armv8.pl | 17 +++++- crypto/openssl/crypto/sha/asm/keccak1600-armv8.pl | 30 +++++----- crypto/openssl/crypto/sha/asm/sha1-armv8.pl | 5 +- crypto/openssl/crypto/sha/asm/sha512-armv8.pl | 11 +++- crypto/openssl/crypto/sha/build.info | 1 + 15 files changed, 228 insertions(+), 80 deletions(-) diff --git a/crypto/openssl/crypto/aes/asm/aesv8-armx.pl b/crypto/openssl/crypto/aes/asm/aesv8-armx.pl index 544dc7e8effe..837eb69e4aa1 100755 --- a/crypto/openssl/crypto/aes/asm/aesv8-armx.pl +++ b/crypto/openssl/crypto/aes/asm/aesv8-armx.pl @@ -120,6 +120,8 @@ ${prefix}_set_encrypt_key: .Lenc_key: ___ $code.=<<___ if ($flavour =~ /64/); + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 ___ @@ -295,7 +297,7 @@ $code.=<<___; ${prefix}_set_decrypt_key: ___ $code.=<<___ if ($flavour =~ /64/); - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 ___ @@ -339,7 +341,7 @@ $code.=<<___ if ($flavour !~ /64/); ___ $code.=<<___ if ($flavour =~ /64/); ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret ___ $code.=<<___; @@ -359,6 +361,11 @@ $code.=<<___; .type ${prefix}_${dir}crypt,%function .align 5 ${prefix}_${dir}crypt: +___ +$code.=<<___ if ($flavour =~ /64/); + AARCH64_VALID_CALL_TARGET +___ +$code.=<<___; ldr $rounds,[$key,#240] vld1.32 {$rndkey0},[$key],#16 vld1.8 {$inout},[$inp] @@ -442,6 +449,7 @@ $code.=<<___; ${prefix}_ecb_encrypt: ___ $code.=<<___ if ($flavour =~ /64/); + AARCH64_VALID_CALL_TARGET subs $len,$len,#16 // Original input data size bigger than 16, jump to big size processing. b.ne .Lecb_big_size @@ -1236,6 +1244,8 @@ $code.=<<___; ${prefix}_cbc_encrypt: ___ $code.=<<___ if ($flavour =~ /64/); + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 ___ @@ -1764,6 +1774,8 @@ $code.=<<___; ${prefix}_ctr32_encrypt_blocks: ___ $code.=<<___ if ($flavour =~ /64/); + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 ___ @@ -2256,6 +2268,7 @@ $code.=<<___ if ($flavour =~ /64/); ${prefix}_xts_encrypt: ___ $code.=<<___ if ($flavour =~ /64/); + AARCH64_VALID_CALL_TARGET cmp $len,#16 // Original input data size bigger than 16, jump to big size processing. b.ne .Lxts_enc_big_size @@ -2930,6 +2943,7 @@ $code.=<<___ if ($flavour =~ /64/); .type ${prefix}_xts_decrypt,%function .align 5 ${prefix}_xts_decrypt: + AARCH64_VALID_CALL_TARGET ___ $code.=<<___ if ($flavour =~ /64/); cmp $len,#16 diff --git a/crypto/openssl/crypto/aes/asm/vpaes-armv8.pl b/crypto/openssl/crypto/aes/asm/vpaes-armv8.pl index dcd5065e68c0..49988e9c2b29 100755 --- a/crypto/openssl/crypto/aes/asm/vpaes-armv8.pl +++ b/crypto/openssl/crypto/aes/asm/vpaes-armv8.pl @@ -53,6 +53,8 @@ open OUT,"| \"$^X\" $xlate $flavour \"$output\"" *STDOUT=*OUT; $code.=<<___; +#include "arm_arch.h" + .text .type _vpaes_consts,%object @@ -259,7 +261,7 @@ _vpaes_encrypt_core: .type vpaes_encrypt,%function .align 4 vpaes_encrypt: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -269,7 +271,7 @@ vpaes_encrypt: st1 {v0.16b}, [$out] ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_encrypt,.-vpaes_encrypt @@ -492,7 +494,7 @@ _vpaes_decrypt_core: .type vpaes_decrypt,%function .align 4 vpaes_decrypt: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -502,7 +504,7 @@ vpaes_decrypt: st1 {v0.16b}, [$out] ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_decrypt,.-vpaes_decrypt @@ -673,7 +675,7 @@ _vpaes_key_preheat: .type _vpaes_schedule_core,%function .align 4 _vpaes_schedule_core: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29, x30, [sp,#-16]! add x29,sp,#0 @@ -838,7 +840,7 @@ _vpaes_schedule_core: eor v6.16b, v6.16b, v6.16b // vpxor %xmm6, %xmm6, %xmm6 eor v7.16b, v7.16b, v7.16b // vpxor %xmm7, %xmm7, %xmm7 ldp x29, x30, [sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size _vpaes_schedule_core,.-_vpaes_schedule_core @@ -1051,7 +1053,7 @@ _vpaes_schedule_mangle: .type vpaes_set_encrypt_key,%function .align 4 vpaes_set_encrypt_key: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 stp d8,d9,[sp,#-16]! // ABI spec says so @@ -1067,7 +1069,7 @@ vpaes_set_encrypt_key: ldp d8,d9,[sp],#16 ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_set_encrypt_key,.-vpaes_set_encrypt_key @@ -1075,7 +1077,7 @@ vpaes_set_encrypt_key: .type vpaes_set_decrypt_key,%function .align 4 vpaes_set_decrypt_key: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 stp d8,d9,[sp,#-16]! // ABI spec says so @@ -1095,7 +1097,7 @@ vpaes_set_decrypt_key: ldp d8,d9,[sp],#16 ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_set_decrypt_key,.-vpaes_set_decrypt_key ___ @@ -1108,11 +1110,11 @@ $code.=<<___; .type vpaes_cbc_encrypt,%function .align 4 vpaes_cbc_encrypt: + AARCH64_SIGN_LINK_REGISTER cbz $len, .Lcbc_abort cmp w5, #0 // check direction b.eq vpaes_cbc_decrypt - .inst 0xd503233f // paciasp stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -1135,15 +1137,16 @@ vpaes_cbc_encrypt: st1 {v0.16b}, [$ivec] // write ivec ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp .Lcbc_abort: + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_cbc_encrypt,.-vpaes_cbc_encrypt .type vpaes_cbc_decrypt,%function .align 4 vpaes_cbc_decrypt: - .inst 0xd503233f // paciasp + // Not adding AARCH64_SIGN_LINK_REGISTER here because vpaes_cbc_decrypt is jumped to + // only from vpaes_cbc_encrypt which has already signed the return address. stp x29,x30,[sp,#-16]! add x29,sp,#0 stp d8,d9,[sp,#-16]! // ABI spec says so @@ -1185,7 +1188,7 @@ vpaes_cbc_decrypt: ldp d10,d11,[sp],#16 ldp d8,d9,[sp],#16 ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_cbc_decrypt,.-vpaes_cbc_decrypt ___ @@ -1195,7 +1198,7 @@ $code.=<<___; .type vpaes_ecb_encrypt,%function .align 4 vpaes_ecb_encrypt: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 stp d8,d9,[sp,#-16]! // ABI spec says so @@ -1229,7 +1232,7 @@ vpaes_ecb_encrypt: ldp d10,d11,[sp],#16 ldp d8,d9,[sp],#16 ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_ecb_encrypt,.-vpaes_ecb_encrypt @@ -1237,7 +1240,7 @@ vpaes_ecb_encrypt: .type vpaes_ecb_decrypt,%function .align 4 vpaes_ecb_decrypt: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 stp d8,d9,[sp,#-16]! // ABI spec says so @@ -1271,7 +1274,7 @@ vpaes_ecb_decrypt: ldp d10,d11,[sp],#16 ldp d8,d9,[sp],#16 ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size vpaes_ecb_decrypt,.-vpaes_ecb_decrypt ___ diff --git a/crypto/openssl/crypto/aes/build.info b/crypto/openssl/crypto/aes/build.info index b250903fa6e2..47f99fdf3366 100644 --- a/crypto/openssl/crypto/aes/build.info +++ b/crypto/openssl/crypto/aes/build.info @@ -116,6 +116,7 @@ INCLUDE[aes-mips.o]=.. GENERATE[aesv8-armx.S]=asm/aesv8-armx.pl INCLUDE[aesv8-armx.o]=.. GENERATE[vpaes-armv8.S]=asm/vpaes-armv8.pl +INCLUDE[vpaes-armv8.o]=.. GENERATE[aes-armv4.S]=asm/aes-armv4.pl INCLUDE[aes-armv4.o]=.. diff --git a/crypto/openssl/crypto/arm64cpuid.pl b/crypto/openssl/crypto/arm64cpuid.pl index ac76dd449f37..11f0e5027942 100755 --- a/crypto/openssl/crypto/arm64cpuid.pl +++ b/crypto/openssl/crypto/arm64cpuid.pl @@ -31,6 +31,7 @@ $code.=<<___; .globl _armv7_neon_probe .type _armv7_neon_probe,%function _armv7_neon_probe: + AARCH64_VALID_CALL_TARGET orr v15.16b, v15.16b, v15.16b ret .size _armv7_neon_probe,.-_armv7_neon_probe @@ -38,6 +39,7 @@ _armv7_neon_probe: .globl _armv7_tick .type _armv7_tick,%function _armv7_tick: + AARCH64_VALID_CALL_TARGET #ifdef __APPLE__ mrs x0, CNTPCT_EL0 #else @@ -49,6 +51,7 @@ _armv7_tick: .globl _armv8_aes_probe .type _armv8_aes_probe,%function _armv8_aes_probe: + AARCH64_VALID_CALL_TARGET aese v0.16b, v0.16b ret .size _armv8_aes_probe,.-_armv8_aes_probe @@ -56,6 +59,7 @@ _armv8_aes_probe: .globl _armv8_sha1_probe .type _armv8_sha1_probe,%function _armv8_sha1_probe: + AARCH64_VALID_CALL_TARGET sha1h s0, s0 ret .size _armv8_sha1_probe,.-_armv8_sha1_probe @@ -63,6 +67,7 @@ _armv8_sha1_probe: .globl _armv8_sha256_probe .type _armv8_sha256_probe,%function _armv8_sha256_probe: + AARCH64_VALID_CALL_TARGET sha256su0 v0.4s, v0.4s ret .size _armv8_sha256_probe,.-_armv8_sha256_probe @@ -70,6 +75,7 @@ _armv8_sha256_probe: .globl _armv8_pmull_probe .type _armv8_pmull_probe,%function _armv8_pmull_probe: + AARCH64_VALID_CALL_TARGET pmull v0.1q, v0.1d, v0.1d ret .size _armv8_pmull_probe,.-_armv8_pmull_probe @@ -77,6 +83,7 @@ _armv8_pmull_probe: .globl _armv8_sha512_probe .type _armv8_sha512_probe,%function _armv8_sha512_probe: + AARCH64_VALID_CALL_TARGET .long 0xcec08000 // sha512su0 v0.2d,v0.2d ret .size _armv8_sha512_probe,.-_armv8_sha512_probe @@ -84,6 +91,7 @@ _armv8_sha512_probe: .globl _armv8_cpuid_probe .type _armv8_cpuid_probe,%function _armv8_cpuid_probe: + AARCH64_VALID_CALL_TARGET mrs x0, midr_el1 ret .size _armv8_cpuid_probe,.-_armv8_cpuid_probe @@ -92,6 +100,7 @@ _armv8_cpuid_probe: .type OPENSSL_cleanse,%function .align 5 OPENSSL_cleanse: + AARCH64_VALID_CALL_TARGET cbz x1,.Lret // len==0? cmp x1,#15 b.hi .Lot // len>15 @@ -123,6 +132,7 @@ OPENSSL_cleanse: .type CRYPTO_memcmp,%function .align 4 CRYPTO_memcmp: + AARCH64_VALID_CALL_TARGET eor w3,w3,w3 cbz x2,.Lno_data // len==0? cmp x2,#16 diff --git a/crypto/openssl/crypto/arm_arch.h b/crypto/openssl/crypto/arm_arch.h index 45d7e1556475..a815a5c72b7f 100644 --- a/crypto/openssl/crypto/arm_arch.h +++ b/crypto/openssl/crypto/arm_arch.h @@ -126,4 +126,62 @@ extern unsigned int OPENSSL_armv8_rsa_neonized; # define MIDR_IS_CPU_MODEL(midr, imp, partnum) \ (((midr) & MIDR_CPU_MODEL_MASK) == MIDR_CPU_MODEL(imp, partnum)) + +#if defined(__ASSEMBLER__) + + /* + * Support macros for + * - Armv8.3-A Pointer Authentication and + * - Armv8.5-A Branch Target Identification + * features which require emitting a .note.gnu.property section with the + * appropriate architecture-dependent feature bits set. + * Read more: "ELF for the Arm® 64-bit Architecture" + */ + +# if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1 +# define GNU_PROPERTY_AARCH64_BTI (1 << 0) /* Has Branch Target Identification */ +# define AARCH64_VALID_CALL_TARGET hint #34 /* BTI 'c' */ +# else +# define GNU_PROPERTY_AARCH64_BTI 0 /* No Branch Target Identification */ +# define AARCH64_VALID_CALL_TARGET +# endif + +# if defined(__ARM_FEATURE_PAC_DEFAULT) && \ + (__ARM_FEATURE_PAC_DEFAULT & 1) == 1 /* Signed with A-key */ +# define GNU_PROPERTY_AARCH64_POINTER_AUTH \ + (1 << 1) /* Has Pointer Authentication */ +# define AARCH64_SIGN_LINK_REGISTER hint #25 /* PACIASP */ +# define AARCH64_VALIDATE_LINK_REGISTER hint #29 /* AUTIASP */ +# elif defined(__ARM_FEATURE_PAC_DEFAULT) && \ + (__ARM_FEATURE_PAC_DEFAULT & 2) == 2 /* Signed with B-key */ +# define GNU_PROPERTY_AARCH64_POINTER_AUTH \ + (1 << 1) /* Has Pointer Authentication */ +# define AARCH64_SIGN_LINK_REGISTER hint #27 /* PACIBSP */ +# define AARCH64_VALIDATE_LINK_REGISTER hint #31 /* AUTIBSP */ +# else +# define GNU_PROPERTY_AARCH64_POINTER_AUTH 0 /* No Pointer Authentication */ +# if GNU_PROPERTY_AARCH64_BTI != 0 +# define AARCH64_SIGN_LINK_REGISTER AARCH64_VALID_CALL_TARGET +# else +# define AARCH64_SIGN_LINK_REGISTER +# endif +# define AARCH64_VALIDATE_LINK_REGISTER +# endif + +# if GNU_PROPERTY_AARCH64_POINTER_AUTH != 0 || GNU_PROPERTY_AARCH64_BTI != 0 + .pushsection .note.gnu.property, "a"; + .balign 8; + .long 4; + .long 0x10; + .long 0x5; + .asciz "GNU"; + .long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ + .long 4; + .long (GNU_PROPERTY_AARCH64_POINTER_AUTH | GNU_PROPERTY_AARCH64_BTI); + .long 0; + .popsection; +# endif + +# endif /* defined __ASSEMBLER__ */ + #endif diff --git a/crypto/openssl/crypto/bn/asm/armv8-mont.pl b/crypto/openssl/crypto/bn/asm/armv8-mont.pl index 54d2e8245f15..21ab12bdf07e 100755 --- a/crypto/openssl/crypto/bn/asm/armv8-mont.pl +++ b/crypto/openssl/crypto/bn/asm/armv8-mont.pl @@ -67,8 +67,8 @@ $n0="x4"; # const BN_ULONG *n0, $num="x5"; # int num); $code.=<<___; +#include "arm_arch.h" #ifndef __KERNEL__ -# include "arm_arch.h" .extern OPENSSL_armv8_rsa_neonized .hidden OPENSSL_armv8_rsa_neonized #endif @@ -78,6 +78,7 @@ $code.=<<___; .type bn_mul_mont,%function .align 5 bn_mul_mont: + AARCH64_SIGN_LINK_REGISTER .Lbn_mul_mont: tst $num,#3 b.ne .Lmul_mont @@ -288,6 +289,7 @@ bn_mul_mont: mov x0,#1 ldp x23,x24,[x29,#48] ldr x29,[sp],#64 + AARCH64_VALIDATE_LINK_REGISTER ret .size bn_mul_mont,.-bn_mul_mont ___ @@ -309,6 +311,8 @@ $code.=<<___; .type bn_mul8x_mont_neon,%function .align 5 bn_mul8x_mont_neon: + // Not adding AARCH64_SIGN_LINK_REGISTER here because bn_mul8x_mont_neon is jumped to + // only from bn_mul_mont which has already signed the return address. stp x29,x30,[sp,#-80]! mov x16,sp stp d8,d9,[sp,#16] @@ -649,6 +653,7 @@ $code.=<<___; ldp d10,d11,[sp,#32] ldp d8,d9,[sp,#16] ldr x29,[sp],#80 + AARCH64_VALIDATE_LINK_REGISTER ret // bx lr .size bn_mul8x_mont_neon,.-bn_mul8x_mont_neon @@ -671,7 +676,8 @@ __bn_sqr8x_mont: cmp $ap,$bp b.ne __bn_mul4x_mont .Lsqr8x_mont: - .inst 0xd503233f // paciasp + // Not adding AARCH64_SIGN_LINK_REGISTER here because __bn_sqr8x_mont is jumped to + // only from bn_mul_mont which has already signed the return address. stp x29,x30,[sp,#-128]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -1425,7 +1431,8 @@ $code.=<<___; ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldr x29,[sp],#128 - .inst 0xd50323bf // autiasp + // x30 is loaded earlier + AARCH64_VALIDATE_LINK_REGISTER ret .size __bn_sqr8x_mont,.-__bn_sqr8x_mont ___ @@ -1449,7 +1456,8 @@ $code.=<<___; .type __bn_mul4x_mont,%function .align 5 __bn_mul4x_mont: - .inst 0xd503233f // paciasp + // Not adding AARCH64_SIGN_LINK_REGISTER here because __bn_mul4x_mont is jumped to + // only from bn_mul_mont (or __bn_sqr8x_mont from bn_mul_mont) which has already signed the return address. stp x29,x30,[sp,#-128]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -1883,7 +1891,8 @@ __bn_mul4x_mont: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldr x29,[sp],#128 - .inst 0xd50323bf // autiasp + // x30 loaded earlier + AARCH64_VALIDATE_LINK_REGISTER ret .size __bn_mul4x_mont,.-__bn_mul4x_mont ___ diff --git a/crypto/openssl/crypto/chacha/asm/chacha-armv8.pl b/crypto/openssl/crypto/chacha/asm/chacha-armv8.pl index dcdc4a04e367..e1a8b8159421 100755 --- a/crypto/openssl/crypto/chacha/asm/chacha-armv8.pl +++ b/crypto/openssl/crypto/chacha/asm/chacha-armv8.pl @@ -132,8 +132,8 @@ my ($a3,$b3,$c3,$d3)=map(($_&~3)+(($_+1)&3),($a2,$b2,$c2,$d2)); } $code.=<<___; +#include "arm_arch.h" #ifndef __KERNEL__ -# include "arm_arch.h" .extern OPENSSL_armcap_P .hidden OPENSSL_armcap_P #endif @@ -153,6 +153,7 @@ $code.=<<___; .type ChaCha20_ctr32,%function .align 5 ChaCha20_ctr32: + AARCH64_SIGN_LINK_REGISTER cbz $len,.Labort cmp $len,#192 b.lo .Lshort @@ -165,7 +166,6 @@ ChaCha20_ctr32: #endif .Lshort: - .inst 0xd503233f // paciasp stp x29,x30,[sp,#-96]! add x29,sp,#0 @@ -285,8 +285,8 @@ $code.=<<___; ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 - .inst 0xd50323bf // autiasp .Labort: + AARCH64_VALIDATE_LINK_REGISTER ret .align 4 @@ -342,7 +342,7 @@ $code.=<<___; ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ChaCha20_ctr32,.-ChaCha20_ctr32 ___ @@ -432,8 +432,8 @@ $code.=<<___; .type ChaCha20_neon,%function .align 5 ChaCha20_neon: + AARCH64_SIGN_LINK_REGISTER .LChaCha20_neon: - .inst 0xd503233f // paciasp stp x29,x30,[sp,#-96]! add x29,sp,#0 @@ -667,7 +667,7 @@ $code.=<<___; ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .align 4 @@ -799,7 +799,7 @@ $code.=<<___; ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ChaCha20_neon,.-ChaCha20_neon ___ @@ -844,7 +844,7 @@ $code.=<<___; .type ChaCha20_512_neon,%function .align 5 ChaCha20_512_neon: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-96]! add x29,sp,#0 @@ -1268,7 +1268,7 @@ $code.=<<___; ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ChaCha20_512_neon,.-ChaCha20_512_neon ___ diff --git a/crypto/openssl/crypto/ec/asm/ecp_nistz256-armv8.pl b/crypto/openssl/crypto/ec/asm/ecp_nistz256-armv8.pl index 81ee3947d7e4..6c5d0e8b3cf0 100755 --- a/crypto/openssl/crypto/ec/asm/ecp_nistz256-armv8.pl +++ b/crypto/openssl/crypto/ec/asm/ecp_nistz256-armv8.pl @@ -122,7 +122,7 @@ $code.=<<___; .type ecp_nistz256_to_mont,%function .align 6 ecp_nistz256_to_mont: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -138,7 +138,7 @@ ecp_nistz256_to_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_to_mont,.-ecp_nistz256_to_mont @@ -147,7 +147,7 @@ ecp_nistz256_to_mont: .type ecp_nistz256_from_mont,%function .align 4 ecp_nistz256_from_mont: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -163,7 +163,7 @@ ecp_nistz256_from_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_from_mont,.-ecp_nistz256_from_mont @@ -173,7 +173,7 @@ ecp_nistz256_from_mont: .type ecp_nistz256_mul_mont,%function .align 4 ecp_nistz256_mul_mont: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -188,7 +188,7 @@ ecp_nistz256_mul_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_mul_mont,.-ecp_nistz256_mul_mont @@ -197,7 +197,7 @@ ecp_nistz256_mul_mont: .type ecp_nistz256_sqr_mont,%function .align 4 ecp_nistz256_sqr_mont: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -211,7 +211,7 @@ ecp_nistz256_sqr_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_sqr_mont,.-ecp_nistz256_sqr_mont @@ -221,7 +221,7 @@ ecp_nistz256_sqr_mont: .type ecp_nistz256_add,%function .align 4 ecp_nistz256_add: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -235,7 +235,7 @@ ecp_nistz256_add: bl __ecp_nistz256_add ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_add,.-ecp_nistz256_add @@ -244,7 +244,7 @@ ecp_nistz256_add: .type ecp_nistz256_div_by_2,%function .align 4 ecp_nistz256_div_by_2: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -256,7 +256,7 @@ ecp_nistz256_div_by_2: bl __ecp_nistz256_div_by_2 ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_div_by_2,.-ecp_nistz256_div_by_2 @@ -265,7 +265,7 @@ ecp_nistz256_div_by_2: .type ecp_nistz256_mul_by_2,%function .align 4 ecp_nistz256_mul_by_2: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -281,7 +281,7 @@ ecp_nistz256_mul_by_2: bl __ecp_nistz256_add // ret = a+a // 2*a ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_mul_by_2,.-ecp_nistz256_mul_by_2 @@ -290,7 +290,7 @@ ecp_nistz256_mul_by_2: .type ecp_nistz256_mul_by_3,%function .align 4 ecp_nistz256_mul_by_3: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -317,7 +317,7 @@ ecp_nistz256_mul_by_3: bl __ecp_nistz256_add // ret += a // 2*a+a=3*a ldp x29,x30,[sp],#16 - .inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_mul_by_3,.-ecp_nistz256_mul_by_3 @@ -327,7 +327,7 @@ ecp_nistz256_mul_by_3: .type ecp_nistz256_sub,%function .align 4 ecp_nistz256_sub: - .inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -339,7 +339,7 @@ ecp_nistz256_sub: bl __ecp_nistz256_sub_from *** 542 LINES SKIPPED *** From nobody Mon Oct 2 16:13:46 2023 X-Original-To: dev-commits-src-main@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 4RzmGf71Swz4wFBx; Mon, 2 Oct 2023 16:13:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzmGf4hCDz4LKQ; Mon, 2 Oct 2023 16:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696263226; 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=LiJKTxyZFxnjBsPiZbOdtAXpcW729O2bMkZm/0ep2Og=; b=TmPHRDqaw0WX8bgZrmd3eybODYMPXTcKlQ06fx5j1QH36A1SGLcBmPrA0amM0mVi6T00LE +Q+x7CMWJWTiPfoxESUXJF2zITg/fX9LWKlZNj5O5X/QhdjkpKDMYoWZq7mVW0M0cVe1Yc ELDYXSB/NRelk+i31u46hQpWWbzwbwQo+AV7WAej2SccSXwVJlkOlFH2wjrgLjATak6YBj 4wcNWkB2260gAUm/WoFL+tkJmCQN2XhjDlFIODgBxNonBjzGTxssqGXPYoeBofXtLYisRU MRlEirc7sF3Wh1liSlBdVbFijRl/tKaWbz9G6h+CsMHUfB/qrBMGs10jXKKOCg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696263226; a=rsa-sha256; cv=none; b=QZxIlJNsd4AaggydKE3aweKuS1Hoqrlfvdva+kns/hwJAzgXzLcYNB9KpygYMT1pS7D7gU zEnC/HUxyPDzlvClTY459qKn3+tt17CyAuN9EhA5bZIAM/9yNOHktVOdD44GHriREy4PdF G9TYA0RyvbAKJIYT+qqp2htCbukKgYM8AxWlwWm5O1ZsweCnO0CtFTpqqzVoWA+9pHb6yl oF9/hNTQ5iGH2VgoKnOAwosSCcG1Wb0j3qgSc2treNJnNKSSbfL/BU/6AejGhWp7CbetwL PghK3oDmGVljPyLuswXuQM2RwoIYXmTDBdA7kcsGzYEkif6xg7ArnpiIm6xuZA== 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=1696263226; 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=LiJKTxyZFxnjBsPiZbOdtAXpcW729O2bMkZm/0ep2Og=; b=RGS5Yfhw6ae85GONu4ELsot2whMpgAoKb/D5b0++gt81deOHxgU+MxgDWnPlokR+mGfarp js3aJlC9XoRZtLzd1eo/6/zOGC2ERWAMHPfnwzOXUatHQoQuKhP3t/3HGkxELVKBP+9mEk jFuktYsgzkFzI81E7qigWeHpPGA5YqqWgi0/QK1wRQol0A98oPT7mJE0Z5Hh+8m9ilnkD0 RQ6p3nB856nIfG75YDCXkme/kUXXccc9NaQdaRjJsYHOsVqq/W8F5XZEHb5Z5WHR4gHuEB Kr/Cgh4pVsddXJfE1JidQBQRduivwTE2c9T50BSG5fpboTRG1KUKwEXHvsuVpg== 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 4RzmGf3Wlsz4Ds; Mon, 2 Oct 2023 16:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392GDkju068964; Mon, 2 Oct 2023 16:13:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392GDktG068961; Mon, 2 Oct 2023 16:13:46 GMT (envelope-from git) Date: Mon, 2 Oct 2023 16:13:46 GMT Message-Id: <202310021613.392GDktG068961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 417778192361 - main - aarch64: fix branch target indications in arm64cpuid.pl and keccak1600 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 41777819236110907dd4cff98ef70dfd0629f744 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=41777819236110907dd4cff98ef70dfd0629f744 commit 41777819236110907dd4cff98ef70dfd0629f744 Author: Tom Cosgrove AuthorDate: 2022-02-07 14:44:56 +0000 Commit: Andrew Turner CommitDate: 2023-10-02 16:12:49 +0000 aarch64: fix branch target indications in arm64cpuid.pl and keccak1600 Add missing AARCH64_VALID_CALL_TARGET to armv8_rng_probe(). Also add these to the functions defined by gen_random(), and note that this Perl sub prints the assembler out directly, not going via the $code xlate mechanism (and therefore coming before the include of arm_arch.h). So fix this too. In KeccakF1600_int, AARCH64_SIGN_LINK_REGISTER functions as AARCH64_VALID_CALL_TARGET on BTI-only builds, so it needs to come before the 'adr' line. Change-Id: If241efe71591c88253a3e36647ced00300c3c1a3 Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17653) Obtained from: OpenSSL 3a23f01268ec --- crypto/openssl/crypto/sha/asm/keccak1600-armv8.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/openssl/crypto/sha/asm/keccak1600-armv8.pl b/crypto/openssl/crypto/sha/asm/keccak1600-armv8.pl index cf54b62c636a..40f7aa7a695a 100755 --- a/crypto/openssl/crypto/sha/asm/keccak1600-armv8.pl +++ b/crypto/openssl/crypto/sha/asm/keccak1600-armv8.pl @@ -126,8 +126,8 @@ $code.=<<___; .type KeccakF1600_int,%function .align 5 KeccakF1600_int: - adr $C[2],iotas AARCH64_SIGN_LINK_REGISTER + adr $C[2],iotas stp $C[2],x30,[sp,#16] // 32 bytes on top are mine b .Loop .align 4 From nobody Mon Oct 2 16:13:47 2023 X-Original-To: dev-commits-src-main@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 4RzmGh19TLz4wFF4; Mon, 2 Oct 2023 16:13:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzmGg5VQwz4LHB; Mon, 2 Oct 2023 16:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696263227; 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=PtAndqjK+zER+Ww6jUtAVbzKhd4ZHgq96RuFynGxS5Q=; b=DEs2KG1wNWeFI6DVASdN91cbXpKOXzSOBLt3YppFQX0UD4Lz3Tn55fboYLEJeCdoIny7EF plHPj3UHsWsHadQShaPVYlOOM2rVzKQ1FOWSHltiMd+sFn0dpMaAfmYkhmaFShZbVfAdPH waFrYlGrE3KvQX6W5QsPWvQZWd5PhJqYJQ/BCq9JhhjO7x0NkCpDBdXNoIOfZQEM9oNLC6 x+Tc+2WTozLb9tocgbfFfqSHvkyFhX8Q0VK033KW7l+ZGDjqdCBZ8iKHcV1dXquKy6z8f9 VMKko+YcLF+YntW1XmU3QcKw2aUTM/HhrqYhNCq0wTiLN22bUA5DogNbeShZ2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696263227; a=rsa-sha256; cv=none; b=nluPpKZV5VCfB+e1FQYkK3kdNe5vkw5qMGD24l/U8yVENDtNQ8fZpF4zJtqjU22S5mcgZa yOCWXG0kL0INwhE7pcEdg5RU9t94Nhm4c6NRSLFb1BHVo6X5+otoRvt+v//l9d8Cv6vyzd Xv36Tcxyn1/wxFwmLu3zjaUi1iegRXPuz4ZkEClFzVKZjt+xW3gjj2Bo9WvhRey+UMpI9a pHfK6HR6P2bVNftgubQ7R/hCuD6WSB3CpqC7Ds0zXWuh4ROryisH8uChL24tpcr1yh6WwK jBFxQzmgnC95twel74hlFSTuLnOTTUu4gD6ceOr8SXXkiv727o/Ph34Qj4Hg3A== 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=1696263227; 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=PtAndqjK+zER+Ww6jUtAVbzKhd4ZHgq96RuFynGxS5Q=; b=FrqtXi7wq9V0RHJrpenCt2IP5jhhSZL+Bz1otDJCVbuElMRO0ANqMDiFaG70CeukhBvCHO p38DSThqt1VpgLPp4cPxX1mtdt+tymRH1Vp8udiEUTJlKA+rIMVCRf4OE2gY4cj9S3N8oz EhJgLgUlLgWbWLrEZaimpR16B43XRv0VKGZaVqPe9T/2eWw6dfKN8tpI1Bm0mBNS5T9/v6 LIsNs62MdumybpneERUc4R/P/WkGJX8zeCzvrQz3sQ5pPxyv5b41J0PEusz0sMOc0XHX43 icxuzBgapJ1XOwc5Rzxfnm4CDq5PCAAdBZPEa/3SnQ08jFPDlHsMYhd8Av5EGw== 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 4RzmGg4Q6Nz3fZ; Mon, 2 Oct 2023 16:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392GDlWG069006; Mon, 2 Oct 2023 16:13:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392GDlpj069003; Mon, 2 Oct 2023 16:13:47 GMT (envelope-from git) Date: Mon, 2 Oct 2023 16:13:47 GMT Message-Id: <202310021613.392GDlpj069003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: bd9588bca05f - main - ossl: Rebuild the openssl asm List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd9588bca05f5cbdeac6e5f9f426b2589301d7c6 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=bd9588bca05f5cbdeac6e5f9f426b2589301d7c6 commit bd9588bca05f5cbdeac6e5f9f426b2589301d7c6 Author: Andrew Turner AuthorDate: 2023-09-21 13:06:54 +0000 Commit: Andrew Turner CommitDate: 2023-10-02 16:12:50 +0000 ossl: Rebuild the openssl asm This adds the new BTI instructions when needed to the arm64 assembly. Sponsored by: Arm Ltd Reviewed by: Pierre Pronchery (earlier version) Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41941 --- sys/crypto/openssl/aarch64/aes-gcm-armv8_64.S | 6 +++ sys/crypto/openssl/aarch64/aesv8-armx.S | 15 +++++- sys/crypto/openssl/aarch64/arm64cpuid.S | 10 ++++ sys/crypto/openssl/aarch64/arm_arch.h | 58 ++++++++++++++++++++++ sys/crypto/openssl/aarch64/armv8-mont.S | 19 ++++++-- sys/crypto/openssl/aarch64/chacha-armv8.S | 18 +++---- sys/crypto/openssl/aarch64/ecp_nistz256-armv8.S | 64 +++++++++++++++---------- sys/crypto/openssl/aarch64/ghashv8-armx.S | 3 ++ sys/crypto/openssl/aarch64/keccak1600-armv8.S | 30 ++++++------ sys/crypto/openssl/aarch64/poly1305-armv8.S | 17 ++++++- sys/crypto/openssl/aarch64/sha1-armv8.S | 5 +- sys/crypto/openssl/aarch64/sha256-armv8.S | 10 ++-- sys/crypto/openssl/aarch64/sha512-armv8.S | 8 ++-- sys/crypto/openssl/aarch64/vpaes-armv8.S | 39 ++++++++------- 14 files changed, 219 insertions(+), 83 deletions(-) diff --git a/sys/crypto/openssl/aarch64/aes-gcm-armv8_64.S b/sys/crypto/openssl/aarch64/aes-gcm-armv8_64.S index eb85dbc9f996..55856548fa6f 100644 --- a/sys/crypto/openssl/aarch64/aes-gcm-armv8_64.S +++ b/sys/crypto/openssl/aarch64/aes-gcm-armv8_64.S @@ -8,6 +8,7 @@ .type aes_gcm_enc_128_kernel,%function .align 4 aes_gcm_enc_128_kernel: + AARCH64_VALID_CALL_TARGET cbz x1, .L128_enc_ret stp x19, x20, [sp, #-112]! mov x16, x4 @@ -990,6 +991,7 @@ aes_gcm_enc_128_kernel: .type aes_gcm_dec_128_kernel,%function .align 4 aes_gcm_dec_128_kernel: + AARCH64_VALID_CALL_TARGET cbz x1, .L128_dec_ret stp x19, x20, [sp, #-112]! mov x16, x4 @@ -1982,6 +1984,7 @@ aes_gcm_dec_128_kernel: .type aes_gcm_enc_192_kernel,%function .align 4 aes_gcm_enc_192_kernel: + AARCH64_VALID_CALL_TARGET cbz x1, .L192_enc_ret stp x19, x20, [sp, #-112]! mov x16, x4 @@ -3039,6 +3042,7 @@ aes_gcm_enc_192_kernel: .type aes_gcm_dec_192_kernel,%function .align 4 aes_gcm_dec_192_kernel: + AARCH64_VALID_CALL_TARGET cbz x1, .L192_dec_ret stp x19, x20, [sp, #-112]! mov x16, x4 @@ -4106,6 +4110,7 @@ aes_gcm_dec_192_kernel: .type aes_gcm_enc_256_kernel,%function .align 4 aes_gcm_enc_256_kernel: + AARCH64_VALID_CALL_TARGET cbz x1, .L256_enc_ret stp x19, x20, [sp, #-112]! mov x16, x4 @@ -5230,6 +5235,7 @@ aes_gcm_enc_256_kernel: .type aes_gcm_dec_256_kernel,%function .align 4 aes_gcm_dec_256_kernel: + AARCH64_VALID_CALL_TARGET cbz x1, .L256_dec_ret stp x19, x20, [sp, #-112]! mov x16, x4 diff --git a/sys/crypto/openssl/aarch64/aesv8-armx.S b/sys/crypto/openssl/aarch64/aesv8-armx.S index d92a1d60c65c..6c6dd095fb84 100644 --- a/sys/crypto/openssl/aarch64/aesv8-armx.S +++ b/sys/crypto/openssl/aarch64/aesv8-armx.S @@ -15,6 +15,8 @@ .align 5 aes_v8_set_encrypt_key: .Lenc_key: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 mov x3,#-1 @@ -186,7 +188,7 @@ aes_v8_set_encrypt_key: .type aes_v8_set_decrypt_key,%function .align 5 aes_v8_set_decrypt_key: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 bl .Lenc_key @@ -220,13 +222,14 @@ aes_v8_set_decrypt_key: eor x0,x0,x0 // return value .Ldec_key_abort: ldp x29,x30,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size aes_v8_set_decrypt_key,.-aes_v8_set_decrypt_key .globl aes_v8_encrypt .type aes_v8_encrypt,%function .align 5 aes_v8_encrypt: + AARCH64_VALID_CALL_TARGET ldr w3,[x2,#240] ld1 {v0.4s},[x2],#16 ld1 {v2.16b},[x0] @@ -256,6 +259,7 @@ aes_v8_encrypt: .type aes_v8_decrypt,%function .align 5 aes_v8_decrypt: + AARCH64_VALID_CALL_TARGET ldr w3,[x2,#240] ld1 {v0.4s},[x2],#16 ld1 {v2.16b},[x0] @@ -285,6 +289,7 @@ aes_v8_decrypt: .type aes_v8_ecb_encrypt,%function .align 5 aes_v8_ecb_encrypt: + AARCH64_VALID_CALL_TARGET subs x2,x2,#16 // Original input data size bigger than 16, jump to big size processing. b.ne .Lecb_big_size @@ -1031,6 +1036,8 @@ aes_v8_ecb_encrypt: .type aes_v8_cbc_encrypt,%function .align 5 aes_v8_cbc_encrypt: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 subs x2,x2,#16 @@ -1506,6 +1513,8 @@ aes_v8_cbc_encrypt: .type aes_v8_ctr32_encrypt_blocks,%function .align 5 aes_v8_ctr32_encrypt_blocks: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 ldr w5,[x3,#240] @@ -1855,6 +1864,7 @@ aes_v8_ctr32_encrypt_blocks: .type aes_v8_xts_encrypt,%function .align 5 aes_v8_xts_encrypt: + AARCH64_VALID_CALL_TARGET cmp x2,#16 // Original input data size bigger than 16, jump to big size processing. b.ne .Lxts_enc_big_size @@ -2496,6 +2506,7 @@ aes_v8_xts_encrypt: .type aes_v8_xts_decrypt,%function .align 5 aes_v8_xts_decrypt: + AARCH64_VALID_CALL_TARGET cmp x2,#16 // Original input data size bigger than 16, jump to big size processing. b.ne .Lxts_dec_big_size diff --git a/sys/crypto/openssl/aarch64/arm64cpuid.S b/sys/crypto/openssl/aarch64/arm64cpuid.S index 5ee467c7f129..52c6ee5b65d3 100644 --- a/sys/crypto/openssl/aarch64/arm64cpuid.S +++ b/sys/crypto/openssl/aarch64/arm64cpuid.S @@ -8,6 +8,7 @@ .globl _armv7_neon_probe .type _armv7_neon_probe,%function _armv7_neon_probe: + AARCH64_VALID_CALL_TARGET orr v15.16b, v15.16b, v15.16b ret .size _armv7_neon_probe,.-_armv7_neon_probe @@ -15,6 +16,7 @@ _armv7_neon_probe: .globl _armv7_tick .type _armv7_tick,%function _armv7_tick: + AARCH64_VALID_CALL_TARGET #ifdef __APPLE__ mrs x0, CNTPCT_EL0 #else @@ -26,6 +28,7 @@ _armv7_tick: .globl _armv8_aes_probe .type _armv8_aes_probe,%function _armv8_aes_probe: + AARCH64_VALID_CALL_TARGET aese v0.16b, v0.16b ret .size _armv8_aes_probe,.-_armv8_aes_probe @@ -33,6 +36,7 @@ _armv8_aes_probe: .globl _armv8_sha1_probe .type _armv8_sha1_probe,%function _armv8_sha1_probe: + AARCH64_VALID_CALL_TARGET sha1h s0, s0 ret .size _armv8_sha1_probe,.-_armv8_sha1_probe @@ -40,6 +44,7 @@ _armv8_sha1_probe: .globl _armv8_sha256_probe .type _armv8_sha256_probe,%function _armv8_sha256_probe: + AARCH64_VALID_CALL_TARGET sha256su0 v0.4s, v0.4s ret .size _armv8_sha256_probe,.-_armv8_sha256_probe @@ -47,6 +52,7 @@ _armv8_sha256_probe: .globl _armv8_pmull_probe .type _armv8_pmull_probe,%function _armv8_pmull_probe: + AARCH64_VALID_CALL_TARGET pmull v0.1q, v0.1d, v0.1d ret .size _armv8_pmull_probe,.-_armv8_pmull_probe @@ -54,6 +60,7 @@ _armv8_pmull_probe: .globl _armv8_sha512_probe .type _armv8_sha512_probe,%function _armv8_sha512_probe: + AARCH64_VALID_CALL_TARGET .long 0xcec08000 // sha512su0 v0.2d,v0.2d ret .size _armv8_sha512_probe,.-_armv8_sha512_probe @@ -61,6 +68,7 @@ _armv8_sha512_probe: .globl _armv8_cpuid_probe .type _armv8_cpuid_probe,%function _armv8_cpuid_probe: + AARCH64_VALID_CALL_TARGET mrs x0, midr_el1 ret .size _armv8_cpuid_probe,.-_armv8_cpuid_probe @@ -69,6 +77,7 @@ _armv8_cpuid_probe: .type OPENSSL_cleanse,%function .align 5 OPENSSL_cleanse: + AARCH64_VALID_CALL_TARGET cbz x1,.Lret // len==0? cmp x1,#15 b.hi .Lot // len>15 @@ -100,6 +109,7 @@ OPENSSL_cleanse: .type CRYPTO_memcmp,%function .align 4 CRYPTO_memcmp: + AARCH64_VALID_CALL_TARGET eor w3,w3,w3 cbz x2,.Lno_data // len==0? cmp x2,#16 diff --git a/sys/crypto/openssl/aarch64/arm_arch.h b/sys/crypto/openssl/aarch64/arm_arch.h index 45d7e1556475..a815a5c72b7f 100644 --- a/sys/crypto/openssl/aarch64/arm_arch.h +++ b/sys/crypto/openssl/aarch64/arm_arch.h @@ -126,4 +126,62 @@ extern unsigned int OPENSSL_armv8_rsa_neonized; # define MIDR_IS_CPU_MODEL(midr, imp, partnum) \ (((midr) & MIDR_CPU_MODEL_MASK) == MIDR_CPU_MODEL(imp, partnum)) + +#if defined(__ASSEMBLER__) + + /* + * Support macros for + * - Armv8.3-A Pointer Authentication and + * - Armv8.5-A Branch Target Identification + * features which require emitting a .note.gnu.property section with the + * appropriate architecture-dependent feature bits set. + * Read more: "ELF for the Arm® 64-bit Architecture" + */ + +# if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1 +# define GNU_PROPERTY_AARCH64_BTI (1 << 0) /* Has Branch Target Identification */ +# define AARCH64_VALID_CALL_TARGET hint #34 /* BTI 'c' */ +# else +# define GNU_PROPERTY_AARCH64_BTI 0 /* No Branch Target Identification */ +# define AARCH64_VALID_CALL_TARGET +# endif + +# if defined(__ARM_FEATURE_PAC_DEFAULT) && \ + (__ARM_FEATURE_PAC_DEFAULT & 1) == 1 /* Signed with A-key */ +# define GNU_PROPERTY_AARCH64_POINTER_AUTH \ + (1 << 1) /* Has Pointer Authentication */ +# define AARCH64_SIGN_LINK_REGISTER hint #25 /* PACIASP */ +# define AARCH64_VALIDATE_LINK_REGISTER hint #29 /* AUTIASP */ +# elif defined(__ARM_FEATURE_PAC_DEFAULT) && \ + (__ARM_FEATURE_PAC_DEFAULT & 2) == 2 /* Signed with B-key */ +# define GNU_PROPERTY_AARCH64_POINTER_AUTH \ + (1 << 1) /* Has Pointer Authentication */ +# define AARCH64_SIGN_LINK_REGISTER hint #27 /* PACIBSP */ +# define AARCH64_VALIDATE_LINK_REGISTER hint #31 /* AUTIBSP */ +# else +# define GNU_PROPERTY_AARCH64_POINTER_AUTH 0 /* No Pointer Authentication */ +# if GNU_PROPERTY_AARCH64_BTI != 0 +# define AARCH64_SIGN_LINK_REGISTER AARCH64_VALID_CALL_TARGET +# else +# define AARCH64_SIGN_LINK_REGISTER +# endif +# define AARCH64_VALIDATE_LINK_REGISTER +# endif + +# if GNU_PROPERTY_AARCH64_POINTER_AUTH != 0 || GNU_PROPERTY_AARCH64_BTI != 0 + .pushsection .note.gnu.property, "a"; + .balign 8; + .long 4; + .long 0x10; + .long 0x5; + .asciz "GNU"; + .long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ + .long 4; + .long (GNU_PROPERTY_AARCH64_POINTER_AUTH | GNU_PROPERTY_AARCH64_BTI); + .long 0; + .popsection; +# endif + +# endif /* defined __ASSEMBLER__ */ + #endif diff --git a/sys/crypto/openssl/aarch64/armv8-mont.S b/sys/crypto/openssl/aarch64/armv8-mont.S index 4bdba95f80f8..8b85fb080aba 100644 --- a/sys/crypto/openssl/aarch64/armv8-mont.S +++ b/sys/crypto/openssl/aarch64/armv8-mont.S @@ -1,6 +1,6 @@ /* Do not modify. This file is auto-generated from armv8-mont.pl. */ +#include "arm_arch.h" #ifndef __KERNEL__ -# include "arm_arch.h" .hidden OPENSSL_armv8_rsa_neonized #endif @@ -10,6 +10,7 @@ .type bn_mul_mont,%function .align 5 bn_mul_mont: + AARCH64_SIGN_LINK_REGISTER .Lbn_mul_mont: tst x5,#3 b.ne .Lmul_mont @@ -220,11 +221,14 @@ bn_mul_mont: mov x0,#1 ldp x23,x24,[x29,#48] ldr x29,[sp],#64 + AARCH64_VALIDATE_LINK_REGISTER ret .size bn_mul_mont,.-bn_mul_mont .type bn_mul8x_mont_neon,%function .align 5 bn_mul8x_mont_neon: + // Not adding AARCH64_SIGN_LINK_REGISTER here because bn_mul8x_mont_neon is jumped to + // only from bn_mul_mont which has already signed the return address. stp x29,x30,[sp,#-80]! mov x16,sp stp d8,d9,[sp,#16] @@ -917,6 +921,7 @@ bn_mul8x_mont_neon: ldp d10,d11,[sp,#32] ldp d8,d9,[sp,#16] ldr x29,[sp],#80 + AARCH64_VALIDATE_LINK_REGISTER ret // bx lr .size bn_mul8x_mont_neon,.-bn_mul8x_mont_neon @@ -926,7 +931,8 @@ __bn_sqr8x_mont: cmp x1,x2 b.ne __bn_mul4x_mont .Lsqr8x_mont: -.inst 0xd503233f // paciasp + // Not adding AARCH64_SIGN_LINK_REGISTER here because __bn_sqr8x_mont is jumped to + // only from bn_mul_mont which has already signed the return address. stp x29,x30,[sp,#-128]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -1677,13 +1683,15 @@ __bn_sqr8x_mont: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldr x29,[sp],#128 -.inst 0xd50323bf // autiasp + // x30 is loaded earlier + AARCH64_VALIDATE_LINK_REGISTER ret .size __bn_sqr8x_mont,.-__bn_sqr8x_mont .type __bn_mul4x_mont,%function .align 5 __bn_mul4x_mont: -.inst 0xd503233f // paciasp + // Not adding AARCH64_SIGN_LINK_REGISTER here because __bn_mul4x_mont is jumped to + // only from bn_mul_mont (or __bn_sqr8x_mont from bn_mul_mont) which has already signed the return address. stp x29,x30,[sp,#-128]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -2117,7 +2125,8 @@ __bn_mul4x_mont: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldr x29,[sp],#128 -.inst 0xd50323bf // autiasp + // x30 loaded earlier + AARCH64_VALIDATE_LINK_REGISTER ret .size __bn_mul4x_mont,.-__bn_mul4x_mont .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 diff --git a/sys/crypto/openssl/aarch64/chacha-armv8.S b/sys/crypto/openssl/aarch64/chacha-armv8.S index 609e34f422a2..4f9d6bd372f7 100644 --- a/sys/crypto/openssl/aarch64/chacha-armv8.S +++ b/sys/crypto/openssl/aarch64/chacha-armv8.S @@ -1,6 +1,6 @@ /* Do not modify. This file is auto-generated from chacha-armv8.pl. */ +#include "arm_arch.h" #ifndef __KERNEL__ -# include "arm_arch.h" .hidden OPENSSL_armcap_P #endif @@ -21,6 +21,7 @@ .type ChaCha20_ctr32,%function .align 5 ChaCha20_ctr32: + AARCH64_SIGN_LINK_REGISTER cbz x2,.Labort cmp x2,#192 b.lo .Lshort @@ -33,7 +34,6 @@ ChaCha20_ctr32: #endif .Lshort: -.inst 0xd503233f // paciasp stp x29,x30,[sp,#-96]! add x29,sp,#0 @@ -245,8 +245,8 @@ ChaCha20_ctr32: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 -.inst 0xd50323bf // autiasp .Labort: + AARCH64_VALIDATE_LINK_REGISTER ret .align 4 @@ -302,7 +302,7 @@ ChaCha20_ctr32: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ChaCha20_ctr32,.-ChaCha20_ctr32 @@ -312,8 +312,8 @@ ChaCha20_ctr32: .type ChaCha20_neon,%function .align 5 ChaCha20_neon: + AARCH64_SIGN_LINK_REGISTER .LChaCha20_neon: -.inst 0xd503233f // paciasp stp x29,x30,[sp,#-96]! add x29,sp,#0 @@ -748,7 +748,7 @@ ChaCha20_neon: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .align 4 @@ -880,13 +880,13 @@ ChaCha20_neon: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ChaCha20_neon,.-ChaCha20_neon .type ChaCha20_512_neon,%function .align 5 ChaCha20_512_neon: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-96]! add x29,sp,#0 @@ -2030,6 +2030,6 @@ ChaCha20_512_neon: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ChaCha20_512_neon,.-ChaCha20_512_neon diff --git a/sys/crypto/openssl/aarch64/ecp_nistz256-armv8.S b/sys/crypto/openssl/aarch64/ecp_nistz256-armv8.S index d297ac15605c..73c367bcf1fc 100644 --- a/sys/crypto/openssl/aarch64/ecp_nistz256-armv8.S +++ b/sys/crypto/openssl/aarch64/ecp_nistz256-armv8.S @@ -2396,7 +2396,7 @@ ecp_nistz256_precomputed: .type ecp_nistz256_to_mont,%function .align 6 ecp_nistz256_to_mont: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -2412,7 +2412,7 @@ ecp_nistz256_to_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_to_mont,.-ecp_nistz256_to_mont @@ -2421,7 +2421,7 @@ ecp_nistz256_to_mont: .type ecp_nistz256_from_mont,%function .align 4 ecp_nistz256_from_mont: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -2437,7 +2437,7 @@ ecp_nistz256_from_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_from_mont,.-ecp_nistz256_from_mont @@ -2447,7 +2447,7 @@ ecp_nistz256_from_mont: .type ecp_nistz256_mul_mont,%function .align 4 ecp_nistz256_mul_mont: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -2462,7 +2462,7 @@ ecp_nistz256_mul_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_mul_mont,.-ecp_nistz256_mul_mont @@ -2471,7 +2471,7 @@ ecp_nistz256_mul_mont: .type ecp_nistz256_sqr_mont,%function .align 4 ecp_nistz256_sqr_mont: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-32]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -2485,7 +2485,7 @@ ecp_nistz256_sqr_mont: ldp x19,x20,[sp,#16] ldp x29,x30,[sp],#32 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_sqr_mont,.-ecp_nistz256_sqr_mont @@ -2495,7 +2495,7 @@ ecp_nistz256_sqr_mont: .type ecp_nistz256_add,%function .align 4 ecp_nistz256_add: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -2509,7 +2509,7 @@ ecp_nistz256_add: bl __ecp_nistz256_add ldp x29,x30,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_add,.-ecp_nistz256_add @@ -2518,7 +2518,7 @@ ecp_nistz256_add: .type ecp_nistz256_div_by_2,%function .align 4 ecp_nistz256_div_by_2: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -2530,7 +2530,7 @@ ecp_nistz256_div_by_2: bl __ecp_nistz256_div_by_2 ldp x29,x30,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_div_by_2,.-ecp_nistz256_div_by_2 @@ -2539,7 +2539,7 @@ ecp_nistz256_div_by_2: .type ecp_nistz256_mul_by_2,%function .align 4 ecp_nistz256_mul_by_2: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -2555,7 +2555,7 @@ ecp_nistz256_mul_by_2: bl __ecp_nistz256_add // ret = a+a // 2*a ldp x29,x30,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_mul_by_2,.-ecp_nistz256_mul_by_2 @@ -2564,7 +2564,7 @@ ecp_nistz256_mul_by_2: .type ecp_nistz256_mul_by_3,%function .align 4 ecp_nistz256_mul_by_3: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -2591,7 +2591,7 @@ ecp_nistz256_mul_by_3: bl __ecp_nistz256_add // ret += a // 2*a+a=3*a ldp x29,x30,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_mul_by_3,.-ecp_nistz256_mul_by_3 @@ -2601,7 +2601,7 @@ ecp_nistz256_mul_by_3: .type ecp_nistz256_sub,%function .align 4 ecp_nistz256_sub: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -2613,7 +2613,7 @@ ecp_nistz256_sub: bl __ecp_nistz256_sub_from ldp x29,x30,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_sub,.-ecp_nistz256_sub @@ -2622,7 +2622,7 @@ ecp_nistz256_sub: .type ecp_nistz256_neg,%function .align 4 ecp_nistz256_neg: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -2637,7 +2637,7 @@ ecp_nistz256_neg: bl __ecp_nistz256_sub_from ldp x29,x30,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_neg,.-ecp_nistz256_neg @@ -3015,7 +3015,7 @@ __ecp_nistz256_div_by_2: .type ecp_nistz256_point_double,%function .align 5 ecp_nistz256_point_double: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-96]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -3150,14 +3150,14 @@ ecp_nistz256_point_double: ldp x19,x20,[x29,#16] ldp x21,x22,[x29,#32] ldp x29,x30,[sp],#96 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_point_double,.-ecp_nistz256_point_double .globl ecp_nistz256_point_add .type ecp_nistz256_point_add,%function .align 5 ecp_nistz256_point_add: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-96]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -3404,14 +3404,14 @@ ecp_nistz256_point_add: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#96 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_point_add,.-ecp_nistz256_point_add .globl ecp_nistz256_point_add_affine .type ecp_nistz256_point_add_affine,%function .align 5 ecp_nistz256_point_add_affine: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-80]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -3610,7 +3610,7 @@ ecp_nistz256_point_add_affine: ldp x23,x24,[x29,#48] ldp x25,x26,[x29,#64] ldp x29,x30,[sp],#80 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size ecp_nistz256_point_add_affine,.-ecp_nistz256_point_add_affine //////////////////////////////////////////////////////////////////////// @@ -3620,6 +3620,8 @@ ecp_nistz256_point_add_affine: .type ecp_nistz256_ord_mul_mont,%function .align 4 ecp_nistz256_ord_mul_mont: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-64]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -3828,6 +3830,8 @@ ecp_nistz256_ord_mul_mont: .type ecp_nistz256_ord_sqr_mont,%function .align 4 ecp_nistz256_ord_sqr_mont: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-64]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -4016,6 +4020,8 @@ ecp_nistz256_ord_sqr_mont: .type ecp_nistz256_scatter_w5,%function .align 4 ecp_nistz256_scatter_w5: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -4078,6 +4084,8 @@ ecp_nistz256_scatter_w5: .type ecp_nistz256_gather_w5,%function .align 4 ecp_nistz256_gather_w5: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -4155,6 +4163,8 @@ ecp_nistz256_gather_w5: .type ecp_nistz256_scatter_w7,%function .align 4 ecp_nistz256_scatter_w7: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 @@ -4199,6 +4209,8 @@ ecp_nistz256_scatter_w7: .type ecp_nistz256_gather_w7,%function .align 4 ecp_nistz256_gather_w7: + AARCH64_VALID_CALL_TARGET + // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later. stp x29,x30,[sp,#-16]! add x29,sp,#0 diff --git a/sys/crypto/openssl/aarch64/ghashv8-armx.S b/sys/crypto/openssl/aarch64/ghashv8-armx.S index fe5cd49a25aa..9dec85cd4679 100644 --- a/sys/crypto/openssl/aarch64/ghashv8-armx.S +++ b/sys/crypto/openssl/aarch64/ghashv8-armx.S @@ -8,6 +8,7 @@ .type gcm_init_v8,%function .align 4 gcm_init_v8: + AARCH64_VALID_CALL_TARGET ld1 {v17.2d},[x1] //load input H movi v19.16b,#0xe1 shl v19.2d,v19.2d,#57 //0xc2.0 @@ -98,6 +99,7 @@ gcm_init_v8: .type gcm_gmult_v8,%function .align 4 gcm_gmult_v8: + AARCH64_VALID_CALL_TARGET ld1 {v17.2d},[x0] //load Xi movi v19.16b,#0xe1 ld1 {v20.2d,v21.2d},[x1] //load twisted H, ... @@ -139,6 +141,7 @@ gcm_gmult_v8: .type gcm_ghash_v8,%function .align 4 gcm_ghash_v8: + AARCH64_VALID_CALL_TARGET cmp x3,#64 b.hs .Lgcm_ghash_v8_4x ld1 {v0.2d},[x0] //load [rotated] Xi diff --git a/sys/crypto/openssl/aarch64/keccak1600-armv8.S b/sys/crypto/openssl/aarch64/keccak1600-armv8.S index cf63318a8d08..08b3cc351213 100644 --- a/sys/crypto/openssl/aarch64/keccak1600-armv8.S +++ b/sys/crypto/openssl/aarch64/keccak1600-armv8.S @@ -1,4 +1,6 @@ /* Do not modify. This file is auto-generated from keccak1600-armv8.pl. */ +#include "arm_arch.h" + .text .align 8 // strategic alignment and padding that allows to use @@ -34,8 +36,8 @@ iotas: .type KeccakF1600_int,%function .align 5 KeccakF1600_int: + AARCH64_SIGN_LINK_REGISTER adr x28,iotas -.inst 0xd503233f // paciasp stp x28,x30,[sp,#16] // 32 bytes on top are mine b .Loop .align 4 @@ -199,14 +201,14 @@ KeccakF1600_int: bne .Loop ldr x30,[sp,#24] -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size KeccakF1600_int,.-KeccakF1600_int .type KeccakF1600,%function .align 5 KeccakF1600: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-128]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -256,7 +258,7 @@ KeccakF1600: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#128 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size KeccakF1600,.-KeccakF1600 @@ -264,7 +266,7 @@ KeccakF1600: .type SHA3_absorb,%function .align 5 SHA3_absorb: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-128]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -498,14 +500,14 @@ SHA3_absorb: ldp x25,x26,[x29,#64] ldp x27,x28,[x29,#80] ldp x29,x30,[sp],#128 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size SHA3_absorb,.-SHA3_absorb .globl SHA3_squeeze .type SHA3_squeeze,%function .align 5 SHA3_squeeze: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-48]! add x29,sp,#0 stp x19,x20,[sp,#16] @@ -568,7 +570,7 @@ SHA3_squeeze: ldp x19,x20,[sp,#16] ldp x21,x22,[sp,#32] ldp x29,x30,[sp],#48 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size SHA3_squeeze,.-SHA3_squeeze .type KeccakF1600_ce,%function @@ -676,7 +678,7 @@ KeccakF1600_ce: .type KeccakF1600_cext,%function .align 5 KeccakF1600_cext: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-80]! add x29,sp,#0 stp d8,d9,[sp,#16] // per ABI requirement @@ -717,14 +719,14 @@ KeccakF1600_cext: ldp d12,d13,[sp,#48] ldp d14,d15,[sp,#64] ldr x29,[sp],#80 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size KeccakF1600_cext,.-KeccakF1600_cext .globl SHA3_absorb_cext .type SHA3_absorb_cext,%function .align 5 SHA3_absorb_cext: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-80]! add x29,sp,#0 stp d8,d9,[sp,#16] // per ABI requirement @@ -940,14 +942,14 @@ SHA3_absorb_cext: ldp d12,d13,[sp,#48] ldp d14,d15,[sp,#64] ldp x29,x30,[sp],#80 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size SHA3_absorb_cext,.-SHA3_absorb_cext .globl SHA3_squeeze_cext .type SHA3_squeeze_cext,%function .align 5 SHA3_squeeze_cext: -.inst 0xd503233f // paciasp + AARCH64_SIGN_LINK_REGISTER stp x29,x30,[sp,#-16]! add x29,sp,#0 mov x9,x0 @@ -1003,7 +1005,7 @@ SHA3_squeeze_cext: .Lsqueeze_done_ce: ldr x29,[sp],#16 -.inst 0xd50323bf // autiasp + AARCH64_VALIDATE_LINK_REGISTER ret .size SHA3_squeeze_cext,.-SHA3_squeeze_cext .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 diff --git a/sys/crypto/openssl/aarch64/poly1305-armv8.S b/sys/crypto/openssl/aarch64/poly1305-armv8.S index 101e4fb40552..35de669f7398 100644 --- a/sys/crypto/openssl/aarch64/poly1305-armv8.S +++ b/sys/crypto/openssl/aarch64/poly1305-armv8.S @@ -16,6 +16,7 @@ .type poly1305_init,%function .align 5 poly1305_init: + AARCH64_VALID_CALL_TARGET cmp x1,xzr stp xzr,xzr,[x0] // zero hash value stp xzr,xzr,[x0,#16] // [along with is_base2_26] @@ -63,6 +64,9 @@ poly1305_init: .align 5 poly1305_blocks: .Lpoly1305_blocks: + // The symbol .Lpoly1305_blocks is not a .globl symbol + // but a pointer to it is returned by poly1305_init + AARCH64_VALID_CALL_TARGET ands x2,x2,#-16 b.eq .Lno_data @@ -128,6 +132,9 @@ poly1305_blocks: .align 5 poly1305_emit: .Lpoly1305_emit: + // The symbol .poly1305_emit is not a .globl symbol + // but a pointer to it is returned by poly1305_init + AARCH64_VALID_CALL_TARGET ldp x4,x5,[x0] // load hash base 2^64 ldr x6,[x0,#16] ldp x10,x11,[x2] // load nonce @@ -223,13 +230,16 @@ poly1305_splat: .align 5 poly1305_blocks_neon: .Lpoly1305_blocks_neon: + // The symbol .Lpoly1305_blocks_neon is not a .globl symbol *** 346 LINES SKIPPED *** From nobody Mon Oct 2 19:26:32 2023 X-Original-To: dev-commits-src-main@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 4RzrY45m5bz4wPg7; Mon, 2 Oct 2023 19:26:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzrY45DLpz4fF4; Mon, 2 Oct 2023 19:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696274792; 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=FR2389szSRIo9wTNC2OKDl8UXeah6f//MX1d+NpAVsw=; b=sz379vMcsC/SlEQa/UIfkHYLzksgUST1MMtmP0hOUD8vMoBaBC79Mkw3RbXlm03lxZLkwf OccnIVLPz+d3+LndsXtDn10876WDBLvPCr2O0WyZ6/k4U3lMlcpm3xt24g8wWIQXch2K1Z lqvnbIRdZg2YOS487B9/5tSly45ry0fhg4JSLR/d3fhtl1bihbwJyhITdrum0kvmL28rXi 39WMH7Fd7uO8nAM8XfYvRfvTZdwxemZhMAHEIUaHplHPf+zMprfnSJ0ztYixt8lr2DcdRo CebuGO3i63Gj1Wl4jd2WKN7vRw+gNdcp4N5tccsS5/zY/oAr+ZRFMgd3Fd/24w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696274792; a=rsa-sha256; cv=none; b=M1npHvMbk2DxDzoiLdYzd9/rI7ACZzbA7zo4Wmuvz4f1r9wMMLJV2TakDyPfYpbl3KNk+i SEFCRvnmXQfqNy+XEZaR7jN0tj+tCzkpSEcmjJJvwjP3kCWNc9MOvJoAcEqGv/+UOY8XGE aGt2bmicvFoXyiQgI5VBA7+357wJvaBXiYKRQaHDRAjku/iqFBE8ttVxuzZ0koX6gMrVgT HktPr6H8r52ojm6AOYorK4vg93g8gfTpqZK0j6d6tpRbwZZcISOEUEc2q11yiHFUBq7LKC PrHwl82aiEgywFDjucc0qcksL4kIp0jsumbkZGr6Dak3kggLvp5Zhuuv5rnlkQ== 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=1696274792; 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=FR2389szSRIo9wTNC2OKDl8UXeah6f//MX1d+NpAVsw=; b=neM9d65ZdES08zM11ZayVv4bVsd+A74kuTSWwAf4zF3CCNe8Y9JlzBGPWR4zAFe5gcIosz p25GH0NgipWqxP7wvYYd3tHbw26BLg6c+oEoLMtF4vB0aPYKv9jtotG/bMcS3KlEoqggAp uU92Rkr3/yjnxVuYJvTOQxLBbvQc8FkK8PhtyXeQTQFN6tV2rt89n/qDHhyo4Hv5lViNC9 9wkljLOjb0BGT4OScgsm+4plvNqkYlbqgdO5Xij4bH+vPP9s4eYsr5ZW+lyKN1MRGZokL1 +G7oDNznUMIZbOuck36KobSYIoWtqOd35LmSVKifVJOKZJ3mPx+qmgzJG2Wx6Q== 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 4RzrY44J9Gz9FL; Mon, 2 Oct 2023 19:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392JQWsW085733; Mon, 2 Oct 2023 19:26:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392JQWfe085730; Mon, 2 Oct 2023 19:26:32 GMT (envelope-from git) Date: Mon, 2 Oct 2023 19:26:32 GMT Message-Id: <202310021926.392JQWfe085730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: b166580681e3 - main - lib/libc/tests/string/memcmp_test.c: extend test to support custom memcmp function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b166580681e3af173ec368656019d02ba1cc55ad Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=b166580681e3af173ec368656019d02ba1cc55ad commit b166580681e3af173ec368656019d02ba1cc55ad Author: Robert Clausecker AuthorDate: 2023-07-14 11:56:12 +0000 Commit: Robert Clausecker CommitDate: 2023-10-02 19:25:21 +0000 lib/libc/tests/string/memcmp_test.c: extend test to support custom memcmp function Extend the tests to permit loading an external memcmp function and testing it over using the libc version. This was added by the example of other tests in the test suite doing the same thing and helped tremendously in development. This change was originally part of D41442 but was taken out to permit separate review as extrapolated from @ngie's request in D41349. Sponsored by: FreeBSD Foundation Approved by: ngie Differential Revision: https://reviews.freebsd.org/D41528 --- lib/libc/tests/string/memcmp_test.c | 57 +++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/lib/libc/tests/string/memcmp_test.c b/lib/libc/tests/string/memcmp_test.c index ab782c92f255..f42bccfca529 100644 --- a/lib/libc/tests/string/memcmp_test.c +++ b/lib/libc/tests/string/memcmp_test.c @@ -26,18 +26,21 @@ #include #include +#include #include #include #include #include +static int (*memcmp_fn)(const void *, const void *, size_t); + ATF_TC_WITHOUT_HEAD(zero); ATF_TC_BODY(zero, tc) { - assert(memcmp("a", "b", 0) == 0); - assert(memcmp("", "", 0) == 0); + assert(memcmp_fn("a", "b", 0) == 0); + assert(memcmp_fn("", "", 0) == 0); } ATF_TC_WITHOUT_HEAD(eq); @@ -49,9 +52,9 @@ ATF_TC_BODY(eq, tc) for (i = 0; i < 256; i++) data1[i] = data2[i] = i ^ 0x55; for (i = 1; i < 256; i++) - assert(memcmp(data1, data2, i) == 0); + assert(memcmp_fn(data1, data2, i) == 0); for (i = 1; i < 256; i++) - assert(memcmp(data1 + i, data2 + i, 256 - i) == 0); + assert(memcmp_fn(data1 + i, data2 + i, 256 - i) == 0); } ATF_TC_WITHOUT_HEAD(neq); @@ -65,9 +68,9 @@ ATF_TC_BODY(neq, tc) data2[i] = i ^ 0x55; } for (i = 1; i < 256; i++) - assert(memcmp(data1, data2, i) != 0); + assert(memcmp_fn(data1, data2, i) != 0); for (i = 1; i < 256; i++) - assert(memcmp(data1 + i, data2 + i, 256 - i) != 0); + assert(memcmp_fn(data1 + i, data2 + i, 256 - i) != 0); } ATF_TC_WITHOUT_HEAD(diff); @@ -81,37 +84,43 @@ ATF_TC_BODY(diff, tc) data1[128] = 255; data2[128] = 0; for (i = 1; i < 66; i++) { - assert(memcmp(data1 + 128, data2 + 128, i) == 255); - assert(memcmp(data2 + 128, data1 + 128, i) == -255); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == 255); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == -255); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == 255); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == -255); + assert(memcmp_fn(data1 + 128, data2 + 128, i) == 255); + assert(memcmp_fn(data2 + 128, data1 + 128, i) == -255); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == 255); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == -255); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == 255); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == -255); } data1[128] = 'c'; data2[128] = 'e'; for (i = 1; i < 66; i++) { - assert(memcmp(data1 + 128, data2 + 128, i) == -2); - assert(memcmp(data2 + 128, data1 + 128, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); + assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); } memset(data1 + 129, 'A', sizeof(data1) - 129); memset(data2 + 129, 'Z', sizeof(data2) - 129); for (i = 1; i < 66; i++) { - assert(memcmp(data1 + 128, data2 + 128, i) == -2); - assert(memcmp(data2 + 128, data1 + 128, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); + assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); } } ATF_TP_ADD_TCS(tp) { + void *dl_handle; + + dl_handle = dlopen(NULL, RTLD_LAZY); + memcmp_fn = dlsym(dl_handle, "test_memcmp"); + if (memcmp_fn == NULL) + memcmp_fn = memcmp; ATF_TP_ADD_TC(tp, zero); ATF_TP_ADD_TC(tp, eq); From nobody Mon Oct 2 19:26:33 2023 X-Original-To: dev-commits-src-main@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 4RzrY606Ngz4wPLt; Mon, 2 Oct 2023 19:26:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzrY56gN8z4fHq; Mon, 2 Oct 2023 19:26:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696274793; 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=MZxeFTiFKkmGRCCHruFmszZrnNM4arAP9VdVebceWCg=; b=HbQMU6FOykEc7QU5DBUq7ijm+/ytmMSBFryWnHhuIT3E7VseHizfc2ihnLSU75sjGDlyNO SH+RlUZTvq8pE2fsdw88ACOuLKgYfPfg1EmvXgeYQqs4Gt1k7J4eJt4Af6XPqZyMokY2+E Utb5uWGBIEEyKs72sucL9vJGa3+vTYi12Ri5FG8mktwtTKDg3+666C1RRnrVVGrxd8glfF 0qMG37iHdub1S2gy+/0GG69h2kpRjOawXLdjBYSDzAw1W+ZQmvrjloT3Rvs+0B3K6LK20c /1B/TV1ZMQ7xgojD01aMZusKXVgzKbUxNaDildOjPxN3jT73dq6LwIorgWGItg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696274793; a=rsa-sha256; cv=none; b=nZkvNT0xV+ocd2ePAfH+0tlcUWdcV70pFAk0aDO2y7TKvnG5Zby+DigiWREZ/H+wk4k4Va tQnHqOWkIaUn/4F8mBF1EVp12hKqCgjqydQE+4fGG2YSSL4N8Cz4FkZ77/PwVIVoP1fRPH X9CdrKpDX4g30IisqCqCIdHN4fDyJ4TxGbzTjXELyf0WH2wzoxmVl/NpfKJ/A1Y9RVGjN0 PnlqRU3hKSbjA3BVYJIwMCjnmvftfAsCMa7/fDDvz0xbhD+29hb5oFljRLIZIIqoSlJXJS OP9eYSTwEYegRiZyfPYcSveRLjI56CYwT0+G4AKitycTEYwqJzu3oiT3qAF0Vg== 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=1696274793; 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=MZxeFTiFKkmGRCCHruFmszZrnNM4arAP9VdVebceWCg=; b=sGR1DMcB2bWirFi2EFrHLBQyXDFYOMZ+8LU6SPcdBprtexA3PKlHsPGEdvsP1Xq1H2U52g cTm4yk/nMPuCn3fNyl9lAXIk1yGCov3d9UN6MyBNSktjmXFhbTopl+wL903xz1bAA5jVxA 5qoA/kdvP2sl5nQW0fkeRYZdKtvWsRSHQgnBa54eVo6ebi+voJZOAc9psVSGjgArFP39vx y/eYJ3I5HsPsM7M4D60dHgvsaNipRBXtL7sXJPOX6yJ+zAd3PWy9Ibm2Ch5o3dcnoSRjHf adWRUHoNe/O/GaWnqGoDmoNv7a8rdAzDkA53kcjiTvFddPb7G/IiiZJjyPUscA== 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 4RzrY55Htgz8qB; Mon, 2 Oct 2023 19:26:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392JQXiR085790; Mon, 2 Oct 2023 19:26:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392JQXeV085787; Mon, 2 Oct 2023 19:26:33 GMT (envelope-from git) Date: Mon, 2 Oct 2023 19:26:33 GMT Message-Id: <202310021926.392JQXeV085787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: c6cc06d465a9 - main - lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmp List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6cc06d465a98270ef734ffec7c9012ec3a1bd17 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=c6cc06d465a98270ef734ffec7c9012ec3a1bd17 commit c6cc06d465a98270ef734ffec7c9012ec3a1bd17 Author: Robert Clausecker AuthorDate: 2023-08-30 15:30:24 +0000 Commit: Robert Clausecker CommitDate: 2023-10-02 19:25:31 +0000 lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmp The four functions more or less perform the same operation. Reuse the same unit test with slight changes so we can cover them all. Constant-time operation is not verified for the timingsafe_* functions. Sponsored by: The FreeBSD Foundation Approved by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41528 --- lib/libc/tests/string/Makefile | 3 + lib/libc/tests/string/bcmp_test.c | 32 ++++++++++ lib/libc/tests/string/memcmp_test.c | 82 ++++++++++++++++++-------- lib/libc/tests/string/timingsafe_bcmp_test.c | 32 ++++++++++ lib/libc/tests/string/timingsafe_memcmp_test.c | 32 ++++++++++ 5 files changed, 155 insertions(+), 26 deletions(-) diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile index 1994b128ab57..e312787c8831 100644 --- a/lib/libc/tests/string/Makefile +++ b/lib/libc/tests/string/Makefile @@ -2,6 +2,7 @@ # ensure libc functions are tested, not clang's builtins CFLAGS+= -fno-builtin +ATF_TESTS_C+= bcmp_test ATF_TESTS_C+= ffs_test ATF_TESTS_C+= ffsl_test ATF_TESTS_C+= ffsll_test @@ -16,6 +17,8 @@ ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= strspn_test ATF_TESTS_C+= strverscmp_test ATF_TESTS_C+= strxfrm_test +ATF_TESTS_C+= timingsafe_bcmp_test +ATF_TESTS_C+= timingsafe_memcmp_test ATF_TESTS_C+= wcscasecmp_test ATF_TESTS_C+= wcscoll_test ATF_TESTS_C+= wcsnlen_test diff --git a/lib/libc/tests/string/bcmp_test.c b/lib/libc/tests/string/bcmp_test.c new file mode 100644 index 000000000000..fdf5e48b3eb4 --- /dev/null +++ b/lib/libc/tests/string/bcmp_test.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE + */ + +#define MEMCMP bcmp +#define RES(x) ((x) != 0) + +#include "memcmp_test.c" diff --git a/lib/libc/tests/string/memcmp_test.c b/lib/libc/tests/string/memcmp_test.c index f42bccfca529..487abe68f421 100644 --- a/lib/libc/tests/string/memcmp_test.c +++ b/lib/libc/tests/string/memcmp_test.c @@ -1,7 +1,11 @@ /*- * Copyright (c) 2016 Jilles Tjoelker + * Copyright (c) 2023 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -33,14 +37,40 @@ #include +#ifndef MEMCMP +#define MEMCMP memcmp +#endif + +/* + * On FreeBSD we demand that memcmp returns the difference between the + * characters at the first site of mismatch. However, ISO/IEC 9899:1990 + * only specifies that a number greater than, equal to, or less than + * zero shall be returned. If a unit test for this less strict + * behaviour is desired, define RES(x) to be (((x) > 0) - ((x) < 0)). + */ +#ifndef RES +#define RES(x) (x) +#endif + static int (*memcmp_fn)(const void *, const void *, size_t); +static void +check_memcmp(const char *a, const char *b, size_t len, int expected) +{ + int got; + + got = memcmp_fn(a, b, len); + ATF_CHECK_EQ_MSG(RES(expected), RES(got), + "%s(%p, %p, %zu) gave %d, but wanted %d", + __XSTRING(MEMCMP), a, b, len, got, expected); +} + ATF_TC_WITHOUT_HEAD(zero); ATF_TC_BODY(zero, tc) { - assert(memcmp_fn("a", "b", 0) == 0); - assert(memcmp_fn("", "", 0) == 0); + check_memcmp("a", "b", 0, 0); + check_memcmp("", "", 0, 0); } ATF_TC_WITHOUT_HEAD(eq); @@ -52,9 +82,9 @@ ATF_TC_BODY(eq, tc) for (i = 0; i < 256; i++) data1[i] = data2[i] = i ^ 0x55; for (i = 1; i < 256; i++) - assert(memcmp_fn(data1, data2, i) == 0); + check_memcmp(data1, data2, i, 0); for (i = 1; i < 256; i++) - assert(memcmp_fn(data1 + i, data2 + i, 256 - i) == 0); + check_memcmp(data1 + i, data2 + i, 256 - i, 0); } ATF_TC_WITHOUT_HEAD(neq); @@ -68,9 +98,9 @@ ATF_TC_BODY(neq, tc) data2[i] = i ^ 0x55; } for (i = 1; i < 256; i++) - assert(memcmp_fn(data1, data2, i) != 0); + check_memcmp(data1, data2, i, -0x55); for (i = 1; i < 256; i++) - assert(memcmp_fn(data1 + i, data2 + i, 256 - i) != 0); + check_memcmp(data1 + i, data2 + i, 256 - i, i - (i ^ 0x55)); } ATF_TC_WITHOUT_HEAD(diff); @@ -84,32 +114,32 @@ ATF_TC_BODY(diff, tc) data1[128] = 255; data2[128] = 0; for (i = 1; i < 66; i++) { - assert(memcmp_fn(data1 + 128, data2 + 128, i) == 255); - assert(memcmp_fn(data2 + 128, data1 + 128, i) == -255); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == 255); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == -255); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == 255); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == -255); + check_memcmp(data1 + 128, data2 + 128, i, 255); + check_memcmp(data2 + 128, data1 + 128, i, -255); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i, 255); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i, -255); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, 255); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, -255); } data1[128] = 'c'; data2[128] = 'e'; for (i = 1; i < 66; i++) { - assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); - assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + check_memcmp(data1 + 128, data2 + 128, i, -2); + check_memcmp(data2 + 128, data1 + 128, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, 2); } memset(data1 + 129, 'A', sizeof(data1) - 129); memset(data2 + 129, 'Z', sizeof(data2) - 129); for (i = 1; i < 66; i++) { - assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); - assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + check_memcmp(data1 + 128, data2 + 128, i, -2); + check_memcmp(data2 + 128, data1 + 128, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, 2); } } @@ -118,9 +148,9 @@ ATF_TP_ADD_TCS(tp) void *dl_handle; dl_handle = dlopen(NULL, RTLD_LAZY); - memcmp_fn = dlsym(dl_handle, "test_memcmp"); + memcmp_fn = dlsym(dl_handle, "test_" __XSTRING(MEMCMP)); if (memcmp_fn == NULL) - memcmp_fn = memcmp; + memcmp_fn = MEMCMP; ATF_TP_ADD_TC(tp, zero); ATF_TP_ADD_TC(tp, eq); diff --git a/lib/libc/tests/string/timingsafe_bcmp_test.c b/lib/libc/tests/string/timingsafe_bcmp_test.c new file mode 100644 index 000000000000..96bf789633f2 --- /dev/null +++ b/lib/libc/tests/string/timingsafe_bcmp_test.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE + */ + +#define MEMCMP timingsafe_bcmp +#define RES(x) ((x) != 0) + +#include "memcmp_test.c" diff --git a/lib/libc/tests/string/timingsafe_memcmp_test.c b/lib/libc/tests/string/timingsafe_memcmp_test.c new file mode 100644 index 000000000000..5f97e41fcf8a --- /dev/null +++ b/lib/libc/tests/string/timingsafe_memcmp_test.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE + */ + +#define MEMCMP timingsafe_memcmp +#define RES(x) (((x) > 0) - ((x) < 0)) + +#include "memcmp_test.c" From nobody Mon Oct 2 19:29:34 2023 X-Original-To: dev-commits-src-main@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 4RzrcZ3KTbz4wPv5; Mon, 2 Oct 2023 19:29:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzrcZ2q6mz4fwf; Mon, 2 Oct 2023 19:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696274974; 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=4BvJ3MljVw4SIpYxIK8c6hPbsuT4qXkt0BBXlIaSlRI=; b=MM3RRV/O9Vo1CBwEZf6SB84jbFFQ3Z9jrTymgyDpIXUOktDIVlqKZnZ1aQSdxrLSO2WceK YSdnkdz6SuP00wBp1ATNlZZaqrPY4htjwatiwD7ki+oNGG2twYNjZu9lbtgeGH8uzrQOPa dHEzBWYThgVnPSu0wjLsYJnH2kIyTfuJSYG0FL2mAoazDTa/73MDLGvgjh143CpIEzRRZ9 vj6NESMjQMDhJPFZprMj2B8lN4rxj+fVwWfd0XHb6qqSx/0qZfJHwmaNYpS0P1H8HJPG9K QMu449mGDguPrDi3Zz/KCd/ZSDbCLa9MNKN9h2e5R4lsNaRimvdocRk6QtA7qQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696274974; a=rsa-sha256; cv=none; b=TFtBER3U3mvc/S22CvU0ELqCykIqCGwGDzT0QgJUVNPxF+Y6KGqro4LmfgOi2ES6z5tsAd MvlbcEK9/fSH/EykxvopRIuiOgb3pbxiJwpJXdleRbWKWgoazJBJiJCtisnt9ykUzt8rrJ szF+vJkgThJgk8Pm3X7Ijbo2F4+uNT0uEIXlSq8zrs9McA/BIEoPO4z7VQ0lFKMm5+0NdS uLLGVw/SqaRJ+SRKfijKKhxsQSDHKjCM35z+B1nTXmMsYTC9srSJ1fXYung/6lLAbJpnG3 bGW/ysQ9ZK/WvKVv/g6g3nbeVpzWyfi4AXy/HzltPJUWgzsncJZW6Jo3QnLKPQ== 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=1696274974; 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=4BvJ3MljVw4SIpYxIK8c6hPbsuT4qXkt0BBXlIaSlRI=; b=K0Q2JkLbK3LusR7BJcfCdPJu4tCGaGh3x+jzAjiCnmWEv9SNzxge9/NEo5mawmbwiSDc8a bR23KWthivn3bZ/yaEqBDdXN/2JWHiq0fPcQQsTqogwrpF7qOZ5/YYoP3SXIfK5y42/CIq QyZtfH6+lc9E2IUG90nHzUitd6LSkt/ZdlqPum3bFOvOG8MRv2mjpye3LKcBbUoi6p05a0 byb/e3/iyA/WepSLUD4TGFYJ4Pk22Rc6AVbrGpFduHgqXTNZZWfGzPCMkAKV6dV9zDTBNb UEqdqM9o7dAWrBGQEB61AyScE6y6z3jbd0IEL64CWqc/CrGqd3PYvL9ICp+L7w== 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 4RzrcZ1tjbz8wG; Mon, 2 Oct 2023 19:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392JTYvX086308; Mon, 2 Oct 2023 19:29:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392JTYpB086305; Mon, 2 Oct 2023 19:29:34 GMT (envelope-from git) Date: Mon, 2 Oct 2023 19:29:34 GMT Message-Id: <202310021929.392JTYpB086305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ebaea1bcd2eb - main - x86: AMD Zen2: Zenbleed chicken bit mitigation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ebaea1bcd2eb0aa90937637ed305184b6fedc69b Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ebaea1bcd2eb0aa90937637ed305184b6fedc69b commit ebaea1bcd2eb0aa90937637ed305184b6fedc69b Author: Olivier Certner AuthorDate: 2023-09-11 14:18:30 +0000 Commit: Ed Maste CommitDate: 2023-10-02 19:29:18 +0000 x86: AMD Zen2: Zenbleed chicken bit mitigation Applies only to bare-metal Zen2 processors. The system currently automatically applies it to all of them. Tunable/sysctl 'machdep.mitigations.zenbleed.enable' can be used to forcibly enable or disable the mitigation at boot or run-time. Possible values are: 0: Mitigation disabled 1: Mitigation enabled 2: Run the automatic determination. Currently, value 2 is the default and has identical effect as value 1. This might change in the future if we choose to take into account microcode revisions in the automatic determination process. The tunable/sysctl value is simply ignored on non-applicable CPU models, which is useful to apply the same configuration on a set of machines that do not all have Zen2 processors. Trying to set it to any integer value not listed above is silently equivalent to setting it to value 2 (automatic determination). The current mitigation state can be queried through sysctl 'machdep.mitigations.zenbleed.state', which returns "Not applicable", "Mitigation enabled" or "Mitigation disabled". Note that this state is not guaranteed to be accurate in case of intervening modifications of the corresponding chicken bit directly via cpuctl(4) (this includes the cpucontrol(8) utility). Resetting the desired policy through 'machdep.mitigations.zenbleed.enable' (possibly to its current value) will reset the hardware state and ensure that the reported state is again coherent with it. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41817 --- sys/amd64/acpica/acpi_wakeup.c | 1 + sys/amd64/amd64/initcpu.c | 3 + sys/amd64/amd64/machdep.c | 4 ++ sys/dev/cpuctl/cpuctl.c | 1 + sys/x86/include/specialreg.h | 1 + sys/x86/include/x86_var.h | 3 + sys/x86/x86/cpu_machdep.c | 123 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 136 insertions(+) diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c index 3b21935255cb..0f9f987b6590 100644 --- a/sys/amd64/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -306,6 +306,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, amd64_syscall_ret_flush_l1d_recalc(); hw_ssb_recalculate(true); x86_rngds_mitg_recalculate(true); + zenbleed_check_and_apply(true); AcpiSetFirmwareWakingVector(0, 0); } else { diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index a048c08fc9ae..c5266ffcc235 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -193,6 +193,9 @@ init_amd(void) hw_lower_amd64_sharedpage = 1; } } + + /* Zenbleed. See the comments in 'cpu_machdep.c'. */ + zenbleed_check_and_apply(false); } /* diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index f39678d1f4e5..4b81f5b9671e 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1495,6 +1495,10 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TUNABLE_INT_FETCH("machdep.mitigations.rndgs.enable", &x86_rngds_mitg_enable); + TUNABLE_INT_FETCH("machdep.mitigations.zenbleed.enable", + &zenbleed_enable); + zenbleed_sanitize_enable(); + finishidentcpu(); /* Final stage of CPU initialization */ /* diff --git a/sys/dev/cpuctl/cpuctl.c b/sys/dev/cpuctl/cpuctl.c index 9c56db1ad19a..1fa655342121 100644 --- a/sys/dev/cpuctl/cpuctl.c +++ b/sys/dev/cpuctl/cpuctl.c @@ -546,6 +546,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td) hw_mds_recalculate(); x86_taa_recalculate(); x86_rngds_mitg_recalculate(true); + zenbleed_check_and_apply(true); printcpuinfo(); return (0); } diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index f45990a056c8..4886430c84b6 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -1172,6 +1172,7 @@ /* MSR_DE_CFG */ #define DE_CFG_10H_12H_STACK_POINTER_JUMP_FIX_BIT 0x1 #define DE_CFG_ZEN_LOAD_STALE_DATA_FIX_BIT 0x2000 +#define DE_CFG_ZEN2_FP_BACKUP_FIX_BIT 0x200 /* VIA ACE crypto featureset: for via_feature_rng */ #define VIA_HAS_RNG 1 /* cpu has RNG */ diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 1629236c5928..44314456d8bf 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -90,6 +90,7 @@ extern int hw_ssb_active; extern int x86_taa_enable; extern int cpu_flush_rsb_ctxsw; extern int x86_rngds_mitg_enable; +extern int zenbleed_enable; extern int cpu_amdc1e_bug; extern char bootmethod[16]; @@ -140,6 +141,8 @@ void hw_mds_recalculate(void); void hw_ssb_recalculate(bool all_cpus); void x86_taa_recalculate(void); void x86_rngds_mitg_recalculate(bool all_cpus); +void zenbleed_sanitize_enable(void); +void zenbleed_check_and_apply(bool all_cpus); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); void nmi_handle_intr(u_int type, struct trapframe *frame); diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index c80284cf2987..868e6e2bc365 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -1477,6 +1477,129 @@ SYSCTL_PROC(_machdep_mitigations_rngds, OID_AUTO, state, sysctl_rngds_state_handler, "A", "MCU Optimization state"); + +/* + * Zenbleed. + * + * No corresponding errata is publicly listed. AMD has issued a security + * bulletin (AMD-SB-7008), entitled "Cross-Process Information Leak". This + * document lists (as of August 2023) platform firmware's availability target + * dates, with most being November/December 2023. It will then be up to + * motherboard manufacturers to produce corresponding BIOS updates, which will + * happen with an inevitable lag. Additionally, for a variety of reasons, + * operators might not be able to apply them everywhere due. On the side of + * standalone CPU microcodes, no plans for availability have been published so + * far. However, a developer appearing to be an AMD employee has hardcoded in + * Linux revision numbers of future microcodes that are presumed to fix the + * vulnerability. + * + * Given the stability issues encountered with early microcode releases for Rome + * (the only microcode publicly released so far) and the absence of official + * communication on standalone CPU microcodes, we have opted instead for + * matching by default all AMD Zen2 processors which, according to the + * vulnerability's discoverer, are all affected (see + * https://lock.cmpxchg8b.com/zenbleed.html). This policy, also adopted by + * OpenBSD, may be overriden using the tunable/sysctl + * 'machdep.mitigations.zenbleed.enable'. We might revise it later depending on + * official statements, microcode updates' public availability and community + * assessment that they actually fix the vulnerability without any instability + * side effects. + */ + +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, zenbleed, + CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "Zenbleed OS-triggered prevention (via chicken bit)"); + +/* 2 is auto, see below. */ +int zenbleed_enable = 2; + +void +zenbleed_sanitize_enable(void) +{ + /* Default to auto (2). */ + if (zenbleed_enable < 0 || zenbleed_enable > 2) + zenbleed_enable = 2; +} + +static bool +zenbleed_chicken_bit_applicable(void) +{ + /* Concerns only bare-metal AMD Zen2 processors. */ + return (cpu_vendor_id == CPU_VENDOR_AMD && + CPUID_TO_FAMILY(cpu_id) == 0x17 && + CPUID_TO_MODEL(cpu_id) >= 0x30 && + vm_guest == VM_GUEST_NO); +} + +static bool +zenbleed_chicken_bit_should_enable(void) +{ + /* + * Obey tunable/sysctl. + * + * As explained above, currently, the automatic setting (2) and the "on" + * one (1) have the same effect. In the future, we might additionally + * check for specific microcode revisions as part of the automatic + * determination. + */ + return (zenbleed_enable != 0); +} + +void +zenbleed_check_and_apply(bool all_cpus) +{ + bool set; + + if (!zenbleed_chicken_bit_applicable()) + return; + + set = zenbleed_chicken_bit_should_enable(); + + x86_msr_op(MSR_DE_CFG, + (set ? MSR_OP_OR : MSR_OP_ANDNOT) | + (all_cpus ? MSR_OP_RENDEZVOUS_ALL : MSR_OP_LOCAL), + DE_CFG_ZEN2_FP_BACKUP_FIX_BIT, NULL); +} + +static int +sysctl_zenbleed_enable_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = zenbleed_enable; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + zenbleed_enable = val; + zenbleed_sanitize_enable(); + zenbleed_check_and_apply(true); + return (0); +} +SYSCTL_PROC(_machdep_mitigations_zenbleed, OID_AUTO, enable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + sysctl_zenbleed_enable_handler, "I", + "Enable Zenbleed OS-triggered mitigation (chicken bit) " + "(0: Force disable, 1: Force enable, 2: Automatic determination)"); + +static int +sysctl_zenbleed_state_handler(SYSCTL_HANDLER_ARGS) +{ + const char *state; + + if (!zenbleed_chicken_bit_applicable()) + state = "Not applicable"; + else if (zenbleed_chicken_bit_should_enable()) + state = "Mitigation enabled"; + else + state = "Mitigation disabled"; + return (SYSCTL_OUT(req, state, strlen(state))); +} +SYSCTL_PROC(_machdep_mitigations_zenbleed, OID_AUTO, state, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_zenbleed_state_handler, "A", + "Zenbleed OS-triggered mitigation (chicken bit) state"); + + /* * Enable and restore kernel text write permissions. * Callers must ensure that disable_wp()/restore_wp() are executed From nobody Mon Oct 2 20:38:53 2023 X-Original-To: dev-commits-src-main@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 4Rzt8Z0vvTz4wT3T; Mon, 2 Oct 2023 20:38:54 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rzt8Z0P4Fz3KLh; Mon, 2 Oct 2023 20:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696279134; 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=sMew1gSyNVPm0xhzNs0Ur6CLjqtEyw9TPQHss5M2/sA=; b=oHdrREMmKGhdaOjmD5YhqwvAU4NO4V9e6tuvAlYtHAcST2HfQIDOjW5Zr8haWlt5RF4XFS wcdee+G4V7PS5CCW9fNnA/82/DL20dqXiJPkumeLTrA6qq54oWuIZ64vxIU8mCFPdOa6bR VUmIBzMrEdBrp3AGeu/Rnup9Av+IwcJwke0wODSMzMAxgvJUEs3eICcVS+26erUdXuqRfq iYPqEVgkVaYkQAsWaEUgcxw+1UxWVXVjuba8gdcDQxHVKU0eonJtM7JYj4JZ+6zsKUuM11 SUyp5aumxslVy7tuuC2HB4GYiasfVP8HQDkJ5bC5A3blKZGafVaYgJ/M/2FHSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696279134; a=rsa-sha256; cv=none; b=ICAF5EzBs0eh91kyF0YJ+gishfjC/n/0AY67WUCLveX7RSpghZsh/9tp6cWsHv/JjpF3x/ VmP+++tqhi/eB6+86S6qSCu2ZSOWsPRFgOW/JGf2JsPzeTrYKWHr9VhqmVcTnQwOlxnfsb MmTkCYfArpJJyb/FdM0u0evQlx0TH1evEMlKV0UglziCvfkGr17Vwda0OLRR7HuEy2uBea F44K/2P+wm5OmOEl7wl1BHoPIqL7844LBVsViCoGPOwuQCO6jRDDR5y343fgpSpBUx8jqY 4geY73oPPih3yA7iEdfSfdBgj6u5Evjxs4cBfqBDVjwthMfCas1OnFq7EM5+og== 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=1696279134; 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=sMew1gSyNVPm0xhzNs0Ur6CLjqtEyw9TPQHss5M2/sA=; b=eyjBvLbESszYkO4oVuWRXmZwBg6Nhhb6S/jfxKtRhdeKXTRZcTBDvIdw83qr10rQxWft1p FGbZJpg1qfmaY0f7R9r/Ru4k9LoDINsh2Gfw+FBsFhXdggBftXGy1H/pYdg81QxTwFCSIL CJu4JuBwpLtHINRQsR92v013YSxhnN91TwqybNn6R9Q0+kgpgqkep83ZCaDgpOLBQVriuD 8q0+4QMPE5vb/Epgkizhq0w791UoDVr2WaiPxEloNzqUD3dPKfCie8NPG61U7wb64M44HL TG04Ztdea34uAux1qRZHYd3r4EHSu61DPLqp0yImDPkEDu1Y7BV06OZWYtpwVQ== 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 4Rzt8Y6Yl0zBfK; Mon, 2 Oct 2023 20:38:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392Kcrbg003018; Mon, 2 Oct 2023 20:38:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392Kcrrf003015; Mon, 2 Oct 2023 20:38:53 GMT (envelope-from git) Date: Mon, 2 Oct 2023 20:38:53 GMT Message-Id: <202310022038.392Kcrrf003015@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: bd572be78436 - main - setusercontext(): Fix gap when setting a realtime-class priority List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd572be78436473a2ad4c1b78728b739c74ef238 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=bd572be78436473a2ad4c1b78728b739c74ef238 commit bd572be78436473a2ad4c1b78728b739c74ef238 Author: Olivier Certner AuthorDate: 2023-05-25 07:10:27 +0000 Commit: Ed Maste CommitDate: 2023-10-02 20:38:03 +0000 setusercontext(): Fix gap when setting a realtime-class priority The login.conf's "priority" capability allows to set priorities in the idle or realtime classes in addition to the classical nice values (-20 to 20), through a natural extension where values greater than 20 put the processes in the idle class (with priority adjusted within RTP_PRIO_MIN and RTP_PRIO_MAX, 21 being converted to 0, 22 to 1, etc.) and values lower than -20 put the process in the realtime class (with priority adjusted within RTP_PRIO_MIN and RTP_PRIO_MAX, -21 being converted to RTP_PRIO_MAX (31), -22 to 30, etc.). Before this fix, in the latter case (realtime class), -21 was converted to 30, and RTP_PRIO_MAX (31) could never be specified. While here, change the priority computation for the idle-class case to be symmetrical and use RTP_PRIO_MIN (in practice, this changes nothing at all, since RTP_PRIO_MIN is 0; but this is the correct theoretical formula, which would work as well with other values of RTP_PRIO_MIN). PR: 271727 Reviewed by: imp, kib MFC after: 2 weeks Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40339 --- lib/libutil/login_class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c index f561479690c1..90a3ec5d106a 100644 --- a/lib/libutil/login_class.c +++ b/lib/libutil/login_class.c @@ -452,7 +452,7 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in if (p > PRIO_MAX) { rtp.type = RTP_PRIO_IDLE; - p -= PRIO_MAX + 1; + p += RTP_PRIO_MIN - (PRIO_MAX + 1); rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", @@ -460,7 +460,7 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in lc ? lc->lc_class : LOGIN_DEFCLASS); } else if (p < PRIO_MIN) { rtp.type = RTP_PRIO_REALTIME; - p -= PRIO_MIN - RTP_PRIO_MAX; + p += RTP_PRIO_MAX - (PRIO_MIN - 1); rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", From nobody Mon Oct 2 20:46:27 2023 X-Original-To: dev-commits-src-main@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 4RztKH3vc4z4wTCd; Mon, 2 Oct 2023 20:46:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RztKH3S3hz3LGd; Mon, 2 Oct 2023 20:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696279587; 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=GzZ4PxZe6kv06zJ60w3qHJi9T/pg7dHv/oo5GBM7DqA=; b=d6YNT0b+I1Nqqaq0SuCbOP/MDU00x+RqtzMPHD2WlsbXHJEz3x8yH5TBAzqiALQGqrVF+j AzRH7GCFQ4DfB7zxhn1QAbYluFTSJZKPj1cy23SBHy+Y6boBhO8rKFpANUzzzAP+QmB13k deu82ls3bODE0agFcpnSVm/tMRl3fhNSvwhLUHV9OJKujPDitZdNnMqsj/+LdBjbgFCGbb 5UhLkCug6DZMnOji30fjxyVefsX4/g3Z6ly39eZOyd53MbeQcAKSSk03kDRxMUI3Kiq9oW dZobseOp1BtnFB/DFtDCewJxOluZjt7MNeWqdWHn7g7CVQ+wsb0vJVqPw905BA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696279587; a=rsa-sha256; cv=none; b=a/apnjSLcxQpn7a93EzIrPGG20Eso6exxxCShBSx4Fc9gpWxbb+UkC3ZfhPoOBP7rP0lpE xCX+4ARgrjS/y4rRhhwdFS7kAfkiZPrtXogYIJ/0GUVJuRDrsyzB90WyVjuQ2EiQKZ2yd+ 28QTu+XODm6162+71bgQ0RmU10K/SMXh1t3HOnysHzWAKAz0GajL69XHx3IEby83JntKr8 jPfP+iguUi16mU9W/C4W8JyyVxrENgV0Mm6ad9SMh1M68MB7txbiYwp0ikh9DAwWjbccp4 0BnctMql6TEEoIZkg1ihvr11/Kh+Dq30+7YCPeklaVh2gDoGHbNe4a3ZyKgEEQ== 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=1696279587; 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=GzZ4PxZe6kv06zJ60w3qHJi9T/pg7dHv/oo5GBM7DqA=; b=t1r+KJwQYIT7Sp+Xvq8lXNpGH1pCy1n3oZunHvadc6sETjN2XeA4Qkox2c4iJukQjr7uLV YUaVoeOJ4Yo+ItV/puIcocKzgzgJDt1++1IJCC/+QbEdB8BqLECL5mjbeFoEJuE+wlkBoY XUXY9TWQuXEeZ9gdppjW4IzZEQ8dYgTr1jEzHMee1l/xdkqENTkkNZvx+q4lDeBjTfC2IS pFQHEqKISb2kcZlXJqHQCBqDKujcvKwPUzHSm6gfjwb3iXfRF0CfZ2WUtOkXftsNt1JiZu QmVH+SajyehGyeoUpmQkShIwxmTXcU/VkZKr7U41PUJMR1lWDv91FhmzrtX+Qw== 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 4RztKH2WQnzBGK; Mon, 2 Oct 2023 20:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392KkRlw019805; Mon, 2 Oct 2023 20:46:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392KkRXW019802; Mon, 2 Oct 2023 20:46:27 GMT (envelope-from git) Date: Mon, 2 Oct 2023 20:46:27 GMT Message-Id: <202310022046.392KkRXW019802@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b8c1aadef9d8 - main - login_cap.c: Don't set errno to ERANGE on memory allocation failure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8c1aadef9d80786daf731300c33d3a001261422 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b8c1aadef9d80786daf731300c33d3a001261422 commit b8c1aadef9d80786daf731300c33d3a001261422 Author: Olivier Certner AuthorDate: 2023-05-25 11:48:40 +0000 Commit: Ed Maste CommitDate: 2023-10-02 20:41:22 +0000 login_cap.c: Don't set errno to ERANGE on memory allocation failure Modified functions: login_getcaptime(), login_getcapnum(), login_getcapsize(). They all call cgetstr(), which returns -2 on such conditions and already sets errno to ENOMEM, arguably the appropriate value for these functions as well. No in-tree consumer currently checks for errno on error reported by these functions, so this change has no other code impact. Reviewed by: kib MFC after: 2 weeks Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40342 --- lib/libutil/login_cap.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/libutil/login_cap.c b/lib/libutil/login_cap.c index e71d38d2d93b..aeda7d5e828b 100644 --- a/lib/libutil/login_cap.c +++ b/lib/libutil/login_cap.c @@ -650,10 +650,8 @@ login_getcaptime(login_cap_t *lc, const char *cap, rlim_t def, rlim_t error) if ((r = cgetstr(lc->lc_cap, cap, &res)) == -1) return def; - else if (r < 0) { - errno = ERANGE; + else if (r < 0) return error; - } /* "inf" and "infinity" are special cases */ if (isinfinite(res)) @@ -735,19 +733,18 @@ login_getcapnum(login_cap_t *lc, const char *cap, rlim_t def, rlim_t error) /* * For BSDI compatibility, try for the tag= first */ - if ((r = cgetstr(lc->lc_cap, cap, &res)) == -1) { + r = cgetstr(lc->lc_cap, cap, &res); + if (r == -1) { long lval; /* string capability not present, so try for tag# as numeric */ if ((r = cgetnum(lc->lc_cap, cap, &lval)) == -1) return def; /* Not there, so return default */ - else if (r >= 0) + else if (r < 0) + return error; + else return (rlim_t)lval; - } - - if (r < 0) { - errno = ERANGE; + } else if (r < 0) return error; - } if (isinfinite(res)) return RLIM_INFINITY; @@ -786,10 +783,8 @@ login_getcapsize(login_cap_t *lc, const char *cap, rlim_t def, rlim_t error) if ((r = cgetstr(lc->lc_cap, cap, &res)) == -1) return def; - else if (r < 0) { - errno = ERANGE; + else if (r < 0) return error; - } if (isinfinite(res)) return RLIM_INFINITY; From nobody Mon Oct 2 20:58:05 2023 X-Original-To: dev-commits-src-main@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 4RztZj3Yqlz4wTcq; Mon, 2 Oct 2023 20:58:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RztZj34Q9z3M1v; Mon, 2 Oct 2023 20:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696280285; 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=JQTiz4wMJsH2LUfGmfYtvXPrNkXtRjRFjRlZXtdt0Wc=; b=IfEsNwppaE0vomOVypaok3byiy92lXA5clZ96Fm3PoODDI0/snIwj53ceCDKM/aRANK7zH PI2g89G16DAfEKak0hnosCdrYnB1LbxCGbo4/U7SkZi2ykYIzJCQv6nQ4KYcH6JvWSuyZN DSMYN+h90kyS2UdaMR7dws26KVn4DQaSeVVcr8rfwW2eCb62HmpXQMGqItAJpc4H6ek8Q/ ah1riKEkGVuOiiMf/+5dMIOokJ0tzFz2+D8gCAE63kEwtf+7kkZqp0rhG8P3bDGZ13uU17 OUg9RY2Yip9JXKIa28AQHW+6UPnuG/3jr5Hm3nRStntw65fwcMKyrkbWTKgUag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696280285; a=rsa-sha256; cv=none; b=pf0x9gWrOt/BHzfDhMREp+Gzy0OHuKcXw6ziNoQOVxTNl7nDDgcPQK37YAXKsWwyjCHKMr FC2tpO+QaQW4PK9NJq3zW4gH1/F6ZwNOBlm7fVQGqKGtHSV2JEQQ8oSE2bTx2E6MmxLq8m nU2DJxYpQ3w9swDFrTXZdk7JD8RiL2FQNv6JnjvGdFKuum49lDJkeCdYSpRN0SjNBsTliF CB4idwbQ5knz5Chg8CwDlnuL3J6FN1WIAlILQufsO8lg7TXXlHREq+Cc9ZcFM3sFzv9SCg VTe13exLaGdDhFZ0Tjnvj9jH1F5oUJ4ihKg14+GNqXI3O7TGuVGKlzr8pjJSIg== 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=1696280285; 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=JQTiz4wMJsH2LUfGmfYtvXPrNkXtRjRFjRlZXtdt0Wc=; b=HPh1OlCidCtnEgwHriPkJKpImSllCawWNVX+afuENmZaWvBT8HvoH0t5BcmrNlU9KoHl87 M5PvoSToGhk/JoJw5JsDVjxv3AGDpQY9XU/Fxdia7bkIjHkJJ+Rzms3+d7Iu3qVDmq+2Jx RFMWswfPdsPucfTc89ZL9EqEiVXVwaiYFTAIy7OmDVquA+zmpWTXGdRrV1p94uYPnQgZbX dXFcRSPtEyMEOi4TuxaXzf2TnCj/ZItXo/CJRjw9e7bsDzPuk4JbVhKp1RrvWkyBA8LRKd ZUGX2kI7DkykIey1dlE98kCZz0D6ssLCUdxXiC2W+6itIf8dVKNE4Fc6s7MMKA== 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 4RztZj29LMzCYP; Mon, 2 Oct 2023 20:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392Kw5js035989; Mon, 2 Oct 2023 20:58:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392Kw5dE035986; Mon, 2 Oct 2023 20:58:05 GMT (envelope-from git) Date: Mon, 2 Oct 2023 20:58:05 GMT Message-Id: <202310022058.392Kw5dE035986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c4b927c341e2 - main - geli tests: Use shorter passphrases in setkey_passphrase List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4b927c341e23eea17f75d139aafcf58545c5b0e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4b927c341e23eea17f75d139aafcf58545c5b0e commit c4b927c341e23eea17f75d139aafcf58545c5b0e Author: Mark Johnston AuthorDate: 2023-10-02 20:55:26 +0000 Commit: Mark Johnston CommitDate: 2023-10-02 20:57:51 +0000 geli tests: Use shorter passphrases in setkey_passphrase There is an undocumented limit on the length of a GELI passphrase, and the test exceeded that. Most of the time it worked because a nul terminator would appear early enough in the string. Reported by: Jenkins Fixes: 2b7b09ac9675 ("geli tests: Add a regression test for geli setkey -J") --- tests/sys/geom/class/eli/setkey_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/geom/class/eli/setkey_test.sh b/tests/sys/geom/class/eli/setkey_test.sh index ce3833f5fe0c..34fb8221ab04 100644 --- a/tests/sys/geom/class/eli/setkey_test.sh +++ b/tests/sys/geom/class/eli/setkey_test.sh @@ -108,9 +108,9 @@ setkey_passphrase_body() atf_check dd if=/dev/random of=rnd bs=512 count=${sectors} status=none hash1=`dd if=rnd bs=512 count=${sectors} status=none | md5` atf_check_equal 0 $? - atf_check dd if=/dev/random of=pass1 bs=512 count=32 status=none - atf_check dd if=/dev/random of=pass2 bs=512 count=32 status=none - atf_check dd if=/dev/random of=pass3 bs=512 count=32 status=none + atf_check dd if=/dev/random of=pass1 bs=512 count=1 status=none + atf_check dd if=/dev/random of=pass2 bs=512 count=1 status=none + atf_check dd if=/dev/random of=pass3 bs=512 count=1 status=none atf_check geli init -B none -J pass1 ${md} atf_check geli attach -j pass1 ${md} From nobody Mon Oct 2 21:50:52 2023 X-Original-To: dev-commits-src-main@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 4Rzvlc3w10z4wWf8; Mon, 2 Oct 2023 21:50:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rzvlc3T1Nz3R8S; Mon, 2 Oct 2023 21:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696283452; 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=GZ5dipZEZw74N/41sRIQqxvf5uwhCo2JtwJfDjRx/u0=; b=MmBp3qvAocfi/UUwROPh5gZMXxoXnbQ05w7zOwH8K3ZNQeK2gq4WuwG9+a3VOdtg2TjOgX lUQKCx7AswFBwJdpfie09k4jMUwHI/D/YqM0GhobxJ86cbrC8CAEAk8TeqW2Oc/wikphgj OA4lT9p1VeSKsuWPV956vaLZokwRjNnJo73LQuU2sg+LNlsnNKVDw07kOvbePISg6NUBt5 52BiM78XsNAe3pqq6HZVDcBaUhXbwC4gFbuZ685ddRlNvhw2FSzkQwrUnTAQcSw7/nKzr2 T88UBXswrIQ9At/BD2kS5Zqo8B5NCfKEL3weo+Dxd5058O5dKLIk6qUVM4KwNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696283452; a=rsa-sha256; cv=none; b=Ybr2XZpmgyC3ih3xbozGajIOKf95CHCUr3aPvpPX5Di4J5XZmmMKxqT/5OJUf6XsJD0C+I LLOqMblG/Mvc24p35qOZL8HRCQckmkfAwqO7GQ+QhGf1n2FA5t5GLn9b8JoEF3B/NW4N0O AA5ROYDKLh27AOAxbmyR6H166MB2Co3v9mj6HASiem5sdqoM3YA0dFWCS1KdScP1E8woTx ll6Z89qoc2o/xuxhswYxjpduNqCf1r6/LwYnAy3KNLniyIfcF2ZDd19+ws6TFB3qm1IyqI kM9K/6C31MlZ0HAp8nYpVXZRMtZpOFhQpEWuvgDCy8U8aQh3gL8fLsGntHszIQ== 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=1696283452; 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=GZ5dipZEZw74N/41sRIQqxvf5uwhCo2JtwJfDjRx/u0=; b=LpUiroYq2cGIXbxnisBgATXKqbZsB/l56DLQWueipHhIQn+8nhS6PJHURI1dxoEm+jI1I3 63lYvRjqRtDw7zI8ywAUBon7oehGJ9O2eKWmcg0SLABP11SXBf50B14+QciSgJyEgsVw1H x2ieUR68qHAwva2ZohMDGCwNd4CMsZvOM/uJV5xMIZyq37Y2AKNXT/nVazWrYhEYVRoIrE 7qh/n9J6+PnVGWyI1DxV899fPRuqU1ftBgVpzL28ANJjaUSYut5etxMKsEgeUx8QJ8HSk/ hEoummlAd9Fv38wZ5tfuIN4VDKidpFNbbKLdWgQ/nc+Ceh7rHX1FG2ECJ+ck4Q== 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 4Rzvlc2XVzzDJg; Mon, 2 Oct 2023 21:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392LoqNS029665; Mon, 2 Oct 2023 21:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392Loq9W029662; Mon, 2 Oct 2023 21:50:52 GMT (envelope-from git) Date: Mon, 2 Oct 2023 21:50:52 GMT Message-Id: <202310022150.392Loq9W029662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: ccac440f7cbb - main - libprocstat: style: space after switch List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccac440f7cbb013de41aa3933f3f7be77225c44f Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=ccac440f7cbb013de41aa3933f3f7be77225c44f commit ccac440f7cbb013de41aa3933f3f7be77225c44f Author: Brooks Davis AuthorDate: 2023-10-02 21:50:00 +0000 Commit: Brooks Davis CommitDate: 2023-10-02 21:50:00 +0000 libprocstat: style: space after switch Style demands a space after the switch keyword. Noticed reviewing code in CheriBSD that propagated the style bug. Reported by: markj Sponsored by: DARPA Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D42041 --- lib/libprocstat/libprocstat.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 0af79b6e63a0..a302310dfb9a 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -347,7 +347,7 @@ struct filestat_list * procstat_getfiles(struct procstat *procstat, struct kinfo_proc *kp, int mmapped) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: return (procstat_getfiles_kvm(procstat, kp, mmapped)); case PROCSTAT_SYSCTL: @@ -1527,7 +1527,7 @@ procstat_get_socket_info_kvm(kvm_t *kd, struct filestat *fst, /* * Protocol specific data. */ - switch(dom.dom_family) { + switch (dom.dom_family) { case AF_INET: case AF_INET6: if (proto.pr_protocol == IPPROTO_TCP) { @@ -1600,7 +1600,7 @@ procstat_get_socket_info_sysctl(struct filestat *fst, struct sockstat *sock, /* * Protocol specific data. */ - switch(sock->dom_family) { + switch (sock->dom_family) { case AF_INET: case AF_INET6: if (sock->proto == IPPROTO_TCP) { @@ -1961,7 +1961,7 @@ procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *cntp) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: warnx("kvm method is not supported"); return (NULL); @@ -2066,7 +2066,7 @@ gid_t * procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *cntp) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: return (procstat_getgroups_kvm(procstat->kd, kp, cntp)); case PROCSTAT_SYSCTL: @@ -2144,7 +2144,7 @@ int procstat_getumask(struct procstat *procstat, struct kinfo_proc *kp, unsigned short *maskp) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: return (procstat_getumask_kvm(procstat->kd, kp, maskp)); case PROCSTAT_SYSCTL: @@ -2234,7 +2234,7 @@ int procstat_getrlimit(struct procstat *procstat, struct kinfo_proc *kp, int which, struct rlimit* rlimit) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: return (procstat_getrlimit_kvm(procstat->kd, kp, which, rlimit)); @@ -2293,7 +2293,7 @@ int procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp, char *pathname, size_t maxlen) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: /* XXX: Return empty string. */ if (maxlen > 0) @@ -2366,7 +2366,7 @@ procstat_getosrel_core(struct procstat_core *core, int *osrelp) int procstat_getosrel(struct procstat *procstat, struct kinfo_proc *kp, int *osrelp) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: return (procstat_getosrel_kvm(procstat->kd, kp, osrelp)); case PROCSTAT_SYSCTL: @@ -2506,7 +2506,7 @@ Elf_Auxinfo * procstat_getauxv(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *cntp) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: warnx("kvm method is not supported"); return (NULL); @@ -2620,7 +2620,7 @@ struct kinfo_kstack * procstat_getkstack(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *cntp) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: warnx("kvm method is not supported"); return (NULL); @@ -2749,7 +2749,7 @@ fail: struct advlock_list * procstat_getadvlock(struct procstat *procstat) { - switch(procstat->type) { + switch (procstat->type) { case PROCSTAT_KVM: warnx("kvm method is not supported"); return (NULL); From nobody Mon Oct 2 22:31:17 2023 X-Original-To: dev-commits-src-main@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 4RzwfG0SGrz4wZ6W; Mon, 2 Oct 2023 22:31:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzwfF5nx8z3Vgh; Mon, 2 Oct 2023 22:31:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696285877; 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=Rl9f6RVEy4dAdE4u2aH4iutMs3zv2ePOnEMSLXO36P4=; b=Y+AZf23KXZ1SCwm7o3mIMBMsgiJawfgZV48LF7kkliP2Nf9XMPY50Vs1dtznmv82B130x6 u34l6Sq4ZUS57LILUXPnjCzIE1qEoSSJiD/Vat+mDHNBqpENEHbs8wCa8gqjixIf1g7aha CEEtjDhmKPZnlN+BN9bWoSyIe41/iQHuZZXdlFg544tb4xc4zjnpnB0vuhtnZa2hxsoVmh vbfd4llKgvYT2GHf0IRh0YENdbG+eddf3+Fmc+hBZOO2z2n0KcUnazThm7AOBWbDnaDy0p FXLWGKGltW28mmhk/fpon596tpNQClmZnhrLm+7Re3d69A/43cK7LIqPKEfK/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696285877; a=rsa-sha256; cv=none; b=JqeoNIa1X2vX9JjdFweHZT7QuiaKmwbASys/bwEFz+tnL2wFyR6OOxJRni14adEjBNc1Wl wmPQo0mV8Vm6r2SRxZUZ0eAhqn2FSoZLlvwWoUu+aKvRJAMzdAOLwz7FWYa8Yk9WbIuEuv hY85x9uYD0gbYIWWX0wZ2RK8/JnaHBAL/C5tNzVyGnovPNgdDoLJPRLqvVtt8d9+gL3oz+ SUJms4RIZDIjW80Dg0r1BaXRBZVKyDbI0DZV3UjY4LWnNSaJNWpbQHYaxcBPwDlfvcJG+P YgoBxhp9iE5FioMfbXCm6v90euw3TBDitfd/RPCa9TCH26FzTkwsW426KjrYeg== 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=1696285877; 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=Rl9f6RVEy4dAdE4u2aH4iutMs3zv2ePOnEMSLXO36P4=; b=cCbGn7hxcVEYchOqHDDQva8XL/TZrdfSjySgeLzW8kjc3TVJA2vCJnS30JDyDkaOUHNOZL uP2cBoppcN+UOxTZMT81anMre0MF+O6gUwJ8tFl4qxqUR65NfL/Cuj7Xva334ejgjvlHoo 6EwlM8e4sys9EhDq7rePLjWWVEU9pJCXweday/5jRMk2eiLUEiSGJSd5r5NpT7CSOecOAL CgG32Mt7uBbROFiu7WEiZEFQ94Ia0J6T6D06G1TWXDFTSk5/A/S+g3DEmLD8UWp21sD7nJ NE5lMuepZ8GrzgF4zHwvX5ZKokXWMFoRHuS982O/M91Ogjfj41IiOAuZp0Li1A== 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 4RzwfF4rqVzW9t; Mon, 2 Oct 2023 22:31:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392MVHBr098914; Mon, 2 Oct 2023 22:31:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392MVHnJ098911; Mon, 2 Oct 2023 22:31:17 GMT (envelope-from git) Date: Mon, 2 Oct 2023 22:31:17 GMT Message-Id: <202310022231.392MVHnJ098911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 6b3bb233cd0c - main - amd64 cpu_fetch_syscall_args_fallback(): fix whitespace List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b3bb233cd0c3eeeb70e388a62b142b4f22b62b2 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6b3bb233cd0c3eeeb70e388a62b142b4f22b62b2 commit 6b3bb233cd0c3eeeb70e388a62b142b4f22b62b2 Author: Konstantin Belousov AuthorDate: 2023-09-26 09:20:30 +0000 Commit: Konstantin Belousov CommitDate: 2023-10-02 22:30:52 +0000 amd64 cpu_fetch_syscall_args_fallback(): fix whitespace Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976 --- sys/amd64/amd64/trap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 4d5887369207..ef38c0789636 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1032,10 +1032,10 @@ cpu_fetch_syscall_args_fallback(struct thread *td, struct syscall_args *sa) regcnt--; } - if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; - else - sa->callp = &p->p_sysent->sv_table[sa->code]; + if (sa->code >= p->p_sysent->sv_size) + sa->callp = &p->p_sysent->sv_table[0]; + else + sa->callp = &p->p_sysent->sv_table[sa->code]; KASSERT(sa->callp->sy_narg <= nitems(sa->args), ("Too many syscall arguments!")); @@ -1045,7 +1045,7 @@ cpu_fetch_syscall_args_fallback(struct thread *td, struct syscall_args *sa) if (sa->callp->sy_narg > regcnt) { params = (caddr_t)frame->tf_rsp + sizeof(register_t); error = copyin(params, &sa->args[regcnt], - (sa->callp->sy_narg - regcnt) * sizeof(sa->args[0])); + (sa->callp->sy_narg - regcnt) * sizeof(sa->args[0])); if (__predict_false(error != 0)) return (error); } From nobody Mon Oct 2 22:31:18 2023 X-Original-To: dev-commits-src-main@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 4RzwfH0j5rz4wYy7; Mon, 2 Oct 2023 22:31:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzwfG75btz3Vdb; Mon, 2 Oct 2023 22:31:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696285879; 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=LwT7gABVdN8aT4oyJEVnaqHOz1ZzBi6lZuSViiSTBGo=; b=fsHirPz+B+ZtuYaSxqm/m991H0AuuX1u2Jk7BQHxbs9cWnr+OSI6/rTpeixtESgi6YfPlT u/RjzZdXXQuzxCx4HYcf2iWcovgkAmoEZuukfzOt9Yb4A0voSIhXSbJBVMCN0P8SzN8Po9 gI2pwVHftEiM1RBnBzYISnCw8auTE9v7rW5/02IbDtcLMTXjAVVDndG8LVr2vRguulsEtn uw+XW9W5V6WgG/HIUJt1jW5rvhN/PTPVWVOnW34g+IZaC1qcRfK+QyLLyEbm4+sEQkwoHr /QYwjqDj76yxIhS6Fcvk2cyi7noeRpYXUQNFHTacxyafy7e9QPH+Wu7qsTsMwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696285879; a=rsa-sha256; cv=none; b=sKf3bwb6q1EIKx+7C1qZFBUTrTRkcJgd9XArXBHtWfN+0jm0yPyDfM9vJOfuRo5lobSRjR fiSTfIrP5LeVHI84Xf30pQ9aNoNUsp6x4tn7sgKNc1rPI183bQq8T0py6dpWXMHC3o9fAz tyo0134pCehDBVP64ucSjUEcDlKvE+TEvoZAjSdtNEFj0JMRflxUt1aUJryuLDB/Vn6E4c ieQuw+mNOYa7bMKumODpJdEJnjQAAlo7BG1VXHTjJodIdTf1dVrBj+Wdu1EDL1DoPEO/ox vaCOytCTNJh/6mWQJsl3FRPxqX3hR2ZK9H7kD7NrPwKIn+/PuBk8UDOzcS6uIQ== 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=1696285879; 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=LwT7gABVdN8aT4oyJEVnaqHOz1ZzBi6lZuSViiSTBGo=; b=MjGbBu/Z0OkJ2gkByvrUERpguypMUldQDIpnKlJemaagu9582J+kShEFRUQ7LcGIcxQqV9 YnCrCzzp7UwH0njHHMq7rp9v4aM82iPPMkRvx4d3JI2M/3sSqsBjFOTtWftgk+HWI/81PN AmwiyMfkxbibljx+7RdLvduTOi5tCoGys/QGld4GExIIiXCZqjODHhVDmajN2Q6eolsR/y nBLMIj6aCqIomvT6fGhDESUAmvqk4AmjQYXxKWLvXeIq/0lrT4Ln+TY73X3lIJxiWVHyhm yHWy/5iDjpexv3KpInkKCqvFEanvgcGC2+rCwW9XnlNL6Rb2JrxPg3teLoPeQw== 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 4RzwfG5zqVzVm5; Mon, 2 Oct 2023 22:31:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392MVIS7098966; Mon, 2 Oct 2023 22:31:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392MVIap098963; Mon, 2 Oct 2023 22:31:18 GMT (envelope-from git) Date: Mon, 2 Oct 2023 22:31:18 GMT Message-Id: <202310022231.392MVIap098963@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 39024a891469 - main - syscalls: fix missing SIGSYS for several ENOSYS errors List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 39024a89146902ca9aba250130b828ad9aced99d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=39024a89146902ca9aba250130b828ad9aced99d commit 39024a89146902ca9aba250130b828ad9aced99d Author: Konstantin Belousov AuthorDate: 2023-09-25 16:32:52 +0000 Commit: Konstantin Belousov CommitDate: 2023-10-02 22:30:52 +0000 syscalls: fix missing SIGSYS for several ENOSYS errors In particular, when the syscall number is too large, or when syscall is dynamic. For that, add nosys_sysent structure to pass fake sysent to syscall top code. Reviewed by: dchagin, markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976 --- sys/amd64/amd64/trap.c | 2 +- sys/amd64/ia32/ia32_syscall.c | 2 +- sys/arm/arm/syscall.c | 2 +- sys/arm64/arm64/elf32_machdep.c | 2 +- sys/arm64/arm64/trap.c | 2 +- sys/arm64/linux/linux_sysvec.c | 2 +- sys/i386/i386/trap.c | 2 +- sys/i386/linux/linux_sysvec.c | 2 +- sys/kern/kern_sig.c | 3 ++- sys/kern/kern_syscalls.c | 25 +++++++++++++++++++------ sys/kern/subr_syscall.c | 3 ++- sys/powerpc/powerpc/trap.c | 2 +- sys/riscv/riscv/trap.c | 2 +- sys/sys/sysent.h | 3 ++- 14 files changed, 35 insertions(+), 19 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index ef38c0789636..8114105655f8 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1033,7 +1033,7 @@ cpu_fetch_syscall_args_fallback(struct thread *td, struct syscall_args *sa) } if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c index 3fb905ab9e0a..c61587a93d1f 100644 --- a/sys/amd64/ia32/ia32_syscall.c +++ b/sys/amd64/ia32/ia32_syscall.c @@ -183,7 +183,7 @@ ia32_fetch_syscall_args(struct thread *td) params += sizeof(quad_t); } if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/arm/arm/syscall.c b/sys/arm/arm/syscall.c index 57644c023646..c440f501e834 100644 --- a/sys/arm/arm/syscall.c +++ b/sys/arm/arm/syscall.c @@ -118,7 +118,7 @@ cpu_fetch_syscall_args(struct thread *td) } p = td->td_proc; if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; error = 0; diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index e1fcb533a8cc..9cf1b2e11f8b 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -191,7 +191,7 @@ freebsd32_fetch_syscall_args(struct thread *td) } if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index c3221e9faf9f..2dda8cfc4c20 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -151,7 +151,7 @@ cpu_fetch_syscall_args(struct thread *td) } if (__predict_false(sa->code >= p->p_sysent->sv_size)) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 5f9252accb5f..19dd5866ba50 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -123,7 +123,7 @@ linux_fetch_syscall_args(struct thread *td) sa->original_code = sa->code; /* LINUXTODO: generic syscall? */ if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 172317aead29..d0ee2b30a3ce 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1113,7 +1113,7 @@ cpu_fetch_syscall_args(struct thread *td) } if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index fe3e3f743620..a3d445951cce 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -522,7 +522,7 @@ linux_fetch_syscall_args(struct thread *td) if (sa->code >= p->p_sysent->sv_size) /* nosys */ - sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 964ad2398bd9..8d0d2903bac0 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2686,7 +2686,8 @@ ptrace_syscallreq(struct thread *td, struct proc *p, audited = AUDIT_SYSCALL_ENTER(sc, td) != 0; if (!sy_thr_static) { - error = syscall_thread_enter(td, se); + error = syscall_thread_enter(td, &se); + sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0; if (error != 0) { tsr->ts_ret.sr_error = error; return; diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c index 78014a36b34b..f923211cb6c8 100644 --- a/sys/kern/kern_syscalls.c +++ b/sys/kern/kern_syscalls.c @@ -61,6 +61,17 @@ lkmressys(struct thread *td, struct nosys_args *args) return (nosys(td, args)); } +struct sysent nosys_sysent = { + .sy_call = (sy_call_t *)nosys, + .sy_systrace_args_func = NULL, + .sy_narg = 0, + .sy_flags = SYF_CAPENABLED, + .sy_auevent = AUE_NULL, + .sy_entry = 0, /* DTRACE_IDNONE */ + .sy_return = 0, + .sy_thrcnt = SY_THR_STATIC, +}; + static void syscall_thread_drain(struct sysent *se) { @@ -78,19 +89,21 @@ syscall_thread_drain(struct sysent *se) } int -syscall_thread_enter(struct thread *td, struct sysent *se) +syscall_thread_enter(struct thread *td, struct sysent **se) { uint32_t cnt, oldcnt; - KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0, + KASSERT(((*se)->sy_thrcnt & SY_THR_STATIC) == 0, ("%s: not a static syscall", __func__)); do { - oldcnt = se->sy_thrcnt; - if ((oldcnt & (SY_THR_DRAINING | SY_THR_ABSENT)) != 0) - return (ENOSYS); + oldcnt = (*se)->sy_thrcnt; + if ((oldcnt & (SY_THR_DRAINING | SY_THR_ABSENT)) != 0) { + *se = &nosys_sysent; + return (0); + } cnt = oldcnt + SY_THR_INCR; - } while (atomic_cmpset_acq_32(&se->sy_thrcnt, oldcnt, cnt) == 0); + } while (atomic_cmpset_acq_32(&(*se)->sy_thrcnt, oldcnt, cnt) == 0); return (0); } diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index c0262a1b1010..ff13672501b2 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -144,7 +144,8 @@ syscallenter(struct thread *td) AUDIT_SYSCALL_ENTER(sa->code, td) || !sy_thr_static)) { if (!sy_thr_static) { - error = syscall_thread_enter(td, se); + error = syscall_thread_enter(td, &se); + sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0; if (error != 0) { td->td_errno = error; goto retval; diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 1527e813647d..7f1a267f5cf2 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -694,7 +694,7 @@ cpu_fetch_syscall_args(struct thread *td) } if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index b855fcc4163a..ea48b02ba29b 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -115,7 +115,7 @@ cpu_fetch_syscall_args(struct thread *td) } if (__predict_false(sa->code >= p->p_sysent->sv_size)) - sa->callp = &p->p_sysent->sv_table[0]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 3f52848af982..3ef6b06c5545 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -191,6 +191,7 @@ struct sysentvec { extern struct sysentvec aout_sysvec; extern struct sysent sysent[]; extern const char *syscallnames[]; +extern struct sysent nosys_sysent; struct nosys_args { register_t dummy; @@ -319,7 +320,7 @@ struct nosys_args; int lkmnosys(struct thread *, struct nosys_args *); int lkmressys(struct thread *, struct nosys_args *); -int syscall_thread_enter(struct thread *td, struct sysent *se); +int syscall_thread_enter(struct thread *td, struct sysent **se); void syscall_thread_exit(struct thread *td, struct sysent *se); int shared_page_alloc(int size, int align); From nobody Mon Oct 2 22:31:19 2023 X-Original-To: dev-commits-src-main@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 4RzwfJ19Hfz4wZ9n; Mon, 2 Oct 2023 22:31:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzwfJ0Jmpz3VqK; Mon, 2 Oct 2023 22:31:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696285880; 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=8aYGxtpNonPK2XeoXtfDoYSwNX2i7eddwwSj3f+byW8=; b=u19GjWh4ly5lUN80Z1VYxifAB4rRygF/WJe0WhpYvpdxtSovnNG4WoG8Z1j3wQKRLibpAC xVa6G3EYNijqTnqWW1N/zYZBIUVQpy22plk/Q7iwrGx7Bn+1OwBvl9suHZUeRoFlpF9hga AETcfGnoJ8UbiBihzDPr1d/GyhuY0WCMWOm+41cvsJctsdljEGLUfYMyCCmws2xT7/axGc fHEBOcuDgJCz8tF6GlmAiB6ZcshcDgV7crbqZjwhuSgEBNMgjwXhvaARH4zM2FcbbrET7a fM/ilFT3tKZckn+CohLej8DAWgsS16qmwBnP+vRTi+dZkIBiKA8Q3KFEbdF+xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696285880; a=rsa-sha256; cv=none; b=iuE1qqKP8hBo7gbsxIs+SWCdq+hJu3YxwvveSvrRh4embOamnaY2UOpOTA5RwWKde2DuWl E3Zls/tladg4TqFjxtVB4GBWWpwZwTzzVc5A+wUns4n+SQyqz/cUU/RJTPzL2XLvdMUYEC Pfgnw59+ro99kKRlpUpzs/2Odc+I/9WEjLTD/KxUxKgLNov6avV8KYsqgz4LIJBpKb721u e2ShjvAALLCPo+CcHoluHcmT4rEzIVF7vx+hAVF9+nuJ+XeKf/MD12aCR0xAO0V8r4SaO6 v5XvUtxW1ZylMRAO+3N6SZgASSMx5GiezW6aXfOzfHFf0jxtm8OVAdBgy1YH6g== 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=1696285880; 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=8aYGxtpNonPK2XeoXtfDoYSwNX2i7eddwwSj3f+byW8=; b=syWwNSr60TFR2fX06LLlugLozLBJZTtS8hsmXL0ZCfFwz91OxEFUiybJkfYyKSd/DJVSRj rjNJ7cNph//yvxcPYc2wZGC4cUU/PztyaHXahqHRfoQpu8zphW6oRueftIVOQFzifFH/5b IG8Zh/uKWPJ84hopaDy9R5TtVzCKVgVcmnivoX7YQ2AtSrOSJqdMipw8oyAqzedac6BFvJ CiaQ1RQ+i019SaxV/QWrUwXOLVjd2GLGz1W/Ta5fzhWGhK664snfEffOy+2wvl0RJd+Qa9 DqNnlGydWHbQ6nalrigggskm4y75EwUNnSTJZMSj6Vv/mzvh5tDb0SRYV5Iwgw== 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 4RzwfH6SFxzW9x; Mon, 2 Oct 2023 22:31:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392MVJRL099005; Mon, 2 Oct 2023 22:31:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392MVJuS099002; Mon, 2 Oct 2023 22:31:19 GMT (envelope-from git) Date: Mon, 2 Oct 2023 22:31:19 GMT Message-Id: <202310022231.392MVJuS099002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b82b4ae75250 - main - sysentvec: add SV_SIGSYS flag List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b82b4ae752501469053979393e33bbfa74fbc9d2 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b82b4ae752501469053979393e33bbfa74fbc9d2 commit b82b4ae752501469053979393e33bbfa74fbc9d2 Author: Konstantin Belousov AuthorDate: 2023-09-25 16:33:36 +0000 Commit: Konstantin Belousov CommitDate: 2023-10-02 22:30:52 +0000 sysentvec: add SV_SIGSYS flag to allow ABIs to indicate that SIGSYS is needed. Mark all native FreeBSD ABIs with the flag. This implicitly marks Linux' ABIs as not delivering SIGSYS on invalid syscall. Reviewed by: dchagin, markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976 --- sys/amd64/amd64/elf_machdep.c | 6 ++++-- sys/arm/arm/elf_machdep.c | 2 +- sys/arm64/arm64/elf32_machdep.c | 2 +- sys/arm64/arm64/elf_machdep.c | 2 +- sys/compat/ia32/ia32_sysvec.c | 3 ++- sys/i386/i386/elf_machdep.c | 2 +- sys/kern/imgact_aout.c | 6 ++++-- sys/kern/kern_sig.c | 8 +++++--- sys/powerpc/powerpc/elf32_machdep.c | 2 +- sys/powerpc/powerpc/elf64_machdep.c | 4 ++-- sys/riscv/riscv/elf_machdep.c | 2 +- sys/sys/sysent.h | 2 +- 12 files changed, 24 insertions(+), 17 deletions(-) diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c index 08eaa1e8ac8b..fc25decc64a2 100644 --- a/sys/amd64/amd64/elf_machdep.c +++ b/sys/amd64/amd64/elf_machdep.c @@ -80,7 +80,8 @@ struct sysentvec elf64_freebsd_sysvec_la48 = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_LP64 | SV_SHP | - SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG, + SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG | + SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, @@ -122,7 +123,8 @@ struct sysentvec elf64_freebsd_sysvec_la57 = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_LP64 | SV_SHP | - SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG, + SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG | + SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index 19332d86afc3..c02e489728dd 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -87,7 +87,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_maxssiz = NULL, .sv_flags = SV_ASLR | SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | - SV_ABI_FREEBSD | SV_ILP32, + SV_ABI_FREEBSD | SV_ILP32 | SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 9cf1b2e11f8b..4161f9d44ae7 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -105,7 +105,7 @@ static struct sysentvec elf32_freebsd_sysvec = { .sv_fixlimit = NULL, // XXX .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_TIMEKEEP | - SV_RNG_SEED_VER, + SV_RNG_SEED_VER | SV_SIGSYS, .sv_set_syscall_retval = freebsd32_set_syscall_retval, .sv_fetch_syscall_args = freebsd32_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c index 7ce521197503..dd053d4d7847 100644 --- a/sys/arm64/arm64/elf_machdep.c +++ b/sys/arm64/arm64/elf_machdep.c @@ -84,7 +84,7 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_SHP | SV_TIMEKEEP | SV_ABI_FREEBSD | SV_LP64 | - SV_ASLR | SV_RNG_SEED_VER, + SV_ASLR | SV_RNG_SEED_VER | SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index b1f4b428a8aa..974bed85480c 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -127,7 +127,8 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_fixlimit = ia32_fixlimit, .sv_maxssiz = &ia32_maxssiz, .sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_IA32 | SV_ILP32 | - SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG, + SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | + SV_DSO_SIG | SV_SIGSYS, .sv_set_syscall_retval = ia32_set_syscall_retval, .sv_fetch_syscall_args = ia32_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c index 85653367c3b6..eb6ac5735e56 100644 --- a/sys/i386/i386/elf_machdep.c +++ b/sys/i386/i386/elf_machdep.c @@ -75,7 +75,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_IA32 | SV_ILP32 | - SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER, + SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index a4ac1901d50e..f1b2845349aa 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -91,7 +91,8 @@ struct sysentvec aout_sysvec = { .sv_setregs = exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32, + .sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32 | + SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, @@ -140,7 +141,8 @@ struct sysentvec aout_sysvec = { .sv_setregs = ia32_setregs, .sv_fixlimit = ia32_fixlimit, .sv_maxssiz = &ia32_maxssiz, - .sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32, + .sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32 | + SV_SIGSYS, .sv_set_syscall_retval = ia32_set_syscall_retval, .sv_fetch_syscall_args = ia32_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 8d0d2903bac0..16bc1e441119 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -4219,9 +4219,11 @@ nosys(struct thread *td, struct nosys_args *args) p = td->td_proc; - PROC_LOCK(p); - tdsignal(td, SIGSYS); - PROC_UNLOCK(p); + if (SV_PROC_FLAG(p, SV_SIGSYS) != 0) { + PROC_LOCK(p); + tdsignal(td, SIGSYS); + PROC_UNLOCK(p); + } if (kern_lognosys == 1 || kern_lognosys == 3) { uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, td->td_sa.code); diff --git a/sys/powerpc/powerpc/elf32_machdep.c b/sys/powerpc/powerpc/elf32_machdep.c index 53af1642b6bf..fcdc1aa1e8a5 100644 --- a/sys/powerpc/powerpc/elf32_machdep.c +++ b/sys/powerpc/powerpc/elf32_machdep.c @@ -124,7 +124,7 @@ struct sysentvec elf32_freebsd_sysvec = { #endif .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_ASLR | - SV_TIMEKEEP | SV_RNG_SEED_VER, + SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_shared_page_base = FREEBSD32_SHAREDPAGE, diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c index 07c1892591d2..6edfd965b7ec 100644 --- a/sys/powerpc/powerpc/elf64_machdep.c +++ b/sys/powerpc/powerpc/elf64_machdep.c @@ -86,7 +86,7 @@ struct sysentvec elf64_freebsd_sysvec_v1 = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR | - SV_TIMEKEEP | SV_RNG_SEED_VER, + SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, @@ -128,7 +128,7 @@ struct sysentvec elf64_freebsd_sysvec_v2 = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | - SV_TIMEKEEP | SV_RNG_SEED_VER, + SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c index f0732e731854..e3744aa2c9e5 100644 --- a/sys/riscv/riscv/elf_machdep.c +++ b/sys/riscv/riscv/elf_machdep.c @@ -84,7 +84,7 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP | - SV_ASLR | SV_RNG_SEED_VER, + SV_ASLR | SV_RNG_SEED_VER | SV_SIGSYS, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 3ef6b06c5545..0166523ab84e 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -164,7 +164,7 @@ struct sysentvec { #define SV_IA32 0x004000 /* Intel 32-bit executable. */ #define SV_AOUT 0x008000 /* a.out executable. */ #define SV_SHP 0x010000 /* Shared page. */ -#define SV_AVAIL1 0x020000 /* Unused */ +#define SV_SIGSYS 0x020000 /* SIGSYS for non-existing syscall */ #define SV_TIMEKEEP 0x040000 /* Shared page timehands. */ #define SV_ASLR 0x080000 /* ASLR allowed. */ #define SV_RNG_SEED_VER 0x100000 /* random(4) reseed generation. */ From nobody Mon Oct 2 22:31:20 2023 X-Original-To: dev-commits-src-main@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 4RzwfK2F0qz4wZGr; Mon, 2 Oct 2023 22:31:21 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzwfK1Hn5z3W6L; Mon, 2 Oct 2023 22:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696285881; 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=fqIfpP2OIAx4iiig2TZTCX/rSHWkVXwmh2pqAZps0mo=; b=WbtA6XlGCGffgX5wOSQgKfIb82/QBOdOI48xNq0o1cWVad/6upSQ03Txvtl18zqO63BCmY dyHesedsWFcrmBbqwzOf53XKs+4McOC+1Zsv9vp7bNOIjZoAR6gu5VYqLQZ1vNcEAWv8ud lu1/1E8RQCjYAxnB8AcjvF49Lf1X3EjlMpSaA2uU3hcQ0KldNeydpQ3eU0IpRud4algO0p sZUSSErKIkRBwpyYQUWdl19hK2IW1H+dpBN43eqOEmIVj8SCUcvUbTN1fVtS0pBZ1mKqQN uG5l9HabIxLK9wQhSgvEWuKFP3Ul9PHljAimAiCD/XAWU237AsdiIByo3Zrpyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696285881; a=rsa-sha256; cv=none; b=qrSOCQiTxPyxl9gCrcAuoZ/Nz8fNAHmI6cloJScjVPdXEMw0Oz+u2mJBIyPbpw9lZNz3uI kaEm9hREFKAvxHWdM7U+AHCVxsC6yalSkBqBT8deG/O6NandaORYUOenGYxH9GDrtzCGJ3 RYZCawkWL4F2V6dtyJukVig+Uzpk6pTOzGhcD42CNlx7MNUc/i9IDHcISoxk7SFliRLKQr GzFLjiO026xrgOBYLlSBuTKFEbskIOKqLksHCIanTP89sGQyAAl4/7J9x/B3qG87Qx5WwR W52mDbOzufYa+xZtBsj14JUlA7VHbqJx5LLD3ZXTTz0KWz714AIt7A+i9XLQeg== 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=1696285881; 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=fqIfpP2OIAx4iiig2TZTCX/rSHWkVXwmh2pqAZps0mo=; b=ROiDpgv++Kaa9aaGQl5HMEMGHtrNPh79RN8FVwbg5oux3aQassUevCn4R5yeNUoJbjQaSw SqHWx2okeexr6Isr2zGF7221Vm9vd37PQW0bm69DW7b7ZmsQzalKL3w1A6pXFUUFnf+ICx KQHRREVRye+oWMkYdSSz02lmOo4YN0zoQQUE2rHvt5gpimR0S/SsLqPKI5n4lsUPCW9umS 6xNov915dGWQ69lgN96aVKtwMCWhfAW8NnubbOCJnZVw5ldKPgDb8g10X+XaGODHp0UMyx SfTSOhI0DaArQZifD7NE4xD+dU39lVGFmrmlgEyFRbnCd5bx8PJbywpLVc9esg== 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 4RzwfK0HY0zVbk; Mon, 2 Oct 2023 22:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392MVKBl099060; Mon, 2 Oct 2023 22:31:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392MVK6Z099057; Mon, 2 Oct 2023 22:31:20 GMT (envelope-from git) Date: Mon, 2 Oct 2023 22:31:20 GMT Message-Id: <202310022231.392MVK6Z099057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5804a1623054 - main - nosys(): add kern.signosys tunable/sysctl to control SIGSYS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5804a1623054d865618d77cfac86978f03b8111a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5804a1623054d865618d77cfac86978f03b8111a commit 5804a1623054d865618d77cfac86978f03b8111a Author: Konstantin Belousov AuthorDate: 2023-09-25 16:36:04 +0000 Commit: Konstantin Belousov CommitDate: 2023-10-02 22:30:53 +0000 nosys(): add kern.signosys tunable/sysctl to control SIGSYS Reviewed by: dchagin, markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976 --- sys/kern/kern_sig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 16bc1e441119..c847783cd3da 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -159,6 +159,10 @@ static int kern_lognosys = 0; SYSCTL_INT(_kern, OID_AUTO, lognosys, CTLFLAG_RWTUN, &kern_lognosys, 0, "Log invalid syscalls"); +static int kern_signosys = 1; +SYSCTL_INT(_kern, OID_AUTO, signosys, CTLFLAG_RWTUN, &kern_signosys, 0, + "Send SIGSYS on return from invalid syscall"); + __read_frequently bool sigfastblock_fetch_always = false; SYSCTL_BOOL(_kern, OID_AUTO, sigfastblock_fetch_always, CTLFLAG_RWTUN, &sigfastblock_fetch_always, 0, @@ -4219,7 +4223,7 @@ nosys(struct thread *td, struct nosys_args *args) p = td->td_proc; - if (SV_PROC_FLAG(p, SV_SIGSYS) != 0) { + if (SV_PROC_FLAG(p, SV_SIGSYS) != 0 && kern_signosys) { PROC_LOCK(p); tdsignal(td, SIGSYS); PROC_UNLOCK(p); From nobody Mon Oct 2 22:31:22 2023 X-Original-To: dev-commits-src-main@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 4RzwfL3dYSz4wYv0; Mon, 2 Oct 2023 22:31:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzwfL2Y7Lz3W9C; Mon, 2 Oct 2023 22:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696285882; 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=stl5KeLArxwt0b0+GsXh1UY31TyxrGdBrGUHf8GpRi0=; b=QCHxhZh5N6b1TDuY3h1JTsFCWAE7x3TLkD1pGkDEo25ykoMK23Dn3FJybnqKZLR3exkWq5 tLAhRoIrNmTk6FMB6AZIiqeO3+yNMfz/qt0jDuwptpfhiA0UhvIaIPzrgJN5NJ//4J6T29 c/3U4xC8euZPXj8hhTO7DQGFOAeo+8wbK4fqx/bZbm7pGI+JRGAchmBzKwBfCwEfzyyMpP pn+1yR25B0N7+WB4sdKpYDgTiLwavSjBh+2JBkOHL83nsJwyC1z6+u45SNI21395zwfRPO wUwR6G4UKtZAOrA+pYdi6skMtgTDyJaqTEjcFvxuLDyyuI60xAr3xvox/SLhQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696285882; a=rsa-sha256; cv=none; b=TZ4BUyeaDBTZ89yKLtwnjOSTxnqAXhb4eVN+iEDMo6F7GePKADjR2mYpD6QiD4W+JcbN6F EcegyB4WYREqEA0XWTOak1zi1rd3d3M5KPZrOfORtReFlbTOhQ3ADX2SwwhlbjoM7VISmw rNAvNxk3O3AzMYWPixEcLig/BIQzEOeddbKIIYq18vNk6Buylui+bQLiJwKthqMYxY4yIu Kg929aHXCOvSb2sUrgPQwZFUe4/U4ei/t16OlDMGJPvDO3OEUfU3YxpaOECP4t1tgrDT7k S4JDflp2mlrT+qbw5GwsMiQciEZj0OzUXjpL1hHraAvYboEnUCyXWSFK7QfWBQ== 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=1696285882; 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=stl5KeLArxwt0b0+GsXh1UY31TyxrGdBrGUHf8GpRi0=; b=jAV07tQHuIBHY3dcEUgHbPi4wjJhPx8gHtI8NlBj1sTIzGXa4RVVPJRtj5z4pVUsAdOIZN ch442elcgQ6gDcqx4OiEEQCWLLRhK4LVFwkOEAcriZDbLpRi95oYPMq6bDRav5bTVRQYeN GDp66rvII/IoAjuFgBrb6YFsdrjJDu5jqhVVFezDDssVmmmiTAwmZ9wBZvmKltJurPOGRZ ZMZNW4Ir0CMiHl1xXnmHelR7kZPUPjAhHoroiuFNOij/YVu7g1GJiWov9KVHKUFeC7cdGN 4Cg5+6i3vXPwRXPuLj9RPBvp0fe36GLS1bfSc38d4h9wvQ2pyfVTXtBz3Vbevg== 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 4RzwfL1Yp2zW9y; Mon, 2 Oct 2023 22:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392MVMsB099110; Mon, 2 Oct 2023 22:31:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392MVMll099107; Mon, 2 Oct 2023 22:31:22 GMT (envelope-from git) Date: Mon, 2 Oct 2023 22:31:22 GMT Message-Id: <202310022231.392MVMll099107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7acc4240ce00 - main - linuxolator: fix nosys() to not send SIGSYS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7acc4240ce00af540093b47ad00be0508310b515 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7acc4240ce00af540093b47ad00be0508310b515 commit 7acc4240ce00af540093b47ad00be0508310b515 Author: Konstantin Belousov AuthorDate: 2023-09-25 16:39:48 +0000 Commit: Konstantin Belousov CommitDate: 2023-10-02 22:30:53 +0000 linuxolator: fix nosys() to not send SIGSYS Reviewed by: dchagin, markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976 --- sys/amd64/linux/linux_sysvec.c | 2 +- sys/amd64/linux32/linux32_sysvec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 2907323d903c..98e2a01b98db 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -159,7 +159,7 @@ linux_fetch_syscall_args(struct thread *td) if (sa->code >= p->p_sysent->sv_size) /* nosys */ - sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 31436ee7162a..7104cc50735e 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -531,7 +531,7 @@ linux32_fetch_syscall_args(struct thread *td) if (sa->code >= p->p_sysent->sv_size) /* nosys */ - sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; From nobody Mon Oct 2 22:31:23 2023 X-Original-To: dev-commits-src-main@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 4RzwfM5d3Qz4wZGw; Mon, 2 Oct 2023 22:31:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RzwfM3TnRz3W21; Mon, 2 Oct 2023 22:31:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696285883; 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=yVVzr15WYsquMPAWP01mLs00b6xvefkr7ZfLfXFbwTc=; b=UCGNPu1ue+RHohcWpAsDO72Vkfzga0pRzPq++lUxKHT/4h6H/XsHzushol43jXQJBMRkYF zwMl/XICXBhuvg4WW3RtbhVKhiMSHMBOW08R5aYfdqK1gaV+bRmYZCPiTAKJfkortbTs/v HEh0VRSJfQzM53qDZnntl0Yc3g5v+SkG+qvuvxkCXO6BYQ/So17P8BZu8q2XUxlHNXukgM 6hW8A6j2AoutHnmkHcqG8EbfAeyil7M2baew3UuA5UnnJdmN/AowpxS8psQ2Ve2h0ncywL 7w7oRswIsv6fzqUcxfj39dokX1DDCNlejest/tYZn0L1izdEMgb4NVHn1T+RIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696285883; a=rsa-sha256; cv=none; b=O4amfqUVexup8SM9OCnoT7n5DH97Eguuyy6K5cw/bQgxyiVyw4efcUnIhcz6avmugjpDtp EPWgzffR43S8yhHVRVRu/KqjaLttcS3VsqbY2m06XLYIlcjNbMhrPZDWkxvDqJHUDfauQ6 2R9xyjjnfPzPzA/4lEtlz0ShVFmU7WotNACqVNLRnvMGWEa+7DSw06c2YtjVIwU4Nd6jT3 A6QSVC7ooyzUi0a/YUHCwe+IWrCBnygOqEgqIucw3eAczCBLcEG4vvKuv7ZyrBAjC5/s6e Vs4z5rV1bSvwT8FdZfdXxUqDd1+Co0tcfMQAuIHZO/38Z155dr4XJXB9AutZzQ== 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=1696285883; 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=yVVzr15WYsquMPAWP01mLs00b6xvefkr7ZfLfXFbwTc=; b=yIxZ4+/i4YiXeP595vsUJxPxbnR+ot2VP6X3sa25p3ADQqxGrcv3ouVGN9h+yC51k2bGcH 5q6/RkaEC3cKIHGuSh0aUEuaNqJAntS8yE01anrxmiX+W4xwKCUy5zE8tI6zGK8CzqlmLJ esrGIvGo1GrEH019tfceL30Vg0xLwNL5/zNN6dkFl3o4ntVtvtZ9/6twJ5gWmb9SSYJ8cL XPP2mbZVcQymLpFohvj6dHreBjZmwrtSmmfZ3WT3gVppxNTtI8BBXspJMStN2rG0yNZf7N PGktBvbQFcVXKhLVDHw9QGC9igOK20JJwgOf49g+0OJXMTW5kJ1HER0b+T/wsg== 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 4RzwfM2Xb0zWB0; Mon, 2 Oct 2023 22:31:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392MVNeB099146; Mon, 2 Oct 2023 22:31:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392MVNW4099143; Mon, 2 Oct 2023 22:31:23 GMT (envelope-from git) Date: Mon, 2 Oct 2023 22:31:23 GMT Message-Id: <202310022231.392MVNW4099143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0afcac3e37e9 - main - SIGSYS: add tests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0afcac3e37e911f7e387ebeb2aae19b2b00ca4cc Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0afcac3e37e911f7e387ebeb2aae19b2b00ca4cc commit 0afcac3e37e911f7e387ebeb2aae19b2b00ca4cc Author: Konstantin Belousov AuthorDate: 2023-09-25 18:40:28 +0000 Commit: Konstantin Belousov CommitDate: 2023-10-02 22:30:53 +0000 SIGSYS: add tests Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976 --- tests/sys/kern/Makefile | 1 + tests/sys/kern/sigsys.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index f2fe9e7008d9..6396b22005c3 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -48,6 +48,7 @@ TEST_METADATA.unix_seqpacket_test+= timeout="15" ATF_TESTS_C+= unix_socketpair_test ATF_TESTS_C+= waitpid_nohang ATF_TESTS_C+= pdeathsig +ATF_TESTS_C+= sigsys ATF_TESTS_SH+= coredump_phnum_test ATF_TESTS_SH+= sonewconn_overflow diff --git a/tests/sys/kern/sigsys.c b/tests/sys/kern/sigsys.c new file mode 100644 index 000000000000..75e3816fc158 --- /dev/null +++ b/tests/sys/kern/sigsys.c @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * SPDX-License-Identifier: BSD-2-Clause + * + * This software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + */ + +#include + +#include +#include +#include +#include +#include + +static sig_atomic_t sigsys_cnt; + +static void +sigsys_handler(int signo, siginfo_t *si, void *ucp) +{ + sigsys_cnt++; +} + +ATF_TC(sigsys_test); + +ATF_TC_HEAD(sigsys_test, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Testing delivery of SIGSYS on invalid syscalls"); +} + +ATF_TC_BODY(sigsys_test, tc) +{ + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_sigaction = sigsys_handler; + sa.sa_flags = SA_SIGINFO; + ATF_REQUIRE(sigaction(SIGSYS, &sa, NULL) == 0); + + ATF_REQUIRE(syscall(273) == -1); /* reserved */ + ATF_CHECK_ERRNO(ENOSYS, true); + atomic_signal_fence(memory_order_seq_cst); + ATF_CHECK_EQ(1, sigsys_cnt); + + ATF_REQUIRE(syscall(440) == -1); /* SYS_kse_switchin */ + ATF_CHECK_ERRNO(ENOSYS, true); + atomic_signal_fence(memory_order_seq_cst); + ATF_CHECK_EQ(2, sigsys_cnt); + + /* Hope this is enough for say next two months */ + ATF_REQUIRE(syscall(3000000) == -1); + ATF_CHECK_ERRNO(ENOSYS, true); + atomic_signal_fence(memory_order_seq_cst); + ATF_CHECK_EQ(3, sigsys_cnt); + + ATF_REQUIRE(syscall(SYS_afs3_syscall) == -1); + ATF_CHECK_ERRNO(ENOSYS, true); + atomic_signal_fence(memory_order_seq_cst); + ATF_CHECK_EQ(4, sigsys_cnt); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, sigsys_test); + return (atf_no_error()); +} From nobody Tue Oct 3 03:25:33 2023 X-Original-To: dev-commits-src-main@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 4S039q0s76z4vd7J for ; Tue, 3 Oct 2023 03:25:35 +0000 (UTC) (envelope-from cperciva@freebsd.org) Received: from mail.tarsnap.com (mail.tarsnap.com [54.86.246.204]) by mx1.freebsd.org (Postfix) with SMTP id 4S039p323Nz4SGD for ; Tue, 3 Oct 2023 03:25:34 +0000 (UTC) (envelope-from cperciva@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=none; spf=softfail (mx1.freebsd.org: 54.86.246.204 is neither permitted nor denied by domain of cperciva@freebsd.org) smtp.mailfrom=cperciva@freebsd.org; dmarc=none Received: (qmail 94567 invoked from network); 3 Oct 2023 03:25:33 -0000 Received: from unknown (HELO dell7390.daemonology.net) (127.0.0.1) by mail.tarsnap.com with SMTP; 3 Oct 2023 03:25:33 -0000 Received: (qmail 74902 invoked from network); 3 Oct 2023 03:25:33 -0000 Received: from unknown (HELO ?127.0.0.1?) (127.0.0.1) by localhost with SMTP; 3 Oct 2023 03:25:33 -0000 Message-ID: <226ab4a0-f6c8-d5c1-e564-bde9cb4cd797@freebsd.org> Date: Mon, 2 Oct 2023 20:25:33 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: git: 7494fb6b7d80 - main - EC2: Flavour existing AMIs as "base" Content-Language: en-US To: Alexey Dokuchaev Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202309282218.38SMIqGH056845@gitrepo.freebsd.org> From: Colin Percival In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Bar: / X-Spamd-Result: default: False [0.50 / 15.00]; VIOLATED_DIRECT_SPF(3.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[54.86.246.204:from]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:14618, ipnet:54.86.0.0/16, country:US]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[cperciva]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_THREE(0.00)[4]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4S039p323Nz4SGD On 9/28/23 22:52, Alexey Dokuchaev wrote: > On Thu, Sep 28, 2023 at 10:18:52PM +0000, Colin Percival wrote: >> commit 7494fb6b7d809257d4eb9eff06ce226143f27add >> >> EC2: Flavour existing AMIs as "base" > > I think it should be "flavor" since FreeBSD prefers American spelling. I understand that's a policy for FreeBSD documentation, but I'm not aware of any such policy for the FreeBSD src tree. And indeed there are thousands of behaviours, colours, and flavours in the tree, including "colours offered by the original IBM PC Color Graphics Adapter". >> @@ -31,6 +31,7 @@ BASIC-CI_DESC= Image for CI >> EC2_FORMAT= raw >> EC2_FSLIST= ufs zfs >> EC2_DESC= Amazon EC2 image >> +EC2_FLAVOURS= BASE > > Since other nearby values (format, filesystems) are lowercase, perhaps > it makes sense to say EC2_FLAVORS=base and :tu it when needed in the > code to keep declarations consistent and tidy. We already had "VIRTUALBOX" and "VMWARE" flavours of Vagrant (and these are all flavours of upper-cased EC2/GCE/OCI/VAGRANT/etc) so I figured that I would follow the example of being, err, consistently inconsistent. I agree that having everything in lower case would make sense though. -- Colin Percival FreeBSD Deputy Release Engineer & EC2 platform maintainer Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From nobody Tue Oct 3 05:54:40 2023 X-Original-To: dev-commits-src-main@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 4S06Ts1Nr7z4vnq2; Tue, 3 Oct 2023 05:54:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S06Ts0kMsz3DPf; Tue, 3 Oct 2023 05:54:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696312481; 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=3O1zRrWIui8ZwFTyZ1J0uq2xP4RiU5wLnhO2lbCq2pQ=; b=eIVN2k4ue72VMz50/tgmTFEm3jUY3VWEoxdfKjQWcT99uCFe+ph0XYR7aLCQiwa8WwtVGb tgFEszFT88EavntQdL8vb3h3UY16ExfjesKfOONgHLJ09Tcu57/sN75YF5S/IbBpmk6RRQ nc9OmLopTKlE1a0Z7avQ/e46xRzVo8nU0xqsdOKnG1CTOLjpVfnQ0Iqfbgbf0WfYIQydcP MvBtNZY9+3hD8DNPnZhWwM0Yuki6EszJkM//Uyx59cK55bWqHEy1uhGWNnZuMV/4lBGpXt LAOkJPv8lidedOv0Nl+JaDBLTt0wTOGPgCh9JzhXQYiYyCvB2zd0TCk+jrgAXQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696312481; a=rsa-sha256; cv=none; b=tbgYjr7pmksbI420QxKcDt2xXSFRy4+6AusT8wd8Q3MzDpeuqDknvE8LQIelbpoFqwOdZC 15IHMnP5ZLgOW58vF9KvDshCcjDa52GbvIcm0pWZq8nmrHRHXYjgq3Qialkhpic0roCZIR NQ+EGWSzR8J2nODILrwteOaTPw8LPw2Rzh0wSREN9TL6BbVBnw45zVfve9eNjHkZYzSluc hdjfOjJIKIBiFqn2gCKqI+tF998LitYlYkMWd5j0RUsWGtCoJmI3pDvU91K7VNT+ulWUkE aLpJVo67vnyaeCv+0syLtFUCu9TvrIOocjg893E8pRBsX+itGJcmp+gQzilqaQ== 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=1696312481; 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=3O1zRrWIui8ZwFTyZ1J0uq2xP4RiU5wLnhO2lbCq2pQ=; b=KIePQr8VUJRJQUOJq9HCiwJ7EYRcmuGUb0Qxj/MsHaS5DN2hNA521Nx8mr5oZBIaIjX/1O XIE+F94oPLk6e3qKuGuKPQLEptW2wT1HAxav7zZ1Sfhq9gbGECcGWJSzYzAjZ2P2PChpJc V5Pv8hyocz1tgiLB9r/+Hojm9kI9nFqjfyV2kd2Vu/BMjPPskH6JlInYuZkJTsqOVdFr0Z HhOVRsAS9AYx3bC6AUdo6H+JnJ9Tjj1hDiW9dY+07aELneJntTIA9lgTBPS0zmiYVuKG1X EJyYF4xG11KfSi/EUDP1wmfqS2npybNTzDbMbXVSTHRrO2neQwNIpHzzwoTnVA== 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 4S06Tr6tvxzjph; Tue, 3 Oct 2023 05:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3935seEq034737; Tue, 3 Oct 2023 05:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3935seMn034734; Tue, 3 Oct 2023 05:54:40 GMT (envelope-from git) Date: Tue, 3 Oct 2023 05:54:40 GMT Message-Id: <202310030554.3935seMn034734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 09f5c1e118bb - main - libfetch: don't rely on ca_root_nss for certificate validation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09f5c1e118bb4eca77b83a0d08f559b20f60aa59 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=09f5c1e118bb4eca77b83a0d08f559b20f60aa59 commit 09f5c1e118bb4eca77b83a0d08f559b20f60aa59 Author: Michael Osipov AuthorDate: 2023-10-03 05:53:20 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-03 05:53:20 +0000 libfetch: don't rely on ca_root_nss for certificate validation Before certctl(8), there was no system trust store, and libfetch relied on the CA certificate bundle from the ca_root_nss port to verify peers. We now have a system trust store and a reliable mechanism for manipulating it (to explicitly add, remove, or revoke certificates), but if ca_root_nss is installed, libfetch will still prefer that to the system trust store. With this change, unless explicitly overridden, libfetch will rely on OpenSSL to pick up the default system trust store. PR: 256902 MFC after: 3 days Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D42059 --- lib/libfetch/common.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index fd2091791620..dfa742577585 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -1055,8 +1055,6 @@ fetch_ssl_setup_transport_layer(SSL_CTX *ctx, int verbose) /* * Configure peer verification based on environment. */ -#define LOCAL_CERT_FILE _PATH_LOCALBASE "/etc/ssl/cert.pem" -#define BASE_CERT_FILE "/etc/ssl/cert.pem" static int fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) { @@ -1066,12 +1064,6 @@ fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) if (getenv("SSL_NO_VERIFY_PEER") == NULL) { ca_cert_file = getenv("SSL_CA_CERT_FILE"); - if (ca_cert_file == NULL && - access(LOCAL_CERT_FILE, R_OK) == 0) - ca_cert_file = LOCAL_CERT_FILE; - if (ca_cert_file == NULL && - access(BASE_CERT_FILE, R_OK) == 0) - ca_cert_file = BASE_CERT_FILE; ca_cert_path = getenv("SSL_CA_CERT_PATH"); if (verbose) { fetch_info("Peer verification enabled"); From nobody Tue Oct 3 07:38:54 2023 X-Original-To: dev-commits-src-main@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 4S08p64gNbz4vvW6; Tue, 3 Oct 2023 07:38:54 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S08p63rvPz3PBk; Tue, 3 Oct 2023 07:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696318734; 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=IDC5yy9MxPsxExLF7NBX+KWeaVkzfKBgIa4sQoL3QZE=; b=aCfYNKvmYLulsM8IOxdtfPq2ir2jhjqn0Y3w57zi3r9OMqZx7Lm8UjpCCf0vvY5BjiHl6t eHkMyVhmK/G0Bbf+TnxCYW5mRD/DkvTaAHcuu5JdS/j7DXeiQOUH6nKE4RqN2TouaKwmtl AKU+XsxZKio1VZxsYTxrjo4n4JwQ3huZhpOXm2SHxtbnXtnRe9b1Q38EcgNR9kUwJV6S6X 4FrxUBkoc1jtlwXq++nLcPkKT/dBu5tbjIDEmDoJmmhC8j7zIX9K36968GvXdu4PGNsPGL 2z4rM8neCpRONwSsEPwBDYAU8RksGWAYKD4AqrcoZJzGoSShjBlla7j6gDOkxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696318734; a=rsa-sha256; cv=none; b=cyctNObSoSKH6zV2KAKh5NZKsKdDs41AhK3dUMk2R5mxS60yi+Rtf2Tto3EKEyXH3oL/pH FVJRRoAzI+qjzzGOgk8xyOkFyO6F/0Pwmff6kkdics669QgIdWKKEjUxHEOKlH43SkeJsa IZzAFffk1C5mYRWqAM9KX/cL8cHNDgjOUhIH+cP2CPvCdUOnsqTgUbC7ISDhINj1SXn3xQ Aeb2GCF4sBkM8Olkq5FazfVgzhHBt4AzvQqFsr8oBJkU18AOnB8BUPpR31YsBcZrLjHGiF qOv+PQc2MVjCHQltQX3xFANelxpwvjfrtaO4M1ME5zrdtvXGLFJ9YUuAbZZVyQ== 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=1696318734; 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=IDC5yy9MxPsxExLF7NBX+KWeaVkzfKBgIa4sQoL3QZE=; b=CfFOie10YsgcMAOsryFCPB6YIHMmJMLUcECUcc8/wUcvxQTkPKoc8pjHUvZ327JNoK82gb JEhCx39IBwm3/Kv0HigUm+cSHby7H97yg/EFDw2N5Fj2CHvnVtZ3iMCIrB1kCRDpwq+vZP jSEK9m1+VwTDb8HezRvNs9vqbuAopggS1JVVyf3A3hrMGL+3NkAofhu22FmmyE/udlcU7b Eupl/dkhw+VEy2pZN3uJsI4bMEH7d1oSBL0Y6gTrA5bhfdqJJAQWeAqXRDwFIqJG8P8j+q saIS+lZrNONCbnMNlV3JE6oH0mtySPosGHzubSN887MFCJI/T1dtcGdRv8d++Q== 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 4S08p62vnXzmK3; Tue, 3 Oct 2023 07:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937cs2i002221; Tue, 3 Oct 2023 07:38:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937csCA002218; Tue, 3 Oct 2023 07:38:54 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:38:54 GMT Message-Id: <202310030738.3937csCA002218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: b67c0ba46138 - main - tests: Test that SIGSYS is not delivered if kern.signosys knob is off List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b67c0ba4613861f8245ce835081311aef1c19bae Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b67c0ba4613861f8245ce835081311aef1c19bae commit b67c0ba4613861f8245ce835081311aef1c19bae Author: Dmitry Chagin AuthorDate: 2023-10-03 07:38:02 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-03 07:38:02 +0000 tests: Test that SIGSYS is not delivered if kern.signosys knob is off Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D41979 MFC after: 1 week --- tests/sys/kern/Makefile | 1 + tests/sys/kern/sigsys.c | 101 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 88 insertions(+), 14 deletions(-) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index 6396b22005c3..e449d9deeed1 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -49,6 +49,7 @@ ATF_TESTS_C+= unix_socketpair_test ATF_TESTS_C+= waitpid_nohang ATF_TESTS_C+= pdeathsig ATF_TESTS_C+= sigsys +TEST_METADATA.sigsys+= is_exclusive="true" ATF_TESTS_SH+= coredump_phnum_test ATF_TESTS_SH+= sonewconn_overflow diff --git a/tests/sys/kern/sigsys.c b/tests/sys/kern/sigsys.c index 75e3816fc158..8554a646ebc6 100644 --- a/tests/sys/kern/sigsys.c +++ b/tests/sys/kern/sigsys.c @@ -7,31 +7,29 @@ * under sponsorship from the FreeBSD Foundation. */ +#include #include +#include #include #include #include #include #include +#include static sig_atomic_t sigsys_cnt; +#define SAVEDVALUE "savedsignosys" + static void sigsys_handler(int signo, siginfo_t *si, void *ucp) { sigsys_cnt++; } -ATF_TC(sigsys_test); - -ATF_TC_HEAD(sigsys_test, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Testing delivery of SIGSYS on invalid syscalls"); -} - -ATF_TC_BODY(sigsys_test, tc) +static void +sigsys_test(int knob) { struct sigaction sa; @@ -43,27 +41,102 @@ ATF_TC_BODY(sigsys_test, tc) ATF_REQUIRE(syscall(273) == -1); /* reserved */ ATF_CHECK_ERRNO(ENOSYS, true); atomic_signal_fence(memory_order_seq_cst); - ATF_CHECK_EQ(1, sigsys_cnt); + ATF_CHECK_EQ(1 * knob, sigsys_cnt * knob); ATF_REQUIRE(syscall(440) == -1); /* SYS_kse_switchin */ ATF_CHECK_ERRNO(ENOSYS, true); atomic_signal_fence(memory_order_seq_cst); - ATF_CHECK_EQ(2, sigsys_cnt); + ATF_CHECK_EQ(2 * knob, sigsys_cnt * knob); /* Hope this is enough for say next two months */ ATF_REQUIRE(syscall(3000000) == -1); ATF_CHECK_ERRNO(ENOSYS, true); atomic_signal_fence(memory_order_seq_cst); - ATF_CHECK_EQ(3, sigsys_cnt); + ATF_CHECK_EQ(3 * knob, sigsys_cnt * knob); ATF_REQUIRE(syscall(SYS_afs3_syscall) == -1); ATF_CHECK_ERRNO(ENOSYS, true); atomic_signal_fence(memory_order_seq_cst); - ATF_CHECK_EQ(4, sigsys_cnt); + ATF_CHECK_EQ(4 * knob, sigsys_cnt * knob); +} + +static void +sysctlset(const char *name, int val) +{ + size_t oldlen; + int oldval; + char buf[80]; + + ATF_REQUIRE(sysctlbyname(name, &oldval, &oldlen, NULL, 0) == 0); + + /* Store old %name in a symlink for cleanup */ + snprintf(buf, sizeof(buf), "%d", oldval); + ATF_REQUIRE(symlink(buf, SAVEDVALUE) == 0); + + ATF_REQUIRE(sysctlbyname(name, NULL, NULL, &val, sizeof(val)) == 0); +} + +static void +sysctlcleanup(const char *name) +{ + size_t oldlen; + int n, oldval; + char buf[80]; + + if ((n = readlink(SAVEDVALUE, buf, sizeof(buf))) > 0) { + buf[MIN((size_t)n, sizeof(buf) - 1)] = '\0'; + if (sscanf(buf, "%d", &oldval) == 1) { + oldlen = sizeof(oldval); + (void)sysctlbyname(name, NULL, 0, + &oldval, oldlen); + } + } + (void)unlink(SAVEDVALUE); +} + +ATF_TC_WITH_CLEANUP(sigsys_test_on); +ATF_TC_HEAD(sigsys_test_on, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "descr", + "Testing delivery of SIGSYS on invalid syscalls"); +} + +ATF_TC_BODY(sigsys_test_on, tc) +{ + sysctlset("kern.signosys", 1); + sigsys_test(1); +} + +ATF_TC_CLEANUP(sigsys_test_on, tc) +{ + sysctlcleanup("kern.signosys"); +} + +ATF_TC_WITH_CLEANUP(sigsys_test_off); +ATF_TC_HEAD(sigsys_test_off, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "descr", + "Testing SIGSYS silence on invalid syscalls"); +} + +ATF_TC_BODY(sigsys_test_off, tc) +{ + sysctlset("kern.signosys", 0); + sigsys_test(0); +} + +ATF_TC_CLEANUP(sigsys_test_off, tc) +{ + sysctlcleanup("kern.signosys"); } ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, sigsys_test); + ATF_TP_ADD_TC(tp, sigsys_test_on); + ATF_TP_ADD_TC(tp, sigsys_test_off); return (atf_no_error()); } From nobody Tue Oct 3 07:38:55 2023 X-Original-To: dev-commits-src-main@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 4S08p75lycz4vvSr; Tue, 3 Oct 2023 07:38:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S08p74qSFz3Nwp; Tue, 3 Oct 2023 07:38:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696318735; 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=ObficpXzDNnfAfq/Kdhs/q7gO2zT44OxzHOaYvbuGIU=; b=b72zmZ/QFFQBiijYWSzJlNLuVJIbV3UM17cpraJs+bcNKCB2CbTD7hnViSfwOCI429RzeQ InRydZTX9BVxUYeS5J/WZ6kG3fsvQ7NzQTuseq6dceAyO7R5UeLBwrbD9MYB4mEOfR4EFK AclXlOBmQhC0WB/ls29jgV2899q9lv2Vsandvv3BEOQv7jDMcA8FarVXsMIR0lijw1SL5i frVgV4ubK/dEd3scWBtxM57gxCSz49CjYWN5L7gTBjUOZRKVqDBbmS/3EzHYnY31odu4wa l5FjNlilX7afZwVLhxuccsRouzuabtQNTd5LSoZFHVnc9orM7E6zctgPa2dkyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696318735; a=rsa-sha256; cv=none; b=Ztgiy2YeQOqgVVzws6zEa9TzoGvUAXy2dCiL/wPhXyi9UMDKhDsbqhT4E4LivPVfyK5v5n D+9NWMj+XI1BWnK4xKK/sfbuuBGRW/QyabJe6USmX2JqL97p0R9d1u9Jr/FcW3+TjHRSQn kGomnlpPUitfOm5B0Zlv6S2dJ41bvSus04WJlgafR5wJzd6CPfQSNFDVAsgvw7I/Zbkjob 4k3QHgk1to7dfA2oS6D95lygnQPTo1kPwbe3CcgM7VoeA0BiNyavWv+5FackJoskPRT8QP NKR8k7UUd5FmvQJq8xWWivy3BE6zggei40fTTUKQT0xwEGIJfmTCxYb8Iy1Rug== 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=1696318735; 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=ObficpXzDNnfAfq/Kdhs/q7gO2zT44OxzHOaYvbuGIU=; b=rhNNzTo9b+Qhe+WGZTfwfSY6xbaL53rtrTGI6cx3RMnAQGG53DWmBHaJDJKVgGlrFVPDLN DkOaHuGghp4f+g9ox/zRO3EvEkB8uzdkppLMJAZbOCaJRcbf/N+nVegoIQj2UI1Wk9+bjY Zhk3FvFsQ555NIGsQPyBh/BYqrKtGdb6H9tT2thN5MsOMPdnYAQvj28ddR4RU4uYscB03D R27UOhs02dfsbZkSwQhliOs45uv3+m744WuL9db8YiMNSiYkYvnrPTbwJozxnazJhmrl5S uvsWZrtE1bSA4j0qxo9zvgBrGgyicjl3kMeBEXUryinPzrj8FBf+TNlwH/JmaQ== 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 4S08p73vf3zmXP; Tue, 3 Oct 2023 07:38:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937ctie002263; Tue, 3 Oct 2023 07:38:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937ctgh002260; Tue, 3 Oct 2023 07:38:55 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:38:55 GMT Message-Id: <202310030738.3937ctgh002260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 8e523be5a5a2 - main - linux(4): Deorbit linux_nosys from syscalls.master List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e523be5a5a2cb9660021d2de5732ee7257b2788 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8e523be5a5a2cb9660021d2de5732ee7257b2788 commit 8e523be5a5a2cb9660021d2de5732ee7257b2788 Author: Dmitry Chagin AuthorDate: 2023-10-03 07:38:02 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-03 07:38:02 +0000 linux(4): Deorbit linux_nosys from syscalls.master Differential Revision: https://reviews.freebsd.org/D41902 MFC after: 1 week --- sys/amd64/linux/syscalls.master | 7 +------ sys/amd64/linux32/syscalls.master | 7 +------ sys/arm64/linux/syscalls.master | 7 +------ sys/i386/linux/syscalls.master | 7 +------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master index 437066d1655b..8e12a539b87f 100644 --- a/sys/amd64/linux/syscalls.master +++ b/sys/amd64/linux/syscalls.master @@ -32,13 +32,9 @@ #include #include #include -#include #include #include -; Isn't pretty, but there seems to be no other way to trap nosys -#define nosys linux_nosys - 0 AUE_NULL NOPROTO { int read( int fd, @@ -2191,6 +2187,5 @@ 453 AUE_NULL STD { int linux_map_shadow_stack(void); } -; please, keep this line at the end. -454 AUE_NULL UNIMPL nosys + ; vim: syntax=off diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 32ed678fe0c6..7d796df1aed3 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -32,14 +32,10 @@ #include #include #include -#include #include #include #include -; Isn't pretty, but there seems to be no other way to trap nosys -#define nosys linux_nosys - 0 AUE_NULL UNIMPL setup 1 AUE_EXIT STD { void linux_exit( @@ -2616,6 +2612,5 @@ 452 AUE_NULL STD { int linux_fchmodat2(void); } - ; please, keep this line at the end. -453 AUE_NULL UNIMPL nosys + ; vim: syntax=off diff --git a/sys/arm64/linux/syscalls.master b/sys/arm64/linux/syscalls.master index 9ba548359c46..61c7499d57b3 100644 --- a/sys/arm64/linux/syscalls.master +++ b/sys/arm64/linux/syscalls.master @@ -9,13 +9,9 @@ #include #include #include -#include #include #include -; Isn't pretty, but there seems to be no other way to trap nosys -#define nosys linux_nosys - 0 AUE_NULL UNIMPL linux_io_setup 1 AUE_NULL UNIMPL linux_io_destroy 2 AUE_NULL UNIMPL linux_io_submit @@ -1865,6 +1861,5 @@ 452 AUE_NULL STD { int linux_fchmodat2(void); } - ; please, keep this line at the end. -453 AUE_NULL UNIMPL nosys + ; vim: syntax=off diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 3f37cc2fc485..e3c39e50986c 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -32,13 +32,9 @@ #include #include #include -#include #include #include -; Isn't pretty, but there seems to be no other way to trap nosys -#define nosys linux_nosys - 0 AUE_NULL UNIMPL setup 1 AUE_EXIT STD { void linux_exit( @@ -2628,6 +2624,5 @@ 452 AUE_NULL STD { int linux_fchmodat2(void); } - ; please, keep this line at the end. -453 AUE_NULL UNIMPL nosys + ; vim: syntax=off From nobody Tue Oct 3 07:38:56 2023 X-Original-To: dev-commits-src-main@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 4S08p86prFz4vv6R; Tue, 3 Oct 2023 07:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S08p85bybz3P2g; Tue, 3 Oct 2023 07:38:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696318736; 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=LciQtq1AiTHAg3ApIOxx048B2zXPUb2WyJGwEXB4Z5Q=; b=q2UEeWF/Derwbsgn4TMPRd8pm2sW38m8ZzJSJ30THrKdA2C8ZVI1pSVbVyVY6pKPYHrRJM xHz2YCqSYAaHHbDliwdH799lo+NEQDbPNLqsIA29D9bNTlfFAQBsKL3eepoaNeuxmsGZ8y 3+qoevk8Kjr0HnD8CueRvvqwZesXhDDHE3vO9NQQyEBpA78pF4PxLAYUSAgdfdLWQZdBBO D7dyHXI8FqacfW8OMNLahJQhtPi7AdaUgDKIpo9+n5AI/DVn6U4FP2hjXgC3/Lp6nhYKIq kFZKsHQsaHqxmMl+eIvKuAOLU9kOYvnRzZLxq3+8oUle2Ei9Y7/fR6qHHa4h5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696318736; a=rsa-sha256; cv=none; b=fEDXT/gFse65v5P4Sv5gNxT7dW7PRzq+x81fyj6F9vbXkyEBXpLO5HSIpUEtuoxtymnm7y u3ZrSPtkJAezTDgm9Iz/Vl5ePpP0voTwbi0CgliHVwv4ihNvB/0zf9StZjiwpf2/gafi+V BhBSnQUFViUwz7AVD+W4mzEnY0SEBLvRW/L/XL/koj+uHnZL+qA4WhALxNIcZnHii+EYVa NnNICbEq4cgUeGqETWARKF1HhCeOXC88/51DcMu4H8DidOaNrpw4pJyPIUetmkZrNGzhme VRI8UdS02MkwnFlsdqHpwMx8+8Ycsaqmx8ciWbu+fFD5ECUwxB7Ts+AQpUsNNQ== 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=1696318736; 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=LciQtq1AiTHAg3ApIOxx048B2zXPUb2WyJGwEXB4Z5Q=; b=wtOk30k1WaBE15G9vjqnFb3mPE7w4bj/G6dgNhINc7s0zGP2rkX61/XQ9auMhzJSOPJemO 3iMdHpCGMMhmIMTWGRUvO8j0Dm/oBr9W1+/z2G8M83xXEO6GTVgO7d/FXiakhUR6XphleE fCLDOlFFjaMiaGr2a1adphUCEmA99mEISIkrbp6EGDsQwYfzqyg3gpNnFglakkU5IPRFFI N7mhElERHqTNsaJtxc4VLq1fOTuC8V60f23qU5vZeRRYulX3PQF1gVZXeQ50eoNQptQOyi /XXS3cEy0DmpbOQZRQsmaNQTmmMGskPN3JyQt8pgXsdFp8VlACHuQNS7Qkxw5A== 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 4S08p84gdNzmM9; Tue, 3 Oct 2023 07:38:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937cu1c002306; Tue, 3 Oct 2023 07:38:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937cu20002303; Tue, 3 Oct 2023 07:38:56 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:38:56 GMT Message-Id: <202310030738.3937cu20002303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 99abee8b7be2 - main - linux(4): Regen for linux_nosys change List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99abee8b7be2d19be583b942b470f7af11d32ddc Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=99abee8b7be2d19be583b942b470f7af11d32ddc commit 99abee8b7be2d19be583b942b470f7af11d32ddc Author: Dmitry Chagin AuthorDate: 2023-10-03 07:38:03 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-03 07:38:03 +0000 linux(4): Regen for linux_nosys change MFC after: 1 week --- sys/amd64/linux/linux_proto.h | 2 -- sys/amd64/linux/linux_syscall.h | 2 +- sys/amd64/linux/linux_syscalls.c | 2 -- sys/amd64/linux/linux_sysent.c | 3 --- sys/amd64/linux/linux_systrace_args.c | 3 --- sys/amd64/linux32/linux32_proto.h | 2 -- sys/amd64/linux32/linux32_syscall.h | 2 +- sys/amd64/linux32/linux32_syscalls.c | 2 -- sys/amd64/linux32/linux32_sysent.c | 3 --- sys/amd64/linux32/linux32_systrace_args.c | 3 --- sys/arm64/linux/linux_proto.h | 2 -- sys/arm64/linux/linux_syscall.h | 2 +- sys/arm64/linux/linux_syscalls.c | 2 -- sys/arm64/linux/linux_sysent.c | 3 --- sys/arm64/linux/linux_systrace_args.c | 3 --- sys/i386/linux/linux_proto.h | 2 -- sys/i386/linux/linux_syscall.h | 2 +- sys/i386/linux/linux_syscalls.c | 2 -- sys/i386/linux/linux_sysent.c | 3 --- sys/i386/linux/linux_systrace_args.c | 3 --- 20 files changed, 4 insertions(+), 44 deletions(-) diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h index 0759ce282499..e02e1e9e64eb 100644 --- a/sys/amd64/linux/linux_proto.h +++ b/sys/amd64/linux/linux_proto.h @@ -33,7 +33,6 @@ struct thread; #define PADR_(t) 0 #endif -#define nosys linux_nosys struct linux_write_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; @@ -1438,7 +1437,6 @@ struct linux_fchmodat2_args { struct linux_map_shadow_stack_args { syscallarg_t dummy; }; -#define nosys linux_nosys int linux_write(struct thread *, struct linux_write_args *); int linux_open(struct thread *, struct linux_open_args *); int linux_newstat(struct thread *, struct linux_newstat_args *); diff --git a/sys/amd64/linux/linux_syscall.h b/sys/amd64/linux/linux_syscall.h index efd3413f91ce..3f1198399416 100644 --- a/sys/amd64/linux/linux_syscall.h +++ b/sys/amd64/linux/linux_syscall.h @@ -354,4 +354,4 @@ #define LINUX_SYS_linux_cachestat 451 #define LINUX_SYS_linux_fchmodat2 452 #define LINUX_SYS_linux_map_shadow_stack 453 -#define LINUX_SYS_MAXSYSCALL 455 +#define LINUX_SYS_MAXSYSCALL 454 diff --git a/sys/amd64/linux/linux_syscalls.c b/sys/amd64/linux/linux_syscalls.c index 6851612ec749..eeec76f3f3b9 100644 --- a/sys/amd64/linux/linux_syscalls.c +++ b/sys/amd64/linux/linux_syscalls.c @@ -5,7 +5,6 @@ */ const char *linux_syscallnames[] = { -#define nosys linux_nosys "read", /* 0 = read */ "linux_write", /* 1 = linux_write */ "linux_open", /* 2 = linux_open */ @@ -460,5 +459,4 @@ const char *linux_syscallnames[] = { "linux_cachestat", /* 451 = linux_cachestat */ "linux_fchmodat2", /* 452 = linux_fchmodat2 */ "linux_map_shadow_stack", /* 453 = linux_map_shadow_stack */ - "#454", /* 454 = nosys */ }; diff --git a/sys/amd64/linux/linux_sysent.c b/sys/amd64/linux/linux_sysent.c index ecb4ebb85b3a..e5a0ff377de5 100644 --- a/sys/amd64/linux/linux_sysent.c +++ b/sys/amd64/linux/linux_sysent.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -15,7 +14,6 @@ /* The casts are bogus but will do for now. */ struct sysent linux_sysent[] = { -#define nosys linux_nosys { .sy_narg = AS(read_args), .sy_call = (sy_call_t *)sys_read, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 0 = read */ { .sy_narg = AS(linux_write_args), .sy_call = (sy_call_t *)linux_write, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 1 = linux_write */ { .sy_narg = AS(linux_open_args), .sy_call = (sy_call_t *)linux_open, .sy_auevent = AUE_OPEN_RWTC, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 2 = linux_open */ @@ -470,5 +468,4 @@ struct sysent linux_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_cachestat, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 451 = linux_cachestat */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fchmodat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 452 = linux_fchmodat2 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_map_shadow_stack, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 453 = linux_map_shadow_stack */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 454 = nosys */ }; diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c index 2b0cf1df7e40..8a350eeda6c0 100644 --- a/sys/amd64/linux/linux_systrace_args.c +++ b/sys/amd64/linux/linux_systrace_args.c @@ -11,7 +11,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) int64_t *iarg = (int64_t *)uarg; int a = 0; switch (sysnum) { -#define nosys linux_nosys /* read */ case 0: { struct read_args *p = params; @@ -2816,7 +2815,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* read */ case 0: switch (ndx) { @@ -7280,7 +7278,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* read */ case 0: if (ndx == 0 || ndx == 1) diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index ae52fb81c560..8da298847a43 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -33,7 +33,6 @@ struct thread; #define PADR_(t) 0 #endif -#define nosys linux_nosys struct linux_exit_args { char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)]; }; @@ -1736,7 +1735,6 @@ struct linux_cachestat_args { struct linux_fchmodat2_args { syscallarg_t dummy; }; -#define nosys linux_nosys int linux_exit(struct thread *, struct linux_exit_args *); int linux_fork(struct thread *, struct linux_fork_args *); int linux_write(struct thread *, struct linux_write_args *); diff --git a/sys/amd64/linux32/linux32_syscall.h b/sys/amd64/linux32/linux32_syscall.h index b6d74578cdfd..c7a2e79842af 100644 --- a/sys/amd64/linux32/linux32_syscall.h +++ b/sys/amd64/linux32/linux32_syscall.h @@ -413,4 +413,4 @@ #define LINUX32_SYS_linux_set_mempolicy_home_node 450 #define LINUX32_SYS_linux_cachestat 451 #define LINUX32_SYS_linux_fchmodat2 452 -#define LINUX32_SYS_MAXSYSCALL 454 +#define LINUX32_SYS_MAXSYSCALL 453 diff --git a/sys/amd64/linux32/linux32_syscalls.c b/sys/amd64/linux32/linux32_syscalls.c index 3f1e0425e224..3308ffeb7712 100644 --- a/sys/amd64/linux32/linux32_syscalls.c +++ b/sys/amd64/linux32/linux32_syscalls.c @@ -5,7 +5,6 @@ */ const char *linux32_syscallnames[] = { -#define nosys linux_nosys "#0", /* 0 = setup */ "linux_exit", /* 1 = linux_exit */ "linux_fork", /* 2 = linux_fork */ @@ -459,5 +458,4 @@ const char *linux32_syscallnames[] = { "linux_set_mempolicy_home_node", /* 450 = linux_set_mempolicy_home_node */ "linux_cachestat", /* 451 = linux_cachestat */ "linux_fchmodat2", /* 452 = linux_fchmodat2 */ - "#453", /* 453 = nosys */ }; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index c1656a124026..024bca613c11 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -16,7 +15,6 @@ /* The casts are bogus but will do for now. */ struct sysent linux32_sysent[] = { -#define nosys linux_nosys { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 0 = setup */ { .sy_narg = AS(linux_exit_args), .sy_call = (sy_call_t *)linux_exit, .sy_auevent = AUE_EXIT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 1 = linux_exit */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fork, .sy_auevent = AUE_FORK, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 2 = linux_fork */ @@ -470,5 +468,4 @@ struct sysent linux32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_set_mempolicy_home_node, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 450 = linux_set_mempolicy_home_node */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_cachestat, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 451 = linux_cachestat */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fchmodat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 452 = linux_fchmodat2 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 453 = nosys */ }; diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 29940f4ed8a3..994f80b92d81 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -11,7 +11,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) int64_t *iarg = (int64_t *)uarg; int a = 0; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: { struct linux_exit_args *p = params; @@ -3325,7 +3324,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: switch (ndx) { @@ -8651,7 +8649,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: if (ndx == 0 || ndx == 1) diff --git a/sys/arm64/linux/linux_proto.h b/sys/arm64/linux/linux_proto.h index d002ad5a824f..c42de57d77c5 100644 --- a/sys/arm64/linux/linux_proto.h +++ b/sys/arm64/linux/linux_proto.h @@ -33,7 +33,6 @@ struct thread; #define PADR_(t) 0 #endif -#define nosys linux_nosys struct linux_setxattr_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; @@ -1245,7 +1244,6 @@ struct linux_cachestat_args { struct linux_fchmodat2_args { syscallarg_t dummy; }; -#define nosys linux_nosys int linux_setxattr(struct thread *, struct linux_setxattr_args *); int linux_lsetxattr(struct thread *, struct linux_lsetxattr_args *); int linux_fsetxattr(struct thread *, struct linux_fsetxattr_args *); diff --git a/sys/arm64/linux/linux_syscall.h b/sys/arm64/linux/linux_syscall.h index c45f3ded47a2..5ddc0608aff8 100644 --- a/sys/arm64/linux/linux_syscall.h +++ b/sys/arm64/linux/linux_syscall.h @@ -301,4 +301,4 @@ #define LINUX_SYS_linux_set_mempolicy_home_node 450 #define LINUX_SYS_linux_cachestat 451 #define LINUX_SYS_linux_fchmodat2 452 -#define LINUX_SYS_MAXSYSCALL 454 +#define LINUX_SYS_MAXSYSCALL 453 diff --git a/sys/arm64/linux/linux_syscalls.c b/sys/arm64/linux/linux_syscalls.c index 81fed4cc0227..c26519dc0a52 100644 --- a/sys/arm64/linux/linux_syscalls.c +++ b/sys/arm64/linux/linux_syscalls.c @@ -5,7 +5,6 @@ */ const char *linux_syscallnames[] = { -#define nosys linux_nosys "#0", /* 0 = linux_io_setup */ "#1", /* 1 = linux_io_destroy */ "#2", /* 2 = linux_io_submit */ @@ -459,5 +458,4 @@ const char *linux_syscallnames[] = { "linux_set_mempolicy_home_node", /* 450 = linux_set_mempolicy_home_node */ "linux_cachestat", /* 451 = linux_cachestat */ "linux_fchmodat2", /* 452 = linux_fchmodat2 */ - "#453", /* 453 = nosys */ }; diff --git a/sys/arm64/linux/linux_sysent.c b/sys/arm64/linux/linux_sysent.c index c0b495482040..ac93f9bb3a54 100644 --- a/sys/arm64/linux/linux_sysent.c +++ b/sys/arm64/linux/linux_sysent.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -15,7 +14,6 @@ /* The casts are bogus but will do for now. */ struct sysent linux_sysent[] = { -#define nosys linux_nosys { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 0 = linux_io_setup */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 1 = linux_io_destroy */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 2 = linux_io_submit */ @@ -469,5 +467,4 @@ struct sysent linux_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_set_mempolicy_home_node, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 450 = linux_set_mempolicy_home_node */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_cachestat, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 451 = linux_cachestat */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fchmodat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 452 = linux_fchmodat2 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 453 = nosys */ }; diff --git a/sys/arm64/linux/linux_systrace_args.c b/sys/arm64/linux/linux_systrace_args.c index ff58a287ee88..151d46238d1c 100644 --- a/sys/arm64/linux/linux_systrace_args.c +++ b/sys/arm64/linux/linux_systrace_args.c @@ -11,7 +11,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) int64_t *iarg = (int64_t *)uarg; int a = 0; switch (sysnum) { -#define nosys linux_nosys /* linux_setxattr */ case 5: { struct linux_setxattr_args *p = params; @@ -2433,7 +2432,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_setxattr */ case 5: switch (ndx) { @@ -6347,7 +6345,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_setxattr */ case 5: if (ndx == 0 || ndx == 1) diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 6cbab6b1e8d8..8109afec72e9 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -33,7 +33,6 @@ struct thread; #define PADR_(t) 0 #endif -#define nosys linux_nosys struct linux_exit_args { char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)]; }; @@ -1730,7 +1729,6 @@ struct linux_cachestat_args { struct linux_fchmodat2_args { syscallarg_t dummy; }; -#define nosys linux_nosys int linux_exit(struct thread *, struct linux_exit_args *); int linux_fork(struct thread *, struct linux_fork_args *); int linux_write(struct thread *, struct linux_write_args *); diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h index 19b1714fb5d9..d82006b89847 100644 --- a/sys/i386/linux/linux_syscall.h +++ b/sys/i386/linux/linux_syscall.h @@ -419,4 +419,4 @@ #define LINUX_SYS_linux_set_mempolicy_home_node 450 #define LINUX_SYS_linux_cachestat 451 #define LINUX_SYS_linux_fchmodat2 452 -#define LINUX_SYS_MAXSYSCALL 454 +#define LINUX_SYS_MAXSYSCALL 453 diff --git a/sys/i386/linux/linux_syscalls.c b/sys/i386/linux/linux_syscalls.c index 112e6505bd00..88f362661ae2 100644 --- a/sys/i386/linux/linux_syscalls.c +++ b/sys/i386/linux/linux_syscalls.c @@ -5,7 +5,6 @@ */ const char *linux_syscallnames[] = { -#define nosys linux_nosys "#0", /* 0 = setup */ "linux_exit", /* 1 = linux_exit */ "linux_fork", /* 2 = linux_fork */ @@ -459,5 +458,4 @@ const char *linux_syscallnames[] = { "linux_set_mempolicy_home_node", /* 450 = linux_set_mempolicy_home_node */ "linux_cachestat", /* 451 = linux_cachestat */ "linux_fchmodat2", /* 452 = linux_fchmodat2 */ - "#453", /* 453 = nosys */ }; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 5aa7f4921774..dbba4dec3a8c 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -15,7 +14,6 @@ /* The casts are bogus but will do for now. */ struct sysent linux_sysent[] = { -#define nosys linux_nosys { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 0 = setup */ { .sy_narg = AS(linux_exit_args), .sy_call = (sy_call_t *)linux_exit, .sy_auevent = AUE_EXIT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 1 = linux_exit */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fork, .sy_auevent = AUE_FORK, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 2 = linux_fork */ @@ -469,5 +467,4 @@ struct sysent linux_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_set_mempolicy_home_node, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 450 = linux_set_mempolicy_home_node */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_cachestat, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 451 = linux_cachestat */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fchmodat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 452 = linux_fchmodat2 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 453 = nosys */ }; diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index 76781af18124..70036d227707 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -11,7 +11,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) int64_t *iarg = (int64_t *)uarg; int a = 0; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: { struct linux_exit_args *p = params; @@ -3356,7 +3355,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: switch (ndx) { @@ -8707,7 +8705,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: if (ndx == 0 || ndx == 1) From nobody Tue Oct 3 07:38:57 2023 X-Original-To: dev-commits-src-main@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 4S08pB0cWxz4vvSx; Tue, 3 Oct 2023 07:38:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S08p96Z1rz3PHH; Tue, 3 Oct 2023 07:38:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696318737; 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=lblZeyktA0LG2NQE3SNZsea1OeNI4IBBkzVQH+ImEdY=; b=mk/l1S9ogy1jeKEdZF1+A/vFVde+c8fU3lZ3UMxBTh77pmxelhJZn7P3QKYJF87a99U6iN G4gEmJX7+Dtif8dzfFwXZMfaAgTwiKBW2rE9n4POX6OSixOgomK9UghZ0lTU9rEdzpQylf 6YDuGpLwTek8WpycNi4hNjvYiV+HYeEafiwAJHWBdHqIHjkSHVv6J2wGi3tSUf5aAEr8zC XR0B/xmqs+eqt6uyX4XILBzlsyNlhc4jXauv82aUsNif2xbIq3czh8q0i7xji7vkfuRrVb CHL6RNoCXTQpO40SkaWIS25dneL+wV+F/GZnfriQxfA3mjOEWJ4KUIGwNhAXkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696318737; a=rsa-sha256; cv=none; b=Mx9Upv/H+MJCMEiOqE0yK0lcdWTtNcYO2h6AFrTfemosg1GVBn0yy9SAlCgENVxlx9P1sU 3miueXxf0zfxs9VxgrS15puHqlC2L2n3Tmue+z1N+NzK6Nymu5FFaiAf0kynzkVs0zvzU7 DkjufPYU9zqzyc3Z2PfjJrySlG2OrPMVLWVxpLCLv2BK9NCvARb4HXMw4f9R52u1MNj+gK ec8/ZzGNeoz+8Kq2fUBdIaD+xoxB7WOBzMFftllhORgfYhvlEDyYd3a1DXbOV3iDMkDRPG OVcJQsoW06PnI3aQ2qk3qu/PeCGOyd7qTUDrqKCGIgrlfRSxTSqc1LIL6YFsEg== 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=1696318737; 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=lblZeyktA0LG2NQE3SNZsea1OeNI4IBBkzVQH+ImEdY=; b=TwFVG2ID7AETA2l7Ta0xA3YiK8gURQyRbXcfHQ+goK7TBoK5YG/vRG0qLml6jGkCTUOt73 ym7jQ2QEcLlkk9IS0vyDjZTIThEkNYsP+Fj5TngrsRqZ4JHwOUBHDSpPT60Xbts7fd8Oz0 yUXytU602oQ+Vge4n8r85riOfg/N0ox+/IzsukcyXcXoY3RJK4sGqW3+icN6ewPxZlC41D UV6t4ARqu4JgEapmvoCD+2BJ8GSV00y0Kzzgh3xt1BuR5dkccjkev0133l3gIGGrtT32bX QaA0C9R/VQubLoihrS8wL0Uwx5IfOfoMmjC2V3Pk8bMxY1G3wESO6UzcnqBl0Q== 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 4S08p95fYRzmMB; Tue, 3 Oct 2023 07:38:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937cvAQ002343; Tue, 3 Oct 2023 07:38:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937cv76002340; Tue, 3 Oct 2023 07:38:57 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:38:57 GMT Message-Id: <202310030738.3937cv76002340@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 199e397e9bf1 - main - linux(4): Deorbit linux_nosys List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 199e397e9bf1076ae905e2742ef8e294870f5b27 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=199e397e9bf1076ae905e2742ef8e294870f5b27 commit 199e397e9bf1076ae905e2742ef8e294870f5b27 Author: Dmitry Chagin AuthorDate: 2023-10-03 07:38:03 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-03 07:38:03 +0000 linux(4): Deorbit linux_nosys Differential Revision: https://reviews.freebsd.org/D41901 MFC after: 1 week --- sys/amd64/linux/linux_sysvec.c | 1 - sys/compat/linux/linux_misc.c | 8 -------- sys/compat/linux/linux_sysproto.h | 36 ------------------------------------ 3 files changed, 45 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 98e2a01b98db..757986f94ae1 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -65,7 +65,6 @@ #include #include #include -#include #include #include diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index cb781f3bad75..b87c05322e16 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -79,7 +79,6 @@ #include #include #include -#include #include #include @@ -1506,13 +1505,6 @@ linux_getsid(struct thread *td, struct linux_getsid_args *args) return (kern_getsid(td, args->pid)); } -int -linux_nosys(struct thread *td, struct nosys_args *ignore) -{ - - return (ENOSYS); -} - int linux_getpriority(struct thread *td, struct linux_getpriority_args *args) { diff --git a/sys/compat/linux/linux_sysproto.h b/sys/compat/linux/linux_sysproto.h index 7ad9e2068d7f..e69de29bb2d1 100644 --- a/sys/compat/linux/linux_sysproto.h +++ b/sys/compat/linux/linux_sysproto.h @@ -1,36 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2005 Travis Poppe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef LINUX_SYSPROTO -#define LINUX_SYSPROTO - -int linux_nosys(struct thread *, struct nosys_args *); - -#endif From nobody Tue Oct 3 07:38:58 2023 X-Original-To: dev-commits-src-main@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 4S08pC1Kcwz4vvCP; Tue, 3 Oct 2023 07:38:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S08pC0d3hz3PXK; Tue, 3 Oct 2023 07:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696318739; 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=bO9LkNutaNLsF48d47LfqZGX3Gj55dG7ZZrvjkQ6AZ0=; b=vUjm9SKOJXKf6BukSMQnYJ4QbEjNRS6dbCudY/VgN8IRz5hIzGUbRF5Ah6ZInbNzX6mVj2 cGbptbQKXlzeLfqk3fiMxf+cWuBNrGWiGa667WCsDarmyr2pqCiGiK6cyL/ENtdjKafI0i JDyCbDYsFAFwLFMC38INGR/Q5G8DO3aS1fO8EOcqBwGEJE1W8Sz+RYbkNKNIJLv5cgx/eZ jwLc+m7jAgvK51zK3WdmI3d1hKiP7If/zdqY/OacF3AscoEgCHTuzfQNqnHvVeRUEdiYDk 2QLTQBxAOS21w0toJQAQqb9SQGnViYC+n8cD8PNTDQ0HJRRnrEBptWze9HdWIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696318739; a=rsa-sha256; cv=none; b=lmszBkchgRZ50/U/c5WcBuXptUigxZVWOCBscI9FP8qmryhTI5axmHhkDLMj3X9MKVjFlH lMT1vhPCKh5mdp038owcWQ25ki03Dl73HDTxwVJW+yPvFiWEflrk+kvnjalo1QP4YDOLgD 38906QQXMkOi2mFM790qbtRD6thCZs4HdnaiafI38xuBKeaHev8fOIbNSPTFi1o5hxaiku +6OaPJy6JbZdfI5QOvpM42JIP3P00TpkWpp7BUYyJCrtpR8xZWxphjhizo/l7gheHfLHqL JTK5BOFd36tyUSL8z1PTNXAy/NfTCco/mzjnfZO/3pg73lGWJcaMJ5wKL330ZA== 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=1696318739; 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=bO9LkNutaNLsF48d47LfqZGX3Gj55dG7ZZrvjkQ6AZ0=; b=yrgI1RfaRc+YTX6T62zqbfUZOlju5Ysal5H/QAj3CsTV4f5InOIsLuhF16GYI+VAwic7kE XQGzILoa4Dal3Pts8rOfBZ0FqecYmpUPo+xVZijYYfh33HsQgglNmFfqV9AzK7VLMJppz5 1hRfM1KhP5ByN0zOkAEdW+7/1s8ppcPrVojk/F1KR46c4LONEQII1FPxWAwMmzLxpd5SkP oMKrNxwtWMb+x3aenNLYlOoFcZ3zR0NmHerzOzhcUvlIJLzwfAANUpz0ms6S4cmiMt+xAI cgMNRI2RsHYruXhIsEDC7RPaoxKs8uCW8Jy4Zv6nF2M+F1LdTBESS86ZVfzNzw== 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 4S08pB6gjKzmd8; Tue, 3 Oct 2023 07:38:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937cwnH002383; Tue, 3 Oct 2023 07:38:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937cwBT002380; Tue, 3 Oct 2023 07:38:58 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:38:58 GMT Message-Id: <202310030738.3937cwBT002380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 7ec361d627fa - main - sysent: Trim trailing whitespaces List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ec361d627faeba2538fde88521d76e53a433359 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=7ec361d627faeba2538fde88521d76e53a433359 commit 7ec361d627faeba2538fde88521d76e53a433359 Author: Dmitry Chagin AuthorDate: 2023-10-03 07:38:03 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-03 07:38:03 +0000 sysent: Trim trailing whitespaces MFC after: 1 week --- sys/sys/sysent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 0166523ab84e..a23c338f9ce2 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -223,7 +223,7 @@ struct syscall_module_data { .sy_return = 0, \ .sy_flags = 0, \ .sy_thrcnt = 0 \ -} +} #define MAKE_SYSENT(syscallname) \ static struct sysent syscallname##_sysent = SYSENT_INIT_VALS(syscallname); From nobody Tue Oct 3 07:56:32 2023 X-Original-To: dev-commits-src-main@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 4S09BS6SQbz4vw7W; Tue, 3 Oct 2023 07:56:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09BS5Pt6z3S87; Tue, 3 Oct 2023 07:56:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319792; 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=hQs3/89pAIyU0KO00d6ro0P7/aC6laEpM58Em29NNv4=; b=S6biEb5aa1a1Sz/5h58NocLxI8Q7w+7Z9AfXnMd41cIerxcaEjNrf6gASr3J2LL9ln1spz dlALOAtx9wPwv5qwzFSOlcaL2YdPJE2dnvAN3Aclctsk99ftKje8SThnbaSXsXYU2kv3VN ikRREaO2GKMtIQQgUma3hoxGkIxk7J4aNbKOgfnY97Jn4Bg4kmyEkPf4p4Dnshi4Ad+xMM vhZ7Q5RXPkyNnzj2ZLvqI+BJIWkmsmp+p6H7iaxtH9V/pnEUVrF9rDSmIWc2Vd7i4lf/AY sLblYARtvqaDUgKeLGAxQj8nfNPCJoABDULkpJFPAO46Ln3WGdld/P1EZjokig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319792; a=rsa-sha256; cv=none; b=AL0ZROTry4eulPqDaek2lIhmbqRxCcOyIo/dUV0yqsRKYwfUWXOp7kIW1JBMsEK8HLzvGk c1OAAa7KlMPyATtMqvOMEc6Ezn5k9hSY2m+B+d4TJdJf5dRq71WLT5j2RPgg9p/kFtypG/ mc3Vpl3WLT//eP5yWEY2P7TEIhSdbnp3syPOJneqzUM0Uz9X+gqgcJCz0e5KGW45135WEH DXuaHdAW2rmmnZgzXGzwKdX/fgJp369mbRpki43fQNzfzS5cQIeiElZukPPWUrR+vijX9o 2z7/80AbPeqZkIE26MrGz/YBOn3npy8sazlO7S0mBwp2L0vr43Sugganp4yE0Q== 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=1696319792; 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=hQs3/89pAIyU0KO00d6ro0P7/aC6laEpM58Em29NNv4=; b=sZjNgKsGkuJWYffSKfVDQmgXVWEw4azETmDdGXaDaZv/meI9402+jKsO6RcwXwpmjjUuXW yVYaXjz7rT+6Mf5T73jDLeVz39vf1LeiWa37GPldN6ojodGFCRQAGWEcgWUykwQ43y1OmP M05HoSg6u+Q0zRB5TPr7N7yvmMsONp9xW3EczKeLzByXAa45g+bquEU7Rw03uESeIhx8gu ejhV58PLHEHGeMfvvgl/wJMRQPun50MfZ0F/ph01xyx29Repqdcirc2ZVfWO+PCJAZA9Gh /4H5VWf03KUUOk/jtvbwWQASWLB/08R8pJ6veSYr3DyTXlS1PbZr8szyIph/2Q== 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 4S09BS4Sr0zmfq; Tue, 3 Oct 2023 07:56:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937uWPX035461; Tue, 3 Oct 2023 07:56:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937uWwb035458; Tue, 3 Oct 2023 07:56:32 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:32 GMT Message-Id: <202310030756.3937uWwb035458@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 580d00f42fdd - main - iicbus: Move twsi under a new controller subdirectory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 580d00f42fdd94ce43583cc45fe3f1d9fdff47d4 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=580d00f42fdd94ce43583cc45fe3f1d9fdff47d4 commit 580d00f42fdd94ce43583cc45fe3f1d9fdff47d4 Author: Emmanuel Vadot AuthorDate: 2023-09-19 07:43:37 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:19 +0000 iicbus: Move twsi under a new controller subdirectory The folder is a mess so start moving stuff into sub-directories. Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41907 --- sys/arm/allwinner/files.allwinner | 2 +- sys/arm/mv/files.arm7 | 2 +- sys/conf/files.arm | 2 +- sys/conf/files.arm64 | 6 +++--- sys/dev/iicbus/{ => controller}/twsi/a10_twsi.c | 2 +- sys/dev/iicbus/{ => controller}/twsi/mv_twsi.c | 2 +- sys/dev/iicbus/{ => controller}/twsi/twsi.c | 2 +- sys/dev/iicbus/{ => controller}/twsi/twsi.h | 0 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/arm/allwinner/files.allwinner b/sys/arm/allwinner/files.allwinner index b5197809380d..cc609e50f2bd 100644 --- a/sys/arm/allwinner/files.allwinner +++ b/sys/arm/allwinner/files.allwinner @@ -22,7 +22,7 @@ arm/allwinner/axp81x.c optional axp81x arm/allwinner/if_awg.c optional awg syscon arm/allwinner/if_emac.c optional emac arm/allwinner/sunxi_dma_if.m optional a10_dmac | a31_dmac -dev/iicbus/twsi/a10_twsi.c optional twsi +dev/iicbus/controller/twsi/a10_twsi.c optional twsi dev/usb/controller/generic_ohci.c optional ohci dev/usb/controller/generic_usb_if.m optional ohci dev/usb/controller/generic_ehci.c optional ehci diff --git a/sys/arm/mv/files.arm7 b/sys/arm/mv/files.arm7 index 3eb18739532a..791046161151 100644 --- a/sys/arm/mv/files.arm7 +++ b/sys/arm/mv/files.arm7 @@ -22,7 +22,7 @@ arm/mv/rtc.c standard arm/mv/armadaxp/armadaxp_mp.c optional smp arm/mv/armadaxp/mptramp.S optional smp dev/cesa/cesa.c optional cesa -dev/iicbus/twsi/mv_twsi.c optional twsi +dev/iicbus/controller/twsi/mv_twsi.c optional twsi dev/mge/if_mge.c optional mge dev/neta/if_mvneta_fdt.c optional neta fdt dev/neta/if_mvneta.c optional neta mdio mii diff --git a/sys/conf/files.arm b/sys/conf/files.arm index 3dc48e20b168..344dada420c9 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -93,7 +93,7 @@ dev/fdt/fdt_arm_platform.c optional platform fdt dev/video/crtc_if.m optional vt dev/hwpmc/hwpmc_arm.c optional hwpmc dev/hwpmc/hwpmc_armv7.c optional hwpmc -dev/iicbus/twsi/twsi.c optional twsi +dev/iicbus/controller/twsi/twsi.c optional twsi dev/ofw/ofw_pcib.c optional fdt pci dev/pci/pci_host_generic.c optional pci_host_generic pci dev/pci/pci_host_generic_fdt.c optional pci_host_generic pci fdt diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index dc78840646bb..4df4f5c81bd1 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -337,9 +337,9 @@ ice_ddp.fw optional ice_ddp \ clean "ice_ddp.fw" dev/iicbus/sy8106a.c optional sy8106a fdt -dev/iicbus/twsi/mv_twsi.c optional twsi fdt -dev/iicbus/twsi/a10_twsi.c optional twsi fdt -dev/iicbus/twsi/twsi.c optional twsi fdt +dev/iicbus/controller/twsi/mv_twsi.c optional twsi fdt +dev/iicbus/controller/twsi/a10_twsi.c optional twsi fdt +dev/iicbus/controller/twsi/twsi.c optional twsi fdt dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_acpi.c optional ipmi acpi diff --git a/sys/dev/iicbus/twsi/a10_twsi.c b/sys/dev/iicbus/controller/twsi/a10_twsi.c similarity index 98% rename from sys/dev/iicbus/twsi/a10_twsi.c rename to sys/dev/iicbus/controller/twsi/a10_twsi.c index 3b61d338e580..de3f6a92f44f 100644 --- a/sys/dev/iicbus/twsi/a10_twsi.c +++ b/sys/dev/iicbus/controller/twsi/a10_twsi.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include diff --git a/sys/dev/iicbus/twsi/mv_twsi.c b/sys/dev/iicbus/controller/twsi/mv_twsi.c similarity index 99% rename from sys/dev/iicbus/twsi/mv_twsi.c rename to sys/dev/iicbus/controller/twsi/mv_twsi.c index 3f50bb0c4968..35f5b0acc650 100644 --- a/sys/dev/iicbus/twsi/mv_twsi.c +++ b/sys/dev/iicbus/controller/twsi/mv_twsi.c @@ -63,7 +63,7 @@ #include #include -#include +#include #include "iicbus_if.h" diff --git a/sys/dev/iicbus/twsi/twsi.c b/sys/dev/iicbus/controller/twsi/twsi.c similarity index 99% rename from sys/dev/iicbus/twsi/twsi.c rename to sys/dev/iicbus/controller/twsi/twsi.c index 802110ed7f99..7031cce515ce 100644 --- a/sys/dev/iicbus/twsi/twsi.c +++ b/sys/dev/iicbus/controller/twsi/twsi.c @@ -56,7 +56,7 @@ #include #include -#include +#include #include "iicbus_if.h" diff --git a/sys/dev/iicbus/twsi/twsi.h b/sys/dev/iicbus/controller/twsi/twsi.h similarity index 100% rename from sys/dev/iicbus/twsi/twsi.h rename to sys/dev/iicbus/controller/twsi/twsi.h From nobody Tue Oct 3 07:56:33 2023 X-Original-To: dev-commits-src-main@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 4S09BV08sjz4vwSY; Tue, 3 Oct 2023 07:56:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09BT6Znyz3SDR; Tue, 3 Oct 2023 07:56:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319793; 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=aniM7Jqyv2nFwxdSYweEliyRZU0PWP/FYVZ1YA9cdoI=; b=Fq3oGEvaC316O/FjsMXRQN62dN9klzX0D5g5eZioIRNFN3NvVv4E0eiNW9HvC3GhTZ1Hqv p/MP7WVfqgqKwKm+33vG+bIuzJ84jbWuo6wYLfzTZLW+Nnw8frUdMsc35xrKZsib1qXSWe K8xYFlorqQqImcavrNK4ZSH54It28YFUjYf8HmpRjzgha1H19N6tpZfdC+7tHDloda4Q6M wvhXx3bjgPxsB6lJN+xnmZQmPwpxjTJ/6alSRne/7R474smu3T8+juqUFXvfanwrSe7LkG cLA5GdHQh5n4Kkw7X/Cz1CrSX9XskmSP/6PciK4t+va4x/Oaac3fATJEp+HCKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319793; a=rsa-sha256; cv=none; b=pKovt/xBInXOKIRSB2YsPBQBdc/ae7QcOnXGpz6HP+ntpHx7LQLUZqZAaSKqQ7rd+OTVAZ vXSi1DZYOT2/ak9yy5V8sFcc1Oxlkd7nHS0vkwx6OTBj5Wy+lsdGOw3G2RxDPQbet4rBo1 SyTTJosM54Qq9W2vMM9GNOSxvKpUuxw+4ENX6Zi0hZlP+/nFe7tC1fI9lC9zrr5GSL7xt0 jNs24WAXz+lzp7g601K7OVcuuB0p4roLFFEUmbdgM5PwXGtFwWfy6SNeQ5xDB9v4/3J9FD BhMVFP0IWpARj8NeH72/CUF+DhESrGwp3o0859WGS+YQ0ef1xvSsN+nNKgYg+A== 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=1696319793; 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=aniM7Jqyv2nFwxdSYweEliyRZU0PWP/FYVZ1YA9cdoI=; b=i10HetKWOSx4AfQ2ntwJwKltFFTC0fIoEgs/mS4i6fqgx6QA67fO9CcjZA1ZlAkwOSNW10 OVk4Lxq8sxJsc3Y3PIJ9BIkUgfL9SIYJkxeqBtmQGtPacE044W8RK0g1NX9xjoQ5YC3V46 2utJWh7FnLQiDiUdaHHSc/xlt8iil6OUFBLEOnNFwxbbA3RpZCM6iWAPe1LxQwN/f+slz/ yB0zIRjdbocExG6veCIWTiXmK9KPbuTnNwjALqfQeBJFskf/Q+bHe2WRuvWVXlc1BySWUo tBCNcLinRJDl6ozhalESJknfXZmPFemgJc/CU92HG7eWCQQHl32IGAFOZrJQ2g== 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 4S09BT5Y2Lzn48; Tue, 3 Oct 2023 07:56:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937uXHB035519; Tue, 3 Oct 2023 07:56:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937uXjO035516; Tue, 3 Oct 2023 07:56:33 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:33 GMT Message-Id: <202310030756.3937uXjO035516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 2f16049c985a - main - iicbus: Move remaining rtc driver into rtc subfolder List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f16049c985a364e2bd2b256f5bef9af17e10c62 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2f16049c985a364e2bd2b256f5bef9af17e10c62 commit 2f16049c985a364e2bd2b256f5bef9af17e10c62 Author: Emmanuel Vadot AuthorDate: 2023-09-19 07:49:45 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:19 +0000 iicbus: Move remaining rtc driver into rtc subfolder No reason that they should live directly under iicbus Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41908 --- sys/conf/files | 16 ++++++++-------- sys/dev/iicbus/{ => rtc}/ds1307.c | 2 +- sys/dev/iicbus/{ => rtc}/ds1307reg.h | 0 sys/dev/iicbus/{ => rtc}/ds13rtc.c | 0 sys/dev/iicbus/{ => rtc}/ds1672.c | 0 sys/dev/iicbus/{ => rtc}/ds3231.c | 2 +- sys/dev/iicbus/{ => rtc}/ds3231reg.h | 0 sys/dev/iicbus/{ => rtc}/isl12xx.c | 0 sys/dev/iicbus/{ => rtc}/nxprtc.c | 0 sys/dev/iicbus/{ => rtc}/rtc8583.c | 0 sys/dev/iicbus/{ => rtc}/s35390a.c | 0 sys/modules/i2c/ds1307/Makefile | 2 +- sys/modules/i2c/ds13rtc/Makefile | 2 +- sys/modules/i2c/ds1672/Makefile | 2 +- sys/modules/i2c/ds3231/Makefile | 2 +- sys/modules/i2c/isl12xx/Makefile | 2 +- sys/modules/i2c/nxprtc/Makefile | 2 +- sys/modules/i2c/rtc8583/Makefile | 2 +- sys/modules/i2c/s35390a/Makefile | 2 +- 19 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 4e72eac77e68..f2a3524bdb21 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1794,10 +1794,6 @@ dev/ida/ida_pci.c optional ida pci dev/iicbus/acpi_iicbus.c optional acpi iicbus | acpi compat_linuxkpi dev/iicbus/ad7418.c optional ad7418 dev/iicbus/ads111x.c optional ads111x -dev/iicbus/ds1307.c optional ds1307 -dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds1374 -dev/iicbus/ds1672.c optional ds1672 -dev/iicbus/ds3231.c optional ds3231 dev/iicbus/htu21.c optional htu21 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic @@ -1814,7 +1810,6 @@ dev/iicbus/iicsmb.c optional iicsmb \ dev/iicbus/iicoc.c optional iicoc dev/iicbus/iicoc_fdt.c optional iicoc fdt dev/iicbus/iicoc_pci.c optional iicoc pci -dev/iicbus/isl12xx.c optional isl12xx dev/iicbus/lm75.c optional lm75 dev/iicbus/max44009.c optional max44009 dev/iicbus/mux/iicmux.c optional iicmux @@ -1822,15 +1817,20 @@ dev/iicbus/mux/iicmux_if.m optional iicmux dev/iicbus/mux/iic_gpiomux.c optional iic_gpiomux fdt dev/iicbus/mux/ltc430x.c optional ltc430x dev/iicbus/mux/pca954x.c optional pca954x iicbus iicmux -dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus dev/iicbus/ofw_iicbus_if.m optional fdt iicbus dev/iicbus/pcf8574.c optional pcf8574 dev/iicbus/pcf8591.c optional pcf8591 -dev/iicbus/rtc8583.c optional rtc8583 +dev/iicbus/rtc/ds1307.c optional ds1307 +dev/iicbus/rtc/ds13rtc.c optional ds13rtc | ds133x | ds1374 +dev/iicbus/rtc/ds1672.c optional ds1672 +dev/iicbus/rtc/ds3231.c optional ds3231 +dev/iicbus/rtc/isl12xx.c optional isl12xx +dev/iicbus/rtc/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/rtc/pcf85063.c optional pcf85063 iicbus fdt +dev/iicbus/rtc/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt -dev/iicbus/s35390a.c optional s35390a +dev/iicbus/rtc/s35390a.c optional s35390a dev/iicbus/sy8106a.c optional sy8106a fdt dev/iicbus/syr827.c optional syr827 fdt dev/iicbus/gpio/tca64xx.c optional tca64xx fdt gpio diff --git a/sys/dev/iicbus/ds1307.c b/sys/dev/iicbus/rtc/ds1307.c similarity index 99% rename from sys/dev/iicbus/ds1307.c rename to sys/dev/iicbus/rtc/ds1307.c index 6522b3284bf3..e8d24880571c 100644 --- a/sys/dev/iicbus/ds1307.c +++ b/sys/dev/iicbus/rtc/ds1307.c @@ -48,7 +48,7 @@ #include #endif -#include +#include #include "clock_if.h" #include "iicbus_if.h" diff --git a/sys/dev/iicbus/ds1307reg.h b/sys/dev/iicbus/rtc/ds1307reg.h similarity index 100% rename from sys/dev/iicbus/ds1307reg.h rename to sys/dev/iicbus/rtc/ds1307reg.h diff --git a/sys/dev/iicbus/ds13rtc.c b/sys/dev/iicbus/rtc/ds13rtc.c similarity index 100% rename from sys/dev/iicbus/ds13rtc.c rename to sys/dev/iicbus/rtc/ds13rtc.c diff --git a/sys/dev/iicbus/ds1672.c b/sys/dev/iicbus/rtc/ds1672.c similarity index 100% rename from sys/dev/iicbus/ds1672.c rename to sys/dev/iicbus/rtc/ds1672.c diff --git a/sys/dev/iicbus/ds3231.c b/sys/dev/iicbus/rtc/ds3231.c similarity index 99% rename from sys/dev/iicbus/ds3231.c rename to sys/dev/iicbus/rtc/ds3231.c index eb45f6fcf6e6..23e88eb7ecd3 100644 --- a/sys/dev/iicbus/ds3231.c +++ b/sys/dev/iicbus/rtc/ds3231.c @@ -47,7 +47,7 @@ #include #endif -#include +#include #include "clock_if.h" #include "iicbus_if.h" diff --git a/sys/dev/iicbus/ds3231reg.h b/sys/dev/iicbus/rtc/ds3231reg.h similarity index 100% rename from sys/dev/iicbus/ds3231reg.h rename to sys/dev/iicbus/rtc/ds3231reg.h diff --git a/sys/dev/iicbus/isl12xx.c b/sys/dev/iicbus/rtc/isl12xx.c similarity index 100% rename from sys/dev/iicbus/isl12xx.c rename to sys/dev/iicbus/rtc/isl12xx.c diff --git a/sys/dev/iicbus/nxprtc.c b/sys/dev/iicbus/rtc/nxprtc.c similarity index 100% rename from sys/dev/iicbus/nxprtc.c rename to sys/dev/iicbus/rtc/nxprtc.c diff --git a/sys/dev/iicbus/rtc8583.c b/sys/dev/iicbus/rtc/rtc8583.c similarity index 100% rename from sys/dev/iicbus/rtc8583.c rename to sys/dev/iicbus/rtc/rtc8583.c diff --git a/sys/dev/iicbus/s35390a.c b/sys/dev/iicbus/rtc/s35390a.c similarity index 100% rename from sys/dev/iicbus/s35390a.c rename to sys/dev/iicbus/rtc/s35390a.c diff --git a/sys/modules/i2c/ds1307/Makefile b/sys/modules/i2c/ds1307/Makefile index 9699a1057dc3..363aa412cbdc 100644 --- a/sys/modules/i2c/ds1307/Makefile +++ b/sys/modules/i2c/ds1307/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = ds1307 SRCS = ds1307.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h diff --git a/sys/modules/i2c/ds13rtc/Makefile b/sys/modules/i2c/ds13rtc/Makefile index ffeab1c12dd7..a9616765b7a5 100644 --- a/sys/modules/i2c/ds13rtc/Makefile +++ b/sys/modules/i2c/ds13rtc/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = ds13rtc SRCS = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h diff --git a/sys/modules/i2c/ds1672/Makefile b/sys/modules/i2c/ds1672/Makefile index 1b1fd9ab038c..c160e317c36d 100644 --- a/sys/modules/i2c/ds1672/Makefile +++ b/sys/modules/i2c/ds1672/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = ds1672 SRCS = ds1672.c diff --git a/sys/modules/i2c/ds3231/Makefile b/sys/modules/i2c/ds3231/Makefile index 7548f6ef8282..4c6a7241bf76 100644 --- a/sys/modules/i2c/ds3231/Makefile +++ b/sys/modules/i2c/ds3231/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = ds3231 SRCS = ds3231.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h diff --git a/sys/modules/i2c/isl12xx/Makefile b/sys/modules/i2c/isl12xx/Makefile index 98411b78aae6..be0b409eeff2 100644 --- a/sys/modules/i2c/isl12xx/Makefile +++ b/sys/modules/i2c/isl12xx/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = isl12xx SRCS = isl12xx.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h diff --git a/sys/modules/i2c/nxprtc/Makefile b/sys/modules/i2c/nxprtc/Makefile index 23efdcfe7754..3501909f6ea4 100644 --- a/sys/modules/i2c/nxprtc/Makefile +++ b/sys/modules/i2c/nxprtc/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = nxprtc SRCS = nxprtc.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h diff --git a/sys/modules/i2c/rtc8583/Makefile b/sys/modules/i2c/rtc8583/Makefile index 23cb48afd33c..a474da20685e 100644 --- a/sys/modules/i2c/rtc8583/Makefile +++ b/sys/modules/i2c/rtc8583/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = rtc8583 SRCS = rtc8583.c diff --git a/sys/modules/i2c/s35390a/Makefile b/sys/modules/i2c/s35390a/Makefile index d1091db58abc..e12ddeece2ec 100644 --- a/sys/modules/i2c/s35390a/Makefile +++ b/sys/modules/i2c/s35390a/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc KMOD = s35390a SRCS = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h From nobody Tue Oct 3 07:56:34 2023 X-Original-To: dev-commits-src-main@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 4S09BW1QTdz4vwbB; Tue, 3 Oct 2023 07:56:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09BW0Vfrz3SKJ; Tue, 3 Oct 2023 07:56:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319795; 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=7BW+tv4/n6yRhaeoLHOOAv2nYqbIQNLG2YT05dZ3KwM=; b=b3W2Pl9CUHd3VxhQ2wjChwupfpX33C2yDRwDSz6qlJPaAHvpGeB0Ts4eGj4jHfNCLCIANI Oaorecw0tJ+0XOO+9DMWPFwV29CLHMYe51Au9uwFvfCzR6zBZJ4bVITL5BV96C5V8VDb6z Ek2vkbzrFApFKRkZVzV0rqFO9kgeOpTnU8jz59JsejZL3cw5uqTyhYE90CHt0saJbHYp1w dRnv2pM+cA6CaB5kiqFlkh33Uuf9cIaLTNsxY6Fs5yhnIxud969aji2gjaX+F3x64KJCuH O32i4sxH19xG1s1kxbCtYmmfGjx+HKNBL1MmH95FAwGAQ+dC7rjql/DFon+YqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319795; a=rsa-sha256; cv=none; b=ewmT6BUp1/ps0vZaX0u0WyCGgFAcApQAabVFL9oit8FDUbxmx/1AJOKD7L21c7+CvYsum2 sI5WoSg+jlozsyuTqFP3rQjChcoPZH26B6AvCr7dg6hme5BPdWDewIKdGnlJGLNKaRnXdZ UeKuy4vz47hThzGB7UZWc+47LRDlwjJw9g6234YZ0NnWuvz4QLLi6nIs0lKfcefQzmKZdc W74z4Zx100NuqW731bobNCujy8xo0usrZFA9m+K1BrVvpyUFTcM+t2R6pN4qsSgDDWXZEy i6Ppm4RRSVn2zYhfYHcBlYHObnYGvUp7P+SxKSy5LPWNB9CuBZqjm1k1kDgEWw== 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=1696319795; 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=7BW+tv4/n6yRhaeoLHOOAv2nYqbIQNLG2YT05dZ3KwM=; b=FvfdGzgzm4H4ris3iG8iOaNlkdVwH8flW+4WLVANpSBIZYnVSZ4pIy14zo/lbJJ+jks/jq svxEUQw+zMA4CLE33UUQmIYmm3XLarRchL+lviLPB5lHqVgPtS/2fR5MXOc/iyEbi8ymps bfNUT/YFRPcwiCykFeOcHIGUWtt2Lx/DI/XrJHyNDBxAUbmAcVDSXF8DoTPQNDcOUhwC79 2i5c3TqdWUmSaQ7c8hnnuoWDRG6E6WGLTJulH60TLk0+ge1uRLuc+gQBbggTLoX2nIlCEm 3F3kC+Fj6VxDE9i68EEKMHAulJqlUBrA2yvqtgREEU6PhQl0CpwTFFrL/UlqFA== 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 4S09BV6cV4zmhd; Tue, 3 Oct 2023 07:56:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937uYkC035567; Tue, 3 Oct 2023 07:56:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937uYi8035564; Tue, 3 Oct 2023 07:56:34 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:34 GMT Message-Id: <202310030756.3937uYi8035564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 062944cc4227 - main - iicbus: Move Silergy pmic/regulators under pmic/silergy subdirectory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 062944cc4227e7bd002e4de2be48ec9b710bfaa5 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=062944cc4227e7bd002e4de2be48ec9b710bfaa5 commit 062944cc4227e7bd002e4de2be48ec9b710bfaa5 Author: Emmanuel Vadot AuthorDate: 2023-09-19 07:56:02 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:19 +0000 iicbus: Move Silergy pmic/regulators under pmic/silergy subdirectory Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41909 --- sys/conf/files | 4 ++-- sys/conf/files.arm64 | 1 - sys/dev/iicbus/{ => pmic/silergy}/sy8106a.c | 0 sys/dev/iicbus/{ => pmic/silergy}/syr827.c | 0 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index f2a3524bdb21..83333e195ad0 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1831,10 +1831,10 @@ dev/iicbus/rtc/pcf85063.c optional pcf85063 iicbus fdt dev/iicbus/rtc/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt dev/iicbus/rtc/s35390a.c optional s35390a -dev/iicbus/sy8106a.c optional sy8106a fdt -dev/iicbus/syr827.c optional syr827 fdt dev/iicbus/gpio/tca64xx.c optional tca64xx fdt gpio dev/iicbus/pmic/fan53555.c optional fan53555 fdt | tcs4525 fdt +dev/iicbus/pmic/silergy/sy8106a.c optional sy8106a fdt +dev/iicbus/pmic/silergy/syr827.c optional syr827 fdt dev/igc/if_igc.c optional igc iflib pci dev/igc/igc_api.c optional igc iflib pci dev/igc/igc_base.c optional igc iflib pci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 4df4f5c81bd1..d8adc54763fc 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -336,7 +336,6 @@ ice_ddp.fw optional ice_ddp \ no-obj no-implicit-rule \ clean "ice_ddp.fw" -dev/iicbus/sy8106a.c optional sy8106a fdt dev/iicbus/controller/twsi/mv_twsi.c optional twsi fdt dev/iicbus/controller/twsi/a10_twsi.c optional twsi fdt dev/iicbus/controller/twsi/twsi.c optional twsi fdt diff --git a/sys/dev/iicbus/sy8106a.c b/sys/dev/iicbus/pmic/silergy/sy8106a.c similarity index 100% rename from sys/dev/iicbus/sy8106a.c rename to sys/dev/iicbus/pmic/silergy/sy8106a.c diff --git a/sys/dev/iicbus/syr827.c b/sys/dev/iicbus/pmic/silergy/syr827.c similarity index 100% rename from sys/dev/iicbus/syr827.c rename to sys/dev/iicbus/pmic/silergy/syr827.c From nobody Tue Oct 3 07:56:35 2023 X-Original-To: dev-commits-src-main@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 4S09BX1zXTz4vw7Y; Tue, 3 Oct 2023 07:56:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09BX17BPz3SB3; Tue, 3 Oct 2023 07:56:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319796; 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=3ZwbshPZDSoglBrcmZ4IzbVoN2kQVNOglpryKR5NZXU=; b=TEii1GspW0Hg++kbAxXIw9OcNbNBTIpDz7YvNzf3fgszG0tmW5kshdzZfuWHtTaGK9XYHP 6aLVTjGGtJ8eDZZoHBkFZL+Ib504pGNpIhTgiLlz70uVgmAw7Mgc8ZPWr3AOIfNWialbIn C00t87UfcluUQ1T7irETZMxQhhaypnjTTWX5TIER5uj27elgyCpNNC9ZQ7OBpsXQDNwkvm O2uKjSCCk/keRuUZ1wngxQ2zEc82IqbOnGqxOemplD55By3TeRdPLQ4xDodpMu5xy3SEv4 41RwpyWO7pC0IqxrgS3WKPleAqp/ksn3dRej5/vUaVzpa+GxaDhV9O/btbqmqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319796; a=rsa-sha256; cv=none; b=rtn6auRFzSuQ59cQbvpreX+5gFQ27xmvIdHcTajWyJioG9Cj2g1hMIWuSD1P9aC6lLzWto 01EIw+V7RDOjhiSXZYXGa4DCXhHTRkpksZQ+3rbmhhx7rX5Qy/NYR31ervt032pv1f7iBV wJmfwIHs27/z9jfjyHbpvT1+p3KMoiHPYK7rR/2mW+wPEJzZOsSrsnQZ+tbH6pBh0lkNwG pgtnHZ3XDoFli0EzHPurmxIDv5/wRp/61wae+7An0bg3sOLZM6WATO5H13j/dJRAENgKGl xoObELUD6tqcMYdrQsFh4Hn3yKcx96KHss62BisZ1IuOq0UAMk/YShttm4m5RQ== 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=1696319796; 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=3ZwbshPZDSoglBrcmZ4IzbVoN2kQVNOglpryKR5NZXU=; b=x1zV0dWccgs2M4WTh3rs0DImfCmhlbvYBPoV9HfDJFOGTJJKCgsLNCVFXq/21P3D5P35cU wRNT/VkaOeNcVUaecfnZwR507TfvkSm8LVRc6iFKN4W+gjYf/S86OVjc7hYdo4aVGfXACY IJLCZo4NobRnro6KsxaUtIKXu0FJHiRrf7gukNvW5hLOYsWqpM4zrVhVbCatUhmC+D8wmC t/jPE/7jzaGFKXF5h/BK4SQYWqa6euEEzO9TYImjpZJJzpEXCOBPdWdVIT7WeiS0UlVyJ8 FbI4zkqlTR0+Vdo9w/aFKeDXtukkJSh0m5jTt2Q2umQANxuGgCKbSPQ+dLuHSA== 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 4S09BX09TQzmct; Tue, 3 Oct 2023 07:56:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937uZoM035625; Tue, 3 Oct 2023 07:56:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937uZWE035622; Tue, 3 Oct 2023 07:56:35 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:35 GMT Message-Id: <202310030756.3937uZWE035622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 22d7dd834bc5 - main - iicbus: Move adm1030 and adt746x to new pwm subdirectory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22d7dd834bc5cd189810e414701e3ad1e98102e4 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=22d7dd834bc5cd189810e414701e3ad1e98102e4 commit 22d7dd834bc5cd189810e414701e3ad1e98102e4 Author: Emmanuel Vadot AuthorDate: 2023-09-19 08:04:02 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:19 +0000 iicbus: Move adm1030 and adt746x to new pwm subdirectory Those are (mainly) pwm controller so move it under a new subdirectory. Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41910 --- sys/conf/files.powerpc | 4 ++-- sys/dev/iicbus/{ => pwm}/adm1030.c | 0 sys/dev/iicbus/{ => pwm}/adt746x.c | 0 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 48251ab07d9e..0a05b1327689 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -41,13 +41,13 @@ dev/hwpmc/hwpmc_power8.c optional hwpmc dev/hwpmc/hwpmc_powerpc.c optional hwpmc dev/hwpmc/hwpmc_ppc970.c optional hwpmc dev/iicbus/ad7417.c optional ad7417 powermac -dev/iicbus/adm1030.c optional powermac windtunnel | adm1030 powermac -dev/iicbus/adt746x.c optional adt746x powermac dev/iicbus/ds1631.c optional ds1631 powermac dev/iicbus/ds1775.c optional ds1775 powermac dev/iicbus/max6690.c optional max6690 powermac dev/iicbus/ofw_iicbus.c optional iicbus aim dev/iicbus/ofw_iicbus_if.m optional iicbus aim +dev/iicbus/pwm/adm1030.c optional powermac windtunnel | adm1030 powermac +dev/iicbus/pwm/adt746x.c optional adt746x powermac dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_opal.c optional powernv ipmi dev/ice/if_ice_iflib.c optional ice pci powerpc64 | ice pci powerpc64le \ diff --git a/sys/dev/iicbus/adm1030.c b/sys/dev/iicbus/pwm/adm1030.c similarity index 100% rename from sys/dev/iicbus/adm1030.c rename to sys/dev/iicbus/pwm/adm1030.c diff --git a/sys/dev/iicbus/adt746x.c b/sys/dev/iicbus/pwm/adt746x.c similarity index 100% rename from sys/dev/iicbus/adt746x.c rename to sys/dev/iicbus/pwm/adt746x.c From nobody Tue Oct 3 07:56:37 2023 X-Original-To: dev-commits-src-main@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 4S09BY4jH0z4vwXj; Tue, 3 Oct 2023 07:56:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09BY2CK7z3SQt; Tue, 3 Oct 2023 07:56:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319797; 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=g4g1rc5Ot/i+b1YUMvBJWN+9gPo37LiOOix9JAIfla4=; b=j8KSVS2zI0ONhqt5MFVGU/wtXhRP0w+icXroQGX6tAV5EMvZvEvZMi3zFk4KKCTr0ZjQU5 3Q9YZ/Eh5yfHYl9KUOnvvPa/cyBi4s9wYzqs/EWV0ddO6IkxwlYhPWuMzTZ6LHkyPEP2cH H0BPnOMc27zKLGqLqyts+qMmXWKuzSsCFRKrYPNh0OPzGsbV0dMG4V7BLKYScU/3VXCxG9 sciMVq1AWdtV90QZKqU9xIQQPI6+2smzrr6fhAW0EnNPOwXLcMhY8lGZys8BZKe8VaoCqc wMZQS99eCXqTCKoTSSjAX0w+fj+Ol9IKY7Q/gBzxDgmooagdym7kgUxRlSoOlw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319797; a=rsa-sha256; cv=none; b=fHPP9x2ZJsy817LUM0QUdpYFQJdvUoubN8q5QGOcUdcP6a59gkJ+H6oi1ttP3crw09zzQs oU4nZNrKRK68AooPDyclxCTFWwvfSy8sNXrZQVSKX/cwiBYcgBHoD8KAT9e6gusOkdM3N+ wz5VlZ6AIaVZlg3Jqs5xZbbgiiBipFh9dGWv27tWZiaidjt/POVjjzinHIQBAdEk0smq5u S4vQ5L2Nf0rt9SiP+0xITwy1E1kYhlVQg65+lDwjcQRw59bU98f9csilPBV7qG7MoFprHv izQTsHvcUJaljy0/I+gpV8oYOpxOjuYY7NiHdXvQ40K5kqnwvUvAkeIkOy+6FA== 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=1696319797; 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=g4g1rc5Ot/i+b1YUMvBJWN+9gPo37LiOOix9JAIfla4=; b=nnMQpa0OdOTYnfFKge9w5VKqU4qHyPsa2lzmTlOVhstuLaQ/b/xWi56D6mMdjNBqJL0oDl BsbeUdhojqYPWA73+walDUk+Kk+EbKG4wo0t+Fe5NMDsXJO58//UgLWgvpLSGtUUGR3R6g ZskVHvCJaQkHnIMiqEYMHmpDoeLHnKgj7dFwuau0YYF/mZS2ib3EvDESzoE5ydhDKbnRm6 3xjb+Z3sum4efyaoKzVYd/l6N3MPK8wyzTflDMU8ssRLNN2l8xntY5MGDum0hwHPM/kh1k R6DqCrUFt+E4tUsMzDVQ8kmapCyICNoAcvsAqhQk4JbBVQQIezqMwQacdtnfnA== 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 4S09BY1GZRzn4h; Tue, 3 Oct 2023 07:56:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937ubpk035679; Tue, 3 Oct 2023 07:56:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937ubfg035676; Tue, 3 Oct 2023 07:56:37 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:37 GMT Message-Id: <202310030756.3937ubfg035676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 06589d6e029c - main - iicbus: Move ADC drivers into a new adc subfolder List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 06589d6e029c6ff64a7816d743e0a508abe6193b Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=06589d6e029c6ff64a7816d743e0a508abe6193b commit 06589d6e029c6ff64a7816d743e0a508abe6193b Author: Emmanuel Vadot AuthorDate: 2023-09-19 08:38:19 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:19 +0000 iicbus: Move ADC drivers into a new adc subfolder No reason that they should live directly under iicbus Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41911 --- sys/conf/files | 6 +++--- sys/conf/files.powerpc | 2 +- sys/dev/iicbus/{ => adc}/ad7417.c | 0 sys/dev/iicbus/{ => adc}/ad7418.c | 0 sys/dev/iicbus/{ => adc}/ads111x.c | 0 sys/dev/iicbus/{ => adc}/pcf8591.c | 0 sys/modules/i2c/ads111x/Makefile | 2 +- sys/modules/i2c/pcf8591/Makefile | 2 +- 8 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 83333e195ad0..1eb6ba4ff781 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1792,8 +1792,6 @@ dev/ida/ida.c optional ida dev/ida/ida_disk.c optional ida dev/ida/ida_pci.c optional ida pci dev/iicbus/acpi_iicbus.c optional acpi iicbus | acpi compat_linuxkpi -dev/iicbus/ad7418.c optional ad7418 -dev/iicbus/ads111x.c optional ads111x dev/iicbus/htu21.c optional htu21 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic @@ -1812,6 +1810,9 @@ dev/iicbus/iicoc_fdt.c optional iicoc fdt dev/iicbus/iicoc_pci.c optional iicoc pci dev/iicbus/lm75.c optional lm75 dev/iicbus/max44009.c optional max44009 +dev/iicbus/adc/ad7418.c optional ad7418 +dev/iicbus/adc/ads111x.c optional ads111x +dev/iicbus/adc/pcf8591.c optional pcf8591 dev/iicbus/mux/iicmux.c optional iicmux dev/iicbus/mux/iicmux_if.m optional iicmux dev/iicbus/mux/iic_gpiomux.c optional iic_gpiomux fdt @@ -1820,7 +1821,6 @@ dev/iicbus/mux/pca954x.c optional pca954x iicbus iicmux dev/iicbus/ofw_iicbus.c optional fdt iicbus dev/iicbus/ofw_iicbus_if.m optional fdt iicbus dev/iicbus/pcf8574.c optional pcf8574 -dev/iicbus/pcf8591.c optional pcf8591 dev/iicbus/rtc/ds1307.c optional ds1307 dev/iicbus/rtc/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/rtc/ds1672.c optional ds1672 diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 0a05b1327689..76a0f4d707f3 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -40,10 +40,10 @@ dev/hwpmc/hwpmc_mpc7xxx.c optional hwpmc dev/hwpmc/hwpmc_power8.c optional hwpmc dev/hwpmc/hwpmc_powerpc.c optional hwpmc dev/hwpmc/hwpmc_ppc970.c optional hwpmc -dev/iicbus/ad7417.c optional ad7417 powermac dev/iicbus/ds1631.c optional ds1631 powermac dev/iicbus/ds1775.c optional ds1775 powermac dev/iicbus/max6690.c optional max6690 powermac +dev/iicbus/adc/ad7417.c optional ad7417 powermac dev/iicbus/ofw_iicbus.c optional iicbus aim dev/iicbus/ofw_iicbus_if.m optional iicbus aim dev/iicbus/pwm/adm1030.c optional powermac windtunnel | adm1030 powermac diff --git a/sys/dev/iicbus/ad7417.c b/sys/dev/iicbus/adc/ad7417.c similarity index 100% rename from sys/dev/iicbus/ad7417.c rename to sys/dev/iicbus/adc/ad7417.c diff --git a/sys/dev/iicbus/ad7418.c b/sys/dev/iicbus/adc/ad7418.c similarity index 100% rename from sys/dev/iicbus/ad7418.c rename to sys/dev/iicbus/adc/ad7418.c diff --git a/sys/dev/iicbus/ads111x.c b/sys/dev/iicbus/adc/ads111x.c similarity index 100% rename from sys/dev/iicbus/ads111x.c rename to sys/dev/iicbus/adc/ads111x.c diff --git a/sys/dev/iicbus/pcf8591.c b/sys/dev/iicbus/adc/pcf8591.c similarity index 100% rename from sys/dev/iicbus/pcf8591.c rename to sys/dev/iicbus/adc/pcf8591.c diff --git a/sys/modules/i2c/ads111x/Makefile b/sys/modules/i2c/ads111x/Makefile index 05e2d1c0da0e..d02cb704146c 100644 --- a/sys/modules/i2c/ads111x/Makefile +++ b/sys/modules/i2c/ads111x/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/adc KMOD= ads111x SRCS= ads111x.c diff --git a/sys/modules/i2c/pcf8591/Makefile b/sys/modules/i2c/pcf8591/Makefile index c944a2c8c66d..8f17f3dc3ae1 100644 --- a/sys/modules/i2c/pcf8591/Makefile +++ b/sys/modules/i2c/pcf8591/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/adc KMOD= pcf8591 SRCS= pcf8591.c From nobody Tue Oct 3 07:56:38 2023 X-Original-To: dev-commits-src-main@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 4S09BZ4Wjcz4vwdc; Tue, 3 Oct 2023 07:56:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09BZ3DFDz3Sdb; Tue, 3 Oct 2023 07:56:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319798; 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=RCkbiyu7i6GR3FaYOglgGrU1WY2Mrs1ABHvuvU+lLbk=; b=tZsqoPDqE5vED/QaMQVqAWEa5j+0WAMmbMXvvNLwrYDgw6MjT7VVZeyA5ivtoZdIa43BZU ZjKVxiiLhZdldxzSHA0CiA4fFOMONQWTDpKgBs6e4y5MvXigfyEZlFKioVms5KNzpKSsDL p6PLH8uh/OoSdZbWFYJkMUMnByeoFW8OwGuU9m8TdLtRLSx4WQ4/08+3UDtgVkUVrgVQ2w 2hOSvPbMQzMuv5giSreIziwggvKBiWOJnOGr8tsJUU/NSAMDP5RG9V3wKO78jeMPtInP7S q5jIL8GsdfCicz2AQhhA/90WUsaDGOxlHaBoCXnLeX5qIyUUhHvZZi9EY2cnVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319798; a=rsa-sha256; cv=none; b=tfAJsuYghoWhrRAD+3ZtMfNiX5mJvIuLEP+giqFgU40ItuEEvisLfZkh1V2h4G4BQ4rkM9 5JyvHpZKs4l/WYGd8Zb4XqjH7B8URriAMvB9idM+Xp47rO7DhjAMUQoMBHxGpWeNEj95yb u7Q38ZOVeczfAm/8zzwBcnchEzy3iVKmyF3afzdn1ujWSyitAwPcst0Q7kqWoGwgXTIvsO MRJnGzU8W6oKol02BMwpPTZZtdUlLGxB2b1mLb+e6ykUAlZqf0KSVZvYTfgNWqtmcHBFPE wYL+OCtbJCN6uVEndh8seINkaC6v1OkVhPL4sydu3kEfyaQwOAKVnOlaGxetoQ== 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=1696319798; 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=RCkbiyu7i6GR3FaYOglgGrU1WY2Mrs1ABHvuvU+lLbk=; b=Ey4X9FTHlPryDw0WHJWzXqOqOguzPdGzsLyS3nQH9Bv4cVgrdwM0BOQKDsXI1IplXdBVTF hiJUDroA5PRlZi+OILC9p/3Dp+7vGgcL3XMizSTLslhdJoD5PxU7hEQsMjURSSGZ1I1oXM J3ogla4KaXsWgvTdAU4Lfzpe2NnvxYT5b+9Gkul5fs+szNQBNvzjeZhREyZAt7I3Pv0AfU e8QTjWtWaFvUEJIZQ3BlL5O7I72iARR4QPDRUB7/nwv90+K19VBMCyGiWtb1nvoX3dCFZ1 esFy0mxYeBD+v7465P2wJAEmw+qz43E5pqtyWny9PG5E6SlzYBJOj3gE6DYYFA== 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 4S09BZ2Hfxzn4j; Tue, 3 Oct 2023 07:56:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937ucUA035721; Tue, 3 Oct 2023 07:56:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937uc3V035718; Tue, 3 Oct 2023 07:56:38 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:38 GMT Message-Id: <202310030756.3937uc3V035718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 918a10c9f792 - main - iicbus: conf: Fix pcf8574 entry List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 918a10c9f792d2c2f78b75626f7bf2abc85a0fff Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=918a10c9f792d2c2f78b75626f7bf2abc85a0fff commit 918a10c9f792d2c2f78b75626f7bf2abc85a0fff Author: Emmanuel Vadot AuthorDate: 2023-09-19 08:39:26 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:19 +0000 iicbus: conf: Fix pcf8574 entry It lives in the gpio subdirectory Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41912 --- sys/conf/files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index 1eb6ba4ff781..6f1718309951 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1820,7 +1820,6 @@ dev/iicbus/mux/ltc430x.c optional ltc430x dev/iicbus/mux/pca954x.c optional pca954x iicbus iicmux dev/iicbus/ofw_iicbus.c optional fdt iicbus dev/iicbus/ofw_iicbus_if.m optional fdt iicbus -dev/iicbus/pcf8574.c optional pcf8574 dev/iicbus/rtc/ds1307.c optional ds1307 dev/iicbus/rtc/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/rtc/ds1672.c optional ds1672 @@ -1831,6 +1830,7 @@ dev/iicbus/rtc/pcf85063.c optional pcf85063 iicbus fdt dev/iicbus/rtc/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt dev/iicbus/rtc/s35390a.c optional s35390a +dev/iicbus/gpio/pcf8574.c optional pcf8574 dev/iicbus/gpio/tca64xx.c optional tca64xx fdt gpio dev/iicbus/pmic/fan53555.c optional fan53555 fdt | tcs4525 fdt dev/iicbus/pmic/silergy/sy8106a.c optional sy8106a fdt From nobody Tue Oct 3 07:56:39 2023 X-Original-To: dev-commits-src-main@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 4S09Bb5TZtz4vwPl; Tue, 3 Oct 2023 07:56:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09Bb4fypz3SYc; Tue, 3 Oct 2023 07:56:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319799; 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=dLeYF0u0PboIYdO2QEYw7eStN49lME38a7/qeRlF3IM=; b=rWOReNrlDXtIXcfXBJ5KuHZCxd/XLW5lICuTZwLIA78PuxginI7jBYKwQubY4zEJMExRqY mt21FYvNafaPsX54QQa3dn4HiViH2FbYAaQNfAT7Lsi50khB2N2xO7DhZd17adEHK+NvnP xIMFBlUuKO5uQkO42Ck3lSfur335nKkwrlTdGBfo3MDfFcNzgi7TQeA+TaTgaLuFN/qZ/n JXWeX+v1SrXvB8kIY9g3wC16j3XTQd4mfsJKF35qzH9ZtItpI6QH1DD43RrDk9apHhsbbT mAIVaul52QJevoycPWki5jQ8PGmCp9jpYw1TV5VemgTAf3AEZ9qJAdTL+2WfLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319799; a=rsa-sha256; cv=none; b=ILV/p4fyb9hWVZl11gtdjx2bPFZHJ3CQp3dyUDkmHcOpp2sVCsKSVHaF+xH/JQ09D14QKV WHDBpYHB0z0G5LgUrkApY3ikvEuBhMt1ZRRu/aT6gCWbsbaWho5DG7dgZX+YYTINSXvQ+f rJlZolym9ljVMfflQMotbHmzvww/q5/fTjWWEOdK+BgNxNsQKLuoNBJ2wqg/94FFVvxK0e JNkWrLoGc5h6PJ5jRv1pdNr/6rU8wTpH16s3FuqWyfZh7hlN4Ej3eAykwy2HpttqeEWnxj +YzEMgUiW66KETnvnqEhkbmMsT+hPT6ejsL2YqN7urY0CG7l0EAkek1lXQDlyA== 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=1696319799; 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=dLeYF0u0PboIYdO2QEYw7eStN49lME38a7/qeRlF3IM=; b=gsP1/hMz0BaL+BKJUwEzX41K93bpG0MPDXiwwsL6Vo96JzLvMHbgMA8ocaVYjSI/opIQxB 8QkykiTDaEwDFCUxxn2FHZfSVGhtv0fGOoJp7r4ZOuf9RGGihY7jsrwYkiFdxghlRITtrX EVOpOCIPtvjGQTlHRrWGOzFXdQdQyqSLKeDLjPiB/5w/Jcv5tAp9GMEXwQXP1Io3xKgqNE TULIHXJH/R3ojxVdnLwNJPf1YpX9he0QnvNPa9zfcTTqH5gLjtCaXDoEyYShKMBNKi9TIj qrTyR2WyqyFZwbx2+UwQ+qKUjxbY0AnI/z3L0//H9uO+sslPr0G04CfGrTaQFA== 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 4S09Bb3NTszmcv; Tue, 3 Oct 2023 07:56:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937udAa035782; Tue, 3 Oct 2023 07:56:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937udPL035779; Tue, 3 Oct 2023 07:56:39 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:39 GMT Message-Id: <202310030756.3937udPL035779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 7c569caa0a6f - main - iicbus: Move i2c sensors drivers into new sensor subdirectory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c569caa0a6fffa7e1cc0a7f61e986dbc7c59074 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=7c569caa0a6fffa7e1cc0a7f61e986dbc7c59074 commit 7c569caa0a6fffa7e1cc0a7f61e986dbc7c59074 Author: Emmanuel Vadot AuthorDate: 2023-09-19 09:51:40 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:20 +0000 iicbus: Move i2c sensors drivers into new sensor subdirectory No reason that they should live directly under iicbus Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41913 --- sys/conf/files | 6 +++--- sys/conf/files.powerpc | 6 +++--- sys/dev/iicbus/{ => sensor}/ds1631.c | 0 sys/dev/iicbus/{ => sensor}/ds1775.c | 0 sys/dev/iicbus/{ => sensor}/htu21.c | 0 sys/dev/iicbus/{ => sensor}/lm75.c | 0 sys/dev/iicbus/{ => sensor}/max44009.c | 0 sys/dev/iicbus/{ => sensor}/max6690.c | 0 sys/dev/iicbus/{ => sensor}/tmp461.c | 0 sys/modules/i2c/htu21/Makefile | 2 +- sys/modules/i2c/max44009/Makefile | 2 +- sys/modules/i2c/tmp461/Makefile | 2 +- 12 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 6f1718309951..36ba432cc93e 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1792,7 +1792,6 @@ dev/ida/ida.c optional ida dev/ida/ida_disk.c optional ida dev/ida/ida_pci.c optional ida pci dev/iicbus/acpi_iicbus.c optional acpi iicbus | acpi compat_linuxkpi -dev/iicbus/htu21.c optional htu21 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic @@ -1808,8 +1807,6 @@ dev/iicbus/iicsmb.c optional iicsmb \ dev/iicbus/iicoc.c optional iicoc dev/iicbus/iicoc_fdt.c optional iicoc fdt dev/iicbus/iicoc_pci.c optional iicoc pci -dev/iicbus/lm75.c optional lm75 -dev/iicbus/max44009.c optional max44009 dev/iicbus/adc/ad7418.c optional ad7418 dev/iicbus/adc/ads111x.c optional ads111x dev/iicbus/adc/pcf8591.c optional pcf8591 @@ -1830,6 +1827,9 @@ dev/iicbus/rtc/pcf85063.c optional pcf85063 iicbus fdt dev/iicbus/rtc/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt dev/iicbus/rtc/s35390a.c optional s35390a +dev/iicbus/sensor/htu21.c optional htu21 +dev/iicbus/sensor/lm75.c optional lm75 +dev/iicbus/sensor/max44009.c optional max44009 dev/iicbus/gpio/pcf8574.c optional pcf8574 dev/iicbus/gpio/tca64xx.c optional tca64xx fdt gpio dev/iicbus/pmic/fan53555.c optional fan53555 fdt | tcs4525 fdt diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 76a0f4d707f3..0293efd28fbe 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -40,14 +40,14 @@ dev/hwpmc/hwpmc_mpc7xxx.c optional hwpmc dev/hwpmc/hwpmc_power8.c optional hwpmc dev/hwpmc/hwpmc_powerpc.c optional hwpmc dev/hwpmc/hwpmc_ppc970.c optional hwpmc -dev/iicbus/ds1631.c optional ds1631 powermac -dev/iicbus/ds1775.c optional ds1775 powermac -dev/iicbus/max6690.c optional max6690 powermac dev/iicbus/adc/ad7417.c optional ad7417 powermac dev/iicbus/ofw_iicbus.c optional iicbus aim dev/iicbus/ofw_iicbus_if.m optional iicbus aim dev/iicbus/pwm/adm1030.c optional powermac windtunnel | adm1030 powermac dev/iicbus/pwm/adt746x.c optional adt746x powermac +dev/iicbus/sensor/ds1631.c optional ds1631 powermac +dev/iicbus/sensor/ds1775.c optional ds1775 powermac +dev/iicbus/sensor/max6690.c optional max6690 powermac dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_opal.c optional powernv ipmi dev/ice/if_ice_iflib.c optional ice pci powerpc64 | ice pci powerpc64le \ diff --git a/sys/dev/iicbus/ds1631.c b/sys/dev/iicbus/sensor/ds1631.c similarity index 100% rename from sys/dev/iicbus/ds1631.c rename to sys/dev/iicbus/sensor/ds1631.c diff --git a/sys/dev/iicbus/ds1775.c b/sys/dev/iicbus/sensor/ds1775.c similarity index 100% rename from sys/dev/iicbus/ds1775.c rename to sys/dev/iicbus/sensor/ds1775.c diff --git a/sys/dev/iicbus/htu21.c b/sys/dev/iicbus/sensor/htu21.c similarity index 100% rename from sys/dev/iicbus/htu21.c rename to sys/dev/iicbus/sensor/htu21.c diff --git a/sys/dev/iicbus/lm75.c b/sys/dev/iicbus/sensor/lm75.c similarity index 100% rename from sys/dev/iicbus/lm75.c rename to sys/dev/iicbus/sensor/lm75.c diff --git a/sys/dev/iicbus/max44009.c b/sys/dev/iicbus/sensor/max44009.c similarity index 100% rename from sys/dev/iicbus/max44009.c rename to sys/dev/iicbus/sensor/max44009.c diff --git a/sys/dev/iicbus/max6690.c b/sys/dev/iicbus/sensor/max6690.c similarity index 100% rename from sys/dev/iicbus/max6690.c rename to sys/dev/iicbus/sensor/max6690.c diff --git a/sys/dev/iicbus/tmp461.c b/sys/dev/iicbus/sensor/tmp461.c similarity index 100% rename from sys/dev/iicbus/tmp461.c rename to sys/dev/iicbus/sensor/tmp461.c diff --git a/sys/modules/i2c/htu21/Makefile b/sys/modules/i2c/htu21/Makefile index a7108d62fd0b..e049139c20cf 100644 --- a/sys/modules/i2c/htu21/Makefile +++ b/sys/modules/i2c/htu21/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/sensor KMOD= htu21 SRCS= htu21.c diff --git a/sys/modules/i2c/max44009/Makefile b/sys/modules/i2c/max44009/Makefile index 42c96bbbf883..c4342b5819aa 100644 --- a/sys/modules/i2c/max44009/Makefile +++ b/sys/modules/i2c/max44009/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/sensor KMOD= max44009 SRCS= max44009.c diff --git a/sys/modules/i2c/tmp461/Makefile b/sys/modules/i2c/tmp461/Makefile index 4cd5be59fd18..9c4d6518d596 100644 --- a/sys/modules/i2c/tmp461/Makefile +++ b/sys/modules/i2c/tmp461/Makefile @@ -1,5 +1,5 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/sensor KMOD = tmp461 SRCS = tmp461.c bus_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h From nobody Tue Oct 3 07:56:40 2023 X-Original-To: dev-commits-src-main@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 4S09Bc6GBcz4vwVT; Tue, 3 Oct 2023 07:56:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09Bc5Rwfz3Sf1; Tue, 3 Oct 2023 07:56:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319800; 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=CAP96XLEzUZXBsOaFORxEDf3h+Mm5p9hplkC2Zf5hzA=; b=g+8Qz26T6biQayv5C+j3NrR6RJbRXwI8ZHxd0W8ap9fOdvTeX1oNYZCjzZJhBwkktFofHD dTMN+1CBg7opEsBbSPXyrpF22sn3bRWEUPYWq8lf2G+oVEZtzTgGCiAXCwLKI88YVxim2a wGckAoRhEiKcAtvWVO+MwdgTkQc0g1Ka3dYAuYu5WOcqhyzai6Zn7thS0pi09m141l+rH2 p1WAfg8H1M6zHphmqTqWEQ2sBrk8jcTqFgXyo0pawzPSpeKjcJ9mdPXbWKnibmUdOmc2KY ocrw1ec5gW2Pauy/3lwhSKsKzhR0e6KA0Hv3lh9nYDMSmraHNAmSpNOcgVlV1w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319800; a=rsa-sha256; cv=none; b=L7ZqKeRj7cWidrGuU+Hk6fZpsK+renmUE6fmbLHyisfP4L5/spE/vjj8i/EtaHjxjxiIWn pr76fGAA8cUh33BUouDjL24irGSACYKTcGmiujIcoyymb2X6OrGmG2+YjI0tnAhU0yZOkz CETBu/6XuzVFmwt6qO38JcePaogamhIYymNWU4qhSdGo1/rpjBEt07VQaDknpmt31FX6Yl 7B3Nen3zMKf4/RBvTcOT/0NBRqOvF2NUlQkflMwT53qgGijMNJQvrT+haek87uOc+OTc0G KBMOPh2gd4azrkkBv6je1WqP9sXy0vHGCssk+yBJiCKg4dI/fnkptSBusxskhw== 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=1696319800; 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=CAP96XLEzUZXBsOaFORxEDf3h+Mm5p9hplkC2Zf5hzA=; b=HQ+jAoN2Qwk/r4QcQgWqlYP0xoLbEY6S0Tt7fQC+KCqgT2c5sX/hgM1d/T3p67Or26N5Wa CfzYcMKUtUTwlGa1xk2NhPDJxpibt6tEkLej3CELGPt3vL1wpI0vF3XQc2Az0enZgQELxc F5/MmWfBOg4S9vbU3v4KUCcIhBmQbAktNqdFjkxGqonFXjWRjQ7cWDJrRzjDShx7Sv13xg JeX6Yi5uecAN3w5+/aWrXELU/Mdq19YzxtsVA0hVThkHYw9LaSe9GVxDceFsrsn3g13x2R eqocSBKtYjcgkMUIKHcRPBtgWOep23Nispd0zgyy8bPADcYTevXlS4BM1LWGaA== 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 4S09Bc4BkVzmtc; Tue, 3 Oct 2023 07:56:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937uehh035840; Tue, 3 Oct 2023 07:56:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937ueRv035837; Tue, 3 Oct 2023 07:56:40 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:40 GMT Message-Id: <202310030756.3937ueRv035837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 125f5c5b48b1 - main - iicbus: Move opencores i2c driver into controller subdirectory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 125f5c5b48b1fdccf364b821ce48bfdbd9687ed1 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=125f5c5b48b1fdccf364b821ce48bfdbd9687ed1 commit 125f5c5b48b1fdccf364b821ce48bfdbd9687ed1 Author: Emmanuel Vadot AuthorDate: 2023-09-19 10:06:32 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:20 +0000 iicbus: Move opencores i2c driver into controller subdirectory Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41914 --- sys/conf/files | 6 +++--- sys/dev/iicbus/{ => controller/opencores}/iicoc.c | 0 sys/dev/iicbus/{ => controller/opencores}/iicoc.h | 0 sys/dev/iicbus/{ => controller/opencores}/iicoc_fdt.c | 0 sys/dev/iicbus/{ => controller/opencores}/iicoc_pci.c | 0 sys/modules/i2c/controllers/iicoc/Makefile | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 36ba432cc93e..7701efbaac25 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1804,12 +1804,12 @@ dev/iicbus/iichid.c optional iichid acpi hid iicbus dev/iicbus/iiconf.c optional iicbus | compat_linuxkpi dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" -dev/iicbus/iicoc.c optional iicoc -dev/iicbus/iicoc_fdt.c optional iicoc fdt -dev/iicbus/iicoc_pci.c optional iicoc pci dev/iicbus/adc/ad7418.c optional ad7418 dev/iicbus/adc/ads111x.c optional ads111x dev/iicbus/adc/pcf8591.c optional pcf8591 +dev/iicbus/controller/opencores/iicoc.c optional iicoc +dev/iicbus/controller/opencores/iicoc_fdt.c optional iicoc fdt +dev/iicbus/controller/opencores/iicoc_pci.c optional iicoc pci dev/iicbus/mux/iicmux.c optional iicmux dev/iicbus/mux/iicmux_if.m optional iicmux dev/iicbus/mux/iic_gpiomux.c optional iic_gpiomux fdt diff --git a/sys/dev/iicbus/iicoc.c b/sys/dev/iicbus/controller/opencores/iicoc.c similarity index 100% rename from sys/dev/iicbus/iicoc.c rename to sys/dev/iicbus/controller/opencores/iicoc.c diff --git a/sys/dev/iicbus/iicoc.h b/sys/dev/iicbus/controller/opencores/iicoc.h similarity index 100% rename from sys/dev/iicbus/iicoc.h rename to sys/dev/iicbus/controller/opencores/iicoc.h diff --git a/sys/dev/iicbus/iicoc_fdt.c b/sys/dev/iicbus/controller/opencores/iicoc_fdt.c similarity index 100% rename from sys/dev/iicbus/iicoc_fdt.c rename to sys/dev/iicbus/controller/opencores/iicoc_fdt.c diff --git a/sys/dev/iicbus/iicoc_pci.c b/sys/dev/iicbus/controller/opencores/iicoc_pci.c similarity index 100% rename from sys/dev/iicbus/iicoc_pci.c rename to sys/dev/iicbus/controller/opencores/iicoc_pci.c diff --git a/sys/modules/i2c/controllers/iicoc/Makefile b/sys/modules/i2c/controllers/iicoc/Makefile index f6902f1f864a..f86a6513ad22 100644 --- a/sys/modules/i2c/controllers/iicoc/Makefile +++ b/sys/modules/i2c/controllers/iicoc/Makefile @@ -1,4 +1,4 @@ -.PATH: ${SRCTOP}/sys/dev/iicbus +.PATH: ${SRCTOP}/sys/dev/iicbus/controller/opencores KMOD = iicoc SRCS = device_if.h bus_if.h iicbus_if.h \ From nobody Tue Oct 3 07:56:41 2023 X-Original-To: dev-commits-src-main@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 4S09Bd6PYwz4vwSp; Tue, 3 Oct 2023 07:56:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09Bd65GHz3Snh; Tue, 3 Oct 2023 07:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319801; 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=B68nzKSTXApJ13p8kKqQ91mhgzeKi3kC3o5KHMaf8y4=; b=dXPauK5CQTGqpSRVK9dj6FJMqVbDwhbsmKfAeZID1zdfvedirrAmc0GFj8cgdlgx6QCSBK PHan5SL379sS97rOmd8hKcC20K+yotTn3cpEUqb2L2PnlwI5ROnTVxxkAgnonJtKrz1yoe dB2yCwjVYWBTXOEwA0+a8B7V9P0s2b1+SdgC9RbHZDYld4luOGvszSmv2r8cMEdmVYINOk nW2bKn19t5RhHG2kLuVmYjzHNAaNNR6h1cK5eLgzwNx9LqJKVaMCKrR7TkauGBySBjSC+/ R1xD41Lfs+D79xjRFTpmdQXqnlzWW2tJGVR4w0L/eNx4jlCxQGbmkv+kyx1xBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319801; a=rsa-sha256; cv=none; b=Wh7s+sZ+H2dfVfzH/dgYCeWBpkviRAy4dlsXHz2uO/NVVJKulby+YLVb3xIWKuoz3N1QF3 IFKUR3S9jqYxeWwmb1ljxwmQtsf/xvR/KrFFTd/gyGbHEYjn+htWypcpdinsnTnZLUG+YQ jqHXi3AQRZVFvokG9ajvXjYI+5KMZe4WxLg0c/C6bvKUkxHmBeLL8zmuE2KNUe8odFD9YW KVtXbf9HDAYs+QDxmQBsC7wqCyB2+H5hIqUxYJi/71HfFzsVofL2e/hF7pp9Q4yUUb6qq/ bnEMBAR1shxpFyph6RUk08sFoTXN/0kek/KMV0o/hWAQW/2YAOAsf7RCj8M4Eg== 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=1696319801; 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=B68nzKSTXApJ13p8kKqQ91mhgzeKi3kC3o5KHMaf8y4=; b=OVW30EPIIVkpevx8YdpuGlhY8iBuCYyRkdg/bpKRX6QmG77YWYn4mCnTLrInlbmRjSZv85 XF/w+/To9gOTJoh+v5XIh9cKmPvlfaHc/rzHynEcmtdY65Kslnri8jgOSpnGlRF7zvsTFy ynP/jNMFfrgDT1G19jsNLYDmHsWGGIbeupvii7gqAwVSDd1RQqWSlDb0GoereqV5XzBxJn XRvAJwZfoj0/UI5tOwRVSPUH719afZzijowc3Oba795ubL5Jn+XLK0Xu5HoBagikZP++U2 Nq/InAr+2J6Amjtvll8ycp/JTOs8DRPn2WSsy7uOckM/CdRhOFr5Kds2zcjiGw== 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 4S09Bd5Brczmfr; Tue, 3 Oct 2023 07:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937ufY0035882; Tue, 3 Oct 2023 07:56:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937ufvh035879; Tue, 3 Oct 2023 07:56:41 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:41 GMT Message-Id: <202310030756.3937ufvh035879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 137b58e4d204 - main - i2c: Add cadence iic driver List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 137b58e4d2044adc200d13c8989d3746a0a4bd7f Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=137b58e4d2044adc200d13c8989d3746a0a4bd7f commit 137b58e4d2044adc200d13c8989d3746a0a4bd7f Author: Emmanuel Vadot AuthorDate: 2023-09-27 05:34:38 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:20 +0000 i2c: Add cadence iic driver This IP is found in Xilinx SoC, it only been tested on ZynqMP (arm64) so only enable it there for now. Differential Revision: https://reviews.freebsd.org/D41994 --- sys/arm64/conf/std.xilinx | 3 + sys/conf/files.arm64 | 1 + sys/dev/iicbus/controller/cadence/cdnc_i2c.c | 707 +++++++++++++++++++++++++++ 3 files changed, 711 insertions(+) diff --git a/sys/arm64/conf/std.xilinx b/sys/arm64/conf/std.xilinx index cc89e8575336..50ebf5ade53b 100644 --- a/sys/arm64/conf/std.xilinx +++ b/sys/arm64/conf/std.xilinx @@ -16,4 +16,7 @@ device cgem # Cadence GEM Gigabit Ethernet device # MMC/SD/SDIO Card slot support device sdhci +# IICBUS +device cdnc_i2c + options FDT diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index d8adc54763fc..baf8734fb38f 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -696,6 +696,7 @@ arm64/rockchip/clk/rk3568_pmucru.c optional fdt soc_rockchip_rk3568 # Xilinx arm/xilinx/uart_dev_cdnc.c optional uart soc_xilinx_zynq fdt arm/xilinx/zy7_gpio.c optional gpio soc_xilinx_zynq fdt +dev/iicbus/controller/cadence/cdnc_i2c.c optional cdnc_i2c iicbus soc_xilinx_zynq fdt dev/usb/controller/xlnx_dwc3.c optional xhci soc_xilinx_zynq fdt dev/firmware/xilinx/zynqmp_firmware.c optional fdt soc_xilinx_zynq dev/firmware/xilinx/zynqmp_firmware_if.m optional fdt soc_xilinx_zynq diff --git a/sys/dev/iicbus/controller/cadence/cdnc_i2c.c b/sys/dev/iicbus/controller/cadence/cdnc_i2c.c new file mode 100644 index 000000000000..dd525071caa2 --- /dev/null +++ b/sys/dev/iicbus/controller/cadence/cdnc_i2c.c @@ -0,0 +1,707 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019-2020 Thomas Skibo + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Cadence / Zynq i2c driver. + * + * Reference: Zynq-7000 All Programmable SoC Technical Reference Manual. + * (v1.12.2) July 1, 2018. Xilinx doc UG585. I2C Controller is documented + * in Chapter 20. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include "iicbus_if.h" + +#ifdef I2CDEBUG +#define DPRINTF(...) do { printf(__VA_ARGS__); } while (0) +#else +#define DPRINTF(...) do { } while (0) +#endif + +#if 0 +#define HWTYPE_CDNS_R1P10 1 +#endif +#define HWTYPE_CDNS_R1P14 2 + +static struct ofw_compat_data compat_data[] = { +#if 0 + {"cdns,i2c-r1p10", HWTYPE_CDNS_R1P10}, +#endif + {"cdns,i2c-r1p14", HWTYPE_CDNS_R1P14}, + {NULL, 0} +}; + +struct cdnc_i2c_softc { + device_t dev; + device_t iicbus; + struct mtx sc_mtx; + struct resource *mem_res; + struct resource *irq_res; + void *intrhandle; + + uint16_t cfg_reg_shadow; + uint16_t istat; + clk_t ref_clk; + uint32_t ref_clock_freq; + uint32_t i2c_clock_freq; + + int hwtype; + int hold; + + /* sysctls */ + unsigned int i2c_clk_real_freq; + unsigned int interrupts; + unsigned int timeout_ints; +}; + +#define I2C_SC_LOCK(sc) mtx_lock(&(sc)->sc_mtx) +#define I2C_SC_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) +#define I2C_SC_LOCK_INIT(sc) \ + mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), NULL, MTX_DEF) +#define I2C_SC_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) +#define I2C_SC_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) + +#define RD2(sc, off) (bus_read_2((sc)->mem_res, (off))) +#define WR2(sc, off, val) (bus_write_2((sc)->mem_res, (off), (val))) +#define RD1(sc, off) (bus_read_1((sc)->mem_res, (off))) +#define WR1(sc, off, val) (bus_write_1((sc)->mem_res, (off), (val))) + +/* Cadence I2C controller device registers. */ +#define CDNC_I2C_CR 0x0000 /* Config register. */ +#define CDNC_I2C_CR_DIV_A_MASK (3 << 14) +#define CDNC_I2C_CR_DIV_A_SHIFT 14 +#define CDNC_I2C_CR_DIV_A(a) ((a) << 14) +#define CDNC_I2C_CR_DIV_A_MAX 3 +#define CDNC_I2C_CR_DIV_B_MASK (0x3f << 8) +#define CDNC_I2C_CR_DIV_B_SHIFT 8 +#define CDNC_I2C_CR_DIV_B(b) ((b) << 8) +#define CDNC_I2C_CR_DIV_B_MAX 63 +#define CDNC_I2C_CR_CLR_FIFO (1 << 6) +#define CDNC_I2C_CR_SLVMON_MODE (1 << 5) +#define CDNC_I2C_CR_HOLD (1 << 4) +#define CDNC_I2C_CR_ACKEN (1 << 3) +#define CDNC_I2C_CR_NEA (1 << 2) +#define CDNC_I2C_CR_MAST (1 << 1) +#define CDNC_I2C_CR_RNW (1 << 0) + +#define CDNC_I2C_SR 0x0004 /* Status register. */ +#define CDNC_I2C_SR_BUS_ACTIVE (1 << 8) +#define CDNC_I2C_SR_RX_OVF (1 << 7) +#define CDNC_I2C_SR_TX_VALID (1 << 6) +#define CDNC_I2C_SR_RX_VALID (1 << 5) +#define CDNC_I2C_SR_RXRW (1 << 3) + +#define CDNC_I2C_ADDR 0x0008 /* i2c address register. */ +#define CDNC_I2C_DATA 0x000C /* i2c data register. */ + +#define CDNC_I2C_ISR 0x0010 /* Int status register. */ +#define CDNC_I2C_ISR_ARB_LOST (1 << 9) +#define CDNC_I2C_ISR_RX_UNDF (1 << 7) +#define CDNC_I2C_ISR_TX_OVF (1 << 6) +#define CDNC_I2C_ISR_RX_OVF (1 << 5) +#define CDNC_I2C_ISR_SLV_RDY (1 << 4) +#define CDNC_I2C_ISR_XFER_TMOUT (1 << 3) +#define CDNC_I2C_ISR_XFER_NACK (1 << 2) +#define CDNC_I2C_ISR_XFER_DATA (1 << 1) +#define CDNC_I2C_ISR_XFER_DONE (1 << 0) +#define CDNC_I2C_ISR_ALL 0x2ff +#define CDNC_I2C_TRANS_SIZE 0x0014 /* Transfer size. */ +#define CDNC_I2C_PAUSE 0x0018 /* Slv Monitor Pause reg. */ +#define CDNC_I2C_TIME_OUT 0x001C /* Time-out register. */ +#define CDNC_I2C_TIME_OUT_MIN 31 +#define CDNC_I2C_TIME_OUT_MAX 255 +#define CDNC_I2C_IMR 0x0020 /* Int mask register. */ +#define CDNC_I2C_IER 0x0024 /* Int enable register. */ +#define CDNC_I2C_IDR 0x0028 /* Int disable register. */ + +#define CDNC_I2C_FIFO_SIZE 16 +#define CDNC_I2C_DEFAULT_I2C_CLOCK 400000 /* 400Khz default */ + +#define CDNC_I2C_ISR_ERRS (CDNC_I2C_ISR_ARB_LOST | CDNC_I2C_ISR_RX_UNDF | \ + CDNC_I2C_ISR_TX_OVF | CDNC_I2C_ISR_RX_OVF | CDNC_I2C_ISR_XFER_TMOUT | \ + CDNC_I2C_ISR_XFER_NACK) + +/* Configure clock dividers. */ +static int +cdnc_i2c_set_freq(struct cdnc_i2c_softc *sc) +{ + uint32_t div_a, div_b, err, clk_out; + uint32_t best_div_a, best_div_b, best_err; + + best_div_a = 0; + best_div_b = 0; + best_err = ~0U; + + /* + * The i2c controller has a two-stage clock divider to create + * the "clock enable" signal used to sample the incoming SCL and + * SDA signals. The Clock Enable signal is divided by 22 to create + * the outgoing SCL signal. + * + * Try all div_a values and pick best match. + */ + for (div_a = 0; div_a <= CDNC_I2C_CR_DIV_A_MAX; div_a++) { + div_b = sc->ref_clock_freq / (22 * sc->i2c_clock_freq * + (div_a + 1)); + if (div_b > CDNC_I2C_CR_DIV_B_MAX) + continue; + clk_out = sc->ref_clock_freq / (22 * (div_a + 1) * + (div_b + 1)); + err = clk_out > sc->i2c_clock_freq ? + clk_out - sc->i2c_clock_freq : + sc->i2c_clock_freq - clk_out; + if (err < best_err) { + best_err = err; + best_div_a = div_a; + best_div_b = div_b; + } + } + + if (best_err == ~0U) { + device_printf(sc->dev, "cannot configure clock divider.\n"); + return (EINVAL); /* out of range */ + } + + clk_out = sc->ref_clock_freq / (22 * (best_div_a + 1) * + (best_div_b + 1)); + + DPRINTF("%s: ref_clock_freq=%d i2c_clock_freq=%d\n", __func__, + sc->ref_clock_freq, sc->i2c_clock_freq); + DPRINTF("%s: div_a=%d div_b=%d real-freq=%d\n", __func__, best_div_a, + best_div_b, clk_out); + + sc->cfg_reg_shadow &= ~(CDNC_I2C_CR_DIV_A_MASK | + CDNC_I2C_CR_DIV_B_MASK); + sc->cfg_reg_shadow |= CDNC_I2C_CR_DIV_A(best_div_a) | + CDNC_I2C_CR_DIV_B(best_div_b); + WR2(sc, CDNC_I2C_CR, sc->cfg_reg_shadow); + + sc->i2c_clk_real_freq = clk_out; + + return (0); +} + +/* Initialize hardware. */ +static int +cdnc_i2c_init_hw(struct cdnc_i2c_softc *sc) +{ + + /* Reset config register and clear FIFO. */ + sc->cfg_reg_shadow = 0; + WR2(sc, CDNC_I2C_CR, CDNC_I2C_CR_CLR_FIFO); + sc->hold = 0; + + /* Clear and disable all interrupts. */ + WR2(sc, CDNC_I2C_ISR, CDNC_I2C_ISR_ALL); + WR2(sc, CDNC_I2C_IDR, CDNC_I2C_ISR_ALL); + + /* Max out bogus time-out register. */ + WR1(sc, CDNC_I2C_TIME_OUT, CDNC_I2C_TIME_OUT_MAX); + + /* Set up clock dividers. */ + return (cdnc_i2c_set_freq(sc)); +} + +static int +cdnc_i2c_errs(struct cdnc_i2c_softc *sc, uint16_t istat) +{ + + DPRINTF("%s: istat=0x%x\n", __func__, istat); + + /* XXX: clean up after errors. */ + + /* Reset config register and clear FIFO. */ + sc->cfg_reg_shadow &= CDNC_I2C_CR_DIV_A_MASK | CDNC_I2C_CR_DIV_B_MASK; + WR2(sc, CDNC_I2C_CR, sc->cfg_reg_shadow | CDNC_I2C_CR_CLR_FIFO); + sc->hold = 0; + + if (istat & CDNC_I2C_ISR_XFER_TMOUT) + return (IIC_ETIMEOUT); + else if (istat & CDNC_I2C_ISR_RX_UNDF) + return (IIC_EUNDERFLOW); + else if (istat & (CDNC_I2C_ISR_RX_OVF | CDNC_I2C_ISR_TX_OVF)) + return (IIC_EOVERFLOW); + else if (istat & CDNC_I2C_ISR_XFER_NACK) + return (IIC_ENOACK); + else if (istat & CDNC_I2C_ISR_ARB_LOST) + return (IIC_EBUSERR); /* XXX: ???? */ + else + /* Should not happen */ + return (IIC_NOERR); +} + +static int +cdnc_i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +{ + struct cdnc_i2c_softc *sc = device_get_softc(dev); + int error; + + DPRINTF("%s: speed=%d addr=0x%x\n", __func__, speed, addr); + + I2C_SC_LOCK(sc); + + sc->i2c_clock_freq = IICBUS_GET_FREQUENCY(sc->iicbus, speed); + + error = cdnc_i2c_init_hw(sc); + + I2C_SC_UNLOCK(sc); + + return (error ? IIC_ENOTSUPP : IIC_NOERR); +} + +static void +cdnc_i2c_intr(void *arg) +{ + struct cdnc_i2c_softc *sc = (struct cdnc_i2c_softc *)arg; + uint16_t status; + + I2C_SC_LOCK(sc); + + sc->interrupts++; + + /* Read active interrupts. */ + status = RD2(sc, CDNC_I2C_ISR) & ~RD2(sc, CDNC_I2C_IMR); + + /* Clear interrupts. */ + WR2(sc, CDNC_I2C_ISR, status); + + if (status & CDNC_I2C_ISR_XFER_TMOUT) + sc->timeout_ints++; + + sc->istat |= status; + + if (status) + wakeup(sc); + + I2C_SC_UNLOCK(sc); +} + +static int +cdnc_i2c_xfer_rd(struct cdnc_i2c_softc *sc, struct iic_msg *msg) +{ + int error = IIC_NOERR; + uint16_t flags = msg->flags; + uint16_t len = msg->len; + int idx = 0, nbytes, last, first = 1; + uint16_t statr; + + DPRINTF("%s: flags=0x%x len=%d\n", __func__, flags, len); + +#if 0 + if (sc->hwtype == HWTYPE_CDNS_R1P10 && (flags & IIC_M_NOSTOP)) + return (IIC_ENOTSUPP); +#endif + + I2C_SC_ASSERT_LOCKED(sc); + + /* Program config register. */ + sc->cfg_reg_shadow &= CDNC_I2C_CR_DIV_A_MASK | CDNC_I2C_CR_DIV_B_MASK; + sc->cfg_reg_shadow |= CDNC_I2C_CR_HOLD | CDNC_I2C_CR_ACKEN | + CDNC_I2C_CR_NEA | CDNC_I2C_CR_MAST | CDNC_I2C_CR_RNW; + WR2(sc, CDNC_I2C_CR, sc->cfg_reg_shadow | CDNC_I2C_CR_CLR_FIFO); + sc->hold = 1; + + while (len > 0) { + nbytes = MIN(CDNC_I2C_FIFO_SIZE - 2, len); + WR1(sc, CDNC_I2C_TRANS_SIZE, nbytes); + + last = nbytes == len && !(flags & IIC_M_NOSTOP); + if (last) { + /* Clear HOLD bit on last transfer. */ + sc->cfg_reg_shadow &= ~CDNC_I2C_CR_HOLD; + WR2(sc, CDNC_I2C_CR, sc->cfg_reg_shadow); + sc->hold = 0; + } + + /* Writing slv address for a start or repeated start. */ + if (first && !(flags & IIC_M_NOSTART)) + WR2(sc, CDNC_I2C_ADDR, msg->slave >> 1); + first = 0; + + /* Enable FIFO interrupts and wait. */ + if (last) + WR2(sc, CDNC_I2C_IER, CDNC_I2C_ISR_XFER_DONE | + CDNC_I2C_ISR_ERRS); + else + WR2(sc, CDNC_I2C_IER, CDNC_I2C_ISR_XFER_DATA | + CDNC_I2C_ISR_ERRS); + + error = mtx_sleep(sc, &sc->sc_mtx, 0, "cdi2c", hz); + + /* Disable FIFO interrupts. */ + WR2(sc, CDNC_I2C_IDR, CDNC_I2C_ISR_XFER_DATA | + CDNC_I2C_ISR_XFER_DONE | CDNC_I2C_ISR_ERRS); + + if (error == EWOULDBLOCK) + error = cdnc_i2c_errs(sc, CDNC_I2C_ISR_XFER_TMOUT); + else if (sc->istat & CDNC_I2C_ISR_ERRS) + error = cdnc_i2c_errs(sc, sc->istat); + sc->istat = 0; + + if (error != IIC_NOERR) + break; + + /* Read nbytes from FIFO. */ + while (nbytes-- > 0) { + statr = RD2(sc, CDNC_I2C_SR); + if (!(statr & CDNC_I2C_SR_RX_VALID)) { + printf("%s: RX FIFO underflow?\n", __func__); + break; + } + msg->buf[idx++] = RD2(sc, CDNC_I2C_DATA); + len--; + } + } + + return (error); +} + +static int +cdnc_i2c_xfer_wr(struct cdnc_i2c_softc *sc, struct iic_msg *msg) +{ + int error = IIC_NOERR; + uint16_t flags = msg->flags; + uint16_t len = msg->len; + int idx = 0, nbytes, last, first = 1; + + DPRINTF("%s: flags=0x%x len=%d\n", __func__, flags, len); + + I2C_SC_ASSERT_LOCKED(sc); + + /* Program config register. */ + sc->cfg_reg_shadow &= CDNC_I2C_CR_DIV_A_MASK | CDNC_I2C_CR_DIV_B_MASK; + sc->cfg_reg_shadow |= CDNC_I2C_CR_HOLD | CDNC_I2C_CR_ACKEN | + CDNC_I2C_CR_NEA | CDNC_I2C_CR_MAST; + WR2(sc, CDNC_I2C_CR, sc->cfg_reg_shadow | CDNC_I2C_CR_CLR_FIFO); + sc->hold = 1; + + while (len > 0) { + /* Put as much data into fifo as you can. */ + nbytes = MIN(len, CDNC_I2C_FIFO_SIZE - + RD1(sc, CDNC_I2C_TRANS_SIZE) - 1); + len -= nbytes; + while (nbytes-- > 0) + WR2(sc, CDNC_I2C_DATA, msg->buf[idx++]); + + last = len == 0 && !(flags & IIC_M_NOSTOP); + if (last) { + /* Clear HOLD bit on last transfer. */ + sc->cfg_reg_shadow &= ~CDNC_I2C_CR_HOLD; + WR2(sc, CDNC_I2C_CR, sc->cfg_reg_shadow); + sc->hold = 0; + } + + /* Perform START if this is start or repeated start. */ + if (first && !(flags & IIC_M_NOSTART)) + WR2(sc, CDNC_I2C_ADDR, msg->slave >> 1); + first = 0; + + /* Enable FIFO interrupts. */ + WR2(sc, CDNC_I2C_IER, CDNC_I2C_ISR_XFER_DONE | + CDNC_I2C_ISR_ERRS); + + /* Wait for end of data transfer. */ + error = mtx_sleep(sc, &sc->sc_mtx, 0, "cdi2c", hz); + + /* Disable FIFO interrupts. */ + WR2(sc, CDNC_I2C_IDR, CDNC_I2C_ISR_XFER_DONE | + CDNC_I2C_ISR_ERRS); + + if (error == EWOULDBLOCK) + error = cdnc_i2c_errs(sc, CDNC_I2C_ISR_XFER_TMOUT); + else if (sc->istat & CDNC_I2C_ISR_ERRS) + error = cdnc_i2c_errs(sc, sc->istat); + sc->istat = 0; + if (error) + break; + } + + return (error); +} + +static int +cdnc_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) +{ + struct cdnc_i2c_softc *sc = device_get_softc(dev); + int i, error = IIC_NOERR; + + DPRINTF("%s: nmsgs=%d\n", __func__, nmsgs); + + I2C_SC_LOCK(sc); + + for (i = 0; i < nmsgs; i++) { + DPRINTF("%s: msg[%d]: hold=%d slv=0x%x flags=0x%x len=%d\n", + __func__, i, sc->hold, msgs[i].slave, msgs[i].flags, + msgs[i].len); + + if (!sc->hold && (msgs[i].flags & IIC_M_NOSTART)) + return (IIC_ENOTSUPP); + + if (msgs[i].flags & IIC_M_RD) { + error = cdnc_i2c_xfer_rd(sc, &msgs[i]); + if (error != IIC_NOERR) + break; + } else { + error = cdnc_i2c_xfer_wr(sc, &msgs[i]); + if (error != IIC_NOERR) + break; + } + } + + I2C_SC_UNLOCK(sc); + + return (error); +} + +static void +cdnc_i2c_add_sysctls(device_t dev) +{ + struct cdnc_i2c_softc *sc = device_get_softc(dev); + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child; + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "i2c_clk_real_freq", CTLFLAG_RD, + &sc->i2c_clk_real_freq, 0, "i2c clock real frequency"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_interrupts", CTLFLAG_RD, + &sc->interrupts, 0, "interrupt calls"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_timeouts", CTLFLAG_RD, + &sc->timeout_ints, 0, "hardware timeout interrupts"); +} + + +static int +cdnc_i2c_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Cadence I2C Controller"); + + return (BUS_PROBE_DEFAULT); +} + + +static int cdnc_i2c_detach(device_t); + +static int +cdnc_i2c_attach(device_t dev) +{ + struct cdnc_i2c_softc *sc; + int rid, err; + phandle_t node; + pcell_t cell; + uint64_t freq; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + + I2C_SC_LOCK_INIT(sc); + + /* Get ref-clock and i2c-clock properties. */ + node = ofw_bus_get_node(dev); + if (OF_getprop(node, "ref-clock", &cell, sizeof(cell)) > 0) + sc->ref_clock_freq = fdt32_to_cpu(cell); + else if (clk_get_by_ofw_index(dev, node, 0, &sc->ref_clk) == 0) { + if ((err = clk_enable(sc->ref_clk)) != 0) + device_printf(dev, "Cannot enable clock. err=%d\n", + err); + else if ((err = clk_get_freq(sc->ref_clk, &freq)) != 0) + device_printf(dev, + "Cannot get clock frequency. err=%d\n", err); + else + sc->ref_clock_freq = freq; + } + else { + device_printf(dev, "must have ref-clock property\n"); + return (ENXIO); + } + if (OF_getprop(node, "clock-frequency", &cell, sizeof(cell)) > 0) + sc->i2c_clock_freq = fdt32_to_cpu(cell); + else + sc->i2c_clock_freq = CDNC_I2C_DEFAULT_I2C_CLOCK; + + /* Get memory resource. */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "could not allocate memory resources.\n"); + cdnc_i2c_detach(dev); + return (ENOMEM); + } + + /* Allocate IRQ. */ + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "could not allocate IRQ resource.\n"); + cdnc_i2c_detach(dev); + return (ENOMEM); + } + + /* Activate the interrupt. */ + err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, cdnc_i2c_intr, sc, &sc->intrhandle); + if (err) { + device_printf(dev, "could not setup IRQ.\n"); + cdnc_i2c_detach(dev); + return (err); + } + + /* Configure the device. */ + err = cdnc_i2c_init_hw(sc); + if (err) { + cdnc_i2c_detach(dev); + return (err); + } + + sc->iicbus = device_add_child(dev, "iicbus", -1); + + cdnc_i2c_add_sysctls(dev); + + /* Probe and attach iicbus when interrupts work. */ + return (bus_delayed_attach_children(dev)); +} + +static int +cdnc_i2c_detach(device_t dev) +{ + struct cdnc_i2c_softc *sc = device_get_softc(dev); + + if (device_is_attached(dev)) + bus_generic_detach(dev); + + if (sc->ref_clk != NULL) { + clk_release(sc->ref_clk); + sc->ref_clk = NULL; + } + + /* Delete iic bus. */ + if (sc->iicbus) + device_delete_child(dev, sc->iicbus); + + /* Disable hardware. */ + if (sc->mem_res != NULL) { + sc->cfg_reg_shadow = 0; + WR2(sc, CDNC_I2C_CR, CDNC_I2C_CR_CLR_FIFO); + + /* Clear and disable all interrupts. */ + WR2(sc, CDNC_I2C_ISR, CDNC_I2C_ISR_ALL); + WR2(sc, CDNC_I2C_IDR, CDNC_I2C_ISR_ALL); + } + + /* Teardown and release interrupt. */ + if (sc->irq_res != NULL) { + if (sc->intrhandle) + bus_teardown_intr(dev, sc->irq_res, sc->intrhandle); + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->irq_res), sc->irq_res); + sc->irq_res = NULL; + } + + /* Release memory resource. */ + if (sc->mem_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem_res), sc->mem_res); + sc->mem_res = NULL; + } + + I2C_SC_LOCK_DESTROY(sc); + + return (0); +} + + +static phandle_t +cdnc_i2c_get_node(device_t bus, device_t dev) +{ + + return (ofw_bus_get_node(bus)); +} + +static device_method_t cdnc_i2c_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, cdnc_i2c_probe), + DEVMETHOD(device_attach, cdnc_i2c_attach), + DEVMETHOD(device_detach, cdnc_i2c_detach), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, cdnc_i2c_get_node), + + /* iicbus methods */ + DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_reset, cdnc_i2c_reset), + DEVMETHOD(iicbus_transfer, cdnc_i2c_transfer), + + DEVMETHOD_END +}; + +static driver_t cdnc_i2c_driver = { + "cdnc_i2c", + cdnc_i2c_methods, + sizeof(struct cdnc_i2c_softc), +}; + +DRIVER_MODULE(cdnc_i2c, simplebus, cdnc_i2c_driver, NULL, NULL); +DRIVER_MODULE(ofw_iicbus, cdnc_i2c, ofw_iicbus_driver, NULL, NULL); +MODULE_DEPEND(cdnc_i2c, iicbus, 1, 1, 1); +MODULE_DEPEND(cdnc_i2c, ofw_iicbus, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); From nobody Tue Oct 3 07:56:42 2023 X-Original-To: dev-commits-src-main@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 4S09Bg0nTcz4vwY0; Tue, 3 Oct 2023 07:56:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09Bf6dHZz3Snt; Tue, 3 Oct 2023 07:56:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696319802; 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=i/tRPd02dgEIVtssDy/s3l6tcRW2zQfdtRGDIU+YdbM=; b=n1ss1dINS2vHG1/+S1Wt7VWpebkFAKWGNRT9LasDCffgFfFU3SoBRYA1esFmLevrmdxWb8 CfahC+okp4eMKvOFKVrhj+BH9GXdMpbweVVdO3aaef0II2tUlQZidFIDi1pFkArxvZot+4 P1NY2qIlg6duDJgooS7Sa8CqHp88/1ZUPmzxeDPP3ojeKTW21fS+TRq7TlZBxeX+fAVNdO o8zyAQ3qytT8MQXUIhjd+YwypQuJeL/U3iuKId/GMU9zK4jzOdm2EBKz2y1DcoJOeUfb/r xtaht33Hf2FsjLTHR75LNtiTXZdlICreeg5AyQtDvYgLmtY/m5w40Pf3U9xHBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696319802; a=rsa-sha256; cv=none; b=X6T1v0sW5soMeEXZ63YtCUANe4K0xJtcEvyx1PgaGNMZJ6mg+D+xsBeQoz1FfGo49NVdh5 U0b+jH6LjwJmQS5fbigZxF8YA++/fRPlWOjNKvg+a3PI1/q3P3VHwt2Fk86eiAPSbvsTWi UtWKscDzlYFSFDSF0UjvPxnIdsx4Y/pJ4EQW8Jy6mXsdiC93+sZpmyhB3uLRaP6I6C+G38 nwCljbBCZ8OEKkAHGn6Q/K/aL7N7SxrOlrurdMkkJLpDhitf38hd3M3FYGUsQIRX56STH8 8EQhb7gxU59aOpa8zV/vu/lBvwAfYO/DJujXbT2q94cf08zdiuMyfhCSr9XxxA== 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=1696319802; 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=i/tRPd02dgEIVtssDy/s3l6tcRW2zQfdtRGDIU+YdbM=; b=SATvkflyhDaW4NL21k3R3CEDe17n6HocU+7uWP1hjKLA2eKlekk8FzQ19vWvz9wKfHUqnM C7oUAc6MiLAopivOIPGLjNsiytS9zJ6ClZ/IzEgeXEq99LCHsTvBZAhG2v9RNwpOk386+A QRd1vbeOxsjuBMKfhSRQn2sJ7VMClV8+dlWSAWCSzZvmHXArp3ktTQjfjROATDQPzwLr07 fk/w7H1Tquzo+pvEhFJQjIRPaNyQO0JYXcJ+k3FIQpYCJYXjj/XX1JmQSJHu6x8jtCw6EJ lVryrW/++LmgAzi8nNpWPk8e6CA+sdG6clYHp/jZ1vhH6veZp04DEC0NTGNP5g== 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 4S09Bf5jk0zn49; Tue, 3 Oct 2023 07:56:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3937ugRB035929; Tue, 3 Oct 2023 07:56:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3937ugOX035926; Tue, 3 Oct 2023 07:56:42 GMT (envelope-from git) Date: Tue, 3 Oct 2023 07:56:42 GMT Message-Id: <202310030756.3937ugOX035926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 1d6a6a524409 - main - i2c: Add Microcrystal RV3032 RTC driver List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d6a6a524409662992ca96bc91ae69b2a2a5ff35 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=1d6a6a524409662992ca96bc91ae69b2a2a5ff35 commit 1d6a6a524409662992ca96bc91ae69b2a2a5ff35 Author: Emmanuel Vadot AuthorDate: 2023-09-27 07:58:52 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-03 07:56:20 +0000 i2c: Add Microcrystal RV3032 RTC driver This is a simple RTC driver for the rv3032 from Microcrystal. Just the basic functionality is implemented (no timer, alarm etc ..). Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D41995 --- sys/conf/files | 1 + sys/dev/iicbus/rtc/rv3032.c | 455 ++++++++++++++++++++++++++++++++++++++++ sys/modules/i2c/Makefile | 3 +- sys/modules/i2c/rv3032/Makefile | 13 ++ 4 files changed, 471 insertions(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index 7701efbaac25..5d5e8f30347c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1825,6 +1825,7 @@ dev/iicbus/rtc/isl12xx.c optional isl12xx dev/iicbus/rtc/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/rtc/pcf85063.c optional pcf85063 iicbus fdt dev/iicbus/rtc/rtc8583.c optional rtc8583 +dev/iicbus/rtc/rv3032.c optional rv3032 iicbus fdt dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt dev/iicbus/rtc/s35390a.c optional s35390a dev/iicbus/sensor/htu21.c optional htu21 diff --git a/sys/dev/iicbus/rtc/rv3032.c b/sys/dev/iicbus/rtc/rv3032.c new file mode 100644 index 000000000000..67805dcb7939 --- /dev/null +++ b/sys/dev/iicbus/rtc/rv3032.c @@ -0,0 +1,455 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Beckhoff Automation GmbH & Co. KG + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "clock_if.h" +#include "iicbus_if.h" + +/* Date registers */ +#define RV3032_SECS_100TH 0x00 +#define RV3032_SECS 0x01 +#define RV3032_MINS 0x02 +#define RV3032_HOURS 0x03 +#define RV3032_WEEKDAY 0x04 +#define RV3032_DATE 0x05 +#define RV3032_MONTH 0x06 +#define RV3032_YEAR 0x07 + +/* Alarm registers */ +#define RV3032_ALARM_MINUTES 0x08 +#define RV3032_ALARM_HOURS 0x09 +#define RV3032_ALARM_DATE 0x0A + +/* Periodic countdown timer registers */ +#define RV3032_TIMER_VALUE0 0x0B +#define RV3032_TIMER_VALUE1 0x0C + +/* Status register */ +#define RV3032_STATUS 0x0D +#define RV3032_STATUS_VLF (1 << 0) /* Voltage Low Flag */ +#define RV3032_STATUS_PORF (1 << 1) /* Power On Reset Flag */ +#define RV3032_STATUS_EVF (1 << 2) /* External eVent Flag */ +#define RV3032_STATUS_AF (1 << 3) /* Alarm Flag */ +#define RV3032_STATUS_TF (1 << 4) /* periodic countdown Timer Flag */ +#define RV3032_STATUS_UF (1 << 5) /* periodic time Update Flag */ +#define RV3032_STATUS_TLF (1 << 6) /* Temperature Low Flag */ +#define RV3032_STATUS_THF (1 << 7) /* Temperature High Flag */ + +/* Temperature registers */ +#define RV3032_TEMP_LSB 0x0E +#define RV3032_TEMP_LSB_BSF (1 << 0) +#define RV3032_TEMP_LSB_CLKF (1 << 1) +#define RV3032_TEMP_LSB_EEBUSY (1 << 2) +#define RV3032_TEMP_LSB_EEF (1 << 3) +#define RV3032_TEMP_LSB_MASK (0xF0) +#define RV3032_TEMP_LSB_SHIFT 4 + +#define RV3032_TEMP_MSB 0x0F + +#define TEMP_DIV 16 +#define TEMP_C_TO_K 273 + +/* Control registers */ +#define RV3032_CTRL1 0x10 +#define RV3032_CTRL1_TD_MASK 0x3 /* Timer clock frequency */ +#define RV3032_CTRL1_TD_SHIFT 0 +#define RV3032_CTRL1_TD_4096 0 +#define RV3032_CTRL1_TD_64 1 +#define RV3032_CTRL1_TD_1 2 +#define RV3032_CTRL1_TD_1_60 3 +#define RV3032_CTRL1_EERD (1 << 2) /* EEPROM memory refresh disable bit */ +#define RV3032_CTRL1_TE (1 << 3) /* Periodic countdown timer enable bit */ +#define RV3032_CTRL1_USEL (1 << 4) /* Update interrupt select bit */ +#define RV3032_CTRL1_GP0 (1 << 5) /* General Purpose bit 0 */ + +#define RV3032_CTRL2 0x11 +#define RV3032_CTRL2_STOP (1 << 0) /* Stop bit */ +#define RV3032_CTRL2_GP1 (1 << 1) /* General Purpose bit 1 */ +#define RV3032_CTRL2_EIE (1 << 2) /* External event interrupt enable bit */ +#define RV3032_CTRL2_AIE (1 << 3) /* Alarm interrupt enable bit */ +#define RV3032_CTRL2_TIE (1 << 4) /* Periodic countdown timer interrupt enable bit */ +#define RV3032_CTRL2_UIE (1 << 5) /* Periodic time update interrupt enable bit */ +#define RV3032_CTRL2_CLKIE (1 << 6) /* Interrupt Controlled Clock Output Enable bit */ +#define RV3032_CTRL3 0x12 +#define RV3032_CTRL3_TLIE (1 << 0) /* Temperature Low Interrupt Enable bit */ +#define RV3032_CTRL3_THIE (1 << 1) /* Temperature High Interrupt Enable bit */ +#define RV3032_CTRL3_TLE (1 << 2) /* Temperature Low Enable bit */ +#define RV3032_CTRL3_THE (1 << 3) /* Temperature High Enable bit */ +#define RV3032_CTRL3_BSIE (1 << 4) /* Backup Switchover Interrupt Enable bit */ + +/* EEPROM registers */ +#define RV3032_EEPROM_ADDRESS 0x3D +#define RV3032_EEPROM_DATA 0x3E +#define RV3032_EEPROM_COMMAND 0x3F +#define RV3032_EEPROM_CMD_UPDATE 0x11 +#define RV3032_EEPROM_CMD_REFRESH 0x12 +#define RV3032_EEPROM_CMD_WRITE_ONE 0x21 +#define RV3032_EEPROM_CMD_READ_ONE 0x22 + +/* PMU register */ +#define RV3032_EEPROM_PMU 0xC0 +#define RV3032_PMU_TCM_MASK 0x3 +#define RV3032_PMU_TCM_SHIFT 0 +#define RV3032_PMU_TCM_OFF 0 +#define RV3032_PMU_TCM_175V 1 +#define RV3032_PMU_TCM_30V 2 +#define RV3032_PMU_TCM_45V 3 +#define RV3032_PMU_TCR_MASK 0x3 +#define RV3032_PMU_TCR_SHIFT 2 +#define RV3032_PMU_TCR_06K 0 +#define RV3032_PMU_TCR_2K 1 +#define RV3032_PMU_TCR_7K 2 +#define RV3032_PMU_TCR_12K 3 +#define RV3032_PMU_BSM_MASK 0x3 +#define RV3032_PMU_BSM_SHIFT 4 +#define RV3032_PMU_BSM_OFF 0 +#define RV3032_PMU_BSM_DSM 1 +#define RV3032_PMU_BSM_LSM 2 +#define RV3032_PMU_BSM_OFF2 3 +#define RV3032_PMU_NCLKE (1 << 6) + +struct rv3032_softc { + device_t dev; + device_t busdev; + struct intr_config_hook init_hook; +}; + +struct rv3032_timeregs { + uint8_t secs; + uint8_t mins; + uint8_t hours; + uint8_t weekday; + uint8_t date; + uint8_t month; + uint8_t year; +}; + +static struct ofw_compat_data compat_data[] = { + {"microcrystal,rv3032", 1}, + {NULL, 0}, +}; + +static int +rv3032_update_register(struct rv3032_softc *sc, uint8_t reg, uint8_t value, uint8_t mask) +{ + int rv; + uint8_t data; + + if ((rv = iicdev_readfrom(sc->dev, reg, &data, 1, IIC_WAIT)) != 0) + return (rv); + data &= mask; + data |= value; + if ((rv = iicdev_writeto(sc->dev, reg, &data, 1, IIC_WAIT)) != 0) + return (rv); + return (0); +} + +static int +rv3032_eeprom_wait(struct rv3032_softc *sc) +{ + int rv, timeout; + uint8_t data; + + for (timeout = 1000; timeout > 0; timeout--) { + if ((rv = iicdev_readfrom(sc->dev, RV3032_TEMP_LSB, &data, sizeof(data), IIC_WAIT)) != 0) + return (rv); + if ((data & RV3032_TEMP_LSB_EEBUSY) == 0) { + break; + } + } + if (timeout == 0) { + device_printf(sc->dev, "Timeout updating the eeprom\n"); + return (ETIMEDOUT); + } + /* Wait 1ms before allowing another eeprom access */ + DELAY(1000); + + return (0); +} + +static int +rv3032_eeprom_disable(struct rv3032_softc *sc) +{ + int rv; + + if ((rv = rv3032_update_register(sc, RV3032_CTRL1, RV3032_CTRL1_EERD, ~RV3032_CTRL1_EERD)) != 0) + return (rv); + /* Wait 1ms before checking EBUSY */ + DELAY(1000); + return (rv3032_eeprom_wait(sc)); +} + +static int +rv3032_eeprom_update(struct rv3032_softc *sc) +{ + int rv; + uint8_t data; + + data = RV3032_EEPROM_CMD_UPDATE; + if ((rv = iicdev_writeto(sc->dev, RV3032_EEPROM_COMMAND, &data, sizeof(data), IIC_WAIT)) != 0) + return (rv); + /* Wait 1ms before checking EBUSY */ + DELAY(1000); + return (rv3032_eeprom_wait(sc)); +} + +static int +rv3032_eeprom_enable(struct rv3032_softc *sc) +{ + int rv; + + /* Restore eeprom refresh */ + if ((rv = rv3032_update_register(sc, RV3032_CTRL1, 0, ~RV3032_CTRL1_EERD)) != 0) + return (rv); + DELAY(1000); + + return (0); +} + +static int +rv3032_update_cfg(struct rv3032_softc *sc) +{ + int rv; + + if ((rv = rv3032_eeprom_disable(sc)) != 0) + return (rv); + + /* Save configuration in eeprom and re-enable it */ + if ((rv = rv3032_eeprom_update(sc)) != 0) + return (rv); + return (rv3032_eeprom_enable(sc)); +} + +static int +rv3032_temp_read(struct rv3032_softc *sc, int *temp) +{ + int rv, temp2; + uint8_t data[2]; + + if ((rv = iicdev_readfrom(sc->dev, RV3032_TEMP_LSB, &data, sizeof(data), IIC_WAIT)) != 0) + return (rv); + + /* Wait for temp to be stable */ + *temp = (((data[0] & RV3032_TEMP_LSB_MASK) >> RV3032_TEMP_LSB_SHIFT) | + (data[1] << RV3032_TEMP_LSB_SHIFT)); + do { + temp2 = *temp; + *temp = (((data[0] & RV3032_TEMP_LSB_MASK) >> RV3032_TEMP_LSB_SHIFT) | + (data[1] << RV3032_TEMP_LSB_SHIFT)); + } while (temp2 != *temp); + *temp = (*temp / TEMP_DIV) + TEMP_C_TO_K; + return (0); +} + +static int +rv3032_temp_sysctl(SYSCTL_HANDLER_ARGS) +{ + int error, temp; + struct rv3032_softc *sc; + + sc = (struct rv3032_softc *)arg1; + if (rv3032_temp_read(sc, &temp) != 0) + return (EIO); + error = sysctl_handle_int(oidp, &temp, 0, req); + + return (error); +} + +static void +rv3032_init(void *arg) +{ + struct rv3032_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + int rv; + + sc = (struct rv3032_softc*)arg; + config_intrhook_disestablish(&sc->init_hook); + + /* Set direct switching mode */ + rv3032_update_register(sc, + RV3032_EEPROM_PMU, + RV3032_PMU_BSM_DSM << RV3032_PMU_BSM_SHIFT, + RV3032_PMU_BSM_MASK); + if ((rv = rv3032_update_cfg(sc)) != 0) { + device_printf(sc->dev, "Cannot set to DSM mode (%d)\n", rv); + return; + } + + /* Register as clock source */ + clock_register_flags(sc->dev, 1000000, CLOCKF_SETTIME_NO_ADJ); + clock_schedule(sc->dev, 1); + + ctx = device_get_sysctl_ctx(sc->dev); + tree_node = device_get_sysctl_tree(sc->dev); + tree = SYSCTL_CHILDREN(tree_node); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "temperature", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + rv3032_temp_sysctl, "IK0", "Current temperature"); + return; +} + +static int +rv3032_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Microcrystal RV3032"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} + +static int +rv3032_attach(device_t dev) +{ + struct rv3032_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->busdev = device_get_parent(sc->dev); + + sc->init_hook.ich_func = rv3032_init; + sc->init_hook.ich_arg = sc; + if (config_intrhook_establish(&sc->init_hook) != 0) + return (ENOMEM); + + return (0); +} + +static int +rv3032_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + +static int +rv3032_gettime(device_t dev, struct timespec *ts) +{ + struct rv3032_softc *sc; + struct rv3032_timeregs time_regs; + struct clocktime ct; + uint8_t status; + int rv; + + sc = device_get_softc(dev); + + if ((rv = iicdev_readfrom(sc->dev, RV3032_STATUS, &status, sizeof(status), IIC_WAIT)) != 0) + return (rv); + if (status & (RV3032_STATUS_PORF | RV3032_STATUS_VLF)) + return (EINVAL); + if ((rv = iicdev_readfrom(sc->dev, RV3032_SECS, &time_regs, sizeof(time_regs), IIC_WAIT)) != 0) + return (rv); + + bzero(&ct, sizeof(ct)); + ct.sec = FROMBCD(time_regs.secs & 0x7f); + ct.min = FROMBCD(time_regs.mins & 0x7f); + ct.hour = FROMBCD(time_regs.hours & 0x3f); + ct.day = FROMBCD(time_regs.date & 0x3f); + ct.mon = FROMBCD(time_regs.month & 0x1f) - 1; + ct.year = FROMBCD(time_regs.year) + 2000; + + return (clock_ct_to_ts(&ct, ts)); +} + +static int +rv3032_settime(device_t dev, struct timespec *ts) +{ + struct rv3032_softc *sc; + struct rv3032_timeregs time_regs; + struct clocktime ct; + uint8_t status; + int rv; + + sc = device_get_softc(dev); + if ((rv = iicdev_readfrom(sc->dev, RV3032_STATUS, &status, sizeof(status), IIC_WAIT)) != 0) + return (rv); + + clock_ts_to_ct(ts, &ct); + + time_regs.secs = TOBCD(ct.sec); + time_regs.mins = TOBCD(ct.min); + time_regs.hours = TOBCD(ct.hour); + time_regs.date = TOBCD(ct.day); + time_regs.month = TOBCD(ct.mon + 1); + time_regs.year = TOBCD(ct.year - 2000); + + if ((rv = iicdev_writeto(sc->dev, RV3032_SECS, &time_regs, sizeof(time_regs), IIC_WAIT)) != 0) + return (rv); + + /* Force a power on reset event so rv3032 reload the registers */ + status &= ~(RV3032_STATUS_PORF | RV3032_STATUS_VLF); + if ((rv = iicdev_writeto(sc->dev, RV3032_STATUS, &status, sizeof(status), IIC_WAIT)) != 0) + return (rv); + return (0); +} + +static device_method_t rv3032_methods[] = { + /* device_if methods */ + DEVMETHOD(device_probe, rv3032_probe), + DEVMETHOD(device_attach, rv3032_attach), + DEVMETHOD(device_detach, rv3032_detach), + + /* clock_if methods */ + DEVMETHOD(clock_gettime, rv3032_gettime), + DEVMETHOD(clock_settime, rv3032_settime), + + DEVMETHOD_END, +}; + +static driver_t rv3032_driver = { + "rv3032", + rv3032_methods, + sizeof(struct rv3032_softc), +}; + +DRIVER_MODULE(rv3032, iicbus, rv3032_driver, NULL, NULL); +MODULE_VERSION(rv3032, 1); +MODULE_DEPEND(rv3032, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +IICBUS_FDT_PNP_INFO(compat_data); diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index b0b002b2309a..abbb390b0e07 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -28,7 +28,8 @@ SUBDIR = \ smbus \ .if !empty(OPT_FDT) -SUBDIR += rx8803 \ +SUBDIR += rv3032 \ + rx8803 \ tca64xx \ tmp461 .endif diff --git a/sys/modules/i2c/rv3032/Makefile b/sys/modules/i2c/rv3032/Makefile new file mode 100644 index 000000000000..7d3f8ac47aa6 --- /dev/null +++ b/sys/modules/i2c/rv3032/Makefile @@ -0,0 +1,13 @@ + +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc +KMOD= rv3032 +SRCS= rv3032.c + +SRCS+= bus_if.h \ + clock_if.h \ + device_if.h \ + iicbus_if.h \ + opt_platform.h \ + ofw_bus_if.h + +.include From nobody Tue Oct 3 08:26:31 2023 X-Original-To: dev-commits-src-main@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 4S09s41N23z4vxxM; Tue, 3 Oct 2023 08:26:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S09s40tyvz3Xs0; Tue, 3 Oct 2023 08:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696321592; 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=+6SQdw+neMnz9VCt/aZnOL0DvC3s4rsm3J/RUBs0Krs=; b=M08VlSbJ71iI/WaPkpFlaRGUdR7O/MVTW1R/wDf/7UGdpJxm/8cl+h4bJEeQaUZXmcC3EO OoFRyHtG0QVrKBqaqGfDkrawJVbK2Er5j1OoV3MuXy1AktLi3v/rzB6iWna3RQeLWCRGlg NF7yzxnNjqJEzQ6AZR+IsuaH5Jo5eGx/9hu3y1Ee/XDAxayuPjn1x9szP+pSU4w0UG1irO aXO9rfHEClzeUO6C5OC0JrDjdOTJfMJqPgfv4Gd3yv4bRm40sjcxmHwJVgWBZogMnFDk5L fM1Dibt8SN785vt4rOg/5mVMmYn+v3zd1iE9RGVVm4Lnz2e/YHebc/VEFE5tWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696321592; a=rsa-sha256; cv=none; b=D+af20omJo8OH64ZRMl6+Cmu/rYQrdKaWBGIMSwrdb+/QMXy+DYhveefn/K0SAMFuvLfVI Uw0s3cClou/lT3maE9aMCSDYnXlSXXwJuGbhXRL46x6xNltt+53EGjP4SraCKSFMA7Memx 1HPuDvUudzSUtI7/u/VwtT8tk2jSx8gug7QikU4okGiD1T1FzkdYD5Us74PAhbuiCKtU/k Ym2bXnfCjJAdOV9jKmpbN/52RbW5HJsC6lLKS3F7reG/tu37v/znOEvt7HaUnw0ODS21p/ PI2LSwg0cG7B1pWLyRRqUVhzPHQ/FTtu6SgrGCX2Soi0mPNNxD3TeV8UzTwiVA== 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=1696321592; 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=+6SQdw+neMnz9VCt/aZnOL0DvC3s4rsm3J/RUBs0Krs=; b=QfEU0FzAvJbDIA4dp3VWSRMuLiNGmlPNbvIwTtWETULKnp/M0aU44cinZ773FykVu10Vmz 6HnR3P64wmAFLFbH6z26PUtwrnskjVd2v/0PEe1ALoQJPZQUMOVHRiZzuUtjhuoR0bK1cr Z6Ah5w0zqK/sojJuqWr4o3K9JJx3YKeNwE7NGLBYJ/tGJtSvDs+FtH11soWbZfTzHekl2f OkcXvQltNgxwJrsmsIS9a3GlRfrzW7vuqPIHOoVhN4W02LMqLVnKdJmM0tNyWt4i+1rXQD 1obB5f4CRCYc1LkamtiEHCqEmzz+vQ3ips4korSSxtalkDK0NU1fXCV9M9ajlA== 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 4S09s373Ntznb7; Tue, 3 Oct 2023 08:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3938QVE7086349; Tue, 3 Oct 2023 08:26:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3938QVL8086346; Tue, 3 Oct 2023 08:26:31 GMT (envelope-from git) Date: Tue, 3 Oct 2023 08:26:31 GMT Message-Id: <202310030826.3938QVL8086346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: fbb3f13b1553 - main - linux(4): Actually delete linux_sysproto.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbb3f13b15539f223e40ff606744dc8ba1d6569f Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=fbb3f13b15539f223e40ff606744dc8ba1d6569f commit fbb3f13b15539f223e40ff606744dc8ba1d6569f Author: Dmitry Chagin AuthorDate: 2023-10-03 08:26:17 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-03 08:26:17 +0000 linux(4): Actually delete linux_sysproto.h MFC after: 1 week --- sys/compat/linux/linux_sysproto.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/compat/linux/linux_sysproto.h b/sys/compat/linux/linux_sysproto.h deleted file mode 100644 index e69de29bb2d1..000000000000 From nobody Tue Oct 3 13:41:49 2023 X-Original-To: dev-commits-src-main@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 4S0Jrs5L9Lz4wGb2; Tue, 3 Oct 2023 13:41:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0Jrs4mFlz4f3S; Tue, 3 Oct 2023 13:41:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696340509; 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=gw1F18UZC+njdtWg+ntxybyDUAuiuu96LEqldIHGK+Y=; b=aYJhOp2DME4hdXRNtEmgjo1A33+OVtwah+1tRHdFVlir6s1WHxRD5YoHAmRXYCoCftmgpV kUi2TLPV6J8N2nwWegTE4zNCiCyhAYg9l4NiWZIByiiDuvTPWqUdQ10KyQmTm3fBbfoK3L rLWnhoGcAWF5Wov6O1r8Fl7zer/1/eEEZW/ZrhAXkjXn2feK5S4WwSEOY621RbTBNQjbvx 4CMP6i4RW17r14E6DoG2oxNwYt0hBQQSHdAN1bgGZjRH8zj+/3MiXe0MYHS6x9OkI4+Rlc M9ptjck/0inJ6IhZfM8kgmGZVWAeQkxkRpVam1pvjZqIIy0gnn0TtcrE6Ep1uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696340509; a=rsa-sha256; cv=none; b=tvZul96/1meGReS9XNAniNR4G08qznvHjgKFLYNjZoFIbipF+UPkck4mkeYoRL5ak6YBMw eAC803BYeJLa8xlnvpOMjz72y6wQv7jBpDY3VaiGfuYpTwRYhjXuN3dXIEJL40nYS03P9t PM3LFD65pXHkgvE9VwIG4yF6g3AXMIx5qVpOB361ka5KDhDQfiswUq9qxcNDTSyto4ikAa EKpyWTT0TrcHsGahmaHOnz4y4+OQ8sWiwDb7Wc0GO8J32EMDpxqct3Sde4juDDMLifzFeA 5c8ljs/5VuOVzluNixvqXURWIxrRurVOGXujiFL1FUi5jbN9XLdLh9gZts5xeQ== 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=1696340509; 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=gw1F18UZC+njdtWg+ntxybyDUAuiuu96LEqldIHGK+Y=; b=wFdxhfVBpChxLGqopfSYOeYFUDeyPmQAMDPUR++KLKhzCE7Z3jV9oi4iYyM8jz/hrQPiC3 yiz88MyCpidIUoiHoq6FxrLtCNSjGgqW1u3DPciLGlNy3aCZW4zDJ/gCDqwvItH7bhk/vA FDpe+JtQ3uwfEUZFmh1fxqPcmiidc+6tDptn7MvB2KEpuTDrjVi5EmHA8oVZsS9dKvXw+V pL/h8UzxOMD0Z9C4pB7gQQpih830ykUvHpXRLSbN7Nf9N8Ne2ZeNiWy4e/A2lci+MgZXau K47vVruT5/iqTb0kj9ZLQONB2BeYAVzEsrfvBotBbj06FMmfXxFE/5DH1kPWqQ== 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 4S0Jrs3dJCzxWh; Tue, 3 Oct 2023 13:41:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 393DfnQ5015948; Tue, 3 Oct 2023 13:41:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 393DfnWr015943; Tue, 3 Oct 2023 13:41:49 GMT (envelope-from git) Date: Tue, 3 Oct 2023 13:41:49 GMT Message-Id: <202310031341.393DfnWr015943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 38a375c472d2 - main - vfs cache: s/vfs.cache_fast_lookup/vfs.cache.param.fast_lookup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38a375c472d295df41adf73c5ddd50543f9d877c Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=38a375c472d295df41adf73c5ddd50543f9d877c commit 38a375c472d295df41adf73c5ddd50543f9d877c Author: Mateusz Guzik AuthorDate: 2023-10-03 13:34:32 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-03 13:35:17 +0000 vfs cache: s/vfs.cache_fast_lookup/vfs.cache.param.fast_lookup --- sys/kern/vfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 12b9f2d74641..7e059d374c31 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4036,7 +4036,7 @@ syscal_vfs_cache_fast_lookup(SYSCTL_HANDLER_ARGS) cache_fast_lookup_enabled_recalc(); return (error); } -SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, +SYSCTL_PROC(_vfs_cache_param, OID_AUTO, fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &cache_fast_lookup, 0, syscal_vfs_cache_fast_lookup, "IU", ""); /* From nobody Tue Oct 3 13:41:50 2023 X-Original-To: dev-commits-src-main@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 4S0Jrt697Qz4wGRk; Tue, 3 Oct 2023 13:41:50 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0Jrt5kHdz4f40; Tue, 3 Oct 2023 13:41:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696340510; 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=8MhJpizShRMhggA2n4MKi1hzlq1eKw49KiPc3UzNids=; b=O7UaSRfDtDj/TVLXTFHC+Wofa3uq2zf1np873EywTx89RCy2tIbptftbpBg8pxl2ZyVrMO DIkx3tjsW5U/DcrotZGRLXYqtCby3kXMgMaNCK4nRcNjnEon2H/hzNQK/xKXHb6TJO7sW4 5BjiHOhd+u7sIBs0oIofNkO8QL6tDVRxbYJb499OLzChIIlOCXm7F3BZKMkO1qHA6rw7to wqRUw8cU4r5poPTwkV2bgGLYOFfZHHZG2c+FhnQ7ASWeMdAlzV7BZRFUVnXTt9sSG/JHbG Fv/lLUGWRHhQOFdMpABfW4jjA4bE11V4IPzL83Wl7tKS1u0qM3kyxYuHWHaqLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696340510; a=rsa-sha256; cv=none; b=IqmI5MyWHUDEEV5G5k1j0E7vjXEbnmVjbzAC1F5bkwim6IAdz0ajaPJT6xYWJoa2F46O/u 6cR9TV9b3USKFbpXoBxpVphEUQEkQfPMIe5CxZiAkW2cGxIMX2OY/Qo9VouimboQvxjW7y 79rZRx72Lv16NPQ0lcVsmT5KDLLcXxNfVvmWQY7rxjczh4h0J7dH2ruAZXBWaG6V+1zF1N C/rTUwqE5qLPNDcaMVScz8NNGZX+VT4P//Me6F8bS5JB+TuGT7ENLv9JyVXzZqH05YTBb8 VyWQFoO8RQpJhYd3iDBllUnugcAFC93JTm4B5duKZF0lbc3jp7tehjnI91XUgA== 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=1696340510; 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=8MhJpizShRMhggA2n4MKi1hzlq1eKw49KiPc3UzNids=; b=AkmP7xpe/T3IxLaVtHfxxwayo/gAqFrUfl78nXAkTXmflo778nfpj8pzabmGyzBsEPZ5n7 O/RlwLU18qDyavUSZAJiaaPlboEriTHwhJNFqUYB3ktdsexUEa5PzeJMYMz2Vqp2RY5EVr kR+sQAzi7Phj3QlqMDpyzc5pLmd4fqOvT3aVlzbwikRVqNzDv3r3d1bqYd25ucXcT1m4RB hVwUQjGgmThgA1GnITj8BEuA4nGGxLaAxjkHyCgl2qSpCUCYwF9v/PCulqaMa/f1zq+z1d /Vvn2M5Z0/c4V+UxiBQJ57Oww9JxL862CQpATk7NzozydjcoZGtpUtfVjNGcgA== 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 4S0Jrt4cQyzxKD; Tue, 3 Oct 2023 13:41:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 393DfoNu016000; Tue, 3 Oct 2023 13:41:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 393DfoNJ015997; Tue, 3 Oct 2023 13:41:50 GMT (envelope-from git) Date: Tue, 3 Oct 2023 13:41:50 GMT Message-Id: <202310031341.393DfoNJ015997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 4862e8ac0223 - main - vfs cache: describe various optimization ideas List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4862e8ac0223d7b19c8b3e070af1e2b38b18f333 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4862e8ac0223d7b19c8b3e070af1e2b38b18f333 commit 4862e8ac0223d7b19c8b3e070af1e2b38b18f333 Author: Mateusz Guzik AuthorDate: 2023-10-03 13:36:50 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-03 13:36:50 +0000 vfs cache: describe various optimization ideas While here report a sample result from running on Sapphire Rapids: An access(2) loop slapped into will-it-scale, like so: while (1) { int error = access(tmpfile, R_OK); assert(error == 0); (*iterations)++; } .. operating on /usr/obj/usr/src/amd64.amd64/sys/GENERIC/vnode_if.c In operations per second: lockless: 3462164 locked: 1362376 While the over 3.4 mln may seem like a big number, a critical look shows it should be significantly higher. A poor man's profiler, counting how many times given routine was sampled: dtrace -w -n 'profile:::profile-4999 /execname == "a.out"/ { @[sym(arg0)] = count(); } tick-5s { system("clear"); trunc(@, 40); printa("%40a %@16d\n", @); clear(@); }' [snip] kernel`kern_accessat 231 kernel`cpu_fetch_syscall_args 324 kernel`cache_fplookup_cross_mount 340 kernel`namei 346 kernel`amd64_syscall 352 kernel`tmpfs_fplookup_vexec 388 kernel`vput 467 kernel`vget_finish 499 kernel`lockmgr_unlock 529 kernel`lockmgr_slock 558 kernel`vget_prep_smr 571 kernel`vput_final 578 kernel`vdropl 1070 kernel`memcmp 1174 kernel`0xffffffff80 2080 0x0 2231 kernel`copyinstr_smap 2492 kernel`cache_fplookup 9246 --- sys/kern/vfs_cache.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7e059d374c31..6ae4239cc11d 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -197,10 +197,85 @@ * - vnodes are subject to being recycled even if target inode is left in memory, * which loses the name cache entries when it perhaps should not. in case of tmpfs * names get duplicated -- kept by filesystem itself and namecache separately - * - struct namecache has a fixed size and comes in 2 variants, often wasting space. - * now hard to replace with malloc due to dependence on SMR. + * - struct namecache has a fixed size and comes in 2 variants, often wasting + * space. now hard to replace with malloc due to dependence on SMR, which + * requires UMA zones to opt in * - lack of better integration with the kernel also turns nullfs into a layered * filesystem instead of something which can take advantage of caching + * + * Appendix A: where is the time lost, expanding on paragraph III + * + * While some care went into optimizing lookups, there is still plenty of + * performance left on the table, most notably from single-threaded standpoint. + * Below is a woefully incomplete list of changes which can help. Ideas are + * mostly sketched out, no claim is made all kinks or prerequisites are laid + * out. + * + * Note there is performance lost all over VFS. + * + * === SMR-only lookup + * + * For commonly used ops like stat(2), when the terminal vnode *is* cached, + * lockless lookup could refrain from refing/locking the found vnode and + * instead return while within the SMR section. Then a call to, say, + * vop_stat_smr could do the work (or fail with EAGAIN), finally the result + * would be validated with seqc not changing. This would be faster + * single-threaded as it dodges atomics and would provide full scalability for + * multicore uses. This would *not* work for open(2) or other calls which need + * the vnode to hang around for the long haul, but would work for aforementioned + * stat(2) but also access(2), readlink(2), realpathat(2) and probably more. + * + * === hotpatching for sdt probes + * + * They result in *tons* of branches all over with rather regrettable codegen + * at times. Removing sdt probes altogether gives over 2% boost in lookup rate. + * Reworking the code to patch itself at runtime with asm goto would solve it. + * asm goto is fully supported by gcc and clang. + * + * === copyinstr + * + * On all architectures it operates one byte at a time, while it could be + * word-sized instead thanks to the Mycroft trick. + * + * API itself is rather pessimal for path lookup, accepting arbitrary sizes and + * *optionally* filling in the length parameter. + * + * Instead a new routine (copyinpath?) could be introduced, demanding a buffer + * size which is a multiply of the word (and never zero), with the length + * always returned. On top of it the routine could be allowed to transform the + * buffer in arbitrary ways, most notably writing past the found length (not to + * be confused with writing past buffer size) -- this would allow word-sized + * movs while checking for '\0' later. + * + * === detour through namei + * + * Currently one suffers being called from namei, which then has to check if + * things worked out locklessly. Instead the lockless lookup could be the + * actual entry point which calls what is currently namei as a fallback. + * + * === avoidable branches in cache_can_fplookup + * + * The cache_fast_lookup_enabled flag check could be hotpatchable (in fact if + * this is off, none of fplookup code should execute). + * + * Both audit and capsicum branches can be combined into one, but it requires + * paying off a lot of tech debt first. + * + * ni_startdir could be indicated with a flag in cn_flags, eliminating the + * branch. + * + * === mount stacks + * + * Crossing a mount requires checking if perhaps something is mounted on top. + * Instead, an additional entry could be added to struct mount with a pointer + * to the final mount on the stack. This would be recalculated on each + * mount/unmount. + * + * === root vnodes + * + * It could become part of the API contract to *always* have a rootvnode set in + * mnt_rootvnode. Such vnodes are annotated with VV_ROOT and vnlru would have + * to be modified to always skip them. */ static SYSCTL_NODE(_vfs, OID_AUTO, cache, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, From nobody Tue Oct 3 17:19:29 2023 X-Original-To: dev-commits-src-main@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 4S0Ph202Ryz4vlbZ; Tue, 3 Oct 2023 17:19:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0Ph16TfKz4Jtn; Tue, 3 Oct 2023 17:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696353569; 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=uTXw+HT5TUuKJ18eF37WGJUr7M4FR3J9DycOtD9mi1I=; b=J8l2EOGZTrVPKaZVer+ft++cTF6YKdqUJsKaj40ZpnGuI5vTfrJBK6zhg9TPRklrcSRXrl F9sUBZICRSUqqTTj+IbFWx9NyyNX07g3WVrdFyB5MaBZFjWzU1uU/2WxMu5thg1MEOuhC7 ZPt4F3Ub+Uf2LlvzNKCXcmrVr3ELJWLywtDhDnRNsEuZOa10rwWV8wjL0w6ftThmEO2lzj KAl11GAz4+oNXiWMcuYK6rirh221EmaLDZnB+E+AZnE+NMDYMAPz4D40TG33iJ1ZvjoUQv IakdX5pqeHZHP3sDOVZ5hPu6BOB2MjC/TYz2acC2qLob+Kei0SU3NwasHU9yFQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696353569; a=rsa-sha256; cv=none; b=P1xFIR038VI4BFUS1CvwxWX8Ak16bkYTdXYDjq7bduwZk6yxQsc7zsErkXyxaU0dHYMqUs 6tLyRWxi/N83ctrUtY/jyN3IKl5iFaGTdwGrl9KRbdM2yncbJ7m+6sKLAQ2hSStGSvYiVR uJyiaFbI32+AttNSf5k5HU3l+G6bHD1dgIDcEPpGefWd06a2uliFCZ35oLQLnQa1e3Dgr7 3UxTc1mpdmHlBn1+wKCOPBoK9B4/XqNTO8J9wszAkhrxuvrdMAQ3qM9GxJ9GkrUEl9hv4Y fYVr+uhM0q1zAiyz9f15XUTiBh96pFaszJP3n0IK6jMlybd0k2/TfAkhHa9F1w== 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=1696353569; 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=uTXw+HT5TUuKJ18eF37WGJUr7M4FR3J9DycOtD9mi1I=; b=ak2EbdbCIu8qNbL4uYzrOWOWb7p5v8hLPvUM+pwgf0xHFuD8irN0eEv3o2MdcSRiz/MKI5 pYfHGRqgN87lEOpWZ2hcuZ9IXNAjrVGDBP08KR7CClrjbuKsko19lp/fFhKSkNTYvFAIbe EybLnCL62RQRS9/T6v83XLPPow/98CZU8k2d8DadGod3V+OHkGp+jTUnk9QsnLW+50DXyO pM6vVb5FD/BfBKw5YYhfrAfR4J57yQJDFAHSAaTIAO3LWCj9qVTsPuDjbLNd4SsTfhVCUY lLH2k0etTfYlTugw00DpL4WeZcOul/LmEMBBdwQbiZfy0QwLHHs7ao5A9q7ooQ== 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 4S0Ph15QYrz13jF; Tue, 3 Oct 2023 17:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 393HJTAa068787; Tue, 3 Oct 2023 17:19:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 393HJTuY068784; Tue, 3 Oct 2023 17:19:29 GMT (envelope-from git) Date: Tue, 3 Oct 2023 17:19:29 GMT Message-Id: <202310031719.393HJTuY068784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b4db386f9fa7 - main - dtrace: fix fbt regression for aarch64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4db386f9fa7be9668aa09d14b0bbd048a7a7e89 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b4db386f9fa7be9668aa09d14b0bbd048a7a7e89 commit b4db386f9fa7be9668aa09d14b0bbd048a7a7e89 Author: Igor Ostapenko AuthorDate: 2023-10-03 16:48:00 +0000 Commit: Mark Johnston CommitDate: 2023-10-03 17:07:41 +0000 dtrace: fix fbt regression for aarch64 fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Signed-off-by: Igor Ostapenko Fixes: 980746e5cb26 ("fbt: simplify arm64 function-prologue parsing") Reviewed by: markj Pull Request: https://github.com/freebsd/freebsd-src/pull/855 MFC after: 1 week --- sys/cddl/dev/fbt/aarch64/fbt_isa.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c index 4094ea43a9fe..44690b97f77a 100644 --- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c +++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c @@ -90,7 +90,6 @@ fbt_provide_module_function(linker_file_t lf, int symindx, uint32_t *instr, *limit; const char *name; char *modname; - bool found; int offs; modname = opaque; @@ -119,16 +118,16 @@ fbt_provide_module_function(linker_file_t lf, int symindx, if ((*instr & BTI_MASK) == BTI_INSTR) instr++; - /* Look for stp (pre-indexed) operation */ - found = false; /* * If the first instruction is a nop it's a specially marked * asm function. We only support a nop first as it's not a normal * part of the function prologue. */ if (*instr == NOP_INSTR) - found = true; - for (; !found && instr < limit; instr++) { + goto found; + + /* Look for stp (pre-indexed) or sub operation */ + for (; instr < limit; instr++) { /* * Functions start with "stp xt1, xt2, [xn, ]!" or * "sub sp, sp, ". @@ -142,14 +141,14 @@ fbt_provide_module_function(linker_file_t lf, int symindx, * past the function prologue. */ if (((*instr >> ADDR_SHIFT) & ADDR_MASK) == 31) - found = true; + break; } else if ((*instr & SUB_MASK) == SUB_INSTR && ((*instr >> SUB_RD_SHIFT) & SUB_R_MASK) == 31 && ((*instr >> SUB_RN_SHIFT) & SUB_R_MASK) == 31) - found = true; + break; } - - if (!found) +found: + if (instr >= limit) return (0); fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); From nobody Tue Oct 3 17:41:38 2023 X-Original-To: dev-commits-src-main@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 4S0Q9b0YXCz4vmyj; Tue, 3 Oct 2023 17:41:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0Q9b05qLz4MZJ; Tue, 3 Oct 2023 17:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696354899; 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=jl/GnHTzWCGIlW0Xcm0sSEZudmwM/tQxgF8+9WbAhKo=; b=CntjhQAVLcKatvakQg5F8BA1cB2ny+z/IzZcRwFvxttNIuPwxRCPeOdcw30X5K/CCTFxvY DRe10Fa/EIwXrxxE7a1fU7DJibTsPLvh11l5uo1mRpfgL57aqnb1Nyj4RdBirgFl6u6Zha 2gHuFKjqJzJHYw5L4FoWrXKpQqmxkccZAjFc/DyWUymixpA6p01CKwE0Z6P6mt4NyvWzj0 WIXVI1deq62xrBa5NFi1HHC1O7gzt1NK8aSckgqDPU8GOn6Hbg8XUtPBKHOckoTlzxeKw9 m73GoOE3Jw/1iQAVX+zZwKjZAmGosmYNhU7V/WWtMF8JKPG/jrKpHd5Hkwj3Iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696354899; a=rsa-sha256; cv=none; b=XkFkS72sKbRXPuQxXDI0MftdWLgwO/zmq+MV731XTh8ECCM/H0s7fp2o1Xhwg1lmLd+EcW U9K0GnHLJjQjHI6IreEZQUczE+MWJu0wZIqoIkV9m1yhJIb7Hvsvn1jTTDvmFdoIGJ7WF5 19HHZlZpJFSZfKXwFA7ongzOakbrqez1+gsfGyfwriV+qbqF0WDsCvdl/bjHDYcdAZQKCs d8dCG5PusbPFWOmU+ZCoEy/blPivr/J4fkS9bWhZs9aDk+NfsmvpFcPmgq/cqjMWgbI7do aACFl0CP0V9s9CvyYofXjZTSmxofK3QQuPypkQM0ciCJDMLWopQdU/nWSZqC2A== 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=1696354899; 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=jl/GnHTzWCGIlW0Xcm0sSEZudmwM/tQxgF8+9WbAhKo=; b=Yr74Gsdsm4sTZLm4zhK35znCDlJXEh1PFzVEa8hXkEe/GnPT1AhP38msYaMb2IZxqUjohk es2eeB9wFNkK28DS6Q86zM9EmqHmfGaY4AdSN+KYRFGmSyh0FKxdtv5ZqeAHsan2tQPgcr EwC4Y/iNAjU17EYz14JwSSKdiOzancVXWjtNs8YwDDFnAbN3wNX851AlZdjK53dDG6VQx6 Jt5yN1kW3Jhi1fhiAYp86sANlfCH1NA/J9o3XFrs1w1QahJzZysxXr4JrhDZK9vrkRka1b 19JHL6GE1AixPLZm4DHfJTVK1BTUg9/8JHcw3ptflXvghy7aCqL8/N0JlgV92g== 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 4S0Q9Z6GLLz14JP; Tue, 3 Oct 2023 17:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 393Hfcco012731; Tue, 3 Oct 2023 17:41:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 393HfcbP012728; Tue, 3 Oct 2023 17:41:38 GMT (envelope-from git) Date: Tue, 3 Oct 2023 17:41:38 GMT Message-Id: <202310031741.393HfcbP012728@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 5a82fc7859f7 - main - sbuf.9: Add LIBRARY section List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a82fc7859f746d95811e43b3a117b8eea297749 Auto-Submitted: auto-generated The branch main has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a82fc7859f746d95811e43b3a117b8eea297749 commit 5a82fc7859f746d95811e43b3a117b8eea297749 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2023-10-03 17:07:15 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2023-10-03 17:22:24 +0000 sbuf.9: Add LIBRARY section Sponsored by: Klara, Inc. MFC after: 3 days --- share/man/man9/sbuf.9 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9 index 5ab045118f51..d4ffa050a893 100644 --- a/share/man/man9/sbuf.9 +++ b/share/man/man9/sbuf.9 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 26, 2020 +.Dd October 3, 2023 .Dt SBUF 9 .Os .Sh NAME @@ -60,6 +60,8 @@ .Nm sbuf_printf_drain , .Nm sbuf_putbuf .Nd safe string composition +.Sh LIBRARY +.Lb libsbuf .Sh SYNOPSIS .In sys/types.h .In sys/sbuf.h From nobody Tue Oct 3 20:16:02 2023 X-Original-To: dev-commits-src-main@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 4S0Tbk3nCYz4vwlV; Tue, 3 Oct 2023 20:16: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0Tbk38Dhz4g8F; Tue, 3 Oct 2023 20:16:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696364162; 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=o6WLgNRRaBWg4Rpi4a+cUgOebs/rBhw0Sr8knnJAGsU=; b=hBMmv0Ym8/igKDRN60gS9AgYzhnqroPCPJOF83hzlqB/Pp6f/W/FOGyh5Et+j6vXst7vDr 26RbfN6ADzcrNKjAuh/Bk/0z05DOhPVr2ENanp4AErJ4+p5l4AD7nMPHb1/JKlN5bi0tNw ncmODTH3BFmfi/EsNVm1Q2qzB0MwQaemJUr8NgQ0G9t141lxWHCsDRrqUlDN9RjtVCmQdO UfSvVbietASh23bb5bJMizkDd7ldnIGoYOt26G19ESdrNIyzn5NiaUQBQdhoW77wOZvrOe MrfB9gWUl4aN3NE/NxkQ5xvOSitS7xsakgtUs5qJ1BvkYiTpDvMvQc8vmQe/5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696364162; a=rsa-sha256; cv=none; b=MHbL1Wg4/dwbzC0P6SFoPDKNW/sftYD9TlAimYnJzZEyTlP1Gb5EuexfTU82z6sp+1yZKK U97UUPbS9L51praG7UBzg8Bi7T/Y4fHUIYo1s2Zcq6BxBdIzw99dHeupUU3htES3Yu2YCs 0wuhKzlNueTah//BpDwktcW3C+H357UaV4HEySi8T0AzNLkoi+T8copOtLaZHstoSruY3h PnbpgHr+/yGShltVJWvwdYEgkb1XF4G65kIEDIdUcaZ19kgC8LMl/R1ag12rIWjWLFpXVQ pyN2wMOny7+H15EFxGPQ7p4fWAxZEHUoMhfRcWFTLVFspDsvCPFXp7R43T0R1w== 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=1696364162; 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=o6WLgNRRaBWg4Rpi4a+cUgOebs/rBhw0Sr8knnJAGsU=; b=o+rVoV+Vi+bEt/1/EgjK2vj3Bp8mKcPgjEzB9AwsrQEq8pCZFU3TuyFhShsvBKewpQz6tC bfSVWyLyyOD9d4VxjBaTgv8QavGxa2s/j+DREpyHK73yA/B5WYuoYstw0mWlQ7nVqf5c9v fTzKA7keKrevaS0Fa7c1kr4bFamceUjjJpUgtFaOSvpDdTJhPyp7pfRd6o5PePxKe1DfBb 4d+ICqY9MpmybiUpv3GaG3gEz7RZzFCOJctoJ6rtYbCCcSBsZqcK9d7tPEfUawFvOMLfXv GivyuFb65i08Wh8pBb0+uMpw+vdz4VxdyzlF94BW4KMk7eLUw453sCuLJTsr1Q== 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 4S0Tbk26Hzz17rK; Tue, 3 Oct 2023 20:16:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 393KG2D3069664; Tue, 3 Oct 2023 20:16:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 393KG2WR069661; Tue, 3 Oct 2023 20:16:02 GMT (envelope-from git) Date: Tue, 3 Oct 2023 20:16:02 GMT Message-Id: <202310032016.393KG2WR069661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= Subject: git: 1e99b2ee9095 - main - linuxkpi: Fix uses of `pmap_change_attr()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e99b2ee90956f275c3668e92a408400f2dada1c Auto-Submitted: auto-generated The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=1e99b2ee90956f275c3668e92a408400f2dada1c commit 1e99b2ee90956f275c3668e92a408400f2dada1c Author: Jean-Sébastien Pédron AuthorDate: 2023-08-16 20:32:42 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-10-03 20:13:52 +0000 linuxkpi: Fix uses of `pmap_change_attr()` [Why] This function takes an offset and a length as argument, not a physical address and a number of pages. This misuse caused the `set_memory_*()` and `arch_io_reserve_memtype_wc()` functions to return EINVAL. Another problem was the fact that they returned errors as a positive integer, whereas Linux uses negative integers. [How] Physical addresses and number of pages are converted to offset+length in the `set_memory_*()` functions. `arch_io_reserve_memtype_wc()` now calls `pmap_change_attr()` directly instead of using `set_memory_wc()`. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D42053 --- .../linuxkpi/common/include/asm/set_memory.h | 24 +++++++++++++++++++--- sys/compat/linuxkpi/common/include/linux/io.h | 15 ++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/asm/set_memory.h b/sys/compat/linuxkpi/common/include/asm/set_memory.h index ae50148f0314..69f659001c60 100644 --- a/sys/compat/linuxkpi/common/include/asm/set_memory.h +++ b/sys/compat/linuxkpi/common/include/asm/set_memory.h @@ -34,14 +34,26 @@ static inline int set_memory_uc(unsigned long addr, int numpages) { - return (pmap_change_attr(addr, numpages, VM_MEMATTR_UNCACHEABLE)); + vm_offset_t va; + vm_size_t len; + + va = PHYS_TO_DMAP(addr); + len = numpages << PAGE_SHIFT; + + return (-pmap_change_attr(va, len, VM_MEMATTR_UNCACHEABLE)); } static inline int set_memory_wc(unsigned long addr, int numpages) { #ifdef VM_MEMATTR_WRITE_COMBINING - return (pmap_change_attr(addr, numpages, VM_MEMATTR_WRITE_COMBINING)); + vm_offset_t va; + vm_size_t len; + + va = PHYS_TO_DMAP(addr); + len = numpages << PAGE_SHIFT; + + return (-pmap_change_attr(va, len, VM_MEMATTR_WRITE_COMBINING)); #else return (set_memory_uc(addr, numpages)); #endif @@ -50,7 +62,13 @@ set_memory_wc(unsigned long addr, int numpages) static inline int set_memory_wb(unsigned long addr, int numpages) { - return (pmap_change_attr(addr, numpages, VM_MEMATTR_WRITE_BACK)); + vm_offset_t va; + vm_size_t len; + + va = PHYS_TO_DMAP(addr); + len = numpages << PAGE_SHIFT; + + return (-pmap_change_attr(va, len, VM_MEMATTR_WRITE_BACK)); } static inline int diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h index ee46d354a5ae..2345967898e6 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -532,14 +532,25 @@ void lkpi_arch_phys_wc_del(int); static inline int arch_io_reserve_memtype_wc(resource_size_t start, resource_size_t size) { + vm_offset_t va; - return (set_memory_wc(start, size >> PAGE_SHIFT)); + va = PHYS_TO_DMAP(start); + +#ifdef VM_MEMATTR_WRITE_COMBINING + return (-pmap_change_attr(va, size, VM_MEMATTR_WRITE_COMBINING)); +#else + return (-pmap_change_attr(va, size, VM_MEMATTR_UNCACHEABLE)); +#endif } static inline void arch_io_free_memtype_wc(resource_size_t start, resource_size_t size) { - set_memory_wb(start, size >> PAGE_SHIFT); + vm_offset_t va; + + va = PHYS_TO_DMAP(start); + + pmap_change_attr(va, size, VM_MEMATTR_WRITE_BACK); } #endif From nobody Tue Oct 3 21:19:32 2023 X-Original-To: dev-commits-src-main@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 4S0W1105QSz4w0vY; Tue, 3 Oct 2023 21:19:33 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0W106fHPz4l5P; Tue, 3 Oct 2023 21:19:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696367972; 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=Pmlsh1WqGgYjC08jqAG7GP2FDp2ZDk+yOCJZG/2ejIc=; b=IxyUUZ8hbzN/WJCOTEIPwisJmmp+5aYh2BTly4b79ybhfiRooEbmiv49uNZIlJ4IbtIRYM dsT+crpxqjBMtUK4FOFKKhbJIzrgaUNs64i4Vd7l22m8/XGAlEA43XPzBeRPpr312FkxPp J/UU+5ZZQU0E/Umy2P2U67LCTg8b6hOtNbopSFIJMXOrWD0rVEEFemG0zW4Fx7Py68VDM3 mWR8RGlaIW3lh8JzhfN0w3cxUrpi5UHfdwNHRblbjUPCPrI12mQ0gFjgQvYFZYoIjPhtl1 3EWuVH8ZotVRux909sHnFd5U0oE9pQx5/0C1dodKtHk1dUFREBXyfKSl5BgpHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696367972; a=rsa-sha256; cv=none; b=EdI9uwJBEXi2NzWxSGz1dULivAwELXFY3Oi7E6Jbos9oDwS50+EY/KcsuUivgmd8IqYYUk YKjvEUaFHlapHFwumbZtOjX1vAwGN44IjTz+J3QVCEeU73oCcf2Ly7/GYnMI6+fG31z6d3 xIp3KZTjovt3V/lMrRsBQX8Uw5lekeVG6ym5WXlhetIkAfeTpg7ssXmR+XPt7bhyyJ3UFJ HZYYuUyGxWfwC7jUOvfk7afxgDmFiT+1SFkgRbR7/7xRmNi+lZSDzWu4SGS+2UNSyb4fOU 99Mi87RNPsrp2n/s+xn3eKR94vZnh+z1KVvDYOKFWMzK9zMVi+ktAa7MMDutCg== 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=1696367972; 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=Pmlsh1WqGgYjC08jqAG7GP2FDp2ZDk+yOCJZG/2ejIc=; b=HZg/sZQ45EYc9VWV/8V15OdFNjcndt5TEelXvekbP03fBk61qVCihp2sxfUgOoezrAan/Z 6ZUl7YHfuYGAAuAMg+26hgorXbeacj5ToN0bPSE733Fw2UEDw9V5SifXAoNqp1oPuWoiFV ONcSUicGgU0YflsdII8irxSVNbKydZUuUROq3rbRXZKGNRVZwXFaFoHaT8t28N+y33Cjbs ml6cFpnrdHNRFZC38MmXTLtVJq6w9Ozbvz0mLuSVOgSkL9/4/RVSEQlZZgo+W+GaG1gorH cYALPLVX2IVLZza0nB8P9GF6k8LNsCAd9OmOH2Ugw3XYNlIjd+HpBZWSh6pX5A== 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 4S0W105gKSz198v; Tue, 3 Oct 2023 21:19:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 393LJWBE071513; Tue, 3 Oct 2023 21:19:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 393LJWBa071510; Tue, 3 Oct 2023 21:19:32 GMT (envelope-from git) Date: Tue, 3 Oct 2023 21:19:32 GMT Message-Id: <202310032119.393LJWBa071510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 6c38c6b1b917 - main - LinuxKPI: 802.11: fix re-creation of VAP List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c38c6b1b917957d420902213f318bf0153214f2 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=6c38c6b1b917957d420902213f318bf0153214f2 commit 6c38c6b1b917957d420902213f318bf0153214f2 Author: Bjoern A. Zeeb AuthorDate: 2023-10-03 21:14:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-03 21:18:29 +0000 LinuxKPI: 802.11: fix re-creation of VAP After dbf7691999abe (as indicated in that commit message) EEXISTS errors may be seen. From current investigation that is due to the single-VAP support in LinuxKPI 802.11 and the related calls to mo_start() and mo_stop() and them being disabled in ic_parent() currently. Calling mo_stop() in lkpi_ic_vap_delete() seems to fix the problem and new VAPs (wlan interfaces) can be created again after being destroyed. Fixes: dbf7691999abe ("improve lkpi_ic_vap_delete()") Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 7565f491606b..9f5f5bef7f27 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2481,6 +2481,9 @@ lkpi_ic_vap_delete(struct ieee80211vap *vap) lkpi_80211_mo_remove_interface(hw, vif); + /* Single VAP, so we can do this here. */ + lkpi_80211_mo_stop(hw); + mtx_destroy(&lvif->mtx); free(lvif, M_80211_VAP); } From nobody Wed Oct 4 09:35:10 2023 X-Original-To: dev-commits-src-main@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 4S0qKp4Hy7z4vYVG; Wed, 4 Oct 2023 09:35:10 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0qKp3pWKz4N8r; Wed, 4 Oct 2023 09:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696412110; 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=U3kqE9X1D2mpOn2YGuXaCUrgfPqjhmYqKU+ngT1gc9k=; b=EaW7TKyQ/28fQSmLHzWhRu9JAW2Vo3mvaR7KVT5aB9PwiGCASAwMYHkC+dXl/0J1iKrto+ K9d1YAQnwhqYTQWE/YdKLs3SSsXkAlSZGOus84GGFJbkbYbnN3W9q1Lq6UuFth76pW0TJe ZQHXDC+Xy70+RSGC6U9qUE2aUjvXxbYarvS8dU9wP1o5Ht5onukyUfW6ZppDkNAkR7bA5g M2nWRN/pMKaxX92YFWbbrKhJDGrgZuN5PcQ+rXZ8suj91OiH6EKYAxpRbWbghDirie5gsH Dh2k5IOsrrrxIDvUNxRRP6dqh/LVFubyEs7ohl2sIyiSHx9pYh/0Tr2PEwYZ9w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696412110; a=rsa-sha256; cv=none; b=iebrk/xBiGoREIJJrC17DJNR/kwApWn2wjPO26EVIlwHIRdNdrqNjBPUlOYDoF0FJdiHXd FNkWb7hK0sVjwi1DFUAFwopGd4kMCfwieQLeD/vNFeioSErnNTzTAm6FZRQ4sZjad9Xe/H NDKdU5wQPRMASh2XbmM2aNVeqdNM+z7wScLxX84u//vaDYnfqDkX5x3oBn0pu3kyeg74/+ s7aOUyVPNkyMUu+Cnw68HPPsuvoUaS6MgjSRfjLVODtM21XJ4D9OPEdXsSgzvg76c3ork2 AU/3tdl2IV8KFWaHPSA5LxoBIRG17Lz53mR5rIJl0F9akr550KpDeJx8BsgFlg== 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=1696412110; 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=U3kqE9X1D2mpOn2YGuXaCUrgfPqjhmYqKU+ngT1gc9k=; b=fV1NrYhAyZ219zm3l5slqkwPz10kNjq5tqjmhXgHqhhpG1xiEKkNMde7IQ0nvVLpWYlRdC tGfZE7VQNvuShNORfiCh2+7AmCv9SqljJGQ+s6EqRS16PCRVUYMKUzCb3N7lHBKFvSJenl lxEQf8/qqMhV1qNtkmHQKfvweMzYJ45HHq/+IyByJe5lz0kMCU8X64FTnASdaPJwXN3yG/ 7dH//DGb3Fo7zqK/Mo32toUgbiX2go5qalNY2uRFST9gHAJz4uLhxHSezvvPA3E6uRSfij SQusjkw5Xs5cH6wqvyvztdyGxZ7Vu8hWPci6sNVS9890Uuoz0JF2q4kFTNEAjQ== 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 4S0qKp2tfnzXfk; Wed, 4 Oct 2023 09:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3949ZAbT001274; Wed, 4 Oct 2023 09:35:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3949ZAlD001271; Wed, 4 Oct 2023 09:35:10 GMT (envelope-from git) Date: Wed, 4 Oct 2023 09:35:10 GMT Message-Id: <202310040935.3949ZAlD001271@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 74c2461386ea - main - pf: cope with missing rpool.cur List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74c2461386ea5eeb41e674df6b16a44b0509a882 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=74c2461386ea5eeb41e674df6b16a44b0509a882 commit 74c2461386ea5eeb41e674df6b16a44b0509a882 Author: Kristof Provost AuthorDate: 2023-10-03 15:11:44 +0000 Commit: Kristof Provost CommitDate: 2023-10-04 08:16:03 +0000 pf: cope with missing rpool.cur If we're evaluating a pfsync'd state (and have different rules on both ends) our state may point to the default rule, which does not have rpool.cur set. As a result we can end up dereferencing a NULL pointer. Explicitly check for this when we try to re-construct the route-to interface. Also add a test case which can trigger this issue. MFC after: 3 days See also: https://redmine.pfsense.org/issues/14804 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 9 ++-- tests/sys/netpfil/pf/pfsync.sh | 96 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3e1c8d32add9..fae0bd2854f9 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6978,7 +6978,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } else { ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; /* If pfsync'd */ - if (ifp == NULL) + if (ifp == NULL && r->rpool.cur != NULL) ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; PF_STATE_UNLOCK(s); @@ -7035,9 +7035,10 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, s->rt_addr.v4.s_addr; ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; /* If pfsync'd */ - if (ifp == NULL) + if (ifp == NULL && r->rpool.cur != NULL) { ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; + } PF_STATE_UNLOCK(s); } @@ -7191,7 +7192,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } else { ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; /* If pfsync'd */ - if (ifp == NULL) + if (ifp == NULL && r->rpool.cur != NULL) ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; PF_STATE_UNLOCK(s); @@ -7249,7 +7250,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, &s->rt_addr, AF_INET6); ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; /* If pfsync'd */ - if (ifp == NULL) + if (ifp == NULL && r->rpool.cur != NULL) ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; } diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index 80b81205b59d..5d30f5b44888 100644 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -826,6 +826,101 @@ basic_ipv6_cleanup() pfsynct_cleanup } +atf_test_case "route_to" "cleanup" +route_to_head() +{ + atf_set descr 'Test route-to with default rule' + atf_set require.user root + atf_set require.progs scapy +} + +route_to_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_out_one=$(vnet_mkepair) + epair_out_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a ${epair_out_one}a + vnet_mkjail two ${epair_two}a ${epair_sync}b ${epair_out_two}a + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig ${epair_out_one}a 203.0.113.1/24 up + jexec one ifconfig ${epair_out_one}a name outif + jexec one sysctl net.inet.ip.forwarding=1 + jexec one arp -s 203.0.113.254 00:01:02:03:04:05 + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1 \ + up + + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + jexec two ifconfig ${epair_two}a 198.51.100.2/24 up + jexec two ifconfig ${epair_out_two}a 203.0.113.2/24 up + #jexec two ifconfig ${epair_out_two}a name outif + jexec two sysctl net.inet.ip.forwarding=1 + jexec two arp -s 203.0.113.254 00:01:02:03:04:05 + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + maxupd 1 \ + up + + # Enable pf! + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass out route-to (outif 203.0.113.254)" + jexec two pfctl -e + + # Make sure we have different rulesets so the synced state is associated with + # V_pf_default_rule + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass out route-to (outif 203.0.113.254)" \ + "pass out proto tcp" + + ifconfig ${epair_one}b 198.51.100.254/24 up + ifconfig ${epair_two}b 198.51.100.253/24 up + route add -net 203.0.113.0/24 198.51.100.1 + ifconfig ${epair_two}b up + ifconfig ${epair_out_one}b up + ifconfig ${epair_out_two}b up + + atf_check -s exit:0 env PYTHONPATH=${common_dir} \ + ${common_dir}/pft_ping.py \ + --sendif ${epair_one}b \ + --fromaddr 198.51.100.254 \ + --to 203.0.113.254 \ + --recvif ${epair_out_one}b + + # Allow time for sync + ifconfig ${epair_one}b inet 198.51.100.254 -alias + route del -net 203.0.113.0/24 198.51.100.1 + route add -net 203.0.113.0/24 198.51.100.2 + + sleep 2 + + # Now try to trigger the state on the other pfsync member + env PYTHONPATH=${common_dir} \ + ${common_dir}/pft_ping.py \ + --sendif ${epair_two}b \ + --fromaddr 198.51.100.254 \ + --to 203.0.113.254 \ + --recvif ${epair_out_two}b + + true +} + +route_to_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" @@ -838,4 +933,5 @@ atf_init_test_cases() atf_add_test_case "timeout" atf_add_test_case "basic_ipv6_unicast" atf_add_test_case "basic_ipv6" + atf_add_test_case "route_to" } From nobody Wed Oct 4 10:19:18 2023 X-Original-To: dev-commits-src-main@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 4S0rJk6sYVz4vdF3; Wed, 4 Oct 2023 10:19:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0rJk6NdNz4T6F; Wed, 4 Oct 2023 10:19:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696414758; 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=v8jy7vbGaE3w+rhldBLj8eXQMmSQWSo67HCzqU3PB6g=; b=hzpGwsVH4+3i9IgAIxWFxFRqsF7C5DOiWHC2KXPGlcu+tnTt/D7b7jXzTJIaYIR4QwfmzN cyskZKbUEf+JKsslA80leaTVZ73o8MTrvjXOb5Uck95v++dWxF3GnRT1SAhyn9y9TrWS20 KomDxy8ZgAFcLEGWIz3hrr8Srsup3akRtgovInI4MG8SCZCwytcSrX5eS5n24c+cQQPfEX VHH8bh0eDLsn3ulRbZgm0awh1URcjg4/fQaiU9oBmbiwLrrkQPIxcmYDw5ahFrBl7vy+Qb Hh9dk8cuLKK9MLKfTccfwvJxv6gwuuP7k3u7N6KauPKqASutTXABLSjYyzf0Jg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696414758; a=rsa-sha256; cv=none; b=RXTp3QhiQrtDrz8LKAfjc0yAJ6mTgQSQe65dxCv/yWvJE3zqwa6UwAtjLqprreZKjMfCzZ EttLAZs4IzLF8ZIdegaP6nBV+1EIfaysmlIdldufmNNv+NNYUfhe+cbuYTALSLAuKAhOBx gTLJ7vMRuo+R+XRODtFMarKyNEss3KqV9Vz01D0vFguHCT3Do7vlE01+nj9MlyYPDJszTI n/kVrEl6bbcf91VrbmkMtuNaKLmcCn4vEonPCMDoVhiN62eHvl2287TdD1TJQuBt9NWU8a QAXwshFq4yl41MH1sKfRqjZryOmTmQEraa8gKX0lByafX2xrf03izblcV6wDtQ== 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=1696414758; 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=v8jy7vbGaE3w+rhldBLj8eXQMmSQWSo67HCzqU3PB6g=; b=VjPV4B5UobFAr7nIvvqH99NxMp3dArhuUQhnaq75YKrgPiMHIbJnUpNQFlEdH4sCjYeHMe 3Xj71GW6V9PiVVlaq4W3RIXKrRjf95HbGd1MzqywSFj/FTJEXr+pxRM+TN+kT7x0kvpi+w 8aG2rqg6pw+tlkQHFKeP7TV9cut0vbgMpd7V6XEnC2O5vUnrdllPRil9knmCEef3LFcm1I 091kWDjJnXba4gUCHcEjokCu00buXxbSw45DIPSCVxCdmPwdGjmPQTuekEPLx/s+mM4aJd /PyjaYS8/te50ylhx5DSClqLWKuMeIbPamlTMyMu4xU6XN9NU2mVAZVT2UEj+A== 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 4S0rJk5RqszYPD; Wed, 4 Oct 2023 10:19:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394AJI6s069309; Wed, 4 Oct 2023 10:19:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394AJI3C069306; Wed, 4 Oct 2023 10:19:18 GMT (envelope-from git) Date: Wed, 4 Oct 2023 10:19:18 GMT Message-Id: <202310041019.394AJI3C069306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f06c92854474 - main - LinuxKPI: remove dummy headers with implementations List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f06c928544747326c04f84c582bcd5fda0d7bb91 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f06c928544747326c04f84c582bcd5fda0d7bb91 commit f06c928544747326c04f84c582bcd5fda0d7bb91 Author: Bjoern A. Zeeb AuthorDate: 2023-10-04 10:17:21 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-04 10:17:21 +0000 LinuxKPI: remove dummy headers with implementations Both agp_backend.h and utsname.h have an implementation in common/ these days so the dummy headers are no longer needed. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/dummy/include/linux/agp_backend.h | 0 sys/compat/linuxkpi/dummy/include/linux/utsname.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/compat/linuxkpi/dummy/include/linux/agp_backend.h b/sys/compat/linuxkpi/dummy/include/linux/agp_backend.h deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/sys/compat/linuxkpi/dummy/include/linux/utsname.h b/sys/compat/linuxkpi/dummy/include/linux/utsname.h deleted file mode 100644 index e69de29bb2d1..000000000000 From nobody Wed Oct 4 12:28:46 2023 X-Original-To: dev-commits-src-main@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 4S0vBF1Yygz4vqYS; Wed, 4 Oct 2023 12:28:53 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0vBF1GGlz3N8T; Wed, 4 Oct 2023 12:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696422533; 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=YZ6Jow8lcVUZllkP3NeVZC0ppf9Ib+Y1JtP4+GQVvmw=; b=fODdoOKxrdLcJEMY/8qGRqUWnGp4MLdEQOcc8Q5cnjkjLpmPIrgcVfJ+ldHrguXA/kvCTf fX5BoZ4W9U6+4mA/TG1viyB2rxNeWeTNkOszCkctaYPggr4MSLS9G3/3SIOitYzleE4ZWl DjJl28E300UxmRIwdgfS3Q+y49rhpfEoJCUGL3weZL6MR+EDvIlMMWSkLHld4x39LO5DTy Q159USakgF/qoUuVKjr18YV2lauy4+TZoK7AD4kqdzgVsksBZeAanbgYr3Wzd2rZdAvu2C /+3HwwjfzN7ay1vBL9tuyjmibWMvaaAkTeq10lVLh/cpufHOti3KqCbs5/sUTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696422533; a=rsa-sha256; cv=none; b=xxZinrNRLUyUPD6jkR3rr1frLSjNXriN/ugsiimlO1cviXQACWd9oazmGh3zsDLXHO2fhx tAk4Qw4bVYzwb+CCIxTmrLf7dZ87BS8gM2Oyhsr2lBV+zQfvqGpQQqnTmfUNsca3jpjtd2 wK9f1UbRtT/rrA6wggcAkzSGKaQK7z2x+7e0O8ANhTZVBwJijZr5+N8WHNmePiHVbpt34z jp5LbpkYTz483tyVh6KmBrTp+nX9hzYFWiT/leySr4f22DP5FrQ51+4xuB5240oUI1IveX ++so1w3SCgP+08M7k2Qc2hgEvAgLObac6BJmwC5Hus+/PoTXsf0oT0Oimpgs1g== 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=1696422533; 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=YZ6Jow8lcVUZllkP3NeVZC0ppf9Ib+Y1JtP4+GQVvmw=; b=mpNKWLap0NkjXRFbvbyFcOzHP0w2yMF8G9VbfSXeWMCx3q/GXFC/LwI/32hs+WvSj+uWw+ UEdFQok39P4snZ+gsHP+F92Ayu9zlyk6YwZNwjlF8yme1FAlGwIyFZwmaXVp3x56puSH8B PMdIsecJO6XlT99gZe8SjT0PA9C8ZhyBeAOA4KRbs+QXYpJXOyyZ4BTDSSOvfp/eynP9BW 7jCQ4c8pmUS3ddsxBfJGnMJ5kyx6c72MSApC0Ikkd1zOQ1FCAXmueS6C8OQYw/xvlv9Xwf ZEKpFMSO7kBnoqY5HcwH6LeQBLDGXsrlAmZMSjTBAVnxckfR59J0C5gqGOIhtg== 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 4S0vBF0L0Xzcyr; Wed, 4 Oct 2023 12:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394CSqGl086866; Wed, 4 Oct 2023 12:28:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394CSkXP086856; Wed, 4 Oct 2023 12:28:46 GMT (envelope-from git) Date: Wed, 4 Oct 2023 12:28:46 GMT Message-Id: <202310041228.394CSkXP086856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: f7f4bd06a8d4 - main - zfs: merge openzfs/zfs@f795e90a1 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7f4bd06a8d4e5d1e92d0d2905a68a2a03ed9c0c Auto-Submitted: auto-generated The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=f7f4bd06a8d4e5d1e92d0d2905a68a2a03ed9c0c commit f7f4bd06a8d4e5d1e92d0d2905a68a2a03ed9c0c Merge: f06c92854474 f795e90a11c6 Author: Martin Matuska AuthorDate: 2023-10-04 12:02:37 +0000 Commit: Martin Matuska CommitDate: 2023-10-04 12:08:42 +0000 zfs: merge openzfs/zfs@f795e90a1 Notable upstream pull request merges: #15322 4e16964e1 Add '-u' - nomount flag for zfs set #15331 fe4d055b3 Report ashift of L2ARC devices in zdb #15333 249d759ca Fix invalid pointer access in trace_dbuf.h #15339 f795e90a1 Add BTI landing pads to the AArch64 SHA2 assembly Obtained from: OpenZFS OpenZFS commit: f795e90a11c683d64bacc260fb7feab705b220b1 sys/contrib/openzfs/cmd/zdb/zdb.c | 2 +- sys/contrib/openzfs/cmd/zfs/zfs_main.c | 48 ++++++---- sys/contrib/openzfs/config/zfs-build.m4 | 11 +++ .../openzfs/contrib/bash_completion.d/Makefile.am | 2 - sys/contrib/openzfs/contrib/debian/control | 2 +- .../contrib/debian/openzfs-zfsutils.install | 1 - sys/contrib/openzfs/contrib/debian/rules.in | 5 - sys/contrib/openzfs/include/libzfs.h | 8 ++ .../openzfs/include/os/linux/zfs/sys/trace_dbuf.h | 8 +- sys/contrib/openzfs/lib/libzfs/libzfs.abi | 7 ++ sys/contrib/openzfs/lib/libzfs/libzfs_changelist.c | 27 ++++-- sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c | 18 +++- sys/contrib/openzfs/man/man7/zfsprops.7 | 26 +++++- sys/contrib/openzfs/man/man8/zfs-set.8 | 7 ++ .../module/icp/asm-aarch64/sha2/sha256-armv8.S | 3 + .../module/icp/asm-aarch64/sha2/sha512-armv8.S | 2 + sys/contrib/openzfs/module/zfs/vdev_label.c | 10 ++ sys/contrib/openzfs/tests/runfiles/common.run | 2 +- sys/contrib/openzfs/tests/runfiles/sanity.run | 2 +- .../openzfs/tests/zfs-tests/tests/Makefile.am | 1 + .../cli_root/zfs_set/zfs_set_nomount.ksh | 103 +++++++++++++++++++++ sys/modules/zfs/zfs_config.h | 4 +- sys/modules/zfs/zfs_gitrev.h | 2 +- 23 files changed, 253 insertions(+), 48 deletions(-) diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_nomount.ksh index 000000000000,ebf08711423c..ebf08711423c mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_nomount.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_nomount.ksh diff --cc sys/modules/zfs/zfs_config.h index b77a32e4754c,000000000000..b355e0cd6d0f mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,1149 -1,0 +1,1149 @@@ +/* + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* add_disk() returns int */ +/* #undef HAVE_ADD_DISK_RET */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +/* Define if you have [rt] */ +#define HAVE_AIO_H 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdevname() is available */ +/* #undef HAVE_BDEVNAME */ + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_*_io_acct() available */ +/* #undef HAVE_BDEV_IO_ACCT_63 */ + +/* bdev_*_io_acct() available */ +/* #undef HAVE_BDEV_IO_ACCT_OLD */ + +/* bdev_kobj() exists */ +/* #undef HAVE_BDEV_KOBJ */ + +/* bdev_max_discard_sectors() is available */ +/* #undef HAVE_BDEV_MAX_DISCARD_SECTORS */ + +/* bdev_max_secure_erase_sectors() is available */ +/* #undef HAVE_BDEV_MAX_SECURE_ERASE_SECTORS */ + +/* block_device_operations->submit_bio() returns void */ +/* #undef HAVE_BDEV_SUBMIT_BIO_RETURNS_VOID */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio_alloc() takes 4 arguments */ +/* #undef HAVE_BIO_ALLOC_4ARG */ + +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_dev() is a macro */ +/* #undef HAVE_BIO_SET_DEV_MACRO */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_get_by_path() exists and takes 4 args */ +/* #undef HAVE_BLKDEV_GET_BY_PATH_4ARG */ + +/* blkdev_get_by_path() handles ERESTARTSYS */ +/* #undef HAVE_BLKDEV_GET_ERESTARTSYS */ + +/* blkdev_issue_discard() is available */ +/* #undef HAVE_BLKDEV_ISSUE_DISCARD */ + +/* blkdev_issue_secure_erase() is available */ +/* #undef HAVE_BLKDEV_ISSUE_SECURE_ERASE */ + +/* blkdev_put() accepts void* as arg 2 */ +/* #undef HAVE_BLKDEV_PUT_HOLDER */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_disk() exists */ +/* #undef HAVE_BLK_ALLOC_DISK */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk_cleanup_disk() exists */ +/* #undef HAVE_BLK_CLEANUP_DISK */ + +/* blk_mode_t is defined */ +/* #undef HAVE_BLK_MODE_T */ + +/* block multiqueue is available */ +/* #undef HAVE_BLK_MQ */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_discard() is available */ +/* #undef HAVE_BLK_QUEUE_DISCARD */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_update_readahead() exists */ +/* #undef HAVE_BLK_QUEUE_UPDATE_READAHEAD */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* BLK_STS_RESV_CONFLICT is defined */ +/* #undef HAVE_BLK_STS_RESV_CONFLICT */ + +/* Define if release() in block_device_operations takes 1 arg */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG */ + +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_splice_read exists */ +/* #undef HAVE_COPY_SPLICE_READ */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* cpu_has_feature() is GPL-only */ +/* #undef HAVE_CPU_HAS_FEATURE_GPL_ONLY */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* dentry aliases are in d_u member */ +/* #undef HAVE_DENTRY_D_U_ALIASES */ + +/* dequeue_signal() takes 4 arguments */ +/* #undef HAVE_DEQUEUE_SIGNAL_4ARG */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* disk_check_media_change() exists */ +/* #undef HAVE_DISK_CHECK_MEDIA_CHANGE */ + +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + +/* disk_update_readahead() exists */ +/* #undef HAVE_DISK_UPDATE_READAHEAD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* FALLOC_FL_ZERO_RANGE is defined */ +/* #undef HAVE_FALLOC_FL_ZERO_RANGE */ + +/* fault_in_iov_iter_readable() is available */ +/* #undef HAVE_FAULT_IN_IOV_ITER_READABLE */ + +/* filemap_range_has_page() is available */ +/* #undef HAVE_FILEMAP_RANGE_HAS_PAGE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* fops->fadvise() exists */ +/* #undef HAVE_FILE_FADVISE */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* flush_dcache_page() is GPL-only */ +/* #undef HAVE_FLUSH_DCACHE_PAGE_GPL_ONLY */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* Define if compiler supports -Wformat-overflow */ +/* #undef HAVE_FORMAT_OVERFLOW */ + +/* fsync_bdev() is declared in include/blkdev.h */ +/* #undef HAVE_FSYNC_BDEV */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* yes */ +/* #undef HAVE_GENERIC_FADVISE */ + +/* generic_fillattr requires struct mnt_idmap* */ +/* #undef HAVE_GENERIC_FILLATTR_IDMAP */ + +/* generic_fillattr requires struct mnt_idmap* and u32 request_mask */ +/* #undef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK */ + +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_acl() exists */ +/* #undef HAVE_GET_ACL */ + +/* iops->get_acl() takes rcu */ +/* #undef HAVE_GET_ACL_RCU */ + +/* has iops->get_inode_acl() */ +/* #undef HAVE_GET_INODE_ACL */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* iattr->ia_vfsuid and iattr->ia_vfsgid exist */ +/* #undef HAVE_IATTR_VFSID */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* iops->getattr() takes struct mnt_idmap* */ +/* #undef HAVE_IDMAP_IOPS_GETATTR */ + +/* iops->setattr() takes struct mnt_idmap* */ +/* #undef HAVE_IDMAP_IOPS_SETATTR */ + +/* APIs for idmapped mount are present */ +/* #undef HAVE_IDMAP_MNT_API */ + +/* Define if compiler supports -Wimplicit-fallthrough */ +/* #undef HAVE_IMPLICIT_FALLTHROUGH */ + +/* Define if compiler supports -Winfinite-recursion */ +/* #undef HAVE_INFINITE_RECURSION */ + +/* inode_get_ctime() exists in linux/fs.h */ +/* #undef HAVE_INODE_GET_CTIME */ + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes mnt_idmap */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAP */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_USERNS */ + +/* inode_set_ctime_to_ts() exists in linux/fs.h */ +/* #undef HAVE_INODE_SET_CTIME_TO_TS */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iops->create() takes struct mnt_idmap* */ +/* #undef HAVE_IOPS_CREATE_IDMAP */ + +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct mnt_idmap* */ +/* #undef HAVE_IOPS_MKDIR_IDMAP */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct mnt_idmap* */ +/* #undef HAVE_IOPS_MKNOD_IDMAP */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->permission() takes struct mnt_idmap* */ +/* #undef HAVE_IOPS_PERMISSION_IDMAP */ + +/* iops->permission() takes struct user_namespace* */ +/* #undef HAVE_IOPS_PERMISSION_USERNS */ + +/* iops->rename() takes struct mnt_idmap* */ +/* #undef HAVE_IOPS_RENAME_IDMAP */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->setattr() exists */ +/* #undef HAVE_IOPS_SETATTR */ + +/* iops->symlink() takes struct mnt_idmap* */ +/* #undef HAVE_IOPS_SYMLINK_IDMAP */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter_type() is available */ +/* #undef HAVE_IOV_ITER_TYPE */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* iter_iov() is available */ +/* #undef HAVE_ITER_IOV */ + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* kernel has asm/fpu/internal.h */ +/* #undef HAVE_KERNEL_FPU_INTERNAL_HEADER */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* Define if compiler supports -Winfinite-recursion */ +/* #undef HAVE_KERNEL_INFINITE_RECURSION */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* linux/blk-cgroup.h exists */ +/* #undef HAVE_LINUX_BLK_CGROUP_HEADER */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* iops->mkdir() takes umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* folio_wait_bit() exists */ +/* #undef HAVE_PAGEMAP_FOLIO_WAIT_BIT */ + +/* part_to_dev() exists */ +/* #undef HAVE_PART_TO_DEV */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* struct reclaim_state has reclaimed */ +/* #undef HAVE_RECLAIM_STATE_RECLAIMED */ + +/* register_shrinker is vararg */ +/* #undef HAVE_REGISTER_SHRINKER_VARARG */ + +/* register_sysctl_table exists */ +/* #undef HAVE_REGISTER_SYSCTL_TABLE */ + +/* iops->rename2() exists */ +/* #undef HAVE_RENAME2 */ + +/* struct inode_operations_wrapper takes .rename2() */ +/* #undef HAVE_RENAME2_OPERATIONS_WRAPPER */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() accepts mnt_idmap */ +/* #undef HAVE_SETATTR_PREPARE_IDMAP */ + +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ + +/* iops->set_acl() exists, takes 3 args */ +/* #undef HAVE_SET_ACL */ + +/* iops->set_acl() takes 4 args, arg1 is struct mnt_idmap * */ +/* #undef HAVE_SET_ACL_IDMAP_DENTRY */ + +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + +/* iops->set_acl() takes 4 args, arg2 is struct dentry * */ +/* #undef HAVE_SET_ACL_USERNS_DENTRY_ARG2 */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* cs->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* standalone exists */ +/* #undef HAVE_STANDALONE_LINUX_STDARG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* sync_blockdev() is declared in include/blkdev.h */ +/* #undef HAVE_SYNC_BLOCKDEV */ + +/* struct kobj_type has default_groups */ +/* #undef HAVE_SYSFS_DEFAULT_GROUPS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* i_op->tmpfile() uses old dentry signature */ +/* #undef HAVE_TMPFILE_DENTRY */ + +/* i_op->tmpfile() has mnt_idmap */ +/* #undef HAVE_TMPFILE_IDMAP */ + +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + +/* iops->setattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_SETATTR */ + +/* user_namespace->ns.inum exists */ +/* #undef HAVE_USER_NS_COMMON_INUM */ + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* fops->clone_file_range() is available */ +/* #undef HAVE_VFS_CLONE_FILE_RANGE */ + +/* fops->copy_file_range() is available */ +/* #undef HAVE_VFS_COPY_FILE_RANGE */ + +/* fops->dedupe_file_range() is available */ +/* #undef HAVE_VFS_DEDUPE_FILE_RANGE */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* filemap_dirty_folio exists */ +/* #undef HAVE_VFS_FILEMAP_DIRTY_FOLIO */ + +/* file_operations_extend takes .copy_file_range() and .clone_file_range() */ +/* #undef HAVE_VFS_FILE_OPERATIONS_EXTEND */ + +/* generic_copy_file_range() is available */ +/* #undef HAVE_VFS_GENERIC_COPY_FILE_RANGE */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + *** 230 LINES SKIPPED *** From nobody Wed Oct 4 14:46:27 2023 X-Original-To: dev-commits-src-main@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 4S0yDz5rQyz4w3dW; Wed, 4 Oct 2023 14:46:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0yDz5BVsz4Fgm; Wed, 4 Oct 2023 14:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696430787; 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=Wxlh9G7bxMXjVnCnW+E+DyQiarMe5SX94EhKGeA3SYI=; b=IlZPXrkjroON4hJbH5IqtNcz9tu5Z+Dhj8tUmWnE9pNC4TBLXqzwcHk8f/uJmfFLzKLBq5 KqBJW0AwEeHFqd0Mw9skv5fMZ2Kkvd3xDbrlaYtWFgVZXSE3gz4yxCYH4hY0HcVBh4Jytv Hc+E7+0khYVsLgjmjmqY+QfzlHZGsfft12L7L/4+Ly3Xkg8SBct0QjlAkofsEqrcIN0kHK xX6t6PiHVNGIYHY32d3eKEnI4V0pu6eiG7+MCSCocx5ZZsCncbR4ByFCOCnB8Ph8dmwWG7 FIStklLD4xUocwNJBBrIBp4H9dZAUuKbj9kJSBORVqCuZ/ElQkm6cXdbKoCbjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696430787; a=rsa-sha256; cv=none; b=c5SfFSWZaenUakkLyCz0xc46pUEAZZ1xHuWyTmI37sK8EjSpSWMkEtZ+hKZ6ymT3Tfgk70 MAVOT2KGJAaYhGOqlPMgdDas4m5gMwMNDVkwxGFANsSvJtMQUseQEtkW9sJzl43/uUamzl G22vcQsysfx0OESqzIP/jUcHyz1TVIwVKH6mtMLy04AIGcibpGhmu2b86t7ShcM97PsWlN ZoIS6KfNv7HzzmMpwPLrqxIE53op0um4u/G/QEcXXU9sBT4+BolgitEPAGWpeJnFS7l/IA YQ7y3OLQrARAsgyMqq3DfJv1h3Npw/SC++aECj7EIuTQJLnxWH+PcYrAq7aURg== 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=1696430787; 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=Wxlh9G7bxMXjVnCnW+E+DyQiarMe5SX94EhKGeA3SYI=; b=P6hdOboWx+4k9stcXGmXvTGOUqeINwXhQTwO0dEV6uBp7a3f6vrPDbvgt0M2b1CqOqwvQj ndE9g2HOm/S9t94QrX2Ekd2o4YfDIcKczpf123J3PR0hwxxFNcslp4CYEPs5+fjJTH/GoF Up4gHUHjCu8terjEyId7rFbY2cy8BSLbll8lmwi3jp66Q+Fqp3JOXj+4f8jYgJWIlrPSMN P0pXg2C0KK4M1prGdYRAOzXkE2sY91pu8XXTNdFgsPsNMauRXTMhYn4fwy4bXOUUI2/aRe /gkizIR1+e/tq4s+IQpFiNhmSWCll0/E+KpTsT3da8odtyWV6DpduuyLB9iIrQ== 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 4S0yDz4Dt4zhVl; Wed, 4 Oct 2023 14:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394EkRIx020216; Wed, 4 Oct 2023 14:46:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394EkRsU020213; Wed, 4 Oct 2023 14:46:27 GMT (envelope-from git) Date: Wed, 4 Oct 2023 14:46:27 GMT Message-Id: <202310041446.394EkRsU020213@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 30beebe444f5 - main - freebsd-update: add a note about when files may be deleted List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30beebe444f5f415a388be9df91107246bd32674 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=30beebe444f5f415a388be9df91107246bd32674 commit 30beebe444f5f415a388be9df91107246bd32674 Author: Ed Maste AuthorDate: 2023-09-29 15:47:41 +0000 Commit: Ed Maste CommitDate: 2023-10-04 14:45:57 +0000 freebsd-update: add a note about when files may be deleted Files under /var/db/freebsd-update are required during the upgrade process, and to support rollback. They may be deleted if no upgrade is in progress and rollback will not be required. PR: 273601 Reviewed by: bcr Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42022 --- usr.sbin/freebsd-update/freebsd-update.8 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.8 b/usr.sbin/freebsd-update/freebsd-update.8 index 471ae359c917..0d50ac8822de 100644 --- a/usr.sbin/freebsd-update/freebsd-update.8 +++ b/usr.sbin/freebsd-update/freebsd-update.8 @@ -23,7 +23,7 @@ .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 10, 2022 +.Dd October 4, 2023 .Dt FREEBSD-UPDATE 8 .Os .Sh NAME @@ -251,7 +251,11 @@ configuration file. .It Pa /var/db/freebsd-update/ Default location where .Nm -stores temporary files and downloaded updates. +stores temporary files, downloaded updates, and files required for rollback. +All files under +.Pa /var/db/freebsd-update/ +may be deleted if an upgrade is not in progress and rollback will not be +required. .El .Sh SEE ALSO .Xr freebsd-version 1 , From nobody Wed Oct 4 15:08:28 2023 X-Original-To: dev-commits-src-main@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 4S0ykN4qsYz4w5Qt; Wed, 4 Oct 2023 15:08:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0ykN44NZz4KCq; Wed, 4 Oct 2023 15:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696432108; 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=KoYmcyjYN8WKFxddYBHIWiyDU2UVCpG5GdXPogn5syA=; b=qGd+3GOQ+3qlB/a2Ci522zY3Zlk5kba7Tj69Ggc32lKCoduADtqNO6otzmOpmGbwmm5WYx yehxp6z4X7NT3f2rS1xPUtiIOCSlshU3Zov9995cSDLumkl2Q+VAJ5Dmbzdv3yftW7x7tA dS5bo8vUokETfM8KkK2ztHH6+t4vjL8XDDUWZnExk9J2vTsqa6dm8xCeL5TVPG9P9/T8N1 EWyMUjCS4DOs5CceU+jJwbiSyU7FsfhXpAFf8cQ3thiGhAy/lDFdUJ3tBwZUiGyNAzEQez c9lrzCiL7CiMHh5xqwbJSkb7H173fT2uG7ji3ZTjfcjxrVyNQICjgNKTBPKamQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696432108; a=rsa-sha256; cv=none; b=q7ErFt9vTxUi/slrlrtUrMXg+xpAkBsCfMTnz4mAhg5/R0ft4gTPI7Ym2YfDnlyTi6bAmh tRIHEnwDhzwdi3yG913wVVhkRB5+yUIfwalBHj0l0tg4/r8tSrDPL1pfXsyFqmgEyRaGOP 7MfFkZrimKxcomvd0opCldS3cecTwOwT2QQOdzQGfcw1pHoTLMHJNhuRPMwpFWUffgfZOb waUDqWgfQ0JiTGWxqDk02BO2iQ7QReTcQxokKobkby7zlyoSgrGx/TYJgoXZhrkouuZn1t nEm2ooirbNoliKePZbrcO06TwykGLi8bxGPFDSkM4/o7QDn+li2QGjXKRYYE7w== 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=1696432108; 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=KoYmcyjYN8WKFxddYBHIWiyDU2UVCpG5GdXPogn5syA=; b=JzHmOhVUjOGEWXjdA4k37tLxBR8Ka/jGNyi2puOI71LYphkbYf6aD8yMsubZGsPzQTkIwg EQtgBwerTe/31CKijCs/UsOi5DFtVtce0urCA52+ob61F4uBRrgUVJNilUy8V9yRuVrHCM +gFuq7WMpvCWYXjtUV15dU6lVRR9m5876MiKndua40bAMGUXFDcyfes9ZQdbJUMsEc6lw0 WfUL5dpdN++8GGWQ285em81DddsJig2888TOAiIY+QP3iUf4Jsn8rrC0Lkbs+7P8huaU6V oMLlpFRrZH/c9lFmWeC/XhA8CA/VNCkeP3I2l65tCHPsLt82Gp1a7540Pi3ICQ== 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 4S0ykN37CmzjBw; Wed, 4 Oct 2023 15:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394F8STj053708; Wed, 4 Oct 2023 15:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394F8SAr053705; Wed, 4 Oct 2023 15:08:28 GMT (envelope-from git) Date: Wed, 4 Oct 2023 15:08:28 GMT Message-Id: <202310041508.394F8SAr053705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6962da914dd5 - main - axge: Add support for AX88179A List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6962da914dd511349b219241e92b32329be76fc6 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6962da914dd511349b219241e92b32329be76fc6 commit 6962da914dd511349b219241e92b32329be76fc6 Author: Damien Broka AuthorDate: 2023-09-19 16:26:06 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 15:08:06 +0000 axge: Add support for AX88179A The AX88179A has two firmware modes, one of which is backward compatible with existing AX88178A/179 driver. The active firmware mode can be controlled through a register. Update axge(4) man page to mention 179A support and ensure that, when bound to a AX88179A, the driver activates the compatible firmware mode. Reviewed by: markj Pull Request: https://github.com/freebsd/freebsd-src/pull/854 MFC after: 1 week --- share/man/man4/axge.4 | 12 ++++++------ sys/dev/usb/net/if_axge.c | 39 +++++++++++++++++++++++++++++++-------- sys/dev/usb/net/if_axgereg.h | 7 +++++++ 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/share/man/man4/axge.4 b/share/man/man4/axge.4 index d42a1a233c59..9ca268d6ff83 100644 --- a/share/man/man4/axge.4 +++ b/share/man/man4/axge.4 @@ -28,12 +28,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 24, 2015 +.Dd October 4, 2023 .Dt AXGE 4 .Os .Sh NAME .Nm axge -.Nd "ASIX Electronics AX88178A/AX88179 USB Gigabit Ethernet driver" +.Nd "ASIX Electronics AX88178A/179/179A USB Gigabit Ethernet driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -59,13 +59,13 @@ if_axge_load="YES" The .Nm driver provides support for USB Gigabit Ethernet adapters based on the ASIX -Electronics AX88179 USB 3.0 and AX88178A USB 2.0 chipsets. +Electronics AX88179/AX88179A USB 3.0 and AX88178A USB 2.0 chipsets. .Pp -The AX88179 and AX88178A contain a 10/100/1000 Ethernet MAC with a GMII -interface for interfacing with the Gigabit Ethernet PHY. +The AX88179, AX88179A and AX88178A contain a 10/100/1000 Ethernet MAC with a +GMII interface for interfacing with the Gigabit Ethernet PHY. .Pp These devices will operate with both USB 1.x and USB 2.0 controllers, and the -AX88179 will operate with USB 3.0 controllers. +AX88179/AX88179A will operate with USB 3.0 controllers. Packets are received and transmitted over separate USB bulk transfer endpoints. .Pp The diff --git a/sys/dev/usb/net/if_axge.c b/sys/dev/usb/net/if_axge.c index 385a982afd9d..cae1d61feb34 100644 --- a/sys/dev/usb/net/if_axge.c +++ b/sys/dev/usb/net/if_axge.c @@ -28,7 +28,8 @@ #include /* - * ASIX Electronics AX88178A/AX88179 USB 2.0/3.0 gigabit ethernet driver. + * ASIX Electronics AX88178A/AX88179/AX88179A USB 2.0/3.0 gigabit ethernet + * driver. */ #include @@ -70,13 +71,15 @@ */ static const STRUCT_USB_HOST_ID axge_devs[] = { -#define AXGE_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } - AXGE_DEV(ASIX, AX88178A), - AXGE_DEV(ASIX, AX88179), - AXGE_DEV(BELKIN, B2B128), - AXGE_DEV(DLINK, DUB1312), - AXGE_DEV(LENOVO, GIGALAN), - AXGE_DEV(SITECOMEU, LN032), +#define AXGE_DEV(v,p,i,...) \ + { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i), __VA_ARGS__ } + AXGE_DEV(ASIX, AX88178A, AXGE_FLAG_178A), + AXGE_DEV(ASIX, AX88179, AXGE_FLAG_179, USB_DEV_BCD_LTEQ(0x0100)), + AXGE_DEV(ASIX, AX88179, AXGE_FLAG_179A, USB_DEV_BCD_GTEQ(0x0200)), + AXGE_DEV(BELKIN, B2B128, AXGE_FLAG_179), + AXGE_DEV(DLINK, DUB1312, AXGE_FLAG_179), + AXGE_DEV(LENOVO, GIGALAN, AXGE_FLAG_179), + AXGE_DEV(SITECOMEU, LN032, AXGE_FLAG_179), #undef AXGE_DEV }; @@ -410,6 +413,24 @@ axge_chip_init(struct axge_softc *sc) axge_write_cmd_1(sc, AXGE_ACCESS_MAC, AXGE_CLK_SELECT, AXGE_CLK_SELECT_ACS | AXGE_CLK_SELECT_BCS); uether_pause(&sc->sc_ue, hz / 10); + + if ((sc->sc_flags & AXGE_FLAG_179A) != 0) { + /* + * 179A chip has two firmware modes that each use different + * transfer layouts for Ethernet over USB. The newer fw mode has + * larger rx packet headers which seem to + * accomodate for ethernet frames up to 9K length and a VLAN + * field for hardware tagging, but is not backward compatible + * with 178A/179 bulk transfer code due to the change in size + * and field alignments. The other fw mode uses the same packet + * headers as the older 178A/179 chips, which this driver uses. + * + * As we do not currently have VLAN hw tagging or jumbo support + * in this driver anyway, we're ok forcing 179A into its compat + * mode by default. + */ + axge_write_cmd_1(sc, AXGE_FW_MODE, AXGE_FW_MODE_178A179, 0); + } } static void @@ -551,6 +572,8 @@ axge_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sc->sc_flags = USB_GET_DRIVER_INFO(uaa); + iface_index = AXGE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, axge_config, AXGE_N_TRANSFER, sc, &sc->sc_mtx); diff --git a/sys/dev/usb/net/if_axgereg.h b/sys/dev/usb/net/if_axgereg.h index ea7a2c4a98b8..87e662b6cbc1 100644 --- a/sys/dev/usb/net/if_axgereg.h +++ b/sys/dev/usb/net/if_axgereg.h @@ -32,10 +32,14 @@ #define AXGE_ACCESS_EEPROM 0x04 #define AXGE_ACCESS_EFUSE 0x05 #define AXGE_RELOAD_EEPROM_EFUSE 0x06 +#define AXGE_FW_MODE 0x08 #define AXGE_WRITE_EFUSE_EN 0x09 #define AXGE_WRITE_EFUSE_DIS 0x0A #define AXGE_ACCESS_MFAB 0x10 +#define AXGE_FW_MODE_178A179 0x0000 +#define AXGE_FW_MODE_179A 0x0001 + /* Physical link status register */ #define AXGE_PLSR 0x02 #define PLSR_USB_FS 0x01 @@ -202,6 +206,9 @@ struct axge_softc { int sc_flags; #define AXGE_FLAG_LINK 0x0001 /* got a link */ +#define AXGE_FLAG_178A 0x1000 /* AX88178A */ +#define AXGE_FLAG_179 0x2000 /* AX88179 */ +#define AXGE_FLAG_179A 0x4000 /* AX88179A */ }; #define AXGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) From nobody Wed Oct 4 15:54:14 2023 X-Original-To: dev-commits-src-main@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 4S0zlB4XkFz4w9Fw; Wed, 4 Oct 2023 15:54:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0zlB3kxbz4Zhp; Wed, 4 Oct 2023 15:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696434854; 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=MkNJ7wiEyn6+/fDz0hHP6oV/3D8yyYfUrDVdhX9ZF4E=; b=orEsBCN+KVr1bHN6lqxLEF1K7CkAUcHjil6w5T2X5Kqh1LbFdF20TV6+5Fs4k3KPmEyayW 8sxU7fqolZsuNVjFJlHP1L6bmGLYr95GC9GjXz6ueNMs1Si/gUh0R8QFbfonTIDC2o/JvF NBxsmoNY+HnfmQA/GmQeKYo/WmLI/gOxhtYjlvzoyShXJHzdlqBooTZOqcxMtn0kNUappa VtqkU9G2ou+ZbUVYIPy+9RBU2ZLCRe7h9yo2rNHHpD7NU5lPdnls/+IX89dNOZG2ZCpBQ6 L4sVll85UWlFKsosnf7ORMfcEqOttTHb80vODtjbod5hm6IFR3t7C3U7xmeJsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696434854; a=rsa-sha256; cv=none; b=gaP4M2lJMbyni3pZ2WCko1H9jR8dtYgC8rtWSkadzJJiqL4pcnhXBAf8isGfepHEcQNeEL 7vkRX7Kf6wAUhD0i6JSAay/+0nhE7kmpb0OPaHNbWcXko3sDIyHoHaLYILexqfvJc6FpIq Kpc0XcId9MBhcy+Uw40WPh5Gk2aQhHda4YWd/Q5SE7R3/Rn0Srza7C91vCA0rjCaHOWdY3 XbWdcbAUEzg596hUx7vxncxSDRjKDhLmFtDICCAqdf9Lw/VZJgsHFfEo0xjtYTQ23PO4+v JPO0ire8F8eI6UABJIXFBL4Ct7+WeuiFy+wsyWgmEUqlYITDgxJ+nqR504HYHg== 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=1696434854; 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=MkNJ7wiEyn6+/fDz0hHP6oV/3D8yyYfUrDVdhX9ZF4E=; b=baA7AhBoRu7Z3X3PpC8EXed4BXGKL7UjjxuLlwbT+CCCK2oGbpbKtzJLCd9/eZ55CzGqXm LIrr40rpLhVB/zoHNSXlVINGrIyw+pa9D9x4W+DnxYQuCGp/BZ6dJE06uwwD39VT73UBwx tyl3soKK32eu9Ctgb68yJb7Dn9q/+rOqikUO5rCv9zpH0867JokhB/xnrkbl6Qp1VFd6qr 8ueGNi+29s86qHX7tUvmgBD8r8RM4SXUU/zFFWYCdJzeqfl/Xeqfdcx4nOJOBNS/DW7si0 y8cev4+1X0y2im18be7MRIIHnDHYJ3mN4KriP/0DEhKcRTQXSXz5dyilJjO0sA== 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 4S0zlB2n2jzkTT; Wed, 4 Oct 2023 15:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394FsE5o037711; Wed, 4 Oct 2023 15:54:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394FsERk037708; Wed, 4 Oct 2023 15:54:14 GMT (envelope-from git) Date: Wed, 4 Oct 2023 15:54:14 GMT Message-Id: <202310041554.394FsERk037708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4b38c532efb9 - main - mount.8: Mention tarfs(5) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b38c532efb9845898d63546da57d843b3b1c1a6 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4b38c532efb9845898d63546da57d843b3b1c1a6 commit 4b38c532efb9845898d63546da57d843b3b1c1a6 Author: Jose Luis Duran AuthorDate: 2023-10-04 15:42:40 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 15:52:40 +0000 mount.8: Mention tarfs(5) Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/856 --- sbin/mount/mount.8 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8 index 5632ad678ffb..91e697bdc3b8 100644 --- a/sbin/mount/mount.8 +++ b/sbin/mount/mount.8 @@ -27,7 +27,7 @@ .\" .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" -.Dd March 17, 2022 +.Dd October 4, 2023 .Dt MOUNT 8 .Os .Sh NAME @@ -569,6 +569,7 @@ support for a particular file system might be provided either on a static .Xr ext2fs 5 , .Xr fstab 5 , .Xr procfs 5 , +.Xr tarfs 5 , .Xr tmpfs 5 , .Xr automount 8 , .Xr fstyp 8 , From nobody Wed Oct 4 16:12:14 2023 X-Original-To: dev-commits-src-main@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 4S107z0TDpz4wBVy; Wed, 4 Oct 2023 16:12:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S107z04qXz4c6p; Wed, 4 Oct 2023 16:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696435935; 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=MULri9xjy8jMR9Gt9I0qw0R5ACDh2TY2oWVWyXSvy2s=; b=yZRrT2B/V4zXVpiiS/dUB9ArssJ3VxCHU/epQEpNA04p9CZr4uxkBICEe/57NNZ7tRPJ05 RB/VAypJD0U/82uk9qvZzqk/uyQQfz2Xsx1Ddx+H1z6daAyPxL2k4KRXorv2HksBUOqWCi YJ7hQBNwtJRpKCotSf7oAWfEzijq1EHnjb/LOu7U1TMe/P2voRC0O19H1KeqIoUpBTJQ4N OmfNO+N+fS7oSjctgvcqpdSU/BQds+aw33RQm4H+yy6YtCmj/tvth2cXIseam2c6UiwInb aAd6QDDgvZeae8NBJ4cddJhRTJt/qeaB9tJ0F1u7yCo9sISSq6Vne7tWnERc5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696435935; a=rsa-sha256; cv=none; b=M/2btSuKZOPxVHL5xzeZLzkmZPAp/H+i+TGAQ7y5oDG4EKsLxaoL5nLm4gF53GLifU4ygy 4kc37mmnO0kEd/DUl/IjfsJn0eizEh2SXjzfRZxyj4E8KDjbymko/g4hTmJNjslWmqOoUi 6p31tckrwfY+5Zb8pXgP5j9v6KAWE1FaRXk3NPUews2F3C0SyYqCI+gNj1IUbK0AbOWGUh oo+mW/Q816pCRe7wUfudueKuHZ2ges3osvrldxcm52C+CIVIX98SJU3x35Cc/uHyHQKmd/ mJEfiwkPh/yvZHZun6QtHehA3U6KZFvlZy+Z99If55d4u1eB9nXNtYgTomtV0A== 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=1696435935; 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=MULri9xjy8jMR9Gt9I0qw0R5ACDh2TY2oWVWyXSvy2s=; b=TeN1YIc5d2FRkQaTnT//kOh0BWJdtoSLsPWA0+5ewAZqblOXSLxZLSGwbP7HfSPzCYP7fa APduOgqEyiVQpcnD+6btn4LJiqxRF4gQ9JUGIIqA3OuVonW03r9qoDBeqGd03beO3xugqF 1zQ1ppcQj2H2PKnNsETXouBNIci/gnJZjWT7nf6R5MMIcMcP9EcvDMmHZ+rI2Waut86Vee ggqclNo3hMi8DM/HEzC1la++bcbTPOke8VAvKB1/Mf2tEG1Hkat8DI4iocluAnnMQ/xIyO /Cvju8OV8uF/9TnvjH3QWTjlWFq/NgQFSsOyOX0NnLlhKKmTEDY4atB38wyY7g== 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 4S107y6DsBzkyZ; Wed, 4 Oct 2023 16:12:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GCEtj071452; Wed, 4 Oct 2023 16:12:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GCEhv071446; Wed, 4 Oct 2023 16:12:14 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:12:14 GMT Message-Id: <202310041612.394GCEhv071446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 61ba55bcf70f - main - bsddialog: import version 1.0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61ba55bcf70f2340f9c943c9571113b3fd8eda69 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=61ba55bcf70f2340f9c943c9571113b3fd8eda69 commit 61ba55bcf70f2340f9c943c9571113b3fd8eda69 Merge: 4b38c532efb9 e56a937c3e11 Author: Baptiste Daroussin AuthorDate: 2023-10-04 16:11:36 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-04 16:12:03 +0000 bsddialog: import version 1.0 contrib/bsddialog/.gitignore | 2 + contrib/bsddialog/CHANGELOG | 194 ++- contrib/bsddialog/GNUMakefile | 28 - contrib/bsddialog/LICENSE | 2 +- contrib/bsddialog/Makefile | 62 +- contrib/bsddialog/README.md | 35 +- contrib/bsddialog/bsddialog.c | 1687 -------------------- contrib/bsddialog/examples_library/calendar.c | 22 +- contrib/bsddialog/examples_library/checklist.c | 11 +- contrib/bsddialog/examples_library/compile | 2 +- contrib/bsddialog/examples_library/datebox.c | 21 +- contrib/bsddialog/examples_library/form.c | 11 +- contrib/bsddialog/examples_library/gauge.c | 57 + contrib/bsddialog/examples_library/infobox.c | 6 +- contrib/bsddialog/examples_library/menu.c | 11 +- contrib/bsddialog/examples_library/mixedgauge.c | 79 + contrib/bsddialog/examples_library/mixedlist.c | 21 +- contrib/bsddialog/examples_library/msgbox.c | 9 +- contrib/bsddialog/examples_library/pause.c | 21 +- contrib/bsddialog/examples_library/radiolist.c | 14 +- contrib/bsddialog/examples_library/rangebox.c | 7 +- contrib/bsddialog/examples_library/theme.c | 46 +- contrib/bsddialog/examples_library/timebox.c | 18 +- contrib/bsddialog/examples_library/yesno.c | 11 +- contrib/bsddialog/examples_utility/checklist.sh | 16 +- contrib/bsddialog/examples_utility/datebox.sh | 34 + contrib/bsddialog/examples_utility/form.sh | 4 +- contrib/bsddialog/examples_utility/infobox.sh | 2 +- contrib/bsddialog/examples_utility/inputbox.sh | 5 +- contrib/bsddialog/examples_utility/menu.sh | 13 +- contrib/bsddialog/examples_utility/mixedform.sh | 4 +- contrib/bsddialog/examples_utility/mixedgauge.sh | 10 +- contrib/bsddialog/examples_utility/passwordbox.sh | 4 +- contrib/bsddialog/examples_utility/passwordform.sh | 4 +- contrib/bsddialog/examples_utility/radiolist.sh | 18 +- contrib/bsddialog/examples_utility/rangebox.sh | 33 + contrib/bsddialog/lib/{GNUMakefile => GNUmakefile} | 15 +- contrib/bsddialog/lib/Makefile | 49 +- contrib/bsddialog/lib/barbox.c | 705 ++++---- contrib/bsddialog/lib/bsddialog.3 | 626 +++++--- contrib/bsddialog/lib/bsddialog.h | 44 +- contrib/bsddialog/lib/bsddialog_progressview.h | 8 +- contrib/bsddialog/lib/bsddialog_theme.h | 28 +- contrib/bsddialog/lib/calendarbox.c | 520 ------ contrib/bsddialog/lib/datebox.c | 715 +++++++++ contrib/bsddialog/lib/formbox.c | 940 ++++++----- contrib/bsddialog/lib/infobox.c | 96 -- contrib/bsddialog/lib/lib_util.c | 1157 ++++++++------ contrib/bsddialog/lib/lib_util.h | 169 +- contrib/bsddialog/lib/libbsddialog.c | 38 +- contrib/bsddialog/lib/menubox.c | 837 +++++----- contrib/bsddialog/lib/messagebox.c | 250 ++- contrib/bsddialog/lib/textbox.c | 268 ++-- contrib/bsddialog/lib/theme.c | 254 ++- contrib/bsddialog/lib/timebox.c | 479 +----- contrib/bsddialog/util_theme.c | 353 ---- contrib/bsddialog/util_theme.h | 36 - contrib/bsddialog/utility/GNUmakefile | 33 + contrib/bsddialog/utility/Makefile | 33 + contrib/bsddialog/{ => utility}/bsddialog.1 | 345 ++-- contrib/bsddialog/utility/bsddialog.c | 338 ++++ contrib/bsddialog/utility/util.h | 125 ++ contrib/bsddialog/utility/util_builders.c | 768 +++++++++ contrib/bsddialog/utility/util_cli.c | 841 ++++++++++ contrib/bsddialog/utility/util_theme.c | 451 ++++++ lib/libbsddialog/Makefile | 3 +- usr.bin/bsddialog/Makefile | 9 +- usr.sbin/bsdinstall/partedit/diskmenu.c | 6 +- usr.sbin/bsdinstall/partedit/diskmenu.h | 4 +- usr.sbin/bsdinstall/partedit/gpart_ops.c | 7 +- usr.sbin/bsdinstall/partedit/part_wizard.c | 4 +- usr.sbin/bsdinstall/partedit/partedit.c | 2 +- 72 files changed, 6891 insertions(+), 6189 deletions(-) diff --cc contrib/bsddialog/.gitignore index 8b8ec9d4ae0b,000000000000..c8fc68ed8a0e mode 100644,000000..100644 --- a/contrib/bsddialog/.gitignore +++ b/contrib/bsddialog/.gitignore @@@ -1,24 -1,0 +1,26 @@@ +bsddialog +.depend* +*.o +*.so* +*.a +*.gz +*.core +*~ +BSDDIALOG.geany +BSDDIALOG.tags +examples_library/calendar +examples_library/checklist +examples_library/datebox +examples_library/form ++examples_library/gauge +examples_library/infobox +examples_library/menu ++examples_library/mixedgauge +examples_library/mixedlist +examples_library/msgbox +examples_library/pause +examples_library/radiolist +examples_library/rangebox +examples_library/theme +examples_library/timebox +examples_library/yesno diff --cc contrib/bsddialog/Makefile index 28162c5e90b3,000000000000..884cfa1b3e60 mode 100644,000000..100644 --- a/contrib/bsddialog/Makefile +++ b/contrib/bsddialog/Makefile @@@ -1,50 -1,0 +1,38 @@@ +# PUBLIC DOMAIN - NO WARRANTY, see: +# +# - # Written in 2021 by Alfonso Sabato Siciliano ++# Written in 2023 by Alfonso Sabato Siciliano + - OUTPUT= bsddialog - SOURCES= bsddialog.c util_theme.c - OBJECTS= ${SOURCES:.c=.o} - LIBPATH= ${.CURDIR}/lib - LIBBSDDIALOG= ${LIBPATH}/libbsddialog.so ++OUTPUT = bsddialog ++export VERSION=1.0 ++.CURDIR ?= ${CURDIR} ++LIBPATH = ${.CURDIR}/lib ++LIBBSDDIALOG = ${LIBPATH}/libbsddialog.so ++UTILITYPATH = ${.CURDIR}/utility + - CFLAGS+= -I${LIBPATH} -std=gnu99 -Wall -Wextra -Werror - # `make -DDEBUG` - .if defined(DEBUG) - CFLAGS= -g -Wall -I${LIBPATH} - LIBDEBUG= -DDEBUG - .endif - LDFLAGS+= -ltinfow -Wl,-rpath=${LIBPATH} -L${LIBPATH} -lbsddialog - - BINDIR= /usr/local/bin - MAN= ${OUTPUT}.1 - GZIP= gzip -cn - MANDIR= /usr/local/share/man/man1 - - INSTALL= install +RM= rm -f ++LN = ln -s -f ++ ++### cli options ### ++# port/pkg Makefile: 'MAKE_ARGS = -DNORPATH' ++NORPATH ?= ++export DISABLERPATH=${NORPATH} ++# `make -DDEBUG` ++# `gmake DEBUG=1` ++DEBUG ?= ++export ENABLEDEBUG=${DEBUG} + +all : ${OUTPUT} + - ${OUTPUT}: ${LIBBSDDIALOG} ${OBJECTS} - ${CC} ${LDFLAGS} ${OBJECTS} -o ${.PREFIX} ++${OUTPUT}: ${LIBBSDDIALOG} ++ ${MAKE} -C ${UTILITYPATH} LIBPATH=${LIBPATH} ++ ${LN} ${UTILITYPATH}/${OUTPUT} ${.CURDIR}/${OUTPUT} + +${LIBBSDDIALOG}: - make -C ${LIBPATH} ${LIBDEBUG} - - .c.o: - ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} - - install: - ${INSTALL} -s -m 555 ${OUTPUT} ${BINDIR} - ${GZIP} ${MAN} > ${MAN}.gz - ${INSTALL} -m 444 ${MAN}.gz ${MANDIR} - - unistall: - ${RM} ${BINDIR}/${OUTPUT} - ${RM} ${MANDIR}/${MAN}.gz ++ ${MAKE} -C ${LIBPATH} + +clean: - make -C ${LIBPATH} clean - ${RM} ${OUTPUT} *.o *~ *.core ${MAN}.gz ++ ${MAKE} -C ${LIBPATH} clean ++ ${MAKE} -C ${UTILITYPATH} clean ++ ${RM} ${OUTPUT} *.core ++ diff --cc contrib/bsddialog/README.md index 59af7072e7f5,000000000000..f4846ec07745 mode 100644,000000..100644 --- a/contrib/bsddialog/README.md +++ b/contrib/bsddialog/README.md @@@ -1,120 -1,0 +1,131 @@@ - # BSDDialog 0.4 ++# BSDDialog 1.0 + +This project provides **bsddialog** and **libbsddialog**, an utility +and a library to build scripts and tools with TUI dialogs and widgets. ++ ++ ++## Demo ++ +[Screenshots](https://www.flickr.com/photos/alfonsosiciliano/albums/72157720215006074). + + +## Getting Started + - FreeBSD: ++FreeBSD and Linux: + +``` +% git clone https://gitlab.com/alfix/bsddialog.git +% cd bsddialog +% make +% ./bsddialog --msgbox "Hello World!" 8 20 +``` + - Linux: - - ``` - % git clone https://gitlab.com/alfix/bsddialog.git - % cd bsddialog - % make -f GNUMakefile - % ./bsddialog --msgbox "Hello World!" 8 20 - ``` - +Output: + +![screenshot](screenshot.png) + + +## Utility + +**Dialogs:** + +--calendar, --checklist, --datebox, --form, --gauge, --infobox, --inputbox, +--menu, --mixedform, --mixedgauge, --msgbox, --passwordbox, --passwordform, +--pause, --radiolist, --rangebox, --textbox, --timebox, --treeview, --yesno. + +**Manual** + + - [bsddialog(1)](https://alfonsosiciliano.gitlab.io/posts/2022-01-26-manual-bsddialog.html) + + +**Examples**: + +``` +% ./bsddialog --backtitle "TITLE" --title msgbox --msgbox "Hello World!" 5 30 +% ./bsddialog --theme blackwhite --title msgbox --msgbox "Hello World!" 5 30 +% ./bsddialog --begin-y 2 --default-no --title yesno --yesno "Hello World!" 5 30 +% ./bsddialog --ascii-lines --pause "Hello World!" 8 50 10 +% ./bsddialog --checklist "Space to select" 0 0 0 Name1 Desc1 off Name2 Desc2 on +% ./bsddialog --title yesno --hline "bsddialog" --yesno "Hello World!" 5 25 +% ./bsddialog --extra-button --help-button --yesno "Hello World!" 0 0 +``` + +and [Examples](https://gitlab.com/alfix/bsddialog/-/tree/main/examples_utility) +in the _Public Domain_ to build new projects: +``` +% sh ./examples_utility/calendar.sh +% sh ./examples_utility/checklist.sh ++% sh ./examples_utility/datebox.sh +% sh ./examples_utility/form.sh +% sh ./examples_utility/gauge.sh +% sh ./examples_utility/infobox.sh +% sh ./examples_utility/inputbox.sh +% sh ./examples_utility/menu.sh +% sh ./examples_utility/mixedform.sh +% sh ./examples_utility/mixedgauge.sh +% sh ./examples_utility/msgbox.sh +% sh ./examples_utility/passwordbox.sh +% sh ./examples_utility/passwordform.sh +% sh ./examples_utility/pause.sh +% sh ./examples_utility/radiolist.sh ++% sh ./examples_utility/rangebox.sh +% sh ./examples_utility/timebox.sh +% sh ./examples_utility/yesno.sh +``` + +## Library + +**API** + + - [bsddialog.h](https://gitlab.com/alfix/bsddialog/-/blob/main/lib/bsddialog.h) + - [bsddialog\_theme.h](https://gitlab.com/alfix/bsddialog/-/blob/main/lib/bsddialog_theme.h) + + +**Manual** + + - [bsddialog(3)](https://alfonsosiciliano.gitlab.io/posts/2022-01-15-manual-libbsddialog.html) + + +**Examples**: + +[Examples](https://gitlab.com/alfix/bsddialog/-/tree/main/examples_library) +in the _Public Domain_ to build new projects: +``` +% cd examples_library +% sh compile +% ./calendar +% ./checklist +% ./datebox +% ./form ++% ./gauge +% ./infobox +% ./menu ++% ./mixedgauge +% ./mixedlist +% ./msgbox +% ./pause +% ./radiolist +% ./rangebox +% ./theme +% ./timebox +% ./yesno +``` + + +## TODO and Ideas - ++ + - menubar feature + - key callback + - Right-To-Left text ++ - some terminal does not hide the cursor, move it bottom-right before to getch. ++ - refactor backtitle: multiline, conf.backtitle, WINDOW \*dialog.backtitle. ++ - refactor bottomdesc: WINDOW \*dialog.bottomdesc -> fix expandig screen. ++ - accessibility https://wiki.freebsd.org/Accessibility/Wishlist/Base ++ - add bool conf.menu.depthlines. ++ - implement custom getopt\_long(). ++ - refactor/redesign gauge(). ++ - improve grey lines expanding terminal (maybe redrawwin() in hide\_dialog()). ++ - more restrictive strtol() and strtoul(). ++ - implement global buttons handler. ++ - add/move external tutorial. ++ - implement menutype.min_on. diff --cc contrib/bsddialog/examples_library/gauge.c index 000000000000,3b38a80f3f2c..3b38a80f3f2c mode 000000,100644..100644 --- a/contrib/bsddialog/examples_library/gauge.c +++ b/contrib/bsddialog/examples_library/gauge.c diff --cc contrib/bsddialog/examples_library/mixedgauge.c index 000000000000,7666867902fb..7666867902fb mode 000000,100644..100644 --- a/contrib/bsddialog/examples_library/mixedgauge.c +++ b/contrib/bsddialog/examples_library/mixedgauge.c diff --cc contrib/bsddialog/examples_utility/datebox.sh index 000000000000,bea4559dfbec..bea4559dfbec mode 000000,100755..100755 --- a/contrib/bsddialog/examples_utility/datebox.sh +++ b/contrib/bsddialog/examples_utility/datebox.sh diff --cc contrib/bsddialog/examples_utility/rangebox.sh index 000000000000,9b3213d8acad..9b3213d8acad mode 000000,100644..100644 --- a/contrib/bsddialog/examples_utility/rangebox.sh +++ b/contrib/bsddialog/examples_utility/rangebox.sh diff --cc contrib/bsddialog/lib/Makefile index 0f536fb38743,000000000000..252b33f79848 mode 100644,000000..100644 --- a/contrib/bsddialog/lib/Makefile +++ b/contrib/bsddialog/lib/Makefile @@@ -1,75 -1,0 +1,44 @@@ +# PUBLIC DOMAIN - NO WARRANTY, see: +# +# +# Written in 2021 by Alfonso Sabato Siciliano + - VERSION = 0.4 +LIBRARY = bsddialog +LIBRARY_SO = lib${LIBRARY:=.so} +LIBRARY_A = lib${LIBRARY:=.a} +HEADERS = bsddialog.h bsddialog_theme.h bsddialog_progressview.h - SOURCES = barbox.c calendarbox.c formbox.c infobox.c libbsddialog.c \ - lib_util.c menubox.c messagebox.c textbox.c theme.c timebox.c ++SOURCES = barbox.c datebox.c formbox.c libbsddialog.c lib_util.c \ ++ menubox.c messagebox.c textbox.c theme.c timebox.c +OBJECTS = ${SOURCES:.c=.o} - CFLAGS += -D_XOPEN_SOURCE_EXTENDED -fPIC -Wall -Wextra - LDFLAGS += -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings \ - -Wl,--warn-shared-textrel -Wl,-soname,${LIBRARY_SO}.${VERSION} \ - -L/usr/lib -lncursesw -ltinfow + +.if defined(DEBUG) - # `make -DDEBUG` - CFLAGS = -g -D_XOPEN_SOURCE_EXTENDED -fPIC -Wall -Wextra - .else - CFLAGS += -std=gnu99 -fstack-protector-strong ++CFLAGS += -g +.endif ++CFLAGS += -D_XOPEN_SOURCE_EXTENDED -fPIC -Wall -Wextra -std=gnu99 \ ++ -fstack-protector-strong ++LDFLAGS += -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings \ ++ -Wl,--warn-shared-textrel -Wl,-soname,${LIBRARY_SO}.${VERSION} \ ++ -L/usr/lib -lncursesw -ltinfow + - LOCALBASE = /usr/local +LN = ln -s -f +RM = rm -f - CP = cp - GZIP = gzip -cn - LDCONFIG = /sbin/ldconfig -m - MAN = ${OUTPUT}.3 - GZIP = gzip -cn - MANDIR = ${LOCALBASE}/share/man/man3 - INSTALL = install - RM = rm -f + - all : man ${LIBRARY} ++all : ${LIBRARY} + +${LIBRARY}: ${LIBRARY_SO} ${LIBRARY_A} + +${LIBRARY_SO}.${VERSION}: ${OBJECTS} + ${CC} ${LDFLAGS} ${.ALLSRC} -o ${LIBRARY_SO}.${VERSION} + +${LIBRARY_SO}: ${LIBRARY_SO}.${VERSION} + ${LN} ${LIBRARY_SO}.${VERSION} ${LIBRARY_SO} + +${LIBRARY_A}: ${OBJECTS} + ${AR} cr ${.TARGET} ${OBJECTS} + ${RANLIB} ${.TARGET} + +.c.o: + ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + - man: - ${GZIP} ${LIBRARY}.3 > ${LIBRARY}.3.gz - +clean: + ${RM} ${LIBRARY_SO}* *.o *~ *.gz ${LIBRARY_A} - - - install: - ${INSTALL} -m 644 ${HEADERS} ${LOCALBASE}/include - ${INSTALL} -m 644 -s ${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/ - ${INSTALL} -l rs ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/${LIBRARY_SO} - ${INSTALL} -m 644 ${LIBRARY_A} ${LOCALBASE}/lib - ${LDCONFIG} ${LOCALBASE}/lib - ${INSTALL} -m 644 ${LIBRARY}.3.gz ${MANDIR} - - unistall: - ${RM} ${LOCALBASE}/include/${LIBRARY}*.h - ${RM} ${LOCALBASE}/lib/${LIBRARY_SO} - ${RM} ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION} - ${LDCONFIG} ${LOCALBASE}/lib - ${RM} ${MANDIR}/${LIBRARY}.3.gz diff --cc contrib/bsddialog/lib/datebox.c index 000000000000,9f26b2d08093..9f26b2d08093 mode 000000,100644..100644 --- a/contrib/bsddialog/lib/datebox.c +++ b/contrib/bsddialog/lib/datebox.c diff --cc contrib/bsddialog/utility/GNUmakefile index 000000000000,518ec0d912d6..518ec0d912d6 mode 000000,100644..100644 --- a/contrib/bsddialog/utility/GNUmakefile +++ b/contrib/bsddialog/utility/GNUmakefile diff --cc contrib/bsddialog/utility/Makefile index 000000000000,ab51b46a25be..ab51b46a25be mode 000000,100644..100644 --- a/contrib/bsddialog/utility/Makefile +++ b/contrib/bsddialog/utility/Makefile diff --cc contrib/bsddialog/utility/bsddialog.c index 000000000000,d4d1fc3e0f3a..d4d1fc3e0f3a mode 000000,100644..100644 --- a/contrib/bsddialog/utility/bsddialog.c +++ b/contrib/bsddialog/utility/bsddialog.c diff --cc contrib/bsddialog/utility/util.h index 000000000000,2750c2ee6951..2750c2ee6951 mode 000000,100644..100644 --- a/contrib/bsddialog/utility/util.h +++ b/contrib/bsddialog/utility/util.h diff --cc contrib/bsddialog/utility/util_builders.c index 000000000000,2dfa20cb0f86..2dfa20cb0f86 mode 000000,100644..100644 --- a/contrib/bsddialog/utility/util_builders.c +++ b/contrib/bsddialog/utility/util_builders.c diff --cc contrib/bsddialog/utility/util_cli.c index 000000000000,22bed6550fb5..22bed6550fb5 mode 000000,100644..100644 --- a/contrib/bsddialog/utility/util_cli.c +++ b/contrib/bsddialog/utility/util_cli.c diff --cc contrib/bsddialog/utility/util_theme.c index 000000000000,c313d743252b..c313d743252b mode 000000,100644..100644 --- a/contrib/bsddialog/utility/util_theme.c +++ b/contrib/bsddialog/utility/util_theme.c diff --cc lib/libbsddialog/Makefile index ddb7e08f71ba,000000000000..8b02205a0d23 mode 100644,000000..100644 --- a/lib/libbsddialog/Makefile +++ b/lib/libbsddialog/Makefile @@@ -1,28 -1,0 +1,27 @@@ +BSDDIALOG= ${SRCTOP}/contrib/bsddialog + +.PATH: ${BSDDIALOG}/lib + +LIB= bsddialog +PRIVATELIB= yes +SHLIB_MAJOR= 0 +SRCS= barbox.c \ - calendarbox.c \ ++ datebox.c \ + formbox.c \ - infobox.c \ + lib_util.c \ + lib_util.h \ + libbsddialog.c \ + menubox.c \ + messagebox.c \ + textbox.c \ + theme.c \ + timebox.c +INCS= bsddialog.h \ + bsddialog_theme.h \ + bsddialog_progressview.h +MAN= bsddialog.3 + +LIBADD= ncursesw tinfow formw +CFLAGS+= -D_XOPEN_SOURCE_EXTENDED + +.include diff --cc usr.bin/bsddialog/Makefile index 1c2f9d697e97,000000000000..24a75aaf2f96 mode 100644,000000..100644 --- a/usr.bin/bsddialog/Makefile +++ b/usr.bin/bsddialog/Makefile @@@ -1,10 -1,0 +1,13 @@@ - BSDDIALOG= ${SRCTOP}/contrib/bsddialog ++BSDDIALOG= ${SRCTOP}/contrib/bsddialog/utility +.PATH: ${BSDDIALOG} + +PROG= bsddialog - SRCS= bsddialog.c util_theme.c ++SRCS= bsddialog.c \ ++ util_builders.c \ ++ util_cli.c \ ++ util_theme.c +MAN= bsddialog.1 - CFLAGS+= -I${BSDDIALOG}/lib ++CFLAGS+= -I${BSDDIALOG}/../lib +LIBADD= bsddialog tinfow + +.include diff --cc usr.sbin/bsdinstall/partedit/diskmenu.c index 9e16ef96171a,000000000000..6a14ee831e18 mode 100644,000000..100644 --- a/usr.sbin/bsdinstall/partedit/diskmenu.c +++ b/usr.sbin/bsdinstall/partedit/diskmenu.c @@@ -1,90 -1,0 +1,90 @@@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2022 Alfonso Sabato Siciliano + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "diskmenu.h" + +int +diskmenu_show(const char *title, const char *text, struct partedit_item *items, + int nitems, int *focusitem) +{ + int i, output; + char size[16], *mp; + struct bsddialog_menuitem *bsditems; + struct bsddialog_conf conf; + + bsditems = malloc(nitems * sizeof(struct bsddialog_menuitem)); + if (bsditems == NULL) + return BSDDIALOG_ERROR; + for (i = 0; i < nitems; i++) { + bsditems[i].prefix = ""; + bsditems[i].on = false; + bsditems[i].depth = items[i].indentation; + /* old menu sets max namelen to 10 */ + bsditems[i].name = items[i].name; + humanize_number(size, 7, items[i].size, "B", + HN_AUTOSCALE, HN_DECIMAL); + mp = items[i].mountpoint != NULL ? items[i].mountpoint : ""; + asprintf(__DECONST(char**, &bsditems[i].desc), "%s %-15s %-10s", + size, items[i].type, mp); + bsditems[i].bottomdesc = ""; + } + + bsddialog_initconf(&conf); + conf.title = title; + conf.menu.align_left = true; - conf.text.highlight = true; ++ conf.text.escape = true; + conf.key.f1_message="[\\Z1\\ZbC\\Znreate]: a new partition.\n" + "[\\Z1\\ZbD\\Znelete]: selected partition(s).\n" + "[\\Z1\\ZbC\\Znhange]: partition type or mountpoint.\n" + "[\\Z1\\ZbR\\Znevert]: changes to disk setup.\n" + "[\\Z1\\ZbA\\Znuto]: guided partitioning tool.\n" + "[\\Z1\\ZbF\\Zninish]: will ask to apply changes."; + conf.menu.shortcut_buttons = true; + conf.button.ok_label = "Create"; + conf.button.with_extra = true; + conf.button.extra_label = "Delete"; + conf.button.cancel_label = "Modify"; + conf.button.with_help = true; + conf.button.help_label = "Revert"; - conf.button.generic1_label = "Auto"; - conf.button.generic2_label = "Finish"; ++ conf.button.right1_label = "Auto"; ++ conf.button.right2_label = "Finish"; + conf.button.default_label = "Finish"; + output = bsddialog_menu(&conf, text, 20, 0, 10, nitems, bsditems, + focusitem); + + for (i = 0; i < nitems; i++) + free((char *)bsditems[i].desc); + free(bsditems); + + return output; +} diff --cc usr.sbin/bsdinstall/partedit/diskmenu.h index 7c0e3c505f9e,000000000000..9fce2e813214 mode 100644,000000..100644 --- a/usr.sbin/bsdinstall/partedit/diskmenu.h +++ b/usr.sbin/bsdinstall/partedit/diskmenu.h @@@ -1,52 -1,0 +1,52 @@@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2011 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _PARTEDIT_DISKMENU_H +#define _PARTEDIT_DISKMENU_H + +#define BUTTON_CREATE BSDDIALOG_OK +#define BUTTON_DELETE BSDDIALOG_EXTRA +#define BUTTON_MODIFY BSDDIALOG_CANCEL +#define BUTTON_REVERT BSDDIALOG_HELP - #define BUTTON_AUTO BSDDIALOG_GENERIC1 - #define BUTTON_FINISH BSDDIALOG_GENERIC2 ++#define BUTTON_AUTO BSDDIALOG_RIGHT1 ++#define BUTTON_FINISH BSDDIALOG_RIGHT2 + +struct partedit_item { + int indentation; + const char *name; + intmax_t size; + const char *type; + char *mountpoint; + + void *cookie; +}; + +int diskmenu_show(const char *title, const char *text, + struct partedit_item *items, int nitems, int *selected); + +#endif diff --cc usr.sbin/bsdinstall/partedit/gpart_ops.c index 8b75d2d6d859,000000000000..92d1a367890c mode 100644,000000..100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@@ -1,1542 -1,0 +1,1539 @@@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2011 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "partedit.h" + +#define GPART_FLAGS "x" /* Do not commit changes by default */ + +static void +gpart_show_error(const char *title, const char *explanation, const char *errstr) +{ + char *errmsg; + char message[512]; + int error; + struct bsddialog_conf conf; + + if (explanation == NULL) + explanation = ""; + + error = strtol(errstr, &errmsg, 0); + if (errmsg != errstr) { + while (errmsg[0] == ' ') + errmsg++; + if (errmsg[0] != '\0') + sprintf(message, "%s%s. %s", explanation, + strerror(error), errmsg); + else + sprintf(message, "%s%s", explanation, strerror(error)); + } else { + sprintf(message, "%s%s", explanation, errmsg); + } + + bsddialog_initconf(&conf); + conf.title = title; + bsddialog_msgbox(&conf, message, 0, 0); +} + +static int +scheme_supports_labels(const char *scheme) +{ + if (strcmp(scheme, "APM") == 0) + return (1); + if (strcmp(scheme, "GPT") == 0) + return (1); + + return (0); +} + +static void +newfs_command(const char *fstype, char *command, int use_default) +{ + struct bsddialog_conf conf; + + bsddialog_initconf(&conf); + + if (strcmp(fstype, "freebsd-ufs") == 0) { + int i; + struct bsddialog_menuitem items[] = { + {"", false, 0, "UFS1", "UFS Version 1", + "Use version 1 of the UFS file system instead " + "of version 2 (not recommended)"}, + {"", true, 0, "SU", "Softupdates", + "Enable softupdates (default)"}, + {"", true, 0, "SUJ", "Softupdates journaling", + "Enable file system journaling (default - " + "turn off for SSDs)"}, + {"", false, 0, "TRIM", "Enable SSD TRIM support", + "Enable TRIM support, useful on solid-state " + "drives" }, + }; + + if (!use_default) { + int choice; + conf.title = "UFS Options"; + choice = bsddialog_checklist(&conf, "", 0, 0, 0, + nitems(items), items, NULL); + if (choice == BSDDIALOG_CANCEL) + return; + } + + strcpy(command, "newfs "); + for (i = 0; i < (int)nitems(items); i++) { + if (items[i].on == false) + continue; + if (strcmp(items[i].name, "UFS1") == 0) + strcat(command, "-O1 "); + else if (strcmp(items[i].name, "SU") == 0) + strcat(command, "-U "); + else if (strcmp(items[i].name, "SUJ") == 0) + strcat(command, "-j "); + else if (strcmp(items[i].name, "TRIM") == 0) + strcat(command, "-t "); + } + } else if (strcmp(fstype, "freebsd-zfs") == 0) { + int i; + struct bsddialog_menuitem items[] = { + {"", 0, true, "fletcher4", "checksum algorithm: fletcher4", + "Use fletcher4 for data integrity checking. " + "(default)"}, + {"", 0, false, "fletcher2", "checksum algorithm: fletcher2", + "Use fletcher2 for data integrity checking. " + "(not recommended)"}, + {"", 0, false, "sha256", "checksum algorithm: sha256", + "Use sha256 for data integrity checking. " + "(not recommended)"}, + {"", 0, false, "atime", "Update atimes for files", + "Disable atime update"}, + }; + + if (!use_default) { + int choice; + conf.title = "ZFS Options"; + choice = bsddialog_checklist(&conf, "", 0, 0, 0, + nitems(items), items, NULL); + if (choice == BSDDIALOG_CANCEL) + return; + } + + strcpy(command, "zpool create -f -m none "); + if (getenv("BSDINSTALL_TMPBOOT") != NULL) { + char zfsboot_path[MAXPATHLEN]; + snprintf(zfsboot_path, sizeof(zfsboot_path), "%s/zfs", + getenv("BSDINSTALL_TMPBOOT")); + mkdir(zfsboot_path, S_IRWXU | S_IRGRP | S_IXGRP | + S_IROTH | S_IXOTH); + sprintf(command, "%s -o cachefile=%s/zpool.cache ", + command, zfsboot_path); + } + for (i = 0; i < (int)nitems(items); i++) { + if (items[i].on == false) + continue; + if (strcmp(items[i].name, "fletcher4") == 0) + strcat(command, "-O checksum=fletcher4 "); + else if (strcmp(items[i].name, "fletcher2") == 0) + strcat(command, "-O checksum=fletcher2 "); + else if (strcmp(items[i].name, "sha256") == 0) + strcat(command, "-O checksum=sha256 "); + else if (strcmp(items[i].name, "atime") == 0) + strcat(command, "-O atime=off "); + } + } else if (strcmp(fstype, "fat32") == 0 || strcmp(fstype, "efi") == 0 || + strcmp(fstype, "ms-basic-data") == 0) { + int i; + struct bsddialog_menuitem items[] = { + {"", 0, true, "FAT32", "FAT Type 32", + "Create a FAT32 filesystem (default)"}, + {"", 0, false, "FAT16", "FAT Type 16", + "Create a FAT16 filesystem"}, + {"", 0, false, "FAT12", "FAT Type 12", + "Create a FAT12 filesystem"}, + }; + + if (!use_default) { + int choice; + conf.title = "FAT Options"; + choice = bsddialog_radiolist(&conf, "", 0, 0, 0, + nitems(items), items, NULL); + if (choice == BSDDIALOG_CANCEL) + return; + } + + strcpy(command, "newfs_msdos "); + for (i = 0; i < (int)nitems(items); i++) { + if (items[i].on == false) + continue; + if (strcmp(items[i].name, "FAT32") == 0) + strcat(command, "-F 32 -c 1"); + else if (strcmp(items[i].name, "FAT16") == 0) + strcat(command, "-F 16 "); + else if (strcmp(items[i].name, "FAT12") == 0) + strcat(command, "-F 12 "); + } + } else { + if (!use_default) { + conf.title = "Error"; + bsddialog_msgbox(&conf, "No configurable options exist " + "for this filesystem.", 0, 0); + } + command[0] = '\0'; + } +} + +const char * +choose_part_type(const char *def_scheme) +{ + int button, choice, i; + const char *scheme = NULL; + struct bsddialog_conf conf; + + struct bsddialog_menuitem items[] = { + {"", false, 0, "APM", "Apple Partition Map", + "Bootable on PowerPC Apple Hardware" }, + {"", false, 0, "BSD", "BSD Labels", + "Bootable on most x86 systems" }, + {"", false, 0, "GPT", "GUID Partition Table", + "Bootable on most x86 systems and EFI aware ARM64" }, + {"", false, 0, "MBR", "DOS Partitions", + "Bootable on most x86 systems" }, + }; + + for (i = 0; i < (int)nitems(items); i++) + if (strcmp(items[i].name, def_scheme) == 0) + choice = i; + + bsddialog_initconf(&conf); + +parttypemenu: + conf.title = "Partition Scheme"; + button = bsddialog_menu(&conf, + "Select a partition scheme for this volume:", 0, 0, 0, + nitems(items), items, &choice); + + if (button == BSDDIALOG_CANCEL) + return NULL; + + if (!is_scheme_bootable(items[choice].name)) { + char message[512]; + sprintf(message, "This partition scheme (%s) is not " + "bootable on this platform. Are you sure you want " + "to proceed?", items[choice].name); + conf.button.default_cancel = true; + conf.title = "Warning"; + button = bsddialog_yesno(&conf, message, 0, 0); + conf.button.default_cancel = false; + if (button == BSDDIALOG_NO) + goto parttypemenu; *** 2323 LINES SKIPPED *** From nobody Wed Oct 4 16:27:14 2023 X-Original-To: dev-commits-src-main@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 4S10TH0h1mz4wCqw; Wed, 4 Oct 2023 16:27:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S10TH09Hbz4dJD; Wed, 4 Oct 2023 16:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696436835; 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=VFBS9rHc0xj2lElft/pSm1w5DBwnYO9NUKI4OrsrhVo=; b=ZQg+twnQtU4u8ntmqgsz0ECcRCFqq/aaobNoqqdS7PgnTfe395A+WA+zlEKs5oR6h1hQ5H gccuwZWRHLAhuv4kXJ60Yv5fxo4jNMa2Btd/Rr3F2TUlHJuo42BbT0iNPmktBMA5PSJgMW htlmtvr/jUvEtglXQ2lK4n76LsGtJNmkbB1ZkB16NnveWfzX5hjNPc6/A4SHDe1Nx/TToO 2tf7nxUZG8Tm7SWBeYkAG+zr2t4vCqu3J1F8RwSqJWmhvLwES79Ab1Dprp5ptgeTU99UMJ Ames03O0KZlkb+pYDVpQ3aVZPL//SFQOBvwZ3Al98c0/hd+Jy4Vi9g32mn6iaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696436835; a=rsa-sha256; cv=none; b=MiUq4G+TeqKxBOKFm0yBX/A2XD79yJeDdv5BGH/mIAXTKRjDNIXDrZCfML8bs0m4ftP7ql ex6g+EHRFkS36jioiFjmgmdeoYpzYW88hRZv20V+jqXrAcPrWqkE4KfVUo6iXG8RBUEOmH +8T/XB3H76kSVywzvfcOGCz1kFg0h3Tmalg+54fdyZzZO2pawmDBMuqZVn9WIVI06tAjy+ pwsijwF/XbId0hANFbGg1iV3SPKZnHd40M3Rh2vkoV6hQ+nCBYlMJOjy2yoRmEba+fELRv Xf7hMj+NlQ+u8dfmB/1ntWSwSz6uUx/S13kEDEDZtm56fDZpm2JUYGphgO0kjA== 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=1696436835; 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=VFBS9rHc0xj2lElft/pSm1w5DBwnYO9NUKI4OrsrhVo=; b=EqSmzq/bWBgDJv1BmR0DsHrMgPqU4TnQmLsLQlmz59UHHtO3GUteNAP84puMuoK8vQNe8d oZp1q7BGp644QKhy+NnEAHL4OCVbkiLrIWdTlE+a9DMzmvi6cs0p2TF+83E52qIA5QQtDf tJ+Z372J5CUSWkjN1qJrhxh/knZpsur0XhoMTSQHm+RApgvLLyAAMwXm47zfTRHN3GmqJc CfNrWyMDsLFv5K2LqqmCVnr53PLCyMik3sD/4gDAxf/cpbPjEL5mV5RjOagOsaOcVUWklq G6Owi7q3vlrxy17KiRT9iqJNUVRBihbjElk75QlsMHdUskEyojHAXFpHZb8wqQ== 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 4S10TG6Dj4zlDS; Wed, 4 Oct 2023 16:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GREkT088561; Wed, 4 Oct 2023 16:27:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GRE9N088558; Wed, 4 Oct 2023 16:27:14 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:27:14 GMT Message-Id: <202310041627.394GRE9N088558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: dfa9e89fcd3f - main - mailmap: Fixup a few github nouser emails List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfa9e89fcd3f8cf43b589a349b6c30f9cf661357 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dfa9e89fcd3f8cf43b589a349b6c30f9cf661357 commit dfa9e89fcd3f8cf43b589a349b6c30f9cf661357 Author: Warner Losh AuthorDate: 2023-10-04 16:15:27 +0000 Commit: Warner Losh CommitDate: 2023-10-04 16:17:55 +0000 mailmap: Fixup a few github nouser emails Fixup a couple foo@user.noreply.github.com email addresses based other information (either known FreeBSD user, known other commits with the correct name, etc) --- .mailmap | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.mailmap b/.mailmap index 273abae90fc5..b06274fe6df3 100644 --- a/.mailmap +++ b/.mailmap @@ -7,3 +7,8 @@ Mina Galić Mina Galić Mina Galić +Michal Meloun +Dmitriy Alexandrov +Alfonso Gregory <83477269+AtariDreams@users.noreply.github.com> +Alfonso Gregory <83477269+gAlfonso-bit@users.noreply.github.com> +Jose Luis Duran From nobody Wed Oct 4 16:53:54 2023 X-Original-To: dev-commits-src-main@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 4S11423vS2z4wGhJ; Wed, 4 Oct 2023 16:53:54 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S11422zGcz3C83; Wed, 4 Oct 2023 16:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438434; 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=+rk9gEU/9hTUQwoONc1JSVzrhiiQzTakriA8FBndsgw=; b=IoDPfjJHv4XY2QsW6aeGnAxveWraxrAEuXBBDRLh1Stz3rUfgeAM5Lo/bJ32Ef/AhuTsVn lBMfxwL/zkuQn3/BPHwXIqX4RBrkzci48x/Q7vRxMY8HV3AGXl+HbWJy7UZvu2JZr7gpqN XZ8YdG2HfZNUs9BG+4AEMyzpMgo7iipTkv6yj67U1iA5EgJsNCuzvDvjE4WzsDXVVfkI7T zol8L6pzuIo5UV1xTdtEjHP4Ie9f/83KzgS/SVx21CLxz6KbLtr2AYhU3nSENFE63lO0Ou XP+myaD+KBqPREg5Mql3xWrjoVZTFDqCu1g9mOxJBIKs/X6+vRhQPoKpaOXGxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438434; a=rsa-sha256; cv=none; b=ex3omsPF38EXDktX0XmQuwis2SNQBPBeRCbj7SKbqDToQFcskNff1ZIegPyramCjO7gDKJ T1NDlg92hvlAvvgrC2CRFJgFbvAFGUEBdm/iJCftvfR105Zgaq50CNYy0u/BHyYdFd4owS b3eXQWNFnmgRTpzV8xGckyzqLWVl/aBu5W5T6YVWmYMfZ9yltC/Iykg9AUmjfF3OCqNkEe uFLzSasL9AxSJN71X41NmTkLGkz72f4nARVWBAo5zs3apOSVIJ7VjNN9ucKa4C89+QpCJt smS1MjIrfmDSaXtzxPhDdTDmidj/yXcDSQ8mwY1pE6pHcdKzdEhv0jDyrY9Lmg== 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=1696438434; 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=+rk9gEU/9hTUQwoONc1JSVzrhiiQzTakriA8FBndsgw=; b=VmkqxCI1kOsuQdLkCKKI+7gNKhPp8/8n9lQHDz1sH9OpV/mkx7Lw/TGYVvfiGZcU2nXY2U qfhY2NNJRZgG9n34pyHLzh1yb+zQnRpccFDiwrG52zm6s1CgTF9GZWrVPBB8umkrOM+tSY Cckx4h+S2IL+/5deHmP7EwOyxx7Ox3t57+aF5VRqOoidPMhZqnioGfd4V72AOkq0xgFNIy N0FMwhRYnplLFT8b809Ygxv9YDtoYmgSAfjUea/Um0y+J2WE41aoQZU3NCuMibKwWJCoH0 pQptfuMUDqq7veT4FZJoCT0AWI/GBiV1NOsTB4qyWjFDEml8SOv4I1F2FLVbGw== 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 4S1142221SzlRS; Wed, 4 Oct 2023 16:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Grshs037385; Wed, 4 Oct 2023 16:53:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Grsae037381; Wed, 4 Oct 2023 16:53:54 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:53:54 GMT Message-Id: <202310041653.394Grsae037381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 01d53c34e79a - main - bhyve: Improve pcifd function naming List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01d53c34e79afaad757088e5fbb4846f02a8beca Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=01d53c34e79afaad757088e5fbb4846f02a8beca commit 01d53c34e79afaad757088e5fbb4846f02a8beca Author: Mark Johnston AuthorDate: 2023-10-04 16:19:58 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Improve pcifd function naming read_config() and write_config() are externally visible, so give them more descriptive names. No functional change intended. MFC after: 1 week Sponsored by: Innovate UK --- usr.sbin/bhyve/pci_emul.c | 2 +- usr.sbin/bhyve/pci_gvt-d.c | 8 ++++---- usr.sbin/bhyve/pci_lpc.c | 9 +++++---- usr.sbin/bhyve/pci_passthru.c | 40 +++++++++++++++++++++++----------------- usr.sbin/bhyve/pci_passthru.h | 6 ++++-- 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index 3c34d0e22478..5fb25dbfe9c7 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -375,7 +375,7 @@ pci_config_read_reg(const struct pcisel *const host_sel, nvlist_t *nvl, if (config == NULL) { return def; } else if (host_sel != NULL && strcmp(config, "host") == 0) { - return read_config(host_sel, reg, size); + return pci_host_read_config(host_sel, reg, size); } else { return strtol(config, NULL, 16); } diff --git a/usr.sbin/bhyve/pci_gvt-d.c b/usr.sbin/bhyve/pci_gvt-d.c index 35c7f30dd292..78fa9878358e 100644 --- a/usr.sbin/bhyve/pci_gvt-d.c +++ b/usr.sbin/bhyve/pci_gvt-d.c @@ -49,11 +49,11 @@ gvt_d_probe(struct pci_devinst *const pi) sc = pi->pi_arg; - vendor = read_config(passthru_get_sel(sc), PCIR_VENDOR, 0x02); + vendor = pci_host_read_config(passthru_get_sel(sc), PCIR_VENDOR, 0x02); if (vendor != PCI_VENDOR_INTEL) return (ENXIO); - class = read_config(passthru_get_sel(sc), PCIR_CLASS, 0x01); + class = pci_host_read_config(passthru_get_sel(sc), PCIR_CLASS, 0x01); if (class != PCIC_DISPLAY) return (ENXIO); @@ -169,7 +169,7 @@ gvt_d_setup_gsm(struct pci_devinst *const pi) "Warning: Unable to reuse host address of Graphics Stolen Memory. GPU passthrough might not work properly."); } - bdsm = read_config(passthru_get_sel(sc), PCIR_BDSM, 4); + bdsm = pci_host_read_config(passthru_get_sel(sc), PCIR_BDSM, 4); pci_set_cfgdata32(pi, PCIR_BDSM, gsm->gpa | (bdsm & (PCIM_BDSM_GSM_ALIGNMENT - 1))); @@ -201,7 +201,7 @@ gvt_d_setup_opregion(struct pci_devinst *const pi) return (-1); } - asls = read_config(passthru_get_sel(sc), PCIR_ASLS_CTL, 4); + asls = pci_host_read_config(passthru_get_sel(sc), PCIR_ASLS_CTL, 4); header = mmap(NULL, sizeof(*header), PROT_READ, MAP_SHARED, memfd, asls); diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c index 2ff9bbc27774..5c2a2a7965b0 100644 --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -485,15 +485,16 @@ pci_lpc_get_sel(struct pcisel *const sel) sel->pc_dev = slot; sel->pc_func = 0; - if (read_config(sel, PCIR_HDRTYPE, 1) & PCIM_MFDEV) + if (pci_host_read_config(sel, PCIR_HDRTYPE, 1) & PCIM_MFDEV) max_func = PCI_FUNCMAX; for (uint8_t func = 0; func <= max_func; ++func) { sel->pc_func = func; - if ((read_config(sel, PCIR_CLASS, 1) == PCIC_BRIDGE) && - (read_config(sel, PCIR_SUBCLASS, 1) == - PCIS_BRIDGE_ISA)) { + if (pci_host_read_config(sel, PCIR_CLASS, 1) == + PCIC_BRIDGE && + pci_host_read_config(sel, PCIR_SUBCLASS, 1) == + PCIS_BRIDGE_ISA) { return (0); } } diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index fa23358c07a2..0a80ee649689 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -145,7 +145,7 @@ pcifd_init(void) } uint32_t -read_config(const struct pcisel *sel, long reg, int width) +pci_host_read_config(const struct pcisel *sel, long reg, int width) { struct pci_io pi; @@ -165,7 +165,8 @@ read_config(const struct pcisel *sel, long reg, int width) } void -write_config(const struct pcisel *sel, long reg, int width, uint32_t data) +pci_host_write_config(const struct pcisel *sel, long reg, int width, + uint32_t data) { struct pci_io pi; @@ -224,24 +225,25 @@ cfginitmsi(struct passthru_softc *sc) * Parse the capabilities and cache the location of the MSI * and MSI-X capabilities. */ - sts = read_config(&sel, PCIR_STATUS, 2); + sts = pci_host_read_config(&sel, PCIR_STATUS, 2); if (sts & PCIM_STATUS_CAPPRESENT) { - ptr = read_config(&sel, PCIR_CAP_PTR, 1); + ptr = pci_host_read_config(&sel, PCIR_CAP_PTR, 1); while (ptr != 0 && ptr != 0xff) { - cap = read_config(&sel, ptr + PCICAP_ID, 1); + cap = pci_host_read_config(&sel, ptr + PCICAP_ID, 1); if (cap == PCIY_MSI) { /* * Copy the MSI capability into the config * space of the emulated pci device */ sc->psc_msi.capoff = ptr; - sc->psc_msi.msgctrl = read_config(&sel, - ptr + 2, 2); + sc->psc_msi.msgctrl = pci_host_read_config(&sel, + ptr + 2, 2); sc->psc_msi.emulated = 0; caplen = msi_caplen(sc->psc_msi.msgctrl); capptr = ptr; while (caplen > 0) { - u32 = read_config(&sel, capptr, 4); + u32 = pci_host_read_config(&sel, capptr, + 4); pci_set_cfgdata32(pi, capptr, u32); caplen -= 4; capptr += 4; @@ -255,7 +257,8 @@ cfginitmsi(struct passthru_softc *sc) msixcap_ptr = (char *)&msixcap; capptr = ptr; while (caplen > 0) { - u32 = read_config(&sel, capptr, 4); + u32 = pci_host_read_config(&sel, capptr, + 4); memcpy(msixcap_ptr, &u32, 4); pci_set_cfgdata32(pi, capptr, u32); caplen -= 4; @@ -263,7 +266,8 @@ cfginitmsi(struct passthru_softc *sc) msixcap_ptr += 4; } } - ptr = read_config(&sel, ptr + PCICAP_NEXTPTR, 1); + ptr = pci_host_read_config(&sel, ptr + PCICAP_NEXTPTR, + 1); } } @@ -298,7 +302,7 @@ cfginitmsi(struct passthru_softc *sc) */ if ((sts & PCIM_STATUS_CAPPRESENT) != 0 && sc->psc_msi.capoff == 0) { int origptr, msiptr; - origptr = read_config(&sel, PCIR_CAP_PTR, 1); + origptr = pci_host_read_config(&sel, PCIR_CAP_PTR, 1); msiptr = passthru_add_msicap(pi, 1, origptr); sc->psc_msi.capoff = msiptr; sc->psc_msi.msgctrl = pci_get_cfgdata16(pi, msiptr + 2); @@ -577,7 +581,8 @@ cfginitbar(struct passthru_softc *sc) return (-1); /* Use same lobits as physical bar */ - uint8_t lobits = read_config(&sc->psc_sel, PCIR_BAR(i), 0x01); + uint8_t lobits = pci_host_read_config(&sc->psc_sel, PCIR_BAR(i), + 0x01); if (bartype == PCIBAR_MEM32 || bartype == PCIBAR_MEM64) { lobits &= ~PCIM_BAR_MEM_BASE; } else { @@ -621,7 +626,8 @@ cfginit(struct pci_devinst *pi, int bus, int slot, int func) intline = pci_get_cfgdata8(pi, PCIR_INTLINE); intpin = pci_get_cfgdata8(pi, PCIR_INTPIN); for (int i = 0; i <= PCIR_MAXLAT; i += 4) { - pci_set_cfgdata32(pi, i, read_config(&sc->psc_sel, i, 4)); + pci_set_cfgdata32(pi, i, + pci_host_read_config(&sc->psc_sel, i, 4)); } pci_set_cfgdata8(pi, PCIR_INTLINE, intline); pci_set_cfgdata8(pi, PCIR_INTPIN, intpin); @@ -638,7 +644,7 @@ cfginit(struct pci_devinst *pi, int bus, int slot, int func) goto done; } - write_config(&sc->psc_sel, PCIR_COMMAND, 2, + pci_host_write_config(&sc->psc_sel, PCIR_COMMAND, 2, pci_get_cfgdata16(pi, PCIR_COMMAND)); /* @@ -988,13 +994,13 @@ passthru_cfgread_default(struct passthru_softc *sc, if (coff == PCIR_COMMAND) { if (bytes <= 2) return (-1); - *rv = read_config(&sc->psc_sel, PCIR_STATUS, 2) << 16 | + *rv = pci_host_read_config(&sc->psc_sel, PCIR_STATUS, 2) << 16 | pci_get_cfgdata16(pi, PCIR_COMMAND); return (0); } /* Everything else just read from the device's config space */ - *rv = read_config(&sc->psc_sel, coff, bytes); + *rv = pci_host_read_config(&sc->psc_sel, coff, bytes); return (0); } @@ -1080,7 +1086,7 @@ passthru_cfgwrite_default(struct passthru_softc *sc, struct pci_devinst *pi, } #endif - write_config(&sc->psc_sel, coff, bytes, val); + pci_host_write_config(&sc->psc_sel, coff, bytes, val); if (coff == PCIR_COMMAND) { cmd_old = pci_get_cfgdata16(pi, PCIR_COMMAND); if (bytes == 1) diff --git a/usr.sbin/bhyve/pci_passthru.h b/usr.sbin/bhyve/pci_passthru.h index 49d2bb309f71..a89ad287cbc5 100644 --- a/usr.sbin/bhyve/pci_passthru.h +++ b/usr.sbin/bhyve/pci_passthru.h @@ -36,8 +36,10 @@ typedef int (*cfgread_handler)(struct passthru_softc *sc, typedef int (*cfgwrite_handler)(struct passthru_softc *sc, struct pci_devinst *pi, int coff, int bytes, uint32_t val); -uint32_t read_config(const struct pcisel *sel, long reg, int width); -void write_config(const struct pcisel *sel, long reg, int width, uint32_t data); +uint32_t pci_host_read_config(const struct pcisel *sel, long reg, int width); +void pci_host_write_config(const struct pcisel *sel, long reg, int width, + uint32_t data); + int passthru_cfgread_emulate(struct passthru_softc *sc, struct pci_devinst *pi, int coff, int bytes, uint32_t *rv); int passthru_cfgwrite_emulate(struct passthru_softc *sc, struct pci_devinst *pi, From nobody Wed Oct 4 16:53:55 2023 X-Original-To: dev-commits-src-main@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 4S11434pMpz4wGfl; Wed, 4 Oct 2023 16:53:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114347zxz3C8R; Wed, 4 Oct 2023 16:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438435; 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=311YNNr5JVrROgeJDtyoEWQ2QG+sas09Wql6MpJsaVA=; b=D2d+c8QQiba14puM4PXeRBGHh8ln05hNe7yZDbJy06BvHBEIhjmoK6fOK0KeVi09VeAsKS i7m8TD3B2T7lhJYinfC9NkSf6lbLkyfFuZcPhsVa5jVOa1dBxR6hcEx9c/z8vbR0qm0C0p 8V3/hW9vQyZwO77YvaNxl+jW/FI4Vr0xXk/WMO1JMhKhsRNTFyCXH6Z1qSd5MoGUmBVTpN VadppSd6DJrqeUytjhE8a93Qbeg71jhlt3anmCifO2/WXb6Lz1N5MlF3Yf2SB8AbW1HEWB EEofS9tiQBCsm2sPXCu4ynuui/D/omIMgNd42wpEwcacS6qkSkKvXDHcViiO8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438435; a=rsa-sha256; cv=none; b=e9pnHEa38zGhGaDSfwG9pq1se/RLfNYH/Io6JZJEu2QznmK7IfBCX7j25DRTChixaPJF+u JoiEbYzlF2pYtoNH6apxYcLjGmZguH09qA65Dko5F1SEoHPTPzmM0UR69FDuneE/qh5h4Y +J00EZJQM/xHxiGiWHjtUwpcBnBng4A7rl+BloEKx/sCljE5JOQBEHHXc8ZCp7niX3zx7w aKtaXMAy1xq619IpbKpRaJuDjJwsWmiCVWjfRcMt4I4NIPat1bevsN9cMU35XGp7OKSo+e KvfxIv0AX/drBpCF8C+h5OXhEl2X5vcTBuI94/qUrjzL3PpKcAbcfbMQmPjxcA== 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=1696438435; 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=311YNNr5JVrROgeJDtyoEWQ2QG+sas09Wql6MpJsaVA=; b=kgb9ByinqsKJSrZ52xwGB2S1WxMYgHQQPHHk9PpS6AscMG6vHpdTs6XdXrHkHjl30DOQ3p grvKFk/rvwHneeelEv6qMTOguzXOSwJxq5XN/2PTpnsZ3yyX95aQ8tqLtK/5Fsu+H+RSzC AqR63JVp4aPa5fWiIeUvkq/HhJUxQWKea7dWLgZmTd5nbet6iC+twMVJ4+jhtM9Qz/fNoD IyEC6+bKKohRb8amhADwQ54RaRfm5Efse/NYoELQYHF7BQKweWUb2+YbBTjME5cCGdDZ61 QGSIezHL71V7qEG4XX4/gRC3zridy7F3VzC/Ljf9C+FHKk7mzZ5+ZyvN8r3DVw== 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 4S1143341jzllx; Wed, 4 Oct 2023 16:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GrtuF037434; Wed, 4 Oct 2023 16:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GrtlA037431; Wed, 4 Oct 2023 16:53:55 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:53:55 GMT Message-Id: <202310041653.394GrtlA037431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4f2bd4027b32 - main - bhyve: Start moving machine-dependent code into subdirectories List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f2bd4027b3261d159f6d673dc9ee9e84b4a3538 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2bd4027b3261d159f6d673dc9ee9e84b4a3538 commit 4f2bd4027b3261d159f6d673dc9ee9e84b4a3538 Author: Mark Johnston AuthorDate: 2023-10-04 16:20:37 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Start moving machine-dependent code into subdirectories In preparation for an arm64 port, make an easy change which puts some machine-dependent code in its own directory. Going forward, code which is only used on one platform should live in a MD directory. We should strive to layer modules in such a way as to avoid polluting shared code with lots of ifdefs. For some existing files this will take some effort. task_switch.c and fwctl.c are an easy place to start: the former is very x86-specific, and the latter provides an I/O port interface which can't be used on anything other than x86. (fwcfg as implemented has the same problem, but QEMU also supports a MMIO fwcfg interface.) So I propose that we start by simply making those files conditional. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40501 --- usr.sbin/bhyve/Makefile | 16 +++++++++------- usr.sbin/bhyve/amd64/Makefile.inc | 6 ++++++ usr.sbin/bhyve/{ => amd64}/fwctl.c | 0 usr.sbin/bhyve/{ => amd64}/fwctl.h | 0 usr.sbin/bhyve/{ => amd64}/task_switch.c | 2 ++ usr.sbin/bhyve/bhyverun.c | 8 +++++++- usr.sbin/bhyve/bhyverun.h | 2 -- usr.sbin/bhyve/snapshot.c | 1 - 8 files changed, 24 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index a720c6b3c7a4..794bfbe4c8a3 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -2,9 +2,6 @@ # .include -CFLAGS+=-I${.CURDIR}/../../contrib/lib9p -CFLAGS+=-I${SRCTOP}/sys -.PATH: ${SRCTOP}/sys/libkern ${SRCTOP}/sys/cam/ctl PROG= bhyve PACKAGE= bhyve @@ -13,6 +10,10 @@ MAN= bhyve.8 bhyve_config.5 BHYVE_SYSDIR?=${SRCTOP} +.PATH: ${.CURDIR}/${MACHINE_CPUARCH} \ + ${SRCTOP}/sys/libkern \ + ${SRCTOP}/sys/cam/ctl + SRCS= \ acpi.c \ acpi_device.c \ @@ -29,7 +30,6 @@ SRCS= \ ctl_scsi_all.c \ ctl_util.c \ e820.c \ - fwctl.c \ gdb.c \ hda_codec.c \ inout.c \ @@ -73,7 +73,6 @@ SRCS= \ smbiostbl.c \ sockstream.c \ spinup_ap.c \ - task_switch.c \ tpm_device.c \ tpm_emul_passthru.c \ tpm_intf_crb.c \ @@ -90,10 +89,13 @@ SRCS= \ SRCS+= snapshot.c .endif +.include "${MACHINE_CPUARCH}/Makefile.inc" + CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 -.PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm -SRCS+= vmm_instruction_emul.c +CFLAGS+=-I${.CURDIR} \ + -I${.CURDIR}/../../contrib/lib9p \ + -I${SRCTOP}/sys LIBADD= vmmapi md nv pthread z util sbuf cam 9p diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc new file mode 100644 index 000000000000..62de5f211a23 --- /dev/null +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -0,0 +1,6 @@ +SRCS+= \ + fwctl.c \ + task_switch.c + +.PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm +SRCS+= vmm_instruction_emul.c diff --git a/usr.sbin/bhyve/fwctl.c b/usr.sbin/bhyve/amd64/fwctl.c similarity index 100% rename from usr.sbin/bhyve/fwctl.c rename to usr.sbin/bhyve/amd64/fwctl.c diff --git a/usr.sbin/bhyve/fwctl.h b/usr.sbin/bhyve/amd64/fwctl.h similarity index 100% rename from usr.sbin/bhyve/fwctl.h rename to usr.sbin/bhyve/amd64/fwctl.h diff --git a/usr.sbin/bhyve/task_switch.c b/usr.sbin/bhyve/amd64/task_switch.c similarity index 99% rename from usr.sbin/bhyve/task_switch.c rename to usr.sbin/bhyve/amd64/task_switch.c index 351df7fb738b..c316d18142a7 100644 --- a/usr.sbin/bhyve/task_switch.c +++ b/usr.sbin/bhyve/amd64/task_switch.c @@ -700,6 +700,8 @@ push_errcode(struct vcpu *vcpu, struct vm_guest_paging *paging, return (VMEXIT_CONTINUE); \ } while (0) +int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_run *); + int vmexit_task_switch(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) { diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 1d4cf048b59b..4e2d5467cfaf 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -88,7 +88,9 @@ #include "inout.h" #include "debug.h" #include "e820.h" -#include "fwctl.h" +#ifdef __amd64__ +#include "amd64/fwctl.h" +#endif #include "gdb.h" #include "ioapic.h" #include "kernemu_dev.h" @@ -921,6 +923,8 @@ vmexit_ipi(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, return (error); } +int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_run *); + static const vmexit_handler_t handler[VM_EXITCODE_MAX] = { [VM_EXITCODE_INOUT] = vmexit_inout, [VM_EXITCODE_INOUT_STR] = vmexit_inout, @@ -1576,9 +1580,11 @@ main(int argc, char *argv[]) } free(e820_fwcfg_item); +#ifdef __amd64__ if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) { fwctl_init(); } +#endif /* * Change the proc title to include the VM name. diff --git a/usr.sbin/bhyve/bhyverun.h b/usr.sbin/bhyve/bhyverun.h index 1131e18baed2..fc0d2595e66b 100644 --- a/usr.sbin/bhyve/bhyverun.h +++ b/usr.sbin/bhyve/bhyverun.h @@ -46,6 +46,4 @@ uintptr_t paddr_host2guest(struct vmctx *ctx, void *addr); int fbsdrun_virtio_msix(void); -int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_run *); - #endif diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index ec56bd0fed9a..7d8959756757 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -79,7 +79,6 @@ #include "debug.h" #include "inout.h" #include "ipc.h" -#include "fwctl.h" #include "ioapic.h" #include "mem.h" #include "mevent.h" From nobody Wed Oct 4 16:53:56 2023 X-Original-To: dev-commits-src-main@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 4S11452sb9z4wGnV; Wed, 4 Oct 2023 16:53:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S11445PJQz3CLB; Wed, 4 Oct 2023 16:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438436; 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=g727BTWPkOqSZad2UxIqglTpUx5T1urqhVYSBMS0gEo=; b=rjiOZ81XWloQjg3VtIopGx5lPoQqokoG8syOIBcnnAzh6AwYBWccMYWISUw8ENJDD8mzhB KycZA9NXhiwB/LwPkoply0sSG5WnBaZbH2xqvNTmKTPtL9+rhxJHe9anpjK07jrecvl3m1 TRa22qMOZRw7foMkMy5MEC3F9WQu07WIJiMxNIVXR0esNT3y/XWx1iIOdIRJVz3LomDciC 1UzIBbjF471ShGyFPzRYop1SoihNvjCd/LscroKwjSL3w+2TEspk9CDgbLK/G86vbto7hY 5xh6v8Q6wS+ZvVnu0SosvbqBJ3+sNeHQnNEz1T2FwT8d18PrV/6YoLmG8ZCTVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438436; a=rsa-sha256; cv=none; b=MovqZh7VuvvCZ/alIfxwkByVW/g4ZnPJQlLfg1VDo4Lrg0Vrdk152hirU5hEszDdeBoSfv 3DGkUT4x3nljm5CUYi7jbXft4YKpnG/YAhsy9hpYdw/K3IqG/D/LdqXHXOfQQ6XYJUYKGo zAJLQDg2ZRqoBGS2FHaumsSkdr6YWKMgTl8reShs/TZ09yhYjWKQ/2rQ0qWlL9mvNnsd/3 LQyqipLfkebcOqjSk3gL27yH/QIck5U5Rf+JLa8tKGatFR0lJJ3ZZ4t3xSofly9AdhHjmM RUDOdWu3OsiwE2MWInCeAefXgk9xVOGMsLRkB8si3GRl661rK9xWpOB0o2Nesg== 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=1696438436; 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=g727BTWPkOqSZad2UxIqglTpUx5T1urqhVYSBMS0gEo=; b=brHc2R9Unu5wAnX09OcDyAKpGmqdBJuwHJIjjdEg06K6/28QMAG2+LImi0JUkLbERpD7yv bjdkpPu9AfuRLsw1hJS38t/gGkKIjS0Jmk/tRP1/FeOyfAfi5isDeVu0o1iVIqE85gvDf3 EzwEhtlxRY4A7p+pBBjjphI4lqxK433fNhvEZoeaqVNzcqVIsWPJa6Rl4i73ibSJauhptN TUISxISipxlKgcH9FDidvjsbz/tVL4dnttH+9SPiT7tBByLnG4vGzy2E/7IKWF22EVIB/5 5CKR7vV71NdGUE2XUWKzeSbd+jZguMYa4hi3pToL278ezoTbgX80EllDJQPrxA== 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 4S11444KKkzm0S; Wed, 4 Oct 2023 16:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GruYx037491; Wed, 4 Oct 2023 16:53:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GruGI037488; Wed, 4 Oct 2023 16:53:56 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:53:56 GMT Message-Id: <202310041653.394GruGI037488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f927afc1a6fe - main - bhyve: Move some more amd64-specific drivers to their own subdir List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f927afc1a6fe8257e28d79e8bb77305c2958724a Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f927afc1a6fe8257e28d79e8bb77305c2958724a commit f927afc1a6fe8257e28d79e8bb77305c2958724a Author: Mark Johnston AuthorDate: 2023-10-04 16:20:57 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Move some more amd64-specific drivers to their own subdir No functional change intended. Reviewed by: corvink, jhb, emaste MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40551 --- usr.sbin/bhyve/Makefile | 6 ------ usr.sbin/bhyve/amd64/Makefile.inc | 7 +++++++ usr.sbin/bhyve/{ => amd64}/atkbdc.c | 0 usr.sbin/bhyve/{ => amd64}/atkbdc.h | 0 usr.sbin/bhyve/{ => amd64}/post.c | 0 usr.sbin/bhyve/{ => amd64}/ps2kbd.c | 0 usr.sbin/bhyve/{ => amd64}/ps2kbd.h | 0 usr.sbin/bhyve/{ => amd64}/ps2mouse.c | 0 usr.sbin/bhyve/{ => amd64}/ps2mouse.h | 0 usr.sbin/bhyve/bhyverun.c | 6 +++++- usr.sbin/bhyve/snapshot.c | 15 +++++++++++++-- 11 files changed, 25 insertions(+), 9 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 794bfbe4c8a3..86039a8c45da 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -17,7 +17,6 @@ BHYVE_SYSDIR?=${SRCTOP} SRCS= \ acpi.c \ acpi_device.c \ - atkbdc.c \ audio.c \ basl.c \ bhyvegc.c \ @@ -63,9 +62,6 @@ SRCS= \ pci_xhci.c \ pctestdev.c \ pm.c \ - post.c \ - ps2kbd.c \ - ps2mouse.c \ qemu_fwcfg.c \ qemu_loader.c \ rfb.c \ @@ -138,6 +134,4 @@ NO_WTHREAD_SAFETY= NO_WCAST_ALIGN= -SUBDIR= kbdlayout - .include diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 62de5f211a23..c52219cb8dd1 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -1,6 +1,13 @@ SRCS+= \ + atkbdc.c \ fwctl.c \ + post.c \ + ps2kbd.c \ + ps2mouse.c \ task_switch.c + .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c + +SUBDIR+= kbdlayout diff --git a/usr.sbin/bhyve/atkbdc.c b/usr.sbin/bhyve/amd64/atkbdc.c similarity index 100% rename from usr.sbin/bhyve/atkbdc.c rename to usr.sbin/bhyve/amd64/atkbdc.c diff --git a/usr.sbin/bhyve/atkbdc.h b/usr.sbin/bhyve/amd64/atkbdc.h similarity index 100% rename from usr.sbin/bhyve/atkbdc.h rename to usr.sbin/bhyve/amd64/atkbdc.h diff --git a/usr.sbin/bhyve/post.c b/usr.sbin/bhyve/amd64/post.c similarity index 100% rename from usr.sbin/bhyve/post.c rename to usr.sbin/bhyve/amd64/post.c diff --git a/usr.sbin/bhyve/ps2kbd.c b/usr.sbin/bhyve/amd64/ps2kbd.c similarity index 100% rename from usr.sbin/bhyve/ps2kbd.c rename to usr.sbin/bhyve/amd64/ps2kbd.c diff --git a/usr.sbin/bhyve/ps2kbd.h b/usr.sbin/bhyve/amd64/ps2kbd.h similarity index 100% rename from usr.sbin/bhyve/ps2kbd.h rename to usr.sbin/bhyve/amd64/ps2kbd.h diff --git a/usr.sbin/bhyve/ps2mouse.c b/usr.sbin/bhyve/amd64/ps2mouse.c similarity index 100% rename from usr.sbin/bhyve/ps2mouse.c rename to usr.sbin/bhyve/amd64/ps2mouse.c diff --git a/usr.sbin/bhyve/ps2mouse.h b/usr.sbin/bhyve/amd64/ps2mouse.h similarity index 100% rename from usr.sbin/bhyve/ps2mouse.h rename to usr.sbin/bhyve/amd64/ps2mouse.h diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 4e2d5467cfaf..707e21caf506 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -82,7 +82,9 @@ #include "bhyverun.h" #include "acpi.h" -#include "atkbdc.h" +#ifdef __amd64__ +#include "amd64/atkbdc.h" +#endif #include "bootrom.h" #include "config.h" #include "inout.h" @@ -1454,7 +1456,9 @@ main(int argc, char *argv[]) init_inout(); kernemu_dev_init(); init_bootrom(ctx); +#ifdef __amd64__ atkbdc_init(ctx); +#endif pci_irq_init(ctx); ioapic_init(ctx); diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 7d8959756757..593930c7f8a3 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -75,7 +75,9 @@ #include "bhyverun.h" #include "acpi.h" -#include "atkbdc.h" +#ifdef __amd64__ +#include "amd64/atkbdc.h" +#endif #include "debug.h" #include "inout.h" #include "ipc.h" @@ -892,7 +894,12 @@ vm_restore_devices(struct restore_state *rstate) return (ret); } - return (vm_restore_device(rstate, atkbdc_snapshot, "atkbdc", NULL)); +#ifdef __amd64__ + ret = vm_restore_device(rstate, atkbdc_snapshot, "atkbdc", NULL); +#else + ret = 0; +#endif + return (ret); } int @@ -1131,8 +1138,12 @@ vm_snapshot_devices(int data_fd, xo_handle_t *xop) goto snapshot_err; } +#ifdef __amd64__ ret = vm_snapshot_device(atkbdc_snapshot, "atkbdc", NULL, data_fd, xop, meta, &offset); +#else + ret = 0; +#endif xo_close_list_h(xop, JSON_DEV_ARR_KEY); From nobody Wed Oct 4 16:53:57 2023 X-Original-To: dev-commits-src-main@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 4S11460DSxz4wH2R; Wed, 4 Oct 2023 16:53:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S11456G29z3CR5; Wed, 4 Oct 2023 16:53:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438437; 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=tbANAGyo3JoWa2S5xmvi3SVP3q0GMMBTt73RqWzFx+c=; b=GXXaZZnwR9I3/LS9w9Pik2uZ4K0OT+8/lemjLP1QD7TMkKdNNmqByT2PpYDWUUFFPldUJO mwCasj1pey3P/F1C7vL1BaBguTr8jQMVcATBQy2BrQu/3nZTAMQEXhQ44bYAq+3gENXSe8 WFEkHwX6KRhodJIxGj6r1nCScSnE2IfMA+zX1eUUfYhoj6nQ/FiKohcauGj2j7U1JciWwg x+1SYINMYD76v1qIO0M5WwVuS3vvotW+xQ0YZpQvGLV3t25pje+JMBfYz8TcgLbSZH6tlR HlU1h38TqC//lWPQc+DiT2XKLR42m5xCalbL4jSbp0wI+rP8XebWvdW3arkU4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438437; a=rsa-sha256; cv=none; b=k1+UmVDIVPk3LXaAwd05VZOvMs8OmnZ/l9Lcmuj4Ar2OAxZeqadJpq31oz8T1hgy6lPaaU pKSomgtiYSe82qRObpl6cQxuPGtzobfqNsbLmHzNk2JuEGDNJ5mRIw76eM7Y0yY8fdtCna zJVjiqsvCw1sMc134TfEC4eY3HfYlnWL+kYNFST+38PiDTfLy4SgKjv3ewP+3toya1sQrG 8kQRo4spAmxKiX8RhTYU8D4yX6Gnm/VlV9jJTKN9M9A2dwxTvFmJAuvD5Sxc32YVuKPZhr DWPqIxVI0kJSjU0F98Z31bNqgCQMNJMfBukb8fWt9tXHKqVL4ESHP0JVUSGqRg== 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=1696438437; 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=tbANAGyo3JoWa2S5xmvi3SVP3q0GMMBTt73RqWzFx+c=; b=Z9Q4iq4uI3zz6YRaMLowq8ynDsXeoZIbBV9QyDL4HECRUphX1Vr95ejjIAtvr4UKTye4HI FHOIsVgqJGo7eAIo6+wDjbk10vuBlka3naFGbKGxzX0BxTOPCcnazHolOLfOJzByhHvraw eJSO/mQmcSFCA5BWGIZriKaqakndAQwc9ZYqJkpgyeCxX3UJrJWIT0mKeJUFSCC3VPBsSO FrXwSJ4PwUfBAuvny6HCOBFJWBIWGSdI1ABFsrmStGkp+foKjHyfC3elkPQ8psW6ZqUtIb ThN2tTUGVPlse+fa4R2m+xoGf+TYvNIZ70LgopHavwQnXmRryw5AMZWENTzKZg== 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 4S11455LxJzlRT; Wed, 4 Oct 2023 16:53:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GrvRD037541; Wed, 4 Oct 2023 16:53:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GrvUk037538; Wed, 4 Oct 2023 16:53:57 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:53:57 GMT Message-Id: <202310041653.394GrvUk037538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4fe5b70cae67 - main - bhyve: Move more amd64-specific code under amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4fe5b70cae6761b9205ff35b72ccfe60d7326301 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4fe5b70cae6761b9205ff35b72ccfe60d7326301 commit 4fe5b70cae6761b9205ff35b72ccfe60d7326301 Author: Mark Johnston AuthorDate: 2023-10-04 16:21:20 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Move more amd64-specific code under amd64/ mptable and the e820 are both rather amd64-specific and can be moved easily. In the case of e820, move the registration with qemu_fwcfg into e820.c, as it simplifies bhyverun.c a bit and I can't see any downsides. No functional change intended. Reviewed by: corvink, jhb, emaste MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40552 --- usr.sbin/bhyve/Makefile | 2 -- usr.sbin/bhyve/amd64/Makefile.inc | 2 ++ usr.sbin/bhyve/{ => amd64}/e820.c | 24 +++++++++++++++++++++++- usr.sbin/bhyve/{ => amd64}/e820.h | 2 +- usr.sbin/bhyve/{ => amd64}/mptbl.c | 0 usr.sbin/bhyve/{ => amd64}/mptbl.h | 0 usr.sbin/bhyve/bhyverun.c | 30 ++++++++++++++---------------- usr.sbin/bhyve/pci_gvt-d.c | 2 +- usr.sbin/bhyve/snapshot.c | 1 - 9 files changed, 41 insertions(+), 22 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 86039a8c45da..499c0d1bb89d 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -28,7 +28,6 @@ SRCS= \ crc16.c \ ctl_scsi_all.c \ ctl_util.c \ - e820.c \ gdb.c \ hda_codec.c \ inout.c \ @@ -37,7 +36,6 @@ SRCS= \ kernemu_dev.c \ mem.c \ mevent.c \ - mptbl.c \ net_backends.c \ net_utils.c \ pci_ahci.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index c52219cb8dd1..e0cb84e32b85 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -1,6 +1,8 @@ SRCS+= \ atkbdc.c \ + e820.c \ fwctl.c \ + mptbl.c \ post.c \ ps2kbd.c \ ps2mouse.c \ diff --git a/usr.sbin/bhyve/e820.c b/usr.sbin/bhyve/amd64/e820.c similarity index 95% rename from usr.sbin/bhyve/e820.c rename to usr.sbin/bhyve/amd64/e820.c index 99a66645f70f..545878aad39f 100644 --- a/usr.sbin/bhyve/e820.c +++ b/usr.sbin/bhyve/amd64/e820.c @@ -105,7 +105,7 @@ e820_dump_table(void) } } -struct qemu_fwcfg_item * +static struct qemu_fwcfg_item * e820_get_fwcfg_item(void) { struct qemu_fwcfg_item *fwcfg_item; @@ -466,3 +466,25 @@ e820_init(struct vmctx *const ctx) return (0); } + +int +e820_finalize(void) +{ + struct qemu_fwcfg_item *e820_fwcfg_item; + int error; + + e820_fwcfg_item = e820_get_fwcfg_item(); + if (e820_fwcfg_item == NULL) { + warnx("invalid e820 table"); + return (ENOMEM); + } + error = qemu_fwcfg_add_file("etc/e820", + e820_fwcfg_item->size, e820_fwcfg_item->data); + if (error != 0) { + warnx("could not add qemu fwcfg etc/e820"); + return (error); + } + free(e820_fwcfg_item); + + return (0); +} diff --git a/usr.sbin/bhyve/e820.h b/usr.sbin/bhyve/amd64/e820.h similarity index 95% rename from usr.sbin/bhyve/e820.h rename to usr.sbin/bhyve/amd64/e820.h index 8703a55115cd..ae68fe9040a9 100644 --- a/usr.sbin/bhyve/e820.h +++ b/usr.sbin/bhyve/amd64/e820.h @@ -41,5 +41,5 @@ uint64_t e820_alloc(const uint64_t address, const uint64_t length, const uint64_t alignment, const enum e820_memory_type type, const enum e820_allocation_strategy strategy); void e820_dump_table(void); -struct qemu_fwcfg_item *e820_get_fwcfg_item(void); int e820_init(struct vmctx *const ctx); +int e820_finalize(void); diff --git a/usr.sbin/bhyve/mptbl.c b/usr.sbin/bhyve/amd64/mptbl.c similarity index 100% rename from usr.sbin/bhyve/mptbl.c rename to usr.sbin/bhyve/amd64/mptbl.c diff --git a/usr.sbin/bhyve/mptbl.h b/usr.sbin/bhyve/amd64/mptbl.h similarity index 100% rename from usr.sbin/bhyve/mptbl.h rename to usr.sbin/bhyve/amd64/mptbl.h diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 707e21caf506..7672c577da66 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -89,8 +89,8 @@ #include "config.h" #include "inout.h" #include "debug.h" -#include "e820.h" #ifdef __amd64__ +#include "amd64/e820.h" #include "amd64/fwctl.h" #endif #include "gdb.h" @@ -98,7 +98,9 @@ #include "kernemu_dev.h" #include "mem.h" #include "mevent.h" -#include "mptbl.h" +#ifdef __amd64__ +#include "amd64/mptbl.h" +#endif #include "pci_emul.h" #include "pci_irq.h" #include "pci_lpc.h" @@ -1221,7 +1223,6 @@ main(int argc, char *argv[]) int max_vcpus, memflags; struct vcpu *bsp; struct vmctx *ctx; - struct qemu_fwcfg_item *e820_fwcfg_item; size_t memsize; const char *optstr, *value, *vmname; #ifdef BHYVE_SNAPSHOT @@ -1349,9 +1350,11 @@ main(int argc, char *argv[]) case 'x': set_config_bool("x86.x2apic", true); break; +#ifdef __amd64__ case 'Y': set_config_bool("x86.mptable", false); break; +#endif case 'h': usage(0); default: @@ -1476,10 +1479,12 @@ main(int argc, char *argv[]) exit(4); } +#ifdef __amd64__ if (e820_init(ctx) != 0) { fprintf(stderr, "Unable to setup E820"); exit(4); } +#endif /* * Exit if a device emulation finds an error in its initialization @@ -1552,9 +1557,7 @@ main(int argc, char *argv[]) } #endif - /* - * build the guest tables, MP etc. - */ +#ifdef __amd64__ if (get_config_bool_default("x86.mptable", true)) { error = mptable_build(ctx, guest_ncpus); if (error) { @@ -1562,6 +1565,7 @@ main(int argc, char *argv[]) exit(4); } } +#endif error = smbios_build(ctx); if (error != 0) @@ -1572,17 +1576,11 @@ main(int argc, char *argv[]) assert(error == 0); } - e820_fwcfg_item = e820_get_fwcfg_item(); - if (e820_fwcfg_item == NULL) { - fprintf(stderr, "invalid e820 table"); - exit(4); - } - if (qemu_fwcfg_add_file("etc/e820", e820_fwcfg_item->size, - e820_fwcfg_item->data) != 0) { - fprintf(stderr, "could not add qemu fwcfg etc/e820"); +#ifdef __amd64__ + error = e820_finalize(); + if (error != 0) exit(4); - } - free(e820_fwcfg_item); +#endif #ifdef __amd64__ if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) { diff --git a/usr.sbin/bhyve/pci_gvt-d.c b/usr.sbin/bhyve/pci_gvt-d.c index 78fa9878358e..f64cc5984352 100644 --- a/usr.sbin/bhyve/pci_gvt-d.c +++ b/usr.sbin/bhyve/pci_gvt-d.c @@ -17,7 +17,7 @@ #include #include -#include "e820.h" +#include "amd64/e820.h" #include "pci_gvt-d-opregion.h" #include "pci_passthru.h" diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 593930c7f8a3..2daef0ef74f0 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -84,7 +84,6 @@ #include "ioapic.h" #include "mem.h" #include "mevent.h" -#include "mptbl.h" #include "pci_emul.h" #include "pci_irq.h" #include "pci_lpc.h" From nobody Wed Oct 4 16:53:58 2023 X-Original-To: dev-commits-src-main@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 4S11470vdpz4wGyr; Wed, 4 Oct 2023 16:53:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S11470H9Cz3CWZ; Wed, 4 Oct 2023 16:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438439; 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=1egFqjeS5PMcc3+V8ZQiW/fclSYWSJBycnTPaDPvakk=; b=w0Z2l30B+QDFVcxm8EC2C+8XLAobSc8+DUr4fi3GuJ+2UkqIORRirSIbpdXitNSh4pB5Zk AHuCPgqdUC8bHjgVk9jemxJVF2udQR1OYetZnbWePbpOSPqaAFWQLoYAYyTBgSn35EpaIi srNgaXzIZ3XBS/PXLKjL6LFOEZw/dQ+a4nbus9bmXCHebHMBGYkCP1SRLmE5W8NewlwzRm 1zZeMvXfoelgSmEPlfLdAlF69agsPAeyAAiWAMuTDAOhR1ph9SWV1e9H4P2+MF7M33zoc/ JwHxJmTpeRmJBd9iwteE/DbyoPpWQzBoMogLpeIQsvbWb/onboPmCj1so0pnuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438439; a=rsa-sha256; cv=none; b=lRU4WiZwEWTDDZamMYbItJfPGGRMCm+xZIRSZy0o3q5D5sMKMaCtu2QEq/1l/XsPQV+KMc +ubYH2wiouemZ2csifMPLicIMwBM/L33yEIlmi46SUZ2rrl5gYVAGp5hcfVdrJm3XvAYg1 z2sFPVZDy8wIv5mgkdttrACi2rW3W+uJwtGAOKOkHK79pL/AKuZZPeFPdq/WuXNag1Vv1V c1guMxYLZsUY1KWQYuil5NR8VO/lZjJzOSQtV6NkoFhFx2Y/8IqkGsEkFqk7uUu9NZdUzy eYIPPMrxWZ1gEsrShJq312ze5Zha1yafhngO1lboxfCeS5vFnmFimWK6L9voJQ== 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=1696438439; 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=1egFqjeS5PMcc3+V8ZQiW/fclSYWSJBycnTPaDPvakk=; b=b85DanvVzqPvKhNe6Z8HZyV60B7pJm4PJyl5Vk5asldRVL/0hTZXO9SiIq0C4/SMXNxwJT i9YqrOCacDcCjOuX4nZpH6FVtqXdy/b4nyk4WBwe77w16Svr9P/kzrwZ5F7Qs/YKgD/jKf 0jGJPGCcz7VtN81qpYUIPcBdp3bbKJ2JVBrq5IUxt51t1pugKVuPNpfEHsrjE/1SV7y/ua b69LWTZ+1z7xSSzzTaXJCM4vIUGja5Ei7u0bKaZJVvkXfYygVFr1F1Tze0/Ay4ektWxlug oKsOFoUc6eafhF077f1dHiYZVy6r8MZlQRNGptLp+W3/+FC/CKwu0O/b5qAf2w== 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 4S114665kZzlly; Wed, 4 Oct 2023 16:53:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GrwDP037583; Wed, 4 Oct 2023 16:53:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GrwjL037581; Wed, 4 Oct 2023 16:53:58 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:53:58 GMT Message-Id: <202310041653.394GrwjL037581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a1642451ce25 - main - bhyve: Move kernemu to amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1642451ce25bb0e2d01765a8dedda69c5029d48 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a1642451ce25bb0e2d01765a8dedda69c5029d48 commit a1642451ce25bb0e2d01765a8dedda69c5029d48 Author: Mark Johnston AuthorDate: 2023-10-04 16:22:41 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Move kernemu to amd64/ This code handles instruction emulation for accesses to various amd64-specific MMIO regions. No functional change intended. Reviewed by: corvink, jhb, emaste MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40554 --- usr.sbin/bhyve/Makefile | 3 --- usr.sbin/bhyve/amd64/Makefile.inc | 4 +++- usr.sbin/bhyve/{ => amd64}/kernemu_dev.c | 0 usr.sbin/bhyve/{ => amd64}/kernemu_dev.h | 0 usr.sbin/bhyve/bhyverun.c | 6 +++++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 499c0d1bb89d..c2ccd60790ae 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -33,7 +33,6 @@ SRCS= \ inout.c \ ioapic.c \ iov.c \ - kernemu_dev.c \ mem.c \ mevent.c \ net_backends.c \ @@ -85,8 +84,6 @@ SRCS+= snapshot.c .include "${MACHINE_CPUARCH}/Makefile.inc" -CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 - CFLAGS+=-I${.CURDIR} \ -I${.CURDIR}/../../contrib/lib9p \ -I${SRCTOP}/sys diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index e0cb84e32b85..6843cec4919f 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -2,14 +2,16 @@ SRCS+= \ atkbdc.c \ e820.c \ fwctl.c \ + kernemu_dev.c \ mptbl.c \ post.c \ ps2kbd.c \ ps2mouse.c \ task_switch.c - .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c +CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 + SUBDIR+= kbdlayout diff --git a/usr.sbin/bhyve/kernemu_dev.c b/usr.sbin/bhyve/amd64/kernemu_dev.c similarity index 100% rename from usr.sbin/bhyve/kernemu_dev.c rename to usr.sbin/bhyve/amd64/kernemu_dev.c diff --git a/usr.sbin/bhyve/kernemu_dev.h b/usr.sbin/bhyve/amd64/kernemu_dev.h similarity index 100% rename from usr.sbin/bhyve/kernemu_dev.h rename to usr.sbin/bhyve/amd64/kernemu_dev.h diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 7672c577da66..df40c7a7cc2a 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -95,7 +95,9 @@ #endif #include "gdb.h" #include "ioapic.h" -#include "kernemu_dev.h" +#ifdef __amd64__ +#include "amd64/kernemu_dev.h" +#endif #include "mem.h" #include "mevent.h" #ifdef __amd64__ @@ -1457,7 +1459,9 @@ main(int argc, char *argv[]) init_mem(guest_ncpus); init_inout(); +#ifdef __amd64__ kernemu_dev_init(); +#endif init_bootrom(ctx); #ifdef __amd64__ atkbdc_init(ctx); From nobody Wed Oct 4 16:53:59 2023 X-Original-To: dev-commits-src-main@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 4S114816fJz4wGnZ; Wed, 4 Oct 2023 16:54:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S11480VZmz3CX8; Wed, 4 Oct 2023 16:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438440; 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=jOVP/RdIMiG7v+ashXEeDcdb8OzdE+OVrFs92ZR3XW8=; b=nPuzDgzqlwVq8aU3SVKt/SVvqSWSFMEANm3u0A/yqwYhMOaMLLi55NnG5mMZGGQNHk/Wg/ ivc3/e2WZ8jTWWVU1I8ioCCWHgfyMvUIsW6x2s7iZi4Lof/8oJv6iz6J1r0H1RG0MpObNk 47BEjjcsUcZ0xMuwmdzMVnP45QF7Ly+j4axGs+sH4+Xw7Zg/ShhaTmfHpyGBIn2q7lS+WW wF9f+2hIy84qsBAJIz2bAceRShqdyAy9vwrF701ezN088zN71s+jyAMRetHsl6gM5JtSyC m5uuGcH14nMgyAUDYF+2HMNmk8YmwzP3RUg5P8CcZnRb2uwpJOCjHEGFmzvVWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438440; a=rsa-sha256; cv=none; b=Gg/DBQ0bTPcYzzCjtJvb4qCyvTVbVpRTpUZjt4OpixzelXASwcuIiEwqAVvUgW1P64spjb xjYeCpUUdDNl6v1q0C+sBCj4dBPf4F8K+laUzIo0GAlRDkXRFb0vWBHWvOsSAiOW7GBfqx D7fy7pLCPZD9hiRnX8BYv1HQCFR+y5pXs5chAs9+WW1Iq+6fuzm4vVpzNCe/oJ5iMGWmIC xQmyBRLt2sINnqvDDQNSxVxK2YoqIrLlKSL0mFVk+DWSn5H4QqhzD+Zja9a5KN3ah9rwVt vwmUtdkIsluqsYlosHcX5+5a9wcfrCz6Bz/c7IraRDODmaCZACwjLD6WXhShRA== 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=1696438440; 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=jOVP/RdIMiG7v+ashXEeDcdb8OzdE+OVrFs92ZR3XW8=; b=kAZvE3kH+UfiqR9hnuCQJJvoJ0HPiJ//b/neH0z5Qk5AAkDSxK1wbTS46ORMy5H61qQdyL ckGbwaaP1ivMCN3KA+gAG0WrTJHYTxj46DXYLZX1Z+fxQrzUWoxwuNJMi64WymIZLXuG5F YhSXO81tsMhhdhuIed7AKdwU/zp9vo10c2BYayLRGcGm/pWG7knkiLVXHAmogxQJUX3yZQ cEqcEvOZnfREjXpfNsfvCqwA9uHbKB7WobVwEmeIhYJEo+nnYq13vV6C7fWEv5ZRPQN21M 8YDkWwO5WrrPtEV9gttil6D4B9eueHGzMFgJD5d3YGrVoioOSJFxwY2CB75Eqw== 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 4S11476gNDzlRV; Wed, 4 Oct 2023 16:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GrxLp037638; Wed, 4 Oct 2023 16:53:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GrxXZ037635; Wed, 4 Oct 2023 16:53:59 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:53:59 GMT Message-Id: <202310041653.394GrxXZ037635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 72f9c9d82fce - main - bhyve: Split vmexit handling into a separate file List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72f9c9d82fce84fcb68c9aa1f32fabcf0c0038e9 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=72f9c9d82fce84fcb68c9aa1f32fabcf0c0038e9 commit 72f9c9d82fce84fcb68c9aa1f32fabcf0c0038e9 Author: Mark Johnston AuthorDate: 2023-10-04 16:22:56 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Split vmexit handling into a separate file Put it in amd64, since most of it is MD and won't be used on arm64. Add a bit of glue to bhyverun.h to make CPU startup and shutdown work without having to export more global variables. AP startup will be reworked further in a future revision. This makes bhyverun.c much more machine-independent. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40556 --- usr.sbin/bhyve/Makefile | 1 + usr.sbin/bhyve/amd64/vmexit.c | 493 ++++++++++++++++++++++++++++++++++++++++++ usr.sbin/bhyve/bhyverun.c | 468 ++------------------------------------- usr.sbin/bhyve/bhyverun.h | 7 + usr.sbin/bhyve/vmexit.h | 34 +++ 5 files changed, 551 insertions(+), 452 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index c2ccd60790ae..5f13d457d914 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -75,6 +75,7 @@ SRCS= \ usb_mouse.c \ vga.c \ virtio.c \ + vmexit.c \ vmgenc.c \ xmsr.c diff --git a/usr.sbin/bhyve/amd64/vmexit.c b/usr.sbin/bhyve/amd64/vmexit.c new file mode 100644 index 000000000000..152fecaf424c --- /dev/null +++ b/usr.sbin/bhyve/amd64/vmexit.c @@ -0,0 +1,493 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "bhyverun.h" +#include "config.h" +#include "debug.h" +#include "gdb.h" +#include "inout.h" +#include "mem.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif +#include "spinup_ap.h" +#include "vmexit.h" +#include "xmsr.h" + +static int +vmexit_inout(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) +{ + struct vm_exit *vme; + int error; + int bytes, port, in; + + vme = vmrun->vm_exit; + port = vme->u.inout.port; + bytes = vme->u.inout.bytes; + in = vme->u.inout.in; + + error = emulate_inout(ctx, vcpu, vme); + if (error) { + fprintf(stderr, "Unhandled %s%c 0x%04x at 0x%lx\n", + in ? "in" : "out", + bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), + port, vme->rip); + return (VMEXIT_ABORT); + } else { + return (VMEXIT_CONTINUE); + } +} + +static int +vmexit_rdmsr(struct vmctx *ctx __unused, struct vcpu *vcpu, + struct vm_run *vmrun) +{ + struct vm_exit *vme; + uint64_t val; + uint32_t eax, edx; + int error; + + vme = vmrun->vm_exit; + + val = 0; + error = emulate_rdmsr(vcpu, vme->u.msr.code, &val); + if (error != 0) { + fprintf(stderr, "rdmsr to register %#x on vcpu %d\n", + vme->u.msr.code, vcpu_id(vcpu)); + if (get_config_bool("x86.strictmsr")) { + vm_inject_gp(vcpu); + return (VMEXIT_CONTINUE); + } + } + + eax = val; + error = vm_set_register(vcpu, VM_REG_GUEST_RAX, eax); + assert(error == 0); + + edx = val >> 32; + error = vm_set_register(vcpu, VM_REG_GUEST_RDX, edx); + assert(error == 0); + + return (VMEXIT_CONTINUE); +} + +static int +vmexit_wrmsr(struct vmctx *ctx __unused, struct vcpu *vcpu, + struct vm_run *vmrun) +{ + struct vm_exit *vme; + int error; + + vme = vmrun->vm_exit; + + error = emulate_wrmsr(vcpu, vme->u.msr.code, vme->u.msr.wval); + if (error != 0) { + fprintf(stderr, "wrmsr to register %#x(%#lx) on vcpu %d\n", + vme->u.msr.code, vme->u.msr.wval, vcpu_id(vcpu)); + if (get_config_bool("x86.strictmsr")) { + vm_inject_gp(vcpu); + return (VMEXIT_CONTINUE); + } + } + return (VMEXIT_CONTINUE); +} + +static const char * const vmx_exit_reason_desc[] = { + [EXIT_REASON_EXCEPTION] = "Exception or non-maskable interrupt (NMI)", + [EXIT_REASON_EXT_INTR] = "External interrupt", + [EXIT_REASON_TRIPLE_FAULT] = "Triple fault", + [EXIT_REASON_INIT] = "INIT signal", + [EXIT_REASON_SIPI] = "Start-up IPI (SIPI)", + [EXIT_REASON_IO_SMI] = "I/O system-management interrupt (SMI)", + [EXIT_REASON_SMI] = "Other SMI", + [EXIT_REASON_INTR_WINDOW] = "Interrupt window", + [EXIT_REASON_NMI_WINDOW] = "NMI window", + [EXIT_REASON_TASK_SWITCH] = "Task switch", + [EXIT_REASON_CPUID] = "CPUID", + [EXIT_REASON_GETSEC] = "GETSEC", + [EXIT_REASON_HLT] = "HLT", + [EXIT_REASON_INVD] = "INVD", + [EXIT_REASON_INVLPG] = "INVLPG", + [EXIT_REASON_RDPMC] = "RDPMC", + [EXIT_REASON_RDTSC] = "RDTSC", + [EXIT_REASON_RSM] = "RSM", + [EXIT_REASON_VMCALL] = "VMCALL", + [EXIT_REASON_VMCLEAR] = "VMCLEAR", + [EXIT_REASON_VMLAUNCH] = "VMLAUNCH", + [EXIT_REASON_VMPTRLD] = "VMPTRLD", + [EXIT_REASON_VMPTRST] = "VMPTRST", + [EXIT_REASON_VMREAD] = "VMREAD", + [EXIT_REASON_VMRESUME] = "VMRESUME", + [EXIT_REASON_VMWRITE] = "VMWRITE", + [EXIT_REASON_VMXOFF] = "VMXOFF", + [EXIT_REASON_VMXON] = "VMXON", + [EXIT_REASON_CR_ACCESS] = "Control-register accesses", + [EXIT_REASON_DR_ACCESS] = "MOV DR", + [EXIT_REASON_INOUT] = "I/O instruction", + [EXIT_REASON_RDMSR] = "RDMSR", + [EXIT_REASON_WRMSR] = "WRMSR", + [EXIT_REASON_INVAL_VMCS] = + "VM-entry failure due to invalid guest state", + [EXIT_REASON_INVAL_MSR] = "VM-entry failure due to MSR loading", + [EXIT_REASON_MWAIT] = "MWAIT", + [EXIT_REASON_MTF] = "Monitor trap flag", + [EXIT_REASON_MONITOR] = "MONITOR", + [EXIT_REASON_PAUSE] = "PAUSE", + [EXIT_REASON_MCE_DURING_ENTRY] = + "VM-entry failure due to machine-check event", + [EXIT_REASON_TPR] = "TPR below threshold", + [EXIT_REASON_APIC_ACCESS] = "APIC access", + [EXIT_REASON_VIRTUALIZED_EOI] = "Virtualized EOI", + [EXIT_REASON_GDTR_IDTR] = "Access to GDTR or IDTR", + [EXIT_REASON_LDTR_TR] = "Access to LDTR or TR", + [EXIT_REASON_EPT_FAULT] = "EPT violation", + [EXIT_REASON_EPT_MISCONFIG] = "EPT misconfiguration", + [EXIT_REASON_INVEPT] = "INVEPT", + [EXIT_REASON_RDTSCP] = "RDTSCP", + [EXIT_REASON_VMX_PREEMPT] = "VMX-preemption timer expired", + [EXIT_REASON_INVVPID] = "INVVPID", + [EXIT_REASON_WBINVD] = "WBINVD", + [EXIT_REASON_XSETBV] = "XSETBV", + [EXIT_REASON_APIC_WRITE] = "APIC write", + [EXIT_REASON_RDRAND] = "RDRAND", + [EXIT_REASON_INVPCID] = "INVPCID", + [EXIT_REASON_VMFUNC] = "VMFUNC", + [EXIT_REASON_ENCLS] = "ENCLS", + [EXIT_REASON_RDSEED] = "RDSEED", + [EXIT_REASON_PM_LOG_FULL] = "Page-modification log full", + [EXIT_REASON_XSAVES] = "XSAVES", + [EXIT_REASON_XRSTORS] = "XRSTORS" +}; + +static const char * +vmexit_vmx_desc(uint32_t exit_reason) +{ + + if (exit_reason >= nitems(vmx_exit_reason_desc) || + vmx_exit_reason_desc[exit_reason] == NULL) + return ("Unknown"); + return (vmx_exit_reason_desc[exit_reason]); +} + +#define DEBUG_EPT_MISCONFIG +#ifdef DEBUG_EPT_MISCONFIG +#define VMCS_GUEST_PHYSICAL_ADDRESS 0x00002400 + +static uint64_t ept_misconfig_gpa, ept_misconfig_pte[4]; +static int ept_misconfig_ptenum; +#endif + +static int +vmexit_vmx(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) +{ + struct vm_exit *vme; + + vme = vmrun->vm_exit; + + fprintf(stderr, "vm exit[%d]\n", vcpu_id(vcpu)); + fprintf(stderr, "\treason\t\tVMX\n"); + fprintf(stderr, "\trip\t\t0x%016lx\n", vme->rip); + fprintf(stderr, "\tinst_length\t%d\n", vme->inst_length); + fprintf(stderr, "\tstatus\t\t%d\n", vme->u.vmx.status); + fprintf(stderr, "\texit_reason\t%u (%s)\n", vme->u.vmx.exit_reason, + vmexit_vmx_desc(vme->u.vmx.exit_reason)); + fprintf(stderr, "\tqualification\t0x%016lx\n", + vme->u.vmx.exit_qualification); + fprintf(stderr, "\tinst_type\t\t%d\n", vme->u.vmx.inst_type); + fprintf(stderr, "\tinst_error\t\t%d\n", vme->u.vmx.inst_error); +#ifdef DEBUG_EPT_MISCONFIG + if (vme->u.vmx.exit_reason == EXIT_REASON_EPT_MISCONFIG) { + vm_get_register(vcpu, + VMCS_IDENT(VMCS_GUEST_PHYSICAL_ADDRESS), + &ept_misconfig_gpa); + vm_get_gpa_pmap(ctx, ept_misconfig_gpa, ept_misconfig_pte, + &ept_misconfig_ptenum); + fprintf(stderr, "\tEPT misconfiguration:\n"); + fprintf(stderr, "\t\tGPA: %#lx\n", ept_misconfig_gpa); + fprintf(stderr, "\t\tPTE(%d): %#lx %#lx %#lx %#lx\n", + ept_misconfig_ptenum, ept_misconfig_pte[0], + ept_misconfig_pte[1], ept_misconfig_pte[2], + ept_misconfig_pte[3]); + } +#endif /* DEBUG_EPT_MISCONFIG */ + return (VMEXIT_ABORT); +} + +static int +vmexit_svm(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun) +{ + struct vm_exit *vme; + + vme = vmrun->vm_exit; + + fprintf(stderr, "vm exit[%d]\n", vcpu_id(vcpu)); + fprintf(stderr, "\treason\t\tSVM\n"); + fprintf(stderr, "\trip\t\t0x%016lx\n", vme->rip); + fprintf(stderr, "\tinst_length\t%d\n", vme->inst_length); + fprintf(stderr, "\texitcode\t%#lx\n", vme->u.svm.exitcode); + fprintf(stderr, "\texitinfo1\t%#lx\n", vme->u.svm.exitinfo1); + fprintf(stderr, "\texitinfo2\t%#lx\n", vme->u.svm.exitinfo2); + return (VMEXIT_ABORT); +} + +static int +vmexit_bogus(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, + struct vm_run *vmrun) +{ + assert(vmrun->vm_exit->inst_length == 0); + + return (VMEXIT_CONTINUE); +} + +static int +vmexit_reqidle(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, + struct vm_run *vmrun) +{ + assert(vmrun->vm_exit->inst_length == 0); + + return (VMEXIT_CONTINUE); +} + +static int +vmexit_hlt(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, + struct vm_run *vmrun __unused) +{ + /* + * Just continue execution with the next instruction. We use + * the HLT VM exit as a way to be friendly with the host + * scheduler. + */ + return (VMEXIT_CONTINUE); +} + +static int +vmexit_pause(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, + struct vm_run *vmrun __unused) +{ + return (VMEXIT_CONTINUE); +} + +static int +vmexit_mtrap(struct vmctx *ctx __unused, struct vcpu *vcpu, + struct vm_run *vmrun) +{ + assert(vmrun->vm_exit->inst_length == 0); + +#ifdef BHYVE_SNAPSHOT + checkpoint_cpu_suspend(vcpu_id(vcpu)); +#endif + gdb_cpu_mtrap(vcpu); +#ifdef BHYVE_SNAPSHOT + checkpoint_cpu_resume(vcpu_id(vcpu)); +#endif + + return (VMEXIT_CONTINUE); +} + +static int +vmexit_inst_emul(struct vmctx *ctx __unused, struct vcpu *vcpu, + struct vm_run *vmrun) +{ + struct vm_exit *vme; + struct vie *vie; + int err, i, cs_d; + enum vm_cpu_mode mode; + + vme = vmrun->vm_exit; + + vie = &vme->u.inst_emul.vie; + if (!vie->decoded) { + /* + * Attempt to decode in userspace as a fallback. This allows + * updating instruction decode in bhyve without rebooting the + * kernel (rapid prototyping), albeit with much slower + * emulation. + */ + vie_restart(vie); + mode = vme->u.inst_emul.paging.cpu_mode; + cs_d = vme->u.inst_emul.cs_d; + if (vmm_decode_instruction(mode, cs_d, vie) != 0) + goto fail; + if (vm_set_register(vcpu, VM_REG_GUEST_RIP, + vme->rip + vie->num_processed) != 0) + goto fail; + } + + err = emulate_mem(vcpu, vme->u.inst_emul.gpa, vie, + &vme->u.inst_emul.paging); + if (err) { + if (err == ESRCH) { + EPRINTLN("Unhandled memory access to 0x%lx\n", + vme->u.inst_emul.gpa); + } + goto fail; + } + + return (VMEXIT_CONTINUE); + +fail: + fprintf(stderr, "Failed to emulate instruction sequence [ "); + for (i = 0; i < vie->num_valid; i++) + fprintf(stderr, "%02x", vie->inst[i]); + FPRINTLN(stderr, " ] at 0x%lx", vme->rip); + return (VMEXIT_ABORT); +} + +static int +vmexit_suspend(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) +{ + struct vm_exit *vme; + enum vm_suspend_how how; + int vcpuid = vcpu_id(vcpu); + + vme = vmrun->vm_exit; + + how = vme->u.suspended.how; + + fbsdrun_deletecpu(vcpuid); + + switch (how) { + case VM_SUSPEND_RESET: + exit(0); + case VM_SUSPEND_POWEROFF: + if (get_config_bool_default("destroy_on_poweroff", false)) + vm_destroy(ctx); + exit(1); + case VM_SUSPEND_HALT: + exit(2); + case VM_SUSPEND_TRIPLEFAULT: + exit(3); + default: + fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how); + exit(100); + } + return (0); /* NOTREACHED */ +} + +static int +vmexit_debug(struct vmctx *ctx __unused, struct vcpu *vcpu, + struct vm_run *vmrun __unused) +{ + +#ifdef BHYVE_SNAPSHOT + checkpoint_cpu_suspend(vcpu_id(vcpu)); +#endif + gdb_cpu_suspend(vcpu); +#ifdef BHYVE_SNAPSHOT + checkpoint_cpu_resume(vcpu_id(vcpu)); +#endif + /* + * XXX-MJ sleep for a short period to avoid chewing up the CPU in the + * window between activation of the vCPU thread and the STARTUP IPI. + */ + usleep(1000); + return (VMEXIT_CONTINUE); +} + +static int +vmexit_breakpoint(struct vmctx *ctx __unused, struct vcpu *vcpu, + struct vm_run *vmrun) +{ + gdb_cpu_breakpoint(vcpu, vmrun->vm_exit); + return (VMEXIT_CONTINUE); +} + +static int +vmexit_ipi(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, + struct vm_run *vmrun) +{ + struct vm_exit *vme; + cpuset_t *dmask; + int error = -1; + int i; + + dmask = vmrun->cpuset; + vme = vmrun->vm_exit; + + switch (vme->u.ipi.mode) { + case APIC_DELMODE_INIT: + CPU_FOREACH_ISSET(i, dmask) { + error = fbsdrun_suspendcpu(i); + if (error) { + warnx("failed to suspend cpu %d", i); + break; + } + } + break; + case APIC_DELMODE_STARTUP: + CPU_FOREACH_ISSET(i, dmask) { + spinup_ap(fbsdrun_vcpu(i), + vme->u.ipi.vector << PAGE_SHIFT); + } + error = 0; + break; + default: + break; + } + + return (error); +} + +int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_run *); + +const vmexit_handler_t vmexit_handlers[VM_EXITCODE_MAX] = { + [VM_EXITCODE_INOUT] = vmexit_inout, + [VM_EXITCODE_INOUT_STR] = vmexit_inout, + [VM_EXITCODE_VMX] = vmexit_vmx, + [VM_EXITCODE_SVM] = vmexit_svm, + [VM_EXITCODE_BOGUS] = vmexit_bogus, + [VM_EXITCODE_REQIDLE] = vmexit_reqidle, + [VM_EXITCODE_RDMSR] = vmexit_rdmsr, + [VM_EXITCODE_WRMSR] = vmexit_wrmsr, + [VM_EXITCODE_MTRAP] = vmexit_mtrap, + [VM_EXITCODE_INST_EMUL] = vmexit_inst_emul, + [VM_EXITCODE_SUSPENDED] = vmexit_suspend, + [VM_EXITCODE_TASK_SWITCH] = vmexit_task_switch, + [VM_EXITCODE_DEBUG] = vmexit_debug, + [VM_EXITCODE_BPT] = vmexit_breakpoint, + [VM_EXITCODE_IPI] = vmexit_ipi, + [VM_EXITCODE_HLT] = vmexit_hlt, + [VM_EXITCODE_PAUSE] = vmexit_pause, +}; diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index df40c7a7cc2a..1cf7fc5bcc24 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -41,11 +41,7 @@ #include #endif -#include -#include - #include -#include #ifndef WITHOUT_CAPSICUM #include @@ -73,11 +69,6 @@ #include #endif -#include -#ifndef WITHOUT_CAPSICUM -#include -#endif -#include #include #include "bhyverun.h" @@ -112,83 +103,14 @@ #include "snapshot.h" #endif #include "tpm_device.h" -#include "xmsr.h" -#include "spinup_ap.h" #include "rtc.h" #include "vmgenc.h" +#include "vmexit.h" +#include "xmsr.h" #define MB (1024UL * 1024) #define GB (1024UL * MB) -static const char * const vmx_exit_reason_desc[] = { - [EXIT_REASON_EXCEPTION] = "Exception or non-maskable interrupt (NMI)", - [EXIT_REASON_EXT_INTR] = "External interrupt", - [EXIT_REASON_TRIPLE_FAULT] = "Triple fault", - [EXIT_REASON_INIT] = "INIT signal", - [EXIT_REASON_SIPI] = "Start-up IPI (SIPI)", - [EXIT_REASON_IO_SMI] = "I/O system-management interrupt (SMI)", - [EXIT_REASON_SMI] = "Other SMI", - [EXIT_REASON_INTR_WINDOW] = "Interrupt window", - [EXIT_REASON_NMI_WINDOW] = "NMI window", - [EXIT_REASON_TASK_SWITCH] = "Task switch", - [EXIT_REASON_CPUID] = "CPUID", - [EXIT_REASON_GETSEC] = "GETSEC", - [EXIT_REASON_HLT] = "HLT", - [EXIT_REASON_INVD] = "INVD", - [EXIT_REASON_INVLPG] = "INVLPG", - [EXIT_REASON_RDPMC] = "RDPMC", - [EXIT_REASON_RDTSC] = "RDTSC", - [EXIT_REASON_RSM] = "RSM", - [EXIT_REASON_VMCALL] = "VMCALL", - [EXIT_REASON_VMCLEAR] = "VMCLEAR", - [EXIT_REASON_VMLAUNCH] = "VMLAUNCH", - [EXIT_REASON_VMPTRLD] = "VMPTRLD", - [EXIT_REASON_VMPTRST] = "VMPTRST", - [EXIT_REASON_VMREAD] = "VMREAD", - [EXIT_REASON_VMRESUME] = "VMRESUME", - [EXIT_REASON_VMWRITE] = "VMWRITE", - [EXIT_REASON_VMXOFF] = "VMXOFF", - [EXIT_REASON_VMXON] = "VMXON", - [EXIT_REASON_CR_ACCESS] = "Control-register accesses", - [EXIT_REASON_DR_ACCESS] = "MOV DR", - [EXIT_REASON_INOUT] = "I/O instruction", - [EXIT_REASON_RDMSR] = "RDMSR", - [EXIT_REASON_WRMSR] = "WRMSR", - [EXIT_REASON_INVAL_VMCS] = - "VM-entry failure due to invalid guest state", - [EXIT_REASON_INVAL_MSR] = "VM-entry failure due to MSR loading", - [EXIT_REASON_MWAIT] = "MWAIT", - [EXIT_REASON_MTF] = "Monitor trap flag", - [EXIT_REASON_MONITOR] = "MONITOR", - [EXIT_REASON_PAUSE] = "PAUSE", - [EXIT_REASON_MCE_DURING_ENTRY] = - "VM-entry failure due to machine-check event", - [EXIT_REASON_TPR] = "TPR below threshold", - [EXIT_REASON_APIC_ACCESS] = "APIC access", - [EXIT_REASON_VIRTUALIZED_EOI] = "Virtualized EOI", - [EXIT_REASON_GDTR_IDTR] = "Access to GDTR or IDTR", - [EXIT_REASON_LDTR_TR] = "Access to LDTR or TR", - [EXIT_REASON_EPT_FAULT] = "EPT violation", - [EXIT_REASON_EPT_MISCONFIG] = "EPT misconfiguration", - [EXIT_REASON_INVEPT] = "INVEPT", - [EXIT_REASON_RDTSCP] = "RDTSCP", - [EXIT_REASON_VMX_PREEMPT] = "VMX-preemption timer expired", - [EXIT_REASON_INVVPID] = "INVVPID", - [EXIT_REASON_WBINVD] = "WBINVD", - [EXIT_REASON_XSETBV] = "XSETBV", - [EXIT_REASON_APIC_WRITE] = "APIC write", - [EXIT_REASON_RDRAND] = "RDRAND", - [EXIT_REASON_INVPCID] = "INVPCID", - [EXIT_REASON_VMFUNC] = "VMFUNC", - [EXIT_REASON_ENCLS] = "ENCLS", - [EXIT_REASON_RDSEED] = "RDSEED", - [EXIT_REASON_PM_LOG_FULL] = "Page-modification log full", - [EXIT_REASON_XSAVES] = "XSAVES", - [EXIT_REASON_XRSTORS] = "XRSTORS" -}; - -typedef int (*vmexit_handler_t)(struct vmctx *, struct vcpu *, struct vm_run *); - int guest_ncpus; uint16_t cpu_cores, cpu_sockets, cpu_threads; @@ -508,6 +430,12 @@ fbsdrun_virtio_msix(void) return (get_config_bool_default("virtio_msix", true)); } +struct vcpu * +fbsdrun_vcpu(int vcpuid) +{ + return (vcpu_info[vcpuid].vcpu); +} + static void * fbsdrun_start_thread(void *param) { @@ -554,7 +482,7 @@ fbsdrun_addcpu(struct vcpu_info *vi) assert(error == 0); } -static void +void fbsdrun_deletecpu(int vcpu) { static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -581,376 +509,12 @@ fbsdrun_deletecpu(int vcpu) pthread_mutex_unlock(&resetcpu_mtx); } -static int -vmexit_inout(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) -{ - struct vm_exit *vme; - int error; - int bytes, port, in; - - vme = vmrun->vm_exit; - port = vme->u.inout.port; - bytes = vme->u.inout.bytes; - in = vme->u.inout.in; - - error = emulate_inout(ctx, vcpu, vme); - if (error) { - fprintf(stderr, "Unhandled %s%c 0x%04x at 0x%lx\n", - in ? "in" : "out", - bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), - port, vme->rip); - return (VMEXIT_ABORT); - } else { - return (VMEXIT_CONTINUE); - } -} - -static int -vmexit_rdmsr(struct vmctx *ctx __unused, struct vcpu *vcpu, - struct vm_run *vmrun) -{ - struct vm_exit *vme; - uint64_t val; - uint32_t eax, edx; - int error; - - vme = vmrun->vm_exit; - - val = 0; - error = emulate_rdmsr(vcpu, vme->u.msr.code, &val); - if (error != 0) { - fprintf(stderr, "rdmsr to register %#x on vcpu %d\n", - vme->u.msr.code, vcpu_id(vcpu)); - if (get_config_bool("x86.strictmsr")) { - vm_inject_gp(vcpu); - return (VMEXIT_CONTINUE); - } - } - - eax = val; - error = vm_set_register(vcpu, VM_REG_GUEST_RAX, eax); - assert(error == 0); - - edx = val >> 32; - error = vm_set_register(vcpu, VM_REG_GUEST_RDX, edx); - assert(error == 0); - - return (VMEXIT_CONTINUE); -} - -static int -vmexit_wrmsr(struct vmctx *ctx __unused, struct vcpu *vcpu, - struct vm_run *vmrun) -{ - struct vm_exit *vme; - int error; - - vme = vmrun->vm_exit; - - error = emulate_wrmsr(vcpu, vme->u.msr.code, vme->u.msr.wval); - if (error != 0) { - fprintf(stderr, "wrmsr to register %#x(%#lx) on vcpu %d\n", - vme->u.msr.code, vme->u.msr.wval, vcpu_id(vcpu)); - if (get_config_bool("x86.strictmsr")) { - vm_inject_gp(vcpu); - return (VMEXIT_CONTINUE); - } - } - return (VMEXIT_CONTINUE); -} - -#define DEBUG_EPT_MISCONFIG -#ifdef DEBUG_EPT_MISCONFIG -#define VMCS_GUEST_PHYSICAL_ADDRESS 0x00002400 - -static uint64_t ept_misconfig_gpa, ept_misconfig_pte[4]; -static int ept_misconfig_ptenum; -#endif - -static const char * -vmexit_vmx_desc(uint32_t exit_reason) -{ - - if (exit_reason >= nitems(vmx_exit_reason_desc) || - vmx_exit_reason_desc[exit_reason] == NULL) - return ("Unknown"); - return (vmx_exit_reason_desc[exit_reason]); -} - -static int -vmexit_vmx(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) -{ - struct vm_exit *vme; - - vme = vmrun->vm_exit; - - fprintf(stderr, "vm exit[%d]\n", vcpu_id(vcpu)); - fprintf(stderr, "\treason\t\tVMX\n"); - fprintf(stderr, "\trip\t\t0x%016lx\n", vme->rip); - fprintf(stderr, "\tinst_length\t%d\n", vme->inst_length); - fprintf(stderr, "\tstatus\t\t%d\n", vme->u.vmx.status); - fprintf(stderr, "\texit_reason\t%u (%s)\n", vme->u.vmx.exit_reason, - vmexit_vmx_desc(vme->u.vmx.exit_reason)); - fprintf(stderr, "\tqualification\t0x%016lx\n", - vme->u.vmx.exit_qualification); - fprintf(stderr, "\tinst_type\t\t%d\n", vme->u.vmx.inst_type); - fprintf(stderr, "\tinst_error\t\t%d\n", vme->u.vmx.inst_error); -#ifdef DEBUG_EPT_MISCONFIG - if (vme->u.vmx.exit_reason == EXIT_REASON_EPT_MISCONFIG) { - vm_get_register(vcpu, - VMCS_IDENT(VMCS_GUEST_PHYSICAL_ADDRESS), - &ept_misconfig_gpa); - vm_get_gpa_pmap(ctx, ept_misconfig_gpa, ept_misconfig_pte, - &ept_misconfig_ptenum); - fprintf(stderr, "\tEPT misconfiguration:\n"); - fprintf(stderr, "\t\tGPA: %#lx\n", ept_misconfig_gpa); - fprintf(stderr, "\t\tPTE(%d): %#lx %#lx %#lx %#lx\n", - ept_misconfig_ptenum, ept_misconfig_pte[0], - ept_misconfig_pte[1], ept_misconfig_pte[2], - ept_misconfig_pte[3]); - } -#endif /* DEBUG_EPT_MISCONFIG */ - return (VMEXIT_ABORT); -} - -static int -vmexit_svm(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun) -{ - struct vm_exit *vme; - - vme = vmrun->vm_exit; - - fprintf(stderr, "vm exit[%d]\n", vcpu_id(vcpu)); - fprintf(stderr, "\treason\t\tSVM\n"); - fprintf(stderr, "\trip\t\t0x%016lx\n", vme->rip); - fprintf(stderr, "\tinst_length\t%d\n", vme->inst_length); - fprintf(stderr, "\texitcode\t%#lx\n", vme->u.svm.exitcode); - fprintf(stderr, "\texitinfo1\t%#lx\n", vme->u.svm.exitinfo1); - fprintf(stderr, "\texitinfo2\t%#lx\n", vme->u.svm.exitinfo2); - return (VMEXIT_ABORT); -} - -static int -vmexit_bogus(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, - struct vm_run *vmrun) -{ - assert(vmrun->vm_exit->inst_length == 0); - - return (VMEXIT_CONTINUE); -} - -static int -vmexit_reqidle(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, - struct vm_run *vmrun) -{ - assert(vmrun->vm_exit->inst_length == 0); - - return (VMEXIT_CONTINUE); -} - -static int -vmexit_hlt(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, - struct vm_run *vmrun __unused) -{ - /* - * Just continue execution with the next instruction. We use - * the HLT VM exit as a way to be friendly with the host - * scheduler. - */ - return (VMEXIT_CONTINUE); -} - -static int -vmexit_pause(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, - struct vm_run *vmrun __unused) -{ - return (VMEXIT_CONTINUE); -} - -static int -vmexit_mtrap(struct vmctx *ctx __unused, struct vcpu *vcpu, - struct vm_run *vmrun) -{ - assert(vmrun->vm_exit->inst_length == 0); - -#ifdef BHYVE_SNAPSHOT - checkpoint_cpu_suspend(vcpu_id(vcpu)); -#endif - gdb_cpu_mtrap(vcpu); -#ifdef BHYVE_SNAPSHOT - checkpoint_cpu_resume(vcpu_id(vcpu)); -#endif - - return (VMEXIT_CONTINUE); -} - -static int -vmexit_inst_emul(struct vmctx *ctx __unused, struct vcpu *vcpu, - struct vm_run *vmrun) -{ - struct vm_exit *vme; - struct vie *vie; - int err, i, cs_d; - enum vm_cpu_mode mode; - - vme = vmrun->vm_exit; - - vie = &vme->u.inst_emul.vie; - if (!vie->decoded) { - /* - * Attempt to decode in userspace as a fallback. This allows - * updating instruction decode in bhyve without rebooting the - * kernel (rapid prototyping), albeit with much slower - * emulation. - */ - vie_restart(vie); - mode = vme->u.inst_emul.paging.cpu_mode; - cs_d = vme->u.inst_emul.cs_d; - if (vmm_decode_instruction(mode, cs_d, vie) != 0) - goto fail; - if (vm_set_register(vcpu, VM_REG_GUEST_RIP, - vme->rip + vie->num_processed) != 0) - goto fail; - } - - err = emulate_mem(vcpu, vme->u.inst_emul.gpa, vie, - &vme->u.inst_emul.paging); - if (err) { - if (err == ESRCH) { - EPRINTLN("Unhandled memory access to 0x%lx\n", - vme->u.inst_emul.gpa); - } - goto fail; - } - - return (VMEXIT_CONTINUE); - -fail: - fprintf(stderr, "Failed to emulate instruction sequence [ "); - for (i = 0; i < vie->num_valid; i++) - fprintf(stderr, "%02x", vie->inst[i]); - FPRINTLN(stderr, " ] at 0x%lx", vme->rip); - return (VMEXIT_ABORT); -} - -static int -vmexit_suspend(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) -{ - struct vm_exit *vme; - enum vm_suspend_how how; - int vcpuid = vcpu_id(vcpu); - - vme = vmrun->vm_exit; - - how = vme->u.suspended.how; - - fbsdrun_deletecpu(vcpuid); - - switch (how) { - case VM_SUSPEND_RESET: - exit(0); - case VM_SUSPEND_POWEROFF: - if (get_config_bool_default("destroy_on_poweroff", false)) - vm_destroy(ctx); - exit(1); - case VM_SUSPEND_HALT: - exit(2); - case VM_SUSPEND_TRIPLEFAULT: - exit(3); - default: - fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how); - exit(100); - } - return (0); /* NOTREACHED */ -} - -static int -vmexit_debug(struct vmctx *ctx __unused, struct vcpu *vcpu, - struct vm_run *vmrun __unused) -{ - -#ifdef BHYVE_SNAPSHOT - checkpoint_cpu_suspend(vcpu_id(vcpu)); -#endif - gdb_cpu_suspend(vcpu); -#ifdef BHYVE_SNAPSHOT - checkpoint_cpu_resume(vcpu_id(vcpu)); -#endif - /* - * XXX-MJ sleep for a short period to avoid chewing up the CPU in the - * window between activation of the vCPU thread and the STARTUP IPI. - */ - usleep(1000); - return (VMEXIT_CONTINUE); -} *** 150 LINES SKIPPED *** From nobody Wed Oct 4 16:54:00 2023 X-Original-To: dev-commits-src-main@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 4S11491hQ0z4wH7S; Wed, 4 Oct 2023 16:54:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S11491GTlz3CXl; Wed, 4 Oct 2023 16:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438441; 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=CcsQH/BNp1kfrGViGh40msPPpI8tDO5/ANMuM0t/VR0=; b=nDvd/KEnrQ+ab9y6ZP5T08VKQxzfDsUji4NPytqLP5NP8cBwLiDzuuhmpcMDHbI5Kn2Z/V sJxEe3mVtMwv2+YN8aC/JD0GcN8mWpZnqjms5WagC8ALCi3rlKxjfn9+jWMYQNjj6bIfVa d6cJXOcxK9mDKKtIc/bCbnN+/zRKKEA+co+eFHpn7k/J7vU4YQmfpM5PExSXNuMA6j4aWv Lna0jV+3lovWtIhx/M2j3Fn/YKwcyzAPGjHdLA//3W4OFWgz6qR20fenfcNuWIwKDXbZRw Nxb3u+RUlhvl/zTMfgySgzeKIumeRlMUNF6cy8ee7RcT5BSms7iXW9pjBOivkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438441; a=rsa-sha256; cv=none; b=UR1fTku+BuowJPWGTgL9n9DiVM5Y071bW4pmv0NvmPxhGL9UZEpHDv+LtjH52NlDNvQ1Ld J8vsgHsdZ5tgqHJBWb5aLwauorDvlERcKnGYNT1gO8qC5gMMlyIDcXNjE4kgnGtDb567gG LSbjNkJNu1rirMA6qyMQDHiusvHU9+TYeaw+k7WDl6e33O+R0Xw1mSBQaOuoPIIXay1RCh rTW8vNKWRPEdUeb1Lvr89371rDhrN6SOjdX+wWh+QZI3YzNQ26wgS3xqKqTwtTB9VYCp8K vuJ1EsNIOCiOrS3YPbPCrXNk4Y4wS3OMYGwXlhnFUGlhvYCtbcCJlBM0vHTRxQ== 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=1696438441; 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=CcsQH/BNp1kfrGViGh40msPPpI8tDO5/ANMuM0t/VR0=; b=ToCt/r7LjYLUxDfIeQpgRodbMJ59Z3RFr1w1/+fN47k0pFce4cwXs+pPhB6ooTp6zoznGm yPJdHAEdnKAoZTRt5jR3HnfUa9zf244fWgYr/xmEPL1TAk9CMt7m2UVw0f8b+3kwl7cD0C PA7SUpXN3lZphYurKsmi6FNvYwdXsFyshzpuWLOOOEudTaQQfMtUQ8wfK3jxGmA+SV36xq IAdyHJZHfjGFYCZymEg87Ba5gDgVYbT0mhkJHbGbV42HhkgC+NWrWPZhjyYyU85NyUkjYj 7E7oDkFDwlV2c8/QDf0s0aziyRZLKVOJiML+nrU1ZqO+pjIVC2TVxiusDMnZPQ== 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 4S11490Kjhzl1F; Wed, 4 Oct 2023 16:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs0QA037696; Wed, 4 Oct 2023 16:54:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs0QE037693; Wed, 4 Oct 2023 16:54:00 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:00 GMT Message-Id: <202310041654.394Gs0QE037693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 145ffd5db770 - main - bhyve: Remove some unneeded includes from snapshot.c List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 145ffd5db770669339fb73d242950f76d369de1b Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=145ffd5db770669339fb73d242950f76d369de1b commit 145ffd5db770669339fb73d242950f76d369de1b Author: Mark Johnston AuthorDate: 2023-10-04 16:23:07 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Remove some unneeded includes from snapshot.c MFC after: 1 week Sponsored by: Innovate UK --- usr.sbin/bhyve/snapshot.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 2daef0ef74f0..86c76e679e53 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -44,8 +44,6 @@ #include #include -#include - #ifndef WITHOUT_CAPSICUM #include #endif @@ -79,19 +77,10 @@ #include "amd64/atkbdc.h" #endif #include "debug.h" -#include "inout.h" #include "ipc.h" -#include "ioapic.h" #include "mem.h" -#include "mevent.h" #include "pci_emul.h" -#include "pci_irq.h" -#include "pci_lpc.h" -#include "smbiostbl.h" #include "snapshot.h" -#include "xmsr.h" -#include "spinup_ap.h" -#include "rtc.h" #include #include From nobody Wed Oct 4 16:54:02 2023 X-Original-To: dev-commits-src-main@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 4S114B4ZXFz4wGhY; Wed, 4 Oct 2023 16:54: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114B2QJCz3Ch9; Wed, 4 Oct 2023 16:54:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438442; 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=JmGeLN1JWdNURZKZXvzN7XdZN/YGrN8MlMyMoO29hck=; b=FJS/zteUXd9fNHQpBZLZfAoN8Qf/dj5tOl6W7n4tExeWKas+dQIatBMlDULrbGLydOIBuD q7+CtHDvv9Ye9NH6HRVz+wHLe5a/cY7hjsIhPJbAvQ5AAfBbMQRlxfpFnJmi8J8ViDe2xc EACBTpXgMhhzeo8iMNCyawRNm7D6jPeR5oodSlp5s0DPz0wy+7Ol2Xr8MjJZ73Cm6lX1Gk 6WtAjb0YRdn8SBkxfIDyNDlgVGzHfd41bV53z4AAmW2+VCCHhDuv3kfQ/5xB0e6rgTZNZy Rs6mkfux0reZLSTi0vUbqz/ti5rB+WJZFnoRGW9WsEZFjBSQbWICu+5wtcByig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438442; a=rsa-sha256; cv=none; b=Y9zyFZCxLQXxIfh9N3hgYQh+vxTpfBDtHRmgBUCP4LiqR1jsMPCYEbOVDMFhaR/RSG8lY4 3YA7lTyOGf46Je5nwfPZmVA6uU2g1q48r5FzmHVQSsVuYR6U1/1y0LoPbK5I2ll+0qRks2 mXfxeFbFtEYrV7Fq2+Or/jJjU2Ao/bH7vLfUMvXMYBHzd5mrSX4BQoMOTdl9CSL5Hbjgnh Ux5CdtDs3ITqIndKwAqXgtmUvRFqAunjNbIOWULOeexc2SY2jCWEeJ+kK0S+xMVk4kpbWw gywFaAJ+INghPtnZx4Ye12atbas9Aapw3lK50xsiKwHqgpTh8tWaVEtt3JYsaQ== 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=1696438442; 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=JmGeLN1JWdNURZKZXvzN7XdZN/YGrN8MlMyMoO29hck=; b=aDGiAY4lGekdsBYElWBhwSnMKV95lwNv+muOyqKpEl53yDnKHXEylIxIUk6O9W+ZjCoLK4 Qe97k76KAfcdr0g0CWefJA9ezzqNfwuczh0DAgcdtHY52gdtRWpQksd/37RnWpPWLHWWwr IA58NaBiullnrZrYRsbFbsD8HiZkG159pWXEpppdqJAXo3Crh1kImWOzJncEw4LY7Fj9RX vGZnDfvHrXS+QOs0IQCHgJDA12ufm2fJlw2HHHFfo135DKkQ5XRyOUGMu7U9zH0OsMYN1v c5hote8DtIHQR+wFX/mA0anNIsStVZwlPKAa/P0J3Nu/qYRgdD9n+NtTOeGLXg== 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 4S114B1WWxzlm0; Wed, 4 Oct 2023 16:54:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs2Pr037748; Wed, 4 Oct 2023 16:54:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs23j037745; Wed, 4 Oct 2023 16:54:02 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:02 GMT Message-Id: <202310041654.394Gs23j037745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 548b11228f7a - main - bhyve: Move MSR emulation into amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 548b11228f7a83785dcf6c4c8b0bbfed0284d794 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=548b11228f7a83785dcf6c4c8b0bbfed0284d794 commit 548b11228f7a83785dcf6c4c8b0bbfed0284d794 Author: Mark Johnston AuthorDate: 2023-10-04 16:23:22 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Move MSR emulation into amd64/ No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40733 --- usr.sbin/bhyve/Makefile | 3 +-- usr.sbin/bhyve/amd64/Makefile.inc | 3 ++- usr.sbin/bhyve/{ => amd64}/xmsr.c | 0 usr.sbin/bhyve/{ => amd64}/xmsr.h | 0 usr.sbin/bhyve/bhyverun.c | 6 +++++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 5f13d457d914..30ecf56ae748 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -76,8 +76,7 @@ SRCS= \ vga.c \ virtio.c \ vmexit.c \ - vmgenc.c \ - xmsr.c + vmgenc.c .if ${MK_BHYVE_SNAPSHOT} != "no" SRCS+= snapshot.c diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 6843cec4919f..d655708210ce 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -7,7 +7,8 @@ SRCS+= \ post.c \ ps2kbd.c \ ps2mouse.c \ - task_switch.c + task_switch.c \ + xmsr.c .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c diff --git a/usr.sbin/bhyve/xmsr.c b/usr.sbin/bhyve/amd64/xmsr.c similarity index 100% rename from usr.sbin/bhyve/xmsr.c rename to usr.sbin/bhyve/amd64/xmsr.c diff --git a/usr.sbin/bhyve/xmsr.h b/usr.sbin/bhyve/amd64/xmsr.h similarity index 100% rename from usr.sbin/bhyve/xmsr.h rename to usr.sbin/bhyve/amd64/xmsr.h diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 1cf7fc5bcc24..727a47892e41 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -106,7 +106,9 @@ #include "rtc.h" #include "vmgenc.h" #include "vmexit.h" -#include "xmsr.h" +#ifdef __amd64__ +#include "amd64/xmsr.h" +#endif #define MB (1024UL * 1024) #define GB (1024UL * MB) @@ -1015,11 +1017,13 @@ main(int argc, char *argv[]) exit(4); } +#ifdef __amd64__ error = init_msr(); if (error) { fprintf(stderr, "init_msr error %d", error); exit(4); } +#endif init_mem(guest_ncpus); init_inout(); From nobody Wed Oct 4 16:54:03 2023 X-Original-To: dev-commits-src-main@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 4S114C4JCfz4wH2k; Wed, 4 Oct 2023 16:54:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114C39Cmz3CdH; Wed, 4 Oct 2023 16:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438443; 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=1n+zJlqyVtdzr0tHUmmM5KRvHYQkmaSeYR2y5MClDXg=; b=mJHfEZCc/zzoNl49Z9vLXto1RT+TcRjkhuXAZeER8KiNxgpuoeJeYSj7q7V2DVgMyFKMyg BO3hEGQSlzU7hP5RDZ4U5E03Jly6N5Oz6N10juFFzuOCUHkPsvB7it1AV0UPSGgYFq20Yk rvosNehp1E87wZboP84D/szAbfpACKWbsUWHdSySlnZX3qGIb8sgRFjTSHclR9Zt29j5Kp +r4vXXotg/jUzL9+nH4F08sEAPIi4iXHxef4ISFuZTKeLPt2/UDPuSH74f9mOet5eqfu5N MaBP+Sr4YKjaA+jxIVbJ+AwIQFOCKefOOGY/96cxZMOBjEEUBA0pWE4JpZVI2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438443; a=rsa-sha256; cv=none; b=uh/zuXV6NBBfu77y18xDlWxztECP1QLwFfSbjDh6Ox205QZ/Rl4CUZ/zQc/w+x/wRSwCgm 05WNFd4mQjLND/kiEckD0THt5rVFwYLuse1fhdUlv+gYXVwVYTrs51OH+pOhHg3LKvSmoI uxfAOeV9b6rqpVO5z98VgfawRbY9NZXwKa2j3y8ZzAgF75tr7FOj6sE6Uc38AEwA2er6tL 9ILxfVcnXnfAfzxVZkF7L/9hERRcP3LPCkNyUeaYdPrhdQ79McnurJ/YvXDtBWqENDtqQS UDdKd7K5v1UxM3T4pE3viG3ad/3/fxOoOIOlMChVtZQ4qA+WtN1NcEDn3jk0GA== 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=1696438443; 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=1n+zJlqyVtdzr0tHUmmM5KRvHYQkmaSeYR2y5MClDXg=; b=n99FG2TRmCv3cyQpl0/x71Pl0jDmJHFVo0ciGIgwkEpwHoO7fbI/y1c3SVvw4Pu4qWPmR/ JqV/1uGG+HBG4JTIFe1re+9kzAaOCRgnsamPY3OQKbzFetieJjLhHfMig4wDqKXFBBXLWF Ng2YpsTOhUJ6WBiGQUoNUBU40D/tec+crLAmS523lbY1/7vT4fT6Rw8c5bF5tjMoefilZ+ x+6DtDmIB3LcoDFlssKg3IkBzE4H9aqFhSZdFdxQEBb+w8Kl+6/ofCsR7RyxLT47LdnBip ypRrON3MB5TrfgqxxYYmEUqiynFtbdYxRdjUHMiEMVZrJKY9TlxgTZlWQXGY+g== 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 4S114C2GMGzlRW; Wed, 4 Oct 2023 16:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs3oE037796; Wed, 4 Oct 2023 16:54:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs3EA037793; Wed, 4 Oct 2023 16:54:03 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:03 GMT Message-Id: <202310041654.394Gs3EA037793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a7f6c2ff732d - main - bhyve: Move the RTC driver to amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7f6c2ff732db1d0032066109ee0dd5af1a39b81 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a7f6c2ff732db1d0032066109ee0dd5af1a39b81 commit a7f6c2ff732db1d0032066109ee0dd5af1a39b81 Author: Mark Johnston AuthorDate: 2023-10-04 16:23:36 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Move the RTC driver to amd64/ No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40734 --- usr.sbin/bhyve/Makefile | 1 - usr.sbin/bhyve/amd64/Makefile.inc | 1 + usr.sbin/bhyve/{ => amd64}/rtc.c | 0 usr.sbin/bhyve/{ => amd64}/rtc.h | 0 usr.sbin/bhyve/bhyverun.c | 8 +++++++- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 30ecf56ae748..ef78b149c68c 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -62,7 +62,6 @@ SRCS= \ qemu_fwcfg.c \ qemu_loader.c \ rfb.c \ - rtc.c \ smbiostbl.c \ sockstream.c \ spinup_ap.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index d655708210ce..a18b98a157ec 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -7,6 +7,7 @@ SRCS+= \ post.c \ ps2kbd.c \ ps2mouse.c \ + rtc.c \ task_switch.c \ xmsr.c diff --git a/usr.sbin/bhyve/rtc.c b/usr.sbin/bhyve/amd64/rtc.c similarity index 100% rename from usr.sbin/bhyve/rtc.c rename to usr.sbin/bhyve/amd64/rtc.c diff --git a/usr.sbin/bhyve/rtc.h b/usr.sbin/bhyve/amd64/rtc.h similarity index 100% rename from usr.sbin/bhyve/rtc.h rename to usr.sbin/bhyve/amd64/rtc.h diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 727a47892e41..7716ea119dd6 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -103,7 +103,9 @@ #include "snapshot.h" #endif #include "tpm_device.h" -#include "rtc.h" +#ifdef __amd64__ +#include "amd64/rtc.h" +#endif #include "vmgenc.h" #include "vmexit.h" #ifdef __amd64__ @@ -903,9 +905,11 @@ main(int argc, char *argv[]) case 'e': set_config_bool("x86.strictio", true); break; +#ifdef __amd64__ case 'u': set_config_bool("rtc.use_localtime", false); break; +#endif case 'U': set_config_value("uuid", optarg); break; @@ -1037,7 +1041,9 @@ main(int argc, char *argv[]) pci_irq_init(ctx); ioapic_init(ctx); +#ifdef __amd64__ rtc_init(ctx); +#endif sci_init(ctx); if (qemu_fwcfg_init(ctx) != 0) { From nobody Wed Oct 4 16:54:04 2023 X-Original-To: dev-commits-src-main@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 4S114D5ZmDz4wH01; Wed, 4 Oct 2023 16:54:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114D4QdZz3CkF; Wed, 4 Oct 2023 16:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438444; 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=akLxv1hxKT+WjvYFB/eR57iPyEwAtm5p6jXmRvj0oms=; b=JQyzAp2lDS39Ya3TWzwcwMII3n3pSV/BrVGpWzaq879Rz1+HD4Z9EWOMDmR4dNyTnMV7dF ZqxMsZELRy/C40WkdZhHItVBumJH6ZywNm6wBHLcuexeAVfzmz/0ehmSrZPdMwaFDyXP7f VdUNXvxWfwYBYSwBmkrfYbGW1xm46ptYFaK540qz8xom8aDbl5kPVd0FpFshzMzlxzYfma NPkO6WcPQhxJGGu5uO3Q0vEPqIWBZ3Vh13Mdc9me6lb94l+AoDEQAOMs8wfri2qfMwZHeN MVjfIaMg3J5bG1LLoLMjfrfxp+qzx1lGcIw84Kd890AacQxkWb49KF3tKHojUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438444; a=rsa-sha256; cv=none; b=J5LSw/3geD7kEhG8Zp7RL0q9w0K85ebZn7RUnjVci0PhrzwMxrjiv4FQEa+tUjoOcSphgQ sPazNRk0XN3sDc25jVc0oQ5Bu2+k0Uaen1ToukmHZdqtzGenwfdZdaeHwpzUo8F3mxy44J f4QsiwHmBN48zN1LWYl1RO1GQdda6+oSaZ4WWSWAmiFMOsGk6GCfHB2KWNY3WC3J5ig73/ UJ938HBDDiFrPmXxCVe2WlCmbaDJLB6nqvJa+IVK+4ANSHg6qeqM4iHAMJKNLChmvqYlZf ySRJj/viwkR77eD2WaH3XZ0ejgNychFUZcuPnaiIBQ0NOnAtWT3J5OdlgzubHQ== 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=1696438444; 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=akLxv1hxKT+WjvYFB/eR57iPyEwAtm5p6jXmRvj0oms=; b=Kj9MGIlBA4P5j0zRs9Z3SQJsHZuDIiDgTDLDx5Gy2ujqHe533U4rMPNadPUPNSAoCHiIVq xeiOiu/DAlpVa5bPOl7IiocmpGXkhAd4pORKQfq8JMWzAPhRMUm782I7udlO+fKTRbJptO XduCNRVwlksGbXOV07a1x+p0JCOFOsWAOLhUMmV7vUoIRTnTpoykfF1F5vU2FJE3KtopGe FDjaYELMEtNZYojgB/vk+xMidWY0G6EEn8s8GOtEJ0/bF/hANPaifikPTbHeryQmZLJAvP TYAKxsWTqYg/v+7cSGFisrrnzD9MrL/RIAYDVAGS4dxCdqYXv3phQbcDbQAuJg== 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 4S114D3Wcgzljj; Wed, 4 Oct 2023 16:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs451037845; Wed, 4 Oct 2023 16:54:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs4Sd037842; Wed, 4 Oct 2023 16:54:04 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:04 GMT Message-Id: <202310041654.394Gs4Sd037842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 75d1e855b0a2 - main - bhyve: Move power management code to amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 75d1e855b0a2acfb60e5a3c81b018d8f73ebf450 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=75d1e855b0a2acfb60e5a3c81b018d8f73ebf450 commit 75d1e855b0a2acfb60e5a3c81b018d8f73ebf450 Author: Mark Johnston AuthorDate: 2023-10-04 16:23:50 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Move power management code to amd64/ This implements various x86-specific interfaces. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40735 --- usr.sbin/bhyve/Makefile | 1 - usr.sbin/bhyve/amd64/Makefile.inc | 1 + usr.sbin/bhyve/{ => amd64}/pm.c | 0 usr.sbin/bhyve/bhyverun.c | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index ef78b149c68c..7c14dbc4a524 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -58,7 +58,6 @@ SRCS= \ pci_virtio_scsi.c \ pci_xhci.c \ pctestdev.c \ - pm.c \ qemu_fwcfg.c \ qemu_loader.c \ rfb.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index a18b98a157ec..a176b0e5471f 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -4,6 +4,7 @@ SRCS+= \ fwctl.c \ kernemu_dev.c \ mptbl.c \ + pm.c \ post.c \ ps2kbd.c \ ps2mouse.c \ diff --git a/usr.sbin/bhyve/pm.c b/usr.sbin/bhyve/amd64/pm.c similarity index 100% rename from usr.sbin/bhyve/pm.c rename to usr.sbin/bhyve/amd64/pm.c diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 7716ea119dd6..c27cb427f1e2 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1043,8 +1043,8 @@ main(int argc, char *argv[]) #ifdef __amd64__ rtc_init(ctx); -#endif sci_init(ctx); +#endif if (qemu_fwcfg_init(ctx) != 0) { fprintf(stderr, "qemu fwcfg initialization error"); From nobody Wed Oct 4 16:54:05 2023 X-Original-To: dev-commits-src-main@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 4S114F5mv0z4wGhh; Wed, 4 Oct 2023 16:54:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114F558Yz3D5g; Wed, 4 Oct 2023 16:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438445; 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=MbNA8Q3znPyNQ4NIAYJj9O/tigpKs7jCinQhHMrg7bs=; b=hkq0dKntcC/SwzwEgz0gviujysQRY9eUBJsoiWu2HcFroppwgj2mlYBTxaZ/veDXa5/uR9 xgVgMcVwYW7Tnr1JCV7m2vmsJ6Dv3iTd0Sz12WyL/XNqC+KTF4xKMnOyMAT1Fs/zCf01gd 0InMf224lBlpUwmOGbvmOZb0lqpXwzd5rSfxPIsVKTdk45h/5S6jLDh39HsQQ29P7woXwj 7/RUPFqBPy3AtGv/t8WbkUiY3BxCx2CiG+pkbd2Kw1ALjl2BOjrwmzW/O97UNqw4sw/aQ8 KE74FK4TJTmrxzanHrgcILbU92qnz4cA2kG7A5Gjj+TkwKiYW6XnpBhzrnTIuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438445; a=rsa-sha256; cv=none; b=yFJr12wlVUmnNPdv9nPh/+fhHyct9qF+ISnZofGdh3bGpaUGajSkx7j67dqZ6FirTMdZdB iPG/QnjfUs4sJuMhpmIa7tCwDeJ1ZJF2XU4e9LgBKYphH9sJNCZEZA03O7EUVCEu0LUVJz S6anpc6ZUNH0oX3YCikfvoiNhboQ78Y9eyOfWtdab9fAL37oLhdChf0PlX1QNllmexcwuy MSlL1XGuzXb742MmmI4ADnx8SOTmWVLo131ELO6jIkmS8LmGFDtxxQvhnbDF537wS+jj2Z KsVebe6pE+YHL+2LalD6wS0y2rVmBZT6w0yJCyJEjzQyGcmME2Ub5h7CUGt3hQ== 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=1696438445; 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=MbNA8Q3znPyNQ4NIAYJj9O/tigpKs7jCinQhHMrg7bs=; b=LBeAT2jqdL8Yss8reFJvZZCUejzzsfUEei2KHFtr/TtoVsq73ZIjE919+4dH2UmRQU19RG Lre5b2MTB59dDmTSm3o5T8shtdEcyNoYLeI7USt4UV0yFkecLN8Q8G/hjHpDkCseTCXNDJ mfotPU23pfNeT6wLIrH8AhrWBwTEwSmICfdUoSBMOGbxlZo7mQ2O6rrKO3LuqFdmyutO9P v4QWazmMbJy6NLW13xPqxn0AZ8m2w3t9Cemh9iISAFlRQQKOth6WydnRe7VEHquhZiF7vv hf1lJfEnz1Zp876kjPIME+675hiigmmD2PfALFFqX7EY4pMqPjJSHbIsDjLPzw== 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 4S114F4BQNzm2y; Wed, 4 Oct 2023 16:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs5hX037895; Wed, 4 Oct 2023 16:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs5bU037892; Wed, 4 Oct 2023 16:54:05 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:05 GMT Message-Id: <202310041654.394Gs5bU037892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4ab7aea8ec2f - main - bhyve: Move the gvt-d driver to amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ab7aea8ec2f5fac0e6d140300c8f04db99d83df Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4ab7aea8ec2f5fac0e6d140300c8f04db99d83df commit 4ab7aea8ec2f5fac0e6d140300c8f04db99d83df Author: Mark Johnston AuthorDate: 2023-10-04 16:24:04 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:16 +0000 bhyve: Move the gvt-d driver to amd64/ It is amd64-only. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40736 --- usr.sbin/bhyve/Makefile | 1 - usr.sbin/bhyve/amd64/Makefile.inc | 1 + usr.sbin/bhyve/{ => amd64}/pci_gvt-d-opregion.h | 0 usr.sbin/bhyve/{ => amd64}/pci_gvt-d.c | 0 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 7c14dbc4a524..d510c32fccd0 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -41,7 +41,6 @@ SRCS= \ pci_e82545.c \ pci_emul.c \ pci_fbuf.c \ - pci_gvt-d.c \ pci_hda.c \ pci_hostbridge.c \ pci_irq.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index a176b0e5471f..5caecb35a620 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -4,6 +4,7 @@ SRCS+= \ fwctl.c \ kernemu_dev.c \ mptbl.c \ + pci_gvt-d.c \ pm.c \ post.c \ ps2kbd.c \ diff --git a/usr.sbin/bhyve/pci_gvt-d-opregion.h b/usr.sbin/bhyve/amd64/pci_gvt-d-opregion.h similarity index 100% rename from usr.sbin/bhyve/pci_gvt-d-opregion.h rename to usr.sbin/bhyve/amd64/pci_gvt-d-opregion.h diff --git a/usr.sbin/bhyve/pci_gvt-d.c b/usr.sbin/bhyve/amd64/pci_gvt-d.c similarity index 100% rename from usr.sbin/bhyve/pci_gvt-d.c rename to usr.sbin/bhyve/amd64/pci_gvt-d.c From nobody Wed Oct 4 16:54:06 2023 X-Original-To: dev-commits-src-main@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 4S114H1YF8z4wGlM; Wed, 4 Oct 2023 16:54:07 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114G67TMz3D1h; Wed, 4 Oct 2023 16:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438446; 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=f3KmWW76Ddw/hcAWBRSra/OgpA7JTO9RZQueCZe4aMU=; b=mi5OuKyDbRQnwKue398/32zHk+SDdEUd8Md1e6AEcTYlDwVD1m66NLKW+XHkhjSH41BFsC 3N4+oI+2yDATj4gvQ5SKGppXUA6geiB35O4i2w1aVNCeQLyOAkqbA9f5ztZPx5XYG9nwH0 Gt8yyTvlVAFbo1mbNmw402iIKRaIzeVHY7B0FR2yctZX3XmrN1C5cz374by8DzBrQDBEsG jF0cp+b8XUCQQTh/hjRmAiTxHdp5ju6OJigcn5j83SvTZOgIytX45uWy3cJ6QXOfOoTzEc xkbojaPdwkNzmxk22kJ8Zjx4ZcG2DOLn26jk56CSPMbcxB9YIWqXD4ZGBDAdTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438446; a=rsa-sha256; cv=none; b=XXJkrwSnF7OF9pJIJx/Bmp7ATpapBbKgG1OZOdqmwLBD1XSVRA6Ij4+PEXLqLo1mmgmW+I jMRVr0Q67iC72cKCjtN/QYKQEHbYCLmlNVJU0k0LMCZgFoggcmioXnkMvOep3oDSN9or59 o1d+Dcjy6wlo7VZT2pBRzrPQZFQuLX45H5gTmM7fb3lNB1QpC4FJK7YC0Qh+tlQYnAQasa FCW/0PnxtgFqm3bIFDQHMSVrIMxRKgCS4ttJM0kyLQoLFiAyQJbewYwajZTBgp3bnZkMnu 0YXSAWUD9ct4XDAYqFPNwipw+YnKFYHAZD4CQB1JjEGXnwQBrsmGAXkeuFTafA== 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=1696438446; 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=f3KmWW76Ddw/hcAWBRSra/OgpA7JTO9RZQueCZe4aMU=; b=vJ99MS8jjmCpXU3nAfGVz2eWJlUxMKj5lrhIUrCXQyinXgU+KR2ox1s9lc+vbyZLQijUg2 4tszHGTHmGEhpCTnowvySsIrwCA725iIKZh4eRQiGMq47ld2mKQJ38SHkuytPiQY+Ak/Ws RR3zo72TX+iSedKdiEFADhd4jo2jNDrRRN4Pr7zZtA53R+UPCHn8w4j0SJmWVSvFIsG08L okhCKl3nBduUkMOJDBaGHaEtk8cBtLu0gLFkTExph+buEqYs6g8q0of9ARXXqAVgypXxf7 6IzE4fLWGrO8EbOrmoaFTYpnLLdTUHGrUKCx9BQUvnQH7GV0tbjwFy+t6IjW6g== 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 4S114G5DL0zm0T; Wed, 4 Oct 2023 16:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs6wg037947; Wed, 4 Oct 2023 16:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs6v9037944; Wed, 4 Oct 2023 16:54:06 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:06 GMT Message-Id: <202310041654.394Gs6v9037944@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c7c5d3e3888a - main - bhyve: Move AP startup code to amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7c5d3e3888aa9018297794285dcd884e6182bd5 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c7c5d3e3888aa9018297794285dcd884e6182bd5 commit c7c5d3e3888aa9018297794285dcd884e6182bd5 Author: Mark Johnston AuthorDate: 2023-10-04 16:24:19 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Move AP startup code to amd64/ This code is only invoked via MD vmexit handlers. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40737 --- usr.sbin/bhyve/Makefile | 1 - usr.sbin/bhyve/amd64/Makefile.inc | 1 + usr.sbin/bhyve/{ => amd64}/spinup_ap.c | 0 usr.sbin/bhyve/{ => amd64}/spinup_ap.h | 0 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index d510c32fccd0..f6db03a3358b 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -62,7 +62,6 @@ SRCS= \ rfb.c \ smbiostbl.c \ sockstream.c \ - spinup_ap.c \ tpm_device.c \ tpm_emul_passthru.c \ tpm_intf_crb.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 5caecb35a620..824f12861923 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -10,6 +10,7 @@ SRCS+= \ ps2kbd.c \ ps2mouse.c \ rtc.c \ + spinup_ap.c \ task_switch.c \ xmsr.c diff --git a/usr.sbin/bhyve/spinup_ap.c b/usr.sbin/bhyve/amd64/spinup_ap.c similarity index 100% rename from usr.sbin/bhyve/spinup_ap.c rename to usr.sbin/bhyve/amd64/spinup_ap.c diff --git a/usr.sbin/bhyve/spinup_ap.h b/usr.sbin/bhyve/amd64/spinup_ap.h similarity index 100% rename from usr.sbin/bhyve/spinup_ap.h rename to usr.sbin/bhyve/amd64/spinup_ap.h From nobody Wed Oct 4 16:54:07 2023 X-Original-To: dev-commits-src-main@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 4S114J1db5z4wH9G; Wed, 4 Oct 2023 16:54:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114J08qQz3D6S; Wed, 4 Oct 2023 16:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438448; 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=eHaqTRmXknmJmeaWyM2fwBrhJOla/fLasrOnX74CYVA=; b=vDlKcqdqlTT0+HxjxwdufnpeDD+yFo70owsmVNarqYCg8lXnX/LX1nejYxu4rzXlaX7nQi wLcxQfjiIhSp7Jsl6znazoJmWuHrglEQH5QEL297VoVs7vGTUU/L8NUcEjBLjwpEVgUM1Z JDCk+zSnJPO/PJmJiBBTxx9xSqTYQDwDaz/5uVbmzvLIxqQdWdX7/1i5fxqkosazFzeT+W 2xxLChAVv0ZjKwmOz9O29wBbHVpDEpznNlF4pOz5yQVNRutW4iGgmDLvsWyBRqxFsEaw3M ziL6eoAdS1gEjqEsxd3EMrV12Om+Dh3j7s2bPun/rwdfIdqjxk6L2c+Jckee6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438448; a=rsa-sha256; cv=none; b=aPxzKagGujSKTv8GxcTqEfCTFd0iozbCqa+z+4OLX1FhNfTHm8Z5dTtRcJEi3KIagQ8JH6 +SLTN5AcQ2sH3jpxck7Ap27XpUolYkPCwXj8SwyFdQBelfZyQSGji6MraofcBX9KszeVe5 5XZ+OX2vkyFkFAd4JUwj23o6XEA43P84hChhV86DbQbmthdzCDeGHZJ28AMMX70DMtVRFL 5z10AuXgyUZDpNl/MejpXwohG4j5dBhPYyt+aHio2Sz8IbOe36VLtnnwZKNHQmL8P5k50k JWJC2uSKvZtGl8hWqOr1Kfpjas1bioYi+n2yCTMSbMM/cFsWWgOO9e3rkiZZ6w== 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=1696438448; 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=eHaqTRmXknmJmeaWyM2fwBrhJOla/fLasrOnX74CYVA=; b=fh552SJ5a8lX2+1Dh+9rZVJgChN2BVGJhPH7o9lyd3nFS7GNpK3VNlfuyglx8NzCUoQFxg Jo4IYx/4eVqNrwrtErc2D+gtNkqnJbE9Mm2wbfnVmMInSCewognsfP/L8ZKUmKGqmDy1Bv rQs272FN8s5ic5V8Aotzxm4EY+a7rZICIpt9h5Syt4yHoyfS3iGozBNlBHw0su9kUt5Bq+ 0v6kq6u6Oc9wrMQ8nwXjsPTK8HMNM6I1CbS13bBDFJELk4gjZKp1dzd/hiPR4eZF/a/fmf tt1q3ZyvdCuarEcy8qTj6SVRpsTAUYdu6iFQP/oOo1UdbJeor4g/f1SmP2RERw== 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 4S114H6NK5zlRX; Wed, 4 Oct 2023 16:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs7rb037998; Wed, 4 Oct 2023 16:54:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs7kP037995; Wed, 4 Oct 2023 16:54:07 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:07 GMT Message-Id: <202310041654.394Gs7kP037995@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 71cc76e8d78e - main - bhyve: Compile some device models only on amd64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71cc76e8d78eba4f6ff158c1d163af573a52580e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=71cc76e8d78eba4f6ff158c1d163af573a52580e commit 71cc76e8d78eba4f6ff158c1d163af573a52580e Author: Mark Johnston AuthorDate: 2023-10-04 16:24:57 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Compile some device models only on amd64 These models register legacy PCI interrupts, which won't be supported in the arm64 port. In principle it should be possible to make these models work on arm64 with a bit of effort, so don't move the sources to the amd64 subdirectory. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40738 --- usr.sbin/bhyve/Makefile | 6 ------ usr.sbin/bhyve/amd64/Makefile.inc | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index f6db03a3358b..0ec6ad73e2a2 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -37,17 +37,13 @@ SRCS= \ mevent.c \ net_backends.c \ net_utils.c \ - pci_ahci.c \ - pci_e82545.c \ pci_emul.c \ pci_fbuf.c \ - pci_hda.c \ pci_hostbridge.c \ pci_irq.c \ pci_lpc.c \ pci_nvme.c \ pci_passthru.c \ - pci_uart.c \ pci_virtio_9p.c \ pci_virtio_block.c \ pci_virtio_console.c \ @@ -55,8 +51,6 @@ SRCS= \ pci_virtio_net.c \ pci_virtio_rnd.c \ pci_virtio_scsi.c \ - pci_xhci.c \ - pctestdev.c \ qemu_fwcfg.c \ qemu_loader.c \ rfb.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 824f12861923..862aeddb16e0 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -4,7 +4,13 @@ SRCS+= \ fwctl.c \ kernemu_dev.c \ mptbl.c \ + pci_ahci.c \ + pci_e82545.c \ pci_gvt-d.c \ + pci_hda.c \ + pci_uart.c \ + pci_xhci.c \ + pctestdev.c \ pm.c \ post.c \ ps2kbd.c \ From nobody Wed Oct 4 16:54:08 2023 X-Original-To: dev-commits-src-main@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 4S114K1ygkz4wH5Y; Wed, 4 Oct 2023 16:54:09 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114K1Smbz3DFg; Wed, 4 Oct 2023 16:54:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438449; 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=j6LQnzwNui0Qan6v23YdzsUmbKLjD3LQ3l7StMEMZjo=; b=X5779RTaZrIao2+P2fQKzA6xPydHYCpGLGuEN9Bpa3VbkiqTSFe5sbCw1tGPU6nsHSJiux Ov087uNEhz7dM91W34QyP0QroxdVXGVjFxbHlyySbTT7AAP1jSaqHAix4DZy2khab+8h52 Dfyz0IFtmXWheouf+zxAndWCnfO9rvzlydgx0qBpVWYayvwEVpEYAzc1B0L/ky7PeM3T0A 06XqSY/v0+pzXA8vjY1OARZmyPCsO9qyqpypLCFPCt7vFC/p7j05LY1Cl6+4AtpSc6Ps1x qGX9bqleRxHPQMpXTfYcyU+1kx0Kmo7CzKVZozSYgE3Ev7zv0Pr9lWBFA0Ok2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438449; a=rsa-sha256; cv=none; b=RWHSXZLbSPQwLrym+dNjNjPElWDtDF9p7S/s51mVsdoprcDLW4R4rBi0dEtbzSZkoJHdQz 4CqEIYGBhMOKb0s7LFuajLjdrvQ/gdClr1BadNstevZt6nlkntYzUwisaSj105cZEn/9Oj 9mrw5E6WeUvPrgfSslPYTfEV0Jv4mGIpOpPb4y4qPjURwvo7CkjYX0OjB5+dgLkcRlMSAc /9tz2HNNZx3ddwJ3C8Ut19y0L2p335xxOpgZ6QyuyuP2CXGrFVtjHY56TUlFXdqQQP/jyp 8aVvzjQwqBIlUFqZM7YZioNdolBbmAmfA4jwpbkYUsBnHd45/JVjCrgW9x/MKQ== 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=1696438449; 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=j6LQnzwNui0Qan6v23YdzsUmbKLjD3LQ3l7StMEMZjo=; b=OTY/Ku4kTCnl9Ja6naKmL6NZLhRGKArpcISut+X7MHCli27xiO0k6iy2iMF49rhI71TyuU oHL+xf8NvqvZqol6Wz6IGq3tEAI4Lp1At56guvK6dIqSE5vDz8RZ95Rsb5+q2AcFNk8C+J zdMnw4PfxknWeTbbNczvYv0gOsYz1FgDV97RqH1OyUgpWBBhGNO4oUfHoIqeynm9HsgMCE AF6ps953PegqsiKK7XOWagmQy7MTc0qWtCzChHnW3rjN4Z6X6PuFpCp1fyYr5xExZI/ThI p47xe2IerTH4sh65OUoLIlK5ItC/RMiN+z2oi0nW59scc5jZEaQvq1XUqXNzKQ== 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 4S114K0G41zlWr; Wed, 4 Oct 2023 16:54:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394Gs8Hl038052; Wed, 4 Oct 2023 16:54:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Gs8wh038049; Wed, 4 Oct 2023 16:54:08 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:08 GMT Message-Id: <202310041654.394Gs8wh038049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 55c13f6e7a41 - main - bhyve: Move legacy PCI interrupt handling under amd64/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55c13f6e7a412cc4bd0ea3fc183cd7c5c2348f01 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=55c13f6e7a412cc4bd0ea3fc183cd7c5c2348f01 commit 55c13f6e7a412cc4bd0ea3fc183cd7c5c2348f01 Author: Mark Johnston AuthorDate: 2023-10-04 16:25:19 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Move legacy PCI interrupt handling under amd64/ Specifically, move IO-APIC, LPC and PIRQ routing code under amd64/. Use ifdefs to conditionally compile related code in other files. In particular, legacy PCI interrupt handling is now compiled only on amd64. This is not too invasive, but suggestions for a more modular approach would be appreciated. I am not sure why qemu fwcfg handling is tied to LPC, and I suspect it should be decoupled. In this commit I just apply an ifdef hammer, but we will eventually want fwcfg on arm64 as well. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40739 --- usr.sbin/bhyve/Makefile | 3 --- usr.sbin/bhyve/amd64/Makefile.inc | 3 +++ usr.sbin/bhyve/{ => amd64}/ioapic.c | 0 usr.sbin/bhyve/{ => amd64}/ioapic.h | 0 usr.sbin/bhyve/{ => amd64}/pci_irq.c | 0 usr.sbin/bhyve/{ => amd64}/pci_irq.h | 0 usr.sbin/bhyve/{ => amd64}/pci_lpc.c | 0 usr.sbin/bhyve/{ => amd64}/pci_lpc.h | 0 usr.sbin/bhyve/bhyverun.c | 16 ++++++++++++---- usr.sbin/bhyve/pci_emul.c | 36 +++++++++++++++++++++++++++++------- usr.sbin/bhyve/pci_emul.h | 27 +++++++++++++++------------ usr.sbin/bhyve/qemu_fwcfg.c | 18 ++++++++++++++++-- usr.sbin/bhyve/virtio.h | 2 ++ 13 files changed, 77 insertions(+), 28 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 0ec6ad73e2a2..5aaf0d4ea2a0 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -31,7 +31,6 @@ SRCS= \ gdb.c \ hda_codec.c \ inout.c \ - ioapic.c \ iov.c \ mem.c \ mevent.c \ @@ -40,8 +39,6 @@ SRCS= \ pci_emul.c \ pci_fbuf.c \ pci_hostbridge.c \ - pci_irq.c \ - pci_lpc.c \ pci_nvme.c \ pci_passthru.c \ pci_virtio_9p.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 862aeddb16e0..76813891b0a0 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -2,12 +2,15 @@ SRCS+= \ atkbdc.c \ e820.c \ fwctl.c \ + ioapic.c \ kernemu_dev.c \ mptbl.c \ pci_ahci.c \ pci_e82545.c \ pci_gvt-d.c \ pci_hda.c \ + pci_irq.c \ + pci_lpc.c \ pci_uart.c \ pci_xhci.c \ pctestdev.c \ diff --git a/usr.sbin/bhyve/ioapic.c b/usr.sbin/bhyve/amd64/ioapic.c similarity index 100% rename from usr.sbin/bhyve/ioapic.c rename to usr.sbin/bhyve/amd64/ioapic.c diff --git a/usr.sbin/bhyve/ioapic.h b/usr.sbin/bhyve/amd64/ioapic.h similarity index 100% rename from usr.sbin/bhyve/ioapic.h rename to usr.sbin/bhyve/amd64/ioapic.h diff --git a/usr.sbin/bhyve/pci_irq.c b/usr.sbin/bhyve/amd64/pci_irq.c similarity index 100% rename from usr.sbin/bhyve/pci_irq.c rename to usr.sbin/bhyve/amd64/pci_irq.c diff --git a/usr.sbin/bhyve/pci_irq.h b/usr.sbin/bhyve/amd64/pci_irq.h similarity index 100% rename from usr.sbin/bhyve/pci_irq.h rename to usr.sbin/bhyve/amd64/pci_irq.h diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/amd64/pci_lpc.c similarity index 100% rename from usr.sbin/bhyve/pci_lpc.c rename to usr.sbin/bhyve/amd64/pci_lpc.c diff --git a/usr.sbin/bhyve/pci_lpc.h b/usr.sbin/bhyve/amd64/pci_lpc.h similarity index 100% rename from usr.sbin/bhyve/pci_lpc.h rename to usr.sbin/bhyve/amd64/pci_lpc.h diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index c27cb427f1e2..ba63a6405538 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -85,8 +85,8 @@ #include "amd64/fwctl.h" #endif #include "gdb.h" -#include "ioapic.h" #ifdef __amd64__ +#include "amd64/ioapic.h" #include "amd64/kernemu_dev.h" #endif #include "mem.h" @@ -95,8 +95,10 @@ #include "amd64/mptbl.h" #endif #include "pci_emul.h" -#include "pci_irq.h" -#include "pci_lpc.h" +#ifdef __amd64__ +#include "amd64/pci_irq.h" +#include "amd64/pci_lpc.h" +#endif #include "qemu_fwcfg.h" #include "smbiostbl.h" #ifdef BHYVE_SNAPSHOT @@ -634,8 +636,10 @@ do_open(const char *vmname) reinit = romboot = false; +#ifdef __amd64__ if (lpc_bootrom()) romboot = true; +#endif error = vm_create(vmname); if (error) { @@ -855,6 +859,7 @@ main(int argc, char *argv[]) case 'K': set_config_value("keyboard.layout", optarg); break; +#ifdef __amd64__ case 'l': if (strncmp(optarg, "help", strlen(optarg)) == 0) { lpc_print_supported_devices(); @@ -864,6 +869,7 @@ main(int argc, char *argv[]) "configuration '%s'", optarg); } break; +#endif #ifdef BHYVE_SNAPSHOT case 'r': restore_file = optarg; @@ -1037,9 +1043,9 @@ main(int argc, char *argv[]) init_bootrom(ctx); #ifdef __amd64__ atkbdc_init(ctx); -#endif pci_irq_init(ctx); ioapic_init(ctx); +#endif #ifdef __amd64__ rtc_init(ctx); @@ -1085,6 +1091,7 @@ main(int argc, char *argv[]) init_gdb(ctx); +#ifdef __amd64__ if (lpc_bootrom()) { if (vm_set_capability(bsp, VM_CAP_UNRESTRICTED_GUEST, 1)) { fprintf(stderr, "ROM boot failed: unrestricted guest " @@ -1094,6 +1101,7 @@ main(int argc, char *argv[]) error = vcpu_reset(bsp); assert(error == 0); } +#endif /* * Add all vCPUs. diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index 5fb25dbfe9c7..6b2e46ce917d 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -52,11 +52,15 @@ #include "config.h" #include "debug.h" #include "inout.h" -#include "ioapic.h" +#ifdef __amd64__ +#include "amd64/ioapic.h" +#endif #include "mem.h" #include "pci_emul.h" -#include "pci_irq.h" -#include "pci_lpc.h" +#ifdef __amd64__ +#include "amd64/pci_irq.h" +#include "amd64/pci_lpc.h" +#endif #include "pci_passthru.h" #include "qemu_fwcfg.h" @@ -143,9 +147,12 @@ SYSRES_MEM(PCI_EMUL_ECFG_BASE, PCI_EMUL_ECFG_SIZE); #define PCI_EMUL_MEMLIMIT32 PCI_EMUL_ECFG_BASE #define PCI_EMUL_MEMSIZE64 (32*GB) -static struct pci_devemu *pci_emul_finddev(const char *name); +#ifdef __amd64__ static void pci_lintr_route(struct pci_devinst *pi); static void pci_lintr_update(struct pci_devinst *pi); +#endif + +static struct pci_devemu *pci_emul_finddev(const char *name); static void pci_cfgrw(int in, int bus, int slot, int func, int coff, int bytes, uint32_t *val); @@ -1061,11 +1068,13 @@ pci_emul_init(struct vmctx *ctx, struct pci_devemu *pde, int bus, int slot, pdi->pi_bus = bus; pdi->pi_slot = slot; pdi->pi_func = func; +#ifdef __amd64__ pthread_mutex_init(&pdi->pi_lintr.lock, NULL); pdi->pi_lintr.pin = 0; pdi->pi_lintr.state = IDLE; pdi->pi_lintr.pirq_pin = 0; pdi->pi_lintr.ioapic_irq = 0; +#endif pdi->pi_d = pde; snprintf(pdi->pi_name, PI_NAMESZ, "%s@pci.%d.%d.%d", pde->pe_emu, bus, slot, func); @@ -1203,7 +1212,9 @@ msixcap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, pi->pi_msix.enabled = val & PCIM_MSIXCTRL_MSIX_ENABLE; pi->pi_msix.function_mask = val & PCIM_MSIXCTRL_FUNCTION_MASK; +#ifdef __amd64__ pci_lintr_update(pi); +#endif } CFGWRITE(pi, offset, val, bytes); @@ -1245,7 +1256,9 @@ msicap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, } else { pi->pi_msi.maxmsgnum = 0; } +#ifdef __amd64__ pci_lintr_update(pi); +#endif } static void @@ -1538,6 +1551,7 @@ init_pci(struct vmctx *ctx) bi->memlimit64 = pci_emul_membase64; } +#ifdef __amd64__ /* * PCI backends are initialized before routing INTx interrupts * so that LPC devices are able to reserve ISA IRQs before @@ -1558,6 +1572,7 @@ init_pci(struct vmctx *ctx) } } lpc_pirq_routed(); +#endif if ((error = init_bootorder()) != 0) { warnx("%s: Unable to init bootorder", __func__); @@ -1601,6 +1616,7 @@ init_pci(struct vmctx *ctx) return (0); } +#ifdef __amd64__ static void pci_apic_prt_entry(int bus __unused, int slot, int pin, int pirq_pin __unused, int ioapic_irq, void *arg __unused) @@ -1633,6 +1649,7 @@ pci_pirq_prt_entry(int bus __unused, int slot, int pin, int pirq_pin, dsdt_line(" },"); free(name); } +#endif /* * A bhyve virtual machine has a flat PCI hierarchy with a root port @@ -1644,7 +1661,7 @@ pci_bus_write_dsdt(int bus) struct businfo *bi; struct slotinfo *si; struct pci_devinst *pi; - int count, func, slot; + int func, slot; /* * If there are no devices on this 'bus' then just return. @@ -1747,8 +1764,8 @@ pci_bus_write_dsdt(int bus) dsdt_line(" ,, , AddressRangeMemory, TypeStatic)"); dsdt_line(" })"); - count = pci_count_lintr(bus); - if (count != 0) { +#ifdef __amd64__ + if (pci_count_lintr(bus) != 0) { dsdt_indent(2); dsdt_line("Name (PPRT, Package ()"); dsdt_line("{"); @@ -1771,6 +1788,7 @@ pci_bus_write_dsdt(int bus) dsdt_line("}"); dsdt_unindent(2); } +#endif dsdt_indent(2); for (slot = 0; slot < MAXSLOTS; slot++) { @@ -1866,6 +1884,7 @@ pci_generate_msi(struct pci_devinst *pi, int index) } } +#ifdef __amd64__ static bool pci_lintr_permitted(struct pci_devinst *pi) { @@ -2026,6 +2045,7 @@ pci_walk_lintr(int bus, pci_lintr_cb cb, void *arg) } } } +#endif /* __amd64__ */ /* * Return 1 if the emulated device in 'slot' is a multi-function device. @@ -2130,11 +2150,13 @@ pci_emul_cmd_changed(struct pci_devinst *pi, uint16_t old) } } +#ifdef __amd64__ /* * If INTx has been unmasked and is pending, assert the * interrupt. */ pci_lintr_update(pi); +#endif } static void diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h index 0fd438151093..c367169113f8 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -115,12 +115,6 @@ struct msix_table_entry { #define MAX_MSIX_TABLE_ENTRIES 2048 #define PBA_SIZE(msgnum) (roundup2((msgnum), 64) / 8) -enum lintr_stat { - IDLE, - ASSERTED, - PENDING -}; - struct pci_devinst { struct pci_devemu *pi_d; struct vmctx *pi_vmctx; @@ -130,13 +124,19 @@ struct pci_devinst { int pi_prevcap; int pi_capend; +#ifdef __amd64__ struct { int8_t pin; - enum lintr_stat state; + enum { + IDLE, + ASSERTED, + PENDING, + } state; int pirq_pin; int ioapic_irq; pthread_mutex_t lock; } pi_lintr; +#endif struct { int enabled; @@ -221,8 +221,15 @@ struct pciecap { } __packed; static_assert(sizeof(struct pciecap) == 60, "compile-time assertion failed"); +#ifdef __amd64__ typedef void (*pci_lintr_cb)(int b, int s, int pin, int pirq_pin, int ioapic_irq, void *arg); +void pci_lintr_assert(struct pci_devinst *pi); +void pci_lintr_deassert(struct pci_devinst *pi); +void pci_lintr_request(struct pci_devinst *pi); +int pci_count_lintr(int bus); +void pci_walk_lintr(int bus, pci_lintr_cb cb, void *arg); +#endif int init_pci(struct vmctx *ctx); void pci_callback(void); @@ -241,9 +248,6 @@ void pci_emul_capwrite(struct pci_devinst *pi, int offset, int bytes, void pci_emul_cmd_changed(struct pci_devinst *pi, uint16_t old); void pci_generate_msi(struct pci_devinst *pi, int msgnum); void pci_generate_msix(struct pci_devinst *pi, int msgnum); -void pci_lintr_assert(struct pci_devinst *pi); -void pci_lintr_deassert(struct pci_devinst *pi); -void pci_lintr_request(struct pci_devinst *pi); int pci_msi_enabled(struct pci_devinst *pi); int pci_msix_enabled(struct pci_devinst *pi); int pci_msix_table_bar(struct pci_devinst *pi); @@ -257,11 +261,10 @@ int pci_emul_add_msixcap(struct pci_devinst *pi, int msgnum, int barnum); int pci_emul_msix_twrite(struct pci_devinst *pi, uint64_t offset, int size, uint64_t value); uint64_t pci_emul_msix_tread(struct pci_devinst *pi, uint64_t offset, int size); -int pci_count_lintr(int bus); -void pci_walk_lintr(int bus, pci_lintr_cb cb, void *arg); void pci_write_dsdt(void); uint64_t pci_ecfg_base(void); int pci_bus_configured(int bus); + #ifdef BHYVE_SNAPSHOT struct pci_devinst *pci_next(const struct pci_devinst *cursor); int pci_snapshot(struct vm_snapshot_meta *meta); diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c index e845c70950b1..73a401ad8a81 100644 --- a/usr.sbin/bhyve/qemu_fwcfg.c +++ b/usr.sbin/bhyve/qemu_fwcfg.c @@ -23,7 +23,9 @@ #include "acpi_device.h" #include "bhyverun.h" #include "inout.h" -#include "pci_lpc.h" +#ifdef __amd64__ +#include "amd64/pci_lpc.h" +#endif #include "qemu_fwcfg.h" #define QEMU_FWCFG_ACPI_DEVICE_NAME "FWCF" @@ -423,6 +425,18 @@ int qemu_fwcfg_init(struct vmctx *const ctx) { int error; + bool fwcfg_enabled; + + /* + * The fwcfg implementation currently only provides an I/O port + * interface and thus is amd64-specific for now. An MMIO interface is + * required for other platforms. + */ +#ifdef __amd64__ + fwcfg_enabled = strcmp(lpc_fwcfg(), "qemu") == 0; +#else + fwcfg_enabled = false; +#endif /* * Bhyve supports fwctl (bhyve) and fwcfg (qemu) as firmware interfaces. @@ -430,7 +444,7 @@ qemu_fwcfg_init(struct vmctx *const ctx) * interfaces at the same time to the guest. Therefore, only create acpi * tables and register io ports for fwcfg, if it's used. */ - if (strcmp(lpc_fwcfg(), "qemu") == 0) { + if (fwcfg_enabled) { error = acpi_device_create(&fwcfg_sc.acpi_dev, &fwcfg_sc, ctx, &qemu_fwcfg_acpi_device_emul); if (error) { diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index 2b72b862ab21..4c6c8004b2d1 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -358,7 +358,9 @@ vi_interrupt(struct virtio_softc *vs, uint8_t isr, uint16_t msix_idx) VS_LOCK(vs); vs->vs_isr |= isr; pci_generate_msi(vs->vs_pi, 0); +#ifdef __amd64__ pci_lintr_assert(vs->vs_pi); +#endif VS_UNLOCK(vs); } } From nobody Wed Oct 4 16:54:10 2023 X-Original-To: dev-commits-src-main@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 4S114L3bdrz4wH9V; Wed, 4 Oct 2023 16:54:10 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114L2X0nz3D77; Wed, 4 Oct 2023 16:54:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438450; 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=Hsy3HWVFd9JyiuQVZIQ4XTsJt0JtjF0jv9Eltsa2j2Q=; b=qKQty9O2cYdtTVYsNuhYookeYA6oLng6dm1oiMzYGU48aSp8FnnEvSogUzpXukZs+2Mrsc A+QGvEyYFDaRaPVRcNudtUOKFCEfpvSkAbrc7obnujUIphIkB3S4aRFQ/Ag8LeqEX8ce4W Vv7V0PyU7c6+e99pIBhtxqtslKevYs3HKGAb9kNIPARQ63RxcH3wFtCqOTrxWa0IqYG981 2LFJzWawPRnI639iJl0WJbnyekjAieM1JNlXn70VLFvBK+yEhbEV2x4DFGYfWDT09irCwo isiLhj448aZtBMlPVIgINzWdttE4NcA/ZlLQ4OHChp1506qUNyZzJCbgznFrgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438450; a=rsa-sha256; cv=none; b=myEIVgT56v/cablrCMp0tShKisVz+ZCtUkmF4lj2AVUG7EuDV0WfIfBR9BnZFLtxWPXI14 sQrjj2GyfjBTwk3b1LHfCTeJnq2YaLMhYocjNkHOdYOil7TwpmBiTiMKDIyou9n3mIfT5a yeFvTVBEmoE33DqrTgZTD0VEiBNdyAVfca7m4yvC60IAC11FF4DBqUeitb+iM2lR77Q9P8 t9n2lVHLjdNHdHsR6vhDPTI4Dp73mbFAfwpPqoZcLF9rRYpJaQhl1RKBQaF4nay/MWRO/X DKfddlx73QUg1mJxVjeE5nsdUOQgcEqYpdAvnwfAQ4Osjepp0AlPB1mTIYvhGA== 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=1696438450; 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=Hsy3HWVFd9JyiuQVZIQ4XTsJt0JtjF0jv9Eltsa2j2Q=; b=JdrO84HT7EDiD9pMfgvoLP78HUUCA/XYXvSMKvceJ7ewppivAx11m7z+cJxmAjfmwMEwY5 p/zm/dy4dhmuE1SpSzD3qgXTC8mmgJBvTGzqZYmUkBYGwreAF/4TkeqnkwDt72oiuQSt21 J0C6lLPK9qCA10gSM1E3fnr5bMFAcD2QNK0QIVB4twER0zjaPM8b82rB0Kn4FkhSW753dt ZAz9dz85ZZ/wAs/dz2sfAgdTZkVimLA2D+B58fEBaFwdKga0pb0a/mnyauOmwIoaNBQFi4 PvZ0Nb+y8gOc9igEOTHqlzmq+3/kEspENGWfAJt+NJx7zXn9tOrgDrm5Pep+NQ== 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 4S114L1SkWzlm1; Wed, 4 Oct 2023 16:54:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GsASU038094; Wed, 4 Oct 2023 16:54:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GsAf2038091; Wed, 4 Oct 2023 16:54:10 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:10 GMT Message-Id: <202310041654.394GsAf2038091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 61429b49d2bd - main - bhyve: Conditionally compile framebuffer-related code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61429b49d2bd4fdad37e0873b2fc085eacbd26b2 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=61429b49d2bd4fdad37e0873b2fc085eacbd26b2 commit 61429b49d2bd4fdad37e0873b2fc085eacbd26b2 Author: Mark Johnston AuthorDate: 2023-10-04 16:25:47 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Conditionally compile framebuffer-related code The arm64 port does not implement VGA, so move the device model sources. Compile framebuffer code only on amd64 for now, but do not move the sources, as we ought to be able to add support later. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40740 --- usr.sbin/bhyve/Makefile | 3 --- usr.sbin/bhyve/amd64/Makefile.inc | 3 +++ usr.sbin/bhyve/{ => amd64}/vga.c | 0 usr.sbin/bhyve/{ => amd64}/vga.h | 0 usr.sbin/bhyve/pci_fbuf.c | 5 +++-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 5aaf0d4ea2a0..1bb3c9a1b053 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -37,7 +37,6 @@ SRCS= \ net_backends.c \ net_utils.c \ pci_emul.c \ - pci_fbuf.c \ pci_hostbridge.c \ pci_nvme.c \ pci_passthru.c \ @@ -50,7 +49,6 @@ SRCS= \ pci_virtio_scsi.c \ qemu_fwcfg.c \ qemu_loader.c \ - rfb.c \ smbiostbl.c \ sockstream.c \ tpm_device.c \ @@ -60,7 +58,6 @@ SRCS= \ uart_emul.c \ usb_emul.c \ usb_mouse.c \ - vga.c \ virtio.c \ vmexit.c \ vmgenc.c diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 76813891b0a0..435327155fc3 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -7,6 +7,7 @@ SRCS+= \ mptbl.c \ pci_ahci.c \ pci_e82545.c \ + pci_fbuf.c \ pci_gvt-d.c \ pci_hda.c \ pci_irq.c \ @@ -18,9 +19,11 @@ SRCS+= \ post.c \ ps2kbd.c \ ps2mouse.c \ + rfb.c \ rtc.c \ spinup_ap.c \ task_switch.c \ + vga.c \ xmsr.c .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm diff --git a/usr.sbin/bhyve/vga.c b/usr.sbin/bhyve/amd64/vga.c similarity index 100% rename from usr.sbin/bhyve/vga.c rename to usr.sbin/bhyve/amd64/vga.c diff --git a/usr.sbin/bhyve/vga.h b/usr.sbin/bhyve/amd64/vga.h similarity index 100% rename from usr.sbin/bhyve/vga.h rename to usr.sbin/bhyve/amd64/vga.h diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c index 3d63707affa8..a6bf508a46e6 100644 --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -46,10 +46,11 @@ #include "config.h" #include "debug.h" #include "console.h" -#include "inout.h" #include "pci_emul.h" #include "rfb.h" -#include "vga.h" +#ifdef __amd64__ +#include "amd64/vga.h" +#endif /* * bhyve Framebuffer device emulation. From nobody Wed Oct 4 16:54:11 2023 X-Original-To: dev-commits-src-main@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 4S114M3YtNz4wHCd; Wed, 4 Oct 2023 16:54:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114M34LFz3DGn; Wed, 4 Oct 2023 16:54:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438451; 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=ky23CSPDoOUkvDXTAKI/uDp3uUwjr7gBATXWx5q9jxs=; b=Sl7Gi6Vj2j/0Xn9beC/79xODX7dOgSFhkfNXL+51F6z8+17VnmoDs+jSkxFaThLUkLDlvk 089ZwvYS35Qml3nyuBSStu7IclU/hl1CXIO0/UC0j6k9X34+45Rs98jmRACysoPYz1DZsV irKQQ2pwC5ppgirm/BsE/9sOH5FXaAE+hDZ1E2VFyVVo0NyiJc+6/NwWnpemhZ8AhXj31V X6RK90DNZ48mwg2dnkv61oWjePEcCaGB+fi2qrMIdKs8D+WB4AHgTW+ExTweUkQQDyhEnA MPH2u4hLnpAnJ8lgkwTRx6ZRgqNej2/ZSFCwgM55QRN2/NOIY/Qta4eFE9f/3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438451; a=rsa-sha256; cv=none; b=dZNe3jGvV2UxtTR3RnGiOpusJ941Sih4mcMtOaS/JoQAeroXaG7rYrbg8l8jvIfGg8hO3g dt/XLPn+Her71NzZtGvxodnMCvtt9drcW7FVuBbAnfDd6S1jK7sltUvug/1M0km+5xR4CK gn7l+Myc0gvJLhazAat2a647yleyCQiUu/a1CwZDf7fL5tEJt4VU4/8SEqLow23bAWJY52 s+ncLUUbu4hqsK/F+s1tN8K/Pcmaq9+SpNozCifczUvAhA8P84oVY8QwBRbYuv+2F6ch5y eI0Dbheei5tq01FHy60W2MRveiYhGFzDGYz4omOFt9nisr5HasT091LYDgZVgA== 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=1696438451; 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=ky23CSPDoOUkvDXTAKI/uDp3uUwjr7gBATXWx5q9jxs=; b=Fr1fv00A0td/2zk8bZHA0VUQBmmY0D5kiQHZQI2NsGOTaYRHDgx4L8WkmG7SNPJCUt3FRC alQvvktwvZH8V2cbNR4mDYhfG/XxYIYxs3NLp0cY0Zrf3IG09PResoynvOVnnqECvDnMsZ djE8TBpxoioOBAttj82K4f1o+bFVOB5zrCR6tdPjnsmLOGeN836mD2UQwAZ/6ruxlo1OI1 h5Bt7jex8p4d0QnXDyQsCRCjBiLNi75Jx/8038572ks3j63aXFuMHb4RrFcq76y9z3zerp AUgvdhC/LTusZfonMASUTEbfHwKbNsQLO7yIXCa9kwZWMS7qwU2XfUNidS25Ow== 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 4S114M27bQzlxF; Wed, 4 Oct 2023 16:54:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GsBZ2038151; Wed, 4 Oct 2023 16:54:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GsBQK038148; Wed, 4 Oct 2023 16:54:11 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:11 GMT Message-Id: <202310041654.394GsBQK038148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 31cf78c9217b - main - bhyve: Make most I/O port handling specific to amd64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31cf78c9217b8298816115474973f4f0568962cf Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=31cf78c9217b8298816115474973f4f0568962cf commit 31cf78c9217b8298816115474973f4f0568962cf Author: Mark Johnston AuthorDate: 2023-10-04 16:26:08 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Make most I/O port handling specific to amd64 - The qemu_fwcfg interface, as implemented, is I/O port-based, but QEMU implements an MMIO interface that we'll eventually want to port for arm64. - Retain support for I/O space PCI BARs, simply treat them like MMIO BARs for most purposes, similar to what the arm64 kernel does. Such BARs are created by virtio devices. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40741 --- usr.sbin/bhyve/Makefile | 1 - usr.sbin/bhyve/amd64/Makefile.inc | 1 + usr.sbin/bhyve/{ => amd64}/inout.c | 0 usr.sbin/bhyve/{ => amd64}/inout.h | 0 usr.sbin/bhyve/bhyverun.c | 6 ++-- usr.sbin/bhyve/pci_emul.c | 63 +++++++++++++++++++++++++++++++++++--- usr.sbin/bhyve/pctestdev.c | 4 ++- usr.sbin/bhyve/qemu_fwcfg.c | 9 ++++-- 8 files changed, 73 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 1bb3c9a1b053..7c0750fae7d7 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -30,7 +30,6 @@ SRCS= \ ctl_util.c \ gdb.c \ hda_codec.c \ - inout.c \ iov.c \ mem.c \ mevent.c \ diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 435327155fc3..96aaecafae4c 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -2,6 +2,7 @@ SRCS+= \ atkbdc.c \ e820.c \ fwctl.c \ + inout.c \ ioapic.c \ kernemu_dev.c \ mptbl.c \ diff --git a/usr.sbin/bhyve/inout.c b/usr.sbin/bhyve/amd64/inout.c similarity index 100% rename from usr.sbin/bhyve/inout.c rename to usr.sbin/bhyve/amd64/inout.c diff --git a/usr.sbin/bhyve/inout.h b/usr.sbin/bhyve/amd64/inout.h similarity index 100% rename from usr.sbin/bhyve/inout.h rename to usr.sbin/bhyve/amd64/inout.h diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index ba63a6405538..0c8eba3e4a6b 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -78,7 +78,9 @@ #endif #include "bootrom.h" #include "config.h" -#include "inout.h" +#ifdef __amd64__ +#include "amd64/inout.h" +#endif #include "debug.h" #ifdef __amd64__ #include "amd64/e820.h" @@ -1036,8 +1038,8 @@ main(int argc, char *argv[]) #endif init_mem(guest_ncpus); - init_inout(); #ifdef __amd64__ + init_inout(); kernemu_dev_init(); #endif init_bootrom(ctx); diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index 6b2e46ce917d..e91b4d0a1e20 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -51,8 +51,8 @@ #include "bhyverun.h" #include "config.h" #include "debug.h" -#include "inout.h" #ifdef __amd64__ +#include "amd64/inout.h" #include "amd64/ioapic.h" #endif #include "mem.h" @@ -502,6 +502,7 @@ pci_msix_pba_bar(struct pci_devinst *pi) return (-1); } +#ifdef __amd64__ static int pci_emul_io_handler(struct vmctx *ctx __unused, int in, int port, int bytes, uint32_t *eax, void *arg) @@ -530,6 +531,31 @@ pci_emul_io_handler(struct vmctx *ctx __unused, int in, int port, } return (-1); } +#else +static int +pci_emul_iomem_handler(struct vcpu *vcpu __unused, int dir, + uint64_t addr, int size, uint64_t *val, void *arg1, long arg2) +{ + struct pci_devinst *pdi = arg1; + struct pci_devemu *pe = pdi->pi_d; + uint64_t offset; + int bidx = (int)arg2; + + assert(bidx <= PCI_BARMAX); + assert(pdi->pi_bar[bidx].type == PCIBAR_IO); + assert(addr >= pdi->pi_bar[bidx].addr && + addr + size <= pdi->pi_bar[bidx].addr + pdi->pi_bar[bidx].size); + assert(size == 1 || size == 2 || size == 4); + + offset = addr - pdi->pi_bar[bidx].addr; + if (dir == MEM_F_READ) + *val = (*pe->pe_barread)(pdi, bidx, offset, size); + else + (*pe->pe_barwrite)(pdi, bidx, offset, size, *val); + + return (0); +} +#endif /* !__amd64__ */ static int pci_emul_mem_handler(struct vcpu *vcpu __unused, int dir, @@ -538,7 +564,7 @@ pci_emul_mem_handler(struct vcpu *vcpu __unused, int dir, struct pci_devinst *pdi = arg1; struct pci_devemu *pe = pdi->pi_d; uint64_t offset; - int bidx = (int) arg2; + int bidx = (int)arg2; assert(bidx <= PCI_BARMAX); assert(pdi->pi_bar[bidx].type == PCIBAR_MEM32 || @@ -601,12 +627,16 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) { struct pci_devemu *pe; int error; - struct inout_port iop; - struct mem_range mr; + enum pcibar_type type; pe = pi->pi_d; - switch (pi->pi_bar[idx].type) { + type = pi->pi_bar[idx].type; + switch (type) { case PCIBAR_IO: + { +#ifdef __amd64__ + struct inout_port iop; + bzero(&iop, sizeof(struct inout_port)); iop.name = pi->pi_name; iop.port = pi->pi_bar[idx].addr; @@ -618,9 +648,29 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) error = register_inout(&iop); } else error = unregister_inout(&iop); +#else + struct mem_range mr; + + bzero(&mr, sizeof(struct mem_range)); + mr.name = pi->pi_name; + mr.base = pi->pi_bar[idx].addr; + mr.size = pi->pi_bar[idx].size; + if (registration) { + mr.flags = MEM_F_RW; + mr.handler = pci_emul_iomem_handler; + mr.arg1 = pi; + mr.arg2 = idx; + error = register_mem(&mr); + } else + error = unregister_mem(&mr); +#endif break; + } case PCIBAR_MEM32: case PCIBAR_MEM64: + { + struct mem_range mr; + bzero(&mr, sizeof(struct mem_range)); mr.name = pi->pi_name; mr.base = pi->pi_bar[idx].addr; @@ -634,6 +684,7 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) } else error = unregister_mem(&mr); break; + } case PCIBAR_ROM: error = 0; break; @@ -2346,6 +2397,7 @@ pci_cfgrw(int in, int bus, int slot, int func, int coff, int bytes, } } +#ifdef __amd64__ static int cfgenable, cfgbus, cfgslot, cfgfunc, cfgoff; static int @@ -2401,6 +2453,7 @@ INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+0, IOPORT_F_INOUT, pci_emul_cfgdata); INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+1, IOPORT_F_INOUT, pci_emul_cfgdata); INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+2, IOPORT_F_INOUT, pci_emul_cfgdata); INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+3, IOPORT_F_INOUT, pci_emul_cfgdata); +#endif #ifdef BHYVE_SNAPSHOT /* diff --git a/usr.sbin/bhyve/pctestdev.c b/usr.sbin/bhyve/pctestdev.c index b6fc3c336a93..539016a51876 100644 --- a/usr.sbin/bhyve/pctestdev.c +++ b/usr.sbin/bhyve/pctestdev.c @@ -43,7 +43,9 @@ #include #include "debug.h" -#include "inout.h" +#ifdef __amd64__ +#include "amd64/inout.h" +#endif #include "mem.h" #include "pctestdev.h" diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c index 73a401ad8a81..830cee730dbd 100644 --- a/usr.sbin/bhyve/qemu_fwcfg.c +++ b/usr.sbin/bhyve/qemu_fwcfg.c @@ -22,8 +22,8 @@ #include "acpi_device.h" #include "bhyverun.h" -#include "inout.h" #ifdef __amd64__ +#include "amd64/inout.h" #include "amd64/pci_lpc.h" #endif #include "qemu_fwcfg.h" @@ -114,6 +114,7 @@ struct qemu_fwcfg_user_file { static STAILQ_HEAD(qemu_fwcfg_user_file_list, qemu_fwcfg_user_file) user_files = STAILQ_HEAD_INITIALIZER(user_files); +#ifdef __amd64__ static int qemu_fwcfg_selector_port_handler(struct vmctx *const ctx __unused, const int in, const int port __unused, const int bytes, uint32_t *const eax, @@ -181,6 +182,7 @@ qemu_fwcfg_data_port_handler(struct vmctx *const ctx __unused, const int in, return (0); } +#endif static int qemu_fwcfg_add_item(const uint16_t architecture, const uint16_t index, @@ -295,6 +297,7 @@ qemu_fwcfg_add_item_signature(void) (uint8_t *)fwcfg_signature)); } +#ifdef __amd64__ static int qemu_fwcfg_register_port(const char *const name, const int port, const int size, const int flags, const inout_func_t handler) @@ -310,6 +313,7 @@ qemu_fwcfg_register_port(const char *const name, const int port, const int size, return (register_inout(&iop)); } +#endif int qemu_fwcfg_add_file(const char *name, const uint32_t size, void *const data) @@ -461,7 +465,7 @@ qemu_fwcfg_init(struct vmctx *const ctx) goto done; } - /* add handlers for fwcfg ports */ +#ifdef __amd64__ if ((error = qemu_fwcfg_register_port("qemu_fwcfg_selector", QEMU_FWCFG_SELECTOR_PORT_NUMBER, QEMU_FWCFG_SELECTOR_PORT_SIZE, @@ -481,6 +485,7 @@ qemu_fwcfg_init(struct vmctx *const ctx) __func__, QEMU_FWCFG_DATA_PORT_NUMBER); goto done; } +#endif } /* add common fwcfg items */ From nobody Wed Oct 4 16:54:12 2023 X-Original-To: dev-commits-src-main@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 4S114Q0Q0Bz4wH9Y; Wed, 4 Oct 2023 16:54:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114P0PL3z3DKS; Wed, 4 Oct 2023 16:54:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438453; 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=z0f0zv4CHPyShGAZi8sJWMRB46ZUnrbjHZZ1DqaI0kM=; b=pzWSJzKWrSRCqf6URkRgdpHOhGDC//PcTno2ZVhTlQeQH4KMjRu7dn0cn/T8i42lh7APUG 0NCTsbsswheIemzv8VlCiHwXXjhrnm4pIeLUgEAVC+87MlBW6fORsG73eKnkmpOuW9f8RR nnfzgp+U2Ri47gJFRxWBb/mEvU99vsSlm1C/q7Qr0MW0LjuWx7uB/2at0ht+nnrj6SzibZ iQluu2s0IFywiv5LZWiMdHqGfXokn8g5CPYn+5dXgWDHtDbqllhWNxvlHFmG+lGWjhcKIP KAFlIqo1v+pzMQuQpUPuwSYfjBd5cMOMvSC4ShpJgNt4ps7H3WTUOh47SpH+8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438453; a=rsa-sha256; cv=none; b=fgNeNsAsgaCkP8hEAqhtQ7KQv2Et5gPRjz8pImiHRRIbZyIAn0sdF+35zV3uq1NNSopOjx SKKT/Kv670tJK0sUvmMfC1gTTtDcR+STKoQfcWvcwFBetHQsOJPx3LmEQ8r7/ld7QM/i2j r5WRtjIFPES50jEKbWwXjzrejEuGVr3hWQUHqeh5b8Pz65siedwR/cxf2W8ChLJjLh4XG7 DnU26YbA4tF07Q52gtW0Fa65H3yli49p11KYliuJ9UTDzedSV335E5kz9CzhSUvl0cDOXV cphXip8sJlx2KtMWI6fXxe8ZjPOzQCisu9paX1xLm3H7ovJXGIr1szZJXMlyww== 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=1696438453; 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=z0f0zv4CHPyShGAZi8sJWMRB46ZUnrbjHZZ1DqaI0kM=; b=lxKiwoi4S3/dsEBZCBJc+sx28p7AKcYfeWHjCoRQkqRIS9xv2DdTQktuQzUsx6z2SEmKVn f1Tjg4cwV+msTjJRpDYxv6Q9roPfuWLGhYVxyc7HXY7yoIt/+HHo7b17pli/HqI4HSv80U dDrHfJanX7fpfy+Ckl52rlv6cHOZKzYbM68xkHpLWOi/jqv6HSx/7obPDEMUY7uhprxMpU rExEnFr7SeGfoJuwFGdFoxbINcySPrizRiE709qsYhTzO3n7R4iCJEHEe3yiqlPQ1ggubZ CHNTcaR7/gV1OhPA6m4RWDLes3ySVvrs4E5cJ+Jx7M4CxCX+XniCO/GphU54tg== 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 4S114N2rpczlWw; Wed, 4 Oct 2023 16:54:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GsCkE038196; Wed, 4 Oct 2023 16:54:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GsCpb038193; Wed, 4 Oct 2023 16:54:12 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:12 GMT Message-Id: <202310041654.394GsCpb038193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ca2cda98d265 - main - bhyve: Make gdb support optional List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca2cda98d265ef5d80b7cd0705697a1af27fb808 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ca2cda98d265ef5d80b7cd0705697a1af27fb808 commit ca2cda98d265ef5d80b7cd0705697a1af27fb808 Author: Mark Johnston AuthorDate: 2023-10-04 16:26:36 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Make gdb support optional Add a BHYVE_GDB_SUPPORT make variable that can be set by per-arch makefiles. When set, BHYVE_GDB is defined and can be used as a preprocessor predicate. Use it to guard gdb stub calls in MI code. The arm64 bhyve port currently does not have a functional gdb stub, but that's not critical to landing the port, so this mechanism slightly reduces the friction of adding support for a new platform. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40986 --- usr.sbin/bhyve/Makefile | 13 ++++++++----- usr.sbin/bhyve/amd64/Makefile.inc | 2 ++ usr.sbin/bhyve/bhyverun.c | 10 ++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 7c0750fae7d7..1a8191f9fd3f 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -28,7 +28,6 @@ SRCS= \ crc16.c \ ctl_scsi_all.c \ ctl_util.c \ - gdb.c \ hda_codec.c \ iov.c \ mem.c \ @@ -67,6 +66,14 @@ SRCS+= snapshot.c .include "${MACHINE_CPUARCH}/Makefile.inc" +.if defined(BHYVE_GDB_SUPPORT) +SRCS+= gdb.c +CFLAGS+= -DBHYVE_GDB +.ifdef GDB_LOG +CFLAGS+=-DGDB_LOG +.endif +.endif + CFLAGS+=-I${.CURDIR} \ -I${.CURDIR}/../../contrib/lib9p \ -I${SRCTOP}/sys @@ -102,10 +109,6 @@ CFLAGS+= -I${SRCTOP}/contrib/libucl/include CFLAGS+= -DBHYVE_SNAPSHOT .endif -.ifdef GDB_LOG -CFLAGS+=-DGDB_LOG -.endif - # Disable thread safety analysis since it only finds very simple bugs and # yields many false positives. NO_WTHREAD_SAFETY= diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc index 96aaecafae4c..bc0ffa720d31 100644 --- a/usr.sbin/bhyve/amd64/Makefile.inc +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -1,3 +1,5 @@ +BHYVE_GDB_SUPPORT= + SRCS+= \ atkbdc.c \ e820.c \ diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 0c8eba3e4a6b..d054ec1301f7 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -86,7 +86,9 @@ #include "amd64/e820.h" #include "amd64/fwctl.h" #endif +#ifdef BHYVE_GDB #include "gdb.h" +#endif #ifdef __amd64__ #include "amd64/ioapic.h" #include "amd64/kernemu_dev.h" @@ -463,7 +465,9 @@ fbsdrun_start_thread(void *param) #ifdef BHYVE_SNAPSHOT checkpoint_cpu_add(vi->vcpuid); #endif +#ifdef BHYVE_GDB gdb_cpu_add(vi->vcpu); +#endif vm_loop(vi->ctx, vi->vcpu); @@ -757,6 +761,7 @@ parse_simple_config_file(const char *path) fclose(fp); } +#ifdef BHYVE_GDB static void parse_gdb_options(const char *opt) { @@ -780,6 +785,7 @@ parse_gdb_options(const char *opt) set_config_value("gdb.port", sport); } +#endif static void set_defaults(void) @@ -852,9 +858,11 @@ main(int argc, char *argv[]) errx(EX_USAGE, "invalid fwcfg item '%s'", optarg); } break; +#ifdef BHYVE_GDB case 'G': parse_gdb_options(optarg); break; +#endif case 'k': parse_simple_config_file(optarg); break; @@ -1091,7 +1099,9 @@ main(int argc, char *argv[]) if (get_config_bool("acpi_tables")) vmgenc_init(ctx); +#ifdef BHYVE_GDB init_gdb(ctx); +#endif #ifdef __amd64__ if (lpc_bootrom()) { From nobody Wed Oct 4 16:54:13 2023 X-Original-To: dev-commits-src-main@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 4S114Q14xvz4wH3C; Wed, 4 Oct 2023 16:54:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114P57Mvz3DXC; Wed, 4 Oct 2023 16:54:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438453; 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=v/SiBvVfcBxPy1g6kJncPVOyK7sMaEyyzYMzZJlahXM=; b=rKZqx1JmbWR47ZOs+p7aZHSqGlCotWERUzKhfIhbVL/F/CQM+EShKOqtVNFa37mLDX8SvU PfMUWhoFsgLD3qwitBLJCAo5K2chvmUAfyi/vkHTHUVcDCj7vzKBwAmH9iXM3ykw2lhxNJ JqldIAWEDlgB0jVMEnvve6hao1gJZNgPnDwgyko6eJ18ZhpBVf+I+VABLms9TmnTxlrAzS 3sxn7H1ERYqEP4/YUhPrGxDEvGs3Ws2/C+v55RhVVmjX3K7JGQZjovX/A5/ghfrYdzmYQ9 JqEALpj2sswGLC4EchX15EiaaTH0w3PoR5axWlg4JGMBbnAzthLqopptCVKtww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438453; a=rsa-sha256; cv=none; b=dqaasJ/yXRcVHRQOrqucY22gDhw6+4rjhvMgUkxYFoibw5mt69Yiz7JxOdYvvjgTJkwwye Bvzt/B5YE99tsqC/OrD7DPFhvJA3kmf4vhdeZ0ffmQnTOHv56QvUZxQhFqjzKjedfwlyPN +yWc8Rz6oyLpkM05aH1Gqx4JnFar2u5R84mpuegCr9HZDkaxxu9CVBrAoBeQm5SpVtWyxo roYHXsKDkVZW4h+M1WsHdiMlcTEUMPgom8g5piLVUm4Knd3NJdVRxxEuDUbPh3gnR2gJv6 LR3vpYfkmUhr83MLeYfxul5XXS54NsX6p0shvxgIK1hw43dkmQGl6bUSN4458Q== 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=1696438453; 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=v/SiBvVfcBxPy1g6kJncPVOyK7sMaEyyzYMzZJlahXM=; b=rdqXXHkh2jU1/OOlUcUG+ZLGCIcgW2eMpEEU3jfGLJVpAsqKbDjg9/BRlf9CM8xu2XGvbW xESXu1SIlLLbnsZ2HXXDwLG7J4Gc8m3PThrMXNFVXoai/9QvdATIRIgQ0BAgMsFVOJh/15 Hyw3QMfdFypO5EAKn4s9zwJf3h/CJ4FhRUEFDGNQRvOQ88isVWx+HGV8Qn4R0Vl/zgbCJ/ 3nKEwQRHkqfStLtVgoJyPN9CFRo+Vp9sG3ROWvZPRorN8aUqEfrMHITEcnnZA4CI42jD0X PZs3oKLZKRmLH43u7JUQa1QvqpYVwwh0Kr4J/luRF2b0x4J7rAmnpLS1rwojyA== 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 4S114P41TBzljp; Wed, 4 Oct 2023 16:54:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GsDcm038250; Wed, 4 Oct 2023 16:54:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GsDwd038247; Wed, 4 Oct 2023 16:54:13 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:13 GMT Message-Id: <202310041654.394GsDwd038247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e20b74da223d - main - bhyve: Move vcpu initialization into a MD source file List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e20b74da223d675321618fe6d67858084d152c9e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e20b74da223d675321618fe6d67858084d152c9e commit e20b74da223d675321618fe6d67858084d152c9e Author: Mark Johnston AuthorDate: 2023-10-04 16:27:07 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Move vcpu initialization into a MD source file - Make handling of x86 config options, like x86.x2apic, conditional to amd64. - Move fbsdrun_set_capabilities() and spinup_vcpu() to a new file, bhyverun_machdep.c. The moved code is all highly x86 specific. I'm not sure how best to handle the namespace. I'm using "bhyve_" for MD functions called from MI code. We also have "fbsdrun_" for some MI routines that are typically called from MD code. The file name is prefixed by "bhyverun_". Reviewed by: corvink MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40987 --- usr.sbin/bhyve/Makefile | 1 + usr.sbin/bhyve/amd64/bhyverun_machdep.c | 125 ++++++++++++++++++++++++++++++++ usr.sbin/bhyve/bhyverun.c | 111 ++++------------------------ usr.sbin/bhyve/bhyverun.h | 12 ++- 4 files changed, 152 insertions(+), 97 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 1a8191f9fd3f..de8e87d2ad49 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -21,6 +21,7 @@ SRCS= \ basl.c \ bhyvegc.c \ bhyverun.c \ + bhyverun_machdep.c \ block_if.c \ bootrom.c \ config.c \ diff --git a/usr.sbin/bhyve/amd64/bhyverun_machdep.c b/usr.sbin/bhyve/amd64/bhyverun_machdep.c new file mode 100644 index 000000000000..c6926abe61bc --- /dev/null +++ b/usr.sbin/bhyve/amd64/bhyverun_machdep.c @@ -0,0 +1,125 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include + +#include "bhyverun.h" +#include "config.h" +#include "pci_lpc.h" + +void +bhyve_init_config(void) +{ + init_config(); + + /* Set default values prior to option parsing. */ + set_config_bool("acpi_tables", true); + set_config_bool("acpi_tables_in_memory", true); + set_config_value("memory.size", "256M"); + set_config_bool("x86.strictmsr", true); + set_config_value("lpc.fwcfg", "bhyve"); +} + +void +bhyve_init_vcpu(struct vcpu *vcpu) +{ + int err, tmp; + + if (get_config_bool_default("x86.vmexit_on_hlt", false)) { + err = vm_get_capability(vcpu, VM_CAP_HALT_EXIT, &tmp); + if (err < 0) { + fprintf(stderr, "VM exit on HLT not supported\n"); + exit(4); + } + vm_set_capability(vcpu, VM_CAP_HALT_EXIT, 1); + } + + if (get_config_bool_default("x86.vmexit_on_pause", false)) { + /* + * pause exit support required for this mode + */ + err = vm_get_capability(vcpu, VM_CAP_PAUSE_EXIT, &tmp); + if (err < 0) { + fprintf(stderr, + "SMP mux requested, no pause support\n"); + exit(4); + } + vm_set_capability(vcpu, VM_CAP_PAUSE_EXIT, 1); + } + + if (get_config_bool_default("x86.x2apic", false)) + err = vm_set_x2apic_state(vcpu, X2APIC_ENABLED); + else + err = vm_set_x2apic_state(vcpu, X2APIC_DISABLED); + + if (err) { + fprintf(stderr, "Unable to set x2apic state (%d)\n", err); + exit(4); + } + + vm_set_capability(vcpu, VM_CAP_ENABLE_INVPCID, 1); + + err = vm_set_capability(vcpu, VM_CAP_IPI_EXIT, 1); + assert(err == 0); +} + +void +bhyve_start_vcpu(struct vcpu *vcpu, bool bsp) +{ + int error; + + if (bsp) { + if (lpc_bootrom()) { + error = vm_set_capability(vcpu, + VM_CAP_UNRESTRICTED_GUEST, 1); + if (error != 0) { + err(4, "ROM boot failed: unrestricted guest " + "capability not available"); + } + error = vcpu_reset(vcpu); + assert(error == 0); + } + } else { + bhyve_init_vcpu(vcpu); + + /* + * Enable the 'unrestricted guest' mode for APs. + * + * APs startup in power-on 16-bit mode. + */ + error = vm_set_capability(vcpu, VM_CAP_UNRESTRICTED_GUEST, 1); + assert(error == 0); + } + + fbsdrun_addcpu(vcpu_id(vcpu)); +} diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index d054ec1301f7..f42db8147d54 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -476,17 +476,20 @@ fbsdrun_start_thread(void *param) return (NULL); } -static void -fbsdrun_addcpu(struct vcpu_info *vi) +void +fbsdrun_addcpu(int vcpuid) { + struct vcpu_info *vi; pthread_t thr; int error; + vi = &vcpu_info[vcpuid]; + error = vm_activate_cpu(vi->vcpu); if (error != 0) err(EX_OSERR, "could not activate CPU %d", vi->vcpuid); - CPU_SET_ATOMIC(vi->vcpuid, &cpumask); + CPU_SET_ATOMIC(vcpuid, &cpumask); vm_suspend_cpu(vi->vcpu); @@ -590,49 +593,6 @@ num_vcpus_allowed(struct vmctx *ctx, struct vcpu *vcpu) return (1); } -static void -fbsdrun_set_capabilities(struct vcpu *vcpu) -{ - int err, tmp; - - if (get_config_bool_default("x86.vmexit_on_hlt", false)) { - err = vm_get_capability(vcpu, VM_CAP_HALT_EXIT, &tmp); - if (err < 0) { - fprintf(stderr, "VM exit on HLT not supported\n"); - exit(4); - } - vm_set_capability(vcpu, VM_CAP_HALT_EXIT, 1); - } - - if (get_config_bool_default("x86.vmexit_on_pause", false)) { - /* - * pause exit support required for this mode - */ - err = vm_get_capability(vcpu, VM_CAP_PAUSE_EXIT, &tmp); - if (err < 0) { - fprintf(stderr, - "SMP mux requested, no pause support\n"); - exit(4); - } - vm_set_capability(vcpu, VM_CAP_PAUSE_EXIT, 1); - } - - if (get_config_bool_default("x86.x2apic", false)) - err = vm_set_x2apic_state(vcpu, X2APIC_ENABLED); - else - err = vm_set_x2apic_state(vcpu, X2APIC_DISABLED); - - if (err) { - fprintf(stderr, "Unable to set x2apic state (%d)\n", err); - exit(4); - } - - vm_set_capability(vcpu, VM_CAP_ENABLE_INVPCID, 1); - - err = vm_set_capability(vcpu, VM_CAP_IPI_EXIT, 1); - assert(err == 0); -} - static struct vmctx * do_open(const char *vmname) { @@ -697,26 +657,6 @@ do_open(const char *vmname) return (ctx); } -static void -spinup_vcpu(struct vcpu_info *vi, bool bsp) -{ - int error; - - if (!bsp) { - fbsdrun_set_capabilities(vi->vcpu); - - /* - * Enable the 'unrestricted guest' mode for APs. - * - * APs startup in power-on 16-bit mode. - */ - error = vm_set_capability(vi->vcpu, VM_CAP_UNRESTRICTED_GUEST, 1); - assert(error == 0); - } - - fbsdrun_addcpu(vi); -} - static bool parse_config_option(const char *option) { @@ -787,17 +727,6 @@ parse_gdb_options(const char *opt) } #endif -static void -set_defaults(void) -{ - - set_config_bool("acpi_tables", true); - set_config_bool("acpi_tables_in_memory", true); - set_config_value("memory.size", "256M"); - set_config_bool("x86.strictmsr", true); - set_config_value("lpc.fwcfg", "bhyve"); -} - int main(int argc, char *argv[]) { @@ -814,8 +743,8 @@ main(int argc, char *argv[]) restore_file = NULL; #endif - init_config(); - set_defaults(); + bhyve_init_config(); + progname = basename(argv[0]); #ifdef BHYVE_SNAPSHOT @@ -825,9 +754,11 @@ main(int argc, char *argv[]) #endif while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { +#ifdef __amd64__ case 'a': set_config_bool("x86.x2apic", false); break; +#endif case 'A': /* * NOP. For backward compatibility. Most systems don't @@ -903,6 +834,7 @@ main(int argc, char *argv[]) if (!parse_config_option(optarg)) errx(EX_USAGE, "invalid configuration option '%s'", optarg); break; +#ifdef __amd64__ case 'H': set_config_bool("x86.vmexit_on_hlt", true); break; @@ -921,7 +853,6 @@ main(int argc, char *argv[]) case 'e': set_config_bool("x86.strictio", true); break; -#ifdef __amd64__ case 'u': set_config_bool("rtc.use_localtime", false); break; @@ -929,16 +860,18 @@ main(int argc, char *argv[]) case 'U': set_config_value("uuid", optarg); break; +#ifdef __amd64__ case 'w': set_config_bool("x86.strictmsr", false); break; +#endif case 'W': set_config_bool("virtio_msix", false); break; +#ifdef __amd64__ case 'x': set_config_bool("x86.x2apic", true); break; -#ifdef __amd64__ case 'Y': set_config_bool("x86.mptable", false); break; @@ -1012,7 +945,7 @@ main(int argc, char *argv[]) exit(4); } - fbsdrun_set_capabilities(bsp); + bhyve_init_vcpu(bsp); /* Allocate per-VCPU resources. */ vcpu_info = calloc(guest_ncpus, sizeof(*vcpu_info)); @@ -1103,23 +1036,11 @@ main(int argc, char *argv[]) init_gdb(ctx); #endif -#ifdef __amd64__ - if (lpc_bootrom()) { - if (vm_set_capability(bsp, VM_CAP_UNRESTRICTED_GUEST, 1)) { - fprintf(stderr, "ROM boot failed: unrestricted guest " - "capability not available\n"); - exit(4); - } - error = vcpu_reset(bsp); - assert(error == 0); - } -#endif - /* * Add all vCPUs. */ for (int vcpuid = 0; vcpuid < guest_ncpus; vcpuid++) - spinup_vcpu(&vcpu_info[vcpuid], vcpuid == BSP); + bhyve_start_vcpu(vcpu_info[vcpuid].vcpu, vcpuid == BSP); #ifdef BHYVE_SNAPSHOT if (restore_file != NULL) { diff --git a/usr.sbin/bhyve/bhyverun.h b/usr.sbin/bhyve/bhyverun.h index b1cfb99a964e..39e0916f08ef 100644 --- a/usr.sbin/bhyve/bhyverun.h +++ b/usr.sbin/bhyve/bhyverun.h @@ -26,8 +26,10 @@ * SUCH DAMAGE. */ -#ifndef _FBSDRUN_H_ -#define _FBSDRUN_H_ +#ifndef _BHYVERUN_H_ +#define _BHYVERUN_H_ + +#include #define VMEXIT_CONTINUE (0) #define VMEXIT_ABORT (-1) @@ -46,6 +48,7 @@ uintptr_t paddr_host2guest(struct vmctx *ctx, void *addr); struct vcpu; struct vcpu *fbsdrun_vcpu(int vcpuid); +void fbsdrun_addcpu(int vcpuid); void fbsdrun_deletecpu(int vcpuid); int fbsdrun_suspendcpu(int vcpuid); @@ -53,4 +56,9 @@ int fbsdrun_virtio_msix(void); typedef int (*vmexit_handler_t)(struct vmctx *, struct vcpu *, struct vm_run *); +/* Interfaces implemented by machine-dependent code. */ +void bhyve_init_config(void); +void bhyve_init_vcpu(struct vcpu *vcpu); +void bhyve_start_vcpu(struct vcpu *vcpu, bool bsp); + #endif From nobody Wed Oct 4 16:54:14 2023 X-Original-To: dev-commits-src-main@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 4S114Q72nGz4wH64; Wed, 4 Oct 2023 16:54:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114Q5yy7z3DMG; Wed, 4 Oct 2023 16:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438454; 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=R0IzUI5Gsvvgp7jvrtpnUFCJwgZEnJ02MnjW5Sna/NM=; b=cb/PrJdnjAXa0A0Cq8bL+yjrLrIHrfETm+garQmn+HsIp+7/xetNiHG48rrKaMk2Solu3V DcjGlTZJZNNMWD4wg7O9F7fv3WR/OUw842g3hv+A59bBibJwy0qcNe7IifS/S+7ChRnUKR t1j50gB/f/U+ZHApuF6TfS/vjvQM1ziV8195bWrtnhdn8AWjKkcwoIWNrodnL/zJY6B/7V yjgCqapyfU/IDHALDxcZAZ97Bg/x//aELr7YbzSYDHv68KPfQgH7pSnsrjRB3w2YGnQGm6 p5Kcs+zCzH0Oln5wh8TA2b4VfTkXMQ2N/95dHnLoh/QS2W97B44prMpTP4hhXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438454; a=rsa-sha256; cv=none; b=Q7pnQ2deBr0ULwewoYm+mD5h0J5Bdnp2f8Hd7BGx7BrSbwwB9d0vDscIyLEXLaqYJVDJeo NCFGkiNoRdemhrli3oBiPDxYGKb7j41Ve7wzUDksCtTp73OB43xKCVbyW6YS41XNiO+uBG arrMI1H/UXss0kYppDkiwp7Y3fgPWI8CsrXLjf8AUSuJ8HnG4jJY50bY2Jah0fbUuixNAM XqVCqikuXcvqlL+kiafXWXqX7xeO0k4nxErvNwLX2Pl57PTFW9r0L4KXEIjjtLxpk9iC4D pnA0R/CpkySKEsnYn8/LG4KssxEt/9lfXSgEULInyzge7rOGR2dm3xr0nwfzpg== 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=1696438454; 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=R0IzUI5Gsvvgp7jvrtpnUFCJwgZEnJ02MnjW5Sna/NM=; b=SbyHU1sGZp70LzGZlUHJyVl5SJRc0J65waNZYCX43hAqBqNIjIXT39AvwgzXC7KwhFBWGX g9dAWw1PPWyEFEu5Qyb2mSxCSMQux3RQiJP/ifOfKjt5S01TjdoYEhXBOExqQRhnGWUpXB bMBiGy8Gbtbs8dmtZzXK5PzTrS1C7fJEskKDr/5YMAdWWH+uXsrZYjjl/YrN42Z252swbX M5Fxkh7mX4xLbIQ0X3P4D1NOYv54g/QtAkXBnaTVBKNirKq8JZhhrv+wj3Bj6S1MPJHGGB ipidR403vjE/W3WOIunsWj9RrRtApJPcaGi29rUJktt8HUDrhacUclbUf9yAkQ== 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 4S114Q53w1zlxK; Wed, 4 Oct 2023 16:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GsELa038304; Wed, 4 Oct 2023 16:54:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GsEDH038301; Wed, 4 Oct 2023 16:54:14 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:14 GMT Message-Id: <202310041654.394GsEDH038301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f82af74c7603 - main - bhyve: Move most early initialization into an MD routine List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f82af74c76030029d4d8af95c29f2036a20796a4 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f82af74c76030029d4d8af95c29f2036a20796a4 commit f82af74c76030029d4d8af95c29f2036a20796a4 Author: Mark Johnston AuthorDate: 2023-10-04 16:27:54 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Move most early initialization into an MD routine Prior to initializing PCI devices, main() calls a number of initialization routines, many of which are amd64-specific. Move this list of calls to bhyverun_machdep.c. Similarly, add an MD function to handle late initialization. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40989 --- usr.sbin/bhyve/amd64/bhyverun_machdep.c | 62 +++++++++++++++++++++++ usr.sbin/bhyve/amd64/xmsr.c | 7 +-- usr.sbin/bhyve/bhyverun.c | 88 ++------------------------------- usr.sbin/bhyve/bhyverun.h | 2 + 4 files changed, 72 insertions(+), 87 deletions(-) diff --git a/usr.sbin/bhyve/amd64/bhyverun_machdep.c b/usr.sbin/bhyve/amd64/bhyverun_machdep.c index c6926abe61bc..40325a7f52c9 100644 --- a/usr.sbin/bhyve/amd64/bhyverun_machdep.c +++ b/usr.sbin/bhyve/amd64/bhyverun_machdep.c @@ -33,9 +33,21 @@ #include +#include "acpi.h" +#include "atkbdc.h" #include "bhyverun.h" #include "config.h" +#include "e820.h" +#include "fwctl.h" +#include "ioapic.h" +#include "inout.h" +#include "kernemu_dev.h" +#include "mptbl.h" +#include "pci_irq.h" #include "pci_lpc.h" +#include "rtc.h" +#include "smbiostbl.h" +#include "xmsr.h" void bhyve_init_config(void) @@ -123,3 +135,53 @@ bhyve_start_vcpu(struct vcpu *vcpu, bool bsp) fbsdrun_addcpu(vcpu_id(vcpu)); } + +int +bhyve_init_platform(struct vmctx *ctx, struct vcpu *bsp __unused) +{ + int error; + + error = init_msr(); + if (error != 0) + return (error); + init_inout(); + kernemu_dev_init(); + atkbdc_init(ctx); + pci_irq_init(ctx); + ioapic_init(ctx); + rtc_init(ctx); + sci_init(ctx); + error = e820_init(ctx); + if (error != 0) + return (error); + + return (0); +} + +int +bhyve_init_platform_late(struct vmctx *ctx, struct vcpu *bsp __unused) +{ + int error; + + if (get_config_bool_default("x86.mptable", true)) { + error = mptable_build(ctx, guest_ncpus); + if (error != 0) + return (error); + } + error = smbios_build(ctx); + if (error != 0) + return (error); + error = e820_finalize(); + if (error != 0) + return (error); + + if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) + fwctl_init(); + + if (get_config_bool("acpi_tables")) { + error = acpi_build(ctx, guest_ncpus); + assert(error == 0); + } + + return (0); +} diff --git a/usr.sbin/bhyve/amd64/xmsr.c b/usr.sbin/bhyve/amd64/xmsr.c index 99e758e84fff..7481df4669e7 100644 --- a/usr.sbin/bhyve/amd64/xmsr.c +++ b/usr.sbin/bhyve/amd64/xmsr.c @@ -33,12 +33,13 @@ #include #include -#include - +#include #include #include #include +#include + #include "debug.h" #include "xmsr.h" @@ -236,7 +237,7 @@ init_msr(void) cpu_vendor_intel = 1; } else { EPRINTLN("Unknown cpu vendor \"%s\"", cpu_vendor); - error = -1; + error = ENOENT; } return (error); } diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index f42db8147d54..8d9ad3750d43 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -71,52 +71,27 @@ #include -#include "bhyverun.h" #include "acpi.h" -#ifdef __amd64__ -#include "amd64/atkbdc.h" -#endif +#include "bhyverun.h" #include "bootrom.h" #include "config.h" -#ifdef __amd64__ -#include "amd64/inout.h" -#endif #include "debug.h" -#ifdef __amd64__ -#include "amd64/e820.h" -#include "amd64/fwctl.h" -#endif #ifdef BHYVE_GDB #include "gdb.h" #endif -#ifdef __amd64__ -#include "amd64/ioapic.h" -#include "amd64/kernemu_dev.h" -#endif #include "mem.h" #include "mevent.h" -#ifdef __amd64__ -#include "amd64/mptbl.h" -#endif #include "pci_emul.h" #ifdef __amd64__ -#include "amd64/pci_irq.h" #include "amd64/pci_lpc.h" #endif #include "qemu_fwcfg.h" -#include "smbiostbl.h" #ifdef BHYVE_SNAPSHOT #include "snapshot.h" #endif #include "tpm_device.h" -#ifdef __amd64__ -#include "amd64/rtc.h" -#endif #include "vmgenc.h" #include "vmexit.h" -#ifdef __amd64__ -#include "amd64/xmsr.h" -#endif #define MB (1024UL * 1024) #define GB (1024UL * MB) @@ -970,30 +945,10 @@ main(int argc, char *argv[]) exit(4); } -#ifdef __amd64__ - error = init_msr(); - if (error) { - fprintf(stderr, "init_msr error %d", error); - exit(4); - } -#endif - init_mem(guest_ncpus); -#ifdef __amd64__ - init_inout(); - kernemu_dev_init(); -#endif init_bootrom(ctx); -#ifdef __amd64__ - atkbdc_init(ctx); - pci_irq_init(ctx); - ioapic_init(ctx); -#endif - -#ifdef __amd64__ - rtc_init(ctx); - sci_init(ctx); -#endif + if (bhyve_init_platform(ctx, bsp) != 0) + exit(4); if (qemu_fwcfg_init(ctx) != 0) { fprintf(stderr, "qemu fwcfg initialization error"); @@ -1006,13 +961,6 @@ main(int argc, char *argv[]) exit(4); } -#ifdef __amd64__ - if (e820_init(ctx) != 0) { - fprintf(stderr, "Unable to setup E820"); - exit(4); - } -#endif - /* * Exit if a device emulation finds an error in its initialization */ @@ -1076,37 +1024,9 @@ main(int argc, char *argv[]) } #endif -#ifdef __amd64__ - if (get_config_bool_default("x86.mptable", true)) { - error = mptable_build(ctx, guest_ncpus); - if (error) { - perror("error to build the guest tables"); - exit(4); - } - } -#endif - - error = smbios_build(ctx); - if (error != 0) + if (bhyve_init_platform_late(ctx, bsp) != 0) exit(4); - if (get_config_bool("acpi_tables")) { - error = acpi_build(ctx, guest_ncpus); - assert(error == 0); - } - -#ifdef __amd64__ - error = e820_finalize(); - if (error != 0) - exit(4); -#endif - -#ifdef __amd64__ - if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) { - fwctl_init(); - } -#endif - /* * Change the proc title to include the VM name. */ diff --git a/usr.sbin/bhyve/bhyverun.h b/usr.sbin/bhyve/bhyverun.h index 39e0916f08ef..5fe97ca07f0b 100644 --- a/usr.sbin/bhyve/bhyverun.h +++ b/usr.sbin/bhyve/bhyverun.h @@ -60,5 +60,7 @@ typedef int (*vmexit_handler_t)(struct vmctx *, struct vcpu *, struct vm_run *); void bhyve_init_config(void); void bhyve_init_vcpu(struct vcpu *vcpu); void bhyve_start_vcpu(struct vcpu *vcpu, bool bsp); +int bhyve_init_platform(struct vmctx *ctx, struct vcpu *bsp); +int bhyve_init_platform_late(struct vmctx *ctx, struct vcpu *bsp); #endif From nobody Wed Oct 4 16:54:15 2023 X-Original-To: dev-commits-src-main@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 4S114S4TG9z4wHCm; Wed, 4 Oct 2023 16:54:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114S2rYMz3DMq; Wed, 4 Oct 2023 16:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438456; 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=S2UNEDC3uaM89fhmz8S2/c8u7mxkvLFKMy8QOaHnsTs=; b=g+dQ2MUa8FzJmVvWA+ejINI0rwRh+HVowOwEdvJhZhhH3QIICp2gOkOngYSYGUMZmO8N4s GIMQvZMukXdsWn7ej0AhdkXgcYcFdcsQr14zjm1mukUQy5RYuABLiXf93lN1snQNqQQRgt fBYukO/CrO1ntxWS2AmskQykq4JjvKJ7H9aA567thqPKxqz1k2/6OEhmQ9dUvsNB82IIeN bffUs5Ccw1ndec5hCyLBm96A2MpHqPYC/swcAVn1fInPhZreG4nOpcHN80UqQX3XZTSYfT jzqOSNtfnR9wclt8+lKtpzHNEDBNqomli81W9BiNg2XI4zivCYqEbYmEmvIKJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438456; a=rsa-sha256; cv=none; b=xD4P7O+fu+lXJXLgV2K6775gzbREBA7KlRQAishK3KCg6aPraD9C/0e8hZ3MvyouCv3pH6 C3bO95qcZeN4WFoST4c/+D9vWN8rCnC+DHDzJC2/NC0KbFFWYOJ4PyRouHL0ww6CeFL7x4 6AevmNnniRI9RZyD51+2UZAyQX7mteH9LhoK3mcheZMFLaYOKIduiFT92vlOmFPjmi2b8Y 0JwKLUG8qKpb5iKyPlIHnwUpOyF+cKPGnTWPmcqvv0E19VFESZL8YJn5LUy2OdWKHUf1S8 1UXbExRuoxI37kuTIO2gZKMka7QHHOhJLWqzz/9vN0cjU7sqpBmwc5zOqv6nJA== 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=1696438456; 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=S2UNEDC3uaM89fhmz8S2/c8u7mxkvLFKMy8QOaHnsTs=; b=C8XXglLzDKhHnVcEO2ei8LK4DVWAcaesejBua3aTLYC9uPmgXmHzA0Oqgk8deot1VKB/sO L6AbOzrseyAzO0XRpEujq9RE2KBRqyLNuYpGjEcd9kPpi9T2CBzd8lUy1A6dR+v6SJKgcw Y4OIYsEFqQXpsMdyVLDDqF+kcDEyBlJz0CkFB3swBCx//NbU1k66tDpdU7VVcv6jga0rj6 xTevK1rpTwtufH+ZgmOk0JKmGsL+5cX3v5OpjMWI8nBRLOSnoz8w0iuaeaVM4vtB0Csx7t nWBP5GROZbRc4qFzy4FP3dHzwitwDLPpXli/9b49ylc2F1VhvQ/TPiGIpGjUFA== 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 4S114R5wgqzlxP; Wed, 4 Oct 2023 16:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GsF78038364; Wed, 4 Oct 2023 16:54:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GsFw4038361; Wed, 4 Oct 2023 16:54:15 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:15 GMT Message-Id: <202310041654.394GsFw4038361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 83b003fbe965 - main - bhyve: Build the HPET ACPI table on amd64 only List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83b003fbe965869124706b4a80b212734152356d Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=83b003fbe965869124706b4a80b212734152356d commit 83b003fbe965869124706b4a80b212734152356d Author: Mark Johnston AuthorDate: 2023-10-04 16:28:28 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Build the HPET ACPI table on amd64 only There is no HPET on arm64 and vm_get_hpet_capabilities() is not implemented there. Move the vm_get_hpet_capabilities() call into build_hpet(): I cannot see a downside, and doing so eliminates a global variable and reduces the amount of code that needs to be conditionally compiled. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40990 --- usr.sbin/bhyve/acpi.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c index 4a3233291b7a..050e1a0ab75f 100644 --- a/usr.sbin/bhyve/acpi.c +++ b/usr.sbin/bhyve/acpi.c @@ -71,7 +71,6 @@ static int basl_keep_temps; static int basl_verbose_iasl; static int basl_ncpu; -static uint32_t hpet_capabilities; /* * Contains the full pathname of the template to be passed @@ -218,6 +217,7 @@ basl_fwrite_dsdt(FILE *fp) pci_write_dsdt(); +#ifdef __amd64__ dsdt_line(""); dsdt_line(" Scope (_SB.PC00)"); dsdt_line(" {"); @@ -233,6 +233,7 @@ basl_fwrite_dsdt(FILE *fp) dsdt_line(" })"); dsdt_line(" }"); dsdt_line(" }"); +#endif vmgenc_write_dsdt(); @@ -530,11 +531,18 @@ build_fadt(struct vmctx *const ctx) return (0); } +#ifdef __amd64__ static int build_hpet(struct vmctx *const ctx) { ACPI_TABLE_HPET hpet; struct basl_table *table; + uint32_t hpet_capabilities; + int err; + + err = vm_get_hpet_capabilities(ctx, &hpet_capabilities); + if (err != 0) + return (err); BASL_EXEC(basl_table_create(&table, ctx, ACPI_SIG_HPET, BASL_TABLE_ALIGNMENT)); @@ -551,6 +559,7 @@ build_hpet(struct vmctx *const ctx) return (0); } +#endif static int build_madt(struct vmctx *const ctx) @@ -720,14 +729,8 @@ build_spcr(struct vmctx *const ctx) int acpi_build(struct vmctx *ctx, int ncpu) { - int err; - basl_ncpu = ncpu; - err = vm_get_hpet_capabilities(ctx, &hpet_capabilities); - if (err != 0) - return (err); - /* * For debug, allow the user to have iasl compiler output sent * to stdout rather than /dev/null @@ -756,7 +759,9 @@ acpi_build(struct vmctx *ctx, int ncpu) BASL_EXEC(build_rsdp(ctx)); BASL_EXEC(build_fadt(ctx)); BASL_EXEC(build_madt(ctx)); +#ifdef __amd64__ BASL_EXEC(build_hpet(ctx)); +#endif BASL_EXEC(build_mcfg(ctx)); BASL_EXEC(build_facs(ctx)); BASL_EXEC(build_spcr(ctx)); From nobody Wed Oct 4 16:54:16 2023 X-Original-To: dev-commits-src-main@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 4S114T2VNcz4wH9h; Wed, 4 Oct 2023 16:54:17 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S114T0ZDBz3DN1; Wed, 4 Oct 2023 16:54:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696438457; 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=8lxM8k8BOlEhiakCGU7CAmiYXn8oC41zTeFxiuf/cbA=; b=cbhhxuUMiMzt3VFHV9GaDIupHfHrBehOkrVchJDGwmfgactkEga402lCKTFZ+otd6GycZo +Ua+n6ZR7J1h5XjO301bErGhZjGp5H4Bb5Rc6FxD6GEzaS1uokQJukZdxJdxTNmo33Pv68 lUxnIvMDatD82v1N3UfIX41ebgpqsRjnOXH/DXFfV6T5GrmD88UAs6ecsGYj3FiOiC4EFR t4BQ1KO03S7T8YAOOqG+J1Oc8JIFeRHK40Pqv2+kdgD9EhZClu9h/SAU0pcgBhaZTCHbxA anSk+FMRWE7+0BlcKirf1nq1xP1nBdDWuXHbIlPnSiSuB5/jGV1BqZHZSeQCpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696438457; a=rsa-sha256; cv=none; b=Dnvzs+sJTsfcyMiFn2NSmrO/rwMLH4L1Tx+LRZBJxcq7Lboyfchb6O9ql33bcUlJcIE3dG lsJtGlVPcEF7xqxAZQsA3yxMWLVSEE1Alauxzdm+wyqIhBr3IAd49lbh8MzeJ15ETPiZPp csE3TsomZ3C+VZlFVxIDVYv4JnDNyjqW1+bIT/HpS6WtGK0OmAJIzqpmucjL55mhUbX+qo gm5ucOh/Q/vZbMwtCvNuowftoBvZDI2xOv+WwBWKBC25Rd/splhCJGEXZjz3u/Uuh9Du3m oD3JgBixajb5jsCcKBFCeWpfQkaIDs9k3MK2HcL+9R+FGp2pz/MQpuVLaTV4EQ== 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=1696438457; 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=8lxM8k8BOlEhiakCGU7CAmiYXn8oC41zTeFxiuf/cbA=; b=QSQ4ZUFh78Zx/Q4uGOUxefvfB6J2jKjJ4U4B/B+MFROiTq1k2uFCOOHfDC8uLIkbYkiwii 2bTiziaObb9B00RjlN0s+jkCyALV92pCJ2VG1Uj9/H/bNX88V8lyOC71WU9Skp0lq/9NW2 x1cS+NvQd4XIJis2p9X5CzaD7u8otM2EszDuaJM3Fw88wwhxXR7DCmLSrcWk3FeK08/cRG xOW1RckFC69aT9PuayPbqCcLzXNXicuVzi2lDqvQ6P2Wa1Z8nX7vw+MYQl5qUPfzn6sSNk mTrFQ5K9tZz62NeHzT157z+N1OcbAP5zZUxZXdHtJmw9pzd97vx0zWOGa/6D0w== 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 4S114S6bh7zlmH; Wed, 4 Oct 2023 16:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394GsGaN038423; Wed, 4 Oct 2023 16:54:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394GsGkZ038420; Wed, 4 Oct 2023 16:54:16 GMT (envelope-from git) Date: Wed, 4 Oct 2023 16:54:16 GMT Message-Id: <202310041654.394GsGkZ038420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7228ad8da93b - main - bhyve: Move the vm_inject_fault() implementation to vmexit.c List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7228ad8da93bcce820c85b733972d0d9cc767d27 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7228ad8da93bcce820c85b733972d0d9cc767d27 commit 7228ad8da93bcce820c85b733972d0d9cc767d27 Author: Mark Johnston AuthorDate: 2023-10-04 16:29:07 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Move the vm_inject_fault() implementation to vmexit.c This function isn't generic and has a different signature on arm64. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40991 --- usr.sbin/bhyve/amd64/vmexit.c | 13 +++++++++++++ usr.sbin/bhyve/bhyverun.c | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/usr.sbin/bhyve/amd64/vmexit.c b/usr.sbin/bhyve/amd64/vmexit.c index 152fecaf424c..5d903d98f277 100644 --- a/usr.sbin/bhyve/amd64/vmexit.c +++ b/usr.sbin/bhyve/amd64/vmexit.c @@ -56,6 +56,19 @@ #include "vmexit.h" #include "xmsr.h" +void +vm_inject_fault(struct vcpu *vcpu, int vector, int errcode_valid, + int errcode) +{ + int error, restart_instruction; + + restart_instruction = 1; + + error = vm_inject_exception(vcpu, vector, errcode_valid, errcode, + restart_instruction); + assert(error == 0); +} + static int vmexit_inout(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) { diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 8d9ad3750d43..027042cf0c14 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -380,19 +380,6 @@ build_vcpumaps(void) } } -void -vm_inject_fault(struct vcpu *vcpu, int vector, int errcode_valid, - int errcode) -{ - int error, restart_instruction; - - restart_instruction = 1; - - error = vm_inject_exception(vcpu, vector, errcode_valid, errcode, - restart_instruction); - assert(error == 0); -} - void * paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len) { From nobody Wed Oct 4 18:21:34 2023 X-Original-To: dev-commits-src-main@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 4S131C0htYz4vm3j; Wed, 4 Oct 2023 18:21:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S131C0GdRz3VQN; Wed, 4 Oct 2023 18:21:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696443695; 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=CnBcRlL6RYeb3Z9TYp383a/LE4aQuhKpABbuezGWSu0=; b=VcizELk2dPjoPYBKdKbirMPvnM41LjDsxWi8BMZ5mu+hkaflDkoABkltJN1655ANlql5MJ INgPfkUrfBB39YJBfSWrCR81pAyHiGTxNx2Ly/choMBtvV6u8gOtWMWRLnuT8GsEnVAElq 3GHqfyCaCWdmvNoTCJjBXBLxgXXCVGZM0fVTggq8FqGcG705At4aizekfgziAuiF61iM17 Nr5e5PFzd4zzCtSRSbhKaqRJJMS7s31p4ob2+gmpTGCoILFwpk8lnEm2TZqqdtWP3KDd3R AIcAUu8jJAMttlqbh6SEq2/JWqy9QWuTRyD7uyr7hDgjxLIP3ENyBT1bk1zB2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696443695; a=rsa-sha256; cv=none; b=lra1GpeBLyIbZ/7U09TqRePP+cRBq+0rfy+sVkl9KfPIhxY8m3ox3Ple4sDSRS8TEuHpzV L2si1MU/kJ1d4u21kPRoSccG06CNuZarj9B7k8zcueMCCae7r6PgVMWJde4qHRZ9jg58IJ IloLc2emDwXyuG7+/JYdZmmwvZhNkbQqjBbrV6Qoh3nYCYlvdE65w58Jp5TF2uZfUWgN6z nyfMTSHINPDDk3eGcfPWcWkgIg3zP4K4GaYVibgUAw4LubXCphiANSnLa/trP1B4YDgkO9 6E0ORot1T/0Vwdj8jvzFTTTPdQpTc/hU/mUZ4qG22pim6+OXkNpfa/i2d3RsqQ== 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=1696443695; 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=CnBcRlL6RYeb3Z9TYp383a/LE4aQuhKpABbuezGWSu0=; b=KLBk6w/uECEMIs4rRX0ERCZsDWCxOhFIQG6Jpeoa5U0TdGt5CLPK4nlOidIZXpEJCpTfX8 hTBHBnYv7dFGJnGLOdX6egj1xGgSIXNk7BmXzj49ycylHI7ORs7w8fVbMDpKh4mw5i+Dq1 cyT/L2dQGFUmEVVT7543pzDOrddGDDNfj7G54KrFBLyF2jZSSmA4lVZn9PEm4maXI9xNPa N7+AA+7zHZNoBbzzy9EEgU2sdY9lR/nJ1fi1oc4NTAEKSHBYQVeKo7hAKkEudGlY5aSBFu DmSSJ7+t3jJq/wQUjRzzAhB4+Z8YoQbuoKI5H1AX0sBZXBjUxrhsp5Pba6JD2A== 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 4S131B6SK0znc9; Wed, 4 Oct 2023 18:21:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394ILYhQ085834; Wed, 4 Oct 2023 18:21:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394ILYSK085831; Wed, 4 Oct 2023 18:21:34 GMT (envelope-from git) Date: Wed, 4 Oct 2023 18:21:34 GMT Message-Id: <202310041821.394ILYSK085831@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 4fe779900b5d - main - linux(4): Deduplicate SystemV IPC defines from amd64/linux List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4fe779900b5d9359969426d44679d28d3178604e Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4fe779900b5d9359969426d44679d28d3178604e commit 4fe779900b5d9359969426d44679d28d3178604e Author: Dmitry Chagin AuthorDate: 2023-10-04 18:18:45 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-04 18:18:45 +0000 linux(4): Deduplicate SystemV IPC defines from amd64/linux MFC after: 1 week --- sys/amd64/linux/linux.h | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index 4603835e15e6..918b9129f47b 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -188,34 +188,6 @@ typedef struct { #define LINUX_MS_NOEXEC 0x0008 #define LINUX_MS_REMOUNT 0x0020 -/* - * SystemV IPC defines - */ -#define LINUX_IPC_RMID 0 -#define LINUX_IPC_SET 1 -#define LINUX_IPC_STAT 2 -#define LINUX_IPC_INFO 3 - -#define LINUX_SHM_LOCK 11 -#define LINUX_SHM_UNLOCK 12 -#define LINUX_SHM_STAT 13 -#define LINUX_SHM_INFO 14 - -#define LINUX_SHM_RDONLY 0x1000 -#define LINUX_SHM_RND 0x2000 -#define LINUX_SHM_REMAP 0x4000 - -/* semctl commands */ -#define LINUX_GETPID 11 -#define LINUX_GETVAL 12 -#define LINUX_GETALL 13 -#define LINUX_GETNCNT 14 -#define LINUX_GETZCNT 15 -#define LINUX_SETVAL 16 -#define LINUX_SETALL 17 -#define LINUX_SEM_STAT 18 -#define LINUX_SEM_INFO 19 - union l_semun { l_int val; l_uintptr_t buf; From nobody Wed Oct 4 18:21:35 2023 X-Original-To: dev-commits-src-main@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 4S131D23JQz4vm60; Wed, 4 Oct 2023 18:21:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S131D1QRhz3VFY; Wed, 4 Oct 2023 18:21:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696443696; 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=7QxVIxQ1EFZ483T7JbeXRTWUYQp3AW5CVZxRfNwvvgU=; b=LJ08NgFjyHAnS6MQ0th0GbT26EKmzNClKmnT1SNZoLHi6kIq889ZTa3TybPpiQd3oNYMpv FTqVGk4crW3U9VxWO7r48lpxAZClNVT466nLUoI9EDW4e4J3I2oo5pyRm5PFE7zFBJc9qf S4C0aamC73MxoJTuu1O1numdzceP4k/oeAhnlRuXHRs5AqydD/IdU228TymZy81Ryw5Mbl l7rtIgXQnVD9BvYkDIYxdTORnVeZuqrTGTmWIO9Cz6wTvm/qb3dgXU0YpuAM39O7tKd8TG 0dFEdxhHwMIfk4PS8Wn2+pTt3kgNAp8z7QPFhVNDZWsPziXAV+4pSXgacc9s9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696443696; a=rsa-sha256; cv=none; b=ESkc7EGRItPc2BLtmrAODKicpuYfjJAJysXgunV9qXZtFhr/15lxBb3hdPJdMUCha8j48S JXT0WVUdjUUVdMMMseaeMtcviZguyomGPkp+yx+97j7etrr14mGNCBjo6aZWOdaM0Oi9ir AZZ1XsRQMfQ9Nv76GAEH6UmuCzKvSdd7GeN9VS8hPswUhs6eh9YJnK9TPncVyKJfshwzgH CmhR7FPh4GxaofMLnI4FJOPvXcG5O0/j4P4X47L20W7l0TWkfeBksq9z0nKZI4I70Qb2hs OEwA6ZAbCayAfWHf7AjysqVp3/JrsDI7QOqc/CBuTSkitru6YCYlBFEDHX55ig== 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=1696443696; 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=7QxVIxQ1EFZ483T7JbeXRTWUYQp3AW5CVZxRfNwvvgU=; b=mgghZgffsYuUhLoDNzbWGOO9LVpDmEcczvjoXiN1ZPNrFsMpUZadocuwdQi5EKrHvMpwSR sNNkIf7zkbjQud1dilx8vx6VQwrVacqMnOL/VpTrPHFSUquRQ8lW3qUm4QlmWasvykyUY+ OY7ymMadvZKa8NeKnMEFPrIBUXL0J97VgS/L/q/DjGVyA/PcmlkCtRiIugI4Q6/JUlsz1b Dq6n0pef/w9KScRS0m9Omr2Hn4xbOkBGBwXFrm4YbhoHBTTE/lebRb+PFC9Thr19EWNXI0 RbfV9dIroTcHsh+LGFgClE35g/y5B/2I/wnWLhn7Zt1y5/offPO0XCFz6qOetA== 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 4S131D0MrKzncB; Wed, 4 Oct 2023 18:21:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394ILZcL085880; Wed, 4 Oct 2023 18:21:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394ILZJA085877; Wed, 4 Oct 2023 18:21:35 GMT (envelope-from git) Date: Wed, 4 Oct 2023 18:21:35 GMT Message-Id: <202310041821.394ILZJA085877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 1ee29160c5e5 - main - linux(4): Fix semid64_ds structure layout List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ee29160c5e5d8fa70173445b4a6de6742af74dc Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=1ee29160c5e5d8fa70173445b4a6de6742af74dc commit 1ee29160c5e5d8fa70173445b4a6de6742af74dc Author: Dmitry Chagin AuthorDate: 2023-10-04 18:21:12 +0000 Commit: Dmitry Chagin CommitDate: 2023-10-04 18:21:12 +0000 linux(4): Fix semid64_ds structure layout Unlike x86_64, other 64-bit architectures do not have paddings for the time fields. MFC after: 1 week --- sys/compat/linux/linux_ipc64.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linux/linux_ipc64.h b/sys/compat/linux/linux_ipc64.h index 75563c55971c..e3834b909bfc 100644 --- a/sys/compat/linux/linux_ipc64.h +++ b/sys/compat/linux/linux_ipc64.h @@ -101,9 +101,13 @@ struct l_msqid64_ds { struct l_semid64_ds { struct l_ipc64_perm sem_perm; /* permissions */ l_time_t sem_otime; /* last semop time */ +#if defined(__amd64__) || defined(__i386__) l_ulong __unused1; +#endif l_time_t sem_ctime; /* last change time */ +#if defined(__amd64__) || defined(__i386__) l_ulong __unused2; +#endif l_ulong sem_nsems; /* no. of semaphores in array */ l_ulong __unused3; l_ulong __unused4; From nobody Wed Oct 4 19:19:42 2023 X-Original-To: dev-commits-src-main@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 4S14JH1Sdxz4vwSg; Wed, 4 Oct 2023 19:19:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S14JH11R5z3f5v; Wed, 4 Oct 2023 19:19:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696447183; 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=nSrFfG6KvvYWBed5NsRv22Ut14/5opTsGKII3onS9AM=; b=VK3vrwLZ5cUALddVC80nAXzxCumUd8wwIFp9V/pUnMX9cnuLS2CV6MmthTRROfeiAAeoxI hRsd3ztNgNiag60BZny8PFEPogYpG7TYqBLIJdDqh3BWexpglnsHeMnmU5ksdLpak4TSMg 0ENl7qrgMf/obv/R5kh4pc+O9dJGwiVUGKF+xZxt5UGbxfXKdy29EI3/7pgLzEayjpXaRS YNc9j5YJa01FBBaYhJQqoWmVqghCAkjnF47qy0gkOhqlXHJQ8qWlyKCwFhsBAK2hecya8w QZ2Wx7wTjMP8EvDb4s6QknvM4WAd5dJBRFdsrXChd/4/cXTSzy9mBK2nvm9CcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696447183; a=rsa-sha256; cv=none; b=XylOG+ScYvKmaBYReTszp4ekcyEZYGJ1z7sT0Xy3wIhiFqMny0dck3jvpCz1l8YF0rKCc4 UZfvhG+24HWpSlLd6xaeEdvgv5cifiXeFRqV0P9CEDUMp8ES1IU5F8FYX6zgH2RLDiGmJY R2Rw+c9reE3/DUOIuLEng11LwLDXkZBh24edmBdsHYsvblQhw0Ue9bfeEJr+EhPEuZEAaB yXfBtD+qqd/Vh0N93C/Rpg8B26re1CxrvVzFidVity01lfiF+Bm1DEoUTkFInd5T3pHhJa qSfNMNR+MijQzo3TwU1GAnHNvwipf38juKvSDqDzITv6fuRTyaNZO32e7QOc0w== 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=1696447183; 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=nSrFfG6KvvYWBed5NsRv22Ut14/5opTsGKII3onS9AM=; b=tU3eSOW1uIkeyqFYqFZLtq2ZJQUVC8JZjDJ55xT4L5g11KvwjfacmhxeOiLfSwCmUh+doY Elo+YrjPUtXcYMmHYDe0CL/LIWJ8dPTRJkCzH2oM0uhojYAxlczwERSmJOzXoP+5ukdZW/ ymFWJYLJFoJulJ6njNiTjm1wfWevoDqqPF7Kcft1GakzfRjdDO2horCY4gNYyn71j47MKL 707eNSSc1JuwCw1Fv+yA01VzoXvjvDnNKF97Q83QuE614xkPAVZ96dslyzSwAAcIWog9Dy xEFXMbEzCUG6vczkPDMhd5XHdvTBMjUEy2Jeu5DLGsMYjCAxh+cJMveImKto0w== 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 4S14JH04B2zptD; Wed, 4 Oct 2023 19:19:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394JJgET073152; Wed, 4 Oct 2023 19:19:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394JJgUE073149; Wed, 4 Oct 2023 19:19:42 GMT (envelope-from git) Date: Wed, 4 Oct 2023 19:19:42 GMT Message-Id: <202310041919.394JJgUE073149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 8818f0f1124e - main - TCP: Fix a rack bug that skyzall found which results in a crash. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8818f0f1124ea3d0e8028f85d667237536eba10c Auto-Submitted: auto-generated The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=8818f0f1124ea3d0e8028f85d667237536eba10c commit 8818f0f1124ea3d0e8028f85d667237536eba10c Author: Randall Stewart AuthorDate: 2023-10-04 19:16:01 +0000 Commit: Randall Stewart CommitDate: 2023-10-04 19:16:01 +0000 TCP: Fix a rack bug that skyzall found which results in a crash. So when we call the fast_rsm retransmit path, we should always move snd_nxt back up to snd_max. In fact during ack-processing if snd_nxt falls behind it should be moved up there as well. Otherwise what can happen is we have an incorrect mark on snd_nxt and incorrectly calculate the offset when we go through the front path (which is what skzyall was able to do) then when we go to clean up the send the offset is all wrong and we crash. Special thanks to Gleb for pointing out the problem and the email that had the reproducer so I could find the issue. Reported-by: syzbot+f5061a372f74f021ec02@syzkaller.appspotmail.com Sponsored by: Netflix Inc --- sys/netinet/tcp_stacks/rack.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index a6e649f78c10..5c16cb9ed23b 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12342,8 +12342,8 @@ rack_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so, if (SEQ_GT(tp->snd_una, tp->snd_recover)) tp->snd_recover = tp->snd_una; - if (SEQ_LT(tp->snd_nxt, tp->snd_una)) { - tp->snd_nxt = tp->snd_una; + if (SEQ_LT(tp->snd_nxt, tp->snd_max)) { + tp->snd_nxt = tp->snd_max; } if (under_pacing && (rack->use_fixed_rate == 0) && @@ -16363,8 +16363,8 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb /* Send recover and snd_nxt must be dragged along */ if (SEQ_GT(tp->snd_una, tp->snd_recover)) tp->snd_recover = tp->snd_una; - if (SEQ_LT(tp->snd_nxt, tp->snd_una)) - tp->snd_nxt = tp->snd_una; + if (SEQ_LT(tp->snd_nxt, tp->snd_max)) + tp->snd_nxt = tp->snd_max; /* * If the RXT timer is running we want to * stop it, so we can restart a TLP (or new RXT). @@ -19112,6 +19112,8 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma lgb->tlb_errno = error; lgb = NULL; } + /* Move snd_nxt to snd_max so we don't have false retransmissions */ + tp->snd_nxt = tp->snd_max; if (error) { goto failed; } else if (rack->rc_hw_nobuf && (ip_sendflag != IP_NO_SND_TAG_RL)) { From nobody Thu Oct 5 02:28:56 2023 X-Original-To: dev-commits-src-main@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 4S1FqX6vkPz4vtJG; Thu, 5 Oct 2023 02:28: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1FqX6NKJz3Qlr; Thu, 5 Oct 2023 02:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696472936; 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=OHfKCR01GRKH4YhPXmfQegIeLF6xNLIbDqMHa1VG+2Y=; b=oTLQZTxmXVyjkX2oktyuh3XGpPVjB3Go2N30vcrEVHtKr3rcEREjwLrrnkEAuKsPQ0X8bB lCr6uCXiVfbyw5EKUHlXCYtQVSWQyH6943ZzAXbSkMxN8Lc0sRmRGHAW14GMPNhj06J22g X6aCleJDzYV7d3YPVgpw9PaE42IzKJxqZnZwhVg7O60lJqu2bc0aKrAyjvUJwpfBl0GX29 EIJdqc6lJl21MQWDmOVz4rc6oBtQl3eIgex6qjQuaaW/17gJusR4mqXAHLhyBJMPm+qa/e TxqItY29JAUuXajTV4TvF7D0uiOqA1sqWqZfRU5Q9cSjvzjkW68b1+WHJ0EeMA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696472936; a=rsa-sha256; cv=none; b=cqFSnUy3TsDAHmHINHHwb3AthG0Uhx1CMLRSpyQ1n/uMXWJhQUpQJebMAnnOvedyFgpeiM KwSkrElQSsdQNClPbkmd8bCkM0MY4X79HjRjRZN8el4/yaRZ1jhPIGYCd+86BWmhIlbZyi /N12AGQW1mP5yJYdd3pZsWGeeZq//t16wl3I/VetBxZB2V/AS9mvQF+KJZdG0z3wfVgJ40 xmmsLrAoAlBqWPm/29wHuHn0CtGu8jswKytenORaUdeKzdhQ+4r5H5sDhXEZ4qDXGl3j1a 2KuEX4Mlaum3R5JUzr2jF6Omh74XhHUsTOhCT3zlRJRToDABDciNoRRZYEaZvQ== 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=1696472936; 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=OHfKCR01GRKH4YhPXmfQegIeLF6xNLIbDqMHa1VG+2Y=; b=ZIfRYhk51P1I8v7V0qFJvRXiaWgw4Z19v5cZY+L8QSaaBgktWlKDTL0iwEG4FUJ7DXclo9 XVKg9NZ2zqkX8Mz0V+RY8B7zPtBglbY3JSAHoxrqryHp0axQchpIAULYQqtXCju18cHMRC fLVJkX2QzSY/R2+cPrhO6tck5FxA3vjuGdtVjqZ79tkEhZcYAB584OmLZjlmbvfaW1LxI7 rCiJrJkGiIvGQjoPX6WEOVFEgjnKy4W4I6G2QNEocP4tyESlDLqON++byEsqkEr7ZK+KAI tVBNZZegwzhzhM2fH5r843Rvcu2YL/CHPhMUgEGQ9tKJDFFxdia/iPx4ZQ8s2Q== 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 4S1FqX5Qrfz132K; Thu, 5 Oct 2023 02:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3952SuCr095191; Thu, 5 Oct 2023 02:28:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3952SuUi095188; Thu, 5 Oct 2023 02:28:56 GMT (envelope-from git) Date: Thu, 5 Oct 2023 02:28:56 GMT Message-Id: <202310050228.3952SuUi095188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 9b03a5de73d4 - main - bectl: fix some `mandoc -Tlint` complaints List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b03a5de73d41f98b9b3c8e250a58f62f3e48d61 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9b03a5de73d41f98b9b3c8e250a58f62f3e48d61 commit 9b03a5de73d41f98b9b3c8e250a58f62f3e48d61 Author: Kyle Evans AuthorDate: 2023-10-05 02:26:55 +0000 Commit: Kyle Evans CommitDate: 2023-10-05 02:26:55 +0000 bectl: fix some `mandoc -Tlint` complaints The EXAMPLES mis-comments caused an obnoxious amount of blank space above SEE ALSO when rendered by mandoc to a terminal. The missing termination of .Xo meant the description of -h ran together with the subcommand synopsis. The other changes were generally ignored tags due to context that simply don't need to be there. Provoked by: grahamperrin --- sbin/bectl/bectl.8 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sbin/bectl/bectl.8 b/sbin/bectl/bectl.8 index 718f4e2597ae..19cd867df56b 100644 --- a/sbin/bectl/bectl.8 +++ b/sbin/bectl/bectl.8 @@ -15,7 +15,7 @@ .\" .\" @(#)be.1 .\" -.Dd June 28, 2023 +.Dd October 5, 2023 .Dt BECTL 8 .Os .Sh NAME @@ -114,12 +114,12 @@ For instance, booting into the recovery media and manually importing a pool from one of the system's resident disks will require the .Fl r flag to work. -.Pp .Ss Supported Subcommands and Flags .Bl -tag -width activate .It Xo .Fl h | .Fl \&? +.Xc Print usage information. .It Xo .Cm activate @@ -396,7 +396,6 @@ will force the unmount if busy. .Pp Unmount will not remove the mount point. .El -.Pp .Ss Boot Environment Structures The traditional .Fx @@ -482,11 +481,11 @@ A future version of may default to handling both styles and deprecate the various .Fl r flags. -\" .Sh EXAMPLES -\" .Bl -bullet -\" .It -\" To fill in with jail upgrade example when behavior is firm. -\" .El +.\" .Sh EXAMPLES +.\" .Bl -bullet +.\" .It +.\" To fill in with jail upgrade example when behavior is firm. +.\" .El .Sh SEE ALSO .Xr libbe 3 , .Xr zfsprops 7 , From nobody Thu Oct 5 07:31:30 2023 X-Original-To: dev-commits-src-main@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 4S1NXf43Rnz4wgPF; Thu, 5 Oct 2023 07:31:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1NXf3bzHz4W7h; Thu, 5 Oct 2023 07:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696491090; 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=WMoiyZp6+CKg400UNLzRpeh4LvVJNWBkGBWRzCVUUPE=; b=xvw8O8EX3O0aFHLC8FzeM2FtOm8UGjEL5M1K0fKHLZVCJMA+KvEKJtOGCcyZWBs8L//YIT ntisB2vWWcViXzbot4QwA5I6uyw9rucqN5gPicnbBCXkBoTwK3svx8Pf8+dhRgXtusEkF7 7pbfBI+0KU2M29cxylnzYPOi4s5JWuaiX7Deu28lKfS1XEAfh/EDhWgDnPgsVksoCy7NsJ i0jnrCkrqk787I+hutKdKnzH/GdhgE3NimSL7XT/uxGG7ez0P3tyXBtGqnMCW3qBEsPEYV dtks3WOPND3kE5oD3iBGL3wS16G3KKXz2O8gmwfG+V67iRxYXFnSXZ5oxx7Bjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696491090; a=rsa-sha256; cv=none; b=P4zRqk8dTuRM4nEUOoD/VP/JN3ig/fh33AkFdD85blNL+X7z+Z9wuGxGTCb0a3rWYxhPp2 wEG2nT8zFT0eHawgrKQrG+NBfJc3Lqil3tSX0jrtQtwhJ3GAVzadRYvj00QT6M9+p+ipYD Fa8KwHwO7ljyTo0MydaOjOVGAEYo1nzbPhw3qFNV/k/A5/6N2wVBwQfvAL270cTdA+GXdI c/9w39m+IdELrfDs8nwlKJjeUdyjS3Q2KJRM60DDu7SyPDgdcQuITfVoTavlI0xfNmurxN 5jG/qh4MM5idazfJOdRfQANvTdfNw62ViklZtNTIt0uKg9aHXkHyGfzdLL0MWw== 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=1696491090; 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=WMoiyZp6+CKg400UNLzRpeh4LvVJNWBkGBWRzCVUUPE=; b=eZE6apBUK7THxoIlOH9+SFtZUBRcOEQUjo22lxjcfwuFNimc5trWRrJswJNQv62tlnc+zN 6WNu1ktZwg70BdvNCeX81XbiC9ndYVwOeCbNDKcVZnWNZX0dYr+txMj8RXLlKlNXwToFzR CVtBnXtTSf4ilgMpAsJT8Giy8xiv4vhVm9+IcDQWOVmRVz0O6oFlXMY4qNaHD9wB7TOlTi ia0FDqK9mMYg5D4/TH3g/jBb9KVHlstgNdvA1GDz2pKPOAKncTzTZb6HnC5ac+7yeOBZt2 uvbpFYqQPuJ0Ok8AZuR9Y6X4OWkF8THyTvPSqC/ifWnaYZC0gXJU4ZPD2Mj2TA== 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 4S1NXf2fbhz1B5h; Thu, 5 Oct 2023 07:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3957VUNF003299; Thu, 5 Oct 2023 07:31:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3957VUPl003296; Thu, 5 Oct 2023 07:31:30 GMT (envelope-from git) Date: Thu, 5 Oct 2023 07:31:30 GMT Message-Id: <202310050731.3957VUPl003296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 30e9abf2fc46 - main - bsdconfig(8): add bsddialog(1) support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30e9abf2fc462084b752064fa814d90ad3161352 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=30e9abf2fc462084b752064fa814d90ad3161352 commit 30e9abf2fc462084b752064fa814d90ad3161352 Author: Alfonso S. Siciliano AuthorDate: 2023-10-05 07:29:12 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 07:31:18 +0000 bsdconfig(8): add bsddialog(1) support Add bsddialog(1) to bsdconfig(8). This can be considered an increment not a replacement, `$DIALOG=dialog' restores dialog(1). Differential Revision: https://reviews.freebsd.org/D37480 --- usr.sbin/bsdconfig/share/dialog.subr | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index 5b7ae9123073..0b6f11f39134 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -51,7 +51,7 @@ f_include_lang $BSDCFG_LIBE/include/messages.subr # Default name of dialog(1) utility # NOTE: This is changed to "Xdialog" by the optional `-X' argument # -DIALOG="dialog" +DIALOG="bsddialog" # # Default dialog(1) title and backtitle text @@ -79,9 +79,15 @@ DIALOG_OK=${SUCCESS:-0} DIALOG_CANCEL=${FAILURE:-1} DIALOG_HELP=2 DIALOG_EXTRA=3 -DIALOG_ITEM_HELP=4 -export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1' -DIALOG_ESC=255 +if [ $DIALOG = "bsddialog" ]; then + DIALOG_ITEM_HELP=2 + DIALOG_ERROR=255 + DIALOG_ESC=5 +else + DIALOG_ITEM_HELP=4 + export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1' + DIALOG_ESC=255 +fi # # Default behavior is to call f_dialog_init() automatically when loaded. @@ -2221,7 +2227,14 @@ f_dialog_init() # # Process `-X' command-line option # - [ "$USE_XDIALOG" ] && DIALOG=Xdialog USE_DIALOG= + if [ "$USE_XDIALOG" ]; then + if [ $DIALOG = "bsddialog" ]; then + DIALOG_ESC=255 + # else it is already 255 like dialog(1) + fi + DIALOG=Xdialog + USE_DIALOG= + fi # # Sanity check, or die gracefully @@ -2229,7 +2242,7 @@ f_dialog_init() if ! f_have $DIALOG; then unset USE_XDIALOG local failed_dialog="$DIALOG" - DIALOG=dialog + DIALOG=bsddialog f_die 1 "$msg_no_such_file_or_directory" "$pgm" "$failed_dialog" fi @@ -2261,7 +2274,7 @@ f_dialog_init() if ! f_have xauth; then # Die gracefully, as we [likely] can't use Xdialog(1) unset USE_XDIALOG - DIALOG=dialog + DIALOG=bsddialog f_die 1 "$msg_no_such_file_or_directory" "$pgm" "xauth" fi HOSTNAME=$( hostname ) @@ -2283,12 +2296,13 @@ f_dialog_init() then # Xdialog(1) failed, fall back to dialog(1) unset USE_XDIALOG + DIALOG=bsddialog # Display the error message produced by Xdialog(1) local height width f_dialog_buttonbox_size height width \ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$maxsize" - dialog \ + $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --ok-label "$msg_ok" \ From nobody Thu Oct 5 07:55:33 2023 X-Original-To: dev-commits-src-main@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 4S1P4Q0yMBz4vlNR; Thu, 5 Oct 2023 07:55:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1P4P6ZQsz4XlD; Thu, 5 Oct 2023 07:55:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696492533; 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=nNAzmby5bGsRw3sNU6rgTdUC/XfoBkR4r+8xMA2s1xA=; b=VydB10uNGdcxN5ii+rqVytfKPptkjapKZ4DiAsnserROOFo34OVEJiGlitAMwJNQMHEzVg Le+JO/StzmA2lIhGqISqO1IHlnst5D0kcAiZ1uw7JyupUIDKpltkPpCOyP1iFH/TepvWin eNwGLLWXIyWSXX4PoZkd8arXEYS5e3rB7Qv/1r4Sil6VkYDtx/sWfPzsG7hhWm2yNAKe8G XeY1WhBRQ+MbWDFmflJJiawtfKhVzdWfGGPUGOmgCirC0WfaCrUqSS5qiCvREOAEqD/bB7 4po1tNOjABgbzpiVotnAHaOkFpooC0FDA7tyyih9CZTZfovMTgJw+Q23YwnkLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696492533; a=rsa-sha256; cv=none; b=MiR+2CITfPZfMMczk0+oepCJX+EbF4cGE7vQnChVsMyPEZucohDzpLoobhHKMYfOGskMii iWUEAxnu1kuesiXgfpL5T2LXzzSkWrMXPm2iR8H1B8SremAWOPweARP9+k5jxACzK8QGls 1EXQySlpkrhGZhYhh+QVtu+xk1Xu+HLkcsT+S6huwcVoGZLpBkMSLN+0cp2uqAeErryunt CrRV6ifakHd3APukUL0eTLB0sxO8TksykN78LM33nctQgTjjRZTvt9Ad1vL+Xxxxfx2EJN 2zLzlLpMknwESE5dSpuLZ1fphk1ng5fVWGv9TXJkbnxg9+lr+PTqvwwa+kx4Dw== 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=1696492533; 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=nNAzmby5bGsRw3sNU6rgTdUC/XfoBkR4r+8xMA2s1xA=; b=L8Wm2UdDl/ojOuYN+mbh9RG5Qv0eAC+/MmO53ZXzv5lfxGjJE4ke6NhANHNpRK/1UxBX0W kxDTvgngWXM4vRKK2KSjIgTDYZBR39kUNMRNpsyLnAsLKJyuko72ZN4RTc0OjX9LWhboSm 4W9Bi7qZ9GSz9E6qL5OfukGhmbtxa5pu0/LQCVYE0M9+gJzfrj1MlEc0VMSlPjnzHM+BRF cOBlzZWco8fgznduaLZiWHclW/dwe8u5Sien21vmiJz0TYo4DOU/ZjumORlYo9jFPt98DS ayG3/XZxzeF14Tc35kmaJjuLJVOnXHvcCaAI6oXWlWe2qmhqEL7ASVjUWOqvog== 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 4S1P4P5gHyz1Brm; Thu, 5 Oct 2023 07:55:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3957tX61042666; Thu, 5 Oct 2023 07:55:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3957tXDo042664; Thu, 5 Oct 2023 07:55:33 GMT (envelope-from git) Date: Thu, 5 Oct 2023 07:55:33 GMT Message-Id: <202310050755.3957tXDo042664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 5b9f08dbc7a4 - main - bsdconfig: always build and install List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b9f08dbc7a4a08117ebf2b4a0c9046bda571f95 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=5b9f08dbc7a4a08117ebf2b4a0c9046bda571f95 commit 5b9f08dbc7a4a08117ebf2b4a0c9046bda571f95 Author: Baptiste Daroussin AuthorDate: 2023-10-05 07:51:16 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 07:51:16 +0000 bsdconfig: always build and install it does not depend on dialog(1) anymore --- usr.sbin/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index ca8b87a134eb..bdc45c87e3bc 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -6,6 +6,7 @@ SUBDIR= adduser \ arp \ binmiscctl \ boottrace \ + bsdconfig \ camdd \ cdcontrol \ chkgrp \ @@ -128,7 +129,6 @@ SUBDIR.${MK_BSNMP}+= bsnmpd SUBDIR.${MK_OPENSSL}+= certctl .endif SUBDIR.${MK_CXGBETOOL}+= cxgbetool -SUBDIR.${MK_DIALOG}+= bsdconfig SUBDIR.${MK_EFI}+= efivar efidp efibootmgr efitable efiwake .if ${MK_OPENSSL} != "no" SUBDIR.${MK_EFI}+= uefisign From nobody Thu Oct 5 07:55:34 2023 X-Original-To: dev-commits-src-main@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 4S1P4R108Qz4vlNS; Thu, 5 Oct 2023 07:55:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1P4R0NM9z4YCh; Thu, 5 Oct 2023 07:55:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696492535; 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=tYzWS0bg6owQ5VttukqtBPyfYMEZ3fcQTGDgEehKgcw=; b=dXSzT3j2UCT7zvV9h2LGPP9SdyuZHHoT568H1984hF9EIEDCRgwg4qUmVQWl/4GYmFvYFy uZya9mCE7Bq4ykVaoeMmlShmhkkFDlK44KjYXq54z8ykebZYE+GXsrwtkaON3mQ5YwSi7Z zLbcc3eI53ucvHH7FkUMZJ+U+HTrs/UeUvrrl1C3PR/Y2jKyK87r3ggci+d7hZMYXzR3KX 9ZcNMqAX14oiaNlbj93PP5mUoAEEHEEP5gZAmTLulvGbGFgisUmn0hnL4Fwe+dxOYVJwhQ uTkgLiiG471rRdnoGkCyCC3Qr/h5veYfOT9PcjfFEfrd+O6bp+9HmtZIoZmSZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696492535; a=rsa-sha256; cv=none; b=jRHUf7MMRBV1QjZM3Ni3cSZLKXVW52mg57FxMrFok0k0ulWXCyX0KfFnaYljREJdGmhh3f YVxUcGPJ4iJnKomBjg3y4By4kZJVHWUstBEhiSL82+qkmF0laDRlgjysvOLiINbMe0WBuM nUve6HQz68RkFfIfFJS9pL4ObGtMPeNl8byT63Fk0prq/Oy6qSDnUjiF32/8nDMP9e53Wy pBs+3465VggHkv1UcMad2+rsPCpXoTe4xnybVo9uK2GMs7gnnN4CIf5H2W+YiP1TcZNbcH 5KuEYeMNUFmvwFdyQ9k4awRi0KC45c3FZPvev3ptRqyS80ux6RgoyXQrr2/umw== 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=1696492535; 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=tYzWS0bg6owQ5VttukqtBPyfYMEZ3fcQTGDgEehKgcw=; b=BsxVhvPh+6tOK7p3gwKC4gM6a1DeTKsC45dcWBrJeJw5/OkNbEjrrTOB6U3QutsdXvfJA4 c1sfZaLfGWDSKhdjnzw6QMNe/L/9VZ8XMBUqmybtF79P4cPyuTuhm1Pw1CM8wMqHn+I6Ov nNX9gSmszbGy7+SJBk1hR+FqJSkQevzUxiUWbI0f06uHiPbMn3OolfFgDggq2zF4x1y6bt 8lnEU5eAFv9otU2STl8vjXbwSXicxyT0ARvAhGXp32JiQ1aDIgsR7pPm7bDyWlKmnBtmWq HK1c7aGzDr2DVJwO27nd8eTAkFtDoz2BZl3LT298jP+yCcsfRhyE/rBcMjDgMA== 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 4S1P4Q6QpKz1C1q; Thu, 5 Oct 2023 07:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3957tYu9042712; Thu, 5 Oct 2023 07:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3957tYR9042708; Thu, 5 Oct 2023 07:55:34 GMT (envelope-from git) Date: Thu, 5 Oct 2023 07:55:34 GMT Message-Id: <202310050755.3957tYR9042708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 166a655fcf13 - main - bsdinstall: decouple from the MK_DIALOG option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 166a655fcf136fac9e461f3201a52dd4a959a6da Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=166a655fcf136fac9e461f3201a52dd4a959a6da commit 166a655fcf136fac9e461f3201a52dd4a959a6da Author: Baptiste Daroussin AuthorDate: 2023-10-05 07:54:20 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 07:54:20 +0000 bsdinstall: decouple from the MK_DIALOG option bsdinstall does not depend on libdialog(3) or anything using libdialog(3) for a while now, it does not need to depend on MK_DIALOG anymore --- share/mk/src.opts.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index c234a9829fca..16b2433244da 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -404,10 +404,6 @@ MK_KERBEROS:= no MK_KERBEROS_SUPPORT:= no .endif -.if ${MK_DIALOG} == "no" -MK_BSDINSTALL:= no -.endif - .if ${MK_DTRACE} == "no" MK_CTF:= no .endif From nobody Thu Oct 5 09:54:42 2023 X-Original-To: dev-commits-src-main@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 4S1Rjt4XSnz4w7Pq; Thu, 5 Oct 2023 09:54:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1Rjt41Rnz3LLN; Thu, 5 Oct 2023 09:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696499682; 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=tf4gwilzt75cmyhjLTdmIH3OYqNrIYlvmUL1xAThxEo=; b=DfJRAYmUz69HKnSGfwBgyCCd+F8i53/qdPsc7vHyc4mCyxxuF7TjQH0z63Z/+znViKetNl /tv+zrDZEZSkvz690titTslEf+CIu3Nea5f6U8b73s2STuTw040x46sO6yPAGAhPZ13X9v WUuNbcGFZNnVDXNqkQ+TMKcI27V/zoYUZAGCxnAXARZGajxAsF68HbVi2Ev+MhjYxWtiXN SJOA5nxKwuwQMtBfsyQeBckAi2dWyHu1sUtZha+n0n8AOyXj9l/OTsSADYslEWf6/LLHsW D5eiwTtHnSpznmglTYweAw9MQZAHbb7wXAIPJ46NqZxQIk4r5LmC4s2T5xFwTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696499682; a=rsa-sha256; cv=none; b=jNIfF6AHkE/XvEvjqVIou8t04at+SYdKatDMDwKC7N9e6YKvKgvU73KYVNLGzKeKlyHwZX 6h3QKLK/cT28J5dDM1OmUO8UHfWHYlgv8KMUp9kWMipqUWhom0gbALAjKpe146AFAS7nSz J4y1tim0U/rDiW0Z+WSudf+pp+Z/jzXInYIBdF9fUugI5Kvol2PEifDxKj71KWFBwdfjsc u1Dp6/CJCiXlFtkkai5QGX1Xwvi6O+gp+dQTY8cG9axusBFv0En0EBk+NEYCLIZZUcHRe9 sdVltqBQpcK+C9O4Jfpz5LcDh6QbcTXNmoFARs6gqt47BSK2HQpB+j9l81xIgg== 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=1696499682; 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=tf4gwilzt75cmyhjLTdmIH3OYqNrIYlvmUL1xAThxEo=; b=h7ySrIpQA025PNR5hoYAi65XHB21Rz5ynTAkpG5F5oo22kRiFdNTVf+JHvHG0uHmwfQyIA nUpODFsjBt52sinYo1MqwhOhhM+9Y3HA+EttI49lLtr48J02MNJ0U8rnniT1takaovOvKa Y9eYRRruPBvsgRXtD8bl9Ukgf/kaPy4WVkuX7MZHRrxo55MVl+/fNa5oBkrVxQDsJ4Mp0C xt7VIvw4JVpdHfQGz+HG02oobU07n0+GkAOVPW0duxQPn5IIYvsT+SCvkLl3EWNtX3V5kO WwJ4Sx53LfxhvBQQ+oBCxs4SwuRHfG35HNY7mDzQe7cEdoke28N5ayOEZF1I1g== 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 4S1Rjt35Ckz1FV8; Thu, 5 Oct 2023 09:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3959sgtU043479; Thu, 5 Oct 2023 09:54:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3959sg2p043476; Thu, 5 Oct 2023 09:54:42 GMT (envelope-from git) Date: Thu, 5 Oct 2023 09:54:42 GMT Message-Id: <202310050954.3959sg2p043476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 956a46311462 - main - if_ovpn tests: fix ra test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 956a46311462423f97b2410065f8caff2c630701 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=956a46311462423f97b2410065f8caff2c630701 commit 956a46311462423f97b2410065f8caff2c630701 Author: Kristof Provost AuthorDate: 2023-10-05 07:41:25 +0000 Commit: Kristof Provost CommitDate: 2023-10-05 07:48:49 +0000 if_ovpn tests: fix ra test Client one is supposed to be assigend 198.51.100.2, but sometimes it loses the race and the address ends up assigned to client two. When this happened one would try to ping itself, which failed because the loopback interface isn't up. Ideally we'd generate static address assignments, but that would complicate the test. Activate loopback interfaces so the test always passes, and just try to ping both possible addresses. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/net/if_ovpn/if_ovpn.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh index c052a6d7eb47..bbaffa0bce73 100644 --- a/tests/sys/net/if_ovpn/if_ovpn.sh +++ b/tests/sys/net/if_ovpn/if_ovpn.sh @@ -805,14 +805,18 @@ ra_body() ifconfig ${bridge} addm ${two}a vnet_mkjail srv ${srv}b ${lan}a + jexec srv ifconfig lo0 inet 127.0.0.1/8 up jexec srv ifconfig ${srv}b 192.0.2.1/24 up jexec srv ifconfig ${lan}a 203.0.113.1/24 up vnet_mkjail lan ${lan}b + jexec lan ifconfig lo0 inet 127.0.0.1/8 up jexec lan ifconfig ${lan}b 203.0.113.2/24 up jexec lan route add default 203.0.113.1 vnet_mkjail one ${one}b + jexec one ifconfig lo0 inet 127.0.0.1/8 up jexec one ifconfig ${one}b 192.0.2.2/24 up vnet_mkjail two ${two}b + jexec two ifconfig lo0 inet 127.0.0.1/8 up jexec two ifconfig ${two}b 192.0.2.3/24 up # Sanity checks @@ -890,7 +894,9 @@ ra_body() # Client-to-client communication atf_check -s exit:0 -o ignore jexec one ping -c 1 198.51.100.3 + atf_check -s exit:0 -o ignore jexec one ping -c 1 198.51.100.2 atf_check -s exit:0 -o ignore jexec two ping -c 1 198.51.100.2 + atf_check -s exit:0 -o ignore jexec two ping -c 1 198.51.100.3 # RA test atf_check -s exit:0 -o ignore jexec one ping -c 1 203.0.113.1 From nobody Thu Oct 5 10:54:42 2023 X-Original-To: dev-commits-src-main@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 4S1T365SL8z4wHq7; Thu, 5 Oct 2023 10:54:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1T364wCLz3SGl; Thu, 5 Oct 2023 10:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696503282; 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=Xy0zBtFfrI9wHSwbD7ssVzolNKn4eHuuO9Q0FiY8rLk=; b=VCCXRWGsxL6Aqzy4xeoTRmuLToCPmabEaN7Rq+HwluaJ+fQ3JD4qYu1CFDYFEBlTB9hZlA gfm5KYWhZqPFVvw1N7ASkXtOeY9oPMdgF5kloxJbHXShmif/kKFNlqR7iaEsH3iJiCRFOd rrN8wvNH60DqcEH/IDGWzsXF0seD/uXgD4PwEx5gXo9qrQnqdVDZj0bV5hMOIUDf34t5Ys 4nLqsoj5OvlVQv1+QERoBMRfdGyD5dEdLjHFWYa+v+FsSPEIkOCfrOO+fnmfRtScozhMWm 2gjxSODoQdzbT+olF4Sd0ZtHwlaVP/HQCjYDUQBtq5asLHIXHFndtI8eD35UYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696503282; a=rsa-sha256; cv=none; b=tWecsbiug4RX9W+YpuwPhX/Fta5WOkD9HvKOYlZp+NxqZM0pMH//tRpjER8RsqBdJr7Fan HqztyU+06NqRdeysijrpDhH4NkATJkb8DguWe3x/Lb/OayNx3/JVlGl2LrVePXeOP7mENv Y7gqcGMG9VHdWD7rR489bZbszdRkSGbhpEAvUH2djy2EVGA0w+57PiaY0/Tw60hUHAQZv3 GtaUpBK4F4wgwZLGTpVnYagyCxXjb0HAHhGiS3XZSjTHf6JSBIFhL3hzflrQHP5IKadDMI T22LkEnQF7iq+nPaEe7EFB9HfPxG5x8VAH6cH6q5IRNbEBgY4pvipEqD8A4XBg== 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=1696503282; 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=Xy0zBtFfrI9wHSwbD7ssVzolNKn4eHuuO9Q0FiY8rLk=; b=xnIkmCtDaq3vGGk3PwdiTdxE2cfSD26SDXQ+qFl8HeDTYrgfawUdnNM6mHJWE9dbUYICHy Ad3hxA1cnceKyEOQzJU+HH2Qs7SvGQ02d/7MmLejfi0UWeUALzjQH/QHe5Le5ctcyWCClg vDKEd12pIvzdqcCK/EVi1fvA8YVBXh+FrMLBOVPJGAnCbs+cwcg9VJMm6TImYGeTb4AZLb Xk/eU4KMXzxfqCRMl4JOzpgN6ZVqRlFrMjTgWksimf4XqU0FXtVxb7UMy5vJF4rprwtI/Q 96FIOBlmCac5cU9JZvm3vimJFvBEKu3pBX78lbthEpsBoEmhiKHo0i+SxzkAxw== 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 4S1T363sV5z1HQR; Thu, 5 Oct 2023 10:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395Asgj8043923; Thu, 5 Oct 2023 10:54:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395AsgBC043920; Thu, 5 Oct 2023 10:54:42 GMT (envelope-from git) Date: Thu, 5 Oct 2023 10:54:42 GMT Message-Id: <202310051054.395AsgBC043920@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: e19b2ef976d3 - main - genl: add a monitor subcommand List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e19b2ef976d326d34b17331c5071d9e687d0d5d5 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=e19b2ef976d326d34b17331c5071d9e687d0d5d5 commit e19b2ef976d326d34b17331c5071d9e687d0d5d5 Author: Baptiste Daroussin AuthorDate: 2023-10-05 10:51:02 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 10:53:47 +0000 genl: add a monitor subcommand usage: $ genl monitor this subcommand allows to monitor the message from a multicast group of a given family when received. If it knows how to parse the messages received it will dump the decoded version, otherwise it will just inform a new message has been received So far it only knows how to parse nlctrl notify messages, but the plan to allow to make the parsing extensible via lua scripts Differential Revision: https://reviews.freebsd.org/D40372 --- usr.bin/genl/genl.1 | 27 ++++++++-- usr.bin/genl/genl.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 158 insertions(+), 10 deletions(-) diff --git a/usr.bin/genl/genl.1 b/usr.bin/genl/genl.1 index 44ce4feaea48..b3d66298eb00 100644 --- a/usr.bin/genl/genl.1 +++ b/usr.bin/genl/genl.1 @@ -24,23 +24,44 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 20, 2023 +.Dd Oct 5, 2023 .Dt GENL 1 .Os .Sh NAME .Nm genl -.Nd "generic netlink list" +.Nd "generic netlink" .Sh SYNOPSIS .Nm +.Pp +.Nm Cm list +.Pp +.Nm Cm monitor Ao family Ac Ao multicast group Ac .Sh DESCRIPTION +The .Nm -lists all available generic netlink protocols, and presents its details: +utility is design to provide access to the user to generic netlink +protocols. +.Pp +The following commands are available: +.Bl -tag -ident +.It Cm list Po default Pc +Lists all available generic netlink protocols, and presents its details: .Bl -tag -width "multicast groups" .It operations Id of the operation if any and associated capabilities .It multicast groups If of the available multicast group if any and it associated name .El +.It Cm monitor Ao family Ac Ao multicast group Ac +Connect to the +.Ar family +protocol and subscribe to the +.Ar mulicast group +then print the received messages in a readable format if the protocol is known. +So far only +.Qq nlctrl +is known. +.El .Sh SEE ALSO .Xr genetlink 4 , .Xr netlink 4 diff --git a/usr.bin/genl/genl.c b/usr.bin/genl/genl.c index 8e8e18a7f8e2..e3acb872a39e 100644 --- a/usr.bin/genl/genl.c +++ b/usr.bin/genl/genl.c @@ -27,18 +27,41 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include #include +static int monitor_mcast(int argc, char **argv); +static int list_families(int argc, char **argv); +static void parser_nlctrl_notify(struct snl_state *ss, struct nlmsghdr *hdr); +static void parser_fallback(struct snl_state *ss, struct nlmsghdr *hdr); + +static struct commands { + const char *name; + const char *usage; + int (*cmd)(int argc, char **argv); +} cmds[] = { + { "monitor", "monitor ", monitor_mcast }, + { "list", "list", list_families }, +}; + +static struct mcast_parsers { + const char *family; + void (*parser)(struct snl_state *ss, struct nlmsghdr *hdr); +} mcast_parsers [] = { + { "nlctrl", parser_nlctrl_notify }, +}; + struct genl_ctrl_op { uint32_t id; uint32_t flags; @@ -131,6 +154,13 @@ dump_mcast_groups( struct snl_genl_ctrl_mcast_groups *mcast_groups) mcast_groups->groups[i]->mcast_grp_name); } +static void +usage(void) +{ + fprintf(stderr, "Usage: %s\n", getprogname()); + for (size_t i = 0; i < nitems(cmds); i++) + fprintf(stderr, " %s %s\n", getprogname(), cmds[i].usage); +} static void dump_family(struct genl_family *family) @@ -143,8 +173,87 @@ dump_family(struct genl_family *family) dump_mcast_groups(&family->mcast_groups); } +void +parser_nlctrl_notify(struct snl_state *ss, struct nlmsghdr *hdr) +{ + struct genl_family family = {}; + + if (snl_parse_nlmsg(ss, hdr, &genl_family_parser, + &family)) + dump_family(&family); +} + +void +parser_fallback(struct snl_state *ss __unused, struct nlmsghdr *hdr __unused) +{ + printf("New unknown message\n"); +} + +int +monitor_mcast(int argc __unused, char **argv) +{ + struct snl_state ss; + struct nlmsghdr *hdr; + struct _getfamily_attrs attrs; + struct pollfd pfd; + bool found = false; + void (*parser)(struct snl_state *ss, struct nlmsghdr *hdr); + + parser = parser_fallback; + + if (!snl_init(&ss, NETLINK_GENERIC)) + err(EXIT_FAILURE, "snl_init()"); + + if (argc != 2) { + usage(); + return (EXIT_FAILURE); + } + if (!snl_get_genl_family_info(&ss, argv[0], &attrs)) + errx(EXIT_FAILURE, "Unknown family '%s'", argv[0]); + for (uint32_t i = 0; i < attrs.mcast_groups.num_groups; i++) { + if (strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, + argv[1]) == 0) { + found = true; + if (setsockopt(ss.fd, SOL_NETLINK, + NETLINK_ADD_MEMBERSHIP, + (void *)&attrs.mcast_groups.groups[i]->mcast_grp_id, + sizeof(attrs.mcast_groups.groups[i]->mcast_grp_id)) + == -1) + err(EXIT_FAILURE, "Cannot subscribe to command " + "notify"); + break; + } + } + if (!found) + errx(EXIT_FAILURE, "No such multicat group '%s'" + " in family '%s'", argv[1], argv[0]); + for (size_t i= 0; i < nitems(mcast_parsers); i++) { + if (strcmp(mcast_parsers[i].family, argv[0]) == 0) { + parser = mcast_parsers[i].parser; + break; + } + } + memset(&pfd, 0, sizeof(pfd)); + pfd.fd = ss.fd; + pfd.events = POLLIN | POLLERR; + while (true) { + pfd.revents = 0; + if (poll(&pfd, 1, -1) == -1) { + if (errno == EINTR) + continue; + err(EXIT_FAILURE, "poll()"); + } + hdr = snl_read_message(&ss); + if (hdr != NULL && hdr->nlmsg_type != NLMSG_ERROR) + parser(&ss, hdr); + + } + + return (EXIT_SUCCESS); +} + int -main(int argc, char **argv __unused) +list_families(int argc, char **argv __unused) { struct snl_state ss; struct snl_writer nw; @@ -152,16 +261,16 @@ main(int argc, char **argv __unused) struct snl_errmsg_data e = {}; uint32_t seq_id; - if (argc > 1) - errx(EXIT_FAILURE, "usage: genl does not accept any argument"); - if (modfind("netlink") == -1) - err(EXIT_FAILURE, "require netlink module to be loaded"); - + if (argc != 0) { + usage(); + return (EXIT_FAILURE); + } if (!snl_init(&ss, NETLINK_GENERIC)) err(EXIT_FAILURE, "snl_init()"); snl_init_writer(&ss, &nw); - hdr = snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); + hdr = snl_create_genl_msg_request(&nw, GENL_ID_CTRL, + CTRL_CMD_GETFAMILY); if ((hdr = snl_finalize_msg(&nw)) == NULL) err(EXIT_FAILURE, "snl_finalize_msg"); seq_id = hdr->nlmsg_seq; @@ -179,3 +288,21 @@ main(int argc, char **argv __unused) return (EXIT_SUCCESS); } + +int +main(int argc, char **argv) +{ + if (modfind("netlink") == -1) + err(EXIT_FAILURE, "require netlink module to be loaded"); + + if (argc == 1) + return (list_families(0, NULL)); + + for (size_t i = 0; i < nitems(cmds); i++) { + if (strcmp(argv[1], cmds[i].name) == 0) + return (cmds[i].cmd(argc - 2, argv + 2)); + } + usage(); + + return (EXIT_FAILURE); +} From nobody Thu Oct 5 11:10:28 2023 X-Original-To: dev-commits-src-main@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 4S1TPJ2lz4z4wLGZ; Thu, 5 Oct 2023 11:10:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1TPJ2Wngz3Tmc; Thu, 5 Oct 2023 11:10:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696504228; 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=VDBZgzeua14uHlW6pZSlLlg1NRmzkS6sDQ7U2gnddSE=; b=WWm+BvP0+7xfOGZI0pDZrDl9Bq8j32zt8y67t052VD8IuxM6o5oFa8nGqz5gVF2qq94ILj Mz091HCX5hC/lvdFmihJnNqICzRCzsUIAjWfBokDCPSWyoiP7UXIl+BbwSPElPJHQE8jYe sAjXSXIG8BoeeQXsek71o1h8ZRSzNzqocJcXi2pAoQygaRSTKih8Ek0DnaSWyNrYCAo0oo 4a21s5oDf7XFYE1M5+SyYmjxtckqXlVdNlxTyMTHMXPOHZcnzuPeVj82hVZh4X7nj3XDI5 OdeZZZKSfyP1MECrFPOd4K6WhE1Qr0JSMtdn4oRWJxesT4/KNGbQ1JaCoQR+4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696504228; a=rsa-sha256; cv=none; b=ZF0UWVkVjfTNMsF8xjwfJQTjveZvQ7L3HVWbpZxxhFlp/qU6bU1LBJa5jiKSYaUMzh3UDh uK8CYiWJJRS10R+3imS1pklmxFiwf2HhTO1rRMDobR+KGVEB3lPYbF8Jf9fYrxkZe44ARX U1rV+HIoq42WmxlJf4vRzunxkO7XA1NR4BB5w8LQpq+M4RJMpsyxCvweefWV8k4BtTBVIx GepbMgRI2MMn5t4nNMwoRcs7bnRPDpMNed9rp9E9YeMkv2raA9YaiGkpR3F89U36tTlvWs 9NVyjd06/hHr0iU1wuJT/VN5G2yHkP46ghKgxxV5ehPEt2HjaOV2Ziv4zDQLOw== 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=1696504228; 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=VDBZgzeua14uHlW6pZSlLlg1NRmzkS6sDQ7U2gnddSE=; b=X/ZCbDZK5JKxDUOymI4dDZbBWLzeLx+mh2Fva3Q4VBNz0ZDBzrFbxGXaTfHGvSjAFMInA6 NOdNLhYiLVafHfXmB2RgrqoKUvKre0HAKwJ8OOqlmTGlolNmm1PxXSCaB6UA0Dk+1pn+NR zlVFGc72gtusMaJ6xb4Jec8Calx1Gwqe1m/ecg1aFIdufjHlrvDRWVJhbvv3A/kr9XQsiW 51YHeziuLmd71NRQ4JilXmTCcsVLpVbQ5M35aL1/XUAK+ZsR4SozuL5p6rFIzlMib/ZsiO 4BNLUBoOQltJrN1IavqiqkiGxEHY7Nggk3HhnJHorE0vLpLn8+VyxO7Vs3ElmQ== 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 4S1TPJ1bD3z1HFd; Thu, 5 Oct 2023 11:10:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395BAS8x070925; Thu, 5 Oct 2023 11:10:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395BASgZ070922; Thu, 5 Oct 2023 11:10:28 GMT (envelope-from git) Date: Thu, 5 Oct 2023 11:10:28 GMT Message-Id: <202310051110.395BASgZ070922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 77e93191b92e - main - bsdconfig: drop support for floppies List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77e93191b92eed7842f56154eed1d1d0519dd65c Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=77e93191b92eed7842f56154eed1d1d0519dd65c commit 77e93191b92eed7842f56154eed1d1d0519dd65c Author: Baptiste Daroussin AuthorDate: 2023-10-05 08:37:39 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 11:09:54 +0000 bsdconfig: drop support for floppies Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D42083 --- usr.sbin/bsdconfig/include/media.hlp | 7 - usr.sbin/bsdconfig/include/messages.subr | 9 -- usr.sbin/bsdconfig/include/options.hlp | 4 +- usr.sbin/bsdconfig/share/device.subr | 14 +- usr.sbin/bsdconfig/share/media/Makefile | 2 +- usr.sbin/bsdconfig/share/media/any.subr | 3 - usr.sbin/bsdconfig/share/media/floppy.subr | 228 --------------------------- usr.sbin/bsdconfig/share/media/options.subr | 1 - usr.sbin/bsdconfig/share/packages/index.subr | 2 - usr.sbin/bsdconfig/share/script.subr | 1 - 10 files changed, 3 insertions(+), 268 deletions(-) diff --git a/usr.sbin/bsdconfig/include/media.hlp b/usr.sbin/bsdconfig/include/media.hlp index 6fd609473810..1f07789ec0a4 100644 --- a/usr.sbin/bsdconfig/include/media.hlp +++ b/usr.sbin/bsdconfig/include/media.hlp @@ -16,13 +16,6 @@ You can install from the following types of media: get the distribution files from there. - Floppy Get distribution files from one or more DOS or UFS - formatted floppies. Such floppies are assumed to - contain the appropriate distribution pieces - see - ABOUT.TXT for more information about making floppy - distribution media. - - FTP Get the distribution files from an anonymous ftp server (you will be presented with a list). Please note that you may invoke FTP in "Active"/"Passive" auto-mode, or diff --git a/usr.sbin/bsdconfig/include/messages.subr b/usr.sbin/bsdconfig/include/messages.subr index 63c8f4925c0f..b9ddd8e2f466 100644 --- a/usr.sbin/bsdconfig/include/messages.subr +++ b/usr.sbin/bsdconfig/include/messages.subr @@ -77,7 +77,6 @@ msg_checking_access_to="Checking access to\n %s" msg_chinese_desc="Ported software for the Chinese market." msg_choose_a_cd_dvd_type="Choose a CD/DVD type" msg_choose_a_dos_partition="Choose a DOS partition" -msg_choose_a_floppy_drive="Choose a Floppy drive" msg_choose_a_ufs_partition="Choose a UFS partition" msg_choose_a_usb_drive="Choose a USB drive" msg_choose_installation_media="Choose Installation Media" @@ -129,7 +128,6 @@ msg_enter_a_fully_qualified_pathname_for_the_directory="Enter a fully qualified msg_enter_the_device_name_of_a_ufs_formatted_partition="Enter the device-name of a UFS formatted partition" msg_error="Error" msg_error_mounting_device="Error mounting %s on %s: %s" -msg_error_mounting_floppy_device="Error mounting floppy %s (%s) on %s: %s" msg_error_mounting_usb_drive="Error mounting USB drive %s on %s: %s" msg_error_when_requesting_url="Error when requesting %s, you could try an other server" msg_estonia="Estonia" @@ -141,7 +139,6 @@ msg_failed_to_reach_wpa_supplicant="Failed to reach wpa_supplicant: %s" msg_file_system="File System" msg_finance_desc="Monetary, financial and related applications." msg_finland="Finland" -msg_floppy="Floppy" msg_forget_all="Forget All" msg_forget_all_confirm="WARNING! Are you really sure you want to forget all known networks\nby re-initializing wpa_supplicant.conf(5)? This cannot be undone." msg_forget_all_help="Reset wpa_supplicant(8) configuration, forgetting all known networks" @@ -171,7 +168,6 @@ msg_http_proxy="HTTP Proxy" msg_hungarian_desc="Ported software for the Hungarian market." msg_iceland="Iceland" msg_install_from_a_dos_partition="Install from a DOS partition" -msg_install_from_a_floppy_disk_set="Install from a floppy disk set" msg_install_from_a_freebsd_cd_dvd="Install from a FreeBSD CD/DVD" msg_install_from_a_ufs_partition="Install from a UFS partition" msg_install_from_a_usb_drive="Install from a USB drive" @@ -257,7 +253,6 @@ msg_no="No" msg_no_cd_dvd_devices_found="No CD/DVD devices found! Please check that your system's\nconfiguration is correct and that the CD/DVD drive is of a\nsupported type. For more information, consult the hardware\nguide in the Doc menu." msg_no_description_provided="No description provided" msg_no_dos_primary_partitions_found="No DOS primary partitions found! This installation method is unavailable" -msg_no_floppy_devices_found="No floppy devices found! Please check that your system's configuration\nis correct. For more information, consult the hardware guide in the Doc\nmenu." msg_no_gateway_has_been_set="No gateway has been set. You will be unable to access hosts\nnot on your local network" msg_no_network_devices="No network devices available!" msg_no_package_name_passed_in_package_variable="No package name passed in package variable" @@ -297,11 +292,8 @@ msg_please_enter_the_full_nfs_file_specification="Please enter the full NFS file msg_please_enter_the_password_for_this_user="Please enter the password for this user:" msg_please_enter_the_username_you_wish_to_login_as="Please enter the username you wish to login as:" msg_please_enter_username_password="Please enter a username and password for sudo(8):" -msg_please_insert_floppy_containing="Please insert floppy containing %s in %s" -msg_please_insert_floppy_in_drive="Please insert floppy in %s" msg_please_select_a_category_to_display="Please select a category to display." msg_please_select_a_cd_dvd_drive="FreeBSD can be installed directly from a CD/DVD containing a valid\nFreeBSD distribution. If you are seeing this menu it is because\nmore than one CD/DVD drive was found on your system. Please select\none of the following CD/DVD drives as your installation drive." -msg_please_select_a_floppy_drive="You have more than one floppy drive. Please choose which drive\nyou would like to use." msg_please_select_a_freebsd_ftp_distribution_site="Please select a FreeBSD FTP distribution site" msg_please_select_a_freebsd_http_distribution_site="Please select a FreeBSD HTTP distribution site" msg_please_select_a_usb_drive="You have more than one USB drive. Please choose which drive\nyou would like to use." @@ -447,7 +439,6 @@ msg_xfce_desc="Software related to the Xfce Desktop Environment." msg_yes="Yes" msg_yes_to_all="Yes to All" msg_you_are_not_root_but="You are not root but %s can use sudo(8).\nWhat would you like to do?" -msg_you_may_remove_the_floppy="You may remove the floppy from %s" msg_youve_already_done_the_network_configuration="You've already done the network configuration once,\nwould you like to skip over it now?" msg_zope_desc="Software related to the Zope platform." tcplayout_extras_help="Any interface-specific options to ifconfig you would like to add" diff --git a/usr.sbin/bsdconfig/include/options.hlp b/usr.sbin/bsdconfig/include/options.hlp index f47df27a6b88..257c5011fb9e 100644 --- a/usr.sbin/bsdconfig/include/options.hlp +++ b/usr.sbin/bsdconfig/include/options.hlp @@ -85,9 +85,7 @@ Release Name: Which release to attempt to load from installation media. You should only change this option if you're really sure you know what you are doing! This will change the release name used by - bsdconfig when fetching components of any distributions, and - is a useful way of using a more recent installation boot floppy - with an older release (say, on CDROM). + bsdconfig when fetching components of any distributions. Media Type: Which media type is being used. diff --git a/usr.sbin/bsdconfig/share/device.subr b/usr.sbin/bsdconfig/share/device.subr index c60ad303acfc..4ca2a80c69a5 100644 --- a/usr.sbin/bsdconfig/share/device.subr +++ b/usr.sbin/bsdconfig/share/device.subr @@ -77,7 +77,6 @@ f_struct_define DEVICE_INFO \ setvar DEVICE_TYPE_ANY "any" # Any setvar DEVICE_TYPE_NONE "NONE" # Unknown setvar DEVICE_TYPE_DISK "DISK" # GEOM `DISK' -setvar DEVICE_TYPE_FLOPPY "FD" # GEOM `FD' setvar DEVICE_TYPE_FTP "FTP" # Dynamic network device setvar DEVICE_TYPE_NETWORK "NETWORK" # See f_device_get_all_network setvar DEVICE_TYPE_CDROM "CDROM" # GEOM `DISK' @@ -440,14 +439,6 @@ f_device_probe_geom() return $retval ;; - $GEOM_CLASS_FD) - f_dprintf "Found floppy device named %s" "$devname" - debug= f_device_register device "$devname" "$desc" \ - "/dev/$devname" $DEVICE_TYPE_FLOPPY 1 \ - f_media_init_floppy f_media_get_floppy \ - f_media_shutdown_floppy "" "$capacity" - return $? - ;; $GEOM_CLASS_LABEL) : fall through to below section # reduces indentation level ;; @@ -936,7 +927,6 @@ f_device_desc() case "$__type" in $DEVICE_TYPE_CDROM) __cp="" ;; $DEVICE_TYPE_DISK) __cp="" ;; - $DEVICE_TYPE_FLOPPY) __cp="" ;; $DEVICE_TYPE_USB) __cp="" ;; $DEVICE_TYPE_NETWORK) __cp="" ;; *) @@ -1247,7 +1237,6 @@ f_device_menu() # f_cdrom() { f_device_catalog_set $DEVICE_TYPE_CDROM "$1" "$2"; } f_disk() { f_device_catalog_set $DEVICE_TYPE_DISK "$1" "$2"; } -f_floppy() { f_device_catalog_set $DEVICE_TYPE_FLOPPY "$1" "$2"; } f_usb() { f_device_catalog_set $DEVICE_TYPE_USB "$1" "$2"; } f_network() { f_device_catalog_set $DEVICE_TYPE_NETWORK "$1" "$2"; } @@ -1262,7 +1251,7 @@ f_network() { f_device_catalog_set $DEVICE_TYPE_NETWORK "$1" "$2"; } DEVICE_CATALOG_APPEND_ONLY=1 # Make initial loading faster -# CDROM, Disk, Floppy, and USB devices/names +# CDROM, Disk, and USB devices/names f_cdrom "cd%d" "SCSI CDROM drive" f_cdrom "mcd%d" "Mitsumi (old model) CDROM drive" f_cdrom "scd%d" "Sony CDROM drive - CDU31/33A type" @@ -1277,7 +1266,6 @@ f_disk "mfid%d" "LSI MegaRAID SAS array" f_disk "mlxd%d" "Mylex RAID disk" f_disk "twed%d" "3ware ATA RAID array" f_disk "vtbd%d" "VirtIO Block Device" -f_floppy "fd%d" "Floppy Drive unit A" f_usb "da%da" "USB Mass Storage Device" # Network interfaces/names diff --git a/usr.sbin/bsdconfig/share/media/Makefile b/usr.sbin/bsdconfig/share/media/Makefile index d6b77d96ee7f..2cbce2d492b2 100644 --- a/usr.sbin/bsdconfig/share/media/Makefile +++ b/usr.sbin/bsdconfig/share/media/Makefile @@ -1,7 +1,7 @@ FILESDIR= ${SHAREDIR}/bsdconfig/media FILES= any.subr cdrom.subr common.subr directory.subr dos.subr \ - floppy.subr ftp.subr http.subr httpproxy.subr network.subr \ + ftp.subr http.subr httpproxy.subr network.subr \ nfs.subr options.subr tcpip.subr ufs.subr usb.subr wlan.subr .include diff --git a/usr.sbin/bsdconfig/share/media/any.subr b/usr.sbin/bsdconfig/share/media/any.subr index d98f58567bfa..ea4fef0b5151 100644 --- a/usr.sbin/bsdconfig/share/media/any.subr +++ b/usr.sbin/bsdconfig/share/media/any.subr @@ -34,7 +34,6 @@ f_include $BSDCFG_SHARE/dialog.subr f_include $BSDCFG_SHARE/media/cdrom.subr f_include $BSDCFG_SHARE/media/directory.subr f_include $BSDCFG_SHARE/media/dos.subr -f_include $BSDCFG_SHARE/media/floppy.subr f_include $BSDCFG_SHARE/media/ftp.subr f_include $BSDCFG_SHARE/media/http.subr f_include $BSDCFG_SHARE/media/httpproxy.subr @@ -78,7 +77,6 @@ f_media_get_type() '6 $msg_nfs' '$msg_install_over_nfs' '7 $msg_dos' '$msg_install_from_a_dos_partition' '8 $msg_ufs' '$msg_install_from_a_ufs_partition' - '9 $msg_floppy' '$msg_install_from_a_floppy_disk_set' 'A $msg_usb' '$msg_install_from_a_usb_drive' 'X $msg_options' '$msg_view_set_various_media_options' " # END-QUOTE @@ -128,7 +126,6 @@ f_media_get_type() ?" $msg_dos") f_media_set_dos ;; ?" $msg_nfs") f_media_set_nfs ;; ?" $msg_ufs") f_media_set_ufs ;; - ?" $msg_floppy") f_media_set_floppy ;; ?" $msg_usb") f_media_set_usb ;; ?" $msg_options") f_media_options_menu diff --git a/usr.sbin/bsdconfig/share/media/floppy.subr b/usr.sbin/bsdconfig/share/media/floppy.subr deleted file mode 100644 index ae17ee27f282..000000000000 --- a/usr.sbin/bsdconfig/share/media/floppy.subr +++ /dev/null @@ -1,228 +0,0 @@ -if [ ! "$_MEDIA_FLOPPY_SUBR" ]; then _MEDIA_FLOPPY_SUBR=1 -# -# Copyright (c) 2012-2013 Devin Teske -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# -############################################################ INCLUDES - -BSDCFG_SHARE="/usr/share/bsdconfig" -. $BSDCFG_SHARE/common.subr || exit 1 -f_dprintf "%s: loading includes..." media/floppy.subr -f_include $BSDCFG_SHARE/device.subr -f_include $BSDCFG_SHARE/dialog.subr -f_include $BSDCFG_SHARE/media/common.subr -f_include $BSDCFG_SHARE/struct.subr -f_include $BSDCFG_SHARE/variable.subr - -BSDCFG_LIBE="/usr/libexec/bsdconfig" -f_include_lang $BSDCFG_LIBE/include/messages.subr - -############################################################ GLOBALS - -FLOPPY_MOUNTED= -FLOPPY_DISTWANTED= - -############################################################ FUNCTIONS - -# f_media_set_floppy -# -# Return success if we both found and set the media type to be a floppy. -# -f_media_set_floppy() -{ - f_media_close - - local devs ndevs - f_device_find "" $DEVICE_TYPE_FLOPPY devs - f_count ndevs $devs - - if [ ${ndevs:=0} -eq 0 ]; then - f_interactive && f_show_msg "$msg_no_floppy_devices_found" - return $FAILURE - elif [ $ndevs -eq 1 ]; then - f_struct_copy $devs device_media - else - local dev - local title="$msg_choose_a_floppy_drive" - local prompt="$msg_please_select_a_floppy_drive" - local hline= - - dev=$( f_device_menu \ - "$title" "$prompt" "$hline" $DEVICE_TYPE_FLOPPY \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || - return $FAILURE - - f_struct_copy "$dev" device_media - fi - - f_struct device_media && - device_media unset private - - f_struct device_media || return $FAILURE -} - -# f_media_init_floppy $device -# -# Initializes the Floppy media device. Returns success if able to mount the -# Floppy disk device using either mount_msdosfs(8) or mount(8) (tried in that -# order). -# -f_media_init_floppy() -{ - local funcname=f_media_init_floppy - local dev="$1" devname err - - $dev get devname devname || return $FAILURE - f_dprintf "Init floppy called for %s distribution. devname=[%s]" \ - "${FLOPPY_DISTWANTED:-some}" "$devname" - - if [ "$FLOPPY_MOUNTED" ]; then - f_dprintf "Floppy device already mounted." - return $SUCCESS - fi - - local mp - $dev get private mp - if [ ! -e "${mp:=$MOUNTPOINT}" ] && ! f_quietly mkdir -p "$mp"; then - f_show_msg "$msg_unable_to_make_directory_mountpoint" \ - "$mp" "$devname" - return $FAILURE - fi - - if f_interactive; then - local desc - $dev get desc desc - if [ "$FLOPPY_DISTWANTED" ]; then - f_show_msg "$msg_please_insert_floppy_in_drive" "$desc" - else - f_show_msg "$msg_please_insert_floppy_containing" \ - "$FLOPPY_DISTWANTED" "$desc" - fi - fi - - if ! { - f_eval_catch -dk err $funcname mount_msdosfs \ - 'mount_msdosfs -o ro -m 0777 -u 0 -g 0 "%s" "%s"' \ - "$devname" "$mp" || - f_eval_catch -dk err $funcname mount \ - 'mount -o ro "%s" "%s"' "$devname" "$mp" - }; then - err="${err#mount: }"; err="${err#*: }" - local name - $dev get name name - f_show_msg "$msg_error_mounting_floppy_device" \ - "$name" "$devname" "$mp" "$err" - return $FAILURE - fi - FLOPPY_MOUNTED=1 - FLOPPY_DISTWANTED= - return $SUCCESS -} - -# f_media_get_floppy $device $file [$probe_type] -# -# Returns data from $file on a mounted Floppy disk device. Similar to cat(1). -# If $probe_type is present and non-NULL, limits retries to zero and returns -# success if $file exists. If $probe_type is equal to $PROBE_SIZE, prints the -# size of $file in bytes to standard-out. -# -f_media_get_floppy() -{ - local funcname=f_media_get_floppy - local dev="$1" file="$2" probe_type="$3" - local name - - $dev get name name - f_dprintf "f_media_get_floppy: dev=[%s] file=[%s] probe_type=%s" \ - "$name" "$file" "$probe_type" - - # - # floppies don't use f_media_generic_get() because it's too expensive - # to speculatively open files on a floppy disk. Make user get it - # right or give up with floppies. - # - local mp - $dev get private mp - local fp="${mp:=$MOUNTPOINT}/$file" - if ! [ -f "$fp" -a -r "$fp" ]; then - local nretries=4 - [ "$probe_type" = "$PROBE_SIZE" ] && echo "-1" - [ "$probe_type" ] && return $FAILURE - while ! [ -f "$fp" -a -r "$fp" ]; do - if [ $nretries -eq 0 ]; then - f_show_msg "$msg_failed_to_get_floppy_file" \ - "$fp" - [ "$probe_type" = "$PROBE_SIZE" ] && echo "-1" - return $FAILURE - fi - FLOPPY_DISTWANTED="$fp" - f_media_shutdown_floppy "$dev" - f_media_init_floppy "$dev" || return $FAILURE - nretries=$(( $nretries - 1 )) - done - fi - # - # If we reach here, $file exists - # - if [ "$probe_type" = "$PROBE_SIZE" ]; then - local size - f_eval_catch -dk size $funcname stat 'stat -f %%z "%s"' "$fp" - f_isinteger "$size" || size=-1 - echo "$size" - fi - [ "$probe_type" ] && return $SUCCESS - cat "$fp" -} - -# f_media_shutdown_floppy $device -# -# Shuts down the Floppy disk device using umount(8). Return status should be -# ignored. -# -f_media_shutdown_floppy() -{ - local funcname=f_media_shutdown_floppy - local dev="$1" err mp - - [ "$FLOPPY_MOUNTED" ] || return $FAILURE - - $dev get private mp - if f_eval_catch -d $funcname umount \ - 'umount -f "%s"' "${mp:=$MOUNTPOINT}" - then - FLOPPY_MOUNTED= - if f_interactive && [ "$_systemState" != "fixit" ]; then - local desc - $dev get desc desc - f_show_msg "$msg_you_may_remove_the_floppy" "$desc" - fi - fi -} - -############################################################ MAIN - -f_dprintf "%s: Successfully loaded." media/floppy.subr - -fi # ! $_MEDIA_FLOPPY_SUBR diff --git a/usr.sbin/bsdconfig/share/media/options.subr b/usr.sbin/bsdconfig/share/media/options.subr index 340619a50ac1..a4de6395127e 100644 --- a/usr.sbin/bsdconfig/share/media/options.subr +++ b/usr.sbin/bsdconfig/share/media/options.subr @@ -158,7 +158,6 @@ f_media_options_menu() $DEVICE_TYPE_UFS|$DEVICE_TYPE_DISK) cp="$msg_file_system" ;; $DEVICE_TYPE_DIRECTORY) cp="$msg_directory" ;; - $DEVICE_TYPE_FLOPPY) cp="$msg_floppy" ;; $DEVICE_TYPE_FTP) cp="$msg_ftp" ;; $DEVICE_TYPE_HTTP_PROXY) cp="$msg_http_proxy" ;; $DEVICE_TYPE_HTTP) cp="$msg_http_direct" ;; diff --git a/usr.sbin/bsdconfig/share/packages/index.subr b/usr.sbin/bsdconfig/share/packages/index.subr index dd432adf6adf..bd29b882d0d9 100644 --- a/usr.sbin/bsdconfig/share/packages/index.subr +++ b/usr.sbin/bsdconfig/share/packages/index.subr @@ -90,8 +90,6 @@ f_index_initialize() case "$__type" in $DEVICE_TYPE_DIRECTORY) __site="file://$__data/packages/$PKG_ABI" ;; - $DEVICE_TYPE_FLOPPY) - __site="file://${__data:-$MOUNTPOINT}/packages/$PKG_ABI" ;; $DEVICE_TYPE_FTP) f_getvar $VAR_FTP_PATH __site __site="$__site/packages/$PKG_ABI" ;; diff --git a/usr.sbin/bsdconfig/share/script.subr b/usr.sbin/bsdconfig/share/script.subr index feac3b47bdef..055202f1bd93 100644 --- a/usr.sbin/bsdconfig/share/script.subr +++ b/usr.sbin/bsdconfig/share/script.subr @@ -171,7 +171,6 @@ f_resword_new mediaGetType f_media_get_type # media/any.subr f_resword_new mediaSetCDROM f_media_set_cdrom # media/cdrom.subr f_resword_new mediaSetDOS f_media_set_dos # media/dos.subr f_resword_new mediaSetDirectory f_media_set_directory # media/directory.subr -f_resword_new mediaSetFloppy f_media_set_floppy # media/floppy.subr f_resword_new mediaSetNFS f_media_set_nfs # media/nfs.subr f_resword_new mediaSetUFS f_media_set_ufs # media/ufs.subr f_resword_new mediaSetUSB f_media_set_usb # media/usb.subr From nobody Thu Oct 5 11:32:00 2023 X-Original-To: dev-commits-src-main@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 4S1Tt91RW5z4wP03; Thu, 5 Oct 2023 11:32:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1Tt90xlcz3Wq8; Thu, 5 Oct 2023 11:32:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696505521; 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=dzUl1W/8tPU00kVBIFFXjSKrMVoVHUqbt+uMxj+ZDjQ=; b=qHl4TE7ew7M7UNKwo7YURX9gQw/+LcflzfkTf13BfLLbNT+fZ8h9ZPGKCzdBmbmTPWTu+3 iK9bQB1UbkdnY9dKyRVbsKY8d/HuioA9iWPWBEEtHBB8pmxm5yRWx+gsS1zs4x/pAwZag+ 7gq0Rq7Aq/1JnagqfD7rfNWy4Ap/mHSg/OeZK/h3p7P20v4Nh/QjQY6VDow3T/15T3U+Nx XRfcI8S0T6NBfVOniZQKa4mBQd6lYgMmvxDXBtS4PfjBhGyOu8F6b6S11b4NYLWZkwLnNE EA/GnPElkaLyfu4R5w/Htt6i66qjVPnR//KjdsIyE6do8dgZ0x8BkSNlluHILQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696505521; a=rsa-sha256; cv=none; b=osOk9owfkcfmUr3l87yDeh0FdTKE0dMK4b1hHpdaTcyQnU0cSocvkfPGbpnqolqTkwoRRC 4oclNDTHdxKEw0J9qB2lSO3JvBf/6nK2UWmmxlg47NyX2vuQnJDwGI3l2oyGcj9BY4rVhw wx5EbxwSYX7xpmIYwrhgc0ZNAD7nGYt0udkN1hHIUwABigd/b/ctClysBBg4o2VEUNtAGO Y4kg4ful4IwdXu0vt7V2NT4+HUWu0QVuTmVUjuCTYnCRrHJ674jtFA2jnI7v+tV5bKwijn dmofoty18ni9SN1HaekV+KamZzh0BO+tgmWG0dLH0NIA8BBtvIPr1mctJrxZEg== 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=1696505521; 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=dzUl1W/8tPU00kVBIFFXjSKrMVoVHUqbt+uMxj+ZDjQ=; b=VwvXDQZPbESge7ocXJq4Da9H5gwkVhyEIfwryKNm3Gj7zqn3+Y5N/XmLF9ROIb2Zk+dYeX uJM5llmJZREqZAvB0/JBNoSJjqtW0FsP9Ox7Rj8X4s7TS8AciS+GcqaAjTiZ7WtCJY3zDD XUZmoXxyzPfhEnRu4qWyGhIjVmdTBIVfOT1kHaERyVqAlZb8goMyk/nGHWfVEUL2vIiYwO 1NW9CE74WOoNNCwSoSyD1FCFucmVbriXKIo/AejXmgmVG26x7u+6TBippUZL+8cCR/61dc ZWxLWY6Np0EoNek2fIWYY3w5xkX+/vjcoKcLwrYQ206SduTFPuhBu8Hz30nYuA== 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 4S1Tt900Hhz1Hx4; Thu, 5 Oct 2023 11:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395BW05J006306; Thu, 5 Oct 2023 11:32:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395BW0Ov006300; Thu, 5 Oct 2023 11:32:00 GMT (envelope-from git) Date: Thu, 5 Oct 2023 11:32:00 GMT Message-Id: <202310051132.395BW0Ov006300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 5c8c9e1744b3 - main - ObsoleteFiles.inc: document the removal of floppy support in bsdconfig List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c8c9e1744b3f294ed5c73c8f1d0bafbc0f90a5d Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=5c8c9e1744b3f294ed5c73c8f1d0bafbc0f90a5d commit 5c8c9e1744b3f294ed5c73c8f1d0bafbc0f90a5d Author: Baptiste Daroussin AuthorDate: 2023-10-05 11:31:26 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 11:31:26 +0000 ObsoleteFiles.inc: document the removal of floppy support in bsdconfig --- ObsoleteFiles.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 763578aeb652..89594ac77b9b 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20231005: bsdconfig remove support for floppy +OLD_FILES+=usr/share/bsdconfig/media/floppy.subr + # 20230927: Man pages renamed to match the actual functions OLD_FILES+=usr/share/man/man9/cr_seeothergids.9.gz OLD_FILES+=usr/share/man/man9/cr_seeotheruids.9.gz From nobody Thu Oct 5 12:14:44 2023 X-Original-To: dev-commits-src-main@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 4S1VqS32PPz4wVbY; Thu, 5 Oct 2023 12:14:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1VqS2Z2Bz3bZv; Thu, 5 Oct 2023 12:14:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696508084; 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=qSlN6J9PIa3zYm+uLVHazJkG6ytaIA1C7ydFCIi49T4=; b=D+1AwHtrUum7SDaCwFchuoyp9s4yExynwCNxoQaxuLnCvQrAPKMstLz+eE1AWpkuS9GsSn hzIUskcOwiDfuvY/VAFjCKzTv2tW96gOPcZ6RjCRzmUI7SyNZgxVBeQrUQ7RTWhruzRS5Z W+juDR4O+eA5c7JBQmFAYbrZ2Kil/JIzpu46h7XRLkjffVc0BXUDqCn7jaSNrrrYIJc/8C VYFM+gWpJlRU6Z3VFoTfdfVJ4VjLopWR9IrjS9pNWeKIiMUKdOlTE6PQwOkHh1MJRE9HnT /m8cYavTmkmhVgms8asTSfUHjFuv6VTN1D0/O32B223wsZyFIKuE1nxO6FmJvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696508084; a=rsa-sha256; cv=none; b=PCO6L2xagslhG4pmKmuJ6YN6M8vKeXK+YU+X/6bOBXqnfbbvEmDnZbvfXm1m3TuS3Xjvdx Z63E8jiDdaQZPbRM85cOItbXhlM5FyfdMLpeMHkhgXCZ+2B1VyFDYoIY45mmmGxEXiR3X3 rUypuv7+PsBFQEjCn6CRVZa4NyJ9nU+q3wMizUAjQXLm7JZObxiSAcccdKYgCEFIgEPHXb S0lKvatcShudYAmCGexBTuVrL0XwOcsFAbVZNXznNOfTRKQhCNDbT0soRcKhcR5uMXSulm UQ2NjKRtyf6zU6sPmt5w0rC2zDQdKgAQfeUaLoFRt1qPwoPtf/zHbgizqBKADg== 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=1696508084; 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=qSlN6J9PIa3zYm+uLVHazJkG6ytaIA1C7ydFCIi49T4=; b=pC67KTh9mK8MQU+yXRpqmkJdKcH7gtc3W3aeA2rvRqYEg3eHo6Pn8oJQh6WG+rV02aqNdb 23M9PqBUNkZenYxGmx4k3WohUZ6a3QyzCDyZ33vUvdz2IPxk9OyYg+tvXDTFf8Ae1sni2Y uDKn/ifx+FNZWkGLSUk7hTlijeURdE0RzXEjEUHDmntNyywHdh7zCROIpw7SAat8GG2jDT 1K27VwDwcEPMghQhsF+bubT6lhw678Pu/xU3abKKvXY8aVaqFzWK0sOORIsbKF5+31oVbn K51XIyCnHSLZOOcrL/y+7H11lRKDJLeSeH2RweV8k8SZUUVvoaR3gC2AF404tQ== 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 4S1VqS1d8Cz1JsZ; Thu, 5 Oct 2023 12:14:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395CEi8U077665; Thu, 5 Oct 2023 12:14:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395CEiIv077662; Thu, 5 Oct 2023 12:14:44 GMT (envelope-from git) Date: Thu, 5 Oct 2023 12:14:44 GMT Message-Id: <202310051214.395CEiIv077662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: aaff6a85ff1e - main - fortune: use 115200 in serial example List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aaff6a85ff1e506e38a8c4f94f1cb1065427e8c3 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=aaff6a85ff1e506e38a8c4f94f1cb1065427e8c3 commit aaff6a85ff1e506e38a8c4f94f1cb1065427e8c3 Author: Ed Maste AuthorDate: 2023-10-05 12:11:46 +0000 Commit: Ed Maste CommitDate: 2023-10-05 12:14:23 +0000 fortune: use 115200 in serial example Commit 4722ceb7d53e switched the default serial rate to 115200 bps. Follow suit in the freebsd-tips fortune example. Reviewed by: bcr Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41495 --- usr.bin/fortune/datfiles/freebsd-tips | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index dd2c3cfb0495..3ee4ca3a5972 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -833,7 +833,7 @@ $ sysctl -n hw.pagesize To establish a serial connection to anything including a USB device, nothing more than cu(1) is needed: -$ cu -s 9600 -l /dev/ttyU0 +$ cu -s 115200 -l /dev/ttyU0 -- Daniel Ebdrup Jensen % From nobody Thu Oct 5 12:44:23 2023 X-Original-To: dev-commits-src-main@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 4S1WTg2q8Yz4wZVh; Thu, 5 Oct 2023 12:44:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1WTg2bllz3gSs; Thu, 5 Oct 2023 12:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696509863; 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=nEYgeVWb8PWY3735a6WbAjRES0UPrvgB9P6PTkvaIj8=; b=PGUlOXbFeTx9CsudQJlxspd8kmvHuY0FgW4tmD0gNPtPcwEG3hbbErOFYrO1v4VUVlLpa4 tSwZCykdN8/uFOappQi7Qm1csVeXDCelV6Hho/6mipVpcxGTNBIwUdh6LtcY8C/RL5+IOz 7qxkd71Dvujz+gkC8g6Og0mDNipVQdpYrvhueu8yr0GrO4o+a0w3A+/kpwcBwvUGZYo/CP gg2814PPVem+1+W9mUM9rrDC1S3jERIHMLWmd3rFVC9RFGffPlNFX7NtDvj9nZrNzFnKzk TSq/zuD298R1971vi6LRczKY4r755lCgeq+BVcbRLnx5vMUzquR0y1NpnnPosA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696509863; a=rsa-sha256; cv=none; b=NzJ0zYsffNtvvE03oXhiLwKmnNTe+M0p6kA3O5/WB/MuTZkYGJWCY9t3ko+uhXqcO3LAUN y0JGRq+xSDWiXh6OBXJvMbgVrHhOoM4rkNYHYA6hMS7y3reWn+FzAUtUJV4Wg7toYGQvlj uoo1wYivQZ/Fj7zQA6bng3hUtbo9CaVgLEkaorZuBT0pymzQdtliG5LjIsG3Gi+/eEyfYb qKXU0rBEUtKLbcP4uivkPTXJXnSt7r3V9quh2yP9rTVyZjXn1Sy19Dl+xVMOoV6dcbFWzJ iYwYf+I0hAzQER5bhplLLvR6pziY5wE5folhSRUckyUDRAyb8dWJlwkEqP7JWA== 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=1696509863; 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=nEYgeVWb8PWY3735a6WbAjRES0UPrvgB9P6PTkvaIj8=; b=YsWcYJlx1iVvYtGthpMx52ngU8gdrHKt9QRKqg5UoUm0yyKFfu2xZwWrFhM7pGW5ZsoRu3 A/gXT1LwPDftDwVsupx6tPnLdGmU+4lZIlkTzG8ChLw/0/2IwtrbTWz8ISQSJ5KQwZCV+a OIfi8jFP9PGVQ5NOcboCxbwobasLC2Tysh7GBXI/vMhspoq0/HLKqola++bFeEqSExoUvu rGXcUTDCfQAOzl+LSONAWYFbQ2bdE/Wj7S5+e6Ygr/nWg9K1sChMOtTHyygguHvvcR0A7c +wOVMvtP9hyfHkPOVeDETstzK4dcsZ5IU3RcOMBwa2QXL1MfepWttcOcODrhbw== 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 4S1WTg1XPKz1Kwh; Thu, 5 Oct 2023 12:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395CiNNn027093; Thu, 5 Oct 2023 12:44:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395CiNIU027090; Thu, 5 Oct 2023 12:44:23 GMT (envelope-from git) Date: Thu, 5 Oct 2023 12:44:23 GMT Message-Id: <202310051244.395CiNIU027090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 5e7aa7574445 - main - bsdconfig: remove support for ftp, pkg does not support it anymore List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e7aa7574445f1fc90140bc93ec75de83e850fbe Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=5e7aa7574445f1fc90140bc93ec75de83e850fbe commit 5e7aa7574445f1fc90140bc93ec75de83e850fbe Author: Baptiste Daroussin AuthorDate: 2023-10-05 12:39:13 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 12:44:18 +0000 bsdconfig: remove support for ftp, pkg does not support it anymore --- ObsoleteFiles.inc | 3 +- usr.sbin/bsdconfig/include/media.hlp | 16 - usr.sbin/bsdconfig/include/messages.subr | 11 - usr.sbin/bsdconfig/share/media/Makefile | 2 +- usr.sbin/bsdconfig/share/media/any.subr | 15 +- usr.sbin/bsdconfig/share/media/ftp.subr | 840 -------------------------- usr.sbin/bsdconfig/share/media/httpproxy.subr | 1 - usr.sbin/bsdconfig/share/media/options.subr | 9 - usr.sbin/bsdconfig/share/media/tcpip.subr | 1 - usr.sbin/bsdconfig/share/script.subr | 6 - usr.sbin/bsdconfig/share/variable.subr | 11 - 11 files changed, 9 insertions(+), 906 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 89594ac77b9b..09e18daa7abf 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,8 +51,9 @@ # xargs -n1 | sort | uniq -d; # done -# 20231005: bsdconfig remove support for floppy +# 20231005: bsdconfig remove support for floppy and ftp OLD_FILES+=usr/share/bsdconfig/media/floppy.subr +OLD_FILES+=usr/share/bsdconfig/media/ftp.subr # 20230927: Man pages renamed to match the actual functions OLD_FILES+=usr/share/man/man9/cr_seeothergids.9.gz diff --git a/usr.sbin/bsdconfig/include/media.hlp b/usr.sbin/bsdconfig/include/media.hlp index 1f07789ec0a4..ec92e035f833 100644 --- a/usr.sbin/bsdconfig/include/media.hlp +++ b/usr.sbin/bsdconfig/include/media.hlp @@ -16,22 +16,6 @@ You can install from the following types of media: get the distribution files from there. - FTP Get the distribution files from an anonymous ftp server - (you will be presented with a list). Please note that - you may invoke FTP in "Active"/"Passive" auto-mode, or - via an HTTP proxy. - - By default, ftp(1) will automatically use the best mode - for the server. Using an HTTP proxy is sometimes necessary - for firewalls which block all FTP connections. - - If you chose to enter your own URL in the FTP menu, please - note that all paths are *relative* to the home directory - of the user being logged in as. By default, this is the - user "ftp" (anonymous ftp) but you may change this in the - Options screen. - - HTTP Direct Get the distribution files directly from an HTTP server. diff --git a/usr.sbin/bsdconfig/include/messages.subr b/usr.sbin/bsdconfig/include/messages.subr index b9ddd8e2f466..267743e87b0a 100644 --- a/usr.sbin/bsdconfig/include/messages.subr +++ b/usr.sbin/bsdconfig/include/messages.subr @@ -93,10 +93,8 @@ msg_could_not_unmount_the_cdrom_dvd="Could not unmount the CDROM/DVD from %s: %s msg_could_not_unmount_the_dos_partition="Could not unmount the DOS partition from %s: %s" msg_could_not_unmount_the_nfs_partition="Could not unmount the NFS partition from %s: %s" msg_could_not_unmount_the_ufs_partition="Could not unmount the UFS partition from %s: %s" -msg_couldnt_connect_to_ftp_server="Couldn't connect to FTP server" msg_couldnt_connect_to_proxy="Couldn't connect to proxy" msg_couldnt_connect_to_server="Couldn't connect to server" -msg_couldnt_open_ftp_connection="Couldn't open FTP connection to %s:\n %s." msg_create_new="Create New" msg_created_path="Created %s" msg_czech_republic="Czech Republic" @@ -147,8 +145,6 @@ msg_france="France" msg_french_desc="Ported software for French countries." msg_ftp="FTP" msg_ftp_desc="FTP client and server utilities." -msg_ftp_passive="FTP Passive" -msg_ftp_username="FTP username" msg_generating_index_from_pkg_database="Generating INDEX from pkg(8) database\n(this can take a while)..." msg_geography_desc="Geography-related software." msg_german_desc="Ported software for Germanic countries." @@ -171,8 +167,6 @@ msg_install_from_a_dos_partition="Install from a DOS partition" msg_install_from_a_freebsd_cd_dvd="Install from a FreeBSD CD/DVD" msg_install_from_a_ufs_partition="Install from a UFS partition" msg_install_from_a_usb_drive="Install from a USB drive" -msg_install_from_an_ftp_server="Install from an FTP server" -msg_install_from_an_ftp_server_thru_firewall="Install from an FTP server through a firewall" msg_install_from_an_ftp_server_thru_proxy="Install from an FTP server through an HTTP proxy" msg_install_from_an_http_server="Install from an HTTP server" msg_install_from_the_existing_filesystem="Install from the existing filesystem" @@ -224,7 +218,6 @@ msg_media_timeout="Media Timeout" msg_media_type="Media Type" msg_menu_text="If you've already installed FreeBSD, you may use\nthis menu to customize it somewhat to suit your\nparticular configuration. Most importantly, you\ncan use the Packages utility to load extra '3rd\nparty' software not provided in the base\ndistributions." msg_misc_desc="Miscellaneous utilities." -msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized." msg_multimedia_desc="Multimedia software." msg_must_be_root_to_execute="%s: must be root to execute" msg_must_have_pkg_to_execute="%s: must have pkg(8) to execute" @@ -294,7 +287,6 @@ msg_please_enter_the_username_you_wish_to_login_as="Please enter the username yo msg_please_enter_username_password="Please enter a username and password for sudo(8):" msg_please_select_a_category_to_display="Please select a category to display." msg_please_select_a_cd_dvd_drive="FreeBSD can be installed directly from a CD/DVD containing a valid\nFreeBSD distribution. If you are seeing this menu it is because\nmore than one CD/DVD drive was found on your system. Please select\none of the following CD/DVD drives as your installation drive." -msg_please_select_a_freebsd_ftp_distribution_site="Please select a FreeBSD FTP distribution site" msg_please_select_a_freebsd_http_distribution_site="Please select a FreeBSD HTTP distribution site" msg_please_select_a_usb_drive="You have more than one USB drive. Please choose which drive\nyou would like to use." msg_please_select_dos_partition="FreeBSD can be installed directly from a DOS partition assuming,\nof course, that you have copied the relevant distributions into\nyour DOS partition before starting this installation. If this is\nnot the case then you should reboot DOS at this time and copy the\ndistributions you wish to install into a \"FREEBSD\" subdirectory\non one of your DOS partitions. Otherwise, please select the DOS\npartition containing the FreeBSD distribution files." @@ -331,7 +323,6 @@ msg_rescan_devices="Re-scan Devices" msg_reset="RESET!" msg_reset_all_values_to_startup_defaults="Reset all values to startup defaults" msg_return_to_previous_menu="Return to previous menu" -msg_reuse_old_ftp_site_selection_values="Re-use old FTP site selection values?" msg_reuse_old_http_site_settings="Re-use old HTTP site settings?" msg_review="Review" msg_review_desc="Review/perform pending actions" @@ -370,7 +361,6 @@ msg_sorry_try_again="Sorry, try again." msg_south_africa="South Africa" msg_spain="Spain" msg_spanish_desc="Ported software for the Spanish market." -msg_specify_some_other_ftp_site="Specify some other ftp site by URL" msg_specify_some_other_http_site="Specify some other http site by URL" msg_sweden="Sweden" msg_sysutils_desc="Various system utilities." @@ -390,7 +380,6 @@ msg_ukrainian_desc="Ported software for the Ukrainian market." msg_unable_to_configure_device="Unable to configure the %s interface!\nThis installation method cannot be used." msg_unable_to_fetch_package_from_selected_media="Unable to fetch package %s from selected media.\nNo package add will be done." msg_unable_to_get_file_from_selected_media="Unable to get %s file from selected media.\n\nThis may be because the packages collection is not available\non the distribution media you've chosen, most likely an FTP site\nwithout the packages collection mirrored. Please verify that\nyour media, or your path to the media, is correct and try again." -msg_unable_to_get_proper_ftp_path="Unable to get proper FTP path. FTP media not initialized." msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract." msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!" msg_unable_to_open="Unable to open %s" diff --git a/usr.sbin/bsdconfig/share/media/Makefile b/usr.sbin/bsdconfig/share/media/Makefile index 2cbce2d492b2..e90b87f70cc2 100644 --- a/usr.sbin/bsdconfig/share/media/Makefile +++ b/usr.sbin/bsdconfig/share/media/Makefile @@ -1,7 +1,7 @@ FILESDIR= ${SHAREDIR}/bsdconfig/media FILES= any.subr cdrom.subr common.subr directory.subr dos.subr \ - ftp.subr http.subr httpproxy.subr network.subr \ + http.subr httpproxy.subr network.subr \ nfs.subr options.subr tcpip.subr ufs.subr usb.subr wlan.subr .include diff --git a/usr.sbin/bsdconfig/share/media/any.subr b/usr.sbin/bsdconfig/share/media/any.subr index ea4fef0b5151..2c6720be364d 100644 --- a/usr.sbin/bsdconfig/share/media/any.subr +++ b/usr.sbin/bsdconfig/share/media/any.subr @@ -34,7 +34,6 @@ f_include $BSDCFG_SHARE/dialog.subr f_include $BSDCFG_SHARE/media/cdrom.subr f_include $BSDCFG_SHARE/media/directory.subr f_include $BSDCFG_SHARE/media/dos.subr -f_include $BSDCFG_SHARE/media/ftp.subr f_include $BSDCFG_SHARE/media/http.subr f_include $BSDCFG_SHARE/media/httpproxy.subr f_include $BSDCFG_SHARE/media/nfs.subr @@ -69,15 +68,14 @@ f_media_get_type() local prompt="$msg_choose_installation_media_description" local menu_list=" '1 $msg_cd_dvd' '$msg_install_from_a_freebsd_cd_dvd' - '2 $msg_ftp' '$msg_install_from_an_ftp_server' - '3 $msg_http_proxy' + '2 $msg_http_proxy' '$msg_install_from_an_ftp_server_thru_proxy' - '4 $msg_http_direct' '$msg_install_from_an_http_server' - '5 $msg_directory' '$msg_install_from_the_existing_filesystem' + '3 $msg_http_direct' '$msg_install_from_an_http_server' + '4 $msg_directory' '$msg_install_from_the_existing_filesystem' '6 $msg_nfs' '$msg_install_over_nfs' - '7 $msg_dos' '$msg_install_from_a_dos_partition' - '8 $msg_ufs' '$msg_install_from_a_ufs_partition' - 'A $msg_usb' '$msg_install_from_a_usb_drive' + '6 $msg_dos' '$msg_install_from_a_dos_partition' + '7 $msg_ufs' '$msg_install_from_a_ufs_partition' + '8 $msg_usb' '$msg_install_from_a_usb_drive' 'X $msg_options' '$msg_view_set_various_media_options' " # END-QUOTE local hline="$hline_choose_help_for_more_information_on_media_types" @@ -119,7 +117,6 @@ f_media_get_type() case "$mtag" in ?" $msg_cd_dvd") f_media_set_cdrom ;; - ?" $msg_ftp") f_media_set_ftp ;; ?" $msg_http_proxy") f_media_set_http_proxy ;; ?" $msg_http_direct") f_media_set_http ;; ?" $msg_directory") f_media_set_directory ;; diff --git a/usr.sbin/bsdconfig/share/media/ftp.subr b/usr.sbin/bsdconfig/share/media/ftp.subr deleted file mode 100644 index 05c551c7f3d6..000000000000 --- a/usr.sbin/bsdconfig/share/media/ftp.subr +++ /dev/null @@ -1,840 +0,0 @@ -if [ ! "$_MEDIA_FTP_SUBR" ]; then _MEDIA_FTP_SUBR=1 -# -# Copyright (c) 2012-2013 Devin Teske -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# -############################################################ INCLUDES - -BSDCFG_SHARE="/usr/share/bsdconfig" -. $BSDCFG_SHARE/common.subr || exit 1 -f_dprintf "%s: loading includes..." media/ftp.subr -f_include $BSDCFG_SHARE/device.subr -f_include $BSDCFG_SHARE/dialog.subr -f_include $BSDCFG_SHARE/media/common.subr -f_include $BSDCFG_SHARE/media/tcpip.subr -f_include $BSDCFG_SHARE/strings.subr -f_include $BSDCFG_SHARE/struct.subr -f_include $BSDCFG_SHARE/variable.subr - -BSDCFG_LIBE="/usr/libexec/bsdconfig" -f_include_lang $BSDCFG_LIBE/include/messages.subr - -############################################################ GLOBALS - -FTP_SKIP_RESOLV= - -URL_MAX=261261 # according to actual fetch(1) test-results - -FTP_DIRS=" - . - releases/$UNAME_P - snapshots/$UNAME_P - pub/FreeBSD - pub/FreeBSD/releases/$UNAME_P - pub/FreeBSD/snapshots/$UNAME_P - pub/FreeBSD-Archive/old-releases/$UNAME_P -" # END-QUOTE - -############################################################ FUNCTIONS - -# f_dialog_menu_media_ftp -# -# Prompt the user to select from a range of ``built-in'' FTP servers or specify -# their own. If the user makes a choice and doesn't cancel or press Esc, stores -# the user's choice in VAR_FTP_PATH (see variables.subr) and returns success. -# -f_dialog_menu_media_ftp() -{ - f_dialog_title "$msg_please_select_a_freebsd_ftp_distribution_site" - local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE" - f_dialog_title_restore - local prompt="$msg_please_select_the_site_closest_to_you_or_other" - local menu_list=" - '$msg_main_site' 'download.freebsd.org' - '$msg_australia $msg_v6' 'ftp.au.freebsd.org' - ' $msg_australia #3' 'ftp3.au.freebsd.org' - '$msg_austria $msg_v6' 'ftp.at.freebsd.org' - '$msg_brazil #2' 'ftp2.br.freebsd.org' - ' $msg_brazil #3' 'ftp3.br.freebsd.org' - '$msg_bulgaria $msg_v6' 'ftp.bg.freebsd.org' - '$msg_czech_republic $msg_v6' 'ftp.cz.freebsd.org' - '$msg_denmark $msg_v6' 'ftp.dk.freebsd.org' - '$msg_finland' 'ftp.fi.freebsd.org' - '$msg_france $msg_v6' 'ftp.fr.freebsd.org' - ' $msg_france #3' 'ftp3.fr.freebsd.org' - ' $msg_france #6' 'ftp6.fr.freebsd.org' - '$msg_germany $msg_v6' 'ftp.de.freebsd.org' - ' $msg_germany #1 $msg_v6' 'ftp1.de.freebsd.org' - ' $msg_germany #2 $msg_v6' 'ftp2.de.freebsd.org' - ' $msg_germany #5 $msg_v6' 'ftp5.de.freebsd.org' - ' $msg_germany #7 $msg_v6' 'ftp7.de.freebsd.org' - '$msg_greece $msg_v6' 'ftp.gr.freebsd.org' - ' $msg_greece #2 $msg_v6' 'ftp2.gr.freebsd.org' - '$msg_japan $msg_v6' 'ftp.jp.freebsd.org' - ' $msg_japan #2' 'ftp2.jp.freebsd.org' - ' $msg_japan #3' 'ftp3.jp.freebsd.org' - ' $msg_japan #4' 'ftp4.jp.freebsd.org' - ' $msg_japan #6 $msg_v6' 'ftp6.jp.freebsd.org' - '$msg_korea' 'ftp.kr.freebsd.org' - ' $msg_korea #2' 'ftp2.kr.freebsd.org' - '$msg_latvia' 'ftp.lv.freebsd.org' - '$msg_netherlands $msg_v6' 'ftp.nl.freebsd.org' - ' $msg_netherlands #2' 'ftp2.nl.freebsd.org' - '$msg_new_zealand' 'ftp.nz.freebsd.org' - '$msg_norway $msg_v6' 'ftp.no.freebsd.org' - '$msg_poland $msg_v6' 'ftp.pl.freebsd.org' - '$msg_russia $msg_v6' 'ftp.ru.freebsd.org' - ' $msg_russia #2' 'ftp2.ru.freebsd.org' - '$msg_slovenia $msg_v6' 'ftp.si.freebsd.org' - '$msg_south_africa $msg_v6' 'ftp.za.freebsd.org' - ' $msg_south_africa #2 $msg_v6' 'ftp2.za.freebsd.org' - ' $msg_south_africa #4' 'ftp4.za.freebsd.org' - '$msg_sweden $msg_v6' 'ftp.se.freebsd.org' - '$msg_taiwan #4' 'ftp4.tw.freebsd.org' - ' $msg_taiwan #5' 'ftp5.tw.freebsd.org' - '$msg_uk' 'ftp.uk.freebsd.org' - ' $msg_uk #2' 'ftp2.uk.freebsd.org' - '$msg_ukraine $msg_v6' 'ftp.ua.freebsd.org' - '$msg_usa #5 $msg_v6' 'ftp5.us.freebsd.org' - ' $msg_usa #11 $msg_v6' 'ftp11.us.freebsd.org' - ' $msg_usa #14' 'ftp14.us.freebsd.org' - " # END-QUOTE - local hline="$msg_select_a_site_thats_close" - - local height width rows - eval f_dialog_menu_size height width rows \ - \"\$title\" \ - \"\$btitle\" \ - \"\$prompt\" \ - \"\$hline\" \ - $menu_list - - local mtag - mtag=$( eval $DIALOG \ - --title \"\$title\" \ - --backtitle \"\$btitle\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $menu_list \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) || return $DIALOG_CANCEL - f_dialog_data_sanitize mtag - - case "$mtag" in - URL) setvar $VAR_FTP_PATH "other" ;; - *) - local value - value=$( eval f_dialog_menutag2item \"\$mtag\" $menu_list ) - setvar $VAR_FTP_PATH "ftp://$value" - esac - - return $DIALOG_OK -} - -# f_media_set_ftp -# -# Return success if we both found and set the media type to be an FTP server. -# Variables from variable.subr that can be used to script user input: -# -# VAR_FTP_PATH -# Can be a URL (including "ftp://" protocol-prefix) or "other" -# (user is prompted to enter FTP URL). If a URL, can optionally -# contain directory prefix after hostname/port. Valid examples -# include: -# ftp://myhost -# ftp://somename:21/pub/ -# ftp://192.168.2.3/pub/ -# ftp://[::1]:21/ -# The default port if not specified is 21. -# VAR_NAMESERVER [Optional] -# If set, overrides resolv.conf(5) and sets the nameserver that -# is used to convert names into addresses (when a name converts -# into multiple addresses, the first address to successfully -# connect is used). -# -# Meanwhile, the following variables from variable.subr are set after -# successful execution: -# -# VAR_FTP_HOST -# The FTP host to connect to, parsed from VAR_FTP_PATH. In the -# example case of IPv6 where VAR_FTP_PATH is "ftp://[::1]", this -# variable will be set to "::1" (the outer brackets are removed). -# VAR_FTP_PORT -# The TCP port to connect to, parsed from VAR_FTP_PATH. Usually -# 21 unless VAR_FTP_PATH was of one of the following forms: -# ftp://hostname:OTHER_PORT -# ftp://hostname:OTHER_PORT/* -# ftp://ip:OTHER_PORT -# ftp://ip:OTHER_PORT/* -# ftp://[ip6]:OTHER_PORT -# ftp://[ip6]:OTHER_PORT/* -# VAR_FTP_DIR -# If VAR_FTP_PATH contained a directory element (e.g., -# "ftp://localhost/pub") this variable contains only the -# directory element (e.g., "/pub"). -# -f_media_set_ftp() -{ - f_media_close - - local url - f_getvar $VAR_FTP_PATH url - - # If we've been through here before ... - if f_struct device_network && [ "${url#$msg_other}" ]; then - f_dialog_yesno "$msg_reuse_old_ftp_site_selection_values" || - url= - fi - - if [ ! "$url" ]; then - f_dialog_menu_media_ftp || return $FAILURE - f_getvar $VAR_FTP_PATH url - fi - [ "$url" ] || return $FAILURE - - case "$url" in - other) - setvar $VAR_FTP_PATH "ftp://" - f_variable_get_value $VAR_FTP_PATH \ - "$msg_please_specify_url_of_a_freebsd_distribution" - f_getvar $VAR_FTP_PATH url - if [ ! "${url#ftp://}" ]; then - unset $VAR_FTP_PATH - return $FAILURE - fi - if [ ${#url} -gt ${URL_MAX:-261261} ]; then - f_show_msg "$msg_length_of_specified_url_is_too_long" \ - ${#url} ${URL_MAX:-261261} - unset $VAR_FTP_PATH - return $FAILURE - fi - case "$url" in - ftp://*) : valid URL ;; - *) - f_show_msg "$msg_sorry_invalid_url" "$url" - unset $VAR_FTP_PATH - return $FAILURE - esac - esac - case "$url" in - ftp://*) : valid URL ;; - *) - f_show_msg "$msg_sorry_invalid_url" "$url" - unset $VAR_FTP_PATH - return $FAILURE - esac - - # Set the name of the FTP device to the URL - f_struct_new DEVICE device_ftp - device_ftp set name "$url" - - if ! f_struct device_network || - ! f_dialog_yesno "$msg_youve_already_done_the_network_configuration" - then - f_struct device_network && - f_device_shutdown device_network - if ! f_device_select_tcp; then - unset $VAR_FTP_PATH - return $FAILURE - fi - local dev if - f_getvar $VAR_NETWORK_DEVICE if - f_device_find -1 "$if" $DEVICE_TYPE_NETWORK dev - f_struct_copy "$dev" device_network - fi - if ! f_device_init device_network; then - f_dprintf "f_media_set_ftp: %s" "$msg_net_device_init_failed" - unset $VAR_FTP_PATH - return $FAILURE - fi - - local hostname="${url#*://}" port=21 dir=/ - case "$hostname" in - # - # The order in-which the below individual cases appear is important! - # - "["*"]":*/*) # IPv6 address with port and directory - f_dprintf "Looks like an IPv6 addr with port/dir: %s" \ - "$hostname" - hostname="${hostname#\[}" - port="${hostname#*\]:}" - port="${port%%[!0-9]*}" - dir="/${hostname#*/}" - hostname="${hostname%%\]:*}" - ;; - "["*"]":*) # IPv6 address with port - f_dprintf "Looks like an IPv6 addr with port: %s" "$hostname" - hostname="${hostname#\[}" - port="${hostname#*\]:}" - port="${port%%[!0-9]*}" - hostname="${hostname%%\]:*}" - ;; - "["*"]"/*) # IPv6 address with directory - f_dprintf "Looks like an IPv6 addr with dir: %s" "$hostname" - hostname="${hostname#\[}" - dir="/${hostname#*/}" - hostname="${hostname%%\]*}" - ;; - "["*"]") # IPv6 address - f_dprintf "Looks like an IPv6 addr: %s" "$hostname" - hostname="${hostname#\[}" - hostname="${hostname%\]}" - ;; - # - # ^^^ IPv6 above / DNS Name or IPv4 below vvv - # - *:*/*) # DNS name or IPv4 address with port and directory - f_dprintf "Looks like a %s with port/dir: %s" \ - "DNS name or IPv4 addr" "$hostname" - port="${hostname#*:}" - port="${port%%[!0-9]*}" - dir="/${hostname#*/}" - hostname="${hostname%%:*}" - ;; - *:*) # DNS name or IPv4 address with port - f_dprintf "Looks like a DNS name or IPv4 addr with port: %s" \ - "$hostname" - port="${hostname#*:}" - hostname="${hostname%%:*}" - ;; - */*) # DNS name or IPv4 address with directory - f_dprintf "Looks like a DNS name or IPv4 addr with dir: %s" \ - "$hostname" - dir="/${hostname#*/}" - hostname="${hostname%%/*}" - ;; - *) # DNS name or IPv4 address - f_dprintf "Looks like a DNS name or IPv4 addr: %s" "$hostname" - : leave hostname as-is - esac - - f_dprintf "hostname = \`%s'" "$hostname" - f_dprintf "dir = \`%s'" "$dir" - f_dprintf "port \# = \`%d'" "$port" - - local ns - f_getvar $VAR_NAMESERVER ns - [ "$ns" ] || f_resolv_conf_nameservers ns - if [ "$ns" -a ! "$FTP_SKIP_RESOLV" ] && ! { - f_validate_ipaddr "$hostname" || - f_validate_ipaddr6 "$hostname" - }; then - f_show_info "$msg_looking_up_host" "$hostname" - f_dprintf "%s: Looking up hostname, %s, using host(1)" \ - "f_media_set_ftp" "$hostname" - if ! f_quietly f_host_lookup "$hostname"; then - f_show_msg "$msg_cannot_resolve_hostname" "$hostname" - f_struct device_network && - f_device_shutdown device_network - f_struct_free device_network - unset $VAR_FTP_PATH - return $FAILURE - fi - f_dprintf "Found DNS entry for %s successfully." "$hostname" - fi - - setvar $VAR_FTP_HOST "$hostname" - setvar $VAR_FTP_PORT "$port" - setvar $VAR_FTP_DIR "$dir" - - device_ftp set type $DEVICE_TYPE_FTP - device_ftp set init f_media_init_ftp - device_ftp set get f_media_get_ftp - device_ftp set shutdown f_media_shutdown_ftp - device_ftp set private device_network - f_struct_copy device_ftp device_media - f_struct_free device_ftp - - return $SUCCESS -} - -# f_media_set_ftp_active -# -# Wrapper to f_media_set_ftp to access FTP servers actively. -# -f_media_set_ftp_active() -{ - setvar $VAR_FTP_STATE "active" - f_media_set_ftp -} - -# f_media_set_ftp_passive -# -# Wrapper to f_media_set_ftp to access FTP servers passively. -# -f_media_set_ftp_passive() -{ - setvar $VAR_FTP_STATE "passive" - f_media_set_ftp -} - -# f_media_set_ftp_userpass -# -# Prompt the user to enter/confirm the username/password variables that will -# be used to communicate with the FTP servers. Returns success if the user does -# not cancel or press Esc to either username or password. -# -# Variables from variable.subr that can be used to script user input: -# -# VAR_FTP_USER -# The username to send via ftp(1) when connecting to an FTP -# server. -# VAR_FTP_PASS -# The password to send with the above username. -# -# Does not prompt for confirmation of values if VAR_NONINTERACTIVE is set (see -# variable.subr for more information). -# -f_media_set_ftp_userpass() -{ - local user pass - f_variable_get_value $VAR_FTP_USER \ - "$msg_please_enter_the_username_you_wish_to_login_as" - f_getvar $VAR_FTP_USER user - if [ "$user" ]; then - f_variable_get_value $VAR_FTP_PASS \ - "$msg_please_enter_the_password_for_this_user" - f_getvar $VAR_FTP_PASS pass - else - pass= - fi - [ "$pass" ] # Return status -} - -# f_device_network_up $device -# -# Brings up attached network device, if any - takes FTP device as arg. -# -f_device_network_up() -{ - local dev="$1" netDev - f_struct "$dev" || return $FAILURE - $dev get private netDev || return $SUCCESS # No net == happy net -debug=1 f_dprintf "netDev=[$netDev]" - f_device_init $netDev -} - -# f_device_network_down $device -# -# Brings down attached network device, if any - takes FTP device as arg. -# -f_device_network_down() -{ - local dev="$1" netDev - f_struct "$dev" || return $FAILURE - $dev get private netDev || return $SUCCESS - f_device_shutdown $netDev -} - -# f_media_init_ftp $device -# -# Initializes the FTP media device. Returns success if both able to log into -# the FTP server and confirm the existence of at least one known release path -# using ftp(1). -# -# Variables from variable.subr used to initialize the connection are as follows -# (all of which are configured by f_media_set_ftp above): -# -# VAR_FTP_PATH -# The unparsed FTP URL representing the server to contact. -# Usually "ftp://server" for example. Can contain TCP port number -# and/or directory path (but should not contain username/password -# info). -# VAR_FTP_HOST -# The FTP host to connect to. Can be an IPv4 address (e.g., -# 127.0.0.1), IPv6 address (e.g., ::1), or DNS hostname. Usually -# set automatically in f_media_set_ftp() by parsing VAR_FTP_PATH. -# VAR_FTP_PORT -# The TCP port to connect to. Usually set automatically in -# f_media_set_ftp() by parsing VAR_FTP_PATH. -# VAR_FTP_DIR -# The base FTP directory to use when downloading files from the -# FTP server. Usually set automatically in f_media_set_ftp() by -# parsing VAR_FTP_PATH. -# VAR_FTP_USER [Optional] -# If unset, defaults to using anonymous access. -# VAR_FTP_PASS [Optional] -# If unset, defaults to a sensible value. -# -# In addition, the following (managed either manually or by f_media_set_ftp_*): -# -# VAR_FTP_STATE -# Sets FTPMODE for ftp(1) and can be one of: -# active active mode FTP only -# auto automatic determination of passive or active -# (this is the default) -# gate gate-ftp mode -# passive passive mode FTP only -# See ftp(1) for additional information. -# -# And last, but not least (managed automatically or manually): -# -# VAR_RELNAME -# Defaults to being set to $(uname -r) but can be overridden. -# This sets the name of a release to look for as part of a well -# known set of paths to search for release data once connected -# via FTP. If set to "__RELEASE" or "any" then the VAR_FTP_DIR is -# taken as the absolute path to the release and no further -# searching is done (see FTP_DIRS above in the GLOBALS section -# for a list of well known paths that are used when searching for -# a VAR_RELNAME sub-directory). -# -f_media_init_ftp() -{ - local dev="$1" - local url - - $dev get name url - f_dprintf "Init routine called for FTP device. url=[%s]" "$url" - - if [ "$FTP_INITIALIZED" ]; then - f_dprintf "FTP device already initialized." - return $SUCCESS - fi - - # If we can't initialize the network, bag it! - f_device_network_up $dev || return $FAILURE - - local cp - while :; do - f_getvar $VAR_FTP_PATH cp - if [ ! "$cp" ]; then - if ! f_media_set_ftp || - ! f_getvar $VAR_FTP_PATH cp || - [ ! "$cp" ] - then - f_show_msg "$msg_unable_to_get_proper_ftp_path" - f_device_network_down $dev - return $FAILURE - fi - fi - - local ftp_host ftp_dir - if ! { - f_getvar $VAR_FTP_HOST ftp_host && - f_getvar $VAR_FTP_DIR ftp_dir - }; then - f_show_msg "$msg_missing_ftp_host_or_directory" - f_device_network_down $dev - return $FAILURE - fi - - local ftp_port - f_getvar $VAR_FTP_PORT ftp_port - local host="$ftp_host" port="${ftp_port:+:$ftp_port}" - case "$host" in *:*) host="[$host]"; esac - - local user pass use_anon= - f_getvar $VAR_FTP_USER user - if [ ! "$user" ]; then - user="anonymous" - use_anon=1 - fi - if ! f_getvar $VAR_FTP_PASS pass; then - f_getvar $VAR_HOSTNAME cp - if f_running_as_init; then - pass="installer@$cp" - else - local name="$( id -un 2> /dev/null )" - pass="${name:-ftp}@$cp" - fi - fi - - f_show_info "$msg_logging_in_to_user_at_host" \ - "$user" "$ftp_host" - - local userpass="" - if [ ! "$use_anon" ] && [ "$user" -o "$pass" ]; then - userpass="$user${pass:+:$( f_uriencode "$pass" )}" - userpass="$userpass${userpass:+@}" - fi - - local mode rx - f_getvar $VAR_FTP_STATE mode - - if [ "$ftp_dir" ]; then - if ! rx=$( - printf 'cd "%s"\npwd\n' "$ftp_dir" | eval \ - FTPMODE=\"\$mode\" \ - ${use_anon:+FTPANONPASS=\"\$pass\"} \ - ftp -V ${use_anon:+-a} \ - \"ftp://\$userpass\$host\$port\" \ - 2>&1 - ); then - f_show_msg "$msg_couldnt_open_ftp_connection" \ - "$ftp_host" "$rx" - break # to failure - fi - if echo "$rx" | awk -v dir="/${ftp_dir#/}" ' - BEGIN { - found = 0 - if ( dir != "/" ) sub("/$", "", dir) - } - /^Remote directory: / { - sub(/^[^:]*:[[:space:]]*/, "") - if ($0 != dir) next - found = 1; exit - } - END { exit ! found } - '; then - setvar $VAR_FTP_DIR "$ftp_dir" - setvar $VAR_FTP_PATH \ - "ftp://$ftp_host/${ftp_dir#/}" - else - f_show_msg \ - "$msg_please_check_the_url_and_try_again" \ - "ftp://$ftp_host/${ftp_dir#/}" - break # to failure - fi - fi - - # - # Now that we've verified that the path we're given is ok, - # let's try to be a bit intelligent in locating the release we - # are looking for. First off, if the release is specified as - # "__RELEASE" or "any", then just assume that the current - # directory is the one we want and give up. - # - local rel - f_getvar $VAR_RELNAME rel - f_dprintf "f_media_init_ftp: rel=[%s]" "$rel" - - case "$rel" in - __RELEASE|any) - FTP_INITIALIZED=YES - return $SUCCESS - ;; - *) - # - # Ok, since we have a release variable, let's walk - # through the list of directories looking for a release - # directory. First successful CWD wins. - # - if ! rx=$( - for dir in $FTP_DIRS; do - # Avoid confusing some servers - [ "$dir" = "." ] && continue - printf 'cd "/%s/%s"\npwd\n' \ - "$dir" "$rel" - done | eval \ - FTPMODE=\"\$mode\" \ - ${use_anon:+FTPANONPASS=\"\$pass\"} \ - ftp -V ${use_anon:+-a} \ - \"ftp://\$userpass\$host\$port\" \ - 2>&1 - ); then - f_show_msg "$msg_couldnt_open_ftp_connection" \ - "$ftp_host" "$rx" - break # to failure - fi - - local fdir - if fdir=$( echo "$rx" | awk ' - /^Remote directory: / { - sub(/^[^:]*:[[:space:]]*/, "") - if ($0 == "/") next - # Exit after the first dir - found++; print; exit - } - END { exit ! found } - ' ); then - setvar $VAR_FTP_DIR "$fdir" - setvar $VAR_FTP_PATH "ftp://$ftp_host$fdir" - FTP_INITIALIZED=YES - return $SUCCESS - else - f_yesno "$msg_cant_find_distribution" \ - "$rel" "$ftp_host" - if [ $? -eq $DIALOG_OK ]; then - unset $VAR_FTP_PATH - f_media_set_ftp && continue - fi - fi - esac - break # to failure - done - - unset FTP_INITIALIZED $VAR_FTP_PATH - f_device_network_down $dev - return $FAILURE -} - -# f_media_get_ftp $device $file [$probe_type] -# -# Returns data from $file on an FTP server using ftp(1). Please note that -# $device is unused but must be present (even if null). Information is instead -# gathered from the environment. If $probe_type is present and non-NULL, -# returns success if $file exists. If $probe_type is equal to $PROBE_SIZE, -# prints the size of $file in bytes to standard-out. -# -# Variables from variable.subr used to configure the connection are as follows -# (all of which are configured by f_media_set_ftp above): -# -# VAR_FTP_HOST -# FTP host to connect to. Can be an IPv4 address, IPv6 address, -# or DNS hostname of your choice. -# VAR_FTP_PORT -# TCP port to connect on; see f_media_set_ftp() above. -# VAR_FTP_USER [Optional] -# If unset, defaults to using anonymous access. -# VAR_FTP_PASS [Optional] -# If unset, defaults to a sensible value. -# -# In addition, the following (managed either manually or by f_media_set_ftp_*): -# -# VAR_FTP_STATE -# Sets FTPMODE for ftp(1) and can be one of: -# active active mode FTP only -# auto automatic determination of passive or active -# (this is the default) -# gate gate-ftp mode -# passive passive mode FTP only -# See ftp(1) for additional information. -# -# See variable.subr for additional information. -# -# Example usage: -# f_media_set_ftp -# f_media_get_ftp media $file -# -f_media_get_ftp() -{ - local funcname=f_media_get_ftp - local dev="$1" file="$2" probe_type="$3" hosts= - - f_dprintf "f_media_get_ftp: dev=[%s] file=[%s] probe_type=%s" \ - "$dev" "$file" "$probe_type" - - local ftp_host ftp_port - f_getvar $VAR_FTP_HOST ftp_host - f_getvar $VAR_FTP_PORT ftp_port - - if [ ! "$FTP_INITIALIZED" ]; then - f_dprintf "No FTP connection open, can't get file %s" "$file" - return $FAILURE - fi - - if ! { - f_validate_ipaddr "$ftp_host" || - f_validate_ipaddr6 "$ftp_host" || - { - f_dprintf "%s: Looking up hostname, %s, using host(1)" \ - "f_media_get_ftp" "$ftp_host" - f_host_lookup "$ftp_host" hosts - } - }; then - # All the above validations failed - [ "$hosts" ] && f_dialog_msgbox "$hosts" - return $FAILURE - elif [ ! "$hosts" ]; then - # One of the first two validations passed - hosts="$ftp_host" - fi - - local host connected= - for host in $hosts; do - f_quietly nc -nz "$host" "$ftp_port" || continue - connected=1; break - done - if [ ! "$connected" ]; then - f_show_msg "$msg_couldnt_connect_to_ftp_server %s:%s" \ - "$ftp_host" "$ftp_port" - return $FAILURE - fi - - local user pass use_anon= - f_getvar $VAR_FTP_USER user - if [ ! "$user" ]; then - user="anonymous" - use_anon=1 - fi - if ! f_getvar $VAR_FTP_PASS pass; then - f_getvar $VAR_HOSTNAME cp - if f_running_as_init; then - pass="installer@$cp" - else - local name="$( id -un 2> /dev/null )" - pass="${name:-ftp}@$cp" - fi - fi - *** 173 LINES SKIPPED *** From nobody Thu Oct 5 12:44:24 2023 X-Original-To: dev-commits-src-main@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 4S1WTh44f0z4wZZW; Thu, 5 Oct 2023 12:44:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1WTh3G8rz3gYk; Thu, 5 Oct 2023 12:44:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696509864; 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=TnPiW007NpTW4cebJ+i491kLqUCF41k4t8RoW9fGT44=; b=yzpUrde0D3Z0Hj6V+t8knzcrhdiqIDJButK/AwuVQ6xuDAJbaz/QDJ7L2PpPkMw+N2fqzc gR56HXBvZE7R0kEDr+LN3UCv8tT+e1BtNdLFdVX46APcUcegJze+kKtlbvy0WJ+MOaOIwv 5dVULNGPQtzOscnaZEDjPNVgCVif2OfWtxVjtM5knH6fec+yYCxjPJ9/FCL9SrLGNDEZDx dUXkvNnusHIOcM6bRHpSD8y4EqL015aAwOdq9OiI4drh83XhCHZegJHGdeNHvaAVsW+9aa 9x9Sn9L9PO4WHJGOuj2ULeBXsRM+h0GWd57SYMjNq+MY2hySkkQ2EohEWqK0PQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696509864; a=rsa-sha256; cv=none; b=Q7hHOCOSIV/K5es37ry6uYEajxAaS5g2hm8PjCO3ZEpUiGPzNEPR8pE2ALqWUoQzAo42Jd TTYWwh9TnJ232JtCbeeCgYp6iBUzioIq7DM4c8mePrXSsiZCGN3yMeQGTfpCT8aQ84mr8l zV7GWMct6YsYr27GOtcD/0JmxeZp70VKBk9iW57zId5ooy2ZRPbfGefX+EARWlPjg5w4pJ Nk4DEspZTuYxC4rhdU2mYyfyYsCG59U+JZGQKelVez49DQO14imA29V5uh13RrFuYvSNVt XS4l4HbP+m/V0uItQltgq8ZzCvccqoorWOXRjw9ZK/ejbBLFm1fJNsOBP5keXA== 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=1696509864; 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=TnPiW007NpTW4cebJ+i491kLqUCF41k4t8RoW9fGT44=; b=vwR53ORvqI8oEKi6bJ0w+pvmSKpcR70LZ8xzU22wXOJIVg/tVssn+iBKIiSvvXNZqG9Lhi n7l3/+Tc9Wf1WDNFLMuxS4nyxmpIGH47I6MSX0OtmI7hyU+F2UjGZwHq6nP5QncVKHADRG naAmGwFBNRDbg+wQScgQjCdmJJ6nU+RohwrAloKtxVzhCbVju8CKJ6WT6+vSmyvPIvRKoY l+kyFUrucncq3eSmh4rYY8wuP++h0l29lpJ9MOgIs39qnGviWohhc2oPiJgjqloAr9QKYz 5KV1ETrXe3camTjdhKJK2TNLs8ZFQsh4QxnuDC1XilfEN/pC7vg8U+IsAR5sgg== 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 4S1WTh2CSkz1KQx; Thu, 5 Oct 2023 12:44:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395CiOr6027134; Thu, 5 Oct 2023 12:44:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395CiOHc027131; Thu, 5 Oct 2023 12:44:24 GMT (envelope-from git) Date: Thu, 5 Oct 2023 12:44:24 GMT Message-Id: <202310051244.395CiOHc027131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 5ad9edd4565c - main - bsdconfig: use working respositories List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ad9edd4565cdb657da3677b292b772ff573d4df Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=5ad9edd4565cdb657da3677b292b772ff573d4df commit 5ad9edd4565cdb657da3677b292b772ff573d4df Author: Baptiste Daroussin AuthorDate: 2023-10-05 12:43:19 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 12:44:18 +0000 bsdconfig: use working respositories pkg(8) packages have not been published in ftp.freebsd.org, so remove this option --- usr.sbin/bsdconfig/share/media/http.subr | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bsdconfig/share/media/http.subr b/usr.sbin/bsdconfig/share/media/http.subr index c4b1b131d236..e23f1abe27db 100644 --- a/usr.sbin/bsdconfig/share/media/http.subr +++ b/usr.sbin/bsdconfig/share/media/http.subr @@ -76,7 +76,6 @@ f_dialog_menu_media_http() f_dialog_title_restore local prompt="$msg_please_select_the_site_closest_to_you_or_other" local menu_list=" - 'dist $msg_main_site' 'ftp.freebsd.org' 'pkg $msg_main_site' 'pkg.freebsd.org' 'URL' '$msg_specify_some_other_http_site' " # END-QUOTE From nobody Thu Oct 5 12:44:48 2023 X-Original-To: dev-commits-src-main@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 4S1WV82zGqz4wZkd; Thu, 5 Oct 2023 12:44:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1WV826d8z3gtb; Thu, 5 Oct 2023 12:44:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696509888; 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=bB+5mncnGS9EE4YEf1tbP+F03swS5HD7l6sj6oQqi+Q=; b=yuRE2mGfCNMTMak1S64nOJ2VP5dpwwJjUlSAT+zsaVIN+0gG6o/4kJoZib0QBPeWkzpEqX HJr82n7o+Ft5g/YigpNMlN0H2zxb5uYvrB0U/GjACUv3/lyFOBKMfc2FA+UqKDNWT1UPym y4a/b5/KgE5C7F1ilUntZjtKDLx1ghu3Ot8QQcyfIo7eCGBCQjgXZKxUj4R0Fmf9me7mjq m/iv4UZqWp7qtnSMpliI2pDDmWgRawrEN9PIOQPx/xbmvRXmeaH8RU9ydr3U9p8/9VQMsQ ehL1T+4/OokkFVBUb5ui9VY+1W3mL4fHNCfbxESHTMBAOee59UKFr5o0K21PxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696509888; a=rsa-sha256; cv=none; b=NlSM6n4HYaG+t97xSmr7N1ab8jCMMY6M5kFwTcQPE2ohdIGyG8A71g/sQICaJiwBonUgPG kPnTDIZhxR5yetOlMbsNNscYI1v4yWRdsLK2YB8lMWFColn9MhWjy2KJXgPPhLYkVbmBAY l1X+Jr2bbm8D3zhYQb4uPAmpDIUm6Rkz9nTjLtN8QQ+nRhdfsmQKsxo+3bmdBQ5+q6S6Uo d+1kK9kGeXkfbclrpuwsasUEhdmu3ag7fA1KF5xtbgwz7Vl9NOA0tDwSPfFMljU9jhQdTz r4rBz5kmlgEGJGgaiRLn0tvboEu0XMoSOBAmNqbu4C6BFhAJdaiVLI1kgFt+MQ== 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=1696509888; 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=bB+5mncnGS9EE4YEf1tbP+F03swS5HD7l6sj6oQqi+Q=; b=nk5KjQBOXqBN0S+UmPQjphCnnBre3VQWSALe01TNqDybMg15xJR5ry2fdVjPwKHa/9fsZu v54IkyzZSjDE3zQHLO8FUH4g80QLTI9joYwVRsYI5BEwfhgYaR3a9hy79ORpjw9s6oNvwo fUjick1XmNJTbWQxqlVuWcFipfTQHOgUctwUhugyrY5ER50k+TANsCpVu84FTh041ZdAU6 jlbtM85P1EJL8NeueS5mGDNhImVl0zgVfEdDA4DyKifQvtFfO6/9h01k13Wh4S/eR2QMVt SyrMNuLWCnxK0NpAT6bYo8nO84zucJMqvzNsbJ/8XycsLZkXjs8mcr6CUsj4ug== 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 4S1WV80t5Jz1KQy; Thu, 5 Oct 2023 12:44:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395Cim1o027351; Thu, 5 Oct 2023 12:44:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395CimUE027348; Thu, 5 Oct 2023 12:44:48 GMT (envelope-from git) Date: Thu, 5 Oct 2023 12:44:48 GMT Message-Id: <202310051244.395CimUE027348@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 2749c222da8a - main - vfs cache: sanitize debug counters List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2749c222da8a6325d39c0571f72b1dbed2f7d583 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2749c222da8a6325d39c0571f72b1dbed2f7d583 commit 2749c222da8a6325d39c0571f72b1dbed2f7d583 Author: Mateusz Guzik AuthorDate: 2023-10-05 12:16:18 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-05 12:44:42 +0000 vfs cache: sanitize debug counters They are very rarely triggered, so no need for per-cpu distribution. At the same time the non-cpu ones still should use atomics to not lose any updates. --- sys/kern/vfs_cache.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 6ae4239cc11d..00632716a2ec 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -628,17 +628,14 @@ static SYSCTL_NODE(_vfs_cache, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Name cache debugging"); #define DEBUGNODE_ULONG(name, varname, descr) \ SYSCTL_ULONG(_vfs_cache_debug, OID_AUTO, name, CTLFLAG_RD, &varname, 0, descr); -#define DEBUGNODE_COUNTER(name, varname, descr) \ - static COUNTER_U64_DEFINE_EARLY(varname); \ - SYSCTL_COUNTER_U64(_vfs_cache_debug, OID_AUTO, name, CTLFLAG_RD, &varname, \ - descr); -DEBUGNODE_COUNTER(zap_bucket_relock_success, zap_bucket_relock_success, +static u_long zap_bucket_relock_success; +DEBUGNODE_ULONG(zap_bucket_relock_success, zap_bucket_relock_success, "Number of successful removals after relocking"); -static long zap_bucket_fail; +static u_long zap_bucket_fail; DEBUGNODE_ULONG(zap_bucket_fail, zap_bucket_fail, ""); -static long zap_bucket_fail2; +static u_long zap_bucket_fail2; DEBUGNODE_ULONG(zap_bucket_fail2, zap_bucket_fail2, ""); -static long cache_lock_vnodes_cel_3_failures; +static u_long cache_lock_vnodes_cel_3_failures; DEBUGNODE_ULONG(vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed"); @@ -1739,7 +1736,7 @@ cache_zap_unlocked_bucket(struct namecache *ncp, struct componentname *cnp, cache_zap_locked(rncp); mtx_unlock(blp); cache_unlock_vnodes(dvlp, vlp); - counter_u64_add(zap_bucket_relock_success, 1); + atomic_add_long(&zap_bucket_relock_success, 1); return (0); } @@ -1835,7 +1832,7 @@ retry: error = cache_zap_locked_bucket(ncp, cnp, hash, blp); if (__predict_false(error != 0)) { - zap_bucket_fail++; + atomic_add_long(&zap_bucket_fail, 1); goto retry; } counter_u64_add(numposzaps, 1); @@ -2061,7 +2058,7 @@ negative_success: counter_u64_add(numnegzaps, 1); error = cache_zap_locked_bucket(ncp, cnp, hash, blp); if (__predict_false(error != 0)) { - zap_bucket_fail2++; + atomic_add_long(&zap_bucket_fail2, 1); goto retry; } cache_free(ncp); @@ -2259,8 +2256,8 @@ cache_lock_vnodes_cel_3(struct celockstate *cel, struct vnode *vp) } else { if (mtx_trylock(vlp)) goto out; - cache_lock_vnodes_cel_3_failures++; cache_unlock_vnodes_cel(cel); + atomic_add_long(&cache_lock_vnodes_cel_3_failures, 1); if (vlp < cel->vlp[0]) { mtx_lock(vlp); mtx_lock(cel->vlp[0]); From nobody Thu Oct 5 12:44:49 2023 X-Original-To: dev-commits-src-main@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 4S1WV93fL9z4wZgy; Thu, 5 Oct 2023 12:44:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1WV92yV4z4CnP; Thu, 5 Oct 2023 12:44:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696509889; 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=iQzMiGgRG7J9kC5BX1focLPzktVQ90DQ6UJSn0WxEr8=; b=FE0dkaWBWpFdziAKM+PLQbjJFzVTbbYAfzBq0Vbu0RRtybpIg7q+wgWu71OuL/NPzhXeix Wyu9YkCgOLsstfvE1sICVWT1fjGyiIKUZM3A7DpOdJ6WRr6jsU7pJHGZDqKYuzkZxpwY7m paYLKy79bWW0rW2xpfQF4wsAD/G12NutiaH1jqxQlm/KO8LVkUrCjaOZ2jEx3iIw6Qb1ax iMUs7lcmPJIT+7oAcxTox2hCI1FzAy3z4A1yZ6ldm6xz5Jdd5wvtM/lu/nWEp03iK2uSPn 6zkX8+juThdsWqlN6TQz2qpCjDUaJWm5fWG6n4LgVmyBXiJdQ+2jRi+DzbfRAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696509889; a=rsa-sha256; cv=none; b=r2YAzKHqqdhgCRWpDUVyEdXW8oJptScKNRkA0aCbZhpgNV8g0LAFkJ1OXpU2ty9Xs+XBAh Vv1Zb7Y2BkxoQ6virqY30wHQDbIh4igLuFr5aD8I3D45gfeStDpOzscfigHbI/kW34vUrT VpmsN9vYQGxQR90fqpxBh0l39U7Vs4vnrOao6NHG6qHACCmYI7Exyo15cBwNdVT/guF7Zl 96M6WMq4QuVbeTGg6vWvMeLE15aMURS4XLdU1wlkF8wt6pg2wDbEp82UdAg6/ErqnSHR9h aiVxHeCghcIadOpGDBqFwud1oJPxiuglP2hQQsVa//i4dRO8+m2fDjTHTAmAMA== 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=1696509889; 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=iQzMiGgRG7J9kC5BX1focLPzktVQ90DQ6UJSn0WxEr8=; b=JpcahhnsqW8TdPuQrPIcOfeXxzmW5T7Q4jjr2QesojYa+5U/Na+qJhG3NCaQ96LPYp1ZBL Gtwnr/kgOzl+O15yRja9a4S54NT0lCb3sEiFv21pYxdbT+bcQDLy4+BJPoKqALRDaz/7VC KC3lppDMkBk4xl6RLpVQbzhJaGXleOiG/P5Wo9ccIXeSa+EHU50Uqwe3zeafnLKgkeZq2B PX6vLoXjrT7/U5cJyDfkSGH1vs+uglq3YNEA9+lzcyM2dbc3LnN2h7m1ZMPQv0xsVvdmFL Px+6jX5ERaKVC6/AX2rrqUZW9vNckQjXzYEQncPTilArkFrDjk/2xHeZHGGQ2Q== 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 4S1WV922hPz1KR0; Thu, 5 Oct 2023 12:44:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395Cinsn027410; Thu, 5 Oct 2023 12:44:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395Cin3k027407; Thu, 5 Oct 2023 12:44:49 GMT (envelope-from git) Date: Thu, 5 Oct 2023 12:44:49 GMT Message-Id: <202310051244.395Cin3k027407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 0f15054f7990 - main - vfs cache: plug a hypothetical corner case when freeing List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f15054f7990f9c772bea34778a8838aa05ebed8 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0f15054f7990f9c772bea34778a8838aa05ebed8 commit 0f15054f7990f9c772bea34778a8838aa05ebed8 Author: Mateusz Guzik AuthorDate: 2023-09-23 02:04:06 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-05 12:44:42 +0000 vfs cache: plug a hypothetical corner case when freeing cache_zap_unlocked_bucket is called with a bunch of addresses and without any locks held, forcing it to revalidate everything from scratch. It did not account for a case where the entry is reallocated with everything the same except for the target vnode. Should the target use a different lock than the one expected, freeing would proceed without being properly synchronized. Note this is almost impossible to happen in practice. --- sys/kern/vfs_cache.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 00632716a2ec..560ff7d441c0 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1720,6 +1720,7 @@ cache_zap_unlocked_bucket(struct namecache *ncp, struct componentname *cnp, struct mtx *blp) { struct namecache *rncp; + struct mtx *rvlp; cache_assert_bucket_unlocked(ncp); @@ -1732,14 +1733,24 @@ cache_zap_unlocked_bucket(struct namecache *ncp, struct componentname *cnp, !bcmp(rncp->nc_name, cnp->cn_nameptr, rncp->nc_nlen)) break; } - if (rncp != NULL) { - cache_zap_locked(rncp); - mtx_unlock(blp); - cache_unlock_vnodes(dvlp, vlp); - atomic_add_long(&zap_bucket_relock_success, 1); - return (0); - } + if (rncp == NULL) + goto out_mismatch; + + if (!(ncp->nc_flag & NCF_NEGATIVE)) + rvlp = VP2VNODELOCK(rncp->nc_vp); + else + rvlp = NULL; + if (rvlp != vlp) + goto out_mismatch; + + cache_zap_locked(rncp); + mtx_unlock(blp); + cache_unlock_vnodes(dvlp, vlp); + atomic_add_long(&zap_bucket_relock_success, 1); + return (0); + +out_mismatch: mtx_unlock(blp); cache_unlock_vnodes(dvlp, vlp); return (EAGAIN); From nobody Thu Oct 5 12:44:50 2023 X-Original-To: dev-commits-src-main@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 4S1WVB4g7hz4wZp1; Thu, 5 Oct 2023 12:44:50 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1WVB41Gjz4CYb; Thu, 5 Oct 2023 12:44:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696509890; 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=1rl8tUNqrMM1534FurhcO+jWmTw5C+unksvZUGJaT10=; b=ImXQEEnGZPSUAT16X4s+dXhREwq8R/o66X9wEk43mkqYZchUrwCqjFU7a1nSOi225v/qjB O/5MYIPlTmHsL7cRzRAcptKDxTMPmKkOPMQChpM2/KUazmqg8WuJhhdx920fDuZPjDiv24 92EOn1tyHm7LGp85is9tz2gcx0FBDqUWLJ0KoAjhIzFyfdEZsemhn9uiNH2CfK6U5CgYyo J4MYTOff8eWdBU6F1RklOfbvi0R0Bk7et6mLQrHHmFbwmPqPW9xzH4eRknjJQCNsxpwAxM bAf+gsaHxXwMakG9t791klWvmMFZTum44jMNVrmz1wcA43xvugBMoIlJTDbUyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696509890; a=rsa-sha256; cv=none; b=pwRn5soMdGJrYhoeWUlUOzpL0XEOE80Y9YtBk9nP0Iou3w5BP89mRAe0UPlyD4q0AJ9Ejo GRV65SFPVvIqtRTaepwwAhXtB8v0HBQM1L3kB1ETYjTVdUm8b2DcsuDPLLP8KqgtSdLiKJ 5h8UfZZpWSYNbQb6L3iKVvfJvmuWhbqnf1rS5QzdZxxQlo6PsF3Y3gHDOCWfr0URDQ7RiR Dn8q0SpMjY3HYbQyszd4UA4Njvlynkw8Fc1xoue3/ET7xMIwK1C0cWRwqZjUIWfh22JvAE hWwp3OPcLIB/3oRcRHg8n+oZ6fprkvBzvb9cYgdgEShLqilUOMgjuZboixxPsA== 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=1696509890; 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=1rl8tUNqrMM1534FurhcO+jWmTw5C+unksvZUGJaT10=; b=io2FP73KaT3wTMHC+Hodd7dzQJUXgnHeedNRD9qH1yEgMmlq6rY2VVHazjdJdB0mE3Byxm GObh3C5eD3vAOKr8d9Qp3BWCWjN4tUDPmUgvoYYaTovukRNl92o9+fqOzqihKp9hT5SxMq jMgf9JGaEBc3jIEIMrqPJwp/QwoWA8ailAYDwwECMQVAuw33W178AhR/YN3wCKDUPq7hy5 Nm02gPMfHeS3hkBjM4MMnXB98rfmJbVzfWneV0dnFbYmWfX6LGES6ek7sFT6/qi4fUekMa 2eimY4IuZmkl/5Wlvw55AWcwl1geo1O3KXrTtND7eArFDbQzKKxlOKwitJv6QA== 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 4S1WVB34Lkz1KlB; Thu, 5 Oct 2023 12:44:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395CioLa027461; Thu, 5 Oct 2023 12:44:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395CioXl027458; Thu, 5 Oct 2023 12:44:50 GMT (envelope-from git) Date: Thu, 5 Oct 2023 12:44:50 GMT Message-Id: <202310051244.395CioXl027458@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: cd2105d691f4 - main - vfs cache: denote a known bug in cache_remove_cnp List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd2105d691f446f7dbddf5965d82b9e9103bc8d2 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2105d691f446f7dbddf5965d82b9e9103bc8d2 commit cd2105d691f446f7dbddf5965d82b9e9103bc8d2 Author: Mateusz Guzik AuthorDate: 2023-10-05 12:32:29 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-05 12:44:43 +0000 vfs cache: denote a known bug in cache_remove_cnp --- sys/kern/vfs_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 560ff7d441c0..cc2f405d5281 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1822,6 +1822,15 @@ retry_dotdot: return (1); } + /* + * XXX note that access here is completely unlocked with no provisions + * to keep the hash allocated. If one is sufficiently unlucky a + * parallel cache resize can reallocate the hash, unmap backing pages + * and cause the empty check below to fault. + * + * Fixing this has epsilon priority, but can be done with no overhead + * for this codepath with sufficient effort. + */ hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); blp = HASH2BUCKETLOCK(hash); retry: From nobody Thu Oct 5 12:44:51 2023 X-Original-To: dev-commits-src-main@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 4S1WVC6tscz4wZkl; Thu, 5 Oct 2023 12:44:51 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1WVC4gCYz4CWt; Thu, 5 Oct 2023 12:44:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696509891; 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=KwlB48N6Gf2oS0dneumjCoZZnGKYOPMNjL7VWlr+DBM=; b=wW3gMpyicC/JFhN2M628In+P2hp6zFNi1V3fr1nvUmwApcVwxj68ygMB9rIHVpGv3VgJmm jTeRIBjaiuKgYdLlF1zrOhuCoM+r9JBffZrkeaMdpKc2lcp3uHPeph55UJJy2aYUbhYjAI 9o/QBtHHN7R6IyP0OhSvo+BM6N6PWogYGegl5B6WqAHjnzkI0jhT1Z7ev5nzPyxCqsuYzV X33wG+8Y4zAE/+lcL8USJoDQkwnHdaTnSE4ysymdFZYjscWnDYD1nJX1SAhyIxaaApEnQS gNrdUBTgYHabFebIn5GfZk1ttdgaAw5roroN//3W9VwFKA9SQ0SVFOLv17PSPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696509891; a=rsa-sha256; cv=none; b=t0FRgPJZPj7LP48ZLZK5lppVd3OX+nkm4ubrlDhotVj3NFTfgr0YB7iAbub32PmLasnQcX ZAjLuCMbBLPthATDHnWB5dwc48IC+6F5Ni5LuTuYw2WVEh3RDzO5trMdH7z2e15q0blX5h HGuOXERmxhyB/kRmwpEzSBZYN9sqRRnMDliBYhvtPL+Ho8n7mIqYfMexT/BCRz/Y8/2jcP s+iNi5nfbeqOx1at8g2X8ERmfiZgsLEo3t/qo6dmE5W7MFJmRwzd/MEet4UhRoD92TDKYi q+ZuXYjaXQSHOJQJ0X/4YkePxsPTqJ2g2mn5jX9ypg75g3PnE8qLJzApVSRlxw== 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=1696509891; 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=KwlB48N6Gf2oS0dneumjCoZZnGKYOPMNjL7VWlr+DBM=; b=WEBiHLFd4v4R6AKitntZJF7KEzqjMOEbyNUG+3QOpyvxukg0uyFpAv/qewonoOk0lqsSal lw8NSnBOMISsuVR3tYmK5yMnS7n4HVI5nBfO5W9poA98z6XMuvz25XREti/W+yTo8aYqYo 1KPR0s+cu4aBNXeTc8zZGsy4pG28IzYeENWd3+6n2Vb5XOM6K6RS6UxiSTWOCXf0nUphdq UYtaB8yHDrCzxuVEIFFTEYlsYCtB9PWks7CBylcfNARRHBKs17J6PmQLPd0oY1zIFYp2Ia hAJjjxuZtf8YH4NA7qY1+zCG8iXEpCtVnrVfVO4MkXRS6Q2kDuTFgnFJ1BwCHg== 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 4S1WVC3mtsz1L5N; Thu, 5 Oct 2023 12:44:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395CipAn027509; Thu, 5 Oct 2023 12:44:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395CipkC027506; Thu, 5 Oct 2023 12:44:51 GMT (envelope-from git) Date: Thu, 5 Oct 2023 12:44:51 GMT Message-Id: <202310051244.395CipkC027506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 8b622172ba44 - main - vfs cache: add 2 more optimizaiton ideas List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b622172ba44f914092c1d44cecb2b101eb8e17b Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8b622172ba44f914092c1d44cecb2b101eb8e17b commit 8b622172ba44f914092c1d44cecb2b101eb8e17b Author: Mateusz Guzik AuthorDate: 2023-10-05 12:38:32 +0000 Commit: Mateusz Guzik CommitDate: 2023-10-05 12:44:43 +0000 vfs cache: add 2 more optimizaiton ideas --- sys/kern/vfs_cache.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index cc2f405d5281..99e293d5a873 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -276,6 +276,20 @@ * It could become part of the API contract to *always* have a rootvnode set in * mnt_rootvnode. Such vnodes are annotated with VV_ROOT and vnlru would have * to be modified to always skip them. + * + * === inactive on v_usecount reaching 0 + * + * VOP_NEED_INACTIVE should not exist. Filesystems would indicate need for such + * processing with a bit in usecount. + * + * === v_holdcnt + * + * Hold count should probably get eliminated, but one can argue it is a useful + * feature. Even if so, handling of v_usecount could be decoupled from it -- + * vnlru et al would consider the vnode not-freeable if has either hold or + * usecount on it. + * + * This would eliminate 2 atomics. */ static SYSCTL_NODE(_vfs, OID_AUTO, cache, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, From nobody Thu Oct 5 14:27:32 2023 X-Original-To: dev-commits-src-main@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 4S1Ymh63Ngz4wqvs; Thu, 5 Oct 2023 14:27:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1Ymh5YT9z4PWC; Thu, 5 Oct 2023 14:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696516052; 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=+kqDVDptzNnPHGpL5Ho8Z9w8wfZULQbLNe29sMOHgs4=; b=XB6z04IsACltt0U5n201rXgXCwwfpkKmoxa/wooVr89QGZBBUPKYBIjGKd4wGZ6jfg+SMR heMmHfTDj4OALX2XW9pt8PQnaLLki7NrPTrrq+p4PAlat5d3JElWfxFAbVUl/atA86P6ol iKCO2TRujOmrlj6/KHGARtYOlu00RmB+Wy9VqOouJJPk7dIOKtZRmfQFPwZJMbj6NW3Sz6 SPZYJuSRZuV9cOw99JR13vdHcvD5odcxca+XdVMuFavM7WeO3Zv5HfgzV6MjF4GZUYSIV9 6uZeMhYiJRYz15AhD0xJCrxUFirJU0WXxBhUwCFcVECPS1nhgXUvliftPxuT8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696516052; a=rsa-sha256; cv=none; b=gKnD1AHAz5YTWwbwSTvHz//74Q86iVEFIH6g/4bb3RyVMllM701tgCQNXb13egyNfJQD+z uJDI7S/xSOU0xfzC9+5Sxyl+6n+MEBsox9OHzeWwIGmFD2hfQBBpxFGfcIO6+a6nnhiPbR IY54uq0M694NxYm01Ok0OVvfWgiYKqzqcX/8xaNI+6phkaCaz8K/59j3WVHMgz6LOZQobT ySsqEtMH4KWyxktFsQ8BqTF9q+GblxyOjLiF02ptVm852ay4M/baOGtJe/Nrj6WQ851qu/ 6xAhsiiGZn4hFmo02TtCvkwbZaWy6h8sYCJxBvwHAYFBzUaJWBNeP/y7o+LLWw== 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=1696516052; 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=+kqDVDptzNnPHGpL5Ho8Z9w8wfZULQbLNe29sMOHgs4=; b=NJfwmTo7QaPCk56O0b3D9Mcsy+SSRYoO1z/oWUPl2Xq3dU/TTVo9e9tNQp/VC97kn+u2q4 vUZSf/E1znrzeJzuEX5eDP7954upEKgbt8gK8wK6v0N0RMkNUT9oUQza1vjOqPuPCyBHFv tsXR4xNbxhoPVKWo5jBVldxPlWKqrxqt/OYEO4y52aZnQseBmdUcq4cbF14Cy+Ffwp3mgo s0i/GsoDESdeSNpps/eKK1+oNIppqW1PQCxqUtffH+9pbSolxEPEwBSgQvrgoq0g89r1t4 pzadMnxf1ATJfzI3vbHKJASoCNt+kDDy+yOkAWiRv98q1da9yw6EeKb/Wj0bTQ== 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 4S1Ymh4cxKz1MbW; Thu, 5 Oct 2023 14:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395ERWpB094858; Thu, 5 Oct 2023 14:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395ERWd3094855; Thu, 5 Oct 2023 14:27:32 GMT (envelope-from git) Date: Thu, 5 Oct 2023 14:27:32 GMT Message-Id: <202310051427.395ERWd3094855@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 7d48224073ce - main - netlink: fix accessing freed memory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d48224073ce14f0dd3db2d4e96876ac928b52f2 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=7d48224073ce14f0dd3db2d4e96876ac928b52f2 commit 7d48224073ce14f0dd3db2d4e96876ac928b52f2 Author: Bjoern A. Zeeb AuthorDate: 2023-09-30 15:11:57 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-05 14:27:10 +0000 netlink: fix accessing freed memory The check for if_addrlen in dump_iface() is not sufficient to determine if we still have a valid if_addr. Rather than directly accessing if_addr check the STAILQ (for the first entry). This avoids panics when destroying cloned interfaces as experienced with net80211 wlan ones. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jhibbits (earlier version), kp Differential Revision: https://reviews.freebsd.org/D42027 --- sys/netlink/route/iface.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index e1939c7681de..b6e120933f83 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -292,6 +292,7 @@ static bool dump_iface(struct nl_writer *nw, if_t ifp, const struct nlmsghdr *hdr, int if_flags_mask) { + struct epoch_tracker et; struct ifinfomsg *ifinfo; NL_LOG(LOG_DEBUG3, "dumping interface %s data", if_name(ifp)); @@ -321,11 +322,15 @@ dump_iface(struct nl_writer *nw, if_t ifp, const struct nlmsghdr *hdr, nlattr_add_u8(nw, IFLA_PROTO_DOWN, val); nlattr_add_u8(nw, IFLA_LINKMODE, val); */ - if (if_getaddrlen(ifp) != 0) { - struct ifaddr *ifa = if_getifaddr(ifp); + if (if_getaddrlen(ifp) != 0) { + struct ifaddr *ifa; - dump_sa(nw, IFLA_ADDRESS, ifa->ifa_addr); - } + NET_EPOCH_ENTER(et); + ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); + if (ifa != NULL) + dump_sa(nw, IFLA_ADDRESS, ifa->ifa_addr); + NET_EPOCH_EXIT(et); + } if ((if_getbroadcastaddr(ifp) != NULL)) { nlattr_add(nw, IFLA_BROADCAST, if_getaddrlen(ifp), From nobody Thu Oct 5 14:30:25 2023 X-Original-To: dev-commits-src-main@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 4S1Yr159xSz4wrMF; Thu, 5 Oct 2023 14:30:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1Yr14hgvz4QB9; Thu, 5 Oct 2023 14:30:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696516225; 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=/tWPIbTgs+tCzlMe3zHPqrvYErgHUIy0ULedQUOBuOE=; b=cnbXm2NMn1bhXYe8miVTy/5NyvfR32ChZudRjo1J8zVqURUt5JcDJaq8AZiociiqNk2tAr n9TQpDEBTcpSpE3ubsW1GWC0844MfHW+muXBMYvsgXJvSi96UHn5ThRI1FSbb54gbq/tXS DNWENFVsVsyxAMzdw0FmPZvONKKdx5W+qcLTrlScvF//HBKsJ7z20eCrzvEGl+rX6Pw0XV YlanZL9E/yL/MSC9EakmDcUrXlHGFbD0LFThBnjgjbmbHy0DikvRb3jXL8JSzRefPq1jzI KSDM2a9zsvyRYg7nD8IbJxlqCWLZrqzzx9VKxXgZTbE5qvHgRqYwFNk5PmFQDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696516225; a=rsa-sha256; cv=none; b=Ujjl/yZP6H6B7rlU6qTpslGUtdC9M/jTLHd+zUzeldAfXcFQKbPnHUAulT/kxE0Eohw43i LL/cM2ipRvBTaAaHhATpJxE28+6N9wF9Ls5nTyZ+W9KorWqwt9tqT6b1AyRiI3HsFDbVtc 2dzLKs1fhgaXRv0+Av7l1zbjNMkYGmzFdLAOoa8HE6bnzmociZa9A63E6KsVkxYv5l4jt5 grwOsGcGkSEI0z6Uez0nZQQYBcqfk0YkAl2lVtWpfhHo22/SqNKqN32dZjJgdjvqnRZF5X CMzYgP8AoXDYvTXonKgYEPzSRRRm9o05FqTDAf637jaUlten1yMUtmtQEoEJ+w== 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=1696516225; 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=/tWPIbTgs+tCzlMe3zHPqrvYErgHUIy0ULedQUOBuOE=; b=MrCJsn4rn02MJQrzHdkkX99fjq3gZE2uMU3tHCe8pjUkwmXd2JIrjpKxijNor58zyhVRoY 5wmKUkMJ7Z1Ym5+BjT7Q+LVCA/my/TwiA4bHhilWg6kjYewuJbQiSQaaoRjI8qV2Pdk5f8 ioSgYYjP8pBVlxRiOK89n66aoYZA+d4qq+Hzc2Gq+EzyDGDyvgT7eayENViT2UhGC4q7Z8 Tlyl/s0Boci78djSbbYkckCFZb9YISCpstE8EgyOkS6Qg/66YUlNAwQ1lVgZM+kLuTATGo Rt6l9F4TDv8kapEcIkvCFOXWbaKPcifZWuSkQ+wvHxHPM8X3FW3QhjE2NvhsIQ== 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 4S1Yr13lFHz1NNf; Thu, 5 Oct 2023 14:30:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395EUPsO003827; Thu, 5 Oct 2023 14:30:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395EUPxd003824; Thu, 5 Oct 2023 14:30:25 GMT (envelope-from git) Date: Thu, 5 Oct 2023 14:30:25 GMT Message-Id: <202310051430.395EUPxd003824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1137943b1c5b - main - net80211: remove ieee80211_unref_node() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1137943b1c5b225e30b82350ff7fb12c258ea90f Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1137943b1c5b225e30b82350ff7fb12c258ea90f commit 1137943b1c5b225e30b82350ff7fb12c258ea90f Author: Bjoern A. Zeeb AuthorDate: 2023-10-02 14:30:46 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-05 14:28:55 +0000 net80211: remove ieee80211_unref_node() ieee80211_unref_node() was only used in two error cases in ieee80211_send_nulldata(). There we do not need to guard against ni pointer reuse after decrementing the refcount of the ni as we only update the stats and return. Update the man page and remove the link for the now gone function. Sponsored by: The FreeBSD Foundation X-MFC: never Reviewed by: adrian, emaste Differential Revision: https://reviews.freebsd.org/D42035 --- ObsoleteFiles.inc | 3 +++ share/man/man9/Makefile | 3 +-- share/man/man9/ieee80211_node.9 | 15 ++++----------- sys/net80211/ieee80211_node.h | 7 ------- sys/net80211/ieee80211_output.c | 4 ++-- 5 files changed, 10 insertions(+), 22 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 09e18daa7abf..c3cc72351963 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20231005: Remove man page link for now gone net80211 function. +OLD_FILES+=usr/share/man/man9/ieee80211_unref_node.9.gz + # 20231005: bsdconfig remove support for floppy and ftp OLD_FILES+=usr/share/bsdconfig/media/floppy.subr OLD_FILES+=usr/share/bsdconfig/media/ftp.subr diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 1e38eaf8adae..0b56a47db332 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1212,8 +1212,7 @@ MLINKS+=ieee80211_node.9 ieee80211_dump_node.9 \ ieee80211_node.9 ieee80211_find_rxnode_withkey.9 \ ieee80211_node.9 ieee80211_free_node.9 \ ieee80211_node.9 ieee80211_iterate_nodes.9 \ - ieee80211_node.9 ieee80211_ref_node.9 \ - ieee80211_node.9 ieee80211_unref_node.9 + ieee80211_node.9 ieee80211_ref_node.9 MLINKS+=ieee80211_output.9 ieee80211_process_callback.9 \ ieee80211_output.9 M_SEQNO_GET.9 \ ieee80211_output.9 M_WME_GETAC.9 diff --git a/share/man/man9/ieee80211_node.9 b/share/man/man9/ieee80211_node.9 index 8340b4762b67..6dd492e3b33d 100644 --- a/share/man/man9/ieee80211_node.9 +++ b/share/man/man9/ieee80211_node.9 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 28, 2010 +.Dd October 2, 2023 .Dt IEEE80211_NODE 9 .Os .Sh NAME @@ -50,9 +50,6 @@ .Fn ieee80211_ref_node "struct ieee80211_node *" .\" .Ft void -.Fn ieee80211_unref_node "struct ieee80211_node *" -.\" -.Ft void .Fn ieee80211_free_node "struct ieee80211_node *" .\" .Ft void @@ -106,14 +103,10 @@ Routines that lookup a table entry return a (i.e. a pointer to a table entry with the reference count incremented). The .Fn ieee80211_ref_node -and -.Fn ieee80211_unref_node -calls explicitly increment/decrement the reference count of a node, -but are rarely used. -Instead most callers use +call explicitly increments the reference count of a node. .Fn ieee80211_free_node -to release a reference and, if the count goes to zero, reclaim the -table entry. +decrements the reference count of a node and if the count goes to zero +reclaims the table entry. .Pp The station table and its entries are exposed to drivers in several ways. Each frame transmitted to a station includes a reference to the diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 826ecccb1238..685df28ed519 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -326,13 +326,6 @@ ieee80211_ref_node(struct ieee80211_node *ni) return ni; } -static __inline void -ieee80211_unref_node(struct ieee80211_node **ni) -{ - ieee80211_node_decref(*ni); - *ni = NULL; /* guard against use */ -} - void ieee80211_node_attach(struct ieee80211com *); void ieee80211_node_lateattach(struct ieee80211com *); void ieee80211_node_detach(struct ieee80211com *); diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 2358ba009e13..a02073ae8d9c 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1104,7 +1104,7 @@ ieee80211_send_nulldata(struct ieee80211_node *ni) if (vap->iv_state == IEEE80211_S_CAC) { IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT | IEEE80211_MSG_DOTH, ni, "block %s frame in CAC state", "null data"); - ieee80211_unref_node(&ni); + ieee80211_node_decref(ni); vap->iv_stats.is_tx_badstate++; return EIO; /* XXX */ } @@ -1122,7 +1122,7 @@ ieee80211_send_nulldata(struct ieee80211_node *ni) m = ieee80211_getmgtframe(&frm, ic->ic_headroom + hdrlen, 0); if (m == NULL) { /* XXX debug msg */ - ieee80211_unref_node(&ni); + ieee80211_node_decref(ni); vap->iv_stats.is_tx_nobuf++; return ENOMEM; } From nobody Thu Oct 5 14:33:31 2023 X-Original-To: dev-commits-src-main@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 4S1Yvb2lKWz4wrZY; Thu, 5 Oct 2023 14:33:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1Yvb2HdDz4R03; Thu, 5 Oct 2023 14:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696516411; 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=sprP77EsOPni5psai9secDnzb3Yr3sWht0KTuKaHmKY=; b=Imx2/c2Z3xeZqnC92bo9Q7R+X1+xqNb2v6ZZW83DMBdxLYv6QpnABue7W/iSERS5JqK4z+ BFbmpfAjVh/Vz4lAcg/thYA8UQntjLprsuqSCgxQS4BRM3ow+QhYubdU294z1hD8gxE/5Z ZRFQOoLGQWilTbSPU4SXErClPNqMKo04CU3oxpu7cuxduXKZCmIPYZ+IsGvX+I6E4RKmjZ JWfjpKUtAD35d6fXD7S0eXo6PtBdnzlr+cJed6q63njuv0Bu5u3+BU++xXeDHwDgwGcTR6 JQRsk/TxtSCZC51bmmA30IHPpwfhrRH/FBK26qr8Pjl25cEBBlyDJdaglVHHNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696516411; a=rsa-sha256; cv=none; b=cbDEg4CNEFkJjzAyawC9Ejp6x5YsCg6//GsA2QDAV14eJMBW/IFXUzz+EL5mwMJLi6+B+N bEw1EodNa5tnDBXgxJG+qPHXrcJhV3EzBnKZygRaimIPQMDeMlhXnT5IXK8XTWgM2qU+9t 1opVzNSIQ3NDTdQN0fom6Ezu2e/CwRzRS99bBnUkL/9bzOGM/xH70yB7FJSdlcE55Daaa8 4jju6FoahwHW7L1YWBXC5a4wJTtnIadlIA1wWnXbyqt3xdZrnaUXxStd6YFMRBgrh6YHS1 QPVTdoXedQ09cYM2glTE7FAqLkVisryPooV3tro5bUmi4UeoPb58kFGwZORU/A== 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=1696516411; 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=sprP77EsOPni5psai9secDnzb3Yr3sWht0KTuKaHmKY=; b=VcyRV+LCChgMqvNc3nOQLjJ0VvUJQgFQX8PSEYMc9Z8CvvoIj58bDI0MC2MIqiT+T5ux15 3BE7l+8bJJwmA/r1E9WfiXVWeL4t1md9RJig3B1mC0FuqFfv+0EXDRrHkWVzAV3cRrZ0pH ZKhnqk1qNA8qSPKlc5lTpuwGbok6aA6zzZqpGKLD9oYU1ayNrDtgAQthnuIEv8UBXMa+AD j62WcqlDuRRgEogdG68H/46ryho9f44/UCDvtDX6yNVTsppnXE3SKm2JE09cVrqPsa0HU0 yGJcjyG28AozMYX2QSUsAlL7D7KTQtmR0FtFLElW5DpS3PN9n+xOWWKIgtnLtw== 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 4S1Yvb1LN0z1NbQ; Thu, 5 Oct 2023 14:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395EXVTW010711; Thu, 5 Oct 2023 14:33:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395EXV5x010708; Thu, 5 Oct 2023 14:33:31 GMT (envelope-from git) Date: Thu, 5 Oct 2023 14:33:31 GMT Message-Id: <202310051433.395EXV5x010708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4f3b2bba240b - main - rtw88: Use RF_CFGCH instead of hard coded 0x18 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f3b2bba240b6e0603b5cbb47155fd8215bcbcb3 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4f3b2bba240b6e0603b5cbb47155fd8215bcbcb3 commit 4f3b2bba240b6e0603b5cbb47155fd8215bcbcb3 Author: Bjoern A. Zeeb AuthorDate: 2023-10-05 14:01:48 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-05 14:30:58 +0000 rtw88: Use RF_CFGCH instead of hard coded 0x18 While debugging some funky register reads of 0xaeaea from RF_CFGCH resulting in "rtw880: [TXGAPK] unknown channel 234!!" more of these reads came to my attention hidden by using the register index rather than the defined value. Make this more grep-able. MFC after: 3 days --- sys/contrib/dev/rtw88/rtw8822c.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/contrib/dev/rtw88/rtw8822c.c b/sys/contrib/dev/rtw88/rtw8822c.c index da58b9ca8e57..a2fda1b36e6c 100644 --- a/sys/contrib/dev/rtw88/rtw8822c.c +++ b/sys/contrib/dev/rtw88/rtw8822c.c @@ -2204,7 +2204,11 @@ static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw) u32 rf_reg18 = 0; u32 rf_rxbb = 0; +#if defined(__linux__) rf_reg18 = rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK); +#elif defined(__FreeBSD__) + rf_reg18 = rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK); +#endif rf_reg18 &= ~(RF18_BAND_MASK | RF18_CHANNEL_MASK | RF18_RFSI_MASK | RF18_BW_MASK); @@ -3277,7 +3281,11 @@ static void rtw8822c_dpk_information(struct rtw_dev *rtwdev) u32 reg; u8 band_shift; +#if defined(__linux__) reg = rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK); +#elif defined(__FreeBSD__) + reg = rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK); +#endif band_shift = FIELD_GET(BIT(16), reg); dpk_info->dpk_band = 1 << band_shift; @@ -4158,7 +4166,11 @@ static bool rtw8822c_dpk_reload(struct rtw_dev *rtwdev) dpk_info->is_reload = false; +#if defined(__linux__) channel = (u8)(rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK) & 0xff); +#elif defined(__FreeBSD__) + channel = (u8)(rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK) & 0xff); +#endif if (channel == dpk_info->dpk_ch) { rtw_dbg(rtwdev, RTW_DBG_RFK, From nobody Thu Oct 5 14:33:32 2023 X-Original-To: dev-commits-src-main@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 4S1Yvc3nDRz4ws4w; Thu, 5 Oct 2023 14:33:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1Yvc30qnz4Qtg; Thu, 5 Oct 2023 14:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696516412; 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=rWHApdaTTBwyFz4C4bbSd23acU79KtDpiYRAJ2JbhXk=; b=G4PZ1Yxhe44Et8jsKjh46nmvQcYyAS3GKpf/8ZGPR9TbHxBz0by9td3iO3pNBMGak8ONVH DjV1XYpdIDn6BLl+/CwIVXkw4pKzfFMhm0DIHFaMCHCR5C6OwTjYxBoFfHZ483vjynmXZG RIA32NuAxuXpAz/Ur0Se2jbrg/pGolwDuXzi/Lag57/ZrdBeybxaVZtovtSfWD1EigCL8D FdirYdKiOQ4kYtqdpb/wtKISZZ2tdcwXR/JGAjCWrtMJIVWJtNTM9zkA6Gf1NyliNuWEpC ns/vQPPSMo8UIvsI8/5Z7p1I3BK7Lke1UL5rA7cSgf+wLWE3xalGgbk63upQRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696516412; a=rsa-sha256; cv=none; b=jrFL3G1yQm6fC0yT7iW6NQzrlBA5aCBcU/xpahQAUCG1KOTNWlZevlmD2aFLkVpRqlL5hz Fc03b4UklbhtGU42c+QKcpwOWarZkOw3bVx/w7ZMXH6P8gg7q6v1GALK4nBbGOHbJWDW55 WOITx9rxladSy0GxcLvwy1wk4exoeZa0NdTnb0rF9e9Ff09ENL6I7NzoaMsaq91qIeUCDB ZJEY5mEsnQD7rIEwu7Zad2JbXFsU0/xBWnyzoaNTsGFx8w0JmQz9vaZAbaQLF9thcgg39p WAxj/g95cQokl/yqiVxZJPuqbPIujgKDQIk9fF5PZn66ILMwlhomKgE64ZcHpg== 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=1696516412; 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=rWHApdaTTBwyFz4C4bbSd23acU79KtDpiYRAJ2JbhXk=; b=oruiFn1cw5aS0Uw+DltO3j4duLEqO6PXq9OxyEOENs1tQXOO+cgw9BtWlxLge1WRr8PiTE VEldfAd/td8R87cmtjBSC43crnBISXEVynDvfekBDvWQ/ywEDV5oPf4BRGRNRoDM4K32zb SSSQhXRcqPva7sJvzvhr9orZ/5C0YHHUeFtHekPjZWa2KBulas4aaujtkmb/ZPqB3jDpQw ZSIC7oi6j/oLhRup1fEiWeRVa+l9pTYqf5K0zrhIw7s87513qvv83L9IefJ2JMOR8ljk+I wuUYF+bxuNgb7QKUC+rTRWIZQheKnT7oGrxSJJPm8poAiLysfWl3Y1yOD+zasA== 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 4S1Yvc25wHz1NVt; Thu, 5 Oct 2023 14:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395EXWkd010765; Thu, 5 Oct 2023 14:33:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395EXWGE010762; Thu, 5 Oct 2023 14:33:32 GMT (envelope-from git) Date: Thu, 5 Oct 2023 14:33:32 GMT Message-Id: <202310051433.395EXWGE010762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0d2cb6a6ecde - main - LinuxKPI: 802.11: hide txq debugging behind checks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d2cb6a6ecde3b271ede59d77801cb43a8804688 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0d2cb6a6ecde3b271ede59d77801cb43a8804688 commit 0d2cb6a6ecde3b271ede59d77801cb43a8804688 Author: Bjoern A. Zeeb AuthorDate: 2023-10-04 20:30:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-05 14:32:41 +0000 LinuxKPI: 802.11: hide txq debugging behind checks Two txq debug messages were left unconditionally. Hide them behind ifdef/if() condition checks for selective debugging only. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 9f5f5bef7f27..4a296e2f0fad 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4911,15 +4911,18 @@ linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum) for (ac = 0; ac < ac_count; ac++) { IMPROVE_TXQ("LOCKING"); if (qnum == vif->hw_queue[ac]) { +#ifdef LINUXKPI_DEBUG_80211 /* * For now log this to better understand * how this is supposed to work. */ - if (lvif->hw_queue_stopped[ac]) + if (lvif->hw_queue_stopped[ac] && + (linuxkpi_debug_80211 & D80211_IMPROVE_TXQ) != 0) ic_printf(lhw->ic, "%s:%d: lhw %p hw %p " "lvif %p vif %p ac %d qnum %d already " "stopped\n", __func__, __LINE__, lhw, hw, lvif, vif, ac, qnum); +#endif lvif->hw_queue_stopped[ac] = true; } } @@ -4966,15 +4969,18 @@ lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq) /* XXX-BZ what about software scan? */ +#ifdef LINUXKPI_DEBUG_80211 /* * For now log this to better understand * how this is supposed to work. */ - if (!lvif->hw_queue_stopped[ac]) + if (!lvif->hw_queue_stopped[ac] && + (linuxkpi_debug_80211 & D80211_IMPROVE_TXQ) != 0) ic_printf(lhw->ic, "%s:%d: lhw %p hw %p " "lvif %p vif %p ac %d hw_q not stopped\n", __func__, __LINE__, lhw, hw, lvif, vif, ac); +#endif lvif->hw_queue_stopped[ac] = false; LKPI_80211_LVIF_LOCK(lvif); From nobody Thu Oct 5 15:03:40 2023 X-Original-To: dev-commits-src-main@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 4S1ZZN4G7hz4vj0d; Thu, 5 Oct 2023 15:03:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1ZZN3m9Rz4Wmt; Thu, 5 Oct 2023 15:03:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696518220; 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=ooEQPWLY+lfeZXcGytA8EGLdx/RHCek4EelRvBtGly0=; b=u1vQLjIw5I7ciYkN6aaSWUYx35W/zNXSEAexvXlm/ljOe9L/jUO5CkK+N1hi3EF/25J/S2 Zz9Apq+Bo5CFmZ6Gz3EPhGGW7mb/eDWLC+muOHDiChRP9r5ZEgZvcBoHt75xyiM9B9iX3s ZahOKzB7ePf1ABAT6K6TVm/JmBsd1uPD6/w7+ikDQB+ULQKBNgt5yDTVERWTehCJUTaed5 7SLgmGjddyb4Ug5suR2Nc5t5ybetUcct8OuWLdGccSu7yWnBsHBPG2mWCVfuSKWV2+BL+c 7XZG925wAd2lKM4r4KDf+jbNz+O38NxH5dv++ZBPZn+h465uJDxnnwjY5G6sSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696518220; a=rsa-sha256; cv=none; b=M70oqPZO1nokBdBIXEMJYxCgeLq+S6Amk3V6QIbzIKt6EznHshJPP6XyQEIC0EVofSqvzf MAziGZB3zymD0XZgZGUmcxt+5n97557C8fKLOZUPm+LLpOhhySoj+KmrypO1kRo4EJhhAi VTjrh0FwbA+JG91rui6yGlqEhspDOdMtIav3xDrfrVW8YPsngqv3TXv9hVWg/PE2PG0Lwi wox/fsw4gUgiynrzXk8LdhbHcYLMo+uI9q0xXd8YAgI4qMgiNhgVSt9ARZIIdmWwg/RApy APLg9GEchCRr3sWWueXEaTijbcx+DhhkZWCdR5P4/FRp0yluPCiYlatVeD8OXg== 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=1696518220; 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=ooEQPWLY+lfeZXcGytA8EGLdx/RHCek4EelRvBtGly0=; b=pV0PIAR6vMAubgE6Jj3MQQ5s7G/Bo3/WeOHQXK2NPeEPjBKii6LPozDv8+Ht1cAiBqO6A+ BkiZAIA24Vlx72xTI46A0yQalfZXZ7dlFs9gd6QrarXy8mygPQ1WvaKIl6kR78sOv/RaFB OFZPZb4bthcqZbBgvgHmoYQ5gHKuzB756vTlQhau7SYv8OdAlv15KENEpAWNfDjtIXHrPY AkDR7Fj4ZSjPHbhtE3UV5/7/pBcLTslMPxAJ3bERt4EX8qnpx2H00T6+/1ZEBQ+c5+e2pT 7dRU1OgiZn+aquoNOjfT41o4f8dQTAJmMuDwM3bDedUXktmU0lAss9JFZ/jdvg== 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 4S1ZZN2q4Sz1PCm; Thu, 5 Oct 2023 15:03:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395F3e8M061879; Thu, 5 Oct 2023 15:03:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395F3e2D061876; Thu, 5 Oct 2023 15:03:40 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:03:40 GMT Message-Id: <202310051503.395F3e2D061876@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 218885219615 - main - net80211: de-inline ieee80211_ref_node() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2188852196151e5f04533eaa928a7ad0896e4bd6 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2188852196151e5f04533eaa928a7ad0896e4bd6 commit 2188852196151e5f04533eaa928a7ad0896e4bd6 Author: Bjoern A. Zeeb AuthorDate: 2023-10-02 20:20:14 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-05 14:56:02 +0000 net80211: de-inline ieee80211_ref_node() Make ieee80211_ref_node() a macro so we can pass __func__, __LINE__ in for IEEE80211_DEBUG_REFCNT as we do for other refcount related functions. Add the appropriate IEEE80211_DPRINTF() call to the _ieee80211_ref_node() implementation to support wlandebug(8) +node printf style tracing. As a plus we can now also use Dtrace fbt on the _ieee80211_{ref,free}_node() implementations with futher logic, gathering backtraces, etc. more flexibly. Sponsored by: The FreeBSD Foundation X-MFC: never --- sys/net80211/ieee80211_node.c | 14 ++++++++++++++ sys/net80211/ieee80211_node.h | 11 ++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index b7cdc5090c96..88c8ab4eff1c 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -2056,6 +2056,20 @@ _ieee80211_find_txnode(struct ieee80211vap *vap, return ni; } +struct ieee80211_node * +_ieee80211_ref_node(struct ieee80211_node *ni, + const char *func __debrefcnt_used, int line __debrefcnt_used) +{ + +#ifdef IEEE80211_DEBUG_REFCNT + IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, + "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni, + ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)+1); +#endif + ieee80211_node_incref(ni); + return (ni); +} + static void __ieee80211_free_node(struct ieee80211_node *ni) { diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 685df28ed519..954e8e03563f 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -319,13 +319,6 @@ MALLOC_DECLARE(M_80211_NODE_IE); #define IEEE80211_RSSI_GET(x) \ IEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER) -static __inline struct ieee80211_node * -ieee80211_ref_node(struct ieee80211_node *ni) -{ - ieee80211_node_incref(ni); - return ni; -} - void ieee80211_node_attach(struct ieee80211com *); void ieee80211_node_lateattach(struct ieee80211com *); void ieee80211_node_detach(struct ieee80211com *); @@ -397,6 +390,8 @@ struct ieee80211_node *ieee80211_node_create_wds(struct ieee80211vap *, struct ieee80211_channel *); /* These functions are taking __func__, __LINE__ for IEEE80211_DEBUG_REFCNT */ +struct ieee80211_node *_ieee80211_ref_node(struct ieee80211_node *, + const char *func, int line); void _ieee80211_free_node(struct ieee80211_node *, const char *func, int line); struct ieee80211_node *_ieee80211_find_node_locked( @@ -426,6 +421,8 @@ struct ieee80211_node *_ieee80211_find_rxnode_withkey( struct ieee80211_node *_ieee80211_find_txnode(struct ieee80211vap *, const uint8_t macaddr[IEEE80211_ADDR_LEN], const char *func, int line); +#define ieee80211_ref_node(ni) \ + _ieee80211_ref_node(ni, __func__, __LINE__) #define ieee80211_free_node(ni) \ _ieee80211_free_node(ni, __func__, __LINE__) #define ieee80211_find_node_locked(nt, mac) \ From nobody Thu Oct 5 15:11:30 2023 X-Original-To: dev-commits-src-main@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 4S1ZlR1H1tz4vjl0; Thu, 5 Oct 2023 15:11:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1ZlR0p0qz4YnD; Thu, 5 Oct 2023 15:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696518691; 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=zREOov4CzYLhADlObb84aoLq76IiOOCoGfP9YpZDJ2A=; b=tPknnupsp0QlJt4poxMS9LDabPvFBheJljnXBOsHzDeyf7MUR4NfEinJvwh5GueFEn6tY9 WbS3pbXyb/oQtTvQLjasq4o9LU3UzakDN9NeXmn6QKoFSGAdw+ux8qg9xmAsXyRgLTQLU8 iGyraxfulkd0d8+vFUdHk3SCIO0bPdG630JIhJ57czhRT3PE67fBCsuPSUsz7gaIQ6Mtqg E9b9RukUDSnavHXrVloBvI2TvadNxqZtkeJDV/GPMpysAqpIjefNC8VYz/Uj6UEW6aJcIj GaqPOTqjnCGc73am+t6CB1w0BWaiprZ3RmqpTd90J/w1nKbHsjm+K/y7PhqeHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696518691; a=rsa-sha256; cv=none; b=SDUjPous+mNa3iwi9S0WrNqrY0iL4qbAGfRlOu6Gc16//cTLNyBtX0y5HaThvm+lcnCu4m BQXxUnnNTSjA/y9A0ag7/qqtiedG5MtGV91XJPWHtLsCN41T98DRM0Z/CnTSRVdjeRS+ZC Vkx7X5DA/2vADsD0iKSBO9871fGKriJidhHBVG8dJByOZyDnNUbk66cxs3I/odkYYP0EFI VQRkAiXv2BqrX+qohvG8Tq0NF7Jq+bDZQxfBzQoxzj2PXNC4fS2F8/RemlKm7XfiGf2hPp SHe1hIRoitsL3GyTHEHOBHA2LtJJE4RjHZWSHyRBrLsVTOUGp2fIMCiBUwrxsQ== 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=1696518691; 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=zREOov4CzYLhADlObb84aoLq76IiOOCoGfP9YpZDJ2A=; b=qHzaWyJxDRsvrrUrD18OAZibAfENfWcf2F//dfcr16oafuUkq9DCjxxm5JNceGPOm55yJJ 8os11w9aIzCgVNROT0c8eaAEysuZS3blmwa3d6KJgt6wfLvHpAlBhNZtAAShoLA0iAOHQv SuaZ14QSPzaKTtN8X6Il7jSwdq6XJJsniRtvuVSa5OXFF8HoHBX24cSCbxWxBM8e5E0ssk T5n8gl4plA0YsZoLF7icj9IL+Tei87dus3hGr6oIM8VITzsTNlRFAIziSTExZYUN/0UJVD 5yYZbqYGm/FGcAnhiTtuzJrRSLHW7LtcVniImVrO4mgDcP2w4sjBgR+eYGVmGQ== 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 4S1ZlQ6gfpz1PZH; Thu, 5 Oct 2023 15:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FBUu3072794; Thu, 5 Oct 2023 15:11:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FBUK8072791; Thu, 5 Oct 2023 15:11:30 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:11:30 GMT Message-Id: <202310051511.395FBUK8072791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 1525625c7c94 - main - certctl: Clean up. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1525625c7c945856d4814987fd65784fd62cba74 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=1525625c7c945856d4814987fd65784fd62cba74 commit 1525625c7c945856d4814987fd65784fd62cba74 Author: Dag-Erling Smørgrav AuthorDate: 2023-10-05 14:49:53 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-05 15:11:22 +0000 certctl: Clean up. MFC after: 3 days Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D42086 --- usr.sbin/certctl/certctl.sh | 173 +++++++++++++++++++++++++------------------- 1 file changed, 99 insertions(+), 74 deletions(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index c216734a6e9a..02d055102c33 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -26,32 +26,53 @@ # POSSIBILITY OF SUCH DAMAGE. # +set -u + ############################################################ CONFIGURATION : ${DESTDIR:=} : ${DISTBASE:=} : ${FILEPAT:="\.pem$|\.crt$|\.cer$|\.crl$"} -: ${VERBOSE:=0} ############################################################ GLOBALS SCRIPTNAME="${0##*/}" ERRORS=0 -NOOP=0 -UNPRIV=0 +NOOP=false +UNPRIV=false +VERBOSE=false ############################################################ FUNCTIONS +info() +{ + echo "${0##*/}: $@" >&2 +} + +verbose() +{ + if "${VERBOSE}" ; then + info "$@" + fi +} + +perform() +{ + if ! "${NOOP}" ; then + "$@" + fi +} + do_hash() { local hash - if hash=$( openssl x509 -noout -subject_hash -in "$1" ); then + if hash=$(openssl x509 -noout -subject_hash -in "$1") ; then echo "$hash" return 0 else - echo "Error: $1" >&2 - ERRORS=$(( $ERRORS + 1 )) + info "Error: $1" + ERRORS=$((ERRORS + 1)) return 1 fi } @@ -64,7 +85,7 @@ get_decimal() hash=$2 decimal=0 - while [ -e "$checkdir/$hash.$decimal" ]; do + while [ -e "$checkdir/$hash.$decimal" ] ; do decimal=$((decimal + 1)) done @@ -74,22 +95,21 @@ get_decimal() create_trusted_link() { - local blisthash certhash hash + local hash certhash otherfile otherhash local suffix - hash=$( do_hash "$1" ) || return - certhash=$( openssl x509 -sha1 -in "$1" -noout -fingerprint ) - for blistfile in $(find $UNTRUSTDESTDIR -name "$hash.*"); do - blisthash=$( openssl x509 -sha1 -in "$blistfile" -noout -fingerprint ) - if [ "$certhash" = "$blisthash" ]; then - echo "Skipping untrusted certificate $1 ($blistfile)" + hash=$(do_hash "$1") || return + certhash=$(openssl x509 -sha1 -in "$1" -noout -fingerprint) + for otherfile in $(find $UNTRUSTDESTDIR -name "$hash.*") ; do + otherhash=$(openssl x509 -sha1 -in "$otherfile" -noout -fingerprint) + if [ "$certhash" = "$otherhash" ] ; then + info "Skipping untrusted certificate $1 ($otherfile)" return 1 fi done suffix=$(get_decimal "$CERTDESTDIR" "$hash") - [ $VERBOSE -gt 0 ] && echo "Adding $hash.$suffix to trust store" - [ $NOOP -eq 0 ] && \ - install ${INSTALLFLAGS} -lrs $(realpath "$1") "$CERTDESTDIR/$hash.$suffix" + verbose "Adding $hash.$suffix to trust store" + perform install ${INSTALLFLAGS} -lrs "$(realpath "$1")" "$CERTDESTDIR/$hash.$suffix" } # Accepts either dot-hash form from `certctl list` or a path to a valid cert. @@ -99,13 +119,13 @@ resolve_certname() local suffix # If it exists as a file, we'll try that; otherwise, we'll scan - if [ -e "$1" ]; then - hash=$( do_hash "$1" ) || return + if [ -e "$1" ] ; then + hash=$(do_hash "$1") || return srcfile=$(realpath "$1") suffix=$(get_decimal "$UNTRUSTDESTDIR" "$hash") filename="$hash.$suffix" echo "$srcfile" "$hash.$suffix" - elif [ -e "${CERTDESTDIR}/$1" ]; then + elif [ -e "${CERTDESTDIR}/$1" ] ; then srcfile=$(realpath "${CERTDESTDIR}/$1") hash=$(echo "$1" | sed -Ee 's/\.([0-9])+$//') suffix=$(get_decimal "$UNTRUSTDESTDIR" "$hash") @@ -122,12 +142,12 @@ create_untrusted() srcfile=$1 filename=$2 - if [ -z "$srcfile" -o -z "$filename" ]; then + if [ -z "$srcfile" -o -z "$filename" ] ; then return fi - [ $VERBOSE -gt 0 ] && echo "Adding $filename to untrusted list" - [ $NOOP -eq 0 ] && install ${INSTALLFLAGS} -lrs "$srcfile" "$UNTRUSTDESTDIR/$filename" + verbose "Adding $filename to untrusted list" + perform install ${INSTALLFLAGS} -lrs "$srcfile" "$UNTRUSTDESTDIR/$filename" } do_scan() @@ -142,10 +162,10 @@ do_scan() IFS="$oldIFS" for CPATH in "$@"; do [ -d "$CPATH" ] || continue - echo "Scanning $CPATH for certificates..." - for CFILE in $(ls -1 "${CPATH}" | grep -Ee "${FILEPAT}"); do + info "Scanning $CPATH for certificates..." + for CFILE in $(ls -1 "${CPATH}" | grep -Ee "${FILEPAT}") ; do [ -e "$CPATH/$CFILE" ] || continue - [ $VERBOSE -gt 0 ] && echo "Reading $CFILE" + verbose "Reading $CFILE" "$CFUNC" "$CPATH/$CFILE" done done @@ -155,21 +175,21 @@ do_list() { local CFILE subject - if [ -e "$1" ]; then + if [ -e "$1" ] ; then cd "$1" - for CFILE in *.[0-9]; do - if [ ! -s "$CFILE" ]; then - echo "Unable to read $CFILE" >&2 - ERRORS=$(( $ERRORS + 1 )) + for CFILE in *.[0-9] ; do + if [ ! -s "$CFILE" ] ; then + info "Unable to read $CFILE" + ERRORS=$((ERRORS + 1)) continue fi subject= - if [ $VERBOSE -eq 0 ]; then - subject=$( openssl x509 -noout -subject -nameopt multiline -in "$CFILE" | - sed -n '/commonName/s/.*= //p' ) + if [ $VERBOSE -eq 0 ] ; then + subject=$(openssl x509 -noout -subject -nameopt multiline -in "$CFILE" | + sed -n '/commonName/s/.*= //p') fi [ "$subject" ] || - subject=$( openssl x509 -noout -subject -in "$CFILE" ) + subject=$(openssl x509 -noout -subject -in "$CFILE") printf "%s\t%s\n" "$CFILE" "$subject" done cd - @@ -179,17 +199,15 @@ do_list() cmd_rehash() { - if [ $NOOP -eq 0 ]; then - if [ -e "$CERTDESTDIR" ]; then - find "$CERTDESTDIR" -type link -delete - else - mkdir -p "$CERTDESTDIR" - fi - if [ -e "$UNTRUSTDESTDIR" ]; then - find "$UNTRUSTDESTDIR" -type link -delete - else - mkdir -p "$UNTRUSTDESTDIR" - fi + if [ -e "$CERTDESTDIR" ] ; then + perform find "$CERTDESTDIR" -type link -delete + else + perform install -d -m 0755 "$CERTDESTDIR" + fi + if [ -e "$UNTRUSTDESTDIR" ] ; then + perform find "$UNTRUSTDESTDIR" -type link -delete + else + perform install -d -m 0755 "$UNTRUSTDESTDIR" fi do_scan create_untrusted "$UNTRUSTPATH" @@ -198,51 +216,51 @@ cmd_rehash() cmd_list() { - echo "Listing Trusted Certificates:" + info "Listing Trusted Certificates:" do_list "$CERTDESTDIR" } cmd_untrust() { - local BPATH + local UTFILE shift # verb - [ $NOOP -eq 0 ] && mkdir -p "$UNTRUSTDESTDIR" - for BFILE in "$@"; do - echo "Adding $BFILE to untrusted list" - create_untrusted "$BFILE" + perform install -d -m 0755 "$UNTRUSTDESTDIR" + for UTFILE in "$@"; do + info "Adding $UTFILE to untrusted list" + create_untrusted "$UTFILE" done } cmd_trust() { - local BFILE blisthash certhash hash + local UTFILE untrustedhash certhash hash shift # verb - for BFILE in "$@"; do - if [ -s "$BFILE" ]; then - hash=$( do_hash "$BFILE" ) - certhash=$( openssl x509 -sha1 -in "$BFILE" -noout -fingerprint ) - for BLISTEDFILE in $(find $UNTRUSTDESTDIR -name "$hash.*"); do - blisthash=$( openssl x509 -sha1 -in "$BLISTEDFILE" -noout -fingerprint ) - if [ "$certhash" = "$blisthash" ]; then - echo "Removing $(basename "$BLISTEDFILE") from untrusted list" - [ $NOOP -eq 0 ] && rm -f $BLISTEDFILE + for UTFILE in "$@"; do + if [ -s "$UTFILE" ] ; then + hash=$(do_hash "$UTFILE") + certhash=$(openssl x509 -sha1 -in "$UTFILE" -noout -fingerprint) + for UNTRUSTEDFILE in $(find $UNTRUSTDESTDIR -name "$hash.*") ; do + untrustedhash=$(openssl x509 -sha1 -in "$UNTRUSTEDFILE" -noout -fingerprint) + if [ "$certhash" = "$untrustedhash" ] ; then + info "Removing $(basename "$UNTRUSTEDFILE") from untrusted list" + perform rm -f $UNTRUSTEDFILE fi done - elif [ -e "$UNTRUSTDESTDIR/$BFILE" ]; then - echo "Removing $BFILE from untrusted list" - [ $NOOP -eq 0 ] && rm -f "$UNTRUSTDESTDIR/$BFILE" + elif [ -e "$UNTRUSTDESTDIR/$UTFILE" ] ; then + info "Removing $UTFILE from untrusted list" + perform rm -f "$UNTRUSTDESTDIR/$UTFILE" else - echo "Cannot find $BFILE" >&2 - ERRORS=$(( $ERRORS + 1 )) + info "Cannot find $UTFILE" + ERRORS=$((ERRORS + 1)) fi done } cmd_untrusted() { - echo "Listing Untrusted Certificates:" + info "Listing Untrusted Certificates:" do_list "$UNTRUSTDESTDIR" } @@ -270,18 +288,23 @@ while getopts D:d:M:nUv flag; do D) DESTDIR=${OPTARG} ;; d) DISTBASE=${OPTARG} ;; M) METALOG=${OPTARG} ;; - n) NOOP=1 ;; - U) UNPRIV=1 ;; - v) VERBOSE=$(( $VERBOSE + 1 )) ;; + n) NOOP=true ;; + U) UNPRIV=true ;; + v) VERBOSE=true ;; esac done -shift $(( $OPTIND - 1 )) +shift $((OPTIND - 1)) DESTDIR=${DESTDIR%/} +if ! [ -z "${CERTCTL_VERBOSE:-}" ] ; then + VERBOSE=true +fi : ${METALOG:=${DESTDIR}/METALOG} INSTALLFLAGS= -[ $UNPRIV -eq 1 ] && INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR}" +if "$UNPRIV" ; then + INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR}" +fi : ${LOCALBASE:=$(sysctl -n user.localbase)} : ${TRUSTPATH:=${DESTDIR}${DISTBASE}/usr/share/certs/trusted:${DESTDIR}${LOCALBASE}/share/certs:${DESTDIR}${LOCALBASE}/etc/ssl/certs} : ${UNTRUSTPATH:=${DESTDIR}${DISTBASE}/usr/share/certs/untrusted:${DESTDIR}${LOCALBASE}/etc/ssl/untrusted:${DESTDIR}${LOCALBASE}/etc/ssl/blacklisted} @@ -302,7 +325,9 @@ blacklisted) cmd_untrusted ;; esac retval=$? -[ $ERRORS -gt 0 ] && echo "Encountered $ERRORS errors" >&2 +if [ $ERRORS -gt 0 ] ; then + info "Encountered $ERRORS errors" +fi exit $retval ################################################################################ From nobody Thu Oct 5 15:11:31 2023 X-Original-To: dev-commits-src-main@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 4S1ZlS2D68z4vjsw; Thu, 5 Oct 2023 15:11:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1ZlS1RYPz4YnZ; Thu, 5 Oct 2023 15:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696518692; 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=xp84SFSl/oFw7ookW6F8zp+BY8XWH+KvsetuIOwVKAo=; b=BbumE4T8KoT2uPcSdNnFXtdwFMs77SRpc1oEkT+ZbuDlviO6SPCuPNT3o7L0PPrpOeUR+X IJ3jZJPb32L1+3RHT85V1D1/jggZ/rSsLgDeqO+fAh4EKHvann9R6euiElJoVR9Ic3eNX+ mXxKBsDUZqUHTFYhNPFyK5M3N2cFEOA2B+mflrx+JbNQRVFISKiprnoi8YyBTxXMsTBdgS fLCz9VgIB/5mjzjvsL/GmEQLcHWVNgGExI1qGAvYPgq/0enxsxkYDMFOu04hzw7OGm0EP8 eRW1T6IMR+Lz4B8ji/Yxh5QWHtiOtHJLT201u04jOxXwHNLIaPHxMq7JcvDOWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696518692; a=rsa-sha256; cv=none; b=dmyUU2greLCqk11isig9VanpGCsMLuAv4+3HfrX8oAIJEELsgkZ2djaXDDYQlxGRC9/9lv 9JauHtQ0MFSQgRBbv3NCykUgG90pXGDZEaOnVRlX7hz/uCwX5kLqYK82BMYwM2kPitCLus 4yyOr/vQt5GPAEZG6q16owBeHF6x8iV0dSB+KiiNlr1NX8LdQnjnn6VMdsE6PvZHoO4oja e62EyUw+mVcdU1B9Qh57DjVwBW5BH4CfZxdnGxQvzuN5uNhMGnjV4Y0w7ejV3++JLZ9h9i uD2EdGOpSPzFRCY/M0kpKdU3w3tA17uBUHYveJQmh85UwlYIWM/QxzkimrCSlw== 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=1696518692; 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=xp84SFSl/oFw7ookW6F8zp+BY8XWH+KvsetuIOwVKAo=; b=yDRDEjVVSDWBPv7lGSfL0uCC0pR6iVziYYosd9jx/4HF8CDNQr7evpU7nRuOtTmtdJhUc2 qqoKnOu6ERlKR+UevhMM+QYtsPBS3HE2Vet7gK2RT5269X+DdxWBMMxD2R40RqI7sD/pMd p5P/+dsTBbLxn+5pPDWffA0o53cOFG66PCjEbjOWWXfquyzJfXm3Hb9FFBO+f2WGqEgO3j cfNn0hVN/iyGitPFjl6P3cMHk3Dde5F7Zcumw6dnNjj3AfHl88v5cEBNgUMvDpFUaAmIDy FXgMn8DDdq5kxQUN6skkAEY/Um3j8KDYLcSEKYVeMSHxR32XZ8PoMxSFsyG7eg== 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 4S1ZlS0XV3z1Pcn; Thu, 5 Oct 2023 15:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FBV8t072842; Thu, 5 Oct 2023 15:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FBVR6072839; Thu, 5 Oct 2023 15:11:31 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:11:31 GMT Message-Id: <202310051511.395FBVR6072839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: a401c8cb26b2 - main - certctl: Split certificate bundles before processing. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a401c8cb26b22688087ad7c5ee527718459df15a Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=a401c8cb26b22688087ad7c5ee527718459df15a commit a401c8cb26b22688087ad7c5ee527718459df15a Author: Dag-Erling Smørgrav AuthorDate: 2023-10-05 14:50:01 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-05 15:11:22 +0000 certctl: Split certificate bundles before processing. This allows 'certctl rehash' to do the right thing when ca_root_nss is installed, instead of linking the entire bundle to the hash of the first certificate it contains. MFC after: 3 days Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D42087 --- usr.sbin/certctl/certctl.sh | 99 ++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 36 deletions(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index 02d055102c33..b7d3a95bc7d7 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -32,7 +32,6 @@ set -u : ${DESTDIR:=} : ${DISTBASE:=} -: ${FILEPAT:="\.pem$|\.crt$|\.cer$|\.crl$"} ############################################################ GLOBALS @@ -63,6 +62,16 @@ perform() fi } +cert_files_in() +{ + find -L "$@" -type f \( \ + -name '*.pem' -or \ + -name '*.crt' -or \ + -name '*.cer' -or \ + -name '*.crl' \ + \) 2>/dev/null +} + do_hash() { local hash @@ -93,23 +102,32 @@ get_decimal() return 0 } -create_trusted_link() +create_trusted() { local hash certhash otherfile otherhash local suffix + local link=${2:+-lm} hash=$(do_hash "$1") || return certhash=$(openssl x509 -sha1 -in "$1" -noout -fingerprint) for otherfile in $(find $UNTRUSTDESTDIR -name "$hash.*") ; do otherhash=$(openssl x509 -sha1 -in "$otherfile" -noout -fingerprint) if [ "$certhash" = "$otherhash" ] ; then - info "Skipping untrusted certificate $1 ($otherfile)" + info "Skipping untrusted certificate $hash ($otherfile)" return 1 fi done + for otherfile in $(find $CERTDESTDIR -name "$hash.*") ; do + otherhash=$(openssl x509 -sha1 -in "$otherfile" -noout -fingerprint) + if [ "$certhash" = "$otherhash" ] ; then + verbose "Skipping duplicate entry for certificate $hash" + return 0 + fi + done suffix=$(get_decimal "$CERTDESTDIR" "$hash") verbose "Adding $hash.$suffix to trust store" - perform install ${INSTALLFLAGS} -lrs "$(realpath "$1")" "$CERTDESTDIR/$hash.$suffix" + perform install ${INSTALLFLAGS} -m 0444 ${link} \ + "$(realpath "$1")" "$CERTDESTDIR/$hash.$suffix" } # Accepts either dot-hash form from `certctl list` or a path to a valid cert. @@ -137,6 +155,7 @@ resolve_certname() create_untrusted() { local srcfile filename + local link=${2:+-lm} set -- $(resolve_certname "$1") srcfile=$1 @@ -147,12 +166,13 @@ create_untrusted() fi verbose "Adding $filename to untrusted list" - perform install ${INSTALLFLAGS} -lrs "$srcfile" "$UNTRUSTDESTDIR/$filename" + perform install ${INSTALLFLAGS} -m 0444 ${link} \ + "$srcfile" "$UNTRUSTDESTDIR/$filename" } do_scan() { - local CFUNC CSEARCH CPATH CFILE + local CFUNC CSEARCH CPATH CFILE CERT SPLITDIR local oldIFS="$IFS" CFUNC="$1" CSEARCH="$2" @@ -160,14 +180,25 @@ do_scan() IFS=: set -- $CSEARCH IFS="$oldIFS" - for CPATH in "$@"; do - [ -d "$CPATH" ] || continue - info "Scanning $CPATH for certificates..." - for CFILE in $(ls -1 "${CPATH}" | grep -Ee "${FILEPAT}") ; do - [ -e "$CPATH/$CFILE" ] || continue - verbose "Reading $CFILE" - "$CFUNC" "$CPATH/$CFILE" - done + for CFILE in $(cert_files_in "$@") ; do + verbose "Reading $CFILE" + case $(grep -c '^Certificate:$' "$CFILE") in + 0) + ;; + 1) + "$CFUNC" "$CFILE" link + ;; + *) + verbose "Multiple certificates found, splitting..." + SPLITDIR=$(mktemp -d) + egrep '^[^#]' "$CFILE" | \ + split -p '^Certificate:$' - "$SPLITDIR/x" + for CERT in $(find "$SPLITDIR" -type f) ; do + "$CFUNC" "$CERT" + done + rm -rf "$SPLITDIR" + ;; + esac done } @@ -175,43 +206,39 @@ do_list() { local CFILE subject - if [ -e "$1" ] ; then - cd "$1" - for CFILE in *.[0-9] ; do - if [ ! -s "$CFILE" ] ; then - info "Unable to read $CFILE" - ERRORS=$((ERRORS + 1)) - continue - fi - subject= - if [ $VERBOSE -eq 0 ] ; then - subject=$(openssl x509 -noout -subject -nameopt multiline -in "$CFILE" | - sed -n '/commonName/s/.*= //p') - fi - [ "$subject" ] || - subject=$(openssl x509 -noout -subject -in "$CFILE") - printf "%s\t%s\n" "$CFILE" "$subject" - done - cd - - fi + for CFILE in $(find "$@" \( -type f -or -type l \) -name '*.[0-9]') ; do + if [ ! -s "$CFILE" ] ; then + info "Unable to read $CFILE" + ERRORS=$((ERRORS + 1)) + continue + fi + subject= + if ! "$VERBOSE" ; then + subject=$(openssl x509 -noout -subject -nameopt multiline -in "$CFILE" | sed -n '/commonName/s/.*= //p') + fi + if [ -z "$subject" ] ; then + subject=$(openssl x509 -noout -subject -in "$CFILE") + fi + printf "%s\t%s\n" "${CFILE##*/}" "$subject" + done } cmd_rehash() { if [ -e "$CERTDESTDIR" ] ; then - perform find "$CERTDESTDIR" -type link -delete + perform find "$CERTDESTDIR" \( -type f -or -type l \) -delete else perform install -d -m 0755 "$CERTDESTDIR" fi if [ -e "$UNTRUSTDESTDIR" ] ; then - perform find "$UNTRUSTDESTDIR" -type link -delete + perform find "$UNTRUSTDESTDIR" \( -type f -or -type l \) -delete else perform install -d -m 0755 "$UNTRUSTDESTDIR" fi do_scan create_untrusted "$UNTRUSTPATH" - do_scan create_trusted_link "$TRUSTPATH" + do_scan create_trusted "$TRUSTPATH" } cmd_list() From nobody Thu Oct 5 15:31:30 2023 X-Original-To: dev-commits-src-main@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 4S1bBW1CNKz4vmTb; Thu, 5 Oct 2023 15:31:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bBW0kvRz4bjt; Thu, 5 Oct 2023 15:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696519891; 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=8zjTgEvsa2PyXtoTi1eDqrjv0zX6m/ol2MYzYZyst7w=; b=ITziiSXhqrs2ygx3ohpUYGmuK/lQz0z+hhh+KHyrF03yo627beyM8PQ4g7sCl2EGZcWYpv xoMoomGNoa/dXPacdKWEa7joi0FMZc4rkxOPuBum+yLcvJ+KF/gQqB5UAYeCxWU3lvn1Hx c1cc0fZ3MtPgyXNFJ6x+VTo6XiM51xwqeXB1uFDwcxc1LmZ+xY4AbRulHtQL6p2larkCUu /q0keFHtI8eaukuxAh/JqKzpc2zTHG7840bIdx8nOxBxO5Tz3/5mHC8U7oW7YZyx1oEu8d BNeoobyWqjc4mO+aPzMTzZLLqMKjMyBz/2INss0BXVcSJnl3khM0/ZJfIBvTfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696519891; a=rsa-sha256; cv=none; b=egalqt7yoo7CiAkzb3HLt41U/4rnAxQqJxieGS5hPjP6eIjIT+sRYoARnK/DXbzS5XeWlj Hs+sSfIOkvkfmNckjFqnomceWwKCwYT73IScZH1DraVck04pDe6Ts+wyRdMFB7G+aPdeLw H7aU+aDPrwowG06Fl8Ce87Ctifr0uTEh0FEXpKo/oozFH2Bo4BZmFh3YCdzzQaqad5dp/W /hahCSu6g1/NVHxIhO+Y8DcxI0MAgE9UrOGUBTGpqo70aNQy9AIe+zbbholZ8mjZR29zr9 sxTErgfFdG//zQiztIPdXbI6TMRoZlTOHdlefTniHpv84YOvdodpJnsRxTo+yg== 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=1696519891; 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=8zjTgEvsa2PyXtoTi1eDqrjv0zX6m/ol2MYzYZyst7w=; b=qqUxeErASZ9Q7ZTMSEXKGCjzvXv9+WiGjEn8k/lUecxs+Lr3Y8MPSFsezq/F/AwU1eEVbo hlgxgmkWK4Mw+jaRc6OrKhDtOF3OsGEfpBIcuzuHSjvbpZgytsANjf0j6p9dYtHPTJ9ctw t5b0ZwyF34XJgW1N9stptPoG6H8yl6CdB7WiXNlfXKdCO6AIp+BhY5Alol51MTfTXwJ8K6 Au5CuqHbQDK7SwRbqUBu14wwlaCt3DPXsUWH6+utDWwMC86mScB6HsUIx8CycOL7xj6JEZ L8jDLQMR8a4rIdpW8otsvBr2Xft037fh5jUCitrc7GjqKNcrHF9ZskSHpjbJNg== 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 4S1bBV6vS5z1Q6q; Thu, 5 Oct 2023 15:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FVUSK008764; Thu, 5 Oct 2023 15:31:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FVUFg008750; Thu, 5 Oct 2023 15:31:30 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:31:30 GMT Message-Id: <202310051531.395FVUFg008750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 4ab019329025 - main - bsdconfig: simplify pkg installation and ABI detection List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ab0193290255dffce3e123b7b9eec8f768740de Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4ab0193290255dffce3e123b7b9eec8f768740de commit 4ab0193290255dffce3e123b7b9eec8f768740de Author: Baptiste Daroussin AuthorDate: 2023-10-05 15:16:31 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 15:30:17 +0000 bsdconfig: simplify pkg installation and ABI detection --- usr.sbin/bsdconfig/share/packages/musthavepkg.subr | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/usr.sbin/bsdconfig/share/packages/musthavepkg.subr b/usr.sbin/bsdconfig/share/packages/musthavepkg.subr index 9b5d94675345..0a1026afe86c 100644 --- a/usr.sbin/bsdconfig/share/packages/musthavepkg.subr +++ b/usr.sbin/bsdconfig/share/packages/musthavepkg.subr @@ -44,26 +44,16 @@ f_include $BSDCFG_SHARE/mustberoot.subr f_musthavepkg_init() { local funcname=f_musthavepkg_init - local pkg_abi_awk=' # BEGIN-AWK - $1 ~ /^ABI/ && $0 = $NF, sub(/^"/, "") && sub(/".*/, "") { - print; found = 1; exit - } END { exit ! found } - ' # END-AWK - if [ "$PKG_ABI" ]; then # Already set - f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" - export PKG_ABI - f_quietly pkg -N -vv # return status (pkg(8) functional?) - return $? - fi - - # Attempt to get PKG_ABI without prematurely bootstrapping pkg(8) - if f_eval_catch -k PKG_ABI $funcname pkg \ - "pkg -N -vv | awk '%s'" "$pkg_abi_awk" - then - f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" - export PKG_ABI - return $SUCCESS + if f_quietly pkg -N; then + if [ -n "$PKG_ABI" ]; then + export PKG_ABI + return $SUCCESS + fi + if f_eval_catch -k PKG_ABI $funcname pkg "pkg config abi"; then + export PKG_ABI + return $SUCCESS + fi fi # pkg(8) not yet bootstrapped; ask for permission unless nonInteractive @@ -74,10 +64,10 @@ f_musthavepkg_init() # Bootstrap pkg(8) f_dialog_info "$msg_bootstrapping_pkg" - f_eval_catch -k PKG_ABI $funcname pkg \ - "ASSUME_ALWAYS_YES=1 pkg -vv | awk '%s'" "$pkg_abi_awk" || + f_eval_catch $funcname pkg \ + "pkg bootstrap -y" || f_die 1 "$msg_must_have_pkg_to_execute" "$pgm" - + f_eval_catch -k PKG_ABI $funcname pkg "pkg config abi" f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" export PKG_ABI return $SUCCESS From nobody Thu Oct 5 15:34:53 2023 X-Original-To: dev-commits-src-main@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 4S1bGP6hr8z4vnFV; Thu, 5 Oct 2023 15:34:53 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGP6Dpxz4cYQ; Thu, 5 Oct 2023 15:34:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520093; 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=KEnH9AW5cQrC8QEEwpufvxSnOh4BRrnYJ2eoDOpH840=; b=tsPbA7yourDgEWHpt910fsndEpmPT1fSV0nlrAt4xt7/eLvs+owPdYfQX5oT5QjtAL/+e9 vdBa95NtIwEGaMzcvDel/cPjYG6aNw1BVQ707E/jUM77jkUXSV3J1mCJifj54WCclMwJb1 GuggN3H2K594CsOVaR8ljB0Q6SWJvAaJTw+wjf7LkfBdxeOHv0kzHkO0cx412N0EW/dllg w1QASw9HFU8vNZUydc7P/JQdiV5qFoazzTwuzYUxgmcYDFsXEtOA6h5jKV4QoCHLWfVRGg NHIYPxM4PIpczQr3pframrjmW5/S6Lo7bSEQELDaEjz0ZSAJazto7gORYzhkjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520093; a=rsa-sha256; cv=none; b=TlI5+FPo9yd4LBef1nfPCMOx0MWQ1Z0rsm1f22AJScxMDlxomGKiSX0UT/p4T3tEjlCzI6 ao01776LcXpUBTZzruf93xVO/5jTXhFzWEc1y5nb/R00QGWzd9WEBW50BfkWTUvxPlXcqh bFSF+nqeexWFg45I4yer8mKl+LPb5kqhSearJwfyxb1VMDSc/SWcMAzCLaNiJ6PYaUFTQ8 tN4yTEfbtugY+Vg6rYXTkbiRvgsr0SCRCruEXIz2mg5EAghvhr8Of14/hdE5yZGLDFB7op fWoZfQtH0t/iGlxlu/DepSPYMk5ZiLlIFRXfzY8ITIeznh3R3HBC9AdySVPPiw== 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=1696520093; 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=KEnH9AW5cQrC8QEEwpufvxSnOh4BRrnYJ2eoDOpH840=; b=gXFogRPebN11SCh8nt361NGBNfmD9uUwQlJOZJxrzI2ybI2J85odAb/lY5dnfXCNfuhhE0 pCUDiHUfQI4LFk0si6C3rIQXZhtXx+NRr1lKFM5ptKRFgW8V/Fo8IgykhvuBaqYeL2KZJV KX12WpFlo4pnJ5Aemw8IT74Cm25b6Bq6uW6Sk3CizXpin7hD+kZOD2+QXXVG/e+TkJ/5yS fh4nERY1tlS0dxgbdW02JI01Bi3OCyZYcHMTJX0uVLxqpKccAExmbKk3trVQucFUybbpeN +wi3axdV3nZLXgT8mYvNMBt5vx2JHYEVpDsfAzsJ9qe8G5zcDKAjFexo9eOD2A== 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 4S1bGP5HN9z1PGn; Thu, 5 Oct 2023 15:34:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FYrZt012016; Thu, 5 Oct 2023 15:34:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FYrOK012013; Thu, 5 Oct 2023 15:34:53 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:34:53 GMT Message-Id: <202310051534.395FYrOK012013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 432ae724e6eb - main - dwc: Move every sub drivers to dev/dwc List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 432ae724e6ebac4696a7baf5020e2445db06dc2f Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=432ae724e6ebac4696a7baf5020e2445db06dc2f commit 432ae724e6ebac4696a7baf5020e2445db06dc2f Author: Emmanuel Vadot AuthorDate: 2023-09-23 14:38:32 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:38 +0000 dwc: Move every sub drivers to dev/dwc It makes it easier to find all the sub drivers and change them if needed. While here do not gate dwc_rk with soc options, dwc_rk is made for all rockchip SoCs. Same thing for dwc_socfpga --- sys/arm/allwinner/files.allwinner | 2 +- sys/arm/rockchip/files.rk32xx | 2 +- sys/conf/files.arm64 | 5 +++-- sys/{arm/allwinner/aw_if_dwc.c => dev/dwc/if_dwc_aw.c} | 0 sys/{arm64/rockchip => dev/dwc}/if_dwc_rk.c | 0 sys/dev/{altera => }/dwc/if_dwc_socfpga.c | 0 6 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/arm/allwinner/files.allwinner b/sys/arm/allwinner/files.allwinner index cc609e50f2bd..a136b2e050ac 100644 --- a/sys/arm/allwinner/files.allwinner +++ b/sys/arm/allwinner/files.allwinner @@ -5,7 +5,6 @@ arm/allwinner/a10_dmac.c optional a10_dmac arm/allwinner/a31_dmac.c optional a31_dmac arm/allwinner/a10_sramc.c optional SOC_ALLWINNER_A10 arm/allwinner/aw_gpio.c optional gpio -arm/allwinner/aw_if_dwc.c optional dwc arm/allwinner/aw_machdep.c standard arm/allwinner/aw_mmc.c optional mmc | mmccam arm/allwinner/aw_mp.c optional smp @@ -22,6 +21,7 @@ arm/allwinner/axp81x.c optional axp81x arm/allwinner/if_awg.c optional awg syscon arm/allwinner/if_emac.c optional emac arm/allwinner/sunxi_dma_if.m optional a10_dmac | a31_dmac +dev/dwc/if_dwc_aw.c optional dwc dev/iicbus/controller/twsi/a10_twsi.c optional twsi dev/usb/controller/generic_ohci.c optional ohci dev/usb/controller/generic_usb_if.m optional ohci diff --git a/sys/arm/rockchip/files.rk32xx b/sys/arm/rockchip/files.rk32xx index 4dc9a4df908c..0f2774fd76cc 100644 --- a/sys/arm/rockchip/files.rk32xx +++ b/sys/arm/rockchip/files.rk32xx @@ -2,7 +2,6 @@ kern/kern_clocksource.c standard arm/rockchip/rk32xx_machdep.c standard arm/rockchip/rk32xx_mp.c optional smp -arm64/rockchip/if_dwc_rk.c standard arm64/rockchip/rk_i2c.c standard arm64/rockchip/rk_iodomain.c standard arm64/rockchip/rk_gpio.c standard @@ -22,6 +21,7 @@ arm64/rockchip/clk/rk_clk_pll.c standard arm64/rockchip/clk/rk_cru.c standard arm64/rockchip/clk/rk3288_cru.c standard +dev/dwc/if_dwc_rk.c standard dev/iicbus/pmic/act8846.c standard dev/iicbus/pmic/act8846_regulator.c standard dev/iicbus/pmic/fan53555.c standard diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index baf8734fb38f..eaf4577ee14e 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -224,8 +224,11 @@ dev/dpaa2/memac_mdio_common.c optional soc_nxp_ls dpaa2 acpi | soc_nxp_ls dpaa dev/dpaa2/memac_mdio_fdt.c optional soc_nxp_ls dpaa2 fdt dev/dpaa2/memac_mdio_if.m optional soc_nxp_ls dpaa2 acpi | soc_nxp_ls dpaa2 fdt +# Synopsys DesignWare Ethernet Controller dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 +dev/dwc/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 +dev/dwc/if_dwc_socfpga.c optional fdt dwc_socfpga dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls dev/enetc/if_enetc.c optional enetc iflib pci fdt soc_nxp_ls @@ -469,7 +472,6 @@ arm/allwinner/h6/h6_padconf.c optional soc_allwinner_h6 fdt arm/allwinner/h6/h6_r_padconf.c optional soc_allwinner_h6 fdt # Altera/Intel -dev/altera/dwc/if_dwc_socfpga.c optional fdt dwc_socfpga arm64/intel/stratix10-soc-fpga-mgr.c optional soc_intel_stratix10 fdt arm64/intel/stratix10-svc.c optional soc_intel_stratix10 fdt @@ -672,7 +674,6 @@ arm64/rockchip/rk_iodomain.c optional fdt rk_iodomain arm64/rockchip/rk_spi.c optional fdt rk_spi arm64/rockchip/rk_usb2phy.c optional fdt rk_usb2phy soc_rockchip_rk3328 | fdt rk_usb2phy soc_rockchip_rk3399 | fdt rk_usb2phy soc_rockchip_rk3568 arm64/rockchip/rk_typec_phy.c optional fdt rk_typec_phy soc_rockchip_rk3399 -arm64/rockchip/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 arm64/rockchip/rk_tsadc_if.m optional fdt soc_rockchip_rk3399 | fdt soc_rockchip_rk3568 arm64/rockchip/rk_tsadc.c optional fdt soc_rockchip_rk3399 | fdt soc_rockchip_rk3568 arm64/rockchip/rk_pwm.c optional fdt rk_pwm diff --git a/sys/arm/allwinner/aw_if_dwc.c b/sys/dev/dwc/if_dwc_aw.c similarity index 100% rename from sys/arm/allwinner/aw_if_dwc.c rename to sys/dev/dwc/if_dwc_aw.c diff --git a/sys/arm64/rockchip/if_dwc_rk.c b/sys/dev/dwc/if_dwc_rk.c similarity index 100% rename from sys/arm64/rockchip/if_dwc_rk.c rename to sys/dev/dwc/if_dwc_rk.c diff --git a/sys/dev/altera/dwc/if_dwc_socfpga.c b/sys/dev/dwc/if_dwc_socfpga.c similarity index 100% rename from sys/dev/altera/dwc/if_dwc_socfpga.c rename to sys/dev/dwc/if_dwc_socfpga.c From nobody Thu Oct 5 15:34:54 2023 X-Original-To: dev-commits-src-main@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 4S1bGR0kT2z4vnbq; Thu, 5 Oct 2023 15:34:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGR01JMz4cW5; Thu, 5 Oct 2023 15:34:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520095; 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=HH6KJIwRP3HzvH9cifm3hoP6LggeItOVavyKguBGTGc=; b=V3HB1zNlk+ngNRbGvNZaIu0VPTsqKlHAs56s8JhasO6v1NU/vSz6WK29eiLeGDawlChcf6 4gDc+mZdoDY4Vjy0IJuCC5Zhmm83n19zEAf5fV+YZBVmnpRw6KhsiWMXXXm2Qj/iNd+eKi n/V2++eOrpclncNFelhM2NR7pNx+n1nYW7J+pWP9MhCcnNWUvl0CLBT4ePMEM/amMEz/WM X7uAGkIdl+ENfiJ8ePB/uv03uT1Pz6NWl0G/p9CydGS8rKGOKGfoum9MGJCIjkKVSLhWwd uGw11seGT6OkdS/Uzztah0xS6ig7fbo+aT4z7ZIstxjpDK2+zZQjXxdbmGIvVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520095; a=rsa-sha256; cv=none; b=jR2R5p/uN4h4VaHgxo7s1b4dW9urCUPFRNgtlfG6s+ZNRBCujtJUGOCYWGS5AZNZtzchkl EjhXvTSwMva7IoyOll+ntrCxvHt1uSQXlQzJ3odhrU4Wd3okxEyH1gtue/714bwK8qk6Ck xvNMWRpLJ4h3Mcwfg4xcw5nJYCFCVZ2EvGXoRXOcdIJmk4z+iKae5KUBesLtRuIceSs7jG dOJLPjNHqmTz6WlfH54l0DciDdFPiFyVR02kvExMvUfslO02W2DRD2FG9A28uTUdcmCvOu SYcvgarLHJG6a7b5ny5wZWweKsZzFf7z08QX6hiO1KKKniKyE0pXudtQEqoKMw== 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=1696520095; 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=HH6KJIwRP3HzvH9cifm3hoP6LggeItOVavyKguBGTGc=; b=LY0NqK+K6o6MLIiwQF/7fAFRTfA6MlVqbsU9UAz9SKiu3DEvSjBCvAFyHO2IvDW7/UMDnq 9wuSi/YBL00MrFsmb/oTTUOdHaSktdhvwQ/kN2ezC1nQ9xsPabkYotQK8gKzqaWFJuLuhj Sx3rPT0Hhff59olUt9HX1+8zBK96NAlrbqi2fNonWtQ+nPxsh0CKEBykSD3V0a/eVwQVYy hL5yACrLMR2G/EjC6HUIu+Dfn7a6ju8rz18zqYsO1mYnwlQ0mXbFsTOO0AO5+WNBsVgMpd cLc2W1IA+gw+eI9IefPpgi7scUbiOwo1IcifwvpBzxojvvMEHH9WpMN29sjH3w== 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 4S1bGQ6Bt5z1PfY; Thu, 5 Oct 2023 15:34:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FYsqu012065; Thu, 5 Oct 2023 15:34:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FYsrC012061; Thu, 5 Oct 2023 15:34:54 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:34:54 GMT Message-Id: <202310051534.395FYsrC012061@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: f114aadd3e23 - main - dwc: Rename dwc_reset to dwc_reset_phy List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f114aadd3e2300f74922511dcdd69b10a47e7328 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f114aadd3e2300f74922511dcdd69b10a47e7328 commit f114aadd3e2300f74922511dcdd69b10a47e7328 Author: Emmanuel Vadot AuthorDate: 2023-09-23 16:34:19 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:38 +0000 dwc: Rename dwc_reset to dwc_reset_phy It only deals with reseting the phy. While here avoid calling ofw_bus_get_node again and save the node in softc. --- sys/dev/dwc/if_dwc.c | 41 ++++++++++++++++++++++------------------- sys/dev/dwc/if_dwcvar.h | 1 + 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 18e86ac025d4..accc1b6949cb 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1495,43 +1495,47 @@ dwc_tick(void *arg) #define GPIO_ACTIVE_LOW 1 static int -dwc_reset(device_t dev) +dwc_reset_phy(struct dwc_softc *sc) { pcell_t gpio_prop[4]; pcell_t delay_prop[3]; - phandle_t node, gpio_node; + phandle_t gpio_node; device_t gpio; uint32_t pin, flags; uint32_t pin_value; - node = ofw_bus_get_node(dev); - if (OF_getencprop(node, "snps,reset-gpio", + /* + * All those properties are deprecated but still used in some DTS. + * The new way to deal with this is to use the generic bindings + * present in the ethernet-phy node. + */ + if (OF_getencprop(sc->node, "snps,reset-gpio", gpio_prop, sizeof(gpio_prop)) <= 0) return (0); - if (OF_getencprop(node, "snps,reset-delays-us", + if (OF_getencprop(sc->node, "snps,reset-delays-us", delay_prop, sizeof(delay_prop)) <= 0) { - device_printf(dev, + device_printf(sc->dev, "Wrong property for snps,reset-delays-us"); return (ENXIO); } gpio_node = OF_node_from_xref(gpio_prop[0]); if ((gpio = OF_device_from_xref(gpio_prop[0])) == NULL) { - device_printf(dev, + device_printf(sc->dev, "Can't find gpio controller for phy reset\n"); return (ENXIO); } - if (GPIO_MAP_GPIOS(gpio, node, gpio_node, + if (GPIO_MAP_GPIOS(gpio, sc->node, gpio_node, nitems(gpio_prop) - 1, gpio_prop + 1, &pin, &flags) != 0) { - device_printf(dev, "Can't map gpio for phy reset\n"); + device_printf(sc->dev, "Can't map gpio for phy reset\n"); return (ENXIO); } pin_value = GPIO_PIN_LOW; - if (OF_hasprop(node, "snps,reset-active-low")) + if (OF_hasprop(sc->node, "snps,reset-active-low")) pin_value = GPIO_PIN_HIGH; GPIO_PIN_SETFLAGS(gpio, pin, GPIO_PIN_OUTPUT); @@ -1604,7 +1608,6 @@ dwc_attach(device_t dev) if_t ifp; int error, i; uint32_t reg; - phandle_t node; uint32_t txpbl, rxpbl, pbl; bool nopblx8 = false; bool fixed_burst = false; @@ -1617,8 +1620,8 @@ dwc_attach(device_t dev) sc->mii_clk = IF_DWC_MII_CLK(dev); sc->mactype = IF_DWC_MAC_TYPE(dev); - node = ofw_bus_get_node(dev); - switch (mii_fdt_get_contype(node)) { + sc->node = ofw_bus_get_node(dev); + switch (mii_fdt_get_contype(sc->node)) { case MII_CONTYPE_RGMII: case MII_CONTYPE_RGMII_ID: case MII_CONTYPE_RGMII_RXID: @@ -1636,15 +1639,15 @@ dwc_attach(device_t dev) return (ENXIO); } - if (OF_getencprop(node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) + if (OF_getencprop(sc->node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) pbl = BUS_MODE_DEFAULT_PBL; - if (OF_getencprop(node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) + if (OF_getencprop(sc->node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) txpbl = pbl; - if (OF_getencprop(node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) + if (OF_getencprop(sc->node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) rxpbl = pbl; - if (OF_hasprop(node, "snps,no-pbl-x8") == 1) + if (OF_hasprop(sc->node, "snps,no-pbl-x8") == 1) nopblx8 = true; - if (OF_hasprop(node, "snps,fixed-burst") == 1) + if (OF_hasprop(sc->node, "snps,fixed-burst") == 1) fixed_burst = true; if (IF_DWC_INIT(dev) != 0) @@ -1662,7 +1665,7 @@ dwc_attach(device_t dev) dwc_get_hwaddr(sc, macaddr); /* Reset the PHY if needed */ - if (dwc_reset(dev) != 0) { + if (dwc_reset_phy(sc) != 0) { device_printf(dev, "Can't reset the PHY\n"); bus_release_resources(dev, dwc_spec, sc->res); return (ENXIO); diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index 8a8b9b283784..5e5792974560 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -59,6 +59,7 @@ struct dwc_bufmap { struct dwc_softc { struct resource *res[2]; device_t dev; + phandle_t node; int mactype; int mii_clk; device_t miibus; From nobody Thu Oct 5 15:34:55 2023 X-Original-To: dev-commits-src-main@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 4S1bGS2Cdnz4vnFf; Thu, 5 Oct 2023 15:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGS1GLgz4cZT; Thu, 5 Oct 2023 15:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520096; 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=XC3lSE7vEa/0noN65hfSIfhgtbcR8Dz4llqfAGWnsek=; b=GhsVXb4nc+FUpAvTxDwUm77YWWQh0ADiX0RJ6nmqLnyqMmrCcYGoOawzcWJCx1/QrQGNKK qD8g4M3a95VZQuhWdjgrhS7Eu897WPsXSXMteBa1rq6pSFDUkO9Ep1u0BIGlJyu/D3a7rN MGFn+xw32s8CH6Tccss/Iv84qY2NJXBrJ2rC0+c0WxJxAc4p67aAVv4vYIINLOHKMBX+4d 36IE5/4Sx9D/JfeeP9NPbe975/Oik/5SeAsve2WHJDqI4lv1OnNaXRvmtN06Lhz1/OIIYs Dl6vTSprnv3cuy4f9fk+KSnGFwUNC6polkcPgj+jMINhf00o+08h6vGF1958qw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520096; a=rsa-sha256; cv=none; b=bGiJi6wRdtmYloReT3WR3mWMavziywUeMsIaxE8q3FFbEqvDL1bql70YOyeN7NYgeZIF07 oPGGmVSjHrLdTFiJXajFPJr2yQ8+hTzNSYSYIk8BWVa9GOJXYGaG/9AKRmmCgQV1BgrOoh LCHjgLJ3/FAOhrJzSBRW8mLppeLSVVNsSQBb/DxItUTB+3D2zUu2AVbVRsAQwqktOyhZUm eFKhxVuZpNUmLyxQDycwzg65fsv9hkpLbAntqikinvtWHVoTqVRNiz77E9djTT9ocWRDGZ c2kmuCJCdY5/5n/GScOE3PyZ2K0+PAzEbmipdyvV7sWPYo+dGkSis8VAMBV7Zg== 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=1696520096; 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=XC3lSE7vEa/0noN65hfSIfhgtbcR8Dz4llqfAGWnsek=; b=cGmiY8ZexhXxloqty+S7V8M/scWlx/wxwV/UrH8CDPpfiBNAaveHw3H6SrPUo5pb6XunnS ScbiHhF9JsyvpYjjUSQ3rCWMyU8f7nYecEK3quWRHWGCmVm0CAwW/ALhJYOnoyuhuoe26K M0zBkVBApUeP3OgDSuASd5XNgoG88QrcRjLhPaz93BTFJOrj8j3FCJOyh2eKqa7+yfNQrh uqEQZ0cw7Z4gHpc+LiFmWfW9yAEuKu5rtIYKCU9J0rIjS8HKupambmcqelekYBXGKcMoSx 83mASL80sUQ8k04sm7lzsOu+u1Hr17UKOE5F/OpGVh1NNkHEVCeCvuB667AIYQ== 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 4S1bGS0KT2z1PqT; Thu, 5 Oct 2023 15:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FYtFx012110; Thu, 5 Oct 2023 15:34:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FYtaL012107; Thu, 5 Oct 2023 15:34:55 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:34:55 GMT Message-Id: <202310051534.395FYtaL012107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 27f03f1608f3 - main - dwc: Remove unused GPIO_ACTIVE_LOW define List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27f03f1608f35c59d4f05e759729fa58685db8aa Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=27f03f1608f35c59d4f05e759729fa58685db8aa commit 27f03f1608f35c59d4f05e759729fa58685db8aa Author: Emmanuel Vadot AuthorDate: 2023-09-23 16:45:04 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:38 +0000 dwc: Remove unused GPIO_ACTIVE_LOW define While here move comment block above the appropriate functions. --- sys/dev/dwc/if_dwc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index accc1b6949cb..6ef9fb8513af 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1488,12 +1488,6 @@ dwc_tick(void *arg) callout_reset(&sc->dwc_callout, hz, dwc_tick, sc); } -/* - * Probe/Attach functions - */ - -#define GPIO_ACTIVE_LOW 1 - static int dwc_reset_phy(struct dwc_softc *sc) { @@ -1586,6 +1580,10 @@ dwc_clock_init(device_t dev) return (0); } +/* + * Probe/Attach functions + */ + static int dwc_probe(device_t dev) { From nobody Thu Oct 5 15:34:57 2023 X-Original-To: dev-commits-src-main@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 4S1bGT31l6z4vnND; Thu, 5 Oct 2023 15:34:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGT2RG5z4cXG; Thu, 5 Oct 2023 15:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520097; 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=tlVgRyNiC+TKti7jtX/im8/BqhVelvzsIF527ti1XKg=; b=sv6EqXb8x8UIEPUQSO/9UtK1IttR+U63eel6FlCxxCWxmc81iVISCVlYA2IgOwhEcUSZ6t /VR2AXJcSv5i/u7uA95U7bl9PHgWCGk/MLvgLga6GNubvAxO9mWtmcsMz1JwsphD1Nhgnq XBUE2YlnVT7V79U7cIqEMh7/Vy3uAOXVFbGmj1JdKJi/V58qjCYtSZDqyoN3tgBQz5NR8z C/mE2aXtFvcEDk3s+GSbNk9akJPB8r0VQ6pYXOxh5rQwPrTsk+yRRlh/SwB94BUpWrzQJD rYGvdYquci5030+3PNASITNz3geNlOMKDsEH0EfJzuDy6N6bK7g+0dJzaDYPpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520097; a=rsa-sha256; cv=none; b=btbDu2yv6v0iE+fJzOIChUNJLkKs1i/nlipCm4EESAO8RI7B7GzdygbJYsyW80YDlMRQO/ xjdzLm+Vix7//6p7ra48kJJsZ7qlWPeEw/GS96F/V/53TyS+YE25/tFyiOuaJP1DFrItqO OxZr4Hk7WBzpXzCz3xpzrR5rPYsxxOr0YI6HAMxVHCyI4Nlo7cNrdsJz0kJbp19G1GyELs ftsz5gOnXPuWPEaAdqg1zIRnS2k1x3Um0Yq9sqFFDqN8P4CeoP0ynfFgru6autQvdqK0pN dWpfVjY0Ajt53LS6SD/wgOdS+Xm+qL4XGxzK1d/KRIf0WvRGounqmx+AcqsQDA== 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=1696520097; 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=tlVgRyNiC+TKti7jtX/im8/BqhVelvzsIF527ti1XKg=; b=pvnV8zMYM5+rY8IjoWrOhIhpswtN/LZ5tFVXj3XH3SbF2LWvmx3YcxwPNAohd4zfkqBOIw PqyJkDMwr2lSeAVLzeLTbrCtfZIm4HVsYi85t12NIVYXwe/hk+LuGr1RepAII40Or/WA61 +APztKM3RtC80/e17vZzi8QJI6Q+GFzNlnN0uYIlwsj4D0IwThZYeP+zxn5ewVdzlcoEb8 k6eo03HT/qaoQtuTFtkdroDHd/o90ruEM5vfvIrQXYAhyMORdZ3RDXpFVFGxTiWy0XmkS9 5JqLVN5lTn5Aiyn6ILLeGLY0i/FbhZJQBbBGfLrbfCvXHHw3g+UzRlIHMVWt9A== 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 4S1bGT1K2Rz1QGS; Thu, 5 Oct 2023 15:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FYvks012153; Thu, 5 Oct 2023 15:34:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FYvt6012150; Thu, 5 Oct 2023 15:34:57 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:34:57 GMT Message-Id: <202310051534.395FYvt6012150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: f4bb6ea5212b - main - dwc: Add support for mixed-burst List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4bb6ea5212b05445e1e7f01d9023714c83344cb Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f4bb6ea5212b05445e1e7f01d9023714c83344cb commit f4bb6ea5212b05445e1e7f01d9023714c83344cb Author: Emmanuel Vadot AuthorDate: 2023-09-23 16:52:29 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:38 +0000 dwc: Add support for mixed-burst snps,mixed-burst is used to indicate that the DMA engine should use mixed-burst mode. --- sys/dev/dwc/if_dwc.c | 5 +++++ sys/dev/dwc/if_dwc.h | 1 + 2 files changed, 6 insertions(+) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 6ef9fb8513af..7acb70457a24 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1609,6 +1609,7 @@ dwc_attach(device_t dev) uint32_t txpbl, rxpbl, pbl; bool nopblx8 = false; bool fixed_burst = false; + bool mixed_burst = false; sc = device_get_softc(dev); sc->dev = dev; @@ -1647,6 +1648,8 @@ dwc_attach(device_t dev) nopblx8 = true; if (OF_hasprop(sc->node, "snps,fixed-burst") == 1) fixed_burst = true; + if (OF_hasprop(sc->node, "snps,mixed-burst") == 1) + mixed_burst = true; if (IF_DWC_INIT(dev) != 0) return (ENXIO); @@ -1692,6 +1695,8 @@ dwc_attach(device_t dev) reg |= (rxpbl << BUS_MODE_RPBL_SHIFT); if (fixed_burst) reg |= BUS_MODE_FIXEDBURST; + if (mixed_burst) + reg |= BUS_MODE_MIXEDBURST; WRITE4(sc, BUS_MODE, reg); diff --git a/sys/dev/dwc/if_dwc.h b/sys/dev/dwc/if_dwc.h index 5397b5801596..113477818e4b 100644 --- a/sys/dev/dwc/if_dwc.h +++ b/sys/dev/dwc/if_dwc.h @@ -219,6 +219,7 @@ /* DMA */ #define BUS_MODE 0x1000 +#define BUS_MODE_MIXEDBURST (1 << 26) #define BUS_MODE_EIGHTXPBL (1 << 24) /* Multiplies PBL by 8 */ #define BUS_MODE_USP (1 << 23) #define BUS_MODE_RPBL_SHIFT 17 /* Single block transfer size */ From nobody Thu Oct 5 15:34:58 2023 X-Original-To: dev-commits-src-main@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 4S1bGV4cTXz4vnWW; Thu, 5 Oct 2023 15:34:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGV3GqQz4cj6; Thu, 5 Oct 2023 15:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520098; 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=ElGeCR13j//VeArsD+9wrMreZiH1VsFz1Z57NkqQzwY=; b=TokaNZ24TxGM5TnJKiyVr/U3LewQT9tFkoZV0vHUiVxEFEsxD/ySPQlXb4Rui2fLQ75Txc obSU9Kr32IiGhdBk+eplw1VgUjSHWRmF3TyojLIuFT82/n/SWq/ykxtosvsl10zbm3/hni G4iQee2lh9+DmMSfAH1n+0U0t2FXcsI3lCu2N27IeaJwDY14ukvEr5o6i5SF2+h0zMNI+a MdaHRcWEiOb6UDbOk+yml3RxnCELyebw9gXtCvRksH/8CffkWzYvaGetkGd38i22wJ1j++ /Bv1z1Nzlj+TjOrFauaFcvAee3xSXZadr1JLT2ls7FvIsQ9x5xiif9Uq2YbV7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520098; a=rsa-sha256; cv=none; b=hZZLWMYRtAKYws7ZA1nyRxbeLDyFianjkjFyEdD5dXEE++dfeL4BjKX8JcolsIhRhDHNjj bKqVo10d+IDKjc43pf9fVfFCHqr+5LBmgzAzw/y37sd3KpVx4CJtUJQqKbLzwE/8cD48Pw TFGvUY2QUw7Ueoq36hjK2NqKDRnH58x6U6U5MszqZQoQ9jdJMFG/kUqxgT4jYRSlMY+N0+ TzINsUJ7Hk6yKC/vdMQOdyyOufPyX7UINFSELvN1ggbqw6JgY/aduNO5pQUSdhb4KU8Glr 8pUD6lVkv6riGr1gMDZKBcaNXOPOry7LP32DzYRIigzAarMwCTMz0LtN7vjebw== 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=1696520098; 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=ElGeCR13j//VeArsD+9wrMreZiH1VsFz1Z57NkqQzwY=; b=C+n8ALMQNX0A7iaZpOeAW7fj+TTi86eoM6Em22vdrZe8ecbdBtPaSp1+bKXh+dsmfrBHXp ylENQw5oIIMWUNDZ99qb0F/3UvFhsnR7PQHD+uGz4kvi9YT05loYpG1lAzUWn5MiyZp/Rs PWOqp7BB7MOSvazvI9zB8Z1hDalvxH7pILriXLaLo2VrBrl2eIFSea8+xLSwptkGMyeOVi 0xiNChY14F5dTPGcfusy0m892n8VgWYHxMWyO0NobkiHF2g1X5kbZwdM18Y8KTF80ib5E5 8Nk3NF2aQ24mc3k2gHYPB5SQNtR+rUiHbUcajoxXLQrgAq9JjSa/CzmZUJZP9A== 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 4S1bGV2Kqsz1QCS; Thu, 5 Oct 2023 15:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FYwTx012195; Thu, 5 Oct 2023 15:34:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FYwmB012192; Thu, 5 Oct 2023 15:34:58 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:34:58 GMT Message-Id: <202310051534.395FYwmB012192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b69c49d10632 - main - dwc: Add support for aal List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b69c49d106325a9ceb06ca0d5b827d1dbcc8a54c Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b69c49d106325a9ceb06ca0d5b827d1dbcc8a54c commit b69c49d106325a9ceb06ca0d5b827d1dbcc8a54c Author: Emmanuel Vadot AuthorDate: 2023-09-23 16:56:26 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:38 +0000 dwc: Add support for aal snps,aal is used to indicate that the DMA engine should use Address-Aligned Beats. --- sys/dev/dwc/if_dwc.c | 5 +++++ sys/dev/dwc/if_dwc.h | 1 + 2 files changed, 6 insertions(+) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 7acb70457a24..7b9cd936681d 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1610,6 +1610,7 @@ dwc_attach(device_t dev) bool nopblx8 = false; bool fixed_burst = false; bool mixed_burst = false; + bool aal = false; sc = device_get_softc(dev); sc->dev = dev; @@ -1650,6 +1651,8 @@ dwc_attach(device_t dev) fixed_burst = true; if (OF_hasprop(sc->node, "snps,mixed-burst") == 1) mixed_burst = true; + if (OF_hasprop(sc->node, "snps,aal") == 1) + aal = true; if (IF_DWC_INIT(dev) != 0) return (ENXIO); @@ -1697,6 +1700,8 @@ dwc_attach(device_t dev) reg |= BUS_MODE_FIXEDBURST; if (mixed_burst) reg |= BUS_MODE_MIXEDBURST; + if (aal) + reg |= BUS_MODE_AAL; WRITE4(sc, BUS_MODE, reg); diff --git a/sys/dev/dwc/if_dwc.h b/sys/dev/dwc/if_dwc.h index 113477818e4b..be27b189e4e8 100644 --- a/sys/dev/dwc/if_dwc.h +++ b/sys/dev/dwc/if_dwc.h @@ -220,6 +220,7 @@ /* DMA */ #define BUS_MODE 0x1000 #define BUS_MODE_MIXEDBURST (1 << 26) +#define BUS_MODE_AAL (1 << 25) #define BUS_MODE_EIGHTXPBL (1 << 24) /* Multiplies PBL by 8 */ #define BUS_MODE_USP (1 << 23) #define BUS_MODE_RPBL_SHIFT 17 /* Single block transfer size */ From nobody Thu Oct 5 15:34:59 2023 X-Original-To: dev-commits-src-main@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 4S1bGW4n5Hz4vnJP; Thu, 5 Oct 2023 15:34:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGW3x0tz4cft; Thu, 5 Oct 2023 15:34:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520099; 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=MhVIdeE0S5Q1QZFKaHYuvbTI4x7Je8BhrYVB7v9ECIs=; b=xk2CGu8saciQ9O7UehX21E0P2qYw9P+pNxeYP1zyxqmV2V6EvQq54ViKckn5br4uwtvkzI EpZqZT5sqAWeS9impobFOIXloEsD8YHnRG2/CllS8Wys8yq/mfB0z7h4CErBVD1Cx/sgD7 cgIyzSwpvSw6kqZBc7+JeGrUSQFm8dQ1vedCqx6Lz2DtMEtuP1iTriIE9Q6n/coPOY/HOb JNLiAW8E52Tx2NU78GcEuk7ZfmldKSj+NBeqHN7TuwN7zgk/GDzf50nx0MVPmffUayaS9I ZXFq5Gcm1sL+vKpyztF7iyuipB6icTsi+zfVGIBFnr/tqJJ7aXqVPBC52wC4VA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520099; a=rsa-sha256; cv=none; b=PvbTKV7fE0GbwHQbN3pgkRvkMXK/uhHUOO4i+1hTxjL9gM9QW41SRwWgAwKGw054Ykwl/Z wm8U9YHgX4yUoI/fT7Zzng4gDUvRU3rtK5mpicUgJM2SBGR0+j0d+apmClQfBVAZLsZImV Fv5c9f1OQXFVftJQtBpF3Sv74VVThhCbpd7m+XojTHCsUqYYoVPZE3OAommFEGOxWUHix6 h3H0fBn3q5i1+8AQWqnt+gUyOT3aCmjgUotAu2xuVU8gVc/j5xn0EH28H7FaSeEWNAfeEZ Eh42xrclh0bju02Y5o11Ccos7fvZxaj6kmfLiBLobKyY0qIbD3Pn7QTL4F14GA== 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=1696520099; 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=MhVIdeE0S5Q1QZFKaHYuvbTI4x7Je8BhrYVB7v9ECIs=; b=u1yFYLrxtFW0FLDrMskM85NAgx/9+fjq7Qm9KTwlbJYT4CjkXzsn9py/aX5JaTS6FwUwyg TISGjPmq604ctxi+Zovop59qbz494x8e3o8NWkFcdPPBcEzh+obNO1Q3/WD38HdxGt4irV BxmT3Hk8IXf7ZfoLnyhk20b9lxJ01KRonVISkz9SeVUK03MC/IzDh4+jc8L4PEso8KfuuL ZZ07TQoMoheYh2k3D/N1UWcScbKXW1Gqix0IBTOluvcUCSOY6rV4riugJbaUX7S1OrKixt rlDaWH4cLujJBssuyIM57ljt+pOHzUkbLmpC9H9Bbk5y1YWMCTolouIwSRNo3A== 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 4S1bGW2zKMz1PqV; Thu, 5 Oct 2023 15:34:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FYxuF012241; Thu, 5 Oct 2023 15:34:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FYxnZ012238; Thu, 5 Oct 2023 15:34:59 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:34:59 GMT Message-Id: <202310051534.395FYxnZ012238@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 50059a60edec - main - dwc: Rewrite clock and reset functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50059a60edec3c8c37e2f7b490fef83ec288b2da Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=50059a60edec3c8c37e2f7b490fef83ec288b2da commit 50059a60edec3c8c37e2f7b490fef83ec288b2da Author: Emmanuel Vadot AuthorDate: 2023-09-23 16:24:22 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:38 +0000 dwc: Rewrite clock and reset functions snps,dwmac have one required clock named stmmaceth and one optional pclk, correctly handle both in if_dwc, no need to get/enable stmmacseth again in if_dwc_rk. It also have one required reset also named stmmaceth and one optional ahb, correctly handle both. Rockchip have another optional clock named clk_mac_speed, get it and enable it if present. Also fix the optional RMII clocks, they were previously wrongly enabled in RGMII case. --- sys/dev/dwc/if_dwc.c | 100 +++++++++++++++++++++++++++++-------------- sys/dev/dwc/if_dwc_aw.c | 4 +- sys/dev/dwc/if_dwc_rk.c | 39 ++++++++--------- sys/dev/dwc/if_dwc_socfpga.c | 3 ++ sys/dev/dwc/if_dwcvar.h | 6 +++ 5 files changed, 98 insertions(+), 54 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 7b9cd936681d..981e823a6fcc 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -61,6 +61,9 @@ #include +#include +#include + #include #include #include @@ -69,9 +72,6 @@ #include #include -#include -#include - #include "if_dwc_if.h" #include "gpio_if.h" #include "miibus_if.h" @@ -1544,37 +1544,65 @@ dwc_reset_phy(struct dwc_softc *sc) } static int -dwc_clock_init(device_t dev) +dwc_clock_init(struct dwc_softc *sc) { - hwreset_t rst; - clk_t clk; - int error; + int rv; int64_t freq; - /* Enable clocks */ - if (clk_get_by_ofw_name(dev, 0, "stmmaceth", &clk) == 0) { - error = clk_enable(clk); - if (error != 0) { - device_printf(dev, "could not enable main clock\n"); - return (error); - } - if (bootverbose) { - clk_get_freq(clk, &freq); - device_printf(dev, "MAC clock(%s) freq: %jd\n", - clk_get_name(clk), (intmax_t)freq); - } + /* Required clock */ + rv = clk_get_by_ofw_name(sc->dev, 0, "stmmaceth", &sc->clk_stmmaceth); + if (rv != 0) { + device_printf(sc->dev, "Cannot get GMAC main clock\n"); + return (ENXIO); } - else { - device_printf(dev, "could not find clock stmmaceth\n"); + if ((rv = clk_enable(sc->clk_stmmaceth)) != 0) { + device_printf(sc->dev, "could not enable main clock\n"); + return (rv); } - /* De-assert reset */ - if (hwreset_get_by_ofw_name(dev, 0, "stmmaceth", &rst) == 0) { - error = hwreset_deassert(rst); - if (error != 0) { - device_printf(dev, "could not de-assert reset\n"); - return (error); - } + /* Optional clock */ + rv = clk_get_by_ofw_name(sc->dev, 0, "pclk", &sc->clk_pclk); + if (rv != 0) + return (0); + if ((rv = clk_enable(sc->clk_pclk)) != 0) { + device_printf(sc->dev, "could not enable peripheral clock\n"); + return (rv); + } + + if (bootverbose) { + clk_get_freq(sc->clk_stmmaceth, &freq); + device_printf(sc->dev, "MAC clock(%s) freq: %jd\n", + clk_get_name(sc->clk_stmmaceth), (intmax_t)freq); + } + + return (0); +} + +static int +dwc_reset_deassert(struct dwc_softc *sc) +{ + int rv; + + /* Required reset */ + rv = hwreset_get_by_ofw_name(sc->dev, 0, "stmmaceth", &sc->rst_stmmaceth); + if (rv != 0) { + device_printf(sc->dev, "Cannot get GMAC reset\n"); + return (ENXIO); + } + rv = hwreset_deassert(sc->rst_stmmaceth); + if (rv != 0) { + device_printf(sc->dev, "could not de-assert GMAC reset\n"); + return (rv); + } + + /* Optional reset */ + rv = hwreset_get_by_ofw_name(sc->dev, 0, "ahb", &sc->rst_ahb); + if (rv != 0) + return (0); + rv = hwreset_deassert(sc->rst_ahb); + if (rv != 0) { + device_printf(sc->dev, "could not de-assert AHB reset\n"); + return (rv); } return (0); @@ -1654,10 +1682,20 @@ dwc_attach(device_t dev) if (OF_hasprop(sc->node, "snps,aal") == 1) aal = true; - if (IF_DWC_INIT(dev) != 0) - return (ENXIO); + error = clk_set_assigned(dev, ofw_bus_get_node(dev)); + if (error != 0) { + device_printf(dev, "clk_set_assigned failed\n"); + return (error); + } - if (dwc_clock_init(dev) != 0) + /* Enable main clock */ + if ((error = dwc_clock_init(sc)) != 0) + return (error); + /* De-assert main reset */ + if ((error = dwc_reset_deassert(sc)) != 0) + return (error); + + if (IF_DWC_INIT(dev) != 0) return (ENXIO); if (bus_alloc_resources(dev, dwc_spec, sc->res)) { diff --git a/sys/dev/dwc/if_dwc_aw.c b/sys/dev/dwc/if_dwc_aw.c index 5992a652facb..2e34a311b0a7 100644 --- a/sys/dev/dwc/if_dwc_aw.c +++ b/sys/dev/dwc/if_dwc_aw.c @@ -36,13 +36,15 @@ #include +#include +#include + #include #include #include #include #include -#include #include #include "if_dwc_if.h" diff --git a/sys/dev/dwc/if_dwc_rk.c b/sys/dev/dwc/if_dwc_rk.c index 7c8a6c2ab668..49cf5fef7808 100644 --- a/sys/dev/dwc/if_dwc_rk.c +++ b/sys/dev/dwc/if_dwc_rk.c @@ -38,16 +38,16 @@ #include #include -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include + #include "if_dwc_if.h" #include "syscon_if.h" @@ -130,6 +130,7 @@ struct if_dwc_rk_softc { clk_t aclk_mac; clk_t pclk_mac; clk_t clk_stmmaceth; + clk_t clk_mac_speed; /* RMII clocks */ clk_t clk_mac_ref; clk_t clk_mac_refout; @@ -391,26 +392,10 @@ static int if_dwc_rk_init_clocks(device_t dev) { struct if_dwc_rk_softc *sc; - int error; sc = device_get_softc(dev); - error = clk_set_assigned(dev, ofw_bus_get_node(dev)); - if (error != 0) { - device_printf(dev, "clk_set_assigned failed\n"); - return (error); - } /* Enable clocks */ - error = clk_get_by_ofw_name(dev, 0, "stmmaceth", &sc->clk_stmmaceth); - if (error != 0) { - device_printf(dev, "could not find clock stmmaceth\n"); - return (error); - } - - if (clk_get_by_ofw_name(dev, 0, "mac_clk_rx", &sc->mac_clk_rx) != 0) { - device_printf(sc->base.dev, "could not get mac_clk_rx clock\n"); - sc->mac_clk_rx = NULL; - } if (clk_get_by_ofw_name(dev, 0, "mac_clk_tx", &sc->mac_clk_tx) != 0) { device_printf(sc->base.dev, "could not get mac_clk_tx clock\n"); @@ -427,7 +412,15 @@ if_dwc_rk_init_clocks(device_t dev) sc->pclk_mac = NULL; } - if (sc->base.phy_mode == PHY_MODE_RGMII) { + /* Optional clock */ + clk_get_by_ofw_name(dev, 0, "clk_mac_speed", &sc->clk_mac_speed); + + if (sc->base.phy_mode == PHY_MODE_RMII) { + if (clk_get_by_ofw_name(dev, 0, "mac_clk_rx", &sc->mac_clk_rx) != 0) { + device_printf(sc->base.dev, "could not get mac_clk_rx clock\n"); + sc->mac_clk_rx = NULL; + } + if (clk_get_by_ofw_name(dev, 0, "clk_mac_ref", &sc->clk_mac_ref) != 0) { device_printf(sc->base.dev, "could not get clk_mac_ref clock\n"); sc->clk_mac_ref = NULL; @@ -470,6 +463,8 @@ if_dwc_rk_init_clocks(device_t dev) clk_enable(sc->pclk_mac); if (sc->mac_clk_tx) clk_enable(sc->mac_clk_tx); + if (sc->clk_mac_speed) + clk_enable(sc->clk_mac_speed); DELAY(50); diff --git a/sys/dev/dwc/if_dwc_socfpga.c b/sys/dev/dwc/if_dwc_socfpga.c index ac8c78326df7..63a19ed12977 100644 --- a/sys/dev/dwc/if_dwc_socfpga.c +++ b/sys/dev/dwc/if_dwc_socfpga.c @@ -42,6 +42,9 @@ #include +#include +#include + #include #include #include diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index 5e5792974560..da31fa8c6575 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -76,6 +76,12 @@ struct dwc_softc { int stats_harvest_count; int phy_mode; + /* clocks and reset */ + clk_t clk_stmmaceth; + clk_t clk_pclk; + hwreset_t rst_stmmaceth; + hwreset_t rst_ahb; + /* RX */ bus_dma_tag_t rxdesc_tag; bus_dmamap_t rxdesc_map; From nobody Thu Oct 5 15:35:00 2023 X-Original-To: dev-commits-src-main@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 4S1bGX55vRz4vnYq; Thu, 5 Oct 2023 15:35:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGX4dykz4cgF; Thu, 5 Oct 2023 15:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520100; 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=Gi4FjAOqSwqRTm2Xq/zSFO3gYCio2ThCEkYwIF0vR3M=; b=x8WOE+ClGs3e0qxc1sCv1ebfar1mvRLvkh3yuvI2f8s1TudCJ/sJCcIj+HGEKxcHsJNqhP K63DbI+RTljRXQ1lsyIlF4aQmJ9Uz7WCBsfVakJkYazCY8X4ghoaxQQ0OGYk5QlTMUahG2 DZScgXQHgz0Oey5sADXBIYV/vJl6rLXprRHrJgXaLFi9CkXC9IrsiEdXWztyGnYKSD9brK mxzI1kxABEdEBKdgUffCvn71l44JdSgOiB+y9v98/55eDyxKGB+z7k2Tbuf0wcdMnWpBHL V8g1oYcK66ceyLy+dt2pxt0ryJUL+nsNpwJ2V7ayoLZ5+o4i4BcCJ3UO8GUm5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520100; a=rsa-sha256; cv=none; b=wuHaHg7oiiN2YgRQFyR2M5+nHaGqK3yiBbz2ClwdmjSu4I+qwgM0acrEegv8SbDGOjzgcz 1B67Y4U6bzsQeZv+B1j6WLMTfxW23WYHP/MnNmae5le8xxzHHpMfeLG/mpCoMaPOm2K/lG sLteUvn9BYUlau4kUq7t+nQ/zEygMAGK0gdURuhWQLwzpzpbvShgvv7AEHFyxtmXiDonE6 gf//za9Lz1Fyp8Bc2W6WB5viUCx9SSDlaE2rNgo3Knr6rh+xZI0vzxXAB1BmUzUuFtOuXa a2W0d1R2hiFaL+sMETjv9tS6wMw9utdz15u/pEwZfqRwxwf/rsiM14IEasHpmw== 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=1696520100; 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=Gi4FjAOqSwqRTm2Xq/zSFO3gYCio2ThCEkYwIF0vR3M=; b=c/lCdvR2EQxy8mG+CtqDhNsgmM+7vYs/sdU1V5msBOv8mPVhxo1USiHYXsEYjNcgTP16/o 5+sNqYd/6q+tIM9/I0ZzjW5DOxoacAFYjlJGEDDhi+ix5kyIMfJirc2DqD/MDEeyTjBzXh TOnvN6C1Hr1e0YEXyW8MW5w2WwGQOB2ZwS7FjUlHuLiM9hliLtjgzNWl/HE+9wchzlaW1n NIrz3WYCM3JdCZG/Evwqk/LIURZdPDcTIYj5Le8/elRtRemJnrIy3wnj3m8rps/Bm3wOvL jk7FaukRh7kC1UVeghRmWBgn22hzs2qrUCTkSAf0erGVv3dk74ubpXSEMo2xXg== 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 4S1bGX3f0Fz1Q6y; Thu, 5 Oct 2023 15:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ09h012305; Thu, 5 Oct 2023 15:35:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ0Mo012302; Thu, 5 Oct 2023 15:35:00 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:00 GMT Message-Id: <202310051535.395FZ0Mo012302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 9e3879fcc111 - main - dwc: Drop 'All rights reserved' List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e3879fcc11152ad52b13221cd488d40c89a40e9 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=9e3879fcc11152ad52b13221cd488d40c89a40e9 commit 9e3879fcc11152ad52b13221cd488d40c89a40e9 Author: Emmanuel Vadot AuthorDate: 2023-09-26 17:26:16 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Drop 'All rights reserved' Discussed with: br --- sys/dev/dwc/if_dwc.c | 1 - sys/dev/dwc/if_dwc_if.m | 1 - sys/dev/dwc/if_dwcvar.h | 1 - 3 files changed, 3 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 981e823a6fcc..6dca1e204c41 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2014 Ruslan Bukin - * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) diff --git a/sys/dev/dwc/if_dwc_if.m b/sys/dev/dwc/if_dwc_if.m index b8133ef898da..8e3a4196fdbf 100644 --- a/sys/dev/dwc/if_dwc_if.m +++ b/sys/dev/dwc/if_dwc_if.m @@ -1,7 +1,6 @@ #- # Copyright (c) 2015 Luiz Otavio O Souza # Copyright (c) 2014 Ruslan Bukin -# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index da31fa8c6575..15bc3e25f0b7 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2014 Ruslan Bukin - * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) From nobody Thu Oct 5 15:35:01 2023 X-Original-To: dev-commits-src-main@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 4S1bGY6wz7z4vnR8; Thu, 5 Oct 2023 15:35:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGY5s4zz4cgb; Thu, 5 Oct 2023 15:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520101; 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=vkY4O1E3f4sK4vfCuFENKlTa7y0lI1gWvkW6t/8nquE=; b=rb/Aca8oFE8FeT3wIz1/bU+qm74Q91xb6n7Ebz+wdRSP4GDLykUQq5G5sPXXsTYwKb90S8 PGs1eQeILqzyetkVU+aUk3WoI2imfO3Kdfn4AmBXqlFtkoQ99yKTaOmQN+sEGzwvN90o5w +4fOlKciVzvWfIA67J8RJXjB2+qL38ISIeu4fXgDzMn35OckXwql53S5SQgoNcIESPiY6G wvSY3t4hooUSHORDTTsWAXVabNsaH5kBCnUJJjhGgCZE5auvvQD106KHJEqGTwtwutLsn0 rlpubyFeK/5oS0qqovlLgvwzyi+vdSIlysCzf7fKsqB+umlKinLbqezpnHa+nA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520101; a=rsa-sha256; cv=none; b=P9fIBGI3axkBTFCQSGg5Fe8ZrLewgTsKAwBGA/F4ByQ6TQ846wbsjA/3cLZft0r7Y0kaiM deC3nFTDMfbZtLHatKFT9sRrTzNtBAitD/iFI61bKfgOpw8JRpWb34nlR3ZvTrgHm/+36f lXdg7HcZ5nKDLiwGbqtJpdiiVuBa+9uLBaumFdC/W2RhUcnVPPpCo/x1UUkPf2r7hgfgMP UnrNaTQcgn7zTCTOpEatVknRmdh8FLoCPhVbD5yYQ80EVgqpxZ4JllauBx7wSnb23g+orn eumwytH1geWVFUljAI1MhNgAavcsQv1kx52Cob7nnkMSkj3FRvU5MvFHHBGilw== 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=1696520101; 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=vkY4O1E3f4sK4vfCuFENKlTa7y0lI1gWvkW6t/8nquE=; b=BbuqAVNiwXdkkGDFa6+y5/bI6NbJFlEDwoUKgb6RNIOr3LjfhFfajyEMUNzjZ+qTh+E1ah om0QtVo1G2ZtumWVkpB7Z7S4Q6KEDpfDV0iqQFJGWfnuP46i/KVjR/Dee3jAhENdLDT/hB ZE7piRkkGjb/cgdjywR0T/1WghhuxRSUuB881X041zFHD+igytaYFA6wP29LFHLICgo0Ze TgmkLXjm6xSWtdkg1ZAUI91LPWZqDky/3vYzQ+nUtmM+g+7haSWjJ/EHdtuRRUDd0mDI8I 5ozNexxXYS7YuUBwia5wia6rtwenWjZMyYJxtjiHHr5iTHBpYD775LXQEdbdgA== 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 4S1bGY4tz6z1QJh; Thu, 5 Oct 2023 15:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ1es012347; Thu, 5 Oct 2023 15:35:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ1ef012344; Thu, 5 Oct 2023 15:35:01 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:01 GMT Message-Id: <202310051535.395FZ1ef012344@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c36125f6cc8b - main - dwc: Rename if_dwc.h to dwc1000_reg.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c36125f6cc8b3577f913da757ae588dd357a765c Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c36125f6cc8b3577f913da757ae588dd357a765c commit c36125f6cc8b3577f913da757ae588dd357a765c Author: Emmanuel Vadot AuthorDate: 2023-09-25 17:56:31 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Rename if_dwc.h to dwc1000_reg.h Synopsis/Designware controller have multiple version. The version currently supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit. This file only have definition for the registers of this version so rename it. No functional changes intended. --- sys/dev/dwc/{if_dwc.h => dwc1000_reg.h} | 7 +++---- sys/dev/dwc/if_dwc.c | 5 +++-- sys/dev/dwc/if_dwc_aw.c | 13 +++++++------ sys/dev/dwc/if_dwc_if.m | 2 +- sys/dev/dwc/if_dwc_rk.c | 7 ++++--- sys/dev/dwc/if_dwc_socfpga.c | 7 ++++--- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/sys/dev/dwc/if_dwc.h b/sys/dev/dwc/dwc1000_reg.h similarity index 99% rename from sys/dev/dwc/if_dwc.h rename to sys/dev/dwc/dwc1000_reg.h index be27b189e4e8..1f0957b688ac 100644 --- a/sys/dev/dwc/if_dwc.h +++ b/sys/dev/dwc/dwc1000_reg.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2014 Ruslan Bukin - * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) @@ -32,8 +31,8 @@ * Register names were taken almost as is from the documentation. */ -#ifndef __IF_DWC_H__ -#define __IF_DWC_H__ +#ifndef __DWC1000_REG_H__ +#define __DWC1000_REG_H__ #define PHY_MODE_UNKNOWN 0x0 #define PHY_MODE_RMII 0x1 @@ -302,4 +301,4 @@ #define GMAC_MII_CLK_DIV16 0xe #define GMAC_MII_CLK_DIV18 0xf -#endif /* __IF_DWC_H__ */ +#endif /* __DWC1000_REG_H__ */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 6dca1e204c41..86e00c76a1be 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -63,14 +63,15 @@ #include #include -#include -#include #include #include #include #include #include +#include +#include + #include "if_dwc_if.h" #include "gpio_if.h" #include "miibus_if.h" diff --git a/sys/dev/dwc/if_dwc_aw.c b/sys/dev/dwc/if_dwc_aw.c index 2e34a311b0a7..e6cf30f91fc3 100644 --- a/sys/dev/dwc/if_dwc_aw.c +++ b/sys/dev/dwc/if_dwc_aw.c @@ -36,17 +36,18 @@ #include -#include -#include - -#include -#include #include #include -#include +#include +#include #include +#include + +#include +#include + #include "if_dwc_if.h" static int diff --git a/sys/dev/dwc/if_dwc_if.m b/sys/dev/dwc/if_dwc_if.m index 8e3a4196fdbf..0d0d9ee114f7 100644 --- a/sys/dev/dwc/if_dwc_if.m +++ b/sys/dev/dwc/if_dwc_if.m @@ -27,7 +27,7 @@ INTERFACE if_dwc; -#include +#include CODE { static int diff --git a/sys/dev/dwc/if_dwc_rk.c b/sys/dev/dwc/if_dwc_rk.c index 49cf5fef7808..d05352a27793 100644 --- a/sys/dev/dwc/if_dwc_rk.c +++ b/sys/dev/dwc/if_dwc_rk.c @@ -38,15 +38,16 @@ #include #include +#include +#include + #include #include #include #include -#include #include -#include -#include +#include #include "if_dwc_if.h" #include "syscon_if.h" diff --git a/sys/dev/dwc/if_dwc_socfpga.c b/sys/dev/dwc/if_dwc_socfpga.c index 63a19ed12977..7b4ead1a940c 100644 --- a/sys/dev/dwc/if_dwc_socfpga.c +++ b/sys/dev/dwc/if_dwc_socfpga.c @@ -42,13 +42,14 @@ #include +#include +#include + #include #include -#include #include -#include -#include +#include #include "if_dwc_if.h" From nobody Thu Oct 5 15:35:02 2023 X-Original-To: dev-commits-src-main@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 4S1bGb0jhCz4vnYv; Thu, 5 Oct 2023 15:35:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGZ65g8z4cy2; Thu, 5 Oct 2023 15:35:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520102; 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=JvErCHnBCnFR9/LQas5qk4WUWaKuAjRXBxl7TNNQolI=; b=pSEWeIAEZvm0JSFZCYj7PTiLrLrH6ydlcOv4QYQ1K2vcq725DIAICi0BMB2+xAJiN1Yf/7 HebRdMqHxR0VvzBkprXg+0uNmnkxmFtZjTMVp1pm0Q7LicSy6JOC0H16UWT1w7F6Xttui4 ls3HLofqsGHaXLTpnLtVtEalnrpEVbBcjvMUCkLSrXDHa4YqvXnxRCjX76Kr1MP/hKWjAn uiCdWajg1NCloyCSeREGNCghf9MH6pZyRtGgHEX+gtjJx8Lzgn4X1BySLZ1g543BEGSyFF nCSptacgVCse/CNtvgj19uMoWKcXx5Szq/I6LkV9fWeyuY0qmGnYcpP05sV+1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520102; a=rsa-sha256; cv=none; b=WHwBFFFnv63DVyO8sQc9NPv2+483cYlrTX6aORpDtN6mSKzR/uYuXejW6ceMVl5EqNTzn8 +TdwGI5oD3enyWIvBWxwUoySN/cCOKmBzI/xzsuVt1D2hPFRxiuanGz828qNJec3VBarCH xjaus5HbcbuUWMZs4aVTyZhWCuOc1ZLheAEG6nGxrFOAA99YqnDQNxcKmp4C6F7Tu0bpIP hRpuYSUPloXvB/PDATLHsRkSdcC1rA3ilM9HLzitq4gXngK2VZcnxC8dpZ0wmVuxrz0HDY ViFZPpJ4yz5T5k7LZrflyboxVuiPwb0bcLHCEFkO81ucR5uOrQGAhY+uEqKHWQ== 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=1696520102; 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=JvErCHnBCnFR9/LQas5qk4WUWaKuAjRXBxl7TNNQolI=; b=mf/urha6M6RvSEblhsJHY0Myz7QF7Kot3cgUGIGf5guEF2etb+ZhkD8ANjLK0ZK6YD77zM NTBRykVbRxNvdTBMfxwlvUfIlSr8nPjGM0Pc6LiUPXdDPxSZB8wnKkVFlFwl0SC/JToEMH R+yneB15ZeYE7ABGqDwRiVHhFdhYvA2nGZQwDAyVPcnmvYh5ATaJ2FIC7hExG3ZssE1Pni CZ8ECbotHJ1/x49eBiHazPx6iC9JCBYNKjIhc5Egmql20We3wEpZpwMfzGdgC5LucI8707 +vbyXampdGAgqsGeF05RiCZ+GMLrPMnzUFBjZDlANABaBOSzqXkB+3GYjntp3g== 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 4S1bGZ5B99z1QCT; Thu, 5 Oct 2023 15:35:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ2Pl012387; Thu, 5 Oct 2023 15:35:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ2MU012384; Thu, 5 Oct 2023 15:35:02 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:02 GMT Message-Id: <202310051535.395FZ2MU012384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 972adf0f97ac - main - dwc: Split dma functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 972adf0f97ac5e2f3a6024c25623a908403aff9b Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=972adf0f97ac5e2f3a6024c25623a908403aff9b commit 972adf0f97ac5e2f3a6024c25623a908403aff9b Author: Emmanuel Vadot AuthorDate: 2023-09-28 18:40:55 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Split dma functions Synopsis/Designware controller have multiple dma version, the one included in the driver is the base one. if_awg is one example of a dwc variant that have another DMA controller. eqos is a newer variant of dwc that have a newer dma controller. In the goal to support all of those in the same base driver start splitting the dma function to a new file. No functional changes intended. --- sys/conf/files.arm | 1 + sys/conf/files.arm64 | 1 + sys/dev/dwc/dwc1000_dma.c | 668 +++++++++++++++++++++++++++++++++++++++++ sys/dev/dwc/dwc1000_dma.h | 160 ++++++++++ sys/dev/dwc/if_dwc.c | 751 +--------------------------------------------- sys/dev/dwc/if_dwcvar.h | 10 + 6 files changed, 850 insertions(+), 741 deletions(-) diff --git a/sys/conf/files.arm b/sys/conf/files.arm index 344dada420c9..d47f2b7a78e8 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -88,6 +88,7 @@ crypto/des/des_enc.c optional netsmb dev/cpufreq/cpufreq_dt.c optional cpufreq fdt dev/dwc/if_dwc.c optional dwc dev/dwc/if_dwc_if.m optional dwc +dev/dwc/dwc1000_dma.c optional dwc dev/fb/fb.c optional sc dev/fdt/fdt_arm_platform.c optional platform fdt dev/video/crtc_if.m optional vt diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index eaf4577ee14e..b9e690d2ca50 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -227,6 +227,7 @@ dev/dpaa2/memac_mdio_if.m optional soc_nxp_ls dpaa2 acpi | soc_nxp_ls dpaa2 fd # Synopsys DesignWare Ethernet Controller dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 +dev/dwc/dwc1000_dma.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 dev/dwc/if_dwc_socfpga.c optional fdt dwc_socfpga diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c new file mode 100644 index 000000000000..a04f65de8501 --- /dev/null +++ b/sys/dev/dwc/dwc1000_dma.c @@ -0,0 +1,668 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +static inline uint32_t +next_rxidx(struct dwc_softc *sc, uint32_t curidx) +{ + + return ((curidx + 1) % RX_DESC_COUNT); +} + +static void +dwc_get1paddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + + if (error != 0) + return; + *(bus_addr_t *)arg = segs[0].ds_addr; +} + +inline static void +dwc_set_owner(struct dwc_softc *sc, int idx) +{ + wmb(); + sc->txdesc_ring[idx].desc0 |= TDESC0_OWN; + wmb(); +} + +inline static void +dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr, + uint32_t len, uint32_t flags, bool first, bool last) +{ + uint32_t desc0, desc1; + + /* Addr/len 0 means we're clearing the descriptor after xmit done. */ + if (paddr == 0 || len == 0) { + desc0 = 0; + desc1 = 0; + --sc->tx_desccount; + } else { + if (sc->mactype != DWC_GMAC_EXT_DESC) { + desc0 = 0; + desc1 = NTDESC1_TCH | len | flags; + if (first) + desc1 |= NTDESC1_FS; + if (last) + desc1 |= NTDESC1_LS | NTDESC1_IC; + } else { + desc0 = ETDESC0_TCH | flags; + if (first) + desc0 |= ETDESC0_FS; + if (last) + desc0 |= ETDESC0_LS | ETDESC0_IC; + desc1 = len; + } + ++sc->tx_desccount; + } + + sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr); + sc->txdesc_ring[idx].desc0 = desc0; + sc->txdesc_ring[idx].desc1 = desc1; +} + +inline static uint32_t +dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr) +{ + uint32_t nidx; + + sc->rxdesc_ring[idx].addr1 = (uint32_t)paddr; + nidx = next_rxidx(sc, idx); + sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr + + (nidx * sizeof(struct dwc_hwdesc)); + if (sc->mactype != DWC_GMAC_EXT_DESC) + sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | + MIN(MCLBYTES, NRDESC1_RBS1_MASK); + else + sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | + MIN(MCLBYTES, ERDESC1_RBS1_MASK); + + wmb(); + sc->rxdesc_ring[idx].desc0 = RDESC0_OWN; + wmb(); + return (nidx); +} + +int +dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp) +{ + struct bus_dma_segment segs[TX_MAP_MAX_SEGS]; + int error, nsegs; + struct mbuf * m; + uint32_t flags = 0; + int i; + int first, last; + + error = bus_dmamap_load_mbuf_sg(sc->txbuf_tag, sc->txbuf_map[idx].map, + *mp, segs, &nsegs, 0); + if (error == EFBIG) { + /* + * The map may be partially mapped from the first call. + * Make sure to reset it. + */ + bus_dmamap_unload(sc->txbuf_tag, sc->txbuf_map[idx].map); + if ((m = m_defrag(*mp, M_NOWAIT)) == NULL) + return (ENOMEM); + *mp = m; + error = bus_dmamap_load_mbuf_sg(sc->txbuf_tag, sc->txbuf_map[idx].map, + *mp, segs, &nsegs, 0); + } + if (error != 0) + return (ENOMEM); + + if (sc->tx_desccount + nsegs > TX_DESC_COUNT) { + bus_dmamap_unload(sc->txbuf_tag, sc->txbuf_map[idx].map); + return (ENOMEM); + } + + m = *mp; + + if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) { + if ((m->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) != 0) { + if (sc->mactype != DWC_GMAC_EXT_DESC) + flags = NTDESC1_CIC_FULL; + else + flags = ETDESC0_CIC_FULL; + } else { + if (sc->mactype != DWC_GMAC_EXT_DESC) + flags = NTDESC1_CIC_HDR; + else + flags = ETDESC0_CIC_HDR; + } + } + + bus_dmamap_sync(sc->txbuf_tag, sc->txbuf_map[idx].map, + BUS_DMASYNC_PREWRITE); + + sc->txbuf_map[idx].mbuf = m; + + first = sc->tx_desc_head; + for (i = 0; i < nsegs; i++) { + dwc_setup_txdesc(sc, sc->tx_desc_head, + segs[i].ds_addr, segs[i].ds_len, + (i == 0) ? flags : 0, /* only first desc needs flags */ + (i == 0), + (i == nsegs - 1)); + if (i > 0) + dwc_set_owner(sc, sc->tx_desc_head); + last = sc->tx_desc_head; + sc->tx_desc_head = next_txidx(sc, sc->tx_desc_head); + } + + sc->txbuf_map[idx].last_desc_idx = last; + + dwc_set_owner(sc, first); + + return (0); +} + +static int +dma1000_setup_rxbuf(struct dwc_softc *sc, int idx, struct mbuf *m) +{ + struct bus_dma_segment seg; + int error, nsegs; + + m_adj(m, ETHER_ALIGN); + + error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, + m, &seg, &nsegs, 0); + if (error != 0) + return (error); + + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + bus_dmamap_sync(sc->rxbuf_tag, sc->rxbuf_map[idx].map, + BUS_DMASYNC_PREREAD); + + sc->rxbuf_map[idx].mbuf = m; + dwc_setup_rxdesc(sc, idx, seg.ds_addr); + + return (0); +} + +static struct mbuf * +dwc_alloc_mbufcl(struct dwc_softc *sc) +{ + struct mbuf *m; + + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + if (m != NULL) + m->m_pkthdr.len = m->m_len = m->m_ext.ext_size; + + return (m); +} + +static struct mbuf * +dwc_rxfinish_one(struct dwc_softc *sc, struct dwc_hwdesc *desc, + struct dwc_bufmap *map) +{ + if_t ifp; + struct mbuf *m, *m0; + int len; + uint32_t rdesc0; + + m = map->mbuf; + ifp = sc->ifp; + rdesc0 = desc ->desc0; + + if ((rdesc0 & (RDESC0_FS | RDESC0_LS)) != + (RDESC0_FS | RDESC0_LS)) { + /* + * Something very wrong happens. The whole packet should be + * recevied in one descriptr. Report problem. + */ + device_printf(sc->dev, + "%s: RX descriptor without FIRST and LAST bit set: 0x%08X", + __func__, rdesc0); + return (NULL); + } + + len = (rdesc0 >> RDESC0_FL_SHIFT) & RDESC0_FL_MASK; + if (len < 64) { + /* + * Lenght is invalid, recycle old mbuf + * Probably impossible case + */ + return (NULL); + } + + /* Allocate new buffer */ + m0 = dwc_alloc_mbufcl(sc); + if (m0 == NULL) { + /* no new mbuf available, recycle old */ + if_inc_counter(sc->ifp, IFCOUNTER_IQDROPS, 1); + return (NULL); + } + /* Do dmasync for newly received packet */ + bus_dmamap_sync(sc->rxbuf_tag, map->map, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->rxbuf_tag, map->map); + + /* Received packet is valid, process it */ + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = len; + m->m_len = len; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); + + if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0 && + (rdesc0 & RDESC0_FT) != 0) { + m->m_pkthdr.csum_flags = CSUM_IP_CHECKED; + if ((rdesc0 & RDESC0_ICE) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + if ((rdesc0 & RDESC0_PCE) == 0) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + } + + /* Remove trailing FCS */ + m_adj(m, -ETHER_CRC_LEN); + + DWC_UNLOCK(sc); + if_input(ifp, m); + DWC_LOCK(sc); + return (m0); +} + +void +dma1000_txfinish_locked(struct dwc_softc *sc) +{ + struct dwc_bufmap *bmap; + struct dwc_hwdesc *desc; + if_t ifp; + int idx, last_idx; + bool map_finished; + + DWC_ASSERT_LOCKED(sc); + + ifp = sc->ifp; + /* check if all descriptors of the map are done */ + while (sc->tx_map_tail != sc->tx_map_head) { + map_finished = true; + bmap = &sc->txbuf_map[sc->tx_map_tail]; + idx = sc->tx_desc_tail; + last_idx = next_txidx(sc, bmap->last_desc_idx); + while (idx != last_idx) { + desc = &sc->txdesc_ring[idx]; + if ((desc->desc0 & TDESC0_OWN) != 0) { + map_finished = false; + break; + } + idx = next_txidx(sc, idx); + } + + if (!map_finished) + break; + bus_dmamap_sync(sc->txbuf_tag, bmap->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->txbuf_tag, bmap->map); + m_freem(bmap->mbuf); + bmap->mbuf = NULL; + sc->tx_mapcount--; + while (sc->tx_desc_tail != last_idx) { + dwc_setup_txdesc(sc, sc->tx_desc_tail, 0, 0, 0, false, false); + sc->tx_desc_tail = next_txidx(sc, sc->tx_desc_tail); + } + sc->tx_map_tail = next_txidx(sc, sc->tx_map_tail); + if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + } + + /* If there are no buffers outstanding, muzzle the watchdog. */ + if (sc->tx_desc_tail == sc->tx_desc_head) { + sc->tx_watchdog_count = 0; + } +} + +void +dma1000_rxfinish_locked(struct dwc_softc *sc) +{ + struct mbuf *m; + int error, idx; + struct dwc_hwdesc *desc; + + DWC_ASSERT_LOCKED(sc); + for (;;) { + idx = sc->rx_idx; + desc = sc->rxdesc_ring + idx; + if ((desc->desc0 & RDESC0_OWN) != 0) + break; + + m = dwc_rxfinish_one(sc, desc, sc->rxbuf_map + idx); + if (m == NULL) { + wmb(); + desc->desc0 = RDESC0_OWN; + wmb(); + } else { + /* We cannot create hole in RX ring */ + error = dma1000_setup_rxbuf(sc, idx, m); + if (error != 0) + panic("dma1000_setup_rxbuf failed: error %d\n", + error); + + } + sc->rx_idx = next_rxidx(sc, sc->rx_idx); + } +} + +/* + * Start the DMA controller + */ +void +dma1000_start(struct dwc_softc *sc) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + + /* Initializa DMA and enable transmitters */ + reg = READ4(sc, OPERATION_MODE); + reg |= (MODE_TSF | MODE_OSF | MODE_FUF); + reg &= ~(MODE_RSF); + reg |= (MODE_RTC_LEV32 << MODE_RTC_SHIFT); + WRITE4(sc, OPERATION_MODE, reg); + + WRITE4(sc, INTERRUPT_ENABLE, INT_EN_DEFAULT); + + /* Start DMA */ + reg = READ4(sc, OPERATION_MODE); + reg |= (MODE_ST | MODE_SR); + WRITE4(sc, OPERATION_MODE, reg); +} + +/* + * Stop the DMA controller + */ +void +dma1000_stop(struct dwc_softc *sc) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + + /* Stop DMA TX */ + reg = READ4(sc, OPERATION_MODE); + reg &= ~(MODE_ST); + WRITE4(sc, OPERATION_MODE, reg); + + /* Flush TX */ + reg = READ4(sc, OPERATION_MODE); + reg |= (MODE_FTF); + WRITE4(sc, OPERATION_MODE, reg); + + /* Stop DMA RX */ + reg = READ4(sc, OPERATION_MODE); + reg &= ~(MODE_SR); + WRITE4(sc, OPERATION_MODE, reg); +} + +/* + * Create the bus_dma resources + */ +int +dma1000_init(struct dwc_softc *sc) +{ + struct mbuf *m; + int error; + int nidx; + int idx; + + /* + * Set up TX descriptor ring, descriptors, and dma maps. + */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* Parent tag. */ + DWC_DESC_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + TX_DESC_SIZE, 1, /* maxsize, nsegments */ + TX_DESC_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->txdesc_tag); + if (error != 0) { + device_printf(sc->dev, + "could not create TX ring DMA tag.\n"); + goto out; + } + + error = bus_dmamem_alloc(sc->txdesc_tag, (void**)&sc->txdesc_ring, + BUS_DMA_COHERENT | BUS_DMA_WAITOK | BUS_DMA_ZERO, + &sc->txdesc_map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate TX descriptor ring.\n"); + goto out; + } + + error = bus_dmamap_load(sc->txdesc_tag, sc->txdesc_map, + sc->txdesc_ring, TX_DESC_SIZE, dwc_get1paddr, + &sc->txdesc_ring_paddr, 0); + if (error != 0) { + device_printf(sc->dev, + "could not load TX descriptor ring map.\n"); + goto out; + } + + for (idx = 0; idx < TX_DESC_COUNT; idx++) { + nidx = next_txidx(sc, idx); + sc->txdesc_ring[idx].addr2 = sc->txdesc_ring_paddr + + (nidx * sizeof(struct dwc_hwdesc)); + } + + error = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* Parent tag. */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES*TX_MAP_MAX_SEGS, /* maxsize */ + TX_MAP_MAX_SEGS, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->txbuf_tag); + if (error != 0) { + device_printf(sc->dev, + "could not create TX ring DMA tag.\n"); + goto out; + } + + for (idx = 0; idx < TX_MAP_COUNT; idx++) { + error = bus_dmamap_create(sc->txbuf_tag, BUS_DMA_COHERENT, + &sc->txbuf_map[idx].map); + if (error != 0) { + device_printf(sc->dev, + "could not create TX buffer DMA map.\n"); + goto out; + } + } + + for (idx = 0; idx < TX_DESC_COUNT; idx++) + dwc_setup_txdesc(sc, idx, 0, 0, 0, false, false); + + /* + * Set up RX descriptor ring, descriptors, dma maps, and mbufs. + */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* Parent tag. */ + DWC_DESC_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + RX_DESC_SIZE, 1, /* maxsize, nsegments */ + RX_DESC_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->rxdesc_tag); + if (error != 0) { + device_printf(sc->dev, + "could not create RX ring DMA tag.\n"); + goto out; + } + + error = bus_dmamem_alloc(sc->rxdesc_tag, (void **)&sc->rxdesc_ring, + BUS_DMA_COHERENT | BUS_DMA_WAITOK | BUS_DMA_ZERO, + &sc->rxdesc_map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate RX descriptor ring.\n"); + goto out; + } + + error = bus_dmamap_load(sc->rxdesc_tag, sc->rxdesc_map, + sc->rxdesc_ring, RX_DESC_SIZE, dwc_get1paddr, + &sc->rxdesc_ring_paddr, 0); + if (error != 0) { + device_printf(sc->dev, + "could not load RX descriptor ring map.\n"); + goto out; + } + + error = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* Parent tag. */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, 1, /* maxsize, nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->rxbuf_tag); + if (error != 0) { + device_printf(sc->dev, + "could not create RX buf DMA tag.\n"); + goto out; + } + + for (idx = 0; idx < RX_DESC_COUNT; idx++) { + error = bus_dmamap_create(sc->rxbuf_tag, BUS_DMA_COHERENT, + &sc->rxbuf_map[idx].map); + if (error != 0) { + device_printf(sc->dev, + "could not create RX buffer DMA map.\n"); + goto out; + } + if ((m = dwc_alloc_mbufcl(sc)) == NULL) { + device_printf(sc->dev, "Could not alloc mbuf\n"); + error = ENOMEM; + goto out; + } + if ((error = dma1000_setup_rxbuf(sc, idx, m)) != 0) { + device_printf(sc->dev, + "could not create new RX buffer.\n"); + goto out; + } + } + +out: + if (error != 0) + return (ENXIO); + + return (0); +} + +/* + * Free the bus_dma resources + */ +void +dma1000_free(struct dwc_softc *sc) +{ + bus_dmamap_t map; + int idx; + + /* Clean up RX DMA resources and free mbufs. */ + for (idx = 0; idx < RX_DESC_COUNT; ++idx) { + if ((map = sc->rxbuf_map[idx].map) != NULL) { + bus_dmamap_unload(sc->rxbuf_tag, map); + bus_dmamap_destroy(sc->rxbuf_tag, map); + m_freem(sc->rxbuf_map[idx].mbuf); + } + } + if (sc->rxbuf_tag != NULL) + bus_dma_tag_destroy(sc->rxbuf_tag); + if (sc->rxdesc_map != NULL) { + bus_dmamap_unload(sc->rxdesc_tag, sc->rxdesc_map); + bus_dmamem_free(sc->rxdesc_tag, sc->rxdesc_ring, + sc->rxdesc_map); + } + if (sc->rxdesc_tag != NULL) + bus_dma_tag_destroy(sc->rxdesc_tag); + + /* Clean up TX DMA resources. */ + for (idx = 0; idx < TX_DESC_COUNT; ++idx) { + if ((map = sc->txbuf_map[idx].map) != NULL) { + /* TX maps are already unloaded. */ + bus_dmamap_destroy(sc->txbuf_tag, map); + } + } + if (sc->txbuf_tag != NULL) + bus_dma_tag_destroy(sc->txbuf_tag); + if (sc->txdesc_map != NULL) { + bus_dmamap_unload(sc->txdesc_tag, sc->txdesc_map); + bus_dmamem_free(sc->txdesc_tag, sc->txdesc_ring, + sc->txdesc_map); + } + if (sc->txdesc_tag != NULL) + bus_dma_tag_destroy(sc->txdesc_tag); +} diff --git a/sys/dev/dwc/dwc1000_dma.h b/sys/dev/dwc/dwc1000_dma.h new file mode 100644 index 000000000000..613faeee91ff --- /dev/null +++ b/sys/dev/dwc/dwc1000_dma.h @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __DWC1000_DMA_H__ +#define __DWC1000_DMA_H__ + +/* TX descriptors - TDESC0 is almost unified */ +#define TDESC0_OWN (1U << 31) +#define TDESC0_IHE (1U << 16) /* IP Header Error */ +#define TDESC0_ES (1U << 15) /* Error Summary */ +#define TDESC0_JT (1U << 14) /* Jabber Timeout */ +#define TDESC0_FF (1U << 13) /* Frame Flushed */ +#define TDESC0_PCE (1U << 12) /* Payload Checksum Error */ +#define TDESC0_LOC (1U << 11) /* Loss of Carrier */ +#define TDESC0_NC (1U << 10) /* No Carrier */ +#define TDESC0_LC (1U << 9) /* Late Collision */ +#define TDESC0_EC (1U << 8) /* Excessive Collision */ +#define TDESC0_VF (1U << 7) /* VLAN Frame */ +#define TDESC0_CC_MASK 0xf +#define TDESC0_CC_SHIFT 3 /* Collision Count */ +#define TDESC0_ED (1U << 2) /* Excessive Deferral */ +#define TDESC0_UF (1U << 1) /* Underflow Error */ +#define TDESC0_DB (1U << 0) /* Deferred Bit */ +/* TX descriptors - TDESC0 extended format only */ +#define ETDESC0_IC (1U << 30) /* Interrupt on Completion */ +#define ETDESC0_LS (1U << 29) /* Last Segment */ +#define ETDESC0_FS (1U << 28) /* First Segment */ +#define ETDESC0_DC (1U << 27) /* Disable CRC */ +#define ETDESC0_DP (1U << 26) /* Disable Padding */ +#define ETDESC0_CIC_NONE (0U << 22) /* Checksum Insertion Control */ +#define ETDESC0_CIC_HDR (1U << 22) +#define ETDESC0_CIC_SEG (2U << 22) +#define ETDESC0_CIC_FULL (3U << 22) +#define ETDESC0_TER (1U << 21) /* Transmit End of Ring */ +#define ETDESC0_TCH (1U << 20) /* Second Address Chained */ + +/* TX descriptors - TDESC1 normal format */ +#define NTDESC1_IC (1U << 31) /* Interrupt on Completion */ +#define NTDESC1_LS (1U << 30) /* Last Segment */ +#define NTDESC1_FS (1U << 29) /* First Segment */ +#define NTDESC1_CIC_NONE (0U << 27) /* Checksum Insertion Control */ +#define NTDESC1_CIC_HDR (1U << 27) +#define NTDESC1_CIC_SEG (2U << 27) +#define NTDESC1_CIC_FULL (3U << 27) +#define NTDESC1_DC (1U << 26) /* Disable CRC */ +#define NTDESC1_TER (1U << 25) /* Transmit End of Ring */ +#define NTDESC1_TCH (1U << 24) /* Second Address Chained */ +/* TX descriptors - TDESC1 extended format */ +#define ETDESC1_DP (1U << 23) /* Disable Padding */ +#define ETDESC1_TBS2_MASK 0x7ff +#define ETDESC1_TBS2_SHIFT 11 /* Receive Buffer 2 Size */ +#define ETDESC1_TBS1_MASK 0x7ff +#define ETDESC1_TBS1_SHIFT 0 /* Receive Buffer 1 Size */ + +/* RX descriptor - RDESC0 is unified */ +#define RDESC0_OWN (1U << 31) +#define RDESC0_AFM (1U << 30) /* Dest. Address Filter Fail */ +#define RDESC0_FL_MASK 0x3fff +#define RDESC0_FL_SHIFT 16 /* Frame Length */ +#define RDESC0_ES (1U << 15) /* Error Summary */ +#define RDESC0_DE (1U << 14) /* Descriptor Error */ +#define RDESC0_SAF (1U << 13) /* Source Address Filter Fail */ +#define RDESC0_LE (1U << 12) /* Length Error */ +#define RDESC0_OE (1U << 11) /* Overflow Error */ +#define RDESC0_VLAN (1U << 10) /* VLAN Tag */ +#define RDESC0_FS (1U << 9) /* First Descriptor */ +#define RDESC0_LS (1U << 8) /* Last Descriptor */ +#define RDESC0_ICE (1U << 7) /* IPC Checksum Error */ +#define RDESC0_LC (1U << 6) /* Late Collision */ +#define RDESC0_FT (1U << 5) /* Frame Type */ +#define RDESC0_RWT (1U << 4) /* Receive Watchdog Timeout */ +#define RDESC0_RE (1U << 3) /* Receive Error */ +#define RDESC0_DBE (1U << 2) /* Dribble Bit Error */ +#define RDESC0_CE (1U << 1) /* CRC Error */ +#define RDESC0_PCE (1U << 0) /* Payload Checksum Error */ +#define RDESC0_RXMA (1U << 0) /* Rx MAC Address */ + +/* RX descriptors - RDESC1 normal format */ +#define NRDESC1_DIC (1U << 31) /* Disable Intr on Completion */ +#define NRDESC1_RER (1U << 25) /* Receive End of Ring */ +#define NRDESC1_RCH (1U << 24) /* Second Address Chained */ +#define NRDESC1_RBS2_MASK 0x7ff +#define NRDESC1_RBS2_SHIFT 11 /* Receive Buffer 2 Size */ +#define NRDESC1_RBS1_MASK 0x7ff +#define NRDESC1_RBS1_SHIFT 0 /* Receive Buffer 1 Size */ + +/* RX descriptors - RDESC1 enhanced format */ +#define ERDESC1_DIC (1U << 31) /* Disable Intr on Completion */ +#define ERDESC1_RBS2_MASK 0x7ffff +#define ERDESC1_RBS2_SHIFT 16 /* Receive Buffer 2 Size */ +#define ERDESC1_RER (1U << 15) /* Receive End of Ring */ +#define ERDESC1_RCH (1U << 14) /* Second Address Chained */ +#define ERDESC1_RBS1_MASK 0x7ffff +#define ERDESC1_RBS1_SHIFT 0 /* Receive Buffer 1 Size */ + +/* + * A hardware buffer descriptor. Rx and Tx buffers have the same descriptor + * layout, but the bits in the fields have different meanings. + */ +struct dwc_hwdesc +{ + uint32_t desc0; + uint32_t desc1; + uint32_t addr1; /* ptr to first buffer data */ + uint32_t addr2; /* ptr to next descriptor / second buffer data*/ +}; + +struct dwc_hash_maddr_ctx { + struct dwc_softc *sc; + uint32_t hash[8]; +}; + +/* + * The hardware imposes alignment restrictions on various objects involved in + * DMA transfers. These values are expressed in bytes (not bits). + */ +#define DWC_DESC_RING_ALIGN 2048 + +int dma1000_init(struct dwc_softc *sc); +void dma1000_free(struct dwc_softc *sc); +void dma1000_start(struct dwc_softc *sc); +void dma1000_stop(struct dwc_softc *sc); +int dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp); +void dma1000_txfinish_locked(struct dwc_softc *sc); +void dma1000_rxfinish_locked(struct dwc_softc *sc); + +static inline uint32_t +next_txidx(struct dwc_softc *sc, uint32_t curidx) +{ + + return ((curidx + 1) % TX_DESC_COUNT); +} + +#endif /* __DWC1000_DMA_H__ */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 86e00c76a1be..c491106eacd0 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -69,154 +69,28 @@ #include #include -#include #include +#include +#include #include "if_dwc_if.h" #include "gpio_if.h" #include "miibus_if.h" -#define READ4(_sc, _reg) \ - bus_read_4((_sc)->res[0], _reg) -#define WRITE4(_sc, _reg, _val) \ - bus_write_4((_sc)->res[0], _reg, _val) - #define MAC_RESET_TIMEOUT 100 #define WATCHDOG_TIMEOUT_SECS 5 #define STATS_HARVEST_INTERVAL 2 -#define DWC_LOCK(sc) mtx_lock(&(sc)->mtx) -#define DWC_UNLOCK(sc) mtx_unlock(&(sc)->mtx) -#define DWC_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED) -#define DWC_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED) - -/* TX descriptors - TDESC0 is almost unified */ -#define TDESC0_OWN (1U << 31) -#define TDESC0_IHE (1U << 16) /* IP Header Error */ -#define TDESC0_ES (1U << 15) /* Error Summary */ -#define TDESC0_JT (1U << 14) /* Jabber Timeout */ -#define TDESC0_FF (1U << 13) /* Frame Flushed */ -#define TDESC0_PCE (1U << 12) /* Payload Checksum Error */ -#define TDESC0_LOC (1U << 11) /* Loss of Carrier */ -#define TDESC0_NC (1U << 10) /* No Carrier */ -#define TDESC0_LC (1U << 9) /* Late Collision */ -#define TDESC0_EC (1U << 8) /* Excessive Collision */ -#define TDESC0_VF (1U << 7) /* VLAN Frame */ -#define TDESC0_CC_MASK 0xf -#define TDESC0_CC_SHIFT 3 /* Collision Count */ -#define TDESC0_ED (1U << 2) /* Excessive Deferral */ -#define TDESC0_UF (1U << 1) /* Underflow Error */ -#define TDESC0_DB (1U << 0) /* Deferred Bit */ -/* TX descriptors - TDESC0 extended format only */ -#define ETDESC0_IC (1U << 30) /* Interrupt on Completion */ -#define ETDESC0_LS (1U << 29) /* Last Segment */ -#define ETDESC0_FS (1U << 28) /* First Segment */ -#define ETDESC0_DC (1U << 27) /* Disable CRC */ -#define ETDESC0_DP (1U << 26) /* Disable Padding */ -#define ETDESC0_CIC_NONE (0U << 22) /* Checksum Insertion Control */ -#define ETDESC0_CIC_HDR (1U << 22) -#define ETDESC0_CIC_SEG (2U << 22) -#define ETDESC0_CIC_FULL (3U << 22) -#define ETDESC0_TER (1U << 21) /* Transmit End of Ring */ -#define ETDESC0_TCH (1U << 20) /* Second Address Chained */ - -/* TX descriptors - TDESC1 normal format */ -#define NTDESC1_IC (1U << 31) /* Interrupt on Completion */ -#define NTDESC1_LS (1U << 30) /* Last Segment */ -#define NTDESC1_FS (1U << 29) /* First Segment */ -#define NTDESC1_CIC_NONE (0U << 27) /* Checksum Insertion Control */ -#define NTDESC1_CIC_HDR (1U << 27) -#define NTDESC1_CIC_SEG (2U << 27) -#define NTDESC1_CIC_FULL (3U << 27) -#define NTDESC1_DC (1U << 26) /* Disable CRC */ -#define NTDESC1_TER (1U << 25) /* Transmit End of Ring */ -#define NTDESC1_TCH (1U << 24) /* Second Address Chained */ -/* TX descriptors - TDESC1 extended format */ -#define ETDESC1_DP (1U << 23) /* Disable Padding */ -#define ETDESC1_TBS2_MASK 0x7ff -#define ETDESC1_TBS2_SHIFT 11 /* Receive Buffer 2 Size */ -#define ETDESC1_TBS1_MASK 0x7ff -#define ETDESC1_TBS1_SHIFT 0 /* Receive Buffer 1 Size */ - -/* RX descriptor - RDESC0 is unified */ -#define RDESC0_OWN (1U << 31) -#define RDESC0_AFM (1U << 30) /* Dest. Address Filter Fail */ -#define RDESC0_FL_MASK 0x3fff -#define RDESC0_FL_SHIFT 16 /* Frame Length */ -#define RDESC0_ES (1U << 15) /* Error Summary */ -#define RDESC0_DE (1U << 14) /* Descriptor Error */ -#define RDESC0_SAF (1U << 13) /* Source Address Filter Fail */ -#define RDESC0_LE (1U << 12) /* Length Error */ -#define RDESC0_OE (1U << 11) /* Overflow Error */ -#define RDESC0_VLAN (1U << 10) /* VLAN Tag */ -#define RDESC0_FS (1U << 9) /* First Descriptor */ -#define RDESC0_LS (1U << 8) /* Last Descriptor */ -#define RDESC0_ICE (1U << 7) /* IPC Checksum Error */ -#define RDESC0_LC (1U << 6) /* Late Collision */ *** 772 LINES SKIPPED *** From nobody Thu Oct 5 15:35:03 2023 X-Original-To: dev-commits-src-main@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 4S1bGb75Jjz4vnSv; Thu, 5 Oct 2023 15:35:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGb6nBkz4cvX; Thu, 5 Oct 2023 15:35:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520103; 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=KoNJtigiugWRy/CaUxwZ/EpT1kMi/sFzGbrAC9bQAow=; b=hDSOqGo5/edEbcEnvh+BLjYpXn+7IsC4544xJdqRcwPFxuIPireL7jYVOCjjS2lZLauPy4 XxPBPmNLp/g8GL+NAy7R0qNtCh4p6LLXUBwNWTRnXiQXWGhxqd9aQO/B3C0JghOdoUURJA r8eNiZQ+r17xyuhqzyvFdvwO4qHhv2LKROODdQ1JI+j1cihzSDFDzl4gzm3e80c8cI1qWn dqe1VcezzgOInUMuR8ATWdRwrkGUy8c38Wb636tHmId3M0BfxwWGwaSXKD6cpQ7HY8IayD nma/94r1eEm9n4QuESGq6a2anX5ARhY4Qx18B/k40+fVnJawDZ0eLbvkQHWF3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520103; a=rsa-sha256; cv=none; b=doGMkWkx5DXE7InOLkSxcYM2GEjkwiIDjOb1v5mrgW/Elhx4fe1NQz3THqEdNlIH+dRkLT SA+rc+9umEOlnRE/rJPzMPocXhC5v8l7caEzVaJ9WeM/SZa1Q1YQmy5RdbMbgGhfL5Dyw6 DsGofbUWz+oPhK4C3A2twVr01G23LL5Ywy+msnsvxWfsMJFmBU1rDGH2ajklJD7sIR66KC Sbc4N0GNv5MmatDn6N9GHmya4Ucp8/EMuFYaZzFdtaY1T2O3AjuJM5K6Xx4bx4u2azl/r8 191H9Hd0spnojpAad/2JR7CvR3gd4TXjTCsKR8vYAZyUwbULgPARs1+6/cO7Bw== 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=1696520103; 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=KoNJtigiugWRy/CaUxwZ/EpT1kMi/sFzGbrAC9bQAow=; b=CbDTMZUiX/e5SXWnD1Acr7Gfye35YOPRFyACACgz6Bd//VDGyCjgcnVR1LohHzXA86v7lS muoKGo3jRJ7upj7lCvnIguqgoWtYDEisZNztsdRIiOhDOwkEMksvjCvFKKCLKLShqbPAFw D6tylgkmlub3lWyLnjxC+wYLK3O7VpsNqvpkddwgeL6TF4I6apazSumNjP9lxs6fSplqjU fflmh9/d89aTmMS+b2KsN+xNzSatn6uNxye2lIzm95O49dpJ/ZMNEz/DaJp5LVi5p67kd9 LOjiBIM9nr4QKpsr086q3Zh4sfAF54fp/VXDpx4fh5YDWBM1lZqRIS+FpVL8KQ== 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 4S1bGb5t8yz1QCV; Thu, 5 Oct 2023 15:35:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ3gE012427; Thu, 5 Oct 2023 15:35:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ3V3012424; Thu, 5 Oct 2023 15:35:03 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:03 GMT Message-Id: <202310051535.395FZ3V3012424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 62519d5a4f71 - main - dwc: Split core functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62519d5a4f719a420803a3a0823268da6e950fcb Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=62519d5a4f719a420803a3a0823268da6e950fcb commit 62519d5a4f719a420803a3a0823268da6e950fcb Author: Emmanuel Vadot AuthorDate: 2023-09-28 19:38:36 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Split core functions Synopsis/Designware controller have multiple version. The version currently supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit. In the goal to support all of those in the same base driver start splitting the core function to a new file. No functional changes intended. --- sys/conf/files.arm | 1 + sys/conf/files.arm64 | 1 + sys/dev/dwc/dwc1000_core.c | 416 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/dwc/dwc1000_core.h | 43 +++++ sys/dev/dwc/if_dwc.c | 378 ++-------------------------------------- 5 files changed, 476 insertions(+), 363 deletions(-) diff --git a/sys/conf/files.arm b/sys/conf/files.arm index d47f2b7a78e8..772bbb8b0e3b 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -88,6 +88,7 @@ crypto/des/des_enc.c optional netsmb dev/cpufreq/cpufreq_dt.c optional cpufreq fdt dev/dwc/if_dwc.c optional dwc dev/dwc/if_dwc_if.m optional dwc +dev/dwc/dwc1000_core.c optional dwc dev/dwc/dwc1000_dma.c optional dwc dev/fb/fb.c optional sc dev/fdt/fdt_arm_platform.c optional platform fdt diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index b9e690d2ca50..38b9e40463eb 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -227,6 +227,7 @@ dev/dpaa2/memac_mdio_if.m optional soc_nxp_ls dpaa2 acpi | soc_nxp_ls dpaa2 fd # Synopsys DesignWare Ethernet Controller dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 +dev/dwc/dwc1000_core.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/dwc1000_dma.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 dev/dwc/if_dwc_socfpga.c optional fdt dwc_socfpga diff --git a/sys/dev/dwc/dwc1000_core.c b/sys/dev/dwc/dwc1000_core.c new file mode 100644 index 000000000000..ef6db707a3a1 --- /dev/null +++ b/sys/dev/dwc/dwc1000_core.c @@ -0,0 +1,416 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Ethernet media access controller (EMAC) + * Chapter 17, Altera Cyclone V Device Handbook (CV-5V2 2014.07.22) + * + * EMAC is an instance of the Synopsys DesignWare 3504-0 + * Universal 10/100/1000 Ethernet MAC (DWC_gmac). + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "if_dwc_if.h" + +#define STATS_HARVEST_INTERVAL 2 + +/* Pause time field in the transmitted control frame */ +static int dwc_pause_time = 0xffff; +TUNABLE_INT("hw.dwc.pause_time", &dwc_pause_time); + +/* + * MIIBUS functions + */ + +int +dwc1000_miibus_read_reg(device_t dev, int phy, int reg) +{ + struct dwc_softc *sc; + uint16_t mii; + size_t cnt; + int rv = 0; + + sc = device_get_softc(dev); + + mii = ((phy & GMII_ADDRESS_PA_MASK) << GMII_ADDRESS_PA_SHIFT) + | ((reg & GMII_ADDRESS_GR_MASK) << GMII_ADDRESS_GR_SHIFT) + | (sc->mii_clk << GMII_ADDRESS_CR_SHIFT) + | GMII_ADDRESS_GB; /* Busy flag */ + + WRITE4(sc, GMII_ADDRESS, mii); + + for (cnt = 0; cnt < 1000; cnt++) { + if (!(READ4(sc, GMII_ADDRESS) & GMII_ADDRESS_GB)) { + rv = READ4(sc, GMII_DATA); + break; + } + DELAY(10); + } + + return rv; +} + +int +dwc1000_miibus_write_reg(device_t dev, int phy, int reg, int val) +{ + struct dwc_softc *sc; + uint16_t mii; + size_t cnt; + + sc = device_get_softc(dev); + + mii = ((phy & GMII_ADDRESS_PA_MASK) << GMII_ADDRESS_PA_SHIFT) + | ((reg & GMII_ADDRESS_GR_MASK) << GMII_ADDRESS_GR_SHIFT) + | (sc->mii_clk << GMII_ADDRESS_CR_SHIFT) + | GMII_ADDRESS_GB | GMII_ADDRESS_GW; + + WRITE4(sc, GMII_DATA, val); + WRITE4(sc, GMII_ADDRESS, mii); + + for (cnt = 0; cnt < 1000; cnt++) { + if (!(READ4(sc, GMII_ADDRESS) & GMII_ADDRESS_GB)) { + break; + } + DELAY(10); + } + + return (0); +} + +void +dwc1000_miibus_statchg(device_t dev) +{ + struct dwc_softc *sc; + struct mii_data *mii; + uint32_t reg; + + /* + * Called by the MII bus driver when the PHY establishes + * link to set the MAC interface registers. + */ + + sc = device_get_softc(dev); + + DWC_ASSERT_LOCKED(sc); + + mii = sc->mii_softc; + + if (mii->mii_media_status & IFM_ACTIVE) + sc->link_is_up = true; + else + sc->link_is_up = false; + + reg = READ4(sc, MAC_CONFIGURATION); + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_1000_T: + case IFM_1000_SX: + reg &= ~(CONF_FES | CONF_PS); + break; + case IFM_100_TX: + reg |= (CONF_FES | CONF_PS); + break; + case IFM_10_T: + reg &= ~(CONF_FES); + reg |= (CONF_PS); + break; + case IFM_NONE: + sc->link_is_up = false; + return; + default: + sc->link_is_up = false; + device_printf(dev, "Unsupported media %u\n", + IFM_SUBTYPE(mii->mii_media_active)); + return; + } + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) + reg |= (CONF_DM); + else + reg &= ~(CONF_DM); + WRITE4(sc, MAC_CONFIGURATION, reg); + + reg = FLOW_CONTROL_UP; + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) + reg |= FLOW_CONTROL_TX; + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) + reg |= FLOW_CONTROL_RX; + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) + reg |= dwc_pause_time << FLOW_CONTROL_PT_SHIFT; + WRITE4(sc, FLOW_CONTROL, reg); + + IF_DWC_SET_SPEED(dev, IFM_SUBTYPE(mii->mii_media_active)); + +} + +void +dwc1000_core_setup(struct dwc_softc *sc) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + + /* Enable core */ + reg = READ4(sc, MAC_CONFIGURATION); + reg |= (CONF_JD | CONF_ACS | CONF_BE); + WRITE4(sc, MAC_CONFIGURATION, reg); +} + +void +dwc1000_enable_mac(struct dwc_softc *sc, bool enable) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + reg = READ4(sc, MAC_CONFIGURATION); + if (enable) + reg |= CONF_TE | CONF_RE; + else + reg &= ~(CONF_TE | CONF_RE); + WRITE4(sc, MAC_CONFIGURATION, reg); +} + +void +dwc1000_enable_csum_offload(struct dwc_softc *sc) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + reg = READ4(sc, MAC_CONFIGURATION); + if ((if_getcapenable(sc->ifp) & IFCAP_RXCSUM) != 0) + reg |= CONF_IPC; + else + reg &= ~CONF_IPC; + WRITE4(sc, MAC_CONFIGURATION, reg); +} + +static const uint8_t nibbletab[] = { + /* 0x0 0000 -> 0000 */ 0x0, + /* 0x1 0001 -> 1000 */ 0x8, + /* 0x2 0010 -> 0100 */ 0x4, + /* 0x3 0011 -> 1100 */ 0xc, + /* 0x4 0100 -> 0010 */ 0x2, + /* 0x5 0101 -> 1010 */ 0xa, + /* 0x6 0110 -> 0110 */ 0x6, + /* 0x7 0111 -> 1110 */ 0xe, + /* 0x8 1000 -> 0001 */ 0x1, + /* 0x9 1001 -> 1001 */ 0x9, + /* 0xa 1010 -> 0101 */ 0x5, + /* 0xb 1011 -> 1101 */ 0xd, + /* 0xc 1100 -> 0011 */ 0x3, + /* 0xd 1101 -> 1011 */ 0xb, + /* 0xe 1110 -> 0111 */ 0x7, + /* 0xf 1111 -> 1111 */ 0xf, }; + +static uint8_t +bitreverse(uint8_t x) +{ + + return (nibbletab[x & 0xf] << 4) | nibbletab[x >> 4]; +} + +static u_int +dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dwc_hash_maddr_ctx *ctx = arg; + uint32_t crc, hashbit, hashreg; + uint8_t val; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Take lower 8 bits and reverse it */ + val = bitreverse(~crc & 0xff); + if (ctx->sc->mactype != DWC_GMAC_EXT_DESC) + val >>= 2; /* Only need lower 6 bits */ + hashreg = (val >> 5); + hashbit = (val & 31); + ctx->hash[hashreg] |= (1 << hashbit); + + return (1); +} + +void +dwc1000_setup_rxfilter(struct dwc_softc *sc) +{ + struct dwc_hash_maddr_ctx ctx; + if_t ifp; + uint8_t *eaddr; + uint32_t ffval, hi, lo; + int nhash, i; + + DWC_ASSERT_LOCKED(sc); + + ifp = sc->ifp; + nhash = sc->mactype != DWC_GMAC_EXT_DESC ? 2 : 8; + + /* + * Set the multicast (group) filter hash. + */ + if ((if_getflags(ifp) & IFF_ALLMULTI) != 0) { + ffval = (FRAME_FILTER_PM); + for (i = 0; i < nhash; i++) + ctx.hash[i] = ~0; + } else { + ffval = (FRAME_FILTER_HMC); + for (i = 0; i < nhash; i++) + ctx.hash[i] = 0; + ctx.sc = sc; + if_foreach_llmaddr(ifp, dwc_hash_maddr, &ctx); + } + + /* + * Set the individual address filter hash. + */ + if ((if_getflags(ifp) & IFF_PROMISC) != 0) + ffval |= (FRAME_FILTER_PR); + + /* + * Set the primary address. + */ + eaddr = if_getlladdr(ifp); + lo = eaddr[0] | (eaddr[1] << 8) | (eaddr[2] << 16) | + (eaddr[3] << 24); + hi = eaddr[4] | (eaddr[5] << 8); + WRITE4(sc, MAC_ADDRESS_LOW(0), lo); + WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); + WRITE4(sc, MAC_FRAME_FILTER, ffval); + if (sc->mactype != DWC_GMAC_EXT_DESC) { + WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]); + WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]); + } else { + for (i = 0; i < nhash; i++) + WRITE4(sc, HASH_TABLE_REG(i), ctx.hash[i]); + } +} + +void +dwc1000_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr) +{ + uint32_t hi, lo, rnd; + + /* + * Try to recover a MAC address from the running hardware. If there's + * something non-zero there, assume the bootloader did the right thing + * and just use it. + * + * Otherwise, set the address to a convenient locally assigned address, + * 'bsd' + random 24 low-order bits. 'b' is 0x62, which has the locally + * assigned bit set, and the broadcast/multicast bit clear. + */ + lo = READ4(sc, MAC_ADDRESS_LOW(0)); + hi = READ4(sc, MAC_ADDRESS_HIGH(0)) & 0xffff; + if ((lo != 0xffffffff) || (hi != 0xffff)) { + hwaddr[0] = (lo >> 0) & 0xff; + hwaddr[1] = (lo >> 8) & 0xff; + hwaddr[2] = (lo >> 16) & 0xff; + hwaddr[3] = (lo >> 24) & 0xff; + hwaddr[4] = (hi >> 0) & 0xff; + hwaddr[5] = (hi >> 8) & 0xff; + } else { + rnd = arc4random() & 0x00ffffff; + hwaddr[0] = 'b'; + hwaddr[1] = 's'; + hwaddr[2] = 'd'; + hwaddr[3] = rnd >> 16; + hwaddr[4] = rnd >> 8; + hwaddr[5] = rnd >> 0; + } +} + +/* + * Stats + */ + +static void +dwc1000_clear_stats(struct dwc_softc *sc) +{ + uint32_t reg; + + reg = READ4(sc, MMC_CONTROL); + reg |= (MMC_CONTROL_CNTRST); + WRITE4(sc, MMC_CONTROL, reg); +} + +void +dwc1000_harvest_stats(struct dwc_softc *sc) +{ + if_t ifp; + + /* We don't need to harvest too often. */ + if (++sc->stats_harvest_count < STATS_HARVEST_INTERVAL) + return; + + sc->stats_harvest_count = 0; + ifp = sc->ifp; + + if_inc_counter(ifp, IFCOUNTER_IERRORS, + READ4(sc, RXOVERSIZE_G) + READ4(sc, RXUNDERSIZE_G) + + READ4(sc, RXCRCERROR) + READ4(sc, RXALIGNMENTERROR) + + READ4(sc, RXRUNTERROR) + READ4(sc, RXJABBERERROR) + + READ4(sc, RXLENGTHERROR)); + + if_inc_counter(ifp, IFCOUNTER_OERRORS, + READ4(sc, TXOVERSIZE_G) + READ4(sc, TXEXCESSDEF) + + READ4(sc, TXCARRIERERR) + READ4(sc, TXUNDERFLOWERROR)); + + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, + READ4(sc, TXEXESSCOL) + READ4(sc, TXLATECOL)); + + dwc1000_clear_stats(sc); +} diff --git a/sys/dev/dwc/dwc1000_core.h b/sys/dev/dwc/dwc1000_core.h new file mode 100644 index 000000000000..2069215bfffe --- /dev/null +++ b/sys/dev/dwc/dwc1000_core.h @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __DWC1000_CORE_H__ +#define __DWC1000_CORE_H__ + +int dwc1000_miibus_read_reg(device_t dev, int phy, int reg); +int dwc1000_miibus_write_reg(device_t dev, int phy, int reg, int val); +void dwc1000_miibus_statchg(device_t dev); +void dwc1000_core_setup(struct dwc_softc *sc); +void dwc1000_enable_mac(struct dwc_softc *sc, bool enable); +void dwc1000_enable_csum_offload(struct dwc_softc *sc); +void dwc1000_setup_rxfilter(struct dwc_softc *sc); +void dwc1000_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr); +void dwc1000_harvest_stats(struct dwc_softc *sc); + +#endif /* __DWC1000_CORE_H__ */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index c491106eacd0..29f78dd94a9a 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -71,6 +71,7 @@ #include #include +#include #include #include "if_dwc_if.h" @@ -79,7 +80,6 @@ #define MAC_RESET_TIMEOUT 100 #define WATCHDOG_TIMEOUT_SECS 5 -#define STATS_HARVEST_INTERVAL 2 static struct resource_spec dwc_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, @@ -88,139 +88,9 @@ static struct resource_spec dwc_spec[] = { }; static void dwc_stop_locked(struct dwc_softc *sc); -static void dwc_setup_rxfilter(struct dwc_softc *sc); -static void dwc_setup_core(struct dwc_softc *sc); -static void dwc_enable_mac(struct dwc_softc *sc, bool enable); static void dwc_tick(void *arg); -/* Pause time field in the transmitted control frame */ -static int dwc_pause_time = 0xffff; -TUNABLE_INT("hw.dwc.pause_time", &dwc_pause_time); - -/* - * MIIBUS functions - */ - -static int -dwc_miibus_read_reg(device_t dev, int phy, int reg) -{ - struct dwc_softc *sc; - uint16_t mii; - size_t cnt; - int rv = 0; - - sc = device_get_softc(dev); - - mii = ((phy & GMII_ADDRESS_PA_MASK) << GMII_ADDRESS_PA_SHIFT) - | ((reg & GMII_ADDRESS_GR_MASK) << GMII_ADDRESS_GR_SHIFT) - | (sc->mii_clk << GMII_ADDRESS_CR_SHIFT) - | GMII_ADDRESS_GB; /* Busy flag */ - - WRITE4(sc, GMII_ADDRESS, mii); - - for (cnt = 0; cnt < 1000; cnt++) { - if (!(READ4(sc, GMII_ADDRESS) & GMII_ADDRESS_GB)) { - rv = READ4(sc, GMII_DATA); - break; - } - DELAY(10); - } - - return rv; -} - -static int -dwc_miibus_write_reg(device_t dev, int phy, int reg, int val) -{ - struct dwc_softc *sc; - uint16_t mii; - size_t cnt; - - sc = device_get_softc(dev); - - mii = ((phy & GMII_ADDRESS_PA_MASK) << GMII_ADDRESS_PA_SHIFT) - | ((reg & GMII_ADDRESS_GR_MASK) << GMII_ADDRESS_GR_SHIFT) - | (sc->mii_clk << GMII_ADDRESS_CR_SHIFT) - | GMII_ADDRESS_GB | GMII_ADDRESS_GW; - - WRITE4(sc, GMII_DATA, val); - WRITE4(sc, GMII_ADDRESS, mii); - - for (cnt = 0; cnt < 1000; cnt++) { - if (!(READ4(sc, GMII_ADDRESS) & GMII_ADDRESS_GB)) { - break; - } - DELAY(10); - } - - return (0); -} - -static void -dwc_miibus_statchg(device_t dev) -{ - struct dwc_softc *sc; - struct mii_data *mii; - uint32_t reg; - - /* - * Called by the MII bus driver when the PHY establishes - * link to set the MAC interface registers. - */ - - sc = device_get_softc(dev); - - DWC_ASSERT_LOCKED(sc); - - mii = sc->mii_softc; - - if (mii->mii_media_status & IFM_ACTIVE) - sc->link_is_up = true; - else - sc->link_is_up = false; - - reg = READ4(sc, MAC_CONFIGURATION); - switch (IFM_SUBTYPE(mii->mii_media_active)) { - case IFM_1000_T: - case IFM_1000_SX: - reg &= ~(CONF_FES | CONF_PS); - break; - case IFM_100_TX: - reg |= (CONF_FES | CONF_PS); - break; - case IFM_10_T: - reg &= ~(CONF_FES); - reg |= (CONF_PS); - break; - case IFM_NONE: - sc->link_is_up = false; - return; - default: - sc->link_is_up = false; - device_printf(dev, "Unsupported media %u\n", - IFM_SUBTYPE(mii->mii_media_active)); - return; - } - if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) - reg |= (CONF_DM); - else - reg &= ~(CONF_DM); - WRITE4(sc, MAC_CONFIGURATION, reg); - - reg = FLOW_CONTROL_UP; - if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) - reg |= FLOW_CONTROL_TX; - if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) - reg |= FLOW_CONTROL_RX; - if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) - reg |= dwc_pause_time << FLOW_CONTROL_PT_SHIFT; - WRITE4(sc, FLOW_CONTROL, reg); - - IF_DWC_SET_SPEED(dev, IFM_SUBTYPE(mii->mii_media_active)); - -} - /* * Media functions */ @@ -261,183 +131,6 @@ dwc_media_change(if_t ifp) return (error); } -/* - * Core functions - */ - -static const uint8_t nibbletab[] = { - /* 0x0 0000 -> 0000 */ 0x0, - /* 0x1 0001 -> 1000 */ 0x8, - /* 0x2 0010 -> 0100 */ 0x4, - /* 0x3 0011 -> 1100 */ 0xc, - /* 0x4 0100 -> 0010 */ 0x2, - /* 0x5 0101 -> 1010 */ 0xa, - /* 0x6 0110 -> 0110 */ 0x6, - /* 0x7 0111 -> 1110 */ 0xe, - /* 0x8 1000 -> 0001 */ 0x1, - /* 0x9 1001 -> 1001 */ 0x9, - /* 0xa 1010 -> 0101 */ 0x5, - /* 0xb 1011 -> 1101 */ 0xd, - /* 0xc 1100 -> 0011 */ 0x3, - /* 0xd 1101 -> 1011 */ 0xb, - /* 0xe 1110 -> 0111 */ 0x7, - /* 0xf 1111 -> 1111 */ 0xf, }; - -static uint8_t -bitreverse(uint8_t x) -{ - - return (nibbletab[x & 0xf] << 4) | nibbletab[x >> 4]; -} - -static u_int -dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) -{ - struct dwc_hash_maddr_ctx *ctx = arg; - uint32_t crc, hashbit, hashreg; - uint8_t val; - - crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); - /* Take lower 8 bits and reverse it */ - val = bitreverse(~crc & 0xff); - if (ctx->sc->mactype != DWC_GMAC_EXT_DESC) - val >>= 2; /* Only need lower 6 bits */ - hashreg = (val >> 5); - hashbit = (val & 31); - ctx->hash[hashreg] |= (1 << hashbit); - - return (1); -} - -static void -dwc_setup_rxfilter(struct dwc_softc *sc) -{ - struct dwc_hash_maddr_ctx ctx; - if_t ifp; - uint8_t *eaddr; - uint32_t ffval, hi, lo; - int nhash, i; - - DWC_ASSERT_LOCKED(sc); - - ifp = sc->ifp; - nhash = sc->mactype != DWC_GMAC_EXT_DESC ? 2 : 8; - - /* - * Set the multicast (group) filter hash. - */ - if ((if_getflags(ifp) & IFF_ALLMULTI) != 0) { - ffval = (FRAME_FILTER_PM); - for (i = 0; i < nhash; i++) - ctx.hash[i] = ~0; - } else { - ffval = (FRAME_FILTER_HMC); - for (i = 0; i < nhash; i++) - ctx.hash[i] = 0; - ctx.sc = sc; - if_foreach_llmaddr(ifp, dwc_hash_maddr, &ctx); - } - - /* - * Set the individual address filter hash. - */ - if ((if_getflags(ifp) & IFF_PROMISC) != 0) - ffval |= (FRAME_FILTER_PR); - - /* - * Set the primary address. - */ - eaddr = if_getlladdr(ifp); - lo = eaddr[0] | (eaddr[1] << 8) | (eaddr[2] << 16) | - (eaddr[3] << 24); - hi = eaddr[4] | (eaddr[5] << 8); - WRITE4(sc, MAC_ADDRESS_LOW(0), lo); - WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); - WRITE4(sc, MAC_FRAME_FILTER, ffval); - if (sc->mactype != DWC_GMAC_EXT_DESC) { - WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]); - WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]); - } else { - for (i = 0; i < nhash; i++) - WRITE4(sc, HASH_TABLE_REG(i), ctx.hash[i]); - } -} - -static void -dwc_setup_core(struct dwc_softc *sc) -{ - uint32_t reg; - - DWC_ASSERT_LOCKED(sc); - - /* Enable core */ - reg = READ4(sc, MAC_CONFIGURATION); - reg |= (CONF_JD | CONF_ACS | CONF_BE); - WRITE4(sc, MAC_CONFIGURATION, reg); -} - -static void -dwc_enable_mac(struct dwc_softc *sc, bool enable) -{ - uint32_t reg; - - DWC_ASSERT_LOCKED(sc); - reg = READ4(sc, MAC_CONFIGURATION); - if (enable) - reg |= CONF_TE | CONF_RE; - else - reg &= ~(CONF_TE | CONF_RE); - WRITE4(sc, MAC_CONFIGURATION, reg); -} - -static void -dwc_enable_csum_offload(struct dwc_softc *sc) -{ - uint32_t reg; - - DWC_ASSERT_LOCKED(sc); - reg = READ4(sc, MAC_CONFIGURATION); - if ((if_getcapenable(sc->ifp) & IFCAP_RXCSUM) != 0) - reg |= CONF_IPC; - else - reg &= ~CONF_IPC; - WRITE4(sc, MAC_CONFIGURATION, reg); -} - -static void -dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr) -{ - uint32_t hi, lo, rnd; - - /* - * Try to recover a MAC address from the running hardware. If there's - * something non-zero there, assume the bootloader did the right thing - * and just use it. - * - * Otherwise, set the address to a convenient locally assigned address, - * 'bsd' + random 24 low-order bits. 'b' is 0x62, which has the locally - * assigned bit set, and the broadcast/multicast bit clear. - */ - lo = READ4(sc, MAC_ADDRESS_LOW(0)); - hi = READ4(sc, MAC_ADDRESS_HIGH(0)) & 0xffff; - if ((lo != 0xffffffff) || (hi != 0xffff)) { - hwaddr[0] = (lo >> 0) & 0xff; - hwaddr[1] = (lo >> 8) & 0xff; - hwaddr[2] = (lo >> 16) & 0xff; - hwaddr[3] = (lo >> 24) & 0xff; - hwaddr[4] = (hi >> 0) & 0xff; - hwaddr[5] = (hi >> 8) & 0xff; - } else { - rnd = arc4random() & 0x00ffffff; - hwaddr[0] = 'b'; - hwaddr[1] = 's'; - hwaddr[2] = 'd'; - hwaddr[3] = rnd >> 16; - hwaddr[4] = rnd >> 8; - hwaddr[5] = rnd >> 0; - } -} - /* * if_ functions */ @@ -514,15 +207,15 @@ dwc_init_locked(struct dwc_softc *sc) return; /* - * Call mii_mediachg() which will call back into dwc_miibus_statchg() + * Call mii_mediachg() which will call back into dwc1000_miibus_statchg() * to set up the remaining config registers based on current media. */ mii_mediachg(sc->mii_softc); - dwc_setup_rxfilter(sc); - dwc_setup_core(sc); - dwc_enable_mac(sc, true); - dwc_enable_csum_offload(sc); + dwc1000_setup_rxfilter(sc); + dwc1000_core_setup(sc); + dwc1000_enable_mac(sc, true); + dwc1000_enable_csum_offload(sc); dma1000_start(sc); if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); @@ -555,7 +248,7 @@ dwc_stop_locked(struct dwc_softc *sc) callout_stop(&sc->dwc_callout); dma1000_stop(sc); - dwc_enable_mac(sc, false); + dwc1000_enable_mac(sc, false); } static int @@ -577,7 +270,7 @@ dwc_ioctl(if_t ifp, u_long cmd, caddr_t data) if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { flags = if_getflags(ifp) ^ sc->if_flags; if ((flags & (IFF_PROMISC|IFF_ALLMULTI)) != 0) - dwc_setup_rxfilter(sc); + dwc1000_setup_rxfilter(sc); } else { if (!sc->is_detaching) dwc_init_locked(sc); @@ -593,7 +286,7 @@ dwc_ioctl(if_t ifp, u_long cmd, caddr_t data) case SIOCDELMULTI: if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { DWC_LOCK(sc); - dwc_setup_rxfilter(sc); + dwc1000_setup_rxfilter(sc); DWC_UNLOCK(sc); } break; @@ -619,7 +312,7 @@ dwc_ioctl(if_t ifp, u_long cmd, caddr_t data) if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { DWC_LOCK(sc); - dwc_enable_csum_offload(sc); + dwc1000_enable_csum_offload(sc); DWC_UNLOCK(sc); } break; @@ -676,47 +369,6 @@ dwc_intr(void *arg) DWC_UNLOCK(sc); } -/* - * Stats - */ - -static void dwc_clear_stats(struct dwc_softc *sc) -{ - uint32_t reg; - - reg = READ4(sc, MMC_CONTROL); - reg |= (MMC_CONTROL_CNTRST); - WRITE4(sc, MMC_CONTROL, reg); -} - -static void -dwc_harvest_stats(struct dwc_softc *sc) -{ - if_t ifp; - - /* We don't need to harvest too often. */ - if (++sc->stats_harvest_count < STATS_HARVEST_INTERVAL) - return; - - sc->stats_harvest_count = 0; - ifp = sc->ifp; - - if_inc_counter(ifp, IFCOUNTER_IERRORS, - READ4(sc, RXOVERSIZE_G) + READ4(sc, RXUNDERSIZE_G) + - READ4(sc, RXCRCERROR) + READ4(sc, RXALIGNMENTERROR) + - READ4(sc, RXRUNTERROR) + READ4(sc, RXJABBERERROR) + - READ4(sc, RXLENGTHERROR)); - - if_inc_counter(ifp, IFCOUNTER_OERRORS, - READ4(sc, TXOVERSIZE_G) + READ4(sc, TXEXCESSDEF) + - READ4(sc, TXCARRIERERR) + READ4(sc, TXUNDERFLOWERROR)); - - if_inc_counter(ifp, IFCOUNTER_COLLISIONS, - READ4(sc, TXEXESSCOL) + READ4(sc, TXLATECOL)); - - dwc_clear_stats(sc); -} - static void dwc_tick(void *arg) { @@ -745,7 +397,7 @@ dwc_tick(void *arg) } /* Gather stats from hardware counters. */ - dwc_harvest_stats(sc); + dwc1000_harvest_stats(sc); /* Check the media status. */ link_was_up = sc->link_is_up; @@ -973,7 +625,7 @@ dwc_attach(device_t dev) } /* Read MAC before reset */ - dwc_get_hwaddr(sc, macaddr); + dwc1000_get_hwaddr(sc, macaddr); /* Reset the PHY if needed */ *** 14 LINES SKIPPED *** From nobody Thu Oct 5 15:35:04 2023 X-Original-To: dev-commits-src-main@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 4S1bGd1Rjwz4vnRD; Thu, 5 Oct 2023 15:35:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGd0p7nz4d24; Thu, 5 Oct 2023 15:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520105; 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=JoiVNhogr1kRt+4GqknfHyzYQzzZfm1eZlEFdROa800=; b=fI56wGevz1dOA4aRumsmby/RcqKRPPFKftwN6mQNQ1+hLG4fYOE0oZIufI3PGVBwv9wWUW qEFefmhg1IivbA9k4zSLv54ETK6JdUtap6QAHqVe0iVF0S4Twhnh4fZiiETcucc51MxE84 TMYuN79uiFodHh96psfMsKJq6PH8x79p623vg5O1ejf1I0FuyWBaOums4AEUqyBS8FNSNy e2irdy97QTzLVSCbfdL+FWFU9ryzGdpVHt7Rd0AMPaopEnjH2i5l5G5c2DejoVtqJ0ollR f5yIg273N+xnZPQ/u8GdVyleYHhDZiSZQ+ARp9DJeBpGHqGK9zfl+lBPqGHEzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520105; a=rsa-sha256; cv=none; b=I9mECFEdgBRGDbVU3xtLPnK+ybI0ExaH3kWN6TBUZHttDwxVU5F92Lq4KdJtBC7OX0URmT JZOXYx5uSovbuZ2AH7X6dq48X3mvilF0mcJB8lTh+CADkalE+tN6J1bTRP/GCtVwiVMlNM +TkrqdtY6ysFT0Ew1Av/VsTksm6lp+KPRGhbNdaOFCRPnIP4aECZ/N98V/owar1C0HhRum eS/v/vwuMoG4ipTWWxTp6YXQC/oVZMz9b3G04wlBrBCPVVO1QIEOgpV9TKwF9BJ8IbxHmv gVg8g7rONj1YwJk0R8+c8ECsPr70fcLWHst4uuA1MIUx9z6gus8L+tWAzSZraA== 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=1696520105; 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=JoiVNhogr1kRt+4GqknfHyzYQzzZfm1eZlEFdROa800=; b=TQxMpr0LaH1gcgo99vKda7HbrOgz+IBQiI301eH7/scqQNDJJ4Zlu/5CN09Bu4cHHZDr56 2a2K2+mlgKGcQbAOJIUZsCKQBqJuMqkY3t880p22+MjxC9lxOPEkGrfe0i7l/qr62OkY5c xa6gJprjA9EnYTFXVBJq0OzFtPNYpD9M10AWn70gr+IhZtvgt0K5P89rCnhoxmZ2856MH0 WS/xFG5iE4ZErpOPyuRt/m2N2WFRv+T1MNtNTZxU41sTQXB0yDDbr2W0jn/7Ey1qSaNJUc wlJVmXvFfQDggpctW/m9+5/L8lEXYZjdjBxCrDk3KCcFlYA4Yw5VDtj2QQJkIw== 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 4S1bGc6ybCz1PfZ; Thu, 5 Oct 2023 15:35:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ4x3012493; Thu, 5 Oct 2023 15:35:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ4sO012490; Thu, 5 Oct 2023 15:35:04 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:04 GMT Message-Id: <202310051535.395FZ4sO012490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: afa0f66e81cc - main - dwc: Move the txstart dma part to dwc1000_dma List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afa0f66e81ccd6a946133bb9aceaf1fe59370431 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=afa0f66e81ccd6a946133bb9aceaf1fe59370431 commit afa0f66e81ccd6a946133bb9aceaf1fe59370431 Author: Emmanuel Vadot AuthorDate: 2023-09-28 20:34:47 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Move the txstart dma part to dwc1000_dma This is dma related to move it to the dma file. No functional changes intended. --- sys/dev/dwc/dwc1000_dma.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/dwc/dwc1000_dma.h | 8 +------- sys/dev/dwc/if_dwc.c | 36 +---------------------------------- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index a04f65de8501..505e3fcaebef 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -60,6 +60,15 @@ #include #include +#define WATCHDOG_TIMEOUT_SECS 5 + +static inline uint32_t +next_txidx(struct dwc_softc *sc, uint32_t curidx) +{ + + return ((curidx + 1) % TX_DESC_COUNT); +} + static inline uint32_t next_rxidx(struct dwc_softc *sc, uint32_t curidx) { @@ -372,6 +381,45 @@ dma1000_txfinish_locked(struct dwc_softc *sc) } } +void +dma1000_txstart(struct dwc_softc *sc) +{ + int enqueued; + struct mbuf *m; + + enqueued = 0; + + for (;;) { + if (sc->tx_desccount > (TX_DESC_COUNT - TX_MAP_MAX_SEGS + 1)) { + if_setdrvflagbits(sc->ifp, IFF_DRV_OACTIVE, 0); + break; + } + + if (sc->tx_mapcount == (TX_MAP_COUNT - 1)) { + if_setdrvflagbits(sc->ifp, IFF_DRV_OACTIVE, 0); + break; + } + + m = if_dequeue(sc->ifp); + if (m == NULL) + break; + if (dma1000_setup_txbuf(sc, sc->tx_map_head, &m) != 0) { + if_sendq_prepend(sc->ifp, m); + if_setdrvflagbits(sc->ifp, IFF_DRV_OACTIVE, 0); + break; + } + bpf_mtap_if(sc->ifp, m); + sc->tx_map_head = next_txidx(sc, sc->tx_map_head); + sc->tx_mapcount++; + ++enqueued; + } + + if (enqueued != 0) { + WRITE4(sc, TRANSMIT_POLL_DEMAND, 0x1); + sc->tx_watchdog_count = WATCHDOG_TIMEOUT_SECS; + } +} + void dma1000_rxfinish_locked(struct dwc_softc *sc) { diff --git a/sys/dev/dwc/dwc1000_dma.h b/sys/dev/dwc/dwc1000_dma.h index 613faeee91ff..97cebd07f215 100644 --- a/sys/dev/dwc/dwc1000_dma.h +++ b/sys/dev/dwc/dwc1000_dma.h @@ -149,12 +149,6 @@ void dma1000_stop(struct dwc_softc *sc); int dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp); void dma1000_txfinish_locked(struct dwc_softc *sc); void dma1000_rxfinish_locked(struct dwc_softc *sc); - -static inline uint32_t -next_txidx(struct dwc_softc *sc, uint32_t curidx) -{ - - return ((curidx + 1) % TX_DESC_COUNT); -} +void dma1000_txstart(struct dwc_softc *sc); #endif /* __DWC1000_DMA_H__ */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 29f78dd94a9a..107158cebf02 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -79,7 +79,6 @@ #include "miibus_if.h" #define MAC_RESET_TIMEOUT 100 -#define WATCHDOG_TIMEOUT_SECS 5 static struct resource_spec dwc_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, @@ -139,8 +138,6 @@ static void dwc_txstart_locked(struct dwc_softc *sc) { if_t ifp; - struct mbuf *m; - int enqueued; DWC_ASSERT_LOCKED(sc); @@ -152,38 +149,7 @@ dwc_txstart_locked(struct dwc_softc *sc) if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - - enqueued = 0; - - for (;;) { - if (sc->tx_desccount > (TX_DESC_COUNT - TX_MAP_MAX_SEGS + 1)) { - if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); - break; - } - - if (sc->tx_mapcount == (TX_MAP_COUNT - 1)) { - if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); - break; - } - - m = if_dequeue(ifp); - if (m == NULL) - break; - if (dma1000_setup_txbuf(sc, sc->tx_map_head, &m) != 0) { - if_sendq_prepend(ifp, m); - if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); - break; - } - bpf_mtap_if(ifp, m); - sc->tx_map_head = next_txidx(sc, sc->tx_map_head); - sc->tx_mapcount++; - ++enqueued; - } - - if (enqueued != 0) { - WRITE4(sc, TRANSMIT_POLL_DEMAND, 0x1); - sc->tx_watchdog_count = WATCHDOG_TIMEOUT_SECS; - } + dma1000_txstart(sc); } static void From nobody Thu Oct 5 15:35:05 2023 X-Original-To: dev-commits-src-main@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 4S1bGf2DVDz4vncP; Thu, 5 Oct 2023 15:35:06 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGf1Vl9z4d6R; Thu, 5 Oct 2023 15:35:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520106; 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=/G0VSd+/kCXD10+Q77/VT9gXQUllaORLF29sXChWtZI=; b=thDMuTRiaoF/W4I07OQX2rpYlgTBt+LY4zzc4S+MLM3cdPnl7DykUztOZhjTzAnqfesmoQ NuQLmAsdVgehNSFsquhQVeRSpBuJn6r1qyp2Xucc9f6BW1modjJDzjkYcOaTKYmtXy88OB YtpobRwtBpuGtbaBD+tSFNQAR+NdchxK49wLjicklKsa/8dwieZ7tsn76g1dAfJ64wiI58 rTJTFd0dZe7wuw+cUcAAuOXo4l2AN75vnA13TxCgvnbM4q5QQT7Dzc7v3lBBmYGITbUpRh TAqH7yM5sImU2PjCjsXzrFLUWefgyw1Cds7/6AmizBj5QQFDCkjHSN+Fc44fjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520106; a=rsa-sha256; cv=none; b=UmEIgTWQNJE+vhE84i+/c+RpZJ0nArPENcvvYrchEWQgYzcV7WCcouTW3LXu47iUq8YIaE RV9SPOv/Z92bbJL07ed3TGhrs+trQQErb8o+wQnsYJusmZV0IPSbdRpATJ04gyF4+egTqx h9If6v3LUHSU+jHCC1cQhgEYuJRqyXzg+nWP9l2Hm6/9W82prGH7c4vEcYU+Bjtu/ynBJd /M5hNX0TJTuK2IQjhbMsiN3rCe2idVJvlYkWqWZ2pDyxZQ6Be0ejq7TA8/R7uX5Nol+WqK qEw264BDACALr+Gbit4cllSVhhSnX9n5Utg56fCmYPVVajSW7k17tr0mYSJsEA== 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=1696520106; 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=/G0VSd+/kCXD10+Q77/VT9gXQUllaORLF29sXChWtZI=; b=uBiplRSKodoEvMhHWdyzg4+L9T4VQAQvULFBtiKYBQN6qy4awUCkS/7rlmppnQC2rZWGXu hZgGWwOyA4ezN/etrhMh5EQRSOPzLRfYQvXjkorYaoc/+AvBMk3C+p1GkKvyPgCsbVAPI/ 0kUJSu+Iu9b9N8/ZJsBTHlHZqjeyTSASabxYEvqPUykbGGXLVUpz9CNpvPozw2vIyTGBgo PI10CyeUkO/Qlxgr05/UzubPdbZugCkrykpK6WFQRxSd6BJWvjvLALpuAcWn9DPRI7NDuH 1SsaekSy7WtqBrlRH8IpFfJvSlMF8usS0DLJUaCV0DL/bsIdp4vuimRAjpjIsw== 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 4S1bGf0bCpz1QJj; Thu, 5 Oct 2023 15:35:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ59Z012649; Thu, 5 Oct 2023 15:35:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ5bl012646; Thu, 5 Oct 2023 15:35:05 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:05 GMT Message-Id: <202310051535.395FZ5bl012646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 627726b5b6fa - main - dwc: Move struct dwc_hash_maddr_ctx declaration in dwc1000_core List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 627726b5b6fa861079e1d4edd68374a2e798a9da Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=627726b5b6fa861079e1d4edd68374a2e798a9da commit 627726b5b6fa861079e1d4edd68374a2e798a9da Author: Emmanuel Vadot AuthorDate: 2023-09-28 20:36:24 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Move struct dwc_hash_maddr_ctx declaration in dwc1000_core it's only used there. No functional change intended. --- sys/dev/dwc/dwc1000_core.c | 5 +++++ sys/dev/dwc/dwc1000_dma.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/dwc/dwc1000_core.c b/sys/dev/dwc/dwc1000_core.c index ef6db707a3a1..c93019a49f3e 100644 --- a/sys/dev/dwc/dwc1000_core.c +++ b/sys/dev/dwc/dwc1000_core.c @@ -71,6 +71,11 @@ #include "if_dwc_if.h" +struct dwc_hash_maddr_ctx { + struct dwc_softc *sc; + uint32_t hash[8]; +}; + #define STATS_HARVEST_INTERVAL 2 /* Pause time field in the transmitted control frame */ diff --git a/sys/dev/dwc/dwc1000_dma.h b/sys/dev/dwc/dwc1000_dma.h index 97cebd07f215..3858b14cc862 100644 --- a/sys/dev/dwc/dwc1000_dma.h +++ b/sys/dev/dwc/dwc1000_dma.h @@ -131,11 +131,6 @@ struct dwc_hwdesc uint32_t addr2; /* ptr to next descriptor / second buffer data*/ }; -struct dwc_hash_maddr_ctx { - struct dwc_softc *sc; - uint32_t hash[8]; -}; - /* * The hardware imposes alignment restrictions on various objects involved in * DMA transfers. These values are expressed in bytes (not bits). From nobody Thu Oct 5 15:35:07 2023 X-Original-To: dev-commits-src-main@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 4S1bGg58nTz4vnWk; Thu, 5 Oct 2023 15:35:07 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGg2j4Wz4dR7; Thu, 5 Oct 2023 15:35:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520107; 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=+r2fWvNdYVP5l8FK4U8iq18hLNT/cKsLL0/duzUmhxo=; b=dAbGLlqdHgs96yn4rwQPhSfR0hujQNJ94Nk6DswFbERdEh7utvWEgWaZLO80nMF3GxG+X7 bpNCXudA1YbBsieAgX/bSi4/rx44bQ4jTSvF2r/kVgKYPtROUdT6KUT1zopsXBKce/Jsnn wK7otaPgHje5GaRKNrgj/qwdv51luQQAxS/zL/dX9Yu5lnx+JBD42iMFM9OHPNHw0qIWD9 1mzzyfYdRR0Ap0UgHZtQPmIYtZ6tCWhOTjowwHoabR3KEABrzRn61j2I45dYw7LGpBBool 95OePEHk78W1/Ng/QXiCjVsi76W1nnHVHOknqGezWee2pjQ8PIImQVNb0rxvNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520107; a=rsa-sha256; cv=none; b=Zsdzb59oHbFBYPjmdIXWpi7rPb+VPHLGREqIq34xUDjgYXh9wcqSgyMtAvOdYw4JKvXhoG upua2IB3AbAithAHC8wKTao+DMnxrgyCfWCJBX/nL+X21GC1kojW7MY1YMby4pmtKDk2Q4 jDvrJZtcGk0AAJLYRe/RLx7xbyfJlFkeLQpzkVnprk/GjVyoauro/SKpwJWZojiVNOM2cX zNpJmlvpcYR/pyW8apEG33DN7gGkZ0XiEN9n/XXJUldO9GnLK7Bmf34FYWLSyJO37vGnxO SkdobxnVyVXIxsrxSYfU+Ov3twtg6uzZGFBbRJPseu77rh6cXkC6VKSNb7enwA== 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=1696520107; 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=+r2fWvNdYVP5l8FK4U8iq18hLNT/cKsLL0/duzUmhxo=; b=PwmT2tMZ08vCzWHiC+nMvnoToPDFEEoov7DpFu6aoQWTNo2MkioSQRWTL74Ueq5AVJo5Nb wiNxIh38MIqq67C2xqWsLbWFG2HIgaQS95sWcausFon4t+1tlP6LL5hz0i2qbV8IUw/VmX pgQHDoxk5mMCUskaZC3grMjurPkEhMt2iyqxJPpWCLed3BuydKRLfULW4/ImAuXSCRvyVR GWU7k4YV02sBvbAS6hS8vNm8D1j63yxZvuiTD/gxCQvflHHLoW131DhBro8jbW6IGYQxg3 Zyo/LkESfDGs0M1LwUt/XBrS2ZMfiVM1l5uA+Mr86BmIdjJ05dPA8kosq+muZA== 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 4S1bGg1bcdz1PqW; Thu, 5 Oct 2023 15:35:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ7AW012725; Thu, 5 Oct 2023 15:35:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ7S2012722; Thu, 5 Oct 2023 15:35:07 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:07 GMT Message-Id: <202310051535.395FZ7S2012722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: fe82f82dcc3d - main - dwc: Put all DMA related defines in dma1000_dma.c List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe82f82dcc3dea2b2f82fd14bbccf845d6c31951 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=fe82f82dcc3dea2b2f82fd14bbccf845d6c31951 commit fe82f82dcc3dea2b2f82fd14bbccf845d6c31951 Author: Emmanuel Vadot AuthorDate: 2023-09-28 20:37:48 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Put all DMA related defines in dma1000_dma.c No need to polute dwm1000_dma.h now. No functional changes intended. --- sys/dev/dwc/dwc1000_dma.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/dwc/dwc1000_dma.h | 95 ---------------------------------------------- 2 files changed, 96 insertions(+), 95 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index 505e3fcaebef..ad8bdbcfc883 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -62,6 +62,102 @@ #define WATCHDOG_TIMEOUT_SECS 5 + +/* TX descriptors - TDESC0 is almost unified */ +#define TDESC0_OWN (1U << 31) +#define TDESC0_IHE (1U << 16) /* IP Header Error */ +#define TDESC0_ES (1U << 15) /* Error Summary */ +#define TDESC0_JT (1U << 14) /* Jabber Timeout */ +#define TDESC0_FF (1U << 13) /* Frame Flushed */ +#define TDESC0_PCE (1U << 12) /* Payload Checksum Error */ +#define TDESC0_LOC (1U << 11) /* Loss of Carrier */ +#define TDESC0_NC (1U << 10) /* No Carrier */ +#define TDESC0_LC (1U << 9) /* Late Collision */ +#define TDESC0_EC (1U << 8) /* Excessive Collision */ +#define TDESC0_VF (1U << 7) /* VLAN Frame */ +#define TDESC0_CC_MASK 0xf +#define TDESC0_CC_SHIFT 3 /* Collision Count */ +#define TDESC0_ED (1U << 2) /* Excessive Deferral */ +#define TDESC0_UF (1U << 1) /* Underflow Error */ +#define TDESC0_DB (1U << 0) /* Deferred Bit */ +/* TX descriptors - TDESC0 extended format only */ +#define ETDESC0_IC (1U << 30) /* Interrupt on Completion */ +#define ETDESC0_LS (1U << 29) /* Last Segment */ +#define ETDESC0_FS (1U << 28) /* First Segment */ +#define ETDESC0_DC (1U << 27) /* Disable CRC */ +#define ETDESC0_DP (1U << 26) /* Disable Padding */ +#define ETDESC0_CIC_NONE (0U << 22) /* Checksum Insertion Control */ +#define ETDESC0_CIC_HDR (1U << 22) +#define ETDESC0_CIC_SEG (2U << 22) +#define ETDESC0_CIC_FULL (3U << 22) +#define ETDESC0_TER (1U << 21) /* Transmit End of Ring */ +#define ETDESC0_TCH (1U << 20) /* Second Address Chained */ + +/* TX descriptors - TDESC1 normal format */ +#define NTDESC1_IC (1U << 31) /* Interrupt on Completion */ +#define NTDESC1_LS (1U << 30) /* Last Segment */ +#define NTDESC1_FS (1U << 29) /* First Segment */ +#define NTDESC1_CIC_NONE (0U << 27) /* Checksum Insertion Control */ +#define NTDESC1_CIC_HDR (1U << 27) +#define NTDESC1_CIC_SEG (2U << 27) +#define NTDESC1_CIC_FULL (3U << 27) +#define NTDESC1_DC (1U << 26) /* Disable CRC */ +#define NTDESC1_TER (1U << 25) /* Transmit End of Ring */ +#define NTDESC1_TCH (1U << 24) /* Second Address Chained */ +/* TX descriptors - TDESC1 extended format */ +#define ETDESC1_DP (1U << 23) /* Disable Padding */ +#define ETDESC1_TBS2_MASK 0x7ff +#define ETDESC1_TBS2_SHIFT 11 /* Receive Buffer 2 Size */ +#define ETDESC1_TBS1_MASK 0x7ff +#define ETDESC1_TBS1_SHIFT 0 /* Receive Buffer 1 Size */ + +/* RX descriptor - RDESC0 is unified */ +#define RDESC0_OWN (1U << 31) +#define RDESC0_AFM (1U << 30) /* Dest. Address Filter Fail */ +#define RDESC0_FL_MASK 0x3fff +#define RDESC0_FL_SHIFT 16 /* Frame Length */ +#define RDESC0_ES (1U << 15) /* Error Summary */ +#define RDESC0_DE (1U << 14) /* Descriptor Error */ +#define RDESC0_SAF (1U << 13) /* Source Address Filter Fail */ +#define RDESC0_LE (1U << 12) /* Length Error */ +#define RDESC0_OE (1U << 11) /* Overflow Error */ +#define RDESC0_VLAN (1U << 10) /* VLAN Tag */ +#define RDESC0_FS (1U << 9) /* First Descriptor */ +#define RDESC0_LS (1U << 8) /* Last Descriptor */ +#define RDESC0_ICE (1U << 7) /* IPC Checksum Error */ +#define RDESC0_LC (1U << 6) /* Late Collision */ +#define RDESC0_FT (1U << 5) /* Frame Type */ +#define RDESC0_RWT (1U << 4) /* Receive Watchdog Timeout */ +#define RDESC0_RE (1U << 3) /* Receive Error */ +#define RDESC0_DBE (1U << 2) /* Dribble Bit Error */ +#define RDESC0_CE (1U << 1) /* CRC Error */ +#define RDESC0_PCE (1U << 0) /* Payload Checksum Error */ +#define RDESC0_RXMA (1U << 0) /* Rx MAC Address */ + +/* RX descriptors - RDESC1 normal format */ +#define NRDESC1_DIC (1U << 31) /* Disable Intr on Completion */ +#define NRDESC1_RER (1U << 25) /* Receive End of Ring */ +#define NRDESC1_RCH (1U << 24) /* Second Address Chained */ +#define NRDESC1_RBS2_MASK 0x7ff +#define NRDESC1_RBS2_SHIFT 11 /* Receive Buffer 2 Size */ +#define NRDESC1_RBS1_MASK 0x7ff +#define NRDESC1_RBS1_SHIFT 0 /* Receive Buffer 1 Size */ + +/* RX descriptors - RDESC1 enhanced format */ +#define ERDESC1_DIC (1U << 31) /* Disable Intr on Completion */ +#define ERDESC1_RBS2_MASK 0x7ffff +#define ERDESC1_RBS2_SHIFT 16 /* Receive Buffer 2 Size */ +#define ERDESC1_RER (1U << 15) /* Receive End of Ring */ +#define ERDESC1_RCH (1U << 14) /* Second Address Chained */ +#define ERDESC1_RBS1_MASK 0x7ffff +#define ERDESC1_RBS1_SHIFT 0 /* Receive Buffer 1 Size */ + +/* + * The hardware imposes alignment restrictions on various objects involved in + * DMA transfers. These values are expressed in bytes (not bits). + */ +#define DWC_DESC_RING_ALIGN 2048 + static inline uint32_t next_txidx(struct dwc_softc *sc, uint32_t curidx) { diff --git a/sys/dev/dwc/dwc1000_dma.h b/sys/dev/dwc/dwc1000_dma.h index 3858b14cc862..b4af29076625 100644 --- a/sys/dev/dwc/dwc1000_dma.h +++ b/sys/dev/dwc/dwc1000_dma.h @@ -30,95 +30,6 @@ #ifndef __DWC1000_DMA_H__ #define __DWC1000_DMA_H__ -/* TX descriptors - TDESC0 is almost unified */ -#define TDESC0_OWN (1U << 31) -#define TDESC0_IHE (1U << 16) /* IP Header Error */ -#define TDESC0_ES (1U << 15) /* Error Summary */ -#define TDESC0_JT (1U << 14) /* Jabber Timeout */ -#define TDESC0_FF (1U << 13) /* Frame Flushed */ -#define TDESC0_PCE (1U << 12) /* Payload Checksum Error */ -#define TDESC0_LOC (1U << 11) /* Loss of Carrier */ -#define TDESC0_NC (1U << 10) /* No Carrier */ -#define TDESC0_LC (1U << 9) /* Late Collision */ -#define TDESC0_EC (1U << 8) /* Excessive Collision */ -#define TDESC0_VF (1U << 7) /* VLAN Frame */ -#define TDESC0_CC_MASK 0xf -#define TDESC0_CC_SHIFT 3 /* Collision Count */ -#define TDESC0_ED (1U << 2) /* Excessive Deferral */ -#define TDESC0_UF (1U << 1) /* Underflow Error */ -#define TDESC0_DB (1U << 0) /* Deferred Bit */ -/* TX descriptors - TDESC0 extended format only */ -#define ETDESC0_IC (1U << 30) /* Interrupt on Completion */ -#define ETDESC0_LS (1U << 29) /* Last Segment */ -#define ETDESC0_FS (1U << 28) /* First Segment */ -#define ETDESC0_DC (1U << 27) /* Disable CRC */ -#define ETDESC0_DP (1U << 26) /* Disable Padding */ -#define ETDESC0_CIC_NONE (0U << 22) /* Checksum Insertion Control */ -#define ETDESC0_CIC_HDR (1U << 22) -#define ETDESC0_CIC_SEG (2U << 22) -#define ETDESC0_CIC_FULL (3U << 22) -#define ETDESC0_TER (1U << 21) /* Transmit End of Ring */ -#define ETDESC0_TCH (1U << 20) /* Second Address Chained */ - -/* TX descriptors - TDESC1 normal format */ -#define NTDESC1_IC (1U << 31) /* Interrupt on Completion */ -#define NTDESC1_LS (1U << 30) /* Last Segment */ -#define NTDESC1_FS (1U << 29) /* First Segment */ -#define NTDESC1_CIC_NONE (0U << 27) /* Checksum Insertion Control */ -#define NTDESC1_CIC_HDR (1U << 27) -#define NTDESC1_CIC_SEG (2U << 27) -#define NTDESC1_CIC_FULL (3U << 27) -#define NTDESC1_DC (1U << 26) /* Disable CRC */ -#define NTDESC1_TER (1U << 25) /* Transmit End of Ring */ -#define NTDESC1_TCH (1U << 24) /* Second Address Chained */ -/* TX descriptors - TDESC1 extended format */ -#define ETDESC1_DP (1U << 23) /* Disable Padding */ -#define ETDESC1_TBS2_MASK 0x7ff -#define ETDESC1_TBS2_SHIFT 11 /* Receive Buffer 2 Size */ -#define ETDESC1_TBS1_MASK 0x7ff -#define ETDESC1_TBS1_SHIFT 0 /* Receive Buffer 1 Size */ - -/* RX descriptor - RDESC0 is unified */ -#define RDESC0_OWN (1U << 31) -#define RDESC0_AFM (1U << 30) /* Dest. Address Filter Fail */ -#define RDESC0_FL_MASK 0x3fff -#define RDESC0_FL_SHIFT 16 /* Frame Length */ -#define RDESC0_ES (1U << 15) /* Error Summary */ -#define RDESC0_DE (1U << 14) /* Descriptor Error */ -#define RDESC0_SAF (1U << 13) /* Source Address Filter Fail */ -#define RDESC0_LE (1U << 12) /* Length Error */ -#define RDESC0_OE (1U << 11) /* Overflow Error */ -#define RDESC0_VLAN (1U << 10) /* VLAN Tag */ -#define RDESC0_FS (1U << 9) /* First Descriptor */ -#define RDESC0_LS (1U << 8) /* Last Descriptor */ -#define RDESC0_ICE (1U << 7) /* IPC Checksum Error */ -#define RDESC0_LC (1U << 6) /* Late Collision */ -#define RDESC0_FT (1U << 5) /* Frame Type */ -#define RDESC0_RWT (1U << 4) /* Receive Watchdog Timeout */ -#define RDESC0_RE (1U << 3) /* Receive Error */ -#define RDESC0_DBE (1U << 2) /* Dribble Bit Error */ -#define RDESC0_CE (1U << 1) /* CRC Error */ -#define RDESC0_PCE (1U << 0) /* Payload Checksum Error */ -#define RDESC0_RXMA (1U << 0) /* Rx MAC Address */ - -/* RX descriptors - RDESC1 normal format */ -#define NRDESC1_DIC (1U << 31) /* Disable Intr on Completion */ -#define NRDESC1_RER (1U << 25) /* Receive End of Ring */ -#define NRDESC1_RCH (1U << 24) /* Second Address Chained */ -#define NRDESC1_RBS2_MASK 0x7ff -#define NRDESC1_RBS2_SHIFT 11 /* Receive Buffer 2 Size */ -#define NRDESC1_RBS1_MASK 0x7ff -#define NRDESC1_RBS1_SHIFT 0 /* Receive Buffer 1 Size */ - -/* RX descriptors - RDESC1 enhanced format */ -#define ERDESC1_DIC (1U << 31) /* Disable Intr on Completion */ -#define ERDESC1_RBS2_MASK 0x7ffff -#define ERDESC1_RBS2_SHIFT 16 /* Receive Buffer 2 Size */ -#define ERDESC1_RER (1U << 15) /* Receive End of Ring */ -#define ERDESC1_RCH (1U << 14) /* Second Address Chained */ -#define ERDESC1_RBS1_MASK 0x7ffff -#define ERDESC1_RBS1_SHIFT 0 /* Receive Buffer 1 Size */ - /* * A hardware buffer descriptor. Rx and Tx buffers have the same descriptor * layout, but the bits in the fields have different meanings. @@ -131,12 +42,6 @@ struct dwc_hwdesc uint32_t addr2; /* ptr to next descriptor / second buffer data*/ }; -/* - * The hardware imposes alignment restrictions on various objects involved in - * DMA transfers. These values are expressed in bytes (not bits). - */ -#define DWC_DESC_RING_ALIGN 2048 - int dma1000_init(struct dwc_softc *sc); void dma1000_free(struct dwc_softc *sc); void dma1000_start(struct dwc_softc *sc); From nobody Thu Oct 5 15:35:08 2023 X-Original-To: dev-commits-src-main@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 4S1bGh5Bvrz4vnZJ; Thu, 5 Oct 2023 15:35:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGh3cv6z4d97; Thu, 5 Oct 2023 15:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520108; 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=EW/TUh4kl1nXCA57TpAPJb++aH68qGemMg0LF9sFqFw=; b=FcTlhXA3i/UCaGe1iRIOQ/RoVlBduljgqLCqSHsJQLm4EFqzOEMr+jl/md4U/dttE72Ute rA9olxMEiQ2hBszXWBFnznuRFYqvOle4pY/ugZBloK3+K9MHglcstnx1AOEt5VRo9A9qWK wfe/sh2TNpYcnj8ab+tIuxK0oMG8cYgsvy1ZGmHvGQ8BCicY/cDCdk30SXUEOIuKqyXG0M tPaBuAR9Vrpp7qJGP2HuPIWVEwMWYF6bN5tUbxvI7izuBXgP49LIxLMmUxOYCvbw9b3nE0 JCHO1mCmATNR0Oj2DpLr2u/x7f9pZlIqruGW0z7kCg3bIovVFtJzoANTNpSMvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520108; a=rsa-sha256; cv=none; b=xGwixul6eaDbPmKlQAm/E13PqPrEz52y2tBiAzhyMkDZQrLnxzwdKIHhoXXf9cM5Pav8+/ R6hOdskzwGsqxVPL5RwJrIfqQuRCnoJyy2cj8R/a/AYC9UFjAl2/NICJM0ikJKErOcRJ+I 7JC2LlHo2UO49MexXxORK6VKvnZPatey16MX5T7OioC3HptZzwLroMDmjXIjclrWrbd/8V NwQQ9qrrX64cgv3sgYalsyeEljMSxvMPmUmexiu5eqwOx1rvV1HeqQBnkPp17lEl45sXQP V0yaiHStcoWBPrHtKtpqUR0LsBWC2HZG2gAdhhkgokzgtXg1dCiV4KcJMB7VzQ== 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=1696520108; 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=EW/TUh4kl1nXCA57TpAPJb++aH68qGemMg0LF9sFqFw=; b=KUt1i3EiXuyXBEqzDm+hdRfTyFOswdeov5FeSJKujtsPjuNpVS+DdZ1rttzL59+CR3Yphh TduJiWXEc6nj0JkyQVWJXnouK9yA0b+9NwZlagQvK7QzpFrQxJdWz6ov5W4qw73RixP4Vb snbruxBmbAg8ZgE7juT2tJBg+GNlL9UtQ1zO6Pk2azo9vnUdT195ayojeVbRxCt0+ufUiM Ky19toFeOlSjgX8ySWeJ3o/ruiZeewGEI7CuNFccm69mTeTNEUVt5ZOWOzxQVAuNDGTPBA CPL1KvbUtNEbQ5mPIBqxc/Edgy8NeXuEsqVfM8Qy8d7xyYkFM2zAfuVOa0SFxQ== 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 4S1bGh2dwqz1QJk; Thu, 5 Oct 2023 15:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ8PE012786; Thu, 5 Oct 2023 15:35:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ8SI012783; Thu, 5 Oct 2023 15:35:08 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:08 GMT Message-Id: <202310051535.395FZ8SI012783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 29776aa436cf - main - dwc: Move interrupt related code to core and dma file List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29776aa436cf248950bcf755c6a53ec0590d89bf Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=29776aa436cf248950bcf755c6a53ec0590d89bf commit 29776aa436cf248950bcf755c6a53ec0590d89bf Author: Emmanuel Vadot AuthorDate: 2023-10-03 16:04:03 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Move interrupt related code to core and dma file No functional changes intended. --- sys/dev/dwc/dwc1000_core.c | 19 +++++++++++++++++++ sys/dev/dwc/dwc1000_core.h | 2 ++ sys/dev/dwc/dwc1000_dma.c | 35 +++++++++++++++++++++++++++++++++++ sys/dev/dwc/dwc1000_dma.h | 1 + sys/dev/dwc/if_dwc.c | 38 +++++++++----------------------------- 5 files changed, 66 insertions(+), 29 deletions(-) diff --git a/sys/dev/dwc/dwc1000_core.c b/sys/dev/dwc/dwc1000_core.c index c93019a49f3e..6cf836f87be2 100644 --- a/sys/dev/dwc/dwc1000_core.c +++ b/sys/dev/dwc/dwc1000_core.c @@ -419,3 +419,22 @@ dwc1000_harvest_stats(struct dwc_softc *sc) dwc1000_clear_stats(sc); } + +void +dwc1000_intr(struct dwc_softc *sc) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + + reg = READ4(sc, INTERRUPT_STATUS); + if (reg) + READ4(sc, SGMII_RGMII_SMII_CTRL_STATUS); +} + +void +dwc1000_intr_disable(struct dwc_softc *sc) +{ + + WRITE4(sc, INTERRUPT_ENABLE, 0); +} diff --git a/sys/dev/dwc/dwc1000_core.h b/sys/dev/dwc/dwc1000_core.h index 2069215bfffe..cb7d1f3946e9 100644 --- a/sys/dev/dwc/dwc1000_core.h +++ b/sys/dev/dwc/dwc1000_core.h @@ -39,5 +39,7 @@ void dwc1000_enable_csum_offload(struct dwc_softc *sc); void dwc1000_setup_rxfilter(struct dwc_softc *sc); void dwc1000_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr); void dwc1000_harvest_stats(struct dwc_softc *sc); +void dwc1000_intr(struct dwc_softc *softc); +void dwc1000_intr_disable(struct dwc_softc *sc); #endif /* __DWC1000_CORE_H__ */ diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index ad8bdbcfc883..3d95c9d8e764 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -810,3 +810,38 @@ dma1000_free(struct dwc_softc *sc) if (sc->txdesc_tag != NULL) bus_dma_tag_destroy(sc->txdesc_tag); } + +/* + * Interrupt function + */ + +int +dma1000_intr(struct dwc_softc *sc) +{ + uint32_t reg; + int rv; + + DWC_ASSERT_LOCKED(sc); + + rv = 0; + reg = READ4(sc, DMA_STATUS); + if (reg & DMA_STATUS_NIS) { + if (reg & DMA_STATUS_RI) + dma1000_rxfinish_locked(sc); + + if (reg & DMA_STATUS_TI) { + dma1000_txfinish_locked(sc); + dma1000_txstart(sc); + } + } + + if (reg & DMA_STATUS_AIS) { + if (reg & DMA_STATUS_FBI) { + /* Fatal bus error */ + rv = EIO; + } + } + + WRITE4(sc, DMA_STATUS, reg & DMA_STATUS_INTR_MASK); + return (rv); +} diff --git a/sys/dev/dwc/dwc1000_dma.h b/sys/dev/dwc/dwc1000_dma.h index b4af29076625..96a98c2d6d51 100644 --- a/sys/dev/dwc/dwc1000_dma.h +++ b/sys/dev/dwc/dwc1000_dma.h @@ -50,5 +50,6 @@ int dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp); void dma1000_txfinish_locked(struct dwc_softc *sc); void dma1000_rxfinish_locked(struct dwc_softc *sc); void dma1000_txstart(struct dwc_softc *sc); +int dma1000_intr(struct dwc_softc *sc); #endif /* __DWC1000_DMA_H__ */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 107158cebf02..896e2f2205a0 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -300,38 +300,18 @@ static void dwc_intr(void *arg) { struct dwc_softc *sc; - uint32_t reg; + int rv; sc = arg; - DWC_LOCK(sc); - - reg = READ4(sc, INTERRUPT_STATUS); - if (reg) - READ4(sc, SGMII_RGMII_SMII_CTRL_STATUS); - - reg = READ4(sc, DMA_STATUS); - if (reg & DMA_STATUS_NIS) { - if (reg & DMA_STATUS_RI) - dma1000_rxfinish_locked(sc); - - if (reg & DMA_STATUS_TI) { - dma1000_txfinish_locked(sc); - dwc_txstart_locked(sc); - } - } - - if (reg & DMA_STATUS_AIS) { - if (reg & DMA_STATUS_FBI) { - /* Fatal bus error */ - device_printf(sc->dev, - "Ethernet DMA error, restarting controller.\n"); - dwc_stop_locked(sc); - dwc_init_locked(sc); - } + dwc1000_intr(sc); + rv = dma1000_intr(sc); + if (rv == EIO) { + device_printf(sc->dev, + "Ethernet DMA error, restarting controller.\n"); + dwc_stop_locked(sc); + dwc_init_locked(sc); } - - WRITE4(sc, DMA_STATUS, reg & DMA_STATUS_INTR_MASK); DWC_UNLOCK(sc); } @@ -706,7 +686,7 @@ dwc_detach(device_t dev) * Disable and tear down interrupts before anything else, so we don't * race with the handler. */ - WRITE4(sc, INTERRUPT_ENABLE, 0); + dwc1000_intr_disable(sc); if (sc->intr_cookie != NULL) { bus_teardown_intr(dev, sc->res[1], sc->intr_cookie); } From nobody Thu Oct 5 15:35:09 2023 X-Original-To: dev-commits-src-main@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 4S1bGj5Yfvz4vnWw; Thu, 5 Oct 2023 15:35:09 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGj4tPhz4dML; Thu, 5 Oct 2023 15:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520109; 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=J67tjjukdvBH7qGluxyJy5PEgZxLhtMBAnLeu0UEYTA=; b=vTOKUFHF4BQPAky5B+fGnk45pVgUgotNb145x4RYFGcn9G7g0yrBd8yNy/YpsGG134GXQh J2cIENXAF2oUSX6+Q4p2XchRv1xzlr8stLElTJPRFIS5T2gH80vyfhnDPb2v3pCuslDvjE BbEAz/dflLQ8s8xD2PMGpYFVZqGMHw5MI8pJUnmKYnOYmT1+wASSJvA3KbeCeLWje2Io2z UVN3Zm+MhMCseh4XfLgNqJPMeIFBzD2Rnz2WD7oMCAdIEyAXOKtvmsmYkZoV6JcVm02pvc 2ov/FTpjnmIdubQmwRMkJ8INSmUw8FBIEDEPxYl4d54G+x7SvJNjkV3Lb8cdBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520109; a=rsa-sha256; cv=none; b=tKgvmktytz8PROz1d/Zm6wsaLpCaITUPPxh1/JJVL2gBc3ax/U2cWWQBkLQ+iSbB0qVhgi +OVFKUMmz5J2bt5EdKBOSxVX2TieWVtDIIkFOY4+ljpOxJDMQDWsWKzkjkuDI8QrPs8Tg4 p7zId/fFCR/3nNdk58+I2itGheHk6wlG0X6VW1yJJ5p99Bs8DL3ooGANU8efIuY5qRIIlm 1Er6LBxtsX7+dI7iOImkRtTYSuduD/XdTw3/okfXYBxdv5948laukTfKyJj+kLfJMjl1bQ tUkvDDILIAawzveVQy0f8Hz2bkQL7oZbJHesC/EhLA34GfjYxSBwcLb4vEwGvg== 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=1696520109; 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=J67tjjukdvBH7qGluxyJy5PEgZxLhtMBAnLeu0UEYTA=; b=uIk2OSMKK4hjBKZrxRJ0m9MDCiH4HEON7sRIcP6M7qiyVuGYzZYK5ql+yd+SG5ZUppB9Gd 2PRU4/0BnfNh3OSNokxhZaDJJ6fmeWmYsroTlj/duD3J8cYPgJ9bWSJbi2z4pcj3XI3pza HJTmzrC6oqZlF72Rnm1NNrxls0ncJb4CLSeMmk+Wlyv1tRO3JyDMiTiAggTpszmweoXyYj TTCc7TB/QeWaJ0G3u4OhHVL5viOkNisdz4hXelLSNymx81QAsG3Aa7pYl3Wh9HdMxP+RNX 1CKZubm7rO1ihHpKyzLgNHRD3nvH2IwftPjrLY6hgEQ4d7TqWQae87lUZSqjfg== 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 4S1bGj3tNSz1PGp; Thu, 5 Oct 2023 15:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ9dn012841; Thu, 5 Oct 2023 15:35:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ9Hr012838; Thu, 5 Oct 2023 15:35:09 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:09 GMT Message-Id: <202310051535.395FZ9Hr012838@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: f0a7dd770312 - main - dwc: Setup desc addresses in the dma init function. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0a7dd7703124af42da3705bb11e785c0eb9f0c4 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f0a7dd7703124af42da3705bb11e785c0eb9f0c4 commit f0a7dd7703124af42da3705bb11e785c0eb9f0c4 Author: Emmanuel Vadot AuthorDate: 2023-10-03 16:46:56 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Setup desc addresses in the dma init function. --- sys/dev/dwc/dwc1000_dma.c | 11 +++++++++++ sys/dev/dwc/if_dwc.c | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index 3d95c9d8e764..cdfd24afd574 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -605,10 +605,18 @@ int dma1000_init(struct dwc_softc *sc) { struct mbuf *m; + uint32_t reg; int error; int nidx; int idx; + /* + * DMA must be stop while changing descriptor list addresses. + */ + reg = READ4(sc, OPERATION_MODE); + reg &= ~(MODE_ST | MODE_SR); + WRITE4(sc, OPERATION_MODE, reg); + /* * Set up TX descriptor ring, descriptors, and dma maps. */ @@ -684,6 +692,8 @@ dma1000_init(struct dwc_softc *sc) for (idx = 0; idx < TX_DESC_COUNT; idx++) dwc_setup_txdesc(sc, idx, 0, 0, 0, false, false); + WRITE4(sc, TX_DESCR_LIST_ADDR, sc->txdesc_ring_paddr); + /* * Set up RX descriptor ring, descriptors, dma maps, and mbufs. */ @@ -758,6 +768,7 @@ dma1000_init(struct dwc_softc *sc) goto out; } } + WRITE4(sc, RX_DESCR_LIST_ADDR, sc->rxdesc_ring_paddr); out: if (error != 0) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 896e2f2205a0..0df99a7c205c 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -610,22 +610,11 @@ dwc_attach(device_t dev) WRITE4(sc, BUS_MODE, reg); - /* - * DMA must be stop while changing descriptor list addresses. - */ - reg = READ4(sc, OPERATION_MODE); - reg &= ~(MODE_ST | MODE_SR); - WRITE4(sc, OPERATION_MODE, reg); - if (dma1000_init(sc)) { bus_release_resources(dev, dwc_spec, sc->res); return (ENXIO); } - /* Setup addresses */ - WRITE4(sc, RX_DESCR_LIST_ADDR, sc->rxdesc_ring_paddr); - WRITE4(sc, TX_DESCR_LIST_ADDR, sc->txdesc_ring_paddr); - mtx_init(&sc->mtx, device_get_nameunit(sc->dev), MTX_NETWORK_LOCK, MTX_DEF); From nobody Thu Oct 5 15:35:10 2023 X-Original-To: dev-commits-src-main@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 4S1bGk68qqz4vnX2; Thu, 5 Oct 2023 15:35:10 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGk5c6Yz4dQ3; Thu, 5 Oct 2023 15:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520110; 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=y3eRb1/0jKw2wsws9XRaB3wKt6EYgnMfaPl4iNnyejE=; b=W8iWVLWtu1C6nsRzg+9BBDkHzm4Fhpd6ItvKKXbMKa8fiqiOTxX3ZERTLWEeZwI+qwseqs GWEU174VDEnDmtjxcBuJ1rHhkDGzXfViKLhu08TtKeHeiy3tFItV6M2b8s4DNj6yBWvh4X rkgfW0hTzdLBS0kQvZDZIMwGiNCh4cG/dpawCOX6kkWDBNGtmey7pg/4qGXhKKhzu02Evf RpVZuYs5FoiONYuk0pJMt0V7MhGPooCtm6N3+0zkOUkoyh8DsPk+m33jfS/Ct/zmOTEoMG 7v+bDbG2dNcZDgcldIJ0R8Je2UkFX9mMHSg6FA/lhmCWpyL0cZw/H+5EH1CmWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520110; a=rsa-sha256; cv=none; b=PCuQ66GZYm9Qtds2GKqe4RlX8lL7S2T9OjxDmW+JFXIdTqIKTRROxeyJrC4QmbUd6Me1Yt h3p90EK/GJCxwgmA3LBN1WU2xTqOnxsJXoiHN3/B49jtpJfgO/LD8GqI3lBxzppgaER+Zw sq0v6lnKwu/qSLPpkiTZe2k29bXSZJYvKoGeaIrAAI9ypx0zyKh35dxKJDcco0fnu5P3NK gfkVApB35PBtbCnxmvAslPaCMH/OHZtYSN0csannpdEnhyQmLOZw+9XLX7BUqtlc6Z6ViX H+D80JMVXZTwKHx2IvYpv4dWAp7AicTPuMhLzE1dG0mzihPfkMg7X/uZl8Y75g== 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=1696520110; 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=y3eRb1/0jKw2wsws9XRaB3wKt6EYgnMfaPl4iNnyejE=; b=jA4e2tXA4wPSAFpESC63crvPeCDsmMGvV2Io6MEQyRNb4gEpaOJuBJg3eIoSAWgvfn9wDA RoOhw9X7kZCIsPvwcvecNW64GUjlG2X/E3UR6Dx3rPmeX5/TA1eaOoikgJUGfH/OP+91jT PpZFPSpdSpoxq8yvhYKL5MaGutSUw+mYBlYhAynld1RZfzSOoZch+EgmTf4uNRQ1gz3uR0 CvFaz1jmfdo6unX1y5rx2zPq694hnDYIcx5Os04Ph18G4oiRpAJfgt8HGb8r94sUyTnlI2 JMu/g6GenubzOh4X1l+t7pcj2xvRuTbNvenQc13Q4X2ZMyuCKVleHM7Zzo5c0Q== 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 4S1bGk4hnsz1QCW; Thu, 5 Oct 2023 15:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZA4U012894; Thu, 5 Oct 2023 15:35:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZAkY012891; Thu, 5 Oct 2023 15:35:10 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:10 GMT Message-Id: <202310051535.395FZAkY012891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 363b7c39fbad - main - dwc: Move the dma reset code in dwc1000_dma.c List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 363b7c39fbad7c03f46e24bb4e435fad5cb56aa7 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=363b7c39fbad7c03f46e24bb4e435fad5cb56aa7 commit 363b7c39fbad7c03f46e24bb4e435fad5cb56aa7 Author: Emmanuel Vadot AuthorDate: 2023-10-04 05:55:11 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Move the dma reset code in dwc1000_dma.c No functional changes intended --- sys/dev/dwc/dwc1000_core.h | 1 + sys/dev/dwc/dwc1000_dma.c | 24 +++++++++++++++++++++++- sys/dev/dwc/dwc1000_dma.h | 1 + sys/dev/dwc/if_dwc.c | 21 +++++---------------- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/sys/dev/dwc/dwc1000_core.h b/sys/dev/dwc/dwc1000_core.h index cb7d1f3946e9..ade5270e25b1 100644 --- a/sys/dev/dwc/dwc1000_core.h +++ b/sys/dev/dwc/dwc1000_core.h @@ -34,6 +34,7 @@ int dwc1000_miibus_read_reg(device_t dev, int phy, int reg); int dwc1000_miibus_write_reg(device_t dev, int phy, int reg, int val); void dwc1000_miibus_statchg(device_t dev); void dwc1000_core_setup(struct dwc_softc *sc); +int dwc1000_core_reset(struct dwc_softc *sc); void dwc1000_enable_mac(struct dwc_softc *sc, bool enable); void dwc1000_enable_csum_offload(struct dwc_softc *sc); void dwc1000_setup_rxfilter(struct dwc_softc *sc); diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index cdfd24afd574..25916404bb63 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -61,7 +61,7 @@ #include #define WATCHDOG_TIMEOUT_SECS 5 - +#define DMA_RESET_TIMEOUT 100 /* TX descriptors - TDESC0 is almost unified */ #define TDESC0_OWN (1U << 31) @@ -598,6 +598,28 @@ dma1000_stop(struct dwc_softc *sc) WRITE4(sc, OPERATION_MODE, reg); } +int +dma1000_reset(struct dwc_softc *sc) +{ + uint32_t reg; + int i; + + reg = READ4(sc, BUS_MODE); + reg |= (BUS_MODE_SWR); + WRITE4(sc, BUS_MODE, reg); + + for (i = 0; i < DMA_RESET_TIMEOUT; i++) { + if ((READ4(sc, BUS_MODE) & BUS_MODE_SWR) == 0) + break; + DELAY(10); + } + if (i >= DMA_RESET_TIMEOUT) { + return (ENXIO); + } + + return (0); +} + /* * Create the bus_dma resources */ diff --git a/sys/dev/dwc/dwc1000_dma.h b/sys/dev/dwc/dwc1000_dma.h index 96a98c2d6d51..f0d22a67617f 100644 --- a/sys/dev/dwc/dwc1000_dma.h +++ b/sys/dev/dwc/dwc1000_dma.h @@ -46,6 +46,7 @@ int dma1000_init(struct dwc_softc *sc); void dma1000_free(struct dwc_softc *sc); void dma1000_start(struct dwc_softc *sc); void dma1000_stop(struct dwc_softc *sc); +int dma1000_reset(struct dwc_softc *sc); int dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp); void dma1000_txfinish_locked(struct dwc_softc *sc); void dma1000_rxfinish_locked(struct dwc_softc *sc); diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 0df99a7c205c..a3ce32c95cb9 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -78,8 +78,6 @@ #include "gpio_if.h" #include "miibus_if.h" -#define MAC_RESET_TIMEOUT 100 - static struct resource_spec dwc_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, @@ -499,7 +497,7 @@ dwc_attach(device_t dev) uint8_t macaddr[ETHER_ADDR_LEN]; struct dwc_softc *sc; if_t ifp; - int error, i; + int error; uint32_t reg; uint32_t txpbl, rxpbl, pbl; bool nopblx8 = false; @@ -581,19 +579,10 @@ dwc_attach(device_t dev) } /* Reset */ - reg = READ4(sc, BUS_MODE); - reg |= (BUS_MODE_SWR); - WRITE4(sc, BUS_MODE, reg); - - for (i = 0; i < MAC_RESET_TIMEOUT; i++) { - if ((READ4(sc, BUS_MODE) & BUS_MODE_SWR) == 0) - break; - DELAY(10); - } - if (i >= MAC_RESET_TIMEOUT) { - device_printf(sc->dev, "Can't reset DWC.\n"); - bus_release_resources(dev, dwc_spec, sc->res); - return (ENXIO); + if ((error = dma1000_reset(sc)) != 0) { + device_printf(sc->dev, "Can't reset DMA controller.\n"); + bus_release_resources(sc->dev, dwc_spec, sc->res); + return (error); } reg = BUS_MODE_USP; From nobody Thu Oct 5 15:35:11 2023 X-Original-To: dev-commits-src-main@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 4S1bGm17XVz4vncg; Thu, 5 Oct 2023 15:35:12 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGm045qz4dn9; Thu, 5 Oct 2023 15:35:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520112; 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=i3+8R8M/aN1UMQrr37msZDIKRYJnVeD4xTpD5Wm0+/4=; b=noUGRhAqveNnQa6oNY6ZxQjzAI7mfVCrFDXWRbI5g/9AtSr4e2ThzR4mXYhWrdKQo+n8JV dfhWqrpP3cPsa4a1jn2PecUrTMnziWeV+33MSzOeJILdx3ZEnv6kOa6XZXnzHjA/bDUUUz CiuAdVwDleUi1Pe6HO00sBm+t+XYXw2azNjrfddWVOJkGPc2CHkZE/aDe5zbfMShCJ6vh8 YYcVIaf44HVUbZ1b1IEFjPw02j8sXwuVPo6kk8BCmacY7tp+qETtu2kNR3bFezdScN9swk npia/cLgNteESYW56HugZ0y76nieO4RUMbIJHQSnTSjv1YjHIT65fBZy7VX0Tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520112; a=rsa-sha256; cv=none; b=illOik56hgssX/itRE7JqVq3jzIp6NAzL2qtWvkivP6YGv1+EorMP1SmwzDR9ev5EqKqAa y97INn7ttZPSGIZ+F70SrvESwIcXVmT+BiUjp5Nmc3vOu3JlXg7vBmbe9gpvEFLHu95wuo kiIy7QUj6SrpcLJNe2tvrx6aNMjsB4l9fZHeOcR6MRHn3AcbTQMaH4+8OPFTfVWurQProi 8FIBqysRdyMa5kpRCyzSlfCSKLjFCLu020Nr240LUvgKC5bc8ZH3YMhdzMBEwS+KuKdLIW U2m4c1POTPY+VBjmF+QOGVZ+MHVg/Eiz01wJ77WZ9B7sMWqepgWlLadJetZn5Q== 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=1696520112; 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=i3+8R8M/aN1UMQrr37msZDIKRYJnVeD4xTpD5Wm0+/4=; b=P2Ou+9ZCJ2xsOvu7rd5teik9JzgK9R9AytP9o+wrveJyri+Kmjadn68Gc0fnbL5CEQsluM NFBFk+xpYcMWMEDd0LbboVFq3oAHMnqcANgNJWMalDzNrBFbPitaF6XsqC/yXatsB5PSXt Oq4ebHRR+h7VlG3TQx+TLhxJ0BZegew3aTworXhfBeZuQRUghiNgCiy+UbnYzYoXmA61fh iSzS2eaxKWOMHVIQmMbKJq5MuKPVkLOXvXWEaXN86r5TeCdIefju86MbSqUXNs393rjr6c v0WYX6Snh4AKceN/qmiJW0ooFvsf6F5zQLg0YarNgUJ4FDMeoJyI7Jyj/Zlvsw== 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 4S1bGl5xnmz1Q70; Thu, 5 Oct 2023 15:35:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZB9Q012946; Thu, 5 Oct 2023 15:35:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZB05012943; Thu, 5 Oct 2023 15:35:11 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:11 GMT Message-Id: <202310051535.395FZB05012943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 5d88a52be44a - main - dwc: Move dma engine configuration to dwc1000_dma.c List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa commit 5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa Author: Emmanuel Vadot AuthorDate: 2023-10-04 16:19:26 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Move dma engine configuration to dwc1000_dma.c No functional changes intended. --- sys/dev/dwc/dwc1000_dma.c | 14 ++++++++++++++ sys/dev/dwc/if_dwc.c | 37 +++++++++---------------------------- sys/dev/dwc/if_dwcvar.h | 8 ++++++++ 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index 25916404bb63..16b2b2a3241d 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -632,6 +632,20 @@ dma1000_init(struct dwc_softc *sc) int nidx; int idx; + reg = BUS_MODE_USP; + if (!sc->nopblx8) + reg |= BUS_MODE_EIGHTXPBL; + reg |= (sc->txpbl << BUS_MODE_PBL_SHIFT); + reg |= (sc->rxpbl << BUS_MODE_RPBL_SHIFT); + if (sc->fixed_burst) + reg |= BUS_MODE_FIXEDBURST; + if (sc->mixed_burst) + reg |= BUS_MODE_MIXEDBURST; + if (sc->aal) + reg |= BUS_MODE_AAL; + + WRITE4(sc, BUS_MODE, reg); + /* * DMA must be stop while changing descriptor list addresses. */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index a3ce32c95cb9..0e18d57a4c23 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -498,12 +498,7 @@ dwc_attach(device_t dev) struct dwc_softc *sc; if_t ifp; int error; - uint32_t reg; - uint32_t txpbl, rxpbl, pbl; - bool nopblx8 = false; - bool fixed_burst = false; - bool mixed_burst = false; - bool aal = false; + uint32_t pbl; sc = device_get_softc(dev); sc->dev = dev; @@ -534,18 +529,18 @@ dwc_attach(device_t dev) if (OF_getencprop(sc->node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) pbl = BUS_MODE_DEFAULT_PBL; - if (OF_getencprop(sc->node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) - txpbl = pbl; - if (OF_getencprop(sc->node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) - rxpbl = pbl; + if (OF_getencprop(sc->node, "snps,txpbl", &sc->txpbl, sizeof(uint32_t)) <= 0) + sc->txpbl = pbl; + if (OF_getencprop(sc->node, "snps,rxpbl", &sc->rxpbl, sizeof(uint32_t)) <= 0) + sc->rxpbl = pbl; if (OF_hasprop(sc->node, "snps,no-pbl-x8") == 1) - nopblx8 = true; + sc->nopblx8 = true; if (OF_hasprop(sc->node, "snps,fixed-burst") == 1) - fixed_burst = true; + sc->fixed_burst = true; if (OF_hasprop(sc->node, "snps,mixed-burst") == 1) - mixed_burst = true; + sc->mixed_burst = true; if (OF_hasprop(sc->node, "snps,aal") == 1) - aal = true; + sc->aal = true; error = clk_set_assigned(dev, ofw_bus_get_node(dev)); if (error != 0) { @@ -585,20 +580,6 @@ dwc_attach(device_t dev) return (error); } - reg = BUS_MODE_USP; - if (!nopblx8) - reg |= BUS_MODE_EIGHTXPBL; - reg |= (txpbl << BUS_MODE_PBL_SHIFT); - reg |= (rxpbl << BUS_MODE_RPBL_SHIFT); - if (fixed_burst) - reg |= BUS_MODE_FIXEDBURST; - if (mixed_burst) - reg |= BUS_MODE_MIXEDBURST; - if (aal) - reg |= BUS_MODE_AAL; - - WRITE4(sc, BUS_MODE, reg); - if (dma1000_init(sc)) { bus_release_resources(dev, dwc_spec, sc->res); return (ENXIO); diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index 8a4b941297d0..2481b5c220bf 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -81,6 +81,14 @@ struct dwc_softc { hwreset_t rst_stmmaceth; hwreset_t rst_ahb; + /* DMA config */ + uint32_t txpbl; /* TX Burst lenght */ + uint32_t rxpbl; /* RX Burst lenght */ + bool nopblx8; + bool fixed_burst; + bool mixed_burst; + bool aal; + /* RX */ bus_dma_tag_t rxdesc_tag; bus_dmamap_t rxdesc_map; From nobody Thu Oct 5 15:35:12 2023 X-Original-To: dev-commits-src-main@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 4S1bGn2VZxz4vnNy; Thu, 5 Oct 2023 15:35:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGn10Wnz4dnM; Thu, 5 Oct 2023 15:35:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520113; 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=iBohuhs2sFnHoz3vFVR7Bh6ij6aRWUNEKwVmhNvUUfA=; b=AoZQVjuKbgfyBL+WPpYjtdglgK5WueEBs0wkxQOoZFfZM4m4k56PWxS9ml8tpd0l2HDSZp 38DIfCoFHkp6izAxECS+Uu7LCO4ESPbPr4N4S6TYSxZ2lnv/2h2cT1l+uqm7SuI1Fuyy+0 oiM98lgJmBeFELWx7yS20yi1nTCCN2KiXcP4WSMy7LJf8mWKU6QQVb1RUdz1BQCsfFfCGJ MPDs5eHTGH28SHMsTjvgWmg5DtVeWEjjZRQKPKNqo0Wcdx+P3ZwhjGdFku+DdiGRy3HtRO V4t7izEQvUyAfnSfcRHYxmfeoxkvdGo6ilhNRJhQ1dRNGWmli/tCNlyoXAGSdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520113; a=rsa-sha256; cv=none; b=QjPXVnjA2RaBew6uVEQAndob6Fbx5Qo777PDJC5sVuc8KUBOrcu7Ttk89eq281zu2aOzpz hGpaiMmjGgrS2zWZgSNRao1LlmPSaKBEYslLW+8xRPko+IKfJNk8FLMYghZYdwWtR/r0W3 e5A6gPH/I9FUwqi1NRZdpqtstEmRQA9iP6/pKgO4RWv9Q+3TIBCqmtvhcXu2Ka0zCUSU2G JO1eW+n98UGyPyTbBfr4vBa9hGn23v3D1JAOUOcny8K7+g314Du1ulQ1hx+g91i/OGKtzR x7mmlu95clBlPU9Lo5uFkNp/rxork8dVq8Aeo8l+ML7Y9OX3h6XyP14oxV3yPQ== 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=1696520113; 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=iBohuhs2sFnHoz3vFVR7Bh6ij6aRWUNEKwVmhNvUUfA=; b=KbgWCHnDTLq0A9o2wYGS5X7BIAQft0/dJbD6S7xlDM2peXwt96Sifo0f2nknQwbEOdzEWx YqS7iVyScuPHLUaPsXu+5bBgyco3WwoFqQaXJvoO/ncqX3G1pr8wUEAjfQMSYxOuY9m0ad LKnamr6ljQ2TtHv8vHcjyDis+ajLAoDp/dSTNBR46giuU7XdWJaXvhp1yJavo9+hxhq9Qf JH7Z/UoHc7wBG0jU0Hbn6GTnUMlOz03JjsUQhjXE5+LSNdGfWswq2SzWEEzuoDbxkWDj4Q SE7TlU8sj75m6hmuk1EFWLqXKzkEEJHjaS6ZkMLseAkLzWjJpWY9KLtb3xK8lw== 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 4S1bGm6vDjz1QCX; Thu, 5 Oct 2023 15:35:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZCmB013000; Thu, 5 Oct 2023 15:35:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZCZO012997; Thu, 5 Oct 2023 15:35:12 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:12 GMT Message-Id: <202310051535.395FZCZO012997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 801fb66a7e34 - main - dwc: Do not re-invent phy mode type List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 801fb66a7e34c340f23d82f2b375feee4bd87df4 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=801fb66a7e34c340f23d82f2b375feee4bd87df4 commit 801fb66a7e34c340f23d82f2b375feee4bd87df4 Author: Emmanuel Vadot AuthorDate: 2023-10-04 16:29:11 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Do not re-invent phy mode type Directly uses the MII_CONTYPE_* No functional changes intended. --- sys/dev/dwc/dwc1000_reg.h | 5 ----- sys/dev/dwc/if_dwc.c | 8 ++------ sys/dev/dwc/if_dwc_aw.c | 9 +++++++-- sys/dev/dwc/if_dwc_rk.c | 24 ++++++++++++++++-------- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/sys/dev/dwc/dwc1000_reg.h b/sys/dev/dwc/dwc1000_reg.h index 1f0957b688ac..40ba8156ea5d 100644 --- a/sys/dev/dwc/dwc1000_reg.h +++ b/sys/dev/dwc/dwc1000_reg.h @@ -34,11 +34,6 @@ #ifndef __DWC1000_REG_H__ #define __DWC1000_REG_H__ -#define PHY_MODE_UNKNOWN 0x0 -#define PHY_MODE_RMII 0x1 -#define PHY_MODE_RGMII 0x2 -#define PHY_MODE_MII 0x3 - #define MAC_CONFIGURATION 0x0 #define CONF_JD (1 << 22) /* jabber timer disable */ #define CONF_BE (1 << 21) /* Frame Burst Enable */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 0e18d57a4c23..58e4d3cd5a6b 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -509,18 +509,14 @@ dwc_attach(device_t dev) sc->mactype = IF_DWC_MAC_TYPE(dev); sc->node = ofw_bus_get_node(dev); - switch (mii_fdt_get_contype(sc->node)) { + sc->phy_mode = mii_fdt_get_contype(sc->node); + switch (sc->phy_mode) { case MII_CONTYPE_RGMII: case MII_CONTYPE_RGMII_ID: case MII_CONTYPE_RGMII_RXID: case MII_CONTYPE_RGMII_TXID: - sc->phy_mode = PHY_MODE_RGMII; - break; case MII_CONTYPE_RMII: - sc->phy_mode = PHY_MODE_RMII; - break; case MII_CONTYPE_MII: - sc->phy_mode = PHY_MODE_MII; break; default: device_printf(dev, "Unsupported MII type\n"); diff --git a/sys/dev/dwc/if_dwc_aw.c b/sys/dev/dwc/if_dwc_aw.c index e6cf30f91fc3..5ad1d14b385b 100644 --- a/sys/dev/dwc/if_dwc_aw.c +++ b/sys/dev/dwc/if_dwc_aw.c @@ -36,6 +36,8 @@ #include +#include + #include #include @@ -76,10 +78,13 @@ a20_if_dwc_init(device_t dev) /* Configure PHY for MII or RGMII mode */ switch(sc->phy_mode) { - case PHY_MODE_RGMII: + case MII_CONTYPE_RGMII: + case MII_CONTYPE_RGMII_ID: + case MII_CONTYPE_RGMII_RXID: + case MII_CONTYPE_RGMII_TXID: tx_parent_name = "gmac_int_tx"; break; - case PHY_MODE_MII: + case MII_CONTYPE_MII: tx_parent_name = "mii_phy_tx"; break; default: diff --git a/sys/dev/dwc/if_dwc_rk.c b/sys/dev/dwc/if_dwc_rk.c index d05352a27793..51edd2450b42 100644 --- a/sys/dev/dwc/if_dwc_rk.c +++ b/sys/dev/dwc/if_dwc_rk.c @@ -38,6 +38,8 @@ #include #include +#include + #include #include @@ -175,7 +177,7 @@ rk3328_set_delays(struct if_dwc_rk_softc *sc) uint32_t reg; uint32_t tx, rx; - if (sc->base.phy_mode != PHY_MODE_RGMII) + if (!mii_contype_is_rgmii(sc->base.phy_mode)) return; reg = SYSCON_READ_4(sc->grf, RK3328_GRF_MAC_CON0); @@ -210,7 +212,10 @@ rk3328_set_speed(struct if_dwc_rk_softc *sc, int speed) uint32_t reg; switch (sc->base.phy_mode) { - case PHY_MODE_RGMII: + case MII_CONTYPE_RGMII: + case MII_CONTYPE_RGMII_ID: + case MII_CONTYPE_RGMII_RXID: + case MII_CONTYPE_RGMII_TXID: switch (speed) { case IFM_1000_T: case IFM_1000_SX: @@ -230,7 +235,7 @@ rk3328_set_speed(struct if_dwc_rk_softc *sc, int speed) SYSCON_WRITE_4(sc->grf, RK3328_GRF_MAC_CON1, ((MAC_CON1_GMAC2IO_GMII_CLK_SEL_MASK << 16) | reg)); break; - case PHY_MODE_RMII: + case MII_CONTYPE_RMII: switch (speed) { case IFM_100_TX: reg = MAC_CON1_GMAC2IO_RMII_CLK_SEL_25 | @@ -260,12 +265,15 @@ rk3328_set_phy_mode(struct if_dwc_rk_softc *sc) { switch (sc->base.phy_mode) { - case PHY_MODE_RGMII: + case MII_CONTYPE_RGMII: + case MII_CONTYPE_RGMII_ID: + case MII_CONTYPE_RGMII_RXID: + case MII_CONTYPE_RGMII_TXID: SYSCON_WRITE_4(sc->grf, RK3328_GRF_MAC_CON1, ((MAC_CON1_GMAC2IO_INTF_SEL_MASK | MAC_CON1_GMAC2IO_RMII_MODE_MASK) << 16) | MAC_CON1_GMAC2IO_INTF_RGMII); break; - case PHY_MODE_RMII: + case MII_CONTYPE_RMII: SYSCON_WRITE_4(sc->grf, sc->integrated_phy ? RK3328_GRF_MAC_CON2 : RK3328_GRF_MAC_CON1, ((MAC_CON1_GMAC2IO_INTF_SEL_MASK | MAC_CON1_GMAC2IO_RMII_MODE_MASK) << 16) | MAC_CON1_GMAC2IO_INTF_RMII | MAC_CON1_GMAC2IO_RMII_MODE); @@ -286,7 +294,7 @@ rk3399_set_delays(struct if_dwc_rk_softc *sc) { uint32_t reg, tx, rx; - if (sc->base.phy_mode != PHY_MODE_RGMII) + if (!mii_contype_is_rgmii(sc->base.phy_mode)) return; reg = SYSCON_READ_4(sc->grf, RK3399_GRF_SOC_CON6); @@ -416,7 +424,7 @@ if_dwc_rk_init_clocks(device_t dev) /* Optional clock */ clk_get_by_ofw_name(dev, 0, "clk_mac_speed", &sc->clk_mac_speed); - if (sc->base.phy_mode == PHY_MODE_RMII) { + if (sc->base.phy_mode == MII_CONTYPE_RMII) { if (clk_get_by_ofw_name(dev, 0, "mac_clk_rx", &sc->mac_clk_rx) != 0) { device_printf(sc->base.dev, "could not get mac_clk_rx clock\n"); sc->mac_clk_rx = NULL; @@ -448,7 +456,7 @@ if_dwc_rk_init_clocks(device_t dev) } } - if (sc->base.phy_mode == PHY_MODE_RMII) { + if (sc->base.phy_mode == MII_CONTYPE_RMII) { if (sc->mac_clk_rx) clk_enable(sc->mac_clk_rx); if (sc->clk_mac_ref) From nobody Thu Oct 5 15:35:13 2023 X-Original-To: dev-commits-src-main@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 4S1bGp5vfkz4vnP1; Thu, 5 Oct 2023 15:35:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGp1ny0z4dqr; Thu, 5 Oct 2023 15:35:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520114; 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=V6ih19D3QBtOVksL6MXu3NjhtpNj/4MjAsVgDMf2WY0=; b=K1Q7fFSFpOfrZyxE+bXMErhG5CyY8Tzob7eoO5WwJjzn6oYoOl19gQ7PM/c8nG1lxgc5Vf 0YNCfxQSjSN61Q0hXr8IGAf6AyyBuzs9E5I1giy8B1jjk4B8dQIQ60JNTPb53sTQRDEkGa /hUbFeJtZJjyijCYJUGleKDXDVlhg3wQkPeOhCjTir7Am1xglUFKUjArD/5WbhIDz6uwiy wjmBJohmgiUrdHA2faCLCQc1jZFw37nt6j6tb8ZWYaE9KU8IzcHZ6WnOT9tGOB4+HBoWWa Parlue+yHsZ8orkz/iKS3KcbFfvR8hvzUY6o9RhNOPilnaqJbrYULZGmqFkdvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520114; a=rsa-sha256; cv=none; b=TI0vFP4VVALXRVHseKAs8gFDzdFhZK+YtM+3csBPDOq222q9bP2p/mBytVHfIiGw1gkpTV 0dpPQU1FaacIcPXUQwpLX3u1cKXnzPCsDjJVf1Ij9Kl4GeaDy36b7AYfeP/4gIOfDzezF9 mPaxXbZTQeJ/WYd1lM/7GcakJ4SQqHN2hSFoRj5LqZYDy0w/kE4PLjKgCo+htZCAtfezvK EssP+EzwTt8YUyKAQ5uxhVxR9hdw6F85pOtao96f5g5MBVp+2fuNrQKHFRLMrdhJNqTijo M83gINgjqBTzPr9DsQI07WDSwoWm0MbuD2UO6THqJnEGTKKHtBGB15R9joOh0w== 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=1696520114; 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=V6ih19D3QBtOVksL6MXu3NjhtpNj/4MjAsVgDMf2WY0=; b=ZeqdNsdboRU3sDFCe0tTtbezMgf2b1BMSwipJwxz/bippzs0c+11gN2NRxxl8Fo9FmLDCj j4Gwt++cCjQCqnuOU7KVIdtElDvVrT7ZIxB6J043lhRzNf5WdTXWLrvGLYlXNy5hL/NT+O MM5M/5VAoAanXrXNm9JbqDAXTX8JsBdJ3Ng4SEuNKBbs+XknYTE6gq0jQrp5KmxIE/QSYO bFHXc0ppn0iv9bfddg3m2R376z3Snoeb75CmRD4h7G4mvRD6EVY/yevRM//nCJQw5S/WKI 5Pj02fiLYqRYryQu9NvaPTJq4BlvLOO/90RmhO4GvXJnGGI6JDrs/DkT5m7PNw== 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 4S1bGp0rbyz1QJl; Thu, 5 Oct 2023 15:35:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZDMh013042; Thu, 5 Oct 2023 15:35:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZDRH013039; Thu, 5 Oct 2023 15:35:13 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:13 GMT Message-Id: <202310051535.395FZDRH013039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: cef444d068ff - main - dwc: Move BUS_MODE_DEFAULT_PBL; in if_dwcvar.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cef444d068ff95e51d2b1c60a60cde632764c7b3 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=cef444d068ff95e51d2b1c60a60cde632764c7b3 commit cef444d068ff95e51d2b1c60a60cde632764c7b3 Author: Emmanuel Vadot AuthorDate: 2023-10-04 18:21:24 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Move BUS_MODE_DEFAULT_PBL; in if_dwcvar.h And rename it to DMA_DEFAULT_PBL, this is the default for all (most ?) dma engine that dwc should support. While here stop including dwc1000_reg.h in if_dwc.c, we don't need it anymore. No functional changes intended. --- sys/dev/dwc/dwc1000_reg.h | 1 - sys/dev/dwc/if_dwc.c | 3 +-- sys/dev/dwc/if_dwcvar.h | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/dwc/dwc1000_reg.h b/sys/dev/dwc/dwc1000_reg.h index 40ba8156ea5d..768da530bf7c 100644 --- a/sys/dev/dwc/dwc1000_reg.h +++ b/sys/dev/dwc/dwc1000_reg.h @@ -226,7 +226,6 @@ #define BUS_MODE_PRIORXTX_11 0 #define BUS_MODE_PBL_SHIFT 8 /* Single block transfer size */ #define BUS_MODE_SWR (1 << 0) /* Reset */ -#define BUS_MODE_DEFAULT_PBL 8 #define TRANSMIT_POLL_DEMAND 0x1004 #define RECEIVE_POLL_DEMAND 0x1008 #define RX_DESCR_LIST_ADDR 0x100C diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 58e4d3cd5a6b..9e17d67d434d 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -70,7 +70,6 @@ #include #include -#include #include #include @@ -524,7 +523,7 @@ dwc_attach(device_t dev) } if (OF_getencprop(sc->node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) - pbl = BUS_MODE_DEFAULT_PBL; + pbl = DMA_DEFAULT_PBL; if (OF_getencprop(sc->node, "snps,txpbl", &sc->txpbl, sizeof(uint32_t)) <= 0) sc->txpbl = pbl; if (OF_getencprop(sc->node, "snps,rxpbl", &sc->rxpbl, sizeof(uint32_t)) <= 0) diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index 2481b5c220bf..ca0a91d6bf12 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -48,6 +48,8 @@ #define TX_DESC_SIZE (sizeof(struct dwc_hwdesc) * TX_DESC_COUNT) #define TX_MAP_MAX_SEGS 32 +#define DMA_DEFAULT_PBL 8 + struct dwc_bufmap { bus_dmamap_t map; struct mbuf *mbuf; From nobody Thu Oct 5 15:35:15 2023 X-Original-To: dev-commits-src-main@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 4S1bGq3Rfvz4vnX8; Thu, 5 Oct 2023 15:35:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGq2Rdwz4dyq; Thu, 5 Oct 2023 15:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520115; 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=blrq6vEuZl9xhk5SH2C/0TuhPHpkEyTp1dhghMXgnjc=; b=EQ9pwr42l7VDg9Z+qqg2wkDfYETcLutVd5aWSmwU+1Ei3FaY0/cOGSzBZx6l5z6j7V+6w6 c2qPkfGRQmd3IQM1o74ckxigjB+N4BTgxZdCgaY83iFgx1mEZZYxIOwtRtz8lC9zoF/ytv jbS6d7pdL131cj0vpmyBTgVP0WkyZPqwZS1Fd1efZsfPgOmdUYhO3Sap+UICL1mpkT1Hsx a6X1z7oFzHHZvZD+SnJGs1gVDOmEVWb/5OlDfL5C2YPfWv+ajuKevodiswoVGknjvOXqx4 Z1UmCv9HmbIIOWChq8CTtY1d45IpaDRGegV9yNdB+qTHwyD+jSzfYneZ3hGtbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520115; a=rsa-sha256; cv=none; b=XnA7oxmhDrz4lPnZnJRge2xomCRIBQm6JFHUL84nzFLqnUpa57aGsprxnQdZ8Z9ahbRshv 4d2Nx8uw4QC4PxsZyTL7EnKIASa0+tLAFvH/fo+6G87AZkK4jtyrp3ou2w5ZJili4RpUIY exmQtWAM2fcLX0K1CbficqiMYzUhFr6SOR25ju7YgWC+YHwYzptIC5TVpKRFLjVZnBUiDD /fZBnZJNPh0cmebcl0YA5m6wDLC+vujT0JXUDmqai10Teh2lf6x+PUVY2HuvB7kmnAGz79 crZeshbfskA3HekbO3T3i6v1tgizNHlC/vTFp2zEc2BUZSpAUc0Za+KfO0Tchg== 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=1696520115; 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=blrq6vEuZl9xhk5SH2C/0TuhPHpkEyTp1dhghMXgnjc=; b=sVDCFaqPu4y9YwgE6kVjQUxuYO1yrZroOsd/wVSMNJFdSdAmM7eOFJIPDemrBSXqw4DHaW CVdkwPshZJ+UeVGoDlhvVO2dQL8N/sJKN9oSz0gaWBAQoYFOQ/6xks04r6TOfdQRUQqgox RrMVcr2uX7Y/+fc90xucEDi4RXpRRiBY0RJ6pED/5ePcuMCGiHb7i7MJA2Hyj3OKy2XO4a CN4LV568KtlNMy5gLqAc+roiWj5oj92C4+8uOrxto84uZ/ygQzvO/2yFFJ/2VBg/ls0tyJ 4gXd/BQIsZOKmz0ymxxKHRatWPVXrG/6BtEpb5YZNyE3CNFXWI5/rQnmjz3lGw== 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 4S1bGq1NYRz1Q71; Thu, 5 Oct 2023 15:35:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZFxf013078; Thu, 5 Oct 2023 15:35:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZFJG013075; Thu, 5 Oct 2023 15:35:15 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:15 GMT Message-Id: <202310051535.395FZFJG013075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 4b7975ecdc36 - main - dwc: Remove if_dwc_mac_type List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b7975ecdc3631beac717d4addc71006cdc665c5 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=4b7975ecdc3631beac717d4addc71006cdc665c5 commit 4b7975ecdc3631beac717d4addc71006cdc665c5 Author: Emmanuel Vadot AuthorDate: 2023-10-04 19:10:47 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:40 +0000 dwc: Remove if_dwc_mac_type This doesn't represent the mac_type but if the DMA engine support extended descriptors. Read the HW_FEATURE register to learn if the DMA engine supports it. No functional changes intended. --- sys/dev/dwc/dwc1000_core.c | 14 +++++++++++--- sys/dev/dwc/dwc1000_dma.c | 12 ++++++++---- sys/dev/dwc/dwc1000_reg.h | 2 ++ sys/dev/dwc/if_dwc.c | 1 - sys/dev/dwc/if_dwc_aw.c | 8 -------- sys/dev/dwc/if_dwc_if.m | 13 ------------- sys/dev/dwc/if_dwc_rk.c | 8 -------- sys/dev/dwc/if_dwc_socfpga.c | 8 -------- sys/dev/dwc/if_dwcvar.h | 2 +- 9 files changed, 22 insertions(+), 46 deletions(-) diff --git a/sys/dev/dwc/dwc1000_core.c b/sys/dev/dwc/dwc1000_core.c index 6cf836f87be2..872d1a488454 100644 --- a/sys/dev/dwc/dwc1000_core.c +++ b/sys/dev/dwc/dwc1000_core.c @@ -281,7 +281,11 @@ dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); /* Take lower 8 bits and reverse it */ val = bitreverse(~crc & 0xff); - if (ctx->sc->mactype != DWC_GMAC_EXT_DESC) + /* + * TODO: There is probably a HW_FEATURES bit which isn't + * related to the extended descriptors that describe this + */ + if (!ctx->sc->dma_ext_desc) val >>= 2; /* Only need lower 6 bits */ hashreg = (val >> 5); hashbit = (val & 31); @@ -302,7 +306,11 @@ dwc1000_setup_rxfilter(struct dwc_softc *sc) DWC_ASSERT_LOCKED(sc); ifp = sc->ifp; - nhash = sc->mactype != DWC_GMAC_EXT_DESC ? 2 : 8; + /* + * TODO: There is probably a HW_FEATURES bit which isn't + * related to the extended descriptors that describe this + */ + nhash = sc->dma_ext_desc == false ? 2 : 8; /* * Set the multicast (group) filter hash. @@ -335,7 +343,7 @@ dwc1000_setup_rxfilter(struct dwc_softc *sc) WRITE4(sc, MAC_ADDRESS_LOW(0), lo); WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); WRITE4(sc, MAC_FRAME_FILTER, ffval); - if (sc->mactype != DWC_GMAC_EXT_DESC) { + if (!sc->dma_ext_desc) { WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]); WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]); } else { diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index 16b2b2a3241d..7c5924296894 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -201,7 +201,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr, desc1 = 0; --sc->tx_desccount; } else { - if (sc->mactype != DWC_GMAC_EXT_DESC) { + if (!sc->dma_ext_desc) { desc0 = 0; desc1 = NTDESC1_TCH | len | flags; if (first) @@ -233,7 +233,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr) nidx = next_rxidx(sc, idx); sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr + (nidx * sizeof(struct dwc_hwdesc)); - if (sc->mactype != DWC_GMAC_EXT_DESC) + if (!sc->dma_ext_desc) sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | MIN(MCLBYTES, NRDESC1_RBS1_MASK); else @@ -282,12 +282,12 @@ dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp) if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) { if ((m->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) != 0) { - if (sc->mactype != DWC_GMAC_EXT_DESC) + if (!sc->dma_ext_desc) flags = NTDESC1_CIC_FULL; else flags = ETDESC0_CIC_FULL; } else { - if (sc->mactype != DWC_GMAC_EXT_DESC) + if (!sc->dma_ext_desc) flags = NTDESC1_CIC_HDR; else flags = ETDESC0_CIC_HDR; @@ -646,6 +646,10 @@ dma1000_init(struct dwc_softc *sc) WRITE4(sc, BUS_MODE, reg); + reg = READ4(sc, HW_FEATURE); + if (reg & HW_FEATURE_EXT_DESCRIPTOR) + sc->dma_ext_desc = true; + /* * DMA must be stop while changing descriptor list addresses. */ diff --git a/sys/dev/dwc/dwc1000_reg.h b/sys/dev/dwc/dwc1000_reg.h index 768da530bf7c..f581bf135cd8 100644 --- a/sys/dev/dwc/dwc1000_reg.h +++ b/sys/dev/dwc/dwc1000_reg.h @@ -275,7 +275,9 @@ #define CURRENT_HOST_RECEIVE_DESCR 0x104C #define CURRENT_HOST_TRANSMIT_BUF_ADDR 0x1050 #define CURRENT_HOST_RECEIVE_BUF_ADDR 0x1054 + #define HW_FEATURE 0x1058 +#define HW_FEATURE_EXT_DESCRIPTOR (1 << 24) #define DWC_GMAC_NORMAL_DESC 0x1 #define DWC_GMAC_EXT_DESC 0x2 diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 9e17d67d434d..ffcf3e8d6afd 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -505,7 +505,6 @@ dwc_attach(device_t dev) sc->tx_desccount = TX_DESC_COUNT; sc->tx_mapcount = 0; sc->mii_clk = IF_DWC_MII_CLK(dev); - sc->mactype = IF_DWC_MAC_TYPE(dev); sc->node = ofw_bus_get_node(dev); sc->phy_mode = mii_fdt_get_contype(sc->node); diff --git a/sys/dev/dwc/if_dwc_aw.c b/sys/dev/dwc/if_dwc_aw.c index 5ad1d14b385b..6419c9dedca8 100644 --- a/sys/dev/dwc/if_dwc_aw.c +++ b/sys/dev/dwc/if_dwc_aw.c @@ -122,13 +122,6 @@ a20_if_dwc_init(device_t dev) return (0); } -static int -a20_if_dwc_mac_type(device_t dev) -{ - - return (DWC_GMAC_NORMAL_DESC); -} - static int a20_if_dwc_mii_clk(device_t dev) { @@ -140,7 +133,6 @@ static device_method_t a20_dwc_methods[] = { DEVMETHOD(device_probe, a20_if_dwc_probe), DEVMETHOD(if_dwc_init, a20_if_dwc_init), - DEVMETHOD(if_dwc_mac_type, a20_if_dwc_mac_type), DEVMETHOD(if_dwc_mii_clk, a20_if_dwc_mii_clk), DEVMETHOD_END diff --git a/sys/dev/dwc/if_dwc_if.m b/sys/dev/dwc/if_dwc_if.m index 0d0d9ee114f7..aea61579946e 100644 --- a/sys/dev/dwc/if_dwc_if.m +++ b/sys/dev/dwc/if_dwc_if.m @@ -36,12 +36,6 @@ CODE { return (0); } - static int - if_dwc_default_mac_type(device_t dev) - { - return (DWC_GMAC_EXT_DESC); - } - static int if_dwc_default_mii_clk(device_t dev) { @@ -65,13 +59,6 @@ METHOD int init { device_t dev; } DEFAULT if_dwc_default_init; -# -# Return the DWC MAC type (descriptor type). -# -METHOD int mac_type { - device_t dev; -} DEFAULT if_dwc_default_mac_type; - # # Return the DWC MII clock for a specific hardware. # diff --git a/sys/dev/dwc/if_dwc_rk.c b/sys/dev/dwc/if_dwc_rk.c index 51edd2450b42..43d4e4847c62 100644 --- a/sys/dev/dwc/if_dwc_rk.c +++ b/sys/dev/dwc/if_dwc_rk.c @@ -578,13 +578,6 @@ if_dwc_rk_init(device_t dev) return (0); } -static int -if_dwc_rk_mac_type(device_t dev) -{ - - return (DWC_GMAC_NORMAL_DESC); -} - static int if_dwc_rk_mii_clk(device_t dev) { @@ -610,7 +603,6 @@ static device_method_t if_dwc_rk_methods[] = { DEVMETHOD(device_probe, if_dwc_rk_probe), DEVMETHOD(if_dwc_init, if_dwc_rk_init), - DEVMETHOD(if_dwc_mac_type, if_dwc_rk_mac_type), DEVMETHOD(if_dwc_mii_clk, if_dwc_rk_mii_clk), DEVMETHOD(if_dwc_set_speed, if_dwc_rk_set_speed), diff --git a/sys/dev/dwc/if_dwc_socfpga.c b/sys/dev/dwc/if_dwc_socfpga.c index 7b4ead1a940c..867c09109d2a 100644 --- a/sys/dev/dwc/if_dwc_socfpga.c +++ b/sys/dev/dwc/if_dwc_socfpga.c @@ -75,13 +75,6 @@ if_dwc_socfpga_init(device_t dev) return (0); } -static int -if_dwc_socfpga_mac_type(device_t dev) -{ - - return (DWC_GMAC_EXT_DESC); -} - static int if_dwc_socfpga_mii_clk(device_t dev) { @@ -100,7 +93,6 @@ static device_method_t dwc_socfpga_methods[] = { DEVMETHOD(device_probe, if_dwc_socfpga_probe), DEVMETHOD(if_dwc_init, if_dwc_socfpga_init), - DEVMETHOD(if_dwc_mac_type, if_dwc_socfpga_mac_type), DEVMETHOD(if_dwc_mii_clk, if_dwc_socfpga_mii_clk), DEVMETHOD_END diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index ca0a91d6bf12..e21e256852fa 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -61,7 +61,6 @@ struct dwc_softc { struct resource *res[2]; device_t dev; phandle_t node; - int mactype; int mii_clk; device_t miibus; struct mii_data * mii_softc; @@ -90,6 +89,7 @@ struct dwc_softc { bool fixed_burst; bool mixed_burst; bool aal; + bool dma_ext_desc; /* RX */ bus_dma_tag_t rxdesc_tag; From nobody Thu Oct 5 15:38:57 2023 X-Original-To: dev-commits-src-main@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 4S1bM65Vwcz4vpDg; Thu, 5 Oct 2023 15:38:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bM62CYPz3HbT; Thu, 5 Oct 2023 15:38:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520338; 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=zzX+5QNqqZydB62/gSyt/XIqhVpdL4NKvfK3QOmFcK8=; b=ggHL1CLTO+3DAtw+0OrDQs5fnZJc4/6jn4VtKaOol46WYOV/vLRwB3uRBautR5XDKU/S6D cas4JJizP0vIz/EoaKoCw3Z72XH0WVGVN0emlbkGUOGVgAk6fYDm1txmp8tk+0fQRUHrMD oCdCYD97sEIqutyg9ugmqYDxQTtrEPAWTvcqUrnsY+s3rIGxlDbxPrx3v5b1oErqwU0Zro v2KdHcE6Xo/vdMGqjq1RnuzgOjLulKnJmcJZoHSBJBDdDUUIk1nQFyTiIjPkUf3ZFYv97j +6WVmZMTg1OiUN8LQtyp15nCQnsWDWjD6f18QrCVVrqd4Nhl15KXRopBw0GtFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520338; a=rsa-sha256; cv=none; b=eQTJxVrpYQkhhTqZsmAqrr8gmpnKZsYrHhD+VJGVfbazEZ469WVTW6fy8QkFQ6VRP6mxOI bEnrKvxx2pfm4s7DlOUilc1Bv1D3iecdBr1wnyuUwaX5Jh1P2I6wnIfRr+PxnhThelpcxA hCkyDWXiTJO3abYlS1HbhMEVd6le8g70meHqFd51mB84kMooZ6Wvp2DvTk0hemyktGN2L9 lrXXQN4qLg5FsypdN2rag0TUiq8U8sBiuFfLjD9WL0ts8HFyvPpnGECqoy/0qBluYUx9jq FYogrPZlwPHQ3qEau3NpZTe8aCpOjvt73CJcR/I7ikRyTNp/XGaNP8zvp5satQ== 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=1696520338; 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=zzX+5QNqqZydB62/gSyt/XIqhVpdL4NKvfK3QOmFcK8=; b=KH8MPnEa3nFjAbj/BPBQabXmRWV6QnhbCG1ejdEF+Miwgk0gJXzLETtwptPm64uv67BPpp q6QTaY43s4KcK6/twxYB2tpfKqZTxnTtZ2d6MlEdgxpowCq0nIQFVGalgIecMznXvmsLiz hO+jlNJmbtZCksjwM2g0Milcj5rZoTUEFbNauoMoll4clY/W2lO4RJwczWqkHnM+3n34c7 Dbpb9sZPvqTP5JTWPKYV/omrDAJ8q0HIIX8t+tzVjr34DfNHgINXfs5oGRCNdduVZF60Nj pF2gQ1D6foqW3BHqWNtnwXJNr7mplWrbU6cpBfN5mv+2NmXkS0D+7xJ02838Qg== 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 4S1bM6148Zz1PqZ; Thu, 5 Oct 2023 15:38:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FcvDp013778; Thu, 5 Oct 2023 15:38:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FcvR0013775; Thu, 5 Oct 2023 15:38:57 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:38:57 GMT Message-Id: <202310051538.395FcvR0013775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 25fcf889bd7d - main - bsdconfig: remove even more of the ftp support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25fcf889bd7d46fa0d1524073e38b3883a97f9c9 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=25fcf889bd7d46fa0d1524073e38b3883a97f9c9 commit 25fcf889bd7d46fa0d1524073e38b3883a97f9c9 Author: Baptiste Daroussin AuthorDate: 2023-10-05 15:37:21 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 15:37:39 +0000 bsdconfig: remove even more of the ftp support --- usr.sbin/bsdconfig/share/packages/index.subr | 3 --- 1 file changed, 3 deletions(-) diff --git a/usr.sbin/bsdconfig/share/packages/index.subr b/usr.sbin/bsdconfig/share/packages/index.subr index bd29b882d0d9..34c40d6905ab 100644 --- a/usr.sbin/bsdconfig/share/packages/index.subr +++ b/usr.sbin/bsdconfig/share/packages/index.subr @@ -90,9 +90,6 @@ f_index_initialize() case "$__type" in $DEVICE_TYPE_DIRECTORY) __site="file://$__data/packages/$PKG_ABI" ;; - $DEVICE_TYPE_FTP) - f_getvar $VAR_FTP_PATH __site - __site="$__site/packages/$PKG_ABI" ;; $DEVICE_TYPE_HTTP) f_getvar $VAR_HTTP_PATH __site __site="$__site/$PKG_ABI/latest" ;; From nobody Thu Oct 5 16:11:16 2023 X-Original-To: dev-commits-src-main@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 4S1c4N3lV2z4vvKs; Thu, 5 Oct 2023 16:11:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1c4N3DcZz3Rsq; Thu, 5 Oct 2023 16:11:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696522276; 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=OiJ7pc/J4ZnQmR9TPvQoWCug/9x4F+LoI93Yb1yUlaA=; b=LT2rneizug+lAn2SjpM+p0ZnfenAJmkuPgBRLEqD4u454HA2dd0sZbVoRWSQUHho23JN1W 9HKCti2KyfV/lsOOShqhIraYSZLg7gevi5tre7tJSngbWnI/gL6JcOdiCqy1I6wXnXTkPp N27KwQzGvbovvR4q63DWvUk2LRqyLB4UI6wgFfsWBGyDIx6n+Kym0S+P057PrFufmoTJMM rYPM3uFCFk/GCJqa/byJYWh7TQgcsQGNcAroJKMcYiPXQrGNC+qr4q2eM45WoPkgAi4dqa GOtL9XlL6Ou/Yl4pxtaUuOPwZ0RRzLetCsCtYFzLv3UBVDOp20da+ZQWEAPVZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696522276; a=rsa-sha256; cv=none; b=wGLSykwYXSjQbFhDE4ndolBmR0MEVQPdfXQge0FBK9ryrymjdDcSXutw9cgARVKhGNuCms wJko11cXLE380WZPlp2HcngySlnJcn9vTAVB71Ta7lq1y8N+rhuuZ1N6/cbL76r3Q8w120 t9UjtG2xQENbm/ZnQ+5oSvheWZPWnLiOvxjqc8Y2tDMXExPQ7JnRyqU/ccJzbu9B++VSFr tmU2qWMJpq+2PeNcgiQ/qjGyZDQoGgQDmTTXiO4TQBaCVYyjhDCpGWVAlUUevcHXw3WcQw flEWefVSL7Or928vQrUAg3UpeUi2vtrzlI9xdj1rfwBlTFmNUdY2hfsd9nWhoQ== 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=1696522276; 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=OiJ7pc/J4ZnQmR9TPvQoWCug/9x4F+LoI93Yb1yUlaA=; b=eUncZdJ//DmAKwAvwSL7n09qx6efa87j9e6hnl6lNNjZfotp9OVLep3ZdYA7uqLUgSGBm+ ZQvLgqhPGD/OGM8iOyPRmBZ7SVqImfil31bGo7KeuKPpWe6KcKydnEyjgMV2ApemJYexVl zEemp3HFgzW145TTKnIWaUZRRVmPT5l/gU3y6tMz2F90t7VG/I/Lby1SfibM/2BGB8REdW ytSvzo13SzBaR0ozWClzkJF86bqTpQyMyKrvJ5CT4kXUQVL31X8zA+SzDHHoBD5fJyHR0c WHLvAss+3GzUOlocptRR8WMEeOoZjXrN+rHeXAOU+ms1Oo4CqvxHEV8LAOMfWw== 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 4S1c4N2Dt1z1Qsj; Thu, 5 Oct 2023 16:11:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395GBGC9078009; Thu, 5 Oct 2023 16:11:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395GBGOQ078006; Thu, 5 Oct 2023 16:11:16 GMT (envelope-from git) Date: Thu, 5 Oct 2023 16:11:16 GMT Message-Id: <202310051611.395GBGOQ078006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: b00dbe851c66 - main - pf: fix SCTP SDT probe List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b00dbe851c66f26a16219d31c76b7fb411ace94c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b00dbe851c66f26a16219d31c76b7fb411ace94c commit b00dbe851c66f26a16219d31c76b7fb411ace94c Author: Kristof Provost AuthorDate: 2023-10-05 14:57:50 +0000 Commit: Kristof Provost CommitDate: 2023-10-05 15:53:13 +0000 pf: fix SCTP SDT probe We want the return value of pf_test_rule(), i.e. the result of the evaluation of the new state, not the result of the evaluation of the original packet/state. MFC after: 1 week Sponsored by: Orange Business Services --- sys/netpfil/pf/pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index fae0bd2854f9..3dddfdd0b1a4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -5943,7 +5943,7 @@ pf_sctp_multihome_delayed(struct pf_pdesc *pd, int off, struct pfi_kkif *kif, ret = pf_test_rule(&r, &sm, kif, j->m, off, &j->pd, &ra, &rs, NULL); PF_RULES_RUNLOCK(); - SDT_PROBE4(pf, sctp, multihome, test, kif, r, j->m, action); + SDT_PROBE4(pf, sctp, multihome, test, kif, r, j->m, ret); if (sm) { /* Inherit v_tag values. */ sm->src.scrub->pfss_v_tag = s->src.scrub->pfss_flags; From nobody Thu Oct 5 16:15:15 2023 X-Original-To: dev-commits-src-main@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 4S1c901CXqz4vw0Z; Thu, 5 Oct 2023 16:15:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1c900mpQz3SHV; Thu, 5 Oct 2023 16:15:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696522516; 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=tEZermLQkHYy8GLPVHF3HeaJmhJHrhzCrsaOEx9igLQ=; b=FHpNmMJ7PRrB0XNQD6CrEBJlYzKkFGXChBMvu9zh9Svo9EGMV+oiVcIuENZKfmTrjnbGsY waHMoLaZTNlmpZgzrzY5XY7b8SK876wszGgYtxOSyGEOgsCJiDj4tWSdd3Yx/HbowaMdS8 8Tq6Mgl60juoq+GEUTO0zdQlVmexXwdw/W6Pkhk+XkbxY0glEurmR/FWuJYZqlJ9olTLbH iVz03hDE73KbCwGIEz3nLpJFDzlqBqx3IOovo7Cmi9GFCgMxcmgWUzTWCONW1g2C+V1pgp kN0ms/cG73dGSDXoDSRZkHUjp7EaUXPBglE9XT34fv9g1AIxeqJRbPECCnwLFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696522516; a=rsa-sha256; cv=none; b=iEqQ37vWW2h1fxqUlddCPVZasfifQ6AhLoXaX75Ubn1hAeMeC2iNbg5gJnMZZq37KgyvcL neihhYp/xDEN2R9f5+gfRq41BLd6k99ShzcxQB0AnFvODuTkTaHIuJ1Xop13V1hbzoDryn k8tcvGIt5pIllgsZW8Gmkk4VYjv8kM07pKU7G76LiLFW+nKUlkviV1ADTaETGmIe+yfgKN ZCnfFqNPGWn8RJnUQtcFjYyD16nFSSAT6lXHM369UNbE8CdY+y0SEsAAdYclO1s4U6XFSL chTE9HVhW6s85j0K+8zcbxjGmeb0jRI9AHwpfHvfiSdeik4WmpOUJ+JJ8cfm3A== 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=1696522516; 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=tEZermLQkHYy8GLPVHF3HeaJmhJHrhzCrsaOEx9igLQ=; b=Y+GyH3ZATgwLeaGQz1qRCVcAYMeBTuBLDILfZ9XGAuILt/kyEPJSc6hVIywcppyOZ+d1od KHsL7ITmy8Xud6YQnZqXL+YNHfkEhyIt+36ZqJ0vHpDP67nPwG8MZR34OcWgp5NcJ+eJBN pmmrnZxvoXNkY7ftHep9SC7Quq9XbJsqBjPIZgNCpd6HsGohUouI0CFJAOznqjKWkLZMtL mhehQDNri/FljyHStihRo1TAbaZBDSfuyvCHR+5eSyKDcBqGRfxxfHdNunysYyFl2EcxXu XvYXOM2MCb5Iia/EedM/4TO2Tlaw+LchUkQt2G0GVFHJr3ndUxM5NxmkP9VNVQ== 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 4S1c8z6t8pz1QtR; Thu, 5 Oct 2023 16:15:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395GFFER081636; Thu, 5 Oct 2023 16:15:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395GFF4b081633; Thu, 5 Oct 2023 16:15:15 GMT (envelope-from git) Date: Thu, 5 Oct 2023 16:15:15 GMT Message-Id: <202310051615.395GFF4b081633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 6a773a0582ba - main - fusefs: add more readdir tests for misbehaving servers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a773a0582ba936cc19734b21ee5a7bed49cfdec Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=6a773a0582ba936cc19734b21ee5a7bed49cfdec commit 6a773a0582ba936cc19734b21ee5a7bed49cfdec Author: Alan Somers AuthorDate: 2023-10-05 16:13:05 +0000 Commit: Alan Somers CommitDate: 2023-10-05 16:15:03 +0000 fusefs: add more readdir tests for misbehaving servers Inspired by PR 274268 MFC after: 2 weeks Sponsored by: Axcient --- tests/sys/fs/fusefs/readdir.cc | 87 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/tests/sys/fs/fusefs/readdir.cc b/tests/sys/fs/fusefs/readdir.cc index 5fd8f25e8bb7..6b78e3a70697 100644 --- a/tests/sys/fs/fusefs/readdir.cc +++ b/tests/sys/fs/fusefs/readdir.cc @@ -321,6 +321,50 @@ TEST_F(Readdir, nodots) leakdir(dir); } +/* + * FUSE_READDIR returns a path with an embedded NUL. Obviously illegal, but + * nothing bad should happen. + */ +TEST_F(Readdir, nul) +{ + const char FULLPATH[] = "mountpoint/some_dir"; + const char RELPATH[] = "some_dir"; + uint64_t ino = 42; + DIR *dir; + struct dirent *de; + vector ents(1); + vector empty_ents(0); + const char nul[] = "foo\0bar"; + + expect_lookup(RELPATH, ino); + expect_opendir(ino); + ents[0].d_fileno = 4; + ents[0].d_off = 4000; + ents[0].d_namlen = sizeof(nul); + ents[0].d_type = DT_REG; + strncpy(ents[0].d_name, nul, ents[0].d_namlen); + expect_readdir(ino, 0, ents); + expect_readdir(ino, 4000, empty_ents); + + errno = 0; + dir = opendir(FULLPATH); + ASSERT_NE(nullptr, dir) << strerror(errno); + + errno = 0; + de = readdir(dir); + ASSERT_NE(nullptr, de) << strerror(errno); + EXPECT_EQ(4ul, de->d_fileno); + EXPECT_EQ(DT_REG, de->d_type); + EXPECT_EQ(sizeof(nul), de->d_namlen); + EXPECT_EQ(0, strcmp(nul, de->d_name)); + + ASSERT_EQ(nullptr, readdir(dir)); + ASSERT_EQ(0, errno); + + leakdir(dir); +} + + /* telldir(3) and seekdir(3) should work with fuse */ TEST_F(Readdir, seekdir) { @@ -397,6 +441,49 @@ TEST_F(Readdir, seekdir) leakdir(dir); } +/* + * FUSE_READDIR returns a path with an embedded /. Obviously illegal, but + * nothing bad should happen. + */ +TEST_F(Readdir, slash) +{ + const char FULLPATH[] = "mountpoint/some_dir"; + const char RELPATH[] = "some_dir"; + uint64_t ino = 42; + DIR *dir; + struct dirent *de; + vector ents(1); + vector empty_ents(0); + const char foobar[] = "foo/bar"; + + expect_lookup(RELPATH, ino); + expect_opendir(ino); + ents[0].d_fileno = 4; + ents[0].d_off = 4000; + ents[0].d_namlen = sizeof(foobar); + ents[0].d_type = DT_REG; + strncpy(ents[0].d_name, foobar, ents[0].d_namlen); + expect_readdir(ino, 0, ents); + expect_readdir(ino, 4000, empty_ents); + + errno = 0; + dir = opendir(FULLPATH); + ASSERT_NE(nullptr, dir) << strerror(errno); + + errno = 0; + de = readdir(dir); + ASSERT_NE(nullptr, de) << strerror(errno); + EXPECT_EQ(4ul, de->d_fileno); + EXPECT_EQ(DT_REG, de->d_type); + EXPECT_EQ(sizeof(foobar), de->d_namlen); + EXPECT_EQ(0, strcmp(foobar, de->d_name)); + + ASSERT_EQ(nullptr, readdir(dir)); + ASSERT_EQ(0, errno); + + leakdir(dir); +} + TEST_F(Readdir_7_8, nodots) { const char FULLPATH[] = "mountpoint/some_dir"; From nobody Thu Oct 5 17:02:56 2023 X-Original-To: dev-commits-src-main@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 4S1dD11lmdz4w3wB; Thu, 5 Oct 2023 17:02:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1dD11H6kz3YMl; Thu, 5 Oct 2023 17:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696525377; 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=F/RkckI/aZKR/Xg5QmMWs4ZdVexTzYQAP/Zefhp+gvY=; b=kV1vOtM+SE0u+qKzae7Fxl8N/iTd4aswp7MrGyh2YTSmudXiPNQKr2xk6sTVT9D9/FT8x3 qebmGx97dmyJfTDhreGeht6nTzHHX0568YwIvBCDkf5f91gUoX151GR4nM0Lnokg3KY87J sk7Np2G1Hbwsg268x19mSnLbKaQZ25KoBrRVpQz5hd9gVdw45c2fU4uzKrG9LyndOWjvIl ZYjIUWS6YuHaRHCjnIc7KLEKIA+xYvMHSHyBM2vDMSG9JoW8SPlraajOxq9h9MeoMLoYj3 KR93EYz5twNyzFkRvB0B/30xWdbAqFvaoVpyjyL/LNp/sSt4Mtcacd0b3WZBFQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696525377; a=rsa-sha256; cv=none; b=LjKkoVfEBVe7k7WTtsNTy0dGgYJi8emjYf5evIqis5KhDVRej1p0v35bV4w+PFjJwCGpeL pxT8g8PTHQeQHkq0BkU8VJL4xUmuKmkGr/exMcNCZcEeKVjNzl+LPWasDJY9SnHPDHzE5S ZYmLvY5jbEsoR30cF7qXT/SRdnZcsObqKWQi7WRXBNM/to6KqQ2HxAcjY3EngrUMda/8oi ygVC4KzArtX8x9qbC0A2w9/4kptq/IsfzPLugCiXbAAJ78a9ENSmAir3HOY2iUbipIzwuF D1gvSQiJmu8o4yjWkK+KcLC2Ye7ZMPwJhLARr0LSd/3oBpZPTNYONsSU9VYJRw== 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=1696525377; 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=F/RkckI/aZKR/Xg5QmMWs4ZdVexTzYQAP/Zefhp+gvY=; b=R++Gpcb05wxbrMAzTWIrMmNeq18ORMi2RW6m32ZRi9N/4JbVoOv4FXxazTKQS6BmVXcrmW NLCaRJ6HEzeW74+PUS3Frs3jgZm+h4fluwCljzVZ2MH7ZBeZBpo0ZJJw3EcwC0zRMUm4il XHcrBBuICwvBuqZAscTtmqaXUCxlS6dQNvbVZa1VPruFU+QKOciF+CPfxydKDE5VfaBkLW qthxKhz4nUZWlV86Fsur4ELQZ4QNR+WGBT1yo09oh6yW69izRwDgHxnStGjdsooTp5PEiY Evj0Y1ljxs0mjrAEjYAi7CQftdHzB9ZIM7JpqJ8/M+i1oiG0pigGdanQk5L7ag== 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 4S1dD10Lgbz1Rsk; Thu, 5 Oct 2023 17:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395H2u62065257; Thu, 5 Oct 2023 17:02:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395H2uP2065254; Thu, 5 Oct 2023 17:02:56 GMT (envelope-from git) Date: Thu, 5 Oct 2023 17:02:56 GMT Message-Id: <202310051702.395H2uP2065254@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b911f504005d - main - dwc: if_dwc_aw: Include net/if_media.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b911f504005df67f8c25f9b2f817c16588cd309c Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b911f504005df67f8c25f9b2f817c16588cd309c commit b911f504005df67f8c25f9b2f817c16588cd309c Author: Emmanuel Vadot AuthorDate: 2023-10-05 16:59:56 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 17:00:55 +0000 dwc: if_dwc_aw: Include net/if_media.h Needed my miivar.h Fixes: 6b73554e3e9b ("dwc: Do not re-invent phy mode type") --- sys/dev/dwc/if_dwc_aw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/dwc/if_dwc_aw.c b/sys/dev/dwc/if_dwc_aw.c index 6419c9dedca8..4b2735cd07cf 100644 --- a/sys/dev/dwc/if_dwc_aw.c +++ b/sys/dev/dwc/if_dwc_aw.c @@ -33,6 +33,7 @@ #include #include +#include #include From nobody Thu Oct 5 17:52:09 2023 X-Original-To: dev-commits-src-main@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 4S1fJn4cVvz4wCTB; Thu, 5 Oct 2023 17:52:09 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1fJn4QwFz4FHr; Thu, 5 Oct 2023 17:52:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696528329; 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=Cfx++HyOMK1g6mVR/vUnc5TO9o5fM5M2or2XQUirkII=; b=E8RkpnsYZ1FFYI66rgQMZK40Mzp5HCOIBrzu0nZ/4GlrCreCZdAHlDm2W+Ozt2CV/RZzJE gKJPBzaQnIxgT7MI34Y1srlTlxZmelNpI934/UPkczqTXTJE6BVyxlJUyhfzZ61rvo5MXg qspMp8Im5yPjlcyzujPk3V0bnlrUJtpSzquyEylDxA4h9Vxjs82uc5/qBjKUkjAtYBrAji yIZqYRE/PoQhYTjzCX1ZHg2YmVcBCQx6e+Ypj7QGRdwz88iOLthYECUvydW/yd+V+ubJP0 AwPH+fXbGPakFd0nCn8gq78qRxAM+UJ6yx7Gn+VtM9MlnusY1wXSEUitsiRylA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696528329; a=rsa-sha256; cv=none; b=yv3N9GEy0h/2d5nGmETxikfJ3BjxvLy/Z1hc1qpv6IlXwX71xcdISbId1xSUzFxV0gpOP9 TR8Zdqso/4JnmiRsVCd6T2hh61ZSr19fK7zF9rmTFskn37uuTfitMlvJMj9rEQvhFpcsPu PawFEc3Kxqn2KF6BVrYtBIDPgnYRwn/WHqSUXzHAG/owPrh2n/fmJ3kRPVnlDLPmNv2xr1 d3+jQpmr92EcSyU5yhwqHbMo91fPgjtanjHHoDcxCRAZB3M3Oqlt9PeQh2ajLau+uQl17p 34sZkMkRuHc1qn6UI1uVECLiUg2dcSizbJF/cNGDlt48CuDp69NyFBSXfBrgSQ== 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=1696528329; 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=Cfx++HyOMK1g6mVR/vUnc5TO9o5fM5M2or2XQUirkII=; b=pl2C1I4/UhNkSgF4BDGyLmzIATGCy+1EWLxFEXMjTJUdYQwupOQ2Uq2/lNVg+3VzD3NnWH /SRfh2+irPwSeCX8kocZAGJKqA34rIXF4yRlxonqSnWAwM6YKVTAJ2dncioc2PXWx7hlmD F1144oaF3LbVO37t+3sV5IchWWxbwb6X5HiZR8QiWAFP6W+5B+345hEzZUdm5qCgXXDuzd 0JkpPrPGl9fpTwtf5K19WuAmM7UsytYbqvzKx36afPLOVAVfF4uGR/iyj0A6RcUET5mypD C/m8evbQBKJn//bI6kCJ5xg0+GPoHFZrKUcohIpsxInrpkXN3BZUlOl/NUj1eA== 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 4S1fJn3VWGz19Q; Thu, 5 Oct 2023 17:52:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395Hq98O043911; Thu, 5 Oct 2023 17:52:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395Hq9sh043908; Thu, 5 Oct 2023 17:52:09 GMT (envelope-from git) Date: Thu, 5 Oct 2023 17:52:09 GMT Message-Id: <202310051752.395Hq9sh043908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b6a61ac2d475 - main - Add mitigations(7) describing our vulnerability mitigations List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b6a61ac2d475fba9c45f7f407549a522f60dea18 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b6a61ac2d475fba9c45f7f407549a522f60dea18 commit b6a61ac2d475fba9c45f7f407549a522f60dea18 Author: Ed Maste AuthorDate: 2023-09-08 17:49:11 +0000 Commit: Ed Maste CommitDate: 2023-10-05 17:50:54 +0000 Add mitigations(7) describing our vulnerability mitigations This is an initial take on documenting vulnerability mitigations. Reviewed by: gbe (earlier) Sponsored by: The FreeBSD Foundation Co-authored-by: Olivier Certner Differential Revision: https://reviews.freebsd.org/D41794 --- share/man/man7/mitigations.7 | 349 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) diff --git a/share/man/man7/mitigations.7 b/share/man/man7/mitigations.7 new file mode 100644 index 000000000000..8023f094d678 --- /dev/null +++ b/share/man/man7/mitigations.7 @@ -0,0 +1,349 @@ +.\" Copyright © 2023 The FreeBSD Foundation +.\" +.\" This documentation was written by Ed Maste , and +.\" Olivier Certner at Kumacom SAS, under +.\" sponsorship of the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd October 5, 2023 +.Dt MITIGATIONS 7 +.Os +.Sh NAME +.Nm mitigations +.Nd FreeBSD Security Vulnerability Mitigations +.Sh SYNOPSIS +In +.Fx , +various security mitigations are employed to limit the impact of +vulnerabilities and protect the system from malicious attacks. +Some of these mitigations have run-time controls to enable them on a global +or per-process basis, some are optionally enabled or disabled at compile time, +and some are inherent to the implementation and have no controls. +.Pp +The following vulnerability mitigations are covered in this document: +.Bl -bullet -compact +.It +Address Space Layout Randomization (ASLR) +.It +Position Independent Executable (PIE) +.It +Write XOR Execute page protection policy +.It +.Dv PROT_MAX +".It +"Read-Only Relocation (RELRO) +.\".It +.\"Bind Now +.\".It +.\"Stack Smashing Protection (SSP) +.\".It +.\"Supervisor Mode Memory Protection +.It +Hardware Vulnerability Mitigation Controls +.It +Capsicum +.El +.Pp +Please note that the effectiveness and availability of these mitigations may +vary depending on the +.Fx +version and system configuration. +.Sh DESCRIPTION +Security vulnerability mitigations are techniques employed in +.Fx +to limit the potential impact of security vulnerabilities in software and +hardware. +It is essential to understand that mitigations do not directly address the +underlying security issues. +They are not a substitute for secure coding practices. +Mitigations serve as an additional layer of defense, helping to reduce the +likelihood of a successful exploitation of vulnerabilities by making it +more difficult for attackers to achieve their objectives. +.Pp +This manual page describes the security mitigations implemented in +.Fx +to enhance the overall security of the operating system. +Each mitigation is designed to protect against specific types of attacks +and vulnerabilities. +.\" +.Sh SOFTWARE VULNERABILITY MITIGATIONS +.Ss Address Space Layout Randomization (ASLR) +Address Space Layout Randomization (ASLR) is a security mitigation technique +that works by randomizing the memory addresses where system and application +code, data, and libraries are loaded, making it more challenging for attackers +to predict the memory layout and exploit vulnerabilities. +.Pp +ASLR introduces randomness into the memory layout during process execution, +reducing the predictability of memory addresses. +ASLR is intended to make exploitation more difficult in the event that an +attacker discovers a software vulnerability, such as a buffer overflow. +.Pp +ASLR can be enabled on both a global and per-process basis. +Global control is provided by a separate set of +.Xr sysctl 8 +knobs for 32- and 64-bit processes. +It can be or disabled on a per-process basis via +.Xr proccontrol 1 . +Note that an ASLR mode change takes effect upon address space change, +i.e., upon +.Xr execve 2 . +.Pp +Global controls for 32-bit processes: +.Bl -tag -width kern.elf32.aslr.pie_enable +.It Va kern.elf32.aslr.enable +Enable ASLR for 32-bit ELF binaries, other than Position Independent +Exectutable (PIE) binaries. +.It Va kern.elf32.aslr.pie_enable +Enable ASLR for 32-bit Position Independent Executable (PIE) ELF binaries. +.It Va kern.elf32.aslr.honor_sbrk +Reserve the legacy +.Xr sbrk 2 +region for compatibility with older binaries. +.It Va kern.elf32.aslr.stack +If ASLR is enabled for a process, also randomize the stack location. +.El +.Pp +Global controls for 64-bit processes: +.Bl -tag -width kern.elf64.aslr.pie_enable +.It Va kern.elf64.aslr.enable +Enable ASLR for 64-bit ELF binaries, other than Position Independent +Exectutable (PIE) binaries. +.It Va kern.elf64.aslr.pie_enable +Enable ASLR for 64-bit Position Independent Executable (PIE) ELF binaries. +.It Va kern.elf64.aslr.honor_sbrk +Reserve the legacy +.Xr sbrk 2 +region for compatibility with older binaries. +.It Va kern.elf64.aslr.stack +If ASLR is enabled for a process, also randomize the stack location. +.El +.Pp +To execute a command with ASLR enabled or disabled: +.Pp +proccontrol +.Fl m Ar aslr +.Op Fl s Ar enable | disable +.Ar command +.\" +.Ss Position Independent Executable (PIE) +PIE binaries are executable files that do not have a fixed load address. +They can be loaded at an arbitrary memory address by the +.Xr rtld +run-time linker. +With ASLR they are loaded at a random address on each execution. +.\" +.Ss Write XOR Execute page protection policy +Write XOR Execute (W^X) is a vulnerability mitigation strategy that strengthens +the security of the system by controlling memory access permissions. +.Pp +Under the W^X mitigation, memory pages may be writable (W) or executable (E), +but not both at the same time. +This means that code execution is prevented in areas of memory that are +designated as writable, and writing or modification of memory is restricted in +areas marked for execution. +Applications that perform Just In Time (JIT) compilation need to be adapted +to be compatible with W^X. +.Pp +There are separate +.Xr sysctl 8 +knobs to control W^X policy enforcement for 32- and 64-bit processes. +The W^X policy is enabled by setting the appropriate +.Dv allow_wx +sysctl to 0. +.Bl -tag -width kern.elf64.allow_wx +.It Va kern.elf32.allow_wx +Allow 32-bit processes to map pages simultaneously writable and executable. +.It Va kern.elf64.allow_wx +Allow 64-bit processes to map pages simultaneously writable and executable. +.El +.\" +.Ss PROT_MAX +.Dv PROT_MAX +is a FreeBSD-specific extension to +.Xr mmap 2 . +.Dv PROT_MAX +provides the ability to set the maximum protection of a region allocated by +.Xr mmap +and later altered by +.Xr mprotect . +For example, memory allocated originally with an mmap prot argument of +PROT_MAX(PROT_READ | PROT_WRITE) | PROT_READ +may be made writable by a future +.Xr mprotect +call, but may not be made executable. +.\" +.\".Ss Read-Only Relocation (RELRO) +.\" +.Ss BIND_NOW +The +.Va WITH_BIND_NOW +.Xr src.conf 5 +build-time option causes binaries to be built with the +.Dv DF_BIND_NOW +flag set. +The run-time loader +.Xr rtld 1 +will then perform all relocation processing when the process starts, instead of +on demand (on the first access to each symbol). +When enabled in combination with +.Dv RELRO +(which is enabled by default) this provides +.Qt full +RELRO, the entire GOT (.got and .got.plt) are made read-only at program startup, +preventing attacks on the relocation table. +Note that this results in a nonstandard Application Binary Interface (ABI), +and it is possible that some applications may not function correctly. +.\" +.\".Ss Stack Smashing Protection (SSP) +.\" +.\".Ss Supervisor mode memory protection +.\" +.Ss Hardware vulnerability controls +See +.Xr security 7 +for more information. +.\" +.Ss Capsicum +Capsicum is a lightweight OS capability and sandbox framework. +See +.Xr capsicum 4 +for more information. +.Pp +.Sh HARDWARE VULNERABILITY MITIGATIONS +Recent years have seen an unending stream of new hardware vulnerabilities, +notably CPU ones generally caused by detectable microarchitectural side-effects +of speculative execution which leak private data from some other thread or +process or sometimes even internal CPU state that is normally inaccessible. +Hardware vendors usually address these vulnerabilities as they are discovered by +releasing microcode updates, which may then be bundled into platform firmware +updates +.Pq historically called BIOS updates for PCs . +.Pp +The best defense overall against hardware vulnerabilities is to timely apply +these updates when available and to disable the affected hardware's problematic +functionalities when possible (e.g., CPU Simultaneous Multi-Threading). +Software mitigations are only partial substitutes for these, but they can be +helpful on out-of-support hardware or as complements for just-discovered +vulnerabilities not yet addressed by vendors. +Some software mitigations depend on hardware capabilities provided by a +microcode update. +.Pp +FreeBSD's usual policy is to apply by default all OS-level mitigations that do +not require recompilation, except those the particular hardware it is running on +is known not to be vulnerable to +.Pq which sometimes requires firmware updates , +or those that are extremely detrimental to performance in proportion to the +protection they actually provide. +OS-level mitigations generally can have noticeable performance impacts on +specific workloads. +If your threat model allows it, you may want to try disabling some of them in +order to possibly get better performance. +Conversely, minimizing the risks may require you to explicitly enable the most +expensive ones. +The description of each vulnerability/mitigation indicates whether it is enabled +or disabled by default and under which conditions. +It also lists the knobs to tweak to force a particular status. +.Ss Zenbleed +The +.Dq Zenbleed +vulnerability exclusively affects AMD processors based on the Zen2 +microarchitecture. +In contrast with, e.g., Meltdown and the different variants of Spectre, which +leak data by leaving microarchitectural traces, Zenbleed is a genuine hardware +bug affecting the CPU's architectural state. +With particular sequences of instructions whose last ones are mispredicted by +speculative execution, it is possible to make appear in an XMM register data +previously put in some XMM register by some preceding or concurrent task +executing on the same physical core +.Po disabling Simultaneous Muti-Threading +.Pq SMT +is thus not a sufficient protection +.Pc . +.Pp +According to the vulnerability's discoverer, all Zen2-based processors are +affected +.Po see +.Lk https://lock.cmpxchg8b.com/zenbleed.html +.Pc . +As of August 2023, AMD has not publicly listed any corresponding errata but has +issued a security bulletin +.Pq AMD-SB-7008 +entitled +.Dq Cross-Process Information Leak +indicating that platform firmware fixing the vulnerability will be distributed +to manufacturers no sooner than the end of 2023, except for Rome processors for +which it is already available. +No standalone CPU microcodes have been announced so far. +The only readily-applicable fix mentioned by the discoverer is to set a bit of +an undocumented MSR, which reportedly completely stops XMM register leaks. +.Pp +.Fx +currently sets this bit by default on all Zen2 processors. +In the future, it might set it by default only on those Zen2 processors whose +microcode has not been updated to revisions fixing the vulnerability, once such +microcode updates have been actually released and community-tested. +To this mitigation are associated the following knobs: +.Bl -tag -width indent +.It Va machdep.mitigations.zenbleed.enable +A read-write integer tunable and sysctl indicating whether the mitigation should +be forcibly disabled (0), enabled (1) or if it is left to +.Fx +to selectively apply it (2). +Any other integer value is silently converted to and treated as value 2. +Note that this setting is silently ignored when running on non-Zen2 processors +to ease applying a common configuration to heterogeneous machines. +.It Va machdep.mitigations.zenbleed.state +A read-only string indicating the current mitigation state. +It can be either +.Dq Not applicable , +if the processor is not Zen2-based, +.Dq Mitigation enabled +or +.Dq Mitigation disabled . +This state is automatically updated each time the sysctl +.Va machdep.mitigations.zenbleed.enable +is written to. +Note that it can become inaccurate if the chicken bit is set or cleared +directly via +.Xr cpuctl 4 +.Po which includes the +.Xr cpucontrol 8 +utility +.Pc . +.El +.Pp +The performance impact and threat models related to these mitigations +should be considered when configuring and deploying them in a +.Fx +system. +.Pp +.Sh SEE ALSO +.Xr elfctl 1 , +.Xr proccontrol 1 , +.Xr rtld 1 , +.Xr mmap 2 , +.Xr src.conf 5 , +.Xr sysctl.conf 5 , +.Xr security 7 , +.Xr cpucontrol 8 , +.Xr sysctl 8 From nobody Thu Oct 5 18:27:30 2023 X-Original-To: dev-commits-src-main@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 4S1g5f5WtBz4wJGw; Thu, 5 Oct 2023 18:27:34 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1g5f3FrZz4JX4; Thu, 5 Oct 2023 18:27:34 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; none Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTPS id oPwyqeZQBmfesoT4PqNBRk; Thu, 05 Oct 2023 18:27:33 +0000 Received: from spqr.komquats.com ([70.66.152.170]) by cmsmtp with ESMTPSA id oT4NqepX1Zru0oT4OqjPL2; Thu, 05 Oct 2023 18:27:33 +0000 X-Authority-Analysis: v=2.4 cv=CpOsz10D c=1 sm=1 tr=0 ts=651f0015 a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17 a=8nJEP1OIZ-IA:10 a=bhdUkHdE2iEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=pMndMITy2tz2_I68OK0A:9 a=wPNLvfGTeEIA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 422683B4; Thu, 5 Oct 2023 11:27:31 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 0F365134; Thu, 5 Oct 2023 11:27:31 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Ed Maste cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b6a61ac2d475 - main - Add mitigations(7) describing our vulnerability mitigations In-reply-to: <202310051752.395Hq9sh043908@gitrepo.freebsd.org> References: <202310051752.395Hq9sh043908@gitrepo.freebsd.org> Comments: In-reply-to Ed Maste message dated "Thu, 05 Oct 2023 17:52:09 +0000." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Thu, 05 Oct 2023 11:27:30 -0700 Message-Id: <20231005182731.0F365134@slippy.cwsent.com> X-CMAE-Envelope: MS4xfNKoDCF9LGBgNB9CbYlIopXlU50/6XXOVpiqY4iTJvI1liW7pRZJtYs+fZoGDVogVitMNxLHC/7jKJzHBMdh4jOuUr5FoUwNjNuutQaSSCyXJeDwOUuU ZH9CBQ4VEXj4NW2PIChmek7j1hpl0fm5HFVmK678LobOpyWnqF0CZ0zrP9CECNLzvZpNV4FP+dvkdn5ZkemgxBRFJidpM3+vtji34GVQnvfWD1pT09B8mEX/ GA/DAHMmU6jeQ6NPr6zfUYLUJmiLoFqD3ZCaf6lZ3M+lmMtMIPuCfuSWGa/JUimVnbUOZr5afvo6TjcxH5OgS3aqRALYrBp75wrWpyktjAA= X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US] X-Rspamd-Queue-Id: 4S1g5f3FrZz4JX4 In message <202310051752.395Hq9sh043908@gitrepo.freebsd.org>, Ed Maste writes: > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b6a61ac2d475fba9c45f7f407549a522 > f60dea18 > > commit b6a61ac2d475fba9c45f7f407549a522f60dea18 > Author: Ed Maste > AuthorDate: 2023-09-08 17:49:11 +0000 > Commit: Ed Maste > CommitDate: 2023-10-05 17:50:54 +0000 > > Add mitigations(7) describing our vulnerability mitigations > > This is an initial take on documenting vulnerability mitigations. > > Reviewed by: gbe (earlier) > Sponsored by: The FreeBSD Foundation > Co-authored-by: Olivier Certner > Differential Revision: https://reviews.freebsd.org/D41794 > --- > share/man/man7/mitigations.7 | 349 +++++++++++++++++++++++++++++++++++++++++ This would be a good MFC candidate. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=0 From nobody Fri Oct 6 01:50:19 2023 X-Original-To: dev-commits-src-main@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 4S1rwW6D3tz4wZ11; Fri, 6 Oct 2023 01:50:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1rwW5lLWz4J55; Fri, 6 Oct 2023 01:50:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696557019; 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=QNpnCQ0UO91uouLDRsMVYOHBpviKE14JNZ5cEydRHeY=; b=GG1swYXJiSvIqRJvZ3It9dg5ur6S4JmvKnJNDEKATrMgpgKmisbyxbQm5H2HN0HgWT8gDU 17RAWKESBAFSlblzY7oV88YF8BZzsFGCdp8DuXc1UjgSRA3Rc/v8JOCxW55dizxf0rOI2Y JmkbjOVBa7SA1/nFfEpcI9swL8ScZqjivgtxXL5vjy4JiE+G+OBZnhq2Y7MyGiUudVpbpS x85LhUwqjJEuqvgHSAhnj0rn82aG53LwdurwPL/uSKnAdZIlGNFvuILkey41emPKenGdw5 zHCzysKhKVvzlVuczpMUsyPJNEHRAEOtabuaQDzbqsF3NFPS053oOMPiw6aasA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696557019; a=rsa-sha256; cv=none; b=Je/cs+/wV++a+DO+i3ZRrJBki1gQqOioNTspOQEJ6IJrvwhfxCNFsSXHnDiY/dhDbcnNbh UAEtEtbR3GdBblxd7DYP3hnLfOcomD2/e++3Ps5aVD5aNbYSKKZ4TicK6S84lj7EW9yBAs CRi5Pw4p92xk8+Hgvf77/M8iXfFR2Z+nONjxZlG+oq3EF3+N/UNum0PsTvdcVacBrijqCG KpDir0csHO3/W/DileBP2Bxa/+manXuiO/wcf8xL5qizG9p36YcMy/nyA31ZudNAt+QDgH G3BTFJcixTS+pnx5w4+c0hMa7FEFHMzuHp6Dkn5OAfEU/A+XR6ilABh8FeJEEQ== 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=1696557019; 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=QNpnCQ0UO91uouLDRsMVYOHBpviKE14JNZ5cEydRHeY=; b=XsgRMO8AtEhlCiA0litxt37FnQv0vEWeTFBksbFvlR5EnoKHE+8DOaPvdBjrsxD8+I9Pk1 2zGdPgHy9YyeObuG0OKmui/gJTgtwUI3gLcpNBgoUZRIScQbbpK5wyOBFgUgbKApoOEbHJ aofUSrhw2YJs2MIBFD/1TELiStv8zWZS1IR7c/3FxleGHY1hc2/GTWTUDfbXPlu9Ag5orZ bAa/DX4YxPpaUDRBfRSM2YRX7cLyxQHTWjqg7k3oXBnWlK9DPKxy0ubv2jjaPDM/Cnmkuq LOEffFb2nHBhxIca1RzwGGzrhdWxLgDjwbqTbNDi1XkTWZniHvaxItoClDEVMw== 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 4S1rwW4qPtzTZQ; Fri, 6 Oct 2023 01:50:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3961oJEW035831; Fri, 6 Oct 2023 01:50:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3961oJEq035828; Fri, 6 Oct 2023 01:50:19 GMT (envelope-from git) Date: Fri, 6 Oct 2023 01:50:19 GMT Message-Id: <202310060150.3961oJEq035828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 6e5dcc6113da - main - Connect mitigations(7) to the build List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e5dcc6113da649a79e5bc2c3ea9329bcd1d85d5 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6e5dcc6113da649a79e5bc2c3ea9329bcd1d85d5 commit 6e5dcc6113da649a79e5bc2c3ea9329bcd1d85d5 Author: Ed Maste AuthorDate: 2023-10-05 17:55:36 +0000 Commit: Ed Maste CommitDate: 2023-10-06 01:48:27 +0000 Connect mitigations(7) to the build Also add some cross references. Sponsored by: The FreeBSD Foundation --- share/man/man7/Makefile | 1 + share/man/man7/security.7 | 3 ++- usr.bin/elfctl/elfctl.1 | 4 +++- usr.bin/proccontrol/proccontrol.1 | 5 +++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/share/man/man7/Makefile b/share/man/man7/Makefile index 43d37fa33275..11246195201c 100644 --- a/share/man/man7/Makefile +++ b/share/man/man7/Makefile @@ -19,6 +19,7 @@ MAN= arch.7 \ hostname.7 \ intro.7 \ maclabel.7 \ + mitigations.7 \ operator.7 \ orders.7 \ ports.7 \ diff --git a/share/man/man7/security.7 b/share/man/man7/security.7 index 6d6742fca0bb..a48e3607f0e5 100644 --- a/share/man/man7/security.7 +++ b/share/man/man7/security.7 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 18, 2023 +.Dd October 5, 2023 .Dt SECURITY 7 .Os .Sh NAME @@ -1101,6 +1101,7 @@ Enables mapping of simultaneously writable and executable pages for .Xr xdm 1 Pq Pa ports/x11/xorg-clients , .Xr group 5 , .Xr ttys 5 , +.Xr mitigations 7 , .Xr accton 8 , .Xr init 8 , .Xr sshd 8 , diff --git a/usr.bin/elfctl/elfctl.1 b/usr.bin/elfctl/elfctl.1 index 7c565049c155..2dbe04ee0ed2 100644 --- a/usr.bin/elfctl/elfctl.1 +++ b/usr.bin/elfctl/elfctl.1 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 4, 2022 +.Dd October 5, 2023 .Dt ELFCTL 1 .Os .Sh NAME @@ -95,6 +95,8 @@ Features may also be specified as a single combined value: .Bd -literal -offset -indent elfctl -e =0x5 file .Ed +.Sh SEE ALSO +.Xr mitigations 7 .Sh HISTORY .Nm first appeared in diff --git a/usr.bin/proccontrol/proccontrol.1 b/usr.bin/proccontrol/proccontrol.1 index 6bef355a54c9..5cb5d584f480 100644 --- a/usr.bin/proccontrol/proccontrol.1 +++ b/usr.bin/proccontrol/proccontrol.1 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 2, 2021 +.Dd October 5, 2023 .Dt PROCCONTROL 1 .Os .Sh NAME @@ -126,7 +126,8 @@ process 1020, do .Sh SEE ALSO .Xr kill 2 , .Xr procctl 2 , -.Xr ptrace 2 +.Xr ptrace 2 , +.Xr mitigations 7 .Sh HISTORY The .Nm From nobody Fri Oct 6 08:25:18 2023 X-Original-To: dev-commits-src-main@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 4S21hG5vhGz4wPmB; Fri, 6 Oct 2023 08:25:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S21hG5Sb6z3VrH; Fri, 6 Oct 2023 08:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696580718; 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=DabLgwITcVM4W16li6+fIf+Vt1N3smrrs7aILqBAQIg=; b=p/xC6Rti5dh9jI7DFy+QiB6AEVUya2AM433Ysk7r7gzo48uVEJKyiA6g3AGsYgvKktvn6l lG1Mfxx9XnD1gHPWOclZC7CN5ZR6YY9LhSJQ/oM45zudQ8tUYmJLARiBFxOPINiMwB/uta 2gWtfSjRXNG7AYJanSKzTEOCwAv/W+JCPtYSbi60+YZiFvI2aY+U820Y1Il6FkF2GbrDJD 3R/VZXi7j+rxOA+XJXRFQVMkq6wZPVcfBmnqKm0X9k4m0aBCY7rN8quHHZIbYPXmu15p40 ZnlcNWgTVgK4AofrDnD8RESfoyZifW6Dtg89XUPL3aADYH8l37VS2XkbnQZ3GA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696580718; a=rsa-sha256; cv=none; b=HzKKPNWiuqYnWneTLH7U6vRXuuMi9wUr0GH3Kn64YL4KlrTcxaHUiVoeB7KOg7ch/L8fto g5Fr2lk3b/n7fxh36pSDb7+uy6C+QyJWbU+FoWvaLXSvRdiv5erNn/uxKASLpWv5j4O38C JDFOIaggPGCtolPA+JAv8Yc7BvApPdZvtkllqkv8wINbluO9hsludPOG9nVxpOmETydkTN kZvMtAukwpBHzj9oIhrOpF+Xs6KmBEMqVGf4FDno6amZIcXAV5xRs76jlkAxsOnCTD77O8 sTNZLoXtviVLmDnzbsAI8E4rH7hiu9azxOslz/PBgzHrv4RHMJ+biXjA7hRShQ== 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=1696580718; 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=DabLgwITcVM4W16li6+fIf+Vt1N3smrrs7aILqBAQIg=; b=wazIUVoCZs6A1G8YaMgPKMKSaJRr9WW0bz2dmw44hhZl4IDGDEpvSMq8ugS93WlCr742wV Rm5yuxf2e8Bi10EHFKcQpWM5UgWvkCyvau0clkTBSCtriAlimkFtQEeXjvOrGaiQDBDpZl M3WH6eYSpCafSDgQmup2popw8luIRExR7Rj/XoS+lDRHn6bsDlhwSwwXZ6PF+Y/o8MuHNC xkIpV/xfJGCOIcNOHTvCx1HLIeUfrDB18W84dwiBTtDEflDXnyjVyvi6VwXo0ZykCNNkeS h/RYKDamYE956dneHCYlVdo8TCteZHOD9nr9ETxUDIJtT9DCn9UvHbn+MjZWGQ== 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 4S21hG4XCKzgmc; Fri, 6 Oct 2023 08:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3968PIpH092854; Fri, 6 Oct 2023 08:25:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3968PIoH092851; Fri, 6 Oct 2023 08:25:18 GMT (envelope-from git) Date: Fri, 6 Oct 2023 08:25:18 GMT Message-Id: <202310060825.3968PIoH092851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3c871489cdd6 - main - if_re: add Realtek Killer Ethernet E2600 IDs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c871489cdd6c5606b2b1125f66b0e9b8f39561f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c871489cdd6c5606b2b1125f66b0e9b8f39561f commit 3c871489cdd6c5606b2b1125f66b0e9b8f39561f Author: Sk Razee AuthorDate: 2023-10-06 06:08:16 +0000 Commit: Kristof Provost CommitDate: 2023-10-06 06:10:04 +0000 if_re: add Realtek Killer Ethernet E2600 IDs PR: 274292 MFC after: 1 week Reviewed by: kp Event: Oslo Hackathon at Modirum --- sys/dev/re/if_re.c | 2 ++ sys/dev/rl/if_rlreg.h | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 27984200bd91..83fd31fc4f0b 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -178,6 +178,8 @@ static const struct rl_type re_devs[] = { "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, + { RT_VENDORID, RT_DEVICEID_2600, 0, + "RealTek Killer E2600 Gigabit Ethernet Controller" }, { RT_VENDORID, RT_DEVICEID_8139, 0, "RealTek 8139C+ 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8101E, 0, diff --git a/sys/dev/rl/if_rlreg.h b/sys/dev/rl/if_rlreg.h index 01634bb704c7..808d11e34346 100644 --- a/sys/dev/rl/if_rlreg.h +++ b/sys/dev/rl/if_rlreg.h @@ -991,6 +991,7 @@ struct rl_softc { /* * RealTek chip device IDs. */ +#define RT_DEVICEID_2600 0x2600 #define RT_DEVICEID_8139D 0x8039 #define RT_DEVICEID_8129 0x8129 #define RT_DEVICEID_8101E 0x8136 From nobody Fri Oct 6 09:05:15 2023 X-Original-To: dev-commits-src-main@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 4S22ZM6Swgz4wVVx; Fri, 6 Oct 2023 09:05:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S22ZM61xwz3cQn; Fri, 6 Oct 2023 09:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696583115; 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=XioRreEG2wM1x4l12G4aB6alSC7i52CQyQ1qu9Ju3I4=; b=IGiVtt+SFSiO59qGG+F2hTMnCbHq5SyqHY9D6XAS1peKkyBPIUhjPg4f6pyiI59wzGfkVD 5KIjDc1CNTjbAMkTiYvVEx/xoibAkMQ5W2fAcFue3VbT/ctg1Rqlt3thTZzcGMmIzo94z6 7nzCx9z8mcok/2LlDAhNB3g6yDZyJl4R7srlQGdVsXPCCzTOYaUnkKS4IRwLUl5Ts+nzCJ vqNEj5aq7EqbMdpEbKXpayE9MCW7TZ9j3ZdRUrTGAXOxX8WZdDGQGA5JKLUU9Gr9w8cyBz ebLDqKzCP/XBlgrPsR9sIKD+9JbHSFo85zAOvE8v6/Nyad1LRxXUnLjTtL6FPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696583115; a=rsa-sha256; cv=none; b=XAWZGVJNGrR6ncW8J9JML2k4ShqeCw+inOlX9Wa4xpNu1wn2+qX1JQSAqmHVFCbo3zgJNZ 4uTR3PaOasMwhld8zNDE3SpdxE7K4IWZXnh9KHJ/biNtbh5cWcosP5Zil6frVXb4LKQJs+ rgVZPmazANlXu7cT11iP4TXSFMLkEv70vrEQuS2+KILyP6u3iL2+NNIAZQmsc0alzRdM83 SXEvfItBeVx6oEhpxlKA9Kom/7eStgtb737TPOMWBY1ZzKf/Da077Wkws+0uHMNR0KS3/w HzRJl5b6kfQ5lX3bdV0/OSng0S9oEClf5BAH8rKuahfscRD3lJHgEM1iN2PYrw== 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=1696583115; 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=XioRreEG2wM1x4l12G4aB6alSC7i52CQyQ1qu9Ju3I4=; b=xAIB47UZUHAxIxg8sr0rnIiJn+s3GIJM7PNZG7bxHt04jhuiYn0cetsdC2GBjCEE0Y28QN 9hv7cmSFAZ8LFzi9LDY1CsdcH0NGBkmTv5uxNGs6K9ZFzuosziJtA2Y7uhdomrGwiDjWgn //zSodrjtQIarIQKrqvehSEJpw47jKYUAjmvjQkcpOiwAsqTHd88KJjysU31X17mWjlpa4 ymEm1dnKuoVMuhHPSbLMUB8xQyzNwUkyx+BFDtpWJV8G4meSs0mmtbo0i4PCKnjlchP1hj ZWuDJiEIOUhVZQeTi0h8a4A1jbLMfUQMrzuqjfLPPVmNK95JnJsDltz0hHn8DQ== 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 4S22ZM55S6zhm4; Fri, 6 Oct 2023 09:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39695F5d059378; Fri, 6 Oct 2023 09:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39695FCI059375; Fri, 6 Oct 2023 09:05:15 GMT (envelope-from git) Date: Fri, 6 Oct 2023 09:05:15 GMT Message-Id: <202310060905.39695FCI059375@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Benedict Reuschling Subject: git: 07b2c79cc6c7 - main - Correct the example: use maxproc instead of nonexistent nproc List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bcr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 07b2c79cc6c782ae57b6287688338d0ac3941e66 Auto-Submitted: auto-generated The branch main has been updated by bcr: URL: https://cgit.FreeBSD.org/src/commit/?id=07b2c79cc6c782ae57b6287688338d0ac3941e66 commit 07b2c79cc6c782ae57b6287688338d0ac3941e66 Author: Benedict Reuschling AuthorDate: 2023-10-06 09:02:30 +0000 Commit: Benedict Reuschling CommitDate: 2023-10-06 09:02:30 +0000 Correct the example: use maxproc instead of nonexistent nproc Reported by: dewayne@heuristicsystems.com.au PR: 272357 Differential Revision: https://reviews.freebsd.org/D40885 --- share/man/man5/rctl.conf.5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man5/rctl.conf.5 b/share/man/man5/rctl.conf.5 index 4f48b197214a..bf64e54fc567 100644 --- a/share/man/man5/rctl.conf.5 +++ b/share/man/man5/rctl.conf.5 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 14, 2011 +.Dd October 6, 2023 .Dt RCTL.CONF 5 .Os .Sh NAME @@ -61,7 +61,7 @@ To limit the number of processes for users in login class "testing", use a rule like .Bd -literal -offset indent # Resource limits for the "testing" class. -loginclass:testing:nproc:deny=100/user # At most 100 processes per user +loginclass:testing:maxproc:deny=100/user # At most 100 processes per user .Ed .Sh SEE ALSO .Xr rctl 8 From nobody Fri Oct 6 10:50:41 2023 X-Original-To: dev-commits-src-main@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 4S24w13LbVz4w47K; Fri, 6 Oct 2023 10:50:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S24w12xc5z4NS4; Fri, 6 Oct 2023 10:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696589441; 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=x7dtYScGtT50EEsnbldp7Nuhm44hRn8vvgpCd3yhVFs=; b=LQJKqCFiwvzSleavZILXmcIn/MXKFxOEnhI3i/vwPnB6+QAg5qomHJ3kEqe+qdZHmVCXnF +FoxDGr7hhlPdx7IpgVujKhpjBneK1F4Xp4H6WPWk+HhLixNCli6efk8o1ztPbnOZqHWwg YIJzhrkCQZmH5koPkLIBp7UXed+zo55UhSJmXel7bBqYSR5k6SxdVKxbrSTKFgl+5+JTOB rU5SieYl+vEUINdWT+y8IZlp7SsTw+uh3Q9fD3IDYgxx9LdU4TiUVISgE2yj6R0s4Ma24X Ew3JX2qGvUrIZelT3Hrb22q96BtOUcGIHV88o1OTnpLFFiDKsa903+eGMhlo3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696589441; a=rsa-sha256; cv=none; b=BvsYMAPDKAMLIzcQvdKUUgBQ+w0O286wnTv4tSAIboEopssjaa7vgEIh6Uad0Wvk9UAesZ xnivXTNDbUWg6NoIHOoDJ0gcOd2hDsa+NO+X+sJZtID3khD/E11rrozWv0OgDUXz91iwoX pH5bJ3HRWE+iPUVqxlGlFbxlZ5Aa+tX1ffDg4W7pab7WIOP7K9EBNTpPWl94StvlQXaA6a inxHNfwIrHB0UCfxNaF0fV1saW1ZsbWJ5NIV0yWKOrD58gjHyJfmZdmqzNqF52QWbNdNhB uoQpoCxKgMy4OvJcunomiGsXbwY9E2r/TiOcxMm7ja4dV1DwqE1Qe20CEb6Tjw== 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=1696589441; 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=x7dtYScGtT50EEsnbldp7Nuhm44hRn8vvgpCd3yhVFs=; b=NNtL3SkhuN65FMmUw6kiPTa2AgRYI0NYvDA/AAEyl+Kx68V25mU88HuJCJuQjNZUj9IRa7 5HgDbo50yDHDq1sh+13X5qldm58J8FyU4GysejyEhjqVwdykONIN3xfSaAp+1j4pgneNB3 TZgh9QmbMLC2y9a+aVNOcPML+LoRkh+LxrgwxwY/9qQ4bVEbULeNhubjU2JxMx6MKArq0Y yHxRE6ibCJCGKhDED/6yG65kMV721u7h/PhpY+0TBSCesAQY1XvIfljhON0+4hZq0260zn pixgqqKzYJoNHcMbUBGMk5YwOU6qg41uls5oKbdQ/+fRrA4GmTNOxu0DuDYKMw== 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 4S24w1204PzlYL; Fri, 6 Oct 2023 10:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396AofwC036760; Fri, 6 Oct 2023 10:50:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396AofGg036757; Fri, 6 Oct 2023 10:50:41 GMT (envelope-from git) Date: Fri, 6 Oct 2023 10:50:41 GMT Message-Id: <202310061050.396AofGg036757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3a11944bca0f - main - net80211: pass __func__, __LINE__ also to ieee80211_alloc_node() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a11944bca0f07079a61f10468b704589c52a76f Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3a11944bca0f07079a61f10468b704589c52a76f commit 3a11944bca0f07079a61f10468b704589c52a76f Author: Bjoern A. Zeeb AuthorDate: 2023-10-06 10:38:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-06 10:50:06 +0000 net80211: pass __func__, __LINE__ also to ieee80211_alloc_node() Pass caller information to ieee80211_alloc_node() so that in case IEEE80211_DEBUG_REFCNT is compiled in we can (better) track references, in this case the initial ieee80211_node_initref(). Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/net80211/ieee80211_node.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 88c8ab4eff1c..e451b03d8dac 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -84,7 +84,7 @@ static int ieee80211_sta_join1(struct ieee80211_node *); static struct ieee80211_node *ieee80211_alloc_node( struct ieee80211_node_table *, struct ieee80211vap *, - const uint8_t macaddr[IEEE80211_ADDR_LEN]); + const uint8_t macaddr[IEEE80211_ADDR_LEN], const char *, int); static struct ieee80211_node *node_alloc(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); static int node_init(struct ieee80211_node *); @@ -348,7 +348,8 @@ ieee80211_create_ibss(struct ieee80211vap* vap, struct ieee80211_channel *chan) ieee80211_channel_type_char(chan), chan->ic_flags); - ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, + __func__, __LINE__); if (ni == NULL) { /* XXX recovery? */ return; @@ -458,7 +459,8 @@ ieee80211_reset_bss(struct ieee80211vap *vap) /* XXX multi-bss: wrong */ ieee80211_vap_reset_erp(vap); - ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, + __func__, __LINE__); KASSERT(ni != NULL, ("unable to setup initial BSS node")); obss = vap->iv_update_bss(vap, ieee80211_ref_node(ni)); if (obss != NULL) { @@ -921,7 +923,8 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, struct ieee80211_node *ni; int do_ht = 0; - ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr, + __func__, __LINE__); if (ni == NULL) { /* XXX msg */ return 0; @@ -1401,7 +1404,8 @@ ieee80211_del_node_nt(struct ieee80211_node_table *nt, static struct ieee80211_node * ieee80211_alloc_node(struct ieee80211_node_table *nt, - struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN]) + struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN], + const char *func __debrefcnt_used, int line __debrefcnt_used) { struct ieee80211com *ic = nt->nt_ic; struct ieee80211_node *ni; @@ -1418,6 +1422,11 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); ieee80211_node_initref(ni); /* mark referenced */ +#ifdef IEEE80211_DEBUG_REFCNT + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni, + ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); +#endif ni->ni_chan = IEEE80211_CHAN_ANYC; ni->ni_authmode = IEEE80211_AUTH_OPEN; ni->ni_txpower = ic->ic_txpowlimit; /* max power */ @@ -1480,6 +1489,12 @@ ieee80211_tmp_node(struct ieee80211vap *vap, IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); IEEE80211_ADDR_COPY(ni->ni_bssid, bss->ni_bssid); ieee80211_node_initref(ni); /* mark referenced */ +#ifdef IEEE80211_DEBUG_REFCNT + /* Only one caller so we skip func/line passing into the func. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "%s (%s:%u) %p<%s> refcnt %d\n", __func__, "", -1, ni, + ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); +#endif /* NB: required by ieee80211_fix_rate */ ieee80211_node_set_chan(ni, bss->ni_chan); ieee80211_crypto_resetkey(vap, &ni->ni_ucastkey, @@ -1513,7 +1528,7 @@ ieee80211_dup_bss(struct ieee80211vap *vap, struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; - ni = ieee80211_alloc_node(&ic->ic_sta, vap, macaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, macaddr, __func__, __LINE__); if (ni != NULL) { struct ieee80211_node *bss = vap->iv_bss; /* @@ -1541,7 +1556,7 @@ ieee80211_node_create_wds(struct ieee80211vap *vap, struct ieee80211_node *ni; /* XXX check if node already in sta table? */ - ni = ieee80211_alloc_node(&ic->ic_sta, vap, bssid); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, bssid, __func__, __LINE__); if (ni != NULL) { ni->ni_wdsvap = vap; IEEE80211_ADDR_COPY(ni->ni_bssid, bssid); From nobody Fri Oct 6 10:57:25 2023 X-Original-To: dev-commits-src-main@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 4S253p1S63z4w5NV; Fri, 6 Oct 2023 10:57:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S253n6Tdzz4PN7; Fri, 6 Oct 2023 10:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696589845; 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=Kan/6lKfBNxtdlOTgzPy8mlUldGQ5jkMyi0VtRBBUHc=; b=hjN8g4hIg07yl20lxwpUC3hkawPrZd1d3nxVy3ewabOmBsBiZvcYi5kulB4AuH4vzxMpnZ 1t/ZxzqilOpzRghyZOXMB913ZCBzoxL8zrplLnstG6ads044hT7BUlP/BlWYYvCxabuAKI ZQ8TW2kS/hYLOkKjsN7Ti0PA+tmXDjiSnpfJzbmw7G6ohJ2TXK71RkosiH0r0IHwIOlqo1 +SQXIVpFRdRmYlE7iLJWFqo42Xc32y4MYtzJK6rMe5XMZ/uf0Ifwmu2yhqNZ8l1+SZiX+0 OqQ8qu7JGjnF5SHXJMNVoaRs9Ne3dahlTF2k5W4mncqWW1MCHu9bi1omO/Z08A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696589845; a=rsa-sha256; cv=none; b=jeNscsZpXt59749oBYDqR2x41PKN5S8Av4IGt5tA2TxL9wm9OE47mRJ6/lP0SSlvEm9+uM QTwhIY87p61rz19c9DaZ5yqTZk/Wv6P1Rp897I2qSfB88R3SymK9K4kake252HMRNFETne 7ajyP6kqQBcR/AzUbii2zZo7Fl/4KgOnivve/JLkY91cAjlHqNm2SW82lDV4QcPFkwcI8p swFzR6LJzkyRHK2WicHn2cKB+eHWDr7CDH8I8w+tieVxoAty3UtenKJ4Vuv9VLKyYbA/CT PJ9QuR2z7C3sE6t2GdIzq8EBIM37qUnq8fowN6wZnTTkjcp+7eoVtcy1DO0VAg== 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=1696589845; 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=Kan/6lKfBNxtdlOTgzPy8mlUldGQ5jkMyi0VtRBBUHc=; b=lflJc26xYphZzBaGCXgpf8uDI1+QLtRYAD1LJvY3tEDVZPvFPGBJwhzYtf5RMLzTVO8aGS DsbmErFiHOwzYXcCqnGuq9dt6ADCfwAcUxwHhnwEVlAOEVB59/nn5ZvFkBRG3WizSoGGeL vqXfu18U5ft+71kySsYN62r85wTMuMXFF3p3BH/d/3ETnI0TFLrHGs0jhfRvjpp1eC+vb9 K7GyjtnvfCG1ImMhDF5kfWeendJSR3ofhT5ZIuJ34DqCJrwQx4FF2ioBAtFM5xbQMQtWu4 VB7L+geZktuEBVEeoW0m43LA3x5I8xW0m6h04ntEC/DOLDeJO6dAlHpZJ3hoFw== 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 4S253n5ZxBzlLT; Fri, 6 Oct 2023 10:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396AvPUG043927; Fri, 6 Oct 2023 10:57:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396AvPPS043924; Fri, 6 Oct 2023 10:57:25 GMT (envelope-from git) Date: Fri, 6 Oct 2023 10:57:25 GMT Message-Id: <202310061057.396AvPPS043924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 299e2d5724c2 - main - rtw88: re-connect to the build List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 299e2d5724c2bc4929b6eac3258f04055e97992e Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=299e2d5724c2bc4929b6eac3258f04055e97992e commit 299e2d5724c2bc4929b6eac3258f04055e97992e Author: Bjoern A. Zeeb AuthorDate: 2023-10-06 10:53:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-06 10:56:37 +0000 rtw88: re-connect to the build This adds the (updated) rtw88 driver back to the build. Functionality has not been tested (much) so might not currently work but people offered to test. Firmware is provided by the wifi-firmware-rtw88-kmod port/package. This reverts commit 712468443df1130db8f893a5e2ce5c6a8dbf5cde. --- share/man/man4/rtw88.4 | 6 ++---- sys/modules/Makefile | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/share/man/man4/rtw88.4 b/share/man/man4/rtw88.4 index 24baf6a5194f..a1a74db41b42 100644 --- a/share/man/man4/rtw88.4 +++ b/share/man/man4/rtw88.4 @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2022-2023 Bjoern A. Zeeb +.\" Copyright (c) 2022 Bjoern A. Zeeb .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -22,15 +22,13 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 5, 2023 +.Dd October 06, 2023 .Dt RTW88 4 .Os .Sh NAME .Nm rtw88 .Nd Realtek IEEE 802.11n/ac wireless network driver .Sh SYNOPSIS -.Sy The driver is temporary disconnected from the build. -.Pp The driver will auto-load without any user interaction using .Xr devmatch 8 if enabled in diff --git a/sys/modules/Makefile b/sys/modules/Makefile index d2c5cc44705a..3eff75312fd3 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -565,7 +565,7 @@ _iwlwifi= iwlwifi _iwlwififw= iwlwififw .endif _ossl= ossl -#_rtw88= rtw88 +_rtw88= rtw88 _vmware= vmware .endif From nobody Fri Oct 6 13:04:41 2023 X-Original-To: dev-commits-src-main@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 4S27td6g43z4wS9y; Fri, 6 Oct 2023 13:04:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S27td6BBlz3DGL; Fri, 6 Oct 2023 13:04:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696597481; 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=aXG5ElnhmNCEOMDPbCPxYwO6iD2yMdKFzNnTnSYELi0=; b=jd5FR+t7BjYoXBZ0PPYTr1lVfQVaYXLHjxCZ/brJKKZDQw3ZBG+bmv3/EE4m3rT/1912Ww FFTcPDqK80xw9Rukhn4H1eAaeUrk94oZsPapjUgkcMl/RDUwzV5PoF5xzPC2tEeymQctNC bG97Gihac1idMgzL5hNCPnFKuRyM+AbvYlsnouYNPzDGi+J53+x3DYf+8f7bmt4JzSIZ3I lkBej5oDb09KRJ8qj+qppLtnECr/X2dtWmTgGC/8cV13JsJtGSfBHpl84t0aAqBpmlbHwh dI/C4boYnoxlv4QTkNWD5wkj0fU5iMLV10FbOoTt8XeXKfAiLkRX/NfY0Q0q8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696597481; a=rsa-sha256; cv=none; b=yuyW584EZzH0tEyPUyZ/T/qvCbxrSq3d9ZcQhRte/UeJ+4G0dqcTN2fEjLTnLouEH8ZCZ4 tGU/98fwAyeiO1cAVxxsRtSnBsOTCx1oN8jIkor6hiKjHqim13uy7PmadlJgVkWgEqfV+7 AMZopgc4N/4vZb4+TJDPG9SAaahEimDnvtO+qTflCmDArJ4tFNkkkmQn+WoIsaQ+gJFOQ5 AOmDU3phutGIq45dGwgUANw17ou3nAtWwlU7sCp9xqroBSBX5OX3ykRBkHHXkIIfaOJkrR ywz0o/Ve+JBJrUDCijOS/IRJDRXPBYRefyCQ32FMot1v3ar4GJXunUjXKhJZyA== 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=1696597481; 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=aXG5ElnhmNCEOMDPbCPxYwO6iD2yMdKFzNnTnSYELi0=; b=wdFr2fomxiUAegN2nMWS1/xitVuWP9nBvBPoiq06sXDLfy4rt3hdz+DwKEIAiC2p0xclfc 1uOyYN67oA1wvhRZaKmNL+DWn0TpJjckPiCaVUHRGrMgEgQgPQInAbuF52h9w6kXa7icME JK88zRtympZZBW8GjolCY1QVUM8IAWuiIUEQMMNKGLcf94QapAg8vjQHerHFrWs4APXWcM NpJofpT/i82NOjQRr74he0xz3un0YqL6L+ud/8lj0jzSX02RLBN74Qx7PMeWIhBnDSGg3Q xxIZ/jnK5RQ5/ftW4cPintvdRp9fkNiRcm2saF5ChsHgEoLq4QaqI/iDY4gbaA== 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 4S27td5FYyzprf; Fri, 6 Oct 2023 13:04:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396D4fIl059980; Fri, 6 Oct 2023 13:04:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396D4fPD059977; Fri, 6 Oct 2023 13:04:41 GMT (envelope-from git) Date: Fri, 6 Oct 2023 13:04:41 GMT Message-Id: <202310061304.396D4fPD059977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 70a0fb43f91c - main - growfs: make exit codes more consistent List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70a0fb43f91cfe3d08db7cb443d9690f8bff065e Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=70a0fb43f91cfe3d08db7cb443d9690f8bff065e commit 70a0fb43f91cfe3d08db7cb443d9690f8bff065e Author: Mina Galić AuthorDate: 2023-10-05 18:24:53 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-06 13:02:40 +0000 growfs: make exit codes more consistent We have overused err(1), so it's hard to distinguish when an error is very, very serious, and when it's just a user-error, or even harmless. This patch changes the current behaviour to distinguish between the following three: 1 for usage errors 2 for recoverable errors 3 or higher for unrecoverable errors Reviewed by: jilles, pauamma_gundo.com, des Differential Revision: https://reviews.freebsd.org/D27161 --- sbin/growfs/growfs.8 | 6 +++++- sbin/growfs/growfs.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/sbin/growfs/growfs.8 b/sbin/growfs/growfs.8 index f83c3c00cf1f..9a6076017c74 100644 --- a/sbin/growfs/growfs.8 +++ b/sbin/growfs/growfs.8 @@ -36,7 +36,7 @@ .\" .\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $ .\" -.Dd December 13, 2017 +.Dd October 3, 2023 .Dt GROWFS 8 .Os .Sh NAME @@ -88,6 +88,10 @@ This value defaults to the size of the raw partition specified in .Nm will enlarge the file system to the size of the entire partition). .El +.Sh EXIT STATUS +Exit status is 0 on success, and >= 1 on errors. +Errors recoverable by user action are indicated by 2. +OS errors, which are usually not recoverable, are indicated by 3 or greater. .Sh EXAMPLES Expand root file system to fill up available space: .Dl growfs / diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index fc314d19a4e3..a63002271af1 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -147,7 +147,7 @@ growfs(int fsi, int fso, unsigned int Nflag) */ fscs = (struct csum *)calloc((size_t)1, (size_t)sblock.fs_cssize); if (fscs == NULL) - errx(1, "calloc failed"); + errx(3, "calloc failed"); memcpy(fscs, osblock.fs_csp, osblock.fs_cssize); free(osblock.fs_csp); osblock.fs_csp = NULL; @@ -259,7 +259,7 @@ growfs(int fsi, int fso, unsigned int Nflag) * and all the alternates back to disk. */ if (!Nflag && sbput(fso, &sblock, sblock.fs_ncg) != 0) - errc(2, EIO, "could not write updated superblock"); + errc(3, EIO, "could not write updated superblock"); DBG_PRINT0("fscs written\n"); #ifdef FS_DEBUG @@ -1339,7 +1339,7 @@ main(int argc, char **argv) size <<= 30; size <<= 10; } else - errx(1, "unknown suffix on -s argument"); + errx(2, "unknown suffix on -s argument"); break; case 'v': /* for compatibility to newfs */ break; @@ -1364,23 +1364,23 @@ main(int argc, char **argv) statfsp = getmntpoint(*argv); device = getdev(*argv, statfsp); if (device == NULL) - errx(1, "cannot find special device for %s", *argv); + errx(2, "cannot find special device for %s", *argv); fsi = open(device, O_RDONLY); if (fsi < 0) - err(1, "%s", device); + err(3, "%s", device); /* * Try to guess the slice size if not specified. */ if (ioctl(fsi, DIOCGMEDIASIZE, &mediasize) == -1) - err(1,"DIOCGMEDIASIZE"); + err(3,"DIOCGMEDIASIZE"); /* * Check if that partition is suitable for growing a file system. */ if (mediasize < 1) - errx(1, "partition is unavailable"); + errx(2, "partition is unavailable"); /* * Read the current superblock, and take a backup. @@ -1388,16 +1388,16 @@ main(int argc, char **argv) if ((ret = sbget(fsi, &fs, UFS_STDSB, 0)) != 0) { switch (ret) { case ENOENT: - errx(1, "superblock not recognized"); + errx(2, "superblock not recognized"); default: - errc(1, ret, "unable to read superblock"); + errc(3, ret, "unable to read superblock"); } } /* * Check for filesystem that was unclean at mount time. */ if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) - errx(1, "%s is not clean - run fsck.\n", *argv); + errx(2, "%s is not clean - run fsck.\n", *argv); memcpy(&osblock, fs, fs->fs_sbsize); free(fs); memcpy((void *)&fsun1, (void *)&fsun2, osblock.fs_sbsize); @@ -1418,7 +1418,7 @@ main(int argc, char **argv) mediasize, "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); - errx(1, "requested size %s is larger " + errx(2, "requested size %s is larger " "than the available %s", oldsizebuf, newsizebuf); } } @@ -1439,7 +1439,7 @@ main(int argc, char **argv) if (size == (uint64_t)(osblock.fs_size * osblock.fs_fsize)) errx(0, "requested size %s is equal to the current " "filesystem size %s", newsizebuf, oldsizebuf); - errx(1, "requested size %s is smaller than the current " + errx(2, "requested size %s is smaller than the current " "filesystem size %s", newsizebuf, oldsizebuf); } @@ -1451,7 +1451,7 @@ main(int argc, char **argv) * Are we really growing? */ if (osblock.fs_size >= sblock.fs_size) { - errx(1, "we are not growing (%jd->%jd)", + errx(3, "we are not growing (%jd->%jd)", (intmax_t)osblock.fs_size, (intmax_t)sblock.fs_size); } @@ -1461,7 +1461,7 @@ main(int argc, char **argv) if (yflag == 0) { for (j = 0; j < FSMAXSNAP; j++) { if (sblock.fs_snapinum[j]) { - errx(1, "active snapshot found in file system; " + errx(2, "active snapshot found in file system; " "please remove all snapshots before " "using growfs"); } @@ -1506,14 +1506,14 @@ main(int argc, char **argv) if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) { fso = open(_PATH_UFSSUSPEND, O_RDWR); if (fso == -1) - err(1, "unable to open %s", _PATH_UFSSUSPEND); + err(3, "unable to open %s", _PATH_UFSSUSPEND); error = ioctl(fso, UFSSUSPEND, &statfsp->f_fsid); if (error != 0) - err(1, "UFSSUSPEND"); + err(3, "UFSSUSPEND"); } else { fso = open(device, O_WRONLY); if (fso < 0) - err(1, "%s", device); + err(3, "%s", device); } } @@ -1522,7 +1522,7 @@ main(int argc, char **argv) */ testbuf = malloc(sblock.fs_fsize); if (testbuf == NULL) - err(1, "malloc"); + err(3, "malloc"); rdfs((ufs2_daddr_t)((size - sblock.fs_fsize) / DEV_BSIZE), sblock.fs_fsize, testbuf, fsi); wtfs((ufs2_daddr_t)((size - sblock.fs_fsize) / DEV_BSIZE), @@ -1577,7 +1577,7 @@ main(int argc, char **argv) fragroundup(&sblock, sblock.fs_ncg * sizeof(struct csum)); if (osblock.fs_size >= sblock.fs_size) - errx(1, "not enough new space"); + errx(3, "not enough new space"); DBG_PRINT0("sblock calculated\n"); @@ -1591,11 +1591,11 @@ main(int argc, char **argv) if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) { error = ioctl(fso, UFSRESUME); if (error != 0) - err(1, "UFSRESUME"); + err(3, "UFSRESUME"); } error = close(fso); if (error != 0) - err(1, "close"); + err(3, "close"); if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) != 0 && chkdoreload(statfsp, warn) != 0) exit(9); From nobody Fri Oct 6 13:04:42 2023 X-Original-To: dev-commits-src-main@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 4S27tg1T0Dz4wS7t; Fri, 6 Oct 2023 13:04:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S27tg0PhHz3DP9; Fri, 6 Oct 2023 13:04:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696597483; 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=UuiibwZsRW3m6cOqhbz36ufOp+kUZVslgiL4IQOGJ6Q=; b=LA3NDwQEDnx82cBnblrYiUppAI/tlwc9Eovw8LU/LbuwgD810q19MW1rvo6YqMNGW3sn43 5K2u8E9ZvVGmPG/jkPAinTtgwwbEqrrUMhpW3AqLNyCoEo9Kt+H7pEeO6KWQb06xUhnuHU x1F/iH0nW1HnvHNWSHSdo14ueSB5lhIejwq0SPxe+xS9HUtBYQr0Efd45xMcp2/SfMia+Y LrfFcejgdoWsNi+eYSboRGZeMBIqu7BAPce+6oNRMB9rW2kRofh1fJDwce/xHkIO+KW8eZ rCaAXWCZByMZYHpdRhDpc7B15A94tWFYdxg2Sj4u6JLPVhvA2jC2et9WHNxnDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696597483; a=rsa-sha256; cv=none; b=CsgP6T5a+hmMS7f8OxNb01SNsca6vwuWgSQOCuRvQR7n00w2jx6VZvWwY64WT2sTABG0K4 lD6vFrpX8DqNpgXWW9ZdF+iSlN1YMJVFHhkWEFC0tONoB7unLwPDtNr52L708tK52MKi/n qdqmjtUSHFF1jMAUVAV347IEtrPaqcSnPjdtnOYTdxoshWpWjsWbTu+LxpvltQKfgYEYwu 04GNqk/pnfhiG+iGd3HiHvNyW5as/MvlI54NfXQzJG1XFjFIVb5sDwPkzDZbFwr/dBSDIE 2RBYsZPn3IEhqWsBudPSsXJYyhzIbxos0V4fSzPzcOHUeV52iHhQa+5gI9JVcQ== 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=1696597483; 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=UuiibwZsRW3m6cOqhbz36ufOp+kUZVslgiL4IQOGJ6Q=; b=PAWOmftV7F3D0SmstaH2EoWc0SaRTs4SbHEqG5Ep5/C9xV7ym1b41a87Rf28k9VHnxkaxh 2mxsOLZaTbgVuE4qE4uhrpiXxC6d/p6jfC5owWJLLBOK8fMu4Jn4HjzUtkoRNkCa6CSIcQ 4NogF6IspsCVjoI6kXgFQrkzVPsAm8Is/Ix2WGrlzBj92CYoxvPXEGhaAqgJqL2PO/4LiJ NGTXSSJX0tjrC/9hLsx2s019zjsteBqZMM+v5zDcKc5qzeP3DuVF4hNrgYygBam2VvYsAS 5oBLlgbV4hDKLxwFM1yiksnqBaXdGARzR1N2Ef9N8Td7d54nPCqvggosvu6TXw== 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 4S27tf6YqXzpCG; Fri, 6 Oct 2023 13:04:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396D4g8T060025; Fri, 6 Oct 2023 13:04:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396D4gxA060022; Fri, 6 Oct 2023 13:04:42 GMT (envelope-from git) Date: Fri, 6 Oct 2023 13:04:42 GMT Message-Id: <202310061304.396D4gxA060022@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 6594288a6088 - main - mailmap: Add pstef and val List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6594288a6088caf9821487637d5d6ee8c27cd558 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=6594288a6088caf9821487637d5d6ee8c27cd558 commit 6594288a6088caf9821487637d5d6ee8c27cd558 Author: Mina Galić AuthorDate: 2023-10-05 18:25:30 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-06 13:02:41 +0000 mailmap: Add pstef and val normalize pstef@'s Name, as well as Val Packett's. Reviewed by: pstef, val_packett.cool Differential Revision: https://reviews.freebsd.org/D41949 --- .mailmap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.mailmap b/.mailmap index b06274fe6df3..2e4c03966084 100644 --- a/.mailmap +++ b/.mailmap @@ -12,3 +12,5 @@ Dmitriy Alexandrov <83477269+AtariDreams@users.noreply.github.com> Alfonso Gregory <83477269+gAlfonso-bit@users.noreply.github.com> Jose Luis Duran +Val Packett +Piotr Paweł Stefaniak From nobody Fri Oct 6 14:08:28 2023 X-Original-To: dev-commits-src-main@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 4S29JF1PgHz4wdKD; Fri, 6 Oct 2023 14:08:29 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S29JF0yZTz3Mxv; Fri, 6 Oct 2023 14:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696601309; 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=MOaTYBnOdRCu0XY0e4H9r9vp6mNutzKrgYNCPBj2Go8=; b=BwSgzsZ5PbhIibuUjoYu3Ed1pJYOqPLgOuob4DS85doOcEA0rXLXVOuEdR6+n4WG94CVB7 ALmOLBOcR/1p59U/6AJ0MTCsPe8ZOxRIsXvb36vPBFiiB0TvLv5FFwUA+2LZOo+VSXrwgb vJCZJ4Yp51wXfZQmXpxTyboQzAsiuKu2P39ESPUonhZpR3Is6ratQo3MAl/851XkPa3WbQ eOqScud8V3SMVllrXKCSVUTrVOzNvVyMivh8bd71fhIiq8SbLgtcpYM6F/vV9TJY8rFpRP OhapmUHNdARZYYHr+eNj47Rdn9CeFMLwu2/x2SXUmHeg98QIaGRoHaOFmfJq4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696601309; a=rsa-sha256; cv=none; b=aeRDzOKU6VMSzOZ7TwXxae4OeRhnJSCfmH2OOB947Uxs8fvNX1+btx6937/UtXjse5WOlz MirfvTNjMInTODHmlHwmrVwrZXAoRWkdewSRQg6C1gO0nZAgACNaY6d8K6dahHu4PrZuhn EgPMfQwgfm9LYvPOlyyiNHm7jOXNJk/cPsc0coJ3ioKTBKfl4RiBsNh50dVPG67KX3hjca Wi2J2xiANUGXi32uKbTFS+Ykd8iy5m2gw3khYK3SteTnm+yBwz5fyokb609bFpaZOsTl5F vaYwHphBUCyDZA7h/n885Ik+E1CloUr1TxtrjZcw1H1z0EP3xdOG2aWhMrswAQ== 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=1696601309; 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=MOaTYBnOdRCu0XY0e4H9r9vp6mNutzKrgYNCPBj2Go8=; b=Tq66Bn7CipkuKqH2jN6V07Jorea5Y7MGuEXIRnD9BCvjSpYov8dVKCBa0CtG7WUPe2dQhv yNe1dMPb7DT+erNXgBdYg0o6LffErcbGExar32F7Wwze/X2FnLN+BAjKoVkU404HHK9QG0 F9YFGcKbbLPQwPHM3BT8sTdHdud0nOzu852/+mdfyuFYK8GBu3n+QATLjeXuIYcb0UhZUX +XTqwJexERjpPxpM+7JDRTj9BfOeA1CqN22YxCb5lWXnu1p4EUayOgboEwPfwSEBPj5xHu 9o3i4JzMPeJvp4n7j9j488Gg3iZU1ri02yzaKdwO/U9gTEYMrTmBLAyRN2wwdg== 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 4S29JF00kZzqyH; Fri, 6 Oct 2023 14:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396E8SPW059966; Fri, 6 Oct 2023 14:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396E8S91059964; Fri, 6 Oct 2023 14:08:28 GMT (envelope-from git) Date: Fri, 6 Oct 2023 14:08:28 GMT Message-Id: <202310061408.396E8S91059964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 57b9a104a26d - main - Cirrus CI: Only trigger amd64-gcc12 on pull requests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57b9a104a26d0761c4cba5726f0ab78b50a57ded Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=57b9a104a26d0761c4cba5726f0ab78b50a57ded commit 57b9a104a26d0761c4cba5726f0ab78b50a57ded Author: Jose Luis Duran AuthorDate: 2023-10-06 12:13:26 +0000 Commit: Ed Maste CommitDate: 2023-10-06 14:07:59 +0000 Cirrus CI: Only trigger amd64-gcc12 on pull requests Since Cirrus Labs is limiting their free usage tier [1], limit gcc CI runs to pull requests only. [1]: https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/ --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 345e7ab148bb..99a6e0106897 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -63,7 +63,7 @@ task: TOOLCHAIN_PKG: ${TOOLCHAIN} EXTRA_MAKE_FLAGS: -s - name: amd64-gcc12 World and kernel build and boot smoke test (FreeBSD repo) - only_if: $CIRRUS_REPO_FULL_NAME == 'freebsd/freebsd-src' + only_if: $CIRRUS_REPO_FULL_NAME == 'freebsd/freebsd-src' && $CIRRUS_BRANCH =~ 'pull/.*' env: TARGET: amd64 TARGET_ARCH: amd64 From nobody Fri Oct 6 14:31:58 2023 X-Original-To: dev-commits-src-main@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 4S29qM3fz1z4whGJ; Fri, 6 Oct 2023 14:31:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S29qM1b97z3Wj8; Fri, 6 Oct 2023 14:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696602719; 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=/TlNgeaMdHJrty2P4soXxbHXEPK9vpEqNlLnDLfsjOE=; b=LwNjV0c1S5GzUzj0CTqcIpIdmhsgsUfpTq2+NEQl9w33FkBXwMuDb+GBoxZDJtZKvgR9C2 hU9qRqYySEjVM8j7P+q0I4bOrbucOzPrUGHpGIIrsAM4WSYwgQem3r3rZ74aup3FdZvRGr ICaEbxGP2EC2FUQfMzqrnBynyGpOb8lv6E8oVjLeERF76Y/ZCjPz6t1Z69sgByPQtzrf9G DK4H3T6HDI3wc/ibSOYgcMVop/JDllO7ir2tVY77ZSSTe7m9PWH3QGh7/1jM/xAYEhC/+6 4wVbYBkope1VEoaPo8qdbTamveoQKTGHOkc6maei77eSpKNvM1VFXAFi0y7u+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696602719; a=rsa-sha256; cv=none; b=uE9d8jRxI+hpJk/z2EEyK6jXwu1p3GJPOwp8w9Z8pQGtTpX28TOWTtd0Wowfr+zwF9hl7h E2k9MLCESRq2mXae16I5gxi90SkconrgPq0ciBrmG7w8WTh+U3AG29damaQrGjiahXWT3k 5iElQSn+IWiOgF3n0vVcDVqYgmki03tOiHTI2LNBPFfEFzM0chY5ZUiFlRxHjdYUB9EOiw lB6PCeupcoAdJBPm3U3o78SKlhqz8KPgP8epbdqAbLI+fLzfZOI7me2KG0VXke/qME8k7S OogIxULfZZdvt5s1ShdpNayihNO8zglWr23s5lxAOTD3EMmcPeKoEEwP6QwW/g== 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=1696602719; 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=/TlNgeaMdHJrty2P4soXxbHXEPK9vpEqNlLnDLfsjOE=; b=qg5Mtv5PvBbUCG8MkAJoJGm8ajZ/23ViXW1QoNCxBryf0ATaM2WJm19d1EoTGCOO6R2j3M WyoHgEysgE9URIH+rLkI7XrVDSLn9OS6iwPzjrVDKGQUsFttv8D2f4iOpG6aBZbYFPDK/+ WMxyZEsNWHY+lqSIG0EIXh86UzLJU+hpsNJuqnOgxcy4x7XFNmzF2kriH0ym1qlCboV9h9 UHyz8sm5LJ89/0tmVjwdFdWZflYe/RHxlOgE/A1xvmva8WXgbhVOxjoLIOgDjVhhC2WypY +iSZt+6ShkcFM+SY886LELUE8s60/53N9YzTqsbvVjlaTJXFiaTvcqtahNdjyA== 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 4S29qM0gZ2zrPH; Fri, 6 Oct 2023 14:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396EVwss007835; Fri, 6 Oct 2023 14:31:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396EVwW1007832; Fri, 6 Oct 2023 14:31:58 GMT (envelope-from git) Date: Fri, 6 Oct 2023 14:31:58 GMT Message-Id: <202310061431.396EVwW1007832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Benedict Reuschling Subject: git: d6ae056e9dc9 - main - Extend description of -p to include interactions with -d and implying -x List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bcr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6ae056e9dc96c2db45982ac358ba9ed716a9202 Auto-Submitted: auto-generated The branch main has been updated by bcr: URL: https://cgit.FreeBSD.org/src/commit/?id=d6ae056e9dc96c2db45982ac358ba9ed716a9202 commit d6ae056e9dc96c2db45982ac358ba9ed716a9202 Author: Benedict Reuschling AuthorDate: 2023-10-06 14:29:21 +0000 Commit: Benedict Reuschling CommitDate: 2023-10-06 14:29:21 +0000 Extend description of -p to include interactions with -d and implying -x PR: 268052 Event: Oslo Hackathon Differential Revision: https://reviews.freebsd.org/D40595 --- bin/ps/ps.1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index 23868d8b3009..c393b2e49c28 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -28,7 +28,7 @@ .\" .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" -.Dd August 24, 2023 +.Dd October 6, 2023 .Dt PS 1 .Os .Sh NAME @@ -238,6 +238,11 @@ So the header texts for multiple keywords can be changed. If all keywords have empty header texts, no header line is written. .It Fl p Display information about processes which match the specified process IDs. +It implies the use of +.Fl x . +When combined with +.Fl d , +all descendent processes are included. .It Fl r Sort by current CPU usage, instead of the combination of controlling terminal and process ID. From nobody Fri Oct 6 15:22:01 2023 X-Original-To: dev-commits-src-main@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 4S2Bx562H2z4wqCm; Fri, 6 Oct 2023 15:22:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2Bx55d4rz3f16; Fri, 6 Oct 2023 15:22:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696605721; 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=oL8gl+5MvCajClH8ow1ciMZLhJllipEqZJNhjD5Nq/Q=; b=g5zo3Mq8G/uV1dbcX4wGg0LHT197GMD127ZHQXz9N7StEvcEY691i27f50+NnrnE8DykqM 6VYTPv+jcymY6EAhC83AdS2n2I5ggCM/IrZ2zjoJQtxq7wckVUDMjWYhtkPNTujcR/w4SX cdz/MoyeMLtw7ZVc4qWwNP4YqPRiUMBh7Y+LT4E5Qw5XrR7NCrl3hxVoggZ1jyVhc2XKu/ xx4o9BbHtRVgR81aEDs6lbWXsK2d6CxLqGWyesjven3BGqtX2+usI8fcC8NxYLW1iV/dim N6wRXf1fOJQLQ13pPtsdDXM+HpFJNwdY29N1tkxGwRk+70SOr+4ABaRjqV3Awg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696605721; a=rsa-sha256; cv=none; b=qOU4LRa+GeIHnVWbgPU3fE+8emQWC86dF8NfvszxYzubqi/l0wXzjMnatmFByPDZlAi+cO aXSZLNyECZpFsoQwhdmO+vyvqTo5EH6sfa0vmC9cyLf2peRSAiqO5zo5qo+UgETm1egeoL s3ehrWmFdLK0nW68RYGnSFxC2+Dycr6DLWyrotDx+TlQVbY9OgpmRU1wqlRpz3Vwtr4BTS fs9br6YrRtcqB0+k12U/YvNoH2WVimLkT2XbKyhawqZUDBUS8qe1lo/A91PlClg7Rj+D2u T3rtQEx5pdt4eTY3+ZybnWqZ/lOf653+KIZV7qI3tj0JwVKjtlRfi0KDYk6Amg== 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=1696605721; 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=oL8gl+5MvCajClH8ow1ciMZLhJllipEqZJNhjD5Nq/Q=; b=DjENEjo9tdzfIzlJXK08adhg8vYDKhzL8tfSr8Uu06BmmhrvFXpt096tRq1amdj5sCX4Qq gucIGYKqXUw8Ruc1Fyk7YMYuL79TQaw9X3IZh8vgwCqp7vfo8RoEqjUbc0nRbyYm2S1Or4 1a2VJGUrC2Pbb/nJP5jYr+2QsANVg3rW3oPGSfQ8F3njPE9IXoJR+JBTajUMHyBccRtNhx HAsMCoKZ+ujkzgf//iw8KmBhyarHlP1wxgDvVe74JKOz5sBiufkkRX3BB2WllDBGTLwOip K5y1SC+qCYCVU7Muj1Yv8mAn2esPaUFLoIUS5TRXO7YN/p9DHnw7mNxmhK11vA== 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 4S2Bx54c81zt9c; Fri, 6 Oct 2023 15:22:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396FM1sb091690; Fri, 6 Oct 2023 15:22:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396FM1dL091687; Fri, 6 Oct 2023 15:22:01 GMT (envelope-from git) Date: Fri, 6 Oct 2023 15:22:01 GMT Message-Id: <202310061522.396FM1dL091687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brad Davis Subject: git: 7bf5f682c073 - main - Improve the pf nat exhaustion test by checking the reply from the echo server List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bf5f682c073fe271b159964f8f17eb2ac8590b3 Auto-Submitted: auto-generated The branch main has been updated by brd: URL: https://cgit.FreeBSD.org/src/commit/?id=7bf5f682c073fe271b159964f8f17eb2ac8590b3 commit 7bf5f682c073fe271b159964f8f17eb2ac8590b3 Author: Brad Davis AuthorDate: 2023-10-06 15:19:51 +0000 Commit: Brad Davis CommitDate: 2023-10-06 15:19:51 +0000 Improve the pf nat exhaustion test by checking the reply from the echo server Event: Oslo Hackathon Approved by: kp --- tests/sys/netpfil/pf/nat.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/netpfil/pf/nat.sh b/tests/sys/netpfil/pf/nat.sh index 4ceded782cfb..7cc0d8f35c96 100644 --- a/tests/sys/netpfil/pf/nat.sh +++ b/tests/sys/netpfil/pf/nat.sh @@ -61,8 +61,8 @@ exhaust_body() # Sanity check atf_check -s exit:0 -o ignore ping -c 3 198.51.100.2 - echo "foo" | nc -N 198.51.100.2 7 - echo "foo" | nc -N 198.51.100.2 7 + atf_check -s exit:0 -o match:foo* echo "foo" | nc -N 198.51.100.2 7 + atf_check -s exit:0 -o match:foo* echo "foo" | nc -N 198.51.100.2 7 # This one will fail, but that's expected echo "foo" | nc -N 198.51.100.2 7 & From nobody Fri Oct 6 16:05:26 2023 X-Original-To: dev-commits-src-main@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 4S2CvB3bRpz4wx3M; Fri, 6 Oct 2023 16:05:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2CvB36qfz4H4G; Fri, 6 Oct 2023 16:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696608326; 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=6+Xr4Kv0GBun5N4x3H3caDtM3+CTw6DmiVH+kBZ3+Gk=; b=E/JFYfTG5Hc+YQPWLPdZ5UQmLjndudHiQxORDv4ZJpOS70kKMEkMyj16oXR6kuogc9FxSp LUDXuYdFDJMdS05geI4yM999KaSrpkyBuTlOfcjIOjRAkRvLitUP2BAuHzIjtzUCQLaahP bZD0+l/HaRT8eEcuIPbuct2OV0qUDw461pJbgcxJGl2jqfyTi90NrsxYH3t+JVU2akA7Qd iQwdKpjK4oHDILl8SkMifjVCHJpAUxo1vaZ2d30vE3Nkhj1Tq5aLlAzvylpC+hujC0wzbV HnMDxIxtzIeYCOxUOLRwlo1AOd5uv3DjatQWfz1/Ogpofp/R+8/JuA2BpvDzag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696608326; a=rsa-sha256; cv=none; b=WbUtW6CCsPkyL7T4XEtwUBa3lT3zFU4XhfaiNMw9ziJv6TGOIn2tHMjAN6FisD37zWlvcG 0Xkfmdzneb/PV7W80j6pqZrEY1nkVYtu7XThA6Ns/e2AAxfM/PtMcwGM+yxJaLl07gn3eB qicsaXVA13ZBIZlN1Z5pku2XQfwjM7osk7GhUgKz3AfxUWRomTJ/VEDVpNajmpvhBSYUGe sdDt0sHFomSXA2Ac4Xxo4eKABzoEGdR1uVyu2gfFfI3/HdRpdmzbI7tXucgvY6Aussnc4M tkj9i/LvMvhCQJbpcWrfsC3DGU9RbjAYwWI/3jphHP4e29t8kPxTlgR7vJi2ew== 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=1696608326; 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=6+Xr4Kv0GBun5N4x3H3caDtM3+CTw6DmiVH+kBZ3+Gk=; b=c2eUTaauelUulRd3fQ/stYy6hG4iINY/cwGeNselQkiQgdl8pNsLgiILKmK1h9g1MW8nwP JV2v5n58puw0ieNA8apo7qSnnV4FEk7HKJk7kBUXoTHsZ7EO970cZE2ADC0Bg0Qy7DCzQN euxZeiA4WQ9YZMI6NCTy+hX7nUFHt6bqfT8Rh6S7NIiqV1tZAmMQLjGGQT6TnGs60nTDcE Wdtzp155OIIUcHBSVd7NxM+40OyFDv1gVGbT2rAuXTX1IbfGTyogFDco+m+tKNx1yr5a+y xt6fFLHpN494qloCjoFsuZrMj+8Nk4nMsmFU2p7rzndJaQeBsQ2S1LQOVZFZLg== 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 4S2CvB297tzvN7; Fri, 6 Oct 2023 16:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396G5QMX060846; Fri, 6 Oct 2023 16:05:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396G5QBJ060843; Fri, 6 Oct 2023 16:05:26 GMT (envelope-from git) Date: Fri, 6 Oct 2023 16:05:26 GMT Message-Id: <202310061605.396G5QBJ060843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Benedict Reuschling Subject: git: a5bebe4359ef - main - geom.4: Document kern.geom.notaste sysctl List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bcr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5bebe4359ef3f80f592dcc989b4088f18abb939 Auto-Submitted: auto-generated The branch main has been updated by bcr: URL: https://cgit.FreeBSD.org/src/commit/?id=a5bebe4359ef3f80f592dcc989b4088f18abb939 commit a5bebe4359ef3f80f592dcc989b4088f18abb939 Author: Felix Johnson AuthorDate: 2023-10-06 15:58:32 +0000 Commit: Benedict Reuschling CommitDate: 2023-10-06 16:02:49 +0000 geom.4: Document kern.geom.notaste sysctl Reported by: jdc_koitsu.org PR: 254897 Approved by: des Event: Oslo Hackathon Differential Revision: https://reviews.freebsd.org/D42109 --- share/man/man4/geom.4 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/man/man4/geom.4 b/share/man/man4/geom.4 index c7f5f7e5250a..c0f3bb23499d 100644 --- a/share/man/man4/geom.4 +++ b/share/man/man4/geom.4 @@ -32,7 +32,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 26, 2023 +.Dd October 6, 2023 .Dt GEOM 4 .Os .Sh NAME @@ -226,6 +226,12 @@ Examine the rank number of the provider's geom. .It Examine the method name of the provider's geom. .El +.Pp +Tasting is controlled by the +.Va kern.geom.notaste +sysctl. +To disable tasting, set the sysctl to 1, to +re-enable tasting, set the sysctl to 0. .It Em ORPHANIZATION is the process by which a provider is removed while it potentially is still being used. From nobody Fri Oct 6 16:16:35 2023 X-Original-To: dev-commits-src-main@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 4S2D841nSTz4wyn2; Fri, 6 Oct 2023 16:16:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2D836ChWz4KtN; Fri, 6 Oct 2023 16:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696608995; 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=QSeMzntKrKJM2gp1OJkar78dYATkug8CSzy7PFSQCR0=; b=efTDbWQOCAWDFDKX09iVA0kdt2NEUXoWqAMZGbOUuTc0sAyjUx1l6E4VZBAE5IC6am/s7X cEh3+VvZsqWvCnFrgtQifM1bhDvnwpbYH4Vxjuj1NRvWfGViqsAtRXFaJUVcS5yXBuokHZ /X50gAfya/r6HudNmuQR7Bz9CBQcOCftpFDMZn/u/u/NPFrNLi3G86hlqUq/hx8xU1vBr5 2eNqqZGqmhchbOy2vtN5wN4m71A8jaupgg5hWGjFqJT4u+5adXOLH19h+g6JpjskCQYD05 x52r+QctpWas0ykW20J2qtJrZyGM2F5X52Xc71Yxu1UYFIVu9KNwUIZlT1BYNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696608995; a=rsa-sha256; cv=none; b=Y+jK8kytKd6Cg4K6IlsOIM/5XE3KtFp4ImEbMx+YZF8nv8NQtPf9yJO857whkxw17mf+VZ EMO3g44FhVLJnJUOpIheqHCohyDx8XA4x44e3Q8t38LjuvhkkytW2+pLev6GsBhrYByKjU MEMyTYjky7WMYyohCf7qfyb0WFmrjI0CokoSodRtK9mQAtqoVdq+158/6ZGkb7HZKD/E5e Lcmk+HTJ5RocOxIwaFnhbh0nfK80HVse2N7LAJvL4S/2d/j3ixQjbeHbQXc4hQuEqykxN2 hTM2j6X121jRv+UaIZw4H+6tVXE2KTkLAN/5BcLxW0gf5vRUBeo3FA05tJPLgA== 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=1696608995; 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=QSeMzntKrKJM2gp1OJkar78dYATkug8CSzy7PFSQCR0=; b=nVUY6sk2sRCSwPD/DGUlEVtnMIuriKA91c5M9gCYV2NCq4osLwarWscV85ZzoKfGjuk1PQ NJBLsiswIEEzH6+ZzbSACP+ttjvRDERZeeN18TMHYGSpNw/PTzcD67S7wluXhkktcSmml/ ZR08fU4sAw+Rq+RZMK3NDX7AJ4aHrHkknjff0f5X/bCzyJJjxjABkZG/RqkmVuy3lC898o 52HvyPKoOXIsMXPAA2zebz80VtCtOlP5Yq6vsdBBH9xzoVTfhhjJc5PloKU5BHtdpsBAqn LAOor87mmyEzUj3iSvNLuDs1+jFXjfarkFymdtOvllflpD9KJtX15NrhXIPGFQ== 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 4S2D835HBLzvjW; Fri, 6 Oct 2023 16:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396GGZMo077095; Fri, 6 Oct 2023 16:16:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396GGZho077093; Fri, 6 Oct 2023 16:16:35 GMT (envelope-from git) Date: Fri, 6 Oct 2023 16:16:35 GMT Message-Id: <202310061616.396GGZho077093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7ce98cf2f87a - main - pfctl: fix incorrect mask on dynamic address List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ce98cf2f87a22240b66e4c38fd887431a25bf7d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7ce98cf2f87a22240b66e4c38fd887431a25bf7d commit 7ce98cf2f87a22240b66e4c38fd887431a25bf7d Author: Kristof Provost AuthorDate: 2023-10-06 12:20:17 +0000 Commit: Kristof Provost CommitDate: 2023-10-06 16:11:28 +0000 pfctl: fix incorrect mask on dynamic address A PF rule using an IPv4 address followed by an IPv6 address and then a dynamic address, e.g. "pass from {192.0.2.1 2001:db8::1} to (pppoe0)", will have an incorrect /32 mask applied to the dynamic address. MFC after: 3 weeks Obtained from: OpenBSD See also: https://ftp.openbsd.org/pub/OpenBSD/patches/5.6/common/007_pfctl.patch.sig Sponsored by: Rubicon Communications, LLC ("Netgate") Event: Oslo Hackathon at Modirum --- sbin/pfctl/parse.y | 39 +++++++++++++++++++++++++++++++++++- sbin/pfctl/pfctl_parser.c | 30 ++++++++++++++++++++++----- sbin/pfctl/pfctl_parser.h | 1 + sbin/pfctl/tests/files/pf0102.ok | 4 ++-- sbin/pfctl/tests/files/pf1018.in | 1 + sbin/pfctl/tests/files/pf1018.ok | 2 ++ sbin/pfctl/tests/pfctl_test_list.inc | 1 + 7 files changed, 70 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 041dcb0587b3..17227b674814 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -4720,6 +4720,10 @@ natrule : nataction interface af proto fromto tag tagged rtable remove_invalid_hosts(&$9->host, &r.af); if (invalid_redirect($9->host, r.af)) YYERROR; + if ($9->host->addr.type == PF_ADDR_DYNIFTL) { + if (($9->host = gen_dynnode($9->host, r.af)) == NULL) + err(1, "calloc"); + } if (check_netmask($9->host, r.af)) YYERROR; @@ -4936,6 +4940,10 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag yyerror("binat ip versions must match"); YYERROR; } + if ($8->addr.type == PF_ADDR_DYNIFTL) { + if (($8 = gen_dynnode($8, binat.af)) == NULL) + err(1, "calloc"); + } if (check_netmask($8, binat.af)) YYERROR; memcpy(&binat.src.addr, &$8->addr, @@ -4951,6 +4959,10 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag yyerror("binat ip versions must match"); YYERROR; } + if ($9->addr.type == PF_ADDR_DYNIFTL) { + if (($9 = gen_dynnode($9, binat.af)) == NULL) + err(1, "calloc"); + } if (check_netmask($9, binat.af)) YYERROR; memcpy(&binat.dst.addr, &$9->addr, @@ -4980,6 +4992,10 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag "a single address"); YYERROR; } + if ($13->host->addr.type == PF_ADDR_DYNIFTL) { + if (($13->host = gen_dynnode($13->host, binat.af)) == NULL) + err(1, "calloc"); + } if (check_netmask($13->host, binat.af)) YYERROR; @@ -5982,7 +5998,7 @@ expand_rule(struct pfctl_rule *r, char tagname[PF_TAG_NAME_SIZE]; char match_tagname[PF_TAG_NAME_SIZE]; struct pf_pooladdr *pa; - struct node_host *h; + struct node_host *h, *osrch, *odsth; u_int8_t flags, flagset, keep_state; memcpy(label, r->label, sizeof(r->label)); @@ -6043,6 +6059,18 @@ expand_rule(struct pfctl_rule *r, sizeof(r->match_tagname)) >= sizeof(r->match_tagname)) errx(1, "expand_rule: strlcpy"); + osrch = odsth = NULL; + if (src_host->addr.type == PF_ADDR_DYNIFTL) { + osrch = src_host; + if ((src_host = gen_dynnode(src_host, r->af)) == NULL) + err(1, "expand_rule: calloc"); + } + if (dst_host->addr.type == PF_ADDR_DYNIFTL) { + odsth = dst_host; + if ((dst_host = gen_dynnode(dst_host, r->af)) == NULL) + err(1, "expand_rule: calloc"); + } + error += check_netmask(src_host, r->af); error += check_netmask(dst_host, r->af); @@ -6121,6 +6149,15 @@ expand_rule(struct pfctl_rule *r, added++; } + if (osrch && src_host->addr.type == PF_ADDR_DYNIFTL) { + free(src_host); + src_host = osrch; + } + if (odsth && dst_host->addr.type == PF_ADDR_DYNIFTL) { + free(dst_host); + dst_host = odsth; + } + )))))))))); FREE_LIST(struct node_if, interfaces); diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 936c5ec53759..925848055bba 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1306,16 +1306,12 @@ int check_netmask(struct node_host *h, sa_family_t af) { struct node_host *n = NULL; - struct pf_addr *m; + struct pf_addr *m; for (n = h; n != NULL; n = n->next) { if (h->addr.type == PF_ADDR_TABLE) continue; m = &h->addr.v.a.mask; - /* fix up netmask for dynaddr */ - if (af == AF_INET && h->addr.type == PF_ADDR_DYNIFTL && - unmask(m, AF_INET6) > 32) - set_ipmask(n, 32); /* netmasks > 32 bit are invalid on v4 */ if (af == AF_INET && (m->addr32[1] || m->addr32[2] || m->addr32[3])) { @@ -1327,6 +1323,30 @@ check_netmask(struct node_host *h, sa_family_t af) return (0); } +struct node_host * +gen_dynnode(struct node_host *h, sa_family_t af) +{ + struct node_host *n; + struct pf_addr *m; + + if (h->addr.type != PF_ADDR_DYNIFTL) + return (NULL); + + if ((n = calloc(1, sizeof(*n))) == NULL) + return (NULL); + bcopy(h, n, sizeof(*n)); + n->ifname = NULL; + n->next = NULL; + n->tail = NULL; + + /* fix up netmask */ + m = &n->addr.v.a.mask; + if (af == AF_INET && unmask(m, AF_INET6) > 32) + set_ipmask(n, 32); + + return (n); +} + /* interface lookup routines */ static struct node_host *iftab; diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 83a4880106a8..d0f3bc3c303c 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -360,6 +360,7 @@ extern const struct pf_timeout pf_timeouts[]; void set_ipmask(struct node_host *, u_int8_t); int check_netmask(struct node_host *, sa_family_t); int unmask(struct pf_addr *, sa_family_t); +struct node_host *gen_dynnode(struct node_host *, sa_family_t); void ifa_load(void); int get_query_socket(void); struct node_host *ifa_exists(char *); diff --git a/sbin/pfctl/tests/files/pf0102.ok b/sbin/pfctl/tests/files/pf0102.ok index 3233ca5a2643..1c76ec2725ba 100644 --- a/sbin/pfctl/tests/files/pf0102.ok +++ b/sbin/pfctl/tests/files/pf0102.ok @@ -1,8 +1,8 @@ pass inet from 1.1.1.1 to (self) flags S/SA keep state -pass inet6 from 2002:: to (self)/32 flags S/SA keep state +pass inet6 from 2002:: to (self) flags S/SA keep state pass inet6 from 2002:: to (self) flags S/SA keep state pass inet from 1.1.1.1 to (self) flags S/SA keep state pass inet from 1.1.1.1 to (self) flags S/SA keep state -pass inet6 from 2002:: to (self)/32 flags S/SA keep state +pass inet6 from 2002:: to (self)/40 flags S/SA keep state pass inet6 from 2002:: to (self)/40 flags S/SA keep state pass inet from 1.1.1.1 to (self) flags S/SA keep state diff --git a/sbin/pfctl/tests/files/pf1018.in b/sbin/pfctl/tests/files/pf1018.in new file mode 100644 index 000000000000..90f0a3a0bab7 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1018.in @@ -0,0 +1 @@ +pass from { 192.0.2.1 2001:db8::1 } to (pppoe0) diff --git a/sbin/pfctl/tests/files/pf1018.ok b/sbin/pfctl/tests/files/pf1018.ok new file mode 100644 index 000000000000..04950f0035b8 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1018.ok @@ -0,0 +1,2 @@ +pass inet from 192.0.2.1 to (pppoe0) flags S/SA keep state +pass inet6 from 2001:db8::1 to (pppoe0) flags S/SA keep state diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc index 98ea3257d492..4a63c0ba48b7 100644 --- a/sbin/pfctl/tests/pfctl_test_list.inc +++ b/sbin/pfctl/tests/pfctl_test_list.inc @@ -126,3 +126,4 @@ PFCTL_TEST(1014, "Ethernet rule with one label") PFCTL_TEST(1015, "Ethernet rule with several labels") PFCTL_TEST(1016, "Ethernet rule with ridentifier and one label") PFCTL_TEST(1017, "Ethernet rule with ridentifier and several labels") +PFCTL_TEST(1018, "Test dynamic address mask") From nobody Fri Oct 6 16:31:55 2023 X-Original-To: dev-commits-src-main@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 4S2DTl3Plkz4x1rR; Fri, 6 Oct 2023 16:31:55 +0000 (UTC) (envelope-from pstef@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2DTl2yHTz4P1h; Fri, 6 Oct 2023 16:31:55 +0000 (UTC) (envelope-from pstef@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696609915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Phf2Xa6c9WzEk0lV+zfJcE04601MGJS2cb93FD6F0E0=; b=Al0q3SVP0lupdcQMtszEoivQ+RLGXjXA9M8lIrv41tQaauMn7N6izsjhHmRmwbO7AIHRwQ PXPSmNa1OnilHK6HPAIA+qSWs2uE6HVgCuCtUiVLlKOk2azev1+S2z32GfG3yj31DClAbG U0tdBDXGoXLq6z/Xc8wdJu4l2vzmwVXamPGqBxyTRJOUg07SdIEM30c4OjogxkHypgJo11 jffJRhJjK+I/5cDfzVOb3vGz/Q8neLw5WwFLzxxp4tKhRzVQLdsbgduOPnHS1OvjYdcjh1 t2gX4wV3GEHXAer8mbMqSaRxhj39AksKHwZaAYgGcBtikxfIgPajxNGQNvbHhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696609915; a=rsa-sha256; cv=none; b=r9+xSgLMTs0n2c7KNgYjKVeHQDPbtcDruXLOut1ZduwIyuU6hsv7Zc07ZIvSDgLxWQjUy+ JBxS83CjGw0edS+O6U+gZRZdiatHDMmBCC1WcjYMtWDbhRlYImEbTGUEOUY4KRAB88Ygr5 TwN3ZAJjwOLOXTDiAdvn34OQ/BXrhqW3lsPbFZANxvGhTU+BwAdahAsqSdM7Rd1Vbs3Uly Omly7nHNvIdk590rtq4K6BC98YhHMy0iAPR2Bfp4HbuJYTIizFo9BuclB9zWakWLG+iKEt ktNfDWR4WvkParvcPAWnZKh3AAZ9/rspveUjG55GupGoZbIFce5YrXYue678eg== 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=1696609915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Phf2Xa6c9WzEk0lV+zfJcE04601MGJS2cb93FD6F0E0=; b=w/5tFeYBwVpyWrtutHMbSYX5aj/weteBo3CBL5XhaHroVKk8R0WHavs0wNKIn8Hix6VRhc bmEFE9U+x23ZMRnm97aZF5c6d/x9FWK75MoQkO7iJ8pXGmXB7K+NS7yYxpcxSPNx8G8O8y OBORT5jxBJ2V4TfyakfadigxhcAfK7HyNQC6oPAfJ07E/giEd2yU69RgiubpJhu84RZF+D QHZhk+wYwJ+9n2STA/BEIixgHWoSkQ1UDSCOsvf8p/9qHD5A4GExE3BH6Z+S3/HAcwHgLU NdyLkpK8ptObvo/CBIZftB2xWcULq/37V+BBWHhIyXDMARO6A+fmb/r8m15aNQ== Received: by freefall.freebsd.org (Postfix, from userid 1403) id 4435B1DA93; Fri, 6 Oct 2023 16:31:55 +0000 (UTC) Date: Fri, 6 Oct 2023 16:31:55 +0000 From: "Piotr P. Stefaniak" To: Benedict Reuschling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d6ae056e9dc9 - main - Extend description of -p to include interactions with -d and implying -x Message-ID: References: <202310061431.396EVwW1007832@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <202310061431.396EVwW1007832@gitrepo.freebsd.org> On 2023-10-06 14:31:58, Benedict Reuschling wrote: > Extend description of -p to include interactions with -d and implying -x > > PR: 268052 > Event: Oslo Hackathon > Differential Revision: https://reviews.freebsd.org/D40595 Sorry, but that's been changed, see https://reviews.freebsd.org/D41231 and the email thread under https://lists.freebsd.org/archives/freebsd-current/2023-July/004071.html Piotr From nobody Fri Oct 6 16:40:22 2023 X-Original-To: dev-commits-src-main@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 4S2DgV2BkGz4x2jV; Fri, 6 Oct 2023 16:40:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2DgV1jt1z4Q3q; Fri, 6 Oct 2023 16:40:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696610422; 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=mEt3l7/EpXOarg5/VthYedOktwGrzv1CC6N0fV7zooQ=; b=VCTJTpqd2Aba7FhMxUsYmVL5Rxrp7vjEomLzTBzRdnI+6VZ7EN7v7548IIbE2c8mSJd/yB HcsuKhwprxFvJKJ2Zy5lFyMsVViUkr1m7jKcZIcxRnclpcThrnfMe51DCc0uI/nd5Bf6RC X6+IFaobl0fnrVPICK1x3F6YN9S0JmY0YibNFOsRNXCxV5eDEJ9ATS1GiztTp7EjLbkG3y y9F0ITxMPWr4nV3A2MWPpXWJnaXJrmWqXB1epXKUf02Lrlrq9z+efkivUOaxnq1HZ8GFUG KOpeya7KO1qGh3ZXCIUxJNwXbD62vu+kMuUBukAD8y6Zj5JO2wWbRuEBZxuU/A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696610422; a=rsa-sha256; cv=none; b=aoJ026ac7XNcbQHgLNAeif66VTVLclyCSEwQ3z3ClIE1zcsxjs8gCZWgyGMEAOl1vmbDom +P1S5vtEe9gG5q9mguq+EC4fVJ2F45c1y6a/4bvl7VIhJr9EiJZBKxKfOsF/r51SYhZinS eIqDsjCLpwliexXolz88XM67gc4UtgDJbc5W42sRlKn9bG8vK/gXU+gAC8GIYv7iM8y2LM ZPrcQhk3JUP/ja07XP+k4tmZXhVf9E5gxmuYlyS5CYyu7J8SbGxnbowkkApI+Q8j6lv8gu VwwkyGlYTGIsucjF+VRCuy385a/hxnSQXhSDQM+rVutUnr5/DJoBIlNWjelQmA== 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=1696610422; 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=mEt3l7/EpXOarg5/VthYedOktwGrzv1CC6N0fV7zooQ=; b=H9OJhcgFjkOnlVLy1tR7AQOnEjl7SSxsG06Sr/QsN7PtPh2lKb6QNaYSlBfZzOV6NB0Mc6 Pap40tE8MMXIPD0rBv1hImq5TSoURvOCmURSLU0tA3JYor1PioTgrJL4+bVJmtX8Mj22tK HeFLdfIZFGy9YrGx+bq6XUlh287idkn/DPivBXIPVmz0XUMysD5EJXR/xg0WuzdHBhV/16 d4rrQK1uuUmzu7Oddnpdse9/c9XJjFwCQe+UIJ+zX8+PG1fMzKmD9MShFSkZqZ+jn48WZD TkAPsd3WadW9VtsBQyp0ap+NCo0roOHP3TSFAW1OEOSJ3yAxMCIJhApNTV23Fw== 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 4S2DgV0dDTzvwY; Fri, 6 Oct 2023 16:40:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396GeMhD019250; Fri, 6 Oct 2023 16:40:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396GeMZ9019247; Fri, 6 Oct 2023 16:40:22 GMT (envelope-from git) Date: Fri, 6 Oct 2023 16:40:22 GMT Message-Id: <202310061640.396GeMZ9019247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: aad8fb3e2be2 - main - tests: Add a test case for arp host lookups. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aad8fb3e2be27ed3a04531aa01913ab4b7616244 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=aad8fb3e2be27ed3a04531aa01913ab4b7616244 commit aad8fb3e2be27ed3a04531aa01913ab4b7616244 Author: Dag-Erling Smørgrav AuthorDate: 2023-10-06 16:39:59 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-06 16:39:59 +0000 tests: Add a test case for arp host lookups. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D42108 --- tests/sys/netinet/arp.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netinet/arp.sh b/tests/sys/netinet/arp.sh index 045ccd1dc7a7..9181d38b10b0 100755 --- a/tests/sys/netinet/arp.sh +++ b/tests/sys/netinet/arp.sh @@ -120,12 +120,61 @@ pending_delete_if_cleanup() { } +atf_test_case "arp_lookup_host" "cleanup" +arp_lookup_host_head() { + atf_set descr 'Test looking up a specific host' + atf_set require.user root +} + +arp_lookup_host_body() { + + vnet_init + + jname="v4t-arp_lookup_host" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname}a ${epair0}a + vnet_mkjail ${jname}b ${epair0}b + + ipa=198.51.100.1 + ipb=198.51.100.2 + + atf_check -o ignore \ + ifconfig -j ${jname}a ${epair0}a inet ${ipa}/24 + atf_check -o ignore \ + ifconfig -j ${jname}b ${epair0}b inet ${ipb}/24 + + # get jail b's MAC address + eth="$(ifconfig -j ${jname}b ${epair0}b | + sed -nE "s/^\tether ([0-9a-f:]*)$/\1/p")" + + # no entry yet + atf_check -s exit:1 -o match:"\(${ipb}\) -- no entry" \ + jexec ${jname}a arp -n ${ipb} + + # now ping jail b from jail a + atf_check -o ignore \ + jexec ${jname}a ping -c1 ${ipb} + + # should be populated + atf_check -o match:"\(${ipb}\) at $eth on ${epair0}a" \ + jexec ${jname}a arp -n ${ipb} + +} + +arp_lookup_host_cleanup() { + vnet_cleanup +} + + atf_init_test_cases() { atf_add_test_case "arp_add_success" atf_add_test_case "arp_del_success" atf_add_test_case "pending_delete_if" + atf_add_test_case "arp_lookup_host" } # end From nobody Fri Oct 6 16:40:23 2023 X-Original-To: dev-commits-src-main@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 4S2DgW3WnWz4x2XL; Fri, 6 Oct 2023 16:40:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2DgW2lpKz4QSR; Fri, 6 Oct 2023 16:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696610423; 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=L2YMgFsBueVdIUF+NtJw5K00qkcFw1Ess5WSkvTB5Ao=; b=d46I7hLxmhGnzlxZTRVKphHdT9N9c/zO86UU7Xq/hslsRlMSyYQWYuQa7XkgjXHZZtusvq bklTubpypW9A8BJguoWQxBvrbiMif7jMbD30/EXuNzzG3vCFkPTijDCh1ZqSFZW0zF4QAB /y2Yy9+Rk1UbV38AH+2B/p9xoiVltS14vwmXyj/rjuP/ksLx94e0qUsYCwbiRXxpe0DbDj T93jh02HaQZJOCuVXlROH8Mkqc8wlYCVbswFFdgU/c7Us62hthCn/1Fttyf9UKX6ewnlrJ U7P2Iv0WgD4ZDRkbtBcIIGXc02kS1wGBv9+fOmXZ4Ngc9++7+j6RN8H4Au5cew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696610423; a=rsa-sha256; cv=none; b=S/HhdCh5eyi2plfoy67tdzbFtMkLx8RoLNmHfJeNxbkwvzolPq6IfqqPta2Bw4FY/KLC+X 8q74IfBrzUtXyiB2wgtYFwmNRCm/mEEL0oZjdYSpVvGRqxAjzmgV6Npfn/9SeRdS0nqmss CktGY2FbbenLLMczu/QK4/nLZqmwsl3k+gHvAWDoF8yUbYu+gFH9ic5DBNEzHIPutnrYiW vEg+9lD45jZhguJoYil+Q1xCTJ3ga5BH47nPiFrMdoz0nJPGT/F0M/BdhN5WnqI6QIyfHd XtBwk0jfIdEIjRFWON/mq0RZYvjjZyPIWqf7hzgq/1KwLw9RJcbOsgu8lsb3Bw== 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=1696610423; 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=L2YMgFsBueVdIUF+NtJw5K00qkcFw1Ess5WSkvTB5Ao=; b=aWcfFLEa7FE/ET8KerB9PoogkWK88KjvnInnpgsjZpHLSYAZWziZYm0Rv+iHs2vZlWKiof VSnAOexcXYLk/jIKpFTfnHAET9j4q8AOz3NX9q5wvf1zttp8XKOlI6+YyN4ElF7zaZbJY+ VN67W7nChKa4Lm+3umMCYQYvS7N7wgj6M30aee0WJ+0TWklpdHtEpKcRuiAx1MkbjOJxCM YO9A6rk8ODeBcnHTbarvIz/4Ro19iCy2rcspLwm5j+USusrk15Zg/sMrjmGOx7qSTXpEZ7 vOYbC2irPlRJ5wToH6Ccbx0U2ZMeYfl5BOZGHy6mVktGeE74zKk2OmyXmrUbAw== 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 4S2DgW1mPTzvt3; Fri, 6 Oct 2023 16:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396GeNnU019319; Fri, 6 Oct 2023 16:40:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396GeNkY019316; Fri, 6 Oct 2023 16:40:23 GMT (envelope-from git) Date: Fri, 6 Oct 2023 16:40:23 GMT Message-Id: <202310061640.396GeNkY019316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: c5e5722220e0 - main - tests: Use ifconfig -j instead of jexec ifconfig. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5e5722220e091737c70ef4b6571480ad4188fed Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c5e5722220e091737c70ef4b6571480ad4188fed commit c5e5722220e091737c70ef4b6571480ad4188fed Author: Dag-Erling Smørgrav AuthorDate: 2023-10-06 16:40:07 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-06 16:40:07 +0000 tests: Use ifconfig -j instead of jexec ifconfig. Reviewed by: kp, asomers Differential Revision: https://reviews.freebsd.org/D42110 --- tests/sys/common/vnet.subr | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/sys/common/vnet.subr b/tests/sys/common/vnet.subr index 50abadaec81d..183f7284d614 100644 --- a/tests/sys/common/vnet.subr +++ b/tests/sys/common/vnet.subr @@ -79,7 +79,7 @@ vnet_ifrename_jail() ifname=$2 ifnewname=$3 - jexec ${jailname} ifconfig $ifname name $ifnewname + ifconfig -j ${jailname} $ifname name $ifnewname sed -i "" "/^${jailname}/s/${ifname}/${ifnewname}/" created_jails.lst } @@ -88,7 +88,7 @@ vnet_cleanup() if [ -f created_jails.lst ]; then while read jailname ifnames; do for ifname in ${ifnames}; do - jexec ${jailname} ifconfig ${ifname} destroy + ifconfig -j ${jailname} ${ifname} destroy done jail -r ${jailname} done < created_jails.lst @@ -96,10 +96,9 @@ vnet_cleanup() fi if [ -f created_interfaces.lst ]; then - for ifname in `cat created_interfaces.lst` - do + while read ifname; do ifconfig ${ifname} destroy - done + done < created_interfaces.lst rm created_interfaces.lst fi } From nobody Fri Oct 6 16:45:09 2023 X-Original-To: dev-commits-src-main@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 4S2Dn12p4Qz4x3cp; Fri, 6 Oct 2023 16:45:09 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2Dn12HJmz4SBQ; Fri, 6 Oct 2023 16:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696610709; 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=VA04pzFro5bq44lmiconX3kwNgBUco2jMwAjV9NQkCI=; b=LZrcCun3JP/PuAkdi/B71Xv68ingZjrLU9H92PFo3o9gkTRqn7wQzuoVs2fWwnM/aVZTXh 8HTa0OwWyv70JeLGd6BGTl9Voq0M9Fi+a2r59I7n6tGFpzR8JwBpFUpbR5rJwyEO2u92MG uEoUz08xX6yoDx25NfcHmET2iA74lL1Mq028vkqkQbdRCq12mG/hUhoZ+4WUJ+JdV+ygxU rZ9L1GYKtPNjiW3z2trrlQPyiHVi0hJZHibZsxJHT1Ue1wfhXJtX89nJqt7eZlkacex4Cj /7Ew6wwpVnbcvi5W0f+dk98vPdpdzqFOjKejUXVxBzHmHSmKn5eKARG+YCGDEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696610709; a=rsa-sha256; cv=none; b=yGZjW7HXCjttzvWDb6BhU7q0l5LQ1ioNT89FY+SP8tq01bREpsYpWFAC19pq0mfxU/chf4 GAqDDMdP2bOtHwGJ2HaVxL6G9yuJ0uxorKfF9d/uaLfRoVmPg4pQANc7vsukZmw+E+pfyv cuu9pdPo8/fELGZ20Vo1QlksXA1cMiNIHxbB79p+woHd/GDNZAd7lchg5MUiPpR+rUjI9g AeB1IiKe8zHzgKI/+TASK2kRZpJGojJxg9NrgNp9rBx506UlsCN11rZwtAa7nSEXGhPW/4 iICdcduEe869c52atZZLHWb0ixfdwUcT8M9Zm0zvT2G1owlVhKI7AV6kaqpNTQ== 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=1696610709; 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=VA04pzFro5bq44lmiconX3kwNgBUco2jMwAjV9NQkCI=; b=hgFVEGLyDQf1nPADz0dn/dPyfLWPiUss2HCtarW/Kl83S5/NolNGGAE9rOYoJCWbQkfXtK dHo3gSLyU2zVsamoDszLUKNyWyUZ4VaL/NnIY2u8QUOfpe8XeDggldnDljmoiQF0cd3vBv p/fDBU07P+ZyoKqOrTE6+OmwRdJimbz5xvK8PIjvf/ev8X5cLfUIZWSNNDxBEdmy0hd1qB NFVKO59SWscVEu8gwInxZMuVrts++XZl2sp8PEbZurwT5jnayIPSXVpVrWceSmPeihtB9K gVbRQOVgar895xeMHztTbpbfYQiyMreiwfx6XXm0GuUwvB8JgDWZDSApaVx/jA== 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 4S2Dn11NHxzw3D; Fri, 6 Oct 2023 16:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396Gj9GR026913; Fri, 6 Oct 2023 16:45:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396Gj9PH026910; Fri, 6 Oct 2023 16:45:09 GMT (envelope-from git) Date: Fri, 6 Oct 2023 16:45:09 GMT Message-Id: <202310061645.396Gj9PH026910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: cec8e6ba64cc - main - daemon: Disable stdio buffering. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cec8e6ba64ccab7fb0d9fa531ebad9228233334d Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=cec8e6ba64ccab7fb0d9fa531ebad9228233334d commit cec8e6ba64ccab7fb0d9fa531ebad9228233334d Author: Dag-Erling Smørgrav AuthorDate: 2023-10-06 16:44:52 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-10-06 16:44:52 +0000 daemon: Disable stdio buffering. The daemon utility already does its own buffering and retransmits its child's output line by line. There's no need for stdio to add its own buffering on top of this. MFC after: 1 week Sponsored by: Modirum MDPay Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D42111 --- usr.sbin/daemon/daemon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index dfbb609ce10d..65e6bb7ca190 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -420,6 +420,7 @@ daemon_eventloop(struct daemon_state *state) close(state->pipe_fd[1]); state->pipe_fd[1] = -1; setproctitle("%s[%d]", state->title, (int)state->pid); + setbuf(stdout, NULL); while (state->mode != MODE_NOCHILD) { ret = kevent(kq, NULL, 0, &event, 1, NULL); From nobody Fri Oct 6 17:05:59 2023 X-Original-To: dev-commits-src-main@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 4S2FF416l1z4x68g; Fri, 6 Oct 2023 17:06:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2FF40dJDz4VwK; Fri, 6 Oct 2023 17:06:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696611960; 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=QA74JIT4LioNZkuww4fp2WyEwe4KXKfWwC9hlyqm5rk=; b=iXP87pRbX9B8WZ9zRkgRGuHkSUnDJfRporQtuwHH386A6UPopouXZX2xhQU9jMkaaKAZ4e xpPAJhYH/OrN4r0ed3qxGIbpmPjn7KhzKSnk8MWqFSkIeIdCo86tS+7Mc3QTju+UOrNrc4 bIYE/JeJRGxv4WRydpsUFt+Jou5DWhCEh593T45YTOk0sd1pX6tNkz3dv8pZhEYZWySf9N SI+ZYjDF04wyx+grzSkSnIXDsYActOs1TGaKmCnpo/SWy9d1RyszYiejB2T36QiJuq1HkH fCM4v1Lc+THuP/HqiNZXuyPJWxh/Sop5JLR5BTx1jXiFvzKODQ+zX2E0XReG2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696611960; a=rsa-sha256; cv=none; b=iakOLe981vF0o8Ix1+oilkRuymjGe05dN/RLdmY++Y3CFmJpkEm96IqYHxOjVUpMjT5Iad ZmzIL7xRxTI0mqy6wxJD4p+OdSCWKg3ak+78mjtFJSggWZrn8/VfCLELksskZv4GhH89nl wtbHx0VJ/t7BbQ77Xum7rohbAOl3N6yCDObhzVVzC5fOkFj+xMDLB0qNytfB8jA1t4KcQu U1dISvXtiXQPMkLZwBWDh9y37oRfZqPh9iHebqXeaKaL+VUSp5llqQfgHH4Ul/Q1Q3lG4/ TlxxeEgAdj9ic4dtvfsOxfLMdDqzLAsxMCDWodv81LZnIFnfD5pmIPZddHh0yw== 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=1696611960; 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=QA74JIT4LioNZkuww4fp2WyEwe4KXKfWwC9hlyqm5rk=; b=FqbhHVVXukXKuieFlafaBwclCvUPIyOlIwmLahT3eUNFM9PCSrUh5K0iX2Wei3YWiytMWb spOAq4oJX93j3arw0KybOxjdPtctE4Yd3u9L/CxJQcdu7p2GLYeLnIgoGvFvUOpfLRLxQ9 JnBPODfOlsUcTJL4DQlLVyOpZs/5yMhoWi0xWPU7IzCxfv0LMOMuqyEqN9CMLaDzL2Yipv O4iTDe/FO4j4hsJpk1S5OGe5+3t5UY3WEQVmozITvSUGXdUwwDCAVSmtGABV2nH8HHQwnX iBuvwWyCf+5bobycm+ccee2024XRT4nphD4Gp1hDC7R23qQ2mqm57bhq+jww9A== 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 4S2FF36p8mzwpH; Fri, 6 Oct 2023 17:05:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396H5xc6060655; Fri, 6 Oct 2023 17:05:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396H5xjI060652; Fri, 6 Oct 2023 17:05:59 GMT (envelope-from git) Date: Fri, 6 Oct 2023 17:05:59 GMT Message-Id: <202310061705.396H5xjI060652@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 7786911ffd1f - main - dwc: Rewrite part of the descriptors setup functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7786911ffd1f7c6eec0334a06bf9ec1bc14540d3 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=7786911ffd1f7c6eec0334a06bf9ec1bc14540d3 commit 7786911ffd1f7c6eec0334a06bf9ec1bc14540d3 Author: Emmanuel Vadot AuthorDate: 2023-10-05 17:10:00 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-06 17:05:37 +0000 dwc: Rewrite part of the descriptors setup functions - Add a txdesc_clear which clears the tx desc instead of doing that in dwc_setup_txdesc based on arguments. - Remove dwc_set_owner, in the end we always set the owner of the desc as we do it for id > 0 and then for the first one. - Remove dwc_ prefix No functional changes intended. --- sys/dev/dwc/dwc1000_dma.c | 68 +++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index 7c5924296894..f6baa0bd3e45 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -182,50 +182,47 @@ dwc_get1paddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) } inline static void -dwc_set_owner(struct dwc_softc *sc, int idx) +txdesc_clear(struct dwc_softc *sc, int idx) { - wmb(); - sc->txdesc_ring[idx].desc0 |= TDESC0_OWN; - wmb(); + + sc->tx_desccount--; + sc->txdesc_ring[idx].addr1 = (uint32_t)(0); + sc->txdesc_ring[idx].desc0 = 0; + sc->txdesc_ring[idx].desc1 = 0; } inline static void -dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr, +txdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr, uint32_t len, uint32_t flags, bool first, bool last) { uint32_t desc0, desc1; - /* Addr/len 0 means we're clearing the descriptor after xmit done. */ - if (paddr == 0 || len == 0) { + if (!sc->dma_ext_desc) { desc0 = 0; - desc1 = 0; - --sc->tx_desccount; + desc1 = NTDESC1_TCH | len | flags; + if (first) + desc1 |= NTDESC1_FS; + if (last) + desc1 |= NTDESC1_LS | NTDESC1_IC; } else { - if (!sc->dma_ext_desc) { - desc0 = 0; - desc1 = NTDESC1_TCH | len | flags; - if (first) - desc1 |= NTDESC1_FS; - if (last) - desc1 |= NTDESC1_LS | NTDESC1_IC; - } else { - desc0 = ETDESC0_TCH | flags; - if (first) - desc0 |= ETDESC0_FS; - if (last) - desc0 |= ETDESC0_LS | ETDESC0_IC; - desc1 = len; - } - ++sc->tx_desccount; - } - + desc0 = ETDESC0_TCH | flags; + if (first) + desc0 |= ETDESC0_FS; + if (last) + desc0 |= ETDESC0_LS | ETDESC0_IC; + desc1 = len; + } + ++sc->tx_desccount; sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr); sc->txdesc_ring[idx].desc0 = desc0; sc->txdesc_ring[idx].desc1 = desc1; + wmb(); + sc->txdesc_ring[idx].desc0 |= TDESC0_OWN; + wmb(); } inline static uint32_t -dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr) +rxdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr) { uint32_t nidx; @@ -254,7 +251,7 @@ dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp) struct mbuf * m; uint32_t flags = 0; int i; - int first, last; + int last; error = bus_dmamap_load_mbuf_sg(sc->txbuf_tag, sc->txbuf_map[idx].map, *mp, segs, &nsegs, 0); @@ -299,23 +296,18 @@ dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp) sc->txbuf_map[idx].mbuf = m; - first = sc->tx_desc_head; for (i = 0; i < nsegs; i++) { - dwc_setup_txdesc(sc, sc->tx_desc_head, + txdesc_setup(sc, sc->tx_desc_head, segs[i].ds_addr, segs[i].ds_len, (i == 0) ? flags : 0, /* only first desc needs flags */ (i == 0), (i == nsegs - 1)); - if (i > 0) - dwc_set_owner(sc, sc->tx_desc_head); last = sc->tx_desc_head; sc->tx_desc_head = next_txidx(sc, sc->tx_desc_head); } sc->txbuf_map[idx].last_desc_idx = last; - dwc_set_owner(sc, first); - return (0); } @@ -338,7 +330,7 @@ dma1000_setup_rxbuf(struct dwc_softc *sc, int idx, struct mbuf *m) BUS_DMASYNC_PREREAD); sc->rxbuf_map[idx].mbuf = m; - dwc_setup_rxdesc(sc, idx, seg.ds_addr); + rxdesc_setup(sc, idx, seg.ds_addr); return (0); } @@ -463,7 +455,7 @@ dma1000_txfinish_locked(struct dwc_softc *sc) bmap->mbuf = NULL; sc->tx_mapcount--; while (sc->tx_desc_tail != last_idx) { - dwc_setup_txdesc(sc, sc->tx_desc_tail, 0, 0, 0, false, false); + txdesc_clear(sc, sc->tx_desc_tail); sc->tx_desc_tail = next_txidx(sc, sc->tx_desc_tail); } sc->tx_map_tail = next_txidx(sc, sc->tx_map_tail); @@ -730,7 +722,7 @@ dma1000_init(struct dwc_softc *sc) } for (idx = 0; idx < TX_DESC_COUNT; idx++) - dwc_setup_txdesc(sc, idx, 0, 0, 0, false, false); + txdesc_clear(sc, idx); WRITE4(sc, TX_DESCR_LIST_ADDR, sc->txdesc_ring_paddr); From nobody Fri Oct 6 17:06:01 2023 X-Original-To: dev-commits-src-main@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 4S2FF533xgz4x6HQ; Fri, 6 Oct 2023 17:06:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2FF52QpSz4WG9; Fri, 6 Oct 2023 17:06:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696611961; 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=tSnB0a1Vl1X9qLMF5WIFIWiPyVXkhmKXnutyV8tqwpA=; b=nd/C7UYUmVFAg6/VyHnoztr2YCcald+dWcC33N9RQqCSoYlQK1jbI34kE9AYBRbEdrocLv WJMIcSdjp3foPMAYYlDLEQTmiqKzdXOKX2pH7f8qa23KhzcJJby/vj1iaYE5wBCsLCeoPL 3hPla0nXwQ2u3ReolMEeepGnM5tA0V9EY856yAY+Gu0fFuoIyxnzZgcyC0tcbmlvu0yLYP uZby5xBrT7Ge6tmxxnGfuHjK2cpaT6IUQWhSFkbRvHdTV68cvenDxt/hmAuj3kDrF5nXwH sQIsrbNAZmQkC8pUvH+tpP2QpqjxvVR7KJR3VLtKNIrAkmn58tMZ7P9995r3SA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696611961; a=rsa-sha256; cv=none; b=E9ADifn7uMv7tqeX4o9W4F8plQMkxxRPU2DfnQ/uGK7usObW5aVAn/6Vs6UvzUypht1Mjl 6wEagrEHubHDd/c1S//5FYmwaVMtKZtdXvt0sip78WzJKPGa9XZaF/16eFfARcv+p3r+nY W7/YQBwZ7f+Ws9OcrIXRISC+rtSe0q+8D4ClWPk3Ny90v65UB9NWnONRPdo6LRsOY3VBTp vOlRqnI5em3HiMO/SHb7SmxX+X4fs/5LHn/kKkv+KScqHz9Z1ezeaR0A2+CGOZ/eb73nol 1F+kMjS0s4aMNsBmU4WXVEiMuvHwn0pouDD5btU4YVpgvZfodVYEmK1G47SzIQ== 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=1696611961; 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=tSnB0a1Vl1X9qLMF5WIFIWiPyVXkhmKXnutyV8tqwpA=; b=xmRbHLMelVx4sUW49LU/zEhgP1H/rM/1hrTVyoGuTzS+QQ7Vjv9sGcgkC359ThIve9/iY9 S3wX5KjVHuzcaBUsp9pWLCQVKRvUq9yxbYkPzZa8Ybl/hvUYyuQopTVNMhvY+I6Fc1HvcL nBDT/DlIzkg0WEtPjs1zDD1qac/E9+fS3ix/Mb4xhBXZfEhFUmXGI3m43QJbmsqKoC85gl LHxwDp6nInYvlV0VQjU7ezzXkRD6UJxe8Inp0dJeNrznCPqqS8xswN0eyOPcW1RpCIK/jj W9JyMOnn74/ZxxpMzamldt7b69thoqSAeHGlR0WsxH5hLUyidmgZm+OwYJ068g== 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 4S2FF50wJjzwpJ; Fri, 6 Oct 2023 17:06:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396H61Q8060712; Fri, 6 Oct 2023 17:06:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396H615W060709; Fri, 6 Oct 2023 17:06:01 GMT (envelope-from git) Date: Fri, 6 Oct 2023 17:06:01 GMT Message-Id: <202310061706.396H615W060709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 7854d0f6584d - main - dwc: Get the mii clock after calling IF_DWC_INIT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7854d0f6584d259fd7f13595e3d3a4f157db9339 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=7854d0f6584d259fd7f13595e3d3a4f157db9339 commit 7854d0f6584d259fd7f13595e3d3a4f157db9339 Author: Emmanuel Vadot AuthorDate: 2023-10-06 15:43:09 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-06 17:05:40 +0000 dwc: Get the mii clock after calling IF_DWC_INIT We need to calculate it based on the clocks and they aren't started before IF_DWC_INIT. --- sys/dev/dwc/if_dwc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index ffcf3e8d6afd..d212c2db131f 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -504,7 +504,6 @@ dwc_attach(device_t dev) sc->rx_idx = 0; sc->tx_desccount = TX_DESC_COUNT; sc->tx_mapcount = 0; - sc->mii_clk = IF_DWC_MII_CLK(dev); sc->node = ofw_bus_get_node(dev); sc->phy_mode = mii_fdt_get_contype(sc->node); @@ -552,6 +551,11 @@ dwc_attach(device_t dev) if (IF_DWC_INIT(dev) != 0) return (ENXIO); + if ((sc->mii_clk = IF_DWC_MII_CLK(dev)) < 0) { + device_printf(dev, "Cannot get mii clock value %d\n", -sc->mii_clk); + return (ENXIO); + } + if (bus_alloc_resources(dev, dwc_spec, sc->res)) { device_printf(dev, "could not allocate resources\n"); return (ENXIO); From nobody Fri Oct 6 17:06:02 2023 X-Original-To: dev-commits-src-main@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 4S2FF63RxKz4x6CD; Fri, 6 Oct 2023 17:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2FF62ttBz4WK4; Fri, 6 Oct 2023 17:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696611962; 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=gryxDZJtkT+LSBZdVNfxUjmZB7kEBIYK5ZeKzGXivZI=; b=mISUTfFo+X5d3CSJOs9WVjLjWDd6ntFP5A8R2johw+hz58nLg/3eSmd2LzHvQj909bH67w P6/EdBF60xcGb/q516LE62J8H/CsAKFwuAtCnysoqMRFJ+PVKFEKoqoNxAfEh6WELi5pmc c/UQ1VwU3/32jorOnGrFAC63HDMRv7UNZGIDeNXeK4q2K9L3Sqmel3SQHfibEUJadrtSEJ wNaivbudRcAyk8nGkRljn7EL2qYUe38Pg5VbLkGXLX362DkQ1ZJLQSAF5dgCYirQwuMdI4 2rqQflAAMbPeil4nxJXGBoQbNannUZouaMkGQcTIjZ/dLMQBDac/2UXa6qtpvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696611962; a=rsa-sha256; cv=none; b=BuEzdHk+ORTA9IhUde53S+CgmaBKFNhV04S58n3uSMWw2aDdPDt4geqUPTrk1i9nsa+aPk h7yiBp/0kFhb2T+LitXinSiQjp9oT/7TwEOyh5WiSLvFTzLELQ2ZKt/i+bc+mjlaVtPJeT Hl35ADs2Bqlfi9k+P9GzQfANpFd56C+uHBzXYxMMDyHBCDTc0+fK0c7Hd10JTjV3zfngj4 w7A4PpaNH++rxtXuBOWiawiHJpFloVBURCvsFHxNvgQEIGFs4fz853TomQEAqnhsadVEnw Bw7lT5UgqfUEq4oy2SgR0LPvZ1olF5yxXh+y92vvUEEVZPtfRpAIFlROVv6tLQ== 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=1696611962; 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=gryxDZJtkT+LSBZdVNfxUjmZB7kEBIYK5ZeKzGXivZI=; b=TYFiT2OUwNE/DaZT36hWS5qZYjXfO771d1Bclu7LSp08ORgt0Fb2XJPqvRzgDQHW33ORGW TxwWuEsGKLwE2CdV0InVCYbiRPO88zIXddDaxR2zT90UPGqvMXEIqEzjy6taAcfzrN2OOT 1X+HCUjU6gzUuN3JoV+eWLrVjUlEJZpu6zJ09IN0Q/Uujr/CdWpMPweE1/aVLHV3cdno4l weP2ZrObiTkEyaVz6I46/Iq1V+g+rlyGHetYpyz+IAxX8Vo392UZoxkY//BcvyBQgxiiEn UDoRs7w3R/veBNLFRxM7EllPs+72a3beFQ6Jc6kgim//afg2Q44e6/xKp8K2hQ== 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 4S2FF61swWzx0q; Fri, 6 Oct 2023 17:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396H62pj060766; Fri, 6 Oct 2023 17:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396H62a5060763; Fri, 6 Oct 2023 17:06:02 GMT (envelope-from git) Date: Fri, 6 Oct 2023 17:06:02 GMT Message-Id: <202310061706.396H62a5060763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: cf037a17c7c8 - main - dwc: rockchip: Properly calculate mii clock based on pclk_mac List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf037a17c7c81e8a2e73c89eb90877f2625749d7 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=cf037a17c7c81e8a2e73c89eb90877f2625749d7 commit cf037a17c7c81e8a2e73c89eb90877f2625749d7 Author: Emmanuel Vadot AuthorDate: 2023-10-06 15:44:00 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-06 17:05:43 +0000 dwc: rockchip: Properly calculate mii clock based on pclk_mac --- sys/dev/dwc/if_dwc_rk.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/dev/dwc/if_dwc_rk.c b/sys/dev/dwc/if_dwc_rk.c index 43d4e4847c62..257d80bd1e59 100644 --- a/sys/dev/dwc/if_dwc_rk.c +++ b/sys/dev/dwc/if_dwc_rk.c @@ -581,9 +581,29 @@ if_dwc_rk_init(device_t dev) static int if_dwc_rk_mii_clk(device_t dev) { + struct if_dwc_rk_softc *sc; + uint64_t freq; + int rv; - /* Should be calculated from the clock */ - return (GMAC_MII_CLK_150_250M_DIV102); + sc = device_get_softc(dev); + if ((rv = clk_get_freq(sc->pclk_mac, &freq)) != 0) + return (-rv); + freq = freq / 1000 / 1000; + + if (freq >= 60 && freq <= 100) + return (GMAC_MII_CLK_60_100M_DIV42); + else if (freq >= 100 && freq <= 150) + return (GMAC_MII_CLK_100_150M_DIV62); + else if (freq >= 20 && freq <= 35) + return (GMAC_MII_CLK_25_35M_DIV16); + else if (freq >= 35 && freq <= 60) + return (GMAC_MII_CLK_35_60M_DIV26); + else if (freq >= 150 && freq <= 250) + return (GMAC_MII_CLK_150_250M_DIV102); + else if (freq >= 250 && freq <= 300) + return (GMAC_MII_CLK_250_300M_DIV124); + + return (-ERANGE); } static int From nobody Fri Oct 6 17:06:03 2023 X-Original-To: dev-commits-src-main@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 4S2FF742Ffz4x5wW; Fri, 6 Oct 2023 17:06:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2FF73L6kz4Wcn; Fri, 6 Oct 2023 17:06:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696611963; 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=JRM3YLLsm/Yd9Yet1biAFpkL9uwJKnKXX1v6+VIU5YA=; b=TbbNh5xlE9us9bodfHo4qsbQ73YsrlNAn2yubr8tyYgO0O3rO8agp9lIrgwJTDRXAF9262 f8Uk0JZmuQurGCmUcQBSFe5CORFSIPFWg6kGbNqC+75Lv6Auli7+gviGlipuD+TQ5x5qQo OReBHygU7jmtGWSc1f2MdaF58GIRulK6+pHX65zqp4sVMDmuyr7+Tf4KZ0rFgvNgFwvHVh TbaQOoJ0snO18KY+78LedyK92cqbxU/3XkIulEkC2thxr+k6Uvje042NUmcbwCZj7S1afe WVA8sTGNyBjwsLc0brv6Fnei9L1vZAxwibGNOj7hoDko0itKiyYN0tFT8xuyDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696611963; a=rsa-sha256; cv=none; b=n0PTFc+bZKJz5glfHKBPNsW1sHbh6j9gUzvOGOlhcFHWPFLE256E6OC6Vb0Gl1J/6iBMlV 1liNv8Spv4FJt/6ZaQSyiZHZx4cJl8z4xdVLv1PLDK/gzTq+DXBrTFSyj0Z8wnwID1Fh+w 2YaywvExh9qeGJ4ltqYeTeWFmqWVd7DX7UMIWXCLPZQ4IP5EcxSL0couKQIpAyygdFN8G/ 5byBqUhftyQh7SgD3HwkJnQJDoCJHLp272xr/hFwndJgdyB1iAu6Zt2SaQIMV+p6iq9cwQ li+bImbh9U3KdLCLbWRyeQ2fs7Oj5/4qi8eWe5s2jMpMRccDf1HW7xel+vFe1w== 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=1696611963; 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=JRM3YLLsm/Yd9Yet1biAFpkL9uwJKnKXX1v6+VIU5YA=; b=JpRIt+ITaDhEFybyfuZNKWKyQtBNWgX0yNvLLCbjjojjI5H9OIIlYfaGEIOpzrRkbIGrO4 x32QFWVG4VvYgHfiJ7BLJSRxgZplQCY2KtIoLBE75nD9+ZKjtbeoi08MoYwjqA4PWsxcGz /QUELd6k1q624qngr1HwjsdxH2IRkf2JBc9OvIz3m3kNDEpEQ+K/9ZjPQEf1Sb2ND6VFyv ODz/ah42ewsaFsgRZylfkLwfo+z9OZyt0c5OPqRDPz2giJtQopgTEn1FgiRzxmlzcdFlTA DnilUGyMRZaTJkPBrtXJTKue2dwXdwOA1OFPW/bCKSsT/VDrUdiMMy1vCGtxIg== 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 4S2FF72F8YzwjN; Fri, 6 Oct 2023 17:06:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396H63ql060811; Fri, 6 Oct 2023 17:06:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396H63in060807; Fri, 6 Oct 2023 17:06:03 GMT (envelope-from git) Date: Fri, 6 Oct 2023 17:06:03 GMT Message-Id: <202310061706.396H63in060807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 38cbdae33b7c - main - dwc: Rewrite barrier part List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38cbdae33b7c3f772845c06f52b86c0ddeab6a17 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=38cbdae33b7c3f772845c06f52b86c0ddeab6a17 commit 38cbdae33b7c3f772845c06f52b86c0ddeab6a17 Author: Emmanuel Vadot AuthorDate: 2023-10-06 16:04:49 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-06 17:05:45 +0000 dwc: Rewrite barrier part We only need a barrier after writing the OWN bit so everything is coherent for the DMA engine. --- sys/dev/dwc/dwc1000_dma.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index f6baa0bd3e45..4f8ae088305a 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -216,7 +216,6 @@ txdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr, sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr); sc->txdesc_ring[idx].desc0 = desc0; sc->txdesc_ring[idx].desc1 = desc1; - wmb(); sc->txdesc_ring[idx].desc0 |= TDESC0_OWN; wmb(); } @@ -237,7 +236,6 @@ rxdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr) sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | MIN(MCLBYTES, ERDESC1_RBS1_MASK); - wmb(); sc->rxdesc_ring[idx].desc0 = RDESC0_OWN; wmb(); return (nidx); @@ -524,7 +522,6 @@ dma1000_rxfinish_locked(struct dwc_softc *sc) m = dwc_rxfinish_one(sc, desc, sc->rxbuf_map + idx); if (m == NULL) { - wmb(); desc->desc0 = RDESC0_OWN; wmb(); } else { From nobody Fri Oct 6 19:29:47 2023 X-Original-To: dev-commits-src-main@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 4S2JR013lPz4wJDb; Fri, 6 Oct 2023 19:29:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2JR00bznz3PPd; Fri, 6 Oct 2023 19:29:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696620588; 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=nHngIWPzrO+RyAbxpSyzBAigTWh1MpkvWp5u5ZlNRHg=; b=syIa6tV/OEA72YV/SN7PYyxRYlzgi2pIByRYZJSlt8kN/Ex3RsWsTBepVMAcRN44pFGV1K FhPHy0+IzIA8r56cHXNweSJJP+xgMeolp0Def+VlHFU9vE2rnX7p3RM67dh2vdYBpwfmc9 85lwYNOwJEAkOhs+PGkUnWaWvfjZSBwgnl8FG/MmJ/fH//vBySeoXWJyGpj1MnvCwTY+kM idzpBTFW3kGBFtHXMiEhk6SvSCq7rSA+wk/7TobVeGendtt/cy9cCEeDk3YhPXo6m2iIO9 z84g3LPc0FcuX4kM11FNSiJzyTk7jn5saESIxwQfJuVDWzYMr14tbBuqTF545A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696620588; a=rsa-sha256; cv=none; b=NxKzMQVL8KpST7py+I4m2f3DyOv6o7MrQvdKrYyGmt6B4SkmnwNsTPOdiCfT+VHoHGgwGB cusIgi0nXLJgWKvJgcQxDoG8qZLsC64aVy5dAAyvuBlpUNmMhUBqcjSwU+dee4NPf0xNyf JYyMdtWwbQU8exgiPd1M9TH8RGRgKsFBSR6vh/b0uGxrKgSScl1ugEqabnX7GtSKJOdewT ASOl+CrkNo5qIrfUglpmn9OMWbP9NcuzLdlHMAk8J1J2knoYvhL7E9d+jBn77YUVJQJ3tF JWxZFdOj2Sil/qZtfi6u3bHazUERRclX1Wnl/qbkjyGGPZ05iNsAltwhlmLSPg== 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=1696620588; 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=nHngIWPzrO+RyAbxpSyzBAigTWh1MpkvWp5u5ZlNRHg=; b=czGWHL4Lf589b1D785JVlc9xk87+zStiGx6TinHuqA5yu2DsIDRzV3ZEpTgHOlDrWg02Kf UfugHypJyfjyHwQ+UVN8uMXEeKMBdnL99oagq/tRNEAyDffi51xzxlUAcGWz4XeO1dm5Xy 7dqC94Bzn9chyFUFqKVE/uqbu3O10gRj8D0GAYefWj5jYoXlrCC9NLraal2M6IeGCAOXCF w9K4+Be9bLy3onAz4FI9B3TeBjbtwTOA/WUwMweoGXWJ5Zor47I8Ve/ZZZgX1ekh5mpMyu 31X/66TZdYz0dFnZh7GKLFiQ/gCYhdzX5cgzSRxJRTpwiW0d5yU+XO5caH2Gtg== 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 4S2JQz6gxQz11Mb; Fri, 6 Oct 2023 19:29:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396JTl7t093973; Fri, 6 Oct 2023 19:29:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396JTlYt093970; Fri, 6 Oct 2023 19:29:47 GMT (envelope-from git) Date: Fri, 6 Oct 2023 19:29:47 GMT Message-Id: <202310061929.396JTlYt093970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 03205a8cd57f - main - i2c: rtc: Add module for hym8563 driver List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03205a8cd57feb95752142d899d026ff8f45f3e6 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=03205a8cd57feb95752142d899d026ff8f45f3e6 commit 03205a8cd57feb95752142d899d026ff8f45f3e6 Author: Emmanuel Vadot AuthorDate: 2023-10-06 19:20:00 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-06 19:29:38 +0000 i2c: rtc: Add module for hym8563 driver It's used in the nanopi-r5s --- sys/modules/i2c/Makefile | 3 ++- sys/modules/i2c/hym8563/Makefile | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index abbb390b0e07..6c976e9303f1 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -28,7 +28,8 @@ SUBDIR = \ smbus \ .if !empty(OPT_FDT) -SUBDIR += rv3032 \ +SUBDIR += hym8563 \ + rv3032 \ rx8803 \ tca64xx \ tmp461 diff --git a/sys/modules/i2c/hym8563/Makefile b/sys/modules/i2c/hym8563/Makefile new file mode 100644 index 000000000000..e64190887610 --- /dev/null +++ b/sys/modules/i2c/hym8563/Makefile @@ -0,0 +1,13 @@ + +.PATH: ${SRCTOP}/sys/dev/iicbus/rtc +KMOD= hym8563 +SRCS= hym8563.c + +SRCS+= bus_if.h \ + clock_if.h \ + device_if.h \ + iicbus_if.h \ + opt_platform.h \ + ofw_bus_if.h + +.include From nobody Fri Oct 6 19:57:48 2023 X-Original-To: dev-commits-src-main@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 4S2K3J3Pj9z4wNYv; Fri, 6 Oct 2023 19:57:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2K3J2wSCz3Svf; Fri, 6 Oct 2023 19:57:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696622268; 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=CPQ8W7xbbyVGpuiNL8yg7cLAco9NxJCZ2deMrPdpjSg=; b=O3busy3H/6m915msF6vIyaLmj91AHfLDCAp2ntpqrDcbjsggFl21WAxIr1wN2HIBZ9VHuH hxtPJx2x5rc1Ig/tlxXADNLlpDXrvORIALlgmwkVnVurcJvnOaVw2fowLZxQxo86X6t13U VdGoHwQqbJxVdSgT0ieb2ivKrW7YrjF9ZL7xlLuDSNHkDx0VLeHZMSgSX9pbdsCmazWqou YUZJV9qqMswzKBJYXpzaFs8BLcjYRwB8yT1y0jk5qpcphSoffVrPI2zGPC7DhdgN+StEjT WSHwWcUXUlNfPn6zs/5NbugwgfsEK7NNiefn8QOIaBMGJ6JSCPiwvn4yNnOP9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696622268; a=rsa-sha256; cv=none; b=eQzlKPlYDb2+gU768SXvfbGVI9Rba54nx4/Hf+AKyoqQAh8VD3lK6PXvV4J1SAiPUpMSkU rZHAJXMxb8jMWVtOr2ZoG4OdHqHnfbWz7sZ4ZUOu8ZqKp0p2fRp8+1wSw51My6Krq1IZjE np8eyMO0OmWWHj3hzRwNP19gW3pz9jLCVdU6bhmk+1NKcaC/YV2VlskXvSQMgc68cAMwcE lBbzl8HzS3ZSIGjWg9gjEivMTdCwMNBnoWV9w4P3VKxLaNT3gd0JZqhB7ZaJZ91FkWEmZL Oj4FjMafTl6k5KiGRCC9IBPJzdC1nfdcsKrnsvZemuIGkk1K6uhLpObtVW7nzw== 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=1696622268; 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=CPQ8W7xbbyVGpuiNL8yg7cLAco9NxJCZ2deMrPdpjSg=; b=Vgyc0dgftRwRBV9FN6s4ceJQjoYQ4BRMvyzcFTsj0wWkvcZrs6CESFf56q2fRPY9k3s0KJ /dghEXNbPh0B9dAy3Bl/8BD8XUcmp4fgn+kwBLvLhfolHGFLkyFlX2Xl0mc9juVA0xbokL EX80U2PlNYvO1ylt5TvU3a1kwKr588EW1xzm3atLOcrhAuohhdFq//qagJvGEo2tdiRgR2 +S8RYqnOB2+PpDiZ6/FwYVwvV7KY5PDfnvrVghusXY4bUXiCGiLdnEDaWg8aeKAptl1Yc5 ct1804JLWsLfB9Y7+zmFlrPjnGjDaFuqmMMnihGTohWR2MPgRkgBBBCdLxOWfw== 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 4S2K3J1tByz11BD; Fri, 6 Oct 2023 19:57:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396JvmDL043323; Fri, 6 Oct 2023 19:57:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396JvmS8043320; Fri, 6 Oct 2023 19:57:48 GMT (envelope-from git) Date: Fri, 6 Oct 2023 19:57:48 GMT Message-Id: <202310061957.396JvmS8043320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 86885b186898 - main - Fix intermittency in the sys.fs.fusefs.mknod.main test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86885b18689889e9b9142fd31d8c67f21334ba32 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=86885b18689889e9b9142fd31d8c67f21334ba32 commit 86885b18689889e9b9142fd31d8c67f21334ba32 Author: Alan Somers AuthorDate: 2023-10-06 19:46:42 +0000 Commit: Alan Somers CommitDate: 2023-10-06 19:57:38 +0000 Fix intermittency in the sys.fs.fusefs.mknod.main test In the Mknod.parent_inode test case, the kernel sends an extra FUSE_FORGET message. But because it gets sent asynchronously with the failing syscall, it doesn't always get received before the test ends. So we never setup an expectation for it. And 90+% of the time the test would exit successfully. Fix the intermittency by always waiting to receive the FUSE_FORGET message. MFC after: 2 weeks Sponsored by: Axcient --- tests/sys/fs/fusefs/mknod.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/sys/fs/fusefs/mknod.cc b/tests/sys/fs/fusefs/mknod.cc index 223d38f8acb1..1fb855f44f29 100644 --- a/tests/sys/fs/fusefs/mknod.cc +++ b/tests/sys/fs/fusefs/mknod.cc @@ -32,6 +32,7 @@ extern "C" { #include #include #include +#include } #include "mockfs.hh" @@ -255,14 +256,18 @@ TEST_F(Mknod, parent_inode) const char RELPATH[] = "some_node"; mode_t mode = S_IFSOCK | 0755; struct sockaddr_un sa; + sem_t sem; int fd; dev_t rdev = -1; /* Really it's a don't care */ uint64_t ino = 42; + ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno); + expect_lookup(PPATH, ino, S_IFDIR | 0755, 0, 1); EXPECT_LOOKUP(ino, RELPATH) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_mknod(ino, RELPATH, ino, mode, rdev); + expect_forget(ino, 1, &sem); fd = socket(AF_UNIX, SOCK_STREAM, 0); ASSERT_LE(0, fd) << strerror(errno); @@ -273,6 +278,8 @@ TEST_F(Mknod, parent_inode) ASSERT_EQ(EIO, errno); leak(fd); + sem_wait(&sem); + sem_destroy(&sem); } /* From nobody Fri Oct 6 20:44:54 2023 X-Original-To: dev-commits-src-main@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 4S2L5g3PTTz4wWCH; Fri, 6 Oct 2023 20:44:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2L5g1qCBz3ZDK; Fri, 6 Oct 2023 20:44:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696625095; 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=S3wF+RLTyyttD1tw6qnHZO9TWMizIruXYgQX7hcTY+0=; b=arvFQIabFmjjWZrctsfh8d9j/BLqdgXRZzL99OCbqzs/+A9OhKrKHC+8cO3NuymxuSjd5U 9qknthnC0tYET7c0GZO4gFz6Vi9jRGiSXJhBzTPtq6xjhAVnvz4imSIwCzdRlRt3dUEwyE 0KzcNpYkp9kaGj/4S+Cb1MszOFpGN0P6QuoORKT64ebifPE++qeW/a9ONVGtu49tcpzG0n VWAL008xxm6CrH0+WyMYpMjSY4Gb/VROrlWDFyUU6xL239CFYGM4lmN5qsKu4RftEstiqu K3Lgd/RBjlXwqbzuu1ZsxJvjwRsl1XlqVJ42DelsaBFa7PRRyyJEF+KOkF4LcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696625095; a=rsa-sha256; cv=none; b=sJTi+vUR9OTddzuX/89ROJX+9U/ap3uKKQ9b+BDNvHtwXyjSv6Q1cd+xqqnFE+YT7qb/tu 9pUL1rqb7m3StnyBi+7/fAPl7VuGPBx8HZcXCAv8XeBslGPZfAPZXjEaPGkXhGoDe28SYe oEHMkYYUGSp13C5jLRacqPY0dGH9UavYSqWP5I5UebHf812I40jC5qzIV9SRSVWHMOYYv8 37sq7XTnn8k8slpvNA5Rclr42Uykq6MkXmB5qQBmFFMcIqit2enp+3i0TrmoNfnGwu3dKa UTgQPt/1QMYPsNi5FpKzA+g/KNz+Fq3UF/du2K7OfnkuD/MSgJUkPraAozN5tw== 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=1696625095; 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=S3wF+RLTyyttD1tw6qnHZO9TWMizIruXYgQX7hcTY+0=; b=NvXIp7KsAMvcN4vZ6WSZnNJ207zo1dh7uTo2N93uqg6XOZBHa+NfSPxzJEzyU8rErAtFpL kbSXz62VQeA/kb8o8aC+jZPoMhNqRaJKjCxJFminYEISCZowIaQemIPdQPdROLCRyYGEM2 mJRzdSrs0aEkwj11xPqrqO2IaCOXqA7BhVEWHITbiXTibVNZ0UE08N8zST1lfGA6pz08V5 TOUD4iRtalJLGCm7oCNymtcGi3ng6Re14ZSG8674GJHiW3XprznA1IzaaO2Kloc+BO1rFe hvsVbX9AWhQgYaHXXKWsliIge/j3ta+6v4nCr0wkn2Ie8W/nrwKTYIZnxoOGtw== 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 4S2L5g0cSdz130h; Fri, 6 Oct 2023 20:44:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396KisZZ025450; Fri, 6 Oct 2023 20:44:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396KisdI025447; Fri, 6 Oct 2023 20:44:54 GMT (envelope-from git) Date: Fri, 6 Oct 2023 20:44:54 GMT Message-Id: <202310062044.396KisdI025447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: a2b289608d6b - main - mitigations.7: briefly explain RELRO List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2b289608d6b54b6e1ce85096560807e551bb5ac Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a2b289608d6b54b6e1ce85096560807e551bb5ac commit a2b289608d6b54b6e1ce85096560807e551bb5ac Author: Ed Maste AuthorDate: 2023-10-06 14:37:55 +0000 Commit: Ed Maste CommitDate: 2023-10-06 20:44:07 +0000 mitigations.7: briefly explain RELRO Reviewed by: bcr (earlier), kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42107 --- share/man/man7/mitigations.7 | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/share/man/man7/mitigations.7 b/share/man/man7/mitigations.7 index 8023f094d678..fed16d7b325f 100644 --- a/share/man/man7/mitigations.7 +++ b/share/man/man7/mitigations.7 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 5, 2023 +.Dd October 6, 2023 .Dt MITIGATIONS 7 .Os .Sh NAME @@ -50,10 +50,10 @@ Position Independent Executable (PIE) Write XOR Execute page protection policy .It .Dv PROT_MAX -".It -"Read-Only Relocation (RELRO) -.\".It -.\"Bind Now +.It +Relocation Read-Only (RELRO) +.It +Bind Now .\".It .\"Stack Smashing Protection (SSP) .\".It @@ -192,8 +192,25 @@ may be made writable by a future .Xr mprotect call, but may not be made executable. .\" -.\".Ss Read-Only Relocation (RELRO) -.\" +.Ss Relocation Read-Only (RELRO) +Relocation Read-Only (RELRO) is a mitigation tool that makes certain portions +of a program's address space that contain ELF metadata read-only, after +relocation processing by +.Xr rtld 1 . +.Pp +When enabled in isolation the RELRO option provides +.Em partial RELRO +support. +In this case the Procedure Linkage Table (PLT)-related part of the +Global Offset Table (GOT) (in the section typically named .got.plt) remains +writable. +.Pp +RELRO is enabled by default. +The +.Xr src.conf 5 +build-time option +.Va WITHOUT_RELRO +may be used to disable it. .Ss BIND_NOW The .Va WITH_BIND_NOW @@ -205,11 +222,12 @@ The run-time loader .Xr rtld 1 will then perform all relocation processing when the process starts, instead of on demand (on the first access to each symbol). +.Pp When enabled in combination with .Dv RELRO (which is enabled by default) this provides -.Qt full -RELRO, the entire GOT (.got and .got.plt) are made read-only at program startup, +.Em full RELRO . +The entire GOT (.got and .got.plt) are made read-only at program startup, preventing attacks on the relocation table. Note that this results in a nonstandard Application Binary Interface (ABI), and it is possible that some applications may not function correctly. From nobody Fri Oct 6 21:08:24 2023 X-Original-To: dev-commits-src-main@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 4S2Lcm6qhKz4wZk0; Fri, 6 Oct 2023 21:08:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2Lcm6Qjbz3cT5; Fri, 6 Oct 2023 21:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696626504; 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=gZmuOxBTeyUzKioBr75zDHEhZLfxkYbZMKzeyJn4xM0=; b=T3S9sedDllicJ6XH6ukV4reKG5/tRrEG24SyjSnQhV35tdY1ZcfGlJSzyatb9JyDwckiKs u+jtmIXaSk/78Nw8OaUQZChFcZ0QuAbCCETL9P0ZIbt/XQ56k6kbKV8MbluXinkY9OuPcY tbCZka3mxyIMl3e5Bc1U3UC07lQklJTV1BvNplNObd+d+v+PInaL4Jo0QmrFQy+ioUsz0I LcLECSDV0nU5YAJ5Hmy1fswx8wMCsOJANpxV/yxz5dDJclNXxK+eC70g0+sMvwVxqbeej7 P0KAUopD0viLrKIquH0glTHF1cFJsaycTDCYyqx0PkaEXY5C+qGpKBFLL+UgBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696626504; a=rsa-sha256; cv=none; b=gPtL/CoayZT/wSxOV2p7+tlpV3kPy+qEEeUw5Bl+47f3a5fKRCeAm6Ak6mfiIDnvUy8P/S EOUinW4fHCg8e+uwR7sg8UbzjDSmqLgzBL/CrLWwaO0S9NCjRjvcU59ymZOk6VNZEB4SrK dDbwbd6Cb/8hyozDofCvlLKy2/wg3fB7ZN2ZXA7fiIaMGgbLEb3Rp9KgwKEfFuYzwWNJWS OsJfBlRyFEMRJeEH1ezeeZHfwsYnVnuS3+1biHs28hktRr/Uq2qLue7GVx55lj+QKZvv9g hBJbhmTOmDWzHrBRc4WZjIgE/x14zeXHQcszjpjGgSmyOwds3RshrDaosTt/Og== 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=1696626504; 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=gZmuOxBTeyUzKioBr75zDHEhZLfxkYbZMKzeyJn4xM0=; b=rBcb/CX74U2m8SzTXCo0XQfD/N9U7MlVmAFv/JU+S+DiKGLGEu54FyafbvN8r7KbjJ+qrh 63sPIp29ZCfGXLRCuTLuU3RarQ9ncGnWorJmPcFWs4IbONheG45isAn9hBTsloHpNdjnav 8SVeLqaMZ5akozHzJ7ejRDQCJL74cu599MrPtJpdBtuwrjpWywaDXKYtud5WY9erqjNgMz UzeYKRjQJYCvE4HQzuRNI8fmAchOdtfa2ACIUdnvTp85p5swPIKPenIZ2zSgpKoZG0D0R/ pz91TbQa6YH3IJtleZLuieu0vGTMU+b9LkFZmFIEpcykyUSJBTxnQdxZm2X/hQ== 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 4S2Lcm5TlMz13J9; Fri, 6 Oct 2023 21:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 396L8Olv059649; Fri, 6 Oct 2023 21:08:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 396L8OFk059646; Fri, 6 Oct 2023 21:08:24 GMT (envelope-from git) Date: Fri, 6 Oct 2023 21:08:24 GMT Message-Id: <202310062108.396L8OFk059646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 8399d764c929 - main - Fix intermittency in the sys.fs.fusefs.symlink.main test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8399d764c929a4b2fa98dbfae0ca7359810e4668 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=8399d764c929a4b2fa98dbfae0ca7359810e4668 commit 8399d764c929a4b2fa98dbfae0ca7359810e4668 Author: Alan Somers AuthorDate: 2023-10-06 21:05:41 +0000 Commit: Alan Somers CommitDate: 2023-10-06 21:08:03 +0000 Fix intermittency in the sys.fs.fusefs.symlink.main test This change is identical to 86885b18689 but for symlink instead of mknod. The kernel sends a FUSE_FORGET asynchronously with the final syscall. The lack of an expectation caused this test to occasionally fail. Also, remove a sleep that accidentally snuck into a different test. MFC after: 2 weeks MFC with: 86885b18689889e9b9142fd31d8c67f21334ba32 Sponsored by: Axcient --- tests/sys/fs/fusefs/mkdir.cc | 1 - tests/sys/fs/fusefs/symlink.cc | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/sys/fs/fusefs/mkdir.cc b/tests/sys/fs/fusefs/mkdir.cc index 48453ff8bb8a..f020feb94ed8 100644 --- a/tests/sys/fs/fusefs/mkdir.cc +++ b/tests/sys/fs/fusefs/mkdir.cc @@ -241,7 +241,6 @@ TEST_F(Mkdir, parent_inode) ASSERT_EQ(-1, mkdir(FULLPATH, mode)); ASSERT_EQ(EIO, errno); - usleep(100000); } TEST_F(Mkdir_7_8, ok) diff --git a/tests/sys/fs/fusefs/symlink.cc b/tests/sys/fs/fusefs/symlink.cc index 19286a446fc3..bd355497a8bd 100644 --- a/tests/sys/fs/fusefs/symlink.cc +++ b/tests/sys/fs/fusefs/symlink.cc @@ -29,6 +29,7 @@ */ extern "C" { +#include #include } @@ -174,15 +175,22 @@ TEST_F(Symlink, parent_ino) const char PPATH[] = "parent"; const char RELPATH[] = "src"; const char dst[] = "dst"; + sem_t sem; const uint64_t ino = 42; + ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno); + expect_lookup(PPATH, ino, S_IFDIR | 0755, 0, 1); EXPECT_LOOKUP(ino, RELPATH) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_symlink(ino, dst, RELPATH); + expect_forget(ino, 1, &sem); EXPECT_EQ(-1, symlink(dst, FULLPATH)); EXPECT_EQ(EIO, errno); + + sem_wait(&sem); + sem_destroy(&sem); } TEST_F(Symlink_7_8, ok) From nobody Sat Oct 7 00:32:11 2023 X-Original-To: dev-commits-src-main@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 4S2R7v5cfyz4wB5p; Sat, 7 Oct 2023 00:32:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2R7v4GySz4b3p; Sat, 7 Oct 2023 00:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696638731; 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=MF/7kL+s/frbndNjOGD+Oqj4Zx45clJxJu21VXJaMFA=; b=vRkH9HgTE4CdNXE5zRN94i8n/xQx8rTfurgBa8QeDc7FhKhg6I9b66NV2YeNPgx1ozu/IX UXHVkaaLVbPtkQ4gPQKc16BqBuBlucQ1KOFK7sUgbzF8wQ0FVzQJjofokMcFGNZnET/Xd0 V465rmgeuHzP7G6y1KZs6meEmsNpamzDRoHES+lI+7ZzhHw5faRFZv6s5cWWlPX/+THRq7 PTsmwQwYwk+jSTKYRFsywuE/7ucYmyI164LwKRTQPoRozNiy+4glmd9S1AQXNxyT7FG0Kt 0GqXOtbZyoIH7FEOsIOG1lfNKZQm3IJg3n4bpfZOhQJnJG2pWmfU1HxN3K/bXw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696638731; a=rsa-sha256; cv=none; b=hKJdCMn6MR1qsqKfKZD2M7hVkYw6LknL7l31QT90UYXypCwy66jkuUb+q2C2bt7LExlYAn 9BiFsSoivJ3A6Z52UYRVSQ5WsYgJyrzLRdM80SHOI/PzzXcNw/knknMvBvMdFkwKkNaUfY 9z4hrRlZtc7JI7mJuSIGiN1hUdhYybuxksw1q5stMPCpSqAYtqmd3hoBfMvSRTsbWKOJhw jcM6T08J43M2IGvQwj+CANd3IjQ0AmYIrqCULBO70yuElQF8BLfJng9xHOm3B+vocN+ksK ytdwzHLyBVWdreMP4HQv5iQnBFhT0w9gWaITYzUKElGumQWqm5a4H/ngBAPuhA== 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=1696638731; 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=MF/7kL+s/frbndNjOGD+Oqj4Zx45clJxJu21VXJaMFA=; b=uRAc/DZTS9M4Ets8g+saHT0qBWFNNBibklOJWDx97VnkqcRveVlibRXGJhcHr4mn7OlEQv 34t1nStkxJZaasyMUAmeedx/j4PGTMOqlrawySUx39Ddf3g7jvFvyi+BEcCO6+MwZ9DON9 KeEhilNBTZKbN73Npq1cBgLEsPjDcOhtWmjNis+X8iGAtck350OYybhARvrS+sUuB/LLv2 1b9LqCEMf8Nh/X6xqPQwgzA8Irmy1arWymbQqa28t3FCb21PkvC1kn5Alqrq8Av6PIfLjV H3wot+/XhEru8bqO4k1SJ53STn5xJ9WgR1pMSat6BRhUExRdBN11h5PvzSAc0A== 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 4S2R7v2yJPz18B2; Sat, 7 Oct 2023 00:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3970WBHt005674; Sat, 7 Oct 2023 00:32:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3970WBCE005671; Sat, 7 Oct 2023 00:32:11 GMT (envelope-from git) Date: Sat, 7 Oct 2023 00:32:11 GMT Message-Id: <202310070032.3970WBCE005671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4640df1b0a49 - main - mrsas: Fix callout locking in mrsas_complete_cmd() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4640df1b0a49697840b81f6bcd269a483514c6aa Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4640df1b0a49697840b81f6bcd269a483514c6aa commit 4640df1b0a49697840b81f6bcd269a483514c6aa Author: Mark Johnston AuthorDate: 2023-10-07 00:31:03 +0000 Commit: Mark Johnston CommitDate: 2023-10-07 00:31:03 +0000 mrsas: Fix callout locking in mrsas_complete_cmd() callout_stop() requires the associated lock to be held. This is a bit hacky, but I believe it's safe since the subsequent mrsas_cmd_done() call will also acquire the SIM lock to stop a different callout. PR: 265484 Reviewed by: imp Tested by: Jérémie Jourdin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39559 --- sys/dev/mrsas/mrsas.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index 1241f44761c4..e362d4b455fc 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1732,11 +1732,13 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) data_length = r1_cmd->io_request->DataLength; sense = r1_cmd->sense; } + mtx_lock(&sc->sim_lock); r1_cmd->ccb_ptr = NULL; if (r1_cmd->callout_owner) { callout_stop(&r1_cmd->cm_callout); r1_cmd->callout_owner = false; } + mtx_unlock(&sc->sim_lock); mrsas_release_mpt_cmd(r1_cmd); mrsas_atomic_dec(&sc->fw_outstanding); mrsas_map_mpt_cmd_status(cmd_mpt, cmd_mpt->ccb_ptr, status, From nobody Sat Oct 7 01:16:46 2023 X-Original-To: dev-commits-src-main@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 4S2S7L4rkpz4wJKb; Sat, 7 Oct 2023 01:16:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2S7L30BKz4gHM; Sat, 7 Oct 2023 01:16:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696641406; 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=4Jm7c2YAvM+mZE+pHl926Be3jo3vQ/2jcbHMRBErC3A=; b=WBlthp+PdBDPVQE3gN91ZjyKCKQml4n6rOwctSO6CFagtWjx830RSI5EU7HVh7Ed/SKS/9 yqT5+hQNhU6Hpxo82fh3PJ1pgEeEYTl+YCZ8UHxVPeu7ch0bRzRYQKWwhR4ksO+0908xjA Otq+CjOQXNpJBebH7hM7DdXYJkoC5Tt042yi6JsOLKzfoHB0Q0W/+UwztAEjWr50yEKNkn +XPmVixLFjoYjPZYyKMlxvlbuo30Nm5xtoQI2ksoPY2oy9CUEaN7sucmnoiUSl7vDlBqPM yHWjbmwJxSeQGc6DTfwBp/XoWvT52UHbKthOWpgv0Rl4h5GykYTpKSsOJ6/E4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696641406; a=rsa-sha256; cv=none; b=VHjYBRHIUcKwjf3kZ/rENN1m7WA9MAJjWVf1AMz0vCMkeH8VA2K7EAEoei7RHYb/8YRQo0 0rFeRLNB2W7ftvjbzDHF8w4saek9SJkZJptvHKjOTn+xjEAQO6scZVunn0s8H09C5GTIpq Tzf7pcYer1ArMjcC1PGQWrjLHaXl8exgbzENHT1Ub9qXgKf8vrHBsII2Zyh5Va1Ozu/94J qDr+dQB4VWkajY4E+zweVyZafYmgc1Xa2SWa/i8yjPdtLJjFwlGKZWFnQRDxri0ayxg9ft ohdo6vjQLu+VEPtxLsGErBUxUA5dHiU+PbMJfLipsNwlP+mm6uRXZBNLpiUI5A== 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=1696641406; 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=4Jm7c2YAvM+mZE+pHl926Be3jo3vQ/2jcbHMRBErC3A=; b=m+A9eV78weDq98H2qeK1c19FENUgIQstVD1M1A14AATcssOPF1RwRKgufHEAiJgprn/qd0 5Uauu2zKjwF2K3LrGfKWyjfJK67xoAjdb93cHUsL/xupYBOoB1n/kTbIeP/YGsxHON7Vl1 yp1QiNVGQ1DumeUG3wJoIW4aMUgDYU4oshSFRhMwMsMW/9tdX172/vs2Rz6G0RyN7SqDk5 MjLp4kn+wGEe3J5k5SbtoCVmp4RqMhaXJ/4piiJL+OmRB5mJLTNMK91sLrS4cT6NZsZ1o7 3x5MlAYISSUinpA2/TpbVARTIXwR5f8ABMT8hKu3KZMBvjztBatlw7L9T2YGUw== 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 4S2S7L24R1z18s5; Sat, 7 Oct 2023 01:16:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3971GkTC074819; Sat, 7 Oct 2023 01:16:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3971Gkct074816; Sat, 7 Oct 2023 01:16:46 GMT (envelope-from git) Date: Sat, 7 Oct 2023 01:16:46 GMT Message-Id: <202310070116.3971Gkct074816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: f7a2eeaa75dc - main - src.conf(5): regen after 166a655fcf13 (bsdinstall/libdialog) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7a2eeaa75dc95f2958d2db2170744f44e14b7ea Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f7a2eeaa75dc95f2958d2db2170744f44e14b7ea commit f7a2eeaa75dc95f2958d2db2170744f44e14b7ea Author: Ed Maste AuthorDate: 2023-10-07 01:14:11 +0000 Commit: Ed Maste CommitDate: 2023-10-07 01:16:18 +0000 src.conf(5): regen after 166a655fcf13 (bsdinstall/libdialog) Sponsored by: The FreeBSD Foundation --- share/man/man5/src.conf.5 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 64f725c7b2fa..cc26c026052d 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd September 7, 2023 +.Dd October 6, 2023 .Dt SRC.CONF 5 .Os .Sh NAME @@ -477,12 +477,6 @@ Do not build .Xr dpv 1 , and .Xr dpv 3 . -When set, it enforces these options: -.Pp -.Bl -item -compact -.It -.Va WITHOUT_BSDINSTALL -.El .It Va WITHOUT_DICT Do not build the Webster dictionary files. .It Va WITH_DIRDEPS_BUILD From nobody Sat Oct 7 14:04:04 2023 X-Original-To: dev-commits-src-main@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 4S2n8j0c42z4wTNy; Sat, 7 Oct 2023 14:04:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2n8j04wDz4Xjl; Sat, 7 Oct 2023 14:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696687445; 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=2FHIeaXaArm42Dfyn+lXL+uLAQcNG6nuHqmyfM43iz4=; b=HZvlHDovBJSZw2PODALqGAbT75Qeljpj2bc2ABWmcz5ObSrwZZva5r4SuwdIQJQaLbXeP9 qwOUBXGfyV17EziZ1nZWY+VjHkILNzHvOYeDmBblyqXN9XqIxLowBt/S4jeSSwwGc3VC8O EjLZQykmY2hvMq/CAU8vFTIv2HZVe34nPDGzjbFLD4wPRU9IaCehkUa/hoPPBx7Yyt1kax E+gkljujUbG97oC3/25CBEO1Piuf8Lm6VR1pe6+Tbpb4OESkuWOyRQvXqwXXaSlVBzEe6y HxU+3QC6jrA3sULqz4X/j8vJWcjXi11e7S5pI6/mbUrQj99I9RAUCgFnlhgyZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696687445; a=rsa-sha256; cv=none; b=tn9VLyJyBcuGK9/rD6SUeIKLrYfPaYHhgsW5JjGCsPSb9XhqWThCqGV7aJZLVBJsCD/Jl9 9AC2UQllPTtspomdwCkak0d7HwO9Hlk39pTp0JVZNp7J7GOfcPxgw5DvrLH7PfPsAyEdNq YnK+sj/WcpPrXZ5tjCc2tNiLXp5VyRudb1KVsIQEcJvcLxWhX1+Nq2MORqu2O58mIIYfWF WxHXXC4QXOqQlWsOILAPFDD/9zmuPBMOcgS0Y0upCcNzN/OwSZ0Uayt48Ukhm8uxkXTWCC T7axRF9WjBJYdKGFy9T+ghfZMOmzsX6WjeBG2k25t4q09Sopp5uphAq6QvDRgA== 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=1696687445; 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=2FHIeaXaArm42Dfyn+lXL+uLAQcNG6nuHqmyfM43iz4=; b=Bz47OSCqLrbN2Tdn9RZ6vcAPcw0wUNIIisYbxbxpada4YhgS188Kc654Zm/aM0XBrsbVEt ZblXjhjkObLKN1isaanYuLRnZ2y+3ZvCbkL6NGmTp/UM7B6gsF9gqelhfFllZpfwYkALmR K6+OC/haXkXAB5K/3zaRMQqbsqKMPKgACeD3rWDQwjHU5fAyyslngWWEwI26L+8o8Rra+H 9c2lX3F2bKn3amHm/ArKYQGzSkt26hZlXcRdSzEQ7ap2E0Szx35mdjAgGChoC5CyopF8pP jKHDMBAWohzk0gFMFTcAPgPfCh4CQZeMVHP1neA4yiG0wcOPz3P3vvdu0cS3+w== 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 4S2n8h6G5KzYvt; Sat, 7 Oct 2023 14:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 397E44iQ053563; Sat, 7 Oct 2023 14:04:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 397E449k053560; Sat, 7 Oct 2023 14:04:04 GMT (envelope-from git) Date: Sat, 7 Oct 2023 14:04:04 GMT Message-Id: <202310071404.397E449k053560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: abca3ae7734f - main - udp: fix sending of IPv4-mapped addresses List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: abca3ae7734f664ee9c5edc7a9d3a17e29180bdb Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=abca3ae7734f664ee9c5edc7a9d3a17e29180bdb commit abca3ae7734f664ee9c5edc7a9d3a17e29180bdb Author: Michael Tuexen AuthorDate: 2023-10-07 13:56:00 +0000 Commit: Michael Tuexen CommitDate: 2023-10-07 13:56:00 +0000 udp: fix sending of IPv4-mapped addresses The inp_vflags field must be adjusted during the call of in_pcbbind_setup(). This is consistent with the other places in the code, but not elegant at all. PR: 274009 Reported by: syzbot+81ccc423a2737ed031ac@syzkaller.appspotmail.com Reported by: syzbot+c8e3dac881bba85bc029@syzkaller.appspotmail.com Reviewed by: markj, rrs, rscheff MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D42031 --- sys/netinet/udp_usrreq.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 70d738bf2108..cbda7f536262 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1050,7 +1050,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, int cscov_partial = 0; int ipflags = 0; u_short fport, lport; - u_char tos; + u_char tos, vflagsav; uint8_t pr; uint16_t cscov = 0; uint32_t flowid = 0; @@ -1092,7 +1092,8 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, * pcb hash. */ if (sin == NULL || - (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) + (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0) || + (flags & PRUS_IPV6) != 0) INP_WLOCK(inp); else INP_RLOCK(inp); @@ -1203,10 +1204,17 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, error = EINVAL; goto release; } + if ((flags & PRUS_IPV6) != 0) { + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; + } INP_HASH_WLOCK(pcbinfo); error = in_pcbbind_setup(inp, &src, &laddr.s_addr, &lport, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + if ((flags & PRUS_IPV6) != 0) + inp->inp_vflag = vflagsav; if (error) goto release; } @@ -1249,9 +1257,16 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, inp->inp_lport == 0 || sin->sin_addr.s_addr == INADDR_ANY || sin->sin_addr.s_addr == INADDR_BROADCAST) { + if ((flags & PRUS_IPV6) != 0) { + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; + } INP_HASH_WLOCK(pcbinfo); error = in_pcbconnect_setup(inp, sin, &laddr.s_addr, &lport, &faddr.s_addr, &fport, td->td_ucred); + if ((flags & PRUS_IPV6) != 0) + inp->inp_vflag = vflagsav; if (error) { INP_HASH_WUNLOCK(pcbinfo); goto release; From nobody Sat Oct 7 14:24:52 2023 X-Original-To: dev-commits-src-main@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 4S2nch61Cbz4wX7Q; Sat, 7 Oct 2023 14:24:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2nch5ZXGz4cdD; Sat, 7 Oct 2023 14:24:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696688692; 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=9EjGhQiNRXg/TG8exDgsNyccePkRqg0ZGJxioiq1H+s=; b=b5XEovb0AMrVczpmWWpO5kJdoO01M1kAiknffmvKbpOqPwwuXgpTmRMu2uNcV89x/SXQmS zSVcw+difCrI5vBCvzZY8d0XS//UHpU35AmJHnndAyAdNHqFMVHf9hm9VAwjQwPzWK5jpk M/GipbWcvh7FxZ5ysHYGijyW7A66qDsFPjz+L7Ujk0yVGjI1mkgHLIYypVawjp6NOTYE2X NZGumn8ERiwAfKVTVVmUCuw1KgrKedxDb5+tfgVn8szoiMY95ehwQEHOmICnhnVD5wqdtA HAYfdm1hPcKjaUNUc3/89uzxBFtjoEThxc9z2XR2UZdnpkH/VuzeXxXsUlDI5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696688692; a=rsa-sha256; cv=none; b=FXPJBYrKfSB8SJu8jXjNAi6J96p6tuQ1kT9ss5gSGY9UmAXHchkH/oIzBlrNc/T1mFLNhq TTNWov/hQq0mhjjBSL1MKhlRRcUZali96YGoJA9rYvbFswyDNHuMMAAp9mhMagk1BBp8NA d5c3laSWDsXhx2I6vW+ijs9C9oJ5RjB3cfcQK0Xe9GOtkYB8Nj7/Y3FbgCRaEmJauipjib rMPwgwJDD41ipPitkuHw07ugZIRRSs7KUK4QpIAJ19QjFRwXfHt8h8r7NvExudc+FFwyeH DfFI1LxOP4zYVe0zRnB+OVXttxFOgm460iiyrnH6Kl73zMcdCbT7LeirhzkbKQ== 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=1696688692; 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=9EjGhQiNRXg/TG8exDgsNyccePkRqg0ZGJxioiq1H+s=; b=qbVWtfbbq/XL6cJVN+wU0Ix8RlND8Jm0i6CDKksIuHL2W+ZRYtw/klq+LYaXCJzF+1N9P8 yfBt75rVtNpVj4QkciP/Lo3JeKqN+gpoFmDTZIujp6U6H391eFhWt7QoXmDVlLkm2y96GV ZrrodHrfw05YSFk5Ik4ba22NTTBIDgyAok9EGEZBrUoSU3PRTkhP+lUvy0c2uBFyGt534R hhaRxaRr0916PxFO5VEeT6kA5Romjod1IxSb5SOWpSfTUWZP++S8SeNoV2DDabMEvbvIft 1x7/ar+AdzZgWsnHU6BJjwap/yzGhs7GrhBt60F3gOyGhUM9iqTg9SnIsdJTpg== 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 4S2nch4WvSzZNv; Sat, 7 Oct 2023 14:24:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 397EOqHG086648; Sat, 7 Oct 2023 14:24:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 397EOq0u086645; Sat, 7 Oct 2023 14:24:52 GMT (envelope-from git) Date: Sat, 7 Oct 2023 14:24:52 GMT Message-Id: <202310071424.397EOq0u086645@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 662ec2f78152 - main - fusefs: sanitize FUSE_READLINK results for embedded NULs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 662ec2f781521c36b76af748d74bb0a3c2e27a76 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=662ec2f781521c36b76af748d74bb0a3c2e27a76 commit 662ec2f781521c36b76af748d74bb0a3c2e27a76 Author: Alan Somers AuthorDate: 2023-10-04 18:48:01 +0000 Commit: Alan Somers CommitDate: 2023-10-07 14:22:03 +0000 fusefs: sanitize FUSE_READLINK results for embedded NULs If VOP_READLINK returns a path that contains a NUL, it will trigger an assertion in vfs_lookup. Sanitize such paths in fusefs, rejecting any and warning the user about the misbehaving server. PR: 274268 MFC after: 1 week Sponsored by: Axcient Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D42081 --- sys/fs/fuse/fuse_ipc.h | 1 + sys/fs/fuse/fuse_vnops.c | 7 +++++++ tests/sys/fs/fusefs/readlink.cc | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index 27f3662741c5..0ec556138be0 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -239,6 +239,7 @@ struct fuse_data { #define FSESS_WARN_CACHE_INCOHERENT 0x200000 /* Read cache incoherent */ #define FSESS_WARN_WB_CACHE_INCOHERENT 0x400000 /* WB cache incoherent */ #define FSESS_WARN_ILLEGAL_INODE 0x800000 /* Illegal inode for new file */ +#define FSESS_WARN_READLINK_EMBEDDED_NUL 0x1000000 /* corrupt READLINK output */ #define FSESS_MNTOPTS_MASK ( \ FSESS_DAEMON_CAN_SPY | FSESS_PUSH_SYMLINKS_IN | \ FSESS_DEFAULT_PERMISSIONS | FSESS_INTR) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 21ee378b24c6..3249e5988801 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -2007,6 +2007,13 @@ fuse_vnop_readlink(struct vop_readlink_args *ap) if (err) { goto out; } + if (strnlen(fdi.answ, fdi.iosize) + 1 < fdi.iosize) { + struct fuse_data *data = fuse_get_mpdata(vnode_mount(vp)); + fuse_warn(data, FSESS_WARN_READLINK_EMBEDDED_NUL, + "Returned an embedded NUL from FUSE_READLINK."); + err = EIO; + goto out; + } if (((char *)fdi.answ)[0] == '/' && fuse_get_mpdata(vnode_mount(vp))->dataflags & FSESS_PUSH_SYMLINKS_IN) { char *mpth = vnode_mount(vp)->mnt_stat.f_mntonname; diff --git a/tests/sys/fs/fusefs/readlink.cc b/tests/sys/fs/fusefs/readlink.cc index ff9aa08f6fae..30815f2cd4b6 100644 --- a/tests/sys/fs/fusefs/readlink.cc +++ b/tests/sys/fs/fusefs/readlink.cc @@ -79,6 +79,45 @@ TEST_F(Readlink, eloop) EXPECT_EQ(ELOOP, errno); } +/* + * If a malicious or buggy server returns a NUL in the FUSE_READLINK result, it + * should be handled gracefully. + * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274268 + */ +TEST_F(Readlink, embedded_nul) +{ + const char FULLPATH[] = "mountpoint/src"; + const char RELPATH[] = "src"; + const char dst[] = "dst\0stuff"; + char buf[80]; + const uint64_t ino = 42; + + EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH) + .WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { + SET_OUT_HEADER_LEN(out, entry); + out.body.entry.attr.mode = S_IFLNK | 0777; + out.body.entry.nodeid = ino; + out.body.entry.attr_valid = UINT64_MAX; + out.body.entry.entry_valid = UINT64_MAX; + }))); + + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_READLINK && + in.header.nodeid == ino); + }, Eq(true)), + _) + ).WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { + memcpy(out.body.str, dst, sizeof(dst)); + out.header.len = sizeof(out.header) + sizeof(dst) + 1; + }))); + + EXPECT_EQ(-1, readlink(FULLPATH, buf, sizeof(buf))); + EXPECT_EQ(EIO, errno); + EXPECT_EQ(-1, access(FULLPATH, R_OK)); + EXPECT_EQ(EIO, errno); +} + TEST_F(Readlink, ok) { const char FULLPATH[] = "mountpoint/src"; From nobody Sat Oct 7 18:00:50 2023 X-Original-To: dev-commits-src-main@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 4S2tPt2Fb6z4x7pH; Sat, 7 Oct 2023 18:00:50 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2tPt1qX2z3Zd2; Sat, 7 Oct 2023 18:00:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696701650; 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=fuEhUwKkQk03qdUfoG+SV4Pt31z/ku+mDQ/e/JV2MeY=; b=Et9JIBbkUK4qEl8JaSFBPZuF3lVqXvfXCo3e68IGc3DJPQeEQFpjgQbak/FpqSz7TnvLHp NFt8ZBikSEkWRxz2UlpUJPgY1Gasq1lHHxXXtVdRh5Zyk2BP/vn+7IOlfM0/xNvIir4PWS HsZcuX7BnRlke4CAinbteVmks8E18lIsf0TT7M6fkfp3VrLhjbgMsyfKcFfTbqyDYAhqWi sJWOTULPd/VZ+V8+H9f50eJdjIan6FScDNccaGwL0WMGgXn5sadDeh2IQN6PqByrLzFfNc cHektxJrLOjDfLGv9H5bHx0BhASJFLGnnUUon68cwZsXMFGxc9nj6kN5RVJ+kg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696701650; a=rsa-sha256; cv=none; b=Fc+yrMTiQ3PaW7GjroGiZJOxE9bBOrYvUuy301VUkaw9DmPa05luRfqcXPDA4ILh+eDIsi yUfFa0PChtzx8RS66/UCAHMNxB+6tMAmly4YZoDxLLBIvcxKq8NitqV8TFzgfRegDcDyp7 V6HslLyP24OcJCcF/kMXEhbsf5BVvo8bTp9rKnQC6FYfqa2Ej9PTtJjudU0O4hkY8RIC3X WN0xeMaPFn33oZXZhjGz19lk20Vp+rLzeW31MEhqgTNJcljug5oMP5QWI4X+Itq/6Mri2N 5d8WL0GcGKgSmn7aDhTbwuUnRC+1CShiCl+tmgSaPqUesxc7+4dbSzfUXd2Efg== 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=1696701650; 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=fuEhUwKkQk03qdUfoG+SV4Pt31z/ku+mDQ/e/JV2MeY=; b=Xio5hodY7YRGJq7f2Zo//9eAgRCxD7P+FAp67K8pdyQW1EgYjQL6wQYOngLlOFIlb6ndVY QSvdkxEI+aarf9WNwFTKEoJUj8ryPGTHKg8Ac+v1L5XR34wQO9jGEbhNtLr+KZyOg2Caq7 V6vLA0fw/4IKQbz/7aJRXVAJKyvq+MPZs73T/gU8kyZbn9ab1rem+grXvNB25XtI/unw9W AXoNQY47erNfqGBtOgm3PM/bR8Q60Iq3BqFsmG9ZfjeWKa7/dp5eroyJmG/O8Jht188q6e kysMKl4CPz6spxdNMPkoq1T6fRTL0RTCX+vh63irhcauNCl9k9FeQ92pJP+cQQ== 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 4S2tPt0w8nzgvY; Sat, 7 Oct 2023 18:00:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 397I0oB4047771; Sat, 7 Oct 2023 18:00:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 397I0oN0047768; Sat, 7 Oct 2023 18:00:50 GMT (envelope-from git) Date: Sat, 7 Oct 2023 18:00:50 GMT Message-Id: <202310071800.397I0oN0047768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 128f63cedc14 - main - (s)tty: add support for IUTF8 input flag List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 128f63cedc14ae21b35f74e11e2fe1a5659c58e8 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=128f63cedc14ae21b35f74e11e2fe1a5659c58e8 commit 128f63cedc14ae21b35f74e11e2fe1a5659c58e8 Author: Bojan Novković AuthorDate: 2023-10-07 17:59:57 +0000 Commit: Christos Margiolis CommitDate: 2023-10-07 17:59:57 +0000 (s)tty: add support for IUTF8 input flag This patch adds the necessary kernel and stty code to support setting the IUTF8 flag for ttys. It is the first of two patches that fix backspace behaviour for UTF-8 encoded characters when in canonical mode. Reported by: christos Reviewed by: christos, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D42066 --- bin/stty/modes.c | 2 ++ bin/stty/print.c | 1 + bin/stty/stty.1 | 3 +++ share/man/man4/termios.4 | 2 ++ sys/kern/tty.c | 4 ++-- sys/sys/_termios.h | 1 + 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/stty/modes.c b/bin/stty/modes.c index ce39083d7d63..3818677ddc4e 100644 --- a/bin/stty/modes.c +++ b/bin/stty/modes.c @@ -126,6 +126,8 @@ static const struct modes imodes[] = { { "-decctlq", IXANY, 0 }, { "imaxbel", IMAXBEL, 0 }, { "-imaxbel", 0, IMAXBEL }, + { "iutf8", IUTF8, 0 }, + { "-iutf8", 0, IUTF8 }, { NULL, 0, 0 }, }; diff --git a/bin/stty/print.c b/bin/stty/print.c index 07a3c2058474..33472bbccea1 100644 --- a/bin/stty/print.c +++ b/bin/stty/print.c @@ -127,6 +127,7 @@ print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt) put("-inpck", INPCK, 0); put("-ignpar", IGNPAR, 0); put("-parmrk", PARMRK, 0); + put("-iutf8", IUTF8, 1); /* output flags */ tmp = tp->c_oflag; diff --git a/bin/stty/stty.1 b/bin/stty/stty.1 index 9e9405928c67..c572a657a997 100644 --- a/bin/stty/stty.1 +++ b/bin/stty/stty.1 @@ -224,6 +224,9 @@ if .Cm imaxbel is unset and the input queue is full, the next input character causes the entire input and output queues to be discarded. +.It Cm iutf8 Pq Fl iutf8 +Assume that input characters are UTF-8 encoded. Setting this flag +causes backspace to properly delete multibyte characters in canonical mode. .El .Ss Output Modes: This corresponds to the c_oflag of the termios structure. diff --git a/share/man/man4/termios.4 b/share/man/man4/termios.4 index d3a5c8fa582d..80015025345e 100644 --- a/share/man/man4/termios.4 +++ b/share/man/man4/termios.4 @@ -884,6 +884,8 @@ following masks: /* any char will restart after stop */ .It Dv IMAXBEL /* ring bell on input queue full */ +.It Dv IUTF8 +/* assume input is UTF-8 encoded */ .El .Pp In the context of asynchronous serial data transmission, a break diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 134c1dfba98b..620233947410 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -85,8 +85,8 @@ static const char *dev_console_filename; /* * Flags that are supported and stored by this implementation. */ -#define TTYSUP_IFLAG (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|\ - INLCR|IGNCR|ICRNL|IXON|IXOFF|IXANY|IMAXBEL) +#define TTYSUP_IFLAG (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|\ + IGNCR|ICRNL|IXON|IXOFF|IXANY|IMAXBEL|IUTF8) #define TTYSUP_OFLAG (OPOST|ONLCR|TAB3|ONOEOT|OCRNL|ONOCR|ONLRET) #define TTYSUP_LFLAG (ECHOKE|ECHOE|ECHOK|ECHO|ECHONL|ECHOPRT|\ ECHOCTL|ISIG|ICANON|ALTWERASE|IEXTEN|TOSTOP|\ diff --git a/sys/sys/_termios.h b/sys/sys/_termios.h index 327ffcb2f98b..823752732ee2 100644 --- a/sys/sys/_termios.h +++ b/sys/sys/_termios.h @@ -97,6 +97,7 @@ #endif #if __BSD_VISIBLE #define IMAXBEL 0x00002000 /* ring bell on input queue full */ +#define IUTF8 0x00004000 /* assume input is utf-8 encoded */ #endif /* From nobody Sat Oct 7 18:00:51 2023 X-Original-To: dev-commits-src-main@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 4S2tPv44vqz4x7gd; Sat, 7 Oct 2023 18:00:51 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2tPv3B6Hz3ZXF; Sat, 7 Oct 2023 18:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696701651; 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=PjtaIpZBXhLRrOV4iwKdzmXx9naDb4GhbYLInmVVkls=; b=R3KJL7Y385p5PmnicISMSWe7nA/GXixZMHwm24os1uu5j0OwHboL5V9d9RSClSmEOMfLUE lQX05sIvMWbZHUWhX/TFqNFcARFkA3Qdb2T5Dopgc9BZnZDTEGc+AppcEg9PUDNCJNbTTN W/gl/at2DPRGy6BbsAWgD/ITVxlzghuCx1/vWxbOtMUGYQm0sPgyh6CexoJHAb8IUDxZ7v EqvWIottuh/z237L9oIOiXk4jOLrbPFTSBBRXHwN9rW+J3UELA718g2zjBtuKf6LpYPp4x 3JN/jg+5/U1T+Mw/1PjIbQiLcxCxATD1XkmbeoHLWqthTNSIo0spH2DcLRdJwA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696701651; a=rsa-sha256; cv=none; b=yt8dKbzS//isz2ANV8BE7jhtNIFzS8tybs07Pcmis8+q1BmpiNBfI4SJ1Qa2J8HABveaxg oJWIU6N1wgOsJaI8d/W8L9ft0qe+638xGbnh9dC1f15XCVhupPu1XkB7cnjo8gaGHcvBX5 YER4FaXrrIw94gUriKPJ4BF7lp0T49BvniKtkmo6W/eIEjvE+D6w1OVJ4K5L81+bkBbVAp wlCz+FCTIL+8n5qqsRx7wfbx+vwGK+ILw4bQG13/QSkg1xrpYv5zKOJZ3zYoixRGrWZjTz p3RyUZABgaf+sY+/DwkS2WFE3Euh7nfFe3cD9pSoX6hNIoX7izaE5Mf3Bu/Z8g== 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=1696701651; 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=PjtaIpZBXhLRrOV4iwKdzmXx9naDb4GhbYLInmVVkls=; b=o8/x+JsKdPl+IQgtv91I498TxfIgP4Pmsiu0RfakTsNGaP5mDGVelPTtXp+JmVb0+M+gCw XTZZh0IaPRJRQNPXzs30KWeEaUchVh2Oc3J/EXir/CyVYpSF/wV5aurkkJiWTZLnHoIuN+ hKajFXK7ymbtOJIOkvQNW4q6lkVaDIfMqEB91aDRvbtq2i9acSF6yHUFrWghrBCgkiBJik xdHYKDFzM65iH1MHKdvEVjV4cDD7FBZYvH7NGuFi3Puvrjtl/w5413CYpvbVvccNbinz7m +guO+6gitOmZ+H77B99LF/35kuZCM2M5xOgcOXeQdWozCASHwlyPAA9Eq/OdXA== 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 4S2tPv1xRTzgkD; Sat, 7 Oct 2023 18:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 397I0pnj047834; Sat, 7 Oct 2023 18:00:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 397I0p9G047831; Sat, 7 Oct 2023 18:00:51 GMT (envelope-from git) Date: Sat, 7 Oct 2023 18:00:51 GMT Message-Id: <202310071800.397I0p9G047831@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 9e589b093857 - main - tty: fix improper backspace behaviour for UTF8 characters when in canonical mode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e589b0938579f3f4d89fa5c051f845bf754184d Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=9e589b0938579f3f4d89fa5c051f845bf754184d commit 9e589b0938579f3f4d89fa5c051f845bf754184d Author: Bojan Novković AuthorDate: 2023-10-07 18:00:11 +0000 Commit: Christos Margiolis CommitDate: 2023-10-07 18:00:11 +0000 tty: fix improper backspace behaviour for UTF8 characters when in canonical mode This patch adds additional logic in ttydisc_rubchar() to properly handle backspace behaviour for UTF-8 characters. Currently, typing in a backspace after a UTF8 character will delete only one byte from the byte sequence, leaving garbled output in the tty's output queue. With this change all of the character's bytes are deleted. This change is only active when the IUTF8 flag is set (see 19054eb6053189144aa962b2ecc1bf5087758a3e "(s)tty: add support for IUTF8 input flag") The code uses the teken_wcwidth() function to properly handle character column widths for different code points, and adds the teken_utf8_bytes_to_codepoint() function that converts a UTF-8 byte sequence to a codepoint, as specified in RFC3629. Reported by: christos Reviewed by: christos, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D42067 --- sys/kern/tty_ttydisc.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++ sys/teken/teken_wcwidth.h | 30 +++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/sys/kern/tty_ttydisc.c b/sys/kern/tty_ttydisc.c index 665275ee93e7..eae7162e31c0 100644 --- a/sys/kern/tty_ttydisc.c +++ b/sys/kern/tty_ttydisc.c @@ -43,6 +43,9 @@ #include #include +#include +#include + /* * Standard TTYDISC `termios' line discipline. */ @@ -78,8 +81,13 @@ SYSCTL_ULONG(_kern, OID_AUTO, tty_nout, CTLFLAG_RD, /* Character is alphanumeric. */ #define CTL_ALNUM(c) (((c) >= '0' && (c) <= '9') || \ ((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) +/* Character is UTF8-encoded. */ +#define CTL_UTF8(c) (!!((c) & 0x80)) +/* Character is a UTF8 continuation byte. */ +#define CTL_UTF8_CONT(c) (((c) & 0xc0) == 0x80) #define TTY_STACKBUF 256 +#define UTF8_STACKBUF 4 void ttydisc_open(struct tty *tp) @@ -800,6 +808,72 @@ ttydisc_rubchar(struct tty *tp) ttyoutq_write_nofrag(&tp->t_outq, "\b\b\b\b\b\b\b\b", tablen); return (0); + } else if ((tp->t_termios.c_iflag & IUTF8) != 0 && + CTL_UTF8(c)) { + uint8_t bytes[UTF8_STACKBUF] = { 0 }; + int curidx = UTF8_STACKBUF - 1, cwidth = 1, + nb = 0; + teken_char_t codepoint; + + /* Save current byte. */ + bytes[curidx] = c; + curidx--; + nb++; + /* Loop back through inq until we hit the + * leading byte. */ + while (CTL_UTF8_CONT(c) && nb < UTF8_STACKBUF) { + ttyinq_peekchar(&tp->t_inq, &c, "e); + ttyinq_unputchar(&tp->t_inq); + bytes[curidx] = c; + curidx--; + nb++; + } + /* + * Shift array so that the leading + * byte ends up at idx 0. + */ + if (nb < UTF8_STACKBUF) + memmove(&bytes[0], &bytes[curidx + 1], + nb * sizeof(uint8_t)); + /* Check for malformed UTF8 characters. */ + if (nb == UTF8_STACKBUF && + CTL_UTF8_CONT(bytes[0])) { + /* + * Place all bytes back into the inq and + * delete the last byte only. + */ + ttyinq_write(&tp->t_inq, bytes, + UTF8_STACKBUF, 0); + } else { + /* Find codepoint and width. */ + codepoint = + teken_utf8_bytes_to_codepoint(bytes, + nb); + if (codepoint != + TEKEN_UTF8_INVALID_CODEPOINT) { + cwidth = teken_wcwidth( + codepoint); + } else { + /* + * Place all bytes back into the + * inq and fall back to + * default behaviour. + */ + ttyinq_write(&tp->t_inq, bytes, + nb, 0); + } + } + tp->t_column -= cwidth; + /* + * Delete character by punching + * 'cwidth' spaces over it. + */ + if (cwidth == 1) + ttyoutq_write_nofrag(&tp->t_outq, + "\b \b", 3); + else if (cwidth == 2) + ttyoutq_write_nofrag(&tp->t_outq, + "\b\b \b\b", 6); } else { /* * Remove a regular character by diff --git a/sys/teken/teken_wcwidth.h b/sys/teken/teken_wcwidth.h index f57a185c2433..f5a23dbc9679 100644 --- a/sys/teken/teken_wcwidth.h +++ b/sys/teken/teken_wcwidth.h @@ -8,6 +8,8 @@ * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ +#define TEKEN_UTF8_INVALID_CODEPOINT -1 + struct interval { teken_char_t first; teken_char_t last; @@ -116,3 +118,31 @@ static int teken_wcwidth(teken_char_t ucs) (ucs >= 0x20000 && ucs <= 0x2fffd) || (ucs >= 0x30000 && ucs <= 0x3fffd))); } + +/* + * Converts an UTF-8 byte sequence to a codepoint as specified in + * https://datatracker.ietf.org/doc/html/rfc3629#section-3 . The function + * expects the 'bytes' array to start with the leading character. + */ +static teken_char_t +teken_utf8_bytes_to_codepoint(uint8_t bytes[4], int nbytes) +{ + + /* Check for malformed characters. */ + if (bitcount(bytes[0] & 0xf0) != nbytes) + return (TEKEN_UTF8_INVALID_CODEPOINT); + + switch (nbytes) { + case 1: + return (bytes[0] & 0x7f); + case 2: + return (bytes[0] & 0xf) << 6 | (bytes[1] & 0x3f); + case 3: + return (bytes[0] & 0xf) << 12 | (bytes[1] & 0x3f) << 6 | (bytes[2] & 0x3f); + case 4: + return (bytes[0] & 0x7) << 18 | (bytes[1] & 0x3f) << 12 | + (bytes[2] & 0x3f) << 6 | (bytes[3] & 0x3f); + default: + return (TEKEN_UTF8_INVALID_CODEPOINT); + } +} From nobody Sat Oct 7 21:04:19 2023 X-Original-To: dev-commits-src-main@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 4S2yTf6TTCz4wPb9; Sat, 7 Oct 2023 21:04:22 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2yTf5yflz4VXW; Sat, 7 Oct 2023 21:04:22 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696712662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MJAhbwmsnrgxrT3YBjqbX9IOfDGsRuLeOR1/EwE1Qag=; b=ISxVMwGVVBpxU6bRMZSoUNW2LFpPw7Bx79/HAkcKcSFXnxU1atiVfiFr4Vm740NhKkqPfZ o53s7ouUzgHQ7AIpSLrUVsuzBN+vEKl7eMmkPys8Uymto6b3mAZz/dYA+jkmc19C1rFi0n 7cCguRmmYFAAPQSmFDhEm+wb98Rb60jteV0W7/DjK68MbP0okwkdVErAKQlZT3T8pzZtxi 6uGpfJ1Qy0LHTRxD9kO4EvvotzEuAeqNp6vV27jEZeVd43z8MheDhwZM/kQVdRt/le1r47 sGqQmbAY/EoPYAakQZL94eL86FkR8kAgu+edgNgQfyJJaCncsTq5Ku8vV76mTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696712662; a=rsa-sha256; cv=none; b=DM9Kxy8EqYl40X762zwyD3N2W6J5SY8pQfUhIefIPxKVR0s+XJfw6xVLvPvxnvhAp9S+Uo Pqk8KAzvWMeDhgRXnKVDeYirH+xomwQQiH7mWTVhp7i/TV6Jk4jzrlhHOCEd4BDDZ4Fvic 8E852odcKU37RQIv8LaP6jnUX9+s6CcOpaf5YWMmkTpT5Xp+5Z64LOGy9bhtzM43lwpBYB KCCWieKNdL5xcwHSSs0XfAMwMWSeNpQG9m7DZAll3FdQJ+0Y659zCvDBu7LL457z5qrqT2 NzmGLCycicoaV8Yk6C7B/VcWLxxq3W4w9KKilKNAbdpyGV3+mQzIb/2Q6c9WOg== 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=1696712662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MJAhbwmsnrgxrT3YBjqbX9IOfDGsRuLeOR1/EwE1Qag=; b=kge2aQgRLbTt/LAXlG9090mQiSkvd+7D6XTs3av/F68DsdmlaTD7UXWhson4Qk0M5YDgwj Zy1HwWYBp/yz8oc/TuZcuJipUJx2K62Q3OV1QQ/F7Mx4F/jwbQuRZiwfoXhRm+9J2CA6ac kCb59cQholWrgZA63b0TxouWwsRIdLNw22URVr3KLzdQuqmbw+IhewGSFOLMDvZPi5Oc67 r6heKAc+tdkPbSzsyowktVZc8lRpapbrytGKiKMDXRjt4Azzew9OjoQcAhhvfcg6CMbdff BqKgNkKBhPeomP9GDBOEm7Xra0hYGJqzOkHcRtfpqesrKY9UyHmTsgFa+X5d6w== Received: from [10.216.0.102] (unknown [188.243.165.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: fluffy) by smtp.freebsd.org (Postfix) with ESMTPSA id 4S2yTf0YNgzvrG; Sat, 7 Oct 2023 21:04:21 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) Message-ID: <816f8408-865a-488f-a139-ad4bae2301fb@FreeBSD.org> Date: Sun, 8 Oct 2023 00:04:19 +0300 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 9e589b093857 - main - tty: fix improper backspace behaviour for UTF8 characters when in canonical mode Content-Language: ru, en-GB, en-US To: Christos Margiolis , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202310071800.397I0p9G047831@gitrepo.freebsd.org> From: Dima Panov Organization: FreeBSD.org In-Reply-To: <202310071800.397I0p9G047831@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------gKOlBnU1tFebtn0FXPxvZfe0" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------gKOlBnU1tFebtn0FXPxvZfe0 Content-Type: multipart/mixed; boundary="------------Vuuk9vmWgU0JvpFOp1Rm0g4s"; protected-headers="v1" From: Dima Panov To: Christos Margiolis , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <816f8408-865a-488f-a139-ad4bae2301fb@FreeBSD.org> Subject: Re: git: 9e589b093857 - main - tty: fix improper backspace behaviour for UTF8 characters when in canonical mode References: <202310071800.397I0p9G047831@gitrepo.freebsd.org> In-Reply-To: <202310071800.397I0p9G047831@gitrepo.freebsd.org> --------------Vuuk9vmWgU0JvpFOp1Rm0g4s Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 TW9pbi1tb2luIQ0KDQpJdCBicmVha3MgdGhlIGJ1aWxkICUoDQoNCg0KSW4gZmlsZSBpbmNs dWRlZCBmcm9tIC91c3IvbG9jYWwvcG91ZHJpZXJlL2phaWxzLzE1MGFhcmNoNjQvdXNyL3Ny Yy9zeXMvdGVrZW4vdGVrZW4uYzo3MDoNCi91c3IvbG9jYWwvcG91ZHJpZXJlL2phaWxzLzE1 MGFhcmNoNjQvdXNyL3NyYy9zeXMvdGVrZW4vdGVrZW5fd2N3aWR0aC5oOjEzMjo3OiBlcnJv cjogY2FsbCB0byB1bmRlY2xhcmVkIGZ1bmN0aW9uICdiaXRjb3VudCc7IElTTyBDOTkgYW5k IGxhdGVyIGRvIG5vdCBzdXBwb3J0IGltcGxpY2l0IGZ1bmN0aW9uIGRlY2xhcmF0aW9ucyBb LVdlcnJvciwtV2ltcGxpY2l0LWZ1bmN0aW9uLWRlY2xhcmF0aW9uXQ0KICAgaWYgKGJpdGNv dW50KGJ5dGVzWzBdICYgMHhmMCkgIT0gbmJ5dGVzKQ0KICAgICAgIF4NCjEgZXJyb3IgZ2Vu ZXJhdGVkLg0KKioqIFt0ZWtlbi5vXSBFcnJvciBjb2RlIDENCg0KbWFrZVs1XTogc3RvcHBl ZCBpbiAvdXNyL2xvY2FsL3BvdWRyaWVyZS9qYWlscy8xNTBhYXJjaDY0L3Vzci9zcmMvc3Rh bmQvZWZpL2xpYmVmaQ0KDQoNCg0KT24gMDcuMTAuMjAyMyAyMTowMCwgQ2hyaXN0b3MgTWFy Z2lvbGlzIHdyb3RlOg0KPiBUaGUgYnJhbmNoIG1haW4gaGFzIGJlZW4gdXBkYXRlZCBieSBj aHJpc3RvczoNCj4gDQo+IFVSTDogaHR0cHM6Ly9jZ2l0LkZyZWVCU0Qub3JnL3NyYy9jb21t aXQvP2lkPTllNTg5YjA5Mzg1NzlmM2Y0ZDg5ZmE1YzA1MWY4NDViZjc1NDE4NGQNCj4gDQo+ IGNvbW1pdCA5ZTU4OWIwOTM4NTc5ZjNmNGQ4OWZhNWMwNTFmODQ1YmY3NTQxODRkDQo+IEF1 dGhvcjogICAgIEJvamFuIE5vdmtvdmnEhyA8Ym9qYW4ubm92a292aWNAZmVyLmhyPg0KPiBB dXRob3JEYXRlOiAyMDIzLTEwLTA3IDE4OjAwOjExICswMDAwDQo+IENvbW1pdDogICAgIENo cmlzdG9zIE1hcmdpb2xpcyA8Y2hyaXN0b3NARnJlZUJTRC5vcmc+DQo+IENvbW1pdERhdGU6 IDIwMjMtMTAtMDcgMTg6MDA6MTEgKzAwMDANCj4gDQo+ICAgICAgdHR5OiBmaXggaW1wcm9w ZXIgYmFja3NwYWNlIGJlaGF2aW91ciBmb3IgVVRGOCBjaGFyYWN0ZXJzIHdoZW4gaW4gY2Fu b25pY2FsIG1vZGUNCj4gICAgICANCj4gICAgICBUaGlzIHBhdGNoIGFkZHMgYWRkaXRpb25h bCBsb2dpYyBpbiB0dHlkaXNjX3J1YmNoYXIoKSB0byBwcm9wZXJseSBoYW5kbGUNCj4gICAg ICBiYWNrc3BhY2UgYmVoYXZpb3VyIGZvciBVVEYtOCBjaGFyYWN0ZXJzLg0KPiAgICAgIA0K PiAgICAgIEN1cnJlbnRseSwgdHlwaW5nIGluIGEgYmFja3NwYWNlIGFmdGVyIGEgVVRGOCBj aGFyYWN0ZXIgd2lsbCBkZWxldGUgb25seQ0KPiAgICAgIG9uZSBieXRlIGZyb20gdGhlIGJ5 dGUgc2VxdWVuY2UsIGxlYXZpbmcgZ2FyYmxlZCBvdXRwdXQgaW4gdGhlIHR0eSdzDQo+ICAg ICAgb3V0cHV0IHF1ZXVlLiBXaXRoIHRoaXMgY2hhbmdlIGFsbCBvZiB0aGUgY2hhcmFjdGVy J3MgYnl0ZXMgYXJlIGRlbGV0ZWQuDQo+ICAgICAgVGhpcyBjaGFuZ2UgaXMgb25seSBhY3Rp dmUgd2hlbiB0aGUgSVVURjggZmxhZyBpcyBzZXQgKHNlZQ0KPiAgICAgIDE5MDU0ZWI2MDUz MTg5MTQ0YWE5NjJiMmVjYzFiZjUwODc3NThhM2UgIihzKXR0eTogYWRkIHN1cHBvcnQgZm9y IElVVEY4DQo+ICAgICAgaW5wdXQgZmxhZyIpDQo+ICAgICAgDQo+ICAgICAgVGhlIGNvZGUg dXNlcyB0aGUgdGVrZW5fd2N3aWR0aCgpIGZ1bmN0aW9uIHRvIHByb3Blcmx5IGhhbmRsZSBj aGFyYWN0ZXINCj4gICAgICBjb2x1bW4gd2lkdGhzIGZvciBkaWZmZXJlbnQgY29kZSBwb2lu dHMsIGFuZCBhZGRzIHRoZQ0KPiAgICAgIHRla2VuX3V0ZjhfYnl0ZXNfdG9fY29kZXBvaW50 KCkgZnVuY3Rpb24gdGhhdCBjb252ZXJ0cyBhIFVURi04IGJ5dGUNCj4gICAgICBzZXF1ZW5j ZSB0byBhIGNvZGVwb2ludCwgYXMgc3BlY2lmaWVkIGluIFJGQzM2MjkuDQo+ICAgICAgDQo+ ICAgICAgUmVwb3J0ZWQgYnk6ICAgIGNocmlzdG9zDQo+ICAgICAgUmV2aWV3ZWQgYnk6ICAg IGNocmlzdG9zLCBpbXANCj4gICAgICBNRkMgYWZ0ZXI6ICAgICAgMiB3ZWVrcw0KPiAgICAg IERpZmZlcmVudGlhbCBSZXZpc2lvbjogIGh0dHBzOi8vcmV2aWV3cy5mcmVlYnNkLm9yZy9E NDIwNjcNCj4gLS0tDQo+ICAgc3lzL2tlcm4vdHR5X3R0eWRpc2MuYyAgICB8IDc0ICsrKysr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrDQo+ICAgc3lzL3Rl a2VuL3Rla2VuX3djd2lkdGguaCB8IDMwICsrKysrKysrKysrKysrKysrKysNCj4gICAyIGZp bGVzIGNoYW5nZWQsIDEwNCBpbnNlcnRpb25zKCspDQo+IA0KPiBkaWZmIC0tZ2l0IGEvc3lz L2tlcm4vdHR5X3R0eWRpc2MuYyBiL3N5cy9rZXJuL3R0eV90dHlkaXNjLmMNCj4gaW5kZXgg NjY1Mjc1ZWU5M2U3Li5lYWU3MTYyZTMxYzAgMTAwNjQ0DQo+IC0tLSBhL3N5cy9rZXJuL3R0 eV90dHlkaXNjLmMNCj4gKysrIGIvc3lzL2tlcm4vdHR5X3R0eWRpc2MuYw0KPiBAQCAtNDMs NiArNDMsOSBAQA0KPiAgICNpbmNsdWRlIDxzeXMvdWlvLmg+DQo+ICAgI2luY2x1ZGUgPHN5 cy92bm9kZS5oPg0KPiAgIA0KPiArI2luY2x1ZGUgPHRla2VuL3Rla2VuLmg+DQo+ICsjaW5j bHVkZSA8dGVrZW4vdGVrZW5fd2N3aWR0aC5oPg0KPiArDQo+ICAgLyoNCj4gICAgKiBTdGFu ZGFyZCBUVFlESVNDIGB0ZXJtaW9zJyBsaW5lIGRpc2NpcGxpbmUuDQo+ICAgICovDQo+IEBA IC03OCw4ICs4MSwxMyBAQCBTWVNDVExfVUxPTkcoX2tlcm4sIE9JRF9BVVRPLCB0dHlfbm91 dCwgQ1RMRkxBR19SRCwNCj4gICAvKiBDaGFyYWN0ZXIgaXMgYWxwaGFudW1lcmljLiAqLw0K PiAgICNkZWZpbmUgQ1RMX0FMTlVNKGMpCSgoKGMpID49ICcwJyAmJiAoYykgPD0gJzknKSB8 fCBcDQo+ICAgICAgICgoYykgPj0gJ2EnICYmIChjKSA8PSAneicpIHx8ICgoYykgPj0gJ0En ICYmIChjKSA8PSAnWicpKQ0KPiArLyogQ2hhcmFjdGVyIGlzIFVURjgtZW5jb2RlZC4gKi8N Cj4gKyNkZWZpbmUgQ1RMX1VURjgoYykgKCEhKChjKSAmIDB4ODApKQ0KPiArLyogQ2hhcmFj dGVyIGlzIGEgVVRGOCBjb250aW51YXRpb24gYnl0ZS4gKi8NCj4gKyNkZWZpbmUgQ1RMX1VU RjhfQ09OVChjKSAoKChjKSAmIDB4YzApID09IDB4ODApDQo+ICAgDQo+ICAgI2RlZmluZQlU VFlfU1RBQ0tCVUYJMjU2DQo+ICsjZGVmaW5lIFVURjhfU1RBQ0tCVUYgNA0KPiAgIA0KPiAg IHZvaWQNCj4gICB0dHlkaXNjX29wZW4oc3RydWN0IHR0eSAqdHApDQo+IEBAIC04MDAsNiAr ODA4LDcyIEBAIHR0eWRpc2NfcnViY2hhcihzdHJ1Y3QgdHR5ICp0cCkNCj4gICAJCQkJdHR5 b3V0cV93cml0ZV9ub2ZyYWcoJnRwLT50X291dHEsDQo+ICAgCQkJCSAgICAiXGJcYlxiXGJc YlxiXGJcYiIsIHRhYmxlbik7DQo+ICAgCQkJCXJldHVybiAoMCk7DQo+ICsJCQl9IGVsc2Ug aWYgKCh0cC0+dF90ZXJtaW9zLmNfaWZsYWcgJiBJVVRGOCkgIT0gMCAmJg0KPiArCQkJICAg IENUTF9VVEY4KGMpKSB7DQo+ICsJCQkJdWludDhfdCBieXRlc1tVVEY4X1NUQUNLQlVGXSA9 IHsgMCB9Ow0KPiArCQkJCWludCBjdXJpZHggPSBVVEY4X1NUQUNLQlVGIC0gMSwgY3dpZHRo ID0gMSwNCj4gKwkJCQkgICAgbmIgPSAwOw0KPiArCQkJCXRla2VuX2NoYXJfdCBjb2RlcG9p bnQ7DQo+ICsNCj4gKwkJCQkvKiBTYXZlIGN1cnJlbnQgYnl0ZS4gKi8NCj4gKwkJCQlieXRl c1tjdXJpZHhdID0gYzsNCj4gKwkJCQljdXJpZHgtLTsNCj4gKwkJCQluYisrOw0KPiArCQkJ CS8qIExvb3AgYmFjayB0aHJvdWdoIGlucSB1bnRpbCB3ZSBoaXQgdGhlDQo+ICsJCQkJICog bGVhZGluZyBieXRlLiAqLw0KPiArCQkJCXdoaWxlIChDVExfVVRGOF9DT05UKGMpICYmIG5i IDwgVVRGOF9TVEFDS0JVRikgew0KPiArCQkJCQl0dHlpbnFfcGVla2NoYXIoJnRwLT50X2lu cSwgJmMsICZxdW90ZSk7DQo+ICsJCQkJCXR0eWlucV91bnB1dGNoYXIoJnRwLT50X2lucSk7 DQo+ICsJCQkJCWJ5dGVzW2N1cmlkeF0gPSBjOw0KPiArCQkJCQljdXJpZHgtLTsNCj4gKwkJ CQkJbmIrKzsNCj4gKwkJCQl9DQo+ICsJCQkJLyoNCj4gKwkJCQkgKiBTaGlmdCBhcnJheSBz byB0aGF0IHRoZSBsZWFkaW5nDQo+ICsJCQkJICogYnl0ZSBlbmRzIHVwIGF0IGlkeCAwLg0K PiArCQkJCSAqLw0KPiArCQkJCWlmIChuYiA8IFVURjhfU1RBQ0tCVUYpDQo+ICsJCQkJCW1l bW1vdmUoJmJ5dGVzWzBdLCAmYnl0ZXNbY3VyaWR4ICsgMV0sDQo+ICsJCQkJCSAgICBuYiAq IHNpemVvZih1aW50OF90KSk7DQo+ICsJCQkJLyogQ2hlY2sgZm9yIG1hbGZvcm1lZCBVVEY4 IGNoYXJhY3RlcnMuICovDQo+ICsJCQkJaWYgKG5iID09IFVURjhfU1RBQ0tCVUYgJiYNCj4g KwkJCQkgICAgQ1RMX1VURjhfQ09OVChieXRlc1swXSkpIHsNCj4gKwkJCQkJLyoNCj4gKwkJ CQkJICogUGxhY2UgYWxsIGJ5dGVzIGJhY2sgaW50byB0aGUgaW5xIGFuZA0KPiArCQkJCQkg KiBkZWxldGUgdGhlIGxhc3QgYnl0ZSBvbmx5Lg0KPiArCQkJCQkgKi8NCj4gKwkJCQkJdHR5 aW5xX3dyaXRlKCZ0cC0+dF9pbnEsIGJ5dGVzLA0KPiArCQkJCQkgICAgVVRGOF9TVEFDS0JV RiwgMCk7DQo+ICsJCQkJfSBlbHNlIHsNCj4gKwkJCQkJLyogRmluZCBjb2RlcG9pbnQgYW5k IHdpZHRoLiAqLw0KPiArCQkJCQljb2RlcG9pbnQgPQ0KPiArCQkJCQkgICAgdGVrZW5fdXRm OF9ieXRlc190b19jb2RlcG9pbnQoYnl0ZXMsDQo+ICsJCQkJCQluYik7DQo+ICsJCQkJCWlm IChjb2RlcG9pbnQgIT0NCj4gKwkJCQkJICAgIFRFS0VOX1VURjhfSU5WQUxJRF9DT0RFUE9J TlQpIHsNCj4gKwkJCQkJCWN3aWR0aCA9IHRla2VuX3djd2lkdGgoDQo+ICsJCQkJCQkgICAg Y29kZXBvaW50KTsNCj4gKwkJCQkJfSBlbHNlIHsNCj4gKwkJCQkJCS8qDQo+ICsJCQkJCQkg KiBQbGFjZSBhbGwgYnl0ZXMgYmFjayBpbnRvIHRoZQ0KPiArCQkJCQkJICogaW5xIGFuZCBm YWxsIGJhY2sgdG8NCj4gKwkJCQkJCSAqIGRlZmF1bHQgYmVoYXZpb3VyLg0KPiArCQkJCQkJ ICovDQo+ICsJCQkJCQl0dHlpbnFfd3JpdGUoJnRwLT50X2lucSwgYnl0ZXMsDQo+ICsJCQkJ CQkgICAgbmIsIDApOw0KPiArCQkJCQl9DQo+ICsJCQkJfQ0KPiArCQkJCXRwLT50X2NvbHVt biAtPSBjd2lkdGg7DQo+ICsJCQkJLyoNCj4gKwkJCQkgKiBEZWxldGUgY2hhcmFjdGVyIGJ5 IHB1bmNoaW5nDQo+ICsJCQkJICogJ2N3aWR0aCcgc3BhY2VzIG92ZXIgaXQuDQo+ICsJCQkJ ICovDQo+ICsJCQkJaWYgKGN3aWR0aCA9PSAxKQ0KPiArCQkJCQl0dHlvdXRxX3dyaXRlX25v ZnJhZygmdHAtPnRfb3V0cSwNCj4gKwkJCQkJICAgICJcYiBcYiIsIDMpOw0KPiArCQkJCWVs c2UgaWYgKGN3aWR0aCA9PSAyKQ0KPiArCQkJCQl0dHlvdXRxX3dyaXRlX25vZnJhZygmdHAt PnRfb3V0cSwNCj4gKwkJCQkJICAgICJcYlxiICBcYlxiIiwgNik7DQo+ICAgCQkJfSBlbHNl IHsNCj4gICAJCQkJLyoNCj4gICAJCQkJICogUmVtb3ZlIGEgcmVndWxhciBjaGFyYWN0ZXIg YnkNCj4gZGlmZiAtLWdpdCBhL3N5cy90ZWtlbi90ZWtlbl93Y3dpZHRoLmggYi9zeXMvdGVr ZW4vdGVrZW5fd2N3aWR0aC5oDQo+IGluZGV4IGY1N2ExODVjMjQzMy4uZjVhMjNkYmM5Njc5 IDEwMDY0NA0KPiAtLS0gYS9zeXMvdGVrZW4vdGVrZW5fd2N3aWR0aC5oDQo+ICsrKyBiL3N5 cy90ZWtlbi90ZWtlbl93Y3dpZHRoLmgNCj4gQEAgLTgsNiArOCw4IEBADQo+ICAgICogTGF0 ZXN0IHZlcnNpb246IGh0dHA6Ly93d3cuY2wuY2FtLmFjLnVrL35tZ2syNS91Y3Mvd2N3aWR0 aC5jDQo+ICAgICovDQo+ICAgDQo+ICsjZGVmaW5lIFRFS0VOX1VURjhfSU5WQUxJRF9DT0RF UE9JTlQgLTENCj4gKw0KPiAgIHN0cnVjdCBpbnRlcnZhbCB7DQo+ICAgICB0ZWtlbl9jaGFy X3QgZmlyc3Q7DQo+ICAgICB0ZWtlbl9jaGFyX3QgbGFzdDsNCj4gQEAgLTExNiwzICsxMTgs MzEgQEAgc3RhdGljIGludCB0ZWtlbl93Y3dpZHRoKHRla2VuX2NoYXJfdCB1Y3MpDQo+ICAg ICAgICAgKHVjcyA+PSAweDIwMDAwICYmIHVjcyA8PSAweDJmZmZkKSB8fA0KPiAgICAgICAg ICh1Y3MgPj0gMHgzMDAwMCAmJiB1Y3MgPD0gMHgzZmZmZCkpKTsNCj4gICB9DQo+ICsNCj4g Ky8qDQo+ICsgKiBDb252ZXJ0cyBhbiBVVEYtOCBieXRlIHNlcXVlbmNlIHRvIGEgY29kZXBv aW50IGFzIHNwZWNpZmllZCBpbg0KPiArICogaHR0cHM6Ly9kYXRhdHJhY2tlci5pZXRmLm9y Zy9kb2MvaHRtbC9yZmMzNjI5I3NlY3Rpb24tMyAuIFRoZSBmdW5jdGlvbg0KPiArICogZXhw ZWN0cyB0aGUgJ2J5dGVzJyBhcnJheSB0byBzdGFydCB3aXRoIHRoZSBsZWFkaW5nIGNoYXJh Y3Rlci4NCj4gKyAqLw0KPiArc3RhdGljIHRla2VuX2NoYXJfdA0KPiArdGVrZW5fdXRmOF9i eXRlc190b19jb2RlcG9pbnQodWludDhfdCBieXRlc1s0XSwgaW50IG5ieXRlcykNCj4gK3sN Cj4gKw0KPiArICAvKiBDaGVjayBmb3IgbWFsZm9ybWVkIGNoYXJhY3RlcnMuICovDQo+ICsg IGlmIChiaXRjb3VudChieXRlc1swXSAmIDB4ZjApICE9IG5ieXRlcykNCj4gKyAgICByZXR1 cm4gKFRFS0VOX1VURjhfSU5WQUxJRF9DT0RFUE9JTlQpOw0KPiArDQo+ICsgIHN3aXRjaCAo bmJ5dGVzKSB7DQo+ICsgIGNhc2UgMToNCj4gKyAgICByZXR1cm4gKGJ5dGVzWzBdICYgMHg3 Zik7DQo+ICsgIGNhc2UgMjoNCj4gKyAgICByZXR1cm4gKGJ5dGVzWzBdICYgMHhmKSA8PCA2 IHwgKGJ5dGVzWzFdICYgMHgzZik7DQo+ICsgIGNhc2UgMzoNCj4gKyAgICByZXR1cm4gKGJ5 dGVzWzBdICYgMHhmKSA8PCAxMiB8IChieXRlc1sxXSAmIDB4M2YpIDw8IDYgfCAoYnl0ZXNb Ml0gJiAweDNmKTsNCj4gKyAgY2FzZSA0Og0KPiArICAgIHJldHVybiAoYnl0ZXNbMF0gJiAw eDcpIDw8IDE4IHwgKGJ5dGVzWzFdICYgMHgzZikgPDwgMTIgfA0KPiArCShieXRlc1syXSAm IDB4M2YpIDw8IDYgfCAoYnl0ZXNbM10gJiAweDNmKTsNCj4gKyAgZGVmYXVsdDoNCj4gKyAg ICByZXR1cm4gKFRFS0VOX1VURjhfSU5WQUxJRF9DT0RFUE9JTlQpOw0KPiArICB9DQo+ICt9 DQo+IA0KDQotLSANClNpbmNlcmVseSwNCkRpbWEgKGZsdWZmeUBGcmVlQlNELm9yZywgaHR0 cHM6Ly90Lm1lL0ZsdWZmeUJTRCkNCihkZXNrdG9wLCBrZGUsIHgxMSwgb2ZmaWNlLCBwb3J0 cy1zZWN0ZWFtKUBGcmVlQlNEIHRlYW0NCg== --------------Vuuk9vmWgU0JvpFOp1Rm0g4s-- --------------gKOlBnU1tFebtn0FXPxvZfe0 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEELTAsy5mEEwxvh7r8+4ugndU5jykFAmUhx9MFAwAAAAAACgkQ+4ugndU5jykX lg/+Lx1ahUYMh47IRZfbLHaKGE7atCm9WZG/NJkwEltDxxUVl6Pmt9tcE/NXhP3Zecm/f3n/Xfgk 3+goYUJByvLYWfcmtX9C4fSb8k2bJFy0mLi8jk5kkaAfBrEcPfg3bb4jWOf5hddjiqogHWeN7wrN RDFpJTUO1KyjadJD3L5vV4Pyk0uL8t+mcvECI0tkFZpQreHBCtnnWt1f1RKm3kE9JYDxY08MFRuQ cWccUig3cxN06oK0aYBdf9BdptvoJ+V5MX7W2N1N5Bllyz3L5kV2qi03P5pETeMB8io4JqBY2j6p 4/bblYEySTzNBvoSc1/JHTDx88zwKr34Nh0BzP1BpNhUPMLIg28uvFqAtOQaTkvzEdR8tmAI7u7y 1Nof4KJKS4AnB+PXrEFUiRNXntTkx0DU4gnMlnqd9wcuQWT+BNYoW7BDjRdCTSPxRdBD29//XPGw P4OUnQEISlptpkVk/ng1PVw/UJfdt3D5Cq70BsxZKnk5DeMwAncMdVJnbW6FRc8+kpZP1TuQMxzv f6pIhldGUKr56ncnVoS+4u9ucBo50ce4ujqoeD7J/jvaQCt+xqNI3I5hJqcpm0kYpUqreUqERExj xQw/qczVsGl81NdlmxjtizXBS7ZDs6xoaY1M4G1N/MnMAGeCrqPe9jWhhR2BmyfZxtHxFEd6Y+lB 7J8= =qbbP -----END PGP SIGNATURE----- --------------gKOlBnU1tFebtn0FXPxvZfe0-- From nobody Sat Oct 7 21:36:48 2023 X-Original-To: dev-commits-src-main@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 4S2zCJ3cNCz4wVCy; Sat, 7 Oct 2023 21:37:00 +0000 (UTC) (envelope-from christos@freebsd.org) Received: from margiolis.net (mail.margiolis.net [95.179.159.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2zCH3KNsz4ZJD; Sat, 7 Oct 2023 21:36:59 +0000 (UTC) (envelope-from christos@freebsd.org) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=mail; bh=Or9pPaegt9hK8oZ 8GK2biAQsBQkyjqmFic+SaqPjMzs=; h=in-reply-to:references:subject:cc:to: from:date; d=margiolis.net; b=Y6hBLVi94plj7wOGbkpc3lfxoDSMAZVqzZXt773B JUavCLYm4EF81FAPPXOiFOr+y3y1h1C1i5pocrfswiip3tCplpDIJJAFv2Kewuj0h1HEv2 yErb78eeOEn+08pAVvb6zEmiEZsUw8JiQUKoZd0tn8PxfeEHyUR/RSTnCpVtM= Received: from pleb (ppp-94-66-59-115.home.otenet.gr [94.66.59.115]) by margiolis.net (OpenSMTPD) with ESMTPSA id 5b5587ea (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sat, 7 Oct 2023 21:36:50 +0000 (UTC) Date: Sun, 8 Oct 2023 00:36:48 +0300 From: Christos Margiolis To: Dima Panov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9e589b093857 - main - tty: fix improper backspace behaviour for UTF8 characters when in canonical mode Message-ID: References: <202310071800.397I0p9G047831@gitrepo.freebsd.org> <816f8408-865a-488f-a139-ad4bae2301fb@FreeBSD.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <816f8408-865a-488f-a139-ad4bae2301fb@FreeBSD.org> X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:20473, ipnet:95.179.144.0/20, country:US] X-Rspamd-Queue-Id: 4S2zCH3KNsz4ZJD Dima Panov wrote: > It breaks the build %( > > > In file included from /usr/local/poudriere/jails/150aarch64/usr/src/sys/teken/teken.c:70: > /usr/local/poudriere/jails/150aarch64/usr/src/sys/teken/teken_wcwidth.h:132:7: error: call to undeclared function 'bitcount'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] > if (bitcount(bytes[0] & 0xf0) != nbytes) > ^ > 1 error generated. > *** [teken.o] Error code 1 The cross builds had succeeded on GitHub's Actions, our local machines and the FreeBSD cluster, so we thought it was good to go. Apparently, the code should call __bitcount() which is defined in sys/types.h (included in teken/teken.h), instead of bitcount(), which is defined in sys/libkern.h and is not included. I am pushing a fix right now. Unfortunately, since all the machines I keep trying to clean build on succeed, we'll have to wait for feedback again to be sure that the fix is working... Christos From nobody Sat Oct 7 21:37:30 2023 X-Original-To: dev-commits-src-main@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 4S2zCv1mjHz4wVNh; Sat, 7 Oct 2023 21:37:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S2zCv1Hhnz4ZVX; Sat, 7 Oct 2023 21:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696714651; 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=Y17bIXKOjibYNTp9AJothV1ySmNXV4SJ3uElbViNuOs=; b=IJc5aNjdw8i4bqSGQuQNO1+O4AExz8Z3vBb0hS4UpP4uBo6sXv0omrGkSEnhq65z0PFxHc wXkx3vpdtrFMIsU8Sv2MlVIk6KPnzzgpy/2v1tO0Hn2w0P6PUpHVlZLiph3xQxV+jQVM8b CM5dEwbxJ1HfUDKifN8C993LAsugCRN5+gzi0FVnja5/zKDsRHl+gqm0P+AODXYdj9Olmf /z1zgR0t8FWk3UB07iGoGaM7ayis9PN1OvdIVdS5sG8ZGOEV6TP5UbrJQnwJKXSJJMtoXE yw/4b94f5TtZQL4MQWanO0L+7k5RvFeD7ejaFkqyUr1D2qhxSeWA3LifcuXbRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696714651; a=rsa-sha256; cv=none; b=Kgkpd6tZi7Je8N785C3ve9e1U7/Akzt1THaWtodT6KZ4MArZLxkcDW7/bdrIUTYP1iHK84 fXWY5X0GK0A2dvPxJDLLuX7blo9iM04vNxMZUYvtPC+kML3nhRYadDV5Sdwmv1t3HLLp2g AHitqYsuy61DQmvrfLdKohE97I3alvGKFWbzVJ8i1ilOrg/6LggzpJF4NBYI6ke3zcxVLM 1AP0SG4HtiC1AQKItFf2CqgnpnTz3xxOaIRmqmudtKddAouwahpzIe9mEQPmIxLt7MLH3A posLYKZw7sD+lZrb/clcNIs06HeN6We/RiSI3HB4103ovvg0fo8JJROenEI/7g== 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=1696714651; 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=Y17bIXKOjibYNTp9AJothV1ySmNXV4SJ3uElbViNuOs=; b=Qo0BdZHqdCoc1uFykjMffuDqI2X/xH98H1wijfDTO1MCfuVxZY6+3r0uBByL8k0Nn8vjEM HocXuC7JqDGgncib58dHnk1nS2aaEYqzdAp/bjk9PiUe8wPzvnixMC/4ixuTWuYXPh2PX3 RstabaPwc7jSVB444vv7ateWlOWpnYOSNdNhcpRI+dqGeAKLx4OXJEV0H5+BrSApoSoAIE ibeomzuxau6saQ7I784hVj0Bp4H+UEtWdS2vHudkDkkNWvBGQqf1yAgCCFcwOmtcSOHRoP ElrTQ0khaNZbCHSqeba33KHVHlVTodH2Y19PxNBAsc2Z7EG43iuhUG5PogG3hQ== 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 4S2zCv0M5LzmrZ; Sat, 7 Oct 2023 21:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 397LbUIG007725; Sat, 7 Oct 2023 21:37:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 397LbUCU007722; Sat, 7 Oct 2023 21:37:30 GMT (envelope-from git) Date: Sat, 7 Oct 2023 21:37:30 GMT Message-Id: <202310072137.397LbUCU007722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 6d3296f16a06 - main - teken: use __bitcount() instead of bitcount() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d3296f16a06bcaa49918799e683936711dcf9c9 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6d3296f16a06bcaa49918799e683936711dcf9c9 commit 6d3296f16a06bcaa49918799e683936711dcf9c9 Author: Christos Margiolis AuthorDate: 2023-10-07 21:36:59 +0000 Commit: Christos Margiolis CommitDate: 2023-10-07 21:36:59 +0000 teken: use __bitcount() instead of bitcount() The use of bitcount() triggered a build error because it couldn't be located. __bitcount() on the other hand is defined in sys/types.h, which is included in teken/teken.h. MFC after: 2 weeks --- sys/teken/teken_wcwidth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/teken/teken_wcwidth.h b/sys/teken/teken_wcwidth.h index f5a23dbc9679..bc992e1ef5d8 100644 --- a/sys/teken/teken_wcwidth.h +++ b/sys/teken/teken_wcwidth.h @@ -129,7 +129,7 @@ teken_utf8_bytes_to_codepoint(uint8_t bytes[4], int nbytes) { /* Check for malformed characters. */ - if (bitcount(bytes[0] & 0xf0) != nbytes) + if (__bitcount(bytes[0] & 0xf0) != nbytes) return (TEKEN_UTF8_INVALID_CODEPOINT); switch (nbytes) { From nobody Sat Oct 7 22:47:36 2023 X-Original-To: dev-commits-src-main@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 4S30mn1v04z4wj1y; Sat, 7 Oct 2023 22:47:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S30mn1RMxz3G7W; Sat, 7 Oct 2023 22:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696718857; 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=4J2ZmykaOeT6VGUeQtpobkE0UrQQwfGnEDqNVkhbEHw=; b=lzrKCcxg7o40C+zOXUGrNfYEQhMCTCyLAYwZeUJIL63GhYp8FrhIoAJbK/hkX6Itdp28dM auD7hl0ZU6Z7QvudXWieWy2Vk0GzInybUw4PMh5lSoysIXtXKSc2pa8cV6fS0XYNHCWeo+ b2ZjjdTN3zKX/eBNx+tQw3+3Ld0k2jGGCl/BT980MnY2I0gpfK4xYABmSIgDCDX0hfHwxk yn6+37gLEaVlv16XCN3T+eRUJzF4KvnHUBvAirXWynKK89J8I4CTh64i9YA1p3vu+sfw4Q a7t0jku5OUF21zMAAZYXfvevWwJQmi0il1OsTKnLvkUQwxnzq2EZ7Snfe4WBww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696718857; a=rsa-sha256; cv=none; b=J0pGgAKXCRrRYvxgHA7tz5Rw294xWPgVgFDXIa81qJTIBiXMvR1V1+JnLLfsLb9kidPq+Z KYjnfvwDD/SMvQZPXJrOrSgKFcvBBXD4yzfUkWdxyIkPaz2JJdXW5wufzFp2/b1w90cNqa kFEUybG0iWUGgLpAynlXc4i86jdniK8DpHzhs2eto+Ssx+wwPbUtv3hjfXq03tWM/ZPDxZ GmtSZxyFmiTCzX5B8XXWXjaGCV+1OHuYX6UZJgS2AVDFhv3SLa9aBZPNrDB18ce5+2I5fA EC1Djx8vosYWE1mc4M1b3z6wZYikLYjMf4ij0O4Bd+f8rOU8+MHBAW0nCCBpMQ== 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=1696718857; 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=4J2ZmykaOeT6VGUeQtpobkE0UrQQwfGnEDqNVkhbEHw=; b=VOjaZP7qMeR0ozOpX6aLpfeuL45GVblKTO59X8Q/H2ik+xgmuYEV1ugNLaU33A+OqthPUh mz0KKdeo4uP97J/5PYVYM9O3uYTFmW/XQnCi4puZ7/i20wwS6Een8XVGPoIUP5sp+AkU6a m/vWajx3IVKtzg1Vh6GEYw1RexMAod5mY51j2pXggss2Sa//sTX0eBBmrzIhReBtqWQGdM iwotl4yQG7j6Bt+rZOuENw4XAHa+u+UnupU9DcMCqm5DlX5h+vuE8oxFBRPs5N+SFU57cu QIm/5wG4LhYniljK1bUAGMTkKRz9xrgl04YmHeNMzpKi08ADbpaaesVHHB21tQ== 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 4S30mn0NWbzpny; Sat, 7 Oct 2023 22:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 397Mlalk024077; Sat, 7 Oct 2023 22:47:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 397MlaNt024074; Sat, 7 Oct 2023 22:47:36 GMT (envelope-from git) Date: Sat, 7 Oct 2023 22:47:36 GMT Message-Id: <202310072247.397MlaNt024074@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Danilo G. Baio" Subject: git: 04c8bfc17610 - main - jexec.8: Add examples section List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dbaio X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04c8bfc1761010c36081cf300fa751548d541122 Auto-Submitted: auto-generated The branch main has been updated by dbaio: URL: https://cgit.FreeBSD.org/src/commit/?id=04c8bfc1761010c36081cf300fa751548d541122 commit 04c8bfc1761010c36081cf300fa751548d541122 Author: Danilo G. Baio AuthorDate: 2023-10-07 22:44:44 +0000 Commit: Danilo G. Baio CommitDate: 2023-10-07 22:44:44 +0000 jexec.8: Add examples section MFC after: 3 days Reviewed by: gbe, 0mp, danfe, pauamma_gundo.com Differential Revision: https://reviews.freebsd.org/D40831 --- usr.sbin/jexec/jexec.8 | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/usr.sbin/jexec/jexec.8 b/usr.sbin/jexec/jexec.8 index 69f380676c30..4400cbbe56a3 100644 --- a/usr.sbin/jexec/jexec.8 +++ b/usr.sbin/jexec/jexec.8 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 24, 2016 +.Dd October 7, 2023 .Dt JEXEC 8 .Os .Sh NAME @@ -65,6 +65,44 @@ The user name from jailed environment as whom the .Ar command should run. .El +.Sh EXAMPLES +.Ss Example 1 : Open a shell in a jail +The following command specifies a jail by its name and utilizes the current +user's shell: +.Pp +.Dl # jexec name +.Pp +It is also possible to specify a jail by its jid: +.Pp +.Dl # jexec JID +.Ss Example 2 : Run a single command without opening a shell +The following command runs +.Ql uname -a +in a jail called +.Dq name . +Since a command is specified explicitly, +.Nm +does not spawn an interactive shell. +Instead, +.Nm +executes the specified command directly. +.Pp +.Dl # jexec name uname -a +.Ss Example 3 : Open a shell in a jail with a clean environment +The following command opens a +.Xr sh 1 +shell in a jail with a clean environment: +.Pp +.Dl # jexec -l name sh +.Ss Example 4 : Open a shell in a jail with the login command +The following command utilizes +.Xr login 1 +to access the jail, submitting an audit record, and displaying the +user's last login, system copyright, and +.Xr motd 5 +message: +.Pp +.Dl # jexec -l name login -f root .Sh SEE ALSO .Xr jail_attach 2 , .Xr jail 8 ,