* [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
@ 2021-06-06 12:43 irqchip-bot for Marc Zyngier
2021-06-06 14:19 ` kernel test robot
2021-06-06 15:26 ` kernel test robot
0 siblings, 2 replies; 6+ messages in thread
From: irqchip-bot for Marc Zyngier @ 2021-06-06 12:43 UTC (permalink / raw)
To: linux-kernel; +Cc: Marc Zyngier, tglx
The following commit has been merged into the irq/irqchip-next branch of irqchip:
Commit-ID: 23568360ce3fb1a095466409b77338b0f5d6ec6f
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/23568360ce3fb1a095466409b77338b0f5d6ec6f
Author: Marc Zyngier <maz@kernel.org>
AuthorDate: Tue, 04 May 2021 14:24:37 +01:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Wed, 02 Jun 2021 17:35:36 +01:00
genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
In order to start reaping the benefits of irq_resolve_mapping(),
start using it in __handle_domain_irq() and handle_domain_nmi().
This involves splitting generic_handle_irq() to be able to directly
provide the irq_desc.
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
include/linux/irqdesc.h | 1 +-
kernel/irq/irqdesc.c | 60 +++++++++++++++++++++++-----------------
2 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index df46512..cdd1cf8 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -158,6 +158,7 @@ static inline void generic_handle_irq_desc(struct irq_desc *desc)
desc->handle_irq(desc);
}
+int handle_irq_desc(struct irq_desc *desc);
int generic_handle_irq(unsigned int irq);
#ifdef CONFIG_HANDLE_DOMAIN_IRQ
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 4a617d7..684c5b7 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -632,14 +632,8 @@ void irq_init_desc(unsigned int irq)
#endif /* !CONFIG_SPARSE_IRQ */
-/**
- * generic_handle_irq - Invoke the handler for a particular irq
- * @irq: The irq number to handle
- *
- */
-int generic_handle_irq(unsigned int irq)
+int handle_irq_desc(struct irq_desc *desc)
{
- struct irq_desc *desc = irq_to_desc(irq);
struct irq_data *data;
if (!desc)
@@ -652,6 +646,17 @@ int generic_handle_irq(unsigned int irq)
generic_handle_irq_desc(desc);
return 0;
}
+EXPORT_SYMBOL_GPL(handle_irq_desc);
+
+/**
+ * generic_handle_irq - Invoke the handler for a particular irq
+ * @irq: The irq number to handle
+ *
+ */
+int generic_handle_irq(unsigned int irq)
+{
+ return handle_irq_desc(irq_to_desc(irq));
+}
EXPORT_SYMBOL_GPL(generic_handle_irq);
#ifdef CONFIG_HANDLE_DOMAIN_IRQ
@@ -668,27 +673,32 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
bool lookup, struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
- unsigned int irq = hwirq;
+ struct irq_desc *desc;
int ret = 0;
irq_enter();
-#ifdef CONFIG_IRQ_DOMAIN
- if (lookup)
- irq = irq_find_mapping(domain, hwirq);
-#endif
-
- /*
- * Some hardware gives randomly wrong interrupts. Rather
- * than crashing, do something sensible.
- */
- if (unlikely(!irq || irq >= nr_irqs)) {
- ack_bad_irq(irq);
- ret = -EINVAL;
+ if (likely(IS_ENABLED(CONFIG_IRQ_DOMAIN) && lookup)) {
+ /* The irqdomain code provides boundary checks */
+ desc = irq_resolve_mapping(domain, hwirq);
} else {
- generic_handle_irq(irq);
+ /*
+ * Some hardware gives randomly wrong interrupts. Rather
+ * than crashing, do something sensible.
+ */
+ if (unlikely(!hwirq || hwirq >= nr_irqs)) {
+ ack_bad_irq(hwirq);
+ desc = NULL;
+ } else {
+ desc = irq_to_desc(hwirq);
+ }
}
+ if (likely(desc))
+ handle_irq_desc(desc);
+ else
+ ret = -EINVAL;
+
irq_exit();
set_irq_regs(old_regs);
return ret;
@@ -709,7 +719,7 @@ int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,
struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
- unsigned int irq;
+ struct irq_desc *desc;
int ret = 0;
/*
@@ -717,14 +727,14 @@ int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,
*/
WARN_ON(!in_nmi());
- irq = irq_find_mapping(domain, hwirq);
+ desc = irq_resolve_mapping(domain, hwirq);
/*
* ack_bad_irq is not NMI-safe, just report
* an invalid interrupt.
*/
- if (likely(irq))
- generic_handle_irq(irq);
+ if (likely(desc))
+ handle_irq_desc(desc);
else
ret = -EINVAL;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
2021-06-06 12:43 [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co irqchip-bot for Marc Zyngier
@ 2021-06-06 14:19 ` kernel test robot
2021-06-06 15:28 ` Marc Zyngier
2021-06-06 15:26 ` kernel test robot
1 sibling, 1 reply; 6+ messages in thread
From: kernel test robot @ 2021-06-06 14:19 UTC (permalink / raw)
To: irqchip-bot for Marc Zyngier, linux-kernel; +Cc: kbuild-all, Marc Zyngier, tglx
[-- Attachment #1: Type: text/plain, Size: 4141 bytes --]
Hi irqchip-bot,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on tip/irq/core linus/master v5.13-rc4 next-20210604]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd860052c99b1e088352bdd4fb7aef46f8d2ef47
config: riscv-nommu_k210_defconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e684b127b014b361df0088dca184273cdd73d79e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
git checkout e684b127b014b361df0088dca184273cdd73d79e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
kernel/irq/irqdesc.c: In function '__handle_domain_irq':
kernel/irq/irqdesc.c:683:10: error: implicit declaration of function 'irq_resolve_mapping'; did you mean 'irq_create_mapping'? [-Werror=implicit-function-declaration]
683 | desc = irq_resolve_mapping(domain, hwirq);
| ^~~~~~~~~~~~~~~~~~~
| irq_create_mapping
>> kernel/irq/irqdesc.c:683:8: warning: assignment to 'struct irq_desc *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
683 | desc = irq_resolve_mapping(domain, hwirq);
| ^
kernel/irq/irqdesc.c: In function 'handle_domain_nmi':
kernel/irq/irqdesc.c:730:7: warning: assignment to 'struct irq_desc *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
730 | desc = irq_resolve_mapping(domain, hwirq);
| ^
cc1: some warnings being treated as errors
vim +683 kernel/irq/irqdesc.c
661
662 #ifdef CONFIG_HANDLE_DOMAIN_IRQ
663 /**
664 * __handle_domain_irq - Invoke the handler for a HW irq belonging to a domain
665 * @domain: The domain where to perform the lookup
666 * @hwirq: The HW irq number to convert to a logical one
667 * @lookup: Whether to perform the domain lookup or not
668 * @regs: Register file coming from the low-level handling code
669 *
670 * Returns: 0 on success, or -EINVAL if conversion has failed
671 */
672 int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
673 bool lookup, struct pt_regs *regs)
674 {
675 struct pt_regs *old_regs = set_irq_regs(regs);
676 struct irq_desc *desc;
677 int ret = 0;
678
679 irq_enter();
680
681 if (likely(IS_ENABLED(CONFIG_IRQ_DOMAIN) && lookup)) {
682 /* The irqdomain code provides boundary checks */
> 683 desc = irq_resolve_mapping(domain, hwirq);
684 } else {
685 /*
686 * Some hardware gives randomly wrong interrupts. Rather
687 * than crashing, do something sensible.
688 */
689 if (unlikely(!hwirq || hwirq >= nr_irqs)) {
690 ack_bad_irq(hwirq);
691 desc = NULL;
692 } else {
693 desc = irq_to_desc(hwirq);
694 }
695 }
696
697 if (likely(desc))
698 handle_irq_desc(desc);
699 else
700 ret = -EINVAL;
701
702 irq_exit();
703 set_irq_regs(old_regs);
704 return ret;
705 }
706
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 8507 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
2021-06-06 12:43 [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co irqchip-bot for Marc Zyngier
2021-06-06 14:19 ` kernel test robot
@ 2021-06-06 15:26 ` kernel test robot
1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-06-06 15:26 UTC (permalink / raw)
To: irqchip-bot for Marc Zyngier, linux-kernel; +Cc: kbuild-all, Marc Zyngier, tglx
[-- Attachment #1: Type: text/plain, Size: 4515 bytes --]
Hi irqchip-bot,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linux/master]
[also build test ERROR on tip/irq/core linus/master v5.13-rc4 next-20210604]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd860052c99b1e088352bdd4fb7aef46f8d2ef47
config: openrisc-randconfig-r012-20210606 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e684b127b014b361df0088dca184273cdd73d79e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
git checkout e684b127b014b361df0088dca184273cdd73d79e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
kernel/irq/irqdesc.c: In function '__handle_domain_irq':
>> kernel/irq/irqdesc.c:683:10: error: implicit declaration of function 'irq_resolve_mapping'; did you mean 'irq_create_mapping'? [-Werror=implicit-function-declaration]
683 | desc = irq_resolve_mapping(domain, hwirq);
| ^~~~~~~~~~~~~~~~~~~
| irq_create_mapping
>> kernel/irq/irqdesc.c:683:8: warning: assignment to 'struct irq_desc *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
683 | desc = irq_resolve_mapping(domain, hwirq);
| ^
kernel/irq/irqdesc.c: In function 'handle_domain_nmi':
kernel/irq/irqdesc.c:730:7: warning: assignment to 'struct irq_desc *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
730 | desc = irq_resolve_mapping(domain, hwirq);
| ^
cc1: some warnings being treated as errors
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for LOCKDEP
Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
Selected by
- PROVE_LOCKING && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
- DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
vim +683 kernel/irq/irqdesc.c
661
662 #ifdef CONFIG_HANDLE_DOMAIN_IRQ
663 /**
664 * __handle_domain_irq - Invoke the handler for a HW irq belonging to a domain
665 * @domain: The domain where to perform the lookup
666 * @hwirq: The HW irq number to convert to a logical one
667 * @lookup: Whether to perform the domain lookup or not
668 * @regs: Register file coming from the low-level handling code
669 *
670 * Returns: 0 on success, or -EINVAL if conversion has failed
671 */
672 int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
673 bool lookup, struct pt_regs *regs)
674 {
675 struct pt_regs *old_regs = set_irq_regs(regs);
676 struct irq_desc *desc;
677 int ret = 0;
678
679 irq_enter();
680
681 if (likely(IS_ENABLED(CONFIG_IRQ_DOMAIN) && lookup)) {
682 /* The irqdomain code provides boundary checks */
> 683 desc = irq_resolve_mapping(domain, hwirq);
684 } else {
685 /*
686 * Some hardware gives randomly wrong interrupts. Rather
687 * than crashing, do something sensible.
688 */
689 if (unlikely(!hwirq || hwirq >= nr_irqs)) {
690 ack_bad_irq(hwirq);
691 desc = NULL;
692 } else {
693 desc = irq_to_desc(hwirq);
694 }
695 }
696
697 if (likely(desc))
698 handle_irq_desc(desc);
699 else
700 ret = -EINVAL;
701
702 irq_exit();
703 set_irq_regs(old_regs);
704 return ret;
705 }
706
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 23467 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
2021-06-06 14:19 ` kernel test robot
@ 2021-06-06 15:28 ` Marc Zyngier
2021-06-07 6:34 ` [kbuild-all] " Rong Chen
0 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2021-06-06 15:28 UTC (permalink / raw)
To: kernel test robot
Cc: irqchip-bot for Marc Zyngier, linux-kernel, kbuild-all, tglx
On 2021-06-06 15:19, kernel test robot wrote:
> Hi irqchip-bot,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linux/master]
> [also build test WARNING on tip/irq/core linus/master v5.13-rc4
> next-20210604]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:
> https://github.com/0day-ci/linux/commits/irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
> base:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> dd860052c99b1e088352bdd4fb7aef46f8d2ef47
> config: riscv-nommu_k210_defconfig (attached as .config)
> compiler: riscv64-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
> wget
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
> -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> #
> https://github.com/0day-ci/linux/commit/e684b127b014b361df0088dca184273cdd73d79e
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review
> irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
> git checkout e684b127b014b361df0088dca184273cdd73d79e
Same thing. Patch randomly picked without context, broken
test system. From now on. these reports will be sent to /dev/null
until the test infrastructure is fixed.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kbuild-all] Re: [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
2021-06-06 15:28 ` Marc Zyngier
@ 2021-06-07 6:34 ` Rong Chen
0 siblings, 0 replies; 6+ messages in thread
From: Rong Chen @ 2021-06-07 6:34 UTC (permalink / raw)
To: Marc Zyngier, kernel test robot
Cc: irqchip-bot for Marc Zyngier, linux-kernel, kbuild-all, tglx
On 6/6/21 11:28 PM, Marc Zyngier wrote:
> On 2021-06-06 15:19, kernel test robot wrote:
>> Hi irqchip-bot,
>>
>> Thank you for the patch! Perhaps something to improve:
>>
>> [auto build test WARNING on linux/master]
>> [also build test WARNING on tip/irq/core linus/master v5.13-rc4
>> next-20210604]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
>>
>> base:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> dd860052c99b1e088352bdd4fb7aef46f8d2ef47
>> config: riscv-nommu_k210_defconfig (attached as .config)
>> compiler: riscv64-linux-gcc (GCC) 9.3.0
>> reproduce (this is a W=1 build):
>> wget
>> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
>> -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> #
>> https://github.com/0day-ci/linux/commit/e684b127b014b361df0088dca184273cdd73d79e
>>
>> git remote add linux-review https://github.com/0day-ci/linux
>> git fetch --no-tags linux-review
>> irqchip-bot-for-Marc-Zyngier/genirq-Use-irq_resolve_mapping-to-implement-__handle_domain_irq-and-co/20210606-204819
>>
>> git checkout e684b127b014b361df0088dca184273cdd73d79e
>
> Same thing. Patch randomly picked without context, broken
> test system. From now on. these reports will be sent to /dev/null
> until the test infrastructure is fixed.
>
> M.
Hi Marc,
Sorry for the inconvenience, we didn't identify the patch emails from
tip-bot2,
we'll ignore these emails to avoid ineffective work.
Best Regards,
Rong Chen
^ permalink raw reply [flat|nested] 6+ messages in thread
* [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
@ 2021-06-11 13:54 irqchip-bot for Marc Zyngier
0 siblings, 0 replies; 6+ messages in thread
From: irqchip-bot for Marc Zyngier @ 2021-06-11 13:54 UTC (permalink / raw)
To: linux-kernel; +Cc: Marc Zyngier, tglx
The following commit has been merged into the irq/irqchip-next branch of irqchip:
Commit-ID: a3016b26ee6ee13d5647d701404a7912d4eaea9e
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/a3016b26ee6ee13d5647d701404a7912d4eaea9e
Author: Marc Zyngier <maz@kernel.org>
AuthorDate: Tue, 04 May 2021 14:24:37 +01:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Thu, 10 Jun 2021 13:09:18 +01:00
genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
In order to start reaping the benefits of irq_resolve_mapping(),
start using it in __handle_domain_irq() and handle_domain_nmi().
This involves splitting generic_handle_irq() to be able to directly
provide the irq_desc.
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
include/linux/irqdesc.h | 1 +-
kernel/irq/irqdesc.c | 60 +++++++++++++++++++++++-----------------
2 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index df46512..cdd1cf8 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -158,6 +158,7 @@ static inline void generic_handle_irq_desc(struct irq_desc *desc)
desc->handle_irq(desc);
}
+int handle_irq_desc(struct irq_desc *desc);
int generic_handle_irq(unsigned int irq);
#ifdef CONFIG_HANDLE_DOMAIN_IRQ
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 4a617d7..684c5b7 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -632,14 +632,8 @@ void irq_init_desc(unsigned int irq)
#endif /* !CONFIG_SPARSE_IRQ */
-/**
- * generic_handle_irq - Invoke the handler for a particular irq
- * @irq: The irq number to handle
- *
- */
-int generic_handle_irq(unsigned int irq)
+int handle_irq_desc(struct irq_desc *desc)
{
- struct irq_desc *desc = irq_to_desc(irq);
struct irq_data *data;
if (!desc)
@@ -652,6 +646,17 @@ int generic_handle_irq(unsigned int irq)
generic_handle_irq_desc(desc);
return 0;
}
+EXPORT_SYMBOL_GPL(handle_irq_desc);
+
+/**
+ * generic_handle_irq - Invoke the handler for a particular irq
+ * @irq: The irq number to handle
+ *
+ */
+int generic_handle_irq(unsigned int irq)
+{
+ return handle_irq_desc(irq_to_desc(irq));
+}
EXPORT_SYMBOL_GPL(generic_handle_irq);
#ifdef CONFIG_HANDLE_DOMAIN_IRQ
@@ -668,27 +673,32 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
bool lookup, struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
- unsigned int irq = hwirq;
+ struct irq_desc *desc;
int ret = 0;
irq_enter();
-#ifdef CONFIG_IRQ_DOMAIN
- if (lookup)
- irq = irq_find_mapping(domain, hwirq);
-#endif
-
- /*
- * Some hardware gives randomly wrong interrupts. Rather
- * than crashing, do something sensible.
- */
- if (unlikely(!irq || irq >= nr_irqs)) {
- ack_bad_irq(irq);
- ret = -EINVAL;
+ if (likely(IS_ENABLED(CONFIG_IRQ_DOMAIN) && lookup)) {
+ /* The irqdomain code provides boundary checks */
+ desc = irq_resolve_mapping(domain, hwirq);
} else {
- generic_handle_irq(irq);
+ /*
+ * Some hardware gives randomly wrong interrupts. Rather
+ * than crashing, do something sensible.
+ */
+ if (unlikely(!hwirq || hwirq >= nr_irqs)) {
+ ack_bad_irq(hwirq);
+ desc = NULL;
+ } else {
+ desc = irq_to_desc(hwirq);
+ }
}
+ if (likely(desc))
+ handle_irq_desc(desc);
+ else
+ ret = -EINVAL;
+
irq_exit();
set_irq_regs(old_regs);
return ret;
@@ -709,7 +719,7 @@ int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,
struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
- unsigned int irq;
+ struct irq_desc *desc;
int ret = 0;
/*
@@ -717,14 +727,14 @@ int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,
*/
WARN_ON(!in_nmi());
- irq = irq_find_mapping(domain, hwirq);
+ desc = irq_resolve_mapping(domain, hwirq);
/*
* ack_bad_irq is not NMI-safe, just report
* an invalid interrupt.
*/
- if (likely(irq))
- generic_handle_irq(irq);
+ if (likely(desc))
+ handle_irq_desc(desc);
else
ret = -EINVAL;
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-11 13:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06 12:43 [irqchip: irq/irqchip-next] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co irqchip-bot for Marc Zyngier
2021-06-06 14:19 ` kernel test robot
2021-06-06 15:28 ` Marc Zyngier
2021-06-07 6:34 ` [kbuild-all] " Rong Chen
2021-06-06 15:26 ` kernel test robot
2021-06-11 13:54 irqchip-bot for Marc Zyngier
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).