From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D2783D88 for ; Thu, 18 Aug 2022 11:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660823602; x=1692359602; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=2oo9+eUa/OwSNZWYaUh6s8R3NFydHWFrEpTf+pJFEhA=; b=H9E6RpE/HaEzJtLqFAP/Uzp2PtDQKpnffJ0ta4Z7Dupdmq4D+SMJXtth DCUuTvNKjS8TXM4nJg88F+SFK45zNeNk7bDxls2IgSQaPk4UNHXDPmgYW JS+Oaf4Fun9QyKDvc5QZWX3wV1avQVF1+tcPEq4Z2i4hbU9KDEJ1KBg7z E6IAS+Blgtp/l60N8FmKE+mvt1bZZifabXyRi1JyIx8nMdfXzx3vFydfQ KGqD/ST1IllE5gJCH7cSCJZ4Ln+8Ra5LFCdUR2C4F9ypQ9bBI0d5kLIj0 cLhH7KMzgGhz+lySMBUgXZkRWY7hyv+AU+EyALpcmVaYj+fZt23H7zo7S g==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="279703298" X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="279703298" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 04:53:22 -0700 X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="668071773" Received: from gaoshunl-mobl.ccr.corp.intel.com (HELO [10.254.209.211]) ([10.254.209.211]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 04:53:17 -0700 Message-ID: Date: Thu, 18 Aug 2022 19:53:15 +0800 Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Cc: baolu.lu@linux.intel.com, Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Bjorn Helgaas , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Dave Jiang , Vinod Koul , Eric Auger , Liu Yi L , Jacob jun Pan , Zhangfei Gao , Zhu Tony , iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v11 04/13] PCI: Allow PASID only when ACS enforced on upstreaming path Content-Language: en-US To: Bjorn Helgaas References: <20220817211743.GA2274788@bhelgaas> From: Baolu Lu In-Reply-To: <20220817211743.GA2274788@bhelgaas> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Bjorn, On 2022/8/18 05:17, Bjorn Helgaas wrote: > On Wed, Aug 17, 2022 at 09:20:15AM +0800, Lu Baolu wrote: >> Some configurations of the PCI fabric will route device originated TLP >> packets based on the memory addresses. > This makes it sound like a few unusual configurations will route TLPs > based on memory addresses, but address routing is the default for all > PCIe Memory Requests, and ACS provides a way to override that default. > >> These configurations are incompatible with PASID as the PASID >> packets form a distinct address space. > I would say "the Requester ID/PASID combination forms a distinct > address space." > >> For instance, any configuration where switches are present >> without ACS enabled is incompatible. >> >> This enhances the pci_enable_pasid() interface by requiring the ACS to >> support Source Validation, Request Redirection, Completer Redirection, >> and Upstream Forwarding. This effectively means that devices cannot >> spoof their requester ID, requests and completions cannot be redirected, >> and all transactions are forwarded upstream, even as it passes through a >> bridge where the target device is downstream. > I think your patch actually requires all those features to be not just > "supported" but actually*enabled* for the entire path leading to the > device. > > To use the terms from the spec: > > "P2P Request Redirect" > "P2P Completion Redirect" > "Requester ID, Requests, and Completions" > > and maybe something like: > > ... even if the TLP looks like a P2P Request because its memory > address (ignoring the PASID) would fall in a bridge window and would > normally be routed downstream. Thank you for the suggestions. I will rephrase the commit message accordingly like this: PCI: Allow PASID only when ACS enforced on upstreaming path The PCIe fabric routes TLPs based on memory addresses for all PCIe Memory Requests regardless of whether TLPs have PASID prefixes. This is stated in section "2.2.10.2 End-End TLP Prefix Processing" of the specification: The presence of an End-End TLP Prefix does not alter the routing of a TLP. TLPs are routed based on the routing rules covered in Section 2.2.4 . As the Requester ID/PASID combination forms a distinct address space. The memory address based routing is not compatible for PASID TLPs anymore. Therefore we have to rely on ACS to override that default. This enhances pci_enable_pasid() interface by requiring the ACS features to be enabled for the entire path leading to the device. So that even if the TLP looks like a P2P Request because its memory address (ignoring the PASID) would fall in a bridge window and would normally be routed downstream. Best regards, baolu