From patchwork Wed Oct 10 20:37:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lindsay X-Patchwork-Id: 10635237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C0EA16B1 for ; Wed, 10 Oct 2018 20:43:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8820252D5 for ; Wed, 10 Oct 2018 20:43:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9A3628979; Wed, 10 Oct 2018 20:43:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CD81252D5 for ; Wed, 10 Oct 2018 20:43:22 +0000 (UTC) Received: from localhost ([::1]:59058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gALKD-0006lY-Hm for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Oct 2018 16:43:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gALFb-0002ri-Qj for qemu-devel@nongnu.org; Wed, 10 Oct 2018 16:38:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gALFa-0002Up-LO for qemu-devel@nongnu.org; Wed, 10 Oct 2018 16:38:35 -0400 Received: from mail-yw1-xc44.google.com ([2607:f8b0:4864:20::c44]:47096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gALFW-0002QO-Oz; Wed, 10 Oct 2018 16:38:30 -0400 Received: by mail-yw1-xc44.google.com with SMTP id j202-v6so2710196ywa.13; Wed, 10 Oct 2018 13:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AnhG0/ln6p/5gZevgYimHTnAiMxu17Lcq2p4OJVwhik=; b=qZluxc2HhKFPdM1xvKHLm3ozdP7BNmdCOknzP+UT0wv1+BTY6x3i7GMb0qqBli+1Wd djTAlJmus0o3YJhzMUM6j0YwvrO+1Kd21AkQOmdy8d+D5DmaBfohgYDqNdVss7hwbjpN PYrvpZDuHqPOaObhP/xRebxB7KRkS62n9AxPFG2yYzdD1xNuSa6Ff4MbTwmrGXCIM58b F0rjwm+UNazjNCPpdI/wEfS++fmgWxRRwENa8gHCPJqLysySwHT1Mz+q3/vsNxnRQFe8 +2XjB0sY5xfugSck+MuT+X4kLgD1GG97kQkOHKNoUHDnj2Mas9fPJ+bhe+yKLbs/Fcmh fyiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AnhG0/ln6p/5gZevgYimHTnAiMxu17Lcq2p4OJVwhik=; b=Qq+uw1oObvgTLhRsbpZD9TIa6rpjOpBYAYkDQCogKaF5ZlDVx594i2O4eWMk1nvGSk vT+u6+rG05Bm3P2SVAfL/G2vO+B7CsO3cvAOPVupiIt3YhnDQw/PBqAAB5A1nGkYi0ku uUHsbIHhVL9+Z0FuQlW2xhbC9SYmPfkC6iDsIqkxOzH4ab3g/AEqTr/AG2qrKou5r0JC MUIFOi/frzQySCG45ErbBYk/JbWvH0SIbJer5a+6QFU1l+KbMw/bo8YVzE62GPOi3aYr CHtvo5CSzDT/r8g0DGGVtnq3IT+Z9/P4DaiAq1SBv/0KPfyXeKtBemsHTwnrkT07ajLe EtwA== X-Gm-Message-State: ABuFfojbVU+2U6ISYjJztTROHudOUBOdDcw10TZscuxs6CnbHkh+YnRD A4y5y1TF9xtOdNLk7CS2/0uL/L+X X-Google-Smtp-Source: ACcGV61M2/RftAEYV+L4Gwhi3tMlCQGez/ZiyfkDqzHtyDqwfHsPQ5IsghKFPvZNSlJchfWgvf8YBQ== X-Received: by 2002:a81:560a:: with SMTP id k10-v6mr19013985ywb.80.1539203910103; Wed, 10 Oct 2018 13:38:30 -0700 (PDT) Received: from quinoa.localdomain ([216.85.170.153]) by smtp.gmail.com with ESMTPSA id u131-v6sm15170728ywf.13.2018.10.10.13.38.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 13:38:29 -0700 (PDT) From: Aaron Lindsay To: qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Wei Huang , Peter Crosthwaite Date: Wed, 10 Oct 2018 16:37:28 -0400 Message-Id: <20181010203735.27918-8-aclindsa@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010203735.27918-1-aclindsa@gmail.com> References: <20181010203735.27918-1-aclindsa@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c44 Subject: [Qemu-devel] [PATCH v6 07/14] target/arm: Allow AArch32 access for PMCCFILTR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aaron Lindsay , Michael Spradling , qemu-devel@nongnu.org, Digant Desai Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Aaron Lindsay Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/helper.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 52bd13fdde..e804caaced 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -961,6 +961,10 @@ static const ARMCPRegInfo v6_cp_reginfo[] = { PMXEVTYPER_M | PMXEVTYPER_MT | \ PMXEVTYPER_EVTCOUNT) +#define PMCCFILTR 0xf8000000 +#define PMCCFILTR_M PMXEVTYPER_M +#define PMCCFILTR_EL0 (PMCCFILTR | PMCCFILTR_M) + static inline uint32_t pmu_num_counters(CPUARMState *env) { return (env->cp15.c9_pmcr & PMCRN_MASK) >> PMCRN_SHIFT; @@ -1264,10 +1268,26 @@ static void pmccfiltr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { pmccntr_op_start(env); - env->cp15.pmccfiltr_el0 = value & 0xfc000000; + env->cp15.pmccfiltr_el0 = value & PMCCFILTR_EL0; + pmccntr_op_finish(env); +} + +static void pmccfiltr_write_a32(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + pmccntr_op_start(env); + /* M is not accessible from AArch32 */ + env->cp15.pmccfiltr_el0 = (env->cp15.pmccfiltr_el0 & PMCCFILTR_M) | + (value & PMCCFILTR); pmccntr_op_finish(env); } +static uint64_t pmccfiltr_read_a32(CPUARMState *env, const ARMCPRegInfo *ri) +{ + /* M is not visible in AArch32 */ + return env->cp15.pmccfiltr_el0 & PMCCFILTR; +} + static void pmcntenset_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { @@ -1489,6 +1509,11 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .readfn = pmccntr_read, .writefn = pmccntr_write, .raw_readfn = raw_read, .raw_writefn = raw_write, }, #endif + { .name = "PMCCFILTR", .cp = 15, .opc1 = 0, .crn = 14, .crm = 15, .opc2 = 7, + .writefn = pmccfiltr_write_a32, .readfn = pmccfiltr_read_a32, + .access = PL0_RW, .accessfn = pmreg_access, + .type = ARM_CP_ALIAS | ARM_CP_IO, + .resetvalue = 0, }, { .name = "PMCCFILTR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 15, .opc2 = 7, .writefn = pmccfiltr_write, .raw_writefn = raw_write,