From patchwork Sat Aug 10 17:57:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Raphael Tiovalen X-Patchwork-Id: 1971165 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=EzlrRHol; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Z823oj4w; 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 4Wh7mc228Lz214q for ; Sun, 11 Aug 2024 03:58:05 +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=DSXzE+6vLfJHDp1XL25qKxbiD4H6H/J7tjd56g6OYq4=; b=EzlrRHol9KUgnj LvsH78w5yrMGWaHdR9taLEKC9gwNd0SxYhwHfjMCaAycs2KvY8zyda+ne7lXjJMDlj/Bkd5ebAUCD iuOdw55nIVFhLVs7no1sajrQ0ci9YnuLKT9B+Wp7lZs6LhLywgKNp/kByrxN6FdoeXDCRToeWkrML KBpnSQoxqUwt4ovfaV2PGusXPoNwF4wlVC66aal/8D7O2cwES/he3bpa2+6SZR29/LvimMEA9i0xr mR9v39of2GsSzLVORGx/+FMHZN64IMsLw9223TAB5wPg1RKQhKz5HA8h4894Wo0L8R1iWstSn37h+ lxczAxO4jcxnXF8mNSZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scqLo-0000000EPUs-1maA; Sat, 10 Aug 2024 17:58:00 +0000 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scqLm-0000000EPU9-03Yh for kvm-riscv@lists.infradead.org; Sat, 10 Aug 2024 17:57:59 +0000 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-5d5c2ac3410so1738905eaf.2 for ; Sat, 10 Aug 2024 10:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723312676; x=1723917476; 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=iiA15RK33yxGQEASjv70VGn8cOt9t5t1YvCkcvYjpkE=; b=Z823oj4w0p8JrPntrGuzP/VryN6QHkDeb1atYvxg5lXwrCCCxXS6eyqK4grQd/C+Vb Nf1mW8k+HzqlvSoaorZkaVO42hjCOTxxGnGh5vFqxk43BFBZX4t1ca0W18wzY7XdEaAA VJ3sJoqddR5sneFQSEwYMgFbL/s56eC0f80DjHBCCZ23SbsIjcbNW8OXvBgNNeOPbKhr D81qxg62rNZY8RQ5omainmiKPmv786o0IyqbsZHr2T5PHiQaOUIwhzTpqEeTvt09pOSB hvX2wrGC49PU3Sj6qC6O35xBj8IMabJkEqistUtFmnZuzNXDsfvg/+udf09dNrXyiMT+ ny6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723312676; x=1723917476; 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=iiA15RK33yxGQEASjv70VGn8cOt9t5t1YvCkcvYjpkE=; b=eCoj7Y1SqHbqghhQNTIgYEyx2WhY080Gc2v0X9xV9DTnUGKe+U0l0orh0wjS7vvqsW uytEnSGSZc8n07cBprYpIovbZ3cOpvuahZlkjo7It4vjy+/pxqTeJbQBC7oUxDIS/dMs Hh3htx2tQmXHfB2VtLXCo6+a9SXMwEiKyG9YitpPQsu558Z82KjHhrcr/QLLtb4ipJe1 YKLIWqJJHvxEah8cHjj64Z++6m3kejjlQ6m08XlBevcWq3hw6DbNugZpbMLaZD0WDZDI 2pGw8OmG8w0LVlDojXPFM28zxVpW8NfjQUilCtFFCAFXarkjgBy5vaCHlWMqutd4k4gb +/fg== X-Forwarded-Encrypted: i=1; AJvYcCUYkaH3XSheW11Men8WI0qLNocaEMjM05yN+2nxETH+bMBwMfrGhuI/dFBBI/oMwNRa/owWALhr+oCtYJJvPY+m/oliIOa2aUgbfYoo9Q== X-Gm-Message-State: AOJu0Yz1EtNUvnJBMzBE4WhLevPaeayo7OUv5KSghpZZ6+9Iu6zkNzBI gQWTfGtSJCrDYNgWcSBOU34ORbbM+sJSs9FhQ7z4zA0HbG9hdXuK X-Google-Smtp-Source: AGHT+IGbN0SZVioxgikEcVEwDqZXvdNl0JP1tlVCLXDpQQD9CzT9J7DYjcIlMkWmiAh5mL0WMKmrOg== X-Received: by 2002:a05:6358:886:b0:1a5:a3b3:ada7 with SMTP id e5c5f4694b2df-1b177198480mr786746455d.25.1723312676190; Sat, 10 Aug 2024 10:57:56 -0700 (PDT) Received: from JRT-PC.. ([202.166.44.78]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-200bb8fd807sm14107795ad.80.2024.08.10.10.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Aug 2024 10:57:55 -0700 (PDT) From: James Raphael Tiovalen To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Cc: andrew.jones@linux.dev, atishp@rivosinc.com, cade.richard@berkeley.edu, James Raphael Tiovalen Subject: [kvm-unit-tests PATCH 1/3] riscv: sbi: Add IPI extension support Date: Sun, 11 Aug 2024 01:57:42 +0800 Message-ID: <20240810175744.166503-2-jamestiotio@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240810175744.166503-1-jamestiotio@gmail.com> References: <20240810175744.166503-1-jamestiotio@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240810_105758_072486_D4F603D4 X-CRM114-Status: UNSURE ( 8.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) 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: Add IPI EID and FID constants and a helper function to perform the IPI SBI ecall. Signed-off-by: James Raphael Tiovalen --- lib/riscv/asm/sbi.h | 5 +++++ riscv/sbi.c | 5 +++++ 2 files changed, 10 insertions(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jamestiotio(at)gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:c34 listed in] [list.dnswl.org] 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 Add IPI EID and FID constants and a helper function to perform the IPI SBI ecall. Signed-off-by: James Raphael Tiovalen --- lib/riscv/asm/sbi.h | 5 +++++ riscv/sbi.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/riscv/asm/sbi.h b/lib/riscv/asm/sbi.h index 73ab5438..6b485dd3 100644 --- a/lib/riscv/asm/sbi.h +++ b/lib/riscv/asm/sbi.h @@ -17,6 +17,7 @@ enum sbi_ext_id { SBI_EXT_BASE = 0x10, SBI_EXT_TIME = 0x54494d45, + SBI_EXT_IPI = 0x735049, SBI_EXT_HSM = 0x48534d, SBI_EXT_SRST = 0x53525354, }; @@ -42,6 +43,10 @@ enum sbi_ext_time_fid { SBI_EXT_TIME_SET_TIMER = 0, }; +enum sbi_ext_ipi_fid { + SBI_EXT_IPI_SEND_IPI = 0, +}; + struct sbiret { long error; long value; diff --git a/riscv/sbi.c b/riscv/sbi.c index 2438c497..08bd6a95 100644 --- a/riscv/sbi.c +++ b/riscv/sbi.c @@ -32,6 +32,11 @@ static struct sbiret __time_sbi_ecall(unsigned long stime_value) return sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0, 0, 0, 0, 0); } +static struct sbiret __ipi_sbi_ecall(unsigned long hart_mask, unsigned long hart_mask_base) +{ + return sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI, hart_mask, hart_mask_base, 0, 0, 0, 0); +} + static bool env_or_skip(const char *env) { if (!getenv(env)) { From patchwork Sat Aug 10 17:57:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Raphael Tiovalen X-Patchwork-Id: 1971164 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=M9/oVLTJ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Usg3Cj6P; 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 4Wh7mc0zXnz1ybS for ; Sun, 11 Aug 2024 03:58:05 +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=gozzSpmrAQsdA961mVdV9MmdrzcL4fYqNrVcaKLKteo=; b=M9/oVLTJstDgJH 7cyaWUwdG4GkEUDVxejja7iUkaBquwOYOecBmieQeAvFRHkF3zpvRCmgrsrEAolq8jpYMFx8ZhZtA K3ySm05AHaIg/9EOzqRCRr7JmOrgECgWJhQbcyB1xLkpSVUdlftfInRcteSwW6V/oEtAv66YW+Da6 XeJ0+rQoQDZ37J8ZL4EEUcnn6U0W7MTaS+WLrEIdXonH6z+TfEgLyKCfWCiVdvrNIts9tzEBKjfWZ 5Mbfca3LtGCt7J3NlG8zyOhO5rzeZl0vQen2jO1yDYH3Z0AkOjPSu+P13FFRGJ54NkA/iCvzv0vSS 8yJtuSVIuGZdG0Ugkbow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scqLp-0000000EPV8-3FKc; Sat, 10 Aug 2024 17:58:01 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scqLo-0000000EPUU-0IQC for kvm-riscv@lists.infradead.org; Sat, 10 Aug 2024 17:58:01 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1fc587361b6so27394605ad.2 for ; Sat, 10 Aug 2024 10:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723312678; x=1723917478; 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=1KdC7QAj8UGEG84hbd9Xp1hKDuMfF7N+5wk+gE4ItP4=; b=Usg3Cj6P0WSM6UL67FVtdSzwD2fpEZXu+bvJ+jxCrJBDypnrwrWgv4aceYEC2/RUZ7 WsEO+rA2lw+BCqQi5syNj5NyYD/0P4aVlNizRzD6VvhExuYoRnVzFthardazDd13A6/9 XY5+oYA1SuH9NUdBGlO84qeduAWQ7PajaMK50ErSNfMn8LiWG5qtzeFF+SwFKinovaa/ ZN/bCDFQVqj9JIPFjbILlo1uYpe4ziESKA2eiWajMZJ2RHZLg4s1gp8ce8iYIGdkbCzf ZoNpEBwMrO5MzIUQeZVi2OhYFaYaKn8lDkZQUaFSWZ8q4wpC+SbY86VlsYtbluuTOicX Aliw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723312678; x=1723917478; 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=1KdC7QAj8UGEG84hbd9Xp1hKDuMfF7N+5wk+gE4ItP4=; b=ChqHBugarGrSIhEJpUZ/33qWnwfUhJPaSBXtQuPCeSYhbKmoXQsUFkqhjmcA8+XQd0 hi+n1pRWDCt7NPuc+DDEBb4YTyPR49OVWdrw+flLkbS04QC76MtvZQfyssOd3rqx2a/2 I+nUHieqFaxJhcqmvx/ooDo69o9XP0PtJ6GMBRYExGQlqmEnecrFoR6tAtMFnYe24I5Z BZBOkAEp0bNnwpGfHOiEMicCyZ/UxKC6/2A/mMmqcLiPb5sqCb0+zOF3xn7ii3HczFiQ 3hivXES9MfTYuzktuh28xMC5YuT14tByd4qku1JMp7uzT0b8yzchjwous523F1jPx/NA pB1A== X-Forwarded-Encrypted: i=1; AJvYcCWn+VDbXru/1J+FOtcJyM7XUW7eevJ81785Czv6O0kRcnGuQBUP6B2egq2kAjMdwZTfoIm59/Zo5In9woSoWiGIztnJF8njN+xi6tHIhQ== X-Gm-Message-State: AOJu0YzcwZAK2YjVic8eJMXMhnbBHjcAmvTINhpCUJhXM8yJOXEjSHKI +MF0Jfj+XR7EvA5osHgkEzb6sVUW3EGdN/lMYCUbvgApX6xYN/yzRnAcX1AEP/s= X-Google-Smtp-Source: AGHT+IHVrOypvYV1MW9vb2n9/bazOsa95hpYdfsNODJrlBTaVVFNlwkdx6r6kQGjx6HyQd5JH3CG2Q== X-Received: by 2002:a17:903:11c3:b0:1fd:d6d8:1355 with SMTP id d9443c01a7336-200ae52c3e6mr56561595ad.17.1723312678278; Sat, 10 Aug 2024 10:57:58 -0700 (PDT) Received: from JRT-PC.. ([202.166.44.78]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-200bb8fd807sm14107795ad.80.2024.08.10.10.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Aug 2024 10:57:57 -0700 (PDT) From: James Raphael Tiovalen To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Cc: andrew.jones@linux.dev, atishp@rivosinc.com, cade.richard@berkeley.edu, James Raphael Tiovalen Subject: [kvm-unit-tests PATCH 2/3] riscv: sbi: Add HSM extension functions Date: Sun, 11 Aug 2024 01:57:43 +0800 Message-ID: <20240810175744.166503-3-jamestiotio@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240810175744.166503-1-jamestiotio@gmail.com> References: <20240810175744.166503-1-jamestiotio@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240810_105800_131097_8BCDDE25 X-CRM114-Status: UNSURE ( 8.18 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) 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: Add helper functions to perform hart-related operations to prepare for the HSM tests. Also add the HSM state IDs and default suspend type constants. Signed-off-by: James Raphael Tiovalen --- lib/riscv/asm/sbi.h | 18 ++++++++++++++++++ lib/riscv/sbi.c | 15 +++++++++++++++ 2 files changed, 33 insertions(+) Content analysis details: (-2.1 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:634 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jamestiotio(at)gmail.com] 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 Add helper functions to perform hart-related operations to prepare for the HSM tests. Also add the HSM state IDs and default suspend type constants. Signed-off-by: James Raphael Tiovalen --- lib/riscv/asm/sbi.h | 18 ++++++++++++++++++ lib/riscv/sbi.c | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lib/riscv/asm/sbi.h b/lib/riscv/asm/sbi.h index 6b485dd3..5cebc4d9 100644 --- a/lib/riscv/asm/sbi.h +++ b/lib/riscv/asm/sbi.h @@ -47,6 +47,21 @@ enum sbi_ext_ipi_fid { SBI_EXT_IPI_SEND_IPI = 0, }; +enum sbi_ext_hsm_sid { + SBI_EXT_HSM_STARTED = 0, + SBI_EXT_HSM_STOPPED, + SBI_EXT_HSM_START_PENDING, + SBI_EXT_HSM_STOP_PENDING, + SBI_EXT_HSM_SUSPENDED, + SBI_EXT_HSM_SUSPEND_PENDING, + SBI_EXT_HSM_RESUME_PENDING, +}; + +enum sbi_ext_hsm_hart_suspend_type { + SBI_EXT_HSM_HART_SUSPEND_RETENTIVE = 0, + SBI_EXT_HSM_HART_SUSPEND_NON_RETENTIVE = 0x80000000, +}; + struct sbiret { long error; long value; @@ -59,6 +74,9 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, void sbi_shutdown(void); struct sbiret sbi_hart_start(unsigned long hartid, unsigned long entry, unsigned long sp); +struct sbiret sbi_hart_stop(void); +struct sbiret sbi_hart_get_status(unsigned long hartid); +struct sbiret sbi_hart_suspend(uint32_t suspend_type, unsigned long resume_addr, unsigned long opaque); long sbi_probe(int ext); #endif /* !__ASSEMBLY__ */ diff --git a/lib/riscv/sbi.c b/lib/riscv/sbi.c index 3d4236e5..a5c18450 100644 --- a/lib/riscv/sbi.c +++ b/lib/riscv/sbi.c @@ -39,6 +39,21 @@ struct sbiret sbi_hart_start(unsigned long hartid, unsigned long entry, unsigned return sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_START, hartid, entry, sp, 0, 0, 0); } +struct sbiret sbi_hart_stop(void) +{ + return sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_STOP, 0, 0, 0, 0, 0, 0); +} + +struct sbiret sbi_hart_get_status(unsigned long hartid) +{ + return sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_STATUS, hartid, 0, 0, 0, 0, 0); +} + +struct sbiret sbi_hart_suspend(uint32_t suspend_type, unsigned long resume_addr, unsigned long opaque) +{ + return sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_SUSPEND, suspend_type, resume_addr, opaque, 0, 0, 0); +} + long sbi_probe(int ext) { struct sbiret ret; From patchwork Sat Aug 10 17:57:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Raphael Tiovalen X-Patchwork-Id: 1971166 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=poOGSCVO; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=IpQdUiSP; 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 4Wh7mc0vDSz1yXn for ; Sun, 11 Aug 2024 03:58:06 +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=Fi22qEpCabyAhzb9vwUluL6Iy6p/7g6s8/WCbuUmvvs=; b=poOGSCVOjMUYPO /3XTbWT8cPx+A2Wp/sz1xRw3gMu+0LY8A4cakZtLzZbAtBQPd4OELT0M64f8JJ+N+dpvFsGvYZ3k9 2tzJFXeTUYyn5fh2K+mPKBlO8vfJ/5PulLQIzaMuGiVfwtRA/z0ZBTfXlCiMaY3mcA+n5m/hdHwOt aFM4nV6UihRSGngGBPZa6ERqD/SfALgQIB83NUXwNeEEKAs/ulGw8mxhqyczAJH/E+fxkmjhbFa4T nI4FpCjB5EhADgFsn7tczuC1ylp6tjAUlHgG6aNCgoPV1HnvHF4+z9qB+8NRlb1+8x0Mz6moVGk6D jeel2EWMGJ1Voc8giJLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scqLt-0000000EPWo-0iZM; Sat, 10 Aug 2024 17:58:05 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scqLq-0000000EPV1-0xzz for kvm-riscv@lists.infradead.org; Sat, 10 Aug 2024 17:58:04 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1fd90c2fc68so24090885ad.1 for ; Sat, 10 Aug 2024 10:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723312681; x=1723917481; 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=e2p6NB3C17pR36FRexWR0vm1W1d93KFZ2wwtSTWw6vM=; b=IpQdUiSP9p3LAwwo39EwCIMsCRN9xecyulg3JKmXR2/shv97LkXzAARVQruPIT4U04 F8vt+QRnJW8qbC97gvScoabaTPbpwy64wr4qinVg9yAEDdW/EnkRgZPzjqYQ+5bBhEQh nFJFVsh6vm1zgH1FPSjCz65Dyxu9/hhR9+x3ayxEr+a6l0SJvRJUEdYgYJqFEzBdQrNw 2e5hWZzVvX1/iA6Etzgof6eyv3ezWO0cRVGpXVQl2z0i91qKNmYECxnNN0TSaBMpKjn6 2OgDaj7f+3kw+GJ+4N9dzwWZ9r1N8cJKEx6aucFZrntm4DXLWfJUFt4AJe0mMReydrPp JoBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723312681; x=1723917481; 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=e2p6NB3C17pR36FRexWR0vm1W1d93KFZ2wwtSTWw6vM=; b=I62WWhalOLdnYSqStgL9OBEmPF5QECpDKgdzRH/16h8vhq/h8PI9D5EYJNuThEPwc6 m27bzu0bFVTk3D6626i+RWpF4GJRGFstsFvzDHSTRG+pD9hCxvXwEYwhX1LIoG4pmUV8 E6b5IGY/PZ9qmI0n9kNwwqmXMU2cpquarOiRVn3SKj4n71Ig9ilkJsUsvgpuYBz3kNKb DjhqSDcjNJ8UFu+6U1am51facKkyqN9opx+s/Yro2zRRigHo8RFyjqZ01AcNMgOYxqKu NiTROdjvzM+gWRdmfOLM2h1mmZA69JkNTMXbaSSTF2olcb9W3iJwfk8+/1z0CTl4e+UU 72dw== X-Forwarded-Encrypted: i=1; AJvYcCWaGnZIT7WegjiOSD3T6YZbb+cfVPOedbK4+wxMsjG4jup+6JMLvCiJYHvm+rHO7FW+/jQ/imeOmj0Y/pWzDhiXw1dZlJbgbmRyeUj0dA== X-Gm-Message-State: AOJu0Yxmeto68FnI4mlhVoz+2ZoqJJkvwwUBJcxmO/TNctDJ41WeWDEK GE/7R3r9hlZI8aojwA/dJz39sfWEDyZxah7KDbm21MoUYAyj8SkA X-Google-Smtp-Source: AGHT+IElqHh91Ksc817pGfWsKO1UdrQCsbHoGKhToQLOjqlNuYsZCy6S2b2dSJ5rETju9IkahZ1b2w== X-Received: by 2002:a17:902:d48d:b0:1fc:6cf5:df4b with SMTP id d9443c01a7336-200ae5dc1e5mr48907885ad.49.1723312680441; Sat, 10 Aug 2024 10:58:00 -0700 (PDT) Received: from JRT-PC.. ([202.166.44.78]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-200bb8fd807sm14107795ad.80.2024.08.10.10.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Aug 2024 10:58:00 -0700 (PDT) From: James Raphael Tiovalen To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Cc: andrew.jones@linux.dev, atishp@rivosinc.com, cade.richard@berkeley.edu, James Raphael Tiovalen Subject: [kvm-unit-tests PATCH 3/3] riscv: sbi: Add tests for HSM extension Date: Sun, 11 Aug 2024 01:57:44 +0800 Message-ID: <20240810175744.166503-4-jamestiotio@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240810175744.166503-1-jamestiotio@gmail.com> References: <20240810175744.166503-1-jamestiotio@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240810_105802_300774_0DE3978C X-CRM114-Status: GOOD ( 18.93 ) X-Spam-Score: -2.1 (--) 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: Add some tests for all of the HSM extension functions. Signed-off-by: James Raphael Tiovalen --- riscv/Makefile | 7 +- riscv/sbi-asm.S | 38 +++++++ riscv/sbi.c | 280 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 322 insertions(+), 3 [...] Content analysis details: (-2.1 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:630 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jamestiotio(at)gmail.com] 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 Add some tests for all of the HSM extension functions. Signed-off-by: James Raphael Tiovalen --- riscv/Makefile | 7 +- riscv/sbi-asm.S | 38 +++++++ riscv/sbi.c | 280 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 322 insertions(+), 3 deletions(-) create mode 100644 riscv/sbi-asm.S diff --git a/riscv/Makefile b/riscv/Makefile index b0cd613f..c0fd8684 100644 --- a/riscv/Makefile +++ b/riscv/Makefile @@ -21,6 +21,7 @@ all: $(tests) $(TEST_DIR)/sieve.$(exe): AUXFLAGS = 0x1 cstart.o = $(TEST_DIR)/cstart.o +sbi-asm.o = $(TEST_DIR)/sbi-asm.o cflatobjs += lib/alloc.o cflatobjs += lib/alloc_page.o @@ -97,7 +98,7 @@ cflatobjs += lib/efi.o .PRECIOUS: %.so %.so: EFI_LDFLAGS += -defsym=EFI_SUBSYSTEM=0xa --no-undefined -%.so: %.o $(FLATLIBS) $(SRCDIR)/riscv/efi/elf_riscv64_efi.lds $(cstart.o) %.aux.o +%.so: %.o $(FLATLIBS) $(SRCDIR)/riscv/efi/elf_riscv64_efi.lds $(cstart.o) $(sbi-asm.o) %.aux.o $(LD) $(EFI_LDFLAGS) -o $@ -T $(SRCDIR)/riscv/efi/elf_riscv64_efi.lds \ $(filter %.o, $^) $(FLATLIBS) $(EFI_LIBS) @@ -113,7 +114,7 @@ cflatobjs += lib/efi.o -O binary $^ $@ else %.elf: LDFLAGS += -pie -n -z notext -%.elf: %.o $(FLATLIBS) $(SRCDIR)/riscv/flat.lds $(cstart.o) %.aux.o +%.elf: %.o $(FLATLIBS) $(SRCDIR)/riscv/flat.lds $(cstart.o) $(sbi-asm.o) %.aux.o $(LD) $(LDFLAGS) -o $@ -T $(SRCDIR)/riscv/flat.lds \ $(filter %.o, $^) $(FLATLIBS) @chmod a-x $@ @@ -125,7 +126,7 @@ else endif generated-files = $(asm-offsets) -$(tests:.$(exe)=.o) $(cstart.o) $(cflatobjs): $(generated-files) +$(tests:.$(exe)=.o) $(cstart.o) $(sbi-asm.o) $(cflatobjs): $(generated-files) arch_clean: asm_offsets_clean $(RM) $(TEST_DIR)/*.{o,flat,elf,so,efi,debug} \ diff --git a/riscv/sbi-asm.S b/riscv/sbi-asm.S new file mode 100644 index 00000000..6d348c88 --- /dev/null +++ b/riscv/sbi-asm.S @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Helper assembly code routines for RISC-V SBI extension tests. + * + * Copyright (C) 2024, James Raphael Tiovalen + */ +#define __ASSEMBLY__ +#include +#include +#include +#include + +.section .text +.balign 4 +.global check_hart_start +check_hart_start: + csrr t0, CSR_SATP + bnez t0, hart_start_checks_failed + csrr t0, CSR_SSTATUS + andi t1, t0, SR_SIE + bnez t1, hart_start_checks_failed + bne a0, a1, hart_start_checks_failed + la t0, hart_start_works + li t1, 1 + sb t1, 0(t0) +hart_start_checks_failed: + la t0, stop_test_hart + lb t1, 0(t0) + beqz t1, hart_start_checks_failed + call sbi_hart_stop + j halt + +.section .data +.balign PAGE_SIZE +.global hart_start_works +hart_start_works: .byte 0 +.global stop_test_hart +stop_test_hart: .byte 0 diff --git a/riscv/sbi.c b/riscv/sbi.c index 08bd6a95..53986c9e 100644 --- a/riscv/sbi.c +++ b/riscv/sbi.c @@ -5,6 +5,7 @@ * Copyright (C) 2023, Ventana Micro Systems Inc., Andrew Jones */ #include +#include #include #include #include @@ -15,6 +16,9 @@ #include #include #include +#include +#include +#include static void help(void) { @@ -253,6 +257,281 @@ static void check_time(void) report_prefix_pop(); } +struct hsm_info { + bool stages[2]; + bool retentive_suspend_hart; + bool stop_hart; +}; + +static struct hsm_info hsm_info[NR_CPUS]; +extern void check_hart_start(void); +extern unsigned char stop_test_hart; +extern unsigned char hart_start_works; + +static void hart_execute(void) +{ + struct sbiret ret; + unsigned long hartid = current_thread_info()->hartid; + + hsm_info[hartid].stages[0] = true; + + while (true) { + if (hsm_info[hartid].retentive_suspend_hart) { + hsm_info[hartid].retentive_suspend_hart = false; + ret = sbi_hart_suspend(SBI_EXT_HSM_HART_SUSPEND_RETENTIVE, __pa(NULL), __pa(NULL)); + if (ret.error) + report_fail("failed to retentive suspend hart %ld", hartid); + else + hsm_info[hartid].stages[1] = true; + + } else if (hsm_info[hartid].stop_hart) { + break; + } else { + cpu_relax(); + } + } + + ret = sbi_hart_stop(); + if (ret.error) + report_fail("failed to stop hart %ld", hartid); +} + +static void check_hsm(void) +{ + struct sbiret ret; + unsigned long hartid; + int cpu; + unsigned long hart_mask = 0; + bool ipi_failed = false; + unsigned int stage = 0; + + report_prefix_push("hsm"); + + if (!sbi_probe(SBI_EXT_HSM)) { + report_skip("hsm extension not available"); + report_prefix_pop(); + return; + } + + report_prefix_push("hart_get_status"); + + hartid = current_thread_info()->hartid; + ret = sbi_hart_get_status(hartid); + + if (ret.error) { + report_fail("current hartid is invalid"); + report_prefix_pop(); + report_prefix_pop(); + return; + } else if (ret.value != SBI_EXT_HSM_STARTED) { + report_fail("current hart is not started"); + report_prefix_pop(); + report_prefix_pop(); + return; + } + + report_pass("status of current hart is started"); + + report_prefix_pop(); + + report_prefix_push("hart_start"); + + ret = sbi_hart_start(hartid, virt_to_phys(&hart_execute), __pa(NULL)); + report(ret.error == SBI_ERR_ALREADY_AVAILABLE, "boot hart is already started"); + + ret = sbi_hart_start(ULONG_MAX, virt_to_phys(&hart_execute), __pa(NULL)); + report(ret.error == SBI_ERR_INVALID_PARAM, "invalid hartid check"); + + if (nr_cpus < 2) { + report_skip("no other cpus to run the remaining hsm tests on"); + report_prefix_pop(); + report_prefix_pop(); + return; + } + + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + break; + } + } + + ret = sbi_hart_start(hartid, virt_to_phys(&check_hart_start), hartid); + + if (ret.error) { + report_fail("failed to start test hart"); + report_prefix_pop(); + report_prefix_pop(); + return; + } + + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_STOPPED)) + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_START_PENDING)) + ret = sbi_hart_get_status(hartid); + + report(!ret.error && (ret.value == SBI_EXT_HSM_STARTED), + "test hart with hartid %ld successfully started", hartid); + + while (!hart_start_works) + cpu_relax(); + + report(hart_start_works, + "test hart %ld successfully executed code", hartid); + + stop_test_hart = true; + + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_STARTED)) + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_STOP_PENDING)) + ret = sbi_hart_get_status(hartid); + + report(!ret.error && (ret.value == SBI_EXT_HSM_STOPPED), + "test hart %ld successfully stopped", hartid); + + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) + smp_boot_secondary(cpu, hart_execute); + } + + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_STOPPED)) + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_START_PENDING)) + ret = sbi_hart_get_status(hartid); + + report(!ret.error && (ret.value == SBI_EXT_HSM_STARTED), + "new hart with hartid %ld successfully started", hartid); + } + } + + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + + while (!hsm_info[hartid].stages[stage]) + cpu_relax(); + + report(hsm_info[hartid].stages[stage], + "hart %ld successfully executed stage %d code", hartid, stage + 1); + } + } + + stage++; + + report_prefix_pop(); + + report_prefix_push("hart_suspend"); + + if (sbi_probe(SBI_EXT_IPI)) { + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + hsm_info[hartid].retentive_suspend_hart = true; + hart_mask |= 1UL << hartid; + } + } + + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_STARTED)) + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_SUSPEND_PENDING)) + ret = sbi_hart_get_status(hartid); + + report(!ret.error && (ret.value == SBI_EXT_HSM_SUSPENDED), + "hart %ld successfully retentive suspended", hartid); + } + } + + ret = __ipi_sbi_ecall(hart_mask, 0UL); + if (ret.error) { + ipi_failed = true; + report_fail("failed to send ipi to retentive suspended harts"); + } else { + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_SUSPENDED)) + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_RESUME_PENDING)) + ret = sbi_hart_get_status(hartid); + + report(!ret.error && (ret.value == SBI_EXT_HSM_STARTED), + "hart %ld successfully retentive resumed", hartid); + } + } + + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + + while (!hsm_info[hartid].stages[stage]) + cpu_relax(); + + report(hsm_info[hartid].stages[stage], + "hart %ld successfully executed stage %d code", + hartid, stage + 1); + } + } + } + } else { + report_skip("skipping tests since ipi extension is unavailable"); + } + + report_prefix_pop(); + + report_prefix_push("hart_stop"); + + if (!ipi_failed) { + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + hsm_info[hartid].stop_hart = true; + } + } + + for_each_present_cpu(cpu) { + if (cpu != smp_processor_id()) { + hartid = cpus[cpu].hartid; + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_STARTED)) + ret = sbi_hart_get_status(hartid); + + while (!ret.error && (ret.value == SBI_EXT_HSM_STOP_PENDING)) + ret = sbi_hart_get_status(hartid); + + report(!ret.error && (ret.value == SBI_EXT_HSM_STOPPED), + "hart %ld successfully stopped", hartid); + } + } + } else { + report_skip("skipping tests since ipi failed to be sent"); + } + + report_prefix_pop(); + report_prefix_pop(); +} + int main(int argc, char **argv) { @@ -264,6 +543,7 @@ int main(int argc, char **argv) report_prefix_push("sbi"); check_base(); check_time(); + check_hsm(); return report_summary(); }