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=-10.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 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 1C2BCC433E0 for ; Fri, 22 Jan 2021 11:00:47 +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 BEE2A2376F for ; Fri, 22 Jan 2021 11:00:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEE2A2376F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=Huawei.com 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:MIME-Version:References:In-Reply-To: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=v+QfnUtiUKx4fgIExPZLczvrcRETPndk1QbMhG91bWk=; b=1avnQloOVa2HOXkCPz6XIRnlq n2I8dtgHT4VKNojanYaL2aUE8PgjqnlVYyhKMGPL54Z4RY2mfYSeEr+UG7ruA7mMgNf469vK5CYkq KG6hy/d4SovqFicGT5m6v6bhUWMtg67ZPdJ7yJFOHz/bP4zq/7pVYnepJArgL7bmntuqcbFU48uvq vR9KZEhZ2OK4a5RaAY2qZGuvtHsiLLnymVnWHqy5pXRugvvx0IxxobUrObzk2zzawXnGE/0PJNEh8 zIkn7zjZIaetxgggTdk5n0K6iHFvQILTb5eGUjMnrrT9wIackp+v8Z2KP3Mbc8IU7upIFICeb5Iq6 voNjS53Wg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2uA2-0002ct-1Z; Fri, 22 Jan 2021 10:59:26 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2u9w-0002Zp-Cf for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 10:59:22 +0000 Received: from fraeml710-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4DMbkY5sG2z67dSX; Fri, 22 Jan 2021 18:55:01 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml710-chm.china.huawei.com (10.206.15.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 22 Jan 2021 11:59:15 +0100 Received: from localhost (10.47.73.222) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 22 Jan 2021 10:59:13 +0000 Date: Fri, 22 Jan 2021 10:58:32 +0000 From: Jonathan Cameron To: Jean-Philippe Brucker Subject: Re: [PATCH v10 10/10] iommu/arm-smmu-v3: Add stall support for platform devices Message-ID: <20210122105832.00002dcb@Huawei.com> In-Reply-To: References: <20210121123623.2060416-1-jean-philippe@linaro.org> <20210121123623.2060416-11-jean-philippe@linaro.org> <20210121191236.00000103@Huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.47.73.222] X-ClientProxiedBy: lhreml750-chm.china.huawei.com (10.201.108.200) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_055920_694087_15858845 X-CRM114-Status: GOOD ( 17.67 ) 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: vivek.gautam@arm.com, guohanjun@huawei.com, will@kernel.org, lorenzo.pieralisi@arm.com, joro@8bytes.org, linux-acpi@vger.kernel.org, zhangfei.gao@linaro.org, lenb@kernel.org, devicetree@vger.kernel.org, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, eric.auger@redhat.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, rjw@rjwysocki.net, shameerali.kolothum.thodi@huawei.com, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, robin.murphy@arm.com, linux-accelerators@lists.ozlabs.org, baolu.lu@linux.intel.com 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 Fri, 22 Jan 2021 09:51:20 +0100 Jean-Philippe Brucker wrote: > On Thu, Jan 21, 2021 at 07:12:36PM +0000, Jonathan Cameron wrote: > > > @@ -2502,6 +2647,7 @@ static void arm_smmu_release_device(struct device *dev) > > > > > > master = dev_iommu_priv_get(dev); > > > WARN_ON(arm_smmu_master_sva_enabled(master)); > > > + iopf_queue_remove_device(master->smmu->evtq.iopf, dev); > > > arm_smmu_detach_dev(master); > > > arm_smmu_disable_pasid(master); > > > arm_smmu_remove_master(master); > > > > The lack of symmetry here bothers me a bit, but it's already true, so I guess > > this case is fine as well. > > Normally the device driver calls iommu_dev_feat_disable(SVA) which does > iopf_queue_remove_device(). This is just a safety net in case the device > gets removed without the driver properly cleaning up (which will WARN as > well) Ah makes sense. Maybe it's worth a comment in the code for future generations of tired code readers? > > > > > ... > > > > > > @@ -2785,6 +2946,7 @@ static int arm_smmu_cmdq_init(struct arm_smmu_device *smmu) > > > static int arm_smmu_init_queues(struct arm_smmu_device *smmu) > > > { > > > int ret; > > > + bool sva = smmu->features & ARM_SMMU_FEAT_STALLS; > > > > FEAT_SVA? > > Ugh yes, thanks. I left this as a bool instead of moving into the test > below because the PRI patch reuses it, but I think I'll just move it down > when resending. Makes sense. > > Thanks, > Jean > > > > > > > > > /* cmdq */ > > > ret = arm_smmu_init_one_queue(smmu, &smmu->cmdq.q, ARM_SMMU_CMDQ_PROD, > > > @@ -2804,6 +2966,12 @@ static int arm_smmu_init_queues(struct arm_smmu_device *smmu) > > > if (ret) > > > return ret; > > > > > > + if (sva && smmu->features & ARM_SMMU_FEAT_STALLS) { > > > > Isn't this checking same thing twice? > > > > > + smmu->evtq.iopf = iopf_queue_alloc(dev_name(smmu->dev)); > > > + if (!smmu->evtq.iopf) > > > + return -ENOMEM; > > > + } > > > + > > > /* priq */ > > > if (!(smmu->features & ARM_SMMU_FEAT_PRI)) > > > return 0; > > > @@ -3718,6 +3886,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev) > > > iommu_device_unregister(&smmu->iommu); > > > iommu_device_sysfs_remove(&smmu->iommu); > > > arm_smmu_device_disable(smmu); > > > + iopf_queue_free(smmu->evtq.iopf); > > > > > > return 0; > > > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel