From nobody Wed Mar 15 20:07:28 2023 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 4PcLz46SF8z3xjjt; Wed, 15 Mar 2023 20:07:28 +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 4PcLz44fwnz3rGy; Wed, 15 Mar 2023 20:07:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678910848; 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=cZrZQl06gIzGIChBqvLcdwDffI1RbNUdW1y9Z+n0YRM=; b=qTzpEq7k+6+Bs33L/gMzlBQunw9CIUQ7ZAujmKT+0iebBD4tw5QVSBLqZBFH1l+8dL+qZ6 HT080XRt6qn3NELzzjfRG9xmfV9eAUH3BHVtSrmTooBrodo0xi1grQ2DYVdcGYlj79ie6E hWnOWH7oN6c/Pv5J6Wvww3ukcgO2iqlwQm1tETslhFKpbylcnDUJ7i57xUGeCJXHzJwnT6 RJ6AYo90oa9adYQS0DTdLf7degW566i/FdGCfl9MURhklerbFHz00idP8EToU0mLbMZbT7 TNKHMy/IF2PLsTYPQLHieUA++jw6wt1/kFWAmUlIU8KDm8IjJyqL8wun+BA6Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678910848; 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=cZrZQl06gIzGIChBqvLcdwDffI1RbNUdW1y9Z+n0YRM=; b=aCHK+uSyhVfoBidPIqLbxH0Pb7dwL+aovqWwFnQnATiQuXbGHQG+9LWfs7EK50mlbddsqY Y4gwfhUER0+yXTt4E2L7wMCVn0gCjGx9/AoD8QfoRyrSYZ/ufcD1vicUSLl+oQfFMdHQrI +CnFBUg2cLl3DqmnSiGsOF/yTZqJS4ePZHlBKNqEROHIA/m8gBTsZD+3LKWcHCl2O1zBkw yPHFF1RbPXB0lJIh+5QJiK2niSynGYcvirF3hfbKx6GnmBTsbzHK8C5ECmaooEF156Bxj9 kQwtDpoSI7oo+k6yho/iedC9UqCrvzeinhfzmnVFm5MNG5Kx4xteG5kFakRjyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678910848; a=rsa-sha256; cv=none; b=Yoo8HgtdVYqUFWvupJxcz0meDzTA7Ys54INgUY28RtvG3Qt9MPhF24ZNN/ko1rr7o9jlhL LZlnwnuELJXKhEYqv376ixrDvjYmnC5+H5HAvBoTok8uTQdr3PTNsL0htFxw09aIbVnJ4A IxRgC5OOLcJINR+nFzIv4g56+hUFrNek/nIPpT+q+6HKoF/A6d5boX1KtH/COoV247iwGe KF/cnqZ8T/dbr1D7UB2Q8NUvih0RPL67x722LpFbLq7Hg9x9GReCggFhPR5EZxOnabR2L3 /gNUCQblVyEorp8AKlE9fHAAXHhAEXY5B68q+a2syPuFgOHjmPL/cArxR35X/Q== 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 4PcLz43lFMzFZ5; Wed, 15 Mar 2023 20:07:28 +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 32FK7SMr086427; Wed, 15 Mar 2023 20:07:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32FK7Ssu086426; Wed, 15 Mar 2023 20:07:28 GMT (envelope-from git) Date: Wed, 15 Mar 2023 20:07:28 GMT Message-Id: <202303152007.32FK7Ssu086426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Justin Hibbits Subject: git: ed2c3bda43fb - stable/13 - powerpc/pmap: Add pmap_sync_icache() for radix pmap 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ed2c3bda43fbd0bfad9e45c78a59fff8a62422da Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=ed2c3bda43fbd0bfad9e45c78a59fff8a62422da commit ed2c3bda43fbd0bfad9e45c78a59fff8a62422da Author: Justin Hibbits AuthorDate: 2023-03-12 15:46:57 +0000 Commit: Justin Hibbits CommitDate: 2023-03-15 20:06:29 +0000 powerpc/pmap: Add pmap_sync_icache() for radix pmap DTrace pid provider writes to user space to set breakpoints. Failing to sync the icache can lead to SIGTRAP. Radix pmap is the only one missing a pmap_sync_icache() method, so the pid provider would only potentially crash a process on a POWER9 or later system. (cherry picked from commit 6f0b2a235a133a381634ba9a7f5f477c64db9873) --- sys/powerpc/aim/mmu_radix.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 34736d5031bd..9f59d524196f 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -464,6 +464,7 @@ void mmu_radix_remove(pmap_t, vm_offset_t, vm_offset_t); void mmu_radix_remove_all(vm_page_t); void mmu_radix_remove_pages(pmap_t); void mmu_radix_remove_write(vm_page_t); +void mmu_radix_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz); void mmu_radix_unwire(pmap_t, vm_offset_t, vm_offset_t); void mmu_radix_zero_page(vm_page_t); void mmu_radix_zero_page_area(vm_page_t, int, int); @@ -541,6 +542,7 @@ static struct pmap_funcs mmu_radix_methods = { .remove = mmu_radix_remove, .remove_all = mmu_radix_remove_all, .remove_write = mmu_radix_remove_write, + .sync_icache = mmu_radix_sync_icache, .unwire = mmu_radix_unwire, .zero_page = mmu_radix_zero_page, .zero_page_area = mmu_radix_zero_page_area, @@ -5912,6 +5914,25 @@ mmu_radix_unmapdev(vm_offset_t va, vm_size_t size) } } +void +mmu_radix_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) +{ + vm_paddr_t pa = 0; + int sync_sz; + + while (sz > 0) { + pa = pmap_extract(pm, va); + sync_sz = PAGE_SIZE - (va & PAGE_MASK); + sync_sz = min(sync_sz, sz); + if (pa != 0) { + pa += (va & PAGE_MASK); + __syncicache((void *)PHYS_TO_DMAP(pa), sync_sz); + } + va += sync_sz; + sz -= sync_sz; + } +} + static __inline void pmap_pte_attr(pt_entry_t *pte, uint64_t cache_bits, uint64_t mask) {