From patchwork Wed Apr 3 08:04:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Kumar Patra X-Patchwork-Id: 1919160 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=NpMC9VOe; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=M7K05KuR; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=G0ohviLE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8fMN3Fjnz23v5 for ; Wed, 3 Apr 2024 20:19:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GaszWw17O/TWdKqVgQ61aw2EMo9h6oDn0hjqXY/GptU=; b=NpMC9VOes9Axw7 9ptwgz3AZonZztaIRH7Ys55hJUnJd9sZAfikMl0DlcAAbSgofDRKbmpC4zYrYDD7ZhdsSSaWOYNiJ edW/AX7Is9NDk2yaRpK2DCM5vK0LVeJuOzNN5MgVJ1KbHHy2hasE0tWeDijQUMQJ0INxIIDkdnzyI zeUi+h8FM4w9L/AUeHrR0BFmmh4WcuqBmGtWIoJVNn0hoOoE3Nop6+oAVZZWDwvzM/ajHQJ2HNseu Bl7vCnVSetsyTynlgmxouVLJZ4vFXMjHSiERyPO4y3rf5ZnkjzW9uLMT/e5oigOa8SXpFGTcep292 sqYTtc5x/KKUjPso5b4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrwly-0000000FAF3-3f04; Wed, 03 Apr 2024 09:19:10 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrvci-0000000Eieg-2xXH for kvm-riscv@bombadil.infradead.org; Wed, 03 Apr 2024 08:05:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Ixjc/2duOe8tMNsDFapztE6WZpMRR0IqMx2Riyo3ljE=; b=M7K05KuRjuFwVS2jErIyv7IfaV l9hET2zsPs/BYeb9R90b7e5fRLv8pXKBK/J9HIqJyT25kVsNp9DDZIwBxIkH+FmGdrb3Kpa7eFU8O J0VMMgXhQ7NrzWTGO/Q9433XKjzN8IqXxCuXipFvfqIg8ECxHnB8enEjk+bWiqaC2OPmIkZP0wkCs XFATFcVMJYVKeHtg72NyklUTRbD7c1FefdhpG9QG21sGyhjeUaE5KsmuIAxN77PzTNsQ2PyEjYBjq ZUsVecL7c+qSECD664xhxhshoE3G6SKZYx3EY+e70bDPZKY8/FY2mGQpfO+rO+ZD9Rz/pHTrY5JQW GMG1WWSw==; Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrvcc-000000055aT-23Me for kvm-riscv@lists.infradead.org; Wed, 03 Apr 2024 08:05:31 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e0bfc42783so51159675ad.0 for ; Wed, 03 Apr 2024 01:05:24 -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=lists.infradead.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=G0ohviLEEgf8tDNO3f33IBySIf0w76rtSPWvnlkaIKHUn3CGMSFjPS8cdkkpBp4guZ qFeGXxnZlamNA5r9nHpviI0WWSRRpEBBdA9Z50iH8YHENNfbFGDRNoydV8f9Fm1pNUoh INJfR4kpHcHF24yfG9xU/T03TzycQFb+uCfqu7hkUgdQ65U5WXy5iFYucvG9LjvPoQKc T7wvwVwYc4tu7GyNI2uxIOHCNk+tpEneEa6+IFHhz2U63fHQKqwpZNfnhXhZll9iHCF7 4q9lP0FVtZyE5Wn9fsaBsVlkHZCqbb+cLd5HmCp0IyIXyHAyMkkRiSWAd9coedKVPAJq W+tQ== 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=C1yrpMsbFkGpmaJXWKjCXxkjlsfmiaDPqUb60To9N0VGFDFJPpugUI8uz7fP+HxdM8 +WLfSMakqUgK+Cly6/pbcizgfuizKZKjhHCEEeOqBl14bDxrjXmnAukca4CF3BGV5CMM YcePzgtjWTHubLtxSg59EbG9oJ17tUSBudXojWqUNyOrEpEIvd+SoBJ2fBfnS94ml6jZ G9VwXeQixqsJj6UlzMjJ/jU6kpDpDux0Th1HGb5U2G+2++tidRqPSII3QIcsC5Vpb7Jm 8w5xmQpWw1UXqDmTqj2xJOVzQ7MKiJpCVeQZJBOPn5URy9KWenunus+i+0AiN1cCXLmZ VXwQ== X-Forwarded-Encrypted: i=1; AJvYcCU+MK8e9VeDA2UV/lW3DjCnQ6vztJe89MATo4O+TvcM6ysTxiCMW3qxNgX2jqzZCrUC6uWL8Mu2Ax+Ssp2CwBGR7+K3IBCJ+/XzFWUVsg== X-Gm-Message-State: AOJu0YwYEoCVG/o+hUq9REFn2MIgQK33X89rEPCxSjNkMSIhEIt0wCox +y990w4lZz8cB28YnC0OJr+OS33Sv0L2aOGXZ9x+vGZfW50QUKxNcU4Vjf+L+eQ= X-Google-Smtp-Source: AGHT+IFNP2TORKh7//FzhNMEZN9MBNitQSqhLOnah919WVqeHY+e2MYv0jsRIRUc8mtVSGHiLEDhcg== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240403_090526_542941_F2B75EF8 X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 4.0.0 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:62e listed in] [list.dnswl.org] X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It is a good practice to use BIT() instead of (1UL << x). Replace the current usages with BIT(). Signed-off-by: Atish Patra Reviewed-by: Andrew Jones --- 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); } }