genirq/irqdomain: Don't call ops->select for DOMAIN_BUS_ANY tokens
Subsystems (4)
PATCH 1/1 genirq/irqdomain: Don't call ops->select for DOMAIN_BUS_ANY tokens
Users of the IRQCHIP_PLATFORM_DRIVER_{BEGIN,END} helpers rely on a fwspec containing only the fwnode (and crucially a number of parameters set to 0) together with a DOMAIN_BUS_ANY token to check whether a parent irqchip has probed and registered a domain.
Since de1ff306dcf4 ("genirq/irqdomain: Remove the param count restriction from select()"), we call ops->select unconditionally, meaning that irqchips implementing select now need to handle ANY as a match.
Instead of adding more esoteric checks to the individual drivers, add that condition to irq_find_matching_fwspec(), and let it handle the corner case, as per the comment in the function.
This restores the functionnality of the above helpers.
--- kernel/irq/irqdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/irqdomain.c +1 -1
@@ -449,7 +449,7 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,*/ mutex_lock (&irq_domain_mutex);list_for_each_entry (h, &irq_domain_list, link) { -if (h->ops->select) +if (h->ops->select && bus_token !=DOMAIN_BUS_ANY ) rc = h->ops->select (h, fwspec, bus_token);else if (h->ops->match) rc = h->ops->match (h,to_of_node (fwnode), bus_token);
Signature · 1 line
2.39.2
Hi Marc Zyngier,
Quoted 19 lines
-----Original Message-----
From: Marc Zyngier <[email protected]>
Sent: Tuesday, February 20, 2024 11:48 AM
Subject: [PATCH] genirq/irqdomain: Don't callops->selectforDOMAIN_BUS_ANYtokensUsers of the IRQCHIP_PLATFORM_DRIVER_{BEGIN,END} helpers rely on a fwspec containing only the fwnode (and crucially a number of parameters set to 0) together with a
DOMAIN_BUS_ANYtoken to check whether a parent irqchip has probed and registered a domain.Since
de1ff306dcf4("genirq/irqdomain: Remove the param count restriction fromselect()"), we callops->selectunconditionally, meaning that irqchips implementing select now need to handle ANY as a match.Instead of adding more esoteric checks to the individual drivers, add that condition to
irq_find_matching_fwspec(), and let it handle the corner case, as per the comment in the function.
Quoted 5 lines
This restores the functionnality of the above helpers.
Reported-by Dmitry Baryshkov <[email protected]>Tested-by Dmitry Baryshkov <[email protected]>Reported-by Biju Das <[email protected]>
Cheers,
Biju
Quoted 24 lines
Fixes de1ff306dcf4 ("genirq/irqdomain: Remove the param count restrictionfrom
select()")Signed-off-by Marc Zyngier <[email protected]>Link:
--- kernel/irq/irqdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/irq/irqdomain.c index renamed from kernel/irq/irqdomain.c +0
-0
aeb41655d6de..3dd1c871e091100644kernel/irq/irqdomain.c +1
-1@@ -449,7 +449,7 @@ struct irq_domain *irq_find_matching_fwspec(structirq_fwspec *fwspec, */ mutex_lock (&irq_domain_mutex);list_for_each_entry (h, &irq_domain_list, link) { -if (h->ops->select) +if (h->ops->select && bus_token !=DOMAIN_BUS_ANY ) rc = h->ops->select (h, fwspec, bus_token);else if (h->ops->match)rc =
h->ops->match(h, to_of_node(fwnode), bus_token);
--
2.39.2
The following commit has been merged into the irq/msi branch of tip:
The following commit has been merged into the irq/msi branch of tip:
Commit-ID: 5aa3c0cf5bba6437c9e63a56f684f61de8b503d6 Gitweb: https://git.kernel.org/tip/5aa3c0cf5bba6437c9e63a56f684f61de8b503d6 Author: Marc Zyngier <[email protected]> AuthorDate: Tue, 20 Feb 2024 11:47:31 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 20 Feb 2024 17:30:57 +01:00
genirq/irqdomain: Don't call ops->select for DOMAIN_BUS_ANY tokens
Users of the IRQCHIP_PLATFORM_DRIVER_{BEGIN,END} helpers rely on a fwspec containing only the fwnode (and crucially a number of parameters set to 0) together with a DOMAIN_BUS_ANY token to check whether a parent irqchip has probed and registered a domain.
Since de1ff306dcf4 ("genirq/irqdomain: Remove the param count restriction from select()"), ops->select() is called unconditionally, meaning that irqchips implementing select() now need to handle ANY as a match.
Instead of adding more esoteric checks to the individual drivers, add that condition to irq_find_matching_fwspec(), and let it handle the corner case, as per the comment in the function.
This restores the functionality of the above helpers.
--- kernel/irq/irqdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/irqdomain.c +1 -1
@@ -449,7 +449,7 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,*/ mutex_lock (&irq_domain_mutex);list_for_each_entry (h, &irq_domain_list, link) { -if (h->ops->select) +if (h->ops->select && bus_token !=DOMAIN_BUS_ANY ) rc = h->ops->select (h, fwspec, bus_token);else if (h->ops->match) rc = h->ops->match (h,to_of_node (fwnode), bus_token);
Quoted 15 lines · Marc Zyngier
Users of the IRQCHIP_PLATFORM_DRIVER_{BEGIN,END} helpers rely on a fwspec containing only the fwnode (and crucially a number of parameters set to 0) together with a
DOMAIN_BUS_ANYtoken to check whether a parent irqchip has probed and registered a domain.Since
de1ff306dcf4("genirq/irqdomain: Remove the param count restriction fromselect()"), we callops->selectunconditionally, meaning that irqchips implementing select now need to handle ANY as a match.Instead of adding more esoteric checks to the individual drivers, add that condition to
irq_find_matching_fwspec(), and let it handle the corner case, as per the comment in the function.
Quoted 8 lines
This restores the functionnality of the above helpers.
Reported-by Dmitry Baryshkov <[email protected]>Tested-by Dmitry Baryshkov <[email protected]>Reported-by Biju Das <[email protected]>Fixes de1ff306dcf4 ("genirq/irqdomain: Remove the param count restriction from select()")Signed-off-by Marc Zyngier <[email protected]>
Bah. That breaks x86 because it uses DOMAIN_BUS_ANY to find the MSI parent for a fwspec (IOAPIC and HPET) which gets either picked up by the interrupt remapping or by the root vector domain.
Fix below.
Thanks,
tglx
---
Subject: x86/apic/msi: Use DOMAIN_BUS_GENERIC_MSI for HPET/IO-APIC domain search
From: Thomas Gleixner <[email protected]>
Date: Sun, 25 Feb 2024 16:56:12 +0100
The recent restriction to invoke irqdomain_ops::select() only when the domain bus toke is DOMAIN_BUS_ANY breaks the search for the parent MSI domain of HPET and IO-APIC. The latter causes a full boot fail.
The restriction itself makes sense to avoid adding DOMAIN_BUS_ANY matches into the various ARM specific select() callbacks. Reverting this change would obviously break ARM platforms again and require DOMAIN_BUS_ANY matches added to various places.
A simpler solution is to use the DOMAIN_BUS_GENERIC_MSI token for the HPET and IO-APIC parent domain search. This works out of the box because the affected parent domains check only for the firmware specification content and not for the bus token.
--- arch/x86/kernel/apic/io_apic.c | 2 +- arch/x86/kernel/hpet.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -1
@@ -2354,7 +2354,7 @@ static int mp_irqdomain_create(int ioapi fwspec.param_count =1 ; fwspec.param[0 ] =mpc_ioapic_id (ioapic); - parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_ANY ); + parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_GENERIC_MSI );if (!parent) {if (!cfg->dev)irq_domain_free_fwnode (fn);
arch/x86/kernel/hpet.c +1 -1
@@ -568,7 +568,7 @@ static struct irq_domain *hpet_create_ir fwspec.param_count =1 ; fwspec.param[0 ] = hpet_id; - parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_ANY ); + parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_GENERIC_MSI );if (!parent) {irq_domain_free_fwnode (fn);kfree (domain_info);
Quoted 5 lines · Thomas Gleixner
Bah. That breaks x86 because it uses
DOMAIN_BUS_ANYto find the MSI parent for a fwspec (IOAPIC and HPET) which gets either picked up by the interrupt remapping or by the root vector domain.Fix below.
The guest boots fine now, thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteMarc Zyngier
Reviewed-byQuoted 48 lines · Thomas Gleixner
Quoted 15 lines · Marc Zyngier
Users of the IRQCHIP_PLATFORM_DRIVER_{BEGIN,END} helpers rely on a fwspec containing only the fwnode (and crucially a number of parameters set to 0) together with a
DOMAIN_BUS_ANYtoken to check whether a parent irqchip has probed and registered a domain.Since
de1ff306dcf4("genirq/irqdomain: Remove the param count restriction fromselect()"), we callops->selectunconditionally, meaning that irqchips implementing select now need to handle ANY as a match.Instead of adding more esoteric checks to the individual drivers, add that condition to
irq_find_matching_fwspec(), and let it handle the corner case, as per the comment in the function.Quoted 8 lines
This restores the functionnality of the above helpers.
Reported-by Dmitry Baryshkov <[email protected]>Tested-by Dmitry Baryshkov <[email protected]>Reported-by Biju Das <[email protected]>Fixes de1ff306dcf4 ("genirq/irqdomain: Remove the param count restriction from select()")Signed-off-by Marc Zyngier <[email protected]>Bah. That breaks x86 because it uses
DOMAIN_BUS_ANYto find the MSI parent for a fwspec (IOAPIC and HPET) which gets either picked up by the interrupt remapping or by the root vector domain.Fix below.
Thanks,
tglx
---
Subject: x86/apic/msi: UseDOMAIN_BUS_GENERIC_MSIfor HPET/IO-APIC domain search
From: Thomas Gleixner <[email protected]>
Date: Sun, 25 Feb 2024 16:56:12 +0100The recent restriction to invoke
irqdomain_ops::select()only when the domain bus toke isDOMAIN_BUS_ANYbreaks the search for the parent MSI domain of HPET and IO-APIC. The latter causes a full boot fail.The restriction itself makes sense to avoid adding
DOMAIN_BUS_ANYmatches into the various ARM specificselect()callbacks. Reverting this change would obviously break ARM platforms again and requireDOMAIN_BUS_ANYmatches added to various places.
Quoted 8 lines
A simpler solution is to use the
DOMAIN_BUS_GENERIC_MSItoken for the HPET and IO-APIC parent domain search. This works out of the box because the affected parent domains check only for the firmware specification content and not for the bus token.Fixes 5aa3c0cf5bba ("genirq/irqdomain: Don't call ops->select for
DOMAIN_BUS_ANYtokens")Signed-off-by Thomas Gleixner <[email protected]>
Looks good to me.
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
[tip: irq/msi] x86/apic/msi: Use DOMAIN_BUS_GENERIC_MSI for HPET/IO-APIC domain search
In reply to Thomas GleixnerThe following commit has been merged into the irq/msi branch of tip:
The following commit has been merged into the irq/msi branch of tip:
Commit-ID: c147e1ef59d4751a60687074e4268ecc0ef31b5c Gitweb: https://git.kernel.org/tip/c147e1ef59d4751a60687074e4268ecc0ef31b5c Author: Thomas Gleixner <[email protected]> AuthorDate: Sun, 25 Feb 2024 16:56:12 +01:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Sun, 25 Feb 2024 18:53:08 +01:00
x86/apic/msi: Use DOMAIN_BUS_GENERIC_MSI for HPET/IO-APIC domain search
The recent restriction to invoke irqdomain_ops::select() only when the domain bus token is not DOMAIN_BUS_ANY breaks the search for the parent MSI domain of HPET and IO-APIC. The latter causes a full boot fail.
The restriction itself makes sense to avoid adding DOMAIN_BUS_ANY matches into the various ARM specific select() callbacks. Reverting this change would obviously break ARM platforms again and require DOMAIN_BUS_ANY matches added to various places.
A simpler solution is to use the DOMAIN_BUS_GENERIC_MSI token for the HPET and IO-APIC parent domain search. This works out of the box because the affected parent domains check only for the firmware specification content and not for the bus token.
--- arch/x86/kernel/apic/io_apic.c | 2 +- arch/x86/kernel/hpet.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -1
@@ -2354,7 +2354,7 @@ static int mp_irqdomain_create(int ioapic) fwspec.param_count =1 ; fwspec.param[0 ] =mpc_ioapic_id (ioapic); - parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_ANY ); + parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_GENERIC_MSI );if (!parent) {if (!cfg->dev)irq_domain_free_fwnode (fn);
arch/x86/kernel/hpet.c +1 -1
@@ -568,7 +568,7 @@ static struct irq_domain *hpet_create_irq_domain(int hpet_id) fwspec.param_count =1 ; fwspec.param[0 ] = hpet_id; - parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_ANY ); + parent =irq_find_matching_fwspec (&fwspec,DOMAIN_BUS_GENERIC_MSI );if (!parent) {irq_domain_free_fwnode (fn);kfree (domain_info);