Ignore writes of perf reg (cp15 with crm == 12)
PATCH 1/1 Ignore writes of perf reg (cp15 with crm == 12)
On ARMv7, ignore writes to cp15 with crm == 12; these are to setup perf counters which we don't have.
--- target-arm/helper.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
target-arm/helper.c +2 -0
@@ -1457,6 +1457,8 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) }break ;case 9 : +if (arm_feature (env,ARM_FEATURE_V7 ) && crm ==12 ) +break ;/* Perf counters. */ if (arm_feature (env,ARM_FEATURE_OMAPCP ))break ;switch (crm) {
Signature · 1 line
1.7.1
Quoted 2 lines · Loïc Minier
On ARMv7, ignore writes to cp15 with crm == 12; these are to setup perf counters which we don't have.
Thanks Loïc, I have tested this and can confirm that I'm able to boot a CONFIG_PERF_EVENTS kernel now.
Arnd
I found out Matt Waddel has written a better looking patch, but I didn't test it; reviews welcome -- attached
Signature · 1 line
Loïc Minier
target-arm/cpu.h +1 -0
@@ -130,6 +130,7 @@ typedef struct CPUARMState {uint32_t c6_data;uint32_t c9_insn;/* Cache lockdown registers. */ uint32_t c9_data; +uint32_t c9_pmcr_data;/* Performance Monitor Control Register */ uint32_t c12_vbar;/* secure/nonsecure vector base address register. */ uint32_t c12_mvbar;/* monitor vector base address register. */ uint32_t c13_fcse;/* FCSE PID. */
target-arm/helper.c +16 -0
@@ -1558,6 +1558,15 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)case 1 :/* TCM memory region registers. */ /* Not implemented. */ goto bad_reg; +case 12 : +switch (op2) { +case 0 : + env->cp15.c9_pmcr_data = val; +break ; +default : + goto bad_reg; + } +break ;default : goto bad_reg; }
@@ -1897,6 +1906,13 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg;/* L2 Lockdown and Auxiliary control. */ return 0 ; +case 12 : +switch (op2) { +case 0 : +return env->cp15.c9_pmcr_data; +default : + goto bad_reg; + }default : goto bad_reg; }
target-arm/machine.c +2 -0
@@ -46,6 +46,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c6_data);qemu_put_be32 (f, env->cp15.c9_insn);qemu_put_be32 (f, env->cp15.c9_data); +qemu_put_be32 (f, env->cp15.c9_pmcr_data);qemu_put_be32 (f, env->cp15.c13_fcse);qemu_put_be32 (f, env->cp15.c13_context);qemu_put_be32 (f, env->cp15.c13_tls1);
@@ -156,6 +157,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c6_data =qemu_get_be32 (f); env->cp15.c9_insn =qemu_get_be32 (f); env->cp15.c9_data =qemu_get_be32 (f); + env->cp15.c9_pmcr_data =qemu_get_be32 (f); env->cp15.c13_fcse =qemu_get_be32 (f); env->cp15.c13_context =qemu_get_be32 (f); env->cp15.c13_tls1 =qemu_get_be32 (f);
Quoted 5 lines · Loïc Minier
I found out Matt Waddel has written a better looking patch, but I didn't test it; reviews welcome -- attached
Signature · 1 line
Loïc Minier
Return-Path: <[email protected]>
X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-26) on pig.zood.org X-Spam-Level:
X-Spam-Status: No, score=-98.5 required=3.0 tests=BAYES_40,
RATWARE_GECKO_BUILD,USER_IN_WHITELIST autolearn=disabled version=3.1.4
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from mail-qy0-f172.google.com (mail-qy0-f172.google.com [209.85.216.172])
by pig.zood.org (Postfix) with ESMTP id B070E4C0C6 for <[email protected]>; Tue, 27 Jul 2010 19:22:31 +0200 (CEST) Received: by qyk1 with SMTP id 1so2929439qyk.3 for <[email protected]>; Tue, 27 Jul 2010 10:22:30 -0700 (PDT) Received: by 10.224.60.211 with SMTP id q19mr7862913qah.85.1280251350380; Tue, 27 Jul 2010 10:22:30 -0700 (PDT)
X-Forwarded-To: [email protected]
X-Forwarded-For: [email protected] [email protected]
Delivered-To: [email protected]
Received: by 10.231.142.228 with SMTP id r36cs265184ibu;
Tue, 27 Jul 2010 10:22:29 -0700 (PDT)
Received: by 10.216.87.209 with SMTP id y59mr9230573wee.91.1280251348423;
Tue, 27 Jul 2010 10:22:28 -0700 (PDT)
Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139])
by mx.google.com with ESMTP id v17si6997588weq.181.2010.07.27.10.22.27;
Tue, 27 Jul 2010 10:22:28 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of [email protected] designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of [email protected] designates 91.189.90.139 as permitted sender) [email protected]
Received: from hutte.canonical.com ([91.189.90.181])
by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian))
id 1OdnrH-0004PW-Kf
for <[email protected]>; Tue, 27 Jul 2010 18:22:27 +0100
Received: from 75-162-181-248.slkc.qwest.net ([75.162.181.248] helo=[192.168.1.102])
by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32)
(Exim 4.69)
(envelope-from <[email protected]>)
id 1OdnrH-00067z-BO
for [email protected]; Tue, 27 Jul 2010 18:22:27 +0100Message-ID: <[email protected]>
Date: Tue, 27 Jul 2010 11:22:12 -0600
From: Matt Waddel <[email protected]>
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.11) Gecko/20100711 Lightning/1.0b1 Thunderbird/3.0.6 ThunderBrowse/3.3.1
MIME-Version: 1.0
To: =?ISO-8859-1?Q?Lo=EFc_Minier?= <[email protected]>
Subject: qemu cp15 register patch
X-Enigmail-Version: 1.0.1
Content-Type: multipart/mixed;
boundary="------------020300010903030602010303"
Quoted 2 lines
The patch needs a Signed-off-by.
target-arm/cpu.h typedef struct CPUARMState { · line 133
Quoted 9 lines
target-arm/cpu.h +1
-0@@ -130,6 +130,7 @@ typedef struct CPUARMState {uint32_t c6_data;uint32_t c9_insn;/* Cache lockdown registers. */ uint32_t c9_data; +uint32_t c9_pmcr_data;/* Performance Monitor Control Register */
The name looks a bit strange, c9_pmcr seems to be better.
Quoted 8 lines
target-arm/cpu.h +0
-0uint32_t c12_vbar;/* secure/nonsecure vector base address register. */ uint32_t c12_mvbar;/* monitor vector base address register. */ uint32_t c13_fcse;/* FCSE PID. */ target-arm/helper.c +0
-0
target-arm/helper.c void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) · line 1564
Quoted 7 lines
target-arm/helper.c +4
-0@@ -1558,6 +1558,15 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)case 1 :/* TCM memory region registers. */ /* Not implemented. */ goto bad_reg; +case 12 : +switch (op2) { +case 0 : + env->cp15.c9_pmcr_data = val;
Maybe writing a small comment that it is not fully implemented will help for later.
Quoted 36 lines
target-arm/helper.c +12
-0+break ; +default : + goto bad_reg; + } +break ;default : goto bad_reg; }@@ -1897,6 +1906,13 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg;/* L2 Lockdown and Auxiliary control. */ return 0 ; +case 12 : +switch (op2) { +case 0 : +return env->cp15.c9_pmcr_data; +default : + goto bad_reg; + }default : goto bad_reg; }target-arm/machine.c +1
-0@@ -46,6 +46,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c6_data);qemu_put_be32 (f, env->cp15.c9_insn);qemu_put_be32 (f, env->cp15.c9_data); +qemu_put_be32 (f, env->cp15.c9_pmcr_data);qemu_put_be32 (f, env->cp15.c13_fcse);qemu_put_be32 (f, env->cp15.c13_context);qemu_put_be32 (f, env->cp15.c13_tls1);
target-arm/machine.c int cpu_load(QEMUFile *f, void *opaque, int version_id) · line 163
Quoted 7 lines
target-arm/machine.c +1
-0@@ -156,6 +157,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c6_data =qemu_get_be32 (f); env->cp15.c9_insn =qemu_get_be32 (f); env->cp15.c9_data =qemu_get_be32 (f); + env->cp15.c9_pmcr_data =qemu_get_be32 (f); env->cp15.c13_fcse =qemu_get_be32 (f); env->cp15.c13_context =qemu_get_be32 (f); env->cp15.c13_tls1 =qemu_get_be32 (f);
Adding fields here imply a change of CPU_SAVE_VERSION.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net