From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703755; cv=none; d=zohomail.com; s=zohoarc; b=T5iQie/Q3rKzW2Aw737yz0Rx0lSI6/cpZVNLGFYT58XHKz8Lux+I5ZyXTBsje2dV6b6t94x6a6O0OvWfV6VzJEissIfhw2pqqgqaeGMm4EL3UMvVdhK7HMeb1YKgKJ2qRGJof7tyFfnHU7Ydqa3qdLqhNVzNdcDJKb+pPfvRx5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703755; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9laLI1EifxNkXv3D7kotOclZPrE4Ev980+M7V9NnYEA=; b=ZvU+rpdJVaP+WqR7QzM3+dtOAc+cKLLW83144A/9+XwQhy8UwrQ40plvpNeiu9RjnuKRmCu43X76shr7DfBh2J/upPIQbQ+SPJ4rdr4qv4PD3REVSE0Ef9PpSz0GR/GEHSxfRO8D8kZdKlPkqR8V/WuQnjMLFYC4204YcpEt9Oc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794703755709327.09639437377336; Sat, 14 Nov 2026 16:49:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQ8-0008Aq-3W; Sat, 14 Nov 2026 19:48:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQ5-00085v-MI for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:33 -0500 Received: from mail-dy1-x132d.google.com ([2607:f8b0:4864:20::132d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQ3-00016B-VS for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:33 -0500 Received: by mail-dy1-x132d.google.com with SMTP id 5a478bee46e88-3282db206d3so6706944eec.0 for ; Sat, 14 Nov 2026 16:48:31 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703711; x=1795308511; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9laLI1EifxNkXv3D7kotOclZPrE4Ev980+M7V9NnYEA=; b=dZRJppa7oAYcaYlfIOY/UAqi/ezz8Tnjk5h3mBuiJse1Q8AyuucpcJDs40xLlLvCvM 5Cx68LAa1i+Q//bPAuyCiWiYNZX/Fq1+i3IYDqPetU3QD84sff4Ltyz+piKPdx6HhvuF O32C6NJ3nXoSjmzMYHwvzW/S/zY6BDMQfPhG0kxubLnbFgC7Ubzwp1De/KCBGB0Vd4Oe fvxbDi7U2BkD/N9ZKrxmCbS/Eha7jaGp6Ne19uv4K5BpiVolgW1BkilTvXFu46H7s4Y3 C/e/3nJ/4DJy8GCtbMYOAqMgtT62848sX2yjd6b+x+i7oFYPoZjOhJSnrJ9vQC7xTqkn RmDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703711; x=1795308511; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=9laLI1EifxNkXv3D7kotOclZPrE4Ev980+M7V9NnYEA=; b=luA+veQPNqNRr/M6dV2gj7bGJS+ejwv8aPDK8AkAipOxUr1ptjU0f1WLEc9h3kVrCS ZraCEw9SHSZrHz6ihgijvWBg3EdJgA+QKuKSnsq/mqXEdGU0sSaydvNJLcHYiSSJ3+bw pSXIBPqbg9qt14+erfGrtz0JSA36gSVf8ixhgoQXwpUdKgWGVzCgpRKQPTbC97ipW2Fv tc4CbD24XEmIxTqeey32ZCiFdLQB2KIX06IIgO+e+QnYIG/GSxRSLTFWL9ObpEYat4DX 2d3H7eqmsiMzS0FIRvGPZK2XUzH2qV0DbODSPWUgfHMfoJ0DYowQy2qSZKNYZzvnQvHJ AmCg== X-Gm-Message-State: APuU4Z8Yr6iaWafHDyTZI7bVAJdOxl1XhB6fvbVrAGS0+69FQKiY/FxI z8tT9qHQ2OtFPYktQMIMmY5XzpALiRB+lZDIbNmQbNvGy2fp3lhc4ca52/rZVg== X-Gm-Gg: AYBFou1M5mivCjp7ztewl/d5OdHNC3M329QNHXF/VFWJoz3EeeDszSJtP/FQLzFxCSY UAatl/DoFIglVy5dXv0Wk6MNBDgBTQDTcnRf9AydQjaQ3syYaPspLgDtATTRdkfshcqyaqi276N xV2K7Qh5ocuYr/XW8JKvkxb6CFdizpX32h4lIwrU68rqPheQa2hMy0OxR8DTyvlZkA8kV2pkBnD X9Fh6oZpkHzNOvDbZc5YnHfA3fe/GUNAeq+51Q6hd2WdbPmiUbt8cShphKLYyGUemIc1zWyrqer k1HlAMaE+WuMvBGggN7NkVTh/a9ZCKzcgBiSmi0AEgImavWuRpdtt2HbNCCmb1A02aQWGuz8h6A /OWlNtwVMF9NJqqDYYGV6eogRjtNDdAOC/jCtmwrDYkJejuQ0x61yGlA6IZhKPQHbRAxV9ETDe/ XwfYeZ+EzHT3d4z5GFIjDT1+1boC9Fuk5aWgsgYN5Ym5OGQ4118aG8+gwS0IN8odN3wrD4Q35vJ E3Mgsp+G04vwdNstEjN6MdIzbnDThAIwMKuxm7l649/LBe6q5ol1rRLTlnTQCuK/TMAXH8t/mkM i0V4NF9rcPJ4iM0VbMZrf7/tmmBXYk17/o9hiMgNhiC8THM3 X-Received: by 2002:a05:7300:680e:b0:369:21a:dcca with SMTP id 5a478bee46e88-37966387e53mr6805284eec.10.1794703710444; Sat, 14 Nov 2026 16:48:30 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Tan Chi , Alistair Francis , Daniel Henrique Barboza , Nutty Liu Subject: [PULL 1/8] hw/riscv: Build AIA glue only with APLIC and IMSIC Date: Sun, 15 Nov 2026 10:48:12 +1000 Message-ID: <20261115004819.2586336-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::132d; envelope-from=alistair23@gmail.com; helo=mail-dy1-x132d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703758469154100 Content-Type: text/plain; charset="utf-8" From: Tan Chi hw/riscv/aia.c is built unconditionally, but riscv_create_aia() references the APLIC and IMSIC device implementations, which are only built when their respective Kconfig options are enabled. This causes undefined references to riscv_aplic_create() in minimal RISC-V builds that do not include APLIC. Build aia.c only when both CONFIG_RISCV_APLIC and CONFIG_RISCV_IMSIC are enabled. Move imsic_num_bits() to aia.h as a static inline helper, since it is also used by FDT and ACPI code independently of the AIA device creation helper. Signed-off-by: Tan Chi Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Reviewed-by: Nutty Liu Message-ID: <20261101031547.125591-2-tanchi25@mails.ucas.ac.cn> Signed-off-by: Alistair Francis --- hw/riscv/aia.h | 12 +++++++++++- hw/riscv/aia.c | 11 ----------- hw/riscv/meson.build | 3 ++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hw/riscv/aia.h b/hw/riscv/aia.h index 5df3292610e9..e4dcc5aae09c 100644 --- a/hw/riscv/aia.h +++ b/hw/riscv/aia.h @@ -10,8 +10,18 @@ #define HW_RISCV_AIA_H =20 #include "exec/hwaddr.h" +#include "qemu/bitops.h" =20 -uint32_t imsic_num_bits(uint32_t count); +static inline uint32_t imsic_num_bits(uint32_t count) +{ + uint32_t ret =3D 0; + + while (BIT(ret) < count) { + ret++; + } + + return ret; +} =20 DeviceState *riscv_create_aia(MemoryRegion *container, bool msimode, int aia_guests, diff --git a/hw/riscv/aia.c b/hw/riscv/aia.c index 56fc06453321..4463ea2be887 100644 --- a/hw/riscv/aia.c +++ b/hw/riscv/aia.c @@ -13,17 +13,6 @@ =20 #include "aia.h" =20 -uint32_t imsic_num_bits(uint32_t count) -{ - uint32_t ret =3D 0; - - while (BIT(ret) < count) { - ret++; - } - - return ret; -} - DeviceState *riscv_create_aia(MemoryRegion *container, bool msimode, int aia_guests, uint32_t m_imsic_stride, diff --git a/hw/riscv/meson.build b/hw/riscv/meson.build index 6bdabb954473..957031c07d5c 100644 --- a/hw/riscv/meson.build +++ b/hw/riscv/meson.build @@ -1,5 +1,6 @@ riscv_ss =3D ss.source_set() -riscv_ss.add(files('aia.c')) +riscv_ss.add(when: ['CONFIG_RISCV_APLIC', 'CONFIG_RISCV_IMSIC'], + if_true: files('aia.c')) riscv_ss.add(files('boot.c')) riscv_ss.add(files('device-common.c')) riscv_ss.add(files('fdt-common.c')) --=20 2.55.0 From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703758; cv=none; d=zohomail.com; s=zohoarc; b=TUsOBIhEFVoD1SvhzvuLRTZcCml5SzNSR6mMy3zCg6KKkOCOc+6Fco6NVtPFfJ6cgfChYYd+Uy/XrQOMJqbI192GHO1rzR1SakDhQ5rXGfAjToISo4yonafihj83ChJpQGqjDjaQfsiGA9fo6wE+tWi0H04vRYlYtHannu0BJok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703758; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=06GGkVHQKl8lhgizRBUFbOMNhL7MWupgQXxcYmmuRPg=; b=IgCfTxdbw92OR8Vxa6xdB6oHZZvHGJRKbxXtoTr90XGJYtpnoNRwIPD65Vk2pC3xotyUWGrfhAopUktBQal9Z+frB4KJEBpsy1vt8cCOVgop1d/g5GOV/+HTjZH1f26NRXslDfAukT8hV9q52Gfqm2n8iHlNgt+9sBwpEXWVZ4Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17947037588291013.7647217333941; Sat, 14 Nov 2026 16:49:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQ9-0008F9-OP; Sat, 14 Nov 2026 19:48:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQ8-0008Bt-SS for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:36 -0500 Received: from mail-dl1-x1229.google.com ([2607:f8b0:4864:20::1229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQ7-00016V-5L for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:36 -0500 Received: by mail-dl1-x1229.google.com with SMTP id a92af1059eb24-1b3acec6677so2983046c88.1 for ; Sat, 14 Nov 2026 16:48:34 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703713; x=1795308513; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=06GGkVHQKl8lhgizRBUFbOMNhL7MWupgQXxcYmmuRPg=; b=LFdmMPPHpdQCOfoWCGSyhyTJGuYxCIigSQCOipp9NDqHPqtL9fHmXAwTI+lzX7TIHn V6eQ6VnL8AwDb0vOm9U79Jp8pQOqOa0HFq2HEUzzdY9qOyN75KkOAnoK7QLOXDYiHlpD 5QdXuHVEQ9H1WmSazotuPFFATcrFBS8/S9DhUlV5+XckWLZ7t+NYYrYteVFVd1xm0ytL lZAgHAawX+nTvhfQdlOmBzHxRCTrnuqMKQHInqrIHjdWUFw8GE0b8UjM2r+cYNnR4Xif Fqx0DhhJvuyiZVx9fXYMeAWeRLW1yAKwiFFK2jhuAZ7Bww9KNNO5dr3Q2vyK3poB43Q+ PzFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703713; x=1795308513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=06GGkVHQKl8lhgizRBUFbOMNhL7MWupgQXxcYmmuRPg=; b=IyG0xc41Me6zuhHqxEXx6egKNXA8h1CnzaB+evBvk0ZJouaFzQRs5iGQwXitVXbXG9 G8qeMIPhWYMHeoFpx0ZSmSyM58q4TLWLbeepqJohkhy1HBhS4hhUZOwjAaSdrWLrwW3J +IhNe70VrFcTjYglhyW2ClhNAyM7L5QB/aE8974c57H8+UzIeGHf3io9iqsCT7Nc4Y+N P4o2B4NFx1PTvPJG+TfAlzPlSkATWM8OaMK2fkBWHo52OcqR5DfmaaY0ROBuHoN0bFIY CvXNanm67s5aGyNEcnW26id6Ibi6fHTGxgpfKQ1Ag1z9H25EcTdLXoeyOo61LLnk/oWJ tNqQ== X-Gm-Message-State: APuU4Z9tXQCK5jaGP0BpVQEqMzPyMApVxuWGJPbZ17K4XhA3d9m2yem7 33fFY1lCTI52Nd3kXt/CTaRTUXZeEa+aIzh5WagJmY1QGcN/QUCClGAFBsXv9g== X-Gm-Gg: AYBFou20t2i0FF6jgMmxOw6AKIFAcEe32mhpN+MRmVBfWPMjKo283lguBNsRnZLjHoa YipOD8XEiUxfg9YRzYidZVwg3fnTjbcny9miaMav+hwoCm7VTWmBg4DzvU7YV4tojhfkpglsw31 y+BEyUBr5jZkQprI8dXAHIQIKzUoNl4azCbazrjz6gLY1OTFZOuFGhnyjz0INLxBrdjtFzO+fRm bsVltIIvYi9Pyw4RjrCbtDMLGr4yWr7TiQyog/YUZBhIBTWJYhqAU2Ime4BSX+y4HB/NY5haLtQ U6Gy5aiVvt+BR/DAiRs2+lqSdiCAmUXfB9iTS82/FBTLySYI/dzG7VQSzlMP/Ncp/+Dd78ZCsmb d7vnKsZyav8G411VqbME9xpc4Vx+oz+AbDhgfQmmhF7qP9NbLVL6z9qXC8L68OWOqDBGiMbaLS9 62Xp2KuXBIuwgVVlddDg9eeez02gCAfKWOQB9LzJJoaDFyOczDu+CRwHyDGMuwWyXr6h3eF88US lqTrtSr9cne/aBqAxldx5+4F6Ssvl5TS5kIOl8ETadsls80EpRQtybXsDkkQRJZ17ZowxF4x+Xi Z+HhG6C6E7ZBg88+VWHMmNXOahGwNfHGEWAziHRmLOB8vgEWmdDfvCr6N9mJvzzZlt1E X-Received: by 2002:a05:7300:fd05:b0:35d:4e41:d2c2 with SMTP id 5a478bee46e88-37968b848d9mr9384417eec.33.1794703713378; Sat, 14 Nov 2026 16:48:33 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Tan Chi , Alistair Francis , Daniel Henrique Barboza , Nutty Liu Subject: [PULL 2/8] hw/riscv: Build device-common only for its users Date: Sun, 15 Nov 2026 10:48:13 +1000 Message-ID: <20261115004819.2586336-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1229; envelope-from=alistair23@gmail.com; helo=mail-dl1-x1229.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703763250154100 Content-Type: text/plain; charset="utf-8" From: Tan Chi hw/riscv/device-common.c is built unconditionally, although its helpers are only used by the virt and server reference machines. In minimal builds without these machines, device-common.c can reference device implementations that are not built, resulting in an undefined reference to gpex_set_irq_num(). Introduce CONFIG_RISCV_DEVICE_COMMON and select it from the two machines that use these helpers. Build device-common.c only when this option is enabled. Signed-off-by: Tan Chi Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Reviewed-by: Nutty Liu Message-ID: <20261101031547.125591-3-tanchi25@mails.ucas.ac.cn> Signed-off-by: Alistair Francis --- hw/riscv/Kconfig | 5 +++++ hw/riscv/meson.build | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig index d89fdfcc8671..f3bf8d159cba 100644 --- a/hw/riscv/Kconfig +++ b/hw/riscv/Kconfig @@ -7,6 +7,9 @@ config RISCV_NUMA config IBEX bool =20 +config RISCV_DEVICE_COMMON + bool + # RISC-V machines in alphabetical order =20 config MICROCHIP_PFSOC @@ -68,6 +71,7 @@ config RISCV_VIRT select PLATFORM_BUS select ACPI select ACPI_PCI + select RISCV_DEVICE_COMMON =20 config RISCV_SERVER_PLATFORM_REF bool @@ -85,6 +89,7 @@ config RISCV_SERVER_PLATFORM_REF select RISCV_IOMMU select RISCV_NUMA select SERIAL_MM + select RISCV_DEVICE_COMMON =20 config SHAKTI_C bool diff --git a/hw/riscv/meson.build b/hw/riscv/meson.build index 957031c07d5c..b60108787dd5 100644 --- a/hw/riscv/meson.build +++ b/hw/riscv/meson.build @@ -2,7 +2,7 @@ riscv_ss =3D ss.source_set() riscv_ss.add(when: ['CONFIG_RISCV_APLIC', 'CONFIG_RISCV_IMSIC'], if_true: files('aia.c')) riscv_ss.add(files('boot.c')) -riscv_ss.add(files('device-common.c')) +riscv_ss.add(when: 'CONFIG_RISCV_DEVICE_COMMON', if_true: files('device-co= mmon.c')) riscv_ss.add(files('fdt-common.c')) riscv_ss.add(when: 'CONFIG_RISCV_NUMA', if_true: files('numa.c')) riscv_ss.add(files('riscv_hart.c')) --=20 2.55.0 From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703806; cv=none; d=zohomail.com; s=zohoarc; b=G+snX6QGyhFKsQ4qAiTS+Iv9MFe9TYPJurAIKUeVfc+DDM6q9oocUdxx53hrdtD+NXvCXyDQQLiqiuJri2U+mvwcjOwapgXdsqAO/a3dwkDj6QEGexVJS3Nze40rSsCkaOfiKkF6Biaj2NobtZNT60biSud0+r2WllNb53eKczE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703806; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Oo2Dv8f31XI0b7mmm/DDkDg0DE0c4E8icbaWAEEMlO8=; b=KcSupmKs5LIpXtlaqur8iyNphrCVl6F3wZQU7fpYRh8/s/rO1qCSxoDuwVium6sLiWMkWsmD7iGoS4g5bOw1w4grekyIXpyRqiKzxBuCc48rDT41fo+5ns9mZgxjH2oLEYZBiUmsh+Pgwb1w/slZ4YAnyooopdlzwldctz70lx8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794703806794418.97773409374156; Sat, 14 Nov 2026 16:50:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQE-0008KC-U3; Sat, 14 Nov 2026 19:48:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQC-0008JA-Dl for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:40 -0500 Received: from mail-dy1-x1336.google.com ([2607:f8b0:4864:20::1336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQA-00016t-Gj for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:40 -0500 Received: by mail-dy1-x1336.google.com with SMTP id 5a478bee46e88-36e795af1d4so1655674eec.1 for ; Sat, 14 Nov 2026 16:48:38 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703717; x=1795308517; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Oo2Dv8f31XI0b7mmm/DDkDg0DE0c4E8icbaWAEEMlO8=; b=mjcLJPUwQjH6GH/wg52Ps+RtxqVBmo7OZvSBY3+s0EKbNkYxawNWKy3p7KHEuIrKfR xOeqWMca/VwajR6E/jmu1CXSl1He/D8ocnnBFpdSACXtZXjD+qknHEJ0GXO/yWUVDatU qWbxWEjIQ3VH+Auw6iEW80uDmLTou+w6rYFGZqbP5qNPkYWGK/8LEeafKlvadK3uoHLN oZEpwbWMpOgBSTaY35JjIuvyyxAKyRgFvUFu/HVv9QInYO55mG22xDFJffEvs//JfCEv f6j9sJ7kwWsvdQbvDCfA8tuE+g0rnfSHWyfkT79HFVzL9rt85pvBOuAV+ouoIDUN9Sw3 HhhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703717; x=1795308517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Oo2Dv8f31XI0b7mmm/DDkDg0DE0c4E8icbaWAEEMlO8=; b=mKBZQUoMgrd3eZoxyts3WU5RC62tOUtNgV7o8CxPKYI/4TJWejmdLhba55//OIOj7v 2hjmyU9nyuXIcIfEn1McPys8STKrXaTw3fpQ/Chp/7NNQ7LHBVNJ3uGxLLwzV7VCO3wL ey8qe0ukmFF2ATZRffioxhgDDus0H6eqPKj1I4O5GMyxk+3KvquHPx3to4stBBxj7xTA FaXs4wI9aTbg54fQdFmt0o7PLpgkknmFJbmofqpoJM11IhDwR+GaRke0nhr7K3zXkn9+ Zyn2qbmy5fCD2aZ9ljSwKJWWhJbqPhzjAWO5/VBMhMKuQsxITSyl/wizV7oSOc14bvSV Am3w== X-Gm-Message-State: APuU4Z9xjR2P6OOVSdchkIjNheH1sHPdtHx0xDBB3UFh+ubvQeh58XR4 4AIP7CL4sc2X76OKWJjFrCWtvIXWAAOTOrcURcEksuX8yIyXLsPdCH7O0vaIAQ== X-Gm-Gg: AYBFou1ZqfN3PGqpwfLZjmgORjUpxkpqoR4n1SIpZSThxSX+S0W1yQ2vhh7HYGTbixQ utNGuCoRgMfdYfd82RclcFR0qpnhBScblSgEmSnprvGa+i01Gt89wVha+lYaMgDaKxCk09haLXx MgY6suNEx7bZZKwJigJuWXAckcv1/cj2V811u25+ivuSmgMPpgoSHK8ZV6zThr8S+Z7SOj+Y/9H p9ewPGBqj9IuAzLF572iIoXfvgkQUf1jx9FK4VpdFsxRpTBeOBBvFM91etX89MfzuwBy/TRMHG/ IxiQtpCLSmNtwMYUdMxqhC1QsBaUMhlD0I36jQhrfbVELGGEyL+sFi4rayX+SkNw1kvflprE1Tj Hf2DsTerVRofWk5jHlS/pz2LetVJlf2u6as8NB0JSL2E+1DVdl25XbJGHTVaQpZ7HPK93bF09WS AnLeLm6KFVqhnkyv7qMhxlHxyKUIQiusAmdc5Vbyd84gDGQA+FAlpeA7FhInp271vQ56kwnEH2A NjndH4gTDI8glA+yedwCUpWvsfbLsK8+mFCvv9DX3aQecOqK9Wdf3a9q2w4giog54+Ch8mrqCcu C4hkYamaGYN7b/HXzFc6FqiOY4MqBJVV3CeOI9VLwCK6qguHcE0HJ95OprRf49K4nhPR X-Received: by 2002:a05:693c:60c1:b0:36a:2473:9b2f with SMTP id 5a478bee46e88-377e1af6414mr9654312eec.23.1794703716492; Sat, 14 Nov 2026 16:48:36 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Tan Chi , Alistair Francis , Daniel Henrique Barboza , Nutty Liu Subject: [PULL 3/8] hw/riscv: Move platform bus FDT creation to machine code Date: Sun, 15 Nov 2026 10:48:14 +1000 Message-ID: <20261115004819.2586336-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1336; envelope-from=alistair23@gmail.com; helo=mail-dy1-x1336.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703808952154100 Content-Type: text/plain; charset="utf-8" From: Tan Chi riscv_create_fdt_socket_aplic() contains a direct reference to platform_bus_add_all_fdt_nodes(), even though fdt-common.c is built unconditionally and CONFIG_PLATFORM_BUS may be disabled. This causes an undefined reference in minimal RISC-V builds without platform bus support. Move platform bus FDT creation to the virt and server reference machines, which both select CONFIG_PLATFORM_BUS. Export a helper to obtain the APLIC node name and remove the platform bus fields from APLICFdtProps. This removes the dependency from the common APLIC FDT helper while preserving the platform bus interrupt-parent configuration. Signed-off-by: Tan Chi Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Reviewed-by: Nutty Liu Message-ID: <20261101031547.125591-4-tanchi25@mails.ucas.ac.cn> Signed-off-by: Alistair Francis --- include/hw/riscv/fdt-common.h | 3 +-- hw/riscv/fdt-common.c | 13 ++----------- hw/riscv/server_platform_ref.c | 9 +++++++-- hw/riscv/virt.c | 11 +++++++++-- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/include/hw/riscv/fdt-common.h b/include/hw/riscv/fdt-common.h index eb9db8278d09..b3b14ada0aca 100644 --- a/include/hw/riscv/fdt-common.h +++ b/include/hw/riscv/fdt-common.h @@ -54,8 +54,6 @@ typedef struct IMSICFdtProps { typedef struct APLICFdtProps { const MemMapEntry *aplic_m; const MemMapEntry *aplic_s; - const MemMapEntry *platform_bus; - int platform_bus_irq; int socket; int num_harts; bool numa_enabled; @@ -129,6 +127,7 @@ void riscv_create_fdt_socket_aplic(void *fdt, APLICFdtP= rops *props, void riscv_create_fdt_socket_aclint(void *fdt, ACLINTFdtProps *props, uint32_t *intc_phandles); /* Caller must free the returned string. */ +char *riscv_fdt_get_aplic_nodename(hwaddr addr); char *riscv_fdt_get_uart_nodename(hwaddr addr); void riscv_create_fdt_uart(void *fdt, const MemMapEntry *uart_mem, int uart_irq, int aia_type, diff --git a/hw/riscv/fdt-common.c b/hw/riscv/fdt-common.c index ce2dcb43b4fb..e90502b1bc65 100644 --- a/hw/riscv/fdt-common.c +++ b/hw/riscv/fdt-common.c @@ -11,7 +11,6 @@ #include "qemu/error-report.h" #include "system/device_tree.h" #include "hw/core/boards.h" -#include "hw/core/sysbus-fdt.h" #include "hw/riscv/fdt-common.h" #include "target/riscv/cpu_bits.h" #include "hw/riscv/riscv-iommu-bits.h" @@ -599,7 +598,7 @@ void riscv_create_fdt_imsic(void *fdt, IMSICFdtProps *p= rops, } =20 /* Caller must free string after use */ -static char *fdt_get_aplic_nodename(hwaddr aplic_addr) +char *riscv_fdt_get_aplic_nodename(hwaddr aplic_addr) { return g_strdup_printf("/soc/interrupt-controller@%"HWADDR_PRIx, aplic_addr); @@ -613,7 +612,7 @@ static void create_fdt_one_aplic(void *fdt, APLICFdtPro= ps *props, uint32_t aplic_child_phandle, bool m_mode) { - g_autofree char *aplic_name =3D fdt_get_aplic_nodename(aplic_addr); + g_autofree char *aplic_name =3D riscv_fdt_get_aplic_nodename(aplic_add= r); g_autofree uint32_t *aplic_cells =3D g_new0(uint32_t, props->num_harts= * 2); static const char * const aplic_compat[2] =3D { "qemu,aplic", "riscv,aplic" @@ -695,14 +694,6 @@ void riscv_create_fdt_socket_aplic(void *fdt, APLICFdt= Props *props, aplic_s_phandle, 0, false); =20 - if (!props->socket && props->platform_bus_irq) { - g_autofree char *aplic_name =3D fdt_get_aplic_nodename(aplic_addr); - platform_bus_add_all_fdt_nodes(fdt, aplic_name, - props->platform_bus->base, - props->platform_bus->size, - props->platform_bus_irq); - } - aplic_phandles[props->socket] =3D aplic_s_phandle; } =20 diff --git a/hw/riscv/server_platform_ref.c b/hw/riscv/server_platform_ref.c index 5f485b1c79cb..3526c80d7947 100644 --- a/hw/riscv/server_platform_ref.c +++ b/hw/riscv/server_platform_ref.c @@ -192,6 +192,7 @@ static void create_fdt_sockets(RISCVServerRefMachineSta= te *s, { int socket, phandle_pos; MachineState *ms =3D MACHINE(s); + g_autofree char *aplic_name =3D NULL; uint32_t msi_m_phandle =3D 0, msi_s_phandle =3D 0; uint32_t xplic_phandles[MAX_NODES]; g_autofree uint32_t *intc_phandles =3D NULL; @@ -251,8 +252,6 @@ static void create_fdt_sockets(RISCVServerRefMachineSta= te *s, aplic_fdt_props.aplic_m =3D !kvm_enabled() ? &memmap[RVSERVER_APLIC_M] : NULL; aplic_fdt_props.aplic_s =3D &memmap[RVSERVER_APLIC_S]; - aplic_fdt_props.platform_bus =3D &memmap[RVSERVER_PLATFORM_BUS]; - aplic_fdt_props.platform_bus_irq =3D RVSERVER_PLATFORM_BUS_IRQ; aplic_fdt_props.num_harts =3D ms->smp.cpus; aplic_fdt_props.numa_enabled =3D numa_enabled; aplic_fdt_props.irqchip_num_sources =3D RVSERVER_IRQCHIP_NUM_SOURCES; @@ -270,6 +269,12 @@ static void create_fdt_sockets(RISCVServerRefMachineSt= ate *s, xplic_phandles); } =20 + aplic_name =3D riscv_fdt_get_aplic_nodename(memmap[RVSERVER_APLIC_S].b= ase); + platform_bus_add_all_fdt_nodes(ms->fdt, aplic_name, + memmap[RVSERVER_PLATFORM_BUS].base, + memmap[RVSERVER_PLATFORM_BUS].size, + RVSERVER_PLATFORM_BUS_IRQ); + for (socket =3D 0; socket < socket_count; socket++) { if (socket =3D=3D 0) { *irq_mmio_phandle =3D xplic_phandles[socket]; diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 8bc5a7b0728c..ffd6e8868f70 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -296,8 +296,6 @@ static void create_fdt_sockets(RISCVVirtState *s, if (s->aia_type !=3D VIRT_AIA_TYPE_NONE) { aplic_props.aplic_m =3D !kvm_enabled() ? &s->memmap[VIRT_APLIC_M] = : NULL; aplic_props.aplic_s =3D &s->memmap[VIRT_APLIC_S]; - aplic_props.platform_bus =3D &s->memmap[VIRT_PLATFORM_BUS]; - aplic_props.platform_bus_irq =3D VIRT_PLATFORM_BUS_IRQ; aplic_props.socket =3D 0; aplic_props.num_harts =3D ms->smp.cpus; aplic_props.numa_enabled =3D numa_enabled; @@ -353,6 +351,15 @@ static void create_fdt_sockets(RISCVVirtState *s, } } =20 + if (s->aia_type !=3D VIRT_AIA_TYPE_NONE) { + g_autofree char *aplic_name =3D + riscv_fdt_get_aplic_nodename(s->memmap[VIRT_APLIC_S].base); + platform_bus_add_all_fdt_nodes(ms->fdt, aplic_name, + s->memmap[VIRT_PLATFORM_BUS].base, + s->memmap[VIRT_PLATFORM_BUS].size, + VIRT_PLATFORM_BUS_IRQ); + } + riscv_socket_fdt_write_distance_matrix(ms); } =20 --=20 2.55.0 From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703773; cv=none; d=zohomail.com; s=zohoarc; b=kVGFb5qYCL8LsBE3LOSuD98X5Q4X1g/y/4cJwD4Qd6I60cN9RVtjcDoUNyeanpcQkU7x4B2ZhpQ2fCmNeQ9v/pFoDOIV3isbyHWKV+59BHMD0J7syBPR1Jpwg1P4DNGTOliBGv7ZrUBDLkm2Xa4PQ4ZNW1zLbvjn0o/s0/pEyk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703773; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RrbCTmuYz05ZihDwfRnJi31ets07yrwrVtDlvFAiHy4=; b=PGtvuiBVlnnqMscB8CmqXl2JLssqZMYze3Rj0pkgRehvzXRx6dD+83LomgRhbSVhcAfutcT6ioBaGSPCl/l9219zgEG4UVSHu3dgoHQ90gfqheLWt0tpwR0zCYy183hNeemlXeADBLuD2Rfbx82MuX9EqfrmjyqfDoH9FOK1ieg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794703773296734.5015407512415; Sat, 14 Nov 2026 16:49:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQG-0008MT-87; Sat, 14 Nov 2026 19:48:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQE-0008KG-Td for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:42 -0500 Received: from mail-dl1-x122f.google.com ([2607:f8b0:4864:20::122f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQD-000172-1M for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:42 -0500 Received: by mail-dl1-x122f.google.com with SMTP id a92af1059eb24-1b3b4bcbfc9so2396614c88.1 for ; Sat, 14 Nov 2026 16:48:40 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703720; x=1795308520; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RrbCTmuYz05ZihDwfRnJi31ets07yrwrVtDlvFAiHy4=; b=QRHQT0uwLMVc4vKDo0x9DLWMY9gsCrTK8aMM6+IB03SzVJ8T60eTuwcautTydGhndH sRAFJ+VmzMmliGjREWFX3T4srgj3sbfN7bfAcZE9c5AYQBncBYJR9opGoZAtQUGoebAl s+WryOx5UJhiAF8Dt/OPe8Y+60zILVPstKgaq3VKgTckfbafT5RI5n8PSte+S/t9PbQh Q9E4eMjQSSGFcaz+ZyWxzvg91z3B4VbF1NCbkbShizjE3HWGWZUdkspUsCOsCpddr9JW DG8p093QO0xjNYbfOXF25Vk+u9s3lpsC73noukfBH39CwMQImn6dpd9A4DMAEAQaGvDS RBUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703720; x=1795308520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=RrbCTmuYz05ZihDwfRnJi31ets07yrwrVtDlvFAiHy4=; b=M1LaptfLd/lMd7ej9Wxh86Z0UKZJiMokWQ1UuawbiMt8p3lqcJjUTAjYLfJvEOsS16 UMbRY7qdLYM973ioEBWBcXHKoj3oORH4aZUgS9YVSwtvEZdZkKpBEIAYPsza65jkLpyy 3IqZsoSQHrD/5i8F/QrqeYciRJoYPUJ5t3epzaRAkNEneDca67nLTr+Gns+L2h0LImVd pBP2SbW/WoVkmWBOgL2K09uBl+cnqDuqS45XQnWJHn7gGapdLNhRLJJTAVMRWjxo/4S9 Z3zNgsD/4VuWxH6HvivUfmFwozHaZGi02ub2VPDH+ZGp+STg7wzEZVfDebPH1kbeGEcf IdEQ== X-Gm-Message-State: APuU4Z9YHOGPY8C2ezcmblnA6Fq28PDOtzYB04yfqs3Vyq/xTH9pu6BW uToaRdX7a8NR2zwrl22mEs8HztR/CoHILFfE29IQnKbMjqhDHkzRD/p3okLdpw== X-Gm-Gg: AYBFou050Tz6QF2dunT3pVSN7yIxJfAwkT+30AQiMm/HZonGAhPC1fYkpcV+62kJmS1 2DYB7UpcYOPXrQHeIwdi8Qbewf6ARkGwyiVfje2HiKIUJ131aK2ZnM0SsT3tDRS0qRR8d5gK9In scl8Ocd7JMrsj7LuZnuFxPWKjT25Dc6HEtfSg7L/UQ2BMhayJivYPo7kQ32zMuTiiwX80zhY0eN RJwN1rowDUCE7VRm8AX7oMX0Y8/8Oe+cMeNfkIWG+9P0Eydg3v073Ha/mIWprhXdhCpkJVnECjK 7rzBPqQeC7wRzdxyLciQ4RX9EQ5SAf8Bu2cZ86+t7w9GcP1N5Fpt12HiSzqfbAHV0uYSgjylUjc uD2rpIRnAul1nvuy9Ul2Mr75KjM2clr+Zvy6hSNb/7I+VyG+eeiHX2gBr+RSC2p8usCrvoM6fDw s7Sh7mWlKDVUOtLyptriaXwQ6ytu/2GEDe4zyA+rHX8fEaGad+N3m+mHutXxuj94/y1GP2WrTHa hFI6miXzpnRoop0/Q1Z1l1d6/RT43PMrskAnjH9I81ckMelHs0ig38wOHnj8GJwJ6siQzUdm+Pf nqfQ3veHAYljwy+KcktpFsYePNI31pGM/hmbkBHS88bLYT6c X-Received: by 2002:a05:7022:2390:b0:18d:96e8:b913 with SMTP id a92af1059eb24-1b503195191mr9629314c88.47.1794703719546; Sat, 14 Nov 2026 16:48:39 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Tan Chi , Alistair Francis , Daniel Henrique Barboza , Nutty Liu Subject: [PULL 4/8] hw/riscv: Pass socket topology to KVM AIA Date: Sun, 15 Nov 2026 10:48:15 +1000 Message-ID: <20261115004819.2586336-5-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::122f; envelope-from=alistair23@gmail.com; helo=mail-dl1-x122f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703774409154100 Content-Type: text/plain; charset="utf-8" From: Tan Chi KVM AIA initialization uses the RISC-V NUMA helpers to query the socket count and per-socket hart topology. However, KVM support can be enabled without CONFIG_RISCV_NUMA. In this configuration, kvm-cpu.c is built while numa.c is not, resulting in undefined references to riscv_socket_count(), riscv_socket_hart_count() and riscv_socket_first_hartid(). The virt machine already determines the hart topology when initializing its hart arrays. Pass the socket topology directly to KVM AIA instead of querying the NUMA helpers again. This removes the build-time dependency on CONFIG_RISCV_NUMA without changing the IMSIC address configuration. Signed-off-by: Tan Chi Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Reviewed-by: Nutty Liu Message-ID: <20261101031547.125591-5-tanchi25@mails.ucas.ac.cn> Signed-off-by: Alistair Francis --- hw/riscv/aia.h | 5 +++++ target/riscv/kvm/kvm_riscv.h | 5 ++++- hw/riscv/virt.c | 10 +++++++++- target/riscv/kvm/kvm-cpu.c | 10 +++++----- target/riscv/kvm/kvm-stub.c | 3 ++- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/hw/riscv/aia.h b/hw/riscv/aia.h index e4dcc5aae09c..ed9b613f3c80 100644 --- a/hw/riscv/aia.h +++ b/hw/riscv/aia.h @@ -12,6 +12,11 @@ #include "exec/hwaddr.h" #include "qemu/bitops.h" =20 +typedef struct RISCVAIASocket { + uint32_t hartid_base; + uint32_t num_harts; +} RISCVAIASocket; + static inline uint32_t imsic_num_bits(uint32_t count) { uint32_t ret =3D 0; diff --git a/target/riscv/kvm/kvm_riscv.h b/target/riscv/kvm/kvm_riscv.h index aef681f0a212..bad78e28f453 100644 --- a/target/riscv/kvm/kvm_riscv.h +++ b/target/riscv/kvm/kvm_riscv.h @@ -21,6 +21,8 @@ =20 #include "target/riscv/cpu-qom.h" =20 +typedef struct RISCVAIASocket RISCVAIASocket; + void kvm_riscv_reset_vcpu(RISCVCPU *cpu); /** * kvm_riscv_set_irq: @@ -29,7 +31,8 @@ void kvm_riscv_reset_vcpu(RISCVCPU *cpu); * @level: %0 to clear the interrupt, non-zero to set it. */ void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level); -void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, +void kvm_riscv_aia_create(const RISCVAIASocket *sockets, + uint32_t socket_count, uint64_t group_shift, uint64_t aia_irq_num, uint64_t aia_msi_num, uint64_t aplic_base, uint64_t imsic_base, uint64_t guest_num); diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index ffd6e8868f70..dceb3ff55e17 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -859,7 +859,15 @@ static void virt_machine_init(MachineState *machine) } =20 if (kvm_enabled() && virt_use_kvm_aia_aplic_imsic(s->aia_type)) { - kvm_riscv_aia_create(machine, IMSIC_MMIO_GROUP_MIN_SHIFT, + g_autofree RISCVAIASocket *aia_sockets =3D + g_new(RISCVAIASocket, socket_count); + for (i =3D 0; i < socket_count; i++) { + aia_sockets[i].hartid_base =3D s->soc[i].hartid_base; + aia_sockets[i].num_harts =3D s->soc[i].num_harts; + } + + kvm_riscv_aia_create(aia_sockets, socket_count, + IMSIC_MMIO_GROUP_MIN_SHIFT, VIRT_IRQCHIP_NUM_SOURCES, VIRT_IRQCHIP_NUM_MS= IS, s->memmap[VIRT_APLIC_S].base, s->memmap[VIRT_IMSIC_S].base, diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 5beb60233809..32f18a1589fe 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -48,7 +48,7 @@ #include "sbi_ecall_interface.h" #include "chardev/char-fe.h" #include "system/runstate.h" -#include "hw/riscv/numa.h" +#include "hw/riscv/aia.h" =20 #define PR_RISCV_V_SET_CONTROL 69 #define PR_RISCV_V_VSTATE_CTRL_ON 2 @@ -1930,7 +1930,8 @@ void kvm_arch_accel_class_init(ObjectClass *oc) "auto"); } =20 -void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, +void kvm_riscv_aia_create(const RISCVAIASocket *sockets, + uint32_t socket_count, uint64_t group_shift, uint64_t aia_irq_num, uint64_t aia_msi_num, uint64_t aplic_base, uint64_t imsic_base, uint64_t guest_num) @@ -1938,7 +1939,6 @@ void kvm_riscv_aia_create(MachineState *machine, uint= 64_t group_shift, int ret, i; int aia_fd =3D -1; uint64_t default_aia_mode; - uint64_t socket_count =3D riscv_socket_count(machine); uint64_t max_hart_per_socket =3D 0; uint64_t socket, base_hart, hart_count, socket_imsic_base, imsic_addr; uint64_t socket_bits, hart_bits, guest_bits; @@ -2039,8 +2039,8 @@ void kvm_riscv_aia_create(MachineState *machine, uint= 64_t group_shift, =20 for (socket =3D 0; socket < socket_count; socket++) { socket_imsic_base =3D imsic_base + socket * (1U << group_shift); - hart_count =3D riscv_socket_hart_count(machine, socket); - base_hart =3D riscv_socket_first_hartid(machine, socket); + hart_count =3D sockets[socket].num_harts; + base_hart =3D sockets[socket].hartid_base; =20 if (max_hart_per_socket < hart_count) { max_hart_per_socket =3D hart_count; diff --git a/target/riscv/kvm/kvm-stub.c b/target/riscv/kvm/kvm-stub.c index 64e39c96d893..f92916162804 100644 --- a/target/riscv/kvm/kvm-stub.c +++ b/target/riscv/kvm/kvm-stub.c @@ -9,7 +9,8 @@ #include "qemu/osdep.h" #include "target/riscv/kvm/kvm_riscv.h" =20 -void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, +void kvm_riscv_aia_create(const RISCVAIASocket *sockets, + uint32_t socket_count, uint64_t group_shift, uint64_t aia_irq_num, uint64_t aia_msi_num, uint64_t aplic_base, uint64_t imsic_base, uint64_t guest_num) --=20 2.55.0 From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703777; cv=none; d=zohomail.com; s=zohoarc; b=Hm+6Q9AogSzrNYN705Wb70IQdzfNI2Ww+tlvG6jxemwckc/asRfrn20YKRy1F99/Fa9TCtw5CKykB/XJj+juGsC4Nmzd6Hmo4rW6xD1lUPwVJr+Xy2RO+fCK3lyLQZQFQB5uo0Dusyb3/Slk/eXrzg32WKkkJWGP/NsWlIbMl98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703777; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Xjgo6KQJSS+b+bdZzT2EkMy778ORLKBtElCHB3931Zw=; b=XMtynyrY3F8WcqC9FVGTQCyvD62PH70SxTHNbUY4tYpVgdiS9Qi7Wb7pEu2Xn9y9RxNopfra+1vM2vUERjS0d6wfrhkIouaqwFgv3MKWwzHieFSbitGBxHGCyJvSdOtCOKq9LxYbiK8W3kLaIw+qZB2/a25R2ifertbWEZZWrr8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794703777870388.9406357667468; Sat, 14 Nov 2026 16:49:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQJ-0008S5-NQ; Sat, 14 Nov 2026 19:48:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQH-0008Q0-Fh for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:45 -0500 Received: from mail-dy1-x132c.google.com ([2607:f8b0:4864:20::132c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQG-00017N-1T for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:45 -0500 Received: by mail-dy1-x132c.google.com with SMTP id 5a478bee46e88-37d424f1ae8so492288eec.1 for ; Sat, 14 Nov 2026 16:48:43 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703723; x=1795308523; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Xjgo6KQJSS+b+bdZzT2EkMy778ORLKBtElCHB3931Zw=; b=t6sIhQAAo2FvGLMHSk4SKOy5CoYzVPd/9eyL2yaYFVx4GQci8Zm7Cs9o/DpaV+Cvqr ajtjjKuMQbLvm1jljx1SnycsrYfTPL9rL9eU7K1gcKD8iGMOe8nDhABItxcLKhINs61J V+Ln0LjD3Z8c3yFcxEyx32iUU0aeGydMYJjNsqjad49+/4H8EIvgMVWBTNHDc1/eeRkk 4zqLZgBAVZClXurd5Qy1fo4brcW3tYkKLD7iYeng+HPBig/2CBc/K5Xsgb1qoZCV6XW1 g6L5NgxjMhZFNRGxf26McHeVi1jeGURE3cU6SEFr8DjjxVhRE1MdUbBH1YXU+8KA5tYb OQGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703723; x=1795308523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Xjgo6KQJSS+b+bdZzT2EkMy778ORLKBtElCHB3931Zw=; b=f3C0lw1qpnAJvx2mjY/P8jKCRfe/WuwBtXZCHhBcBX716nDfEJwi/j1/ZGn3Mh9gxP Sfd/W8hlhUq/z0pDV5g02xI8sBsvnnJAC5y1AKEeXgBQJyA5i8czUdgiv5o750/iVr/o FGsIIMl+aVZWmUj7PpHi5eaWW45A2+QiL0TEwH7pqf2fZ3dyzag2wn4y8zzh8DupDGGB ufMYRQFvCP9r+FvTES9B/GX7UyRq+QGlCoU+PIumzIFk+R9GSdwgke9VZR9oKqL3eULX lcezdhaX6UGYqONXh7wBYP3XqFA8wwsqN+mx4VR3pRwyyZyxi+O46s7qusD07sCtglGN GBUQ== X-Gm-Message-State: APuU4Z9xIu/2xcEMoh5uYUiD6iaYPHIZShRNpEr7dH7WuxaBxO0uKzRA VWWpJdL0LAqpj8C0e9WuRUyVYmCElriEVEiuopSHpqmsGBpgwo5QzSz152ocVA== X-Gm-Gg: AYBFou19rp1tE7Q+w32ezUlsJEOEc9S+tIlKeyS2RDmmxHd61NLAueU4xYhBzuP81VF leKgWW1sc5Gh3tAL0OBMAUw1J6RuO0M38U8WRkLITGfc10E5RmPs0v1yM7zL7mZRK2eTBvjzu+S duVEP+ZxNfF/skYKrc5qpiO8Hwp8q/4qcLTNt39C+JR52jmlH79bTfT09bT0Kd7cgrPELk78Qw4 T8ksGCEEClxyQa1tRODwMyAdx+ADz8/gR7WSkaBvcXtxVsUfpd20AFMR3+d6uIusTg2CpSzL2Xa lGmr+gwTq/50lZfRPiT45n8PZoC5Dj2jxQ9DqWXtBOBeT1sxfATB53DinSUw/dg3am4RjsJKkn7 0oWVFvaN2U5ZHii8ZWHa7tkUiMd0TuGIFTWD8mP9Z3ANP5vKuEUf8nKR/vZ/vP7gMo8wHt0Yr/9 LcBIxxyWyuaM+xv0lKZj7Dc/qmHRVNe3g/BGKn0JSJWyhW0o+vOxbGKV6633dwcmSB9mRg72Gz5 qOU+ZzTVtXlXDCwJlmIDFee26/nrvKUnabCtvvK+KD5qtbJqrhCiNGmjvJrcIBPihFnmvO2UBjE 1MdidAZ0j26BZ9LQ/T00XJ4QeyPyXe4WUYASVVy8pThycRo= X-Received: by 2002:a05:7301:1705:b0:36e:c9e5:33aa with SMTP id 5a478bee46e88-37965f9ea5bmr6142125eec.13.1794703722543; Sat, 14 Nov 2026 16:48:42 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Tan Chi , Alistair Francis , Daniel Henrique Barboza , Nutty Liu Subject: [PULL 5/8] hw/riscv: Select SSI for IBEX Date: Sun, 15 Nov 2026 10:48:16 +1000 Message-ID: <20261115004819.2586336-6-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::132c; envelope-from=alistair23@gmail.com; helo=mail-dy1-x132c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703780872154100 Content-Type: text/plain; charset="utf-8" From: Tan Chi The Ibex SPI host controller uses the SSI bus infrastructure, but CONFIG_IBEX does not select CONFIG_SSI. This causes undefined references to SSI functions, including ssi_transfer(), when building a minimal RV32 OpenTitan target without default devices. Select SSI from IBEX to ensure that the required bus implementation is built. Signed-off-by: Tan Chi Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Reviewed-by: Nutty Liu Message-ID: <20261101031547.125591-6-tanchi25@mails.ucas.ac.cn> Signed-off-by: Alistair Francis --- hw/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig index f3bf8d159cba..807fcaaf280e 100644 --- a/hw/riscv/Kconfig +++ b/hw/riscv/Kconfig @@ -6,6 +6,7 @@ config RISCV_NUMA =20 config IBEX bool + select SSI =20 config RISCV_DEVICE_COMMON bool --=20 2.55.0 From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703818; cv=none; d=zohomail.com; s=zohoarc; b=OReq/aJ5hd+x2wNs0Q1gBwzXOmZLQiy+1gkKacTNrVK3y2tEIXIsN+mGOetZOQVaNXtVseTpvKt0UYnCJTXfeFfIQdpd+HPl4PStvIYd5gfLwxXg2B85rPU/ufk1lZFP4jSVH+qWbztJwN9xIoAo3wpCS0VHkcVYLrbeBC39jaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703818; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=O1ZiKeTgLj5e7Scr4eBfCPFcfIz4yTLG1STw6Gr4XIk=; b=XlTx/Can1r5Nq+/kcl85QUmIs3SRCnDmIpYUV9u2Kt+eza+l2SDWA5rvTF8HyXkv7x0SZ8ZPd/JNSYKh5u1Fw0m1Y+Xfy+NZRU+e/WdR/vQFTVEBJ5vNALUr3DH/mlnV6WIlrBU8OqDi1dPlAJsDOi1eVQfmjB6We0LlqCYMUGc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794703818449838.9846481105328; Sat, 14 Nov 2026 16:50:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQM-0008Vc-4h; Sat, 14 Nov 2026 19:48:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQK-0008Uh-So for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:48 -0500 Received: from mail-dy1-x132f.google.com ([2607:f8b0:4864:20::132f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQJ-00017a-7B for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:48 -0500 Received: by mail-dy1-x132f.google.com with SMTP id 5a478bee46e88-36a315ed211so2184853eec.0 for ; Sat, 14 Nov 2026 16:48:46 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703725; x=1795308525; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=O1ZiKeTgLj5e7Scr4eBfCPFcfIz4yTLG1STw6Gr4XIk=; b=CAErN2xm2AWQd1YOD1pN8ktxqUZrDeM+sglsceNfcTqcKopxBvTBQGiWd3XXS5JWD1 g9PUv3NP6HEHkFzhNkvH5l93w+i2F1lwI2K+Y+w8kLe/Rd11EA9H41q7dNDqU4cl0Xkb NE6u6tfiJkhiSk7oi6ht2Okcmx0VQZnPNYeoRIU5zkDwIWvaZpXT8EhwAfazRmVtSy4p i8HLEBz0GbVGwj8c2WBEaVJN5/yewaFa7POeN8/joIlTPHMbY49Oz2fMkzDerH+MFuO0 29J2DEzt2WUHrqzgZHnMv+my4LYuZU8Ao7FJAKsyE/RYXkILZUl48A5ZOILFp0mbI8Td Ud8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703725; x=1795308525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=O1ZiKeTgLj5e7Scr4eBfCPFcfIz4yTLG1STw6Gr4XIk=; b=C+ovs09rzSL5AefOMWnGga7aWAHtuBNTSuJ7MmQnxILWNuNha3qk379iFwOWaRbS7H bET8WHwAct0vVIeb7Miw95GWBHiLeEDenNUVrojs4Nf0y+kaLs627rxH9yv42FSVsad5 GOFXhQFjr0T+WcQBOBw59L2masobSKASy8vxh9zYBg13GvBjcIhvAZAFcJmjYYiPYU2g /LCYsxkAF2mBMBgBPLItJIBoa7hzvVnmW7nerqsqHQ+/Nxev+j0DTNqB76wPQ28A4Kwx jBXy4EtTeSvI1iIOP7pxMK2CAXxR4Wm6J12PYxcEifrPjYePbCWx/0HmuWbjGAXJeiCB 42Iw== X-Gm-Message-State: APuU4Z8Q9F9EXsPDNJgD3f7nSsvcPqRPUdX12qBwSJoVZ3waF3vA1kAA YOiUmpd3NYSfVvaygxfj4wPMXHGFRcRBNC15aFIBaUn4P2+3kj5O726KycjIUQ== X-Gm-Gg: AYBFou3wHNi7R2tvcdxLJLQn+BmEy3EUeDVuX1P05aTwl+TJjASYj8r63jfo5Pbco3O W+DdojT+6cW0aRnlaIZknoiv0LPLuZ6AjVfPhkzQxIaQiBL4t9rVqJiBcx9e1h9H5SpBaMWHBt8 Dy7Pm7JyfTtb4z9lyds1QtSF3hRKD5Ut75jhSJECIWLghZ3cU9Y4uBzebrAH+qH9gPv9551I2aM NoUvciq1Bh4BxwtKVYvwhXNFhIWuNa61Ncz/D04AZy9gx/4fAUbjagrl8jKZKvB3FMuLWsUz9Ml KMAqXVRAroQfBTUte8HS8lr5dtrQ0XNVNkBVklNWjSa4S5pnT2qzCrR81moL5+2ALh6sHLC7YPW 4edGzkHt4F/SGgcERu5cGDhOjB5u6RONdF2nOZWTMQeFmwov0rTvNZjtilv6caHVeMbgdKoV9lE 1OQcZrtMcDeNTCnJa8URz9WuGtC1VIAvj6c3QFb//V/K77l/b9ZrXMiGB1kx0dDVPtByIe0yKrM Z1tA+K5mBx7rCm/iGUpIfRAZ8FgWqrqOkSmRGuxIf1kY8GZbXO25/BF5WximENawRJE87JAixbH M/HuPSm8ahJc8sUux5rpPlKZN/Tujs5rPrK4JOtFwYJFgPE= X-Received: by 2002:a05:7300:148c:b0:361:a195:c46e with SMTP id 5a478bee46e88-377de5f761amr13657300eec.1.1794703725060; Sat, 14 Nov 2026 16:48:45 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Alistair Francis Subject: [PULL 6/8] hw/intc/riscv_aplic: Check config value bounds in realize Date: Sun, 15 Nov 2026 10:48:17 +1000 Message-ID: <20261115004819.2586336-7-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::132f; envelope-from=alistair23@gmail.com; helo=mail-dy1-x132f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703820992154100 Content-Type: text/plain; charset="utf-8" From: Peter Maydell The riscv aplic interrupt controller has various configurable properties for things like num-harts and num-irqs, which have architectural upper limits. Currently these are checked in riscv_aplic_create(), by assert(). QOM devices should check this kind of thing in their realize method, and fail realize for out of range values (which in this case will cause riscv_aplic_create() to make QEMU exit with an error, since it uses &error_fatal). This isn't a problem currently as no SoC creates and configures the TYPE_RISCV_APLIC device itself, but it avoids one for the future. Move the checks to the realize method. This requires slight adjustments in some cases because: * property num-irqs is set to num_sources + 1 * property iprio-mask is set to (1U << iprio_bits) - 1 Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis Message-ID: <20261022204223.854640-1-peter.maydell@linaro.org> Signed-off-by: Alistair Francis --- hw/intc/riscv_aplic.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c index 03a0852b8b88..b29a22a455a1 100644 --- a/hw/intc/riscv_aplic.c +++ b/hw/intc/riscv_aplic.c @@ -954,6 +954,32 @@ static void riscv_aplic_realize(DeviceState *dev, Erro= r **errp) uint32_t i; RISCVAPLICState *aplic =3D RISCV_APLIC(dev); =20 + if (aplic->num_harts >=3D APLIC_MAX_IDC) { + error_setg(errp, "num-harts must be less than %d", (int)APLIC_MAX_= IDC); + return; + } + if ((APLIC_IDC_BASE + (aplic->num_harts * APLIC_IDC_SIZE)) > + aplic->aperture_size) { + error_setg(errp, "aperture-size 0x%x too small for num-harts %d", + aplic->aperture_size, aplic->num_harts); + return; + } + if (aplic->num_irqs > APLIC_MAX_SOURCE) { + error_setg(errp, "num-irqs must be less than or equal to %d", + APLIC_MAX_SOURCE); + return; + } + if (!is_power_of_2(aplic->iprio_mask + 1)) { + error_setg(errp, "iprio-mask must have all lower bits set"); + return; + } + if (aplic->iprio_mask < ((1U << APLIC_MIN_IPRIO_BITS) - 1) || + aplic->iprio_mask > ((1U << APLIC_MAX_IPRIO_BITS) - 1)) { + error_setg(errp, "iprio-mask must specify between %d and %d bits o= f " + "priority", APLIC_MIN_IPRIO_BITS, APLIC_MAX_IPRIO_BITS); + return; + } + if (riscv_use_emulated_aplic(aplic->msimode)) { /* Create output IRQ lines for non-MSI mode */ if (!aplic->msimode) { @@ -1119,12 +1145,6 @@ DeviceState *riscv_aplic_create(MemoryRegion *contai= ner, DeviceState *dev =3D qdev_new(TYPE_RISCV_APLIC); uint32_t i; =20 - assert(num_harts < APLIC_MAX_IDC); - assert((APLIC_IDC_BASE + (num_harts * APLIC_IDC_SIZE)) <=3D size); - assert(num_sources < APLIC_MAX_SOURCE); - assert(APLIC_MIN_IPRIO_BITS <=3D iprio_bits); - assert(iprio_bits <=3D APLIC_MAX_IPRIO_BITS); - qdev_prop_set_uint32(dev, "aperture-size", size); qdev_prop_set_uint32(dev, "hartid-base", hartid_base); qdev_prop_set_uint32(dev, "num-harts", num_harts); --=20 2.55.0 From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703774; cv=none; d=zohomail.com; s=zohoarc; b=gMyQkQUajtwqoZSvM4a5kc+HHGw+wUz6t9FaksXUgbWqKEZ1IHcw+jCcNUFSiUVkVmrgl5XDW1n7jOmKK4drhtIu+fw7m1QAgkIH0BZhbJ3gXaMy+aFUBj87wDJXTzotwuHbaG8PHctkYrqAWryTn+t8Fif/XhJW3+Vt0hg61q8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703774; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8o6DosXQmVuLdfzqPB19mDNYoMjjsir5bC1ZQdkSNDM=; b=fgF/UWzpUGDFg2m10QbaSWO3FB1nsEz58hM95S3KMSDTeVnZFzA9krQMtNc2xHchuSZXFOH+FlMYPPjp1Bp9hg9CdwyRYjd3MXKcaV23rSHiBg3MAgg/Iq68PeBgTRJ3JZmlGO67hCMgoMz3M5uHnwpaGmXjvsMelwF/rnJSP4k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794703774720297.9725390588626; Sat, 14 Nov 2026 16:49:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQO-00005E-DK; Sat, 14 Nov 2026 19:48:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQM-00004z-Mx for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:50 -0500 Received: from mail-dy1-x132e.google.com ([2607:f8b0:4864:20::132e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQL-00017n-77 for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:50 -0500 Received: by mail-dy1-x132e.google.com with SMTP id 5a478bee46e88-36e99cf7bb3so2966739eec.0 for ; Sat, 14 Nov 2026 16:48:48 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703728; x=1795308528; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8o6DosXQmVuLdfzqPB19mDNYoMjjsir5bC1ZQdkSNDM=; b=bIZVRBxQy5skzizRqKE9J06aSPnV47zUTpKV78ulg96E7RKAnldvdW0G/cRIyE9SGm qzPO1BGmApH2vHb76K5yRKbeuUtb4ysXe4BG84URFhfJMmGkARgjcezQe5M7QXV0In1h xpD0Xi2rjk2l8DWHCpbA8d9NoS5mwNPTnLbrik4sCs8iBg3qQ4o2CL3XlToIFRTbjWBj lc91aIK2FLf4yjcpBTZ46pOTijrq9I5vZD3QdOydDpMHSYouxyi57jNpOMKzNicwjEOH 9xUwCBzQbiG91CiRKYQ15ILPOiPfpL7Is/fK7u/odmkXCKiBRtiaCN6tNdEI5JSo4qyK sIcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703728; x=1795308528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=8o6DosXQmVuLdfzqPB19mDNYoMjjsir5bC1ZQdkSNDM=; b=fArrH88ZYuaZRymOVML+iZdj5sGK/VUceu6WsLoBLWGwNmzM1mKFxTcQH0Loqersyr w679Bogy/PUJGoEtKkeVqkqKBw8I8gxUk+E/DBoID8gQiIGWxMXijrO/YHaTkoTQmof6 WGF0YUaeSBpAlphwIWxqszc8Ou5sb3pj051H5UBmj0QcYoAFvMexXlH5G3fwXdjHZZ3/ aNB4Qs1xctjhE7BZE3bmaFxOm9DXizTYR5hHSgL9JYimDgZibMEAHbjSL4nIT4ldri7I AL8KyPQ1bbU7AN57pL1mNPm2u8C9BNlaKtdQPIPIpFe0Eao3gzp1sloC/ydBiCDrY6CI wsjA== X-Gm-Message-State: APuU4Z9m0tM3o4YpG0JqWR+NfaHU3hS8cKmbCt6ndQDMZ9MAPdco+Qbb UjSYXKsccDPGYNqnebyU7K/+uUrYLTTIO0esB1sIa0sf70BIxeulaKk5jIDFJg== X-Gm-Gg: AYBFou2nSxut5wmbXBZ82MvLwNs6bJQvRtcvYC3ADhQb9CGZClyAJkZcBq6xr15kJSh VJmgdVLi/WIOGXgRcq//JQk3MoT42oP2bRKgrI+xP8aWaYPoU4jOvMhnwuFE6gddagJInemgSXi 8+x8axwqAK523wviecL6GBWZTvwpQiU13Qk2DgKXN1o/oKa6Gwa6xV7DyX4VLFUBVQ/fLyF+naR ECicyU1eoyXEKwIPNVa9m4Kv6psiaw1Vjf7lkrjFghjt5WA1O24WVTOAJT/NLGfGQWqn3qDjoj4 drJdqdBYAq2buNh4lmClr7vTjmQuL90cCh2i5O0Lfh7W99i7wgSaFA1SckxAybEpNkhkwF0yKms LgioVBsBwHn+fQi3l23y6oswwKfqLGJ1aPbYdSXcz6C78dAsoFOvoBqdDsG6o23T4xZgQQVO/sI 3oBMKF+DY67CJE+jdOnzC5BvtFIFn5Kl9jb3CU0Ey5qCWYP1P/SWLVU7N2sCKdzKSwvSSIA/UHJ Pm+Z67DprAY/1umYWDxkwiTQW/WepZm3oc1elncllXVkO0Clc2j68JP9OtXHIAIGEk55z6CLD95 UQQg5skiEatonoytMqK8rhrwW1QkmKqGZg8uoBYeBjPDeG4= X-Received: by 2002:a05:7300:e9c5:20b0:361:167c:2364 with SMTP id 5a478bee46e88-37966e3ab7cmr7358840eec.8.1794703727796; Sat, 14 Nov 2026 16:48:47 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Sunil V L , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 7/8] hw/riscv/server_platform_ref: Fix mtimer frequency Date: Sun, 15 Nov 2026 10:48:18 +1000 Message-ID: <20261115004819.2586336-8-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::132e; envelope-from=alistair23@gmail.com; helo=mail-dy1-x132e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703776339154100 Content-Type: text/plain; charset="utf-8" From: Sunil V L The RISC-V server reference platform requires a 1 GHz timer frequency. Although the timer frequency is advertised as 1 GHz in the device tree, the mtimer device is still created with a 10 MHz frequency. This mismatch causes the OS to boot very slowly. Use the correct 1 GHz frequency when creating the mtimer device. Fixes: c2fa4320803b ("hw/riscv: server platform reference machine") Signed-off-by: Sunil V L Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-ID: <20261111101609.1183263-1-sunilvl@oss.qualcomm.com> Signed-off-by: Alistair Francis --- hw/riscv/server_platform_ref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/server_platform_ref.c b/hw/riscv/server_platform_ref.c index 3526c80d7947..22b3149ee8e8 100644 --- a/hw/riscv/server_platform_ref.c +++ b/hw/riscv/server_platform_ref.c @@ -561,7 +561,7 @@ static void rvserver_ref_machine_init(MachineState *mac= hine) base_hartid, hart_count, RISCV_ACLINT_DEFAULT_MTIMECMP, RISCV_ACLINT_DEFAULT_MTIME, - RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true); + RVSERVER_ACLINT_TIMEBASE_FREQ, true); =20 /* Per-socket interrupt controller */ s->irqchip[i] =3D riscv_create_aia(system_memory, true, s->aia_gue= sts, --=20 2.55.0 From nobody Mon Nov 23 04:38:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1794703797; cv=none; d=zohomail.com; s=zohoarc; b=HWsj7Mtb9A7lBu93Xiy1QCgJfbZcokgqE4r6+pLlP84u5xo3O3NPR1NT3iLRocgJew5US6H5O+Qkwo5HVtry2iJEMdXsUB0DDgrwz3BzKB/eE6baN10M5s8KaHWUFeL+r2yh8OFPodwjOkwedLydu4sOovGztZ7jnGEbMgB9ubY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794703797; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VTz7mTqV/9RRUs/Zm/ywSfZMtIOKlgcWSJimbOoThy0=; b=HPWR4c8iiRPNNXCXeIAihpYwXceFHWYRDvRr8xkI6QJ38VHXMWFYruY2P2GBQCDMA7jWuhiUSPoXu9b7jWgylFphxkDZOj8YBcyV1RYtJB0UtxDnXpS0a+fmbgWxPRIX1PptXoA5HaS+KY1yNAEQGqrpsxCTMQKIGBDo4F4ctQU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179470379700185.56737281055689; Sat, 14 Nov 2026 16:49:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xSOQR-00005t-T8; Sat, 14 Nov 2026 19:48:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xSOQP-00005S-T1 for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:53 -0500 Received: from mail-dy1-x132f.google.com ([2607:f8b0:4864:20::132f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xSOQO-00018C-EJ for qemu-devel@nongnu.org; Sat, 14 Nov 2026 19:48:53 -0500 Received: by mail-dy1-x132f.google.com with SMTP id 5a478bee46e88-33bf40b0c8bso912655eec.0 for ; Sat, 14 Nov 2026 16:48:52 -0800 (PST) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:13b2:851f:d9cb:44c5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-379553316f2sm21102926eec.9.2026.11.14.16.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2026 16:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794703731; x=1795308531; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VTz7mTqV/9RRUs/Zm/ywSfZMtIOKlgcWSJimbOoThy0=; b=Uw0saFSfEoSafzvfItoJsnkBwM/iBIpRKLyuJApF9clO6vCqWv8tEcRVSKgt05fJYM ujWDpNBnivrawdIAvZAEKBvggFqIOo6ZOcW200rxt0TmJQrFf8Ralqe9rz5MHuI13a/R hwa0tlFH8EXfSMdvq4nXY0MqKy3WHr/j36i+ep2st/uXwbv9T+hPKzMFWZoroPdkEQw3 fnj15Vnno6gNiBUycr7sPkeqbwql+sccImZX22LSfkFtoOxmBewFNrm/uL2OQnAWERpw UQHmCqrlWzc/VJLMJWdyNGIixtTdpiK4eviHkhVx0MU3z6bgBgwW+aATYlzbm1eSjGtJ 43TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794703731; x=1795308531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VTz7mTqV/9RRUs/Zm/ywSfZMtIOKlgcWSJimbOoThy0=; b=HBNcwTuiWQKL723tedO0lSQFowTVW9+YYYhOEdc+aIkEHnXdJTI5vkcq2Fm2Fnn/Lu j19pW/eLuaPm1Bf+m9Lc/mY+xoAzXg71bA4EDOklfuDMkrTDtiLtQR6lJREAlBjFTkt0 ilxD91G6OiYgR+11EK7VtwkGkfMuQvMvPp/fGcX6hdjbFQQfYUT+7+iXevtdypIMjufB kNELa+47CQzOE0JKoiLHn1m6KDari7x4v6LJRlB42exKDHRwRkym5J6pilCMyIfX9fqJ bk+BPa4Jgi/YXx0VrUBnJOAe0fx8zGIKGExDMBs6XobAkIwIVspLSKJ4npN5YkxTEH2C 2PjQ== X-Gm-Message-State: APuU4Z8A7gN33/fW1jCVc1Y6P3owMi3rbesN0H+gL+obDztbF+zpekVE 9Y5+tUTuk8f/Eer+j/n8NlHUSkcIy8osB+N3kux8xEwpwB3RmoU+DjqIXqkQyg== X-Gm-Gg: AYBFou1fVj104i2w6SCZgxXQbzX8MMvOqykr3vFks8PAG1FYt917GyTFx+zNFu4Vj73 DUjbllaAtOwKA/1RoBWXWouEccFAeMw9L+wwMTaMS/bDXy8qfK6p6lalSUn8mSeVcOtW/Uf3CQC 0Hyv3VYNTsKVnQ4d/TNV9hZjgDFmQWQlOM+7qpwvwc88aGrZSERb0EJd/OrLeNIIxUnpHlnw6pu ow1p4esvts43w93iYhlMDZOBjR/igdKoU6Lou6I5BlrZUHlhqbDNRXxN70smOz7Se9Wy109XiXw kxty7xWMM6oMHZ3z8Tz5aewNFAMzW+oT72V95lsfy33lFv9cgDrfkeCnJ9mj7N9D5qmSa7pAtNa p4wdCeSIiNNiqrS+cAZj2KjRCZVR4vZ26Sy8zUxP0QqdoBr40HuDzbyeYaupP6wUl6MRYQUnULv VoQKjmtkL8VHO5EpGVcs9kstX8xBL1/aqjQIJASCX62W5YmyLx39wr9dPlIpXnx01gTWRzncohE ZIhciy1lKGo9os77ckb8pGz2eVnIFW8fofS8A4LTTuJb27p0ZFAe2CzTK48eDi4IWmxPonwIXc3 0WStxcDUdfDa5oa42ulolgva8rl9LknKeuMQhgwZq7F3pjGe X-Received: by 2002:a05:7300:8b:b0:377:5cb:a534 with SMTP id 5a478bee46e88-37965da9681mr6960281eec.17.1794703731065; Sat, 14 Nov 2026 16:48:51 -0800 (PST) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Alistair Francis , Chao Liu , Nutty Liu Subject: [PULL 8/8] target/riscv/tcg: clear itrigger_enabled during trigger_reset_hold() Date: Sun, 15 Nov 2026 10:48:19 +1000 Message-ID: <20261115004819.2586336-9-alistair.francis@wdc.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261115004819.2586336-1-alistair.francis@wdc.com> References: <20261115004819.2586336-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::132f; envelope-from=alistair23@gmail.com; helo=mail-dy1-x132f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1794703798922154100 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza We're leaving env->itrigger_enabled untouched during reset() while at the same time resetting triggers to AD_MATCH (type 2). So, in case we reset the CPU during an itrigger session, translation code will enter itrigger_match helper every time (via ctx->itrigger), and the helper will do nothing since there's no type 3 triggers set. And we'll keep doing that until something else clears env->itrigger_enabled. This is a niche case that it's a bit hard to hit but it will cost a bit of performance for no good reason. Found while reviewing an itrigger related patch. Fixes: 577f02869488 ("target/riscv: Add itrigger_enabled field to CPURISCVS= tate"). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Chao Liu Reviewed-by: Nutty Liu Message-ID: <20261111070600.169519-2-daniel.barboza@oss.qualcomm.com> Signed-off-by: Alistair Francis --- target/riscv/tcg/debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/tcg/debug.c b/target/riscv/tcg/debug.c index 8b58cbd07ab7..988bc815d79c 100644 --- a/target/riscv/tcg/debug.c +++ b/target/riscv/tcg/debug.c @@ -1213,4 +1213,5 @@ void riscv_trigger_reset_hold(CPURISCVState *env) } =20 env->mcontext =3D 0; + env->itrigger_enabled =3D false; } --=20 2.55.0