From nobody Sat Mar 30 20:54: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 4V6Tzt2ldYz5G0RB; Sat, 30 Mar 2024 20:54: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 4V6Tzt2D3Fz4pJ0; Sat, 30 Mar 2024 20:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711832090; 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=4lG9lUxFOLhiXhdvz9ftZuEnmdtOHsPB8dtW8NglEWE=; b=BOC1ONOjeDGV4gas/4LpPjKuN1vlhA1AjoU9wACV9xOeObumqIzRO4QpuvTs6pX3mUXjn0 RMNNkQkNriw3Bz9rezpxvz8gh2v4chRReW2UnsRf7vdygq7EqZRnPD1NFA/6+bCIWLL7xR nwAtE59yb3nsn/0KaRYXrrsbDMzDZtVrMmRo3ZuY8So1FjbRO/qiz8U+gZgPOi4TXJ4BaQ 17W8g+FLzCctgboAsMm0P+LFPRhcUwXTLntOhsZNDW5TkR2uSQjdDi/OFRUphhSihlmdY8 0P1Zbe9F9dyVZLEW3XO0dOWgspVlKEIzVbQddyYSxyiuC6o/Pfn+tlCHh5zEzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711832090; a=rsa-sha256; cv=none; b=PQzIE/m411md5xDYmTG67hizYWQ60qk0Y9hPAq/Xvbko5sYp0pY0+/Q/4dGAtaz/lHU43l tpfbzxZOgHgSUAfB1MW72MXPV6xPHG/KB0hrLrdJvIlUMPd9aV8DB9Sy5v25tickmk7SLj /RU1XMXqCqv6K9CQ2oIR3s+cNZoqSdm5lHNl+lV/IFtqlGHB1hbAebenhqW7LZqqcgNhvs ecBlKwWjaMEAqsz35JjGd1mUMXnPRcfH1ekDqNDO3EIOnKzx1aKtFLUFQRfwgbChz1Yzfc ruhCSqvx1yObneFEiGorK0E8rjXyb36iPURCYxi5TEoj9PAcTPnZfiqa8THdDQ== 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=1711832090; 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=4lG9lUxFOLhiXhdvz9ftZuEnmdtOHsPB8dtW8NglEWE=; b=ZxhkrU0jGfv0FeM4aC14cJMwGnGjQxpqoVOPhr3NleJNAfkQbLj1R5xHcZSG4XRhe5MuJa WqQFtbvF3dHqCNW52oeK8s2La6t1DoBOZZLmDt1RKAV8tAAgHARcvsPT8mq4aadXNG3mrw R54EvQPWWsqOJIdECQkdtGu/woPBUD0f03TkwW7C+tKvbkVHlTQ1/rWssVHkjxEWAAi1sn fCt2f1Uv/Dbwl4wtms6fkDYu8ATqaac9smHGtXytfV/zJ4uvalude5eURpzzso+45cmGyO xN49zP5iMglM4JZshd/RSZvk7j+SxKUjsMX5gclyYuhwVu8cEkkxyEcTB0+7/g== 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 4V6Tzt1rC3z18lQ; Sat, 30 Mar 2024 20:54: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 42UKsocA093095; Sat, 30 Mar 2024 20:54:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42UKso8X093092; Sat, 30 Mar 2024 20:54:50 GMT (envelope-from git) Date: Sat, 30 Mar 2024 20:54:50 GMT Message-Id: <202403302054.42UKso8X093092@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: e0388a906ca7 - main - arm64: enable superpage mappings by pmap_mapdev{,_attr}() 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: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0388a906ca77d07c99e8762d47dccaaaefd8bab Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=e0388a906ca77d07c99e8762d47dccaaaefd8bab commit e0388a906ca77d07c99e8762d47dccaaaefd8bab Author: Alan Cox AuthorDate: 2024-03-30 20:35:32 +0000 Commit: Alan Cox CommitDate: 2024-03-30 20:41:30 +0000 arm64: enable superpage mappings by pmap_mapdev{,_attr}() In order for pmap_kenter{,_device}() to create superpage mappings, either 64 KB or 2 MB, pmap_mapdev{,_attr}() must request appropriately aligned virtual addresses. Reviewed by: markj Tested by: gallatin Differential Revision: https://reviews.freebsd.org/D42737 --- sys/kern/subr_devmap.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c index 5976f16c7577..441ffeb1270a 100644 --- a/sys/kern/subr_devmap.c +++ b/sys/kern/subr_devmap.c @@ -273,6 +273,13 @@ pmap_mapdev(vm_paddr_t pa, vm_size_t size) KASSERT(va >= VM_MAX_KERNEL_ADDRESS - PMAP_MAPDEV_EARLY_SIZE, ("Too many early devmap mappings")); } else +#endif +#ifdef __aarch64__ + if (size >= L2_SIZE && (pa & L2_OFFSET) == 0) + va = kva_alloc_aligned(size, L2_SIZE); + else if (size >= L3C_SIZE && (pa & L3C_OFFSET) == 0) + va = kva_alloc_aligned(size, L3C_SIZE); + else #endif va = kva_alloc(size); if (!va) @@ -304,6 +311,13 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma) KASSERT(va >= (VM_MAX_KERNEL_ADDRESS - (PMAP_MAPDEV_EARLY_SIZE)), ("Too many early devmap mappings 2")); } else +#ifdef __aarch64__ + if (size >= L2_SIZE && (pa & L2_OFFSET) == 0) + va = kva_alloc_aligned(size, L2_SIZE); + else if (size >= L3C_SIZE && (pa & L3C_OFFSET) == 0) + va = kva_alloc_aligned(size, L3C_SIZE); + else +#endif va = kva_alloc(size); if (!va) panic("pmap_mapdev: Couldn't alloc kernel virtual memory");