From patchwork Fri Oct 25 18:59:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 2002492 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=vEoTDwxX; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=PLwHpEdr; 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=opensbi-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 4XZstS5WnHz1xw0 for ; Sat, 26 Oct 2024 06:15:12 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iF3DVovl/KkZKXbZh9cPs5nhGzlFBH36FhLDJxE/QS8=; b=vEoTDwxX5RR8vc vyzR6gOwSsKFKYfFCktZbLeqs9TuOvNB9zSdGc9Yfcq0AQ7hwBEprYTNwdzqdL/XuM3K1xdY4La7a Rktg0GHoBxn3EvPKmyu/qMzuoD/+ajDHRmK6qbB/EFa7hpxbmF/ZSC2WZ5SHrWS+B5nbdLV8omzM0 lfaJtuNnVJggMAM7bF5Uup248telzqffJe4f+FxLJOYkYbzerNyGCwNPZsCGmlfxtdpPNJYvPyNA4 LwRv1lF6hNBvEtWdyyhMZ55/4oF4V1+RmIugmcrH5SE1xMhHjVDh6nRq15qMK87NgscbgMnFBbd2l i4ranqhXR+TIEW02AEBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t4Pm5-00000004v2I-02pG; Fri, 25 Oct 2024 19:15:05 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t4PXO-00000004ser-0HCg for opensbi@lists.infradead.org; Fri, 25 Oct 2024 18:59:55 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2e2e88cb0bbso1819283a91.3 for ; Fri, 25 Oct 2024 11:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729882793; x=1730487593; 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=+SolzJs7+n65a3i+KJVFjgqOUK0x20cXLwWz+qa5PZg=; b=PLwHpEdr93wIbjxT2fL4RiuWHYccPWUQJHpB6XiJyfjn3yWhlXd2VKIObD7xIG7KbX oU6KtkTLlx7nIA7LJofNDKFWC9HJkNWXTpWABxE7ABwwAHv9wAV/yoeq4oL61B8fRQ2s PpXXIbWRXobu/92Wbm/6StrUvD4a8pzs0aNKZ5eyjBAJYmx50p9HUhoovACKVr3ut823 hxb9sKD/OEe3Jl7mXTw2IHM3e/+dDaD1MKnupu13ZtvmUM7doTpkM/0MKLEFqFRcmHD3 sJMcKAaRVUpMRsk48R03w5uwCxXaVI0fg31swCyi/5liRRA/nrSL193IiBGUgjxZsHRC s7dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729882793; x=1730487593; 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=+SolzJs7+n65a3i+KJVFjgqOUK0x20cXLwWz+qa5PZg=; b=dTpF1/XLaekqSqqEwC57jUtOhtHZdJUCefJBmPKhD23oZGB20PbcL+BJx6pNLieITT 7D1bKwAyTv+LMtv+7gUOLyHqtMfyTSqmtyy6ZKAxp6kXMAKMBsP25pJM2x1cn22Q1kYN qQHhnMAfZZ1Q67V3EnHHss5zC1x7K5iZNor7WuBBLZfkyTce0wA8eM0dKN05TnP9KuGQ 0BpqFmtYUxzYcireB4sy9sEU+iG2SAFBd3edqXmuTgy8WY9UpVJnNUXJnDkZ7/PC8rbz anbXJ7wT+CY8FyHYSG2ZGkBAOQEOID37i1nqWf4/hGlgGBT12VVzq8NN9Apnz3dB0+P8 Pcmg== X-Gm-Message-State: AOJu0Yy1MvbnQNEpSoFsckKwQhQYmVQkoW6Pgy2TDt9igvtpl2rj+t3M /9d4qL5xWwRd2Mweu5Er9jCdd2FldRRQ9hiRz1KP20J6tfrHnK1kgCwrjITwq2CVze7om5Sjufg vPKcC0oncrRmxT/Op/CfRP4a60YYlgNhaUXJ5REr94B5YCxwvkgCKpDPhrn2uovE6Gtt00Ofjc7 mTeYmPEKSiJsCKjeMe8ZxMRP5ETPTHv+BgY8WPtb3nL1AVmGjQ6xY= X-Google-Smtp-Source: AGHT+IFIjL8RfuUUXZ0ESF+2ikoDivzhUf6xbZGj1czZt+zFMyBXZ8vqGQHAT1C/8SYzeO3dSipgeg== X-Received: by 2002:a17:90a:e016:b0:2e2:e545:82c5 with SMTP id 98e67ed59e1d1-2e8f104f090mr423842a91.3.1729882793131; Fri, 25 Oct 2024 11:59:53 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e77e55d132sm3853359a91.39.2024.10.25.11.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 11:59:52 -0700 (PDT) From: Samuel Holland To: opensbi@lists.infradead.org Subject: [PATCH v2 1/3] lib: sbi_ipi: Make .ipi_clear always target the current hart Date: Fri, 25 Oct 2024 11:59:46 -0700 Message-ID: <20241025185950.1371610-2-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241025185950.1371610-1-samuel.holland@sifive.com> References: <20241025185950.1371610-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241025_115954_146707_88C58A0F X-CRM114-Status: GOOD ( 17.56 ) 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: All existing users of this operation target the current hart, and it seems unlikely that a future user will need to clear the pending IPI status of a remote hart. Simplify the logic by changing .ipi_c [...] 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:102f listed in] [list.dnswl.org] 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org All existing users of this operation target the current hart, and it seems unlikely that a future user will need to clear the pending IPI status of a remote hart. Simplify the logic by changing .ipi_clear (and its wrapper sbi_ipi_raw_clear()) to always operate on the current hart. This incidentally fixes a bug introduced in commit 78c667b6fc07 ("lib: sbi: Prefer hartindex over hartid in IPI framework"), which changed the .ipi_clear parameter from a hartid to a hart index, but failed to update the warm_init functions to match. Fixes: 78c667b6fc07 ("lib: sbi: Prefer hartindex over hartid in IPI framework") Signed-off-by: Samuel Holland --- Changes in v2: - Rebase on master branch (minor conflict with cae230c93556) include/sbi/sbi_ipi.h | 6 +++--- lib/sbi/sbi_init.c | 2 +- lib/sbi/sbi_ipi.c | 7 +++---- lib/utils/ipi/aclint_mswi.c | 13 ++++--------- lib/utils/ipi/andes_plicsw.c | 6 +++--- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h index d3962334..62d61304 100644 --- a/include/sbi/sbi_ipi.h +++ b/include/sbi/sbi_ipi.h @@ -26,8 +26,8 @@ struct sbi_ipi_device { /** Send IPI to a target HART index */ void (*ipi_send)(u32 hart_index); - /** Clear IPI for a target HART index */ - void (*ipi_clear)(u32 hart_index); + /** Clear IPI for the current hart */ + void (*ipi_clear)(void); }; enum sbi_ipi_update_type { @@ -87,7 +87,7 @@ void sbi_ipi_process(void); int sbi_ipi_raw_send(u32 hartindex); -void sbi_ipi_raw_clear(u32 hartindex); +void sbi_ipi_raw_clear(void); const struct sbi_ipi_device *sbi_ipi_get_device(void); diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index cccd723d..8a2cfaef 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -479,7 +479,7 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid) if (hstate == SBI_HSM_STATE_SUSPENDED) { init_warm_resume(scratch, hartid); } else { - sbi_ipi_raw_clear(sbi_hartid_to_hartindex(hartid)); + sbi_ipi_raw_clear(); init_warm_startup(scratch, hartid); } } diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 337ed175..33b4d9b3 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -237,10 +237,9 @@ void sbi_ipi_process(void) struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); struct sbi_ipi_data *ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off); - u32 hartindex = current_hartindex(); sbi_pmu_ctr_incr_fw(SBI_PMU_FW_IPI_RECVD); - sbi_ipi_raw_clear(hartindex); + sbi_ipi_raw_clear(); ipi_type = atomic_raw_xchg_ulong(&ipi_data->ipi_type, 0); ipi_event = 0; @@ -275,10 +274,10 @@ int sbi_ipi_raw_send(u32 hartindex) return 0; } -void sbi_ipi_raw_clear(u32 hartindex) +void sbi_ipi_raw_clear(void) { if (ipi_dev && ipi_dev->ipi_clear) - ipi_dev->ipi_clear(hartindex); + ipi_dev->ipi_clear(); /* * Ensure that memory or MMIO writes after this diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c index 0ef3d003..2cd7a530 100644 --- a/lib/utils/ipi/aclint_mswi.c +++ b/lib/utils/ipi/aclint_mswi.c @@ -45,24 +45,19 @@ static void mswi_ipi_send(u32 hart_index) mswi->first_hartid]); } -static void mswi_ipi_clear(u32 hart_index) +static void mswi_ipi_clear(void) { u32 *msip; - struct sbi_scratch *scratch; + struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); struct aclint_mswi_data *mswi; - scratch = sbi_hartindex_to_scratch(hart_index); - if (!scratch) - return; - mswi = mswi_get_hart_data_ptr(scratch); if (!mswi) return; /* Clear ACLINT IPI */ msip = (void *)mswi->addr; - writel_relaxed(0, &msip[sbi_hartindex_to_hartid(hart_index) - - mswi->first_hartid]); + writel_relaxed(0, &msip[current_hartid() - mswi->first_hartid]); } static struct sbi_ipi_device aclint_mswi = { @@ -74,7 +69,7 @@ static struct sbi_ipi_device aclint_mswi = { int aclint_mswi_warm_init(void) { /* Clear IPI for current HART */ - mswi_ipi_clear(current_hartindex()); + mswi_ipi_clear(); return 0; } diff --git a/lib/utils/ipi/andes_plicsw.c b/lib/utils/ipi/andes_plicsw.c index 18c79e2b..626699f9 100644 --- a/lib/utils/ipi/andes_plicsw.c +++ b/lib/utils/ipi/andes_plicsw.c @@ -41,9 +41,9 @@ static void plicsw_ipi_send(u32 hart_index) writel_relaxed(BIT(pending_bit), (void *)pending_reg); } -static void plicsw_ipi_clear(u32 hart_index) +static void plicsw_ipi_clear(void) { - u32 target_hart = sbi_hartindex_to_hartid(hart_index); + u32 target_hart = current_hartid(); ulong reg = plicsw.addr + PLICSW_CONTEXT_BASE + PLICSW_CONTEXT_CLAIM + PLICSW_CONTEXT_STRIDE * target_hart; @@ -68,7 +68,7 @@ static struct sbi_ipi_device plicsw_ipi = { int plicsw_warm_ipi_init(void) { /* Clear PLICSW IPI */ - plicsw_ipi_clear(current_hartindex()); + plicsw_ipi_clear(); return 0; } From patchwork Fri Oct 25 18:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 2002490 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=lXNdrlyz; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=TBvUVKwd; 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=opensbi-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 4XZstQ70Ywz1xw0 for ; Sat, 26 Oct 2024 06:15:10 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tCgaqWLSuGjzYUUPBeuDTzDbZtIXDjieKUlSUQ6cWCU=; b=lXNdrlyzNO4y8s c7kT9rbLgWlaghTayN7fLH0R889WIpzDXML0uGTRZemFRcQwG19AFO+kPJryuC0eUhrDxvQtPmkFR ngWr7gihyPFZtftGv8dIMrMLhhcy9nqSzrQRXDrAWqyS6hK2eGP0e4+yOCVxDLOQUGHpeeFB+VnUs dlCAXaaJ6kVpVh13+4h+vnQnWPTQgs5RgdEv6uR0MfG6PwZEKqVzIUvLFNbpAxm+U7Aigpd1L8TYP yTFW466QJt34euUh1nHnHETlLxvX78N5eyRVv9D+OHb3Nwk/A7/gOARAiTdMKchsNWGXFGCjWEUbx kAvz4kUWB8F+2lfy5vWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t4Pm5-00000004v2h-2Tev; Fri, 25 Oct 2024 19:15:05 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t4PXP-00000004sfH-1JVV for opensbi@lists.infradead.org; Fri, 25 Oct 2024 18:59:56 +0000 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2e2ad9825a7so1698673a91.0 for ; Fri, 25 Oct 2024 11:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729882794; x=1730487594; 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=WGiQCFLiL6eUV42V+fmZMMv/ROv8/KkQS5aKVg1BPs0=; b=TBvUVKwdpIvh557j6kWqc1f0V/3hc1//NhYSy9a+3CpVIt4eNbSttIMmzDLtnQytGU iXTYb/3aQa62/2gbOBMAeCDVB7pwwSczDWYDu5yUBwm5TrQfpTC3n9ezDCkmj2s01jOw 80VlC6Rij99dz5fuWLoz7SreDvkD8jWISIHRkBc1Tx+LpR8PTzLTjNqTN/NVPmmcW8gx fMhQx1urToFEnxms+QbALkS+fkSWgFM37arm7AHMXtgyc7MhP/udHKHNBkCNzDr28La7 JTUa+dWbN3rv5HYwvSFZjxx6cbiKiGByBL5AfFVSGw9OqMIJqzsE3/p9t1rmVhx2OCg0 8cXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729882794; x=1730487594; 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=WGiQCFLiL6eUV42V+fmZMMv/ROv8/KkQS5aKVg1BPs0=; b=SW64xw/ncVG3kFY0fhLWZwXdcf9WX8k64PEQAWY4KznEdVrDrsHyjgPVBgBW9Q++pr 86035o4zfvUwYuTg+C5/8oM8gh401LfIZRLYNiJJ7FZsCe3WjHVHi8qweknY4YSEqdvv E51kF5FNkyu53BdLCB/k/h05ZGeg5qPGAC9/XEDX3BpWuBjwQL+EgWDqtxtzpjgI9nUY ++VXwJyIX+owgkGKBPUjXItMbbPEyyOLZY08ALkrfRIOYkUpAyJju69KBvgD6WO/Xa/P i36MH9FzNPuzVW6IlJGf+7xxZjozTQ0jP85y1gcYtVvaUvaVjRCURaPoaSYsDdD+eRsA HMIA== X-Gm-Message-State: AOJu0YxO2cv6K6QbMj05PN+ml4joIHtPxj7rNQVqcY2dP6qK3KNzaJTc mIdp5Fs1mp71wUn9RqcLlGFxaQrZ7jeG1iSydOd/14tjQOrpB71nobQd6OeioPRg2y6elnvd3ns w85dsELAa7U/gAAwAmnLqhc3PiCN9MZsLiIOjfviwpfejogvGjgLRwEzclB4/2IXlS1XaTmo9gX 8ac3dFud748pYOth+rB6W9mdV2YiJAPlubAZ9gbTK0BbXlPqwZN4o= X-Google-Smtp-Source: AGHT+IFYwzC//fmQHFvTHnFTML0AG9gt7yX12jwLPa4qHRO6ZyHvvN67cJtTJjN9G6gC0C+SMSYgqw== X-Received: by 2002:a17:90b:4d01:b0:2e2:c98e:c33f with SMTP id 98e67ed59e1d1-2e8f1058039mr488510a91.1.1729882794110; Fri, 25 Oct 2024 11:59:54 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e77e55d132sm3853359a91.39.2024.10.25.11.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 11:59:53 -0700 (PDT) From: Samuel Holland To: opensbi@lists.infradead.org Subject: [PATCH v2 2/3] lib: sbi_ipi: Move initial IPI clear to sbi_ipi_init() Date: Fri, 25 Oct 2024 11:59:47 -0700 Message-ID: <20241025185950.1371610-3-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241025185950.1371610-1-samuel.holland@sifive.com> References: <20241025185950.1371610-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241025_115955_405709_AE18BED3 X-CRM114-Status: GOOD ( 17.32 ) 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: sbi_ipi_init() expects the platform warm init function to clear IPIs on the local hart, but there is already a generic function to do this. After this change, none of the existing drivers need a warm [...] 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:102b listed in] [list.dnswl.org] 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org sbi_ipi_init() expects the platform warm init function to clear IPIs on the local hart, but there is already a generic function to do this. After this change, none of the existing drivers need a warm init callback. Signed-off-by: Samuel Holland --- (no changes since v1) include/sbi_utils/ipi/aclint_mswi.h | 2 -- include/sbi_utils/ipi/andes_plicsw.h | 2 -- lib/sbi/sbi_hsm.c | 2 +- lib/sbi/sbi_ipi.c | 8 ++++---- lib/utils/ipi/aclint_mswi.c | 8 -------- lib/utils/ipi/andes_plicsw.c | 8 -------- lib/utils/ipi/fdt_ipi_mswi.c | 2 +- lib/utils/ipi/fdt_ipi_plicsw.c | 2 +- platform/fpga/ariane/platform.c | 2 +- platform/fpga/openpiton/platform.c | 2 +- platform/kendryte/k210/platform.c | 2 +- platform/nuclei/ux600/platform.c | 2 +- platform/template/platform.c | 2 +- 13 files changed, 12 insertions(+), 32 deletions(-) diff --git a/include/sbi_utils/ipi/aclint_mswi.h b/include/sbi_utils/ipi/aclint_mswi.h index e373a8cb..4b8249f2 100644 --- a/include/sbi_utils/ipi/aclint_mswi.h +++ b/include/sbi_utils/ipi/aclint_mswi.h @@ -26,8 +26,6 @@ struct aclint_mswi_data { u32 hart_count; }; -int aclint_mswi_warm_init(void); - int aclint_mswi_cold_init(struct aclint_mswi_data *mswi); #endif diff --git a/include/sbi_utils/ipi/andes_plicsw.h b/include/sbi_utils/ipi/andes_plicsw.h index 0d184449..f6e1cae5 100644 --- a/include/sbi_utils/ipi/andes_plicsw.h +++ b/include/sbi_utils/ipi/andes_plicsw.h @@ -32,8 +32,6 @@ struct plicsw_data { uint32_t hart_count; }; -int plicsw_warm_ipi_init(void); - int plicsw_cold_ipi_init(struct plicsw_data *plicsw); #endif /* _IPI_ANDES_PLICSW_H_ */ diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 58a33798..a3d6947a 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -178,7 +178,7 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch) /* * No need to clear IPI here because the sbi_ipi_init() will - * clear it for current HART via sbi_platform_ipi_init(). + * clear it for current HART. */ } diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 33b4d9b3..b39f03e0 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -332,14 +332,14 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot) ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off); ipi_data->ipi_type = 0x00; - /* - * Initialize platform IPI support. This will also clear any - * pending IPIs for current/calling HART. - */ + /* Initialize platform IPI support */ ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch), cold_boot); if (ret) return ret; + /* Clear any pending IPIs for the current hart */ + sbi_ipi_raw_clear(); + /* Enable software interrupts */ csr_set(CSR_MIE, MIP_MSIP); diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c index 2cd7a530..9e55078a 100644 --- a/lib/utils/ipi/aclint_mswi.c +++ b/lib/utils/ipi/aclint_mswi.c @@ -66,14 +66,6 @@ static struct sbi_ipi_device aclint_mswi = { .ipi_clear = mswi_ipi_clear }; -int aclint_mswi_warm_init(void) -{ - /* Clear IPI for current HART */ - mswi_ipi_clear(); - - return 0; -} - int aclint_mswi_cold_init(struct aclint_mswi_data *mswi) { u32 i; diff --git a/lib/utils/ipi/andes_plicsw.c b/lib/utils/ipi/andes_plicsw.c index 626699f9..5d085d85 100644 --- a/lib/utils/ipi/andes_plicsw.c +++ b/lib/utils/ipi/andes_plicsw.c @@ -65,14 +65,6 @@ static struct sbi_ipi_device plicsw_ipi = { .ipi_clear = plicsw_ipi_clear }; -int plicsw_warm_ipi_init(void) -{ - /* Clear PLICSW IPI */ - plicsw_ipi_clear(); - - return 0; -} - int plicsw_cold_ipi_init(struct plicsw_data *plicsw) { int rc; diff --git a/lib/utils/ipi/fdt_ipi_mswi.c b/lib/utils/ipi/fdt_ipi_mswi.c index c78dead1..01331970 100644 --- a/lib/utils/ipi/fdt_ipi_mswi.c +++ b/lib/utils/ipi/fdt_ipi_mswi.c @@ -64,6 +64,6 @@ static const struct fdt_match ipi_mswi_match[] = { struct fdt_ipi fdt_ipi_mswi = { .match_table = ipi_mswi_match, .cold_init = ipi_mswi_cold_init, - .warm_init = aclint_mswi_warm_init, + .warm_init = NULL, .exit = NULL, }; diff --git a/lib/utils/ipi/fdt_ipi_plicsw.c b/lib/utils/ipi/fdt_ipi_plicsw.c index 32885745..1fd6ba1d 100644 --- a/lib/utils/ipi/fdt_ipi_plicsw.c +++ b/lib/utils/ipi/fdt_ipi_plicsw.c @@ -42,6 +42,6 @@ static const struct fdt_match ipi_plicsw_match[] = { struct fdt_ipi fdt_ipi_plicsw = { .match_table = ipi_plicsw_match, .cold_init = fdt_plicsw_cold_ipi_init, - .warm_init = plicsw_warm_ipi_init, + .warm_init = NULL, .exit = NULL, }; diff --git a/platform/fpga/ariane/platform.c b/platform/fpga/ariane/platform.c index ec0584ab..6d901271 100644 --- a/platform/fpga/ariane/platform.c +++ b/platform/fpga/ariane/platform.c @@ -143,7 +143,7 @@ static int ariane_ipi_init(bool cold_boot) return ret; } - return aclint_mswi_warm_init(); + return 0; } /* diff --git a/platform/fpga/openpiton/platform.c b/platform/fpga/openpiton/platform.c index 81cc48f4..eb6087f9 100644 --- a/platform/fpga/openpiton/platform.c +++ b/platform/fpga/openpiton/platform.c @@ -174,7 +174,7 @@ static int openpiton_ipi_init(bool cold_boot) return ret; } - return aclint_mswi_warm_init(); + return 0; } /* diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index 2f3f7079..c67d3f83 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -156,7 +156,7 @@ static int k210_ipi_init(bool cold_boot) return rc; } - return aclint_mswi_warm_init(); + return 0; } static int k210_timer_init(bool cold_boot) diff --git a/platform/nuclei/ux600/platform.c b/platform/nuclei/ux600/platform.c index 5610e7c7..07a1a1a4 100644 --- a/platform/nuclei/ux600/platform.c +++ b/platform/nuclei/ux600/platform.c @@ -212,7 +212,7 @@ static int ux600_ipi_init(bool cold_boot) return rc; } - return aclint_mswi_warm_init(); + return 0; } static int ux600_timer_init(bool cold_boot) diff --git a/platform/template/platform.c b/platform/template/platform.c index b4d30a57..39a2ac87 100644 --- a/platform/template/platform.c +++ b/platform/template/platform.c @@ -112,7 +112,7 @@ static int platform_ipi_init(bool cold_boot) return ret; } - return aclint_mswi_warm_init(); + return 0; } /* From patchwork Fri Oct 25 18:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 2002493 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=qfQqT4j3; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=D7z/g9sL; 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=opensbi-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 4XZstV0ljXz1xw0 for ; Sat, 26 Oct 2024 06:15:14 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qwys3fs6Z1q/3Vv39qtXpWBF+ErYGR3+bslDe9QQi40=; b=qfQqT4j3WmhC3w COuHa/8oZx0RCBJmEMSMYDZEgDgsjO/sO2Djjgk3iJpz0wuxyFx+Aycl9vtzlG36KIB7nITtDCU2e Astt4NkuuRLj+/fEs4vrEge/wLrvcG+Of+6jDJZGNu9BddZouCqrzkjpTnc30Cr6OGf4HQol1u0d3 k3nVWD7pfIoL0wL6NmefiKZ1Ve55IbPREF/UvsXG/xtEe5ohDlajh3PZzhR/8j2Vf3/jGj8qEqO6s 1cQBse1hN7Bf5NxHy2XUEn+SLtd20ZKUF2O+vGl7B17okSqtCBzjfLkQF2lzFTk9fYrOu7DkhW0vb x6iFmJPflu0sEmGzAOCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t4Pm6-00000004v3F-0c1x; Fri, 25 Oct 2024 19:15:06 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t4PXQ-00000004sfo-0wpz for opensbi@lists.infradead.org; Fri, 25 Oct 2024 18:59:57 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7205b6f51f3so584835b3a.1 for ; Fri, 25 Oct 2024 11:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729882795; x=1730487595; 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=LJhCeMTOttN9oHVKY+UOQNT3oqHj9mQXXZzu5FEDSUI=; b=D7z/g9sLS8Vz6+f5HSctDhTuiqTzKIlhdBsQwS0+LxohWv21JMEdCfqdB3KxTgnd3y JZRFnRmNHGoYHGQaJWyiizdMgSnZGZHTT3M+9Vx5EW8J8SxNnKuRo5ulvtComAewq5GC vLhPyYP5Et3aafxfNm2qvssC/1okrjzcNtFtQQmQRd4S0lYemfoJSmIMemmbn928eKrP H9xBaFdW+HipF4Ta/TcgVOvsjfOZHcKKCEOchHGoAgEgIj7mcJ+aS3QEMB2FLbgwHymZ ts5p76NrBHaKCIARLeh4XJJ6urWbRcYBhA9pTOGAVZjSAxe3wuusH2tMPY8gDjV2oRLF RCsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729882795; x=1730487595; 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=LJhCeMTOttN9oHVKY+UOQNT3oqHj9mQXXZzu5FEDSUI=; b=ZwJk/zF9P9b3vIB+LqQe2yynz5FgDNIBKXHeqy+VQUoBkqgDmhoU1n6fu3dJ3xQz2h JosvRjt+gl2kBI4bxzhomo/X9b1K4HSx3KEtxZ4rPn/JNGzvuJW8tqSN/rZkkVsAJiH2 pi3b+5vYK915rrbe+mSY9crI1hij4eICU/WdtAU9ASOk3yeUSk71JNbdud74QtYsxPbC PtAtLN5v6qq0cRHJPWd3OnSGbTBoDv8IcFo+u/JDvMKpPex3DCt8PM78GbaP0TtXcpDw O36xeX/3Iy67hxgfeWjVoYKyhsixrk/dt0fOT+SFZCQCpare9foHVvOJ85iMgrZMG0wi 3ERw== X-Gm-Message-State: AOJu0YzYbek3Jx/a+0Y5IsLaqRGnzpUy56+xJNkuTC4QoZCNYOj3RgqD qHSJ+qqTDohVwcpX/3hA7ETa3LeqjwCx/3WHIvbuT2EWyDtzovhfjYMgW1dVkSnDNxGkv6wZVnx pMhVNGi1FIBIcHiO/dUO9+IwkQaOP4LUB6K5OE/oPyge6JT0vhW9jVXoJZ1YXMbhOzbuboawRlr h0XLy8iJ2xZ1AMS5xZLMJOfjraCnImJ+xrXwy4c0oK4K7gb2qxkP0= X-Google-Smtp-Source: AGHT+IFzKgikWzWwtgJ4lWhJzV7VeOPVE8dgkV3ER7pjX8ZBWOiBC5JCL3YfxJywr6MXZnlC8tpWbg== X-Received: by 2002:a05:6a20:db0d:b0:1d9:90f:73e3 with SMTP id adf61e73a8af0-1d9a83a6578mr313386637.4.1729882794969; Fri, 25 Oct 2024 11:59:54 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e77e55d132sm3853359a91.39.2024.10.25.11.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 11:59:54 -0700 (PDT) From: Samuel Holland To: opensbi@lists.infradead.org Subject: [PATCH v2 3/3] platform: Drop IPI warm init and exit hooks Date: Fri, 25 Oct 2024 11:59:48 -0700 Message-ID: <20241025185950.1371610-4-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241025185950.1371610-1-samuel.holland@sifive.com> References: <20241025185950.1371610-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241025_115956_307341_9D7440EF X-CRM114-Status: GOOD ( 22.63 ) 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: Now that the SBI IPI core clears IPIs at warm boot in a generic way, none of the drivers or platforms use these hooks, and we can remove them. Platforms need only to initialize the driver once during [...] 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:429 listed in] [list.dnswl.org] 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Now that the SBI IPI core clears IPIs at warm boot in a generic way, none of the drivers or platforms use these hooks, and we can remove them. Platforms need only to initialize the driver once during cold init. If other hooks are needed in the future, they can be added to struct sbi_ipi_device. Signed-off-by: Samuel Holland --- (no changes since v1) include/sbi/sbi_platform.h | 25 +++++------------------- include/sbi_utils/ipi/fdt_ipi.h | 9 ++------- lib/sbi/sbi_ipi.c | 13 +++++-------- lib/utils/ipi/fdt_ipi.c | 31 +----------------------------- lib/utils/ipi/fdt_ipi_mswi.c | 2 -- lib/utils/ipi/fdt_ipi_plicsw.c | 2 -- platform/fpga/ariane/platform.c | 14 +++----------- platform/fpga/openpiton/platform.c | 14 +++----------- platform/generic/platform.c | 1 - platform/kendryte/k210/platform.c | 12 ++---------- platform/nuclei/ux600/platform.c | 12 ++---------- platform/template/platform.c | 14 +++----------- 12 files changed, 26 insertions(+), 123 deletions(-) diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index 7b3ac4bf..d16a5e20 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -116,10 +116,8 @@ struct sbi_platform_operations { /** Exit the platform interrupt controller for current HART */ void (*irqchip_exit)(void); - /** Initialize IPI for current HART */ - int (*ipi_init)(bool cold_boot); - /** Exit IPI for current HART */ - void (*ipi_exit)(void); + /** Initialize IPI during cold boot */ + int (*ipi_init)(void); /** Get tlb flush limit value **/ u64 (*get_tlbr_flush_limit)(void); @@ -574,32 +572,19 @@ static inline void sbi_platform_irqchip_exit(const struct sbi_platform *plat) } /** - * Initialize the platform IPI support for current HART + * Initialize the platform IPI support during cold boot * * @param plat pointer to struct sbi_platform - * @param cold_boot whether cold boot (true) or warm_boot (false) * * @return 0 on success and negative error code on failure */ -static inline int sbi_platform_ipi_init(const struct sbi_platform *plat, - bool cold_boot) +static inline int sbi_platform_ipi_init(const struct sbi_platform *plat) { if (plat && sbi_platform_ops(plat)->ipi_init) - return sbi_platform_ops(plat)->ipi_init(cold_boot); + return sbi_platform_ops(plat)->ipi_init(); return 0; } -/** - * Exit the platform IPI support for current HART - * - * @param plat pointer to struct sbi_platform - */ -static inline void sbi_platform_ipi_exit(const struct sbi_platform *plat) -{ - if (plat && sbi_platform_ops(plat)->ipi_exit) - sbi_platform_ops(plat)->ipi_exit(); -} - /** * Initialize the platform timer for current HART * diff --git a/include/sbi_utils/ipi/fdt_ipi.h b/include/sbi_utils/ipi/fdt_ipi.h index c6245201..161f7a2e 100644 --- a/include/sbi_utils/ipi/fdt_ipi.h +++ b/include/sbi_utils/ipi/fdt_ipi.h @@ -17,18 +17,13 @@ struct fdt_ipi { const struct fdt_match *match_table; int (*cold_init)(const void *fdt, int nodeoff, const struct fdt_match *match); - int (*warm_init)(void); - void (*exit)(void); }; -void fdt_ipi_exit(void); - -int fdt_ipi_init(bool cold_boot); +int fdt_ipi_init(void); #else -static inline void fdt_ipi_exit(void) { } -static inline int fdt_ipi_init(bool cold_boot) { return 0; } +static inline int fdt_ipi_init(void) { return 0; } #endif diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index b39f03e0..52898d30 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -321,6 +321,11 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot) if (ret < 0) return ret; ipi_halt_event = ret; + + /* Initialize platform IPI support */ + ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch)); + if (ret) + return ret; } else { if (!ipi_data_off) return SBI_ENOMEM; @@ -332,11 +337,6 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot) ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off); ipi_data->ipi_type = 0x00; - /* Initialize platform IPI support */ - ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch), cold_boot); - if (ret) - return ret; - /* Clear any pending IPIs for the current hart */ sbi_ipi_raw_clear(); @@ -353,7 +353,4 @@ void sbi_ipi_exit(struct sbi_scratch *scratch) /* Process pending IPIs */ sbi_ipi_process(); - - /* Platform exit */ - sbi_platform_ipi_exit(sbi_platform_ptr(scratch)); } diff --git a/lib/utils/ipi/fdt_ipi.c b/lib/utils/ipi/fdt_ipi.c index 959cf57d..c2ff9cfa 100644 --- a/lib/utils/ipi/fdt_ipi.c +++ b/lib/utils/ipi/fdt_ipi.c @@ -16,22 +16,7 @@ extern struct fdt_ipi *fdt_ipi_drivers[]; extern unsigned long fdt_ipi_drivers_size; -static struct fdt_ipi *current_driver = NULL; - -void fdt_ipi_exit(void) -{ - if (current_driver && current_driver->exit) - current_driver->exit(); -} - -static int fdt_ipi_warm_init(void) -{ - if (current_driver && current_driver->warm_init) - return current_driver->warm_init(); - return 0; -} - -static int fdt_ipi_cold_init(void) +int fdt_ipi_init(void) { int pos, noff, rc; struct fdt_ipi *drv; @@ -56,7 +41,6 @@ static int fdt_ipi_cold_init(void) continue; if (rc) return rc; - current_driver = drv; /* * We will have multiple IPI devices on multi-die or @@ -71,16 +55,3 @@ static int fdt_ipi_cold_init(void) */ return 0; } - -int fdt_ipi_init(bool cold_boot) -{ - int rc; - - if (cold_boot) { - rc = fdt_ipi_cold_init(); - if (rc) - return rc; - } - - return fdt_ipi_warm_init(); -} diff --git a/lib/utils/ipi/fdt_ipi_mswi.c b/lib/utils/ipi/fdt_ipi_mswi.c index 01331970..c58d7722 100644 --- a/lib/utils/ipi/fdt_ipi_mswi.c +++ b/lib/utils/ipi/fdt_ipi_mswi.c @@ -64,6 +64,4 @@ static const struct fdt_match ipi_mswi_match[] = { struct fdt_ipi fdt_ipi_mswi = { .match_table = ipi_mswi_match, .cold_init = ipi_mswi_cold_init, - .warm_init = NULL, - .exit = NULL, }; diff --git a/lib/utils/ipi/fdt_ipi_plicsw.c b/lib/utils/ipi/fdt_ipi_plicsw.c index 1fd6ba1d..a178db1b 100644 --- a/lib/utils/ipi/fdt_ipi_plicsw.c +++ b/lib/utils/ipi/fdt_ipi_plicsw.c @@ -42,6 +42,4 @@ static const struct fdt_match ipi_plicsw_match[] = { struct fdt_ipi fdt_ipi_plicsw = { .match_table = ipi_plicsw_match, .cold_init = fdt_plicsw_cold_ipi_init, - .warm_init = NULL, - .exit = NULL, }; diff --git a/platform/fpga/ariane/platform.c b/platform/fpga/ariane/platform.c index 6d901271..5bacebdb 100644 --- a/platform/fpga/ariane/platform.c +++ b/platform/fpga/ariane/platform.c @@ -131,19 +131,11 @@ static int ariane_irqchip_init(bool cold_boot) } /* - * Initialize IPI for current HART. + * Initialize IPI during cold boot. */ -static int ariane_ipi_init(bool cold_boot) +static int ariane_ipi_init(void) { - int ret; - - if (cold_boot) { - ret = aclint_mswi_cold_init(&mswi); - if (ret) - return ret; - } - - return 0; + return aclint_mswi_cold_init(&mswi); } /* diff --git a/platform/fpga/openpiton/platform.c b/platform/fpga/openpiton/platform.c index eb6087f9..89ea80bb 100644 --- a/platform/fpga/openpiton/platform.c +++ b/platform/fpga/openpiton/platform.c @@ -162,19 +162,11 @@ static int openpiton_irqchip_init(bool cold_boot) } /* - * Initialize IPI for current HART. + * Initialize IPI during cold boot. */ -static int openpiton_ipi_init(bool cold_boot) +static int openpiton_ipi_init(void) { - int ret; - - if (cold_boot) { - ret = aclint_mswi_cold_init(&mswi); - if (ret) - return ret; - } - - return 0; + return aclint_mswi_cold_init(&mswi); } /* diff --git a/platform/generic/platform.c b/platform/generic/platform.c index 49d877d0..487f2c2b 100644 --- a/platform/generic/platform.c +++ b/platform/generic/platform.c @@ -399,7 +399,6 @@ const struct sbi_platform_operations platform_ops = { .irqchip_init = fdt_irqchip_init, .irqchip_exit = fdt_irqchip_exit, .ipi_init = fdt_ipi_init, - .ipi_exit = fdt_ipi_exit, .pmu_init = generic_pmu_init, .pmu_xlate_to_mhpmevent = generic_pmu_xlate_to_mhpmevent, .get_tlbr_flush_limit = generic_tlbr_flush_limit, diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index c67d3f83..795f61b5 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -146,17 +146,9 @@ static int k210_irqchip_init(bool cold_boot) return plic_warm_irqchip_init(&plic, hartid * 2, hartid * 2 + 1); } -static int k210_ipi_init(bool cold_boot) +static int k210_ipi_init(void) { - int rc; - - if (cold_boot) { - rc = aclint_mswi_cold_init(&mswi); - if (rc) - return rc; - } - - return 0; + return aclint_mswi_cold_init(&mswi); } static int k210_timer_init(bool cold_boot) diff --git a/platform/nuclei/ux600/platform.c b/platform/nuclei/ux600/platform.c index 07a1a1a4..ae1e0a18 100644 --- a/platform/nuclei/ux600/platform.c +++ b/platform/nuclei/ux600/platform.c @@ -202,17 +202,9 @@ static int ux600_irqchip_init(bool cold_boot) (hartid) ? (2 * hartid) : -1); } -static int ux600_ipi_init(bool cold_boot) +static int ux600_ipi_init(void) { - int rc; - - if (cold_boot) { - rc = aclint_mswi_cold_init(&mswi); - if (rc) - return rc; - } - - return 0; + return aclint_mswi_cold_init(&mswi); } static int ux600_timer_init(bool cold_boot) diff --git a/platform/template/platform.c b/platform/template/platform.c index 39a2ac87..bc1ba52f 100644 --- a/platform/template/platform.c +++ b/platform/template/platform.c @@ -99,20 +99,12 @@ static int platform_irqchip_init(bool cold_boot) } /* - * Initialize IPI for current HART. + * Initialize IPI during cold boot. */ -static int platform_ipi_init(bool cold_boot) +static int platform_ipi_init(void) { - int ret; - /* Example if the generic ACLINT driver is used */ - if (cold_boot) { - ret = aclint_mswi_cold_init(&mswi); - if (ret) - return ret; - } - - return 0; + return aclint_mswi_cold_init(&mswi); } /*