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)) {