From nobody Wed Sep 07 15:10:31 2022 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 4MN5Kg2gDqz4bPKb; Wed, 7 Sep 2022 15:10: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 4MN5Kg1xk7z3ZZB; Wed, 7 Sep 2022 15:10:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p1lNfacFrhe1lo2eQT8UeYptDgrQmg8KUItQkmAg7sI=; b=Ft8mdMMBzuxMDDTTR8uknwKHkKK72vvnO79DrnW0dFsbYnDcbt/RImY1y1a1IzgG3Ucjll M24va4STr6esj5MqeaRIlH9GpybHNV9xp3TMtnHYzhfQNvrm21llt0cK4evfndqNxMzMR8 b1n4H+2MzPM0F5vF+l/abfLqrhctu52L0BitEw6CTTXyEdnaSc8NmgUo5okxHAie4G2n4F EKAc8j7d/S2Qxx4jaPgFiHg5DwBKDLrcbGn1TmW/DvUPrbeNVUCHGIlm0aGyzzO84wJBtZ VdneRq7po64WndcHvGB3NHU2ZpS6DIHQbKx2OSK5MzI0OBsFmuhvvuzO9k616Q== 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 4MN5Kg0pHXzZ2T; Wed, 7 Sep 2022 15:10:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 287FAVPG026369; Wed, 7 Sep 2022 15:10:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 287FAVxr026368; Wed, 7 Sep 2022 15:10:31 GMT (envelope-from git) Date: Wed, 7 Sep 2022 15:10:31 GMT Message-Id: <202209071510.287FAVxr026368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 3d1608cdc30e - stable/13 - linuxkpi: Add asm/processor.h 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3d1608cdc30e28d524b7f1d7cd0910a8247b99f7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p1lNfacFrhe1lo2eQT8UeYptDgrQmg8KUItQkmAg7sI=; b=QZtEC2bst4xHN4U0h209/DPrx3vWnnTft7N9ZmImfThqEuXNyD4zNevH5EEGPQEGXHiIHU FCv61JL7wSpQ2jtz13Pz0SosDXlQfo+6oqyhmy2K/0Mn/pzwp+ZgXguMnkiDRf5dMzcfgM c2ut5OqxXLBL6YHKtMjKcrYKkr9Js73/P9eii4QiAVcefZU26iPYOsMFObyHhD1+uGvm2z 0g+0gjtvIbDw9sT9By4AaYM29NQwcIZoDETHdUuEpqNwrz5Q7k6vmALsU1N0e9IWceqCUL Okoo4TWXGpjVyyhpbGGyClLcxgG6afzQwtw/dQxKmMKyywdJ0HjqYxtAiOan1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662563431; a=rsa-sha256; cv=none; b=kouvkcDf5+RspAtkh+VWVts64xDnSklLOX5tMQZfQRBGNMfw+CdBV03nkSG32bKNY6jsOA wdyVYyWVl90icnq0+ZQxthl8Eaz+BKKWi9uqVf2ZeI3CIcwfB4TSLfj3ydp9THDarNXJqg g0Fe9i7tvrfiRioPIY7RB+lNJU7Lkk2pItJQgzZov41JhxPSxiXOl4kvoF2ngUQD00XNu9 FXjpejRHXr1P5ryh9/5MtrNMxUVkQ3mDrmBYhGti6JDpP+mk8rNk7uLl5su4X0M0WAKc/2 +W29PUMl/is6GOp9Kc1ERccbNnDE+n8llZcpqxKGaF42rEQiYkqxe/aj7TUuZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=3d1608cdc30e28d524b7f1d7cd0910a8247b99f7 commit 3d1608cdc30e28d524b7f1d7cd0910a8247b99f7 Author: Emmanuel Vadot AuthorDate: 2022-08-09 12:21:09 +0000 Commit: Emmanuel Vadot CommitDate: 2022-09-07 15:09:05 +0000 linuxkpi: Add asm/processor.h Also fill the boot_cpu_data struct as drm needs it. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36107 (cherry picked from commit b2c860060ccd6020f313f48107694ef207acfc9a) --- sys/compat/linuxkpi/common/include/asm/processor.h | 46 ++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++ 2 files changed, 50 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/asm/processor.h b/sys/compat/linuxkpi/common/include/asm/processor.h new file mode 100644 index 000000000000..450192750612 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/asm/processor.h @@ -0,0 +1,46 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Vladimir Kondratyev + * + * 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 ``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 _LINUXKPI_ASM_PROCESSOR_H_ +#define _LINUXKPI_ASM_PROCESSOR_H_ + +#include +#include +#include + +#if defined(__i386__) || defined(__amd64__) +struct cpuinfo_x86 { + uint8_t x86; + uint16_t x86_clflush_size; +}; + +#define cpu_relax() cpu_spinwait() + +extern struct cpuinfo_x86 boot_cpu_data; +#endif + +#endif /* _LINUXKPI_ASM_PROCESSOR_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 852bc1b153b2..2b962d98c968 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -97,6 +97,7 @@ __FBSDID("$FreeBSD$"); #if defined(__i386__) || defined(__amd64__) #include +#include #endif SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, @@ -2732,6 +2733,7 @@ io_mapping_create_wc(resource_size_t base, unsigned long size) #if defined(__i386__) || defined(__amd64__) bool linux_cpu_has_clflush; +struct cpuinfo_x86 boot_cpu_data; #endif static void @@ -2742,6 +2744,8 @@ linux_compat_init(void *arg) #if defined(__i386__) || defined(__amd64__) linux_cpu_has_clflush = (cpu_feature & CPUID_CLFSH); + boot_cpu_data.x86_clflush_size = cpu_clflush_line_size; + boot_cpu_data.x86 = ((cpu_id & 0xf0000) >> 12) | ((cpu_id & 0xf0) >> 4); #endif rw_init(&linux_vma_lock, "lkpi-vma-lock");