Re: [PATCH v8 1/6] gpio: Remove dynamic allocation from populate_parent_alloc_arg()

From: Bartosz Golaszewski
Date: Fri Jul 08 2022 - 11:51:57 EST


On Thu, Jul 7, 2022 at 8:24 PM <prabhakar.csengg@xxxxxxxxx> wrote:
>
> From: Marc Zyngier <maz@xxxxxxxxxx>
>
> The gpiolib is unique in the way it uses intermediate fwspecs
> when feeding an interrupt specifier to the parent domain, as it
> relies on the populate_parent_alloc_arg() callback to perform
> a dynamic allocation.
>
> This is pretty inefficient (we free the structure almost immediately),
> and the only reason this isn't a stack allocation is that our
> ThunderX friend uses MSIs rather than a FW-constructed structure.
>
> Let's solve it by providing a new type composed of the union
> of a struct irq_fwspec and a msi_info_t, which satisfies both
> requirements. This allows us to use a stack allocation, and we
> can move the handful of users to this new scheme.
>
> Also perform some additional cleanup, such as getting rid of the
> stub versions of the irq_domain_translate_*cell helpers, which
> are never used when CONFIG_IRQ_DOMAIN_HIERARCHY isn't selected.
>
> Tested on a Tegra186.
>
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
> Cc: Daniel Palmer <daniel@xxxxxxxxx>
> Cc: Romain Perier <romain.perier@xxxxxxxxx>
> Cc: Bartosz Golaszewski <brgl@xxxxxxxx>
> Cc: Thierry Reding <thierry.reding@xxxxxxxxx>
> Cc: Jonathan Hunter <jonathanh@xxxxxxxxxx>
> Cc: Robert Richter <rric@xxxxxxxxxx>
> Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@xxxxxxxxxxxxx>
> Cc: Andy Gross <agross@xxxxxxxxxx>
> Cc: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> ---

Acked-by: Bartosz Golaszewski <brgl@xxxxxxxx>