Re: [PATCH 2/2] iommu/arm-smmu: Allow client devices to select direct mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Evan,

On 2020-04-14 04:42, Evan Green wrote:
On Wed, Jan 22, 2020 at 3:48 AM Sai Prakash Ranjan
<saiprakash.ranjan@xxxxxxxxxxxxxx> wrote:

From: Jordan Crouse <jcrouse@xxxxxxxxxxxxxx>

Some client devices want to directly map the IOMMU themselves instead
of using the DMA domain. Allow those devices to opt in to direct
mapping by way of a list of compatible strings.

Signed-off-by: Jordan Crouse <jcrouse@xxxxxxxxxxxxxx>
Co-developed-by: Sai Prakash Ranjan <saiprakash.ranjan@xxxxxxxxxxxxxx>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@xxxxxxxxxxxxxx>
---
drivers/iommu/arm-smmu-qcom.c | 39 +++++++++++++++++++++++++++++++++++
 drivers/iommu/arm-smmu.c      |  3 +++
 drivers/iommu/arm-smmu.h      |  5 +++++
 3 files changed, 47 insertions(+)

diff --git a/drivers/iommu/arm-smmu-qcom.c b/drivers/iommu/arm-smmu-qcom.c
index 64a4ab270ab7..ff746acd1c81 100644
--- a/drivers/iommu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm-smmu-qcom.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2019, The Linux Foundation. All rights reserved.
  */

+#include <linux/of_device.h>
 #include <linux/qcom_scm.h>

 #include "arm-smmu.h"
@@ -11,6 +12,43 @@ struct qcom_smmu {
        struct arm_smmu_device smmu;
 };

+static const struct arm_smmu_client_match_data qcom_adreno = {
+       .direct_mapping = true,
+};
+
+static const struct arm_smmu_client_match_data qcom_mdss = {
+       .direct_mapping = true,

I don't actually see direct_mapping being used. Shouldn't this member
be checked somewhere?


Thanks for spotting this, my bad. It should be checked in qcom_smmu_request_domain().

diff --git a/drivers/iommu/arm-smmu-qcom.c b/drivers/iommu/arm-smmu-qcom.c
index ff746acd1c81..3ff62ca13ad5 100644
--- a/drivers/iommu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm-smmu-qcom.c
@@ -43,7 +43,7 @@ static int qcom_smmu_request_domain(struct device *dev)
        const struct arm_smmu_client_match_data *client;

        client = qcom_smmu_client_data(dev);
-       if (client)
+       if (client && client->direct_mapping)
                iommu_request_dm_for_dev(dev);

        return 0;

-Sai

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux