From nobody Fri Sep 11 13:01:53 2026 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 4hhF7535jHz6sKc6 for ; Fri, 11 Sep 2026 13:01: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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hhF752Scqz3LPY for ; Fri, 11 Sep 2026 13:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789131713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FdhHpdAGaeRnDAZoOb/M02Hi0q3CljmKk2stVX07yPI=; b=kWeKXTFpAT2I/0nHGkyQSsWYcr0l97b9iE4KFHMXOXp4QMt/3raKq1jqxiKzzW2dh5vFsF HcA6NOw8IA0dAgnlzaIiHO3mxEnB92d5u7HDk8f4HzbXtfrriXLVshXmqJrQueUFSykCe6 qptG0tI0og1XrsHSz7g8JAQT3y7dAm7WQz7AartKYNQunGvtna3O/5ghwskDWRndAQJeR+ dcn1B+1tmQEIDym2buwbAiu/rbZ8rhQpfRi7y41hawEuHO4J3QuNkcJBBgqTC3d4MNOie1 vLHKxWYEpdPKPpU4HaBL45Rc9k2NZvCfVpd4ZzrwpTdCuZEEqQW76TrLMPD4FQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789131713; b=B08y2LvFHlkuZHp3PxL31l3tiJyrQ6QdLPuIDEDikNkXviVGmEuGG/odfGk1Wivj02skRW ce4vrzUqSICcQmve7MxIqJwamk1fSeXcKwYhIhDfRzN6WDILKC/D9m/y+Y5S01/Isc1Arz 75R1VxEprWPDkBKBojkvvguFaVrSpH9AcZxLEpIuqip1W2er03qer3tZSPNGw5QxRnDzuv mnv+GvGQQLHm6H+YBKdpKBfcShu3Zjjpsv/YLUC3Inl+CXjnmrZ3grKGcRTo4IkctLNWeR iF9VnsEXW8yCzMpbJdzWM1PCnWMxQTtqlup21uywHZPw0VW5A6qFE1GFfSEbeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789131713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FdhHpdAGaeRnDAZoOb/M02Hi0q3CljmKk2stVX07yPI=; b=JpCc3KH/hKH1sJuQVlxeunIDsz9DNFCLcaJo4RP9NZ49vLI+j6acdLQ3bcsUm9cuu0CqZP va1BEgfqHF5XjsfhqSqQdsYIcXmxHG/VSy29oekVDRrUD+dsuuNpsmwoNJ78MvQ+ruwmz3 /Hk3ItFiIjivtZ6BZSTXbZ3Hc/cFNKGcDgRSMvoWS0ngX2xAnugo0Wx68P7ihHiIpvnD+4 IFk9DsVAuIMqL1TTFaq/iOMMZxf/Ruz5QrtbW4vQvDVxOHr7SvHsoSXllmpju7Z31XkXVb r3VQDWnqciCDfuqn3hzv/euYzF9B7Z0RTm8bEyP4FFsNIboM4bOO7GcgZDZqog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hhF751WY7zDpN for ; Fri, 11 Sep 2026 13:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1ca63 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 11 Sep 2026 13:01:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: ShengYi Hung From: Mark Johnston Subject: git: ef26f64c1122 - main - amd64/pmap: Return la57 in amd nested page 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/main X-Git-Reftype: branch X-Git-Commit: ef26f64c11220ea303de16d088c585f9d2908b0f Auto-Submitted: auto-generated Date: Fri, 11 Sep 2026 13:01:53 +0000 Message-Id: <6aa3fbc1.1ca63.254eb655@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ef26f64c11220ea303de16d088c585f9d2908b0f commit ef26f64c11220ea303de16d088c585f9d2908b0f Author: ShengYi Hung AuthorDate: 2026-09-11 08:22:39 +0000 Commit: Mark Johnston CommitDate: 2026-09-11 13:01:44 +0000 amd64/pmap: Return la57 in amd nested page AMD doesn't encode page depth in eptp. As a result, the page level is decided by the host la57 value. Without this, it uses 4 level page and therefore cause machine enable la57 have garbage page translation. PR: 291768 Reviewed by: kib Tested by: Antranig Vartanian MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D57978 --- sys/amd64/amd64/pmap.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index eee310cc44b8..8f8d91c768b7 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -443,7 +443,19 @@ pmap_is_la57(pmap_t pmap) { if (pmap->pm_type == PT_X86) return (la57); - return (false); /* XXXKIB handle EPT */ + if (pmap->pm_type == PT_RVI) { + /* + * AMD nested paging has no field to specify the nested + * page table walk length; the hardware derives it from + * the host CR4.LA57 setting (see svm.c, where nCR3 is + * loaded directly from pm_pmltop with no level encoding). + * The NPT must therefore have the same number of levels + * as the host page tables, otherwise guest-physical + * translations are walked at the wrong depth. + */ + return (la57); + } + return (false); /* Intel EPT encodes its own walk length. */ } #define PAT_INDEX_SIZE 8