* RE: [PATCH v2 06/11] KVM: arm64: hide MOPS from guests [not found] ` <20230509142235.3284028-7-kristina.martsenko@arm.com> @ 2023-05-25 19:26 ` Colton Lewis 2023-05-30 16:34 ` Kristina Martsenko 2023-06-03 8:42 ` Marc Zyngier 1 sibling, 1 reply; 15+ messages in thread From: Colton Lewis @ 2023-05-25 19:26 UTC (permalink / raw) To: Kristina Martsenko Cc: linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel > As FEAT_MOPS is not supported in guests yet, hide it from the ID > registers for guests. > The MOPS instructions are UNDEFINED in guests as HCRX_EL2.MSCEn is not > set in HCRX_GUEST_FLAGS, and will take an exception to EL1 if executed. For my benefit, could you please explain why no support for guests yet? Why not set HCRX_EL2.MSCEn in this series? _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 06/11] KVM: arm64: hide MOPS from guests 2023-05-25 19:26 ` [PATCH v2 06/11] KVM: arm64: hide MOPS from guests Colton Lewis @ 2023-05-30 16:34 ` Kristina Martsenko 0 siblings, 0 replies; 15+ messages in thread From: Kristina Martsenko @ 2023-05-30 16:34 UTC (permalink / raw) To: Colton Lewis Cc: linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On 25/05/2023 20:26, Colton Lewis wrote: >> As FEAT_MOPS is not supported in guests yet, hide it from the ID >> registers for guests. > >> The MOPS instructions are UNDEFINED in guests as HCRX_EL2.MSCEn is not >> set in HCRX_GUEST_FLAGS, and will take an exception to EL1 if executed. > > For my benefit, could you please explain why no support for guests yet? > Why not set HCRX_EL2.MSCEn in this series? There's probably a few more things that need doing for guest support, such as setting the HCRX_EL2.MCE2 bit and handling the mops exception in KVM. I'm currently having a look at guest support. Thanks, Kristina _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 06/11] KVM: arm64: hide MOPS from guests [not found] ` <20230509142235.3284028-7-kristina.martsenko@arm.com> 2023-05-25 19:26 ` [PATCH v2 06/11] KVM: arm64: hide MOPS from guests Colton Lewis @ 2023-06-03 8:42 ` Marc Zyngier 2023-06-05 15:45 ` Oliver Upton 1 sibling, 1 reply; 15+ messages in thread From: Marc Zyngier @ 2023-06-03 8:42 UTC (permalink / raw) To: Kristina Martsenko Cc: linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Tue, 09 May 2023 15:22:30 +0100, Kristina Martsenko <kristina.martsenko@arm.com> wrote: > > As FEAT_MOPS is not supported in guests yet, hide it from the ID > registers for guests. > > The MOPS instructions are UNDEFINED in guests as HCRX_EL2.MSCEn is not > set in HCRX_GUEST_FLAGS, and will take an exception to EL1 if executed. > > Acked-by: Catalin Marinas <catalin.marinas@arm.com> > Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> This is very likely to clash with Jing's series that completely reworks the whole idreg series, but as long as this is on its own branch, we can deal with that. Acked-by: Marc Zyngier <maz@kernel.org> M. -- 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 [flat|nested] 15+ messages in thread
* Re: [PATCH v2 06/11] KVM: arm64: hide MOPS from guests 2023-06-03 8:42 ` Marc Zyngier @ 2023-06-05 15:45 ` Oliver Upton 0 siblings, 0 replies; 15+ messages in thread From: Oliver Upton @ 2023-06-05 15:45 UTC (permalink / raw) To: Marc Zyngier Cc: Kristina Martsenko, linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Sat, Jun 03, 2023 at 09:42:18AM +0100, Marc Zyngier wrote: > On Tue, 09 May 2023 15:22:30 +0100, > Kristina Martsenko <kristina.martsenko@arm.com> wrote: > > > > As FEAT_MOPS is not supported in guests yet, hide it from the ID > > registers for guests. > > > > The MOPS instructions are UNDEFINED in guests as HCRX_EL2.MSCEn is not > > set in HCRX_GUEST_FLAGS, and will take an exception to EL1 if executed. > > > > Acked-by: Catalin Marinas <catalin.marinas@arm.com> > > Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> > > This is very likely to clash with Jing's series that completely > reworks the whole idreg series, but as long as this is on its own > branch, we can deal with that. Yup, we will definitely want to get that ironed out. I'll pull Catalin's branch when this all gets queued up. Acked-by: Oliver Upton <oliver.upton@linux.dev> -- Thanks, Oliver _______________________________________________ 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] 15+ messages in thread
[parent not found: <20230509142235.3284028-8-kristina.martsenko@arm.com>]
* RE: [PATCH v2 07/11] arm64: mops: handle MOPS exceptions [not found] ` <20230509142235.3284028-8-kristina.martsenko@arm.com> @ 2023-05-25 19:50 ` Colton Lewis 2023-05-30 16:36 ` Kristina Martsenko 2023-06-05 11:43 ` Shaoqin Huang 1 sibling, 1 reply; 15+ messages in thread From: Colton Lewis @ 2023-05-25 19:50 UTC (permalink / raw) To: Kristina Martsenko Cc: linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel > + if (esr & ESR_ELx_MOPS_ISS_MEM_INST) { > + /* SET* instruction */ > + if (option_a ^ wrong_option) { > + /* Format is from Option A; forward set */ > + pt_regs_write_reg(regs, dstreg, dst + size); > + pt_regs_write_reg(regs, sizereg, -size); > + } > + } else { > + /* CPY* instruction */ > + if (!(option_a ^ wrong_option)) { > + /* Format is from Option B */ > + if (regs->pstate & PSR_N_BIT) { > + /* Backward copy */ > + pt_regs_write_reg(regs, dstreg, dst - size); > + pt_regs_write_reg(regs, srcreg, src - size); > + } > + } else { > + /* Format is from Option A */ > + if (size & BIT(63)) { > + /* Forward copy */ > + pt_regs_write_reg(regs, dstreg, dst + size); > + pt_regs_write_reg(regs, srcreg, src + size); > + pt_regs_write_reg(regs, sizereg, -size); > + } > + } > + } I can see an argument for styling things closely to the ARM manual as you have done here, but Linux style recommends against deep nesting. In this case it is unneeded. I believe this can be written as a single if-else chain and that makes it easier to distinguish the three options. if ((esr & ESR_ELx_MOPS_ISS_MEM_INST) && (option_a ^ wrong_option)) { /* Format is from Option A; forward set */ pt_regs_write_reg(regs, dstreg, dst + size); pt_regs_write_reg(regs, sizereg, -size); } else if ((option_a ^ wrong_option) && (size & BIT(63)) { /* Forward copy */ pt_regs_write_reg(regs, dstreg, dst + size); pt_regs_write_reg(regs, srcreg, src + size); pt_regs_write_reg(regs, sizereg, -size); } else if (regs-pstate & PSR_N_BIT) { /* Backward copy */ pt_regs_write_reg(regs, dstreg, dst - size); pt_regs_write_reg(regs, srcreg, src - size); } _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 07/11] arm64: mops: handle MOPS exceptions 2023-05-25 19:50 ` [PATCH v2 07/11] arm64: mops: handle MOPS exceptions Colton Lewis @ 2023-05-30 16:36 ` Kristina Martsenko 0 siblings, 0 replies; 15+ messages in thread From: Kristina Martsenko @ 2023-05-30 16:36 UTC (permalink / raw) To: Colton Lewis Cc: linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On 25/05/2023 20:50, Colton Lewis wrote: >> + if (esr & ESR_ELx_MOPS_ISS_MEM_INST) { >> + /* SET* instruction */ >> + if (option_a ^ wrong_option) { >> + /* Format is from Option A; forward set */ >> + pt_regs_write_reg(regs, dstreg, dst + size); >> + pt_regs_write_reg(regs, sizereg, -size); >> + } >> + } else { >> + /* CPY* instruction */ >> + if (!(option_a ^ wrong_option)) { >> + /* Format is from Option B */ >> + if (regs->pstate & PSR_N_BIT) { >> + /* Backward copy */ >> + pt_regs_write_reg(regs, dstreg, dst - size); >> + pt_regs_write_reg(regs, srcreg, src - size); >> + } >> + } else { >> + /* Format is from Option A */ >> + if (size & BIT(63)) { >> + /* Forward copy */ >> + pt_regs_write_reg(regs, dstreg, dst + size); >> + pt_regs_write_reg(regs, srcreg, src + size); >> + pt_regs_write_reg(regs, sizereg, -size); >> + } >> + } >> + } > > I can see an argument for styling things closely to the ARM manual as > you have done here, but Linux style recommends against deep nesting. In > this case it is unneeded. I believe this can be written as a single > if-else chain and that makes it easier to distinguish the three options. > > if ((esr & ESR_ELx_MOPS_ISS_MEM_INST) && (option_a ^ wrong_option)) { > /* Format is from Option A; forward set */ > pt_regs_write_reg(regs, dstreg, dst + size); > pt_regs_write_reg(regs, sizereg, -size); > } else if ((option_a ^ wrong_option) && (size & BIT(63)) { > /* Forward copy */ > pt_regs_write_reg(regs, dstreg, dst + size); > pt_regs_write_reg(regs, srcreg, src + size); > pt_regs_write_reg(regs, sizereg, -size); > } else if (regs-pstate & PSR_N_BIT) { > /* Backward copy */ > pt_regs_write_reg(regs, dstreg, dst - size); > pt_regs_write_reg(regs, srcreg, src - size); > } Yeah, the nesting gets a bit deep here, but there are 6 cases in total, ie 6 ways the hardware can set up the registers and pstate (in 3 of them the kernel doesn't need to modify the registers), and I think the current structure makes it clearer what the 6 are, so I'd prefer to keep it as it is for now. Thanks, Kristina _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 07/11] arm64: mops: handle MOPS exceptions [not found] ` <20230509142235.3284028-8-kristina.martsenko@arm.com> 2023-05-25 19:50 ` [PATCH v2 07/11] arm64: mops: handle MOPS exceptions Colton Lewis @ 2023-06-05 11:43 ` Shaoqin Huang 2023-06-05 12:04 ` Catalin Marinas 1 sibling, 1 reply; 15+ messages in thread From: Shaoqin Huang @ 2023-06-05 11:43 UTC (permalink / raw) To: Kristina Martsenko, linux-arm-kernel, kvmarm Cc: Catalin Marinas, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel Hi Kristina, On 5/9/23 22:22, Kristina Martsenko wrote: > The memory copy/set instructions added as part of FEAT_MOPS can take an > exception (e.g. page fault) part-way through their execution and resume > execution afterwards. > > If however the task is re-scheduled and execution resumes on a different > CPU, then the CPU may take a new type of exception to indicate this. > This is because the architecture allows two options (Option A and Option > B) to implement the instructions and a heterogeneous system can have > different implementations between CPUs. > > In this case the OS has to reset the registers and restart execution > from the prologue instruction. The algorithm for doing this is provided > as part of the Arm ARM. What is the Arm ARM? I'm not quite understand it. > > Add an exception handler for the new exception and wire it up for > userspace tasks. > > Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> > Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> > --- > arch/arm64/include/asm/esr.h | 11 ++++++- > arch/arm64/include/asm/exception.h | 1 + > arch/arm64/kernel/entry-common.c | 11 +++++++ > arch/arm64/kernel/traps.c | 52 ++++++++++++++++++++++++++++++ > 4 files changed, 74 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h > index 8487aec9b658..ca954f566861 100644 > --- a/arch/arm64/include/asm/esr.h > +++ b/arch/arm64/include/asm/esr.h > @@ -47,7 +47,7 @@ > #define ESR_ELx_EC_DABT_LOW (0x24) > #define ESR_ELx_EC_DABT_CUR (0x25) > #define ESR_ELx_EC_SP_ALIGN (0x26) > -/* Unallocated EC: 0x27 */ > +#define ESR_ELx_EC_MOPS (0x27) > #define ESR_ELx_EC_FP_EXC32 (0x28) > /* Unallocated EC: 0x29 - 0x2B */ > #define ESR_ELx_EC_FP_EXC64 (0x2C) > @@ -356,6 +356,15 @@ > #define ESR_ELx_SME_ISS_ZA_DISABLED 3 > #define ESR_ELx_SME_ISS_ZT_DISABLED 4 > > +/* ISS field definitions for MOPS exceptions */ > +#define ESR_ELx_MOPS_ISS_MEM_INST (UL(1) << 24) > +#define ESR_ELx_MOPS_ISS_FROM_EPILOGUE (UL(1) << 18) > +#define ESR_ELx_MOPS_ISS_WRONG_OPTION (UL(1) << 17) > +#define ESR_ELx_MOPS_ISS_OPTION_A (UL(1) << 16) > +#define ESR_ELx_MOPS_ISS_DESTREG(esr) (((esr) & (UL(0x1f) << 10)) >> 10) > +#define ESR_ELx_MOPS_ISS_SRCREG(esr) (((esr) & (UL(0x1f) << 5)) >> 5) > +#define ESR_ELx_MOPS_ISS_SIZEREG(esr) (((esr) & (UL(0x1f) << 0)) >> 0) > + > #ifndef __ASSEMBLY__ > #include <asm/types.h> > > diff --git a/arch/arm64/include/asm/exception.h b/arch/arm64/include/asm/exception.h > index e73af709cb7a..72e83af0135f 100644 > --- a/arch/arm64/include/asm/exception.h > +++ b/arch/arm64/include/asm/exception.h > @@ -77,6 +77,7 @@ void do_el0_svc(struct pt_regs *regs); > void do_el0_svc_compat(struct pt_regs *regs); > void do_el0_fpac(struct pt_regs *regs, unsigned long esr); > void do_el1_fpac(struct pt_regs *regs, unsigned long esr); > +void do_el0_mops(struct pt_regs *regs, unsigned long esr); > void do_serror(struct pt_regs *regs, unsigned long esr); > void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags); > > diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c > index 3af3c01c93a6..a8ec174e5b0e 100644 > --- a/arch/arm64/kernel/entry-common.c > +++ b/arch/arm64/kernel/entry-common.c > @@ -611,6 +611,14 @@ static void noinstr el0_bti(struct pt_regs *regs) > exit_to_user_mode(regs); > } > > +static void noinstr el0_mops(struct pt_regs *regs, unsigned long esr) > +{ > + enter_from_user_mode(regs); > + local_daif_restore(DAIF_PROCCTX); > + do_el0_mops(regs, esr); > + exit_to_user_mode(regs); > +} > + > static void noinstr el0_inv(struct pt_regs *regs, unsigned long esr) > { > enter_from_user_mode(regs); > @@ -688,6 +696,9 @@ asmlinkage void noinstr el0t_64_sync_handler(struct pt_regs *regs) > case ESR_ELx_EC_BTI: > el0_bti(regs); > break; > + case ESR_ELx_EC_MOPS: > + el0_mops(regs, esr); > + break; > case ESR_ELx_EC_BREAKPT_LOW: > case ESR_ELx_EC_SOFTSTP_LOW: > case ESR_ELx_EC_WATCHPT_LOW: > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > index 4bb1b8f47298..32dc692bffd3 100644 > --- a/arch/arm64/kernel/traps.c > +++ b/arch/arm64/kernel/traps.c > @@ -514,6 +514,57 @@ void do_el1_fpac(struct pt_regs *regs, unsigned long esr) > die("Oops - FPAC", regs, esr); > } > > +void do_el0_mops(struct pt_regs *regs, unsigned long esr) > +{ > + bool wrong_option = esr & ESR_ELx_MOPS_ISS_WRONG_OPTION; > + bool option_a = esr & ESR_ELx_MOPS_ISS_OPTION_A; > + int dstreg = ESR_ELx_MOPS_ISS_DESTREG(esr); > + int srcreg = ESR_ELx_MOPS_ISS_SRCREG(esr); > + int sizereg = ESR_ELx_MOPS_ISS_SIZEREG(esr); > + unsigned long dst, src, size; > + > + dst = pt_regs_read_reg(regs, dstreg); > + src = pt_regs_read_reg(regs, srcreg); > + size = pt_regs_read_reg(regs, sizereg); > + > + /* > + * Put the registers back in the original format suitable for a > + * prologue instruction, using the generic return routine from the > + * Arm ARM (DDI 0487I.a) rules CNTMJ and MWFQH. > + */ > + if (esr & ESR_ELx_MOPS_ISS_MEM_INST) { > + /* SET* instruction */ > + if (option_a ^ wrong_option) { > + /* Format is from Option A; forward set */ > + pt_regs_write_reg(regs, dstreg, dst + size); > + pt_regs_write_reg(regs, sizereg, -size); > + } > + } else { > + /* CPY* instruction */ > + if (!(option_a ^ wrong_option)) { > + /* Format is from Option B */ > + if (regs->pstate & PSR_N_BIT) { > + /* Backward copy */ > + pt_regs_write_reg(regs, dstreg, dst - size); > + pt_regs_write_reg(regs, srcreg, src - size); > + } > + } else { > + /* Format is from Option A */ > + if (size & BIT(63)) { > + /* Forward copy */ > + pt_regs_write_reg(regs, dstreg, dst + size); > + pt_regs_write_reg(regs, srcreg, src + size); > + pt_regs_write_reg(regs, sizereg, -size); > + } > + } > + } > + > + if (esr & ESR_ELx_MOPS_ISS_FROM_EPILOGUE) > + regs->pc -= 8; > + else > + regs->pc -= 4; > +} > + > #define __user_cache_maint(insn, address, res) \ > if (address >= TASK_SIZE_MAX) { \ > res = -EFAULT; \ > @@ -824,6 +875,7 @@ static const char *esr_class_str[] = { > [ESR_ELx_EC_DABT_LOW] = "DABT (lower EL)", > [ESR_ELx_EC_DABT_CUR] = "DABT (current EL)", > [ESR_ELx_EC_SP_ALIGN] = "SP Alignment", > + [ESR_ELx_EC_MOPS] = "MOPS", > [ESR_ELx_EC_FP_EXC32] = "FP (AArch32)", > [ESR_ELx_EC_FP_EXC64] = "FP (AArch64)", > [ESR_ELx_EC_SERROR] = "SError", -- Shaoqin _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 07/11] arm64: mops: handle MOPS exceptions 2023-06-05 11:43 ` Shaoqin Huang @ 2023-06-05 12:04 ` Catalin Marinas 0 siblings, 0 replies; 15+ messages in thread From: Catalin Marinas @ 2023-06-05 12:04 UTC (permalink / raw) To: Shaoqin Huang Cc: Kristina Martsenko, linux-arm-kernel, kvmarm, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Mon, Jun 05, 2023 at 07:43:27PM +0800, Shaoqin Huang wrote: > Hi Kristina, > > On 5/9/23 22:22, Kristina Martsenko wrote: > > The memory copy/set instructions added as part of FEAT_MOPS can take an > > exception (e.g. page fault) part-way through their execution and resume > > execution afterwards. > > > > If however the task is re-scheduled and execution resumes on a different > > CPU, then the CPU may take a new type of exception to indicate this. > > This is because the architecture allows two options (Option A and Option > > B) to implement the instructions and a heterogeneous system can have > > different implementations between CPUs. > > > > In this case the OS has to reset the registers and restart execution > > from the prologue instruction. The algorithm for doing this is provided > > as part of the Arm ARM. > > What is the Arm ARM? I'm not quite understand it. The Arm Architecture Reference Manual: https://developer.arm.com/documentation/ddi0487/latest (the acronym we pretty well known among the arm/arm64 developers) -- Catalin _______________________________________________ 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] 15+ messages in thread
[parent not found: <20230509142235.3284028-2-kristina.martsenko@arm.com>]
* Re: [PATCH v2 01/11] KVM: arm64: initialize HCRX_EL2 [not found] ` <20230509142235.3284028-2-kristina.martsenko@arm.com> @ 2023-06-02 13:49 ` Catalin Marinas 2023-06-05 15:41 ` Oliver Upton 2023-06-03 8:39 ` Marc Zyngier 1 sibling, 1 reply; 15+ messages in thread From: Catalin Marinas @ 2023-06-02 13:49 UTC (permalink / raw) To: Kristina Martsenko Cc: linux-arm-kernel, kvmarm, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Tue, May 09, 2023 at 03:22:25PM +0100, Kristina Martsenko wrote: > ARMv8.7/9.2 adds a new hypervisor configuration register HCRX_EL2. > Initialize the register to a safe value (all fields 0), to be robust > against firmware that has not initialized it. This is also needed to > ensure that the register is reinitialized after a kexec by a future > kernel. > > In addition, move SMPME setup over to the new flags, as it would > otherwise get overridden. It is safe to set the bit even if SME is not > (uniformly) supported, as it will write to a RES0 bit (having no > effect), and SME will be disabled by the cpufeature framework. > (Similar to how e.g. the API bit is handled in HCR_HOST_NVHE_FLAGS.) This looks fine to me but I may have lost track of the VHE/nVHE code initialisation paths. Marc/Oliver, are you ok with this patch (or this series in general)? I'd like to merge it through the arm64 tree. Thanks. -- Catalin _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 01/11] KVM: arm64: initialize HCRX_EL2 2023-06-02 13:49 ` [PATCH v2 01/11] KVM: arm64: initialize HCRX_EL2 Catalin Marinas @ 2023-06-05 15:41 ` Oliver Upton 0 siblings, 0 replies; 15+ messages in thread From: Oliver Upton @ 2023-06-05 15:41 UTC (permalink / raw) To: Catalin Marinas Cc: Kristina Martsenko, linux-arm-kernel, kvmarm, Will Deacon, Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Fri, Jun 02, 2023 at 02:49:50PM +0100, Catalin Marinas wrote: > On Tue, May 09, 2023 at 03:22:25PM +0100, Kristina Martsenko wrote: > > ARMv8.7/9.2 adds a new hypervisor configuration register HCRX_EL2. > > Initialize the register to a safe value (all fields 0), to be robust > > against firmware that has not initialized it. This is also needed to > > ensure that the register is reinitialized after a kexec by a future > > kernel. > > > > In addition, move SMPME setup over to the new flags, as it would > > otherwise get overridden. It is safe to set the bit even if SME is not > > (uniformly) supported, as it will write to a RES0 bit (having no > > effect), and SME will be disabled by the cpufeature framework. > > (Similar to how e.g. the API bit is handled in HCR_HOST_NVHE_FLAGS.) > > This looks fine to me but I may have lost track of the VHE/nVHE code > initialisation paths. > > Marc/Oliver, are you ok with this patch (or this series in general)? I'd > like to merge it through the arm64 tree. Acked-by: Oliver Upton <oliver.upton@linux.dev> -- Thanks, Oliver _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 01/11] KVM: arm64: initialize HCRX_EL2 [not found] ` <20230509142235.3284028-2-kristina.martsenko@arm.com> 2023-06-02 13:49 ` [PATCH v2 01/11] KVM: arm64: initialize HCRX_EL2 Catalin Marinas @ 2023-06-03 8:39 ` Marc Zyngier 1 sibling, 0 replies; 15+ messages in thread From: Marc Zyngier @ 2023-06-03 8:39 UTC (permalink / raw) To: Kristina Martsenko Cc: linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Tue, 09 May 2023 15:22:25 +0100, Kristina Martsenko <kristina.martsenko@arm.com> wrote: > > ARMv8.7/9.2 adds a new hypervisor configuration register HCRX_EL2. > Initialize the register to a safe value (all fields 0), to be robust > against firmware that has not initialized it. This is also needed to > ensure that the register is reinitialized after a kexec by a future > kernel. > > In addition, move SMPME setup over to the new flags, as it would > otherwise get overridden. It is safe to set the bit even if SME is not > (uniformly) supported, as it will write to a RES0 bit (having no > effect), and SME will be disabled by the cpufeature framework. > (Similar to how e.g. the API bit is handled in HCR_HOST_NVHE_FLAGS.) > > Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> Acked-by: Marc Zyngier <maz@kernel.org> M. -- 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 [flat|nested] 15+ messages in thread
[parent not found: <20230509142235.3284028-4-kristina.martsenko@arm.com>]
* Re: [PATCH v2 03/11] KVM: arm64: switch HCRX_EL2 between host and guest [not found] ` <20230509142235.3284028-4-kristina.martsenko@arm.com> @ 2023-06-02 13:51 ` Catalin Marinas 2023-06-05 15:41 ` Oliver Upton 2023-06-03 8:40 ` Marc Zyngier 1 sibling, 1 reply; 15+ messages in thread From: Catalin Marinas @ 2023-06-02 13:51 UTC (permalink / raw) To: Kristina Martsenko Cc: linux-arm-kernel, kvmarm, Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Tue, May 09, 2023 at 03:22:27PM +0100, Kristina Martsenko wrote: > Switch the HCRX_EL2 register between host and guest configurations, in > order to enable different features in the host and guest. > > Now that there are separate guest flags, we can also remove SMPME from > the host flags, as SMPME is used for virtualizing SME priorities and has > no use in the host. > > Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> Same here, it could be good to have Marc/Oliver look at this. -- Catalin _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 03/11] KVM: arm64: switch HCRX_EL2 between host and guest 2023-06-02 13:51 ` [PATCH v2 03/11] KVM: arm64: switch HCRX_EL2 between host and guest Catalin Marinas @ 2023-06-05 15:41 ` Oliver Upton 0 siblings, 0 replies; 15+ messages in thread From: Oliver Upton @ 2023-06-05 15:41 UTC (permalink / raw) To: Catalin Marinas Cc: Kristina Martsenko, linux-arm-kernel, kvmarm, Will Deacon, Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Fri, Jun 02, 2023 at 02:51:53PM +0100, Catalin Marinas wrote: > On Tue, May 09, 2023 at 03:22:27PM +0100, Kristina Martsenko wrote: > > Switch the HCRX_EL2 register between host and guest configurations, in > > order to enable different features in the host and guest. > > > > Now that there are separate guest flags, we can also remove SMPME from > > the host flags, as SMPME is used for virtualizing SME priorities and has > > no use in the host. > > > > Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> > > Same here, it could be good to have Marc/Oliver look at this. Acked-by: Oliver Upton <oliver.upton@linux.dev> -- Thanks, Oliver _______________________________________________ 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] 15+ messages in thread
* Re: [PATCH v2 03/11] KVM: arm64: switch HCRX_EL2 between host and guest [not found] ` <20230509142235.3284028-4-kristina.martsenko@arm.com> 2023-06-02 13:51 ` [PATCH v2 03/11] KVM: arm64: switch HCRX_EL2 between host and guest Catalin Marinas @ 2023-06-03 8:40 ` Marc Zyngier 1 sibling, 0 replies; 15+ messages in thread From: Marc Zyngier @ 2023-06-03 8:40 UTC (permalink / raw) To: Kristina Martsenko Cc: linux-arm-kernel, kvmarm, Catalin Marinas, Will Deacon, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Tue, 09 May 2023 15:22:27 +0100, Kristina Martsenko <kristina.martsenko@arm.com> wrote: > > Switch the HCRX_EL2 register between host and guest configurations, in > order to enable different features in the host and guest. > > Now that there are separate guest flags, we can also remove SMPME from > the host flags, as SMPME is used for virtualizing SME priorities and has > no use in the host. > > Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> Acked-by: Marc Zyngier <maz@kernel.org> M. -- 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 [flat|nested] 15+ messages in thread
* Re: [PATCH v2 00/11] arm64: Support for Armv8.8 memcpy instructions in userspace [not found] <20230509142235.3284028-1-kristina.martsenko@arm.com> ` (3 preceding siblings ...) [not found] ` <20230509142235.3284028-4-kristina.martsenko@arm.com> @ 2023-06-05 17:46 ` Catalin Marinas 4 siblings, 0 replies; 15+ messages in thread From: Catalin Marinas @ 2023-06-05 17:46 UTC (permalink / raw) To: linux-arm-kernel, kvmarm, Kristina Martsenko Cc: Will Deacon, Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu, Mark Rutland, Mark Brown, Luis Machado, Vladimir Murzin, linux-kernel On Tue, 09 May 2023 15:22:24 +0100, Kristina Martsenko wrote: > The Armv8.8 extension adds new instructions to perform memcpy(), memset() and > memmove() operations in hardware (FEAT_MOPS). This series adds support for > using the new instructions in userspace. More information can be found in the > cover letter for v1: > https://lore.kernel.org/linux-arm-kernel/20230216160012.272345-1-kristina.martsenko@arm.com/ > > Changes in v2: > - Removed booting.rst requirement for HCRX_EL2.MCE2 > - Changed HCRX_EL2 cpucap to be STRICT_BOOT type > - Changed HCRX_EL2.SMPME to be set for the guest and unset for the host > - Moved HCRX_EL2 initialization into init_el2_state(), dropped ISB > - Simplified conditional checks in mops exception handler with XOR > - Added comments from Arm ARM into mops exception handler > - Converted cpucaps to use the new ARM64_CPUID_FIELDS() helper > - Added MOPS to hwcaps kselftest > - Improved commit messages > - Rebased onto v6.4-rc1 > - v1: https://lore.kernel.org/linux-arm-kernel/20230216160012.272345-1-kristina.martsenko@arm.com/ > > [...] Applied to arm64 (for-next/feat_mops), thanks! [01/11] KVM: arm64: initialize HCRX_EL2 https://git.kernel.org/arm64/c/af94aad4c915 [02/11] arm64: cpufeature: detect FEAT_HCX https://git.kernel.org/arm64/c/b0c756fe996a [03/11] KVM: arm64: switch HCRX_EL2 between host and guest https://git.kernel.org/arm64/c/306b4c9f7120 [04/11] arm64: mops: document boot requirements for MOPS https://git.kernel.org/arm64/c/f32c053b9806 [05/11] arm64: mops: don't disable host MOPS instructions from EL2 https://git.kernel.org/arm64/c/b1319c0e9559 [06/11] KVM: arm64: hide MOPS from guests https://git.kernel.org/arm64/c/3172613fbcbb [07/11] arm64: mops: handle MOPS exceptions https://git.kernel.org/arm64/c/8536ceaa7471 [08/11] arm64: mops: handle single stepping after MOPS exception https://git.kernel.org/arm64/c/8cd076a67dc8 [09/11] arm64: mops: detect and enable FEAT_MOPS https://git.kernel.org/arm64/c/b7564127ffcb [10/11] arm64: mops: allow disabling MOPS from the kernel command line https://git.kernel.org/arm64/c/3e1dedb29d0f [11/11] kselftest/arm64: add MOPS to hwcap test https://git.kernel.org/arm64/c/d8a324f102cc -- Catalin _______________________________________________ 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] 15+ messages in thread
end of thread, other threads:[~2023-06-05 17:46 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230509142235.3284028-1-kristina.martsenko@arm.com>
[not found] ` <20230509142235.3284028-7-kristina.martsenko@arm.com>
2023-05-25 19:26 ` [PATCH v2 06/11] KVM: arm64: hide MOPS from guests Colton Lewis
2023-05-30 16:34 ` Kristina Martsenko
2023-06-03 8:42 ` Marc Zyngier
2023-06-05 15:45 ` Oliver Upton
[not found] ` <20230509142235.3284028-8-kristina.martsenko@arm.com>
2023-05-25 19:50 ` [PATCH v2 07/11] arm64: mops: handle MOPS exceptions Colton Lewis
2023-05-30 16:36 ` Kristina Martsenko
2023-06-05 11:43 ` Shaoqin Huang
2023-06-05 12:04 ` Catalin Marinas
[not found] ` <20230509142235.3284028-2-kristina.martsenko@arm.com>
2023-06-02 13:49 ` [PATCH v2 01/11] KVM: arm64: initialize HCRX_EL2 Catalin Marinas
2023-06-05 15:41 ` Oliver Upton
2023-06-03 8:39 ` Marc Zyngier
[not found] ` <20230509142235.3284028-4-kristina.martsenko@arm.com>
2023-06-02 13:51 ` [PATCH v2 03/11] KVM: arm64: switch HCRX_EL2 between host and guest Catalin Marinas
2023-06-05 15:41 ` Oliver Upton
2023-06-03 8:40 ` Marc Zyngier
2023-06-05 17:46 ` [PATCH v2 00/11] arm64: Support for Armv8.8 memcpy instructions in userspace Catalin Marinas
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).