From patchwork Mon Mar 21 05:15:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayuresh Chitale X-Patchwork-Id: 1607569 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=Nn37vHue; 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=WWkqLxS8; 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 4KMNBN0YFlz9s0r for ; Mon, 21 Mar 2022 16:16:12 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=G/avzlAyCjhIwSILbuIhCcMYSzLiM8b+BP4GO6JgDEc=; b=Nn37vHueNonnPq y43Q8leT1qql3RUxxEGbP9P15keB9BA+uNGtyDGOZG1GSj9iwyIBn1znnAwzTJV4519vtpKx65QAA hA3GXTpmp49738e7VYilBSS6OSM8drH928dPmuQCFdOSbbOdzoQRBNWkNIN7wR+HVuZzTMMwto6RM 4bk0m1/hSdhwY98zyGOUq/tVXfLO+seijukb9fLbeFj/zeYm6cf1F7Wd8kGsPcwDN9BthS6kbTRny P3K/j1IhFsyylayIVyrR0UDxlzWq+4vFMdnUe0R2aKZYWWvX3OGEvpyzTr6cTHzktpOLhV1HWOyvs JrSVJ3gJ1eEl/WxTFY/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWAOb-006YQL-R2; Mon, 21 Mar 2022 05:15:57 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWAOY-006YOh-NM for opensbi@lists.infradead.org; Mon, 21 Mar 2022 05:15:56 +0000 Received: by mail-pj1-x1035.google.com with SMTP id n7-20020a17090aab8700b001c6aa871860so7330631pjq.2 for ; Sun, 20 Mar 2022 22:15:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xJ86WE04qyGVb+aBGBuCTYnNUlJnbYHi6n0MDAqoUiU=; b=WWkqLxS88QRJ6iS9rsd7W9fy6QpIVJWsRn4phZ6NBSgHiaYsH7faA5ocDu9KxoJApC W64Ld3GzQ7FlfrS0U0mgRsyDlYDv9FQCIeYojhi+xzZgcO6HjCbdj6QMIRce02xrejBr IiqmAvwVBKEXiYKWrlSdSd2vxa3jgarS0y5er3aqspN1wflKNvds4L0BW/GHFP945fPR CIV0P9T4ZJom4Nwe+Y54pbenj+5XukZ+J/lIeXKg8ZHnX5rC4PFItQAtIA5MTeVw+Xc2 JxuQIP7TNFemBM0EKTq2aFZwmO3o8RklAPqLFDYeyzwYzm9Tz5/9fy0F0qXgg6J7/lCz opsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xJ86WE04qyGVb+aBGBuCTYnNUlJnbYHi6n0MDAqoUiU=; b=IUvG9s/Si58LmhzEAbt1Y82jqMBu3ObOvwD0R1fobHgrmC5kDHJ2xeJomYNkw6Gt3a AlvyVUWVPsDJpwKzYjMB9Ge7ZRdVRyTy3hbJLo/5rS63O1eRHvEEAPnctsm2bMdVCbAP 1nMrsdS/HWj6W/8CIs6uW3liehE2yAwB/kQY2wsAo4d5K6Zta6rR8TcSe8V86614A5UG bgyVpFgxhUF9nRv1clW6kQ1o4DCODP7tvTBEKTtdRNIcus70qLRSlqQYrlpy067XkcY3 lT16MUkWj/bSpiQ55FpIIMjUWpgNi9kekI03ZFx70VbDt4s6/JzkWtNaNX/z+oqjm6iB r2Ug== X-Gm-Message-State: AOAM530VrRpvxfFfr5nHKD6nAebf8TqoecPkttfddqhg09OsmUc8X1ov qFkwFYw2XaC6eGimEEkAfPFyA+FJw8SGeBLu X-Google-Smtp-Source: ABdhPJzqQKYXSG3/UEUFQkOxF8oULv7n4ESZMG1alqXOjzio0o6Vs+N3WLQggEFH1QOtESQN9ix2VA== X-Received: by 2002:a17:902:9043:b0:14f:aa08:8497 with SMTP id w3-20020a170902904300b0014faa088497mr11054555plz.109.1647839753562; Sun, 20 Mar 2022 22:15:53 -0700 (PDT) Received: from ThinkPad-T490.dc1.ventanamicro.com ([171.50.204.174]) by smtp.googlemail.com with ESMTPSA id w8-20020a63a748000000b0038117e18f02sm13503920pgo.29.2022.03.20.22.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Mar 2022 22:15:53 -0700 (PDT) From: Mayuresh Chitale To: opensbi@lists.infradead.org Cc: Mayuresh Chitale Subject: [RFC PATCH v1 3/3] lib: sbi: configure mstateen Date: Mon, 21 Mar 2022 10:45:28 +0530 Message-Id: <20220321051528.20143-4-mchitale@ventanamicro.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220321051528.20143-1-mchitale@ventanamicro.com> References: <20220321051528.20143-1-mchitale@ventanamicro.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220320_221554_794336_C85A71DA X-CRM114-Status: UNSURE ( 8.71 ) 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: When mstateen registers are implemented, the AIA related configurations need to be done in mstateen for the IMSIC initialization to succeed. Signed-off-by: Mayuresh Chitale --- lib/sbi/sbi_hart.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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:1035 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: , MIME-Version: 1.0 Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When mstateen registers are implemented, the AIA related configurations need to be done in mstateen for the IMSIC initialization to succeed. Signed-off-by: Mayuresh Chitale --- lib/sbi/sbi_hart.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 9d0c435..f5c44e1 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -80,6 +80,15 @@ static void mstatus_init(struct sbi_scratch *scratch) mstateen_val |= (1UL << SMSTATEEN0_HSENVCFG); else mstateen_val &= ~(1UL << SMSTATEEN0_HSENVCFG); + + if (sbi_hart_has_feature(scratch, SBI_HART_HAS_AIA)) + mstateen_val |= (1UL << SMSTATEEN0_AIA | + 1UL << SMSTATEEN0_SVSLCT | + 1UL << SMSTATEEN0_IMSIC); + else + mstateen_val &= ~(1UL << SMSTATEEN0_AIA | + 1UL << SMSTATEEN0_SVSLCT | + 1UL << SMSTATEEN0_IMSIC); csr_write(CSR_MSTATEEN0, mstateen_val); }