Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp960744imm; Wed, 26 Sep 2018 09:23:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV61pQ2tIfWXeoqZwV4pXe4vfHCu+wBykpEkLIgCIl2A7mQqS2LTBK2tuxE7JQTDov73AIG0v X-Received: by 2002:a17:902:447:: with SMTP id 65-v6mr6619446ple.325.1537979009471; Wed, 26 Sep 2018 09:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537979009; cv=none; d=google.com; s=arc-20160816; b=TJeJsc88/fuYvYkGaPuF1fspxDBT6tplK807z+dN/7zEsbs2Yop1Ufnu3m+6/nh5Uz YDXzxKulE3d87+/jf4t/rQZbhsRgtDfHOLZhWf/8b/XKfwgp3NhYfJLxXgregtHF/BUP pgVN2gMSIHIXGXI1PPuEQhFWhgS5gIvPdJUl0jGPDxEeYE9FggZDBfjjRUmg71YxdJVH 7bo9G5bTl/WsdILRimVhPvna+1DjjpggJeDTmyxFXeaZmxf3KEbZkCTeOb8vL/uB+s24 myGi+O/CfdDbQPcJb9gpvXf7+G9SLBkFlifmYgBiwCzVmczhwYRkhVq5Pnk+kAgUD5PQ ih/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yTJidMReuNpSkAGsZTX7v+1yHLbDXBD86bpgUObbzKQ=; b=v6wsToepezDEfJzYCnt0YZ+JTpTU7SL6jB3bZLk56V4Or/ntJ8KbOcbEu7Qf0C+Hmm 6uAU7N+Y6KMIMM+NYywY/1UGTbFTe2j0Wch3IHoC2ioYo8nX3c+2YrKBEUCs8d0VSw9p riwU04Btp+knmFX9yiCLVE+5hKePjHNzwiFKazto1J0XlR+dXPmDRewso3uSkGT91M4i KC7GsNc9qVr79AxtDCNT3Q4wsy1XPTYRSFNsDHwVHbd/TL1YL1DBWbRFWfgqJt+u6oXy FAYPujR8itIjqjeMmvnXnZsZueSBa3yE+S+gKKH+SrAGkG9ltGMLkQE/RO6FUMiy9Ch9 +/Sg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r62-v6si1591362pfd.37.2018.09.26.09.23.13; Wed, 26 Sep 2018 09:23:29 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728481AbeIZWgS (ORCPT + 99 others); Wed, 26 Sep 2018 18:36:18 -0400 Received: from mga06.intel.com ([134.134.136.31]:24519 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728025AbeIZWgR (ORCPT ); Wed, 26 Sep 2018 18:36:17 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 09:22:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,306,1534834800"; d="scan'208";a="93922814" Received: from araj-mobl1.jf.intel.com ([10.7.201.19]) by orsmga001.jf.intel.com with ESMTP; 26 Sep 2018 09:22:35 -0700 Date: Wed, 26 Sep 2018 09:22:35 -0700 From: "Raj, Ashok" To: Sinan Kaya Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bjorn Helgaas , open list , Ashok Raj , IOMMU Mailing List Subject: Re: [PATCH V3] PCI: Enable PASID when End-to-End TLP is supported by all bridges Message-ID: <20180926162235.GA30177@araj-mobl1.jf.intel.com> References: <1530372264-20653-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1530372264-20653-1-git-send-email-okaya@codeaurora.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sinan + IOMMU list. On Sat, Jun 30, 2018 at 11:24:24AM -0400, Sinan Kaya wrote: > A PCIe endpoint carries the process address space identifier (PASID) in > the TLP prefix as part of the memory read/write transaction. The address > information in the TLP is relevant only for a given PASID context. > > An IOMMU takes PASID value and the address information from the > TLP to look up the physical address in the system. > > PASID is an End-End TLP Prefix (PCIe r4.0, sec 6.20). Sec 2.2.10.2 says > > It is an error to receive a TLP with an End-End TLP Prefix by a > Receiver that does not support End-End TLP Prefixes. A TLP in > violation of this rule is handled as a Malformed TLP. This is a > reported error associated with the Receiving Port (see Section 6.2). > > Prevent error condition by proactively requiring End-to-End TLP > prefix to be supported on the entire data path between the endpoint and > the root port before enabling PASID. > > Signed-off-by: Sinan Kaya > --- > > +static void pci_configure_eetlp_prefix(struct pci_dev *dev) > +{ > +#ifdef CONFIG_PCI_PASID > + struct pci_dev *bridge; > + u32 cap; > + > + if (!pci_is_pcie(dev)) > + return; > + > + pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap); > + if (!(cap & PCI_EXP_DEVCAP2_E2ETLP)) > + return; Forgot to notice this.. I'm not sure if the same enforcement is required for devices that are RCIEP. The spec isn't clear about calling any excemption. Although it should be simple for devices to expose e2etlp support, but if they don't that should be ok, since there are nothing between itself and the root port. We are seeking help from our SIG reps, but thought I'll ask here as well if there are other opinions. > + > + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) > + dev->eetlp_prefix_path = 1; > + else { > + bridge = pci_upstream_bridge(dev); > + if (bridge && bridge->eetlp_prefix_path) > + dev->eetlp_prefix_path = 1; > + } > +#endif > +} Cheers, Ashok