[v4,11/19] x86/ioapic: Use irq_domain_create_hierarchy()

Message ID 20230116135044.14998-12-johan+linaro@kernel.org
State New
Headers
Series irqdomain: fix mapping race and clean up locking |

Commit Message

Johan Hovold Jan. 16, 2023, 1:50 p.m. UTC
  Use the irq_domain_create_hierarchy() helper to create the hierarchical
domain, which both serves as documentation and avoids poking at
irqdomain internals.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Tested-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 arch/x86/kernel/apic/io_apic.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Comments

Thomas Gleixner Jan. 17, 2023, 9:41 p.m. UTC | #1
On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote:
>  
> -	ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops,
> -						 (void *)(long)ioapic);
> -
> +	ip->irqdomain = irq_domain_create_hierarchy(parent, 0, hwirqs, fn,
> +						    cfg->ops,
> +						    (void *)(long)ioapic);

The 80 character limit has been lifted quite some time ago. Please use
the 100 which are now the norm.

Thanks,

        tglx
  
Johan Hovold Jan. 18, 2023, 10:31 a.m. UTC | #2
On Tue, Jan 17, 2023 at 10:41:36PM +0100, Thomas Gleixner wrote:
> On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote:
> >  
> > -	ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops,
> > -						 (void *)(long)ioapic);
> > -
> > +	ip->irqdomain = irq_domain_create_hierarchy(parent, 0, hwirqs, fn,
> > +						    cfg->ops,
> > +						    (void *)(long)ioapic);
> 
> The 80 character limit has been lifted quite some time ago. Please use
> the 100 which are now the norm.

Not everyone agrees, including coding-style.rst:

	The preferred limit on the length of a single line is 80 columns.

	Statements longer than 80 columns should be broken into sensible
	chunks, unless exceeding 80 columns significantly increases
	readability and does not hide information.

I go above 80 chars when it improves readability, but it's still a soft
limit for many of us.

I'll change the above, but not sure trying too hard to fit everything in
one line really improves things in cases like:

-       uv_domain = irq_domain_create_hierarchy(x86_vector_domain, 0, 0, fn,
-                                               &uv_domain_ops, NULL);
+       uv_domain = irq_domain_create_hierarchy(x86_vector_domain, 0, 0, fn, &uv_domain_ops, NULL);

Johan
  

Patch

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index a868b76cd3d4..9cc4c8e0c3c4 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2364,9 +2364,9 @@  static int mp_irqdomain_create(int ioapic)
 		return -ENODEV;
 	}
 
-	ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops,
-						 (void *)(long)ioapic);
-
+	ip->irqdomain = irq_domain_create_hierarchy(parent, 0, hwirqs, fn,
+						    cfg->ops,
+						    (void *)(long)ioapic);
 	if (!ip->irqdomain) {
 		/* Release fw handle if it was allocated above */
 		if (!cfg->dev)
@@ -2374,8 +2374,6 @@  static int mp_irqdomain_create(int ioapic)
 		return -ENOMEM;
 	}
 
-	ip->irqdomain->parent = parent;
-
 	if (cfg->type == IOAPIC_DOMAIN_LEGACY ||
 	    cfg->type == IOAPIC_DOMAIN_STRICT)
 		ioapic_dynirq_base = max(ioapic_dynirq_base,