All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] ipipe: fix build with CONFIG_IPIPE disabled
@ 2020-09-07 13:09 Philippe Gerum
  2020-09-07 13:09 ` [PATCH 2/6] ipipe: add fixup call to irq_set_[chip_]handler_[name_]locked() helpers Philippe Gerum
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 13:09 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/fork.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/fork.c b/kernel/fork.c
index e73964a45fb5..a5d3aa5dd4c7 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -845,8 +845,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
 #endif
 
 	setup_thread_stack(tsk, orig);
+#ifdef CONFIG_IPIPE
 	__ipipe_init_threadflags(task_thread_info(tsk));
 	__ipipe_init_threadinfo(&task_thread_info(tsk)->ipipe_data);
+#endif
 	clear_user_return_notifier(tsk);
 	clear_tsk_need_resched(tsk);
 	set_task_stack_end_magic(tsk);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/6] ipipe: add fixup call to irq_set_[chip_]handler_[name_]locked() helpers
  2020-09-07 13:09 [PATCH 1/6] ipipe: fix build with CONFIG_IPIPE disabled Philippe Gerum
@ 2020-09-07 13:09 ` Philippe Gerum
  2020-09-07 13:09 ` [PATCH 3/6] x86/ipipe: fix chained irq handling Philippe Gerum
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 13:09 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

The pipeline core must be given an opportunity to fixup the interrupt
descriptor right before a flow handler is assigned to it. To this end,
make sure the irq_set_[chip_]handler_[name_]locked() helpers also call
__fixup_irq_handler().

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/linux/irqdesc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index fb38c2163abf..3852c59798d6 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -208,7 +208,7 @@ static inline void irq_set_handler_locked(struct irq_data *data,
 {
 	struct irq_desc *desc = irq_data_to_desc(data);
 
-	desc->handle_irq = handler;
+	desc->handle_irq = __fixup_irq_handler(desc, handler, 0);
 }
 
 /**
@@ -229,7 +229,7 @@ irq_set_chip_handler_name_locked(struct irq_data *data, struct irq_chip *chip,
 {
 	struct irq_desc *desc = irq_data_to_desc(data);
 
-	desc->handle_irq = handler;
+	desc->handle_irq = __fixup_irq_handler(desc, handler, 0);
 	desc->name = name;
 	data->chip = chip;
 }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/6] x86/ipipe: fix chained irq handling
  2020-09-07 13:09 [PATCH 1/6] ipipe: fix build with CONFIG_IPIPE disabled Philippe Gerum
  2020-09-07 13:09 ` [PATCH 2/6] ipipe: add fixup call to irq_set_[chip_]handler_[name_]locked() helpers Philippe Gerum
@ 2020-09-07 13:09 ` Philippe Gerum
  2020-09-07 14:45   ` Jan Kiszka
  2020-09-07 13:09 ` [PATCH 4/6] ipipe: pinctrl: enable basic pipeline support Philippe Gerum
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 13:09 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

IRQs chained from a parent interrupt (e.g. cascaded interrupts from
chained GPIO irqchips) do not have any assigned vector. Therefore, we
cannot expect __ipipe_get_ioapic_irq_vector() to return anything
sensible for those chained IRQs.

As a result, the interrupt trampoline (__ipipe_do_IRQ()) for the root
stage cannot fix up regs->orig_ax with the proper vector number which
do_IRQ() would use in turn to fetch the corresponding interrupt
descriptor.

Since we already know the IRQ number on entry to __ipipe_do_IRQ(),
rewrite the latter as a variant of do_IRQ() which either retrieves the
descriptor using irq_to_desc() for all device interrupts in order to
fetch the flow handler, or invokes the naked handler of special APIC
vectors directly.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 arch/x86/kernel/ipipe.c  | 13 ++-----------
 arch/x86/kernel/irq_64.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
index 4b0955c3ff49..3f3afcecc1b9 100644
--- a/arch/x86/kernel/ipipe.c
+++ b/arch/x86/kernel/ipipe.c
@@ -73,6 +73,8 @@ void smp_reboot_interrupt(void);
 void smp_thermal_interrupt(struct pt_regs *regs);
 void smp_threshold_interrupt(struct pt_regs *regs);
 
+void __ipipe_do_IRQ(unsigned int irq, void *cookie);
+
 DEFINE_PER_CPU(unsigned long, __ipipe_cr2);
 EXPORT_PER_CPU_SYMBOL_GPL(__ipipe_cr2);
 
@@ -88,17 +90,6 @@ int ipipe_get_sysinfo(struct ipipe_sysinfo *info)
 }
 EXPORT_SYMBOL_GPL(ipipe_get_sysinfo);
 
-static void __ipipe_do_IRQ(unsigned int irq, void *cookie)
-{
-	void (*handler)(struct pt_regs *regs);
-	struct pt_regs *regs;
-
-	regs = raw_cpu_ptr(&ipipe_percpu.tick_regs);
-	regs->orig_ax = ~__ipipe_get_irq_vector(irq);
-	handler = (typeof(handler))cookie;
-	handler(regs);
-}
-
 #ifdef CONFIG_X86_LOCAL_APIC
 
 static void __ipipe_noack_apic(struct irq_desc *desc)
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index b2b2a3f41daf..7fc8ad19940c 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -89,3 +89,32 @@ bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
 	generic_handle_irq_desc(desc);
 	return true;
 }
+
+#ifdef CONFIG_IPIPE
+
+void __ipipe_do_IRQ(unsigned int irq, void *cookie)
+{
+	struct pt_regs *regs = raw_cpu_ptr(&ipipe_percpu.tick_regs);
+	struct pt_regs *old_regs = set_irq_regs(regs);
+	unsigned int (*handler)(struct pt_regs *regs);
+	struct irq_desc *desc;
+
+	handler = (typeof(handler))cookie;
+
+	entering_irq();
+
+	stack_overflow_check(regs);
+
+	if (handler == do_IRQ) {
+		desc = irq_to_desc(irq);
+		generic_handle_irq_desc(desc);
+	} else {
+		handler(regs);
+	}
+
+	exiting_irq();
+
+	set_irq_regs(old_regs);
+}
+
+#endif
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/6] ipipe: pinctrl: enable basic pipeline support
  2020-09-07 13:09 [PATCH 1/6] ipipe: fix build with CONFIG_IPIPE disabled Philippe Gerum
  2020-09-07 13:09 ` [PATCH 2/6] ipipe: add fixup call to irq_set_[chip_]handler_[name_]locked() helpers Philippe Gerum
  2020-09-07 13:09 ` [PATCH 3/6] x86/ipipe: fix chained irq handling Philippe Gerum
@ 2020-09-07 13:09 ` Philippe Gerum
  2020-09-07 13:09 ` [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled Philippe Gerum
  2020-09-07 13:09 ` [PATCH 6/6] ipipe: rename __fixup_irq_handler() to __ipipe_setup_irq_desc() Philippe Gerum
  4 siblings, 0 replies; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 13:09 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

This patch enables the Intel pinctrl/GPIO core driver to operate in a
pipelined interrupt system. However, it does not allow chained GPIO
IRQs to be handled from the head stage of such pipeline yet. In other
words, the chained GPIO interrupts can safely be handled from the
in-band stage when CONFIG_IPIPE is turned on, but cannot be routed to
a real-time application.

Enabling full support will require the I-pipe core to handle IRQs
chained from a shared parent interrupt natively, which it is not
implemented at the moment.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 89ff2795a8b5..927c3dcee378 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1094,7 +1094,9 @@ static irqreturn_t intel_gpio_community_irq_handler(struct intel_pinctrl *pctrl,
 
 			irq = irq_find_mapping(gc->irq.domain,
 					       padgrp->gpio_base + gpp_offset);
-			generic_handle_irq(irq);
+			hard_cond_local_irq_disable();
+			ipipe_handle_demuxed_irq(irq);
+			hard_cond_local_irq_enable();
 
 			ret |= IRQ_HANDLED;
 		}
@@ -1127,7 +1129,7 @@ static struct irq_chip intel_gpio_irqchip = {
 	.irq_unmask = intel_gpio_irq_unmask,
 	.irq_set_type = intel_gpio_irq_type,
 	.irq_set_wake = intel_gpio_irq_wake,
-	.flags = IRQCHIP_MASK_ON_SUSPEND,
+	.flags = IRQCHIP_MASK_ON_SUSPEND|IRQCHIP_PIPELINE_SAFE,
 };
 
 static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled
  2020-09-07 13:09 [PATCH 1/6] ipipe: fix build with CONFIG_IPIPE disabled Philippe Gerum
                   ` (2 preceding siblings ...)
  2020-09-07 13:09 ` [PATCH 4/6] ipipe: pinctrl: enable basic pipeline support Philippe Gerum
@ 2020-09-07 13:09 ` Philippe Gerum
  2020-09-07 14:45   ` Jan Kiszka
  2020-09-07 13:09 ` [PATCH 6/6] ipipe: rename __fixup_irq_handler() to __ipipe_setup_irq_desc() Philippe Gerum
  4 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 13:09 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 arch/x86/kernel/ipipe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
index 3f3afcecc1b9..c5ebfdf2dfb3 100644
--- a/arch/x86/kernel/ipipe.c
+++ b/arch/x86/kernel/ipipe.c
@@ -72,6 +72,7 @@ void smp_irq_move_cleanup_interrupt(struct pt_regs *regs);
 void smp_reboot_interrupt(void);
 void smp_thermal_interrupt(struct pt_regs *regs);
 void smp_threshold_interrupt(struct pt_regs *regs);
+void uv_bau_message_interrupt(struct pt_regs *regs);
 
 void __ipipe_do_IRQ(unsigned int irq, void *cookie);
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/6] ipipe: rename __fixup_irq_handler() to __ipipe_setup_irq_desc()
  2020-09-07 13:09 [PATCH 1/6] ipipe: fix build with CONFIG_IPIPE disabled Philippe Gerum
                   ` (3 preceding siblings ...)
  2020-09-07 13:09 ` [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled Philippe Gerum
@ 2020-09-07 13:09 ` Philippe Gerum
  4 siblings, 0 replies; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 13:09 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

To clarify naming and purpose: this is a pipeline-specific routine,
which further prepares an interrupt descriptor for receiving events
for the most part, swapping the interrupt flow handler specifically
for chained IRQs (not the interrupt handler per se).

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/linux/irqdesc.h | 8 ++++----
 kernel/irq/chip.c       | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 3852c59798d6..121ad0f9c5ea 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -185,8 +185,8 @@ static inline int irq_desc_has_action(struct irq_desc *desc)
 }
 
 irq_flow_handler_t
-__fixup_irq_handler(struct irq_desc *desc, irq_flow_handler_t handle,
-		    int is_chained);
+__ipipe_setup_irq_desc(struct irq_desc *desc, irq_flow_handler_t handle,
+		int is_chained);
 
 static inline int irq_has_action(unsigned int irq)
 {
@@ -208,7 +208,7 @@ static inline void irq_set_handler_locked(struct irq_data *data,
 {
 	struct irq_desc *desc = irq_data_to_desc(data);
 
-	desc->handle_irq = __fixup_irq_handler(desc, handler, 0);
+	desc->handle_irq = __ipipe_setup_irq_desc(desc, handler, 0);
 }
 
 /**
@@ -229,7 +229,7 @@ irq_set_chip_handler_name_locked(struct irq_data *data, struct irq_chip *chip,
 {
 	struct irq_desc *desc = irq_data_to_desc(data);
 
-	desc->handle_irq = __fixup_irq_handler(desc, handler, 0);
+	desc->handle_irq = __ipipe_setup_irq_desc(desc, handler, 0);
 	desc->name = name;
 	data->chip = chip;
 }
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 7c03e2931189..8d56c2fb2f10 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1034,7 +1034,7 @@ static void __ipipe_ack_bad_irq(struct irq_desc *desc)
 }
 
 irq_flow_handler_t
-__fixup_irq_handler(struct irq_desc *desc, irq_flow_handler_t handle, int is_chained)
+__ipipe_setup_irq_desc(struct irq_desc *desc, irq_flow_handler_t handle, int is_chained)
 {
 	if (unlikely(handle == NULL)) {
 		desc->ipipe_ack = __ipipe_ack_bad_irq;
@@ -1134,13 +1134,13 @@ EXPORT_SYMBOL_GPL(ipipe_enable_irq);
 #else /* !CONFIG_IPIPE */
 
 irq_flow_handler_t
-__fixup_irq_handler(struct irq_desc *desc, irq_flow_handler_t handle, int is_chained)
+__ipipe_setup_irq_desc(struct irq_desc *desc, irq_flow_handler_t handle, int is_chained)
 {
 	return handle;
 }
 
 #endif /* !CONFIG_IPIPE */
-EXPORT_SYMBOL_GPL(__fixup_irq_handler);
+EXPORT_SYMBOL_GPL(__ipipe_setup_irq_desc);
 
 static void
 __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
@@ -1176,7 +1176,7 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
 			return;
 	}
 
-	handle = __fixup_irq_handler(desc, handle, is_chained);
+	handle = __ipipe_setup_irq_desc(desc, handle, is_chained);
 
 	/* Uninstall? */
 	if (handle == handle_bad_irq) {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/6] x86/ipipe: fix chained irq handling
  2020-09-07 13:09 ` [PATCH 3/6] x86/ipipe: fix chained irq handling Philippe Gerum
@ 2020-09-07 14:45   ` Jan Kiszka
  2020-09-07 15:17     ` Philippe Gerum
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2020-09-07 14:45 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 07.09.20 15:09, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> IRQs chained from a parent interrupt (e.g. cascaded interrupts from
> chained GPIO irqchips) do not have any assigned vector. Therefore, we
> cannot expect __ipipe_get_ioapic_irq_vector() to return anything
> sensible for those chained IRQs.
> 
> As a result, the interrupt trampoline (__ipipe_do_IRQ()) for the root
> stage cannot fix up regs->orig_ax with the proper vector number which
> do_IRQ() would use in turn to fetch the corresponding interrupt
> descriptor.
> 
> Since we already know the IRQ number on entry to __ipipe_do_IRQ(),
> rewrite the latter as a variant of do_IRQ() which either retrieves the
> descriptor using irq_to_desc() for all device interrupts in order to
> fetch the flow handler, or invokes the naked handler of special APIC
> vectors directly.
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  arch/x86/kernel/ipipe.c  | 13 ++-----------
>  arch/x86/kernel/irq_64.c | 29 +++++++++++++++++++++++++++++
>  2 files changed, 31 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
> index 4b0955c3ff49..3f3afcecc1b9 100644
> --- a/arch/x86/kernel/ipipe.c
> +++ b/arch/x86/kernel/ipipe.c
> @@ -73,6 +73,8 @@ void smp_reboot_interrupt(void);
>  void smp_thermal_interrupt(struct pt_regs *regs);
>  void smp_threshold_interrupt(struct pt_regs *regs);
>  
> +void __ipipe_do_IRQ(unsigned int irq, void *cookie);
> +
>  DEFINE_PER_CPU(unsigned long, __ipipe_cr2);
>  EXPORT_PER_CPU_SYMBOL_GPL(__ipipe_cr2);
>  
> @@ -88,17 +90,6 @@ int ipipe_get_sysinfo(struct ipipe_sysinfo *info)
>  }
>  EXPORT_SYMBOL_GPL(ipipe_get_sysinfo);
>  
> -static void __ipipe_do_IRQ(unsigned int irq, void *cookie)
> -{
> -	void (*handler)(struct pt_regs *regs);
> -	struct pt_regs *regs;
> -
> -	regs = raw_cpu_ptr(&ipipe_percpu.tick_regs);
> -	regs->orig_ax = ~__ipipe_get_irq_vector(irq);
> -	handler = (typeof(handler))cookie;
> -	handler(regs);
> -}
> -
>  #ifdef CONFIG_X86_LOCAL_APIC
>  
>  static void __ipipe_noack_apic(struct irq_desc *desc)
> diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
> index b2b2a3f41daf..7fc8ad19940c 100644
> --- a/arch/x86/kernel/irq_64.c
> +++ b/arch/x86/kernel/irq_64.c
> @@ -89,3 +89,32 @@ bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
>  	generic_handle_irq_desc(desc);
>  	return true;
>  }
> +
> +#ifdef CONFIG_IPIPE
> +
> +void __ipipe_do_IRQ(unsigned int irq, void *cookie)
> +{
> +	struct pt_regs *regs = raw_cpu_ptr(&ipipe_percpu.tick_regs);
> +	struct pt_regs *old_regs = set_irq_regs(regs);
> +	unsigned int (*handler)(struct pt_regs *regs);
> +	struct irq_desc *desc;
> +
> +	handler = (typeof(handler))cookie;
> +
> +	entering_irq();
> +
> +	stack_overflow_check(regs);
> +
> +	if (handler == do_IRQ) {
> +		desc = irq_to_desc(irq);
> +		generic_handle_irq_desc(desc);
> +	} else {
> +		handler(regs);
> +	}
> +
> +	exiting_irq();
> +
> +	set_irq_regs(old_regs);
> +}
> +
> +#endif
> 

This practically only affected us with GPIOs so far, right?

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled
  2020-09-07 13:09 ` [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled Philippe Gerum
@ 2020-09-07 14:45   ` Jan Kiszka
  2020-09-07 15:11     ` Philippe Gerum
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2020-09-07 14:45 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 07.09.20 15:09, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  arch/x86/kernel/ipipe.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
> index 3f3afcecc1b9..c5ebfdf2dfb3 100644
> --- a/arch/x86/kernel/ipipe.c
> +++ b/arch/x86/kernel/ipipe.c
> @@ -72,6 +72,7 @@ void smp_irq_move_cleanup_interrupt(struct pt_regs *regs);
>  void smp_reboot_interrupt(void);
>  void smp_thermal_interrupt(struct pt_regs *regs);
>  void smp_threshold_interrupt(struct pt_regs *regs);
> +void uv_bau_message_interrupt(struct pt_regs *regs);
>  
>  void __ipipe_do_IRQ(unsigned int irq, void *cookie);
>  
> 

IIRC, I broke that intentionally. There is more needed, and no one
should get something building but subtly not working. But we may better do

    depends on !IPIPE

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled
  2020-09-07 14:45   ` Jan Kiszka
@ 2020-09-07 15:11     ` Philippe Gerum
  2020-09-07 15:18       ` Philippe Gerum
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 15:11 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 07.09.20 15:09, Philippe Gerum wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>> 
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>  arch/x86/kernel/ipipe.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
>> index 3f3afcecc1b9..c5ebfdf2dfb3 100644
>> --- a/arch/x86/kernel/ipipe.c
>> +++ b/arch/x86/kernel/ipipe.c
>> @@ -72,6 +72,7 @@ void smp_irq_move_cleanup_interrupt(struct pt_regs *regs);
>>  void smp_reboot_interrupt(void);
>>  void smp_thermal_interrupt(struct pt_regs *regs);
>>  void smp_threshold_interrupt(struct pt_regs *regs);
>> +void uv_bau_message_interrupt(struct pt_regs *regs);
>>  
>>  void __ipipe_do_IRQ(unsigned int irq, void *cookie);
>>  
>> 
>
> IIRC, I broke that intentionally. There is more needed, and no one
> should get something building but subtly not working. But we may better do
>
>     depends on !IPIPE
>

Indeed, otherwise plain build tests with e.g. allyesconfig fail miserably.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/6] x86/ipipe: fix chained irq handling
  2020-09-07 14:45   ` Jan Kiszka
@ 2020-09-07 15:17     ` Philippe Gerum
  0 siblings, 0 replies; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 15:17 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 07.09.20 15:09, Philippe Gerum wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>> 
>> IRQs chained from a parent interrupt (e.g. cascaded interrupts from
>> chained GPIO irqchips) do not have any assigned vector. Therefore, we
>> cannot expect __ipipe_get_ioapic_irq_vector() to return anything
>> sensible for those chained IRQs.
>> 
>> As a result, the interrupt trampoline (__ipipe_do_IRQ()) for the root
>> stage cannot fix up regs->orig_ax with the proper vector number which
>> do_IRQ() would use in turn to fetch the corresponding interrupt
>> descriptor.
>> 
>> Since we already know the IRQ number on entry to __ipipe_do_IRQ(),
>> rewrite the latter as a variant of do_IRQ() which either retrieves the
>> descriptor using irq_to_desc() for all device interrupts in order to
>> fetch the flow handler, or invokes the naked handler of special APIC
>> vectors directly.
>> 
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>  arch/x86/kernel/ipipe.c  | 13 ++-----------
>>  arch/x86/kernel/irq_64.c | 29 +++++++++++++++++++++++++++++
>>  2 files changed, 31 insertions(+), 11 deletions(-)
>> 
>> diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
>> index 4b0955c3ff49..3f3afcecc1b9 100644
>> --- a/arch/x86/kernel/ipipe.c
>> +++ b/arch/x86/kernel/ipipe.c
>> @@ -73,6 +73,8 @@ void smp_reboot_interrupt(void);
>>  void smp_thermal_interrupt(struct pt_regs *regs);
>>  void smp_threshold_interrupt(struct pt_regs *regs);
>>  
>> +void __ipipe_do_IRQ(unsigned int irq, void *cookie);
>> +
>>  DEFINE_PER_CPU(unsigned long, __ipipe_cr2);
>>  EXPORT_PER_CPU_SYMBOL_GPL(__ipipe_cr2);
>>  
>> @@ -88,17 +90,6 @@ int ipipe_get_sysinfo(struct ipipe_sysinfo *info)
>>  }
>>  EXPORT_SYMBOL_GPL(ipipe_get_sysinfo);
>>  
>> -static void __ipipe_do_IRQ(unsigned int irq, void *cookie)
>> -{
>> -	void (*handler)(struct pt_regs *regs);
>> -	struct pt_regs *regs;
>> -
>> -	regs = raw_cpu_ptr(&ipipe_percpu.tick_regs);
>> -	regs->orig_ax = ~__ipipe_get_irq_vector(irq);
>> -	handler = (typeof(handler))cookie;
>> -	handler(regs);
>> -}
>> -
>>  #ifdef CONFIG_X86_LOCAL_APIC
>>  
>>  static void __ipipe_noack_apic(struct irq_desc *desc)
>> diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
>> index b2b2a3f41daf..7fc8ad19940c 100644
>> --- a/arch/x86/kernel/irq_64.c
>> +++ b/arch/x86/kernel/irq_64.c
>> @@ -89,3 +89,32 @@ bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
>>  	generic_handle_irq_desc(desc);
>>  	return true;
>>  }
>> +
>> +#ifdef CONFIG_IPIPE
>> +
>> +void __ipipe_do_IRQ(unsigned int irq, void *cookie)
>> +{
>> +	struct pt_regs *regs = raw_cpu_ptr(&ipipe_percpu.tick_regs);
>> +	struct pt_regs *old_regs = set_irq_regs(regs);
>> +	unsigned int (*handler)(struct pt_regs *regs);
>> +	struct irq_desc *desc;
>> +
>> +	handler = (typeof(handler))cookie;
>> +
>> +	entering_irq();
>> +
>> +	stack_overflow_check(regs);
>> +
>> +	if (handler == do_IRQ) {
>> +		desc = irq_to_desc(irq);
>> +		generic_handle_irq_desc(desc);
>> +	} else {
>> +		handler(regs);
>> +	}
>> +
>> +	exiting_irq();
>> +
>> +	set_irq_regs(old_regs);
>> +}
>> +
>> +#endif
>> 
>
> This practically only affected us with GPIOs so far, right?
>

To my knowledge, yes.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled
  2020-09-07 15:11     ` Philippe Gerum
@ 2020-09-07 15:18       ` Philippe Gerum
  2020-09-11  9:29         ` Jan Kiszka
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2020-09-07 15:18 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


Philippe Gerum <rpm@xenomai.org> writes:

> Jan Kiszka <jan.kiszka@siemens.com> writes:
>
>> On 07.09.20 15:09, Philippe Gerum wrote:
>>> From: Philippe Gerum <rpm@xenomai.org>
>>> 
>>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>>> ---
>>>  arch/x86/kernel/ipipe.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>> 
>>> diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
>>> index 3f3afcecc1b9..c5ebfdf2dfb3 100644
>>> --- a/arch/x86/kernel/ipipe.c
>>> +++ b/arch/x86/kernel/ipipe.c
>>> @@ -72,6 +72,7 @@ void smp_irq_move_cleanup_interrupt(struct pt_regs *regs);
>>>  void smp_reboot_interrupt(void);
>>>  void smp_thermal_interrupt(struct pt_regs *regs);
>>>  void smp_threshold_interrupt(struct pt_regs *regs);
>>> +void uv_bau_message_interrupt(struct pt_regs *regs);
>>>  
>>>  void __ipipe_do_IRQ(unsigned int irq, void *cookie);
>>>  
>>> 
>>
>> IIRC, I broke that intentionally. There is more needed, and no one
>> should get something building but subtly not working. But we may better do
>>
>>     depends on !IPIPE
>>
>
> Indeed, otherwise plain build tests with e.g. allyesconfig fail miserably.

I meant "allnoconfig" of course, but you get the point.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled
  2020-09-07 15:18       ` Philippe Gerum
@ 2020-09-11  9:29         ` Jan Kiszka
  0 siblings, 0 replies; 12+ messages in thread
From: Jan Kiszka @ 2020-09-11  9:29 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 07.09.20 17:18, Philippe Gerum wrote:
> 
> Philippe Gerum <rpm@xenomai.org> writes:
> 
>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>>
>>> On 07.09.20 15:09, Philippe Gerum wrote:
>>>> From: Philippe Gerum <rpm@xenomai.org>
>>>>
>>>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>>>> ---
>>>>  arch/x86/kernel/ipipe.c | 1 +
>>>>  1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
>>>> index 3f3afcecc1b9..c5ebfdf2dfb3 100644
>>>> --- a/arch/x86/kernel/ipipe.c
>>>> +++ b/arch/x86/kernel/ipipe.c
>>>> @@ -72,6 +72,7 @@ void smp_irq_move_cleanup_interrupt(struct pt_regs *regs);
>>>>  void smp_reboot_interrupt(void);
>>>>  void smp_thermal_interrupt(struct pt_regs *regs);
>>>>  void smp_threshold_interrupt(struct pt_regs *regs);
>>>> +void uv_bau_message_interrupt(struct pt_regs *regs);
>>>>  
>>>>  void __ipipe_do_IRQ(unsigned int irq, void *cookie);
>>>>  
>>>>
>>>
>>> IIRC, I broke that intentionally. There is more needed, and no one
>>> should get something building but subtly not working. But we may better do
>>>
>>>     depends on !IPIPE
>>>
>>
>> Indeed, otherwise plain build tests with e.g. allyesconfig fail miserably.
> 
> I meant "allnoconfig" of course, but you get the point.
> 

I've added
https://gitlab.denx.de/Xenomai/ipipe-x86/-/commit/fe5928a3ea7d24eaad0e4a293e25bd1463312c17
instead to 4.19-x86

All other patches merged (and now part of
ipipe-core-4.19.140-cip33-x86-14), the generic ones also the ipipe-noarch.

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-09-11  9:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 13:09 [PATCH 1/6] ipipe: fix build with CONFIG_IPIPE disabled Philippe Gerum
2020-09-07 13:09 ` [PATCH 2/6] ipipe: add fixup call to irq_set_[chip_]handler_[name_]locked() helpers Philippe Gerum
2020-09-07 13:09 ` [PATCH 3/6] x86/ipipe: fix chained irq handling Philippe Gerum
2020-09-07 14:45   ` Jan Kiszka
2020-09-07 15:17     ` Philippe Gerum
2020-09-07 13:09 ` [PATCH 4/6] ipipe: pinctrl: enable basic pipeline support Philippe Gerum
2020-09-07 13:09 ` [PATCH 5/6] x86/ipipe: fix build with CONFIG_X86_UV enabled Philippe Gerum
2020-09-07 14:45   ` Jan Kiszka
2020-09-07 15:11     ` Philippe Gerum
2020-09-07 15:18       ` Philippe Gerum
2020-09-11  9:29         ` Jan Kiszka
2020-09-07 13:09 ` [PATCH 6/6] ipipe: rename __fixup_irq_handler() to __ipipe_setup_irq_desc() Philippe Gerum

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.