From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92BA6C87FD3 for ; Fri, 8 Aug 2025 07:05:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ukH70-00062H-Um; Fri, 08 Aug 2025 03:01:58 -0400 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 1ukH6r-0005sK-NP for qemu-arm@nongnu.org; Fri, 08 Aug 2025 03:01:55 -0400 Received: from p-east3-cluster7-host11-snip4-10.eps.apple.com ([57.103.84.241] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ukH6p-0005CS-K8 for qemu-arm@nongnu.org; Fri, 08 Aug 2025 03:01:49 -0400 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-5 (Postfix) with ESMTPS id DBC981800179; Fri, 8 Aug 2025 07:01:43 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; bh=d/z0LdtJsZ0X4SZniRSWzKSzcqx6k2mthXNU/xLsNUA=; h=From:To:Subject:Date:Message-Id:MIME-Version:x-icloud-hme; b=FKYR9GiQHZg/D/UCZuXzik2qLRqTldHzci3SsfN5uns47+DDrkeoo0EDpQkPpV9YB8p1TTNxwz+4/QoHnmbnhk8vBGzhpXYh1pRCPS1cZwKz6EbHQPVAHLnI3HHV8+Da5/2Tgbj2k9iz8eU8Ls937ruZwj3/aztxudbVcfe+dB3v96243ge2sJDTafQPmTSZXxkWepCdRSS797iwpjE5VlGzQkjgnbw9AmbBmlgb0R9a5v+9pTEj2AoKQp97E4f4/WwYhoP++vC66lYeeMvYBF+kP02HUugnc8GfUZFg24GzUCv9MyDA/KS7LSYVTi0OmsCAXnlXdrsLqXwPRKyxcw== X-Client-IP: 46.189.47.18 Received: from localhost.localdomain (qs-asmtp-me-k8s.p00.prod.me.com [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-5 (Postfix) with ESMTPSA id B9E441800170; Fri, 8 Aug 2025 07:01:41 +0000 (UTC) From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Peter Maydell , Shannon Zhao , "Michael S. Tsirkin" , Ani Sinha , qemu-arm@nongnu.org, Paolo Bonzini , Roman Bolshakov , Igor Mammedov , Phil Dennis-Jordan , Alexander Graf , Mads Ynddal , Cameron Esfahani , Mohamed Mediouni Subject: [PATCH v6 01/13] hw/arm: virt: add GICv2m for the case when ITS is not available Date: Fri, 8 Aug 2025 09:01:25 +0200 Message-Id: <20250808070137.48716-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250808070137.48716-1-mohamed@unpredictable.fr> References: <20250808070137.48716-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODA4MDA1NyBTYWx0ZWRfXwnIBMD0kFNf8 p4DZgM11xeB2LaWoxHzIiJEhKDHSMvHxT1RSJWTM1Eh5TLlwNn7UZicmP79TYqfE7J6mS2dUAVB tDjYg+2KXOR4zBeuyb4YkHlNUBzLSRdtMo1abbrE0qEnodoftNWUJJNryttQdNT3dPgxLf7w7/T cYlpEq8yltqqkmTL2+XT3pE9jRIP8COYp+ai3SFJhmQVuGOF+hpvubknC1JOApXpS2lhaUyDgSV esNBr8PvnAvk9q3IpsVSqc0nwZNfGEDjB6/te5Ui+4iv4AMJ0ubED+lNYZjRUWaefx1xyEku4= X-Proofpoint-GUID: KaYSzqyDqh5Oq2ZjJdUc5hRdavm1FLrB X-Proofpoint-ORIG-GUID: KaYSzqyDqh5Oq2ZjJdUc5hRdavm1FLrB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-08_01,2025-08-06_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 clxscore=1030 bulkscore=0 phishscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506270000 definitions=main-2508080057 Received-SPF: pass client-ip=57.103.84.241; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org On Hypervisor.framework for macOS and WHPX for Windows, the provided environment is a GICv3 without ITS. As such, support a GICv3 w/ GICv2m for that scenario. Signed-off-by: Mohamed Mediouni --- hw/arm/virt-acpi-build.c | 4 +++- hw/arm/virt.c | 8 ++++++++ include/hw/arm/virt.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index b01fc4f8ef..969fa3f686 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -848,7 +848,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) build_append_int_noprefix(table_data, memmap[VIRT_GIC_ITS].base, 8); build_append_int_noprefix(table_data, 0, 4); /* Reserved */ } - } else { + } + + if (!vms->its && !vms->no_gicv3_with_gicv2m) { const uint16_t spi_base = vms->irqmap[VIRT_GIC_V2M] + ARM_SPI_BASE; /* 5.2.12.16 GIC MSI Frame Structure */ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ef6be3660f..5951b331f3 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -953,6 +953,8 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) if (vms->gic_version != VIRT_GIC_VERSION_2 && vms->its) { create_its(vms); + } else if (vms->gic_version != VIRT_GIC_VERSION_2 && !vms->no_gicv3_with_gicv2m) { + create_v2m(vms); } else if (vms->gic_version == VIRT_GIC_VERSION_2) { create_v2m(vms); } @@ -2402,6 +2404,8 @@ static void machvirt_init(MachineState *machine) vms->ns_el2_virt_timer_irq = ns_el2_virt_timer_present() && !vmc->no_ns_el2_virt_timer_irq; + vms->no_gicv3_with_gicv2m = vmc->no_gicv3_with_gicv2m; + fdt_add_timer_nodes(vms); fdt_add_cpu_nodes(vms); @@ -3410,6 +3414,7 @@ static void virt_instance_init(Object *obj) vms->its = true; /* Allow ITS emulation if the machine version supports it */ vms->tcg_its = !vmc->no_tcg_its; + vms->no_gicv3_with_gicv2m = false; /* Default disallows iommu instantiation */ vms->iommu = VIRT_IOMMU_NONE; @@ -3462,8 +3467,11 @@ DEFINE_VIRT_MACHINE_AS_LATEST(10, 1) static void virt_machine_10_0_options(MachineClass *mc) { + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_10_1_options(mc); compat_props_add(mc->compat_props, hw_compat_10_0, hw_compat_10_0_len); + vmc->no_gicv3_with_gicv2m = true; } DEFINE_VIRT_MACHINE(10, 0) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 365a28b082..725ec18fd2 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -131,6 +131,7 @@ struct VirtMachineClass { bool no_cpu_topology; bool no_tcg_lpa2; bool no_ns_el2_virt_timer_irq; + bool no_gicv3_with_gicv2m; bool no_nested_smmu; }; @@ -178,6 +179,7 @@ struct VirtMachineState { char *oem_id; char *oem_table_id; bool ns_el2_virt_timer_irq; + bool no_gicv3_with_gicv2m; CXLState cxl_devices_state; }; -- 2.39.5 (Apple Git-154)