From patchwork Wed Jul 5 06:45:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1803438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=OAeKP6u/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=h6I2ZzW7; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QwqtS35vDz20ZC for ; Wed, 5 Jul 2023 16:45:50 +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: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:In-Reply-To:References: List-Owner; bh=TCBgn5TJ3gPv/QWBVHC674ublGs2thFSKtp6CiR/CuM=; b=OAeKP6u/lbEpzK YJy8Vd85Pch529V+n1KZsii9kFE45y10Zw6eiBQfuzr25IBA4llAR1oP8mUWgrwYsbjiEJNPipLVU yiDKNQFu+74RacbYCFZdt0bbinUSsYU11Hf910TzRsZrIipjAYt6tRwjey84/WW66MuoG3hY0ttTH LD5MJmprX/PCHrcypVTdpFxhRNmsGQHcawtWhYHKP2bdYzhvu3X+Ej4gHZg6TZ3rJjXGgKN2WLwze E6ZhbmMo/gGmIhfwzDOh9mI4WVT2nTpAMAE64Tv67PaEJLAe2a5+mBSdonFqu50xBor+HbTYRL4wW 5NmO0SzV7FwflmuTbzUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGwGW-00EvT9-1P; Wed, 05 Jul 2023 06:45:28 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGwGT-00EvSf-2K for opensbi@lists.infradead.org; Wed, 05 Jul 2023 06:45:27 +0000 Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-7835ffc53bfso7917339f.1 for ; Tue, 04 Jul 2023 23:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1688539524; x=1691131524; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=okGcymyWXf8BMOoZoaEHg/GMLFl19fhgNbl1myDiugE=; b=h6I2ZzW7y3FtOb6mNHepp2yTBthcY2s4kPkyL5FwutMvr/ib2N3aasR0xBvmkpa5Pu 9JO14aXwdbqXJPzdVj/0Fw6v5eSUZX3GAksqXlBu6nmhoozLrwx9diY0DmcVM4D5MVRd cKZJcX3g8USr+pr2nkkbcxDU3wBg1JBSIuOrYmoVfIhe+oyCUYqid+FksIaOo0ryvTUa kWadthX2JL6aNDLq1ufuS3edscOjV5Rq6NOLc5MroGNw6s3OgQBoqKse0CCWenI5En3J 9HWqTWOiktfiudpSnUnr9CzbOrYIz6VuLsRF1Tkz8fjbld4vP6PUAHEY+eGUeWk78r4R piuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688539524; x=1691131524; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=okGcymyWXf8BMOoZoaEHg/GMLFl19fhgNbl1myDiugE=; b=A2xW8hV4lR6xqU39uU8GGWIc4uMMA7oB3ev7ZNc2G+8APgGenLfJ9AFtfP79mNPpMe JxxgE8+aDMg+WtiA/Nefw1hI9wUqpauDpeFXAXiHEpuy3tpNiOyrNPHdLM536kaWMc5P dBZ3e7lffv0/KwJXnR0RG5F6WzztyN+SkO5dh3uIqfjYJM/8AlGrlggFHfFBqn2DVee0 tN+6QMmq0cTfOJr5EevaEzGDkusb2emElI3ermtBVyOvlBse4uU7EOD5/X5FOsq6LYWj lkP/DA8246O8IfoE3+WJ9MBtButqlH+rRpm4+xjWmmmlh4CQJPqxdplBDJoafFUIjeNN 5X9A== X-Gm-Message-State: ABy/qLblKRb1FcMmkbfy/dyuL+hnn0ZGOTjzIK/NQao0evDRH1P2tXEV Pdlmf2Hd8cZuG2EhBN6+s9SIJQ== X-Google-Smtp-Source: APBJJlELtcnAvYKCUb+5MXKQt7q8QM1/NbAfmAAl27C5pvQii1R+ITqJNx0RC3GhHYLbV/wLBuLVjw== X-Received: by 2002:a05:6602:2c89:b0:783:6aa0:9816 with SMTP id i9-20020a0566022c8900b007836aa09816mr1356692iow.7.1688539523814; Tue, 04 Jul 2023 23:45:23 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id x14-20020a02ac8e000000b0042b060ad00esm3968102jan.90.2023.07.04.23.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 23:45:23 -0700 (PDT) From: Anup Patel To: Atish Patra Cc: Andrew Jones , Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH] lib: utils: Fix sbi_hartid_to_scratch() usage in ACLINT drivers Date: Wed, 5 Jul 2023 12:15:15 +0530 Message-Id: <20230705064515.1007478-1-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_234525_784635_1672DBF9 X-CRM114-Status: GOOD ( 10.27 ) X-Spam-Score: -0.2 (/) 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: The cold_init() functions of ACLINT drivers should skip the HART is sbi_hartid_to_scratch() returns NULL because we might be dealing with a HART that is disabled in the device tree. Signed-off-by: Anup Patel --- lib/utils/ipi/aclint_mswi.c | 7 ++++++- lib/utils/timer/aclint_mtimer.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) Content analysis details: (-0.2 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:d35 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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 The cold_init() functions of ACLINT drivers should skip the HART is sbi_hartid_to_scratch() returns NULL because we might be dealing with a HART that is disabled in the device tree. Signed-off-by: Anup Patel Reviewed-by: Xiang W --- lib/utils/ipi/aclint_mswi.c | 7 ++++++- lib/utils/timer/aclint_mtimer.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c index f47b3bc..140a49b 100644 --- a/lib/utils/ipi/aclint_mswi.c +++ b/lib/utils/ipi/aclint_mswi.c @@ -101,8 +101,13 @@ int aclint_mswi_cold_init(struct aclint_mswi_data *mswi) /* Update MSWI pointer in scratch space */ for (i = 0; i < mswi->hart_count; i++) { scratch = sbi_hartid_to_scratch(mswi->first_hartid + i); + /* + * We don't need to fail if scratch pointer is not available + * because we might be dealing with hartid of a HART disabled + * in the device tree. + */ if (!scratch) - return SBI_ENOENT; + continue; mswi_set_hart_data_ptr(scratch, mswi); } diff --git a/lib/utils/timer/aclint_mtimer.c b/lib/utils/timer/aclint_mtimer.c index 13af5d8..271e625 100644 --- a/lib/utils/timer/aclint_mtimer.c +++ b/lib/utils/timer/aclint_mtimer.c @@ -219,8 +219,13 @@ int aclint_mtimer_cold_init(struct aclint_mtimer_data *mt, /* Update MTIMER pointer in scratch space */ for (i = 0; i < mt->hart_count; i++) { scratch = sbi_hartid_to_scratch(mt->first_hartid + i); + /* + * We don't need to fail if scratch pointer is not available + * because we might be dealing with hartid of a HART disabled + * in the device tree. + */ if (!scratch) - return SBI_ENOENT; + continue; mtimer_set_hart_data_ptr(scratch, mt); }