From: Marc Zyngier <maz@kernel.org>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: kernel-team@android.com, Russell King <linux@arm.linux.org.uk>,
Jason Cooper <jason@lakedaemon.net>,
Catalin Marinas <catalin.marinas@arm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Will Deacon <will@kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 06/11] irqchip/gic-v3: Configure SGIs as standard interrupts
Date: Wed, 20 May 2020 11:24:45 +0100 [thread overview]
Message-ID: <93b0ddc83439f24d30db9ea77c831ae6@kernel.org> (raw)
In-Reply-To: <CAFA6WYNfZKpQMTX8qP0eFHwyzJK4HK8z59G3OVLN8h0Uuc7P7w@mail.gmail.com>
Hi Sumit,
On 2020-05-20 10:52, Sumit Garg wrote:
> Hi Marc,
>
> On Tue, 19 May 2020 at 21:48, Marc Zyngier <maz@kernel.org> wrote:
>>
>> Change the way we deal with GICv3 SGIs by turning them into proper
>> IRQs, and calling into the arch code to register the interrupt range
>> instead of a callback.
>>
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> ---
>> drivers/irqchip/irq-gic-v3.c | 91
>> +++++++++++++++++++++---------------
>> 1 file changed, 53 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-gic-v3.c
>> b/drivers/irqchip/irq-gic-v3.c
>> index 23d7c87da407..d57289057b75 100644
>> --- a/drivers/irqchip/irq-gic-v3.c
>> +++ b/drivers/irqchip/irq-gic-v3.c
>> @@ -36,6 +36,9 @@
>> #define FLAGS_WORKAROUND_GICR_WAKER_MSM8996 (1ULL << 0)
>> #define FLAGS_WORKAROUND_CAVIUM_ERRATUM_38539 (1ULL << 1)
>>
>> +#define GIC_IRQ_TYPE_PARTITION (GIC_IRQ_TYPE_LPI + 1)
>> +#define GIC_IRQ_TYPE_SGI (GIC_IRQ_TYPE_LPI + 2)
>> +
>> struct redist_region {
>> void __iomem *redist_base;
>> phys_addr_t phys_base;
>> @@ -657,38 +660,14 @@ static asmlinkage void __exception_irq_entry
>> gic_handle_irq(struct pt_regs *regs
>> if ((irqnr >= 1020 && irqnr <= 1023))
>> return;
>>
>> - /* Treat anything but SGIs in a uniform way */
>> - if (likely(irqnr > 15)) {
>> - int err;
>> -
>> - if (static_branch_likely(&supports_deactivate_key))
>> - gic_write_eoir(irqnr);
>> - else
>> - isb();
>> -
>> - err = handle_domain_irq(gic_data.domain, irqnr, regs);
>> - if (err) {
>> - WARN_ONCE(true, "Unexpected interrupt
>> received!\n");
>> - gic_deactivate_unhandled(irqnr);
>> - }
>> - return;
>> - }
>> - if (irqnr < 16) {
>> + if (static_branch_likely(&supports_deactivate_key))
>> gic_write_eoir(irqnr);
>> - if (static_branch_likely(&supports_deactivate_key))
>> - gic_write_dir(irqnr);
>> -#ifdef CONFIG_SMP
>> - /*
>> - * Unlike GICv2, we don't need an smp_rmb() here.
>> - * The control dependency from gic_read_iar to
>> - * the ISB in gic_write_eoir is enough to ensure
>> - * that any shared data read by handle_IPI will
>> - * be read after the ACK.
>> - */
>> - handle_IPI(irqnr, regs);
>> -#else
>> - WARN_ONCE(true, "Unexpected SGI received!\n");
>> -#endif
>> + else
>> + isb();
>> +
>> + if (handle_domain_irq(gic_data.domain, irqnr, regs)) {
>> + WARN_ONCE(true, "Unexpected interrupt received!\n");
>> + gic_deactivate_unhandled(irqnr);
>> }
>> }
>>
>> @@ -1136,11 +1115,11 @@ static void gic_send_sgi(u64 cluster_id, u16
>> tlist, unsigned int irq)
>> gic_write_sgi1r(val);
>> }
>>
>> -static void gic_raise_softirq(const struct cpumask *mask, unsigned
>> int irq)
>> +static void gic_ipi_send_mask(struct irq_data *d, const struct
>> cpumask *mask)
>> {
>> int cpu;
>>
>> - if (WARN_ON(irq >= 16))
>> + if (WARN_ON(d->hwirq >= 16))
>> return;
>>
>> /*
>> @@ -1154,7 +1133,7 @@ static void gic_raise_softirq(const struct
>> cpumask *mask, unsigned int irq)
>> u16 tlist;
>>
>> tlist = gic_compute_target_list(&cpu, mask,
>> cluster_id);
>> - gic_send_sgi(cluster_id, tlist, irq);
>> + gic_send_sgi(cluster_id, tlist, d->hwirq);
>> }
>>
>> /* Force the above writes to ICC_SGI1R_EL1 to be executed */
>> @@ -1163,10 +1142,36 @@ static void gic_raise_softirq(const struct
>> cpumask *mask, unsigned int irq)
>>
>> static void gic_smp_init(void)
>> {
>> - set_smp_cross_call(gic_raise_softirq);
>> + struct irq_fwspec sgi_fwspec = {
>> + .fwnode = gic_data.fwnode,
>> + };
>> + int base_sgi;
>> +
>> cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_GIC_STARTING,
>> "irqchip/arm/gicv3:starting",
>> gic_starting_cpu, NULL);
>> +
>> + if (is_of_node(gic_data.fwnode)) {
>> + /* DT */
>> + sgi_fwspec.param_count = 3;
>> + sgi_fwspec.param[0] = GIC_IRQ_TYPE_SGI;
>> + sgi_fwspec.param[1] = 0;
>> + sgi_fwspec.param[2] = IRQ_TYPE_EDGE_RISING;
>> + } else {
>> + /* ACPI */
>> + sgi_fwspec.param_count = 2;
>> + sgi_fwspec.param[0] = 0;
>> + sgi_fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
>> + }
>> +
>> + /* Register all 8 non-secure SGIs */
>> + base_sgi = __irq_domain_alloc_irqs(gic_data.domain, -1, 8,
>> + NUMA_NO_NODE, &sgi_fwspec,
>> + false, NULL);
>> + if (WARN_ON(base_sgi <= 0))
>> + return;
>> +
>> + set_smp_ipi_range(base_sgi, 8);
>> }
>>
>> static int gic_set_affinity(struct irq_data *d, const struct cpumask
>> *mask_val,
>> @@ -1215,6 +1220,7 @@ static int gic_set_affinity(struct irq_data *d,
>> const struct cpumask *mask_val,
>> }
>> #else
>> #define gic_set_affinity NULL
>> +#define gic_ipi_send_mask NULL
>> #define gic_smp_init() do { } while(0)
>> #endif
>>
>> @@ -1257,6 +1263,7 @@ static struct irq_chip gic_chip = {
>> .irq_set_irqchip_state = gic_irq_set_irqchip_state,
>> .irq_nmi_setup = gic_irq_nmi_setup,
>> .irq_nmi_teardown = gic_irq_nmi_teardown,
>> + .ipi_send_mask = gic_ipi_send_mask,
>> .flags = IRQCHIP_SET_TYPE_MASKED |
>> IRQCHIP_SKIP_SET_WAKE |
>> IRQCHIP_MASK_ON_SUSPEND,
>
> It looks like you missed to update "struct irq_chip gic_eoimode1_chip"
> with similar change as follows:
>
> diff --git a/drivers/irqchip/irq-gic-v3.c
> b/drivers/irqchip/irq-gic-v3.c
> index 2a09634..ceef63b 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -1291,6 +1291,7 @@ static struct irq_chip gic_eoimode1_chip = {
> .irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity,
> .irq_nmi_setup = gic_irq_nmi_setup,
> .irq_nmi_teardown = gic_irq_nmi_teardown,
> + .ipi_send_mask = gic_ipi_send_mask,
> .flags = IRQCHIP_SET_TYPE_MASKED |
> IRQCHIP_SKIP_SET_WAKE |
> IRQCHIP_MASK_ON_SUSPEND,
>
> After incorporating this change, your patch-set works fine on my
> Developerbox machine.
Huh, well spotted. As I said, it has only been tested as guests,
hence not hitting this path. Time to throw it at the bigger stuff.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Will Deacon <will@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Russell King <linux@arm.linux.org.uk>,
Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
kernel-team@android.com
Subject: Re: [PATCH 06/11] irqchip/gic-v3: Configure SGIs as standard interrupts
Date: Wed, 20 May 2020 11:24:45 +0100 [thread overview]
Message-ID: <93b0ddc83439f24d30db9ea77c831ae6@kernel.org> (raw)
In-Reply-To: <CAFA6WYNfZKpQMTX8qP0eFHwyzJK4HK8z59G3OVLN8h0Uuc7P7w@mail.gmail.com>
Hi Sumit,
On 2020-05-20 10:52, Sumit Garg wrote:
> Hi Marc,
>
> On Tue, 19 May 2020 at 21:48, Marc Zyngier <maz@kernel.org> wrote:
>>
>> Change the way we deal with GICv3 SGIs by turning them into proper
>> IRQs, and calling into the arch code to register the interrupt range
>> instead of a callback.
>>
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> ---
>> drivers/irqchip/irq-gic-v3.c | 91
>> +++++++++++++++++++++---------------
>> 1 file changed, 53 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-gic-v3.c
>> b/drivers/irqchip/irq-gic-v3.c
>> index 23d7c87da407..d57289057b75 100644
>> --- a/drivers/irqchip/irq-gic-v3.c
>> +++ b/drivers/irqchip/irq-gic-v3.c
>> @@ -36,6 +36,9 @@
>> #define FLAGS_WORKAROUND_GICR_WAKER_MSM8996 (1ULL << 0)
>> #define FLAGS_WORKAROUND_CAVIUM_ERRATUM_38539 (1ULL << 1)
>>
>> +#define GIC_IRQ_TYPE_PARTITION (GIC_IRQ_TYPE_LPI + 1)
>> +#define GIC_IRQ_TYPE_SGI (GIC_IRQ_TYPE_LPI + 2)
>> +
>> struct redist_region {
>> void __iomem *redist_base;
>> phys_addr_t phys_base;
>> @@ -657,38 +660,14 @@ static asmlinkage void __exception_irq_entry
>> gic_handle_irq(struct pt_regs *regs
>> if ((irqnr >= 1020 && irqnr <= 1023))
>> return;
>>
>> - /* Treat anything but SGIs in a uniform way */
>> - if (likely(irqnr > 15)) {
>> - int err;
>> -
>> - if (static_branch_likely(&supports_deactivate_key))
>> - gic_write_eoir(irqnr);
>> - else
>> - isb();
>> -
>> - err = handle_domain_irq(gic_data.domain, irqnr, regs);
>> - if (err) {
>> - WARN_ONCE(true, "Unexpected interrupt
>> received!\n");
>> - gic_deactivate_unhandled(irqnr);
>> - }
>> - return;
>> - }
>> - if (irqnr < 16) {
>> + if (static_branch_likely(&supports_deactivate_key))
>> gic_write_eoir(irqnr);
>> - if (static_branch_likely(&supports_deactivate_key))
>> - gic_write_dir(irqnr);
>> -#ifdef CONFIG_SMP
>> - /*
>> - * Unlike GICv2, we don't need an smp_rmb() here.
>> - * The control dependency from gic_read_iar to
>> - * the ISB in gic_write_eoir is enough to ensure
>> - * that any shared data read by handle_IPI will
>> - * be read after the ACK.
>> - */
>> - handle_IPI(irqnr, regs);
>> -#else
>> - WARN_ONCE(true, "Unexpected SGI received!\n");
>> -#endif
>> + else
>> + isb();
>> +
>> + if (handle_domain_irq(gic_data.domain, irqnr, regs)) {
>> + WARN_ONCE(true, "Unexpected interrupt received!\n");
>> + gic_deactivate_unhandled(irqnr);
>> }
>> }
>>
>> @@ -1136,11 +1115,11 @@ static void gic_send_sgi(u64 cluster_id, u16
>> tlist, unsigned int irq)
>> gic_write_sgi1r(val);
>> }
>>
>> -static void gic_raise_softirq(const struct cpumask *mask, unsigned
>> int irq)
>> +static void gic_ipi_send_mask(struct irq_data *d, const struct
>> cpumask *mask)
>> {
>> int cpu;
>>
>> - if (WARN_ON(irq >= 16))
>> + if (WARN_ON(d->hwirq >= 16))
>> return;
>>
>> /*
>> @@ -1154,7 +1133,7 @@ static void gic_raise_softirq(const struct
>> cpumask *mask, unsigned int irq)
>> u16 tlist;
>>
>> tlist = gic_compute_target_list(&cpu, mask,
>> cluster_id);
>> - gic_send_sgi(cluster_id, tlist, irq);
>> + gic_send_sgi(cluster_id, tlist, d->hwirq);
>> }
>>
>> /* Force the above writes to ICC_SGI1R_EL1 to be executed */
>> @@ -1163,10 +1142,36 @@ static void gic_raise_softirq(const struct
>> cpumask *mask, unsigned int irq)
>>
>> static void gic_smp_init(void)
>> {
>> - set_smp_cross_call(gic_raise_softirq);
>> + struct irq_fwspec sgi_fwspec = {
>> + .fwnode = gic_data.fwnode,
>> + };
>> + int base_sgi;
>> +
>> cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_GIC_STARTING,
>> "irqchip/arm/gicv3:starting",
>> gic_starting_cpu, NULL);
>> +
>> + if (is_of_node(gic_data.fwnode)) {
>> + /* DT */
>> + sgi_fwspec.param_count = 3;
>> + sgi_fwspec.param[0] = GIC_IRQ_TYPE_SGI;
>> + sgi_fwspec.param[1] = 0;
>> + sgi_fwspec.param[2] = IRQ_TYPE_EDGE_RISING;
>> + } else {
>> + /* ACPI */
>> + sgi_fwspec.param_count = 2;
>> + sgi_fwspec.param[0] = 0;
>> + sgi_fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
>> + }
>> +
>> + /* Register all 8 non-secure SGIs */
>> + base_sgi = __irq_domain_alloc_irqs(gic_data.domain, -1, 8,
>> + NUMA_NO_NODE, &sgi_fwspec,
>> + false, NULL);
>> + if (WARN_ON(base_sgi <= 0))
>> + return;
>> +
>> + set_smp_ipi_range(base_sgi, 8);
>> }
>>
>> static int gic_set_affinity(struct irq_data *d, const struct cpumask
>> *mask_val,
>> @@ -1215,6 +1220,7 @@ static int gic_set_affinity(struct irq_data *d,
>> const struct cpumask *mask_val,
>> }
>> #else
>> #define gic_set_affinity NULL
>> +#define gic_ipi_send_mask NULL
>> #define gic_smp_init() do { } while(0)
>> #endif
>>
>> @@ -1257,6 +1263,7 @@ static struct irq_chip gic_chip = {
>> .irq_set_irqchip_state = gic_irq_set_irqchip_state,
>> .irq_nmi_setup = gic_irq_nmi_setup,
>> .irq_nmi_teardown = gic_irq_nmi_teardown,
>> + .ipi_send_mask = gic_ipi_send_mask,
>> .flags = IRQCHIP_SET_TYPE_MASKED |
>> IRQCHIP_SKIP_SET_WAKE |
>> IRQCHIP_MASK_ON_SUSPEND,
>
> It looks like you missed to update "struct irq_chip gic_eoimode1_chip"
> with similar change as follows:
>
> diff --git a/drivers/irqchip/irq-gic-v3.c
> b/drivers/irqchip/irq-gic-v3.c
> index 2a09634..ceef63b 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -1291,6 +1291,7 @@ static struct irq_chip gic_eoimode1_chip = {
> .irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity,
> .irq_nmi_setup = gic_irq_nmi_setup,
> .irq_nmi_teardown = gic_irq_nmi_teardown,
> + .ipi_send_mask = gic_ipi_send_mask,
> .flags = IRQCHIP_SET_TYPE_MASKED |
> IRQCHIP_SKIP_SET_WAKE |
> IRQCHIP_MASK_ON_SUSPEND,
>
> After incorporating this change, your patch-set works fine on my
> Developerbox machine.
Huh, well spotted. As I said, it has only been tested as guests,
hence not hitting this path. Time to throw it at the bigger stuff.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2020-05-20 10:25 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 16:17 [PATCH 00/11] arm/arm64: Turning IPIs into normal interrupts Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 01/11] genirq: Add fasteoi IPI flow Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 19:47 ` Florian Fainelli
2020-05-19 19:47 ` Florian Fainelli
2020-06-12 9:54 ` Marc Zyngier
2020-06-12 9:54 ` Marc Zyngier
2020-05-19 22:25 ` Valentin Schneider
2020-05-19 22:25 ` Valentin Schneider
2020-05-19 22:29 ` Valentin Schneider
2020-05-19 22:29 ` Valentin Schneider
2020-06-12 9:58 ` Marc Zyngier
2020-06-12 9:58 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 02/11] genirq: Allow interrupts to be excluded from /proc/interrupts Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 03/11] arm64: Allow IPIs to be handled as normal interrupts Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-21 14:03 ` Valentin Schneider
2020-05-21 14:03 ` Valentin Schneider
2020-05-19 16:17 ` [PATCH 04/11] ARM: " Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 22:24 ` Russell King - ARM Linux admin
2020-05-19 22:24 ` Russell King - ARM Linux admin
2020-05-21 14:03 ` Valentin Schneider
2020-05-21 14:03 ` Valentin Schneider
2020-05-21 15:12 ` Russell King - ARM Linux admin
2020-05-21 15:12 ` Russell King - ARM Linux admin
2020-05-21 16:11 ` Valentin Schneider
2020-05-21 16:11 ` Valentin Schneider
2020-05-19 16:17 ` [PATCH 05/11] irqchip/gic-v3: Describe the SGI range Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 06/11] irqchip/gic-v3: Configure SGIs as standard interrupts Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-20 9:52 ` Sumit Garg
2020-05-20 9:52 ` Sumit Garg
2020-05-20 10:24 ` Marc Zyngier [this message]
2020-05-20 10:24 ` Marc Zyngier
2020-05-21 14:04 ` Valentin Schneider
2020-05-21 14:04 ` Valentin Schneider
2020-06-12 10:39 ` Marc Zyngier
2020-06-12 10:39 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 07/11] irqchip/gic: Refactor SMP configuration Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 08/11] irqchip/gic: Configure SGIs as standard interrupts Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2021-04-20 20:37 ` dann frazier
2021-04-20 20:37 ` dann frazier
2021-04-20 21:25 ` dann frazier
2021-04-20 21:25 ` dann frazier
2021-04-21 10:58 ` Marc Zyngier
2021-04-21 10:58 ` Marc Zyngier
2021-04-21 14:52 ` dann frazier
2021-04-21 14:52 ` dann frazier
2021-04-21 15:49 ` Marc Zyngier
2021-04-21 15:49 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 09/11] irqchip/gic-common: Don't enable SGIs by default Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 10/11] irqchip/bcm2836: Configure mailbox interrupts as standard interrupts Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 16:17 ` [PATCH 11/11] arm64: Kill __smp_cross_call and co Marc Zyngier
2020-05-19 16:17 ` Marc Zyngier
2020-05-19 17:50 ` [PATCH 00/11] arm/arm64: Turning IPIs into normal interrupts Florian Fainelli
2020-05-19 17:50 ` Florian Fainelli
2020-05-19 19:47 ` Florian Fainelli
2020-05-19 19:47 ` Florian Fainelli
2020-06-12 9:49 ` Marc Zyngier
2020-06-12 9:49 ` Marc Zyngier
2020-06-12 16:57 ` Florian Fainelli
2020-06-12 16:57 ` Florian Fainelli
2020-05-19 22:25 ` Valentin Schneider
2020-05-19 22:25 ` Valentin Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=93b0ddc83439f24d30db9ea77c831ae6@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jason@lakedaemon.net \
--cc=kernel-team@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=sumit.garg@linaro.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.