From patchwork Tue Feb 13 04:19:52 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: 772257 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp85649wre; Mon, 12 Feb 2024 20:21:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWpyTZyS1/NFBRec9a+tMzstyjAfVACpokT0qCfR41sCoXRGumtOeNwOKIif45jcj0W2mWFVjSGe1/GaQmYJs+e X-Google-Smtp-Source: AGHT+IH3FvKihFECM6IHNoZgFysGsvmTVOz/N4C62t2lqPA0qWenXmx+obprXsEliEg9AUfMMR8E X-Received: by 2002:a05:620a:29d1:b0:785:d568:9ce with SMTP id s17-20020a05620a29d100b00785d56809cemr5357229qkp.7.1707798060519; Mon, 12 Feb 2024 20:21:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707798060; cv=none; d=google.com; s=arc-20160816; b=zoJMHaM6OutXj9crBQRiX/fyBa41h3w6CReTT69aO43abK9kH47TBS5dcJA3/DEthm xW9UzyNxRyaEd6kEQQipjeefgvMJf3kPQ2uwM7MZCi7PcLpxHWax4ZdqnsyVAYd971Bt za/wbK2bcMv7fgo4eEI07NWBn4e75s0zX1ou3djwuun2gGnfjSke+3GkEDGZvzheMKes CQLidbLKFmXVPTCxgVV8fKo0VlannUEPChsFgTuLAc5LwOb7rYwRmwJDVToeSCw+EZly Vl9eam4EU7R3PFo4OV7YVjJ3dH2UoPAJnCt0jKgbf+rCCatqspkYmUFVxwJR2Y/2ephH n8Kw== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=4c+pEmVTR6F0UzIp4J5WPN/yZvO+7j9ZAv4sXZea+Z4=; fh=0mQ9EsqBVOwK3m+O4LFbmJS8cGbzNBzi4SwudoUxa40=; b=TnCEgnOm1VIVmIQk0mwS6md8qS6S4exebKq0nF03+Llg+BPjHQrmyOy54ppm5V6bjj xbiOPVXkSQODqlSBeT3NxMs6nIZdbGFBU43tZCEYveVEiZRiLbFp+4mdGDjnc6ng7NuC j9tezIzIcqqnAGiFfrVVOlDtShb6zeVFuBVqsku34HghGugpKO9HcH1joAhMIwMOHXh8 lx+QJkshUg3vcNYKZntKsnnq52EXdq68xw85YrkeYJItL3cVBvLG/pPYblmqmDkwzlpT VQ0SCOqG6PhrCG9gh6vA/7jy1uGxOKtm53qkin5rca/Sb/dICrZSZP6zQGDcAdbuU6t0 jSxQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hf2T9nCm; 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 X-Forwarded-Encrypted: i=1; AJvYcCX3LTsM5Amc1ioIQ6M4Kqxznl6gPEpUBSNsdU5e8ceViH4pltaWXwh3E9zqM+r19ljqoOXRxd6p0DBkGanwZI7D Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b16-20020a05620a0f9000b00785c9fe8d4fsi6317547qkn.181.2024.02.12.20.21.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2024 20:21:00 -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=hf2T9nCm; 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 1rZkH2-00054B-2t; Mon, 12 Feb 2024 23:20:00 -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 1rZkH0-000543-Vl for qemu-devel@nongnu.org; Mon, 12 Feb 2024 23:19:58 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZkGz-0002rz-B8 for qemu-devel@nongnu.org; Mon, 12 Feb 2024 23:19:58 -0500 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a3566c0309fso471758766b.1 for ; Mon, 12 Feb 2024 20:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707797995; x=1708402795; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4c+pEmVTR6F0UzIp4J5WPN/yZvO+7j9ZAv4sXZea+Z4=; b=hf2T9nCm1lmjHVehaCvpLu2lppp0VtKtaL91CpKxmCTgfOX/6T07/EyZHMZwu5IQFH QJXNOPsc4J7H7AgOTSH7PndatcHU1GSYUn8RRCCtgW8DzCHjxr+MNTzXRumwMfai84O6 pTAPKo7ZFBoffbjy7c63OtHaWP/Lupnuu4mb9sedRe8dPf9SIJY0FXpj2jIxgVyO8xC7 UAwiMISW4iAUbJ0W3JASMFt4CpwJjSbs8jc/Q/exQ4ehka0F1Y9q4YPpEHfXh/F9biVR 8CVZvwpKBoY50zf45WC687vT0m8OvRDdTDw+26y7Wi+RavcgScYSBmkboqloTkeLjWpm 4aBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707797995; x=1708402795; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4c+pEmVTR6F0UzIp4J5WPN/yZvO+7j9ZAv4sXZea+Z4=; b=OTUwwcD3p/mcLML2s7qZ03iiKCWl0KzjRwr2/qGr4PVMIU58eb06+4tsW3x6IArcni ddFzbOIeeRCyS391yDi0pmk13biWkNgXVGQt+VFxzQFUeoqHW+yG8EmpSp98rCPGsxg0 ekEjkwHdENKA9GGPC398fSJKT+1wuuV5CVaVbu0YWZwc1raTsPdsxEXTG4rkEL5i/Dd3 Pt6sFN5WcIBCGOyHdHDrr1LVvuK0HAM86GOsk4kpm0vQRH8LKGRNEfoJ7WZmeBx39pqS ZNXQDEoGFQOVmZ96MZD7AxerrNwIbgOBiErtXhQijmvLcwdwTnnYCLPOyrZAjN3eaaXn Bbig== X-Gm-Message-State: AOJu0Yx/N01hHkRIeyNySF0vRM3Mgs0HK0dWnplgIqHVl70DvN7fl4nw 2UvSII5ZVJLaDiHwlOjEAyY0sb0VtbDt038yBZrs1bp5xZOozNQJXB5Y08FHYAsgWtqppjxr3kB 3 X-Received: by 2002:a17:906:5ad8:b0:a3c:9bc7:7a0e with SMTP id x24-20020a1709065ad800b00a3c9bc77a0emr3199632ejs.9.1707797995308; Mon, 12 Feb 2024 20:19:55 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUMU9UWbR8rzOiPYzCS+C32rtoQTffTPX9Ensw9MBqKktpZyQcUsi255DsHdZgZL/pizKcvPqLw8GAUWg02CeHw7QdxBBd8mScX8aRK82W3X8htq1wGee7sFwOEf2SDLXZ37bUVhZ0rqmBv5VEeLv4AsBH6U5VILyLMTfHQnqrOV+JjSdkhyYSlvQyMtRTYZNdAVK53KDlaDZnhS/1wNA7Nq+YNevCkK+eSVQ== Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id vi16-20020a170907d41000b00a3ce31d3ffdsm697108ejc.93.2024.02.12.20.19.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 12 Feb 2024 20:19:54 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled Date: Tue, 13 Feb 2024 05:19:52 +0100 Message-ID: <20240213041952.58840-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; helo=mail-ej1-x629.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=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+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 --- 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 7ca3f465e0..5923621845 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]);