From nobody Mon Nov 23 22:32:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1794567606; cv=none; d=zohomail.com; s=zohoarc; b=K4lj2F0AR3sh6EbBhvygxOggLeBABTApQRYACccDct/vCS45pc7BPbhXTGpkU9HSgFPfrev0TeFOWE8z7inEXLsRXQZIinzexAcamU7cQiFTqp3wo5dj4Cuvg+/uB3MUFeYhPjwmWOgKBfdFfK3sgci31qwFzHrHX6/zYOEhP+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794567606; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WPtP2MQskPM8UmGqKce7n9iWdAsWFlNYMnzHqhZaXaM=; b=TkGWUkQYdCyN0Tz1MK2YXsZMMIcfCiBdUApCgqnAnilehAob7XBAkUTp0NyYIWojH0ITSdNfHDTlC3miJt/J1kI6ke/RPQAxlCJVBihujqgT4ztcJn07tlixoVUXuzAqC3ff6HwTewld5YLB87hSaePOgzp1Mc8EnCjoxZIZVp0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1794567605962568.6140426757357; Fri, 13 Nov 2026 03:00:05 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1487264.1689717 (Exim 4.92) (envelope-from ) id 1xRp0U-00071O-IJ; Fri, 13 Nov 2026 10:59:46 +0000 Received: by outflank-mailman (output) from mailman id 1487264.1689717; Fri, 13 Nov 2026 10:59:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xRp0U-00071H-Fb; Fri, 13 Nov 2026 10:59:46 +0000 Received: by outflank-mailman (input) for mailman id 1487264; Fri, 13 Nov 2026 10:59:45 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xRp0S-000713-RB for xen-devel@lists.xenproject.org; Fri, 13 Nov 2026 10:59:45 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xRp0S-0066eh-0S for xen-devel@lists.xenproject.org; Fri, 13 Nov 2026 11:59:44 +0100 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6af6ed98-e002-0a2a0a5209dd-0a2a4506968a-12 for ; Fri, 13 Nov 2026 11:59:43 +0100 Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6af6ed9f-195a-0a2a45060019-b9ff1c1294c1-3 for ; Fri, 13 Nov 2026 11:59:43 +0100 Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr) (Authenticated sender: 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e) by prod-mta-13.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id 1a1d490296f0006d3f.006 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 13 Nov 2026 10:59:40 +0000 Received: from [100.68.94.6] (areims-651-1-80-194.w90-18.abo.wanadoo.fr [90.18.187.194]) (Authenticated sender: baptiste.le-duc) by mail2.vates.fr (Postfix) with ESMTPSA id 5E1BC81C2F; Fri, 13 Nov 2026 11:59:39 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Feedback-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; q=dns/txt; s=selector1; bh=WPtP2MQskPM8UmGqKce7n9iWdAsWFlNYMnzHqhZaXaM=; h=from:subject:date:message-id:to:cc:mime-version:content-type:content-transfer-encoding:feedback-id; b=hqZYsjl7ycZMsOd6ZGb9dQneN98adNtlUDnDTneb2mtFrcwiUR+phBTAVBHg4qB1TKEndURlA V6CjtHhEO7dbNVM1Qmw3aEIC+2XGbz8l1CWT07LhNu4/RnYFqVyAtRqRlDDAVl19HNmVH/1egh+ oqgrJz1bYXBMthMG9XgNdA/HZ7Utz9ScUf+gNaQX88pP/QYGE7GDYz4YbDISl+T2sU/O5NOH4lB ZtAWIVblAKv178KUYoRHQRmBu4MB80hQm/EbZGN1x/xc6rnwEOvPV14cMWhtkQqr54ZnfE9KP2z B0ydnsbNx91CsUFTva7dwZgMjF7b12Rh89CcP/Nav4Mg== X-Zone-Loop: 2d33bed46736319e2d7cbfe9e7a15500c2254f96ee79 x-campaign-type: default x-transaction-id: d761f17d-1bc8-418a-81bd-56ae1ea9aebc x-swg-uid: 01-f3e38bbf-5a38-4cbc-9106-376cd72fdef5 X-Mailer: Sweego Message-ID: <1794567580.8631fc262581453bbf619ec5b2062170.1a1d490296f0006d3f@vates.tech> x-swg-bid: 1794567580.8631fc262581453bbf619ec5b2062170.1a1d490296f0006d3f Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego x-campaign-id: default x-client-id: 8631fc262581453bbf619ec5b2062170 X-Originating-IP: [37.26.189.201] From: Baptiste Le Duc Date: Fri, 13 Nov 2026 11:59:33 +0100 Subject: [PATCH] xen/riscv: bound each IMSIC MMIO regset by the per-group hart slots MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-B4-Tracking: v=1; b=H4sIAAAAAAAC/yWMQQrCMBBFr1Jm7aBJQMGriItkOk1HSFoyqQild zfR5fu8/3ZQLsIK92GHwm9RWXIDcxqAZp8jo4yNwV7s1RjjcJIPSlIhTEkWHCuSc+bmyfLEBO2 3Fm7Sr/l4/lm38GKqPdSN4JUxFJ9p7tO2nrX6KDnCcXwB0BPLUpIAAAA= X-Change-ID: 20261113-fix-imsic-mmio-dt-c3317ac2efec To: xen-devel@lists.xenproject.org Cc: Alistair Francis , Connor Davis , Oleksii Kurochko , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini , Baptiste Le Duc X-Developer-Signature: v=1; a=ed25519-sha256; t=1794567574; l=2870; i=baptiste.le-duc@vates.tech; s=20260810; h=from:subject:message-id; bh=qoi0+YBmThIl+PFjANGmt1scZgvo0AhtaL3wKpUiWa8=; b=RmpusZsoylYSmOms89fpChUlxKiBGR/KadBUhoEwLIFBkmO9AzJRWRBijlVjw+RBAZZ/4k44j lAmqMeDyavdADKKaQbqqHDW2vWLT8BfjMPQz9vkvWoQiVP6UQ/DKUQj X-Developer-Key: i=baptiste.le-duc@vates.tech; a=ed25519; pk=N+BbdvMXRzrCuX/ieh4RWodiAKcLNvI+KjflcZ0oXCo= X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1794567579561 X-purgate-ID: tlsNG-16d1c6/1794567583-1F6C877B-8358DA42/0/0 X-purgate-type: clean X-purgate-size: 2872 X-ZohoMail-DKIM: pass (identity @vates.tech) X-ZM-MESSAGEID: 1794567607724158501 imsic_init() requires every MMIO register set to be exactly IMSIC_HART_SIZE(guest_index_bits) * nr_parent_irqs bytes, i.e. to cover the interrupt files of all harts listed in interrupts-extended. This only holds when the DT describes a single register set. When harts are split into groups (riscv,group-index-bits > 0), each group has its own register set, which only covers the harts of that group. For example, the SpacemiT V100 IMSIC node describes two 2 MiB register sets, each holding 64 hart slots of 32 KiB, with 128 parent interrupts in total. Xen expects 4 MiB per register set and fails with: IMSIC MMIO size is incorrect 2097152, expected MMIO size: 4194304 A register set can also be smaller than its slot space, when the number of harts in a group is not a power of two. Check instead that a register set does not exceed the address space of one group of BIT(hart_index_bits) hart slots. While at it, print the MMIO sizes in hex, so they can be compared directly with the reg property of the DT node. Fixes: c9bd8b322ecb ("xen/riscv: imsic_init() implementation") Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Baptiste Le Duc --- xen/arch/riscv/imsic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/riscv/imsic.c b/xen/arch/riscv/imsic.c index 44b8640ea3..255ac44b52 100644 --- a/xen/arch/riscv/imsic.c +++ b/xen/arch/riscv/imsic.c @@ -416,8 +416,8 @@ int __init imsic_init(const struct dt_device_node *node) for ( unsigned int i =3D 0; i < nr_mmios; i++ ) { unsigned int guest_bits =3D imsic_cfg.guest_index_bits; - unsigned long expected_mmio_size =3D - IMSIC_HART_SIZE(guest_bits) * nr_parent_irqs; + unsigned long max_mmio_regset_size =3D + IMSIC_HART_SIZE(guest_bits) * BIT(imsic_cfg.hart_index_bits, U= ); =20 rc =3D dt_device_get_address(node, i, &mmios[i].base_addr, &mmios[i].size); @@ -442,11 +442,11 @@ int __init imsic_init(const struct dt_device_node *no= de) goto imsic_init_err; } =20 - if ( mmios[i].size !=3D expected_mmio_size ) + if ( mmios[i].size > max_mmio_regset_size ) { rc =3D -EINVAL; - printk(XENLOG_ERR "%s: IMSIC MMIO size is incorrect %ld, expec= ted MMIO size: %ld\n", - node->name, mmios[i].size, expected_mmio_size); + printk(XENLOG_ERR "%s: IMSIC MMIO regset %u size %#lx larger t= han max %#lx\n", + node->name, i, mmios[i].size, max_mmio_regset_size); goto imsic_init_err; } } --- base-commit: 97bf370375113caf92fccf04e2877fc6b5ff887f change-id: 20261113-fix-imsic-mmio-dt-c3317ac2efec Best regards, -- =20 Baptiste Le Duc