Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp193821lqe; Thu, 4 Apr 2024 04:08:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXpowNP/ZKRhLrD6TG3SNKgIhZPPfIWYV8LriI2rdL3vdVh1eZuTWeJMPf7hwTgog3oqN/XbxddEaewYivD5wsVazic1NSB731RJ4vHbw== X-Google-Smtp-Source: AGHT+IESjPlxmHJu7wucvePoED24hKYoJuWH19hgM6l2kMOiCcObM8mRz46HBI3XkDe7ePJvxsPS X-Received: by 2002:ac2:5a1c:0:b0:516:c594:a073 with SMTP id q28-20020ac25a1c000000b00516c594a073mr1469301lfn.68.1712228930295; Thu, 04 Apr 2024 04:08:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712228930; cv=pass; d=google.com; s=arc-20160816; b=djOIaA+F3WP4LG2uK8FuWzUucezm3wcSpXW7tdJK5HvFhyyKATEkPD6GITwWvxomlG +TYlefa+gUvA3Var5L/JhDcdKoIDy7hEgTCc7TPdHA1TBx5VekB87JUCgpW3DuW69vpt abwTHHgfZLMNKnLtQfW87+TOzRISlMekC6AL/juRAGGeTR2NvsNlDwTNxuj2ukgvULzc 3FeFzcJ/dS2cFUZTyG5jdPh39xGj58ZA61X6Y/n87vAC7pVn2gI/YV7rLNRydJAoBW5R d273Z08mRdzAOYOI/1SqW5VPoQ+lZ2X6d7H8de5xC37SqguHowbKFRsp+EsUQXo/r52R /LPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XHYX+6wGVMHeamknM7Pg3k7ckv45aX0Tuc02oE5EGZo=; fh=Lk7//7iNkscH6+8djnyDUCq/yshm8ZrpGXdrKVOEVdI=; b=D/7Yk8orBadN9o11GgnEY3+yE1c9JscWkUNVbL/8ze9Pum/a5hfKFMda9Ws+BJ6WKB VYfwoQPsVt7v7OTRP/YzSvagAknh5t88xMLQWpefNPb4d8KzdsyIWCzpn+IEuSlMr33w A1TmpHz5bQlxs/PT1zLarGKaw4IASV96IfRqXL1vws4gUkGQ5QXd+m9NerdUu18ZF8Vq YrsYcyZmVpSSWWFfFqqHSKARI/rKLVGRFiYVNg0VVLjOBM4ZeEj/QsghO0APG4cV9auw E9RZbakRTVHUURbboJKljPeNZ455nAkZsxr36m34KgFDn0aZLsOd59sKuZAJ3LnmKYzH HESw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="Ljr/OXND"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-131292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131292-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id x4-20020a50d604000000b0056c2a86f522si7565851edi.147.2024.04.04.04.08.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 04:08:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="Ljr/OXND"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-131292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131292-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5188C1F26C47 for ; Thu, 4 Apr 2024 11:08:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4005811E0; Thu, 4 Apr 2024 11:08:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="Ljr/OXND" Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 F2C8280C09 for ; Thu, 4 Apr 2024 11:08:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712228897; cv=none; b=sCYFc/BBDIQz0zjSQfioX1bunqMAXa6pcZbD4OpXneVM4AwbzvVtNMlV1XOLhpsHVcQGlcZpD3eN9Fyh6dgTneIaFk6ZHzDOuGY7vDA74U1GaIQwekDY1RO1SpCA1kJGerhVV3XuEwzmXuLABWScUX8mOi9vAyq2HaIpIuIXlBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712228897; c=relaxed/simple; bh=b9wRAhDeshh10P0TwW9VE8z5e9tGLWnK8X6agCj/Bog=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZmpgmUQeWcULepfKb9YO5qK2zJgI23AnkND/6gDwM6WE+j/ZLRqBDKWgmnGZ9Glcr27slw89SircLOaMXZYqnR9QXQnREjzykta+6DBY3qR7Se1YC1xHFMeLXfebD9slEa+O61DxXmcs4bvaznFGx1tsB8jszpNKfZifKZ+7YGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=Ljr/OXND; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-56c404da0ebso1274904a12.0 for ; Thu, 04 Apr 2024 04:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1712228893; x=1712833693; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XHYX+6wGVMHeamknM7Pg3k7ckv45aX0Tuc02oE5EGZo=; b=Ljr/OXNDGzjYOiaQxhA+bampXnP/a0zzgX8djTEcpnYD5MMa8TCllY0+SuaGIef6jC 5Dh5qxge8IqQ1hA+WwGIZ9dhlzwLwM/AIPeuSEniF+HwnPCJWITHvN+Zz6Og6eWxa9k3 opMoPwdF14N8oSJXDrztnyACRIWz9i/GLLbzn1kCY9SfV1qpFlqFFUI69z4fkApErNOy SlTNj57frpvFIF2ayzph9yNevGe/CUqaQVBYxVk+Yi++jbb3IZxLpXmPkatcOsYIVLa7 Pi0vUHxCtVOtH7wegMrfckbOU9i9LkzCYmDAc3I6Of9bQAtvKamm5XOxpMXV5CBZmuGn cP7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712228893; x=1712833693; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XHYX+6wGVMHeamknM7Pg3k7ckv45aX0Tuc02oE5EGZo=; b=RaXCK23nzia0zym+W1TzUE5aoxurd0eR/mzpGYZPqBs9oxfXBj7qfrxO/HtKZjY3Ph Xki53AvzaoY8Z96HkA2RkBCTy8WGh9I4m5YtGG1YRE+VxbLrKMHYIjWatPIs7YeyOIoD c6uNoNolbBWCQWdumOLoUsxG/IUduJYfBJbaG4aoS8ScPgD16bbWDOoqmgVgnsvluuAd i7TR9tBSHsqrh4wcjFv0uGu/aRolXm9Swb2we9doUwxizsPhfftziOccFJfRKgJDo075 WvLi+GE4R/DTi8kgbGgU0zYXEgiAlQOia0VWOFNfe3F/BFubiaggT6nGXvQsWjxbm+eU VBZA== X-Gm-Message-State: AOJu0Ywjn5nEJpxwn1d5oc16/KHERdyNITDj1zqCNT9vXznHt8FUWMgt VeShnddktC3nM1HG6sdMHpRvozkcq9Qdl1y/MImo2gdvH2vtl5e2Z1pr2tlM9iA= X-Received: by 2002:a17:906:a02:b0:a4e:2d69:e379 with SMTP id w2-20020a1709060a0200b00a4e2d69e379mr1481920ejf.4.1712228893383; Thu, 04 Apr 2024 04:08:13 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id xh12-20020a170906da8c00b00a4e579ce949sm6017903ejb.51.2024.04.04.04.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 04:08:12 -0700 (PDT) Date: Thu, 4 Apr 2024 13:08:11 +0200 From: Andrew Jones To: Atish Patra Cc: linux-kernel@vger.kernel.org, Ajay Kaher , Alexandre Ghiti , Alexey Makhalov , 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: Re: [PATCH v5 04/22] drivers/perf: riscv: Use BIT macro for shifting operations Message-ID: <20240404-9a84f2090d00f6b994e1de7c@orel> References: <20240403080452.1007601-1-atishp@rivosinc.com> <20240403080452.1007601-5-atishp@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403080452.1007601-5-atishp@rivosinc.com> On Wed, Apr 03, 2024 at 01:04:33AM -0700, Atish Patra wrote: > It is a good practice to use BIT() instead of (1UL << x). (1UL << x) isn't generally a problem. The problem is with (1 << 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 > Other than the commit message, Reviewed-by: Andrew Jones Thanks, drew