From: Hanjun Guo <guohanjun@huawei.com>
To: Agustin Vega-Frias <agustinv@codeaurora.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <rjw@rjwysocki.net>,
<lenb@kernel.org>, <tglx@linutronix.de>, <jason@lakedaemon.net>,
<marc.zyngier@arm.com>, <lorenzo.pieralisi@arm.com>,
<timur@codeaurora.org>, <cov@codeaurora.org>,
<agross@codeaurora.org>, <harba@codeaurora.org>, <jcm@redhat.com>,
<msalter@redhat.com>, <mlangsdo@redhat.com>, <ahs3@redhat.com>,
<astone@redhat.com>, <graeme.gregory@linaro.org>,
<charles.garcia-tobin@arm.com>
Subject: Re: [PATCH V9 2/3] ACPI: Add support for ResourceSource/IRQ domain mapping
Date: Wed, 18 Jan 2017 09:40:35 +0800 [thread overview]
Message-ID: <587EC793.2000801@huawei.com> (raw)
In-Reply-To: <cc305557e91d2de4ae53daf1f5e8fe5a@codeaurora.org>
On 2017/1/17 23:07, Agustin Vega-Frias wrote:
> Hi Hanjun,
>
> On 2017-01-17 07:47, Hanjun Guo wrote:
>> On 2016/12/15 6:10, Agustin Vega-Frias wrote:
>>> ACPI extended IRQ resources may contain a ResourceSource to specify
>>> an alternate interrupt controller. Introduce acpi_irq_get and use it
>>> to implement ResourceSource/IRQ domain mapping.
>>>
>>> The new API is similar to of_irq_get and allows re-initialization
>>> of a platform resource from the ACPI extended IRQ resource, and
>>> provides proper behavior for probe deferral when the domain is not
>>> yet present when called.
>>>
>>> Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org>
>>> ---
>>> drivers/acpi/Makefile | 2 +-
>>> drivers/acpi/{gsi.c => irq.c} | 182 ++++++++++++++++++++++++++++++++++++++++++
>>> drivers/base/platform.c | 9 ++-
>>> include/linux/acpi.h | 10 +++
>>> 4 files changed, 201 insertions(+), 2 deletions(-)
>>> rename drivers/acpi/{gsi.c => irq.c} (32%)
>>>
>> [...]
>>> +/**
>>> + * acpi_irq_parse_one_cb - Handle the given resource
>>> + * @ares: resource to handle
>>> + * @context: context for the walk, contains the lookup index and references
>>> + * to the flags and fwspec where the result is returned
>>> + *
>>> + * This is called by acpi_walk_resources passing each resource returned by
>>> + * the _CRS method. We only inspect IRQ resources. Since IRQ resources
>>> + * might contain multiple interrupts we check if the index is within this
>>> + * one's interrupt array, otherwise we subtract the current resource IRQ
>>> + * count from the lookup index to prepare for the next resource.
>>> + * Once a match is found we call acpi_irq_parse_one_match to populate
>>> + * the result and end the walk by returning AE_CTRL_TERMINATE.
>>> + *
>>> + * Return AE_OK if the walk should continue, AE_CTRL_TERMINATE if a matching
>>> + * IRQ resource was found.
>>> + */
>>> +static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
>>> + void *context)
>>> +{
>>> + struct acpi_irq_parse_one_ctx *ctx = context;
>>> + struct acpi_resource_irq *irq;
>>> + struct acpi_resource_extended_irq *eirq;
>>> + struct fwnode_handle *fwnode;
>>> +
>>> + switch (ares->type) {
>>> + case ACPI_RESOURCE_TYPE_IRQ:
>>> + irq = &ares->data.irq;
>>> + if (ctx->index >= irq->interrupt_count) {
>>> + ctx->index -= irq->interrupt_count;
>>> + return AE_OK;
>>> + }
>>> + fwnode = acpi_gsi_domain_id;
>>> + acpi_irq_parse_one_match(fwnode, irq->interrupts[ctx->index],
>>> + irq->triggering, irq->polarity,
>>> + irq->sharable, ctx);
>>> + return AE_CTRL_TERMINATE;
>>> + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
>>> + eirq = &ares->data.extended_irq;
>>
>> If it's an interrupt producer, I think we don't need to map the interrupts in
>> any irqdomain, and return AE_CTRL_TERMINATE here.
>>
>> case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
>> eirq = &ares->data.extended_irq;
>> + if (eirq->producer_consumer == ACPI_PRODUCER)
>> + return AE_CTRL_TERMINATE;
>> if (ctx->index >= eirq->interrupt_count) {
>
> Agreed. I'll add the check. However, we need to return AE_OK, not
> AE_CTRL_TERMINATE, since that terminates the walk and there might
> be other resources to check after this one.
Yes, thanks for the correction, there might be other Interrupt()
resources under _CRS which needs to be scanned.
Thanks
Hanjun
next prev parent reply other threads:[~2017-01-18 1:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 22:10 [PATCH V9 0/3] irqchip: qcom: Add IRQ combiner driver Agustin Vega-Frias
2016-12-14 22:10 ` [PATCH V9 1/3] ACPI: Generic GSI: Do not attempt to map non-GSI IRQs during bus scan Agustin Vega-Frias
2016-12-16 16:24 ` Lorenzo Pieralisi
2016-12-16 16:30 ` Agustin Vega-Frias
2017-01-17 12:15 ` Hanjun Guo
2017-01-17 15:04 ` Agustin Vega-Frias
2016-12-14 22:10 ` [PATCH V9 2/3] ACPI: Add support for ResourceSource/IRQ domain mapping Agustin Vega-Frias
2017-01-17 12:47 ` Hanjun Guo
2017-01-17 15:07 ` Agustin Vega-Frias
2017-01-18 1:40 ` Hanjun Guo [this message]
2016-12-14 22:10 ` [PATCH V9 3/3] irqchip: qcom: Add IRQ combiner driver Agustin Vega-Frias
2017-01-05 16:48 ` Marc Zyngier
2017-01-06 13:17 ` Agustin Vega-Frias
2017-01-09 15:25 ` Marc Zyngier
2017-01-03 15:19 ` [PATCH V9 0/3] " Agustin Vega-Frias
2017-01-03 21:56 ` Rafael J. Wysocki
2017-01-04 12:37 ` Agustin Vega-Frias
2017-01-16 14:07 ` Agustin Vega-Frias
2017-01-16 14:14 ` Marc Zyngier
2017-01-16 14:41 ` Hanjun Guo
2017-01-16 14:53 ` Lorenzo Pieralisi
2017-01-17 12:10 ` Hanjun Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=587EC793.2000801@huawei.com \
--to=guohanjun@huawei.com \
--cc=agross@codeaurora.org \
--cc=agustinv@codeaurora.org \
--cc=ahs3@redhat.com \
--cc=astone@redhat.com \
--cc=charles.garcia-tobin@arm.com \
--cc=cov@codeaurora.org \
--cc=graeme.gregory@linaro.org \
--cc=harba@codeaurora.org \
--cc=jason@lakedaemon.net \
--cc=jcm@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=marc.zyngier@arm.com \
--cc=mlangsdo@redhat.com \
--cc=msalter@redhat.com \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=timur@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).