From patchwork Mon Jan 9 05:20:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Chauhan X-Patchwork-Id: 1723154 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=hGdVaDCD; 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=Sep70qH7; 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 4Nr2PJ3cFvz23g8 for ; Mon, 9 Jan 2023 16:21:56 +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=u2srqs7+8BkY5EpTKy8EIGj8ED4chC+h84amdJ+Chj8=; b=hGdVaDCD2LmajB MXq8DGztQoTmlkBQe+DMNtKbu7qTgiUyircjzdhULkwcbj2ylZGb3MQGzGdv39rhRIJw4rrz3/J8M 5pFOq5P7sCigl8tLIj4x2CGjRqlUZkGNTXuGRCoaAPf4LRWMbiDkh6oKUxaDrJ8/VmIPs9OOT+bbN 59XtAvVBD50EDFKJ7eYPm9rtXQyfiLS2RlNqvngt8N+/bPStqwHQDJ2zftroZ60kGZkA05ZbFTa5p /mvBQsyAeKh4G0wUnTGC7Nlxbww9KYqjGw8pWcQkEb+R5gha6tcxQ8zQQaEvpcDIYU4IGZES/I6ws UOGv96h3GJPGtrMhrG3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkbN-00HQtX-Uk; Mon, 09 Jan 2023 05:21:41 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkbJ-00HQp8-Ay for opensbi@lists.infradead.org; Mon, 09 Jan 2023 05:21:39 +0000 Received: by mail-pl1-x62e.google.com with SMTP id y1so8356059plb.2 for ; Sun, 08 Jan 2023 21:21:37 -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=qCdQPHtpleX7N7I40ECAXbaalRtPXH+0zv/UGc/93NQ=; b=Sep70qH73+SeHxYDRD6lKPQrZuK5oiuJqHyaBKQro/0zFlQ6NRuDQYVdJUIsyMw2Dw Pug+PAmDP7cHwlSfqK5GmmHkzf5rg0a5f763Xy36YeXF9Wa0eM7eE4c+62LPBRwSDhxk L2himgDVF/zt6QtDmUD2fasFXD/4gv7w9S1vf5ZpacHUe2GfZmXRV+nBsfafanhfcjut FQWzGqSgH1JqGPSGsFt0a6mMHGTLSOl9FOIsy96jw2MY4vLIfysU6OWrkCpglF3G7pkh fxcWgTlC/7xRbz52B6f6XZuuwZssU6u4RS1+pbyYLkEI3vDa3t+t1tXMZqb/LusanNKt xBSQ== 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=qCdQPHtpleX7N7I40ECAXbaalRtPXH+0zv/UGc/93NQ=; b=PgBAjvC+XyiTbToG1XOxhU2kkaKd1LXuBY4G36BScPq1Doj/k1+IPTbSEL6vj1cSCg /Jo2pB+feVtxu/rowrL85JW/iDP+1/mc2tjCnIGDOoXtD6Xuv7Akr9dnj6ltant+OrAJ lD2rM3JIzaUDpYfPALz4UAIozMB/ghYss0jaNGF/Ew7/KVtt68s4/2E2Hi3IOjxCiM0P 3rTJREXLBXXdg1DUlk8BaInEXxP1COrKAOQYPpnQUFllFOhQtCHt2jRS9D6nXcJxlnMQ Vq9ZBr4fp/EKqYp/4839hjPAQCWbLEZwO4tMuZlkp3lnPf9TWmSNjvcWVzg39HAhqelw uNaA== X-Gm-Message-State: AFqh2krDsOuwXpGKcwUkMMcYLiHOcrxFk+1F9ebLJpO65XfM6uFVvP5c b6HAo/7UYRPZ1ybETB8tYrR/2WwjqhAx7pLo X-Google-Smtp-Source: AMrXdXuSfVbKU/q9Raqq/IV57zI1q5AboGTk1hHm1cCDD05G4RCFXoa2YXLTUizffpEMwRqw3zU1KA== X-Received: by 2002:a17:902:6f17:b0:193:1c62:29c8 with SMTP id w23-20020a1709026f1700b001931c6229c8mr5450052plk.51.1673241696440; Sun, 08 Jan 2023 21:21:36 -0800 (PST) Received: from localhost.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id e6-20020a17090301c600b00192dda430ddsm4992027plh.123.2023.01.08.21.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 21:21:36 -0800 (PST) From: Himanshu Chauhan To: opensbi@lists.infradead.org Cc: Himanshu Chauhan , Anup Patel Subject: [PATCH v2 8/9] lib: utils: Add M-mode {R/W} flags to the MMIO regions Date: Mon, 9 Jan 2023 05:20:42 +0000 Message-Id: <20230109052043.55473-9-hchauhan@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109052043.55473-1-hchauhan@ventanamicro.com> References: <20230109052043.55473-1-hchauhan@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230108_212137_578324_32189AF8 X-CRM114-Status: UNSURE ( 9.52 ) 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 Reviewed-by: Anup Patel --- lib/utils/ipi/aclint_mswi.c | 4 +++- lib/utils/irqchip/aplic.c | 4 +++- lib/utils/irqchip/ [...] 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:62e 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; }