Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp143480ybp; Wed, 16 Oct 2019 15:24:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNbz2wM44HMXYQfCw7MvQ4vc5Aalrfk+n/5gotfkF5JRJmK/8uB6shFW+3FFae0gsAed6G X-Received: by 2002:a50:eb42:: with SMTP id z2mr495922edp.291.1571264661452; Wed, 16 Oct 2019 15:24:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571264661; cv=none; d=google.com; s=arc-20160816; b=DUyJ7oW/BMQKUpqtehk0FiLtCi/P3qqM/bXmfsIYvLQJZdR7W0Mdyc0untbejdkIJU j77E/xfwGbfhChtE+SP1WaOFZ0fdlt7Zg0zmlgLqseFrVxpJiCb/LLgheqYttKqSB8/P 4NMdaIGUdj4qINBGS3oB+vUSK8/1K7wpvMemJdCXCJRATJoASyWuVvaxgRDWuXyhHp55 RGC22egXFI1nap/VEjaVifQYfVUNipeRT+4c5GrAmiHf/Kdbuu/a9+twRr81jEK/y4nG 9sjp30MdCHme+0QFAXlZ97BczoVthEseOosk5uVGj2v8oWCt4I2rpc8JfEAEldUlqhQb AH/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=PUr56Fdc7zhmqVVhfiXDWNxgwJjd73OonWOqtDkSZ/0=; b=a1hxs6wZgjOFZjqCc/DBlfF4Ac+ucFv8BvM9vQ3iuNJjvHpDcGh/Z4PdMn6lxqzRlN rqs6JklhGDrhl9aBQMyJ44T1x12KVeeIknhprkTnwKvBGHh2MwjcYvJyfwSt9tazXq4w EnuTO76Z/fKR62n4L8GVCw3CuSv92x+ar5j3rEwcc679KqiTCoHdIkEGiyq/vW7vi+qZ FrewlLfml9sxCi980f8jK5q/sHkqwelbb2yIh9ylFyxCegRlo2n4FYU+i6J/5RoN+/sK cCoOhxYFiMCj+GtKVnUvAC2MXIVkC0kDVFi0HcTfUSuGQcZAzcdcHtZwnkHmSIQ1CDhv nksA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20si223164edb.218.2019.10.16.15.23.58; Wed, 16 Oct 2019 15:24:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393487AbfJPQJY (ORCPT + 99 others); Wed, 16 Oct 2019 12:09:24 -0400 Received: from foss.arm.com ([217.140.110.172]:44364 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389848AbfJPQJX (ORCPT ); Wed, 16 Oct 2019 12:09:23 -0400 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 72997142F; Wed, 16 Oct 2019 09:09:23 -0700 (PDT) Received: from [10.1.197.57] (e110467-lin.cambridge.arm.com [10.1.197.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F22C43F68E; Wed, 16 Oct 2019 09:09:21 -0700 (PDT) Subject: Re: "Convert the AMD iommu driver to the dma-iommu api" is buggy To: Joerg Roedel , Qian Cai Cc: iommu@lists.linux-foundation.org, Christoph Hellwig , Tom Murphy , linux-kernel@vger.kernel.org, Julien Grall , Marc Zyngier References: <1571237707.5937.58.camel@lca.pw> <1571237982.5937.60.camel@lca.pw> <20191016153112.GF4695@suse.de> <1571241213.5937.64.camel@lca.pw> <20191016160314.GH4695@suse.de> From: Robin Murphy Message-ID: Date: Wed, 16 Oct 2019 17:09:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20191016160314.GH4695@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/10/2019 17:03, Joerg Roedel wrote: > On Wed, Oct 16, 2019 at 11:53:33AM -0400, Qian Cai wrote: >> On Wed, 2019-10-16 at 17:31 +0200, Joerg Roedel wrote: > >> The x86 one might just be a mistake. >> >> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c >> index ad05484d0c80..63c4b894751d 100644 >> --- a/drivers/iommu/amd_iommu.c >> +++ b/drivers/iommu/amd_iommu.c >> @@ -2542,7 +2542,7 @@ static int amd_iommu_map(struct iommu_domain *dom, >> unsigned long iova, >>         if (iommu_prot & IOMMU_WRITE) >>                 prot |= IOMMU_PROT_IW; >> >> -       ret = iommu_map_page(domain, iova, paddr, page_size, prot, GFP_KERNEL); >> +       ret = iommu_map_page(domain, iova, paddr, page_size, prot, gfp); > > Yeah, that is a bug, I spotted that too. > >> @@ -1185,7 +1185,7 @@ static struct iommu_dma_msi_page >> *iommu_dma_get_msi_page(struct device *dev, >>         if (!iova) >>                 goto out_free_page; >> >> -       if (iommu_map(domain, iova, msi_addr, size, prot)) >> +       if (iommu_map_atomic(domain, iova, msi_addr, size, prot)) >>                 goto out_free_iova; > > Not so sure this is a bug, this code is only about setting up MSIs on > ARM. It probably doesn't need to be atomic. Right, since the iommu_dma_prepare_msi() operation was broken out to happen at MSI domain setup time, I don't think the comment in there applies any more, so we can probably stop disabling irqs around the iommu_dma_get_msi_page() call. Robin.