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=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 66444C06510 for ; Tue, 2 Jul 2019 15:00:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3AFD021479 for ; Tue, 2 Jul 2019 15:00:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="f9oUp9uy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AFD021479 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.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:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+CiDCGZEBVNXoV5BP3C0NGxBwSRJ04gzLXUk1aEuoYM=; b=f9oUp9uyjZSdVq gxwv1dfsZAvOP6vn8c006+AZj+NKnwLi6OsEg1udBNPb2YknX81bGs7+j9HqnOlhDL8ljqE73XPg8 ZR3ZFNgtkEqaixfk/4PuA9EYxAIvvQaLWtab2Dw6jifSYESFrZL7zM8gwiXC+uCswMvf8GU2DZU1o DzIXwpar+1mmTI+vN4aK6Y1zTLLrX6YvBQOKo3ql6YHpGWflO+HsjOIqA9lRN3nK2BNIRCtxHvbEK QHNpfnwn5nofvA3GYIgxy52kjFofkcXYWA1to4oVVN1tDTTRcgc2cLDGmL+nREWKQ07PSDa73nuO0 ypzVOGPX6To5+wyPTQzA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hiKG9-0005rn-88; Tue, 02 Jul 2019 14:59:53 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hiKG5-0005qq-Bv for linux-arm-kernel@lists.infradead.org; Tue, 02 Jul 2019 14:59:50 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2A1821424; Tue, 2 Jul 2019 07:59:45 -0700 (PDT) Received: from [10.1.196.129] (ostrya.cambridge.arm.com [10.1.196.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8FE533F703; Tue, 2 Jul 2019 07:59:43 -0700 (PDT) Subject: Re: [PATCH v3 8/9] iommu/arm-smmu-v3: Add support for PCI ATS To: Robin Murphy , Will Deacon , Lorenzo Pieralisi , "bhelgaas@google.com" References: <20190417182448.12382-1-jean-philippe.brucker@arm.com> <20190417182448.12382-9-jean-philippe.brucker@arm.com> <7fcd5263-8a20-11cb-0c20-9fee35fe65c1@arm.com> From: Jean-Philippe Brucker Message-ID: <433038b1-048b-57ab-db0e-5f9f940d52ce@arm.com> Date: Tue, 2 Jul 2019 15:59:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <7fcd5263-8a20-11cb-0c20-9fee35fe65c1@arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190702_075949_455638_C6C2D28E X-CRM114-Status: GOOD ( 17.19 ) 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: "zhongmiao@hisilicon.com" , "okaya@kernel.org" , Sudeep Holla , "rjw@rjwysocki.net" , "linux-acpi@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "lenb@kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 01/07/2019 18:41, Robin Murphy wrote: > Hi Jean-Philippe, > > I realise it's a bit late for a "review", but digging up the original > patch seemed as good a place as any to raise this... > > On 17/04/2019 19:24, Jean-Philippe Brucker wrote: > [...] >> @@ -1740,6 +1906,9 @@ static void arm_smmu_detach_dev(struct arm_smmu_master *master) >> >> master->domain = NULL; >> arm_smmu_install_ste_for_dev(master); >> + >> + /* Disabling ATS invalidates all ATC entries */ >> + arm_smmu_disable_ats(master); >> } > > Is that actually true? I had initially overlooked this entirely while > diagnosing something else and thought that we were missing any ATC > invalidation on detach at all, but even having looked again I'm not > entirely convinced it's bulletproof. > > Firstly, the ATS spec only seems to say that *enabling* the ATS > capability invalidates all ATC entries, although I think any corner > cases that that alone opens up should be at best theoretical. More > importantly though, pci_disable_ats() might not actually touch the > capability - given that, it seems possible to move a VF to a new domain, > and if it's not reset, end up preserving now-bogus ATC entries despite > the old domain being torn down and freed. Do we need an explicit ATC > invalidation here to be 100% safe, or is there something else I'm missing? Good points, yes the comment is wrong and it looks like we need an explicit invalidation given the current pci_disable_ats() implementation. I'll send a fix shortly. Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel