mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Masney <masneyb@onstation.org>
To: bjorn.andersson@linaro.org
Cc: agross@kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] firmware: qcom: scm: add 32 bit iommu page table support
Date: Tue, 31 Dec 2019 22:37:04 -0500	[thread overview]
Message-ID: <20200101033704.32264-1-masneyb@onstation.org> (raw)

Add 32 bit implmentations of the functions
__qcom_scm_iommu_secure_ptbl_size() and
__qcom_scm_iommu_secure_ptbl_init() that are required by the qcom_iommu
driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 drivers/firmware/qcom_scm-32.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/qcom_scm-32.c b/drivers/firmware/qcom_scm-32.c
index 48e2ef794ea3..f149a85d36b0 100644
--- a/drivers/firmware/qcom_scm-32.c
+++ b/drivers/firmware/qcom_scm-32.c
@@ -638,13 +638,41 @@ int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id,
 int __qcom_scm_iommu_secure_ptbl_size(struct device *dev, u32 spare,
 				      size_t *size)
 {
-	return -ENODEV;
+	int psize[2] = { 0, 0 };
+	int ret;
+
+	ret = qcom_scm_call(dev, QCOM_SCM_SVC_MP,
+			    QCOM_SCM_IOMMU_SECURE_PTBL_SIZE,
+			    &spare, sizeof(spare), &psize, sizeof(psize));
+	if (ret || psize[1])
+		return ret ? ret : -EINVAL;
+
+	*size = psize[0];
+
+	return 0;
 }
 
 int __qcom_scm_iommu_secure_ptbl_init(struct device *dev, u64 addr, u32 size,
 				      u32 spare)
 {
-	return -ENODEV;
+	struct msm_scm_ptbl_init {
+		__le32 paddr;
+		__le32 size;
+		__le32 spare;
+	} req;
+	int ret, scm_ret = 0;
+
+	req.paddr = addr;
+	req.size = size;
+	req.spare = spare;
+
+	ret = qcom_scm_call(dev, QCOM_SCM_SVC_MP,
+			    QCOM_SCM_IOMMU_SECURE_PTBL_INIT,
+			    &req, sizeof(req), &scm_ret, sizeof(scm_ret));
+	if (ret || scm_ret)
+		return ret ? ret : -EINVAL;
+
+	return 0;
 }
 
 int __qcom_scm_io_readl(struct device *dev, phys_addr_t addr,
-- 
2.21.0


             reply	other threads:[~2020-01-01  3:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-01  3:37 Brian Masney [this message]
2020-01-01 11:15 ` Stephan Gerhold
2020-01-01 20:14   ` Rob Clark
2020-01-05  6:56     ` Stephen Boyd
2020-01-02  7:36 ` Bjorn Andersson
2020-01-02  8:50   ` Brian Masney
2020-01-04  2:24   ` Brian Masney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200101033704.32264-1-masneyb@onstation.org \
    --to=masneyb@onstation.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®