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 5CFFD38BF69 for ; Thu, 18 Jun 2026 08:18:40 +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=1781770723; cv=none; b=F6HgAhsWCeok+OTfiRM7HiJrpMoStBMQ1rxl4C0diIk1qn5xRE+Wbz9uSfPX47JmjLYcJVt5NakoTUjYl2oI83+E8hxV/QtJPOcHwesGsOjrimAwPc2VF1VzHq5v3MZAdRWaclzBQPm6aUGhtfTOGVwVicwJMN4xm2/YwTsg9Rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781770723; c=relaxed/simple; bh=gFzDwyt2X6xvExVhZeoNS5S99hvPwFohVyXgPPfmGQY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aHLHYrU15c5ye2CqxQXGSxVnvA8UX5/YjNVlnLk9dL9gQuBvOQpuMrsR34XjWM+LpWezUZwK5q8D9Hthz2c2hCWA1dg64yHuP9R0LlmI13IcdKnk67IDvLGxHrUIA+bFmahyZxjlHgB5JDVW3JUxLnjB4UeVvnCBYCnNHn1w2Uk= 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=G/MAbkOQ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Y03NhVTB; 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="G/MAbkOQ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Y03NhVTB" 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 65I8FRsd975753 for ; Thu, 18 Jun 2026 08:18:39 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= nZj09S/BPA0LGOpjmWXCjddpOq0twXITRnAhohphPiU=; b=G/MAbkOQ9ABuri01 qfZODnVGS3de2ZDM46Q0ZfNBPCMShSg2etQl/aIrPcceDEYl95YCVUKh6Bp4j3Uq HEmLY/pj0MEV+c3DBc1Svr+uTdlOqk1ToEVINzPjvwkyva1bOqz/Lv+FOLfbY0fp IoUPEQ6w2JI2fFSI/s1S/iXElYi+GQKTty4y7AEeofFdX7qmTUaNbk95ftjRlG9h WYtyeTPXfLOjDmc0WoD9TxfLGqkvnGKc8wA2cSCsAzDq8Qd/Bf+YtCO5sLgctC4m LIRqrTrR86p0WRizVthuAdGqIfKg6fBq3bTa0cZVyfnCZDLDc7cblYh7+r4AsZQY r7VloA== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ev1wc2a33-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 18 Jun 2026 08:18:39 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-9156dc90fdaso20297785a.0 for ; Thu, 18 Jun 2026 01:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781770718; x=1782375518; 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=nZj09S/BPA0LGOpjmWXCjddpOq0twXITRnAhohphPiU=; b=Y03NhVTB8FsUqBbYTRQQWLL+wxRbOXh//wB+edE6Lu1Zbu8rbda/HcExXWruFh1d6B c6S4eOosyOOPvLBwYfNGL7VzLl5liKnUlG3XV0sXU0+OmUzPTNPXmeFKqcpIU+huaEkH OxQa8z0c5K16SFJSTXh5sXkeKpVsjU+6E7wQYsPrywi1C51KZSIN8h9uH2tw17w3GWY1 BXaaY0I81rBE2Y2+C7zhWWUIRLsCE7HUJ//xUJVvv7/fSW5oihe3A88DxXhbhlV5j/Os kFs6+byJqW695WsUaq8z3oiR5fyK8fDFcaoNxZ4w5ZOeIRNz1Y4tT3/kH87kZh8ZHPwD tzNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781770718; x=1782375518; 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=nZj09S/BPA0LGOpjmWXCjddpOq0twXITRnAhohphPiU=; b=kg0oHRcpaxaVY8/jfwqtORdN5Na7XxMNM6iak+xsCK0/nSU5Mnd3+z8Dhs9wqusQeX z38vjNc7xg7B9DmuLDVte7mPuyPJdkXwTJoAT66iPf5hI8ELIGH54dzJZ3PBPqHpPUtl F3nVarYDb2F69fwHmxiobgcTOztFXdSjjD0nyC1tVBdsfTzMeX1/VRSBkFkOAJGy9soI KUSAAod3pL5cuMuDvsoHwXvGS7DAKofC5nKApY3JVP+THOQHmvzkUagTc5U+0A4OkubD ucp5lxzJ/iaGNOPVV9xlqYARslMtN5zhcbnEaJJ4Eumb0Wm0UIRlED58zxIqtIWFlBmd 22Hg== X-Forwarded-Encrypted: i=1; AFNElJ82soMAza5VrNAUwrXPuTkJ7eQjukjSYSm3iFXzOkf2lOoJURJ9ncLwSAb7X8c9NWwUlrcbWgyL2Ns9NRE=@vger.kernel.org X-Gm-Message-State: AOJu0YwL6uZak2VC9Yui1bxwHCKQ57b1C9djp/bbyXKza6Kyaw4MYXWW tctSutAoky52FVIv0zWVvgA7mjaKhBiafBG8py3X9x7xX80Jc7ndRdpNMnnsFn3OKTxFdZU87JI b7bgMZS52huLaUbGa9vHyr8kog6Uwuuujbfh5F5b5OrmLfHh+BdO3UGvBRTiNALKaXNE= X-Gm-Gg: Acq92OFoBzHXQkPZ0OptdeC1mdQgLKnHGhil30dG9TKobkS08zw8Lk6E+KRJb5KTZLw qpBp9MYlzTUesWgRUWcy2R8mdeUmqrXjLvGSmBe15rqM//KvTRETobjYtHlPPNIyIChgueoiVXT ydvlqLbTR8ntNeZptB3zSU1XDDit0mLAvaTH/4VkHcO6Hzu7FWbo9xHMnqKmodXNYsRtBjouJtx pXjc39yb8J1koHoKjGXJYclRhtzXPR0NPxW5qjFD+ZetfcX5NAKhhW9iZ8p186zLmaYMhdFYW7D VVKe+oAxt9esc356Yw6rOpMWZZr0bhr4lm9bT73uhFQlQTw1QbkeRyCTlILshhsMrOYKTKZBWWV k+3kUk0fHiqwOPZPliCcYb7NwIcoRcbdgMvk= X-Received: by 2002:a05:620a:3721:b0:8f1:9e59:2208 with SMTP id af79cd13be357-91f2a1e4688mr233824085a.4.1781770718358; Thu, 18 Jun 2026 01:18:38 -0700 (PDT) X-Received: by 2002:a05:620a:3721:b0:8f1:9e59:2208 with SMTP id af79cd13be357-91f2a1e4688mr233822685a.4.1781770717871; Thu, 18 Jun 2026 01:18:37 -0700 (PDT) Received: from [192.168.120.170] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6955acc7597sm1902928a12.9.2026.06.18.01.18.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jun 2026 01:18:37 -0700 (PDT) Message-ID: Date: Thu, 18 Jun 2026 10:18:34 +0200 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 v3 5/8] irqchip/qcom-pdc: Configure PDC to pass through mode To: Maulik Shah , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Gleixner , Linus Walleij Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, Sneh Mankad References: <20260616-hamoa_pdc_v3-v3-0-4d8e1504ea75@oss.qualcomm.com> <20260616-hamoa_pdc_v3-v3-5-4d8e1504ea75@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260616-hamoa_pdc_v3-v3-5-4d8e1504ea75@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=TMt1jVla c=1 sm=1 tr=0 ts=6a33a9df cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=83jgrZZgdiTdjN6bNP8A:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-GUID: zKqd-4ckOrms6pcucwHwvr4wG0xAmSWe X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE4MDA3NSBTYWx0ZWRfXxSOyKSy/VUyE uoB3WUhiMdCyoDKXQdM/y94PNW0hb59Lj9U9rj/8JqaCjBai5TKEcmEVo9kC76KzJANto3EBy4B VH5DuHGn5i7sSVfhI7uS1p88ghj8KDM= X-Proofpoint-ORIG-GUID: zKqd-4ckOrms6pcucwHwvr4wG0xAmSWe X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE4MDA3NSBTYWx0ZWRfXzllQ01vV1920 2Lx3AnOHAbrlZ0YzbPObWujFRf+JdR4dgAlhYql75BZehRJBFCEymPKLxXYeAUQUSQC1t8ZwbsG WyTwF6OUSF0xDMmjutFRCcT6bwuRBqe6VW/WWkQA5qQUe/eh1MTcNhR1u6KIukoxIGLZ8bVFjMQ MJVwefaneOWR7Hhifym9kgauXw2e8WGzFVUmvfvmkshsfLt1QzgSpjXY0FCCSMMnPuz8rWWdoq0 moUnccET0ReC7ejCcLt+kpN4/60URwEvOOrdFMOGNmyoJ//tc5InQxGUc2yW/mQf2S8JYOGg+MU ACqn7kXzrGM9UBVct4woIPyTM6LE8FrBPkltyO5Sw6tPlRUGeobQjxcrqFCaktryPlv22NMNflJ fDE/lzmGtTBGvU7K+kHiIl6S0mZ4OaRuqUUOT2G/g/5BI3h4JQDoX3cN5cb1Plj4p6JSGUnDWPp enorRetpu4XHgRBvrOA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-18_01,2026-06-17_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 adultscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606180075 On 6/16/26 11:25 AM, Maulik Shah wrote: > All PDC irqchip supports pass through mode in which both Direct SPIs and > GPIO IRQs (as SPIs) are sent to GIC without latching at PDC. > > Newer PDCs (v3.0 onwards) also support additional secondary controller mode > where PDC latches GPIO IRQs and sends to GIC as level type IRQ. Direct SPIs > still works same as pass through mode without latching at PDC even in > secondary controller mode. > > All the SoCs so far default uses pass through mode with the exception of > x1e. x1e PDC may be set to secondary controller mode for builds on CRD > boards whereas it may be set to pass through mode for IoT-EVK boards. > The mode configuration is done in firmware and initially shipped windows > firmware did not have SCM interface to read or modify the PDC mode. > Later only write access is opened up for non secure world. > > Using the write access available add changes to modify the PDC mode to > pass through mode via SCM write. When the write fails (on older firmware) > assume to work in secondary mode. > > In secondary mode set the separate irqchip for the GPIOs to perform > additional operations only for the GPIO irqs. > > Co-developed-by: Sneh Mankad > Signed-off-by: Sneh Mankad > Signed-off-by: Maulik Shah > --- [...] > +static int qcom_pdc_gic_secondary_set_type(struct irq_data *d, unsigned int type) > +{ > + enum pdc_irq_config_bits pdc_type; > + enum pdc_irq_config_bits old_pdc_type; > + int ret; > + > + switch (type) { > + case IRQ_TYPE_EDGE_RISING: > + pdc_type = PDC_EDGE_RISING; > + break; > + case IRQ_TYPE_EDGE_FALLING: > + pdc_type = PDC_EDGE_FALLING; > + break; > + case IRQ_TYPE_EDGE_BOTH: > + pdc_type = PDC_EDGE_DUAL; > + break; > + case IRQ_TYPE_LEVEL_HIGH: > + pdc_type = PDC_LEVEL_HIGH; > + break; > + case IRQ_TYPE_LEVEL_LOW: > + pdc_type = PDC_LEVEL_LOW; > + break; > + default: > + WARN_ON(1); > + return -EINVAL; > + } > + > + old_pdc_type = pdc_reg_read(pdc->regs->irq_cfg_reg, d->hwirq); > + pdc_type |= (old_pdc_type & ~pdc->cfg_fields->irq_type); > + pdc_reg_write(pdc->regs->irq_cfg_reg, d->hwirq, pdc_type); > + > + type = IRQ_TYPE_LEVEL_HIGH; Please carry your comment from the previous revision: /* * PDC forwards GPIOs as level high to GIC in secondary * mode. Update the type and clear any previously latched * phantom interrupt at PDC. */ > + pdc->clear_gpio(d->hwirq); > + > + ret = irq_chip_set_type_parent(d, type); > + if (ret) > + return ret; > + > + /* > + * When we change types the PDC can give a phantom interrupt. > + * Clear it. Specifically the phantom shows up when reconfiguring > + * polarity of interrupt without changing the state of the signal > + * but let's be consistent and clear it always. > + * > + * Doing this works because we have IRQCHIP_SET_TYPE_MASKED so the > + * interrupt will be cleared before the rest of the system sees it. > + */ > + if (old_pdc_type != pdc_type) > + irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, false); This bit and the switch statement above are common between the two paths.. I'm debating whether we should factor them out as static inline void, but neither solution is perfect.. so, up to you [...] > @@ -385,20 +547,37 @@ static int qcom_pdc_alloc(struct irq_domain *domain, unsigned int virq, > if (hwirq == GPIO_NO_WAKE_IRQ) > return irq_domain_disconnect_hierarchy(domain, virq); > > - ret = irq_domain_set_hwirq_and_chip(domain, virq, hwirq, > - &qcom_pdc_gic_chip, NULL); > - if (ret) > - return ret; > + /* > + * PDC secondary chip is only set for the GPIO interrupts as SPIs. > + * Direct SPI interrupts are still in pass through mode (no latching > + * at PDC). > + */ > + if (pdc->mode == PDC_PASS_THROUGH_MODE || !pdc_pin_is_gpio(hwirq)) { > + ret = irq_domain_set_hwirq_and_chip(domain, virq, hwirq, > + &qcom_pdc_gic_chip, > + NULL); > + if (ret) > + return ret; > > - region = get_pin_region(hwirq); > - if (!region) > - return irq_domain_disconnect_hierarchy(domain->parent, virq); > + if (type & IRQ_TYPE_EDGE_BOTH) > + type = IRQ_TYPE_EDGE_RISING; > > - if (type & IRQ_TYPE_EDGE_BOTH) > - type = IRQ_TYPE_EDGE_RISING; > + if (type & IRQ_TYPE_LEVEL_MASK) > + type = IRQ_TYPE_LEVEL_HIGH; > + } else { > + ret = irq_domain_set_hwirq_and_chip(domain, virq, hwirq, > + &qcom_pdc_gic_secondary_chip, > + NULL); > + if (ret) > + return ret; > > - if (type & IRQ_TYPE_LEVEL_MASK) > + /* Secondary mode converts all interrupts to LEVEL HIGH type */ > type = IRQ_TYPE_LEVEL_HIGH; > + } nit: (pdc->mode == PDC_SECONDARY_MODE && pdc_pin_is_gpio(hwirq)) could be the primary case to better communicate intent Konrad