From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D73CEC433E0 for ; Mon, 13 Jul 2020 17:21:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A639D206F5 for ; Mon, 13 Jul 2020 17:21:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qdGe3Rc9"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="a81vo8aw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A639D206F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AGRP5AWqsZEP7yuqZ3gMHY4nWx0ny5JQlPOYl0q2fjU=; b=qdGe3Rc9YfqWuqPD6iMOOhW0K Fv5fPPOMkfkWHwAnchSr9QRicVg8JwVW7Woxcz+B9T+L/jONYyAsjnbBABm/iTZKa+nK+4rKsxV/K zxpVeIlXozwYI/+/iUi3wnszU58IEnt1bLmTvGCb0xekEtbbX3w3MI5Uu61eqrDc+P8xsDxcZVl1J 7n1EuYJAgGysa12z/XBo4/VatEFqm4lnb4tJW9EomS90s1arWnxVVgnuf4jSmKZtSBP9rfwnJgyoQ KLtDQmShRzlAERQjbDjJDK9wletS2FSIw4Jtv/RYmAFm/mEDaZfRxIf2tWzDX8pN0PGDJJe7Mxqcw 56S/seVAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jv27g-0006wa-Jl; Mon, 13 Jul 2020 17:20:12 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jv27X-0006ud-Pd for linux-arm-kernel@lists.infradead.org; Mon, 13 Jul 2020 17:20:11 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1594660810; h=In-Reply-To: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=4XiXe8TG0RFYxFbJZ/n9VVska8WODtyTC6be8J3K5K0=; b=a81vo8awy9GsW6iFIIIWIfQvWIbEZBV8kN/xOttiNHqvnF2HwcQujV0wNkG2B8nXPEkjCUzc FbV4Pk0qNFSVQTF8Wg+5fdqVLqSiP8QZWyPRBGVd4l3QiaX2XaDMKYP6wjsG/qQ57q31yONo aOSNpXqqjM+/i0FAb/g2xDSU/+o= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-east-1.postgun.com with SMTP id 5f0c979a427cd557663f9761 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 13 Jul 2020 17:19:22 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A5899C43395; Mon, 13 Jul 2020 17:19:21 +0000 (UTC) Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse) by smtp.codeaurora.org (Postfix) with ESMTPSA id D0324C433C8; Mon, 13 Jul 2020 17:19:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D0324C433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org Date: Mon, 13 Jul 2020 11:19:17 -0600 From: Jordan Crouse To: Will Deacon Subject: Re: [Freedreno] [PATCH v9 4/7] iommu/arm-smmu: Add a pointer to the attached device to smmu_domain Message-ID: <20200713171917.GA3815@jcrouse1-lnx.qualcomm.com> Mail-Followup-To: Will Deacon , Sai Prakash Ranjan , linux-arm-msm@vger.kernel.org, Joerg Roedel , Robin Murphy , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, John Stultz , freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org References: <20200626200042.13713-1-jcrouse@codeaurora.org> <20200626200042.13713-5-jcrouse@codeaurora.org> <20200713150901.GA3072@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200713150901.GA3072@willie-the-truck> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200713_132010_128255_484F4CAE X-CRM114-Status: GOOD ( 32.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: freedreno@lists.freedesktop.org, Sai Prakash Ranjan , linux-arm-msm@vger.kernel.org, Joerg Roedel , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, John Stultz , Robin Murphy , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 13, 2020 at 04:09:02PM +0100, Will Deacon wrote: > On Fri, Jun 26, 2020 at 02:00:38PM -0600, Jordan Crouse wrote: > > Add a link to the pointer to the struct device that is attached to a > > domain. This makes it easy to get the pointer if it is needed in the > > implementation specific code. > > > > Signed-off-by: Jordan Crouse > > --- > > > > drivers/iommu/arm-smmu.c | 6 ++++-- > > drivers/iommu/arm-smmu.h | 1 + > > 2 files changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > > index 048de2681670..060139452c54 100644 > > --- a/drivers/iommu/arm-smmu.c > > +++ b/drivers/iommu/arm-smmu.c > > @@ -668,7 +668,8 @@ static void arm_smmu_write_context_bank(struct arm_smmu_device *smmu, int idx) > > } > > > > static int arm_smmu_init_domain_context(struct iommu_domain *domain, > > - struct arm_smmu_device *smmu) > > + struct arm_smmu_device *smmu, > > + struct device *dev) > > { > > int irq, start, ret = 0; > > unsigned long ias, oas; > > @@ -801,6 +802,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, > > cfg->asid = cfg->cbndx; > > > > smmu_domain->smmu = smmu; > > + smmu_domain->dev = dev; > > > > pgtbl_cfg = (struct io_pgtable_cfg) { > > .pgsize_bitmap = smmu->pgsize_bitmap, > > @@ -1190,7 +1192,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) > > return ret; > > > > /* Ensure that the domain is finalised */ > > - ret = arm_smmu_init_domain_context(domain, smmu); > > + ret = arm_smmu_init_domain_context(domain, smmu, dev); > > if (ret < 0) > > goto rpm_put; > > > > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > > index 5f2de20e883b..d33cfe26b2f5 100644 > > --- a/drivers/iommu/arm-smmu.h > > +++ b/drivers/iommu/arm-smmu.h > > @@ -345,6 +345,7 @@ struct arm_smmu_domain { > > struct mutex init_mutex; /* Protects smmu pointer */ > > spinlock_t cb_lock; /* Serialises ATS1* ops and TLB syncs */ > > struct iommu_domain domain; > > + struct device *dev; /* Device attached to this domain */ > > This really doesn't feel right to me -- you can generally have multiple > devices attached to a domain and they can come and go without the domain > being destroyed. Perhaps you could instead identify the GPU during > cfg_probe() and squirrel that information away somewhere? I need some help here. The SMMU device (qcom,adreno-smmu) will have at least two stream ids from two different platform devices (GPU and GMU) and I need to configure split-pagetable and stall/terminate differently on the two domains. I couldn't figure out a way to identify the platform device before it attached itself with iommu_attach_device. I tried poking around in fwspec but got lost. If there is a way we can uniquely identify the devices (by stream id maybe) then we could use that though I have reservations about hard coding stream IDs in the impl driver. That said, the stream IDs have never changed in the life of the GPU so maybe it's not a problem that needs solving. Jordan > The rest of the series looks ok to me. > > Will > _______________________________________________ > Freedreno mailing list > Freedreno@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/freedreno -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel