From owner-dev-commits-src-branches@freebsd.org Tue Aug 31 19:09:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4584667356E; Tue, 31 Aug 2021 19:09:53 +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 4GzcFY16y8z4sjV; Tue, 31 Aug 2021 19:09:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A8520173EE; Tue, 31 Aug 2021 19:09:52 +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 17VJ9qfO074350; Tue, 31 Aug 2021 19:09:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17VJ9qIp074349; Tue, 31 Aug 2021 19:09:52 GMT (envelope-from git) Date: Tue, 31 Aug 2021 19:09:52 GMT Message-Id: <202108311909.17VJ9qIp074349@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a5dd155bfb2d - stable/13 - arm64: Sync icache when creating executable superpage mappings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a5dd155bfb2d7bd8ee03b596abf11f8af47d73ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2021 19:09:53 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a5dd155bfb2d7bd8ee03b596abf11f8af47d73ca commit a5dd155bfb2d7bd8ee03b596abf11f8af47d73ca Author: Alan Cox AuthorDate: 2021-07-14 17:59:49 +0000 Commit: Mark Johnston CommitDate: 2021-08-31 19:09:24 +0000 arm64: Sync icache when creating executable superpage mappings Reviewed by: andrew, kib, markj (cherry picked from commit 7fb152d22935e014afcad4ddc0b3a7e3c2795762) --- sys/arm64/arm64/pmap.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index fe26f1fea1c3..a8216c6b4d7b 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4239,7 +4239,7 @@ pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, if (pmap != kernel_pmap) new_l2 |= ATTR_S1_nG; return (pmap_enter_l2(pmap, va, new_l2, PMAP_ENTER_NOSLEEP | - PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL, lockp) == + PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, m, lockp) == KERN_SUCCESS); } @@ -4269,8 +4269,6 @@ pmap_every_pte_zero(vm_paddr_t pa) * KERN_RESOURCE_SHORTAGE if PMAP_ENTER_NOSLEEP was specified and a page table * page allocation failed. Returns KERN_RESOURCE_SHORTAGE if * PMAP_ENTER_NORECLAIM was specified and a PV entry allocation failed. - * - * The parameter "m" is only used when creating a managed, writeable mapping. */ static int pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, @@ -4360,6 +4358,16 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, pmap->pm_stats.wired_count += L2_SIZE / PAGE_SIZE; pmap->pm_stats.resident_count += L2_SIZE / PAGE_SIZE; + /* + * Conditionally sync the icache. See pmap_enter() for details. + */ + if ((new_l2 & ATTR_S1_XN) == 0 && ((new_l2 & ~ATTR_MASK) != + (old_l2 & ~ATTR_MASK) || (old_l2 & ATTR_S1_XN) != 0) && + pmap != kernel_pmap && m->md.pv_memattr == VM_MEMATTR_WRITE_BACK) { + cpu_icache_sync_range(PHYS_TO_DMAP(new_l2 & ~ATTR_MASK), + L2_SIZE); + } + /* * Map the superpage. */