From nobody Sun Mar 12 15:52:01 2023 X-Original-To: dev-commits-src-main@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 4PZPRk3Jfmz3y2RB; Sun, 12 Mar 2023 15:52:02 +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 4PZPRk2pLRz3nSx; Sun, 12 Mar 2023 15:52:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678636322; 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=h6N0/bUFJGs1ekZD8ULFhLi9t5vwnw0NBh8hFcNNsOQ=; b=g2Abaz/xkbREK22qmCtstOSIi+PEfianaikN/r27yhIv4DNWuRJI7r/Mf+PMt1RswJ2IMs NKHjoeF2AqxIj5tHb4ib1wCCDdVZYSdtW9HKoLdMIYkVgiHk3hJNIlCFQgjnbTMi1UmqZC 3Zv8/GlS3lZwHbNWtTIox5fKqOlaxhWXvtORk2MAVVyux/4fr4f2FiGQHrpECsrHBf+Boq FzJwEcwsqqLC3yyeNcBouADESi2QNVsTCoVQXApEPyWwcD72pEOJpN5fw/yRr4xY3ZKvtY JDWp93xkLkBx/488cDle8Pr53q8mShjpyKDkC85VC21425zwlUyOpR5MM4hlCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678636322; 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=h6N0/bUFJGs1ekZD8ULFhLi9t5vwnw0NBh8hFcNNsOQ=; b=jO72oJJvCjct3BB61jC+CZWUEZFjdurnagB41bJfJfO0gQ1OPpTBcxn+nDOR71zoNtI53a 3bdaOgMh3oBx8GdaX8mRy7JTxRjkaPZAz2Lz6O9e2SU8tn5uiphkcWAprQsIAthZw5rcoQ TDROsPz9AiBGLq5UywjvuLVbFE2d9/T/PqxL2HmE3R3l+EX+6NVH/WiKeNsIitQ1gj2kb7 1V7/pSojlzN1kyTd7K0jz7CBjKLRUws0bFmnWpOkpYgRlKdhRqfTGQNSl03OC9tb15gxIS oY3dAtegArzRAkgSLxtIdBVkvDkVAShFh1f5FTOXSGTWazLr68MmFVjzjykuaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678636322; a=rsa-sha256; cv=none; b=OfGSls4DSmxE32gBBU0J9eblfUiJ67aDqdRXoy754+yzZ2O/T5yt/n+ZfEku8Nc2uE5lZy pgiLKzNO5vUPASVz5/DU3CEDgqvw5F3h7TmFCayIZw/GodwJe3xI7CMbk+g7EqryDvBlVD ImCfnsuHrkECyWn02xdP/WZ36u7vBpRUbEV1851DIXqGDk+6xHlHdGMH4WCWwbnsI+Jr1E zkMe0UlKYc9zy5XcW7a6OZgsyNm17Ec2y6ht3QAvuYtnaC0MMUfFHpXtoGNdP6XzuzwJVG FUV9TR3uZZQxJt9lSjGmCkffghSk7ivgN6MLIoeXqg5z88S4vVm6C+VvABu3FA== 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 4PZPRk1YJPzHfC; Sun, 12 Mar 2023 15:52:02 +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 32CFq1N0071828; Sun, 12 Mar 2023 15:52:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32CFq1X5071827; Sun, 12 Mar 2023 15:52:01 GMT (envelope-from git) Date: Sun, 12 Mar 2023 15:52:01 GMT Message-Id: <202303121552.32CFq1X5071827@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 6f0b2a235a13 - main - powerpc/pmap: Add pmap_sync_icache() for radix pmap List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 6f0b2a235a133a381634ba9a7f5f477c64db9873 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=6f0b2a235a133a381634ba9a7f5f477c64db9873 commit 6f0b2a235a133a381634ba9a7f5f477c64db9873 Author: Justin Hibbits AuthorDate: 2023-03-12 15:46:57 +0000 Commit: Justin Hibbits CommitDate: 2023-03-12 15:51:42 +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. --- 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 6e2203ccca45..1e7661ba8068 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); @@ -542,6 +543,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, @@ -5921,6 +5923,25 @@ mmu_radix_unmapdev(void *p, 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) {