All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs
@ 2019-03-26 15:35 Lukas Juenger
  0 siblings, 0 replies; 4+ messages in thread
From: Lukas Juenger @ 2019-03-26 15:35 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, Stefano Stabellini, Lukas Juenger

Xen's vGIC implementation supports a maximum number of 992 IRQ lines.
GICv2 specification allows for 1020 IRQ lines.
This commit adds a check for this discrepancy.

Signed-off-by: Lukas Juenger (juenger@ice.rwth-aachen.de)
---
 xen/arch/arm/setup.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 444857a..37b3648 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -888,7 +888,13 @@ void __init start_xen(unsigned long boot_phys_offset,
     /* Create initial domain 0. */
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    dom0_cfg.arch.nr_spis = gic_number_lines() - 32;
+    /*
+     * Xen vGIC supports a maximum of 992 IRQ lines.
+     * 32 are substracted to cover local IRQs.
+     */
+    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
+    if ( gic_number_lines() > 992 )
+        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
     dom0_cfg.max_vcpus = dom0_max_vcpus();
 
     dom0 = domain_create(0, &dom0_cfg, true);
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs
  2019-04-01 11:24 ` Julien Grall
@ 2019-04-05 13:54   ` Lukas Jünger
  0 siblings, 0 replies; 4+ messages in thread
From: Lukas Jünger @ 2019-04-05 13:54 UTC (permalink / raw)
  To: Julien Grall, Lukas Juenger, xen-devel; +Cc: Stefano Stabellini


[-- Attachment #1.1: Type: text/plain, Size: 2812 bytes --]

On 4/1/19 1:24 PM, Julien Grall wrote:
> Hi Lukas,
Hi,
> 
> You sent this patch twice. Is there any difference between the two?
No, they are the same. I accidentally send it twice.
> 
> On 3/27/19 7:19 AM, Lukas Juenger wrote:
>> Xen's vGIC implementation supports a maximum number of 992 IRQ lines.
> 
> NIT:  The correct term is Interrupt Lines.
> 
>> GICv2 specification allows for 1020 IRQ lines.
> This is common code, so we should also take into account the other GIC 
> versions we support.
> 
> 
> 
>> This commit adds a check for this discrepancy.
> 
> Your commit message should explain why reducing to 992 Interrupts lines 
> is fine. How about the following commit title and message?
> 
> "xen/arm: Cap the number interrupts of lines for dom0
> 
> Dom0 vGIC will use the same number interrupt lines as the hardware GIC. 
> While the hardware GIC can support up to 1019 interrupt lines, the vGIC 
> is only supporting up to 992 interrupt lines.
> 
> This means Xen will not be able to boot on platform where the hardware 
> GIC supports more the 992 interrupt lines.
> 
> While it would make sense to increase the limits in the vGICs, this is 
> not trivial because of the design choices.
> 
> At the moment, only models seem to report the maximum of interrupt 
> lines. They also don't have any interrupt wired above the 992 limits.
> So this would be fine to cap the interrupt for Dom0 to 992 lines.
> "
> 
>>
>> Signed-off-by: Lukas Juenger (juenger@ice.rwth-aachen.de)
> 
> We tend to encapsulate the e-mail between <...> and not (...).
> 
I adapted the patch according to your suggestions above.
>> ---
>>   xen/arch/arm/setup.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index 444857a967..37b3648a18 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -888,7 +888,13 @@ void __init start_xen(unsigned long 
>> boot_phys_offset,
>>       /* Create initial domain 0. */
>>       /* The vGIC for DOM0 is exactly emulating the hardware GIC */
>>       dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
>> -    dom0_cfg.arch.nr_spis = gic_number_lines() - 32;
>> +    /*
>> +     * Xen vGIC supports a maximum of 992 IRQ lines.
>> +     * 32 are substracted to cover local IRQs.
>> +     */
>> +    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 
>> 992) - 32;
>> +    if ( gic_number_lines() > 992 )
>> +        printk(XENLOG_WARNING "Maximum number of vGIC IRQs 
>> exceeded.\n");
>>       dom0_cfg.max_vcpus = dom0_max_vcpus();
>>       dom0 = domain_create(0, &dom0_cfg, true);
>>
> 
> Cheers,
> 
Thanks for you input,
Lukas


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5388 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs
  2019-03-27  7:19 Lukas Juenger
@ 2019-04-01 11:24 ` Julien Grall
  2019-04-05 13:54   ` Lukas Jünger
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2019-04-01 11:24 UTC (permalink / raw)
  To: Lukas Juenger, xen-devel; +Cc: Stefano Stabellini

Hi Lukas,

You sent this patch twice. Is there any difference between the two?

On 3/27/19 7:19 AM, Lukas Juenger wrote:
> Xen's vGIC implementation supports a maximum number of 992 IRQ lines.

NIT:  The correct term is Interrupt Lines.

> GICv2 specification allows for 1020 IRQ lines.
This is common code, so we should also take into account the other GIC 
versions we support.



> This commit adds a check for this discrepancy.

Your commit message should explain why reducing to 992 Interrupts lines 
is fine. How about the following commit title and message?

"xen/arm: Cap the number interrupts of lines for dom0

Dom0 vGIC will use the same number interrupt lines as the hardware GIC. 
While the hardware GIC can support up to 1019 interrupt lines, the vGIC 
is only supporting up to 992 interrupt lines.

This means Xen will not be able to boot on platform where the hardware 
GIC supports more the 992 interrupt lines.

While it would make sense to increase the limits in the vGICs, this is 
not trivial because of the design choices.

At the moment, only models seem to report the maximum of interrupt 
lines. They also don't have any interrupt wired above the 992 limits.
So this would be fine to cap the interrupt for Dom0 to 992 lines.
"

> 
> Signed-off-by: Lukas Juenger (juenger@ice.rwth-aachen.de)

We tend to encapsulate the e-mail between <...> and not (...).

> ---
>   xen/arch/arm/setup.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 444857a967..37b3648a18 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -888,7 +888,13 @@ void __init start_xen(unsigned long boot_phys_offset,
>       /* Create initial domain 0. */
>       /* The vGIC for DOM0 is exactly emulating the hardware GIC */
>       dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
> -    dom0_cfg.arch.nr_spis = gic_number_lines() - 32;
> +    /*
> +     * Xen vGIC supports a maximum of 992 IRQ lines.
> +     * 32 are substracted to cover local IRQs.
> +     */
> +    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
> +    if ( gic_number_lines() > 992 )
> +        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
>       dom0_cfg.max_vcpus = dom0_max_vcpus();
>   
>       dom0 = domain_create(0, &dom0_cfg, true);
> 

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs
@ 2019-03-27  7:19 Lukas Juenger
  2019-04-01 11:24 ` Julien Grall
  0 siblings, 1 reply; 4+ messages in thread
From: Lukas Juenger @ 2019-03-27  7:19 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, Stefano Stabellini, Lukas Juenger

Xen's vGIC implementation supports a maximum number of 992 IRQ lines.
GICv2 specification allows for 1020 IRQ lines.
This commit adds a check for this discrepancy.

Signed-off-by: Lukas Juenger (juenger@ice.rwth-aachen.de)
---
 xen/arch/arm/setup.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 444857a967..37b3648a18 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -888,7 +888,13 @@ void __init start_xen(unsigned long boot_phys_offset,
     /* Create initial domain 0. */
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    dom0_cfg.arch.nr_spis = gic_number_lines() - 32;
+    /*
+     * Xen vGIC supports a maximum of 992 IRQ lines.
+     * 32 are substracted to cover local IRQs.
+     */
+    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
+    if ( gic_number_lines() > 992 )
+        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
     dom0_cfg.max_vcpus = dom0_max_vcpus();
 
     dom0 = domain_create(0, &dom0_cfg, true);
-- 
2.21.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-04-05 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 15:35 [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs Lukas Juenger
2019-03-27  7:19 Lukas Juenger
2019-04-01 11:24 ` Julien Grall
2019-04-05 13:54   ` Lukas Jünger

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.