From patchwork Tue Dec 5 02:43:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Kumar Patra X-Patchwork-Id: 1871796 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=g47eblyD; 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=PxTXVBQl; 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 4SklGV6bnXz1ySh for ; Tue, 5 Dec 2023 13:43:46 +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=fURjebUGdJ6wRe9E63KVhQk/ZquUU3ipU5eBrgQV6+k=; b=g47eblyDq9NFHE Zw2sLsejKif0mBUDQW8taD559hABq//fCXvKgNRoKBMJa1sgV7cvFahFK80PkjM6t3mbX/E3NfF5O K3OTRgQ3lGkoJJETz+KzwvOmGB5/FFDmBiYgHzAuHKkpso63dy8ixCBCg/JcZ/hA051beloFmqVuX dVaXWP4XueklpIbppMVhM3IE7od7TeSR+obqxuQxSeXPrqZSwDHg5UCH10rwhdfK+aEi5zQmW/FQa GX2kSDc7c6jcDnXo0Vzm0hbtyGfUSIUhdASKwdl7TFQJD/l+JXlBPxYSU6mTOjevOxGw9eo+0jQ+p aG+NSZYB/Q57f6xTV6rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rALPT-0063zi-0W; Tue, 05 Dec 2023 02:43:43 +0000 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rALPM-0063sl-0F for kvm-riscv@lists.infradead.org; Tue, 05 Dec 2023 02:43:38 +0000 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6d84ddd642fso2807712a34.0 for ; Mon, 04 Dec 2023 18:43:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1701744213; x=1702349013; 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=ESe2+H6xRcIvQHZC4sCC1Ujc/nu3bNcuHE36+amdpNs=; b=PxTXVBQl4dXBKQl63oEHeaZ/QEss3HAMGGsldKwDAPNCqSaPjtGBbF0f81CsMsRv5D zHOtrK+PNA6VLs55vNVLLjYAfgW7tOGTQD49mb9gKX1bL9tP368R6/Oa6aFq8lErSWAr Jmez8uDpmTAJpdSuXPCIg/yMBBJyw0gwK3X17jsKa9tyr3HGi7p+L7ScWk+AlGxBRGAV aCuv/44Zg3WDQ8K+P4TZmL2Egwbrnp/m7fIbYypoNO32bdUfsvowXxV9FKUuGcG3ctHB uevjqnXyRkGLfUA7CJZL2QAuaRSK6f9INypcrjVlsUafvPgt+xFIGtnZ4hpEl3ObuyHu 2p/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701744213; x=1702349013; 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=ESe2+H6xRcIvQHZC4sCC1Ujc/nu3bNcuHE36+amdpNs=; b=YPDjfm2clK0zm7fXfzSgA1268yMXDvWdTZQx1+aqkIrlenfkNaq+BF55SqTSqNTcsV NcCkmeB5roXxhy3s2+ZfABwPSuHezSRussOMnt5jO1wzEXMLubQlJoHrF33i8oiHnlhh vrYH7E1PFIB4Ba5/ycGFKQe8DdNiNnyFCDKCRb7UumMHoPVCJFR/8mJ10jC2x9/YfX+3 fuyzUX5SVo/fYRiILgbQlS/O6xTJCp8rCOh48zdKqFvBaeD5UaWHNm6H0J/meDTP6MNv HtsqnwXP0AaU2wi6g1Jt0swxBrDF24QY02I2HneoBbVa05g7NZnd4XOBfWn0n1gjFJKJ zi1w== X-Gm-Message-State: AOJu0YxN8SzjR6aca2H/NqvWOwl/Es+VmR4lorDtaKqFcIuru9kCUWHg lXupZMxCset7CWtZX6G+AvdU5w== X-Google-Smtp-Source: AGHT+IGEgSVldCBVjabdNWyXSrgKexmOSpdOUxfqb+i3/FDPH6nx8GslbA4iHobHadY6ni/KUBPIug== X-Received: by 2002:a9d:748b:0:b0:6d9:9ef8:84b7 with SMTP id t11-20020a9d748b000000b006d99ef884b7mr2852315otk.26.1701744213065; Mon, 04 Dec 2023 18:43:33 -0800 (PST) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id z17-20020a9d62d1000000b006b9848f8aa7sm2157655otk.45.2023.12.04.18.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 18:43:32 -0800 (PST) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Alexandre Ghiti , Andrew Jones , Anup Patel , Atish Patra , Conor Dooley , Guo Ren , Icenowy Zheng , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paul Walmsley , Will Deacon Subject: [RFC 2/9] drivers/perf: riscv: Add a flag to indicate SBI v2.0 support Date: Mon, 4 Dec 2023 18:43:03 -0800 Message-Id: <20231205024310.1593100-3-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231205024310.1593100-1-atishp@rivosinc.com> References: <20231205024310.1593100-1-atishp@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_184336_374867_1131198A X-CRM114-Status: GOOD ( 10.02 ) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.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 v2.0 added few functions to improve SBI PMU extension. In order to be backward compatible, the driver must use these functions only if SBI v2.0 is available. Signed-off-by: Atish Patra --- drivers/perf/riscv_pmu_sbi.c | 5 +++++ 1 file changed, 5 insertions(+) Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:32d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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 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 SBI v2.0 added few functions to improve SBI PMU extension. In order to be backward compatible, the driver must use these functions only if SBI v2.0 is available. Signed-off-by: Atish Patra --- drivers/perf/riscv_pmu_sbi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index 16acd4dcdb96..40a335350d08 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -35,6 +35,8 @@ PMU_FORMAT_ATTR(event, "config:0-47"); PMU_FORMAT_ATTR(firmware, "config:63"); +static bool sbi_v2_available; + static struct attribute *riscv_arch_formats_attr[] = { &format_attr_event.attr, &format_attr_firmware.attr, @@ -1108,6 +1110,9 @@ static int __init pmu_sbi_devinit(void) return 0; } + if (sbi_spec_version >= sbi_mk_version(2, 0)) + sbi_v2_available = true; + ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_RISCV_STARTING, "perf/riscv/pmu:starting", pmu_sbi_starting_cpu, pmu_sbi_dying_cpu);