* [PATCH v1 0/2] KVM: fix issues with Permission Indirection Extension
@ 2023-10-12 12:34 Joey Gouly
2023-10-12 12:34 ` [PATCH v1 1/2] KVM: arm64: add nPIR{E0}_EL1 to HFG traps Joey Gouly
2023-10-12 12:34 ` [PATCH v1 2/2] KVM: arm64: POR{E0}_EL1 do not need trap handlers Joey Gouly
0 siblings, 2 replies; 4+ messages in thread
From: Joey Gouly @ 2023-10-12 12:34 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: joey.gouly, maz, oliver.upton, kvmarm
Hi all,
This is a fix (and a cleanup) to KVM when using PIE.
The handling around HFG registers was changed and that missed off adding the
PIE traps to the HFG*_nMASK values.
Thanks,
Joey
Joey Gouly (2):
KVM: arm64: add nPIR{E0}_EL1 to HFG traps
KVM: arm64: POR{E0}_EL1 do not need trap handlers
arch/arm64/include/asm/kvm_arm.h | 4 ++--
arch/arm64/kvm/sys_regs.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 1/2] KVM: arm64: add nPIR{E0}_EL1 to HFG traps
2023-10-12 12:34 [PATCH v1 0/2] KVM: fix issues with Permission Indirection Extension Joey Gouly
@ 2023-10-12 12:34 ` Joey Gouly
2023-10-12 15:33 ` Marc Zyngier
2023-10-12 12:34 ` [PATCH v1 2/2] KVM: arm64: POR{E0}_EL1 do not need trap handlers Joey Gouly
1 sibling, 1 reply; 4+ messages in thread
From: Joey Gouly @ 2023-10-12 12:34 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: joey.gouly, maz, oliver.upton, kvmarm
nPIR_EL1 and nPIREO_EL1 are part of the 'reverse polarity' set of bits, set
them so that we disable the traps for a guest.
Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Fixes: e930694e6145 ("KVM: arm64: Restructure FGT register switching")
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
---
arch/arm64/include/asm/kvm_arm.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index 5882b2415596..1095c6647e96 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -344,14 +344,14 @@
*/
#define __HFGRTR_EL2_RES0 (GENMASK(63, 56) | GENMASK(53, 51))
#define __HFGRTR_EL2_MASK GENMASK(49, 0)
-#define __HFGRTR_EL2_nMASK (GENMASK(55, 54) | BIT(50))
+#define __HFGRTR_EL2_nMASK (GENMASK(58, 57) | GENMASK(55, 54) | BIT(50))
#define __HFGWTR_EL2_RES0 (GENMASK(63, 56) | GENMASK(53, 51) | \
BIT(46) | BIT(42) | BIT(40) | BIT(28) | \
GENMASK(26, 25) | BIT(21) | BIT(18) | \
GENMASK(15, 14) | GENMASK(10, 9) | BIT(2))
#define __HFGWTR_EL2_MASK GENMASK(49, 0)
-#define __HFGWTR_EL2_nMASK (GENMASK(55, 54) | BIT(50))
+#define __HFGWTR_EL2_nMASK (GENMASK(58, 57) | GENMASK(55, 54) | BIT(50))
#define __HFGITR_EL2_RES0 GENMASK(63, 57)
#define __HFGITR_EL2_MASK GENMASK(54, 0)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] KVM: arm64: POR{E0}_EL1 do not need trap handlers
2023-10-12 12:34 [PATCH v1 0/2] KVM: fix issues with Permission Indirection Extension Joey Gouly
2023-10-12 12:34 ` [PATCH v1 1/2] KVM: arm64: add nPIR{E0}_EL1 to HFG traps Joey Gouly
@ 2023-10-12 12:34 ` Joey Gouly
1 sibling, 0 replies; 4+ messages in thread
From: Joey Gouly @ 2023-10-12 12:34 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: joey.gouly, maz, oliver.upton, kvmarm
These will not be trapped by KVM, so don't need a handler.
Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
---
arch/arm64/kvm/sys_regs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index e92ec810d449..0afd6136e275 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -2122,8 +2122,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
{ SYS_DESC(SYS_PMMIR_EL1), trap_raz_wi },
{ SYS_DESC(SYS_MAIR_EL1), access_vm_reg, reset_unknown, MAIR_EL1 },
- { SYS_DESC(SYS_PIRE0_EL1), access_vm_reg, reset_unknown, PIRE0_EL1 },
- { SYS_DESC(SYS_PIR_EL1), access_vm_reg, reset_unknown, PIR_EL1 },
+ { SYS_DESC(SYS_PIRE0_EL1), NULL, reset_unknown, PIRE0_EL1 },
+ { SYS_DESC(SYS_PIR_EL1), NULL, reset_unknown, PIR_EL1 },
{ SYS_DESC(SYS_AMAIR_EL1), access_vm_reg, reset_amair_el1, AMAIR_EL1 },
{ SYS_DESC(SYS_LORSA_EL1), trap_loregion },
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/2] KVM: arm64: add nPIR{E0}_EL1 to HFG traps
2023-10-12 12:34 ` [PATCH v1 1/2] KVM: arm64: add nPIR{E0}_EL1 to HFG traps Joey Gouly
@ 2023-10-12 15:33 ` Marc Zyngier
0 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2023-10-12 15:33 UTC (permalink / raw)
To: Joey Gouly
Cc: linux-arm-kernel, oliver.upton, kvmarm, Suzuki K Poulose,
James Morse, Zenghui Yu
Hi Joey,
Please Cc all the reviewers, not only Oliver and me.
On Thu, 12 Oct 2023 13:34:58 +0100,
Joey Gouly <joey.gouly@arm.com> wrote:
>
> nPIR_EL1 and nPIREO_EL1 are part of the 'reverse polarity' set of bits, set
> them so that we disable the traps for a guest.
It would have been helpful to indicate where these bits were defined,
as they are not published in the ARM ARM. For the record, they live in
the XML files available at [1]. If we're adding these, we also need to
add the FGT emulation for nested, which doesn't describe these bits:
diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
index 34075185af8e..f564e9b075d5 100644
--- a/arch/arm64/kvm/emulate-nested.c
+++ b/arch/arm64/kvm/emulate-nested.c
@@ -977,6 +977,8 @@ enum fg_filter_id {
static const struct encoding_to_trap_config encoding_to_fgt[] __initconst = {
/* HFGRTR_EL2, HFGWTR_EL2 */
+ SR_FGT(SYS_PIR_EL1, HFGxTR, nPIR_EL1, 0),
+ SR_FGT(SYS_PIRE0_EL1, HFGxTR, nPIRE0_EL1, 0),
SR_FGT(SYS_TPIDR2_EL0, HFGxTR, nTPIDR2_EL0, 0),
SR_FGT(SYS_SMPRI_EL1, HFGxTR, nSMPRI_EL1, 0),
SR_FGT(SYS_ACCDATA_EL1, HFGxTR, nACCDATA_EL1, 0),
I'll amend the commit message locally and fold this in.
M.
[1] https://developer.arm.com/downloads/-/exploration-tools
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-12 15:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12 12:34 [PATCH v1 0/2] KVM: fix issues with Permission Indirection Extension Joey Gouly
2023-10-12 12:34 ` [PATCH v1 1/2] KVM: arm64: add nPIR{E0}_EL1 to HFG traps Joey Gouly
2023-10-12 15:33 ` Marc Zyngier
2023-10-12 12:34 ` [PATCH v1 2/2] KVM: arm64: POR{E0}_EL1 do not need trap handlers Joey Gouly
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).