From patchwork Mon Nov 5 18:52:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lindsay X-Patchwork-Id: 10668953 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 6D2AC1751 for ; Mon, 5 Nov 2018 19:04:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A8E8291B7 for ; Mon, 5 Nov 2018 19:04:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EA6B29261; Mon, 5 Nov 2018 19:04: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_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 5F2F9291B7 for ; Mon, 5 Nov 2018 19:04:20 +0000 (UTC) Received: from localhost ([::1]:37183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJkAd-0003hS-C3 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Nov 2018 14:04:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJjzP-0005OW-Ih for qemu-devel@nongnu.org; Mon, 05 Nov 2018 13:52:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJjzO-0001At-21 for qemu-devel@nongnu.org; Mon, 05 Nov 2018 13:52:43 -0500 Received: from mail-cys01nam02on0099.outbound.protection.outlook.com ([104.47.37.99]:43926 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 1gJjyu-0000UT-TE; Mon, 05 Nov 2018 13:52:16 -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=2CztuA3sL9gunx35yyGL0HAZd15Mu8hkkma3f+cUywk=; b=d29KVCLbsAw/OGl1JxM/6JHxhIwYev6Xj3xFdKSL8yN7V90yePYC8GJynpgVzKbFdMN7bwxjvOXxqgCVfBn+ErwNMXbXxxvV2RvD32iJ85B7YmjV8iKgUuqpv6IDMkxZ+cngTlWF8kupQZLbjonHeE5ETpI8f9qPxoTdAqnhDpQ= Received: from DM6PR01MB4825.prod.exchangelabs.com (20.177.218.222) by DM6PR01MB5194.prod.exchangelabs.com (20.176.122.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Mon, 5 Nov 2018 18:52:01 +0000 Received: from DM6PR01MB4825.prod.exchangelabs.com ([fe80::4cf7:c8dc:b673:ec66]) by DM6PR01MB4825.prod.exchangelabs.com ([fe80::4cf7:c8dc:b673:ec66%3]) with mapi id 15.20.1294.028; Mon, 5 Nov 2018 18:52:01 +0000 From: Aaron Lindsay To: "qemu-arm@nongnu.org" , Peter Maydell , Alistair Francis , Wei Huang , Peter Crosthwaite , Richard Henderson Thread-Topic: [PATCH v7 10/12] target/arm: PMU: Set PMCR.N to 4 Thread-Index: AQHUdTiipmLYuvQQkUWlgSTv/s4ESQ== Date: Mon, 5 Nov 2018 18:52:01 +0000 Message-ID: <20181105185046.2802-11-aaron@os.amperecomputing.com> References: <20181105185046.2802-1-aaron@os.amperecomputing.com> In-Reply-To: <20181105185046.2802-1-aaron@os.amperecomputing.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BN6PR20CA0070.namprd20.prod.outlook.com (2603:10b6:404:151::32) 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.153] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM6PR01MB5194; 6:R5eDJLG2TZusn5me92JM4Xz5ozmuhbF9AOhRxGuYLQ8vZMnLNg9pQF6DQjFJW/ver1oD2EMbPVMsaYux6zyNKHQtYg5hiHAL+9YthJTyDlrHKLhBRi/f52F1ozN6T9IjLeWUdD1eoIUOJhIaaKflfEZmawZ/rSxIBVFI7QOciBkjLYizgikwEziPylfOPfJXHqsT3TjwVHb/rjaqnBbitfICdcpAVSrYk9HaMjvruogNEiKPzC6J6UU79xQFyj2kQGZQ6yHkIEX52EIHkje1tcKTz7iyZwXOIDX9PfFfsG+ltu1/WjxEIWCia11pLx90VKlSJDHZBVaccbriZhtiSO7SZvNBEO386iyoH/qtVUw4tJsB0P7EsRWMPVfJMJ76j4P9n32W/GVFxz1r5xVDBEp6nai1Pz5N6OjQ8ZdnG+S9O8RW4A2NS/f+YAYyJMwl38EXQFvx/1zpXUVYHf2NZQ==; 5:lwEBzGft+rpm1m6g4/X7oyJ1PuZCg7na++lfh8Qti64B3R7/EDBGUquB+ih1GUOTZkfMwYDW7Mun+cLLPSRl/EqGOuspoyczU5nnLGMCN3NpeYEtQxLksJILNGjuWRkDvxrB22S49ZXfrl/sNBkETALzVvvV4gTLS3Rj3ed4Me8=; 7:5vggkWYAA4UEmYXycaZmwEcZuTIiFAYWMcJnzaX3r8GPa5206E635ZeZwr+x2ItfkkNuXSkU05aVlq3hEbKPHr9Iv7XZXX7vQ0cwSWWSbEovIb59rEQ3HViSK9DpM1XGVhKIE8ckWbN3PKb1BUdoTg== x-ms-office365-filtering-correlation-id: 35e15671-c31f-4e5a-8744-08d6434fc542 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR01MB5194; x-ms-traffictypediagnostic: DM6PR01MB5194: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231382)(944501410)(52105095)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:DM6PR01MB5194; BCL:0; PCL:0; RULEID:; SRVR:DM6PR01MB5194; x-forefront-prvs: 08476BC6EF x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(396003)(346002)(136003)(39840400004)(376002)(366004)(189003)(199004)(81166006)(81156014)(53936002)(66066001)(6436002)(486006)(6486002)(6116002)(14444005)(110136005)(256004)(25786009)(4326008)(54906003)(14454004)(7736002)(305945005)(106356001)(26005)(105586002)(186003)(97736004)(39060400002)(102836004)(8936002)(2900100001)(2501003)(386003)(6506007)(8676002)(7416002)(476003)(316002)(52116002)(6512007)(2616005)(99286004)(76176011)(5660300001)(2906002)(86362001)(68736007)(71200400001)(71190400001)(3846002)(478600001)(446003)(1076002)(11346002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR01MB5194; 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: W5g0ouExxvtHLYr2vsx99LvvTGE97j/4jJHR5YLLSedjaBoLZBiSrWXNvPVoEEfI/oCCHvhUFBsBMQJ/KJySxNQDnutkO0DyGyn4HkuLCWfKqH62LkZqU/cib7t3syB+WgHNapN7Gw8zD9veKO3UNmqUqP5fDwQARL175d8wFuJKwptisNHhxHUrDX0e3dxyB9Yml6KoBathjSWHS0uyQgakTs6lqWx/5WQnMWXeRkLir7D/6B1JUiCdRIGlxAqj2s0kBJCUO1gzUg4F/Di1r/Ku0EZdEBrp4p+g8TqjY4HxJULFvTWUOvGRHAXoLJfeI3wXi/jgIz/eOIowYF15bBqP1BxvP3rmR0wNhdrGpw4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35e15671-c31f-4e5a-8744-08d6434fc542 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2018 18:52:01.1943 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5194 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.99 Subject: [Qemu-devel] [PATCH v7 10/12] 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 e3ec36490c..11eb62bdda 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1753,7 +1753,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) @@ -5508,10 +5508,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, @@ -5526,7 +5526,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);