From patchwork Tue Mar 26 15:35:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Juenger X-Patchwork-Id: 10871439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2325B15AC for ; Tue, 26 Mar 2019 15:40:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1040428DC5 for ; Tue, 26 Mar 2019 15:40:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 048DC28F7B; Tue, 26 Mar 2019 15:40:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F5F928DC5 for ; Tue, 26 Mar 2019 15:40:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h8oA0-00008H-Fi; Tue, 26 Mar 2019 15:38:44 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h8o6o-0008S0-OM for xen-devel@lists.xenproject.org; Tue, 26 Mar 2019 15:35:26 +0000 X-Inumbo-ID: c503df73-4fdc-11e9-bc90-bc764e045a96 Received: from mail-out-2.itc.rwth-aachen.de (unknown [134.130.5.47]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c503df73-4fdc-11e9-bc90-bc764e045a96; Tue, 26 Mar 2019 15:35:23 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2ANBADvRZpc/5xb4olkHQEBBQEHBQGBZYJ+bBInjQmnCToBhECFRjgSAQEDAQEJAQMCbSiGSoFRgyKBdq58ijCBL4ZqhF+Bf4N1bIQNBn6FFAOlGQmBJpIXF4sgiGEBoFshgVYzGggcFIMnghYXjh9BMIEFAQGMaAElgicBAQ X-IPAS-Result: A2ANBADvRZpc/5xb4olkHQEBBQEHBQGBZYJ+bBInjQmnCToBhECFRjgSAQEDAQEJAQMCbSiGSoFRgyKBdq58ijCBL4ZqhF+Bf4N1bIQNBn6FFAOlGQmBJpIXF4sgiGEBoFshgVYzGggcFIMnghYXjh9BMIEFAQGMaAElgicBAQ X-IronPort-AV: E=Sophos;i="5.60,273,1549926000"; d="scan'208";a="73299112" Received: from lab-sss-156.iss.rwth-aachen.de (HELO claus.iss.rwth-aachen.de) ([137.226.91.156]) by mail-in-2.itc.rwth-aachen.de with ESMTP; 26 Mar 2019 16:35:20 +0100 From: Lukas Juenger To: xen-devel@lists.xenproject.org Date: Tue, 26 Mar 2019 16:35:16 +0100 Message-Id: <1553614518-16421-1-git-send-email-juenger@ice.rwth-aachen.de> X-Mailer: git-send-email 1.8.3.1 X-Mailman-Approved-At: Tue, 26 Mar 2019 15:38:43 +0000 Subject: [Xen-devel] [PATCH] arm/dom0: Add check for maximum number of supported vGIC IRQs X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini , Lukas Juenger MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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);