From patchwork Thu Feb 22 12:50:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Chauhan X-Patchwork-Id: 204754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp230660dyb; Thu, 22 Feb 2024 04:58:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWNhAJTPVe1cxOGTuBwtqpREQ6NABnfi0jpGYxZIdhlUWjAxJNyOXenI4Mpg9d9UrMlMS/STpOjeN3YJlXQ8EaCzZkWcQ== X-Google-Smtp-Source: AGHT+IHZWovs2r3sgq8h2lcH6D8hB7okCrSUHUHa+7gnEJIWk3l5el+wbXqtdMOdtBXt8cftF12y X-Received: by 2002:a17:902:cec2:b0:1db:4941:f703 with SMTP id d2-20020a170902cec200b001db4941f703mr24453202plg.15.1708606708362; Thu, 22 Feb 2024 04:58:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708606708; cv=pass; d=google.com; s=arc-20160816; b=ulSUf1AT2mFBP2dV4SajHvqoR2l7qL6E2MeIwMu2nJMukX+kVJM8gHMWsjOAMr2U4d i4XGy3NicwkhmLdWJBU/+BfoBAlKjeZhxDLN/jaN6Sh9ePckDBUH9CLpPEFrY6zkZTjq HdSQjiaIm4AXymlF6ozOdG/Bsu7ExI5a2hkMjmokYiSwdLuuloCx9RQbwEv5/5fzx6L4 l4J3scBIp4WmkTnHODThbhS92QHI7yiuIEOjSp7hS1F4u+E8RE6Kfv3mlzFhHLEUzjYt rdx1VaAwngffS6rAWAIJf9Latm7IyW/TxvIKnvXadGDmbFqV0uCmefdddyRBhEsUJUiM Zn8Q== 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=JuwAWrKDu1e5t4umhFsz7T/5diX1pTYK82qJWje4hkM=; fh=81w2t0sLuJtUhfg+NrHBUtI9lphtpiSMVQyb1B+/6gE=; b=GIddsruhqCVOZJZXoQFX9I77CUpw3xG1HMlkv8ju0fWbfryU5TZbD4KSmZUmVy60MG I/wkVl7X+RT7dq0Yv86qCQFPqK3XQV8ZPK7PIITja/eG2ixG5MXGmb2o14RvZyX9mdu4 jp+VmlTshRAbsNv8opctjwVNhqKfh5Gr3ScT+CewC6go1AG0etNmNxpFcrOsPLCtTVYZ JIm0YaCgf21YcqetAquiskpFCqp3+UUUpWuhWoxDvYtA8yRtnYzlqRdWvMZ26Nuu18yk 8cEYKhzfAvaWBY9cv01sa8FwLIDJGyZ+aoFbvNQ9T5K/vbJdJtsh+IQOjrlSQwJGp0I8 mVMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=fRmnCmkj; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-76544-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76544-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j14-20020a170903028e00b001dc3dfe9f86si2342562plr.220.2024.02.22.04.58.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 04:58:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76544-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=fRmnCmkj; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-76544-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76544-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C4C1DB25BF6 for ; Thu, 22 Feb 2024 12:51:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F0E7133408; Thu, 22 Feb 2024 12:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="fRmnCmkj" Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 9101112E1E7 for ; Thu, 22 Feb 2024 12:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708606268; cv=none; b=qSitMRq7bnLy9VlSTPz6wPW0z8QDTSXT8culCb+iHxX1YCk3XasH1frG0bCj3XBHIR86hiTjKkXeDJZ5ylPurrVyqU3cCJCFYSll239K3+Z0hHz+QElQplh3GoT7Pj5NqJKVJGDorqioNLna/3YteqXmaDYaem/tTgHJLz3g7BA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708606268; c=relaxed/simple; bh=IyrCjU0IHdunFur8vK+GmkbMCbRfKC8f8kABYQiXC8E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BpOCKPzJlaDf8xDS9gUhkGKPmtCd/85dQdhdKgXPkbX57CK2n1eZFWoCyS7VBw/cqlJpm01U8zzKuW/Z5oSMFXBgETZa2ulfvp3bm+JpOcMnkUwzKZ60h5inP8wW6lSPQvs7fWJ9nszEr/xF12Q9wJKyBOMGZulRFsKAFzv1nMo= 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=fRmnCmkj; arc=none smtp.client-ip=209.85.215.170 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-pg1-f170.google.com with SMTP id 41be03b00d2f7-58962bf3f89so2325967a12.0 for ; Thu, 22 Feb 2024 04:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1708606266; x=1709211066; 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=JuwAWrKDu1e5t4umhFsz7T/5diX1pTYK82qJWje4hkM=; b=fRmnCmkju/sLBMmNqNB/COirjt2ps3VJexDgeX3SubcIjxeGSludpsIQRhpie784Kj ZTD9Pnmtt09AJC+GLKsYpRqJnwx1u10NxR6pOpVirOywLVfx7HaKV2XlwIgGQWFiUu2E JFGLdigA7fooQDS7qoubSdCMMFtwXT9E5xi/KpKqTFLTeu4YAt/GSnREsf70Q5y3pq4j iP9mBtDC2t1u5WSZwTbPRzIToD8ifxAS5xDA7Vr/RiFPnZicz/5h/gvjQpr9xGAVov2s xI90/7xybMX4ASqHbKK8MjuK3dgaERiPb6I3JaCKahWoRVDPK5jPi74oC2QtPHCBd/3g v/5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708606266; x=1709211066; 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=JuwAWrKDu1e5t4umhFsz7T/5diX1pTYK82qJWje4hkM=; b=a5squsf+7r5iFcsOgBzIN8hSEBkg5cRfjTquBBkjZqC0KC5zRc0ani/HPA1WxC+8iR QRvuQcSA+Lb1TQ6iTZ6vzcry+zuy6Oq1whZYp/7zG2TlKEu0eK5YBSr2TH0J+pxpQkgm TIK7cU9xzFFE2/Sdlaywz7QnHRli2awhVimSUNGqaE9b55b0+/3mllwYJVsHeqKHjIPK hFuesZvWio1u3JqV4zWAXOE6M+qewRK17k/84kJnpaJEzr3J2iwHJr9q0JlSV6NtYDIe LyZ7h5Ym3SeyHnFAMgFcQWOds38PEJoTXL3zK0KL+DNy25LfAn7RcEDw4ubvls497L16 bq0Q== X-Forwarded-Encrypted: i=1; AJvYcCVaKyn8AoUjnyvIsbkgPz+HiA6NMyX4iU8aafOQyOfXyWaHLUeCqUAeZS3iuSX8RtTZr2YNpOfgjUQdt0uq/XTPTKdw0E0yZCEHZjR1 X-Gm-Message-State: AOJu0YxYw39TI8ln8FUWmZmLtNMeWagnJyUh8wgf9s+iBh4R2SDuZ64v cwnFn9CTfVWnbKwSTZcKmJdIPQhDQllZBg7jwwzUWSu70SCDVVxoXfVW2695mXJopUDXCf8J0NJ y X-Received: by 2002:a17:902:ed05:b0:1dc:51ac:88ef with SMTP id b5-20020a170902ed0500b001dc51ac88efmr1056056pld.6.1708606265710; Thu, 22 Feb 2024 04:51:05 -0800 (PST) Received: from aryabhatta.. ([49.37.248.155]) by smtp.gmail.com with ESMTPSA id k5-20020a170902e90500b001db7599aba0sm9898438pld.24.2024.02.22.04.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 04:51:05 -0800 (PST) From: Himanshu Chauhan To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Subject: [RFC PATCH 1/2] riscv: Add SBI debug trigger extension and function ids Date: Thu, 22 Feb 2024 18:20:58 +0530 Message-Id: <20240222125059.13331-2-hchauhan@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222125059.13331-1-hchauhan@ventanamicro.com> References: <20240222125059.13331-1-hchauhan@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791603988167261446 X-GMAIL-MSGID: 1791603988167261446 Debug trigger extension is a proposed SBI extension to support native debugging in S-mode and VS-mode. The proposal for the extension can be found at: https://lists.riscv.org/g/sig-hypervisors/message/361 This patch adds the extension and the function IDs defined by the extension. Signed-off-by: Himanshu Chauhan --- arch/riscv/include/asm/sbi.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 6e68f8dff76b..e79ff1a2f387 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -34,6 +34,9 @@ enum sbi_ext_id { SBI_EXT_DBCN = 0x4442434E, SBI_EXT_STA = 0x535441, + /* SBI Debug Trigger Extension */ + SBI_EXT_DBTR = 0x44425452, + /* Experimentals extensions must lie within this range */ SBI_EXT_EXPERIMENTAL_START = 0x08000000, SBI_EXT_EXPERIMENTAL_END = 0x08FFFFFF, @@ -124,6 +127,34 @@ enum sbi_ext_susp_sleep_type { SBI_SUSP_SLEEP_TYPE_SUSPEND_TO_RAM = 0, }; +/* SBI debug triggers function IDs */ +enum sbi_ext_dbtr_fid { + SBI_EXT_DBTR_NUM_TRIGGERS = 0, + SBI_EXT_DBTR_SETUP_SHMEM, + SBI_EXT_DBTR_TRIG_READ, + SBI_EXT_DBTR_TRIG_INSTALL, + SBI_EXT_DBTR_TRIG_UPDATE, + SBI_EXT_DBTR_TRIG_UNINSTALL, + SBI_EXT_DBTR_TRIG_ENABLE, + SBI_EXT_DBTR_TRIG_DISABLE, +}; + +struct sbi_dbtr_data_msg { + unsigned long tstate; + unsigned long tdata1; + unsigned long tdata2; + unsigned long tdata3; +}; + +struct sbi_dbtr_id_msg { + unsigned long idx; +}; + +struct sbi_dbtr_shmem_entry { + struct sbi_dbtr_data_msg data; + struct sbi_dbtr_id_msg id; +}; + enum sbi_ext_pmu_fid { SBI_EXT_PMU_NUM_COUNTERS = 0, SBI_EXT_PMU_COUNTER_GET_INFO,