Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp705835pxk; Wed, 16 Sep 2020 15:07:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfPXfc6nctHPjutaXygAIyblGKSNBkvJe4nss4IqrtSZw63xg7SI+nsiK8SAm3uQGjXw4Z X-Received: by 2002:a05:6402:1694:: with SMTP id a20mr29259453edv.286.1600294072966; Wed, 16 Sep 2020 15:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600294072; cv=none; d=google.com; s=arc-20160816; b=yjobDAxBPcy3fV5JF2SM0mynfw/hik5re2FfEavoyfyDzsb+itvFMUS7gNnDhKzGZP dxoT79CGFa/ptY89Gva3lXs19iPD/DuCwLfaOq2np7nwfjwEvME482V+Q9SThJOikuh1 M6YCgtjcxBjuHKPl/y9MWNtRQh7ukK/EqbsbDZpUN2g0X7I3zl7O2eenechJJwJKNv8K enf/LVOoEI+fOJJdjdh074bAGMnc5URIvwYAeoi8X/lCDvQx3e9aIBenk2F598AqO+nM ak9Qvb3SIPJw+HXz4NcfavZCNYO0lvinWlsgRdNq30ZAP3w0BN3X0YtNRpwH3KAhEGwm AzBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=IUSOgp0IoSKk2M8PeYnxovOtWngnqZjQ42qtfnI41go=; b=Lq5FirFX5eUhf8PGzz4BFE/1GsR86y52rOJFvswAd5Hl3ktTjlKU92xLM9iNus7eNG BIB+YzKfEE0XBo/OoQYPdeG/ejA+nMNZqVif6STSv9k8I7L7EVB7rnaNgwAuKDwtjHoO 8QYtn3kxsd1A8QpFa85ntxj0ldEOzjUaHFwC9lSpy7ramTOwTji0MoMHQbjUtWH1tQOB N1ZEhaQehGUXv6ITysH14Ak6my/qvW+9Y9JmDvj39O0Gv9PpKDAKkEW/vA/iQqGNj9Bi BO3/HxRNpbpPAvPD5EWd5k0lKpqQbY4Juvhh/YQAHYlNr/arFNZnpW7VsQ1syiwZJS9v nmPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FGlZ2APP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si12781001eds.432.2020.09.16.15.07.29; Wed, 16 Sep 2020 15:07:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FGlZ2APP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbgIPWFd (ORCPT + 99 others); Wed, 16 Sep 2020 18:05:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:35832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725267AbgIPWFb (ORCPT ); Wed, 16 Sep 2020 18:05:31 -0400 Received: from localhost (52.sub-72-107-123.myvzw.com [72.107.123.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CBF7A21941; Wed, 16 Sep 2020 21:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600292797; bh=8YExeebFYjGD6iWEtSRHpDG9C6se09q+jMParqrrJs0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=FGlZ2APPc29PMaSjdWXxmhHR6wy7u+vpeNqYZVstAkzzvUGDCctx58RLy1mBGrjHV Xeqmdo6DTNYOrM1j7nIe0dcmh+hibme00WoKWuuwGBBP+E90PpyVBZyxf5FUxSk2cI fNWWIK2oCJdaIGnM8r/hxCC3max/XJjpg7/ieWJo= Date: Wed, 16 Sep 2020 16:46:35 -0500 From: Bjorn Helgaas To: Rajat Jain Cc: David Woodhouse , Lu Baolu , Joerg Roedel , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, Raj Ashok , lalithambika.krishnakumar@intel.com, Mika Westerberg , Jean-Philippe Brucker , Prashant Malani , Benson Leung , Todd Broch , Alex Levin , Mattias Nissler , Rajat Jain , Bernie Keany , Aaron Durbin , Diego Rivas , Duncan Laurie , Furquan Shaikh , Jesse Barnes , Christian Kellner , Alex Williamson , Greg Kroah-Hartman , oohall@gmail.com, Saravana Kannan , Suzuki K Poulose , Arnd Bergmann , Heikki Krogerus Subject: Re: [PATCH v4 4/4] PCI/ACS: Enable PCI_ACS_TB for untrusted/external-facing devices Message-ID: <20200916214635.GA1586835@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200707224604.3737893-4-rajatja@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 07, 2020 at 03:46:04PM -0700, Rajat Jain wrote: > When enabling ACS, enable translation blocking for external facing ports > and untrusted devices. > > Signed-off-by: Rajat Jain Applied (slightly modified) to pci/acs for v5.10, thanks! I think the warning is superfluous because every external_facing device is a Root Port or Switch Downstream Port, and if those support ACS at all, they are required to support Translation Blocking. So we should only see the warning if the device is defective, and I don't think we need to go out of our way to look for those. > --- > v4: Add braces to avoid warning from kernel robot > print warning for only external-facing devices. > v3: print warning if ACS_TB not supported on external-facing/untrusted ports. > Minor code comments fixes. > v2: Commit log change > > drivers/pci/pci.c | 8 ++++++++ > drivers/pci/quirks.c | 15 +++++++++++++++ > 2 files changed, 23 insertions(+) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 73a8627822140..a5a6bea7af7ce 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -876,6 +876,14 @@ static void pci_std_enable_acs(struct pci_dev *dev) > /* Upstream Forwarding */ > ctrl |= (cap & PCI_ACS_UF); > > + /* Enable Translation Blocking for external devices */ > + if (dev->external_facing || dev->untrusted) { > + if (cap & PCI_ACS_TB) > + ctrl |= PCI_ACS_TB; > + else if (dev->external_facing) > + pci_warn(dev, "ACS: No Translation Blocking on external-facing dev\n"); > + } > + > pci_write_config_word(dev, pos + PCI_ACS_CTRL, ctrl); > } > > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > index b341628e47527..bb22b46c1d719 100644 > --- a/drivers/pci/quirks.c > +++ b/drivers/pci/quirks.c > @@ -4934,6 +4934,13 @@ static void pci_quirk_enable_intel_rp_mpc_acs(struct pci_dev *dev) > } > } > > +/* > + * Currently this quirk does the equivalent of > + * PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF > + * > + * TODO: This quirk also needs to do equivalent of PCI_ACS_TB, > + * if dev->external_facing || dev->untrusted > + */ > static int pci_quirk_enable_intel_pch_acs(struct pci_dev *dev) > { > if (!pci_quirk_intel_pch_acs_match(dev)) > @@ -4973,6 +4980,14 @@ static int pci_quirk_enable_intel_spt_pch_acs(struct pci_dev *dev) > ctrl |= (cap & PCI_ACS_CR); > ctrl |= (cap & PCI_ACS_UF); > > + /* Enable Translation Blocking for external devices */ > + if (dev->external_facing || dev->untrusted) { > + if (cap & PCI_ACS_TB) > + ctrl |= PCI_ACS_TB; > + else if (dev->external_facing) > + pci_warn(dev, "ACS: No Translation Blocking on external-facing dev\n"); > + } > + > pci_write_config_dword(dev, pos + INTEL_SPT_ACS_CTRL, ctrl); > > pci_info(dev, "Intel SPT PCH root port ACS workaround enabled\n"); > -- > 2.27.0.212.ge8ba1cc988-goog >