Skip to contentSkip to conversation

utils: irqchip: plic: Using 1 as default priority value

PATCH New [email protected] 3 participants 7 messages Apr 24, 2021 – May 12, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils: irqchip: plic: Using 1 as default priority value

From: Guo Ren <[email protected]>

In linux plic drivers:
static inline void plic_irq_toggle(const struct cpumask *mask,
struct irq_data *d, int enable)

{
	int cpu;
	struct plic_priv *priv = irq_data_get_irq_chip_data(d);

	writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID);

It sets PRIORITY in enable/disable irq, but not during init. Actually, priority is no use at all and just keep them the same is enough.

The motivation of my patch: When we want to run 2 different Linux OS in the same SMP system, the second Linux cold boot will flush all priority to zero and the patch is to solve the problem.

---
 lib/utils/irqchip/plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils/irqchip/plic.c +1 -1
index 7665c62..70e89a6 100644
@@ -94,7 +94,7 @@ int plic_cold_irqchip_init(struct plic_data *plic)
 
 	/* Configure default priorities of all IRQs */
 	for (i = 1; i <= plic->num_src; i++)
-		plic_set_priority(plic, i, 0);
+		plic_set_priority(plic, i, 1);
 
 	return 0;
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 utils: irqchip: plic: Using 1 as default priority value

Quoted 20 lines

-----Original Message-----
From: guoren at kernel.org <[email protected]>
Sent: 24 April 2021 08:14
To: guoren at kernel.org; anup at brainfault.org
Cc: opensbi at lists.infradead.org; Guo Ren <[email protected]>; Anup Patel <[email protected]>
Subject: [PATCH] utils: irqchip: plic: Using 1 as default priority value

From: Guo Ren <[email protected]>

In linux plic drivers:
static inline void plic_irq_toggle(const struct cpumask *mask,
struct irq_data *d, int enable)

{
	int cpu;
	struct plic_priv *priv = irq_data_get_irq_chip_data(d);

	writel(enable, priv->regs + PRIORITY_BASE + d->hwirq *
Quoted 8 lines

PRIORITY_PER_ID);

It sets PRIORITY in enable/disable irq, but not during init. Actually, priority is no use at all and just keep them the same is enough.

The motivation of my patch: When we want to run 2 different Linux OS in the same SMP system, the second Linux cold boot will flush all priority to zero and the patch is to solve the problem.

Don't create separate OpenSBI instances for 2 different OSes.

The OpenSBI domain support allows you to create 2 different domains for each Linux. Please checkout recent YouTube video on OpenSBI domains

Regards,
Anup

Quoted 22 lines
---
 lib/utils/irqchip/plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils/irqchip/plic.c index renamed from lib/utils/irqchip/plic.c +0 -0

7665c62..70e89a6 100644

lib/utils/irqchip/plic.c +1 -2
@@ -94,7 +94,7 @@ int plic_cold_irqchip_init(struct plic_data *plic)
 
 	/* Configure default priorities of all IRQs */
 	for (i = 1; i <= plic->num_src; i++)
-		plic_set_priority(plic, i, 0);
+		plic_set_priority(plic, i, 1);
 
 	return 0;
 }
--

2.7.4

author
#2 lore raw

PATCH 1/1 utils: irqchip: plic: Using 1 as default priority value

Hi Anup,

Quoted 26 lines · Anup Patel
Quoted 26 lines

-----Original Message-----
From: guoren at kernel.org <[email protected]>
Sent: 24 April 2021 08:14
To: guoren at kernel.org; anup at brainfault.org
Cc: opensbi at lists.infradead.org; Guo Ren <[email protected]>; Anup Patel <[email protected]>
Subject: [PATCH] utils: irqchip: plic: Using 1 as default priority value

From: Guo Ren <[email protected]>

In linux plic drivers:
static inline void plic_irq_toggle(const struct cpumask *mask,
struct irq_data *d, int enable)

{
      int cpu;
      struct plic_priv *priv = irq_data_get_irq_chip_data(d);

      writel(enable, priv->regs + PRIORITY_BASE + d->hwirq *

PRIORITY_PER_ID);

It sets PRIORITY in enable/disable irq, but not during init. Actually, priority is no use at all and just keep them the same is enough.

Quoted 8 lines
Quoted 3 lines

The motivation of my patch: When we want to run 2 different Linux OS in the same SMP system, the second Linux cold boot will flush all priority to zero and the patch is to solve the problem.

Don't create separate OpenSBI instances for 2 different OSes.

The OpenSBI domain support allows you to create 2 different domains for each Linux. Please checkout recent YouTube video on OpenSBI domains

I agree with the idea of OpenSBI domains, but it isn't related to the patch.

What we've done in a 4 cores SMP with 8GB memory system is:

- "hart0 + hart1, with memory 0 - 4GB" run linux1 + opensbi1
- "hart2 + hart3" with memory 4GB - 8GB run linux2 + opensbi2

They are physical separated in memory and CPUs, but plic is shared. Current opensbi + Linux almost could natively support this kind of simple scenario, but this patch.

Quoted 27 lines

Regards,
Anup

Quoted 22 lines
---
 lib/utils/irqchip/plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils/irqchip/plic.c index renamed from lib/utils/irqchip/plic.c +0 -0

7665c62..70e89a6 100644

lib/utils/irqchip/plic.c +1 -2
@@ -94,7 +94,7 @@ int plic_cold_irqchip_init(struct plic_data *plic)
 
      /* Configure default priorities of all IRQs */
      for (i = 1; i <= plic->num_src; i++)
-             plic_set_priority(plic, i, 0);
+             plic_set_priority(plic, i, 1);
 
      return 0;
 }
--

2.7.4

Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/
#3 lore raw

PATCH 1/1 utils: irqchip: plic: Using 1 as default priority value

Quoted 50 lines

-----Original Message-----
From: Guo Ren <[email protected]>
Sent: 24 April 2021 12:24
To: Anup Patel <[email protected]>
Cc: anup at brainfault.org; opensbi at lists.infradead.org; Guo Ren <[email protected]>
Subject: Re: [PATCH] utils: irqchip: plic: Using 1 as default priority value

Hi Anup,

Quoted 30 lines · Anup Patel
Quoted 21 lines

-----Original Message-----
From: guoren at kernel.org <[email protected]>
Sent: 24 April 2021 08:14
To: guoren at kernel.org; anup at brainfault.org
Cc: opensbi at lists.infradead.org; Guo Ren <[email protected]>; Anup Patel <[email protected]>
Subject: [PATCH] utils: irqchip: plic: Using 1 as default priority value

From: Guo Ren <[email protected]>

In linux plic drivers:
static inline void plic_irq_toggle(const struct cpumask *mask,

                                 struct irq_data *d, int enable) {
      int cpu;
      struct plic_priv *priv = irq_data_get_irq_chip_data(d);

      writel(enable, priv->regs + PRIORITY_BASE + d->hwirq *
Quoted 8 lines

PRIORITY_PER_ID);

It sets PRIORITY in enable/disable irq, but not during init. Actually, priority is no use at all and just keep them the same is enough.

The motivation of my patch: When we want to run 2 different Linux OS in the same SMP system, the second Linux cold boot will flush all priority to zero and the patch is to solve the problem.

Quoted 5 lines

Don't create separate OpenSBI instances for 2 different OSes.

The OpenSBI domain support allows you to create 2 different domains for each Linux. Please checkout recent YouTube video on OpenSBI domains

I agree with the idea of OpenSBI domains, but it isn't related to the patch.

Quoted 8 lines

What we've done in a 4 cores SMP with 8GB memory system is:

- "hart0 + hart1, with memory 0 - 4GB" run linux1 + opensbi1
- "hart2 + hart3" with memory 4GB - 8GB run linux2 + opensbi2

They are physical separated in memory and CPUs, but plic is shared. Current opensbi + Linux almost could natively support this kind of simple scenario, but this patch.

You don't need split OpenSBI because OpenSBI domains allow you to partition the system as-per your requirements.

Please explore OpenSBI domain support instead of adding work-around like this which affects everyone.

Slides: https://events.linuxfoundation.org/riscv-forum-security/program/schedule/
Video: https://www.youtube.com/watch?v=lMxSrfn12ec

Regards,
Anup

Quoted 36 lines
Quoted 24 lines

Regards,
Anup

Quoted 19 lines
---
 lib/utils/irqchip/plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils/irqchip/plic.c +0 -0

index
7665c62..70e89a6 100644

lib/utils/irqchip/plic.c +1 -1
@@ -94,7 +94,7 @@ int plic_cold_irqchip_init(struct plic_data *plic)
 
      /* Configure default priorities of all IRQs */
      for (i = 1; i <= plic->num_src; i++)
-             plic_set_priority(plic, i, 0);
+             plic_set_priority(plic, i, 1);
 
Quoted 5 lines
Quoted 4 lines
lib/utils/irqchip/plic.c +0 -1
      return 0;
 }
--

2.7.4

--
Best Regards
Guo Ren

ML: https://lore.kernel.org/linux-csky/

#4 lore raw

PATCH 1/1 utils: irqchip: plic: Using 1 as default priority value

In reply to Guo Ren
Quoted 40 lines · Guo Ren

Hi Anup,

Quoted 26 lines · Anup Patel
Quoted 26 lines

-----Original Message-----
From: guoren at kernel.org <[email protected]>
Sent: 24 April 2021 08:14
To: guoren at kernel.org; anup at brainfault.org
Cc: opensbi at lists.infradead.org; Guo Ren <[email protected]>; Anup Patel <[email protected]>
Subject: [PATCH] utils: irqchip: plic: Using 1 as default priority value

From: Guo Ren <[email protected]>

In linux plic drivers:
static inline void plic_irq_toggle(const struct cpumask *mask,
struct irq_data *d, int enable)

{
      int cpu;
      struct plic_priv *priv = irq_data_get_irq_chip_data(d);

      writel(enable, priv->regs + PRIORITY_BASE + d->hwirq *

PRIORITY_PER_ID);

It sets PRIORITY in enable/disable irq, but not during init. Actually, priority is no use at all and just keep them the same is enough.

Quoted 8 lines
Quoted 3 lines

The motivation of my patch: When we want to run 2 different Linux OS in the same SMP system, the second Linux cold boot will flush all priority to zero and the patch is to solve the problem.

Don't create separate OpenSBI instances for 2 different OSes.

The OpenSBI domain support allows you to create 2 different domains for each Linux. Please checkout recent YouTube video on OpenSBI domains

I agree with the idea of OpenSBI domains, but it isn't related to the patch.

Quoted 9 lines

What we've done in a 4 cores SMP with 8GB memory system is:

- "hart0 + hart1, with memory 0 - 4GB" run linux1 + opensbi1
- "hart2 + hart3" with memory 4GB - 8GB run linux2 + opensbi2

They are physical separated in memory and CPUs, but plic is shared. Current opensbi + Linux almost could natively support this kind of simple scenario, but this patch.

I am just curious about the use case. Why do you need to run two different linux instances ?

Quoted 39 lines
Quoted 22 lines

Regards,
Anup

Quoted 18 lines
---
 lib/utils/irqchip/plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils/irqchip/plic.c index renamed from lib/utils/irqchip/plic.c +0 -0

7665c62..70e89a6 100644

lib/utils/irqchip/plic.c +1 -1
@@ -94,7 +94,7 @@ int plic_cold_irqchip_init(struct plic_data *plic)
 
      /* Configure default priorities of all IRQs */
      for (i = 1; i <= plic->num_src; i++)
-             plic_set_priority(plic, i, 0);
+             plic_set_priority(plic, i, 1);
 
Quoted 5 lines
Quoted 4 lines
lib/utils/irqchip/plic.c +0 -1
      return 0;
 }
--

2.7.4

--
Best Regards
Guo Ren

ML: https://lore.kernel.org/linux-csky/

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 2 lines
Regards,
Atish
author
#5 lore raw

PATCH 1/1 utils: irqchip: plic: Using 1 as default priority value

Quoted 47 lines · Atish Patra
Quoted 45 lines · Guo Ren

Hi Anup,

Quoted 26 lines · Anup Patel
Quoted 26 lines

-----Original Message-----
From: guoren at kernel.org <[email protected]>
Sent: 24 April 2021 08:14
To: guoren at kernel.org; anup at brainfault.org
Cc: opensbi at lists.infradead.org; Guo Ren <[email protected]>; Anup Patel <[email protected]>
Subject: [PATCH] utils: irqchip: plic: Using 1 as default priority value

From: Guo Ren <[email protected]>

In linux plic drivers:
static inline void plic_irq_toggle(const struct cpumask *mask,
struct irq_data *d, int enable)

{
      int cpu;
      struct plic_priv *priv = irq_data_get_irq_chip_data(d);

      writel(enable, priv->regs + PRIORITY_BASE + d->hwirq *

PRIORITY_PER_ID);

It sets PRIORITY in enable/disable irq, but not during init. Actually, priority is no use at all and just keep them the same is enough.

Quoted 8 lines
Quoted 3 lines

The motivation of my patch: When we want to run 2 different Linux OS in the same SMP system, the second Linux cold boot will flush all priority to zero and the patch is to solve the problem.

Don't create separate OpenSBI instances for 2 different OSes.

The OpenSBI domain support allows you to create 2 different domains for each Linux. Please checkout recent YouTube video on OpenSBI domains

I agree with the idea of OpenSBI domains, but it isn't related to the patch.

What we've done in a 4 cores SMP with 8GB memory system is:

- "hart0 + hart1, with memory 0 - 4GB" run linux1 + opensbi1
- "hart2 + hart3" with memory 4GB - 8GB run linux2 + opensbi2

Quoted 7 lines
Quoted 4 lines

They are physical separated in memory and CPUs, but plic is shared. Current opensbi + Linux almost could natively support this kind of simple scenario, but this patch.

I am just curious about the use case. Why do you need to run two different linux instances ?

Just for customer security needs, they want two memory regions are totally separated.

Quoted 46 lines
Quoted 34 lines
Quoted 23 lines

Regards,
Anup

Quoted 18 lines
---
 lib/utils/irqchip/plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils/irqchip/plic.c index renamed from lib/utils/irqchip/plic.c +0 -0

7665c62..70e89a6 100644

lib/utils/irqchip/plic.c +1 -1
@@ -94,7 +94,7 @@ int plic_cold_irqchip_init(struct plic_data *plic)
 
      /* Configure default priorities of all IRQs */
      for (i = 1; i <= plic->num_src; i++)
-             plic_set_priority(plic, i, 0);
+             plic_set_priority(plic, i, 1);
 
Quoted 5 lines
Quoted 4 lines
lib/utils/irqchip/plic.c +0 -1
      return 0;
 }
--

2.7.4

--
Best Regards
Guo Ren

Quoted 6 lines

ML: https://lore.kernel.org/linux-csky/

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

--
Regards,
Atish

Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/
#6 lore raw

PATCH 1/1 utils: irqchip: plic: Using 1 as default priority value

Quoted 54 lines · Guo Ren
Quoted 52 lines · Atish Patra
Quoted 49 lines · Guo Ren

Hi Anup,

Quoted 26 lines · Anup Patel
Quoted 26 lines

-----Original Message-----
From: guoren at kernel.org <[email protected]>
Sent: 24 April 2021 08:14
To: guoren at kernel.org; anup at brainfault.org
Cc: opensbi at lists.infradead.org; Guo Ren <[email protected]>; Anup Patel <[email protected]>
Subject: [PATCH] utils: irqchip: plic: Using 1 as default priority value

From: Guo Ren <[email protected]>

In linux plic drivers:
static inline void plic_irq_toggle(const struct cpumask *mask,
struct irq_data *d, int enable)

{
      int cpu;
      struct plic_priv *priv = irq_data_get_irq_chip_data(d);

      writel(enable, priv->regs + PRIORITY_BASE + d->hwirq *

PRIORITY_PER_ID);

It sets PRIORITY in enable/disable irq, but not during init. Actually, priority is no use at all and just keep them the same is enough.

Quoted 8 lines
Quoted 3 lines

The motivation of my patch: When we want to run 2 different Linux OS in the same SMP system, the second Linux cold boot will flush all priority to zero and the patch is to solve the problem.

Don't create separate OpenSBI instances for 2 different OSes.

The OpenSBI domain support allows you to create 2 different domains for each Linux. Please checkout recent YouTube video on OpenSBI domains

I agree with the idea of OpenSBI domains, but it isn't related to the patch.

What we've done in a 4 cores SMP with 8GB memory system is:

- "hart0 + hart1, with memory 0 - 4GB" run linux1 + opensbi1
- "hart2 + hart3" with memory 4GB - 8GB run linux2 + opensbi2

They are physical separated in memory and CPUs, but plic is shared. Current opensbi + Linux almost could natively support this kind of simple scenario, but this patch.

Quoted 5 lines
Quoted 2 lines

I am just curious about the use case. Why do you need to run two different linux instances ?

Just for customer security needs, they want two memory regions are totally separated.

Ok, thanks for the clarification.

Quoted 54 lines
Quoted 43 lines
Quoted 34 lines
Quoted 23 lines

Regards,
Anup

Quoted 18 lines
---
 lib/utils/irqchip/plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/utils/irqchip/plic.c index renamed from lib/utils/irqchip/plic.c +0 -0

7665c62..70e89a6 100644

lib/utils/irqchip/plic.c +1 -1
@@ -94,7 +94,7 @@ int plic_cold_irqchip_init(struct plic_data *plic)
 
      /* Configure default priorities of all IRQs */
      for (i = 1; i <= plic->num_src; i++)
-             plic_set_priority(plic, i, 0);
+             plic_set_priority(plic, i, 1);
 
Quoted 5 lines
Quoted 4 lines
lib/utils/irqchip/plic.c +0 -1
      return 0;
 }
--

2.7.4

--
Best Regards
Guo Ren

Quoted 6 lines

ML: https://lore.kernel.org/linux-csky/

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Quoted 3 lines

--
Regards,
Atish

--
Best Regards
Guo Ren

ML: https://lore.kernel.org/linux-csky/

Signature · 2 lines
Regards,
Atish