From patchwork Tue Jul 1 15:11:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 32896 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9238A203C0 for ; Tue, 1 Jul 2014 15:13:37 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id j107sf8332007qga.4 for ; Tue, 01 Jul 2014 08:13:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=jv7hR9Jhgx4F94mL7cTEHFPIPNWJCwzxPJQaiRReHtU=; b=FoFTx1xUmLAPVB7J8ioEmKTFb5vJRzzEdrh2E8d/HlqHSMfPWsthmxDtxppSnDcENe FPG0SRIDtIXV1Z4P1WsDVKfZvSJXhVMARtERalGFamHwXYBgX0xSBLFRB7Z3wPlW4JIp EJF56iagCyWvVWTvKaatXhS1mPLRCBqJH6GLUtCLiLH4Ya82VdI2Ybdi70bZtQKw54Tn LSg+fIkUJ4IYFEIuyRFv/CD74ap0J12pCG3JWJmtj2pB2KnZcP5yzugKbPBe1hM0Nxio BPNlvQPX6XbGKbslfx03jl8yA1nLb6aEFPqAXq8BHf4PBKCn05Ymv+LhONcBlLDpHUEs pmqQ== X-Gm-Message-State: ALoCoQkC92P11lHdFf71yqSfWPn8ECU5JyiWNor+pmJ75/p83AcYF1hrazA1IIco8FnO0jrqShqM X-Received: by 10.236.207.164 with SMTP id n24mr3927129yho.5.1404227617305; Tue, 01 Jul 2014 08:13:37 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.36 with SMTP id 33ls1871517qgg.19.gmail; Tue, 01 Jul 2014 08:13:37 -0700 (PDT) X-Received: by 10.58.165.106 with SMTP id yx10mr45356613veb.17.1404227616999; Tue, 01 Jul 2014 08:13:36 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id xq1si8855415vec.20.2014.07.01.08.13.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Jul 2014 08:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so9183196vcb.10 for ; Tue, 01 Jul 2014 08:13:36 -0700 (PDT) X-Received: by 10.58.182.234 with SMTP id eh10mr1175211vec.41.1404227616895; Tue, 01 Jul 2014 08:13:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp222463vcb; Tue, 1 Jul 2014 08:13:36 -0700 (PDT) X-Received: by 10.66.150.228 with SMTP id ul4mr60886843pab.16.1404227616193; Tue, 01 Jul 2014 08:13:36 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ag5si27343141pbc.9.2014.07.01.08.13.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jul 2014 08:13:36 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1zjF-0008IK-HV; Tue, 01 Jul 2014 15:12:17 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1zj4-00080b-4h for linux-arm-kernel@lists.infradead.org; Tue, 01 Jul 2014 15:12:07 +0000 Received: from leverpostej.cambridge.arm.com (leverpostej.cambridge.arm.com [10.1.205.151]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s61FBMwq008167; Tue, 1 Jul 2014 16:11:27 +0100 (BST) From: Mark Rutland To: will.deacon@arm.com Subject: [PATCH 2/8] arm: perf: add macros for empty event mappings Date: Tue, 1 Jul 2014 16:11:12 +0100 Message-Id: <1404227478-9645-3-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1404227478-9645-1-git-send-email-mark.rutland@arm.com> References: <1404227478-9645-1-git-send-email-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140701_081206_594214_507F06A5 X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mark.rutland@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 We currently map from userspace-ABI standard event numbers to hardware-specific IDs by use of two arrays, *_perf_map and *_perf_cache_map. While we use designated initializers to initialize the events we care about, zero is typically a valid hardware event number, and thus we have to explicitly initialize unsupported event mappings to a nonzero value ({HW,CACHE}_OP_UNSUPPORTED). In the case of the *_cache_map, this requires initialising almost every entry in a 3-dimensional array to CACHE_OP_UNSUPPORTED, requiring over a hundred lines to add eleven supported events in the case of Cortex A9. So as to take up less space and make the tables easier to deal with, this patch adds two new macros to initialize every entry in these tables to the *_UNSUPPORTED values. Supported events can be overridden individually through the use of designated initializers. Signed-off-by: Mark Rutland Acked-by: Will Deacon --- arch/arm/include/asm/pmu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h index 748d20d..0b648c5 100644 --- a/arch/arm/include/asm/pmu.h +++ b/arch/arm/include/asm/pmu.h @@ -51,6 +51,16 @@ struct arm_pmu_platdata { #define C(_x) PERF_COUNT_HW_CACHE_##_x #define CACHE_OP_UNSUPPORTED 0xFFFF +#define PERF_MAP_ALL_UNSUPPORTED \ + [0 ... PERF_COUNT_HW_MAX - 1] = HW_OP_UNSUPPORTED + +#define PERF_CACHE_MAP_ALL_UNSUPPORTED \ +[0 ... C(MAX) - 1] = { \ + [0 ... C(OP_MAX) - 1] = { \ + [0 ... C(RESULT_MAX) - 1] = CACHE_OP_UNSUPPORTED, \ + }, \ +} + /* The events for a given PMU register set. */ struct pmu_hw_events { /*