diff mbox series

[V4,10/21] irqchip/mbigen: Remove platform_msi_create_device_domain() fallback

Message ID 20240623142235.333333826@linutronix.de
State New
Headers show
Series genirq, irqchip: Convert ARM MSI handling to per device MSI domains | expand

Commit Message

Thomas Gleixner June 23, 2024, 3:18 p.m. UTC
From: Thomas Gleixner <tglx@linutronix.de>

Now that ITS provides the MSI parent domain, remove the unused fallback
code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Shivamurthy Shastri <shivamurthy.shastri@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 drivers/irqchip/irq-mbigen.c | 74 ++----------------------------------
 1 file changed, 4 insertions(+), 70 deletions(-)

Comments

Lorenzo Pieralisi June 25, 2024, 2:42 p.m. UTC | #1
On Sun, Jun 23, 2024 at 05:18:48PM +0200, Thomas Gleixner wrote:

[+Hanjun]

Hanjun, are you able to test this series (or find someone who can) and
in particular mbigen changes on affected HW and report back here please ?

Thanks,
Lorenzo

> From: Thomas Gleixner <tglx@linutronix.de>
> 
> Now that ITS provides the MSI parent domain, remove the unused fallback
> code.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
> Signed-off-by: Shivamurthy Shastri <shivamurthy.shastri@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> 
> 
> ---
>  drivers/irqchip/irq-mbigen.c | 74 ++----------------------------------
>  1 file changed, 4 insertions(+), 70 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
> index db0fa80330d9..093fd42893a7 100644
> --- a/drivers/irqchip/irq-mbigen.c
> +++ b/drivers/irqchip/irq-mbigen.c
> @@ -180,64 +180,6 @@ static int mbigen_domain_translate(struct irq_domain *d, struct irq_fwspec *fwsp
>  	return -EINVAL;
>  }
>  
> -/* The following section will go away once ITS provides a MSI parent */
> -
> -static struct irq_chip mbigen_irq_chip = {
> -	.name =			"mbigen-v2",
> -	.irq_mask =		irq_chip_mask_parent,
> -	.irq_unmask =		irq_chip_unmask_parent,
> -	.irq_eoi =		mbigen_eoi_irq,
> -	.irq_set_type =		mbigen_set_type,
> -	.irq_set_affinity =	irq_chip_set_affinity_parent,
> -};
> -
> -static int mbigen_irq_domain_alloc(struct irq_domain *domain,
> -					unsigned int virq,
> -					unsigned int nr_irqs,
> -					void *args)
> -{
> -	struct irq_fwspec *fwspec = args;
> -	irq_hw_number_t hwirq;
> -	unsigned int type;
> -	struct mbigen_device *mgn_chip;
> -	int i, err;
> -
> -	err = mbigen_domain_translate(domain, fwspec, &hwirq, &type);
> -	if (err)
> -		return err;
> -
> -	err = platform_msi_device_domain_alloc(domain, virq, nr_irqs);
> -	if (err)
> -		return err;
> -
> -	mgn_chip = platform_msi_get_host_data(domain);
> -
> -	for (i = 0; i < nr_irqs; i++)
> -		irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
> -				      &mbigen_irq_chip, mgn_chip->base);
> -
> -	return 0;
> -}
> -
> -static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
> -				   unsigned int nr_irqs)
> -{
> -	platform_msi_device_domain_free(domain, virq, nr_irqs);
> -}
> -
> -static const struct irq_domain_ops mbigen_domain_ops = {
> -	.translate	= mbigen_domain_translate,
> -	.alloc		= mbigen_irq_domain_alloc,
> -	.free		= mbigen_irq_domain_free,
> -};
> -
> -static void mbigen_write_msg(struct msi_desc *desc, struct msi_msg *msg)
> -{
> -	mbigen_write_msi_msg(irq_get_irq_data(desc->irq), msg);
> -}
> -
> -/* End of to be removed section */
> -
>  static void mbigen_domain_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc)
>  {
>  	arg->desc = desc;
> @@ -268,20 +210,12 @@ static const struct msi_domain_template mbigen_msi_template = {
>  static bool mbigen_create_device_domain(struct device *dev, unsigned int size,
>  					struct mbigen_device *mgn_chip)
>  {
> -	struct irq_domain *domain = dev->msi.domain;
> -
> -	if (WARN_ON_ONCE(!domain))
> +	if (WARN_ON_ONCE(!dev->msi.domain))
>  		return false;
>  
> -	if (irq_domain_is_msi_parent(domain)) {
> -		return msi_create_device_irq_domain(dev, MSI_DEFAULT_DOMAIN,
> -						    &mbigen_msi_template, size,
> -						    NULL, mgn_chip->base);
> -	}
> -
> -	/* Remove once ITS provides MSI parent */
> -	return !!platform_msi_create_device_domain(dev, size, mbigen_write_msg,
> -						   &mbigen_domain_ops, mgn_chip);
> +	return msi_create_device_irq_domain(dev, MSI_DEFAULT_DOMAIN,
> +					    &mbigen_msi_template, size,
> +					    NULL, mgn_chip->base);
>  }
>  
>  static int mbigen_of_create_domain(struct platform_device *pdev,
> -- 
> 2.34.1
> 
>
Hanjun Guo June 26, 2024, 9:13 a.m. UTC | #2
On 2024/6/25 22:42, Lorenzo Pieralisi wrote:
> On Sun, Jun 23, 2024 at 05:18:48PM +0200, Thomas Gleixner wrote:
> 
> [+Hanjun]

Thanks for let me know.

> 
> Hanjun, are you able to test this series (or find someone who can) and
> in particular mbigen changes on affected HW and report back here please ?

I tested on a Kunpeng920 ARM server (with this patch set on top of
6.10-rc3), which the mbigen interrupts are used by SoC PMU counters, I
can see that the PMU counters can generate overflow interrupts as
before, it works for me.

Thanks
Hanjun
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index db0fa80330d9..093fd42893a7 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -180,64 +180,6 @@  static int mbigen_domain_translate(struct irq_domain *d, struct irq_fwspec *fwsp
 	return -EINVAL;
 }
 
-/* The following section will go away once ITS provides a MSI parent */
-
-static struct irq_chip mbigen_irq_chip = {
-	.name =			"mbigen-v2",
-	.irq_mask =		irq_chip_mask_parent,
-	.irq_unmask =		irq_chip_unmask_parent,
-	.irq_eoi =		mbigen_eoi_irq,
-	.irq_set_type =		mbigen_set_type,
-	.irq_set_affinity =	irq_chip_set_affinity_parent,
-};
-
-static int mbigen_irq_domain_alloc(struct irq_domain *domain,
-					unsigned int virq,
-					unsigned int nr_irqs,
-					void *args)
-{
-	struct irq_fwspec *fwspec = args;
-	irq_hw_number_t hwirq;
-	unsigned int type;
-	struct mbigen_device *mgn_chip;
-	int i, err;
-
-	err = mbigen_domain_translate(domain, fwspec, &hwirq, &type);
-	if (err)
-		return err;
-
-	err = platform_msi_device_domain_alloc(domain, virq, nr_irqs);
-	if (err)
-		return err;
-
-	mgn_chip = platform_msi_get_host_data(domain);
-
-	for (i = 0; i < nr_irqs; i++)
-		irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
-				      &mbigen_irq_chip, mgn_chip->base);
-
-	return 0;
-}
-
-static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
-				   unsigned int nr_irqs)
-{
-	platform_msi_device_domain_free(domain, virq, nr_irqs);
-}
-
-static const struct irq_domain_ops mbigen_domain_ops = {
-	.translate	= mbigen_domain_translate,
-	.alloc		= mbigen_irq_domain_alloc,
-	.free		= mbigen_irq_domain_free,
-};
-
-static void mbigen_write_msg(struct msi_desc *desc, struct msi_msg *msg)
-{
-	mbigen_write_msi_msg(irq_get_irq_data(desc->irq), msg);
-}
-
-/* End of to be removed section */
-
 static void mbigen_domain_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc)
 {
 	arg->desc = desc;
@@ -268,20 +210,12 @@  static const struct msi_domain_template mbigen_msi_template = {
 static bool mbigen_create_device_domain(struct device *dev, unsigned int size,
 					struct mbigen_device *mgn_chip)
 {
-	struct irq_domain *domain = dev->msi.domain;
-
-	if (WARN_ON_ONCE(!domain))
+	if (WARN_ON_ONCE(!dev->msi.domain))
 		return false;
 
-	if (irq_domain_is_msi_parent(domain)) {
-		return msi_create_device_irq_domain(dev, MSI_DEFAULT_DOMAIN,
-						    &mbigen_msi_template, size,
-						    NULL, mgn_chip->base);
-	}
-
-	/* Remove once ITS provides MSI parent */
-	return !!platform_msi_create_device_domain(dev, size, mbigen_write_msg,
-						   &mbigen_domain_ops, mgn_chip);
+	return msi_create_device_irq_domain(dev, MSI_DEFAULT_DOMAIN,
+					    &mbigen_msi_template, size,
+					    NULL, mgn_chip->base);
 }
 
 static int mbigen_of_create_domain(struct platform_device *pdev,