kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Atish Patra <atishp@rivosinc.com>
To: Anup Patel <anup@brainfault.org>, Will Deacon <will@kernel.org>,
	 Mark Rutland <mark.rutland@arm.com>,
	 Paul Walmsley <paul.walmsley@sifive.com>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	 Mayuresh Chitale <mchitale@ventanamicro.com>
Cc: linux-riscv@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	 kvm-riscv@lists.infradead.org, Atish Patra <atishp@rivosinc.com>
Subject: [PATCH v4 3/9] RISC-V: KVM: Add support for Raw event v2
Date: Mon, 21 Jul 2025 20:15:19 -0700	[thread overview]
Message-ID: <20250721-pmu_event_info-v4-3-ac76758a4269@rivosinc.com> (raw)
In-Reply-To: <20250721-pmu_event_info-v4-0-ac76758a4269@rivosinc.com>

SBI v3.0 introduced a new raw event type v2 for wider mhpmeventX
programming. Add the support in kvm for that.

Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
---
 arch/riscv/kvm/vcpu_pmu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c
index 78ac3216a54d..15d71a7b75ba 100644
--- a/arch/riscv/kvm/vcpu_pmu.c
+++ b/arch/riscv/kvm/vcpu_pmu.c
@@ -60,6 +60,7 @@ static u32 kvm_pmu_get_perf_event_type(unsigned long eidx)
 		type = PERF_TYPE_HW_CACHE;
 		break;
 	case SBI_PMU_EVENT_TYPE_RAW:
+	case SBI_PMU_EVENT_TYPE_RAW_V2:
 	case SBI_PMU_EVENT_TYPE_FW:
 		type = PERF_TYPE_RAW;
 		break;
@@ -128,6 +129,9 @@ static u64 kvm_pmu_get_perf_event_config(unsigned long eidx, uint64_t evt_data)
 	case SBI_PMU_EVENT_TYPE_RAW:
 		config = evt_data & RISCV_PMU_RAW_EVENT_MASK;
 		break;
+	case SBI_PMU_EVENT_TYPE_RAW_V2:
+		config = evt_data & RISCV_PMU_RAW_EVENT_V2_MASK;
+		break;
 	case SBI_PMU_EVENT_TYPE_FW:
 		if (ecode < SBI_PMU_FW_MAX)
 			config = (1ULL << 63) | ecode;

-- 
2.43.0


  parent reply	other threads:[~2025-07-22  3:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22  3:15 [PATCH v4 0/9] Add SBI v3.0 PMU enhancements Atish Patra
2025-07-22  3:15 ` [PATCH v4 1/9] drivers/perf: riscv: Add SBI v3.0 flag Atish Patra
2025-07-22  3:15 ` [PATCH v4 2/9] drivers/perf: riscv: Add raw event v2 support Atish Patra
2025-07-22  3:15 ` Atish Patra [this message]
2025-07-22  3:15 ` [PATCH v4 4/9] drivers/perf: riscv: Implement PMU event info function Atish Patra
2025-07-22  3:55   ` Anup Patel
2025-07-22  3:15 ` [PATCH v4 5/9] drivers/perf: riscv: Export " Atish Patra
2025-07-22  3:15 ` [PATCH v4 6/9] KVM: Add a helper function to validate vcpu gpa range Atish Patra
2025-07-22 17:20   ` Sean Christopherson
2025-07-22  3:15 ` [PATCH v4 7/9] RISC-V: KVM: Use the new gpa range validate helper function Atish Patra
2025-07-22  3:15 ` [PATCH v4 8/9] RISC-V: KVM: Implement get event info function Atish Patra
2025-07-22  3:15 ` [PATCH v4 9/9] RISC-V: KVM: Upgrade the supported SBI version to 3.0 Atish Patra
2025-07-22  3:59 ` [PATCH v4 0/9] Add SBI v3.0 PMU enhancements Anup Patel
2025-07-22 13:17   ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250721-pmu_event_info-v4-3-ac76758a4269@rivosinc.com \
    --to=atishp@rivosinc.com \
    --cc=anup@brainfault.org \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=mchitale@ventanamicro.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).