Message ID | 20200214145736.18550-10-maz@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | irqchip/gic-v4: GICv4.1 architecture support | expand |
Hi Marc, On 2020/2/14 22:57, Marc Zyngier wrote: > As for VLPIs, there is a number of configuration bits that cannot As for vSGIs, > be directly communicated through the normal irqchip API, and we > have to use our good old friend set_vcpu_affinity. > > This is used to configure group and priority for a given vSGI. > > Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> > --- > drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++++++++ > include/linux/irqchip/arm-gic-v4.h | 5 +++++ > 2 files changed, 23 insertions(+) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index a9753435c4ff..a2e824eae43f 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -3969,6 +3969,23 @@ static int its_sgi_get_irqchip_state(struct irq_data *d, > return 0; > } > > +static int its_sgi_set_vcpu_affinity(struct irq_data *d, void *vcpu_info) > +{ > + struct its_vpe *vpe = irq_data_get_irq_chip_data(d); > + struct its_cmd_info *info = vcpu_info; > + > + switch (info->cmd_type) { > + case PROP_UPDATE_SGI: > + vpe->sgi_config[d->hwirq].priority = info->priority; > + vpe->sgi_config[d->hwirq].group = info->group; > + its_configure_sgi(d, false); > + return 0; > + > + default: > + return -EINVAL; > + } > +} > + > static struct irq_chip its_sgi_irq_chip = { > .name = "GICv4.1-sgi", > .irq_mask = its_sgi_mask_irq, > @@ -3976,6 +3993,7 @@ static struct irq_chip its_sgi_irq_chip = { > .irq_set_affinity = its_sgi_set_affinity, > .irq_set_irqchip_state = its_sgi_set_irqchip_state, > .irq_get_irqchip_state = its_sgi_get_irqchip_state, > + .irq_set_vcpu_affinity = its_sgi_set_vcpu_affinity, > }; > > static int its_sgi_irq_domain_alloc(struct irq_domain *domain, > diff --git a/include/linux/irqchip/arm-gic-v4.h b/include/linux/irqchip/arm-gic-v4.h > index 30b4855bf766..a1a9d40266f5 100644 > --- a/include/linux/irqchip/arm-gic-v4.h > +++ b/include/linux/irqchip/arm-gic-v4.h > @@ -98,6 +98,7 @@ enum its_vcpu_info_cmd_type { > SCHEDULE_VPE, > DESCHEDULE_VPE, > INVALL_VPE, > + PROP_UPDATE_SGI, Maybe better to use 'PROP_UPDATE_VSGI'? Thanks, Zenghui > }; > > struct its_cmd_info { > @@ -110,6 +111,10 @@ struct its_cmd_info { > bool g0en; > bool g1en; > }; > + struct { > + u8 priority; > + bool group; > + }; > }; > }; > >
Hi Zenghui, On 2020-02-20 03:37, Zenghui Yu wrote: > Hi Marc, > > On 2020/2/14 22:57, Marc Zyngier wrote: >> As for VLPIs, there is a number of configuration bits that cannot > > As for vSGIs, No, I think this is correct, if a bit ambiguous. What I'm trying to say here is that vSGIs have the same requirements as vLPIs, in the sense that some of the configuration aspects cannot be expressed in terms of the irqchip API. > >> be directly communicated through the normal irqchip API, and we >> have to use our good old friend set_vcpu_affinity. >> >> This is used to configure group and priority for a given vSGI. >> >> Signed-off-by: Marc Zyngier <maz@kernel.org> > > Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> > >> --- >> drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++++++++ >> include/linux/irqchip/arm-gic-v4.h | 5 +++++ >> 2 files changed, 23 insertions(+) >> >> diff --git a/drivers/irqchip/irq-gic-v3-its.c >> b/drivers/irqchip/irq-gic-v3-its.c >> index a9753435c4ff..a2e824eae43f 100644 >> --- a/drivers/irqchip/irq-gic-v3-its.c >> +++ b/drivers/irqchip/irq-gic-v3-its.c >> @@ -3969,6 +3969,23 @@ static int its_sgi_get_irqchip_state(struct >> irq_data *d, >> return 0; >> } >> +static int its_sgi_set_vcpu_affinity(struct irq_data *d, void >> *vcpu_info) >> +{ >> + struct its_vpe *vpe = irq_data_get_irq_chip_data(d); >> + struct its_cmd_info *info = vcpu_info; >> + >> + switch (info->cmd_type) { >> + case PROP_UPDATE_SGI: >> + vpe->sgi_config[d->hwirq].priority = info->priority; >> + vpe->sgi_config[d->hwirq].group = info->group; >> + its_configure_sgi(d, false); >> + return 0; >> + >> + default: >> + return -EINVAL; >> + } >> +} >> + >> static struct irq_chip its_sgi_irq_chip = { >> .name = "GICv4.1-sgi", >> .irq_mask = its_sgi_mask_irq, >> @@ -3976,6 +3993,7 @@ static struct irq_chip its_sgi_irq_chip = { >> .irq_set_affinity = its_sgi_set_affinity, >> .irq_set_irqchip_state = its_sgi_set_irqchip_state, >> .irq_get_irqchip_state = its_sgi_get_irqchip_state, >> + .irq_set_vcpu_affinity = its_sgi_set_vcpu_affinity, >> }; >> static int its_sgi_irq_domain_alloc(struct irq_domain *domain, >> diff --git a/include/linux/irqchip/arm-gic-v4.h >> b/include/linux/irqchip/arm-gic-v4.h >> index 30b4855bf766..a1a9d40266f5 100644 >> --- a/include/linux/irqchip/arm-gic-v4.h >> +++ b/include/linux/irqchip/arm-gic-v4.h >> @@ -98,6 +98,7 @@ enum its_vcpu_info_cmd_type { >> SCHEDULE_VPE, >> DESCHEDULE_VPE, >> INVALL_VPE, >> + PROP_UPDATE_SGI, > > Maybe better to use 'PROP_UPDATE_VSGI'? That's indeed better. Thanks, M.
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index a9753435c4ff..a2e824eae43f 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3969,6 +3969,23 @@ static int its_sgi_get_irqchip_state(struct irq_data *d, return 0; } +static int its_sgi_set_vcpu_affinity(struct irq_data *d, void *vcpu_info) +{ + struct its_vpe *vpe = irq_data_get_irq_chip_data(d); + struct its_cmd_info *info = vcpu_info; + + switch (info->cmd_type) { + case PROP_UPDATE_SGI: + vpe->sgi_config[d->hwirq].priority = info->priority; + vpe->sgi_config[d->hwirq].group = info->group; + its_configure_sgi(d, false); + return 0; + + default: + return -EINVAL; + } +} + static struct irq_chip its_sgi_irq_chip = { .name = "GICv4.1-sgi", .irq_mask = its_sgi_mask_irq, @@ -3976,6 +3993,7 @@ static struct irq_chip its_sgi_irq_chip = { .irq_set_affinity = its_sgi_set_affinity, .irq_set_irqchip_state = its_sgi_set_irqchip_state, .irq_get_irqchip_state = its_sgi_get_irqchip_state, + .irq_set_vcpu_affinity = its_sgi_set_vcpu_affinity, }; static int its_sgi_irq_domain_alloc(struct irq_domain *domain, diff --git a/include/linux/irqchip/arm-gic-v4.h b/include/linux/irqchip/arm-gic-v4.h index 30b4855bf766..a1a9d40266f5 100644 --- a/include/linux/irqchip/arm-gic-v4.h +++ b/include/linux/irqchip/arm-gic-v4.h @@ -98,6 +98,7 @@ enum its_vcpu_info_cmd_type { SCHEDULE_VPE, DESCHEDULE_VPE, INVALL_VPE, + PROP_UPDATE_SGI, }; struct its_cmd_info { @@ -110,6 +111,10 @@ struct its_cmd_info { bool g0en; bool g1en; }; + struct { + u8 priority; + bool group; + }; }; };
As for VLPIs, there is a number of configuration bits that cannot be directly communicated through the normal irqchip API, and we have to use our good old friend set_vcpu_affinity. This is used to configure group and priority for a given vSGI. Signed-off-by: Marc Zyngier <maz@kernel.org> --- drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++++++++ include/linux/irqchip/arm-gic-v4.h | 5 +++++ 2 files changed, 23 insertions(+)