2020-08-26 12:05:45

by Thomas Gleixner

[permalink] [raw]
Subject: [patch V2 15/46] x86/irq: Consolidate DMAR irq allocation

From: Thomas Gleixner <[email protected]>

None of the DMAR specific fields are required.

Signed-off-by: Thomas Gleixner <[email protected]>

---
arch/x86/include/asm/hw_irq.h | 6 ------
arch/x86/kernel/apic/msi.c | 10 +++++-----
2 files changed, 5 insertions(+), 11 deletions(-)

--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -83,12 +83,6 @@ struct irq_alloc_info {
irq_hw_number_t msi_hwirq;
};
#endif
-#ifdef CONFIG_DMAR_TABLE
- struct {
- int dmar_id;
- void *dmar_data;
- };
-#endif
#ifdef CONFIG_X86_UV
struct {
int uv_limit;
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -329,15 +329,15 @@ static struct irq_chip dmar_msi_controll
static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,
msi_alloc_info_t *arg)
{
- return arg->dmar_id;
+ return arg->hwirq;
}

static int dmar_msi_init(struct irq_domain *domain,
struct msi_domain_info *info, unsigned int virq,
irq_hw_number_t hwirq, msi_alloc_info_t *arg)
{
- irq_domain_set_info(domain, virq, arg->dmar_id, info->chip, NULL,
- handle_edge_irq, arg->dmar_data, "edge");
+ irq_domain_set_info(domain, virq, arg->devid, info->chip, NULL,
+ handle_edge_irq, arg->data, "edge");

return 0;
}
@@ -384,8 +384,8 @@ int dmar_alloc_hwirq(int id, int node, v

init_irq_alloc_info(&info, NULL);
info.type = X86_IRQ_ALLOC_TYPE_DMAR;
- info.dmar_id = id;
- info.dmar_data = arg;
+ info.devid = id;
+ info.data = arg;

return irq_domain_alloc_irqs(domain, 1, node, &info);
}



2020-08-26 16:54:09

by Megha Dey

[permalink] [raw]
Subject: Re: [patch V2 15/46] x86/irq: Consolidate DMAR irq allocation

Hi Thomas,

On 8/26/2020 4:16 AM, Thomas Gleixner wrote:
> From: Thomas Gleixner <[email protected]>
>
> None of the DMAR specific fields are required.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
>
> ---
> arch/x86/include/asm/hw_irq.h | 6 ------
> arch/x86/kernel/apic/msi.c | 10 +++++-----
> 2 files changed, 5 insertions(+), 11 deletions(-)
>
> --- a/arch/x86/include/asm/hw_irq.h
> +++ b/arch/x86/include/asm/hw_irq.h
> @@ -83,12 +83,6 @@ struct irq_alloc_info {
> irq_hw_number_t msi_hwirq;
> };
> #endif
> -#ifdef CONFIG_DMAR_TABLE
> - struct {
> - int dmar_id;
> - void *dmar_data;
> - };
> -#endif
> #ifdef CONFIG_X86_UV
> struct {
> int uv_limit;
> --- a/arch/x86/kernel/apic/msi.c
> +++ b/arch/x86/kernel/apic/msi.c
> @@ -329,15 +329,15 @@ static struct irq_chip dmar_msi_controll
> static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,
> msi_alloc_info_t *arg)
> {
> - return arg->dmar_id;
> + return arg->hwirq;

Shouldn't this return the arg->devid which gets set in dmar_alloc_hwirq?

-Megha

> }
>
> static int dmar_msi_init(struct irq_domain *domain,
> struct msi_domain_info *info, unsigned int virq,
> irq_hw_number_t hwirq, msi_alloc_info_t *arg)
> {
> - irq_domain_set_info(domain, virq, arg->dmar_id, info->chip, NULL,
> - handle_edge_irq, arg->dmar_data, "edge");
> + irq_domain_set_info(domain, virq, arg->devid, info->chip, NULL,
> + handle_edge_irq, arg->data, "edge");
>
> return 0;
> }
> @@ -384,8 +384,8 @@ int dmar_alloc_hwirq(int id, int node, v
>
> init_irq_alloc_info(&info, NULL);
> info.type = X86_IRQ_ALLOC_TYPE_DMAR;
> - info.dmar_id = id;
> - info.dmar_data = arg;
> + info.devid = id;
> + info.data = arg;
>
> return irq_domain_alloc_irqs(domain, 1, node, &info);
> }
>
>

2020-08-26 18:33:14

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [patch V2 15/46] x86/irq: Consolidate DMAR irq allocation

On Wed, Aug 26 2020 at 09:50, Megha Dey wrote:
>> @@ -329,15 +329,15 @@ static struct irq_chip dmar_msi_controll
>> static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,
>> msi_alloc_info_t *arg)
>> {
>> - return arg->dmar_id;
>> + return arg->hwirq;
>
> Shouldn't this return the arg->devid which gets set in dmar_alloc_hwirq?

Indeed.

2020-08-26 20:51:54

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [patch V2 15/46] x86/irq: Consolidate DMAR irq allocation

On Wed, Aug 26 2020 at 20:32, Thomas Gleixner wrote:
> On Wed, Aug 26 2020 at 09:50, Megha Dey wrote:
>>> @@ -329,15 +329,15 @@ static struct irq_chip dmar_msi_controll
>>> static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,
>>> msi_alloc_info_t *arg)
>>> {
>>> - return arg->dmar_id;
>>> + return arg->hwirq;
>>
>> Shouldn't this return the arg->devid which gets set in dmar_alloc_hwirq?
>
> Indeed.

But for simplicity we can set arg->hwirq to the dmar id right in the
alloc function and then once the generic ops are enabled remove the dmar
callback completely.

2020-08-28 00:14:44

by Megha Dey

[permalink] [raw]
Subject: Re: [patch V2 15/46] x86/irq: Consolidate DMAR irq allocation

Hi Thomas,

On 8/26/2020 1:50 PM, Thomas Gleixner wrote:
> On Wed, Aug 26 2020 at 20:32, Thomas Gleixner wrote:
>> On Wed, Aug 26 2020 at 09:50, Megha Dey wrote:
>>>> @@ -329,15 +329,15 @@ static struct irq_chip dmar_msi_controll
>>>> static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,
>>>> msi_alloc_info_t *arg)
>>>> {
>>>> - return arg->dmar_id;
>>>> + return arg->hwirq;
>>> Shouldn't this return the arg->devid which gets set in dmar_alloc_hwirq?
>> Indeed.
> But for simplicity we can set arg->hwirq to the dmar id right in the
> alloc function and then once the generic ops are enabled remove the dmar
> callback completely
True, can get rid of more code that way.

Subject: [tip: x86/irq] x86/irq: Consolidate DMAR irq allocation

The following commit has been merged into the x86/irq branch of tip:

Commit-ID: 55e039157281f9d8ee7d595c2529a3fd4e790b52
Gitweb: https://git.kernel.org/tip/55e039157281f9d8ee7d595c2529a3fd4e790b52
Author: Thomas Gleixner <[email protected]>
AuthorDate: Wed, 26 Aug 2020 13:16:43 +02:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Wed, 16 Sep 2020 16:52:33 +02:00

x86/irq: Consolidate DMAR irq allocation

None of the DMAR specific fields are required.

Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

---
arch/x86/include/asm/hw_irq.h | 6 ------
arch/x86/kernel/apic/msi.c | 10 +++++-----
2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 641bc14..79f6d1d 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -83,12 +83,6 @@ struct irq_alloc_info {
irq_hw_number_t msi_hwirq;
};
#endif
-#ifdef CONFIG_DMAR_TABLE
- struct {
- int dmar_id;
- void *dmar_data;
- };
-#endif
#ifdef CONFIG_X86_UV
struct {
int uv_limit;
diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
index da68d08..ebf57db 100644
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -326,15 +326,15 @@ static struct irq_chip dmar_msi_controller = {
static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,
msi_alloc_info_t *arg)
{
- return arg->dmar_id;
+ return arg->hwirq;
}

static int dmar_msi_init(struct irq_domain *domain,
struct msi_domain_info *info, unsigned int virq,
irq_hw_number_t hwirq, msi_alloc_info_t *arg)
{
- irq_domain_set_info(domain, virq, arg->dmar_id, info->chip, NULL,
- handle_edge_irq, arg->dmar_data, "edge");
+ irq_domain_set_info(domain, virq, arg->devid, info->chip, NULL,
+ handle_edge_irq, arg->data, "edge");

return 0;
}
@@ -381,8 +381,8 @@ int dmar_alloc_hwirq(int id, int node, void *arg)

init_irq_alloc_info(&info, NULL);
info.type = X86_IRQ_ALLOC_TYPE_DMAR;
- info.dmar_id = id;
- info.dmar_data = arg;
+ info.devid = id;
+ info.data = arg;

return irq_domain_alloc_irqs(domain, 1, node, &info);
}