forked from sched-ext/sched_ext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 patch tries to address it. We hide all the simulator-related data structures from users and instead rely on the well-known irq domain. When creating the interrupt simulator the user receives a pointer to a newly created irq_domain and can use it to create mappings for simulated interrupts. It is also possible to pass a handle to fwnode when creating the simulator domain and retrieve it using irq_find_matching_fwnode(). The irq_sim_fire() function is dropped as well. Instead we implement the irq_get/set_irqchip_state interface. We modify the two modules that use the simulator at the same time as adding these changes in order to reduce the intermediate bloat that would result when trying to migrate the drivers in separate patches. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> #for IIO Link: https://lore.kernel.org/r/20200514083901.23445-3-brgl@bgdev.pl
- Loading branch information
Showing
5 changed files
with
237 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,26 @@ | ||
/* SPDX-License-Identifier: GPL-2.0+ */ | ||
/* | ||
* Copyright (C) 2017-2018 Bartosz Golaszewski <brgl@bgdev.pl> | ||
* Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com> | ||
*/ | ||
|
||
#ifndef _LINUX_IRQ_SIM_H | ||
#define _LINUX_IRQ_SIM_H | ||
|
||
#include <linux/irq_work.h> | ||
#include <linux/device.h> | ||
#include <linux/fwnode.h> | ||
#include <linux/irqdomain.h> | ||
|
||
/* | ||
* Provides a framework for allocating simulated interrupts which can be | ||
* requested like normal irqs and enqueued from process context. | ||
*/ | ||
|
||
struct irq_sim_work_ctx { | ||
struct irq_work work; | ||
unsigned long *pending; | ||
}; | ||
|
||
struct irq_sim_irq_ctx { | ||
int irqnum; | ||
bool enabled; | ||
}; | ||
|
||
struct irq_sim { | ||
struct irq_sim_work_ctx work_ctx; | ||
int irq_base; | ||
unsigned int irq_count; | ||
struct irq_sim_irq_ctx *irqs; | ||
}; | ||
|
||
int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs); | ||
int devm_irq_sim_init(struct device *dev, struct irq_sim *sim, | ||
unsigned int num_irqs); | ||
void irq_sim_fini(struct irq_sim *sim); | ||
void irq_sim_fire(struct irq_sim *sim, unsigned int offset); | ||
int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset); | ||
struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode, | ||
unsigned int num_irqs); | ||
struct irq_domain *devm_irq_domain_create_sim(struct device *dev, | ||
struct fwnode_handle *fwnode, | ||
unsigned int num_irqs); | ||
void irq_domain_remove_sim(struct irq_domain *domain); | ||
|
||
#endif /* _LINUX_IRQ_SIM_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.