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; } /*