lkml.org 
[lkml]   [2020]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/2] iommu/arm-smmu: Allow client devices to select direct mapping
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@codeaurora.org> wrote:
>>
>> From: Jordan Crouse <jcrouse@codeaurora.org>
>>
>> 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@codeaurora.org>
>> Co-developed-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
>> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
>> ---
>> 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

\
 
 \ /
  Last update: 2020-04-14 18:19    [W:0.066 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site