From nobody Sun May 12 23:48:50 2024 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 4Vczpp4yGSz5Jl0t; Sun, 12 May 2024 23:48:50 +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 4Vczpp443nz58jD; Sun, 12 May 2024 23:48:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715557730; 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=XbuKBydj1/XZ5KI3B6h6D2tQggpzCC5xJn2sOEEI3/Q=; b=f2fwamKhkft+y4e0UHzyzFYTT4LnW4HyYWlZ6qDKrgar2XDhBGJOYXwywY8LPawGWZNkNr px3pbk+Fr/5WK4Z/gjurcX2C9XukO6rXryoxYu0ayY/si0OQ4RI5Plx4AQ5DeBAOicg86b FQbWeOEVgr6GZUBTnCeUCMLv6BR51aeOzrcnYLdisWF9/ytljqYJZ2BC9yGcwpr4lFMkbc nPlCtaNV0BZ7xBJ/S3/Zi/ANw3hrfnERaNBnkTwBGQN7Rm3N6shQK3w/OWUINgPaUNJGhi atfuyy9VC1xDNoG9BA8DvHr1bv9Rn9lZ2E0Gkz+78PM6mrQAMy0oOVwsLExIJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715557730; a=rsa-sha256; cv=none; b=YFHk4/5mKtqXxVsk5wizXBzUiMRbeA8KkkThnNu2XnMt8bkxFJUuFbh1CrrZmZbWD9tivY 2wfhp0rwiuGcEaE7tTIcC2xtZrc1MaSj7KLWIP+zeAJUJ9BrP3T2WKfQrIFm+kY5de+9/N nC0heT6R1VT8Ya/RF1kV4LP1JFh9nnpGvL5KRf3Hl+xW7TLWoRzJsSLgNLqsOuOobmQ98J 3W9nV0IgKy+cun6Bx9o9R9nMvSFucJQSlNuHJlXBzmi8j493u9FZxhUQDLQKedecQI3F/z vbXtfDi7TLDVgSunk57EcYe5hLT3kx7wjpg/2EvfBp30KQnqy34sRc5Gwv2Wzw== 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=1715557730; 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=XbuKBydj1/XZ5KI3B6h6D2tQggpzCC5xJn2sOEEI3/Q=; b=bVlvpkOc9xtdjizdgUCOPKs7yVwVIwwfcSS+3g1I+Rdf3iZtGP1nR49c5MwjyrRK69Xeiw jw1mmAHu9kxZz07WDXC4f3iQt3kBsSEorQKEpRuxUFlsIB03rRWtdFzSAqnxx4kd6syp2h QlbTPHFViEYHqSkFosZEirG1YUGNPgUMnPE/eafThrhLeBcZqUfykUREsifb4Dz3prNIIt JBzdB46iiuCqS0hpF/XPxCXVUlys+bcNlNb57xRFQy7R0G18cBcZEIpYxZEfrnP6vt4AQ7 QO4rHgbjcZhp8CUSqYDi9HBFTAWu3DePNH6cxmC8IeuOHrSwQ597L8RFdDCN/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 4Vczpp39tXzQ2N; Sun, 12 May 2024 23:48:50 +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 44CNmovZ005796; Sun, 12 May 2024 23:48:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44CNmo48005793; Sun, 12 May 2024 23:48:50 GMT (envelope-from git) Date: Sun, 12 May 2024 23:48:50 GMT Message-Id: <202405122348.44CNmo48005793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 94b09d388b81 - main - arm64: map kernel using large pages when page size is 16K 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94b09d388b81eb724769e506cdf0f51bba9b73fb Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=94b09d388b81eb724769e506cdf0f51bba9b73fb commit 94b09d388b81eb724769e506cdf0f51bba9b73fb Author: Alan Cox AuthorDate: 2024-05-11 06:09:39 +0000 Commit: Alan Cox CommitDate: 2024-05-12 23:22:38 +0000 arm64: map kernel using large pages when page size is 16K When the page size is 16K, use ATTR_CONTIGUOUS to map the kernel code and data sections using 2M pages. Previously, they were mapped using 16K pages. Reviewed by: markj Tested by: markj Differential Revision: https://reviews.freebsd.org/D45162 --- sys/arm64/arm64/locore.S | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index f53cd365de55..fffebe8f2b02 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -516,11 +516,10 @@ booti_no_fdt: common: #if PAGE_SIZE != PAGE_SIZE_4K /* - * Create L3 pages. The kernel will be loaded at a 2M aligned - * address, however L2 blocks are too large when the page size is - * not 4k to map the kernel with such an aligned address. However, - * when the page size is larger than 4k, L2 blocks are too large to - * map the kernel with such an alignment. + * Create L3 and L3C pages. The kernel will be loaded at a 2M aligned + * address, enabling the creation of L3C pages. However, when the page + * size is larger than 4k, L2 blocks are too large to map the kernel + * with 2M alignment. */ #define PTE_SHIFT L3_SHIFT #define BUILD_PTE_FUNC build_l3_page_pagetable @@ -784,13 +783,17 @@ LENTRY(link_l2_pagetable) LEND(link_l2_pagetable) /* - * Builds count level 3 page table entries + * Builds count level 3 page table entries. Uses ATTR_CONTIGUOUS to create + * large page (L3C) mappings when the current VA and remaining count allow + * it. * x6 = L3 table * x7 = Block attributes * x8 = VA start * x9 = PA start (trashed) * x10 = Entry count (trashed) * x11, x12 and x13 are trashed + * + * VA start (x8) modulo L3C_SIZE must equal PA start (x9) modulo L3C_SIZE. */ LENTRY(build_l3_page_pagetable) /* @@ -811,8 +814,17 @@ LENTRY(build_l3_page_pagetable) /* Only use the output address bits */ lsr x9, x9, #L3_SHIFT + /* Check if an ATTR_CONTIGUOUS mapping is possible */ +1: tst x11, #(L3C_ENTRIES - 1) + b.ne 2f + cmp x10, #L3C_ENTRIES + b.lo 3f + orr x12, x12, #(ATTR_CONTIGUOUS) + b 2f +3: and x12, x12, #(~ATTR_CONTIGUOUS) + /* Set the physical address for this virtual address */ -1: orr x13, x12, x9, lsl #L3_SHIFT +2: orr x13, x12, x9, lsl #L3_SHIFT /* Store the entry */ str x13, [x6, x11, lsl #3]