Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp12211574imu; Tue, 1 Jan 2019 17:43:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN6pXx8dzzpgFYSFSDnKWvw+gKN9Aru86Ee797nf/XDeXPTlmZG/Mbd474mh0awX3ZHi6CvL X-Received: by 2002:a17:902:43e4:: with SMTP id j91mr41003867pld.147.1546393381908; Tue, 01 Jan 2019 17:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546393381; cv=none; d=google.com; s=arc-20160816; b=Of4EoHldBo+KrJpGuDcpusrBHxBw7ilgu462ePGWi2CRcDpdcKVsAJnDSm7iInRaL9 8r/UrSfYM0+v5kaYsWryxnsRrhdDf4mUxaVBnE0iy0aOGYzmCUqufN6Dudb2Rj4c3t2r s5p353CgH6+Z8vAnNMKKbzcKYIGujArMCYAzqjNgKd9VOxxUpzu3y50wXHocJOY2Q3zV qAbixGtmWUrmDFcE80oZqbOGlnCJB7GxHDpeB+dHBtKqujv085zLWf7qJ5sVHkHPMs9a 1jjDBHnWByMfQNG+GFT4qXLCI7ST8ii5sEOojWE/q0OlNxXZ4f3JJHWhEYZFknGJ8HIb xTAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=zrz7FSXmjJiIb++mxj5YXyjnHJ3p5Oy1wG7BGjFZEpA=; b=HYranyRrNIxaewU7EWdcFVlzLvOU9WKRJB5z6n/bRG79h82mRpcJEJMF5Ntbwf+N3t Hi8PHDF4YihFJJgTXEu+857FWTFMX89Tvy9e2PExXCGzakW0HjXl3KEYwvaMAe8essrZ oQSW3pXARBCUPTLIjT+1jg+oJWaj8fqE3dqLyP4Xuy+fB+ZyytLyg8A1QzrvZrrih+tM 1eFYPS9RI57L6BH3MmDU/sM2N41pgHJCIF+egIo+QrbYF/K0oTY7J1N2yogtWI6M6vxp 4J9jn59g7t+PhtlzOnSxLBKehsNuBj7XMvNV+HDrY8cheU+FW4Yl+rti2/wtwJdJxRvc HObQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raithlin.onmicrosoft.com header.s=selector1-raithlin-com header.b=Arz64sUU; 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 19si47881389pgp.186.2019.01.01.17.42.47; Tue, 01 Jan 2019 17:43:01 -0800 (PST) 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; dkim=pass header.i=@raithlin.onmicrosoft.com header.s=selector1-raithlin-com header.b=Arz64sUU; 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 S1727938AbfABBHd (ORCPT + 99 others); Tue, 1 Jan 2019 20:07:33 -0500 Received: from mail-eopbgr660099.outbound.protection.outlook.com ([40.107.66.99]:43262 "EHLO CAN01-QB1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726194AbfABBHd (ORCPT ); Tue, 1 Jan 2019 20:07:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raithlin.onmicrosoft.com; s=selector1-raithlin-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zrz7FSXmjJiIb++mxj5YXyjnHJ3p5Oy1wG7BGjFZEpA=; b=Arz64sUU4d6GKxV1wK81WcXaxiAw05G7Wzl9dmmmLbymtQ3sJDkrk2QdPvEIUXWuwW3cO6Een93NbCPLutRx/Xkdc2/lir2tVAjRO3rzPduO1yG4CbhJrVRfmhKF17romgFhCtuyA9klRfSmE1URLySpcxbK4Ayc8v3bWIPPngo= Received: from YQXPR0101MB0728.CANPRD01.PROD.OUTLOOK.COM (52.132.75.145) by YQXPR0101MB2246.CANPRD01.PROD.OUTLOOK.COM (52.132.80.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Wed, 2 Jan 2019 01:07:28 +0000 Received: from YQXPR0101MB0728.CANPRD01.PROD.OUTLOOK.COM ([fe80::1c44:9d90:7c3f:8fe2]) by YQXPR0101MB0728.CANPRD01.PROD.OUTLOOK.COM ([fe80::1c44:9d90:7c3f:8fe2%2]) with mapi id 15.20.1471.019; Wed, 2 Jan 2019 01:07:28 +0000 From: "Stephen Bates" To: Eric Wehage , Bjorn Helgaas , yu CC: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Logan Gunthorpe , Jonathan Cameron , Alexander Duyck Subject: Re: How to force RC to forward p2p TLPs Thread-Topic: How to force RC to forward p2p TLPs Thread-Index: AQHUnx5WMU0tGDh35kWKmEWxpQy9mqWZ9ggAgAE3IhI= Date: Wed, 2 Jan 2019 01:07:27 +0000 Message-ID: References: <20181229022923.GA159477@google.com>, In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sbates@raithlin.com; x-originating-ip: [70.65.250.31] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;YQXPR0101MB2246;6:Wvw3GWOuoZyzPMMv3HVrx+7irw9zWmfdTeZLYYRvwZkix9CvjXI0+Lnr9F/mGZWQjARliJ/EQQcSoJHCM3sTYiVclSM/8UD8cmuEITlG5H3ruWth2ctZIv2uJtQ2X06UWwad7LJrMSnwT9C0ORbRPKjEykZs4ZWDQxGx6wIz6JWOk727SNO/gMSzSkUFhqVxfXdsSVKU8kS96Wd5k39YOmfFWKgupTdBf/AKe5aFNUauhzIOb7uchzGsxRxUaQBTSS3kjdbNNy8C8YeI/gzqy9V3cCUwHc49gWtXhYrTA5pQ7ZAvb3xc48eYHtGs+4koNoTwh0Qkdk1rxMjLSvmZJJsz+anUGtA7D/7zA7a/+7lOwJDoyomvEPyPXIWuh1+dBHGpXB6z8IWi6umHhmuDfss1a0tlxOM4apm+M2Yj1OP6CTNmU/2HQ41B1qFnOZfOK3TWkdkglBhwhfE/O8HZEw==;5:5cyrfy+x4YhcTK58PoRGtgnQGSyNjijkYNEyeDYD2cRFOnBvduS2VvkBQXnUUKqws3QxD92RJT6Bydki4VzVfOWqjVYmJ8SBBDvvPWRW7Rs0/FDwxx5Rj0lgVcwBIP3imKiicA06f/Hm1OnaX0wrO8loiTsgOcnQCOxHqAPyCH8=;7:G3krZbShUe7MC1u6XfnCwgtnn6CVkoDWMBnbHA52mjoeQKfW7AVlYCO7y4Gbwlof193IHap3I/GW2Yr1ancJ4qEq6AeQt8xK6B4wFDmtKtOpOGYudloZVfavZRrzMX/aOjL1FgQpEifz8Ew4/SQQ7w== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 8b7e7170-7abd-4f45-c5f6-08d6704eaa09 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600109)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020);SRVR:YQXPR0101MB2246; x-ms-traffictypediagnostic: YQXPR0101MB2246: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(10201501046)(6041310)(20161123560045)(20161123558120)(20161123564045)(2016111802025)(20161123562045)(6043046)(201708071742011)(7699051)(76991095);SRVR:YQXPR0101MB2246;BCL:0;PCL:0;RULEID:;SRVR:YQXPR0101MB2246; x-forefront-prvs: 0905A6B2C7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(136003)(39830400003)(346002)(366004)(199004)(189003)(51444003)(13464003)(53754006)(508600001)(6116002)(33656002)(6246003)(11346002)(81166006)(8936002)(3846002)(4326008)(476003)(6506007)(7696005)(99286004)(316002)(39060400002)(26005)(76176011)(68736007)(14454004)(486006)(8676002)(102836004)(81156014)(2906002)(53546011)(53936002)(54906003)(446003)(110136005)(186003)(25786009)(229853002)(256004)(305945005)(6436002)(9686003)(7736002)(86362001)(55016002)(5660300001)(71190400001)(14444005)(71200400001)(66066001)(97736004)(106356001)(105586002)(74316002);DIR:OUT;SFP:1102;SCL:1;SRVR:YQXPR0101MB2246;H:YQXPR0101MB0728.CANPRD01.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: raithlin.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 4VzADk/GQaK4Nqn8kBzRS8TUTPUQK1d5jSGq4WmdKa1Nl+7eZMFP6zM2E4JGjKG7UfPpfbvp6BTZonsED7MtA4OuitT8FIMsUHhu7DPVch8OStXAH6OXphQ4LFasvTW/VKiDbxv3G10mGQSoW/uvCEZcnpOKDJ3jkexESf8Fu6144+c7mH4wyMR6Iwtw8gOBLmsBGWGDaqPS+Fh5lowgZqDOEMzbideZtJIuiBG9MWnVrDn2AYQmipR4FDGPgvaYWLKtMAigzpVK8Nf0kRDbIOLdd10fLU8NbXZF9JBMRtNFf7yxpMdT80yhg/sBWyDC spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: raithlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b7e7170-7abd-4f45-c5f6-08d6704eaa09 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2019 01:07:27.9687 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 18519031-7ff4-4cbb-bbcb-c3252d330f4b X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQXPR0101MB2246 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yu As I understand it you are asking about the case where the two PCIe End Poi= nts (EPs) are connected below the same PCIe switch that is connected via it= 's Upstream Port (UPS) to a Root Port (RP) that is part of a Root Complex = (RC). Do I understand this correctly? The ECR Eric mentioned aims to implement a platform neutral method for dete= rmining if P2P *between* RPs is viable in a system. However I think that is= a bit different to your case (since your EPs are connected to the same RP = via a PCIe switch). What I *think* should be happening in your case when ACS is enabled is the = the TLPs should be routed to the RP and from there to some translation agen= t (often an IOMMU). If the IOMMU has an entry for the addresses in the TLP= s then it should attempt to do a translation and forward on the TLP. If the= IOMMU does not have a translation (or does not exist) then the behaviour i= s probably ill-defined and very specific to the platform you are working on= . If the IOMMU does exist and does have a translation entry it still may not = support routing the TLP back to the PCI hierarchy. This again would be plat= form specific. I guess what I am saying is the same as Logan and Eric. Once TLPs leave the= PCIe Root Port and enter the system (CPU or SOC) you leave the world of th= e PCI/PCIe specification and the behaviour of those TLPs will be dependant = on the specifics of your platform. Do note that if your platform and your EPs=A0supports ATS then I think the = behaviour can be different again because then the P2P TLPs should be able t= o use a translated address and you can setup ACS to allow for translated a= ddresses. However we have not had access to any ATS enabled systems to work= on this aspect of p2pdma yet. It's on the roadmap. Cheers Stephen From: Eric Wehage Sent: December 31, 2018 11:20 PM To: Bjorn Helgaas; yu Cc: linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org; Logan Gunthorp= e; Stephen Bates; Jonathan Cameron; Alexander Duyck Subject: RE: How to force RC to forward p2p TLPs =A0=20 There is no method to force an RC to forward requests p2p. RC's are also no= t required to support p2p and whether they do or not is implementation spec= ific. There is also currently no PCIe based standard to determine whether a= n RC supports p2p or in what capacity. Also, even if p2p is supported, it = might not be supported in a system that enables Virtualization (the Virtual= ization would have to setup p2p tables to allow it). There is currently a PCIe ECR that has been submitted, but is undergoing re= view, that defines a PCIe capability for bridge devices (Root Ports and Swi= tch Downstream Ports) that would allow them to advertise what level of p2p = is supported by the device. Eric Wehage Huawei Principal Engineer, PCIe -----Original Message----- From: Bjorn Helgaas [mailto:helgaas@kernel.org] Sent: Friday, December 28, 2018 6:29 PM To: yu Cc: linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org; Logan Gunthorp= e ; Stephen Bates ; Jonathan Came= ron ; Eric Wehage ; Al= exander Duyck Subject: Re: How to force RC to forward p2p TLPs [+cc Logan, Stephen, Jonathan, Eric, Alex] On Sat, Dec 22, 2018 at 12:50:19PM +0800, yu wrote: > Hi all, >=20 > We have a PCIE card which has a PEX8732 switch on-board,=A0 and there=20 > are two endpoint SOCs like graphic decoder behind the switch, and by=20 > default the ACS is enabled in 8732. >=20 > We use the p2p DMA to transfer data between these two endpoint SOCs,=20 > and if the host server is not enable ACS in BIOS, the p2p works well,=20 > but when ACS is enabled in BIOS, the p2p is always failed. With the=20 > help of a protocol analyzer, we can see that the TLP is redirected to=20 > RC, and RC just discard it. >=20 > I tried to find how to make RC forward redirected TLP to its original=20 > target, but nothing found, it seems this is highly related to the RC=20 > vendors. >=20 > In the PCIE 4.0 spec, the section of the RC behavior of the p2p=20 > request redirect=A0 said that ''implementation-specific logic within the= =20 > RC that determines whether the request is directed towards its=20 > original target, or blocked as an ACS Violation error. the algorithms=20 > and specific controls for making this determination are not=20 > architected by this spec''. >=20 >=20 > So is there some spec or document to describe how to set the RC? Any=20 > suggestion is appreciated. Not that I'm aware of, but the folks I cc'd would know a lot more about thi= s area. Bjorn =