All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Juenger <juenger@ice.rwth-aachen.de>
To: xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Lukas Juenger <juenger@ice.rwth-aachen.de>
Subject: [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs
Date: Wed, 27 Mar 2019 08:19:58 +0100	[thread overview]
Message-ID: <50fee047-6463-4524-9449-51555ed59277@rwthex-w1-a.rwth-ad.de> (raw)

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

             reply	other threads:[~2019-03-27  7:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  7:19 Lukas Juenger [this message]
2019-04-01 11:24 ` [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs Julien Grall
2019-04-05 13:54   ` Lukas Jünger
2019-04-05 13:54     ` [Xen-devel] " Lukas Jünger
  -- strict thread matches above, loose matches on Subject: below --
2019-03-26 15:35 Lukas Juenger

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=50fee047-6463-4524-9449-51555ed59277@rwthex-w1-a.rwth-ad.de \
    --to=juenger@ice.rwth-aachen.de \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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.