From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzT4K-00009J-2L for qemu-devel@nongnu.org; Tue, 24 Jun 2014 11:55:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzT4C-0007d0-UH for qemu-devel@nongnu.org; Tue, 24 Jun 2014 11:55:35 -0400 Received: from smtp.codeaurora.org ([198.145.11.231]:59007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzT4C-0007cq-NV for qemu-devel@nongnu.org; Tue, 24 Jun 2014 11:55:28 -0400 Message-ID: <53A99F6B.2080600@codeaurora.org> Date: Tue, 24 Jun 2014 11:55:23 -0400 From: Christopher Covington MIME-Version: 1.0 References: <3217ac3f31ad96dd4811309d9a68e5af0886e628.1403572003.git.alistair.francis@xilinx.com> In-Reply-To: <3217ac3f31ad96dd4811309d9a68e5af0886e628.1403572003.git.alistair.francis@xilinx.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 7/7] target-arm: Call the pmccntr_sync function when swapping ELs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, qemu-devel@nongnu.org On 06/23/2014 09:12 PM, Alistair Francis wrote: > Call the new pmccntr_sync() function when there is a possibility > of swapping ELs (I.E. when there is an exception) > > Signed-off-by: Alistair Francis > --- > > target-arm/helper-a64.c | 5 +++++ > target-arm/helper.c | 7 +++++++ > target-arm/op_helper.c | 6 ++++++ > 3 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c > index 2b4ce6a..b61174f 100644 > --- a/target-arm/helper-a64.c > +++ b/target-arm/helper-a64.c > @@ -446,6 +446,8 @@ void aarch64_cpu_do_interrupt(CPUState *cs) > target_ulong addr = env->cp15.vbar_el[1]; > int i; > > + pmccntr_sync(env); > + > if (arm_current_pl(env) == 0) { > if (env->aarch64) { > addr += 0x400; > @@ -484,6 +486,7 @@ void aarch64_cpu_do_interrupt(CPUState *cs) > addr += 0x100; > break; > default: > + pmccntr_sync(env); > cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); > } > > @@ -511,4 +514,6 @@ void aarch64_cpu_do_interrupt(CPUState *cs) > > env->pc = addr; > cs->interrupt_request |= CPU_INTERRUPT_EXITTB; > + > + pmccntr_sync(env); > } The double calls seem unwieldy. I think it could be made into a single function call if there was access, perhaps as a second parameter or maybe as a static variable, to both the previous and current state so the function could tell whether there is no transition, enable->disable, or disable->enable. Christopher -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation.