From nobody Wed Sep 07 15:10:37 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 4MN5Kp3vd1z4bPkl; Wed, 7 Sep 2022 15:10: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 4MN5Kp1Qltz3bDm; Wed, 7 Sep 2022 15:10:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6XU980ATVVQWAbr1a4Gb9jnRf19HzpYT8e9/Lmioryk=; b=QhOKonv0HdjSXpirAEw9YQZyBpZuWgNw/R3XLkRKj92sSi2QR/yvSzJrC91TkmyWqUiom9 u1N7/MMUqpwD281j/4G/7rHl3V/Ynv+O+IQxEmuBRIxblxEb5kl7WacIZzCBttCKSdUG55 5h3V2/x90a3HdLwOHqo0YLcGTfwsPCJ/cCmUybqG/nQPnTGTSH4Uk+/QMTwSAKofZ6edgH Y3U00RaVTV7PmfHHx/FmnKcaceIgf9I3ZiwSA/mNFqNCRdLoTJ3DAv9F6ZrtyRO3AqnaMj Tx3cd3Kruku3+d/57lcDmkn2dfgfj3+9zwGgkC3DFlAcsbLoKWB/ZlwB25yRnA== 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 4MN5Kp0XnVzZ8v; Wed, 7 Sep 2022 15:10:38 +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 287FAbb3026522; Wed, 7 Sep 2022 15:10:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 287FAboo026521; Wed, 7 Sep 2022 15:10:37 GMT (envelope-from git) Date: Wed, 7 Sep 2022 15:10:37 GMT Message-Id: <202209071510.287FAboo026521@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: 9ecde173624c - stable/13 - linuxkpi: Add __copy_to_user_inatomic and __copy_from_user_inatomic 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: 9ecde173624c892a2b9aba2a1b4ca977b63fd513 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6XU980ATVVQWAbr1a4Gb9jnRf19HzpYT8e9/Lmioryk=; b=xfkKNpEbuxht7DIbdz6AaK5NYsDoh8rGip7EOLYCxp+skRWOZtIygxL37QdGowRvVV6HWI mldQd7Mu7uyL8tGIbWCzM0lb1spCiRxh5a4MIMGnPC74tysUgPQCE8bv260RdstbQ3Lape srXj3PEAshtZjx3HS2MEKo+dH/Hp8lYts96xMu5Nbr0DWSnKgC6M0bLWLFfBO8ayhYUwR3 qi02c2gZ9aWlqtP+1wSt4haUN8V7II2gu0OHmYC7RpeE54kdNwQF0LTziWTLK32MwIYCES jx0Dd025DGL3HDHJBpW0UxCibLmTfn5nIVjLOXV7GGisRyBokpsTch733cUD1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662563438; a=rsa-sha256; cv=none; b=Co/nzjWniR7dDYuZhgtOPkgqU3KbrGF+ef/SLCgHT7bZTGTREl9GpRaOFgmd3CEMtWE8tc IP+sr4uyDkBf+fJp3JNzs18khvlQDlA+MXxW6EJM1G60zgOblhcr7oaMdoscMp/Sc1ifdW Rza5mIrAetI9vwKn/ciL6knRSEQCQmGwhKQt07nik1VL6GfUtyQo849c6fLgivAqUUmdTm H7fgQ+Izz6tC76aDv87DjKWBGW3Pev69fCUU3KFAsB06X/78gVtb3D0Pe1RNp2ixrR7MWq Qjj4w0FJIDSaxtegrok6XLAF9MeOHl9L7wJiT/JZaCSsJTgXFqPF1XwB84kUmA== 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=9ecde173624c892a2b9aba2a1b4ca977b63fd513 commit 9ecde173624c892a2b9aba2a1b4ca977b63fd513 Author: Emmanuel Vadot AuthorDate: 2022-08-10 06:44:14 +0000 Commit: Emmanuel Vadot CommitDate: 2022-09-07 15:09:06 +0000 linuxkpi: Add __copy_to_user_inatomic and __copy_from_user_inatomic Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36113 (cherry picked from commit 76d93395c522e28cfa329ba57ca235929462412c) --- sys/compat/linuxkpi/common/include/linux/uaccess.h | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/uaccess.h b/sys/compat/linuxkpi/common/include/linux/uaccess.h index c62a94e8e044..3fa16dbcd261 100644 --- a/sys/compat/linuxkpi/common/include/linux/uaccess.h +++ b/sys/compat/linuxkpi/common/include/linux/uaccess.h @@ -89,4 +89,29 @@ pagefault_disabled(void) return ((curthread->td_pflags & TDP_NOFAULTING) != 0); } +static inline int +__copy_to_user_inatomic(void __user *to, const void *from, unsigned n) +{ + + return (copyout_nofault(from, to, n) != 0 ? n : 0); +} +#define __copy_to_user_inatomic_nocache(to, from, n) \ + __copy_to_user_inatomic((to), (from), (n)) + +static inline unsigned long +__copy_from_user_inatomic(void *to, const void __user *from, + unsigned long n) +{ + /* + * XXXKIB. Equivalent Linux function is implemented using + * MOVNTI for aligned moves. For unaligned head and tail, + * normal move is performed. As such, it is not incorrect, if + * only somewhat slower, to use normal copyin. All uses + * except shmem_pwrite_fast() have the destination mapped WC. + */ + return ((copyin_nofault(__DECONST(void *, from), to, n) != 0 ? n : 0)); +} +#define __copy_from_user_inatomic_nocache(to, from, n) \ + __copy_from_user_inatomic((to), (from), (n)) + #endif /* _LINUXKPI_LINUX_UACCESS_H_ */