From nobody Wed Sep 11 10:42:06 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 4X3cZk6Gvcz5WNDp; Wed, 11 Sep 2024 10:42:06 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X3cZk5HQfz4Qj0; Wed, 11 Sep 2024 10:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726051326; 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=9i2W+CmXYOpxGekl61DPZn8JrPY+eb4wVTYx+iOcnGo=; b=C+2Oqh0pxIST8W7OkKI2t0+X+wffyfp3SZdwkf/ME/z3Qu53qGseWKKiNAcrYvrKQVhq7e l9kpVm/SA1gSlNYixfbl7n3rl12vEzfDxzdVLL+YVCHc8f0PL11p38s217MBHI43kE74dm IWhGgjmEbOzDLvc9UgmQ5+SUhfkMC1NFPN+Bv5TlZQDJk647/0KHy9EOmWftWeIBN5oMp0 LOgmLQfPxGEkBbZu9Vu+xqC6bXH+pICZfT1V0Xit2sC1YgxW1iuv/om186j4wPSrQ9XGqN VWViMkVmMRKGvh5GmOmW36BAy5iv0nilpqbqfY6taXru+fgrsLl+XEw6/X39tA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726051326; a=rsa-sha256; cv=none; b=HJTO50JmtlifFp2f3w2jDuY/YUvPLmL1cXuikZR+Z5atQ8UenbPD5YZHrSIu9v83a9vXpM nGRdEaclBYr8gha6awaOK5VqWH8VWAwiMjI9KsSFZId+U8ld8GSz92yqa5uVkZU7SHja4p FviZMLa9bzT8ZDdfBpFDGtm0fgN2qWyWPqZKiLaPyfKeYqWQxGsMZm1fvYKBmhEC3a0ixC JVucxVY5IV/bz5x3exJQXXWtAskjxwFWQyePz9VHPqmJ6FB+ZiSQuKvyBurwsve0eiXb/5 KlJOzq2jrOl5mlr5GsqCsvYdCGzqJStMnKbfKkXo6TmWxzVzUgzu/Xn1bMFwQw== 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=1726051326; 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=9i2W+CmXYOpxGekl61DPZn8JrPY+eb4wVTYx+iOcnGo=; b=uLi/LehN9/wzw6L/9gKeyGGfJEgK8xlaGAra7FmOMMttM4UN1YwS/KD0LGRiiKz/Qhp7Pn pG+RfdSTvWkrrSYyTqWbmzzqGfcPwjQ/+qSmI7LSzFFASFJek/YC6Kkb4tBVhn48NzwbiH m+8QV/YoNt1QZMI93Z8cXRZzXzJDeImhR6NP07YCFKE6HJBYlYd50I8XSvDpD+S81O2abY 1qkN5F2Rk+owa500W2wsw2fUs4B6U/Qk5f4sg1mhZMvyRx7lZdTAuHo83vk/5MeoTbmCmM zx7RJ8YSyfQ/SXLkDwAQ29MBf0/ER11zRvW3K9j0kjF5WvIGJkPZBjrSM1eZ4A== 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 4X3cZk4vtyzS7b; Wed, 11 Sep 2024 10:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48BAg6Dt007767; Wed, 11 Sep 2024 10:42:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48BAg6db007764; Wed, 11 Sep 2024 10:42:06 GMT (envelope-from git) Date: Wed, 11 Sep 2024 10:42:06 GMT Message-Id: <202409111042.48BAg6db007764@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: d54631360276 - main - arm64: Add CPTR_TRAP_ALL and use it in vmm 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d54631360276d3fdbaa9a7872f8af82f1f4287da Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d54631360276d3fdbaa9a7872f8af82f1f4287da commit d54631360276d3fdbaa9a7872f8af82f1f4287da Author: Andrew Turner AuthorDate: 2024-09-11 09:38:27 +0000 Commit: Andrew Turner CommitDate: 2024-09-11 10:25:09 +0000 arm64: Add CPTR_TRAP_ALL and use it in vmm Add a new macro that enables all CPTR_EL2 traps. This helps ensure we trap all extensions we don't support. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46516 --- sys/arm64/include/hypervisor.h | 2 ++ sys/arm64/vmm/vmm_reset.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index 738eeca66ffe..0a138006b108 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -53,11 +53,13 @@ /* CPTR_EL2 - Architecture feature trap register */ /* Valid if HCR_EL2.E2H == 0 */ +#define CPTR_TRAP_ALL 0xc01037ff /* Enable all traps */ #define CPTR_RES0 0x7fefc800 #define CPTR_RES1 0x000033ff #define CPTR_TFP 0x00000400 #define CPTR_TTA 0x00100000 /* Valid if HCR_EL2.E2H == 1 */ +#define CPTR_E2H_TRAP_ALL 0xd0000000 #define CPTR_E2H_FPEN 0x00300000 #define CPTR_E2H_TTA 0x10000000 /* Unconditionally valid */ diff --git a/sys/arm64/vmm/vmm_reset.c b/sys/arm64/vmm/vmm_reset.c index 3195bc10dedd..8ccb83e7a0ea 100644 --- a/sys/arm64/vmm/vmm_reset.c +++ b/sys/arm64/vmm/vmm_reset.c @@ -170,9 +170,10 @@ reset_vm_el2_regs(void *vcpu) * and floating point functionality to EL2. */ if (in_vhe()) - el2ctx->cptr_el2 = CPACR_FPEN_TRAP_NONE; + el2ctx->cptr_el2 = CPTR_E2H_TRAP_ALL | CPTR_E2H_FPEN; else - el2ctx->cptr_el2 = CPTR_RES1; + el2ctx->cptr_el2 = CPTR_TRAP_ALL & ~CPTR_TFP; + el2ctx->cptr_el2 &= ~CPTR_TCPAC; /* * Disable interrupts in the guest. The guest OS will re-enable * them.