From nobody Fri Dec 19 04:29:43 2025 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=1602167399; cv=none; d=zohomail.com; s=zohoarc; b=RJTJxVKoYyToz0Jh2yDfPnBN2LaAk3jwHQiQ14xN0DfHx40N9POIBF1hYqmGq8xBrJhquHech2rDC8TMYwAarBqX6sFVncOuFvIz7YJRURi0bOZTL+hAy/DDyLbpfopIdYt3q1rB6ml94EMmUU8F2UkDL0OQQBd0zuWbgilPBJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602167399; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mUWxkTyEIk2JnpjsU6rZN6KvWfmkqRnVuhjHNTzz8/o=; b=j2pNYxD+lz3FE8p+FmbQJcsYU5eh6DRMgY9Jo2PDPKdLl+zWSvALxZnrbZWF0TcBg0y3mDodnkSHfhlCqwNAsAD3mIcddWodE/75KhCHRzM8AqeUSrhSyb4LLDV6F1vFtAR2Gqbl/XmT86PWgVl8VmRyTDahk9qurLinworSsvw= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602167399515695.3578953041452; Thu, 8 Oct 2020 07:29:59 -0700 (PDT) Received: from localhost ([::1]:53386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQWvb-0000p7-9X for importer@patchew.org; Thu, 08 Oct 2020 10:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQWs0-0004HY-5h for qemu-devel@nongnu.org; Thu, 08 Oct 2020 10:26:12 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:46615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQWry-0005z6-9A for qemu-devel@nongnu.org; Thu, 08 Oct 2020 10:26:11 -0400 Received: by mail-wr1-x432.google.com with SMTP id n6so6547346wrm.13 for ; Thu, 08 Oct 2020 07:26:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id j1sm7905104wrc.28.2020.10.08.07.26.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 07:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mUWxkTyEIk2JnpjsU6rZN6KvWfmkqRnVuhjHNTzz8/o=; b=Osvai1zWywsVacRiXBoozskA6yIXXa6/t2kk+5/EudrH7s6RMf7cy94gqsxIGQQxfF F++CJ6AT5gN8fbB5Z1o5R8PGjveoN8Ra1it7w2Z+qRCMpiDtLw0/O0J93ZguqO9c4OXk L0KS9C71objpe+6pf5LdyIsfvcU76uPGrj4LVP1EYhhr+jEPVE8Rt5x4hSbLNfsqN1PI 7M/h7Pt78zxrPKnQT4H6c8XPhH8kuKm0qHoiqpgEDlxlrLlkTneotoyM1wMkMD0B1LnF m5/BIqltJYHg9YY7vpn9x5AyKpwSS79cZAAisAArjRQmn943ZTZGTER6jbUKPAGkcrEi XI6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mUWxkTyEIk2JnpjsU6rZN6KvWfmkqRnVuhjHNTzz8/o=; b=YRMeQoZ3KoI1uWdmg5OSWkLJeBpgbArhMIBPKagUbWNdV/3HVI1Ps4SequI1JJgyJ4 3DrpWKSB6ye2QjUiXHyhBtYGxR/IYVl1ggyHoZANsKUUudLNFT824jowEzyDSxIyBxir XmpMcsJPtnFQCLuZKWVr5/m15EjfljHqlzbVgg7SzqauFTQs5ZwVZRfNsCFMNjJxgQD4 /Xf2ArSNvTfArVpIPtdZV73i5H+6oDFnb54xGr8pKJxl5DPT8pnhRUXLEqUE0U2xmSin TQk1flI6Amf2BDKPGha3m+FzC2ruPXa2V0AD9chbZWWsd1HQnY5lt+4lkBj8cl4cbU4l NbUg== X-Gm-Message-State: AOAM531pxYx9Utn31+XoJHoPBntZJsDnt09E46O/CpVSfE7eWafDer9G /+b2j4Opfs4aeFi6RCFANv4o7+m+MjPR5Utm X-Google-Smtp-Source: ABdhPJx3VhDl4Fw63VIG0fiNgzKwP9fiPyKmvfSiAyVurjGchvFqpmwtnb04ugQQbujx/ailRwmxfQ== X-Received: by 2002:a05:6000:8e:: with SMTP id m14mr9616520wrx.400.1602167168691; Thu, 08 Oct 2020 07:26:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/12] hw/arm/virt: Move post cpu realize check into its own function Date: Thu, 8 Oct 2020 15:25:53 +0100 Message-Id: <20201008142557.9845-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201008142557.9845-1-peter.maydell@linaro.org> References: <20201008142557.9845-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 client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Andrew Jones We'll add more to this new function in coming patches so we also state the gic must be created and call it below create_gic(). No functional change intended. Reviewed-by: Eric Auger Reviewed-by: Peter Maydell Signed-off-by: Andrew Jones Message-id: 20201001061718.101915-4-drjones@redhat.com Signed-off-by: Peter Maydell --- hw/arm/virt.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 1231a197c85..524eafe22df 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1672,6 +1672,31 @@ static void finalize_gic_version(VirtMachineState *v= ms) } } =20 +/* + * virt_cpu_post_init() must be called after the CPUs have + * been realized and the GIC has been created. + */ +static void virt_cpu_post_init(VirtMachineState *vms) +{ + bool aarch64; + + aarch64 =3D object_property_get_bool(OBJECT(first_cpu), "aarch64", NUL= L); + + if (!kvm_enabled()) { + if (aarch64 && vms->highmem) { + int requested_pa_size =3D 64 - clz64(vms->highest_gpa); + int pamax =3D arm_pamax(ARM_CPU(first_cpu)); + + if (pamax < requested_pa_size) { + error_report("VCPU supports less PA bits (%d) than " + "requested by the memory map (%d)", + pamax, requested_pa_size); + exit(1); + } + } + } +} + static void machvirt_init(MachineState *machine) { VirtMachineState *vms =3D VIRT_MACHINE(machine); @@ -1886,22 +1911,6 @@ static void machvirt_init(MachineState *machine) fdt_add_timer_nodes(vms); fdt_add_cpu_nodes(vms); =20 - if (!kvm_enabled()) { - ARMCPU *cpu =3D ARM_CPU(first_cpu); - bool aarch64 =3D object_property_get_bool(OBJECT(cpu), "aarch64", = NULL); - - if (aarch64 && vms->highmem) { - int requested_pa_size, pamax =3D arm_pamax(cpu); - - requested_pa_size =3D 64 - clz64(vms->highest_gpa); - if (pamax < requested_pa_size) { - error_report("VCPU supports less PA bits (%d) than request= ed " - "by the memory map (%d)", pamax, requested_pa_= size); - exit(1); - } - } - } - memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, machine->ram); if (machine->device_memory) { @@ -1913,6 +1922,8 @@ static void machvirt_init(MachineState *machine) =20 create_gic(vms); =20 + virt_cpu_post_init(vms); + fdt_add_pmu_nodes(vms); =20 create_uart(vms, VIRT_UART, sysmem, serial_hd(0)); --=20 2.20.1