lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c84cf5debc171c0744e32049c70197e7@codeaurora.org>
Date:   Thu, 16 Apr 2020 23:13:50 +0530
From:   Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>
To:     Robin Murphy <robin.murphy@....com>
Cc:     Will Deacon <will@...nel.org>, Joerg Roedel <joro@...tes.org>,
        Jordan Crouse <jcrouse@...eaurora.org>,
        Rob Clark <robdclark@...il.com>,
        Tomasz Figa <tfiga@...omium.org>,
        Rajendra Nayak <rnayak@...eaurora.org>,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Stephen Boyd <swboyd@...omium.org>,
        iommu@...ts.linux-foundation.org,
        Matthias Kaehlcke <mka@...omium.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/2] iommu/arm-smmu: Allow client devices to select direct
 mapping

Hi Robin,

On 2020-04-16 22:47, Robin Murphy wrote:
> On 2020-04-16 5:23 pm, Sai Prakash Ranjan wrote:
>> Hi Robin,
>> 
>> On 2020-04-16 19:28, Robin Murphy wrote:
>>> On 2020-01-22 11:48 am, Sai Prakash Ranjan wrote:
>>>> From: Jordan Crouse <jcrouse@...eaurora.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@...eaurora.org>
>>>> Co-developed-by: Sai Prakash Ranjan 
>>>> <saiprakash.ranjan@...eaurora.org>
>>>> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.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,
>>>> +};
>>> 
>>> Might it make sense to group these by the desired SMMU behaviour
>>> rather than (apparently) what kind of device the client happens to 
>>> be,
>>> which seems like a completely arbitrary distinction from the SMMU
>>> driver's PoV?
>>> 
>> 
>> Sorry, I did not get the "grouping by the desired SMMU behaviour" 
>> thing.
>> Could you please give some more details?
> 
> I mean this pattern:
> 
> device_a_data {
> 	.thing = this;
> }
> 
> device_b_data {
> 	.thing = this;
> }
> 
> device_c_data {
> 	.thing = that;
> }
> 
> match[] = {
> 	{ .compatible = "A", .data = &device_a_data },
> 	{ .compatible = "B", .data = &device_b_data },
> 	{ .compatible = "C", .data = &device_c_data },
> };
> 
> ...vs. this pattern:
> 
> do_this {
> 	.thing = this;
> }
> 
> do_that {
> 	.thing = that;
> }
> 
> match[] = {
> 	{ .compatible = "A", .data = &do_this },
> 	{ .compatible = "B", .data = &do_this },
> 	{ .compatible = "C", .data = &do_that },
> };
> 
> From the perspective of the thing doing the thing, grouping the data
> by device is meaningless if all that matters is whether to do this or
> that. The second pattern expresses that more naturally.
> 
> Of course if every device turns out to need a unique combination of
> several behaviours, then there ends up being no practical difference
> except that it's probably easier to come up with nice names under the
> first pattern. I guess it's up to how you see this developing in
> future; whether you're likely to need fine-grained per-device control,
> or don't expect it to go much beyond domain type.
> 

Thanks for explaining *this thing* :)
I will update the patch to follow the 2nd pattern as it makes more sense
to do_this or do_that directly. I'm not expecting anything other than
domain type atleast for now but hey we can always add the functionality
if the need arises.

Thanks,
Sai

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ