From nobody Sat Aug 9 12:36:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bzgNy1Ptxz64C4S; Sat, 09 Aug 2025 12:36: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bzgNx4fSvz3m0w; Sat, 09 Aug 2025 12:36:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754742961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=trZyXpWAMd0aw52XWV5wpl/aDqWfcJiOuBLNBLUZVbY=; b=oe8NDnsvw7ku7ufSSSZzPenyUK3y4pK0ODj4BeryplIb9ewWM2GHzapOz3J5NXGLab8Jbs QBIokgomZLC5cQ4ZDi4B2MYFOC1Br6ivNUOPoj4M5DIgzo2Y99RUVcJ1We2dlWuZ0aXbpZ 4i+fTsZzltr+Yh7KEB7exRU9H7bLNwkgY7xIy6l43/f4jRwlZh3gQ58XupRIYpsk7lH7xl gCt6mqZpUjW12uUijrXS8YAV0NPJ5NkTUILjER3V3vJ1jUPqVCiKGkPu1o5YVN1O587oGe wEkhz/rSuG1Nc2TGblitw5wvZX91PyRKA8WmD75WVxOouUgKF8F0QH1EYiX6Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754742961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=trZyXpWAMd0aw52XWV5wpl/aDqWfcJiOuBLNBLUZVbY=; b=LBTp0q999ZEzGCSFfYgE4kLxz6jphhcg0/YvYzDS+tqKTCb9ULVdoNBxa4YhVEsExR7XeH FNBT2mIElEquGK9qb7A4IsVIBM1d+NGf+BtYdWJ0Ect3qGHvO4h6CQTcukVpkZ8DJl8ZLD Y7uCoWXEf5a0VuRxnJ0EeNZeEw5/CKVhPHY3qpg89efFAmUdVSwKaY9M6DEksPWagiBCSC B7v15ODqMJcZ5SNSXlgEdSI+uQFhAY2DJdD6A/R9aI1XkZJ9LjL9zbwcfVAybDfyp6ufgi EMwUyTGLqim8g+iF2eVa8g80wKQiaqX6HdODBnaLLivvmSA59wizcegqBbpQOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754742961; a=rsa-sha256; cv=none; b=LLYNHjfMrCEb+RBECyqrLM1MCtn43REc08JOeXC3FZ6dkSL9sWtvKGxX3QbwlSmsGRV2Iv C1yeFcAEH3A9E8OZ6gzs+3VoT369uUQFXZJbEJC3z9FSHBJaE/E7YFMsYjH7zlfD3e/yw1 lnTrvLpkuwa8vXeiLFRApvpu4ne/uULJ9kSnRKqo9hj8gbO5wx7VvkCcqILK7E2nZ6RbFl jl7boKvqaEtZJ97Kv+1rSj73QjmpoyQcSw1sG0OHwuVXOmkRkh5fHeroQ5d/aHLgWvPe9s W5BK1ZJxMjj6+AU0T6JR8zypGiQxD0hhrWVm44xcKeQXf/jPSZ6mqYRdsjRpwA== 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 4bzgNx4DGnz6J4; Sat, 09 Aug 2025 12:36:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 579Ca1s6020683; Sat, 9 Aug 2025 12:36:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 579Ca1Y3020680; Sat, 9 Aug 2025 12:36:01 GMT (envelope-from git) Date: Sat, 9 Aug 2025 12:36:01 GMT Message-Id: <202508091236.579Ca1Y3020680@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: 3c9acc35b1d9 - main - linuxkpi: Add the `topology_*()` functions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c9acc35b1d9e776fa10d45c0ad7d3737e8ccf38 Auto-Submitted: auto-generated The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=3c9acc35b1d9e776fa10d45c0ad7d3737e8ccf38 commit 3c9acc35b1d9e776fa10d45c0ad7d3737e8ccf38 Author: Jean-Sébastien Pédron AuthorDate: 2025-06-21 12:42:04 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2025-08-09 12:26:24 +0000 linuxkpi: Add the `topology_*()` functions ... from . The amdgpu DRM driver started to use `topology_num_cores_per_package()` in Linux 6.9. Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50993 --- sys/compat/linuxkpi/common/include/asm/topology.h | 54 ++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/gfp.h | 1 + .../linuxkpi/common/include/linux/topology.h | 35 ++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/asm/topology.h b/sys/compat/linuxkpi/common/include/asm/topology.h new file mode 100644 index 000000000000..f334d3253cfb --- /dev/null +++ b/sys/compat/linuxkpi/common/include/asm/topology.h @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2025 The FreeBSD Foundation + * Copyright (c) 2025 Jean-Sébastien Pédron + * + * This software was developed by Jean-Sébastien Pédron 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. + */ + +#ifndef _LINUXKPI_ASM_TOPOLOGY_H_ +#define _LINUXKPI_ASM_TOPOLOGY_H_ + +#if defined(__i386__) || defined(__amd64__) +#include + +/* + * The following functions are defined in `arch/x86/include/asm/topology.h` + * and thus are specific to i386 and amd64. + */ + +static inline unsigned int +topology_num_cores_per_package(void) +{ + return (mp_ncores); +} + +static inline unsigned int +topology_num_threads_per_package(void) +{ + return (mp_ncpus); +} +#endif + +#endif /* _LINUXKPI_ASM_TOPOLOGY_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h index 4c4caa621789..7a32e7862338 100644 --- a/sys/compat/linuxkpi/common/include/linux/gfp.h +++ b/sys/compat/linuxkpi/common/include/linux/gfp.h @@ -34,6 +34,7 @@ #include #include +#include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/topology.h b/sys/compat/linuxkpi/common/include/linux/topology.h new file mode 100644 index 000000000000..16baffc024d1 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/topology.h @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2025 The FreeBSD Foundation + * Copyright (c) 2025 Jean-Sébastien Pédron + * + * This software was developed by Jean-Sébastien Pédron 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. + */ + +#ifndef _LINUXKPI_LINUX_TOPOLOGY_H_ +#define _LINUXKPI_LINUX_TOPOLOGY_H_ + +#include + +#endif /* _LINUXKPI_LINUX_TOPOLOGY_H_ */