2020-07-30 03:38:34

by Mark Tomlinson

[permalink] [raw]
Subject: [PATCH 3/3] PCI: iproc: Set affinity mask on MSI interrupts

The core interrupt code expects the irq_set_affinity call to update the
effective affinity for the interrupt. This was not being done, so update
iproc_msi_irq_set_affinity() to do so.

Signed-off-by: Mark Tomlinson <[email protected]>
---
drivers/pci/controller/pcie-iproc-msi.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
index 3176ad3ab0e5..908475d27e0e 100644
--- a/drivers/pci/controller/pcie-iproc-msi.c
+++ b/drivers/pci/controller/pcie-iproc-msi.c
@@ -209,15 +209,20 @@ static int iproc_msi_irq_set_affinity(struct irq_data *data,
struct iproc_msi *msi = irq_data_get_irq_chip_data(data);
int target_cpu = cpumask_first(mask);
int curr_cpu;
+ int ret;

curr_cpu = hwirq_to_cpu(msi, data->hwirq);
if (curr_cpu == target_cpu)
- return IRQ_SET_MASK_OK_DONE;
+ ret = IRQ_SET_MASK_OK_DONE;
+ else {
+ /* steer MSI to the target CPU */
+ data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu;
+ ret = IRQ_SET_MASK_OK;
+ }

- /* steer MSI to the target CPU */
- data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu;
+ irq_data_update_effective_affinity(data, cpumask_of(target_cpu));

- return IRQ_SET_MASK_OK;
+ return ret;
}

static void iproc_msi_irq_compose_msi_msg(struct irq_data *data,
--
2.28.0


2020-07-30 16:48:24

by Ray Jui

[permalink] [raw]
Subject: Re: [PATCH 3/3] PCI: iproc: Set affinity mask on MSI interrupts



On 7/29/2020 8:37 PM, Mark Tomlinson wrote:
> The core interrupt code expects the irq_set_affinity call to update the
> effective affinity for the interrupt. This was not being done, so update
> iproc_msi_irq_set_affinity() to do so.
>
> Signed-off-by: Mark Tomlinson <[email protected]>
> ---
> drivers/pci/controller/pcie-iproc-msi.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
> index 3176ad3ab0e5..908475d27e0e 100644
> --- a/drivers/pci/controller/pcie-iproc-msi.c
> +++ b/drivers/pci/controller/pcie-iproc-msi.c
> @@ -209,15 +209,20 @@ static int iproc_msi_irq_set_affinity(struct irq_data *data,
> struct iproc_msi *msi = irq_data_get_irq_chip_data(data);
> int target_cpu = cpumask_first(mask);
> int curr_cpu;
> + int ret;
>
> curr_cpu = hwirq_to_cpu(msi, data->hwirq);
> if (curr_cpu == target_cpu)
> - return IRQ_SET_MASK_OK_DONE;
> + ret = IRQ_SET_MASK_OK_DONE;
> + else {
> + /* steer MSI to the target CPU */
> + data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu;
> + ret = IRQ_SET_MASK_OK;
> + }
>
> - /* steer MSI to the target CPU */
> - data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu;
> + irq_data_update_effective_affinity(data, cpumask_of(target_cpu));
>
> - return IRQ_SET_MASK_OK;
> + return ret;
> }
>
> static void iproc_msi_irq_compose_msi_msg(struct irq_data *data,
>

This change looks good to me. Thanks.

Reviewed-by: Ray Jui <[email protected]>

2020-07-30 17:10:51

by Scott Branden

[permalink] [raw]
Subject: Re: [PATCH 3/3] PCI: iproc: Set affinity mask on MSI interrupts



On 2020-07-29 8:37 p.m., Mark Tomlinson wrote:
> The core interrupt code expects the irq_set_affinity call to update the
> effective affinity for the interrupt. This was not being done, so update
> iproc_msi_irq_set_affinity() to do so.
>
> Signed-off-by: Mark Tomlinson <[email protected]>
Should this have a Fixes: added to it?
> ---
> drivers/pci/controller/pcie-iproc-msi.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
> index 3176ad3ab0e5..908475d27e0e 100644
> --- a/drivers/pci/controller/pcie-iproc-msi.c
> +++ b/drivers/pci/controller/pcie-iproc-msi.c
> @@ -209,15 +209,20 @@ static int iproc_msi_irq_set_affinity(struct irq_data *data,
> struct iproc_msi *msi = irq_data_get_irq_chip_data(data);
> int target_cpu = cpumask_first(mask);
> int curr_cpu;
> + int ret;
>
> curr_cpu = hwirq_to_cpu(msi, data->hwirq);
> if (curr_cpu == target_cpu)
> - return IRQ_SET_MASK_OK_DONE;
> + ret = IRQ_SET_MASK_OK_DONE;
> + else {
> + /* steer MSI to the target CPU */
> + data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu;
> + ret = IRQ_SET_MASK_OK;
> + }
>
> - /* steer MSI to the target CPU */
> - data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu;
> + irq_data_update_effective_affinity(data, cpumask_of(target_cpu));
>
> - return IRQ_SET_MASK_OK;
> + return ret;
> }
>
> static void iproc_msi_irq_compose_msi_msg(struct irq_data *data,