From nobody Fri May 3 20:34:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1660270944; cv=none; d=zohomail.com; s=zohoarc; b=ai6CJ9Xo5u5wVBcIJMeUyMJ6lOcyFZbyDUMZiehIBihE+P9XEOFgoBwtLVyY6y4925pMWb+EygyQCmgjcBd2wYiE/WDt3qUh4YJUj0EnYx6yoJVWRtc6k2iPGzT7l16viYocvN52+g4XaRDxacQ39cYJx1vAu0CPDLdQDpkRB7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660270944; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=RI/8XtV4BajcHPM09AG1Y7XiStvHQ6IYmyQd+jnrKSc=; b=FCljwW/XNXxD5d8HCke0tumuJfEaVPrWaYGDH6xp9leD8CnlhVjlQUd+pFTKLmNeufALUAQFAABTdMvMSxJbRBwGrAC+Mw9D+Y4/RvzhRuFzGkJgv3fYBBomKh/7WKqubcy5QP3Yp4HkTNpMeLCo54L2fY4YwvODtIUdegvzruo= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1660270944300449.6545441535302; Thu, 11 Aug 2022 19:22:24 -0700 (PDT) Received: from localhost ([::1]:47146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMKJa-0004Hp-KE for importer@patchew.org; Thu, 11 Aug 2022 22:22:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMKIP-0003YS-Az; Thu, 11 Aug 2022 22:21:09 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:4518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMKIM-0002PB-P9; Thu, 11 Aug 2022 22:21:09 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4M3nPl5pfxzkWKN; Fri, 12 Aug 2022 10:17:31 +0800 (CST) Received: from kwepemm600007.china.huawei.com (7.193.23.208) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 12 Aug 2022 10:20:45 +0800 Received: from DESKTOP-8RFUVS3.china.huawei.com (10.174.185.179) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 12 Aug 2022 10:20:44 +0800 To: , CC: , , , Zenghui Yu Subject: [PATCH] hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4 Date: Fri, 12 Aug 2022 10:20:18 +0800 Message-ID: <20220812022018.1069-1-yuzenghui@huawei.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.185.179] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected 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=45.249.212.187; envelope-from=yuzenghui@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Zenghui Yu From: Zenghui Yu via X-ZM-MESSAGEID: 1660270945235100001 Content-Type: text/plain; charset="utf-8" With the introduction of the new TCG GICv4, build_madt() is badly broken as we do not present any GIC Redistributor structure in MADT for GICv4 guests, so that they have no idea about where the Redistributor register frames are. This fixes a Linux guest crash at boot time with ACPI enabled and '-machine gic-version=3D4'. While at it, let's convert the remaining hard coded gic_version into enumeration VIRT_GIC_VERSION_2 for consistency. Signed-off-by: Zenghui Yu --- hw/arm/virt-acpi-build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 449fab0080..9b3aee01bf 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -732,7 +732,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) uint32_t pmu_interrupt =3D arm_feature(&armcpu->env, ARM_FEATURE_P= MU) ? PPI(VIRTUAL_PMU_IRQ) : 0; =20 - if (vms->gic_version =3D=3D 2) { + if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { physical_base_address =3D memmap[VIRT_GIC_CPU].base; gicv =3D memmap[VIRT_GIC_VCPU].base; gich =3D memmap[VIRT_GIC_HYP].base; @@ -762,7 +762,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) build_append_int_noprefix(table_data, armcpu->mp_affinity, 8); } =20 - if (vms->gic_version =3D=3D 3) { + if (vms->gic_version !=3D VIRT_GIC_VERSION_2) { build_append_gicr(table_data, memmap[VIRT_GIC_REDIST].base, memmap[VIRT_GIC_REDIST].size); if (virt_gicv3_redist_region_count(vms) =3D=3D 2) { --=20 2.33.0