Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp175924lqp; Fri, 12 Apr 2024 14:13:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWLJouOlyqmZNrGvqjvikd2tlBJSonIZ2yZVbPRYTnuGkOQAJAYFqL8aOuETeGICdfdulnhR8D45BoUfZG4HL5jZ8vNGn+Oq39ROPHaWw== X-Google-Smtp-Source: AGHT+IHgWBwpB/sJkB6WIjNTGd9E6I/2S26Ej2udR+gdCT0J7CBE4NCKGAIGkjWJ/xekd34uNG1/ X-Received: by 2002:a9d:7e9a:0:b0:6ea:32c7:97e2 with SMTP id m26-20020a9d7e9a000000b006ea32c797e2mr4606138otp.7.1712956393506; Fri, 12 Apr 2024 14:13:13 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u4-20020a05620a084400b0078d5ad78d26si4612303qku.689.2024.04.12.14.13.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 14:13:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=MJCHYCpv; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-143370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2DE4F1C21172 for ; Fri, 12 Apr 2024 21:13:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA9B115216A; Fri, 12 Apr 2024 21:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="MJCHYCpv" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2081.outbound.protection.outlook.com [40.107.21.81]) (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 402511514EF; Fri, 12 Apr 2024 21:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.81 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712956130; cv=fail; b=BZBARIBjWDnYgVZOIpihgNlUTlGCi1r0HOiR9Fnl+xZ8p/eWwJgS5WVSZRoj4H/zw06VIQEXv5ErETciBVHQwwHjp3XtChJMc4amdkzj+lxIE92Bcid+RFBUpBBy3/MI+XnhOXxX6aWVAZ/sybgr61FW2De9TXPtxh9RGm/50XM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712956130; c=relaxed/simple; bh=GlZ5fmhIb53K91zNLegnAbi+hD9J5Krzvh4iUkpSjuI=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=BhUCJ+MmQRLWHLSHhSdL1owvDvmlakUSqvF+WepEQgR68BRY91UNZ41wIw0XCQGQWfJx9tqzdRrS1IT0JdJq5oHlfTNBY3ogiWaOb8IL83cPe36zLZRdJfEnsRd79pxG4h8mtY6ERMc+oV7C2lpaidOFZuHjZDfn63NNDGXx1Qc= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=MJCHYCpv; arc=fail smtp.client-ip=40.107.21.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jgtR7Sz/GKW4XLYGPZLIKdEBdF2xWms3BM+17i6KlRlB2H3nkn7j2aobb+Zt19/I9Rp8VcDkfM22znZ0x/y/X5GG89CpMKHGbr6Tam7VX5wLwm06cm9pjsjDDXsEGkGA4l2pDdlptuGpjar8+o9BBm1OJIXZ6sStp8qVpJbc75fNeiVJq/Dq0bvPF8JDyXHOJb3XY3nzGR6C2FNLrsxWf6CTGtn11imRTxCsrrvCwIfmjLr0ZSdW2Ff47Jxiq5k6n0taPTJnIDDU2+vYWmsgqGCG+qIxyPsvfAEKesPSM77IucPhuh6GNCgMqRN0n45DiK+EUQIB7wYVbLf+Y4uh3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sct3W+OQh6YHyoPlzce2KedkwkCmmQ6Qe7W0p3HaeOw=; b=WAu0ZDO7YfM5Zn++as+nEeg9DsflMtyl0Svh+ZFTXxWMTekggXZ4fipmiiscneZKWutj4iXsqLnuhLxM60GgqgzKldO6QmFVf8dT6jPzpRhvaMjXwq+7dlrn8eAfRFcBXjgYUnQHRMg7893v8TTNDEWHikiiPVMZV+JmuUKw4/bzOxZVCB0U8D8/cIcBLZyedmH/c74gBuvBCG1Not6dr+iZHPek9WgGzNWhWgLhwyxjY0RKneFznEyUfhwWIDUX5ERX1/NYH3ajyRYu2HZXPYr4yTem/F64jcGvdx6hh7X+LYjFMt4E69hV8/NpPg2/9ni944aUkOj2rphe6NpLKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sct3W+OQh6YHyoPlzce2KedkwkCmmQ6Qe7W0p3HaeOw=; b=MJCHYCpvFAJ8WhJi8LVTTZUxaSe6liObbqtothFgkSb/IbgngceuyyvwGXnS8pl8Ue/Uk49/vwgObIq7IlcRTRbK4GrioxoAcmGXov3rt28atAck+VXbectuerqFSnewwhj6zE1BGoH1LoT3V1XXVmQj0z5o8O4TSAhRlokJXRo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AS8PR04MB8690.eurprd04.prod.outlook.com (2603:10a6:20b:429::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Fri, 12 Apr 2024 21:08:45 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58%7]) with mapi id 15.20.7409.055; Fri, 12 Apr 2024 21:08:43 +0000 Date: Fri, 12 Apr 2024 17:08:33 -0400 From: Frank Li To: Manivannan Sadhasivam Cc: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , imx@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v5 5/5] PCI: dwc: Add common send PME_Turn_Off message method Message-ID: References: <20240319-pme_msg-v5-0-af9ffe57f432@nxp.com> <20240319-pme_msg-v5-5-af9ffe57f432@nxp.com> <20240405062426.GB2953@thinkpad> <20240406040131.GC2678@thinkpad> <20240412170548.GB19020@thinkpad> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240412170548.GB19020@thinkpad> X-ClientProxiedBy: SJ0PR05CA0019.namprd05.prod.outlook.com (2603:10b6:a03:33b::24) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8690:EE_ X-MS-Office365-Filtering-Correlation-Id: 809bdefb-e727-4eab-d4f1-08dc5b34bbfa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HYvAv4qgMCsCUDxbKN0m0f1Y+nFKy/Yf8xRfrmgaxD24sJMN+sd6eqbledO0TKkMxzRY7QjbX4maty5iCk66o4CQsP+UKsk054ksdW9ueO3mYrkY8V2PJrCELA8VhPbkCuV7s/L9nGNgfnj0vy+TBmgclM0Lut52WtkHgG7SXXvS6LnxPO81ohi/a+ZF+0jQEZ/uWh1kVgaAbiKccTdH0/gCTWdKaI96wGzMcg5dqxMeyQVcfIGkqAwPeAhcaL4PUCW2SR58mD6s97uRzfWlq0qdZMiJkfDVVwg546PBbJfF4eLXFz+EhfceokoaD7SZKU3rjt17QLb4jQpEKQdWsHNOgDPVzxsn1YxMMAA6KaRua5RqTJL19Jn1i8wKwIxAzrDylCH4B3a1RWX/MHWZI19cNILtdYI3yaBh5IMfRAuXq+wedBKNZzWReOax9RQKpWZYalaBu5cjM0AFkEAmdAOyKAU4gzcx4WlLe+Rngc9CxNDXKqYvkl7KF6rDxZdpienb0lXezJzEoEIe/wyU4Z3hPyZcX4/xdTjGhd1yesd2kTR7AGOoNZ6cmOq1G5443Cqdy+owawKzwywzcMtKj4O5q26/BYROdZoTlNdAtxipBEkz/uw2TBeLLTEBCLEj0YCat3rHhlmFcvcq8y3/qBAWRq8fHwnuel/W7dWnvoe0bNKk0PrOTOV1dEyO2Z0+m/tEYh3+LWOukBNrmgvn8XDAgu5XJ4wW4YelvSEByYg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007)(52116005)(7416005)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cGh3VExwQUpUWWxsVU1lQUpqZXcyODlPZUdNVzYwNWRqZ29HWFUxWEtQNkFR?= =?utf-8?B?QnRVWG1PZjdZLzZRa3dMVExMSXV2YmNSKy9YaFJwV0RGMFJ1NWNic2VDWENJ?= =?utf-8?B?RC9sb1RDMFRQc2I0dm5aUmFXbm8yOUVoTFpTbE9GSWs0Z2dXOW5zMjBqSnp1?= =?utf-8?B?bkdGZG9yK05VcERSOXdRZ3U5cDVkL1JuTk1MQnBhVzN4MGZwMy9CODRXYVJj?= =?utf-8?B?M2RWMlp5ejZtQ013Y01iSTludEVKVmI2QkNpOWlJQm1HdFlxU2xKYURRYnNh?= =?utf-8?B?M3pkS243NU5qMDk1Uks1TmRMNjJMdWRjdEJ0KzZOdkpyTDhMNS9zUkVCWW5X?= =?utf-8?B?RUo0ajliVVY1NmdvdUlwWUFQT0cxTW1NZDVOdDhlQ1pYcmNpRjJhVldBNUR4?= =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exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2024 21:08:43.1652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yMIzFk8k2cGwOzLN9x+buH8UENPLj2TfNf/XZKS7ia0v40Jg1Fx9hMLd2aL5LqpyDq2eGL1akpPNEwBldVwNlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8690 On Fri, Apr 12, 2024 at 10:35:48PM +0530, Manivannan Sadhasivam wrote: > On Mon, Apr 08, 2024 at 11:11:11AM -0400, Frank Li wrote: > > On Sat, Apr 06, 2024 at 09:31:31AM +0530, Manivannan Sadhasivam wrote: > > > On Fri, Apr 05, 2024 at 10:31:16AM -0400, Frank Li wrote: > > > > On Fri, Apr 05, 2024 at 11:54:26AM +0530, Manivannan Sadhasivam wrote: > > > > > On Tue, Mar 19, 2024 at 12:07:15PM -0400, Frank Li wrote: > > > > > > > > > > PCI: dwc: Add generic MSG TLP support for sending PME_Turn_Off during system suspend > > > > > > > > > > > Reserve space at end of first IORESOURCE_MEM window as message TLP MMIO > > > > > > window. This space's size is 'region_align'. > > > > > > > > > > > > Set outbound ATU map memory write to send PCI message. So one MMIO write > > > > > > can trigger a PCI message, such as PME_Turn_Off. > > > > > > > > > > > > Add common dwc_pme_turn_off() function. > > > > > > > > > > > > Call dwc_pme_turn_off() to send out PME_Turn_Off message in general > > > > > > dw_pcie_suspend_noirq() if there are not platform callback pme_turn_off() > > > > > > exist. > > > > > > > > > > > > > > > > How about: > > > > > > > > > > "Instead of relying on the vendor specific implementations to send the > > > > > PME_Turn_Off message, let's introduce a generic way of sending the message using > > > > > the MSG TLP. > > > > > > > > > > This is achieved by reserving a region for MSG TLP of size 'pci->region_align', > > > > > at the end of the first IORESOURCE_MEM window of the host bridge. And then > > > > > sending the PME_Turn_Off message during system suspend with the help of iATU. > > > > > > > > > > It should be noted that this generic implementation is optional for the glue > > > > > drivers and can be overridden by a custom 'pme_turn_off' callback." > > > > > > > > > > > Signed-off-by: Frank Li > > > > > > --- > > > > > > drivers/pci/controller/dwc/pcie-designware-host.c | 94 ++++++++++++++++++++++- > > > > > > drivers/pci/controller/dwc/pcie-designware.h | 3 + > > > > > > 2 files changed, 93 insertions(+), 4 deletions(-) > > > > > > > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > > index 267687ab33cbc..d5723fce7a894 100644 > > > > > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > > @@ -393,6 +393,31 @@ static int dw_pcie_msi_host_init(struct dw_pcie_rp *pp) > > > > > > return 0; > > > > > > } > > > > > > > > > > > > +static void dw_pcie_host_request_msg_tlp_res(struct dw_pcie_rp *pp) > > > > > > +{ > > > > > > + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); > > > > > > + struct resource_entry *win; > > > > > > + struct resource *res; > > > > > > + > > > > > > + win = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); > > > > > > + if (win) { > > > > > > + res = devm_kzalloc(pci->dev, sizeof(*res), GFP_KERNEL); > > > > > > + if (!res) > > > > > > + return; > > > > > > + > > > > > > + /* Reserve last region_align block as message TLP space */ > > > > > > + res->start = win->res->end - pci->region_align + 1; > > > > > > + res->end = win->res->end; > > > > > > > > > > Don't you need to adjust the host bridge window size and end address? > > > > > > > > Needn't. request_resource will reserve it from bridge window. Like malloc, > > > > if you malloc to get a region of memory, which will never get by malloc > > > > again utill you call free. > > > > > > > > > > Hmm, will that modify the window->res->end address and size? > > > > No. This windows already reported to pci system before this function. It is > > not good to modify window-res-end. It just add child resource like below. > > > > windows is root resource, which will create may child when call > > request_resource. > > bridge -> windows > > child1 -> msg > > child2 -> pci ep1 > > child3 -> pci_ep2. > > ... > > > > Although you see whole bridge window, 'msg' already used and put under root > > resource, new pci devices will never use 'msg' resource. > > > > If change windows->res->end here, I worry about it may broken resource > > tree. > > > > Hmm, I think your argument is fair. I was worrying that if someone try to > map separately by referencing win->res->end, then they will see access > violation. It should be wrong if use it without request resource. > > But why can't you just allocate the resource using 'alloc_resource()' API > instead of always allocating at the end? Alloc will start from windows (for example: 0x8000_0000). 0x8000_0000 -> 0x8001_0000 will be allocated to 'msg'. If ep1 want to get 1MB windows, 0x8010_0000 will return. There is a big hole between 0x8001_0000 to 0x8010_0000. I just want to reduce impact to existed system. So PCIe memory layout will be kept the same w/o this patch. There are not big difference between allocate resource and reserve resource for 'msg'. Just little better friendly for exist system. Frank > > - Mani > > > > > > > > > > > > > > > + res->name = "msg"; > > > > > > + res->flags = win->res->flags | IORESOURCE_BUSY; > > > > > > + > > > > > > > > > > Shouldn't this resource be added back to the host bridge? > > > > > > > > No, this resource will reserver for msg only for whole bridge life cycle. > > > > Genenally alloc resource only happen at PCI devices probe. All pci space > > > > will be fixed after system probe. > > > > > > > > > > I don't think so. This resource still belongs to the host bridge, so we should > > > add it back. > > > > When add back? It was reserved at bridge probe. When bridge remove, all > > resource will released. > > > > > > > > - Mani > > > > > > -- > > > மணிவண்ணன் சதாசிவம் > > -- > மணிவண்ணன் சதாசிவம்