From patchwork Fri Feb 11 11:11:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Shubin X-Patchwork-Id: 1591575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=kQogGCmZ; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=maquefel.me header.i=@maquefel.me header.a=rsa-sha256 header.s=mail header.b=VvqRHcN9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jw9v572rMz9sFv for ; Fri, 11 Feb 2022 22:12:33 +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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U95kY8qL+OffoXMRKj+MSZaIVoNBqgaDWSjkN4CXbDE=; b=kQogGCmZOJhNqT RW5Pco2UAW8hq9PwiOG+X/9oDViWP+CqM/VrlY8tVE0WfFpu3tSP8afWuCToUlYg5pHAdXTrJrtkV PIZrcvA/IdL38qgxH8oIwzBXby1eSc94QQ9zvZoXdrhzmYdjPoHI4ezSnixZME5VFlQbu22egG20s 8lbq5qOILSSeCToGtHnN0bINDrCeelYfpeUx02bU6jaoXwxxj01sRu47FU84kOBxLKiq5ahp72Y5P Z/f5yt50Pd5FFLqGYFtZ1PShr8hmrk0d8vwcEGmorlHVGQI/8ZUsJbnBSstwgEmhEog1ov/tC7UBR LFxqoZK8ptt2E9bmrbLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nITqX-006pts-OO; Fri, 11 Feb 2022 11:12:13 +0000 Received: from forward501j.mail.yandex.net ([2a02:6b8:0:801:2::111]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nITqR-006poP-Rk for opensbi@lists.infradead.org; Fri, 11 Feb 2022 11:12:11 +0000 Received: from sas8-0acb42ba66d4.qloud-c.yandex.net (sas8-0acb42ba66d4.qloud-c.yandex.net [IPv6:2a02:6b8:c1b:2a8f:0:640:acb:42ba]) by forward501j.mail.yandex.net (Yandex) with ESMTP id 7A88162356C; Fri, 11 Feb 2022 14:11:57 +0300 (MSK) Received: from sas2-34ddad429748.qloud-c.yandex.net (sas2-34ddad429748.qloud-c.yandex.net [2a02:6b8:c08:b787:0:640:34dd:ad42]) by sas8-0acb42ba66d4.qloud-c.yandex.net (mxback/Yandex) with ESMTP id pY2LusSV46-Bvd4iTkN; Fri, 11 Feb 2022 14:11:57 +0300 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1644577917; bh=sRxHwWyPMp10t4Lj5mJPnDiJ/6GdpO3Ns1hUAuLDX4Y=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=VvqRHcN9gxzTe8Z0aRot2uZh7F6r5QPlsWhltrrffCkhFV34Mfd+vmNplMSSa7qL2 fFhjc6Adopza4nvRG5IwSbVPjAWtCPybbXNwG5WdIf/dcNEQ/g+nzK+xHLxLuSzH7G GevYLJZDaXqyoAcKsAlKKuMVRx6RZWrn7DKuRitg= Authentication-Results: sas8-0acb42ba66d4.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me Received: by sas2-34ddad429748.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id t07H4YKf8b-BuI0mLoj; Fri, 11 Feb 2022 14:11:57 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Nikita Shubin To: opensbi@lists.infradead.org Cc: linux@yadro.com, Nikita Shubin Subject: [PATCH 2/3] lib: sbi: verbose sbi_domain_root_add_memregion Date: Fri, 11 Feb 2022 14:11:54 +0300 Message-Id: <20220211111155.16121-3-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220211111155.16121-1-nikita.shubin@maquefel.me> References: <20220211111155.16121-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220211_031208_140666_12781A33 X-CRM114-Status: GOOD ( 11.30 ) X-Spam-Score: -0.9 (/) 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: From: Nikita Shubin Be more verbose on region confict, print addresses in conflict. Signed-off-by: Nikita Shubin --- include/sbi/sbi_domain.h | 4 +++- lib/sbi/sbi_domain.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a02:6b8:0:801:2:0:0:111 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 From: Nikita Shubin Be more verbose on region confict, print addresses in conflict. Signed-off-by: Nikita Shubin Reviewed-by: Xiang W Reviewed-by: Anup Patel --- include/sbi/sbi_domain.h | 4 +++- lib/sbi/sbi_domain.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index 15e3a53..b90f59c 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -174,7 +174,9 @@ int sbi_domain_register(struct sbi_domain *dom, * Add a memory region to the root domain * @param reg pointer to the memory region to be added * - * @return 0 on success and negative error code on failure + * @return 0 on success + * @return SBI_EALREADY if memory region conflicts with existing + * @return SBI_EINVAL otherwise */ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg); diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index a1ac1bb..4e4c1e1 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -471,8 +471,12 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg) /* Check for conflicts */ sbi_domain_for_each_memregion(&root, nreg) { - if (is_region_conflict(reg, nreg)) - return SBI_EINVAL; + if (is_region_conflict(reg, nreg)) { + sbi_printf("%s: is_region_conflict check failed" + " 0x%lx conflicts existing 0x%lx\n", __func__, + reg->base, nreg->base); + return SBI_EALREADY; + } } /* Append the memregion to root memregions */