From nobody Mon Feb 9 08:33:34 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768932269; cv=none; d=zohomail.com; s=zohoarc; b=e7x60jPUGK2JhDtIlBycBTTPj2coIv1UsS1tQAH/9PuIP8r+ahKK7WfjMeskzxaH84vFKKhEykCN06RSpeoAMXWts3vG5AWTUda8y8UpsKrhh3ffrGyAWp51z18V/m8pAbN61/Bb7dRVCVWqlC11uo8S72QjP+UmZqVNaUnehTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768932269; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jCPqRpQUUqzqFmpPhdz1jQmtLeDG3BlVkhJSsKOlHuY=; b=nkeItzKtUugS3CnuUFnfLhFzgO43qrCWKEPkEG2wta65Y+3/NMZ2FJqUPLN2vnLdY7X37qKLXQEARxrYdajZtk9PtlAN0QipsoZsGzEwLB1XnPuGaXn0aoHvYWbib1WxGch6G6ou8mPWRNowVftcsEhKUbB0xSg+nm1rAW9AYPE= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1768932268976982.5722086866322; Tue, 20 Jan 2026 10:04:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1viG5J-000758-By; Tue, 20 Jan 2026 13:04:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1viG4w-0006bC-Ea for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:52 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1viG4u-0000T4-2h for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:46 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-43590777e22so539478f8f.3 for ; Tue, 20 Jan 2026 10:03:43 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996cf58sm31310889f8f.22.2026.01.20.10.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 10:03:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768932222; x=1769537022; 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; bh=jCPqRpQUUqzqFmpPhdz1jQmtLeDG3BlVkhJSsKOlHuY=; b=UbOU/51hS0AOV++3d6AIMK6JVnfRAwVUZf0KTeI5o81yHnvBIxHPYrhZuXdf3hGUaD n62Yj19EHtXvAfKt3coMto3Dehu8VftE6ggd+itI2BUy0k6JURWVlF3tWKAnt3LxSVY0 67aIJ2LUIuKT7tYHdR6hQgPbCcj4LrQO/yHX4dV5Koq6T0ApuX4yHSu8Fot2J1aBAfNH BaVE20E8FtLetOvVU3aD6kMw4zFC+AHCfNIzTUiRO3Fx/pPWfqQ8QsR+7kuCCwP1Di65 SDJz+J9XtIxGzoSpKonka1sOB6m3dCSKoHaRPsobQMD1gxuheHKiMCm9W5KpLQvswC0b Cx7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768932222; x=1769537022; 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; bh=jCPqRpQUUqzqFmpPhdz1jQmtLeDG3BlVkhJSsKOlHuY=; b=LzOzXv46pMq/S3eWHRFi3VaXRL6X3nJ3Lsc5EfC0T2EK4Wums7gOntmM67ibyKIRC0 fYGX1AMGr3OwJ4eLPLNae6dnMynnrhli2ceaQBvTjz4Vp1NINSRCy5P/vH5lXCJkTBra VnQVux3V3gdjhkxMA4pwiz2LLht749ZiEt+7mrfh+qQE749UmBhMqDMyitnnG62Ynvpm L9H4daYc6q5fUVRPyfDLhu+D/7kDKjki2EFY9kpGnyQ4bfDHTSJGiHc4zTpAQC1oitbn RU+t5NoXAgQPv1SRTDjyqszx92rUCDMXRZZU6d1ecj+KNe85hXGCIHgExB1hsh5ugq2y q+dg== X-Forwarded-Encrypted: i=1; AJvYcCWSCIBbje+LHGzt4+xQ9jtuPndk6KhOPgy/uQSohBpfNLJb2jY4x7G0J6QOTgrYGTYO9fHSIZpskzIh@nongnu.org X-Gm-Message-State: AOJu0YwS4FUdUkGvdhEOmWeBGwLw03CJPYPciMAon7pdCTT3zZ+MleqJ +3uJNJQt82iXq1pPjOJWqco2LR6CqqONWQ264ZN93qylXeNhlxjxUYDuSv0RflwmPgw= X-Gm-Gg: AZuq6aKsf366guWRUGG2+cKWXX0O4127txxO2WNQDFN06KjwdpMpzKRLF9gQNiCPT82 cX3HOZ4iVNSluha8n6NYV7TZemZPCdGT9H4y+ksHB/M1SVxcik7r9IW9D3qWvKx2LZNElP+XHWD Sza6sv3C/b2o6CbyH/Cyrqp2yUnGgOt0rW8p6LDaiW9h7sxOuzk4qliQD7bEo6XheWHPSm9+bKa UJa8aNR9ctuwHHgl2j50naQigu51fVvuu1StCiJ4XVvO4UDNBmF+Gu2PuWYDjGDt5gQAs11yi+K cIHJ/v1XyfBVU9W06sgekJw7joUIpSEJSoVzTFdAswBcU8JZ51JyNFA4rg/u9KJD8dyz6vRx9Qk mZTEvlNiOFxz76PB1AyW1JgHRNcoNNp9Ij3/Y730bdMPdSL4uFC03ckwp8SKh+RDlgwzFhvs1e3 WjhoLHi+P8qqSh/1PNuhpJVqbG11UiFS7fB2KXzDDDq4dHt4uf7D7b X-Received: by 2002:a05:6000:2281:b0:431:16d:63d7 with SMTP id ffacd0b85a97d-4356a05d461mr21542141f8f.47.1768932222095; Tue, 20 Jan 2026 10:03:42 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Mohamed Mediouni , Pierrick Bouvier Subject: [RFC PATCH 1/4] hw/arm/virt: Clean up MSI controller selection logic Date: Tue, 20 Jan 2026 18:03:36 +0000 Message-ID: <20260120180339.1416328-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260120180339.1416328-1-peter.maydell@linaro.org> References: <20260120180339.1416328-1-peter.maydell@linaro.org> 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=lists.gnu.org; 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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1768932271923154100 Content-Type: text/plain; charset="utf-8" The virt board might have multiple different ways to handle MSI interrupts: via an ITS, via the GICv2M device, or not at all. The logic to select which of these we use is confusing because it is controlled by a mix of versioned-board compatibility flags, board option flags, and open-coded logic inside the create_gic() and create_its() functions. Currently we set VirtMachineState::msi_controller as the very last part of this, inside create_its() or create_gicv2m(). This field is then used only in the hotplug pre-plug callback function. As a first step in making this clearer to understand, move the logic into a single finalize_msi_controller() function, which sets VirtMachineState::msi_controller. The actual machine creation code can then look only at that field. (This is a parallel to what we do with the GIC, where finalize_gic_version() sets the VirtMachineState::gic_version field.) Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 4badc1a734..b55297455f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -738,13 +738,6 @@ static void create_its(VirtMachineState *vms) DeviceState *dev; =20 assert(vms->its); - if (!kvm_irqchip_in_kernel() && !vms->tcg_its) { - /* - * Do nothing if ITS is neither supported by the host nor emulated= by - * the machine. - */ - return; - } =20 dev =3D qdev_new(its_class_name()); =20 @@ -754,7 +747,6 @@ static void create_its(VirtMachineState *vms) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_GIC_ITS].base= ); =20 fdt_add_its_gic_node(vms); - vms->msi_controller =3D VIRT_MSI_CTRL_ITS; } =20 static void create_v2m(VirtMachineState *vms) @@ -775,7 +767,6 @@ static void create_v2m(VirtMachineState *vms) } =20 fdt_add_v2m_gic_node(vms); - vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; } =20 /* @@ -957,10 +948,15 @@ static void create_gic(VirtMachineState *vms, MemoryR= egion *mem) =20 fdt_add_gic_node(vms); =20 - if (vms->gic_version !=3D VIRT_GIC_VERSION_2 && vms->its) { + switch (vms->msi_controller) { + case VIRT_MSI_CTRL_NONE: + break; + case VIRT_MSI_CTRL_ITS: create_its(vms); - } else if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { + break; + case VIRT_MSI_CTRL_GICV2M: create_v2m(vms); + break; } } =20 @@ -2079,6 +2075,24 @@ static VirtGICType finalize_gic_version_do(const cha= r *accel_name, return gic_version; } =20 +static void finalize_msi_controller(VirtMachineState *vms) +{ + /* + * Determine the final msi_controller according to + * the relevant user settings and compat data. Called + * after finalizing the GIC version. + */ + if (vms->gic_version !=3D VIRT_GIC_VERSION_2 && vms->its) { + if (!kvm_irqchip_in_kernel() && !vms->tcg_its) { + vms->msi_controller =3D VIRT_MSI_CTRL_NONE; + } else { + vms->msi_controller =3D VIRT_MSI_CTRL_ITS; + } + } else if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { + vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; + } +} + /* * finalize_gic_version - Determines the final gic_version * according to the gic-version property @@ -2251,6 +2265,8 @@ static void machvirt_init(MachineState *machine) * KVM is not available yet */ finalize_gic_version(vms); + /* MSI controller type depends on GIC version */ + finalize_msi_controller(vms); =20 if (vms->secure) { /* --=20 2.47.3 From nobody Mon Feb 9 08:33:34 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768932282; cv=none; d=zohomail.com; s=zohoarc; b=mDLXMi8LMH56VGH0D9NaveuCPR6gjhKmQjsjsiL9dCjV5rsgol6Cah+lbjlHFpyAK66yomP1RjkT/uUv+ZQUABH34JqhEfyz7mjZC9wlGOv8ouV6pJkkNljCrAJ5M0NrZ/O/BMFO4gDhWnIIR3MFcRsb0YalLHJyQd64Njyhkjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768932282; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BF7xLPclhWg7q/XkOOlfgy3QCXWSt8lM7mLCvyOa55I=; b=BHCcR5fGlK2n2x2cYLspZlLWmo094YqXe2eKMXIkk4cYKGQs6T0DN958EjRWa8urOzW5OWS0oVHlNTqzaDcWIgCKvWqH9k/QDvYOYikdlWkjuq0n4TG+cUY2k/8hIHbCuU2NjgMhc7qvirB5s54spL6VtLDaft/TUR1KVRD/5zA= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17689322822591002.3752336390188; Tue, 20 Jan 2026 10:04:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1viG5D-0006w2-KT; Tue, 20 Jan 2026 13:04:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1viG4w-0006bF-T1 for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:52 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1viG4v-0000TH-BJ for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:46 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-4359019da8cso888790f8f.1 for ; Tue, 20 Jan 2026 10:03:44 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996cf58sm31310889f8f.22.2026.01.20.10.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 10:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768932223; x=1769537023; 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; bh=BF7xLPclhWg7q/XkOOlfgy3QCXWSt8lM7mLCvyOa55I=; b=JhfceZXn8d1kXLEK5gEuYfQIQH2lMYjmUMVr9p8AA2y0weOcesx/yAk5jSs3T8axqu moIy7yKUhsAJCJu6B+/Tq68XLUTT7KxgVL9Q335UQryeu4JQH6iHElyyslrjw8ArwSrD S9i4RdlaoCZtK6UmKgwrLCEO8NshsS56WGM4wBVrKxm9hUjwwiUQQIHj7RNUoaRB6H2O 6HA+nGGfrDrgO9HylPzOHEZSVdFOa8YfQo6rSqWBX98FIjhT1jGm16Pj0D5+M55rUipa sTNZ95sR+tSvR83b3i0771HwMp9SCmqKibvCL1fjlNu/+MTSo9F0ESQzXjnYdCV+9aQL u1GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768932223; x=1769537023; 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; bh=BF7xLPclhWg7q/XkOOlfgy3QCXWSt8lM7mLCvyOa55I=; b=g8BBl7gesmWPrWXdM29F9YTnGbbv8SfhWqVyY1M6JBb1qlRtNZabAP/hiM4f9DX9+s D+kuZ5HGouOsNQtNOSMVF32hkMoCeTJVWN5JGCorMk5ncAfGYW3sOEa7Qsx5A3tNIRJz Gj8XkZytrJ6ZeRIlb5xO/nbtW/Nt6pQAuLf84OfKS1+NyonF+AkSqpJxcyZ42MECSblh CVqIdVyC6/CtJ6XkdVzOz4/WOW70K/yaCwDkExvwJ+atDesDPw3gC90zIan7svmAJ+qQ guoUprYl+AcnOyv+wwknQp/tnGQSwxX129/cZHcsD8IS2P7/r6+ZHEfwZ5LGZAZYuWzd C1+A== X-Forwarded-Encrypted: i=1; AJvYcCWke0Pu0EwxHKuEZrHkx7/XJJv56rB8/SGizL4As+dOPVK6pGstcHy7lNOrEcJgWnV7t2UL/zPUj1Lu@nongnu.org X-Gm-Message-State: AOJu0YzkIPusWcHd4K883CKiBtzXLuhftC3mcKjIqbcbeKMF/JBxsCFJ W23bUmNKUydCRn1fefBrEoH49BeRj5su3DcRGbd9V/mT+JXC9JOIDGZH8QkjVRdxO3y+4AUB6Qs Y/w4+J9c= X-Gm-Gg: AZuq6aJgIpXQS19bvbWZToEOsHoymNcpq9DhmXL0Nh1+O7ek20ZnMtWZ8VD9g2lEkKp pipC2mYI+AakkM5cqNc89zv9mBzU+GqOrWlUQEuSOMwX8dTavlchlTkwEkwrlUqziup89p8BoHo F1SWz0g7OgcQSeQGzJ+G1U5FVD1DhA827elC6JYyMXmGF2y6Hw6m9is8A1ytjDIQgsaoCCQTDIm 3fc+pQ/S4EttRU4xgreOR+yUhn75IkfkeHGJepjh1OMXFG3g/DaVZNOjZz32xV9ZketKDlQRu0Z 7g8tZ48Vbc5EdGLPttuMVvxb+rID5iDrM82kVJb7yTRbX+dSH/sFi5oAYe9iR5qUoSX/K4UYBWU rcsx91lcpHB97lerZbtBA/VevaMdCFc0rWLhKDfgQW3yzEVH0xTGlUWma/chHt9zmdScHTizwFb gJoQlHBSdOcjw7HUdfXFKihFZnL6JrfMuFA3oeWccgSpiciAf7esge X-Received: by 2002:adf:e884:0:b0:435:729a:eb6f with SMTP id ffacd0b85a97d-435729aeb94mr13832875f8f.19.1768932223189; Tue, 20 Jan 2026 10:03:43 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Mohamed Mediouni , Pierrick Bouvier Subject: [RFC PATCH 2/4] hw/arm/virt: Don't use vms->tcg_its in create_gic() Date: Tue, 20 Jan 2026 18:03:37 +0000 Message-ID: <20260120180339.1416328-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260120180339.1416328-1-peter.maydell@linaro.org> References: <20260120180339.1416328-1-peter.maydell@linaro.org> 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=lists.gnu.org; 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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1768932283865154100 Content-Type: text/plain; charset="utf-8" The create_gic() function needs to know whether the GIC has a TCG ITS attached, as it should set the "sysmem" and "has-lpi" properties of the GICv3 only in that case. Currently it does this with (!kvm_irqchip_in_kernel() && vms->tcg_its) which implicitly relies on knowing that the only case where we aren't using a KVM GIC and we don't have an ITS is where we suppressed the TCG ITS because of the board-version-compatibility no_tcg_its setting. We can avoid direct use of vms->tcg_its now that we can identify what MSI controller we are using from the vms->msi_controller field. This means that the only use of vms->tcg_its is in the logic in finalize_msi_controller(). Signed-off-by: Peter Maydell Reviewed-by: Mohamed Mediouni Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index b55297455f..a231aef268 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -851,7 +851,7 @@ static void create_gic(VirtMachineState *vms, MemoryReg= ion *mem) redist_region_count); =20 if (!kvm_irqchip_in_kernel()) { - if (vms->tcg_its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { object_property_set_link(OBJECT(vms->gic), "sysmem", OBJECT(mem), &error_fatal); qdev_prop_set_bit(vms->gic, "has-lpi", true); --=20 2.47.3 From nobody Mon Feb 9 08:33:34 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768932250; cv=none; d=zohomail.com; s=zohoarc; b=Vd9mCxHXb1jU/Acq2sbKfiIcPhlfGNkUGiMU1uUWtQYmk/z6C3HyiFIXNZLBjtCKU0fRfRLJLR5mIcQCarVtJ1ytvUJwajfT4K5k2Vnnz1N/BSedYEkxy+Dg/KHadxpMEQ3ksnwpfqhgg8eexfEbxkXqOrvkeXY8e7EEk4hlJTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768932250; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NRzT62H79hhfu62kmgyNxqbBArhK3Nz4ofwZjq+4f9M=; b=GUd/NT+DJV/L+OtHK/AcfIy1SuCmYpSjqIWLiImbE1QSULt5mgbw1I5pYvpchv8t5OJi0NQ7ZvsvdEAzkEiirSD3Wtbr4oOUqfNACsQcctzkOe3oXPpKbz/f6cf1D34zl6gzNYzJC2zd20STNJi2wiKUMCrWVIXXDBMjqW8Pcxc= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1768932250496746.1724762431149; Tue, 20 Jan 2026 10:04:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1viG59-0006sI-TP; Tue, 20 Jan 2026 13:03:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1viG4y-0006bN-SJ for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:52 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1viG4v-0000Tb-Qz for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:47 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-4359108fd24so537491f8f.2 for ; Tue, 20 Jan 2026 10:03:45 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996cf58sm31310889f8f.22.2026.01.20.10.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 10:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768932224; x=1769537024; 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; bh=NRzT62H79hhfu62kmgyNxqbBArhK3Nz4ofwZjq+4f9M=; b=yaOWa+S8VlTzAJkrLD5RrzSVHGJF1tAUf4QKXkivO5JRvsP1NOZp+2zUhAxcFz6aDe FDnXObURFZp4f/04mL3V0V8OgTKOxDg3/ejh9W9JCZkoSowcfvOA4q0iruApNz619pvI 6OPxS2bD4lE8P0PAISiK1PmwR060/ZCeX88xhphMyWEkIg7YKoCDrdieXU6QqwSueViP nxFarWrWqAgGcUlASV0vmpsjAxty3yRlOcCAZOgkU7iAZPqfhBrGYAMnwg3dFjXT0auL AdGMbAu06bpAM20KAOU0thbE2m5KQMjyFRu0+QDRYH3pmp7Fg2khjtFBriZsSjRPljee cSyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768932224; x=1769537024; 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; bh=NRzT62H79hhfu62kmgyNxqbBArhK3Nz4ofwZjq+4f9M=; b=XB5lKjXLtaUBY7lxKTaYzSByvlO4r0NWLgn7M65+cavD+NE5U6ij46Uokl6hF+q3+f 3Gh61Q53fq2WFr9a76AoFqw99ZTfIuO/Xtb2u1V2UOpD/R1447LqCyB6fi8cgJPREsyO xE2BFZoTPrlJEDBwfOvcnTFVOGor4wP5LEp+pX4dpqmUZvbhw1w7QR7lf691BHo2SC3s L6ScSZYpq2v6c3VAaWTHdQsRHl488yng8wz8arfjAGurRls06srwtn5pIObhAkcIBq5j IpK5d2S9P4cqQGEl1w0cPqGo58t0p0kGfRa57dBX02BKQQpaFT+DabARXX7L5cRSHjvO cp8g== X-Forwarded-Encrypted: i=1; AJvYcCUpjsyYyUub9+tvVKkuApmWfxmtPWT9rH24zfPcqMv0OU2GmqiqyHpq6YjXkCu1UGccOMUJEserGQR/@nongnu.org X-Gm-Message-State: AOJu0YznviEqvajcW26jCaeSe5QfrX1LzJtW0G+aRz/p9XWL7B+EcLnJ aO8Z75ML/9E2pFjNhLqeYpt6aGdE+u+7ZkauYTLXBXKgCi35WCjmVndqysqMZob3OjU= X-Gm-Gg: AZuq6aIPlGyzIHNSQYYODnoRfUmpP20yGZ+0Ah3EgU+pVmLK1lCfoOPCs1QRa1EmKXQ JqEXmV2N0cLBimbbIiyI/nAuUGOvJBMm5SP6PHnVlXOpG1nyvvnyw/sIZ8fSZjt/foCxvlVwHJQ D4L5il2wiaA2s/PaMQFrLB+8OQIETkT0lpev1NUR9+eL8I4xnHEUrmr5INxMMYEO6zRLkfYulaP EFtqTc7aWCMr7mGW6gkhQWfL3ag2C5Ih0wHOn5LdmYVeHPaq9uzQSMAGtXOQsahB+RqV5RvNW83 dbDx+jbxQweZJja7oyZizFGG9FbCv3K+kIMEZ4YvwTuIy7DGjILNG4CaBey4Bbm/mLxQtJu0SHI SsJKOsPvE4RGHfDfvC4+PJRiJYrMpDJXw9sN0sZGpgrw79BDVp67rRcy6aBKHSvBb5zekN2gFiF q7CfeixLbgpPXUxmcX2U83AVGhc+x2iZv3CLhhVAw9S0l6Jt7cMzzR X-Received: by 2002:a05:6000:186f:b0:432:c37c:d83b with SMTP id ffacd0b85a97d-43569994296mr21748670f8f.20.1768932224074; Tue, 20 Jan 2026 10:03:44 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Mohamed Mediouni , Pierrick Bouvier Subject: [RFC PATCH 3/4] hw/arm/virt: Drop VirtMachineState::tcg_its Date: Tue, 20 Jan 2026 18:03:38 +0000 Message-ID: <20260120180339.1416328-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260120180339.1416328-1-peter.maydell@linaro.org> References: <20260120180339.1416328-1-peter.maydell@linaro.org> 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=lists.gnu.org; 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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1768932252604158500 Content-Type: text/plain; charset="utf-8" We now use VirtMachineState::tcg_its only in the finalize_msi_controller() function, and it is always the inverse of the VirtMachineClass::no_tcg_its class field. We can simplify to use no_tcg_its and drop the VirtMachineState field entirely. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt.c | 6 +++--- include/hw/arm/virt.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a231aef268..b65f571532 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2082,8 +2082,10 @@ static void finalize_msi_controller(VirtMachineState= *vms) * the relevant user settings and compat data. Called * after finalizing the GIC version. */ + VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); + if (vms->gic_version !=3D VIRT_GIC_VERSION_2 && vms->its) { - if (!kvm_irqchip_in_kernel() && !vms->tcg_its) { + if (!kvm_irqchip_in_kernel() && vmc->no_tcg_its) { vms->msi_controller =3D VIRT_MSI_CTRL_NONE; } else { vms->msi_controller =3D VIRT_MSI_CTRL_ITS; @@ -3511,8 +3513,6 @@ static void virt_instance_init(Object *obj) =20 /* Default allows ITS instantiation */ vms->its =3D true; - /* Allow ITS emulation if the machine version supports it */ - vms->tcg_its =3D !vmc->no_tcg_its; =20 /* Default disallows iommu instantiation */ vms->iommu =3D VIRT_IOMMU_NONE; diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 5907d41dbb..577b4b3362 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -147,7 +147,6 @@ struct VirtMachineState { bool highmem_mmio; bool highmem_redists; bool its; - bool tcg_its; bool virt; bool ras; bool mte; --=20 2.47.3 From nobody Mon Feb 9 08:33:34 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768932283; cv=none; d=zohomail.com; s=zohoarc; b=GyJnTbBrF+8qPKwyttjxhFw15Oit+45pEkpNZlTvTY3qIKkqalZ9rdVSfywI9Zv77wtkhPO0eMzk9U/3mIXsteY9TLibF8JRu+v8wnFLoB8yn2meM2BbtAv0ibN7tKjFRkks5bCaerR3qG3gbOLsC4fG6KW5ejCb7pmdleseb9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768932283; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L0ZMXUtic4MuRKS7Dby22dacdT6+N9i2g5JnhZrBGrY=; b=DIB/90U4ki0wRJAFo0D/N/rTu+m+D3K41uNTj+Q21wMtGDyVy7Y0msgcE4pll3UswqCTr9wNK4Qyq37Pw/6uC497CMtKgSwvYL7VJ8VVo52JvxB6A9+Cc6NbMVDb7pWRx1rnLlykwaPr14UZHQGpML7r5rm+Nt70iSJld0SmWl4= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1768932283392522.7941235376312; Tue, 20 Jan 2026 10:04:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1viG5N-00078C-It; Tue, 20 Jan 2026 13:04:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1viG51-0006eF-0G for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:52 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1viG4y-0000UP-L4 for qemu-devel@nongnu.org; Tue, 20 Jan 2026 13:03:50 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-432d256c2e6so4804253f8f.3 for ; Tue, 20 Jan 2026 10:03:47 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996cf58sm31310889f8f.22.2026.01.20.10.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 10:03:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768932227; x=1769537027; 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; bh=L0ZMXUtic4MuRKS7Dby22dacdT6+N9i2g5JnhZrBGrY=; b=DqqYywy6J8hRy8ZrLXIRrwgWM8xYBRzt78drH6gIX626+8/H5kg3XDviE+xHd+Boos NE3ihhHB2XnQ+GL8mCWLx6vtGMjH3L9aJhCcIA+dh367SOSZlfMnID/gCtJD75m01Mup OhuylGN0haZSWMMFxfZZ/+5ySDsGbE9gELIMuoVeKf3ZxK6n8JioeCTM50RPF7JFEAyW H5kq0dqkNcH1C6vo0/H4GD96w62RLsSpI3vckcdrTJhiqU5vymWFH4/XZxeLmi9f+nzY sYM/lnv5NGEVzoKNjhIP6JEbLUfCoG5wPYxONXULZizgCYC0nBGb0pHLkeAy5ZLi4N23 xtIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768932227; x=1769537027; 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; bh=L0ZMXUtic4MuRKS7Dby22dacdT6+N9i2g5JnhZrBGrY=; b=NoBQJogjNRVccxo1ioSXeCVWTwJ045ZuseCRko7ZDHZEa4W9UgmG3OBREL12e5XHud Lt8O71+o5/GYPvfL8dSjmJsHDzYYvhdyzoLw0hvZSoGfxLBxRpT3IEz8nJm0r3YP6Nvf fLlXYgugay4EQKEZAk3MYUBX9uQyc0VGSDgZtfb5bXFFk7za2G6leTQwSLylpR04jd3p llrGoSxMbyv1LzHF1m+7UnkNsth96Y7UC9EvftL2Tr9mU4Vi0uCwLwTOlZ4DN/2V/Icq C/YGugf/jOFeuiuAbCJ9T4jd6OcKpyoUm+aHyJxSoYHjLpl2lXv8Fi+8FZtZloORh7wI ll0A== X-Forwarded-Encrypted: i=1; AJvYcCUyndV5edoczukUltdguQ3o/rUL8eNv0tEw+cWuzSQX50q1hprjgEoW58oEYXlU6jxVscxHvxU2x5CO@nongnu.org X-Gm-Message-State: AOJu0YwIlkDGLXwZemxnAMUc3XF43Uy7Px7/zSujFNxn+GYlBFI2NiYG ibFLEHlBM2qj7nZTOHlMFOUo9D4h9m5FNlnrhSKqOINpM3ucfadqBn0mrvE6VA3hso0= X-Gm-Gg: AZuq6aKWHhejZXyPJ3tbvf8XzPRQ8XGXratrlyKMXLwMVnBIOHCDNO63yCmpS17k2lN WLncAX4gq6MkG4/sP+weK2MgEknCFvZIFDWcDlDhRGwaP02B8ctiWUPfODSksBZQ7ESU/h/pycx wSTaWpNx4BpmEN9BEyOh8Fan3ewhoIIvff/vcqbt62VK7qlP5xryIbRPjyHdDHnkNA+teJyEz/N ZKTlp0Cbas9OvlHjtF2SdLeGYdIAc/qGix2vfHejISR3l0OVNgMRb0aojwoV2t+STCrxJ99PDrA KXzYoydJUVkhlDujBs0ZmPmgxuB8vf3CYRln1wLPko1/Yy7NpUn8tqIzVgnT2+3o10tR2vVJdp7 f90eomeLDlXlTWWAOMUHmfOqcLKJOiZZDTuIFreHx+01KmvzdN4ty4q5QRdnpz8djSpy3qG9zY5 FQLozhIz5ZpA7lvfZmm2uP3silWTvaR/VOX82p95NNxanSlkZL2bzN6zZDUEaRkIQ= X-Received: by 2002:a05:6000:4383:b0:433:24c7:880e with SMTP id ffacd0b85a97d-4358ff26a86mr4252941f8f.33.1768932225035; Tue, 20 Jan 2026 10:03:45 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Mohamed Mediouni , Pierrick Bouvier Subject: [RFC PATCH 4/4] hw/arm/virt: new "msi" property Date: Tue, 20 Jan 2026 18:03:39 +0000 Message-ID: <20260120180339.1416328-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260120180339.1416328-1-peter.maydell@linaro.org> References: <20260120180339.1416328-1-peter.maydell@linaro.org> 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=lists.gnu.org; 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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1768932286272158500 Content-Type: text/plain; charset="utf-8" The virt board currently only supports either a GICv2 with a possible GICv2m for handling MSI interrupts, or else a GICv3 with a possible ITS for handling MSI interrupts. There is one board property, which lets you say "its=3D(off|on)" and controls only whether there is an ITS or not. This is awkward for macOS HVF, where you get a GICv3 without ITS and MSI handling needs a GICv2m. Create a new board property "msi" which gives the user clearer control over how MSI interrupts are handled: - msi=3Dits : create an ITS - msi=3Dgicv2m : create a GICv2m - msi=3Doff : do not create any MSI handling device - msi=3Dauto : create the best MSI handling device available for the GIC version and accelerator The default is 'auto'. The existing 'its' property becomes a deprecated property kept for compatibility. Existing users of "its=3Don" should prefer "msi=3Dauto"; users of "its=3Doff" should use "msi=3Doff". The backwards compatibility cases we need to support are: (1) TCG, virt-6.1 and earlier: no_tcg_its is set -- you can have a gicv2 (always with a gicv2m) -- if you specify gic-version=3D3 you get a GICv3 without ITS (2) TCG, virt-6.2 and later: -- gic-version=3D2 still has gicv2m -- gic-version=3D3 by default gives you an ITS; if you also say its=3Doff you get GICv3 with no ITS -- there is no case where we provide a GICv3 and are unable to provide an ITS for it (3) KVM (any version): -- gic-version=3D2 has a gicv2m -- gic-version=3D3 gives you an ITS by default; its=3Doff will remove it -- there is no case where we provide a GICv3 and are unable to provide an ITS for it (4) HVF: -- only gic-version=3D2 works, you get a gicv2m Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- docs/system/arm/virt.rst | 21 ++++++++++++- hw/arm/virt.c | 64 +++++++++++++++++++++++++++++++++++++++- include/hw/arm/virt.h | 1 + 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index e5570773ba..4cc54e38db 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -167,9 +167,28 @@ gic-version with TCG this is currently ``3`` if ``virtualization`` is ``off`` and ``4`` if ``virtualization`` is ``on``, but this may change in future) =20 +msi + Specify the MSI controller to use to handle MSI and MSI-X interrupts + from PCI devices. Valid values are: + + ``its`` + ITS, which can be used with a GICv3 or better. + ``gicv2m`` + The GICv2m; this is typically used with a GICv2, but it is possible + to use it with a GICv3. + ``none`` + Do not provide any MSI controller. MSI and MSI-X interrupts will + not be supported. + ``auto`` + Pick the best available controller. This will be an ITS if the + GIC and virtualization accelerator support it, and a GICv2m if not. + This is the default. + its Set ``on``/``off`` to enable/disable ITS instantiation. The default is `= `on`` - for machine types later than ``virt-2.7``. + for machine types later than ``virt-2.7``. This is a deprecated option; + instead of ``its=3Don`` use ``msi=3Dits`` or ``msi=3Dauto``, and instead= of + ``its=3Doff`` use ``msi=3Dnone``. =20 iommu Set the IOMMU type to create for the guest. Valid values are: diff --git a/hw/arm/virt.c b/hw/arm/virt.c index b65f571532..471852e4b1 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -957,6 +957,8 @@ static void create_gic(VirtMachineState *vms, MemoryReg= ion *mem) case VIRT_MSI_CTRL_GICV2M: create_v2m(vms); break; + default: + g_assert_not_reached(); } } =20 @@ -2084,6 +2086,23 @@ static void finalize_msi_controller(VirtMachineState= *vms) */ VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); =20 + if (vms->msi_controller !=3D VIRT_MSI_CTRL_NOSEL) { + /* + * User specified an "msi" option: check what they + * specified, and use it. + */ + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS && + vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { + error_report("A GICv2 cannot use an ITS"); + exit(1); + } + return; + } + + /* + * Pick a "best available" MSI controller, including handling + * the legacy "its" option and the no_tcg_its compat flag. + */ if (vms->gic_version !=3D VIRT_GIC_VERSION_2 && vms->its) { if (!kvm_irqchip_in_kernel() && vmc->no_tcg_its) { vms->msi_controller =3D VIRT_MSI_CTRL_NONE; @@ -2092,6 +2111,8 @@ static void finalize_msi_controller(VirtMachineState = *vms) } } else if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; + } else { + vms->msi_controller =3D VIRT_MSI_CTRL_NONE; } } =20 @@ -2881,6 +2902,36 @@ static void virt_set_gic_version(Object *obj, const = char *value, Error **errp) } } =20 +static const char *msi_option_values[] =3D { + [VIRT_MSI_CTRL_NONE] =3D "off", + [VIRT_MSI_CTRL_GICV2M] =3D "gicv2m", + [VIRT_MSI_CTRL_ITS] =3D "its", + [VIRT_MSI_CTRL_NOSEL] =3D "auto", +}; + +static char *virt_get_msi(Object *obj, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + assert(vms->msi_controller >=3D 0 && + vms->msi_controller < ARRAY_SIZE(msi_option_values)); + return g_strdup(msi_option_values[vms->msi_controller]); +} + +static void virt_set_msi(Object *obj, const char *value, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + for (int i =3D 0; i < ARRAY_SIZE(msi_option_values); i++) { + if (!strcmp(value, msi_option_values[i])) { + vms->msi_controller =3D i; + return; + } + } + error_setg(errp, "Invalid msi value"); + error_append_hint(errp, "Valid values are off, its, gicv2m, auto.\n"); +} + static char *virt_get_iommu(Object *obj, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); @@ -3056,6 +3107,8 @@ static void virt_machine_device_pre_plug_cb(HotplugHa= ndler *hotplug_dev, db_start =3D base_memmap[VIRT_GIC_V2M].base; db_end =3D db_start + base_memmap[VIRT_GIC_V2M].size - 1; break; + default: + g_assert_not_reached(); } resv_prop_str =3D g_strdup_printf("0x%"PRIx64":0x%"PRIx64":%u", db_start, db_end, @@ -3454,7 +3507,13 @@ static void virt_machine_class_init(ObjectClass *oc,= const void *data) virt_set_its); object_class_property_set_description(oc, "its", "Set on/off to enable/disable " - "ITS instantiation"); + "ITS instantiation. Deprecated; " + "use the msi option instead"); + + object_class_property_add_str(oc, "msi", virt_get_msi, virt_set_msi); + object_class_property_set_description(oc, "msi", + "Set to configure MSI handling. " + "Valid values are auto, its, gic= v2m, and off"); =20 object_class_property_add_bool(oc, "dtb-randomness", virt_get_dtb_randomness, @@ -3514,6 +3573,9 @@ static void virt_instance_init(Object *obj) /* Default allows ITS instantiation */ vms->its =3D true; =20 + /* Default to autoselection of MSI controller */ + vms->msi_controller =3D VIRT_MSI_CTRL_NOSEL; + /* Default disallows iommu instantiation */ vms->iommu =3D VIRT_IOMMU_NONE; =20 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 577b4b3362..53f1dc2199 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -103,6 +103,7 @@ typedef enum VirtMSIControllerType { VIRT_MSI_CTRL_NONE, VIRT_MSI_CTRL_GICV2M, VIRT_MSI_CTRL_ITS, + VIRT_MSI_CTRL_NOSEL, } VirtMSIControllerType; =20 typedef enum VirtGICType { --=20 2.47.3