From patchwork Wed Sep 4 01:24:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1980395 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=BtcZxImw; 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=dwUTBlJP; 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 4Wz4Yn0rWtz1ynP for ; Wed, 4 Sep 2024 11:25:31 +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: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=ylWMPixPZEHmWhQyj4SiC5kSPMSRhcV5NfxjGN+qnsA=; b=BtcZxImwOk791V FPTa21bFIrChv2Pf9+SFo0x0bUF5ghBi//PVrb9GK9imuB4LLNA3IqqJ5jwq39MztYufsvJxSuPMZ LThMiNdFywE5TImSn6CK6gc+uoUFg41G6cXsNAEky3oITKIGDPeDyFlQniZkFzQ546ayaLsOGuntK re53BwkgSoHTwR/Fof7W9SOlBXqBaE19MB6mPoNEd6g3qiIZvS9+rfv+j7wjofP7Cam9DTPQoEeDw ZW2wcVJqukRryRRuoQH6Iz6qxkwDEdc9RaqBNhpdjm9MtwgOHvUAVzZ0q0NO5UUOtZNqbjUuh1or+ Q4CNrlR4WvJ6eb6q03/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slelv-00000002TJw-2GMv; Wed, 04 Sep 2024 01:25:23 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sleln-00000002THd-2flR for opensbi@lists.infradead.org; Wed, 04 Sep 2024 01:25:16 +0000 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-7cd9e634ea9so4050291a12.0 for ; Tue, 03 Sep 2024 18:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1725413115; x=1726017915; 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=X3Ix8LUXpSjsJ+loP4q8ywnZoowSjZdWYmOzjjD83FY=; b=dwUTBlJPNja1WV7x67ElAZq+p3hStdrIlw564Wo0979ryqDN05uY/D+G511Tqj5ZaY XbiA8UL0wM8W+68skBjfOX5/DPFQUi+wWigDooW6Ta7uh484RX0h0yAEZ+WvHcRdQV47 RzDO8BxT1uDZI2df6Viys/0iNhmp+ddq6C8wwYdGvdFbuyA3SkUHxC3jKd3rQ/H9w26e FnxfxYDXaLy9Am1yVoVxDoRcMRtQ1xXOn53V3sIFOdPM61Dgw5nDBx/Ny/yLNwlnTJyg Xh5JDXB8XwGzweagvL0wae/n4IX98oRJ/9aU2pKb9MeWuN24rsK2nL9PNDwnCVuUEmJm qSVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725413115; x=1726017915; 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=X3Ix8LUXpSjsJ+loP4q8ywnZoowSjZdWYmOzjjD83FY=; b=tm4gUn+ZIkhGBY3X1Ahk4xslpEl8ToAE2yT+EIR+LUI3LDNL3sUgnGuS6jPJiYsLpE fLDfius4993qfI/7WG+16Z7HI1HNNYHZGtrlA5GDuL0Tmr1TIe/2DhhYNOhQJTZwX7hb coBAWJecr5rfxcJbeUHf2Al7CZzFtwWTmYKi09KG6o+r/aJe6NSZyKh87f4rvKOfPPch BZNhg3ntW0voMfwn1Rlu0VcrzOEKfnHA07jj7QOroW4+VtJMFlrGcEP6ofGcILcPauo0 fCfLXQ2Fs9qozDHjAd9oqdrgkqq+y+9UivPBp1xQNfjVbnRqIyyQi7SAImfLecAKWJ1N fiPg== X-Gm-Message-State: AOJu0YxDLJIs/SQ+1fRhaAQan0MBNRk7asUlQR1qh2btzqPB43/hNrew geWoq55JZB3CZrT7wyc0NQH7HMqsNYHPlhjIsyq3dfO17DJlb4SPsylEKxoYH5XC+d43iMbF5OF jASzCgvYF6PdKmDxG7YeeC/0db0UMrZ3O7805jgc4g+/1S4eDhzqG0sLRIcLL8nHg5WyEFQyw7k w3LelzZx5K/MYY05harFGtNGqiKqiIZYahfwp76QWNDE2XLsPKuoY= X-Google-Smtp-Source: AGHT+IHAzigMmzPP1+ZYPNLO0o5XFWGdIcb1hATwaaISE1g3M0WMhbJ56JjlYsqQRHSqTKJCUIWyRg== X-Received: by 2002:a17:902:d486:b0:205:968b:31cf with SMTP id d9443c01a7336-205968b36d2mr72498455ad.33.1725413114420; Tue, 03 Sep 2024 18:25:14 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-206aea530casm3978835ad.184.2024.09.03.18.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 18:25:13 -0700 (PDT) From: Samuel Holland To: opensbi@lists.infradead.org Subject: [PATCH 2/3] lib: sbi_ipi: Move initial IPI clear to sbi_ipi_init() Date: Tue, 3 Sep 2024 18:24:11 -0700 Message-ID: <20240904012508.3626840-3-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240904012508.3626840-1-samuel.holland@sifive.com> References: <20240904012508.3626840-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-20240903_182515_701045_ABBBFA79 X-CRM114-Status: GOOD ( 18.46 ) 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:536 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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 -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. 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 --- 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 3706acfb..6731e7e5 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -183,7 +183,7 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid) /* * 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 0ce27ba1..3544f221 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -328,14 +328,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 b572ad81..b6499594 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; } /*