From nobody Mon Nov 25 17:39:47 2024 Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4C74212192 for ; Fri, 25 Oct 2024 18:24:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729880666; cv=none; b=hO3l43OzMpUMavXQXpGqY2qwRhhXCrVyUd/jpaA33VOHRpwWljaRS3MKqjI12nsGNuzOi/XR41F627E+OGrb3ht0eJXQ0ayI8meosACRUmrOY/8vTZjE522aHmW1/K0srXKJFQz9F3ipKDEWOOJbqwLxVRFndTz1nUtr9O6Eqso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729880666; c=relaxed/simple; bh=3EsE2vEicI2ETRqCYydgDpIAjz4gjCDUHguJ3uyP0r4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZFKMRKWvkpQ3T8cTuNDKY44w52WuoWMafep9bWB4JdtKragS7tn2ujSt0YKr0WDPf6qaeNvNpoIEux4rOW/RmY9fpucNm6/AtGAz+MG/DTjxQ+dGvaga16tsij3xRcnPbHqKIQVRVJBuoIitDWxtL4pjdKmNkGW4SMND2LOAlxo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=D1ftKHiL; arc=none smtp.client-ip=95.215.58.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="D1ftKHiL" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1729880662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n/vLH7IaL0kII0g5Ri1DQb8sfURLSg7RQrQ+zZ1bWxc=; b=D1ftKHiLBpxZpeDW3gJBo1dAzJERsV8gyxofBmZSunivwtLQlRAhy7K2YacZwCqOBZrGm7 XQOAkbDvOaaz9sEOBFnw9/dDMWqSxLBdVTKjRWA0w0k4e5YKosTP1IlAJv4YY/E9Z9DpnB Uqx7iHkDcrI8GLQhVJgDE0M39PUFC8Q= From: Oliver Upton To: kvmarm@lists.linux.dev Cc: Marc Zyngier , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Anshuman Khandual , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Oliver Upton Subject: [PATCH v4 07/18] KVM: arm64: nv: Rename BEHAVE_FORWARD_ANY Date: Fri, 25 Oct 2024 18:23:42 +0000 Message-ID: <20241025182354.3364124-8-oliver.upton@linux.dev> In-Reply-To: <20241025182354.3364124-1-oliver.upton@linux.dev> References: <20241025182354.3364124-1-oliver.upton@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" BEHAVE_FORWARD_ANY is slightly ambiguous, especially since we're about to cram some more information into the enum. Rephrase it. Signed-off-by: Oliver Upton --- arch/arm64/kvm/emulate-nested.c | 93 +++++++++++++++++---------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-neste= d.c index da7ab14e036d..e1a30d1bcd06 100644 --- a/arch/arm64/kvm/emulate-nested.c +++ b/arch/arm64/kvm/emulate-nested.c @@ -16,9 +16,10 @@ =20 enum trap_behaviour { BEHAVE_HANDLE_LOCALLY =3D 0, + BEHAVE_FORWARD_READ =3D BIT(0), BEHAVE_FORWARD_WRITE =3D BIT(1), - BEHAVE_FORWARD_ANY =3D BEHAVE_FORWARD_READ | BEHAVE_FORWARD_WRITE, + BEHAVE_FORWARD_RW =3D BEHAVE_FORWARD_READ | BEHAVE_FORWARD_WRITE, }; =20 struct trap_bits { @@ -138,7 +139,7 @@ static const struct trap_bits coarse_trap_bits[] =3D { .index =3D HCR_EL2, .value =3D HCR_TID2, .mask =3D HCR_TID2, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TID3] =3D { .index =3D HCR_EL2, @@ -162,37 +163,37 @@ static const struct trap_bits coarse_trap_bits[] =3D { .index =3D HCR_EL2, .value =3D HCR_TIDCP, .mask =3D HCR_TIDCP, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TACR] =3D { .index =3D HCR_EL2, .value =3D HCR_TACR, .mask =3D HCR_TACR, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TSW] =3D { .index =3D HCR_EL2, .value =3D HCR_TSW, .mask =3D HCR_TSW, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TPC] =3D { /* Also called TCPC when FEAT_DPB is implemented */ .index =3D HCR_EL2, .value =3D HCR_TPC, .mask =3D HCR_TPC, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TPU] =3D { .index =3D HCR_EL2, .value =3D HCR_TPU, .mask =3D HCR_TPU, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TTLB] =3D { .index =3D HCR_EL2, .value =3D HCR_TTLB, .mask =3D HCR_TTLB, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TVM] =3D { .index =3D HCR_EL2, @@ -204,7 +205,7 @@ static const struct trap_bits coarse_trap_bits[] =3D { .index =3D HCR_EL2, .value =3D HCR_TDZ, .mask =3D HCR_TDZ, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TRVM] =3D { .index =3D HCR_EL2, @@ -216,205 +217,205 @@ static const struct trap_bits coarse_trap_bits[] = =3D { .index =3D HCR_EL2, .value =3D HCR_TLOR, .mask =3D HCR_TLOR, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TERR] =3D { .index =3D HCR_EL2, .value =3D HCR_TERR, .mask =3D HCR_TERR, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_APK] =3D { .index =3D HCR_EL2, .value =3D 0, .mask =3D HCR_APK, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_NV] =3D { .index =3D HCR_EL2, .value =3D HCR_NV, .mask =3D HCR_NV, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_NV_nNV2] =3D { .index =3D HCR_EL2, .value =3D HCR_NV, .mask =3D HCR_NV | HCR_NV2, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_NV1_nNV2] =3D { .index =3D HCR_EL2, .value =3D HCR_NV | HCR_NV1, .mask =3D HCR_NV | HCR_NV1 | HCR_NV2, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_AT] =3D { .index =3D HCR_EL2, .value =3D HCR_AT, .mask =3D HCR_AT, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_nFIEN] =3D { .index =3D HCR_EL2, .value =3D 0, .mask =3D HCR_FIEN, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TID4] =3D { .index =3D HCR_EL2, .value =3D HCR_TID4, .mask =3D HCR_TID4, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TICAB] =3D { .index =3D HCR_EL2, .value =3D HCR_TICAB, .mask =3D HCR_TICAB, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TOCU] =3D { .index =3D HCR_EL2, .value =3D HCR_TOCU, .mask =3D HCR_TOCU, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_ENSCXT] =3D { .index =3D HCR_EL2, .value =3D 0, .mask =3D HCR_ENSCXT, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TTLBIS] =3D { .index =3D HCR_EL2, .value =3D HCR_TTLBIS, .mask =3D HCR_TTLBIS, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCR_TTLBOS] =3D { .index =3D HCR_EL2, .value =3D HCR_TTLBOS, .mask =3D HCR_TTLBOS, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TPMCR] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TPMCR, .mask =3D MDCR_EL2_TPMCR, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TPM] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TPM, .mask =3D MDCR_EL2_TPM, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TDE] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TDE, .mask =3D MDCR_EL2_TDE, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TDA] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TDA, .mask =3D MDCR_EL2_TDA, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TDOSA] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TDOSA, .mask =3D MDCR_EL2_TDOSA, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TDRA] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TDRA, .mask =3D MDCR_EL2_TDRA, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_E2PB] =3D { .index =3D MDCR_EL2, .value =3D 0, .mask =3D BIT(MDCR_EL2_E2PB_SHIFT), - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TPMS] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TPMS, .mask =3D MDCR_EL2_TPMS, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TTRF] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TTRF, .mask =3D MDCR_EL2_TTRF, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_E2TB] =3D { .index =3D MDCR_EL2, .value =3D 0, .mask =3D BIT(MDCR_EL2_E2TB_SHIFT), - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_MDCR_TDCC] =3D { .index =3D MDCR_EL2, .value =3D MDCR_EL2_TDCC, .mask =3D MDCR_EL2_TDCC, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_CPACR_E0POE] =3D { .index =3D CPTR_EL2, .value =3D CPACR_ELx_E0POE, .mask =3D CPACR_ELx_E0POE, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_CPTR_TAM] =3D { .index =3D CPTR_EL2, .value =3D CPTR_EL2_TAM, .mask =3D CPTR_EL2_TAM, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_CPTR_TCPAC] =3D { .index =3D CPTR_EL2, .value =3D CPTR_EL2_TCPAC, .mask =3D CPTR_EL2_TCPAC, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCRX_EnFPM] =3D { .index =3D HCRX_EL2, .value =3D 0, .mask =3D HCRX_EL2_EnFPM, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_HCRX_TCR2En] =3D { .index =3D HCRX_EL2, .value =3D 0, .mask =3D HCRX_EL2_TCR2En, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_ICH_HCR_TC] =3D { .index =3D ICH_HCR_EL2, .value =3D ICH_HCR_TC, .mask =3D ICH_HCR_TC, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_ICH_HCR_TALL0] =3D { .index =3D ICH_HCR_EL2, .value =3D ICH_HCR_TALL0, .mask =3D ICH_HCR_TALL0, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_ICH_HCR_TALL1] =3D { .index =3D ICH_HCR_EL2, .value =3D ICH_HCR_TALL1, .mask =3D ICH_HCR_TALL1, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, [CGT_ICH_HCR_TDIR] =3D { .index =3D ICH_HCR_EL2, .value =3D ICH_HCR_TDIR, .mask =3D ICH_HCR_TDIR, - .behaviour =3D BEHAVE_FORWARD_ANY, + .behaviour =3D BEHAVE_FORWARD_RW, }, }; =20 @@ -474,7 +475,7 @@ static enum trap_behaviour check_cnthctl_el1pcten(struc= t kvm_vcpu *vcpu) if (get_sanitized_cnthctl(vcpu) & (CNTHCTL_EL1PCTEN << 10)) return BEHAVE_HANDLE_LOCALLY; =20 - return BEHAVE_FORWARD_ANY; + return BEHAVE_FORWARD_RW; } =20 static enum trap_behaviour check_cnthctl_el1pten(struct kvm_vcpu *vcpu) @@ -482,7 +483,7 @@ static enum trap_behaviour check_cnthctl_el1pten(struct= kvm_vcpu *vcpu) if (get_sanitized_cnthctl(vcpu) & (CNTHCTL_EL1PCEN << 10)) return BEHAVE_HANDLE_LOCALLY; =20 - return BEHAVE_FORWARD_ANY; + return BEHAVE_FORWARD_RW; } =20 static enum trap_behaviour check_cptr_tta(struct kvm_vcpu *vcpu) @@ -493,7 +494,7 @@ static enum trap_behaviour check_cptr_tta(struct kvm_vc= pu *vcpu) val =3D translate_cptr_el2_to_cpacr_el1(val); =20 if (val & CPACR_ELx_TTA) - return BEHAVE_FORWARD_ANY; + return BEHAVE_FORWARD_RW; =20 return BEHAVE_HANDLE_LOCALLY; } --=20 2.47.0.163.g1226f6d8fa-goog