mbox series

[v2,0/6] irq/irq_sim: try to improve the API

Message ID 20200211131240.15853-1-brgl@bgdev.pl (mailing list archive)
Headers show
Series irq/irq_sim: try to improve the API | expand

Message

Bartosz Golaszewski Feb. 11, 2020, 1:12 p.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This is my second take at improving the interrupt simulator interface.
I marked it as v2 but it actually takes a completely different approach.

The interrupt simulator API exposes a lot of custom data structures and
functions and doesn't reuse the interfaces already exposed by the irq
subsystem. This series tries to address it.

First, we make irq_domain_reset_irq_data() available to non-V2 domain API
users - that'll be used in the subsequent patch. Next we overhaul the
public interfaces - we hide all specific data structures and instead
rely on the irq_domain struct and virtual interrupt numberspace.

Next four patches simplify the interface even more, but since the change
may be a bit more controversial due to modification of the irq_domain
I decided to split them out of the second patch.

In patch 3/6 we're adding a new callback to irq_domain_ops that is called
right before all the other code in irq_domain_remove(). Next we use it to
remove the simulator-specific cleanup function from irq_sim.h - users now
can simply use the regular irq_domain_remove().

Last two patches show that the new callback isn't limited to the interrupt
simulator and can be used to shrink code in real driver too. We introduce
a new helper for a common use case of disposing of all mappings before
removing the irq_domain and use it in the keystone irqchip driver.

The end effect is that we limit the interrupt simulator API to two
functions (plus one device managed variant) and zero new structures.

v1: https://lkml.org/lkml/2019/8/12/558

v1 -> v2:
- instead of just making the new data structures opaque for users, remove
  them entirely in favor of irq_domain
- call irq_set_handler() & irq_domain_reset_irq_data() when unmapping
  the simulated interrupt
- fix a memory leak in error path
- make it possible to use irq_find_matching_fwnode() with the simulator
  domain
- correctly use irq_create_mapping() and irq_find_mapping(): only use the
  former at init-time and the latter at interrupt-time

Bartosz Golaszewski (6):
  irq: make irq_domain_reset_irq_data() available even for non-V2 users
  irq/irq_sim: simplify the API
  irq/domain: add a new callback to domain ops
  irq/irq_sim: remove irq_domain_remove_sim()
  irq/domain: provide irq_domain_dispose_mappings() helper
  irqchip: keystone: use irq_domain_dispose_mappings()

 drivers/gpio/gpio-mockup.c          |  47 ++++--
 drivers/iio/dummy/iio_dummy_evgen.c |  32 ++--
 drivers/irqchip/irq-keystone.c      |   5 +-
 include/linux/irq_sim.h             |  33 ++--
 include/linux/irqdomain.h           |   9 +-
 kernel/irq/Kconfig                  |   1 +
 kernel/irq/irq_sim.c                | 225 ++++++++++++++++------------
 kernel/irq/irqdomain.c              |  44 ++++--
 8 files changed, 238 insertions(+), 158 deletions(-)

Comments

Bartosz Golaszewski March 3, 2020, 7:57 a.m. UTC | #1
wt., 11 lut 2020 o 14:12 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> This is my second take at improving the interrupt simulator interface.
> I marked it as v2 but it actually takes a completely different approach.
>
> The interrupt simulator API exposes a lot of custom data structures and
> functions and doesn't reuse the interfaces already exposed by the irq
> subsystem. This series tries to address it.
>
> First, we make irq_domain_reset_irq_data() available to non-V2 domain API
> users - that'll be used in the subsequent patch. Next we overhaul the
> public interfaces - we hide all specific data structures and instead
> rely on the irq_domain struct and virtual interrupt numberspace.
>
> Next four patches simplify the interface even more, but since the change
> may be a bit more controversial due to modification of the irq_domain
> I decided to split them out of the second patch.
>
> In patch 3/6 we're adding a new callback to irq_domain_ops that is called
> right before all the other code in irq_domain_remove(). Next we use it to
> remove the simulator-specific cleanup function from irq_sim.h - users now
> can simply use the regular irq_domain_remove().
>
> Last two patches show that the new callback isn't limited to the interrupt
> simulator and can be used to shrink code in real driver too. We introduce
> a new helper for a common use case of disposing of all mappings before
> removing the irq_domain and use it in the keystone irqchip driver.
>
> The end effect is that we limit the interrupt simulator API to two
> functions (plus one device managed variant) and zero new structures.
>
> v1: https://lkml.org/lkml/2019/8/12/558
>
> v1 -> v2:
> - instead of just making the new data structures opaque for users, remove
>   them entirely in favor of irq_domain
> - call irq_set_handler() & irq_domain_reset_irq_data() when unmapping
>   the simulated interrupt
> - fix a memory leak in error path
> - make it possible to use irq_find_matching_fwnode() with the simulator
>   domain
> - correctly use irq_create_mapping() and irq_find_mapping(): only use the
>   former at init-time and the latter at interrupt-time
>

Hi,

it's been three weeks, so gentle ping on that.

Or should I resend the entire series with a more elaborate commit
message for patch 1/6?

Bartosz
Jonathan Cameron April 13, 2020, 5:07 p.m. UTC | #2
On Tue, 3 Mar 2020 08:57:43 +0100
Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> wt., 11 lut 2020 o 14:12 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> >
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > This is my second take at improving the interrupt simulator interface.
> > I marked it as v2 but it actually takes a completely different approach.
> >
> > The interrupt simulator API exposes a lot of custom data structures and
> > functions and doesn't reuse the interfaces already exposed by the irq
> > subsystem. This series tries to address it.
> >
> > First, we make irq_domain_reset_irq_data() available to non-V2 domain API
> > users - that'll be used in the subsequent patch. Next we overhaul the
> > public interfaces - we hide all specific data structures and instead
> > rely on the irq_domain struct and virtual interrupt numberspace.
> >
> > Next four patches simplify the interface even more, but since the change
> > may be a bit more controversial due to modification of the irq_domain
> > I decided to split them out of the second patch.
> >
> > In patch 3/6 we're adding a new callback to irq_domain_ops that is called
> > right before all the other code in irq_domain_remove(). Next we use it to
> > remove the simulator-specific cleanup function from irq_sim.h - users now
> > can simply use the regular irq_domain_remove().
> >
> > Last two patches show that the new callback isn't limited to the interrupt
> > simulator and can be used to shrink code in real driver too. We introduce
> > a new helper for a common use case of disposing of all mappings before
> > removing the irq_domain and use it in the keystone irqchip driver.
> >
> > The end effect is that we limit the interrupt simulator API to two
> > functions (plus one device managed variant) and zero new structures.
> >
> > v1: https://lkml.org/lkml/2019/8/12/558
> >
> > v1 -> v2:
> > - instead of just making the new data structures opaque for users, remove
> >   them entirely in favor of irq_domain
> > - call irq_set_handler() & irq_domain_reset_irq_data() when unmapping
> >   the simulated interrupt
> > - fix a memory leak in error path
> > - make it possible to use irq_find_matching_fwnode() with the simulator
> >   domain
> > - correctly use irq_create_mapping() and irq_find_mapping(): only use the
> >   former at init-time and the latter at interrupt-time
> >  
> 
> Hi,
> 
> it's been three weeks, so gentle ping on that.
> 
> Or should I resend the entire series with a more elaborate commit
> message for patch 1/6?

I'd resend it now if nothing has happened that I missed.  Merge window
having just closed, it's the perfect time for a rebase on rc1.

thanks,

Jonathan

> 
> Bartosz
Bartosz Golaszewski April 14, 2020, 8:37 a.m. UTC | #3
pon., 13 kwi 2020 o 19:07 Jonathan Cameron <jic23@kernel.org> napisał(a):
>
> > Hi,
> >
> > it's been three weeks, so gentle ping on that.
> >
> > Or should I resend the entire series with a more elaborate commit
> > message for patch 1/6?
>
> I'd resend it now if nothing has happened that I missed.  Merge window
> having just closed, it's the perfect time for a rebase on rc1.
>

Yeah, I'll resend the first two patches which are less controversial
and then see with the rest of them.

Bart