Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2554340lqz; Wed, 3 Apr 2024 01:07:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrAjFpmU5/AwK+05PwcbQ8IhFhyClM1Ae21avkdHqkM882+H4yvI1YyFPUNw/MHofTC7gdnOQN1GeMkDHo9wBuRBfM7Rp157G3ETp7cA== X-Google-Smtp-Source: AGHT+IHRezDV6NwKwHQcpSEvZdMt2ID2t7YxmQsiDEnLL1WhUXY1Qvf2Sex5Wo26JtElT3DVeEfS X-Received: by 2002:a17:907:1043:b0:a4e:703d:12a2 with SMTP id oy3-20020a170907104300b00a4e703d12a2mr5656395ejb.52.1712131663813; Wed, 03 Apr 2024 01:07:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712131663; cv=pass; d=google.com; s=arc-20160816; b=Wl6xje3VReRGVSCevnLxDU9VorjisQ/t3ip8rTV7ObbX0tXDG+FrVQ5U7qCcBGKorC yVIys7pdoITjQaqvgUypnDdz9bwwsMJnXm99GJhlXbg0xQ/XJQQDFTrw9lNK8aN9LeZz wTK3r5pTXilFORgxxksWncXgREhiBzLswFRkE4tnP3H7xv+OWFFaUoUIP1ui5R4ePfZ4 jqHwzguTIU1PuBaYvF/BJjV5CMpmkwpIviR4kXY5u1CxtxpoKcmWSVOacrvf1mhXT+fj 9MHRHMx5xEujgpb/ED9a6a1cNQRzS9TCYokOxpIQLOcmnWJybvh/kFUaUwpUuUT1gpXR r+Rw== 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=2HMUEh/ouJpwrjadx4E8ELJ1oGZIEAqlVNHNOiveHPA=; fh=iEgamv6dbODmscQv2wzZN1BSfdyVgGmpVc4xUNBH9RU=; b=MX47NmYY3mfErywedcYIGnlGMeNebraZIdl8fBKnBp/OouVZRGzWOGlW250evDSMDo PiSsircihgumXAMW0tnOe1AI7ufBinaVksuYhuGfVTunUQ1eFE9pU/e1seWqBEkzuZO0 UJLts2HBtrPTeeKMjdL5Fm8jPlX4dYVJB7ADzvXFf6NR5YbrJL7+/Y87x98STNAlf62e AW3z1V767yaiiIjk1i9dJga6U2abqGs8CXkSJko5qUF8pbHop9GQr9AL+Ormu9utl1uu 5550AsyBg0rDKYOMOvTlbR3RmlxpkI9OqQFJHckWj7zXUTIKE93VKpBJSzscJ9YS3U+m Wfuw==; 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=TSeifkcC; 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-129248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129248-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hv17-20020a17090760d100b00a4e3d2896c7si4963348ejc.403.2024.04.03.01.07.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 01:07:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=TSeifkcC; 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-129248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129248-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 883741F24B45 for ; Wed, 3 Apr 2024 08:07:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1357D78B63; Wed, 3 Apr 2024 08:05:33 +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="TSeifkcC" Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 CD3576D1AF for ; Wed, 3 Apr 2024 08:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712131532; cv=none; b=ZEfuYtB/o8WQp+06YjenRgF7uGLdJ7IsM8HuCKAOFNGdt86doyhc7pOKylqczqOJ3WbMM65N2lwpxv8+isJkINooV6wMB/fI3VYqJ2owjuZUEOysjX4ksV+pqVbSydah35aStKbn2AdB4fzHkiSmMB5i9/4ZGL4sAuhWtAypDVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712131532; c=relaxed/simple; bh=qmTer1L5IWEJQe0rkUy5cvb4CMl5u/8y+hPoEZoMutA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zj81jhNmz9VaU9NulnnwqcDLFK6ipS73qzqV64K/hikpxbi/niwjWEE2ZvEtvxdoUHwDNamxpmzqR99GIddiHZx1VAqbg30vb78vqHAq64W8qsPB0//8Ct0qY+Gm6vhhgQfyCiHsaJTyhnoA5O8VCz4Dnx5xD4Vk3o4e9k8g32g= 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=TSeifkcC; arc=none smtp.client-ip=209.85.214.179 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-f179.google.com with SMTP id d9443c01a7336-1e0411c0a52so51648385ad.0 for ; Wed, 03 Apr 2024 01:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712131529; x=1712736329; 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=2HMUEh/ouJpwrjadx4E8ELJ1oGZIEAqlVNHNOiveHPA=; b=TSeifkcCVel9tg4BDxNqVioc8wG9MlkoJ3zjDFmQ42yLVyPQQ8/t+ga6mhJbasv/cw kdJkdlohOprTHDTHFncMalAz2OKXkpESH3KiBcjPJ3O0ROPYzDMLNerLFiJXwcaURbUe 3mI2ilSR2OFLFlLOLX1B4cW/7jrw41WmIldFZwK2rPx7Q4ZzK6Bw97v8K/ZJs5yHr3TS 6SlM4sakMFvnbC9Gbl3qb8BFO+Y+NQVomRmg8WnYURs55sBXVKzOufTz7YG/ZqSp8MLp ZVpChGoH1VXBdxE7bFMf9Dp0wm1JhxgFxm0n5HeRKbSBSShB8oHiu3umukjLxijTUd35 srDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712131529; x=1712736329; 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=2HMUEh/ouJpwrjadx4E8ELJ1oGZIEAqlVNHNOiveHPA=; b=FJs1+8/ahjNP+76QCj6oI84FSkkQYcjXW2hF6ZADnno6I7wc0NktplpZEaz/LHXjnS KA4DuOBpiMnbp28Ogsl5ki5MmEUcffoFaV59z2OiTL+i2k3vG+p5ToItWR2AafUKHsX6 06x2+vgknvcEEmxganeGSjaaMYIvOVLeeJ4kPnHUhv+V4x03qY+hpFAcwuXVoZtBNQGO jxfjjt5Vh08tzWUmHn8XXK7jVfyzx09sDQlhpyG3tMwFAG8njCse1iN7iLNnvvQFPaYM GUD7d/x6DZOZ+dIYxvdtAVaI7JLKTLSlOGKtKgpSMoDp5TtL+854HzC7Pln1WyNjUl+M IPAw== X-Gm-Message-State: AOJu0Yzf+ddMuae206tRLTS3uvczUJri5+5nhYD6oP5q+HSsx0pkRw7i GP0ub43xMNybvKIFj0jCkBDZih5jLFOcKMzzpPmvKd0UfT8vi2pKjs/Wi4rdk8IbyzTho/A9Fyo 3 X-Received: by 2002:a17:902:aa04:b0:1e2:23b8:98dd with SMTP id be4-20020a170902aa0400b001e223b898ddmr14090965plb.69.1712131529484; Wed, 03 Apr 2024 01:05:29 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 01:05:28 -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 08/22] RISC-V: KVM: Fix the initial sample period value Date: Wed, 3 Apr 2024 01:04:37 -0700 Message-Id: <20240403080452.1007601-9-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 The initial sample period value when counter value is not assigned should be set to maximum value supported by the counter width. Otherwise, it may result in spurious interrupts. Signed-off-by: Atish Patra --- arch/riscv/kvm/vcpu_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c index 86391a5061dd..cee1b9ca4ec4 100644 --- a/arch/riscv/kvm/vcpu_pmu.c +++ b/arch/riscv/kvm/vcpu_pmu.c @@ -39,7 +39,7 @@ static u64 kvm_pmu_get_sample_period(struct kvm_pmc *pmc) u64 sample_period; if (!pmc->counter_val) - sample_period = counter_val_mask + 1; + sample_period = counter_val_mask; else sample_period = (-pmc->counter_val) & counter_val_mask; -- 2.34.1