Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Peter Maydell
On 23 April 2015 at 16:00, Greg Bellows wrote: > > > On Thu, Apr 23, 2015 at 9:51 AM, Peter Maydell > wrote: >> We should check what the architecture manual says, but I think >> that in all the trap-WFE cases it says "traps if the CPU >> would go into a low power state". QEMU *never* goes into a

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Greg Bellows
On Thu, Apr 23, 2015 at 9:51 AM, Peter Maydell wrote: > On 23 April 2015 at 15:41, Greg Bellows wrote: > > Ok it sounds like the primary concern is the performance impact of > > constantly trapping wfe to EL2 (in which case HCR must be set to cause > > this). Should we still honor EL3 and EL1 t

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Peter Maydell
On 23 April 2015 at 15:41, Greg Bellows wrote: > Ok it sounds like the primary concern is the performance impact of > constantly trapping wfe to EL2 (in which case HCR must be set to cause > this). Should we still honor EL3 and EL1 trapping ofr wfe? In other words > check if they are the target

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Greg Bellows
On Thu, Apr 23, 2015 at 9:30 AM, Peter Maydell wrote: > On 23 April 2015 at 15:26, Greg Bellows wrote: > > Good catch Edgar, we shouldn't trap if we are "going into a low-power > > state". > > You mean "if we are not going into a low-power state". > ​Yes, sorry. ​ > > > It sounds like we arri

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Peter Maydell
On 23 April 2015 at 15:26, Greg Bellows wrote: > Good catch Edgar, we shouldn't trap if we are "going into a low-power > state". You mean "if we are not going into a low-power state". > It sounds like we arrived at the following: > > wfi- check has_work before taking either the UDEF or HLT exce

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Greg Bellows
On Thu, Apr 23, 2015 at 6:34 AM, Edgar E. Iglesias wrote: > On Thu, Apr 23, 2015 at 12:28:43PM +0100, Peter Maydell wrote: > > On 23 April 2015 at 12:24, Edgar E. Iglesias > wrote: > > > Maybe we can consider YIELD instead of NOP when has_work() is true as > a WFI > > > is probably a good hint f

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Edgar E. Iglesias
On Thu, Apr 23, 2015 at 12:28:43PM +0100, Peter Maydell wrote: > On 23 April 2015 at 12:24, Edgar E. Iglesias wrote: > > Maybe we can consider YIELD instead of NOP when has_work() is true as a WFI > > is probably a good hint from guests to reschedule QEMU CPUs. > > That I'm not convinced about. I

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Peter Maydell
On 23 April 2015 at 12:24, Edgar E. Iglesias wrote: > Maybe we can consider YIELD instead of NOP when has_work() is true as a WFI > is probably a good hint from guests to reschedule QEMU CPUs. That I'm not convinced about. If we have a pending interrupt then our best bet is probably to take it im

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Edgar E. Iglesias
On Thu, Apr 23, 2015 at 11:57:10AM +0100, Peter Maydell wrote: > On 23 April 2015 at 11:39, Edgar E. Iglesias wrote: > > > > On 23/04/2015 6:00 pm, "Peter Maydell" wrote: > >> In theory you could maybe check has_work() for the WFI case, > >> since doing an EXCP_HLT really should cause us to stop

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Peter Maydell
On 23 April 2015 at 11:39, Edgar E. Iglesias wrote: > > On 23/04/2015 6:00 pm, "Peter Maydell" wrote: >> In theory you could maybe check has_work() for the WFI case, >> since doing an EXCP_HLT really should cause us to stop until >> has_work is true, but it seems a bit fragile -- could we really

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Edgar E. Iglesias
On 23/04/2015 6:00 pm, "Peter Maydell" wrote: > > On 23 April 2015 at 03:49, Edgar E. Iglesias wrote: > > On Wed, Apr 22, 2015 at 12:09:21PM -0500, Greg Bellows wrote: > >> void HELPER(wfe)(CPUARMState *env) > >> { > >> CPUState *cs = CPU(arm_env_get_cpu(env)); > >> +int target_el = ch

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-23 Thread Peter Maydell
On 23 April 2015 at 03:49, Edgar E. Iglesias wrote: > On Wed, Apr 22, 2015 at 12:09:21PM -0500, Greg Bellows wrote: >> void HELPER(wfe)(CPUARMState *env) >> { >> CPUState *cs = CPU(arm_env_get_cpu(env)); >> +int target_el = check_wfx_trap(env, true); >> >> /* Don't actually halt th

Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-22 Thread Edgar E. Iglesias
On Wed, Apr 22, 2015 at 12:09:21PM -0500, Greg Bellows wrote: > Add support for trapping WFI and WFE instructions to the proper EL when > SCTLR/SCR/HCR settings apply. > > Signed-off-by: Greg Bellows > > --- > > v1 -> v2 > - Replace check loop with simpler if checks. > - Changed WFx syncdrome f

[Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support

2015-04-22 Thread Greg Bellows
Add support for trapping WFI and WFE instructions to the proper EL when SCTLR/SCR/HCR settings apply. Signed-off-by: Greg Bellows --- v1 -> v2 - Replace check loop with simpler if checks. - Changed WFx syncdrome function to take bool - Changed return of uint32_t to int - Added cdditional commen