Received: by 10.223.176.5 with SMTP id f5csp1606110wra; Wed, 31 Jan 2018 08:50:19 -0800 (PST) X-Google-Smtp-Source: AH8x226nZXyIgtyD8/OcvTaDdNRI1RWsSbW/JIm6j9nNeZV8x+AyjBZMvJqpRdwERyhgJEw0gKCa X-Received: by 2002:a17:902:b945:: with SMTP id h5-v6mr5241262pls.38.1517417418902; Wed, 31 Jan 2018 08:50:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517417418; cv=none; d=google.com; s=arc-20160816; b=LHO9B0lFgPgsUoPfWq/pAMbUqOCPJI8zjkV3Gv2IB60q2TF9vfyAksdtJekLL/Ae/a qtWIwJ2H8DiivGzAYzI8B0C4EHrB9jLMJwSyoqFlqWVhJuX3GkY/v5YwW4TU9njB2H9J MkTzDiDNodpnIrbfFZdv5RERITzgZgtqclabcZGoLeI8lfBKpTAPC+rZOXtEdgJRhw7R b3nm3GFYe+Z89C/aPhPHls3br/vsK3qCN6P5ohUXDZR/PoFiKOlNsd58073pdQ+casIz hejjr7u4uYWVqv0wnNUjURm4axrd1Pvsd6X0ZZsTB7H2oBPLV7oEba399nKgbBxkW7lL xD+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=O8p/BgjtmGCQA/sYL8c+vJovqfaBh86FP30AX7oyxqU=; b=o9tPiE/o2E2gtvv5InnnmcYXTl+zZZ+y1Z+g0pq4EXtBF4i1c1xrJwpMOXEtEv0fkX D9LOgL/Uyz69Lk5gBvNV9brNwt4aFaAH7FLcIjCuJM+h3qxcHV6LL0fjunW4DdBUaJQD c9k3lX565SYFwdPmKt+QF5Gu5lUEQ6UnSzKvp7j0alUMkWM3m/eZ4TxqMayxO2PNktWI 9RJfJN99rdbprsR0XwOBlq40FvPZGZY8az1eTiTLHsLPjO8KotqkMK0IAEWrqDzNl+Ft sTLw0EhLhGVkjq8KrgPSi78LuRSBKJVwpFJ7r5TFy3jHG5PZYUAmw1H9c/8wY/+sGLme TdAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=UFZR+Kc4; dkim=pass header.i=@codeaurora.org header.s=default header.b=AUU/qbxE; 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 64-v6si2178746plk.313.2018.01.31.08.50.04; Wed, 31 Jan 2018 08:50:18 -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=@codeaurora.org header.s=default header.b=UFZR+Kc4; dkim=pass header.i=@codeaurora.org header.s=default header.b=AUU/qbxE; 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 S932270AbeAaQYh (ORCPT + 99 others); Wed, 31 Jan 2018 11:24:37 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39944 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753401AbeAaQYe (ORCPT ); Wed, 31 Jan 2018 11:24:34 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1DE04601D9; Wed, 31 Jan 2018 16:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517415874; bh=FIDHhf3YuUt47ptuRr0RuG+xq3sBiq37d1dN3k07kUM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UFZR+Kc4jEK0b5mbGgxo9XjM4m0d82xrfRAzDd+0jWfZR+uLfgaAl+FbYOYGs5MbX 3+EhSxUXNFV2Wcsu6IUAsSktCYX6LUftNvYDEJkqJDQgakYut0xC14ZP+T+bWoJXQv 1xAFrCk6YslR/rU+j7S8JcwlXbm7A8gK0amsN4Wk= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C6F2C601D9; Wed, 31 Jan 2018 16:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517415873; bh=FIDHhf3YuUt47ptuRr0RuG+xq3sBiq37d1dN3k07kUM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AUU/qbxEhFtP1eWzMqH4hBQn/iMfEZsFKXmXBhtN7mc7zp1YYvlVdBSpjOAkSqzTl KKARhl1cGvrMVWu3zS3Uqy2XcfCz+5AaKobSJXhVk3XHChO/+48EuhclXLNTUsBciX xa1aBpxg6yGdA2Q/YWQSMDfdh/AuTotYb1Mobs64= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C6F2C601D9 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Wed, 31 Jan 2018 16:24:32 +0000 From: Lina Iyer To: Marc Zyngier Cc: tglx@linutronix.de, jason@lakedaemon.net, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, rnayak@codeaurora.org, asathyak@codeaurora.org Subject: Re: [PATCH RFC 1/4] drivers: irqchip: pdc: add support for PDC interrupt controller Message-ID: <20180131162432.GA13231@codeaurora.org> References: <20180123175656.11942-1-ilina@codeaurora.org> <20180123175656.11942-2-ilina@codeaurora.org> <9dd8307c-4906-4707-d4d7-2ef0fc8307b6@arm.com> <20180130175654.GC20815@codeaurora.org> <619608bb-a9c5-27a1-2383-5f6b2f455499@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <619608bb-a9c5-27a1-2383-5f6b2f455499@arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 30 2018 at 18:11 +0000, Marc Zyngier wrote: >On 30/01/18 17:56, Lina Iyer wrote: >> Hi Mark, >> >> On Wed, Jan 24 2018 at 14:20 +0000, Marc Zyngier wrote: >>> Hi Lina, Archana, >>> >>> On 23/01/18 17:56, Lina Iyer wrote: >>>> From : Archana Sathyakumar >>>> >>>> The Power Domain Controller (PDC) hardware block on Qualcomm SoCs houses >>>> an interrupt controller along with other domain control functions to >>>> handle interrupt related functions like handle falling edge or active >>>> low which are not detected at the GIC and handle wakeup interrupts. >>>> >>>> The interrupt controller is on an always-on domain for the purpose of >>>> waking up the processor, but only a subset of the processor's interrupts >>>> are routed through the PDC to the GIC. The PDC powers on the processor's >>>> domain, bringing the domain out of low power mode and replays the >>>> pending interrupts so the GIC may wake up the processor. >>>> >>>> Signed-off-by: Archana Sathyakumar >>>> Signed-off-by: Lina Iyer >>>> [Lina: Split out DT bindings target data and initialization changes] >>>> --- >> >> [...] >> >>>> + >>>> +static int qcom_pdc_translate(struct irq_domain *d, >>>> + struct irq_fwspec *fwspec, unsigned long *hwirq, unsigned int *type) >>>> +{ >>>> + return d->parent->ops->translate(d->parent, fwspec, hwirq, type); >>> >>> No way. The translate operation is local to your domain. You don't go >>> and fish in another domain's private stuff. Please implement your own. >>> The reason you're getting away with it is because you're in the DT by >>> providing the GIC SPI instead of the pin into the PDC. >>> >> I am looking into this approach. Was hoping to get some clarifications >> from you. >> >> The PDC sits between the device and the the GIC. Platform drivers >> receive their interrupts from GIC. They are not aware of the fact that >> the GIC may lose power and hand over its job to PDC. The platform > >I disagree here. If the PDC is between the device and the GIC, then the >device interrupt line is routed to the PDC, and nothing else. The PDC >itself is tied to the GIC, but that's none of the device's business. > >In general, the device shouldn't care about what interrupt controller it >is connected to. So please just describe the HW. There is about 10 >similar configurations in the tree at the moment for the exact same >thing. They are simpler because their PDC equivalent has been designed >to exactly align with the GIC pins, but that's absolutely not a requirement. > This is exactly the case. The PDC is not aligned with GIC for all interrupts. To be a bit more clear than what I seem to conveyed, some interrupts are routed to the GIC and to the PDC and some are not. Interrupts like USB that need to be detected for a falling edge or level low (i.e., not detected at the GIC) are routed through the PDC as well. The PDC detects these and re-triggers the GIC interrupts with the correct polarity so the GIC may sense it. In another case, when the GIC is powered off, the PDC will continue to montior the interrupts routed through the PDC interrupt controller and if any of the enabled ones trigger, the PDC will wake up the GIC and replay the interrupts at the GIC. To the device the presence of PDC is transparent, nor it is aware if the GIC was powered off while the interrupt was enabled. >> drivers may configure an interrupt as a wakeup interrupt, in which case, >> we would wake up the CPU even if we are in system sleep or suspend mode. >> Platform driver don't know about the PDC pin or its configuration >> information. It makes it easier to keep that information contained >> within the PDC driver. Instead of getting the pin-hwirq map from the >> table as in patch #4, I can get that information cleanly from DT. > >That part is fine. > >> >>> Don't do that. Expose the pin in the DT, use the alloc method to map the >>> PDC pin into the GIC pin. >>> >> I would like to understand how you mean by this. I am thinking something >> like this in the dts - >> >> / { >> interrupt-controller = <&pdc>; >> soc { >> intc: interrupt-controller@176000 { >> [...] >> interrupt-controller; >> interrupt-parent = <&intc>; >> }; >> >> pdc: interrupt-controller@210000 { >> [...] >> interrupt-controller; >> interrupt-parent = <&intc>; >> qcm,pdc-ranges = <0 512 94>, <94 641 15>, <115 662 7>; >> }; >> >> foo-device { >> interrupts = ; > >Drop the GIC_SPI (you should only use it in the PDC driver itself when >requesting the GIC version of the interrupt), make sure 481 is a PDC pin >number (it looks like a GIC SPI to me), and *never* encode IRQ_TYPE_NONE >in DT (put the actual trigger type). > Sure, I just picked it up as an example.Yes, this is a GIC SPI and not a PDC port. This is what the platform drivers desire. They have an interrupt number assigned for their device and it would be preferrable for them to use this interrupt vector at the GIC in DT. They dont't want to know the PDC pin (even though the interrupt controller for the SoC may be the PDC in DT). This is because the devices that do not have their interrupt routed through the PDC, would anyways have only the GIC interrupt vector to provide. They have no PDC port available for them. The foo-device above is an example of one such device that does not have it's interrupt routed through the PDC (it doesn't fall in the pdc-ranges). The PDC behaves more like arch extn to the GIC than a stacked interrupt controller in the hierarchy. >> }; >> }; >> }; >> >> Where the qcom,pdc-ranges is defined as - >> . >> >> For this example, the PDC map is established for pin0-pin93 using 94 >> interrupts in sequence starting from 512 and so on. This allows for >> holes in the map per the hardware interrupt topology. >> >> I am not sure if you were asking to specify the pin in the 'interrupts' >> property in each device. I would like to avoid that as this may be an >> information that the device author may care less about. Would you agree? > >The way we represent these stacked interrupt controllers is by tying the >device to the closest interrupt controller. Look at > Did you miss a reference here? We looked at tegra's implementation and it appears similar, thought they don't seemt to have the same complexity. Thanks, Lina