From nobody Fri May 03 13:36:05 2024 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 4VWBdx6GqLz5K2qC; Fri, 3 May 2024 13:36:05 +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 4VWBdx5cPtz4nsV; Fri, 3 May 2024 13:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714743365; 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=GJfdjJK875MjKNNbKW+mvjFp6iMr3ww/oZS4zqDo2+I=; b=k0Xc67lfxM6a+AL8iL9jVoU6hXpDyS9KJJg5036j8wQuYzLB7fkdbj9n2IS/qjRJgL7i7V RIkj3mudL9X25mPWebk5uDlVSINL6PRX38XtupPXGJ6Bq8TbSMWsCQB62z4aF+8P5eQ+n9 MUJYYJD9lhY6mH0Q3z1DncOwRjrsKnJQ6nTJawil5EhRiTxG1qPmwT0iMfxAPXHLR/epfw alfJOo7Xbf0gXbwDvP17s7BtlFbG0QOC3k+/Kv96nZQxiHWoYs3m4k+reVDSYCeuFCY+mc nGP4lg+6As9EBm/IV6v8jBQ0U9vmeaRpZ/sMemwE2E05PDbmPBRW8GF5Ya6AdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714743365; a=rsa-sha256; cv=none; b=UKyfZmZ3yW0DZWsfgrYH4HHwT+dvfVkYeBwkeNGTyB0bNBDvPzw/Nh6FOf6Q3CwF2TpAcv o5B1XP+2mULxicfvotCpt5jwIy+zmg0JZ4n45YsDRBXCbQGDNRo/Db+2R07HSxBcVkYb3W YznKDs7ZNK68B5lgnYoIDcLhAmIKHg11D5gwYK5iBp0xCycY1VjK0yxC23GArcqq3wzQNU uWRk9dcaqQnzFiMzxSWJ1YyZDqDQm1EZw+Pbp63+X6fR8zGnma19GDrSGKEkNMFpZbCoS+ //oYPEWFavVqJy475vBCMXykfdzrA8KfTLR62jEwSs4pPWCIn8KhwkIg4Oc+lg== 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=1714743365; 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=GJfdjJK875MjKNNbKW+mvjFp6iMr3ww/oZS4zqDo2+I=; b=ySTAv/cEpMGmBBLcfngsFgW0taPR72fNZ11ikacR8KU3Y1NdAi2XBfx/TciqtkB8w9x2Nl +nj/hR+Kp/o0r3wo68ctTE8GgcY7PL5fmeglk74PM0/wnpnXT0eIto74gT9JnKij2qEl2L ON8CMWDHDH5mYa5FYTdT9DQ1ZZuc3zOd5s3PZQqfWNJLABTK4pKAYcY/mEfnkSZn7Mv0jO +dPq5cpVBWycurkvsAe2B0kSUTVIsxsYDOttEW2xYdMI/sS2iu4dkQygYDuvXycFZAHWPc 6wQhXU9PCyExjaf5HyKGtEJL7PNnL4RuwJRbofmNrAulwWq1WFRHmQv0aupHUQ== 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 4VWBdx5CrGznk0; Fri, 3 May 2024 13:36:05 +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 443Da5AC032862; Fri, 3 May 2024 13:36:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 443Da5vG032859; Fri, 3 May 2024 13:36:05 GMT (envelope-from git) Date: Fri, 3 May 2024 13:36:05 GMT Message-Id: <202405031336.443Da5vG032859@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tijl Coosemans Subject: git: 7206f7c61991 - main - linuxkpi: Fix set_memory_* 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: tijl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7206f7c619912bdd4d54dd539824733eae50c3a9 Auto-Submitted: auto-generated The branch main has been updated by tijl: URL: https://cgit.FreeBSD.org/src/commit/?id=7206f7c619912bdd4d54dd539824733eae50c3a9 commit 7206f7c619912bdd4d54dd539824733eae50c3a9 Author: Tijl Coosemans AuthorDate: 2024-05-03 13:27:29 +0000 Commit: Tijl Coosemans CommitDate: 2024-05-03 13:27:29 +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 --- 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