From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 958643F786B for ; Tue, 24 Mar 2026 12:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774353905; cv=none; b=prXPtJ2/pOu7WhDSiAmIqnVS2TikQFpX2h2zft9AIdjF5/xo2LRkJYgi90y93M/Hl/35aFT6zlDvK2pDZoWFS1XQDy0wE/wZBTjm2KZD17KMixrL857tecuxOAKHgnUNwMdh8BewYYWYXa+7hpxiei5kgqm2vn8ojGygYaFjylk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774353905; c=relaxed/simple; bh=INmeiGJKMXk+0PJEej2mrgVEmYRHxRGrlBMc5p0a5aY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=o8zjpJiPzz+Tl9TkXO/POpgGuXeCKG+o2sRGZSxBz8PctYzMpc/ZsEgle7UWjTQwMAMc+X6bBu67nQFm2HZ7CGeBumU2O8NatAn2VHr1gZWAiggJVPYBlNIRo8UOtKZmi+72aQ1HgF7doCC+ooGEnK/MTnAXxn3DUWG0BRVF1s8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=eiiwG5ed; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ByGO/wZh; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="eiiwG5ed"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ByGO/wZh" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62O9mmOI890470 for ; Tue, 24 Mar 2026 12:05:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= E5IUEO5PyBIerJfWjfzoqFirzXsSOD9hNzXQV1mXr0E=; b=eiiwG5edacFrpRTZ EtFrpYBAz2dzEh8QgxuzMve34/TbRlhIqFNx0EIQC9p4hZ2Sc1R0WIg2sTP6BzrM ZMpxlfMwVzsguvbqR5NsG0MiTxuaUDz7gQK9z/PxTLu1TEuNtp0aZM+jWN5B0FTG cAEb6aMA1eo/Z0VWzsnyIojgSv0Q7zlmm7vQ+g3Jors7pW4zXq4WIA+Gen1trqxO 8FKevj/nVzz62rhyId8j2AORT2bDOzfq1W9g4Gu+AsQMotjMluRzjhztxSKw7emf qjozK5HoD7x8HTa7uMYLbYLYuYjcsGG4hg2oWm9+adG+aTQzddUtS3YHqtw1B3gb YkEiWw== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d3k1x9qy6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 24 Mar 2026 12:05:00 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2aed1beaa73so69743845ad.2 for ; Tue, 24 Mar 2026 05:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774353831; x=1774958631; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=E5IUEO5PyBIerJfWjfzoqFirzXsSOD9hNzXQV1mXr0E=; b=ByGO/wZhHkNCfRtNzd1cWKYIk+yqjgVvcHWz1qtlz0D2awkgtOI7dNlRXDmrU0Ag/Y BpqSzHy+W85eb/bADDL83GXly35Bem0OlZARvt5kCtW7uVV7AHlwySJ49Klk1wMsou71 pJvHr5+zv+BPeoWe6Fhdz3mt2jSP2Dq3go/N2gwnTMpMqYQXxye/4/VjtZtqnQNqPsvH aB7J/7Kfwpz79/HsOhoChNdIIMrDmJS8mE/scs6eVX/qJl4hfaZTWNrNbS5VVXQGC6Uq tgMjbZC/Mw9k6/LKuIgI6kkJlJaKhPZsehOBjSgNRfJTe2aZR8wQ266lw3dsRtHAEWNt /X2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774353831; x=1774958631; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E5IUEO5PyBIerJfWjfzoqFirzXsSOD9hNzXQV1mXr0E=; b=Lb/jbPGvPLhS66FGFKdDlZZ+NNJGsUDdPUnCNqFqJP1DxquSVKCedowkaT5vHQgSqP ntYKt3lSWzyxjpiAMUEIfAKWnY5NSgamJM+lZghVxsaY/75T5d/BmgbBT/nEH2ooFjJ8 e4d1zk0z/2jdMUWshT2VX0pIJiH91bZlVxmc1sQ+lrjwrlGJKWkagNFw6C5h7GDLxrIG u56nz4PCWV7anx0ME6AWrCoWQHK2pjCUQzDxYFa4OwEQdfOIUETOUWt58ai6z2FTzd3l 6ADLkdI4RMRpeo2men7hIfyj7D97XsgeNVVhr0bBix/J1Eu8tQsCY+gckELqW7BOLv51 1SuQ== X-Forwarded-Encrypted: i=1; AJvYcCWHl5hTEWuW4/p9NOh5MN//DewJKHjRjWq3FEnu/N6ojr9JeNrAw+VV2PVcz0aSnwPwDjz3I5SLv/jj3Fg=@vger.kernel.org X-Gm-Message-State: AOJu0Yzf6TcFIjeoPwDaHL9ma/zQ9SkYkDgSeW500vML6SiXU5OlzNcc 71GQEt1D3e4GH0uZF+pgmD8Q0Y8GFxUPXFp9I7iZVbK//qskWfk/qoefiE8XgbmJZrKU81Gxsf3 a+cZxqS+i/aWdl5eMzdH2ULCO1KqQbqs+I6Pxgw7oebHuIx3JjgISvd6+W+rgKrtWNbde6xczDx A= X-Gm-Gg: ATEYQzwx78WcuPJxzfpIQ6cFZyYuT3uuNRKuMl1ZQlb1EPkG9QDocEV+SplwI7U7m+L nfuSU2tAVJ5kDmeNnwIEs+GTKnuiObcvKv73bOLz9Kjnt9rM3PS/KiFxV2fKu0Z9GIBOoYW7Oj+ 4yzunmeHR/phDMKWaCVCU5vu+BX2W7qjVmygY9i+FrPJv27jSERtnJdeZdtDCcos0bnxsoHzXzP Y/hsrZqpsylHGnes0OpT5EsGFtSFSY2GHroPu4Ac+Bt15WoLY4e4OwQ9L4rrTXhrwpQPXHmy5Ef TFdx9Rv+vj9zBla9LBfDRktsZduEUzzE44mOoJFE2W/V2upM1DdwqBpTnMozsdhQQk2MPglFu3T PrcUAXdk6KCJJasK6Eto/mntVWvYXBBj4gGqg+Ho2daAOI7QIIC/OCQ== X-Received: by 2002:a17:903:3ba5:b0:2b0:5aab:c40a with SMTP id d9443c01a7336-2b08277aecamr143662505ad.31.1774353831142; Tue, 24 Mar 2026 05:03:51 -0700 (PDT) X-Received: by 2002:a17:903:3ba5:b0:2b0:5aab:c40a with SMTP id d9443c01a7336-2b08277aecamr143662045ad.31.1774353830506; Tue, 24 Mar 2026 05:03:50 -0700 (PDT) Received: from [10.218.35.45] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b083656f65sm208995095ad.45.2026.03.24.05.03.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2026 05:03:50 -0700 (PDT) Message-ID: Date: Tue, 24 Mar 2026 17:33:42 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 3/3] PCI: Add support for PCIe WAKE# interrupt To: Manivannan Sadhasivam Cc: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , Danilo Krummrich , Bjorn Helgaas , Bartosz Golaszewski , Linus Walleij , Bartosz Golaszewski , Rob Herring , Saravana Kannan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org, quic_vbadigan@quicinc.com, sherry.sun@nxp.com, driver-core@lists.linux.dev, devicetree@vger.kernel.org References: <20260313-wakeirq_support-v8-0-48a0a702518a@oss.qualcomm.com> <20260313-wakeirq_support-v8-3-48a0a702518a@oss.qualcomm.com> <4n5heks4oymfz75wiajyc5zuzzulmwyfj2couudbi7gi67h2rk@smpnmyhdjkns> Content-Language: en-US From: Krishna Chaitanya Chundru In-Reply-To: <4n5heks4oymfz75wiajyc5zuzzulmwyfj2couudbi7gi67h2rk@smpnmyhdjkns> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzI0MDA5NiBTYWx0ZWRfX++KSz0mO/E1U 3qm9YEGUJ+K9oU/2so3h51asPhKOd9jQE/79gb3EaskbuP16r+stX662P012uOqA8Aytj//Wntb DvJWTevVgLIsgcaALvRGAz8gug0FGlN38FU4GpLWi8WazyrSEWI69/KBnt/EL3OX8fkUPghO96n xVB5tMK9jyEWlbnSmzKijfZRIPMpJ7f3BOxYs9VcUusWR+3o09AqDPKK6auWQJT7K5Z+xh5xUkH VDo9N4xH8wH4YN2YH8YD3cQwGE8LTVzR6Y2DF/84/36jUktyMYmmThIHtrmVBG8kg3PB2cIP9dU mrLZt8fhWxcInesVzcUhJDOBReEREhxvtGPLOoBMkKLxM2K42nXe8Z+3Ys6J/V+GaigI6C1WKfw ilpDtWFjTWRD1FLfZ0iQu6QqpmUxPVDW1p5SMwOUqSlS8hrAU16ASMWsLh8q9tpol5nhlIztDVm KGXPGJ9wNmha3W7BnJA== X-Proofpoint-ORIG-GUID: pBQqF8B1dQ_44d7KkfYbaB3VCl03jmn- X-Authority-Analysis: v=2.4 cv=O880fR9W c=1 sm=1 tr=0 ts=69c27dec cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=NEAV23lmAAAA:8 a=KKAkSRfTAAAA:8 a=rFA5VEQNUbPbIC_WhckA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: pBQqF8B1dQ_44d7KkfYbaB3VCl03jmn- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-24_02,2026-03-23_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 malwarescore=0 clxscore=1015 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603240096 On 3/17/2026 12:56 PM, Manivannan Sadhasivam wrote: > On Fri, Mar 13, 2026 at 12:38:42PM +0530, Krishna Chaitanya Chundru wrote: >> According to the PCI Express specification (PCIe r7.0, Section 5.3.3.2), >> two link wakeup mechanisms are defined: Beacon and WAKE#. Beacon is a >> hardware-only mechanism and is invisible to software (PCIe r7.0, >> Section 4.2.7.8.1). This change adds support for the WAKE# mechanism in >> the PCI core. >> >> According to the PCIe specification, multiple WAKE# signals can exist in >> a system or each component in the hierarchy could share a single WAKE# >> signal. In configurations involving a PCIe switch, each downstream port >> (DSP) of the switch may be connected to a separate WAKE# line, allowing >> each endpoint to signal WAKE# independently. From figure 5.4 in sec >> 5.3.3.2, WAKE# can also be terminated at the switch itself. To support >> this, the WAKE# should be described in the device tree node of the >> endpoint/bridge. If all endpoints share a single WAKE# line, then each >> endpoint node should describe the same WAKE# signal or a single WAKE# in >> the Root Port node. >> >> In pci_device_add(), PCI framework will search for the WAKE# in device >> node, If not found, it searches in its upstream port only if upstream port >> is Root Port. Once found, register for the wake IRQ in shared mode, as the >> WAKE# may be shared among multiple endpoints. >> >> dev_pm_set_dedicated_shared_wake_irq() associates a wakeup IRQ with a >> device and requests it, but the PM core keeps the IRQ disabled by default. >> The IRQ is enabled only when the device is permitted to wake the system, >> i.e. during system suspend and after runtime suspend, and only when device >> wakeup is enabled. >> >> When the wake IRQ fires, the wakeirq handler invokes pm_runtime_resume() to >> bring the device back to an active power state, such as transitioning from >> D3cold to D0. Once the device is active and the link is usable, the >> endpoint may generate a PME, which is then handled by the PCI core through >> PME polling or the PCIe PME service driver to complete the wakeup of the >> endpoint. >> >> WAKE# is added in dts schema and merged based on below links. >> >> Link: https://lore.kernel.org/all/20250515090517.3506772-1-krishna.chundru@oss.qualcomm.com/ >> Link: https://github.com/devicetree-org/dt-schema/pull/170 >> Reviewed-by: Linus Walleij >> Signed-off-by: Krishna Chaitanya Chundru >> --- >> drivers/pci/of.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ >> drivers/pci/pci.c | 10 +++++++ >> drivers/pci/pci.h | 2 ++ >> drivers/pci/probe.c | 2 ++ >> drivers/pci/remove.c | 1 + >> include/linux/of_pci.h | 4 +++ >> include/linux/pci.h | 2 ++ >> 7 files changed, 95 insertions(+) >> >> diff --git a/drivers/pci/of.c b/drivers/pci/of.c >> index 9f8eb5df279ed28db7a3b2fd29c65da9975c2efa..b7199d3598b31b62245716c178a5a73565efc89e 100644 >> --- a/drivers/pci/of.c >> +++ b/drivers/pci/of.c >> @@ -7,6 +7,7 @@ >> #define pr_fmt(fmt) "PCI: OF: " fmt >> >> #include >> +#include >> #include >> #include >> #include >> @@ -15,6 +16,7 @@ >> #include >> #include >> #include >> +#include >> #include "pci.h" >> >> #ifdef CONFIG_PCI >> @@ -586,6 +588,78 @@ int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) >> return irq_create_of_mapping(&oirq); >> } >> EXPORT_SYMBOL_GPL(of_irq_parse_and_map_pci); >> + >> +static void pci_configure_wake_irq(struct pci_dev *pdev, struct gpio_desc *wake) >> +{ >> + int ret, wake_irq; >> + >> + wake_irq = gpiod_to_irq(wake); >> + if (wake_irq < 0) { >> + pci_err(pdev, "Failed to get wake irq: %d\n", wake_irq); >> + return; >> + } >> + >> + device_init_wakeup(&pdev->dev, true); > Just set wakeup only if dev_pm_set_dedicated_shared_wake_irq() succeeds. ack. >> + >> + /* >> + * dev_pm_set_dedicated_shared_wake_irq() associates a wakeup IRQ with the >> + * device and requests it, but the PM core keeps it disabled by default. >> + * The IRQ is enabled only when the device is allowed to wake the system >> + * (during system suspend and after runtime suspend), and only if device >> + * wakeup is enabled. >> + * >> + * When the wake IRQ fires, the wakeirq handler invokes pm_runtime_resume() >> + * to bring the device back to an active power state (e.g. from D3cold to D0). >> + * Once the device is active and the link is usable, the endpoint may signal >> + * a PME, which is then handled by the PCI core (either via PME polling or the >> + * PCIe PME service driver) to wakeup particular endpoint. >> + */ >> + ret = dev_pm_set_dedicated_shared_wake_irq(&pdev->dev, wake_irq, >> + IRQ_TYPE_EDGE_FALLING); > Isn't WAKE# a level triggered signal? Ack. I will change IRQ_TYPE_EDGE_FALLING to IRQ_TYPE_LEVEL_LOW. >> + if (ret < 0) { >> + pci_err(pdev, "Failed to set wake IRQ: %d\n", ret); > s/wake/WAKE# ack. - Krishna Chaitanya. > - Mani >