Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6730835rdb; Fri, 15 Dec 2023 07:01:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlirD1Sg957abWk73ME9HHWhZyj1wi5ZVML/XyJK//hDWO+B8YbWpkffFck00vMrpmwqpF X-Received: by 2002:a05:6808:2dcf:b0:3ba:d2b:18db with SMTP id gn15-20020a0568082dcf00b003ba0d2b18dbmr10844687oib.119.1702652509074; Fri, 15 Dec 2023 07:01:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702652509; cv=none; d=google.com; s=arc-20160816; b=y85bbLFq8nHUJL4Nxm9BeZVOw/F9w4LfjyfR68CXxJbWca+CppDOonAJzXAGki+OO6 JhEI1Shx1xU9niEbqf0Dcmsmjs7TU+kzyx1AXlOQahzk/gKcScHIj4B9rydFaWNuEpTG XZnjYWZB5bbpC855EqXGj2gAJgYloVxVMwW35X9nnQg+w1CfDNvqbUmxKTJpUv8hQzyV WJSU5CWyFLbBrCIJrEVHU53pxg9sJUvQpda+tcuKVoSHA/teVu4Nm6W5gp8GYKBipJ6C Vins6AelTbCmaU85tuU+ZvU5A5BOH1EskH0yi4dp4i6rkUVqKM9mk9Eq8HrWOHLJ+1Pg tJkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=MCLYy479XZrRHMe5RI2613QrCj0wVoI+h3A/rVRsyaY=; fh=95cIsxSwRu1fZDhCbyI/OBlE1l7om1YMXeTvJwX2oGE=; b=RX4k6qVjwwmb5CXAVy5Z9QrsJzRfmRPXo50kOxskM9m1JDu5s37AdhoAL0VzsvnvP2 RWZVVtOq7Q3y0EWokr7JPA2oWKAcWkd9J5/PJWsmbJpGLIAVn0W5BRdS6BHythFfmWcw lh5qQx3jR5PvD4aZZpIpYVybtenYG7aG1XcnXrivfZlzjK4LfI/naEqy9X55Fy3dr+HD TSgWhnwhXodV3Hp3HcdbtaiSg1aK/YGBJ7lvdFiE8YHEXtxb8izkoN+o0eJMGV7VZzn8 v/zTxIivIaYBRGRzceSfbhJXJz7An5NHE0W3RVbGjfUJ2ySODo8jnM/cxtmhDqd69UX0 pRnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1145-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j17-20020a67fa51000000b00465fe4bbef5si2936596vsq.670.2023.12.15.07.01.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 07:01:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1145-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1145-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C69D21C23A12 for ; Fri, 15 Dec 2023 15:01:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57CD137163; Fri, 15 Dec 2023 15:01:11 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DD803714C; Fri, 15 Dec 2023 15:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA28CC15; Fri, 15 Dec 2023 07:01:52 -0800 (PST) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BB2853F5A1; Fri, 15 Dec 2023 07:01:04 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-next@vger.kernel.org, will@kernel.org, u.kleine-koenig@pengutronix.de Cc: James Clark , Mark Rutland , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Anshuman Khandual , Suzuki K Poulose , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 2/2] arm: perf: Fix ARCH=arm build with GCC in armv8pmu_set_event_filter() Date: Fri, 15 Dec 2023 15:00:39 +0000 Message-Id: <20231215150040.3342183-3-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231215150040.3342183-1-james.clark@arm.com> References: <20231215150040.3342183-1-james.clark@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit LLVM ignores everything inside the if statement and doesn't generate errors, but GCC does, resulting in the following: drivers/perf/arm_pmuv3.c: In function armv8pmu_set_event_filter: include/linux/bits.h:34:29: error: left shift count >= width of type [-Werror=shift-count-overflow] 34 | (((~UL(0)) - (UL(1) << (l)) + 1) & \ Fix it by changing the if to #if. This results in an unused function warning for armv8pmu_event_threshold_control(), so suppress that too. Fixes: 816c26754447 ("arm64: perf: Add support for event counting threshold") Signed-off-by: James Clark --- drivers/perf/arm_pmuv3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index 3ed2086cefc3..8aa23878019a 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -338,7 +338,7 @@ static bool armv8pmu_event_want_user_access(struct perf_event *event) return ATTR_CFG_GET_FLD(&event->attr, rdpmc); } -static u8 armv8pmu_event_threshold_control(struct perf_event_attr *attr) +static __maybe_unused u8 armv8pmu_event_threshold_control(struct perf_event_attr *attr) { u8 th_compare = ATTR_CFG_GET_FLD(attr, threshold_compare); u8 th_count = ATTR_CFG_GET_FLD(attr, threshold_count); @@ -1040,11 +1040,13 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, return -EINVAL; } - if (IS_ENABLED(CONFIG_ARM64) && th) { +#if IS_ENABLED(CONFIG_ARM64) + if (th) { config_base |= FIELD_PREP(ARMV8_PMU_EVTYPE_TH, th); config_base |= FIELD_PREP(ARMV8_PMU_EVTYPE_TC, armv8pmu_event_threshold_control(attr)); } +#endif /* * Install the filter into config_base as this is used to -- 2.34.1