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=-8.9 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 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 DCB50C433E0 for ; Fri, 22 Jan 2021 08:53:09 +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 79DFF20739 for ; Fri, 22 Jan 2021 08:53:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79DFF20739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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=8jwaRcnmuIdeqa9QVLeJnQ1S9wDnV+gGgAXQNHV5nGU=; b=0dNrgaQ44mK1o3BbOMNX8unm6 AFA4DWrD9z56h0wmRJWuOnuEADLewst1Qf2kA4I8o/ae5zJFL0P3b+KZkv/KiDbtGzGLvtTouOK78 9FDEhtdYZ1BzbX1x0MeQkEV3S6GuBqzsIFbISRtX8ogmbPcmXGfgBFwwTWtFQ2TvbdHKRt9JYxq06 D91aefGerjv3AHi41BNX5w585wpyjTh0lIa193oAkptuszdYAqhcA8oSXu8ayKKJVtoIsHoYYr86U N87472iD7PnnBnLQd853D7cjPzmea9DHdl89fako4yYsXTMcWySIUDgFQa+gtM07a9F4IxrKa4KyG GY+sROdpw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2sAV-000121-Cx; Fri, 22 Jan 2021 08:51:47 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2sAS-00011M-FY for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 08:51:46 +0000 Received: by mail-wm1-x330.google.com with SMTP id v184so3643488wma.1 for ; Fri, 22 Jan 2021 00:51:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vrASp/RtgpnkhA58OvyJAdDc1T+gTz0RiPx6wduZk8c=; b=up1a2h2iDNc3JdPf9XWIf2bOEaBA5o+PTzwpwYGlMWM3ZPj/bERowdcDTXhk7MzMw/ 0IFYO6oW0pkXjX1cb3hU7fdkG5CpEdf5p2OrQuENFNur3mXO1UNPNNoA78V26IXInBoj TajCQT15iimZzsSU1SJAar/pCn1bCAmu7IeSTP9dwglQQsZGde0nTViozhqrE/WuU4wa gbsoMIH3ZTkUTJskvTs16R6tGViSYH17JSudaIueKcawYY5Tbj2U9x+w96OIJ1XQBqcy tHESxQyCoAjop66UARHym1LLJEipIIbc8xAb1bYp5sSgO+3CD+f4WOOCCsBpjXXfzNH9 O73Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vrASp/RtgpnkhA58OvyJAdDc1T+gTz0RiPx6wduZk8c=; b=ryOP/dW+KRftSjMLw3ov61xJeusUOyGby8GK7s41QeMzpixkQNwDsi//FiD6wJVeUu Ard8NqqwgHMy7TpjTGRxPWLPpll8xWcRbrvuBA2zcGOqw65pSna/DUL4SKKiw+5zGSXZ XPs2RK4rgEgrdQfRyJOKhZox0qubc8bwgMgo3n+ujciHqSa7Ve5mN8MFcpuDk1wtihXd TlHcAWmNHvB/IE7Bn1WnMIJ/m2NiDEEARJjwlSU+tTTpb6ahrefGtwzdQ7QWezQe2UvJ J7816Y8LvAY1LOlNcuESEataHCsXXbe6gbsdVorH65ABA2uJk4L9sqO8XM5/ZIm7pUGi kR1Q== X-Gm-Message-State: AOAM533Y6Jr61OFh5Qq9Zw4otbuxoYvde8Bk+uvExQehJUbVa/OVqqxT jf/2DGCRS3hU/V0+GJTuz+0Ibw== X-Google-Smtp-Source: ABdhPJwPXJQhdUZQz8TZ2CsHYCjCHXTUgo1cueUoveXyLgzD7Ys+eUwGva42rD/7MMLN1jYZ/pNjIQ== X-Received: by 2002:a1c:1d12:: with SMTP id d18mr2803870wmd.121.1611305500497; Fri, 22 Jan 2021 00:51:40 -0800 (PST) Received: from myrica ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id l5sm11088232wrv.44.2021.01.22.00.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 00:51:39 -0800 (PST) Date: Fri, 22 Jan 2021 09:51:20 +0100 From: Jean-Philippe Brucker To: Jonathan Cameron Subject: Re: [PATCH v10 10/10] iommu/arm-smmu-v3: Add stall support for platform devices Message-ID: References: <20210121123623.2060416-1-jean-philippe@linaro.org> <20210121123623.2060416-11-jean-philippe@linaro.org> <20210121191236.00000103@Huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210121191236.00000103@Huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_035144_634127_4F9D6461 X-CRM114-Status: GOOD ( 16.71 ) 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 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) > > ... > > > > @@ -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. 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