From patchwork Tue Dec 20 10:46:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Chauhan X-Patchwork-Id: 1717791 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=Eo38tWWp; 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=NNBxCyYs; 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 4NbtZw6GKjz1ydZ for ; Tue, 20 Dec 2022 21:48:08 +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=s0aK19xJyFRjxbwK+/UQ9kbwwdjEN0xmI0ux9j4j+iY=; b=Eo38tWWpvkdstQ Cmn8hOo8RDhhbOgdA9DynC5lwQ4xECB0JAnl0vple2qKBvqr3KrzAY8YwXsJlNBzAiI1T393mylFw AE5BOKo1FIYodWX2Yl400WM1mEXKce/vklxlGQ4fsm1hIDiAOlx/tyIfwe5R20oUCkx4F3saeI130 N/uYYsmGZ8ILgp1LdR8WESErdW8mY0dj83jwcHCbr0kbTo2pEqM0cC9YT9ySPiwxj54oLfCFTUHp+ MZBPf3g0mi2TUOG8vS3ykchsYYTzL3hVEbhdMYRWTIy5C6OA5VqVUCwI7Y6Lqgw91Vs//KPtR2nEE lbAvhPtIH86oVwCs5k2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7aA1-00DRtP-9p; Tue, 20 Dec 2022 10:47:50 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7a95-00DRHQ-LO for opensbi@lists.infradead.org; Tue, 20 Dec 2022 10:46:56 +0000 Received: by mail-pj1-x1034.google.com with SMTP id b13-20020a17090a5a0d00b0021906102d05so11703037pjd.5 for ; Tue, 20 Dec 2022 02:46:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=dp4O/+U9XJSonpZ+Oio2GO+HhMLNxKWejqHpOJVzfYU=; b=NNBxCyYsMVEKgox28Td7R4NUKH5+thaalEZQ79UIbD0OucC+RUwJGbgWGiCt6kVUk5 Bvn2yA+e5/b1EticLakNWF6FDp1Yb9VT3K3WpAPVitKlj3jlQJqtxlta2+CRxpSWxrhD c1Tqv7g5n+uaH/LhHIHUKye7KsuFsq/KJI81o71t3Ne7bQGR+0yms9sUWF/d70SNeunR vIMPS/o8Ktx+bzY7sSax7wMBJoYrb7iagJW4gNbV8ExwQlYvqYzzGBntsHgmYK6Pw4/w eSL4xFojQHxcMWPBR04oLA5JB5QaDYw/9kHgZE0I6j5dS6Yaz0ys7xv5o5TnAXQKEiZ/ 3Qpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=dp4O/+U9XJSonpZ+Oio2GO+HhMLNxKWejqHpOJVzfYU=; b=YZVd5DD1gUSs927HVvHrW/ep+kOz/Px1bP7/Nbl/KPZKepZ7kBGGUP/FPOEfEy+GR6 6l/IS8fuWEGi14Y+EW5cje5AXUskk4EbxzgAkMfHc7yKiRXagwSvNHiwWRO3JbHNyygY /msTwiMeFNVS8O+BxR9pBVo9APHoOYCZD+MrbvblZlfW+eDCDSyfBqknCFXPcWfvsoqM mUO0susrLBTKdLAtNhJ5+X9z0oFf18O6i0fjaDrQQNDpGsMJpkMeDwXFvzU0y5on9K6E shLSUyOPXS88yMqIwRe/n7k51HzNc0vn4lUsmByqwON52k/22kymBZDGBpGeAlG57joE nnZw== X-Gm-Message-State: ANoB5pkVTMPmbBW41bIShwC8DNX+o7UvlHAYkWERi559gofUVwv3JvaT eIVl50E4oUxNrZpPlcMn+wHPfuGE0L2xgHX8WNYIXA== X-Google-Smtp-Source: AA0mqf7Z1243mQJkVSWSRa/LURgzQ4rnWe2fXEOnzQ+MT2facXr9xN2J+WoaIWQDkjjZ4E09xkavtQ== X-Received: by 2002:a17:902:7890:b0:188:fc0c:cdb1 with SMTP id q16-20020a170902789000b00188fc0ccdb1mr43907250pll.16.1671533210590; Tue, 20 Dec 2022 02:46:50 -0800 (PST) Received: from yoga6.thechauhan.dev ([2405:201:d019:c0a2:9958:7bb7:7663:ccd9]) by smtp.gmail.com with ESMTPSA id ik30-20020a170902ab1e00b001897d30143asm8923550plb.289.2022.12.20.02.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 02:46:50 -0800 (PST) From: Himanshu Chauhan To: opensbi@lists.infradead.org Cc: Himanshu Chauhan Subject: [PATCH 8/9] lib: utils: Add M-mode {R/W} flags to the MMIO regions Date: Tue, 20 Dec 2022 16:16:24 +0530 Message-Id: <20221220104625.80667-9-hchauhan@ventanamicro.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221220104625.80667-1-hchauhan@ventanamicro.com> References: <20221220104625.80667-1-hchauhan@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221220_024651_809882_BBD50531 X-CRM114-Status: UNSURE ( 9.11 ) X-CRM114-Notice: Please train this message. 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: Add the M-mode readable/writable flags to mmio regions of various drivers. Signed-off-by: Himanshu Chauhan --- lib/utils/ipi/aclint_mswi.c | 4 +++- lib/utils/irqchip/aplic.c | 4 +++- lib/utils/irqchip/imsic.c | 4 +++- lib/utils/timer/aclint_mtimer [...] 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:1034 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 Add the M-mode readable/writable flags to mmio regions of various drivers. Signed-off-by: Himanshu Chauhan Reviewed-by: Anup Patel --- lib/utils/ipi/aclint_mswi.c | 4 +++- lib/utils/irqchip/aplic.c | 4 +++- lib/utils/irqchip/imsic.c | 4 +++- lib/utils/timer/aclint_mtimer.c | 16 ++++++++++++---- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c index 832e223..c714a89 100644 --- a/lib/utils/ipi/aclint_mswi.c +++ b/lib/utils/ipi/aclint_mswi.c @@ -88,7 +88,9 @@ int aclint_mswi_cold_init(struct aclint_mswi_data *mswi) region_size = ((mswi->size - pos) < ACLINT_MSWI_ALIGN) ? (mswi->size - pos) : ACLINT_MSWI_ALIGN; sbi_domain_memregion_init(mswi->addr + pos, region_size, - SBI_DOMAIN_MEMREGION_MMIO, ®); + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_M_READABLE | + SBI_DOMAIN_MEMREGION_M_WRITABLE), ®); rc = sbi_domain_root_add_memregion(®); if (rc) return rc; diff --git a/lib/utils/irqchip/aplic.c b/lib/utils/irqchip/aplic.c index 0a8469b..858e9b2 100644 --- a/lib/utils/irqchip/aplic.c +++ b/lib/utils/irqchip/aplic.c @@ -269,7 +269,9 @@ int aplic_cold_irqchip_init(struct aplic_data *aplic) (last_deleg_irq == aplic->num_source) && (first_deleg_irq == 1))) { sbi_domain_memregion_init(aplic->addr, aplic->size, - SBI_DOMAIN_MEMREGION_MMIO, ®); + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_M_READABLE | + SBI_DOMAIN_MEMREGION_M_WRITABLE), ®); rc = sbi_domain_root_add_memregion(®); if (rc) return rc; diff --git a/lib/utils/irqchip/imsic.c b/lib/utils/irqchip/imsic.c index 98f2cb6..ada4f3b 100644 --- a/lib/utils/irqchip/imsic.c +++ b/lib/utils/irqchip/imsic.c @@ -313,7 +313,9 @@ int imsic_cold_irqchip_init(struct imsic_data *imsic) for (i = 0; i < IMSIC_MAX_REGS && imsic->regs[i].size; i++) { sbi_domain_memregion_init(imsic->regs[i].addr, imsic->regs[i].size, - SBI_DOMAIN_MEMREGION_MMIO, ®); + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_M_READABLE | + SBI_DOMAIN_MEMREGION_M_WRITABLE), ®); rc = sbi_domain_root_add_memregion(®); if (rc) return rc; diff --git a/lib/utils/timer/aclint_mtimer.c b/lib/utils/timer/aclint_mtimer.c index 1846a9a..84ded4e 100644 --- a/lib/utils/timer/aclint_mtimer.c +++ b/lib/utils/timer/aclint_mtimer.c @@ -188,26 +188,34 @@ int aclint_mtimer_cold_init(struct aclint_mtimer_data *mt, rc = sbi_domain_root_add_memrange(mt->mtimecmp_addr, mt->mtime_size + mt->mtimecmp_size, MTIMER_REGION_ALIGN, - SBI_DOMAIN_MEMREGION_MMIO); + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_M_READABLE | + SBI_DOMAIN_MEMREGION_M_WRITABLE)); if (rc) return rc; } else if (mt->mtimecmp_addr == (mt->mtime_addr + mt->mtime_size)) { rc = sbi_domain_root_add_memrange(mt->mtime_addr, mt->mtime_size + mt->mtimecmp_size, MTIMER_REGION_ALIGN, - SBI_DOMAIN_MEMREGION_MMIO); + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_M_READABLE | + SBI_DOMAIN_MEMREGION_M_WRITABLE)); if (rc) return rc; } else { rc = sbi_domain_root_add_memrange(mt->mtime_addr, mt->mtime_size, MTIMER_REGION_ALIGN, - SBI_DOMAIN_MEMREGION_MMIO); + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_M_READABLE | + SBI_DOMAIN_MEMREGION_M_WRITABLE)); if (rc) return rc; rc = sbi_domain_root_add_memrange(mt->mtimecmp_addr, mt->mtimecmp_size, MTIMER_REGION_ALIGN, - SBI_DOMAIN_MEMREGION_MMIO); + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_M_READABLE | + SBI_DOMAIN_MEMREGION_M_WRITABLE)); if (rc) return rc; }