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.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 006B2C10DCE for ; Thu, 12 Mar 2020 08:18:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5726206EB for ; Thu, 12 Mar 2020 08:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbgCLISz (ORCPT ); Thu, 12 Mar 2020 04:18:55 -0400 Received: from mga05.intel.com ([192.55.52.43]:51333 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbgCLISz (ORCPT ); Thu, 12 Mar 2020 04:18:55 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2020 01:18:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,544,1574150400"; d="scan'208";a="261424574" Received: from unknown (HELO [10.254.208.137]) ([10.254.208.137]) by orsmga002.jf.intel.com with ESMTP; 12 Mar 2020 01:18:47 -0700 Cc: baolu.lu@linux.intel.com, bhelgaas@google.com, will@kernel.org, robh+dt@kernel.org, joro@8bytes.org, sudeep.holla@arm.com, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, lorenzo.pieralisi@arm.com, corbet@lwn.net, mark.rutland@arm.com, liviu.dudau@arm.com, guohanjun@huawei.com, rjw@rjwysocki.net, lenb@kernel.org, robin.murphy@arm.com, dwmw2@infradead.org, amurray@thegoodpenguin.co.uk, frowand.list@gmail.com Subject: Re: [PATCH v2 08/11] iommu/vt-d: Use pci_ats_supported() To: Jean-Philippe Brucker References: <20200311124506.208376-1-jean-philippe@linaro.org> <20200311124506.208376-9-jean-philippe@linaro.org> <7019230c-3c56-e6db-6704-d73f23fa39b5@linux.intel.com> <20200312075436.GA568802@myrica> From: Lu Baolu Message-ID: <5e508904-e432-e3b9-1fe4-0c4e11df10fc@linux.intel.com> Date: Thu, 12 Mar 2020 16:18:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200312075436.GA568802@myrica> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On 2020/3/12 15:54, Jean-Philippe Brucker wrote: > Hi Baolu, > > On Thu, Mar 12, 2020 at 09:44:16AM +0800, Lu Baolu wrote: >> Hi Jean, >> >> On 2020/3/11 20:45, Jean-Philippe Brucker wrote: >>> The pci_ats_supported() function checks if a device supports ATS and is >>> allowed to use it. >>> >>> Signed-off-by: Jean-Philippe Brucker >>> --- >>> drivers/iommu/intel-iommu.c | 9 +++------ >>> 1 file changed, 3 insertions(+), 6 deletions(-) >>> >>> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c >>> index 6fa6de2b6ad5..17208280ef5c 100644 >>> --- a/drivers/iommu/intel-iommu.c >>> +++ b/drivers/iommu/intel-iommu.c >>> @@ -1454,8 +1454,7 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info) >>> !pci_reset_pri(pdev) && !pci_enable_pri(pdev, 32)) >>> info->pri_enabled = 1; >>> #endif >>> - if (!pdev->untrusted && info->ats_supported && >>> - pci_ats_page_aligned(pdev) && >>> + if (info->ats_supported && pci_ats_page_aligned(pdev) && >>> !pci_enable_ats(pdev, VTD_PAGE_SHIFT)) { >>> info->ats_enabled = 1; >>> domain_update_iotlb(info->domain); >>> @@ -2611,10 +2610,8 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, >>> if (dev && dev_is_pci(dev)) { >>> struct pci_dev *pdev = to_pci_dev(info->dev); >>> - if (!pdev->untrusted && >>> - !pci_ats_disabled() && >> >> The pci_ats_disabled() couldn't be replaced by pci_ats_supported(). Even >> pci_ats_supported() returns true, user still can disable it. Or move >> ats_disabled into pci_ats_supported()? > > It is already there, but hidden behind the "if (!dev->ats_cap)": > pci_ats_init() only sets dev->ats_cap after checking that > pci_ats_disabled() returns false. > Ah! Yes. Acked-by: Lu Baolu > Thanks, > Jean Best regards, baolu 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.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 8544BC1975A for ; Thu, 12 Mar 2020 08:18:59 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 5E85D206EB for ; Thu, 12 Mar 2020 08:18:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E85D206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 35C8322767; Thu, 12 Mar 2020 08:18:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gTTuqAobMoF1; Thu, 12 Mar 2020 08:18:57 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id D19EB20398; Thu, 12 Mar 2020 08:18:57 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C2079C18D3; Thu, 12 Mar 2020 08:18:57 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 76D62C0177 for ; Thu, 12 Mar 2020 08:18:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 65F798513B for ; Thu, 12 Mar 2020 08:18:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xtVusMHH-rwE for ; Thu, 12 Mar 2020 08:18:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 2518085137 for ; Thu, 12 Mar 2020 08:18:55 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2020 01:18:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,544,1574150400"; d="scan'208";a="261424574" Received: from unknown (HELO [10.254.208.137]) ([10.254.208.137]) by orsmga002.jf.intel.com with ESMTP; 12 Mar 2020 01:18:47 -0700 Subject: Re: [PATCH v2 08/11] iommu/vt-d: Use pci_ats_supported() To: Jean-Philippe Brucker References: <20200311124506.208376-1-jean-philippe@linaro.org> <20200311124506.208376-9-jean-philippe@linaro.org> <7019230c-3c56-e6db-6704-d73f23fa39b5@linux.intel.com> <20200312075436.GA568802@myrica> From: Lu Baolu Message-ID: <5e508904-e432-e3b9-1fe4-0c4e11df10fc@linux.intel.com> Date: Thu, 12 Mar 2020 16:18:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200312075436.GA568802@myrica> Content-Language: en-US Cc: mark.rutland@arm.com, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, liviu.dudau@arm.com, guohanjun@huawei.com, will@kernel.org, corbet@lwn.net, frowand.list@gmail.com, linux-acpi@vger.kernel.org, lenb@kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, bhelgaas@google.com, linux-arm-kernel@lists.infradead.org, dwmw2@infradead.org, rjw@rjwysocki.net, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, robin.murphy@arm.com, amurray@thegoodpenguin.co.uk X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2020/3/12 15:54, Jean-Philippe Brucker wrote: > Hi Baolu, > > On Thu, Mar 12, 2020 at 09:44:16AM +0800, Lu Baolu wrote: >> Hi Jean, >> >> On 2020/3/11 20:45, Jean-Philippe Brucker wrote: >>> The pci_ats_supported() function checks if a device supports ATS and is >>> allowed to use it. >>> >>> Signed-off-by: Jean-Philippe Brucker >>> --- >>> drivers/iommu/intel-iommu.c | 9 +++------ >>> 1 file changed, 3 insertions(+), 6 deletions(-) >>> >>> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c >>> index 6fa6de2b6ad5..17208280ef5c 100644 >>> --- a/drivers/iommu/intel-iommu.c >>> +++ b/drivers/iommu/intel-iommu.c >>> @@ -1454,8 +1454,7 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info) >>> !pci_reset_pri(pdev) && !pci_enable_pri(pdev, 32)) >>> info->pri_enabled = 1; >>> #endif >>> - if (!pdev->untrusted && info->ats_supported && >>> - pci_ats_page_aligned(pdev) && >>> + if (info->ats_supported && pci_ats_page_aligned(pdev) && >>> !pci_enable_ats(pdev, VTD_PAGE_SHIFT)) { >>> info->ats_enabled = 1; >>> domain_update_iotlb(info->domain); >>> @@ -2611,10 +2610,8 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, >>> if (dev && dev_is_pci(dev)) { >>> struct pci_dev *pdev = to_pci_dev(info->dev); >>> - if (!pdev->untrusted && >>> - !pci_ats_disabled() && >> >> The pci_ats_disabled() couldn't be replaced by pci_ats_supported(). Even >> pci_ats_supported() returns true, user still can disable it. Or move >> ats_disabled into pci_ats_supported()? > > It is already there, but hidden behind the "if (!dev->ats_cap)": > pci_ats_init() only sets dev->ats_cap after checking that > pci_ats_disabled() returns false. > Ah! Yes. Acked-by: Lu Baolu > Thanks, > Jean Best regards, baolu _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 1666BC2BB1D for ; Thu, 12 Mar 2020 08:19:02 +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 E4FCB206F1 for ; Thu, 12 Mar 2020 08:19:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="g5X+5xO4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4FCB206F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.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-Type: Content-Transfer-Encoding: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=2Mnuu2YzH/3eW1ZZU9JqbDQio2jX1+EbCCmSAxyuyyE=; b=g5X+5xO44yGx4qOl9kPjyZzdb dPQsWePl+/E+h8UWJy1Lcj1jea0Hw0QA3joHSEiFpVqiaU9LGt3dULIwjcsyNPHFCxzLGxEYPyaGl WhgntDrW6HF7aQDqWKnwoAspfW1v7yXjEU2BdgGyy5v+ahJazf1IVQaBOJLtM4meDPyw0v3qyo5ZS M8JNr6FcLLfL66CqTppryhwPIhhCi0cMVTwxN4KJj+UzdurlOhxWIE44nWg8a8NpijQkQrkF73EwF hB22gHOT5YZHtFOFVgId2OKvawd3KY5c5vPbLv5OXnW/H3J9AkOQ1+2emfEjLrzCMZRLxhHxrQvyc fBKZZ4DhQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCJ3T-0006Bi-8Y; Thu, 12 Mar 2020 08:18:59 +0000 Received: from mga02.intel.com ([134.134.136.20]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCJ3P-0006Av-LO for linux-arm-kernel@lists.infradead.org; Thu, 12 Mar 2020 08:18:56 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2020 01:18:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,544,1574150400"; d="scan'208";a="261424574" Received: from unknown (HELO [10.254.208.137]) ([10.254.208.137]) by orsmga002.jf.intel.com with ESMTP; 12 Mar 2020 01:18:47 -0700 Subject: Re: [PATCH v2 08/11] iommu/vt-d: Use pci_ats_supported() To: Jean-Philippe Brucker References: <20200311124506.208376-1-jean-philippe@linaro.org> <20200311124506.208376-9-jean-philippe@linaro.org> <7019230c-3c56-e6db-6704-d73f23fa39b5@linux.intel.com> <20200312075436.GA568802@myrica> From: Lu Baolu Message-ID: <5e508904-e432-e3b9-1fe4-0c4e11df10fc@linux.intel.com> Date: Thu, 12 Mar 2020 16:18:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200312075436.GA568802@myrica> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200312_011855_749571_8C90547C X-CRM114-Status: GOOD ( 17.14 ) 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: mark.rutland@arm.com, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, liviu.dudau@arm.com, guohanjun@huawei.com, will@kernel.org, lorenzo.pieralisi@arm.com, corbet@lwn.net, frowand.list@gmail.com, joro@8bytes.org, linux-acpi@vger.kernel.org, lenb@kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, bhelgaas@google.com, linux-arm-kernel@lists.infradead.org, dwmw2@infradead.org, rjw@rjwysocki.net, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, baolu.lu@linux.intel.com, robin.murphy@arm.com, amurray@thegoodpenguin.co.uk Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020/3/12 15:54, Jean-Philippe Brucker wrote: > Hi Baolu, > > On Thu, Mar 12, 2020 at 09:44:16AM +0800, Lu Baolu wrote: >> Hi Jean, >> >> On 2020/3/11 20:45, Jean-Philippe Brucker wrote: >>> The pci_ats_supported() function checks if a device supports ATS and is >>> allowed to use it. >>> >>> Signed-off-by: Jean-Philippe Brucker >>> --- >>> drivers/iommu/intel-iommu.c | 9 +++------ >>> 1 file changed, 3 insertions(+), 6 deletions(-) >>> >>> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c >>> index 6fa6de2b6ad5..17208280ef5c 100644 >>> --- a/drivers/iommu/intel-iommu.c >>> +++ b/drivers/iommu/intel-iommu.c >>> @@ -1454,8 +1454,7 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info) >>> !pci_reset_pri(pdev) && !pci_enable_pri(pdev, 32)) >>> info->pri_enabled = 1; >>> #endif >>> - if (!pdev->untrusted && info->ats_supported && >>> - pci_ats_page_aligned(pdev) && >>> + if (info->ats_supported && pci_ats_page_aligned(pdev) && >>> !pci_enable_ats(pdev, VTD_PAGE_SHIFT)) { >>> info->ats_enabled = 1; >>> domain_update_iotlb(info->domain); >>> @@ -2611,10 +2610,8 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, >>> if (dev && dev_is_pci(dev)) { >>> struct pci_dev *pdev = to_pci_dev(info->dev); >>> - if (!pdev->untrusted && >>> - !pci_ats_disabled() && >> >> The pci_ats_disabled() couldn't be replaced by pci_ats_supported(). Even >> pci_ats_supported() returns true, user still can disable it. Or move >> ats_disabled into pci_ats_supported()? > > It is already there, but hidden behind the "if (!dev->ats_cap)": > pci_ats_init() only sets dev->ats_cap after checking that > pci_ats_disabled() returns false. > Ah! Yes. Acked-by: Lu Baolu > Thanks, > Jean Best regards, baolu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel