Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp593627ybz; Wed, 15 Apr 2020 14:45:36 -0700 (PDT) X-Google-Smtp-Source: APiQypKzUKZoEeR+ujBT5tI4TGAfao6WdFFAeyAkI6w7uPuP9VmE8N6Ju+jWm3oeycK0lZgZIpYL X-Received: by 2002:a05:6402:356:: with SMTP id r22mr6995947edw.3.1586987136300; Wed, 15 Apr 2020 14:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586987136; cv=none; d=google.com; s=arc-20160816; b=CoKAiBzEYZtyiuZA9KAgnSIP7zhc+Pidg9obNVk1UL2GdyLWq5nmSq6UP2dLtOIAI8 Tkw32nxxByG3KkGcDqvgyalffkSQTmdHkqssZixX37SzNZj3Th4xKmZlmV6fiKPG6K2e /xI2hQZRm3iFMBS7+WDKYlnwSlBjyf7FDnT+RqQM/ZFZv+WacYVznmqxYKAN+tomYB6j uXocgdYgIYHBB/KRHmFgcDCnSA7+cWgSftCM6N96rc5a2AZpn/OuIP6EK8tnjN4B+xr4 asLG9lrZVgmAwS5Mv3hYA4HknN7aNPKLVlEj/MlHuaEJldcAxQaadVlaSOwdoMzjvj8W D0Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=pjzwfTcChHnISigCJHUetoRvOtw8Q36XYbff0pt71XY=; b=IO3WMIHOMO09T2PG5OlVAm9B8GZzASs1WWd/V1gBHFmeVVbJT7QD/tp7Tq4rW5rDN1 vSULG3uK0YGRP+FLYvuRZ5yNnAF/5uXzebhOtzNYyq1Yi3zcmIw2vsDiMipiuHmAH7Xz V97rBhggifwUm5i40X1TQ0/uAJqH+Tijxl+o/GDjjJy0soKwdqpi9/Ey3uBP4mwOM7dG h5i2cOx+SOCYP3IpnnIdnPkQr0+WqNiE2GER3+3LMTrKhw3C1hNVh1t/OT6HxDtOfaqH k+vgJWM/VsD4l03WSq7ZetthZPrubbkExV1OywI/N9YER+ILGCAtqWWQv38sWoPVgode S4LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="EBVOg6X/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si11067674edk.133.2020.04.15.14.45.11; Wed, 15 Apr 2020 14:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="EBVOg6X/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391010AbgDNQSn (ORCPT + 99 others); Tue, 14 Apr 2020 12:18:43 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:14120 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390722AbgDNQSk (ORCPT ); Tue, 14 Apr 2020 12:18:40 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586881119; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=pjzwfTcChHnISigCJHUetoRvOtw8Q36XYbff0pt71XY=; b=EBVOg6X/p8Plyh7uVYSdxlpC70ArYFEMk51fgEK/B/bp2K3IC3orEv8eF9AUu4Su42r8ezrX K1qYYCFrTbBc9M/3Zqh/IMWsCue72TzGg9VhmaiDSgEktaKEupqbWlzfvEoULpBcPWQj0zwA ypoXb7FqSNiEGrGW/FfJyVMDAuU= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e95e25e.7f4c0c536228-smtp-out-n04; Tue, 14 Apr 2020 16:18:38 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 06F62C4478F; Tue, 14 Apr 2020 16:18:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 28FA7C433F2; Tue, 14 Apr 2020 16:18:37 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 14 Apr 2020 21:48:37 +0530 From: Sai Prakash Ranjan To: Evan Green Cc: Will Deacon , Robin Murphy , Joerg Roedel , Jordan Crouse , Rob Clark , iommu@lists.linux-foundation.org, linux-arm Mailing List , LKML , linux-arm-msm , Stephen Boyd , Matthias Kaehlcke , Bjorn Andersson , Rajendra Nayak , Tomasz Figa Subject: Re: [PATCH 2/2] iommu/arm-smmu: Allow client devices to select direct mapping In-Reply-To: References: <813cc5b2da10c27db982254b274bf26008a9e6da.1579692800.git.saiprakash.ranjan@codeaurora.org> Message-ID: X-Sender: saiprakash.ranjan@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Evan, On 2020-04-14 04:42, Evan Green wrote: > On Wed, Jan 22, 2020 at 3:48 AM Sai Prakash Ranjan > wrote: >> >> From: Jordan Crouse >> >> 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 >> Co-developed-by: Sai Prakash Ranjan >> Signed-off-by: Sai Prakash Ranjan >> --- >> 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 >> #include >> >> #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