From patchwork Thu Feb 15 17:57:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 772999 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp969031wre; Thu, 15 Feb 2024 10:08:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWXFIhvqsWhmZOhjpnUXebs+tN+Xzehv3O/VOqKZN47pfUH3S6r24+fO+HZmYG8ec26OxqAUyvpBbwimHDAj7pX X-Google-Smtp-Source: AGHT+IEqWa9sUE7FhNvzTagJqUWuFEPnUoh7KY8SD4sSCbxAHT2yyyeR7k98lDEEXrX+eVwJlBmO X-Received: by 2002:a05:6808:3010:b0:3c0:34b4:ee0f with SMTP id ay16-20020a056808301000b003c034b4ee0fmr2993291oib.53.1708020517224; Thu, 15 Feb 2024 10:08:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708020517; cv=none; d=google.com; s=arc-20160816; b=tSUazRMwhphkUURlscvZBA7+t1WIUOouLD/XU9cJwEWuVgRvGMVVynXa62cpWG5G7k scSz5NTu154KKtbBsnEevccd+6uo+vB0R6k96w5D+sZzM4bVgkl1zRX6XgrBJJYjPyum MH3ny27PsuyFmqlD83DITFkohsymqeksZfTCWi4sEZ6jnywtG5cg8CIwGc1SkaPeks7W u70mZo3MshhbbQXvdkJlukymZgpkaJgwqOyPB9RsurI3wHuywmmiVdBvBV7+wLNQPpiV Ox40nXpJKzA/3Intw48gafDaKIAPqgdCYGV+mX1WGoOmHqRLGp6u/Z9nUUEnCXYLqFKk A2jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0uuVnrOUAIUZkKyymxTIXoVEwsBVaCFKYc2xJo7UVoM=; fh=SyGPuDDufU2F1oigqJN48XJgbTU8/01W/hl/HkJ37S8=; b=Oj26IUpN2kz6NfFdm7jqUYEJYQe71D7z0+Fih41obhgWvMWmI31kqWYaNrahe45yWT z0R3YdOAREXym7I+2iUCiF4InH8DPplaysPTI4FjQ+sUdD76rLZ4hLhthxHXRie8duRH QdCRze4tgSgGd8oD5eCIqfjzrJuxiTbbdjheQcEXZQW0Vkx/T1BJJejyz1xZeMI9vn9m aQnn5AD+7URtk2fzNivUFrbjzsAaiKcKOLlpIGLppRWh4x35X6cM+wXw4+xei/KTN4jw 7eUKN+Uq48zo7KfhAHTT+m8aqOe9dXlDCUX3hMEIdsqB9fbjn+2Jc+oGqvfDRh7frK2D taMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WE9D0xRR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c4-20020ab056c4000000b007d2a4e6baafsi404205uab.217.2024.02.15.10.08.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 10:08:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WE9D0xRR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rag50-0000il-TX; Thu, 15 Feb 2024 13:03:26 -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 1rag4m-0008Vv-6b for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:03:15 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rag4h-00032Z-Tw for qemu-devel@nongnu.org; Thu, 15 Feb 2024 13:03:09 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a29c4bbb2f4so154154066b.1 for ; Thu, 15 Feb 2024 10:03:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708020186; x=1708624986; 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=0uuVnrOUAIUZkKyymxTIXoVEwsBVaCFKYc2xJo7UVoM=; b=WE9D0xRRC0KpZU8AqRW7qCx4D3ffLDDLCcekHkLKVkftVfsZB9fryy0OGFKIUFS6oF ssFLWMSkmCFV5ht6SToCTvcUlzY9Tqd0M45g3iwEnxwh9mPjc6e713P9UB4gxwHWMtq9 TMLPoOTu7czN9Chl1XFAA6mvkrfri4AqsMcu7cOHbP21kl/YqBeaX4Q1RTabVqhIDMUU usNGyDKI2BgfzKhmAhXvg1H3upqeMIfDEwrHK/Ic7f230II836p39ftOGlLgqKSrqL4H Ug2HXmQNTIapKAx2TLJEZ9OJH4AAlQ2eEz+3N+lhxGY0xxbMi9oN5WvMD6YV1j3KAWfh u6Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708020186; x=1708624986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0uuVnrOUAIUZkKyymxTIXoVEwsBVaCFKYc2xJo7UVoM=; b=gJdGM15guaKMoOeOidJVtbSy2hsf/7JVOD84+ZjVZgKKHdouVaj/RksWHMGxpwKblU rEsrYIZaMCuKG9PpmiTL2tfPRarILnGbvfbljQldJ6qMhw+NH/slYCE9tlWepFqFIlUn LqXJHyJs1TVU7GWidLSngCJNZCBxfXDiBrR3IYdlMW4quSZh9rShFV/Az+9Ba+x1UWWN 8U87RYVeGyzR58GQB2gqlSCZ8D4OeMyxW8QxL/5Lh55i37nLw5esIBvzj9a2d0BgTD+1 VBCYDhGOMU1ISWB6lVQUDWydCjf3c23DUYe9wcilI+pI9iMxdpNX/mjOcLOPVsh6F4lm vIzA== X-Gm-Message-State: AOJu0Yyz3lXo9Ta59eQX7D+kAs5eZcBqrDkgsch9KPSdk61B44t4pCWU XLErvhSxkBegc514zqmH6YCg5XI4CCyyPWZArVsAJ7VJRlUH2kVVJsPuQYkUuxV+CP8gebAzFS5 v9LQ= X-Received: by 2002:a17:906:bc5a:b0:a3c:875b:f378 with SMTP id s26-20020a170906bc5a00b00a3c875bf378mr1375359ejv.36.1708020185956; Thu, 15 Feb 2024 10:03:05 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id l22-20020a170906079600b00a3d4b488970sm788570ejc.45.2024.02.15.10.03.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 10:03:05 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Paolo Bonzini , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PULL 46/56] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled Date: Thu, 15 Feb 2024 18:57:40 +0100 Message-ID: <20240215175752.82828-47-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215175752.82828-1-philmd@linaro.org> References: <20240215175752.82828-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We can not create the Q35 machine without PCI, so simplify pc_q35_init() removing pointless checks. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240213041952.58840-1-philmd@linaro.org> --- hw/i386/pc_q35.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index b7c69d55d6..a785bf7366 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -130,8 +130,7 @@ static void pc_q35_init(MachineState *machine) ISADevice *rtc_state; MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); - MemoryRegion *pci_memory; - MemoryRegion *rom_memory; + MemoryRegion *pci_memory = g_new(MemoryRegion, 1); GSIState *gsi_state; ISABus *isa_bus; int i; @@ -143,6 +142,8 @@ static void pc_q35_init(MachineState *machine) bool keep_pci_slot_hpc; uint64_t pci_hole64_size = 0; + assert(pcmc->pci_enabled); + /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping * also known as MMCFG). @@ -189,16 +190,6 @@ static void pc_q35_init(MachineState *machine) kvmclock_create(pcmc->kvmclock_create_always); } - /* pci enabled */ - if (pcmc->pci_enabled) { - pci_memory = g_new(MemoryRegion, 1); - memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); - rom_memory = pci_memory; - } else { - pci_memory = NULL; - rom_memory = system_memory; - } - pc_guest_info_init(pcms); if (pcmc->smbios_defaults) { @@ -212,14 +203,13 @@ static void pc_q35_init(MachineState *machine) /* create pci host bus */ phb = OBJECT(qdev_new(TYPE_Q35_HOST_DEVICE)); - if (pcmc->pci_enabled) { - pci_hole64_size = object_property_get_uint(phb, - PCI_HOST_PROP_PCI_HOLE64_SIZE, - &error_abort); - } + pci_hole64_size = object_property_get_uint(phb, + PCI_HOST_PROP_PCI_HOLE64_SIZE, + &error_abort); /* allocate ram and load rom/bios */ - pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size); + memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); + pc_memory_init(pcms, system_memory, pci_memory, pci_hole64_size); object_property_add_child(OBJECT(machine), "q35", phb); object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM, @@ -243,7 +233,7 @@ static void pc_q35_init(MachineState *machine) pcms->bus = host_bus; /* irq lines */ - gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); + gsi_state = pc_gsi_create(&x86ms->gsi, true); /* create ISA bus */ lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), @@ -286,9 +276,7 @@ static void pc_q35_init(MachineState *machine) pc_i8259_create(isa_bus, gsi_state->i8259_irq); } - if (pcmc->pci_enabled) { - ioapic_init_gsi(gsi_state, "q35"); - } + ioapic_init_gsi(gsi_state, "q35"); if (tcg_enabled()) { x86_register_ferr_irq(x86ms->gsi[13]);