From patchwork Fri Aug 30 15:49:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1979100 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=sRNJ+Wf2; 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=eNqv2a3D; 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 4WwMzK3TRwz1yfX for ; Sat, 31 Aug 2024 01:49:49 +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=hOlkHx4pgYb1ca66FyaMQsLkcpkucX4gosj6FXW1U+E=; b=sRNJ+Wf2QkhvWi 0znnC8MwdWmSP2N2kcqii6WvwIAu0toAJyNfcsz55RRdEm3sDhgyzbCFOdHewt8nS1KbxouaQKWf5 ZNmOAsWxnF6rbO4U7naDowULOT7glr4r4Po35JTTLXUpnQAxHfWG88ZP89s/y6qNn6puh1qjHPGq+ LYZ+92fVaZPTNNkoO+xI8Z0vmnLtevXYFnVWvNfG1lknyGjEpCUPrMQE7jcU8cmMT86UL3i0XrSJT 63BOOpzZSND8IKKiP4zjIzv04mMdxLmwfPb8XygQLw8uXrOjign5IajxWysyV2S7SekG3CJrWSpNZ qy6T5W9j8vR6PRkhb+hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sk3sc-00000006sYo-43hz; Fri, 30 Aug 2024 15:49:42 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sk3sZ-00000006sWY-26V7 for opensbi@lists.infradead.org; Fri, 30 Aug 2024 15:49:40 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-715abede256so1541945b3a.3 for ; Fri, 30 Aug 2024 08:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1725032978; x=1725637778; 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=qcyl/76NWzoam0tpvnZ8TZDmqTSE4wP7HSnSDZzgUOI=; b=eNqv2a3D5iRndIm0S67t7OcOgVDwfYH0NGpKf3kMcR4RPJkAFBtT2d1K6ZypbcL3hE ObZaWJG4llFudFTwsb022LqFRhYGmNDsKViXIOwDO5auRVjKU3iUDf/wPptlQ4GdLEpS asv5IPhOrUxbxlxdsZXh/FtCIi3vCFtxeolBB19y/ZQveBqMm17VFF5NEMasoNZWpRwL lXrkcH1EqiXB8IDL1dmUKPdGMB57UA1P7XrWU7tUprWSJPTsSp69JK+Hggj6k68EJUJP arRIM7+8EtrbuIUO17SOS02WtY/f8zu5zirMd5S+g0DNuVwd8XN36liBOK1rteZbHDYA EQeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725032978; x=1725637778; 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=qcyl/76NWzoam0tpvnZ8TZDmqTSE4wP7HSnSDZzgUOI=; b=u6KQpL3VzyvpcgXEB1+7NQZ+2GYcBIyn0QLwKtJcRBgo5HT38p/n627EHCX+H5c5q8 y4DWZ/P1fPFHxn22YRzcTg5vfPXatQlaEFDTkDPr7honYGT0egomuwe7iXfa55dOvIcS O4BFMZuHrI6v1a0+lpg6lQjl0j1wCafQE4OXzyr9Lk/mKBBu2nChaFkflTbMVMm9BMZi USBaLY5+1YQ82zRkKGqNuYePGa9n+q3Nv0JiTcc2vW+LQ+STqqrJyR/8rXuaGv1IIhY3 6lqzLexiux8tkC3NQJyLghx5TNdL/l/JIMO6/2ruYseTy+aZM+sRnUXXm8l3YNF/lqsj IEpA== X-Gm-Message-State: AOJu0YwDdUfNegjmRsQgZP4JhsV9Uh/FbNQJ6kT6Fjt9YhdEtY8eidar hBqDZrwlcx6JUvPx5Iy49e9lDNJ/TiPZp/sNCy5/ng5I97sMUaghLPSoYQX/QKquPL/NtgVGP4w A1Ug/RbtJZlA2R4fe8LoBXYyZ3E7AAm4+iLUt2rIcfsibt9gX0mwG3OEmFyaJ9jJ+OlInNyH+lt oxXUlXpVK5tKiv7POZn5DmMkdaEifUYOOoFBSF1SIOilx1bj/zl50= X-Google-Smtp-Source: AGHT+IHeTnVXgaBXFMYJA8I+85gYdv9j0uS81lkGKgZ2bYT7wP/6WwEc/E4JKM6iNPozQhV30A096g== X-Received: by 2002:a05:6a20:d524:b0:1c8:961c:4143 with SMTP id adf61e73a8af0-1cce10a9c02mr5902787637.36.1725032978256; Fri, 30 Aug 2024 08:49:38 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-715e569e793sm2920817b3a.131.2024.08.30.08.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 08:49:37 -0700 (PDT) From: Samuel Holland To: opensbi@lists.infradead.org Subject: [PATCH 05/12] lib: utils/irqchip: Look up IMSIC data by hart index Date: Fri, 30 Aug 2024 08:49:09 -0700 Message-ID: <20240830154929.3971790-6-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240830154929.3971790-1-samuel.holland@sifive.com> References: <20240830154929.3971790-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-20240830_084939_566936_85589D32 X-CRM114-Status: GOOD ( 10.64 ) 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: This avoids needing to map a hartid to a hart index. Signed-off-by: Samuel Holland --- include/sbi_utils/irqchip/imsic.h | 4 ++-- lib/utils/irqchip/imsic.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) 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:434 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 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_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 This avoids needing to map a hartid to a hart index. Signed-off-by: Samuel Holland Reviewed-by: Anup Patel --- include/sbi_utils/irqchip/imsic.h | 4 ++-- lib/utils/irqchip/imsic.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/sbi_utils/irqchip/imsic.h b/include/sbi_utils/irqchip/imsic.h index e295771e..bc9292d3 100644 --- a/include/sbi_utils/irqchip/imsic.h +++ b/include/sbi_utils/irqchip/imsic.h @@ -37,9 +37,9 @@ struct imsic_data { int imsic_map_hartid_to_data(u32 hartid, struct imsic_data *imsic, int file); -struct imsic_data *imsic_get_data(u32 hartid); +struct imsic_data *imsic_get_data(u32 hartindex); -int imsic_get_target_file(u32 hartid); +int imsic_get_target_file(u32 hartindex); void imsic_local_irqchip_init(void); diff --git a/lib/utils/irqchip/imsic.c b/lib/utils/irqchip/imsic.c index bac72d21..ee532bb4 100644 --- a/lib/utils/irqchip/imsic.c +++ b/lib/utils/irqchip/imsic.c @@ -119,28 +119,28 @@ int imsic_map_hartid_to_data(u32 hartid, struct imsic_data *imsic, int file) return 0; } -struct imsic_data *imsic_get_data(u32 hartid) +struct imsic_data *imsic_get_data(u32 hartindex) { struct sbi_scratch *scratch; if (!imsic_ptr_offset) return NULL; - scratch = sbi_hartid_to_scratch(hartid); + scratch = sbi_hartindex_to_scratch(hartindex); if (!scratch) return NULL; return imsic_get_hart_data_ptr(scratch); } -int imsic_get_target_file(u32 hartid) +int imsic_get_target_file(u32 hartindex) { struct sbi_scratch *scratch; if (!imsic_file_offset) return SBI_ENOENT; - scratch = sbi_hartid_to_scratch(hartid); + scratch = sbi_hartindex_to_scratch(hartindex); if (!scratch) return SBI_ENOENT; @@ -257,7 +257,7 @@ void imsic_local_irqchip_init(void) int imsic_warm_irqchip_init(void) { - struct imsic_data *imsic = imsic_get_data(current_hartid()); + struct imsic_data *imsic = imsic_get_data(current_hartindex()); /* Sanity checks */ if (!imsic || !imsic->targets_mmode)