From nobody Tue Sep 27 12:56:14 2022 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 4McKPX1TM8z4cw9b; Tue, 27 Sep 2022 12:56:16 +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 4McKPW16KHz3P3P; Tue, 27 Sep 2022 12:56:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664283375; 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=HnOtdhIpb7KZvfzyJ0VPh+OEo3pjQ/eiYvc9Ky6BUmE=; b=Ieb7qL2Dvxj1onCclozmb1G5APp/IbvUhgD/aoxRUT9Oc1Eg1pMB9daRBauippPkHSLLVO aHF1bLhenInyHA1Krvckh9rQVh5q6Dag7KWO9qQDyPwWzm5ryvloJHBO6vNotenbmQhPWg czQZI0MOzNbIT1OMAhm0dm80AeiYkLXjrUfZ1fsEeOwq4GbJ3gqDz3HOHbVvzmHC/VIrcr LwKqQozJLIhXZxnhWDNXE2dM5YX6uanSeZK3VyZAf86N6tzg06AITo50sU4TH/bloFQpLz lPSPskBwypVNKORmGS+aIHk+zdC7tWfuLY174v97c+i867bUcgoC+n6xNAQlyw== 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 4McKPW0Cw6z17C2; Tue, 27 Sep 2022 12:56:15 +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 28RCuElX041425; Tue, 27 Sep 2022 12:56:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28RCuEfm041424; Tue, 27 Sep 2022 12:56:14 GMT (envelope-from git) Date: Tue, 27 Sep 2022 12:56:14 GMT Message-Id: <202209271256.28RCuEfm041424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: dc39b2dc64d2 - main - Allow changing arm64 table attributes when bootstrapping 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc39b2dc64d2396083c916b1f688cbd22548f991 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664283375; 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=HnOtdhIpb7KZvfzyJ0VPh+OEo3pjQ/eiYvc9Ky6BUmE=; b=lOUKodc0vOMt/erFyZLj4J7Ju+qH+vhBMrshzWUqkt3SYK6youUPw8fmtOUjACtUWg7nCm 08S35QBuUS8PlF4dcSikBpaMrHRCo6UoIIRac8S7Ey58F4jZadHyMg2+LrLF8vQGgcy4rc 1Vz92lBeuvbLtHxhiSOizhVeuUvi1l1Me2W0wKaroddKxPMg7jdhSUwHbmI+5RJ18hYE5K Tpgqg8sJMtAuUX26VS80nc34p4qcmHMCuuz8AfnVJgdNueoVzRoqvXib9DI9llnf7g4bC9 xiggq8xNRYlxA5SqXMBBk1gK91NxZvtf7JxAtrVqvJp0iyY6NMVlSxRVX83a9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664283375; a=rsa-sha256; cv=none; b=EL0e36pnIFu9atWGJP3JhYgyGpo2ocNOO6JAhTpqPeORmfXbDZk/YUIiBhpskfpGPyEEzn 8soNU/gwBBOC4IvizwA/TSivo02VvAsEpJ4fq9qY0i+/Vm12Q9SLXln3T7owhcPidjLnEB LFKLSc3uAlQ83B+ClUQgsPoTEjT18rf859zadTwQTqKyF/v3kYvqScAmP8f9HtHvqkWTD5 HFR9ftA8GNrQlf5Z6w9sy862VwJili3Iw5GDXuJdBTg5/BEpmH57la4aUuMo1Gpmg20yZm crkn4049TgNgTSmlsnUEbgj03f/qlFQWOcOfDdBc/yyK2iqM8SEW74gwsnN+Cw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dc39b2dc64d2396083c916b1f688cbd22548f991 commit dc39b2dc64d2396083c916b1f688cbd22548f991 Author: Andrew Turner AuthorDate: 2022-09-26 14:16:32 +0000 Commit: Andrew Turner CommitDate: 2022-09-27 12:26:29 +0000 Allow changing arm64 table attributes when bootstrapping pmap Only the DMAP region can be mapped with PXN. Allow the table attributes to be changed for other mappings. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/pmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 66046779802d..a31e95ba6f32 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -823,6 +823,7 @@ struct pmap_bootstrap_state { pt_entry_t *l1; pt_entry_t *l2; pt_entry_t *l3; + pt_entry_t table_attrs; u_int l0_slot; u_int l1_slot; u_int l2_slot; @@ -936,7 +937,7 @@ pmap_bootstrap_l1_table(struct pmap_bootstrap_state *state) l2_pa = pmap_early_vtophys((vm_offset_t)state->l2); MPASS((l2_pa & Ln_TABLE_MASK) == 0); MPASS(state->l1[l1_slot] == 0); - pmap_store(&state->l1[l1_slot], l2_pa | TATTR_PXN_TABLE | + pmap_store(&state->l1[l1_slot], l2_pa | state->table_attrs | L1_TABLE); } KASSERT(state->l2 != NULL, ("%s: NULL l2", __func__)); @@ -980,7 +981,7 @@ pmap_bootstrap_l2_table(struct pmap_bootstrap_state *state) l3_pa = pmap_early_vtophys((vm_offset_t)state->l3); MPASS((l3_pa & Ln_TABLE_MASK) == 0); MPASS(state->l2[l2_slot] == 0); - pmap_store(&state->l2[l2_slot], l3_pa | TATTR_PXN_TABLE | + pmap_store(&state->l2[l2_slot], l3_pa | state->table_attrs | L2_TABLE); } KASSERT(state->l3 != NULL, ("%s: NULL l3", __func__)); @@ -1238,6 +1239,11 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, /* Create a direct map region early so we can use it for pa -> va */ freemempos = pmap_bootstrap_dmap(l1pt, min_pa, freemempos); bs_state.dmap_valid = true; + /* + * We only use PXN when we know nothing will be executed from it, e.g. + * the DMAP region. + */ + bs_state.table_attrs &= ~TATTR_PXN_TABLE; start_pa = pa = KERNBASE - kern_delta;