[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ+vNU3+rz50MRQQsz39Jfbspy2ig9tqzb_yg1RFooxGutCM+g@mail.gmail.com>
Date: Tue, 28 Feb 2023 15:11:15 -0800
From: Tim Harvey <tharvey@...eworks.com>
To: Robin Murphy <robin.murphy@....com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Al Cooper <alcooperx@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>
Cc: maz@...nel.org, tglx@...utronix.de,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] irqchip/gic-v3: Claim iomem resources
On Tue, Apr 12, 2022 at 8:29 AM Robin Murphy <robin.murphy@....com> wrote:
>
> As a simple quality-of-life tweak, claim our MMIO regions when mapping
> them, such that the GIC shows up in /proc/iomem. No effort is spent on
> trying to release them, since frankly if the GIC fails to probe then
> it's never getting a second try anyway.
>
> Signed-off-by: Robin Murphy <robin.murphy@....com>
>
> ---
>
> I briefly looked at doing the same for GICv2, but quickly decided that
> GICv2 isn't interesting enough to be worth the (greater) bother...
>
> Lightly tested with ACPI.
> ---
> drivers/irqchip/irq-gic-v3.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index b252d5534547..9815b692a47a 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -1980,10 +1980,10 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
> u32 nr_redist_regions;
> int err, i;
>
> - dist_base = of_iomap(node, 0);
> - if (!dist_base) {
> + dist_base = of_io_request_and_map(node, 0, "GICD");
> + if (IS_ERR(dist_base)) {
> pr_err("%pOF: unable to map gic dist registers\n", node);
> - return -ENXIO;
> + return PTR_ERR(dist_base);
> }
>
> err = gic_validate_dist_version(dist_base);
> @@ -2007,8 +2007,8 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
> int ret;
>
> ret = of_address_to_resource(node, 1 + i, &res);
> - rdist_regs[i].redist_base = of_iomap(node, 1 + i);
> - if (ret || !rdist_regs[i].redist_base) {
> + rdist_regs[i].redist_base = of_io_request_and_map(node, 1 + i, "GICR");
> + if (ret || IS_ERR(rdist_regs[i].redist_base)) {
> pr_err("%pOF: couldn't map region %d\n", node, i);
> err = -ENODEV;
> goto out_unmap_rdist;
> @@ -2034,7 +2034,7 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
>
> out_unmap_rdist:
> for (i = 0; i < nr_redist_regions; i++)
> - if (rdist_regs[i].redist_base)
> + if (rdist_regs[i].redist_base && !IS_ERR(rdist_regs[i].redist_base))
> iounmap(rdist_regs[i].redist_base);
> kfree(rdist_regs);
> out_unmap_dist:
> @@ -2081,6 +2081,7 @@ gic_acpi_parse_madt_redist(union acpi_subtable_headers *header,
> pr_err("Couldn't map GICR region @%llx\n", redist->base_address);
> return -ENOMEM;
> }
> + request_mem_region(redist->base_address, redist->length, "GICR");
>
> gic_acpi_register_redist(redist->base_address, redist_base);
> return 0;
> @@ -2103,6 +2104,7 @@ gic_acpi_parse_madt_gicc(union acpi_subtable_headers *header,
> redist_base = ioremap(gicc->gicr_base_address, size);
> if (!redist_base)
> return -ENOMEM;
> + request_mem_region(gicc->gicr_base_address, size, "GICR");
>
> gic_acpi_register_redist(gicc->gicr_base_address, redist_base);
> return 0;
> @@ -2304,6 +2306,7 @@ gic_acpi_init(union acpi_subtable_headers *header, const unsigned long end)
> pr_err("Unable to map GICD registers\n");
> return -ENOMEM;
> }
> + request_mem_region(dist->base_address, ACPI_GICV3_DIST_MEM_SIZE, "GICD");
>
> err = gic_validate_dist_version(acpi_data.dist_base);
> if (err) {
> --
> 2.28.0.dirty
>
Greetings,
I have bisected a kernel issue where octeontx (CN803x) will hang on
reboot caused by commit c0db06fd0993 ("mmc: core: Disable card detect
during shutdown"). This commit made it into 5.16 and stable kernels.
I've found that the patch here which is commit 2b2cd74a06c3 resolves
this hang but I'm not entirely clear why.
Does anyone have a good explanation of why the hang occurs in the
first place and why this resolves it? I would like to get the proper
fix into the affected stable branches.
Best Regards,
Tim
Powered by blists - more mailing lists