Re: [RFC 2/3] KVM: arm64: pmu: Fix chained SW_INCR counters

2019-12-05 Thread Auger Eric
Hi Marc, On 12/5/19 3:52 PM, Marc Zyngier wrote: > On 2019-12-05 14:06, Auger Eric wrote: >> Hi Marc, >> >> On 12/5/19 10:43 AM, Marc Zyngier wrote: >>> Hi Eric, >>> >>> On 2019-12-04 20:44, Eric Auger wrote: At the moment a SW_INCR counter always overflows on 32-bit boundary, independen

[PATCH 0/2] kvm/arm64: unimplemented sysreg improvements

2019-12-05 Thread Mark Rutland
While testing some other patches, I realised that KVM's logging of trapped sysreg accesses can log inconsistent information, and this is arguably unnecessary for IMPLEMENTATION DEFINED system registers. This patches fix that up, ensureing that logged information is consistent, and avoiding logging

[PATCH 2/2] kvm/arm64: don't log IMP DEF sysreg traps

2019-12-05 Thread Mark Rutland
We don't intend to support IMPLEMENATION DEFINED system registers, but have to trap them (and emulate them as UNDEFINED). These traps aren't interesting to the system administrator or to the KVM developers, so let's not bother logging when we do so. Signed-off-by: Mark Rutland Cc: Alexandru Elise

[PATCH 1/2] kvm/arm64: sanely ratelimit sysreg messages

2019-12-05 Thread Mark Rutland
Currently kvm_pr_unimpl() is ratelimited, so print_sys_reg_instr() won't spam the console. However, someof its callers try to print some contextual information with kvm_err(), which is not ratelimited. This means that in some cases the context may be printed without the sysreg encoding, which isn't

Re: [RFC 2/3] KVM: arm64: pmu: Fix chained SW_INCR counters

2019-12-05 Thread Marc Zyngier
On 2019-12-05 14:06, Auger Eric wrote: Hi Marc, On 12/5/19 10:43 AM, Marc Zyngier wrote: Hi Eric, On 2019-12-04 20:44, Eric Auger wrote: At the moment a SW_INCR counter always overflows on 32-bit boundary, independently on whether the n+1th counter is programmed as CHAIN. Check whether the S

Re: [RFC 2/3] KVM: arm64: pmu: Fix chained SW_INCR counters

2019-12-05 Thread Auger Eric
Hi Marc, On 12/5/19 10:43 AM, Marc Zyngier wrote: > Hi Eric, > > On 2019-12-04 20:44, Eric Auger wrote: >> At the moment a SW_INCR counter always overflows on 32-bit >> boundary, independently on whether the n+1th counter is >> programmed as CHAIN. >> >> Check whether the SW_INCR counter is a 64b

Re: [PATCH v3 08/15] KVM: Move setting of memslot into helper routine

2019-12-05 Thread Philippe Mathieu-Daudé
On 10/25/19 1:07 AM, Sean Christopherson wrote: Split out the core functionality of setting a memslot into a separate helper in preparation for moving memslot deletion into its own routine. Tested-by: Christoffer Dall Signed-off-by: Sean Christopherson --- virt/kvm/kvm_main.c | 106 +

Re: [PATCH v3 07/15] KVM: Refactor error handling for setting memory region

2019-12-05 Thread Philippe Mathieu-Daudé
On 10/25/19 1:07 AM, Sean Christopherson wrote: Replace a big pile o' gotos with returns to make it more obvious what error code is being returned, and to prepare for refactoring the functional, i.e. post-checks, portion of __kvm_set_memory_region(). Reviewed-by: Janosch Frank Signed-off-by: Se

Re: [RFC 1/3] KVM: arm64: pmu: Don't increment SW_INCR if PMCR.E is unset

2019-12-05 Thread Marc Zyngier
On 2019-12-04 20:44, Eric Auger wrote: The specification says PMSWINC increments PMEVCNTR_EL1 by 1 if PMEVCNTR_EL0 is enabled and configured to count SW_INCR. For PMEVCNTR_EL0 to be enabled, we need both PMCNTENSET to be set for the corresponding event counter but we also need the PMCR.E bit to

Re: [RFC 2/3] KVM: arm64: pmu: Fix chained SW_INCR counters

2019-12-05 Thread Marc Zyngier
Hi Eric, On 2019-12-04 20:44, Eric Auger wrote: At the moment a SW_INCR counter always overflows on 32-bit boundary, independently on whether the n+1th counter is programmed as CHAIN. Check whether the SW_INCR counter is a 64b counter and if so, implement the 64b logic. Fixes: 80f393a23be6 ("K

Re: [RFC 3/3] KVM: arm64: pmu: Enforce PMEVTYPER evtCount size

2019-12-05 Thread Auger Eric
Hi Will, On 12/5/19 10:02 AM, Will Deacon wrote: > On Wed, Dec 04, 2019 at 09:44:26PM +0100, Eric Auger wrote: >> ARMv8.1-PMU supports 16-bit evtCount whereas 8.0 only supports >> 10 bits. >> >> On Seatlle which has an 8.0 PMU implementation, evtCount[15:10] >> are not read as 0, as expected. Fix

Re: [RFC 3/3] KVM: arm64: pmu: Enforce PMEVTYPER evtCount size

2019-12-05 Thread Will Deacon
On Wed, Dec 04, 2019 at 09:44:26PM +0100, Eric Auger wrote: > ARMv8.1-PMU supports 16-bit evtCount whereas 8.0 only supports > 10 bits. > > On Seatlle which has an 8.0 PMU implementation, evtCount[15:10] > are not read as 0, as expected. Fix that by applying a mask on > the selected event that dep