Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2554904lqz; Wed, 3 Apr 2024 01:09:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+DvMngXgYRv0cIKPMMZgIK0Oeb68qUkHiDfo7mhVzURUsXCV1YnP/oveFm11mEgLlGONHa8PsR02uBxKBTfYfS/xqKko8L2QHEiqnXA== X-Google-Smtp-Source: AGHT+IEfFX1Vr82sH/HJ1G7DVS7ZpbFeI4QKMnzlOc5tz6+InKBSeiWNN7HCCHDrLAUZnb6rI3mB X-Received: by 2002:a17:90b:19ce:b0:2a2:8fb1:f89a with SMTP id nm14-20020a17090b19ce00b002a28fb1f89amr1654288pjb.11.1712131754888; Wed, 03 Apr 2024 01:09:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712131754; cv=pass; d=google.com; s=arc-20160816; b=YkY7vVuknXv4jdzMfyjjU3LUvZi9tvfAE+l0wXkniTkIK8wj4JFazICC3Fj8cFyB9d 5st4vScfpKsYRs8g3naCpsWUY7DBPPIyFrdLj61gJfYQUmVadT0kX1/pvtQa5TJvnWDO WyIS9LNN13T+iHJyPB/YakqG9SKiFSG8tHV4jvA+upgtVXErRtZZfgpVW7M5XS0DR7Hu Pk3pQYCEeB8dl2Wb+fX9PSR+bdJfTmlhpUwOd7VPvpbzgVoucOsh0Vrm/Gzj8tC6La1E 2cvymaC64znxgI8+n3rQ/+AtvX0++aj8od1M3qlzvloNO+Fo/LZyrL65a2Sx2UyyNcrg LNEQ== ARC-Message-Signature: i=2; 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:dkim-signature; bh=Ixjc/2duOe8tMNsDFapztE6WZpMRR0IqMx2Riyo3ljE=; fh=iEgamv6dbODmscQv2wzZN1BSfdyVgGmpVc4xUNBH9RU=; b=o+ebfXx6G5LuzGE010E+5K5sS1Znbm9c4UgMrtoURgP9M8ddd701NlS70Qngxv73Fh wn+3HJoTVdEQomZ+47QhLtA2MpwMhDkBGHHk8lvtLSftwzypnARTgVvt6C4t9vP6iPFC cfxxAU5+9/qRDhf4WgFFTCsK0qHSgbtn0vhVD3tVGW++tBSInhE/KUwJVcu87ubDWPZ+ jccmeeIpc4GZRbc2FvyAVoL2YtjwP9M78JW6NtfM1jJZMjeQpfQzq+Bi4fO3Fx5Xf/LC og9UADcmYIqWsgtokhuKXjOStlnAyc3EqHSfZZ4zJu/g5BDd2Y8c3zh0s4hIFC8LCvNb UUnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="OdCJtUm/"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-129244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129244-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y4-20020a17090a1f4400b002a2b016ba65si34530pjy.65.2024.04.03.01.09.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 01:09:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="OdCJtUm/"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-129244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129244-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A48C428B26C for ; Wed, 3 Apr 2024 08:06:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5020671B51; Wed, 3 Apr 2024 08:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="OdCJtUm/" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 003FD71B3B for ; Wed, 3 Apr 2024 08:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712131523; cv=none; b=TBJ8ciYCy2wYIxHHfPJEqEAnJZwM3xkA/Xg6xH7ctusCNJTlpNUnoeNA/GtcNdRv9pYWtgNwzbiJwkECXSJny0xi/RGCL9Khzh6A7sTHQwo0X3EXKQH1WgedR2EvgggoxzWEU9Z6+N+tuEBMu0MDDsbc3hX8/8xH2Yv7FG/yPR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712131523; c=relaxed/simple; bh=IeCUKxpOMKG0zL7LcLS/wH2lWaOxpIfM9zaAAyQj4Uk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bPmVSorNmFHxXeo9XP67lA3rRBXcQuWajYzHK5nzSyP/L629mtTcl08IXFcsALTTWHZIySKXniSu9Emjy+qjhZ9Ru33x++nuU0IvE/g8e8AlL4su9cH3oXy255Efuu5Hon3dh3ideZFSLPCNiWNav4waP/4kN7u1QsCQxoRC2FA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=OdCJtUm/; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e0d82c529fso51751645ad.2 for ; Wed, 03 Apr 2024 01:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712131520; x=1712736320; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ixjc/2duOe8tMNsDFapztE6WZpMRR0IqMx2Riyo3ljE=; b=OdCJtUm/TnCsKRq0tOayzDsxkmSlAE4FjEpJQ8e4FvpENOjnl6jwWVCrlwrgStP4zL AKlz3P/CLAem4ptLrNY6j0UaCbQqAbfvKQ6u8qMnfN50cRknOPKxAa6FyBCn5zVQYG1W EcMpRnWm2kHkgkpEAHc5xIwmNgVAINAVvJ0g2zxWgw1sfPBOis1sYIQJNdIGQUSadp/F 2WkDKPYY6YDOwvrioJDD36yGUs0aoegshj5HvZie4Uy3uXFovDk7heQZa4hOJfsWGW20 e/cWfP2ScDyVwCxu7mAjRNoKhvFrQbfRApoN1NXz/sViPapNAeAhJCBIY9CxfCFtkLtC cFFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712131520; x=1712736320; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ixjc/2duOe8tMNsDFapztE6WZpMRR0IqMx2Riyo3ljE=; b=FtLInM9gigQddtkwTS2Y6LyZWiiS1gYRTb8XHHl+2713Qh0ZWFM/0lJ1mqoCfl5iXi 1dl/VkXUg6yu0Uqvhclhq/K0Zzfz7lNVwq14cDm4YNqp03AlsZG/yyld4AbQTYD6wotV yhl14wVfOHp2OSDFtyP+9vWuPyf5WX1imeHq5r5zDtG7fgAOwq0TwmfkhtOw5rrJu0/S OTdP8/zuY1jXaIyxmHcfO8QaLMYtuJcQXpim6B5J6EqcoXSW1JhwXifl7ufRGh8sIdMf dkTtt/fvOmhYdk3Eb64NMsuan0LwdJ/f5i9EOmxjBaiSb7+QmwsvGjOKtUQOXmnsBuHO dLdQ== X-Gm-Message-State: AOJu0Yybb12ppFPhkWFCpIwJcUoZCNrMtmWKeKDKD3csgPd/0OxbObVz YE6AURTkPoLQ4jxK9gBHnV7DYgY8rFau7hS1iiLUeN/RW1GvrwOcbNTRRdHK7MfW5jMKrLOsu/b A X-Received: by 2002:a17:902:b701:b0:1e0:a1c7:56fd with SMTP id d1-20020a170902b70100b001e0a1c756fdmr13300312pls.61.1712131520248; Wed, 03 Apr 2024 01:05:20 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id c12-20020a170902d48c00b001e0b5d49fc7sm12557229plg.161.2024.04.03.01.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 01:05:19 -0700 (PDT) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Ajay Kaher , Alexandre Ghiti , Alexey Makhalov , Andrew Jones , Anup Patel , Conor Dooley , Juergen Gross , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Shuah Khan , virtualization@lists.linux.dev, VMware PV-Drivers Reviewers , Will Deacon , x86@kernel.org Subject: [PATCH v5 04/22] drivers/perf: riscv: Use BIT macro for shifting operations Date: Wed, 3 Apr 2024 01:04:33 -0700 Message-Id: <20240403080452.1007601-5-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240403080452.1007601-1-atishp@rivosinc.com> References: <20240403080452.1007601-1-atishp@rivosinc.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 It is a good practice to use BIT() instead of (1UL << x). Replace the current usages with BIT(). Signed-off-by: Atish Patra --- arch/riscv/include/asm/sbi.h | 20 ++++++++++---------- drivers/perf/riscv_pmu_sbi.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index ef8311dafb91..4afa2cd01bae 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -233,20 +233,20 @@ enum sbi_pmu_ctr_type { #define SBI_PMU_EVENT_IDX_INVALID 0xFFFFFFFF /* Flags defined for config matching function */ -#define SBI_PMU_CFG_FLAG_SKIP_MATCH (1 << 0) -#define SBI_PMU_CFG_FLAG_CLEAR_VALUE (1 << 1) -#define SBI_PMU_CFG_FLAG_AUTO_START (1 << 2) -#define SBI_PMU_CFG_FLAG_SET_VUINH (1 << 3) -#define SBI_PMU_CFG_FLAG_SET_VSINH (1 << 4) -#define SBI_PMU_CFG_FLAG_SET_UINH (1 << 5) -#define SBI_PMU_CFG_FLAG_SET_SINH (1 << 6) -#define SBI_PMU_CFG_FLAG_SET_MINH (1 << 7) +#define SBI_PMU_CFG_FLAG_SKIP_MATCH BIT(0) +#define SBI_PMU_CFG_FLAG_CLEAR_VALUE BIT(1) +#define SBI_PMU_CFG_FLAG_AUTO_START BIT(2) +#define SBI_PMU_CFG_FLAG_SET_VUINH BIT(3) +#define SBI_PMU_CFG_FLAG_SET_VSINH BIT(4) +#define SBI_PMU_CFG_FLAG_SET_UINH BIT(5) +#define SBI_PMU_CFG_FLAG_SET_SINH BIT(6) +#define SBI_PMU_CFG_FLAG_SET_MINH BIT(7) /* Flags defined for counter start function */ -#define SBI_PMU_START_FLAG_SET_INIT_VALUE (1 << 0) +#define SBI_PMU_START_FLAG_SET_INIT_VALUE BIT(0) /* Flags defined for counter stop function */ -#define SBI_PMU_STOP_FLAG_RESET (1 << 0) +#define SBI_PMU_STOP_FLAG_RESET BIT(0) enum sbi_ext_dbcn_fid { SBI_EXT_DBCN_CONSOLE_WRITE = 0, diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index babf1b9a4dbe..a83ae82301e3 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -386,7 +386,7 @@ static int pmu_sbi_ctr_get_idx(struct perf_event *event) cmask = 1; } else if (event->attr.config == PERF_COUNT_HW_INSTRUCTIONS) { cflags |= SBI_PMU_CFG_FLAG_SKIP_MATCH; - cmask = 1UL << (CSR_INSTRET - CSR_CYCLE); + cmask = BIT(CSR_INSTRET - CSR_CYCLE); } } -- 2.34.1