From nobody Thu Aug 18 09:10:08 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 4M7fH45Kclz4Ywvc; Thu, 18 Aug 2022 09:10: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 4M7fH44vRvz3PtV; Thu, 18 Aug 2022 09:10:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660813808; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fEIO3xxxBRuG9oDA7jwqk6e3RdcNfRw+E2zAqAjb3JI=; b=mM/HCyBrreYZXU/fjQkIJDKy0iwZMbyLMAslEu1+lZ78TzP6Uc1JC34Gnb9MVrFMRgtXm0 RzjFr123PTPqL75U5ampUItLrYZyU/GJqBh56b1snmIl5t3fLqYhG0w7fItdaN6I6R5z26 25Nx+0DJyg437YM2Au7bK3NnplEXouRDno37NqhwgnfvEjgfUZt27Smjoi8CiP7Za8wvfq iq/jyzBgVSnyzn0n7xwsIHQt/+zx9UFpD6SsS18dJlmbg626jMlnn+zVfrRLImUadU4pv6 p5ZMxjTo5AFdLXBkgmVKbOxGI8PqI9V7cbTFCCU2MIHfLoZ4dOoTnMF8tdAWrQ== 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 4M7fH4401bz1N6x; Thu, 18 Aug 2022 09:10:08 +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 27I9A8eY017670; Thu, 18 Aug 2022 09:10:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27I9A86A017668; Thu, 18 Aug 2022 09:10:08 GMT (envelope-from git) Date: Thu, 18 Aug 2022 09:10:08 GMT Message-Id: <202208180910.27I9A86A017668@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: b2c860060ccd - main - 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/main X-Git-Reftype: branch X-Git-Commit: b2c860060ccd6020f313f48107694ef207acfc9a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660813808; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fEIO3xxxBRuG9oDA7jwqk6e3RdcNfRw+E2zAqAjb3JI=; b=gDbeUkRumTf99ShLj2h3Gep0lmpXEQP5QW8U26Nq5Ns83geRXoXigR1MOnAZVCowBVLKYl ckCuh8gR/iTsXdTiapuwC175xRBdauGpVX0hw3FDwAxdP6nPLttFrpkYMWRTyMyYBLm7hg eH1qhT/2fH9Y1DKz6gv2t/vVrgKR0fC6Rp1TYWKbhAaodglAaQ5ybhhk6lNtuDXWJmrRQI 4TznRa+UBX3kG++7fHtOldxJCTFOykJZ4m7t2rFGyfYxct2ethx1T4NKM2A4lLPD4d0+M0 BTcTF1KOCPt+uNy/1CBd85LiDmuc9leyKc9Q7D8R0YaTYqp0EaMaST0UI2TVqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660813808; a=rsa-sha256; cv=none; b=JBCuG5SJwS94g6OFhlwN5AgaFM1j1nPeWiVeKLLC68ESsUX+H6LqXJ581jyJlLGkF/C+s6 R6k0gbKPzu10lfFEVDuu8TxwsFCC00+eNMC87XGWzWwUWBKX6BCxj/jicKG1n0L3aA5Dj8 nOvMLttDZTnhhGDeF1SEHrgRP/zTrYUGpWOtzkl7jHCisDCrfYLMIIaQHB2q8ZU9bQlz5x nY2kOaQi5sCfqS3POsGEb5C/qWsr5JlUa4oZgz4i7KFeAW0Q7e0pNorIb9bfSk+A7wynPm wTXwlnZnOK7PkBRhovcg+QGlars99QTOe7oyyuwi3CZ1pxbhdvsbXrvFVJmt/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b2c860060ccd6020f313f48107694ef207acfc9a commit b2c860060ccd6020f313f48107694ef207acfc9a Author: Emmanuel Vadot AuthorDate: 2022-08-09 12:21:09 +0000 Commit: Emmanuel Vadot CommitDate: 2022-08-18 07:46:43 +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 --- 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 8644f67762d9..89d2728ce28e 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, @@ -2730,6 +2731,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 @@ -2740,6 +2742,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");