[PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings

Wei Yongjun posted 3 patches 3 years, 2 months ago
[PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings
Posted by Wei Yongjun 3 years, 2 months ago
From: Wei Yongjun <weiyongjun1@huawei.com>

The IRQ simulator only support one cell binding now, this patch make it
works with either one or two cell bindings, where the cell values map
directly to the irq number and irq flags.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 kernel/irq/irq_sim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index dd76323ea3fd..73a90b7b6022 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -149,6 +149,7 @@ static void irq_sim_domain_unmap(struct irq_domain *domain, unsigned int virq)
 static const struct irq_domain_ops irq_sim_domain_ops = {
 	.map		= irq_sim_domain_map,
 	.unmap		= irq_sim_domain_unmap,
+	.xlate		= irq_domain_xlate_onetwocell,
 };
 
 /**
-- 
2.34.1
Re: [PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings
Posted by Bartosz Golaszewski 3 years, 2 months ago
On Mon, Sep 26, 2022 at 10:27 AM Wei Yongjun <weiyongjun@huaweicloud.com> wrote:
>
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> The IRQ simulator only support one cell binding now, this patch make it
> works with either one or two cell bindings, where the cell values map
> directly to the irq number and irq flags.
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  kernel/irq/irq_sim.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
> index dd76323ea3fd..73a90b7b6022 100644
> --- a/kernel/irq/irq_sim.c
> +++ b/kernel/irq/irq_sim.c
> @@ -149,6 +149,7 @@ static void irq_sim_domain_unmap(struct irq_domain *domain, unsigned int virq)
>  static const struct irq_domain_ops irq_sim_domain_ops = {
>         .map            = irq_sim_domain_map,
>         .unmap          = irq_sim_domain_unmap,
> +       .xlate          = irq_domain_xlate_onetwocell,
>  };
>
>  /**
> --
> 2.34.1
>

You'll need Marc's (Cc'ed) Ack here.

Bart
Re: [PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings
Posted by Marc Zyngier 3 years, 2 months ago
On Mon, 26 Sep 2022 07:24:48 -0400,
Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> 
> On Mon, Sep 26, 2022 at 10:27 AM Wei Yongjun <weiyongjun@huaweicloud.com> wrote:
> >
> > From: Wei Yongjun <weiyongjun1@huawei.com>
> >
> > The IRQ simulator only support one cell binding now, this patch make it
> > works with either one or two cell bindings, where the cell values map
> > directly to the irq number and irq flags.
> >
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  kernel/irq/irq_sim.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
> > index dd76323ea3fd..73a90b7b6022 100644
> > --- a/kernel/irq/irq_sim.c
> > +++ b/kernel/irq/irq_sim.c
> > @@ -149,6 +149,7 @@ static void irq_sim_domain_unmap(struct irq_domain *domain, unsigned int virq)
> >  static const struct irq_domain_ops irq_sim_domain_ops = {
> >         .map            = irq_sim_domain_map,
> >         .unmap          = irq_sim_domain_unmap,
> > +       .xlate          = irq_domain_xlate_onetwocell,
> >  };
> >
> >  /**
> > --
> > 2.34.1
> >
> 
> You'll need Marc's (Cc'ed) Ack here.

The question is what will the simulator code do with this information.
Throw it away? What of 3/4/5 cell bindings? I'd rather see the
simulator being extended to deal with arbitrary bindings instead of
trading a harcoded limit for another one. And also give some
semantics to the extra cells.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
Re: [PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings
Posted by Wei Yongjun 3 years, 2 months ago

On 2022/9/26 20:55, Marc Zyngier wrote:
> On Mon, 26 Sep 2022 07:24:48 -0400,
> Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>>
>> On Mon, Sep 26, 2022 at 10:27 AM Wei Yongjun <weiyongjun@huaweicloud.com> wrote:
>>>
>>> From: Wei Yongjun <weiyongjun1@huawei.com>
>>>
>>> The IRQ simulator only support one cell binding now, this patch make it
>>> works with either one or two cell bindings, where the cell values map
>>> directly to the irq number and irq flags.
>>>
>>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>>> ---
>>>  kernel/irq/irq_sim.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
>>> index dd76323ea3fd..73a90b7b6022 100644
>>> --- a/kernel/irq/irq_sim.c
>>> +++ b/kernel/irq/irq_sim.c
>>> @@ -149,6 +149,7 @@ static void irq_sim_domain_unmap(struct irq_domain *domain, unsigned int virq)
>>>  static const struct irq_domain_ops irq_sim_domain_ops = {
>>>         .map            = irq_sim_domain_map,
>>>         .unmap          = irq_sim_domain_unmap,
>>> +       .xlate          = irq_domain_xlate_onetwocell,
>>>  };
>>>
>>>  /**
>>> --
>>> 2.34.1
>>>
>>
>> You'll need Marc's (Cc'ed) Ack here.

Hi Marc,

> 
> The question is what will the simulator code do with this information.
> Throw it away? What of 3/4/5 cell bindings? I'd rather see the

The 3/4/5 cell bindings is selience ignored currently.

> simulator being extended to deal with arbitrary bindings instead of
> trading a harcoded limit for another one. And also give some
> semantics to the extra cells.

Would you means we should allow the users to overwrite the xlate callback
or overwrite the domain_ops?

Regards,
Wei Yongjun
Re: [PATCH v2 1/3] genirq/irq_sim: Allow both one and two cell bindings
Posted by Marc Zyngier 3 years, 2 months ago
On Wed, 28 Sep 2022 08:32:25 +0100,
Wei Yongjun <weiyongjun1@huawei.com> wrote:
> 
> 
> 
> On 2022/9/26 20:55, Marc Zyngier wrote:
> > On Mon, 26 Sep 2022 07:24:48 -0400,
> > Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >>
> >> On Mon, Sep 26, 2022 at 10:27 AM Wei Yongjun <weiyongjun@huaweicloud.com> wrote:
> >>>
> >>> From: Wei Yongjun <weiyongjun1@huawei.com>
> >>>
> >>> The IRQ simulator only support one cell binding now, this patch make it
> >>> works with either one or two cell bindings, where the cell values map
> >>> directly to the irq number and irq flags.
> >>>
> >>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> >>> ---
> >>>  kernel/irq/irq_sim.c | 1 +
> >>>  1 file changed, 1 insertion(+)
> >>>
> >>> diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
> >>> index dd76323ea3fd..73a90b7b6022 100644
> >>> --- a/kernel/irq/irq_sim.c
> >>> +++ b/kernel/irq/irq_sim.c
> >>> @@ -149,6 +149,7 @@ static void irq_sim_domain_unmap(struct irq_domain *domain, unsigned int virq)
> >>>  static const struct irq_domain_ops irq_sim_domain_ops = {
> >>>         .map            = irq_sim_domain_map,
> >>>         .unmap          = irq_sim_domain_unmap,
> >>> +       .xlate          = irq_domain_xlate_onetwocell,
> >>>  };
> >>>
> >>>  /**
> >>> --
> >>> 2.34.1
> >>>
> >>
> >> You'll need Marc's (Cc'ed) Ack here.
> 
> Hi Marc,
> 
> > 
> > The question is what will the simulator code do with this information.
> > Throw it away? What of 3/4/5 cell bindings? I'd rather see the
> 
> The 3/4/5 cell bindings is selience ignored currently.
> 
> > simulator being extended to deal with arbitrary bindings instead of
> > trading a harcoded limit for another one. And also give some
> > semantics to the extra cells.
> 
> Would you means we should allow the users to overwrite the xlate callback
> or overwrite the domain_ops?

Neither. I think the caller should provide an irq_domain_ops structure
at domain creation, with the .xlate member populated, and the irq_sim
code would add its own ops to it.

Providing NULL would ensure we fallback to the existing behaviour.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.