From: Hanjun Guo <hanjun.guo@linaro.org>
To: Tomasz Nowicki <tn@semihalf.com>,
marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net,
rjw@rjwysocki.net, bhelgaas@google.com,
lorenzo.pieralisi@arm.com, robert.richter@caviumnetworks.com,
shijie.huang@arm.com, Suravee.Suthikulpanit@amd.com
Cc: al.stone@linaro.org, graeme.gregory@linaro.org,
Catalin.Marinas@arm.com, will.deacon@arm.com,
linux-kernel@vger.kernel.org, okaya@codeaurora.org,
linux-acpi@vger.kernel.org, ddaney.cavm@gmail.com,
linux-pci@vger.kernel.org, mw@semihalf.com,
andrea.gallo@linaro.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V7 4/8] irqchip/gicv3-its: Cleanup for ITS domain initialization
Date: Tue, 21 Jun 2016 15:44:09 +0800 [thread overview]
Message-ID: <7718646e-4f4c-eee9-30fd-02578679e3d6@linaro.org> (raw)
In-Reply-To: <1466420541-20101-5-git-send-email-tn@semihalf.com>
On 2016/6/20 19:02, Tomasz Nowicki wrote:
> There is no point to initialize ITS without having msi-controller
> property in corresponding DT node. However, its_probe is checking
> msi-controller presence at the end, so we can save our time and do that
> check prior to its_probe call. Also, for the code clarity purpose,
> we put domain initialization to separate function.
>
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> drivers/irqchip/irq-gic-v3-its.c | 57 ++++++++++++++++++++++++----------------
> 1 file changed, 34 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 7ceaba8..bd43de1 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -1609,13 +1609,37 @@ static void its_enable_quirks(struct its_node *its)
> gic_enable_quirks(iidr, its_quirks, its);
> }
>
> +static int its_init_domain(struct device_node *node, struct its_node *its,
> + struct irq_domain *parent)
> +{
> + struct irq_domain *inner_domain;
> + struct msi_domain_info *info;
> +
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> + if (!info)
> + return -ENOMEM;
> +
> + inner_domain = irq_domain_add_tree(node, &its_domain_ops, its);
> + if (!inner_domain) {
> + kfree(info);
> + return -ENOMEM;
> + }
> +
> + inner_domain->parent = parent;
> + inner_domain->bus_token = DOMAIN_BUS_NEXUS;
> + info->ops = &its_msi_domain_ops;
> + info->data = its;
> + inner_domain->host_data = info;
> +
> + return 0;
> +}
> +
> static int __init its_probe(struct device_node *node,
> struct irq_domain *parent)
> {
> struct resource res;
> struct its_node *its;
> void __iomem *its_base;
> - struct irq_domain *inner_domain;
> u32 val;
> u64 baser, tmp;
> int err;
> @@ -1707,28 +1731,9 @@ static int __init its_probe(struct device_node *node,
> writeq_relaxed(0, its->base + GITS_CWRITER);
> writel_relaxed(GITS_CTLR_ENABLE, its->base + GITS_CTLR);
>
> - if (of_property_read_bool(node, "msi-controller")) {
> - struct msi_domain_info *info;
> -
> - info = kzalloc(sizeof(*info), GFP_KERNEL);
> - if (!info) {
> - err = -ENOMEM;
> - goto out_free_tables;
> - }
> -
> - inner_domain = irq_domain_add_tree(node, &its_domain_ops, its);
> - if (!inner_domain) {
> - err = -ENOMEM;
> - kfree(info);
> - goto out_free_tables;
> - }
> -
> - inner_domain->parent = parent;
> - inner_domain->bus_token = DOMAIN_BUS_NEXUS;
> - info->ops = &its_msi_domain_ops;
> - info->data = its;
> - inner_domain->host_data = info;
> - }
> + err = its_init_domain(node, its, parent);
> + if (err)
> + goto out_free_tables;
>
> spin_lock(&its_lock);
> list_add(&its->entry, &its_nodes);
> @@ -1779,6 +1784,12 @@ int __init its_init(struct device_node *node, struct rdists *rdists,
>
> for (np = of_find_matching_node(node, its_device_id); np;
> np = of_find_matching_node(np, its_device_id)) {
> + if (!of_property_read_bool(np, "msi-controller")) {
> + pr_warn("%s: no msi-controller property, ITS ignored\n",
> + np->full_name);
> + continue;
> + }
> +
> its_probe(np, parent_domain);
> }
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Thanks
Hanjun
next prev parent reply other threads:[~2016-06-21 7:44 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 11:02 [PATCH V7 0/8] Introduce ACPI world to ITS irqchip Tomasz Nowicki
2016-06-20 11:02 ` [PATCH V7 1/8] ACPI: I/O Remapping Table (IORT) initial support Tomasz Nowicki
2016-06-21 7:12 ` Hanjun Guo
2016-06-22 10:50 ` Marc Zyngier
2016-06-22 11:06 ` Tomasz Nowicki
2016-06-22 12:03 ` Marc Zyngier
2016-06-21 11:23 ` Lorenzo Pieralisi
2016-06-21 17:36 ` Lorenzo Pieralisi
2016-06-22 12:35 ` Tomasz Nowicki
2016-06-22 12:40 ` Tomasz Nowicki
2016-06-22 13:25 ` Marc Zyngier
2016-06-22 13:52 ` Tomasz Nowicki
2016-06-22 14:51 ` Marc Zyngier
2016-06-23 1:34 ` Hanjun Guo
2016-07-26 13:19 ` Christopher Covington
2016-07-26 14:48 ` Marc Zyngier
2016-06-20 11:02 ` [PATCH V7 2/8] ACPI: Add new IORT functions to support MSI domain handling Tomasz Nowicki
2016-06-21 7:28 ` Hanjun Guo
2016-06-20 11:02 ` [PATCH V7 3/8] PCI/MSI: Setup MSI domain on a per-device basis using IORT ACPI table Tomasz Nowicki
2016-06-21 7:33 ` Hanjun Guo
2016-07-19 21:42 ` Bjorn Helgaas
2016-06-20 11:02 ` [PATCH V7 4/8] irqchip/gicv3-its: Cleanup for ITS domain initialization Tomasz Nowicki
2016-06-21 7:44 ` Hanjun Guo [this message]
2016-06-20 11:02 ` [PATCH V7 5/8] irqchip/gicv3-its: Refactor ITS DT init code to prepare for ACPI Tomasz Nowicki
2016-06-20 11:02 ` [PATCH V7 6/8] irqchip/gicv3-its: Probe ITS in the ACPI way Tomasz Nowicki
2016-06-21 8:03 ` Hanjun Guo
2016-06-20 11:02 ` [PATCH V7 7/8] irqchip/gicv3-its: Factor out code that might be reused for ACPI Tomasz Nowicki
2016-06-20 11:02 ` [PATCH V7 8/8] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Tomasz Nowicki
2016-06-21 8:19 ` Hanjun Guo
2016-06-20 17:31 ` [PATCH V7 0/8] Introduce ACPI world to ITS irqchip Shanker Donthineni
2016-06-24 11:04 ` Tomasz Nowicki
2016-08-09 10:45 ` Robert Richter
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=7718646e-4f4c-eee9-30fd-02578679e3d6@linaro.org \
--to=hanjun.guo@linaro.org \
--cc=Catalin.Marinas@arm.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=al.stone@linaro.org \
--cc=andrea.gallo@linaro.org \
--cc=bhelgaas@google.com \
--cc=ddaney.cavm@gmail.com \
--cc=graeme.gregory@linaro.org \
--cc=jason@lakedaemon.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=marc.zyngier@arm.com \
--cc=mw@semihalf.com \
--cc=okaya@codeaurora.org \
--cc=rjw@rjwysocki.net \
--cc=robert.richter@caviumnetworks.com \
--cc=shijie.huang@arm.com \
--cc=tglx@linutronix.de \
--cc=tn@semihalf.com \
--cc=will.deacon@arm.com \
/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).