Message ID | 20240416184421.3693802-6-atishp@rivosinc.com |
---|---|
State | Changes Requested |
Headers | show
Return-Path: <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> 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=1GlSHPa1; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=UWBtDd11; 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=Zk9n2R0P; 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 4VJvff0tV6z1yZh for <incoming@patchwork.ozlabs.org>; Wed, 17 Apr 2024 05:46:00 +1000 (AEST) 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=J/0O0SSp9eqp71e6pPTn410WMVXQKYL9xNuykJEsnxE=; b=1GlSHPa17QXLri d3/jHWVaO0yFBBNt7DiIKA3EXxcw6wEZb6UUwarGDEHHGkrHAIHMMbMOs8xgyszAIZaQvxoUSMVok e+ZOyQEnnzmOeGZPnQvSU0QE00vlHuY09ECZoIaM+neT/uPsxQss2/VmXOpybdSNIZ4NhewIsU1O6 8C0+wCmiESwWcOgoWprthIGS8T7zpYRZYTpIFhSNj09FKaTrGKDZWG3whmohFmvzq6KlHAJO7ScAh DPjbx3tJTK0pCvHwmEZtUrJGvoBvR1ojBUWeK+c/eBlEr+DZHDll/wCCQIOOM4IXkLrVdwynulBHQ HvqO+NknndVAZAkWcjkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwokh-0000000Dag4-0tHC; Tue, 16 Apr 2024 19:45:59 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwnnh-0000000DMNi-2MuN for kvm-riscv@bombadil.infradead.org; Tue, 16 Apr 2024 18:45:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=Y0lXa0RA4+kQWkomLRJk1QW7kf666EFgaJ2j58l79bA=; b=UWBtDd11Fj+PDFrfuL8x/0d2OM zbh3r2Xn2AIw0efrO8ybJJ8wyYv+1XAenmTXhDxToa5GBXKQW3OO+PweEppwmsuTpqFkgnFENdmGU VZvJvkGXI6g3yZ1nyxchh+62+OxKusDS9E8v30bb3bme5YTUpq1vfCzdBCV6rjPy2rtqYcBdCR8oZ 1X8ifZfVoEBY8mbpcL/FmUqH9jbrAtXqkd6vXnWAiC3ADGZfNNHUpAebcH82y49yJ6+57I94cBQSg IjwKbKjcZUFVp5P+HiS6mXYztsug3TCnP4A3Wg3eTR4R5CIMsMLXnFzFsGYZi4kGwtIu5ZnYho9Ql 8uwO9tug==; Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwnnd-0000000BCDz-3UWu for kvm-riscv@lists.infradead.org; Tue, 16 Apr 2024 18:45:00 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6ee0642f718so48697b3a.0 for <kvm-riscv@lists.infradead.org>; Tue, 16 Apr 2024 11:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713293088; x=1713897888; 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=Y0lXa0RA4+kQWkomLRJk1QW7kf666EFgaJ2j58l79bA=; b=Zk9n2R0PmZHyW03QVgL7AasUCD1D0xAUPFdjTdpllN1liPDc7UbQ0kT/0AXrXby/Wq mT4eVqYr43Vf+u65cF1jfnFmj5Zz9u1ROg8dQBr3v7uRnlhGqAec2GyrQCbH9uV6mA1Y NAU1MyuVgqs6DTV4JlwhzkYMW1nWVi72ryHpfaIbUx4SQFSQsbEwlaSVB5ks2O76vXxW aeA3pjK4hPw4MO6TOD7pEGNF+hnAl6CmmieVbwtPvIOlrUizRsvYwq8F1BBo6ZTn/F7u JreFLMOhPkNSjAgnEP5eUYEH/tnovGpu7JMpnwLQON5Y7eXpH26rjSHD7of728eJB7x6 /4pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713293088; x=1713897888; 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=Y0lXa0RA4+kQWkomLRJk1QW7kf666EFgaJ2j58l79bA=; b=StiL0mAh/dpRX3j9cacZUbbV73D6eMny9h7xb13SLJDQWTf6OpMOxI+elGks/4wQLt nW6RP1i6waY4SaZbhEKhsOwvXgpcp0ZWyAB58TFJ5weOdiemX01XX04UOO2YvPxWGTm9 vpN0cbq15655a1Vr+EamlIVx5HS7kImIuOcSaCkr/YdcxlnnGnYdwI6RlmjUf4kXzP69 BPK/u2j5BrYXflSfDl/4gaA8G92Ke0J8g3oqXNKHCj6ApdECsRY5ZCoctlLYXCYddfVn XI1d21PjCOHKI0ixWAvL44au1jBrqQxqVRtgGKN88KgN9C57k1e47w4+A5pVFLA4rlF2 WPqw== X-Forwarded-Encrypted: i=1; AJvYcCXK36mJQVwwCKehX+Q+dFx/vRDHK6wKw2ltoRmwCbeT6J7gLOXeBusvyfadZkoy5lqwtCuxd0GxGUJ/al78ZxORiUYnaW3EaSkNPubCGQ== X-Gm-Message-State: AOJu0YzMUR25z2lXcjn0eoEGD8KHz9u/Yi7pqASGB/hfa1jrQDHiHMdZ kxHphDB8xsfDawKFkgHIM7UVwjfCTerbHxBt4WQm69MIma1X+MOwTSTdzmWxT4E= X-Google-Smtp-Source: AGHT+IEy4ZrQc6VpWHcofWnBnFX841IYpr0DACATgSN6h23DP3YRcVds0NngKjdBNkuEvrMjPFCw+A== X-Received: by 2002:a17:90b:4c8e:b0:2aa:b56b:5bdb with SMTP id my14-20020a17090b4c8e00b002aab56b5bdbmr3174156pjb.9.1713293088546; Tue, 16 Apr 2024 11:44:48 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id o19-20020a17090aac1300b002a269828bb8sm8883645pjq.40.2024.04.16.11.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 11:44:48 -0700 (PDT) From: Atish Patra <atishp@rivosinc.com> To: linux-kernel@vger.kernel.org Cc: Atish Patra <atishp@rivosinc.com>, Andrew Jones <ajones@ventanamicro.com>, Anup Patel <anup@brainfault.org>, Palmer Dabbelt <palmer@rivosinc.com>, Ajay Kaher <ajay.kaher@broadcom.com>, Albert Ou <aou@eecs.berkeley.edu>, Alexandre Ghiti <alexghiti@rivosinc.com>, Conor Dooley <conor.dooley@microchip.com>, Juergen Gross <jgross@suse.com>, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland <mark.rutland@arm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Paolo Bonzini <pbonzini@redhat.com>, Paul Walmsley <paul.walmsley@sifive.com>, Shuah Khan <shuah@kernel.org>, virtualization@lists.linux.dev, Will Deacon <will@kernel.org>, x86@kernel.org Subject: [PATCH v7 05/24] RISC-V: Add SBI PMU snapshot definitions Date: Tue, 16 Apr 2024 11:44:02 -0700 Message-Id: <20240416184421.3693802-6-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416184421.3693802-1-atishp@rivosinc.com> References: <20240416184421.3693802-1-atishp@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_194458_314951_E185C52C X-CRM114-Status: GOOD ( 11.57 ) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: SBI PMU Snapshot function optimizes the number of traps to higher privilege mode by leveraging a shared memory between the S/VS-mode and the M/HS mode. Add the definitions for that extension and new e [...] Content analysis details: (0.0 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_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:429 listed in] [list.dnswl.org] X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <kvm-riscv.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/kvm-riscv/> List-Post: <mailto:kvm-riscv@lists.infradead.org> List-Help: <mailto:kvm-riscv-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kvm-riscv" <kvm-riscv-bounces@lists.infradead.org> Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
RISC-V SBI v2.0 PMU improvements and Perf sampling in KVM guest
|
expand
|
diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 4afa2cd01bae..9aada4b9f7b5 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -132,6 +132,7 @@ enum sbi_ext_pmu_fid { SBI_EXT_PMU_COUNTER_STOP, SBI_EXT_PMU_COUNTER_FW_READ, SBI_EXT_PMU_COUNTER_FW_READ_HI, + SBI_EXT_PMU_SNAPSHOT_SET_SHMEM, }; union sbi_pmu_ctr_info { @@ -148,6 +149,13 @@ union sbi_pmu_ctr_info { }; }; +/* Data structure to contain the pmu snapshot data */ +struct riscv_pmu_snapshot_data { + u64 ctr_overflow_mask; + u64 ctr_values[64]; + u64 reserved[447]; +}; + #define RISCV_PMU_RAW_EVENT_MASK GENMASK_ULL(47, 0) #define RISCV_PMU_RAW_EVENT_IDX 0x20000 @@ -244,9 +252,11 @@ enum sbi_pmu_ctr_type { /* Flags defined for counter start function */ #define SBI_PMU_START_FLAG_SET_INIT_VALUE BIT(0) +#define SBI_PMU_START_FLAG_INIT_SNAPSHOT BIT(1) /* Flags defined for counter stop function */ #define SBI_PMU_STOP_FLAG_RESET BIT(0) +#define SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT BIT(1) enum sbi_ext_dbcn_fid { SBI_EXT_DBCN_CONSOLE_WRITE = 0, @@ -285,6 +295,7 @@ struct sbi_sta_struct { #define SBI_ERR_ALREADY_AVAILABLE -6 #define SBI_ERR_ALREADY_STARTED -7 #define SBI_ERR_ALREADY_STOPPED -8 +#define SBI_ERR_NO_SHMEM -9 extern unsigned long sbi_spec_version; struct sbiret {