From patchwork Tue Nov 20 21:26:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lindsay X-Patchwork-Id: 10691251 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 11E9315A7 for ; Tue, 20 Nov 2018 21:33:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3BC529FF5 for ; Tue, 20 Nov 2018 21:33:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E54602A0CE; Tue, 20 Nov 2018 21:33:05 +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_INVALID, DKIM_SIGNED,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 6634329FF5 for ; Tue, 20 Nov 2018 21:33:05 +0000 (UTC) Received: from localhost ([::1]:36040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPDdo-0005l5-AA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 20 Nov 2018 16:33:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPDY5-0000RO-9G for qemu-devel@nongnu.org; Tue, 20 Nov 2018 16:27:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPDXx-00069r-Qc for qemu-devel@nongnu.org; Tue, 20 Nov 2018 16:27:06 -0500 Received: from mail-eopbgr760129.outbound.protection.outlook.com ([40.107.76.129]:22624 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPDXl-0005lc-4A; Tue, 20 Nov 2018 16:26:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amperemail.onmicrosoft.com; s=selector1-os-amperecomputing-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lUfDHk0s+shvz7OJtogLRCV+QPhYazBl3f1TO2/weWE=; b=sSUqHpAmmtVfdQzoP2HcqEAyK8cLJHtmT0c/yvhn2SsvxI/9GxgF/RU1+vYS3/pCrvhTdwPA30aAe6hPd1wGGRmOw4k5xb3rcoqm7OqE58L7++QtEi3O6TvfwUk4P8xgEalcoIS59RpRneVl8Xqcd5OalvYVMk0MY5KHr4gFoas= Received: from DM6PR01MB4825.prod.exchangelabs.com (20.177.218.222) by DM6PR01MB4651.prod.exchangelabs.com (20.177.216.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Tue, 20 Nov 2018 21:26:46 +0000 Received: from DM6PR01MB4825.prod.exchangelabs.com ([fe80::d5ed:ce81:19eb:c9ea]) by DM6PR01MB4825.prod.exchangelabs.com ([fe80::d5ed:ce81:19eb:c9ea%5]) with mapi id 15.20.1294.048; Tue, 20 Nov 2018 21:26:46 +0000 From: Aaron Lindsay To: "qemu-arm@nongnu.org" , Peter Maydell , Alistair Francis , Wei Huang , Peter Crosthwaite , Richard Henderson Thread-Topic: [PATCH v8 11/13] target/arm: PMU: Set PMCR.N to 4 Thread-Index: AQHUgRe9YdUZEF5OKkKRIPjMBxZNTw== Date: Tue, 20 Nov 2018 21:26:46 +0000 Message-ID: <20181120212553.8480-12-aaron@os.amperecomputing.com> References: <20181120212553.8480-1-aaron@os.amperecomputing.com> In-Reply-To: <20181120212553.8480-1-aaron@os.amperecomputing.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: CY4PR04CA0037.namprd04.prod.outlook.com (2603:10b6:903:c6::23) To DM6PR01MB4825.prod.exchangelabs.com (2603:10b6:5:6b::30) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aaron@os.amperecomputing.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [216.85.170.155] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM6PR01MB4651; 6:f/X2+sKT7BOWPrYEEjRzGnDMPcCHg93dXl/rLyaR6JR0O+jHCAED6eaJeVCFnvpaSz6c0lPQgcbuD584rW0x1fHkrYiznJEe/qiir6UizoCHh8q5SjoWKz1Cr0WDYplcz2IyFoG612WClx5kDhR6AUzdnCfVmRoSdNY3li4kE9ZhH1TahAp0cI4DnFz74awIiLQMjhNYgoLQPvucwD7anMMMYparmp5F1cHWFPGaXZVbcLOdEE4xCvA+nXLU02LCzNkWiLclZzV2S0eWIAylknH9yIeq7BDRI3wU49LUIZps1yWZM6zOBQDXMPbYgnno8fr08OXSp0ZGhTa3fThKQl/0Yg7gzcDV0lc2Xr9lXOk+WMsT++BCcWet4RQLqbhvAYbgnJN1f4UuzrN4GVkH+XEFNNBGkpjhZMn8FdfNYaDVrLLdVDotJp5eB3l0PVRGGr68TxeW2bDIk5/iXJvbFw==; 5:jrBzKLgjdZoFHWXWzSDO+1Uf1UjXxpJ5fP/E8uz+HUyu0jYxrPVOGgeBv1H8BYpVne/QYGYBgGx+uvqtwyppbsS1ICkLtnr+e1YsilPSMhSaihPHaWZ72cIPCnsp5rVwmvMP4QsxnBNq9WjBddZB2zDErIsn74Pq3tSrf2qik6E=; 7:8cZHjbiqEdJrUy74PZ13CwjotZeVkwrfrrlR0SRekeormD6uVTXwMVbFc5ZzOJZ92YKeeWYgc3zdZSLtPvA+Uo7BjNZGWCpRj/8ryUutOmjGjqwe7h6x8gCWDxpu708HiTfLsItxpdXKBjFPSUdCjQ== x-ms-office365-filtering-correlation-id: c6febe83-4203-4d72-f89c-08d64f2edfc2 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR01MB4651; x-ms-traffictypediagnostic: DM6PR01MB4651: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231442)(944501410)(52105112)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DM6PR01MB4651; BCL:0; PCL:0; RULEID:; SRVR:DM6PR01MB4651; x-forefront-prvs: 08626BE3A5 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(346002)(136003)(366004)(396003)(39840400004)(189003)(199004)(476003)(305945005)(39060400002)(71200400001)(7736002)(71190400001)(4326008)(2906002)(3846002)(14444005)(6116002)(6436002)(1076002)(7416002)(14454004)(256004)(316002)(2616005)(5660300001)(486006)(575784001)(11346002)(6512007)(53936002)(86362001)(446003)(110136005)(54906003)(6486002)(186003)(478600001)(2501003)(66066001)(26005)(102836004)(97736004)(99286004)(25786009)(81166006)(68736007)(105586002)(6506007)(8936002)(386003)(81156014)(52116002)(76176011)(106356001)(2900100001)(8676002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR01MB4651; H:DM6PR01MB4825.prod.exchangelabs.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:0; received-spf: None (protection.outlook.com: os.amperecomputing.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 4+9XOBul+3h3TmaYPEtImtsXLBflD2Y1w4gLADryJYihdk9WsocsG8pOgyBjneOnVk29hkowl+IM79yBfqX97x8iizxSnHdreKcuFf2PfPjJ1erbm4Ieh4sGza2NU/ZOK5UyRtyBMeYExh2hZjkT8UVJUxI9O6p1m36KzpUXKg96+Rnb1RaCkhpDhB5AQzUOT1nzl9OAhYPzGfzzR7VbC7n/vPXg0YJI1cQiCkOeNexTpW5gvybxL3sBVWm/ubjspvPvkdrll7JSR2USDB6NLLeGy78fGTas77S6j25iw9FXUHY8DRdzwcZCnj2RGPwmYMD08YsOpg/R/USXNVxkIIkDoqHJSwTa1nkgU++9s0c= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6febe83-4203-4d72-f89c-08d64f2edfc2 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2018 21:26:46.3190 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB4651 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.76.129 Subject: [Qemu-devel] [PATCH v8 11/13] target/arm: PMU: Set PMCR.N to 4 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 This both advertises that we support four counters and enables them because the pmu_num_counters() reads this value from PMCR. Signed-off-by: Aaron Lindsay Signed-off-by: Aaron Lindsay Reviewed-by: Peter Maydell --- target/arm/helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 6e5f00c0d5..b8462d429a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1768,7 +1768,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .access = PL1_W, .type = ARM_CP_NOP }, /* Performance monitors are implementation defined in v7, * but with an ARM recommended set of registers, which we - * follow (although we don't actually implement any counters) + * follow. * * Performance registers fall into three categories: * (a) always UNDEF in PL0, RW in PL1 (PMINTENSET, PMINTENCLR) @@ -5502,10 +5502,10 @@ void register_cp_regs_for_features(ARMCPU *cpu) } if (arm_feature(env, ARM_FEATURE_V7)) { /* v7 performance monitor control register: same implementor - * field as main ID register, and we implement only the cycle - * count register. + * field as main ID register, and we implement four counters in + * addition to the cycle count register. */ - unsigned int i, pmcrn = 0; + unsigned int i, pmcrn = 4; ARMCPRegInfo pmcr = { .name = "PMCR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 0, .access = PL0_RW, @@ -5520,7 +5520,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL0_RW, .accessfn = pmreg_access, .type = ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr), - .resetvalue = cpu->midr & 0xff000000, + .resetvalue = (cpu->midr & 0xff000000) | (pmcrn << PMCRN_SHIFT), .writefn = pmcr_write, .raw_writefn = raw_write, }; define_one_arm_cp_reg(cpu, &pmcr);