From nobody Sat May 11 15:38:32 2024 X-Original-To: dev-commits-src-branches@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 4Vc8zX74QXz5KKdj; Sat, 11 May 2024 15:38: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 4Vc8zX6c8Pz450K; Sat, 11 May 2024 15:38:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715441912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LwR4oA9jdDzz8hb4HE9ueNgjAzlVAE+OzlkNfKKM3z4=; b=DrqrnueDXO95aL+HjCFOOev4y9icdA284hI8wRa1d9uHoPLbcjZGvtm3GcZIFpGdCNirbm iKdIxQ4aZnhnl21SAEpEB63A+ZJAdqWg4IwtIc+5QewvdJ4EISPMFbTVLRZ/aeiwmupnFX Az6QJumJECORoFYnb7QJAABBtX9TmfOH9GEKf5nUoaFqQ7fLqJz7JviMal+ckcNGZ1q6/r SCylpflArQ7F0JaOu1t4+huuMmYbHTIfD6SA3V09JItFkONSpqByUworyA2Bxl7q7QfkAu Yud1ZwE/ueo1RyV2+sQMtLEFFce/sFe6uhq+QNvfZBazErGnhF2hx3HVRHtr8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715441912; a=rsa-sha256; cv=none; b=ugPgI76jw4+jvPRIIuCqGH4WQrgd/Bh2kE0daSyhzLiJnQmYLwL3aJ+UXDQ4S+WxKFX5xo x95EcYmCfMyK2+s7aebFBp8In4ymnhfqzRcySHdFnYCFsKwnHgiZXCC7nn2/Nk0Kx6ANEV TPayEsT+yPoEq5OmQOxffJeiqC522MZQLijINCgxcOHDxyIKb0aZDrb07PgFTALFk9PHvL 9p5yYJTSEYTLTAh2ACCt5Slk7ZvY7o30vWvsu35MaxhBsHcYX2K3TQZTu9aMmD2Ptr9t3q at+dyG8k+tf0IeqPc5moyakMMbeDnHRr3pKHAs60W0sWodEqVPfQu3tOJRNuww== 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=1715441912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LwR4oA9jdDzz8hb4HE9ueNgjAzlVAE+OzlkNfKKM3z4=; b=LP2VIqs2SdiYzoYr5x7ka2S7tFcO6cHIibg6X8uK8eMJpWUuCFfUvGLI+hcpYToGfGnqmC MocibPk9HWiRwc65CMvYIQfaP0wKELkp00K3WJcJ64cujajXT1g8cXMC7idMmqlmiV6sBI rEVYuBFUAg8mcdvAikWzIk/kzCCt4Zt/D9zFIu7uP7ElZM4YnSiao6iFHu7dV88QsNPY0F 62ETYGJ+GbLg0BhMotbLBsQKV6otaYKSkxMr2FEvJWyOnfs/jppfsJEgycaPYqzjwRlXhp HG2viMYmI7tON/HQrYDi7rl7LaEMpdJ7iAME45j2xrXdyJSvIioIyz46PgbTjw== 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 4Vc8zX6CLszQwy; Sat, 11 May 2024 15:38: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 44BFcWLa039546; Sat, 11 May 2024 15:38:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44BFcWHs039543; Sat, 11 May 2024 15:38:32 GMT (envelope-from git) Date: Sat, 11 May 2024 15:38:32 GMT Message-Id: <202405111538.44BFcWHs039543@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tijl Coosemans Subject: git: 147ea7d4092f - stable/14 - linuxkpi: Fix set_memory_* List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tijl X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 147ea7d4092f4b08411724bd501283a281ffa34e Auto-Submitted: auto-generated The branch stable/14 has been updated by tijl: URL: https://cgit.FreeBSD.org/src/commit/?id=147ea7d4092f4b08411724bd501283a281ffa34e commit 147ea7d4092f4b08411724bd501283a281ffa34e Author: Tijl Coosemans AuthorDate: 2024-05-03 13:27:29 +0000 Commit: Tijl Coosemans CommitDate: 2024-05-11 15:32:35 +0000 linuxkpi: Fix set_memory_* set_memory_* is currently implemented using PHYS_TO_DMAP but not all architectures have a DMAP. Looking at how this function is used the given address isn't physical but virtual so the PHYS_TO_DMAP call can simply be removed. Also cast numpages before shifting it to avoid overflow. Reviewed by: kib, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45057 (cherry picked from commit 7206f7c619912bdd4d54dd539824733eae50c3a9) --- sys/compat/linuxkpi/common/include/asm/set_memory.h | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/asm/set_memory.h b/sys/compat/linuxkpi/common/include/asm/set_memory.h index 69f659001c60..1019aaf264a0 100644 --- a/sys/compat/linuxkpi/common/include/asm/set_memory.h +++ b/sys/compat/linuxkpi/common/include/asm/set_memory.h @@ -34,26 +34,20 @@ static inline int set_memory_uc(unsigned long addr, int numpages) { - 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)); + len = (vm_size_t)numpages << PAGE_SHIFT; + return (-pmap_change_attr(addr, len, VM_MEMATTR_UNCACHEABLE)); } static inline int set_memory_wc(unsigned long addr, int numpages) { #ifdef 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)); + len = (vm_size_t)numpages << PAGE_SHIFT; + return (-pmap_change_attr(addr, len, VM_MEMATTR_WRITE_COMBINING)); #else return (set_memory_uc(addr, numpages)); #endif @@ -62,13 +56,10 @@ set_memory_wc(unsigned long addr, int numpages) static inline int set_memory_wb(unsigned long addr, int numpages) { - 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)); + len = (vm_size_t)numpages << PAGE_SHIFT; + return (-pmap_change_attr(addr, len, VM_MEMATTR_WRITE_BACK)); } static inline int