From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982067; cv=none; d=zohomail.com; s=zohoarc; b=j+aBpkmeQoh/uZ7Zy3wifQq3es/8v2s5ESPjID8SBxQejsukEdWJeJifd26Ir6lyf8fViuf4sumgNF89gteqZMRQB1vkd5G5J767qaY0MaShKqB2z2V3FLtY0EaLnOCy6ylKx0Q1VPULD6qUcpJT5nH209fBvY54RvhZkUneQNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982067; h=Content-Transfer-Encoding:Cc: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=M94ZWqJV1AdEsj9l0Iz5HDYh7/xoEBsvE14jtmH7TGk=; b=V9hBz1OSV5LADJZAuAgVyy9O6qnPXPIFdHguulXVhLMYJcsDJiJFvcI3BxzO29oRd+ABFCKjWNJhLLdv39ciVaN6iH71T6bAosYfJy8oBDhiJtb8ivEpx1YRjLVSl89SDh+rUv15joo03wZhwJ993DfcIihuDWcnz2KJQtwubbw= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982066993550.3324833448672; Wed, 28 Jun 2023 12:54:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDA-0004g9-C7; Wed, 28 Jun 2023 15:52:20 -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 1qEbD6-0004fJ-T2 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:16 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbD4-0005hC-Bq for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:16 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-98377c5d53eso24032566b.0 for ; Wed, 28 Jun 2023 12:52:14 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981933; x=1690573933; 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=M94ZWqJV1AdEsj9l0Iz5HDYh7/xoEBsvE14jtmH7TGk=; b=PMhIEjcWSQaKxngW7erYnsqP4eoUN2FzRTQFLPHhyqbrLHLC6wJ0Rj1UYQpynC050g PI8/gpSXFvWRpIhFimBBmwcvyWBLiMegQ9p/WtGQoSFMxv2wi6zIp66gd/a+G+M8fPEB fvI+KQVeBsbIFHF9q6f+3e1Neqbg+h/MncU3pDrOCXPXgdBM4V0nvG+zTcFfL+EtKh5E hvbPv58evSIsoo06LzY/NWJpdvHHRag0JzvCJtUVT+Wzi7cEIU6HLOcKLru4diA9vIY6 0wnKvHO43dIuQ2QieYNkduS9OTHMvmzCYvB98dqxGka9ETAMJG+VJpc6OC1jH4URUz+z IbnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981933; x=1690573933; 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=M94ZWqJV1AdEsj9l0Iz5HDYh7/xoEBsvE14jtmH7TGk=; b=fhaq/h+mqVy/4PhFWHmM8so05/J+X91621op3p3/AEmF5GgEy2N+zVdfRMTw74YFQG YHMIsS2p3pM8s1aDu37FBY1Wl9g0hjsjJl7YKSrmlzzfqg3Q4G6NdmdqRaRdMkhBmWjz 0/JKEz9LKOHIdLCeaNw+919Hn+DVkdpM2NQ7QHLDiQjG+HDG317s+4/pozn2WSW+hlB7 0frLedf/lba0XWiEEfZhb/ELmCWASorQWAg5m+ulc7PmzrYJAHZWiA2Z7A8qOiRqevzg LAUU8VtiLR6+vGvHrR6vO+HcrV5M+PVOVqnl7r9AlX3TChZbYM/uQwz8rSwvHaPsNQMF WhRw== X-Gm-Message-State: AC+VfDyJwyYHWEwnm3NRKF8TbIlmsbyVaAWWE65xUHXFlrvn4sy79Fda g6vlJKHokO8sFhzvY4prgONI3fUfCgo= X-Google-Smtp-Source: ACHHUZ5X1HYhYsphrE3SUH6424wDcfmaK8oN2BWAhYRzaqzfc5ulHxUBkz8aYh13TV5mJe/RvJrmow== X-Received: by 2002:a17:907:7b96:b0:969:7739:2eb7 with SMTP id ne22-20020a1709077b9600b0096977392eb7mr34639607ejc.4.1687981932554; Wed, 28 Jun 2023 12:52:12 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , Thomas Huth Subject: [PATCH v2 01/16] hw/i386/pc_q35: Resolve redundant q35_host variable Date: Wed, 28 Jun 2023 21:51:49 +0200 Message-ID: <20230628195204.1241-2-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::62f; envelope-from=shentey@gmail.com; helo=mail-ej1-x62f.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982069152100007 Content-Type: text/plain; charset="utf-8" The variable is redundant to "phb" and is never used by its real type. Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_q35.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 11a7084ea1..d9f3764184 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -120,8 +120,7 @@ static void pc_q35_init(MachineState *machine) PCMachineState *pcms =3D PC_MACHINE(machine); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); X86MachineState *x86ms =3D X86_MACHINE(machine); - Q35PCIHost *q35_host; - PCIHostState *phb; + Object *phb; PCIBus *host_bus; PCIDevice *lpc; DeviceState *lpc_dev; @@ -207,10 +206,10 @@ static void pc_q35_init(MachineState *machine) } =20 /* create pci host bus */ - q35_host =3D Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE)); + phb =3D OBJECT(qdev_new(TYPE_Q35_HOST_DEVICE)); =20 if (pcmc->pci_enabled) { - pci_hole64_size =3D object_property_get_uint(OBJECT(q35_host), + pci_hole64_size =3D object_property_get_uint(phb, PCI_HOST_PROP_PCI_HOLE6= 4_SIZE, &error_abort); } @@ -218,23 +217,23 @@ static void pc_q35_init(MachineState *machine) /* allocate ram and load rom/bios */ pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size); =20 - object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); - object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM, + object_property_add_child(OBJECT(machine), "q35", phb); + object_property_set_link(phb, MCH_HOST_PROP_RAM_MEM, OBJECT(machine->ram), NULL); - object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM, + object_property_set_link(phb, MCH_HOST_PROP_PCI_MEM, OBJECT(pci_memory), NULL); - object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_SYSTEM_MEM, + object_property_set_link(phb, MCH_HOST_PROP_SYSTEM_MEM, OBJECT(system_memory), NULL); - object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_IO_MEM, + object_property_set_link(phb, MCH_HOST_PROP_IO_MEM, OBJECT(system_io), NULL); - object_property_set_int(OBJECT(q35_host), PCI_HOST_BELOW_4G_MEM_SIZE, + object_property_set_int(phb, PCI_HOST_BELOW_4G_MEM_SIZE, x86ms->below_4g_mem_size, NULL); - object_property_set_int(OBJECT(q35_host), PCI_HOST_ABOVE_4G_MEM_SIZE, + object_property_set_int(phb, PCI_HOST_ABOVE_4G_MEM_SIZE, x86ms->above_4g_mem_size, NULL); + /* pci */ - sysbus_realize_and_unref(SYS_BUS_DEVICE(q35_host), &error_fatal); - phb =3D PCI_HOST_BRIDGE(q35_host); - host_bus =3D phb->bus; + sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); + host_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); /* create ISA bus */ lpc =3D pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), = true, TYPE_ICH9_LPC_DEVICE); --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687981972; cv=none; d=zohomail.com; s=zohoarc; b=Jh7JH0AnPnSH2H6CPEbEHJTSWLZSdfVMIA+zCgAeJABYU2KhDqjp69w1/jVuNY5NpuWxeKF9f3uT3eOS+8bH4pgv9rW1V7ODcjPC1LFOiVyKG317LpF8fXUFgyMGcxGSSe8IyDHUHPmEOvY+LS46UL6mo3xMh/mk1WoPOgXCRsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687981972; h=Content-Transfer-Encoding:Cc: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=1qTEjiJO+rGciaKNYAv4AjJGsmsXEooYuDKonzHCbf4=; b=LLBdZDX0qyTXaRNZkTBq6uOyslH6Nu7mb52NDbPP8X8y0TLAQ7AYTygYB5TgUK4wShGV0/Pxbst41YKQZeXInRSfCvW9UqAANx4w2d0VXNB7yfCbd1KCjXd7hUa0vHB+HmAJ9NBoexrd4bMYbvq6PAIQtj0itHOrRnI2xSkTVnM= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687981972676809.2078859335218; Wed, 28 Jun 2023 12:52:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbD9-0004g7-KE; Wed, 28 Jun 2023 15:52:20 -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 1qEbD7-0004fR-EC for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:17 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbD5-0005hO-PW for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:17 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-991ef0b464cso249567966b.0 for ; Wed, 28 Jun 2023 12:52:15 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981934; x=1690573934; 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=1qTEjiJO+rGciaKNYAv4AjJGsmsXEooYuDKonzHCbf4=; b=Mfd7atY84/FKHIik5Kqo2ACsvtK0RKxdnXsNRrsB9DeTjJVO5tihP/NRBuIE3l0wgh oAz/rY4Od56mGDqNl9WMBn6vpBH51RMA77NUvuY1gD0RQVnxLHMCC2Y/224eHFAF/rmB JfYMt3kvNrQ5i0BYCAoBlJ0ZryZd1nOpZl/75fMJxSJ1r41hvNIhfWxluyJrcKhWDOqE FzbOALyd+4Bbp9pBLqo58qXBSDeIxwCsiM4aaL97phWFXYLZmtV3peS9MJDzolfr9mZS YVKabfUE2+zE9KQJA2fO4mSLsu0sCTAjwoPKmLMp5WDFUmK1YEDnLPj0+FEm5XxKAFhW eU6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981934; x=1690573934; 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=1qTEjiJO+rGciaKNYAv4AjJGsmsXEooYuDKonzHCbf4=; b=Rsn0yZHHJ2rfGOh/k6VaKLKKtDMtAJzHyyYulZRew2CxXGvGFncKBwlYOujmgGPjyQ SkgskFfMaMBJ9Or+4cKW4taUoRYLZhHh0r0PPq5778vikCuXpO2na0i9itYNel2F+i66 B1kOiXxJPWEYJVWSnSLVH00AX5P1GyrW0/hNXL/KAakm4z/R7ISrd+2GgvFIBomoFR8M 9wUFU+4Ngy5VZDy2rgkiWnDeD8XiKm1AfbbnOz+HXvAmEGclr3618qvd1OdzbuEjBd5U LBKx3YtIXtQsvguIjuC7Jg9i0tNhg1DvgVOWzMI+zJHgnMT8tOoFYc9lHvnlqdzdj+eM 9pZA== X-Gm-Message-State: AC+VfDyjioMaMU6HR27p8rCkA8kkab0R7bYe8mcYHvzaurew/JaJsA68 RmCJ/Kwe3lw7236yqoLCXvuYSfVSxVk= X-Google-Smtp-Source: ACHHUZ5D6yWNiDlqPjgKzfzAwGMTFNfPgBNW8slafVrho58xzOKeLDFxkrC/Dhh9mL1fG8MeCP5nlg== X-Received: by 2002:a17:907:2d27:b0:98f:c9b:24ef with SMTP id gs39-20020a1709072d2700b0098f0c9b24efmr2329241ejc.20.1687981933804; Wed, 28 Jun 2023 12:52:13 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow Subject: [PATCH v2 02/16] hw/pci-host/q35: Fix double, contradicting .endianness assignment Date: Wed, 28 Jun 2023 21:51:50 +0200 Message-ID: <20230628195204.1241-3-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::631; envelope-from=shentey@gmail.com; helo=mail-ej1-x631.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687981974026100001 Content-Type: text/plain; charset="utf-8" Fixes the following clangd warning (-Winitializer-overrides): q35.c:297:19: Initializer overrides prior initialization of this subobject q35.c:292:19: previous initialization is here Settle on little endian which is consistent with using pci_host_conf_le_ops. Fixes: bafc90bdc594 ("q35: implement TSEG") Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/q35.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index fd18920e7f..84137b9ad9 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -285,7 +285,6 @@ static void blackhole_write(void *opaque, hwaddr addr, = uint64_t val, static const MemoryRegionOps blackhole_ops =3D { .read =3D blackhole_read, .write =3D blackhole_write, - .endianness =3D DEVICE_NATIVE_ENDIAN, .valid.min_access_size =3D 1, .valid.max_access_size =3D 4, .impl.min_access_size =3D 4, --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687981992; cv=none; d=zohomail.com; s=zohoarc; b=SJiDmpHJYem8RiOx8m+aBWxvIaHLXL7wxrtm4J/oPHyV5UMVKkU+WaxSe+8N6OI3ellDMG1FP1Vz0Ks/UbIQTRpiCH9TGP1WB5efMSNrsr+9OlYvyFtetVxKfBh0rfPEyfJ0PDMdUHPSVk00QHeBZiPWY9mGkPm82o3t+sU9X4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687981992; h=Content-Type:Content-Transfer-Encoding:Cc: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=CCVk7jdt1nDqHH6A+S2BbR5/KvJS5BvxayG0t6p+t7Q=; b=cSPeeHYCaBoBWzv+fcxlScr5ouyo2garTrMiMlLojaBCjug6KKW1aoDmb89zjOpz0yP/HRw6oxeR5GLJ+Mhy1mjiBCpTL/FkfaXJobabgi0njBocPLbl/TS71TyY3hcZJat+83MtmqoL9lhM38rxDLH6KvyY6jqHtcQoEKCc8xw= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687981992787642.1727412613751; Wed, 28 Jun 2023 12:53:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDD-0004hP-JB; Wed, 28 Jun 2023 15:52:24 -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 1qEbD9-0004g8-N0 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:20 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbD7-0005hx-DW for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:18 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b69e6d324aso3657561fa.0 for ; Wed, 28 Jun 2023 12:52:17 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981935; x=1690573935; 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=CCVk7jdt1nDqHH6A+S2BbR5/KvJS5BvxayG0t6p+t7Q=; b=g4Zm4T/cD6DYwp5JSBB0X0v+RiO5uDIPzzlYAGxoch8ZLRDrvu5YE02aGTtwUM1nqD LBMVfM204G/JnDsAw2Cg7DXNd7Kn2zabQRh1gIHko70K8wH4DCWF3kPZlWio/pa1RpRi nkwAKsRgOVQEGuW7ly6hAcipTOg1wTesK3o51cltzhlLExrZJb1TaKejupaWW4Qx4jw8 bK/Vpfu6fcOTiojz25Wup3YAOP7ElYGYk5jlDUQMIyuXr5K1KDi3eVBfbLQ6EgggqU3B Wm/mO6zbVBxvfgHUmgoGt4zgVnJJbFX9f2TbaI/kNx9sC4fGk28Aw2KxqTuNKgrq6gmi fuqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981935; x=1690573935; 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=CCVk7jdt1nDqHH6A+S2BbR5/KvJS5BvxayG0t6p+t7Q=; b=QiWj4M1uOKN6wA3BqrYFEn2P6N5ywKwZp3StFRWg4+E+rMi5QmPyTCAGxme3950FAD JN9Ymry4yQuBC2SGqE4mwpMKF0DVjcAq49W0y0BgWx4+aRhnrngYpmtmFDZxB3299Kcr 3b195MqkLQMjJiJhQnO5E0SwAJ1DlRIZwyPYEF7ieAkJDTG7BPkJsgmAf3l37KwOsQPc ZgqSsR79SBifXV3XcrXPev1W1ou9CnBIgEkbg7/YRP7VgNugO/q5QDccD/3BEPn3Zq4F 4fvbjDBsTagTWQvml2hA56TIHTzBNhir6+ZJ5UTRfo3j1kHK1buXJg7z3cM9Vey8fD6t m/0A== X-Gm-Message-State: AC+VfDwfRQe89EDP6/Eoz190sZGFtyoIjAMJZLKBRNkB+pYaceXhXEO9 RV9fd2el3g6SDMVJBUV0x1d3cwGB+J8= X-Google-Smtp-Source: ACHHUZ4XzFUe54bMOk0YomRIYK7gIFOvGZJcs0BNUJms0iw+xNxthUc2DBXatPOLdbaSXUrEDjKwUQ== X-Received: by 2002:a2e:9d4e:0:b0:2b4:67e0:4ce0 with SMTP id y14-20020a2e9d4e000000b002b467e04ce0mr18407294ljj.44.1687981935148; Wed, 28 Jun 2023 12:52:15 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 03/16] hw/pci-host/q35: Initialize PCMachineState::bus in board code Date: Wed, 28 Jun 2023 21:51:51 +0200 Message-ID: <20230628195204.1241-4-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::230; envelope-from=shentey@gmail.com; helo=mail-lj1-x230.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687981994895100004 The Q35 PCI host currently sets the PC machine's PCI bus attribute through global state, thereby assuming the machine to be a PC machine. The Q35 machine code already holds on to Q35's pci bus attribute, so can easily set its own property while preserving encapsulation. Signed-off-by: Bernhard Beschow Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_q35.c | 4 +++- hw/pci-host/q35.c | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index d9f3764184..4edc0b35f4 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -230,10 +230,12 @@ static void pc_q35_init(MachineState *machine) x86ms->below_4g_mem_size, NULL); object_property_set_int(phb, PCI_HOST_ABOVE_4G_MEM_SIZE, x86ms->above_4g_mem_size, NULL); + sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); =20 /* pci */ - sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); host_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); + pcms->bus =3D host_bus; + /* create ISA bus */ lpc =3D pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), = true, TYPE_ICH9_LPC_DEVICE); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 84137b9ad9..0604464074 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -66,7 +66,6 @@ static void q35_host_realize(DeviceState *dev, Error **er= rp) s->mch.pci_address_space, s->mch.address_space_io, 0, TYPE_PCIE_BUS); - PC_MACHINE(qdev_get_machine())->bus =3D pci->bus; pci->bypass_iommu =3D PC_MACHINE(qdev_get_machine())->default_bus_bypass_iommu; qdev_realize(DEVICE(&s->mch), BUS(pci->bus), &error_fatal); --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982014; cv=none; d=zohomail.com; s=zohoarc; b=Aqa1IRL/NrQVPmeHEmnccqgi8Z0lHnjP8II/t0Gsftvd686tXJ3JWL00rqbyqcZ2CSTQfMgRrEBROaRnSFWSo8t1lXRQkl5WqjMKEnuTB7W/kqsIMDNYauSpp4LUemDSPJ3lUvIdmAsdCP/JCQ8L1Pvs4ftsw9XLF0Q10ceMAXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982014; h=Content-Transfer-Encoding:Cc: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=3zxuFy1nKO4CI4FNaygwtRvNzJbOGIkhIVlB0FND1xI=; b=FC/2+9fd0BKdMaq2ptLpL/Zj+afePgaI+uLfHkEbScixLrpGBgk7ERXhhTlV9MQPHFzk3TS7nl0fVCC22i5QUVrCLLA+Rk+emVUPx8OA4eWIHShxLopnD7zfmvExU9VaenJjcVzjJV3a1AzKIsQ6ECIs3Qq2Wghll72WKorIN94= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982014629373.36924363450703; Wed, 28 Jun 2023 12:53:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDE-0004hQ-64; Wed, 28 Jun 2023 15:52:24 -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 1qEbDA-0004gM-UX for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:21 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbD9-0005iC-F8 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:20 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-986d8332f50so25154266b.0 for ; Wed, 28 Jun 2023 12:52:18 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981936; x=1690573936; 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=3zxuFy1nKO4CI4FNaygwtRvNzJbOGIkhIVlB0FND1xI=; b=iNk9AerB1EuR7lMgwcmm81Z/3vVFueV6R0Ojb5oQgjTczIPhVl3PmrTBesMyU17MJF AFrAX6iEtu1Ni4U7nYUfrELKJnrItqUGbbtRaoY/pywbiQELK+nES/swA2qOGw7t+omF PTa1szS8JmQjdtb7JuaMG2VGhEyYTx51aVEN0VhhtIBQ+cTxpZKyFHm6wgpYvPWlhw7v CVIXHHlbndOSLME4Ojwi4IBjAS7qFkPFGvDg04zu0YxSCmfQ6xYsUL6/DovsL5h1DLXt VFLE2D5Or24Ccenu6+6oMXRT3U1xDdkhz5uq2jqaTb4wRlsOuGZnMxFzvv1x//X/yP+U +Rcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981936; x=1690573936; 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=3zxuFy1nKO4CI4FNaygwtRvNzJbOGIkhIVlB0FND1xI=; b=Z4EGX88r+LVkn5FzSmcc+xmSJiBkUhfKiEwp5dC58Q7kJYtUCGq/HN+7ENjAtF0oLq ZXOv5r6oZtDqupLlnROpLb66QQwHYbELKPgi2/lybiot8e4JIFzoXKNeoEmpLIZ02gRQ wK5yLLEoYyxZ6upTnPUsARp8CMVWbuiql9owVCHT3kvutzQsjTjy8z5hylBCi2cEEnbl HIOgVEnYMIuW3co6a+ebKhlD8azpxhlIdUKOvFynvhauTuf64g9H5TzTusjbI+VYAoon 5ErLj3o2clN+CylSVj4Ldnh3II1xG2Algl708XfwOoJWKp/4gVyB0CgMcmg9aJ9hTb/l tKDg== X-Gm-Message-State: AC+VfDzkvF+ICM7fxArvXDIWxI6Y14QYe0GtL/MM6cR3C3dQF/jep9iZ iz9O6Wht1XxkMPVhXERv8os3/Dzuukc= X-Google-Smtp-Source: ACHHUZ431JrQQMgBSIZJcOVcHnwOtvvMiYgS8LSLFoGfl0VoHsYQ1r6d83AONOucJaN2BJ1tbFA0iA== X-Received: by 2002:a17:906:3c06:b0:991:e17c:f8fa with SMTP id h6-20020a1709063c0600b00991e17cf8famr5059546ejg.61.1687981936341; Wed, 28 Jun 2023 12:52:16 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , Igor Mammedov Subject: [PATCH v2 04/16] hw/pci/pci_host: Introduce PCI_HOST_BYPASS_IOMMU macro Date: Wed, 28 Jun 2023 21:51:52 +0200 Message-ID: <20230628195204.1241-5-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::633; envelope-from=shentey@gmail.com; helo=mail-ej1-x633.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982015886100001 Content-Type: text/plain; charset="utf-8" Introduce a macro to avoid copy and pasting strings which can easily cause typos. Suggested-by: Michael S. Tsirkin Signed-off-by: Bernhard Beschow Reviewed-by: Igor Mammedov --- include/hw/pci/pci_host.h | 2 ++ hw/pci/pci_host.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h index c6f4eb4585..e52d8ec2cd 100644 --- a/include/hw/pci/pci_host.h +++ b/include/hw/pci/pci_host.h @@ -31,6 +31,8 @@ #include "hw/sysbus.h" #include "qom/object.h" =20 +#define PCI_HOST_BYPASS_IOMMU "bypass-iommu" + #define TYPE_PCI_HOST_BRIDGE "pci-host-bridge" OBJECT_DECLARE_TYPE(PCIHostState, PCIHostBridgeClass, PCI_HOST_BRIDGE) =20 diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c index dfd185bbb4..7af8afdcbe 100644 --- a/hw/pci/pci_host.c +++ b/hw/pci/pci_host.c @@ -232,7 +232,7 @@ const VMStateDescription vmstate_pcihost =3D { static Property pci_host_properties_common[] =3D { DEFINE_PROP_BOOL("x-config-reg-migration-enabled", PCIHostState, mig_enabled, true), - DEFINE_PROP_BOOL("bypass-iommu", PCIHostState, bypass_iommu, false), + DEFINE_PROP_BOOL(PCI_HOST_BYPASS_IOMMU, PCIHostState, bypass_iommu, fa= lse), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982098; cv=none; d=zohomail.com; s=zohoarc; b=ZUO482wSTCMDASeSvlAZEe8m8SFJGqlgjywL+q/J5xSWv7gHrlkGbjsvtY5kqsha6nNv944qovw2sBkCb4NovCZ7to19scXjzkGEZzUPIWAVm51rug4mhuFxaRpS7FexDTLFD/A0hhdiMikDJq053d4WLApyrK1Y8mOakJ7PyRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982098; h=Content-Type:Content-Transfer-Encoding:Cc: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=rtJ3y6eIvCQ3GWIbAZbSOrnzKk4wFNnFByJB8omAiJU=; b=mSlXgNfMXAdwlOgRYFvlCCSd7dUMnqXN03MN4GUjcWkZEyndsEMJgVr9/Wh3W8BmXNNxP3QjvYzaB7A5JDP5EBgW3xbWiysF9u7lUSiasqdY6axqLkBqCYxzEfaSjd0lcVABMgnalu8ROzkZBd7HUKm9W27XxXQG4ms1Ym6TnzM= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982097902574.5715383526324; Wed, 28 Jun 2023 12:54:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDI-0004j6-50; Wed, 28 Jun 2023 15:52:28 -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 1qEbDB-0004gQ-Ce for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:21 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbD9-0005iL-P6 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:21 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b6a152a933so3318611fa.1 for ; Wed, 28 Jun 2023 12:52:19 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981938; x=1690573938; 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=rtJ3y6eIvCQ3GWIbAZbSOrnzKk4wFNnFByJB8omAiJU=; b=ZC/Xsx5/QQOSSWgdWPF/3jl6ZZXO7ysNyR7PaPM4w1GbIvWcUrMIxRCHMO+5aBKW1J IBYiKDlzY/JIsNLmsgzI10AJqUZD3xmWHnnHD1S9ag9XRKpFmmrp3/b9RQ/nUywcTdwV qn4agobHIYL2x2IgwyYQ59OzNiAnPLncOMnZBy9jvwnY9MxraSf9Xzj3of5tY7b2oL8v Q1Mu7IeD2W/rroHIsDMgOyUtSDQOEj21qeYkqcuOGhpG+jBTn21z0sw2eduQjdEJpSa6 3EJgdahxPRgvuhydsQ2fitllyGMaVWYjxCBZbFXs39jcO0GKa7NcOkr310MGGhLYrI1C XpPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981938; x=1690573938; 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=rtJ3y6eIvCQ3GWIbAZbSOrnzKk4wFNnFByJB8omAiJU=; b=U1NbswwjaeO7Wo5olJlSuv1IL0wqarEgyIbn5lBmMEaTg7nmMRHxZcijwndBv59fjx 3DHEahauufi+VS0TEVRJdLKzFjaFG1fyaxC/sOZvhk7bdqujta/e9gE75IsLm6sB1xlj rcJE1H3F11QqrEwLNdlk5+crylFK5WUC1jNuvfjAizoPVHcifJ/vSEAF9FJWWD3nChXX beSEj5d8y1RyxW57GPWCnnLkMsDlxx9rGqEvlyLBjV73PTzF/5ZPsDhqgS0E6lu7ACP/ ESWQbllfpJavyuIGIm8lO7ofo0rEt7uiQFclxMMNg2RyTKpgv5x3rk40OsHkPui9vVdL V59A== X-Gm-Message-State: AC+VfDwVvLyY8eRar3QaODbK7c2pl0uWGCmQaq8x9D1x79XR3xEY7ILc MZz7+wfdYlMAr9SEspIvIYFWEFp9/o0= X-Google-Smtp-Source: ACHHUZ5LnvxeG3A+9dPam1D2a0NQlXIQSXqx7QKUujZZfDMC/xoKzs/pQt7SUu8aQ3nJkqH21ryphQ== X-Received: by 2002:a2e:8443:0:b0:2b1:edfe:8171 with SMTP id u3-20020a2e8443000000b002b1edfe8171mr21950229ljh.36.1687981937707; Wed, 28 Jun 2023 12:52:17 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 05/16] hw/pci-host/q35: Initialize PCI_HOST_BYPASS_IOMMU property from board code Date: Wed, 28 Jun 2023 21:51:53 +0200 Message-ID: <20230628195204.1241-6-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::22c; envelope-from=shentey@gmail.com; helo=mail-lj1-x22c.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982099297100007 The Q35 PCI host already has a PCI_HOST_BYPASS_IOMMU property. However, the host initializes this property itself by accessing global machine state, thereby assuming it to be a PC machine. Avoid this by having board code set this property. Signed-off-by: Bernhard Beschow Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_q35.c | 2 ++ hw/pci-host/q35.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 4edc0b35f4..852250e8cb 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -230,6 +230,8 @@ static void pc_q35_init(MachineState *machine) x86ms->below_4g_mem_size, NULL); object_property_set_int(phb, PCI_HOST_ABOVE_4G_MEM_SIZE, x86ms->above_4g_mem_size, NULL); + object_property_set_bool(phb, PCI_HOST_BYPASS_IOMMU, + pcms->default_bus_bypass_iommu, NULL); sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); =20 /* pci */ diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 0604464074..d2830cee34 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -66,8 +66,7 @@ static void q35_host_realize(DeviceState *dev, Error **er= rp) s->mch.pci_address_space, s->mch.address_space_io, 0, TYPE_PCIE_BUS); - pci->bypass_iommu =3D - PC_MACHINE(qdev_get_machine())->default_bus_bypass_iommu; + qdev_realize(DEVICE(&s->mch), BUS(pci->bus), &error_fatal); } =20 --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982029; cv=none; d=zohomail.com; s=zohoarc; b=iSz53H+2EwuerY9WcHL52hTksf0HOicG1pXLYk77V48eXYdXII+gSgo+aLzZ/sf7dUCQoxY4P798Y3fQIcGFY/uGsS8EnWxQKuxMB3LFS8pR/IHXz1yYgW53+GXEKNdmJbD7grAnDw8KcQiu7M52RpUWnpYNF+OtpdshssdKv/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982029; h=Content-Transfer-Encoding:Cc: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=fWlnycR5wJyTdbj8DEeaQ9aaDr9hN9D3c5m0fZQj8MU=; b=GYf/ovop8nd4lnrMpGYbDq7nOi+2f7GQL7N+S0jR2yCedPkD1zYSFPdPJY0rkQE/I3fvPD2180RTM5ORtp7F//P5y/zen3/U+/GBF+gwekg6jXbOOJHvZmzDpX1mgCohzq6iG82SW/tGHhU/X8nP4fmbQ5lMh5HLZZxCLG6EmOo= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982029691789.3109194751207; Wed, 28 Jun 2023 12:53:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDJ-0004jc-0Q; Wed, 28 Jun 2023 15:52:29 -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 1qEbDC-0004gr-9d for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:22 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDA-0005iO-Mt for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:22 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-991fee3a6b1so25188666b.0 for ; Wed, 28 Jun 2023 12:52:20 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981939; x=1690573939; 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=fWlnycR5wJyTdbj8DEeaQ9aaDr9hN9D3c5m0fZQj8MU=; b=dHQfj8xZfVNPNi67NDDtMr6ztg98xEwGKlej5ZICK/2ijaI9VUqgtDvwatQm/8PcFX ekPJZUed90DuG8BX3JfBMhPCv7mBx0WEA9IZjgUEfVMkIaXnIy9wYsEEcAUfGDxbeAqH P1X1T411rAucl0HroOvDECsnNMLxQbU+O+6gwPY4Bn9m9lVxsnmO8AUJEmOXr5foXqxi rB3iDWdztNBQTkMlcEj1t08i35Okh4PokAl8RgofPO2XnpAuvV7VSx/Q4S9YOjdXXMC1 6eZka3ep/JIyyukUmwFfOncOtzN27FkmSWDcTyJAn4qW3pcONgvT4dOnRwJdNDOayd/t HBcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981939; x=1690573939; 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=fWlnycR5wJyTdbj8DEeaQ9aaDr9hN9D3c5m0fZQj8MU=; b=FUgZYwzPKUXIW8B2nkrp75xDyzYQLIWgKLGj2ui3CMwcIlir77FI1BY9ly1cZJ51V5 gwjhnL6ypOeWyAcd2OTSx2dmuc+NYXKKbjOGoejvRoElqwkIun3vDM2XoKcUqyFstbe+ djlwE/8GV83IcdJLw2HOKioK5NMa0mcBfOT7e6R5KIWJcPFIzl5+JHLNkRiZ21UViYSd IEizs4oEXMguj86qhhAAupR/w06H+DH1zrRDQ4MmdfdeoGjfapk5z5BzQ7hXJ5lVrCGR kkvKEiQWOx2Ymhoo5wqkzq6sYGSEGZAyqhSk977pUiZL3814bqbkog9eSwEKI08nYtGY h6ig== X-Gm-Message-State: AC+VfDxsPRDH1mFwkVXX+jCCMPBp8HD3kQ4dC5PGk/W5UxU2pPBM0k8e 0Mw4beXOfuyen4u54JAa29Xdlcq4k9s= X-Google-Smtp-Source: ACHHUZ52DBeQ2cjjNsTmbdGi5j4ZEZnDL4RR6VsqkFGnT7bgJOZ6cDIPvUh+lZB6J7vtECx0oS448g== X-Received: by 2002:a17:907:3e16:b0:978:a186:464f with SMTP id hp22-20020a1709073e1600b00978a186464fmr35930860ejc.39.1687981938712; Wed, 28 Jun 2023 12:52:18 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow Subject: [PATCH v2 06/16] hw/pci-host/q35: Make some property name macros reusable by i440fx Date: Wed, 28 Jun 2023 21:51:54 +0200 Message-ID: <20230628195204.1241-7-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::62b; envelope-from=shentey@gmail.com; helo=mail-ej1-x62b.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982031024100006 Content-Type: text/plain; charset="utf-8" Signed-off-by: Bernhard Beschow --- include/hw/i386/pc.h | 4 ++++ include/hw/pci-host/q35.h | 5 ----- hw/i386/pc_q35.c | 8 ++++---- hw/pci-host/q35.c | 8 ++++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6eec0fc51d..c34c698cdd 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -146,6 +146,10 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int = level); =20 void pc_guest_info_init(PCMachineState *pcms); =20 +#define PCI_HOST_PROP_RAM_MEM "ram-mem" +#define PCI_HOST_PROP_PCI_MEM "pci-mem" +#define PCI_HOST_PROP_SYSTEM_MEM "system-mem" +#define PCI_HOST_PROP_IO_MEM "io-mem" #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index e89329c51e..1d98bbfe0d 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -74,11 +74,6 @@ struct Q35PCIHost { * gmch part */ =20 -#define MCH_HOST_PROP_RAM_MEM "ram-mem" -#define MCH_HOST_PROP_PCI_MEM "pci-mem" -#define MCH_HOST_PROP_SYSTEM_MEM "system-mem" -#define MCH_HOST_PROP_IO_MEM "io-mem" - /* PCI configuration */ #define MCH_HOST_BRIDGE "MCH" =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 852250e8cb..02dd274276 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -218,13 +218,13 @@ static void pc_q35_init(MachineState *machine) pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size); =20 object_property_add_child(OBJECT(machine), "q35", phb); - object_property_set_link(phb, MCH_HOST_PROP_RAM_MEM, + object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM, OBJECT(machine->ram), NULL); - object_property_set_link(phb, MCH_HOST_PROP_PCI_MEM, + object_property_set_link(phb, PCI_HOST_PROP_PCI_MEM, OBJECT(pci_memory), NULL); - object_property_set_link(phb, MCH_HOST_PROP_SYSTEM_MEM, + object_property_set_link(phb, PCI_HOST_PROP_SYSTEM_MEM, OBJECT(system_memory), NULL); - object_property_set_link(phb, MCH_HOST_PROP_IO_MEM, + object_property_set_link(phb, PCI_HOST_PROP_IO_MEM, OBJECT(system_io), NULL); object_property_set_int(phb, PCI_HOST_BELOW_4G_MEM_SIZE, x86ms->below_4g_mem_size, NULL); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index d2830cee34..91c46df9ae 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -240,19 +240,19 @@ static void q35_host_initfn(Object *obj) object_property_add_uint64_ptr(obj, PCIE_HOST_MCFG_SIZE, &pehb->size, OBJ_PROP_FLAG_READ); =20 - object_property_add_link(obj, MCH_HOST_PROP_RAM_MEM, TYPE_MEMORY_REGIO= N, + object_property_add_link(obj, PCI_HOST_PROP_RAM_MEM, TYPE_MEMORY_REGIO= N, (Object **) &s->mch.ram_memory, qdev_prop_allow_set_link_before_realize, 0); =20 - object_property_add_link(obj, MCH_HOST_PROP_PCI_MEM, TYPE_MEMORY_REGIO= N, + object_property_add_link(obj, PCI_HOST_PROP_PCI_MEM, TYPE_MEMORY_REGIO= N, (Object **) &s->mch.pci_address_space, qdev_prop_allow_set_link_before_realize, 0); =20 - object_property_add_link(obj, MCH_HOST_PROP_SYSTEM_MEM, TYPE_MEMORY_RE= GION, + object_property_add_link(obj, PCI_HOST_PROP_SYSTEM_MEM, TYPE_MEMORY_RE= GION, (Object **) &s->mch.system_memory, qdev_prop_allow_set_link_before_realize, 0); =20 - object_property_add_link(obj, MCH_HOST_PROP_IO_MEM, TYPE_MEMORY_REGION, + object_property_add_link(obj, PCI_HOST_PROP_IO_MEM, TYPE_MEMORY_REGION, (Object **) &s->mch.address_space_io, qdev_prop_allow_set_link_before_realize, 0); } --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982029; cv=none; d=zohomail.com; s=zohoarc; b=c6QiC6yG/1pQRI3dSS5JukNXBAyIzp625CcfkoXhvqqDgWLRmGVhaiwlm0ALVYL4eYdLyWPPOJaKvECWHiNJsUNoZ13BrnUQimBGGVI+j0/5Yh20Ydx7X5DPTmSwXWvklcxILxWwo5TMUd2/kQFL3xB24V+pjbUvA4TSD+hGe8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982029; h=Content-Type:Content-Transfer-Encoding:Cc: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=UK0QSdymOFByub6L+Ko6+j892+Q1EOkr2A7MxnMviE4=; b=EGPl+3/dB0DzcBP21DriYjyBhVnZpwvpSPivMepQVSvWitj8EPUfsU8p+dkX50k6ES9l4U4ptMZMso7u87Fj6SgiNqHT65neHxhaDU7xO0rjvp9gBYvS9EVNBXE1qzph7FWFlK1nzjXyNyI3Sm3+0jriGA1uPRnqk5Byh/gBQ0s= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982029734356.136046523553; Wed, 28 Jun 2023 12:53:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDF-0004hp-IN; Wed, 28 Jun 2023 15:52:25 -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 1qEbDC-0004h2-SX for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:22 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDB-0005iZ-Bu for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:22 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-991fee3a6b1so25190166b.0 for ; Wed, 28 Jun 2023 12:52:20 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981940; x=1690573940; 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=UK0QSdymOFByub6L+Ko6+j892+Q1EOkr2A7MxnMviE4=; b=oBewUrNXU/c3JEPhwAnvz9PDBky7HWoDdRRJXf7CloOFM/9mPvwfBFrm5vX0lnzr31 k4X4YZvR1/hDBz4WDtguZ9VRplE+uZHAkvZc2CjIhfOa5OgNY2T6Q14jpl3V45eXIvbi C7Tcv3IrM4X97DTW4gmca8lzSq9TxlPHpf5pa0N7vUBaQyGDDvMZr5hmFv77ReOt8YGA 6phpKSrKzFPuapNAtjFbZI0W0iCXn1O9jS4MlCh2TCrHakabOSjO42J7RMKWgtRyiau3 gjOOvq263pFIkaKNBKda8iPSrwXvoFHEtJiVdQ7m5FPhIG4K+kTTLi5sx8Azul99xB8T x0ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981940; x=1690573940; 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=UK0QSdymOFByub6L+Ko6+j892+Q1EOkr2A7MxnMviE4=; b=aPJDrwzBARPI7/R4uybepi7EtMX2NaDRCdf49BfmvWijIo/ZBO1UN5oUjfJ40Ai3DZ dSacb7ZYT+vdJ61fkIRIkhcJTpRZWPyW0E6jqQOEBsIJoTMVOIi0x21ZlMt7FONDQ1cD lF/2sTxNoWt27qgjfse01bV2+m+MWYlYeTO5scquAz2qwVn0AswYzAmsNzLSs53uYqxb s9Iga5pI3cubUa6FvRIerpIMJCiYGHAjakMescVLqg1ikQCPJN33FUsunJnEZjlGDqUx miSijkDgiXP8leYfy5dpOCd1n5mnEjpW3hyTxGCAquYRbaPDN825dRKbw2BkGblgYCz+ Og1Q== X-Gm-Message-State: AC+VfDywQftMukpWNolno4LbmWdunJzvnmECn1AdXCMtqfFQxs20AVS2 ZZBmuOOFiWM+COSamBmJin2L2AYGJDc= X-Google-Smtp-Source: ACHHUZ5NFYXKm5XyVTIwTm5PuVeXNUAY9JKuH/EpcqBTO3fBZwaTvWn3Eu/LC0xeVlSQy6WwZSOGbw== X-Received: by 2002:a17:907:1dec:b0:991:e3c4:c129 with SMTP id og44-20020a1709071dec00b00991e3c4c129mr6068124ejc.69.1687981939786; Wed, 28 Jun 2023 12:52:19 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 07/16] hw/pci-host/i440fx: Replace magic values by existing constants Date: Wed, 28 Jun 2023 21:51:55 +0200 Message-ID: <20230628195204.1241-8-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::62e; envelope-from=shentey@gmail.com; helo=mail-ej1-x62e.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982031023100005 Signed-off-by: Bernhard Beschow Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 61e7b97ff4..daa4d11104 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -277,8 +277,8 @@ PCIBus *i440fx_init(const char *pci_type, =20 /* if *disabled* show SMRAM to all CPUs */ memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region", - f->pci_address_space, 0xa0000, 0x20000); - memory_region_add_subregion_overlap(f->system_memory, 0xa0000, + f->pci_address_space, SMRAM_C_BASE, SMRAM_C_S= IZE); + memory_region_add_subregion_overlap(f->system_memory, SMRAM_C_BASE, &f->smram_region, 1); memory_region_set_enabled(&f->smram_region, true); =20 @@ -286,9 +286,9 @@ PCIBus *i440fx_init(const char *pci_type, memory_region_init(&f->smram, OBJECT(d), "smram", 4 * GiB); memory_region_set_enabled(&f->smram, true); memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low", - f->ram_memory, 0xa0000, 0x20000); + f->ram_memory, SMRAM_C_BASE, SMRAM_C_SIZE); memory_region_set_enabled(&f->low_smram, true); - memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram); + memory_region_add_subregion(&f->smram, SMRAM_C_BASE, &f->low_smram); object_property_add_const_link(qdev_get_machine(), "smram", OBJECT(&f->smram)); =20 --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982064; cv=none; d=zohomail.com; s=zohoarc; b=CYzuGzfL7tnxsKWP6/0meOohZyFccx7sJVIoiyuINm0spySzNf3VYGi0lx35N2Hw2Qajz8x5ByR5CFcYAbvSeWKbeVfoGRwha6wEOxY9UD2iZvDxwPgWHp6XKf5SvjXK8mVYbSn/ggbYT5sd5tw+gamHeENFhCtNt8Tccdk+TPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982064; h=Content-Type:Content-Transfer-Encoding:Cc: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=TnZDOSHqQBsSWteDv2G+9LZmJ/COR2eO+dhEfWcuy58=; b=GmhuRqccYEHnQqcTCV4YVX/k6qR65IDc1yOQEOaNeFDZ3rJIjk2Eu67nBXmS0kTQuUXhaErm1ILCEvbm+QE2j5RT75ghYXivzz52JyGQylsPNJGRm9OJlXanrWVKj0zWql30BygdvEZvv0dRj6lqDuO61VrokDFbkcy8MuxTFd8= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982064883514.5358714675951; Wed, 28 Jun 2023 12:54:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDF-0004hy-SS; Wed, 28 Jun 2023 15:52:25 -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 1qEbDE-0004hR-5X for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:24 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDC-0005iq-JC for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:23 -0400 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-977e0fbd742so21926966b.2 for ; Wed, 28 Jun 2023 12:52:22 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981941; x=1690573941; 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=TnZDOSHqQBsSWteDv2G+9LZmJ/COR2eO+dhEfWcuy58=; b=UmQPuAyif+TAhSqc0Y8ENy9wQ1MCfLs4xxfoGKvWwNLAvEKyDB/ryEBChaOaWeUjvp cqYMmSdCM9qIhXZTueQjMJwrI3LJEtrUo0p6ifBwI/gcvMfu/mxLNXciuUrCNJVVdOBe Vgoab3FW8VMnfXBRYM0KFAafktcqkIRB1PAHb4vawy2PDm+uVx4O95UKL96PVg4CJV5n f6hUphznarhJZ2ulQoSCeSdnZvZcisTC5j4Yh4xOvM2c3vijsctwbBk+UimjCLpF4ft7 rfaMBVOSAh8UmQOrAebNBtBY+yYepBzknqI9xSHB60huK3Qu7MUi/b9y/D0jYnsp9chY YgzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981941; x=1690573941; 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=TnZDOSHqQBsSWteDv2G+9LZmJ/COR2eO+dhEfWcuy58=; b=TeOUU1lqNGikmxNKdinsYVktZwXz5ptIwjWFCeL04z710gpAe+YRltZiUAc7duwo76 Y0E2clDFeHYTudcLAD3DQZOP/vNq915XrT892YyhYvIa+0fw+OIHo7mphvN5BTrAyc8/ VYeX4dEAjOj6UgZQ206YCo2LfEyl7wO+WBCn4O54SUkSTzzrvZpoJta8qf5o9YC99vNV R+lHfmLQ0xn4aXQd3O1sSKBlQIHnyp5D8FnWV0DDH1SJXhFxlJhzFHR4UhkPr+WzCnSK mJXxfWaTiuY7Tn2cjgTYEDFFInwrYQhZxnx6PGJgr9aqKqJFAfcPQ73GywX4t9QxHWrl yEWQ== X-Gm-Message-State: AC+VfDxOqFmW8aPKKxe6l2rJnwvq5sPDNBWYrVBYw97dPXcSZdp0kUNS /mBYpMNyTqcPLnkB7+dBlzTbylLty9s= X-Google-Smtp-Source: ACHHUZ4pZ82+kJrjkO+6KW4z9PtdPZ35M4HiBsQaNcKcWxkLnbYqkY9TRsAwRgEm31Zn5Ba2Fzzh/A== X-Received: by 2002:a17:907:3f87:b0:982:84c9:96c4 with SMTP id hr7-20020a1709073f8700b0098284c996c4mr31371989ejc.10.1687981940966; Wed, 28 Jun 2023 12:52:20 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 08/16] hw/pci-host/i440fx: Have common names for some local variables Date: Wed, 28 Jun 2023 21:51:56 +0200 Message-ID: <20230628195204.1241-9-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::62c; envelope-from=shentey@gmail.com; helo=mail-ej1-x62c.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982065156100001 `PCIHostState` is often referred to as `phb`, own device state usually as `= s`. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index daa4d11104..88beaf99c4 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -205,28 +205,28 @@ static void i440fx_pcihost_get_pci_hole64_end(Object = *obj, Visitor *v, =20 static void i440fx_pcihost_initfn(Object *obj) { - PCIHostState *s =3D PCI_HOST_BRIDGE(obj); + PCIHostState *phb =3D PCI_HOST_BRIDGE(obj); =20 - memory_region_init_io(&s->conf_mem, obj, &pci_host_conf_le_ops, s, + memory_region_init_io(&phb->conf_mem, obj, &pci_host_conf_le_ops, phb, "pci-conf-idx", 4); - memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s, + memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb, "pci-conf-data", 4); } =20 static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) { - PCIHostState *s =3D PCI_HOST_BRIDGE(dev); + PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 - memory_region_add_subregion(s->bus->address_space_io, 0xcf8, &s->conf_= mem); + memory_region_add_subregion(phb->bus->address_space_io, 0xcf8, &phb->c= onf_mem); sysbus_init_ioports(sbd, 0xcf8, 4); =20 - memory_region_add_subregion(s->bus->address_space_io, 0xcfc, &s->data_= mem); + memory_region_add_subregion(phb->bus->address_space_io, 0xcfc, &phb->d= ata_mem); sysbus_init_ioports(sbd, 0xcfc, 4); =20 /* register i440fx 0xcf8 port as coalesced pio */ - memory_region_set_flush_coalesced(&s->data_mem); - memory_region_add_coalescing(&s->conf_mem, 0, 4); + memory_region_set_flush_coalesced(&phb->data_mem); + memory_region_add_coalescing(&phb->conf_mem, 0, 4); } =20 static void i440fx_realize(PCIDevice *dev, Error **errp) @@ -248,17 +248,16 @@ PCIBus *i440fx_init(const char *pci_type, MemoryRegion *pci_address_space, MemoryRegion *ram_memory) { + I440FXState *s =3D I440FX_PCI_HOST_BRIDGE(dev); + PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); PCIBus *b; PCIDevice *d; - PCIHostState *s; PCII440FXState *f; unsigned i; - I440FXState *i440fx; =20 - s =3D PCI_HOST_BRIDGE(dev); b =3D pci_root_bus_new(dev, NULL, pci_address_space, address_space_io, 0, TYPE_PCI_BUS); - s->bus =3D b; + phb->bus =3D b; object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev)); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 @@ -268,8 +267,7 @@ PCIBus *i440fx_init(const char *pci_type, f->pci_address_space =3D pci_address_space; f->ram_memory =3D ram_memory; =20 - i440fx =3D I440FX_PCI_HOST_BRIDGE(dev); - range_set_bounds(&i440fx->pci_hole, below_4g_mem_size, + range_set_bounds(&s->pci_hole, below_4g_mem_size, IO_APIC_DEFAULT_ADDRESS - 1); =20 /* setup pci memory mapping */ --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982076; cv=none; d=zohomail.com; s=zohoarc; b=Rmg4whwSLCCnqYlA3lfkINudgmIEKwm6NKomHmTY3QskatR7A73xkoRhr3cdFJQZPUbuXYgoMK8o6pZ0qXF+z0uj0lp0pilUm/MuvRvetqJdsDisREzgGSdWMbZVxwrNjOjcjyFi3cPo0m5v1ka9+G4a3EkwO6cSAxYXbdqG1M4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982076; h=Content-Type:Content-Transfer-Encoding:Cc: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=wrA+4PmMXDulwwNnZ2Eajp9IPfFETxnEjuY+hG4KFbI=; b=e9Co0xsrNdP2hESVT86wPg2WnIHHR2Fsko+Zs7w9IlzllMWpapHUYC+q4KhFyDucpYKG0qaLQwBZy09OCIPdAL5keVOqZqK0U9R1UQlGB2gbZjaOCKEh0nRohdOnx55JAy3hxncMK7FKK2uArL0f0zWCsBjEiOGVoUJTB6dTibU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982076052980.9003954318354; Wed, 28 Jun 2023 12:54:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDG-0004i7-Ew; Wed, 28 Jun 2023 15:52:26 -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 1qEbDF-0004ho-Eu for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:25 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDD-0005j5-TP for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:25 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-98e1ccc6673so23174766b.3 for ; Wed, 28 Jun 2023 12:52:23 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981942; x=1690573942; 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=wrA+4PmMXDulwwNnZ2Eajp9IPfFETxnEjuY+hG4KFbI=; b=MvudMRoe3gtJRyDV8MpbflDMKeHfkwu8jByvpJek3RVqXQGczjLOx18LjAfjpCGBbk LjaRPT1YEd0Bfwu3zcFd7p0Wd1y6IXT8HZ00xgMXgcAaHN1baUNmLo5PMxQlIBvd4+rB 6oEmC9B+aOfzyAVw6idoWbeq9LwuuGrAnK/QvYZoA3PLZTJxO7XgqaXPcw0/WlppGC98 WpDIQzT7mQM1Vm+TC0943M1PBTLx2QJHXQyFXlA9785LBtPehE2QQhBHLznRhqdIocKq 4yc/zvh2t17gI3PGHWGMU2Y/dkK66Dr2K5qfoDfjxcqKOwvPSmnjdG+YOTQshhndCvji G8+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981942; x=1690573942; 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=wrA+4PmMXDulwwNnZ2Eajp9IPfFETxnEjuY+hG4KFbI=; b=JIk5U7ZZy2JwDjeeTcAIEU9npU8Uzasmp6cmSZ9EX9PKdOppP7AS8sQVvCOwNl6vwP z6v2B0gf7Nbd9mqpFoPkFOmn9TMa7rvHcFb3UpQH86VBSGrEimMvf5/9u3fpInC0FWLA 9PiC3jNua8zOV7cz+lJ0uJ4YeO/aO86mvj5ocsBvg0M6XHFdqjw1VvcKWGNsNWQdCkXL FdDv8aK7TWVCvonrFIAufKSO4FREGfponl3z6nYUthtjwxJKC66HDbDWdqaZQPDUWfdb qgpsfsfw/y/QexdylaNDSF+AROXImE8feVKlXB3pr4Lm3RFoHkgRn9Z1H8ROP/XTo/9J DStQ== X-Gm-Message-State: AC+VfDx9eQJQ6sMR2Pdnh43CfdldSu0Kk+TDt7oXw+pe/GIVJgkhFzus GKoyGg7YRCkFsj957QR00+yp7AOguKs= X-Google-Smtp-Source: ACHHUZ7sXM5WfkFHJw+nKFN8zO0YuoJlhJp+ood9xn3ThkX/Kwe6nQo7SqBVECVPgaOw4jTak2C3IA== X-Received: by 2002:a17:907:36c6:b0:974:1d8b:ca5e with SMTP id bj6-20020a17090736c600b009741d8bca5emr29301752ejc.14.1687981941964; Wed, 28 Jun 2023 12:52:21 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 09/16] hw/pci-host/i440fx: Move i440fx_realize() into PCII440FXState section Date: Wed, 28 Jun 2023 21:51:57 +0200 Message-ID: <20230628195204.1241-10-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::62f; envelope-from=shentey@gmail.com; helo=mail-ej1-x62f.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982077190100001 i440fx_realize() realizes the PCI device inside the host bridge (PCII440FXState), but is implemented between i440fx_pcihost_realize() and i440fx_init() which deal with the host bridge itself (I440FXState). Since we want to append i440fx_init() to i440fx_pcihost_realize() later let's move i440fx_realize() out of the way. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 88beaf99c4..9df4688b2e 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -65,6 +65,15 @@ struct I440FXState { */ #define I440FX_COREBOOT_RAM_SIZE 0x57 =20 +static void i440fx_realize(PCIDevice *dev, Error **errp) +{ + dev->config[I440FX_SMRAM] =3D 0x02; + + if (object_property_get_bool(qdev_get_machine(), "iommu", NULL)) { + warn_report("i440fx doesn't support emulated iommu"); + } +} + static void i440fx_update_memory_mappings(PCII440FXState *d) { int i; @@ -229,15 +238,6 @@ static void i440fx_pcihost_realize(DeviceState *dev, E= rror **errp) memory_region_add_coalescing(&phb->conf_mem, 0, 4); } =20 -static void i440fx_realize(PCIDevice *dev, Error **errp) -{ - dev->config[I440FX_SMRAM] =3D 0x02; - - if (object_property_get_bool(qdev_get_machine(), "iommu", NULL)) { - warn_report("i440fx doesn't support emulated iommu"); - } -} - PCIBus *i440fx_init(const char *pci_type, DeviceState *dev, MemoryRegion *address_space_mem, --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982095; cv=none; d=zohomail.com; s=zohoarc; b=j00VdZsitFBOQIkiJ8/ClPv4EEHN0mvXCgsRai7DbqeWhCEYSpN7veVfV3atNgB6d6bqGr44FruzPhErhfaIYCANzU/Ohr74l73Gpo3fwepuby5ErybNZBxNZwkBNEqEVj0aM9J23r9Lj6OqeaDMg6hrcbMbswWWuOoNyC49LPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982095; h=Content-Type:Content-Transfer-Encoding:Cc: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=WiFO595PbyvHK55Z+oXifs8Sd0sd0acHPDSBWvnuw9s=; b=ZcGBtItUhTfWMbp3nTKnoKhMOavTKHjxHGhHe62A5+X06fIeZDR8so7wBjRjRxg9zIirpmkq6e+vfWYM3j50bN52M44f22/W6bX9ZoPvequk9tWvfXR14zMWmfU7MWVG/x6TFFl3Dd0K9Fi8In8DTPc34anHnNbMGYeIMjg/VTY= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982095651554.7239076138975; Wed, 28 Jun 2023 12:54:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDI-0004jC-OJ; Wed, 28 Jun 2023 15:52:28 -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 1qEbDH-0004ip-6V for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:27 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDF-0005jJ-E5 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:26 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b69f1570b2so3698311fa.0 for ; Wed, 28 Jun 2023 12:52:25 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981943; x=1690573943; 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=WiFO595PbyvHK55Z+oXifs8Sd0sd0acHPDSBWvnuw9s=; b=L1UlLDKPd7NqZty+eYZZ3GDaWRfUwW6WSS97zQpxhcz2u2PKpQ3jQRSGNL+eOtp/aP cka0+vzIpOxfA0qyum3UUbmff5Jl4BhNici0VvL1RE9mOmSn2HUicdsKKZCM1KbzLc+j +fRnEXxmCUp8Z2Ju+b4w+Sde/esliihDkIAGubUylC6LGxRfrBwrSqa1qdlpwuN98fPX L//WmXLUveYNfMR0uH95Rh+MHJvBUVlS2x9izbQ0PM4rqZRWzMJqm3KXLSiw3lh4Zpv4 /HNKlTy0OQgVkKjNvKRGanmkpMcEM0rFGszbhocFBKxaS74vOc7zLRFFdW28RLO6+RSc HosA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981943; x=1690573943; 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=WiFO595PbyvHK55Z+oXifs8Sd0sd0acHPDSBWvnuw9s=; b=RHX11evkpNPr9eBZqwGhW4UufI89SuThGknLxeHYohsEA8t4jg4PLfzPIhQyftGnsL 5ryIMcQRTpsy9IcFnkVv+r2wWZAcYmEivGAarMnhRgXQb98Dv5IMIyhJMK8kp68lFCM2 dXeCOdNns+cQksjFsAZ+Yrt+EfLm1sJMlF+WprJCxEUETlTE2XEwi40YRfXgl+xWz7Xu 8oUcGXKPsqvEc4qghpqTwcWEwAWd/AhC4WJPNJK/uyLZTL4dqkOhfmub6qDIa3WQ+uEC G22eSdz3Gim+/cgxPSbx2JTF7vZQvkaw5SGlPC1+c6bn027vgXZQCGA7UxAktdfeNn9I 9NXg== X-Gm-Message-State: AC+VfDxvML1qF8IMjz79qCEC664MWR5s/PYXfHD2ZK4HcMay4iQKoD4T 6YiPhd2tDkb7XPWL05+G29vIKs2DgAA= X-Google-Smtp-Source: ACHHUZ4kj94VZRo41x56imYiVk7FGchoA3dnFGcld5SdcNxbKZcp/xJKcJsi5Md+OjmW+GN4D9vl7Q== X-Received: by 2002:a2e:8089:0:b0:2b6:b88b:6689 with SMTP id i9-20020a2e8089000000b002b6b88b6689mr3429637ljg.22.1687981943301; Wed, 28 Jun 2023 12:52:23 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 10/16] hw/pci-host/i440fx: Make MemoryRegion pointers accessible as properties Date: Wed, 28 Jun 2023 21:51:58 +0200 Message-ID: <20230628195204.1241-11-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::22c; envelope-from=shentey@gmail.com; helo=mail-lj1-x22c.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982097321100001 The goal is to eliminate i440fx_init() which is a legacy init function. This neccessitates the memory regions to be properties, like in Q35, which will = be assigned in board code. Since i440fx needs different PCI devices in Xen mode, and since i440fx shall be self-contained, the PCI device will be created during realization of the host. Thus the pointers need to be moved to the host structure to be usable= as properties. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci-host/i440fx.h | 3 --- hw/pci-host/i440fx.c | 42 +++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index bf57216c78..e3a550021e 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -25,9 +25,6 @@ struct PCII440FXState { PCIDevice parent_obj; /*< public >*/ =20 - MemoryRegion *system_memory; - MemoryRegion *pci_address_space; - MemoryRegion *ram_memory; PAMMemoryRegion pam_regions[PAM_REGIONS_COUNT]; MemoryRegion smram_region; MemoryRegion smram, low_smram; diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 9df4688b2e..efc940ba12 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -47,6 +47,10 @@ OBJECT_DECLARE_SIMPLE_TYPE(I440FXState, I440FX_PCI_HOST_= BRIDGE) =20 struct I440FXState { PCIHostState parent_obj; + + MemoryRegion *system_memory; + MemoryRegion *pci_address_space; + MemoryRegion *ram_memory; Range pci_hole; uint64_t pci_hole64_size; bool pci_hole64_fix; @@ -214,12 +218,25 @@ static void i440fx_pcihost_get_pci_hole64_end(Object = *obj, Visitor *v, =20 static void i440fx_pcihost_initfn(Object *obj) { + I440FXState *s =3D I440FX_PCI_HOST_BRIDGE(obj); PCIHostState *phb =3D PCI_HOST_BRIDGE(obj); =20 memory_region_init_io(&phb->conf_mem, obj, &pci_host_conf_le_ops, phb, "pci-conf-idx", 4); memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb, "pci-conf-data", 4); + + object_property_add_link(obj, PCI_HOST_PROP_RAM_MEM, TYPE_MEMORY_REGIO= N, + (Object **) &s->ram_memory, + qdev_prop_allow_set_link_before_realize, 0); + + object_property_add_link(obj, PCI_HOST_PROP_PCI_MEM, TYPE_MEMORY_REGIO= N, + (Object **) &s->pci_address_space, + qdev_prop_allow_set_link_before_realize, 0); + + object_property_add_link(obj, PCI_HOST_PROP_SYSTEM_MEM, TYPE_MEMORY_RE= GION, + (Object **) &s->system_memory, + qdev_prop_allow_set_link_before_realize, 0); } =20 static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) @@ -255,7 +272,11 @@ PCIBus *i440fx_init(const char *pci_type, PCII440FXState *f; unsigned i; =20 - b =3D pci_root_bus_new(dev, NULL, pci_address_space, + s->system_memory =3D address_space_mem; + s->pci_address_space =3D pci_address_space; + s->ram_memory =3D ram_memory; + + b =3D pci_root_bus_new(dev, NULL, s->pci_address_space, address_space_io, 0, TYPE_PCI_BUS); phb->bus =3D b; object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev)); @@ -263,20 +284,17 @@ PCIBus *i440fx_init(const char *pci_type, =20 d =3D pci_create_simple(b, 0, pci_type); f =3D I440FX_PCI_DEVICE(d); - f->system_memory =3D address_space_mem; - f->pci_address_space =3D pci_address_space; - f->ram_memory =3D ram_memory; =20 range_set_bounds(&s->pci_hole, below_4g_mem_size, IO_APIC_DEFAULT_ADDRESS - 1); =20 /* setup pci memory mapping */ - pc_pci_as_mapping_init(f->system_memory, f->pci_address_space); + pc_pci_as_mapping_init(s->system_memory, s->pci_address_space); =20 /* if *disabled* show SMRAM to all CPUs */ memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region", - f->pci_address_space, SMRAM_C_BASE, SMRAM_C_S= IZE); - memory_region_add_subregion_overlap(f->system_memory, SMRAM_C_BASE, + s->pci_address_space, SMRAM_C_BASE, SMRAM_C_S= IZE); + memory_region_add_subregion_overlap(s->system_memory, SMRAM_C_BASE, &f->smram_region, 1); memory_region_set_enabled(&f->smram_region, true); =20 @@ -284,17 +302,17 @@ PCIBus *i440fx_init(const char *pci_type, memory_region_init(&f->smram, OBJECT(d), "smram", 4 * GiB); memory_region_set_enabled(&f->smram, true); memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low", - f->ram_memory, SMRAM_C_BASE, SMRAM_C_SIZE); + s->ram_memory, SMRAM_C_BASE, SMRAM_C_SIZE); memory_region_set_enabled(&f->low_smram, true); memory_region_add_subregion(&f->smram, SMRAM_C_BASE, &f->low_smram); object_property_add_const_link(qdev_get_machine(), "smram", OBJECT(&f->smram)); =20 - init_pam(&f->pam_regions[0], OBJECT(d), f->ram_memory, f->system_memor= y, - f->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); + init_pam(&f->pam_regions[0], OBJECT(d), s->ram_memory, s->system_memor= y, + s->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); for (i =3D 0; i < ARRAY_SIZE(f->pam_regions) - 1; ++i) { - init_pam(&f->pam_regions[i + 1], OBJECT(d), f->ram_memory, - f->system_memory, f->pci_address_space, + init_pam(&f->pam_regions[i + 1], OBJECT(d), s->ram_memory, + s->system_memory, s->pci_address_space, PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } =20 --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982102; cv=none; d=zohomail.com; s=zohoarc; b=j/9/M0XU2bYaWuJyJyUgAWC3jygdggmD5V9BWMGwiduV1Pw9Gdri0MqcbHc/llxg4IIqbTNg6mHRn3KGVZ9D2fhf6HqjmcMWtbjflyRtgqowwBXGPTIXpji6EOBKGox9URsQtVWNCLx0+WKBc2vV0MfEtHRbghmuDUlfswacVGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982102; h=Content-Transfer-Encoding:Cc: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=gKD6DSHKY/sOvXmo5WfDcFMeb6GuFh7TX7kHJMrdslc=; b=JBSN7lUlGFNKNJz5UgkPutyXAK6IvLEo0V7rhTL4Lm9jI9+nYSn9XWICmg3y1gHwlJJHFb8bYxVszjsZ69Riqfq1y+cgX1StwaaI/TXc9sWSVuWvE6pjOWFmz3dmLa8LSJgM/BAAFJjhfUH8cznt3Jts7OLXWMJ9N/0wzz/27LU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982102868272.6742314432962; Wed, 28 Jun 2023 12:55:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDI-0004j7-Fx; Wed, 28 Jun 2023 15:52:28 -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 1qEbDH-0004iy-IM for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:27 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDG-0005jM-0m for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:27 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-98e1ccc6673so23179166b.3 for ; Wed, 28 Jun 2023 12:52:25 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981944; x=1690573944; 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=gKD6DSHKY/sOvXmo5WfDcFMeb6GuFh7TX7kHJMrdslc=; b=rj5RKPkLxz9iPfmkmZ6wu+hrkhdIXqIMzOtKOvFc0vN4EJHmS0wrGZeDVI9nnCXwdu dm2F/AqxLKKXJGb2eZOCHtZPYDGCn3hyk34sehiArc/fsmsVU7huymdSjIVjItgabXCi ADfIjDvgi1mElKspCdAGSix371yUHIPxpCZwaf+TbIx6Jo2svVCiWUNbqG1qTrOxteFF ocLBfUcH+VQB3+hPLOQLVGYcdxXC3zg4KIBeO6wXMtgwFJSsbsTPYFfVApSruFwh9aL+ xybzJPD7YUBfCULbh0FEemMja+S61tTOBC5AhO+nxTNR2GaVtcAgz3t6aGDn8WUyA1ZM JwMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981944; x=1690573944; 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=gKD6DSHKY/sOvXmo5WfDcFMeb6GuFh7TX7kHJMrdslc=; b=RENDfkNq/zGiBcE7i+Hc06FCbb+rQW9OlQNuxmTCBRIikHLCFCX7O5nkM7Zxx7S7Eg IV3VNJuOMK3xuKmm/Jgsc+nlURAiF9+42VJU55nTwsBZQZ9ihR9LnyA0czHstHh/nVJ+ K+hr0R8XJPgU4jAxZwxo5t94+MbpAYKMynPQ9ZJNhMl7eT9d8mtrCAwKCzAHe5tR3shT vZ8BfUGuUvLcpvyw4k42wUoaA7cP3UzDW+jL+v3OCz4Ia0X6EPZNHstIdJO1blpz1OeJ 28APE4g/UNofqqjeQIt6pF1rCTVzGaYi4eSRL7HEiKhvU9LflqFcTM+i6diCS9uQ3YrY nCHQ== X-Gm-Message-State: AC+VfDzpTh47vvUcZkWHWAuqI+a02yOGUX8B0SediXiyimvadM4GogyX 01azLEwaChvqHqTddOAnyAWxe2y98Qk= X-Google-Smtp-Source: ACHHUZ7I78F4kraS2Haup/mqkjf7BVTf+fqE3deww6zuwzBlg3Fke4bQE47f2tYmSMPLFGMUNRklPg== X-Received: by 2002:a17:906:a245:b0:96f:45cd:6c24 with SMTP id bi5-20020a170906a24500b0096f45cd6c24mr27805663ejb.23.1687981944397; Wed, 28 Jun 2023 12:52:24 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow Subject: [PATCH v2 11/16] hw/pci-host/i440fx: Add PCI_HOST_PROP_IO_MEM property Date: Wed, 28 Jun 2023 21:51:59 +0200 Message-ID: <20230628195204.1241-12-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::631; envelope-from=shentey@gmail.com; helo=mail-ej1-x631.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982103313100001 Content-Type: text/plain; charset="utf-8" Introduce the property in anticipation of QOM'ification; Q35 has the same property. Signed-off-by: Bernhard Beschow --- hw/pci-host/i440fx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index efc940ba12..a740d1762b 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -27,7 +27,6 @@ #include "qemu/range.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" -#include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/i440fx.h" #include "hw/qdev-properties.h" @@ -49,6 +48,7 @@ struct I440FXState { PCIHostState parent_obj; =20 MemoryRegion *system_memory; + MemoryRegion *io_memory; MemoryRegion *pci_address_space; MemoryRegion *ram_memory; Range pci_hole; @@ -237,17 +237,22 @@ static void i440fx_pcihost_initfn(Object *obj) object_property_add_link(obj, PCI_HOST_PROP_SYSTEM_MEM, TYPE_MEMORY_RE= GION, (Object **) &s->system_memory, qdev_prop_allow_set_link_before_realize, 0); + + object_property_add_link(obj, PCI_HOST_PROP_IO_MEM, TYPE_MEMORY_REGION, + (Object **) &s->io_memory, + qdev_prop_allow_set_link_before_realize, 0); } =20 static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) { + I440FXState *s =3D I440FX_PCI_HOST_BRIDGE(dev); PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 - memory_region_add_subregion(phb->bus->address_space_io, 0xcf8, &phb->c= onf_mem); + memory_region_add_subregion(s->io_memory, 0xcf8, &phb->conf_mem); sysbus_init_ioports(sbd, 0xcf8, 4); =20 - memory_region_add_subregion(phb->bus->address_space_io, 0xcfc, &phb->d= ata_mem); + memory_region_add_subregion(s->io_memory, 0xcfc, &phb->data_mem); sysbus_init_ioports(sbd, 0xcfc, 4); =20 /* register i440fx 0xcf8 port as coalesced pio */ @@ -273,11 +278,12 @@ PCIBus *i440fx_init(const char *pci_type, unsigned i; =20 s->system_memory =3D address_space_mem; + s->io_memory =3D address_space_io; s->pci_address_space =3D pci_address_space; s->ram_memory =3D ram_memory; =20 b =3D pci_root_bus_new(dev, NULL, s->pci_address_space, - address_space_io, 0, TYPE_PCI_BUS); + s->io_memory, 0, TYPE_PCI_BUS); phb->bus =3D b; object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev)); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982038; cv=none; d=zohomail.com; s=zohoarc; b=IHdlpr9lXEJ8LHPaXOo3BahtW8AxTW9XmrDD9b7/716ibbocyAeKuNJzJ71tOCceaiYQEksIsSj0E0LBhb2Le1YiftHAiOkCXnYUGN8G882sljZQ+EaVWv0yhKwyU6sw/BZnleni4LIZZ+rXl3nD5jt0rTZiEYdFH/PgzOffDkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982038; h=Content-Transfer-Encoding:Cc: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=mL6z6NKnRj7uKbeJl/5GmAu1q3jetiBvcyAOgocsCSQ=; b=SokmVjoI1Ac6BCPhVw3qGAnb+YPMXCQSNxKfUSdXgKO3YTRWPgzd1PlzI6OSfUmmWTKe9CIg8uBi6GvqSoGT6AiXH3vIDUx7TEa8yBujixhb77/LwFxfLM854gpvXxbAvZ0foglQ3n9qSxaddiz34A+/EiBh0AC2F8/9xA9jm20= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168798203817592.36706907419125; Wed, 28 Jun 2023 12:53:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDL-0004kW-4h; Wed, 28 Jun 2023 15:52:31 -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 1qEbDJ-0004je-0C for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:29 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDH-0005jX-8Y for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:28 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-991e69499d1so20684266b.2 for ; Wed, 28 Jun 2023 12:52:26 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981945; x=1690573945; 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=mL6z6NKnRj7uKbeJl/5GmAu1q3jetiBvcyAOgocsCSQ=; b=RsTnsSRG2QbMdkxGxMftOLIQ1si5yrkMKk9BxDT79cJH3ljn/KSig4m/CxaFPnEks2 h1oJ6faSs6JScXo0D4eQ9BhcqJYKy60NfTCJN/FPgS6X7h60UCkI/6325fYXXnl4xt5p N98fckPt1/ny0L5DJIKi5qZ4Fqv1bpvRgm8es5uhPUyrpolVNetnnrD0tVCRMe/WI2PR pkPSGkxrM0TfkyWLtX2M18126hr9yQ48Bek8E8Y87QA6To+sPF7DGX5u1IMOHvH5AXyH 6ii5N9/XBJdZMq/V6gc4XxkC4aj51AnAj3kNRd9WivDwqa6oZwpIRm7sviWyqn+RnBs5 jzyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981945; x=1690573945; 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=mL6z6NKnRj7uKbeJl/5GmAu1q3jetiBvcyAOgocsCSQ=; b=b+B1la5ZCbSz/krM2EgZzm37lr5ySsL+FGeQE2uRRGvh2EDkUPQeMuHkZn+LQ33rji T91AYUfwXLnq0hzhnaaGeF80kGTCh74UnEBgFWLr5fwJCkbrLz+Xyx/9BVRwRWl18Swa ETUS9kSU95beQ/QvTIehUSaDtjLINaQeL5KWTtmFxIcffvCZo+kOz3tKyYSH0MC4gdqO AXQE+J69PLBKuMewWCSH7bfJOi9hVCJ/9IZzVADhjfsaa6MxyyWJf9dGZGkyjp8dGBar 8UYASoa/PID/rnE1AnmPVQGRt5dzI5dovKBaxOUEOWOKw9oDfKheEXPq+kkJ9/R6tL4z oP/A== X-Gm-Message-State: AC+VfDyD5jftgHw8//A7CR8FS4t7vsjnhLPdOigo1DuD4B6g4FYyr1zy ORB1UV1v/LGPcrT2c/bTP7R0AS+7J9U= X-Google-Smtp-Source: ACHHUZ7db4UIJbdDZPV3xjqaAvFZDGUf9PugH/TDo3HcHI0Ey5q1VjYwWtrrhPM4ItF/7qJMxYbTUw== X-Received: by 2002:a17:906:4793:b0:978:8937:19ba with SMTP id cw19-20020a170906479300b00978893719bamr32857892ejc.44.1687981945556; Wed, 28 Jun 2023 12:52:25 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow Subject: [PATCH v2 12/16] hw/pci-host/i440fx: Add PCI_HOST_{ABOVE, BELOW}_4G_MEM_SIZE properties Date: Wed, 28 Jun 2023 21:52:00 +0200 Message-ID: <20230628195204.1241-13-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::635; envelope-from=shentey@gmail.com; helo=mail-ej1-x635.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982039025100001 Content-Type: text/plain; charset="utf-8" Introduce the properties in anticipation of QOM'ification; Q35 has the same properties. Note that we want to avoid a "ram size" property in the QOM interface since= it seems redundant to both properties introduced in this change. Thus the remo= val of the ram_size parameter. We assume the invariant of both properties to su= m up to "ram size" which is already asserted in pc_memory_init(). Under Xen the invariant seems to hold as well, so we now also check it there. Signed-off-by: Bernhard Beschow --- include/hw/pci-host/i440fx.h | 1 - hw/i386/pc_piix.c | 5 ++++- hw/pci-host/i440fx.c | 12 ++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index e3a550021e..7e38456ebb 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -36,7 +36,6 @@ PCIBus *i440fx_init(const char *pci_type, DeviceState *dev, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, - ram_addr_t ram_size, ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size, MemoryRegion *pci_memory, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index f9947fbc10..87bee368fc 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -227,6 +227,9 @@ static void pc_init1(MachineState *machine, if (!xen_enabled()) { pc_memory_init(pcms, system_memory, rom_memory, hole64_size); } else { + assert(machine->ram_size =3D=3D x86ms->below_4g_mem_size + + x86ms->above_4g_mem_size); + pc_system_flash_cleanup_unused(pcms); if (machine->kernel_filename !=3D NULL) { /* For xen HVM direct kernel boot, load linux here */ @@ -242,7 +245,7 @@ static void pc_init1(MachineState *machine, =20 pci_bus =3D i440fx_init(pci_type, i440fx_host, - system_memory, system_io, machine->ram_size, + system_memory, system_io, x86ms->below_4g_mem_size, x86ms->above_4g_mem_size, pci_memory, ram_memory); diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index a740d1762b..4dd70e68fa 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -52,6 +52,8 @@ struct I440FXState { MemoryRegion *pci_address_space; MemoryRegion *ram_memory; Range pci_hole; + uint64_t below_4g_mem_size; + uint64_t above_4g_mem_size; uint64_t pci_hole64_size; bool pci_hole64_fix; uint32_t short_root_bus; @@ -264,7 +266,6 @@ PCIBus *i440fx_init(const char *pci_type, DeviceState *dev, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, - ram_addr_t ram_size, ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size, MemoryRegion *pci_address_space, @@ -281,6 +282,8 @@ PCIBus *i440fx_init(const char *pci_type, s->io_memory =3D address_space_io; s->pci_address_space =3D pci_address_space; s->ram_memory =3D ram_memory; + s->below_4g_mem_size =3D below_4g_mem_size; + s->above_4g_mem_size =3D above_4g_mem_size; =20 b =3D pci_root_bus_new(dev, NULL, s->pci_address_space, s->io_memory, 0, TYPE_PCI_BUS); @@ -291,7 +294,7 @@ PCIBus *i440fx_init(const char *pci_type, d =3D pci_create_simple(b, 0, pci_type); f =3D I440FX_PCI_DEVICE(d); =20 - range_set_bounds(&s->pci_hole, below_4g_mem_size, + range_set_bounds(&s->pci_hole, s->below_4g_mem_size, IO_APIC_DEFAULT_ADDRESS - 1); =20 /* setup pci memory mapping */ @@ -322,6 +325,7 @@ PCIBus *i440fx_init(const char *pci_type, PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } =20 + ram_addr_t ram_size =3D s->below_4g_mem_size + s->above_4g_mem_size; ram_size =3D ram_size / 8 / 1024 / 1024; if (ram_size > 255) { ram_size =3D 255; @@ -381,6 +385,10 @@ static Property i440fx_props[] =3D { DEFINE_PROP_SIZE(PCI_HOST_PROP_PCI_HOLE64_SIZE, I440FXState, pci_hole64_size, I440FX_PCI_HOST_HOLE64_SIZE_DEFAULT), DEFINE_PROP_UINT32("short_root_bus", I440FXState, short_root_bus, 0), + DEFINE_PROP_SIZE(PCI_HOST_BELOW_4G_MEM_SIZE, I440FXState, + below_4g_mem_size, 0), + DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, I440FXState, + above_4g_mem_size, 0), DEFINE_PROP_BOOL("x-pci-hole64-fix", I440FXState, pci_hole64_fix, true= ), DEFINE_PROP_END_OF_LIST(), }; --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982051; cv=none; d=zohomail.com; s=zohoarc; b=TK5Hhlp891ffEEdDGLm9WgXrPCnIKv9mRATuR9KRiIUqSYAQ7QEBphOeyN8wurS/iI85FGj75wFLP4ZpxbjHLMpC6BZwVaC25lFVlS/AEURsznLqFV9fD63xvz5sLIIwiEezjwsKMtro4IPqEFZukZY8uf284MRnFllVvihN+rc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982051; h=Content-Transfer-Encoding:Cc: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=UHBCVt28+gb3jtcCQXQp5cJeJRF2BGFVeWUg0BbI4/k=; b=K3A/mqmICS5pbZLnPutpHYVOqYCI4l5hJX65ncgiHQL8KRR/cwGMv4oin2n9jPX/6PEymxF4ww6l0a7wwa/chjlOciDXpzVSjqJuU2HkvHLO2AFdIPnRJEUt0PhbWClsJHnB3rPSqFMExF3H4P6p4iPlt+ukiaD3Gvk82W+lt1Y= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982051806950.4581824147928; Wed, 28 Jun 2023 12:54:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDM-0004l8-My; Wed, 28 Jun 2023 15:52:32 -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 1qEbDK-0004kJ-KE for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:30 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDI-0005kA-U6 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:30 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-98d34f1e54fso20553266b.2 for ; Wed, 28 Jun 2023 12:52:28 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981947; x=1690573947; 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=UHBCVt28+gb3jtcCQXQp5cJeJRF2BGFVeWUg0BbI4/k=; b=eZ/0cBv/FdVLJYqU4zfdAw0zs6oqa4YrY4TficCbBxzk1J7cltsd8dvwx4sbZQ6bzc dMvHrRLPP3/M42D6AeasG3913gxalxX0tFBgdTgnb1zN/gNdoeeMMsMG/sjcEPSgSS0x dxMEw0w4HHdGia9995F69/NDh3UifkHvSD5RjHHpc/EvGJmunF+fwzxfDNp4rejQhdmd EP12FZIZWsfEEjWz+hg8L582dtUEoCampj1Fq1EiUG544xGMqnvTtykZQIytEda3U52F 7iaxDsEH+kujZRVFicPOe0r7/nD92rINCGt1Al3t5UjzNBDnGR/hIGz/aYr6NiK1ZPzO iS8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981947; x=1690573947; 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=UHBCVt28+gb3jtcCQXQp5cJeJRF2BGFVeWUg0BbI4/k=; b=dtHQzjRxPISZemdeYmQK82oBqh6OPrGIb+tUQBa2jtnYeDA++njtWPCIElej4DdtaS Oxw9CEnJAUUyQYfRgVjEDzqfJhfxSwzjIIuQa9Pz50O1TG/K9ggJ14Cm0pbbMk+rnL51 uFzRfXCsotn/3EjfUq1FN1mhLsJbarVXXGNQc98TCEq6cw6/+PbCfvHP1qOM55scEU36 LcTK5p8KYsH82UHJ+6xJg9WeXdPw1jwLyfsIX+X/rFmQTrp/LS5ShuXzUwsyZ5PSmC87 hwqjcJLTVzcFzsacoC8+fMQGXhpcfoaCCX9dNePb0eLbcIqN07dofesIpcJTHsECfi+4 2g2A== X-Gm-Message-State: AC+VfDw/V0CEKQ5mGZ7XT9yo1+Ds8oBYoWUxs3Mv6l8qNNNcO79xza3G Ip/ZhFzBMjFArbxleZqYjFdIW27rv/M= X-Google-Smtp-Source: ACHHUZ4RepXXgLbP386FB0BOYlZzPn/HivzuOujM9QncRDmT/Rj1hZIPNb2MY8426eMtLKgLTn69LQ== X-Received: by 2002:a17:907:7b96:b0:982:3e2a:91a8 with SMTP id ne22-20020a1709077b9600b009823e2a91a8mr31056025ejc.72.1687981947114; Wed, 28 Jun 2023 12:52:27 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow Subject: [PATCH v2 13/16] hw/pci-host/i440fx: Add I440FX_HOST_PROP_PCI_TYPE property Date: Wed, 28 Jun 2023 21:52:01 +0200 Message-ID: <20230628195204.1241-14-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::62a; envelope-from=shentey@gmail.com; helo=mail-ej1-x62a.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982052386100001 Content-Type: text/plain; charset="utf-8" I440FX needs a different PCI device model if the "igd-passthru" property is enabled. The type name is currently passed as a parameter to i440fx_init().= This parameter will be replaced by a property assignment once i440fx_init() gets resolved. Signed-off-by: Bernhard Beschow --- include/hw/pci-host/i440fx.h | 2 ++ hw/pci-host/i440fx.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index 7e38456ebb..2d7bae5a45 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -15,6 +15,8 @@ #include "hw/pci-host/pam.h" #include "qom/object.h" =20 +#define I440FX_HOST_PROP_PCI_TYPE "pci-type" + #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" #define TYPE_I440FX_PCI_DEVICE "i440FX" =20 diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 4dd70e68fa..e8e66afc11 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -57,6 +57,8 @@ struct I440FXState { uint64_t pci_hole64_size; bool pci_hole64_fix; uint32_t short_root_bus; + + char *pci_type; }; =20 #define I440FX_PAM 0x59 @@ -284,6 +286,7 @@ PCIBus *i440fx_init(const char *pci_type, s->ram_memory =3D ram_memory; s->below_4g_mem_size =3D below_4g_mem_size; s->above_4g_mem_size =3D above_4g_mem_size; + s->pci_type =3D (char *)pci_type; =20 b =3D pci_root_bus_new(dev, NULL, s->pci_address_space, s->io_memory, 0, TYPE_PCI_BUS); @@ -291,7 +294,7 @@ PCIBus *i440fx_init(const char *pci_type, object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev)); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 - d =3D pci_create_simple(b, 0, pci_type); + d =3D pci_create_simple(b, 0, s->pci_type); f =3D I440FX_PCI_DEVICE(d); =20 range_set_bounds(&s->pci_hole, s->below_4g_mem_size, @@ -390,6 +393,7 @@ static Property i440fx_props[] =3D { DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, I440FXState, above_4g_mem_size, 0), DEFINE_PROP_BOOL("x-pci-hole64-fix", I440FXState, pci_hole64_fix, true= ), + DEFINE_PROP_STRING(I440FX_HOST_PROP_PCI_TYPE, I440FXState, pci_type), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982069; cv=none; d=zohomail.com; s=zohoarc; b=WmvsrfpEFygZJOIfWsd0x7bQwBJBjom2vPlF38tq1UlBuaEG6O4fWVwrVyIJsGdNOIT/Aemf1XNFcZOWSGQD2M543QJE1lTQZT2A+rOb32TU14l1pZ2PuJ7hUyExGmckpmM31D77PIa9POfnQ0J+aGJr+pRj62W4hCUdxklxbk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982069; h=Content-Transfer-Encoding:Cc: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=PAuySTnUlRMKcQIw8Nf4jgD5dpIo9GmxLU1PU0Ah2h8=; b=jx/Dn0dav6/9HVoVKWMgvCHkCqinGVLz5I8gE0eHzhfAQlTUbVqXOX8oi5sth2wH7pS94xe3bdyF/xZyOw/tKaxqNf7I70DSuUuTQXF7/T/rDiL+LZyWz2/ilSr6ybdGx4FIlxpbduiDSiIZldhpwNObt+D7sAsX9wY53/WRtwA= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982069408163.56314536322486; Wed, 28 Jun 2023 12:54:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDN-0004lI-DP; Wed, 28 Jun 2023 15:52:33 -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 1qEbDL-0004km-Mp for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:31 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDJ-0005kP-V5 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:31 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-98d34f1e54fso20555266b.2 for ; Wed, 28 Jun 2023 12:52:29 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981948; x=1690573948; 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=PAuySTnUlRMKcQIw8Nf4jgD5dpIo9GmxLU1PU0Ah2h8=; b=kv9Z6o2Pa/eQMUJKSX9/22f3Pwdwbwinvvjp07jkKUFHNCF8OrgAds34bPYBjKFSIs x84a6OOBYa0Ru04vHAoQfv6rDqf2rj8IrzJQQ9GoURTXAB9AWrVhbCrZK1DVBstfz7Ih gE4dspizdO94G/2Ti81lfgESF55IK+o9uY7ZALw3WNMFxpmC8Xal+6mn3CqmLsciZgnO KRYd2emvqfZ7W1aAGSKWyyGns+bupngFKthY4El0V7rwr6VFkQd3sdy5+6PUS9TYTNxJ UWsi5pSWlz/B3cLAHokhDCkSS++Jetbx1Pl/X1AuqzfnJXl1rDDRYQjc/+2WDaM4M7Sl rV6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981948; x=1690573948; 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=PAuySTnUlRMKcQIw8Nf4jgD5dpIo9GmxLU1PU0Ah2h8=; b=WADtLR2GSOIxs5qCc/okwX/d0ufYVCgmMGqMKroAA1iHHyk+md7a5GrVk6cGIVPOiw dyVYaJOCKbSBSh0GUrLqnv+cxcgPXYp0Y1yg+1pFSjIVEQAunEj+CIOGqmu6YDnKE7gk 5ZUAE3pE996L01msoacu8fgWOsx6ERYZeS63RzoxjVMQ0A2VJpiP2lYLR/I44u4PiXBg GrbBd+3q4qRE/Zr+XRWQ8pom8rHxM/eX3aP8rg/Yedfs2TzCxaP7OhDPyrFmS01mqubR t22Xejc1u6Qb3/WIWS5cNsq2jO58IMWfwWK57qgZLUIAb+jJzrvn4FiMZ5/FRApiHIfM 2ckw== X-Gm-Message-State: AC+VfDyJ+mXcC5X6O7GuLIGfN704fRoWVgJ2ZNVmn/YzSMzFZQPz33Ar cnIsIF0WDZxm1C/l1drlN8i9Ev95wB4= X-Google-Smtp-Source: ACHHUZ4qTrKQapL480apX6W3KEZ9QUyhUZajTvGneQrEezpY8PVhNdiC+8TnNXAEj3x59ToL9p+CGQ== X-Received: by 2002:a17:907:7f16:b0:992:1233:9c45 with SMTP id qf22-20020a1709077f1600b0099212339c45mr5084249ejc.69.1687981948303; Wed, 28 Jun 2023 12:52:28 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow Subject: [PATCH v2 14/16] hw/pci-host/i440fx: Resolve i440fx_init() Date: Wed, 28 Jun 2023 21:52:02 +0200 Message-ID: <20230628195204.1241-15-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::62b; envelope-from=shentey@gmail.com; helo=mail-ej1-x62b.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982071161100011 Content-Type: text/plain; charset="utf-8" i440fx_init() is a legacy init function. The previous patches worked towards TYPE_I440FX_PCI_HOST_BRIDGE to be instantiated the QOM way. Do this now by transforming the parameters passed to i440fx_init() into property assignmen= ts. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci-host/i440fx.h | 10 ---------- hw/i386/pc_piix.c | 30 +++++++++++++++++++++--------- hw/pci-host/i440fx.c | 34 +++++----------------------------- 3 files changed, 26 insertions(+), 48 deletions(-) diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index 2d7bae5a45..c988f70890 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -34,14 +34,4 @@ struct PCII440FXState { =20 #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" =20 -PCIBus *i440fx_init(const char *pci_type, - DeviceState *dev, - MemoryRegion *address_space_mem, - MemoryRegion *address_space_io, - ram_addr_t below_4g_mem_size, - ram_addr_t above_4g_mem_size, - MemoryRegion *pci_memory, - MemoryRegion *ram_memory); - - #endif diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 87bee368fc..1df309b8e2 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -126,7 +126,7 @@ static void pc_init1(MachineState *machine, MemoryRegion *rom_memory; ram_addr_t lowmem; uint64_t hole64_size; - DeviceState *i440fx_host; + Object *i440fx_host; =20 /* * Calculate ram split, for memory below and above 4G. It's a bit @@ -201,8 +201,8 @@ static void pc_init1(MachineState *machine, pci_memory =3D g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory =3D pci_memory; - i440fx_host =3D qdev_new(host_type); - hole64_size =3D object_property_get_uint(OBJECT(i440fx_host), + i440fx_host =3D OBJECT(qdev_new(host_type)); + hole64_size =3D object_property_get_uint(i440fx_host, PCI_HOST_PROP_PCI_HOLE64_SI= ZE, &error_abort); } else { @@ -243,12 +243,24 @@ static void pc_init1(MachineState *machine, PIIX3State *piix3; PCIDevice *pci_dev; =20 - pci_bus =3D i440fx_init(pci_type, - i440fx_host, - system_memory, system_io, - x86ms->below_4g_mem_size, - x86ms->above_4g_mem_size, - pci_memory, ram_memory); + object_property_add_child(OBJECT(machine), "i440fx", i440fx_host); + object_property_set_link(i440fx_host, PCI_HOST_PROP_RAM_MEM, + OBJECT(ram_memory), &error_fatal); + object_property_set_link(i440fx_host, PCI_HOST_PROP_PCI_MEM, + OBJECT(pci_memory), &error_fatal); + object_property_set_link(i440fx_host, PCI_HOST_PROP_SYSTEM_MEM, + OBJECT(system_memory), &error_fatal); + object_property_set_link(i440fx_host, PCI_HOST_PROP_IO_MEM, + OBJECT(system_io), &error_fatal); + object_property_set_uint(i440fx_host, PCI_HOST_BELOW_4G_MEM_SIZE, + x86ms->below_4g_mem_size, &error_fatal); + object_property_set_uint(i440fx_host, PCI_HOST_ABOVE_4G_MEM_SIZE, + x86ms->above_4g_mem_size, &error_fatal); + object_property_set_str(i440fx_host, I440FX_HOST_PROP_PCI_TYPE, + pci_type, &error_fatal); + sysbus_realize_and_unref(SYS_BUS_DEVICE(i440fx_host), &error_fatal= ); + + pci_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(i440fx_host), "pci.0= ")); pci_bus_map_irqs(pci_bus, xen_enabled() ? xen_pci_slot_get_pirq : pc_pci_slot_get_pirq); diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index e8e66afc11..62d6287681 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -249,9 +249,14 @@ static void i440fx_pcihost_initfn(Object *obj) =20 static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) { + ERRP_GUARD(); I440FXState *s =3D I440FX_PCI_HOST_BRIDGE(dev); PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + PCIBus *b; + PCIDevice *d; + PCII440FXState *f; + unsigned i; =20 memory_region_add_subregion(s->io_memory, 0xcf8, &phb->conf_mem); sysbus_init_ioports(sbd, 0xcf8, 4); @@ -262,37 +267,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, = Error **errp) /* register i440fx 0xcf8 port as coalesced pio */ memory_region_set_flush_coalesced(&phb->data_mem); memory_region_add_coalescing(&phb->conf_mem, 0, 4); -} - -PCIBus *i440fx_init(const char *pci_type, - DeviceState *dev, - MemoryRegion *address_space_mem, - MemoryRegion *address_space_io, - ram_addr_t below_4g_mem_size, - ram_addr_t above_4g_mem_size, - MemoryRegion *pci_address_space, - MemoryRegion *ram_memory) -{ - I440FXState *s =3D I440FX_PCI_HOST_BRIDGE(dev); - PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); - PCIBus *b; - PCIDevice *d; - PCII440FXState *f; - unsigned i; - - s->system_memory =3D address_space_mem; - s->io_memory =3D address_space_io; - s->pci_address_space =3D pci_address_space; - s->ram_memory =3D ram_memory; - s->below_4g_mem_size =3D below_4g_mem_size; - s->above_4g_mem_size =3D above_4g_mem_size; - s->pci_type =3D (char *)pci_type; =20 b =3D pci_root_bus_new(dev, NULL, s->pci_address_space, s->io_memory, 0, TYPE_PCI_BUS); phb->bus =3D b; - object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev)); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 d =3D pci_create_simple(b, 0, s->pci_type); f =3D I440FX_PCI_DEVICE(d); @@ -336,8 +314,6 @@ PCIBus *i440fx_init(const char *pci_type, d->config[I440FX_COREBOOT_RAM_SIZE] =3D ram_size; =20 i440fx_update_memory_mappings(f); - - return b; } =20 static void i440fx_class_init(ObjectClass *klass, void *data) --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687982089; cv=none; d=zohomail.com; s=zohoarc; b=MgKZlxprzM4W/3UP0TyEUpeQSjH5bW4GpLeq2k+cWNnnSrjbLFyCsi846YF3NxfqpweDXoX6keDlzzjNdixXK5MCXxGkCbbvo3/4mqunkuHWxnbisSj1zaV7Ypcwmj90fRVC7ZuoSmLwIH0ENSUBujpQwF0EVkj88sZz4x4kzao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687982089; h=Content-Transfer-Encoding:Cc: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=mJccraeGb/rRnN46LM+nPCIzD/H53Jyy3MeNDBjGgJI=; b=Xe/q1dg9nlLiUrbvxaQwTojtWZdQyE2joXZtcRWIvcp4rnrA64TFbLSYBiws3e/yELgJcrjiISOLGntWjzvsGOK/hhf9YV2HXacO217NDFEm3B/SmNzZ+PXXfGpLTr6/wuhd3Wxf6pHzJEX8QwKAoftLVRYinRGQFdbixwY4JtE= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687982089121236.83358391816057; Wed, 28 Jun 2023 12:54:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDO-0004le-90; Wed, 28 Jun 2023 15:52:34 -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 1qEbDM-0004lA-WA for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:33 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDL-0005kX-EN for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:32 -0400 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-51d805cb33aso6481087a12.3 for ; Wed, 28 Jun 2023 12:52:31 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981949; x=1690573949; 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=mJccraeGb/rRnN46LM+nPCIzD/H53Jyy3MeNDBjGgJI=; b=MC0zvE1oIMHN6UoOtv35Aqb3H3VaACk9G+5/RCoVdIQNM4gEMvjT91ZjFm37uM4E6h wMr+rwtXBDO7+lOaT+dnaoUif6h/c5d61Wo4vPO/n57ag4UYYb2uGha+VI0QBiuEJDvZ qf8+4WhALAUjSVdfs95vsjleZeKrPD3SL4klHvYpn3H/e9iHe9pZ0rdXTZeiH3rvBDY0 mGhW22KW4j+bV6sWL0wafpDviaNNF9HPN4T3WkW3ycUOQ5vc00dRgJvkqqs//H6pWS0e l9mHfQMUJe0vE5sqFLLr00nyZ2vuRUyDrSooTLz5lMBOThayKJn2xoqO2JhdIS3721Mo wZIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981949; x=1690573949; 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=mJccraeGb/rRnN46LM+nPCIzD/H53Jyy3MeNDBjGgJI=; b=He4fKSllY3aIyHjDgvZEM0lwWc4vIpAxPw+Q3acKjrmFaCPi4GmgjsTr6plb22Gewy l2NyOaP19amKuzHxWNQCL5I0dbuaOPrLo5FAT9kM1pCEnakguY3srMhmQhomLm2oysz9 xqHXyTf2+3/XYLfQUfpNRMm+fYWagN9sqircwSa2h1BIYj9VfM5JVvR1wsE5/CPk68yK zG6kYsR9+KR5Z+35ZjjodmlKIT5vufGa//gANkgF/orTphzQ148F3o24uAed0fKiZ2L6 O4MZU5+1iNJFQ800FOKQ5z0xffA+grtpIxUpPYkTYP3eTNKUlvJUG24L4f3/3ONy7C9D ZNJA== X-Gm-Message-State: AC+VfDywziZRYcdXRdJv8WSlg4Vrj+ZZoNACSNsKmSg2ohXrrCvM/3KK zEUMDpoqd0YHCtwjDhuD7CE9KTthIa8= X-Google-Smtp-Source: ACHHUZ7cyHvGsM2plJT35qbKPUG8NT1rbMZH7+Aw+ZY7vnEmQErtBAZkLRp/p1XflxKsAbzs54IohQ== X-Received: by 2002:a17:907:1dd1:b0:98e:1484:5954 with SMTP id og17-20020a1709071dd100b0098e14845954mr10101065ejc.71.1687981949612; Wed, 28 Jun 2023 12:52:29 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , Igor Mammedov Subject: [PATCH v2 15/16] hw/i386/pc_piix: Turn some local variables into initializers Date: Wed, 28 Jun 2023 21:52:03 +0200 Message-ID: <20230628195204.1241-16-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> 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::52a; envelope-from=shentey@gmail.com; helo=mail-ed1-x52a.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687982091294100003 Content-Type: text/plain; charset="utf-8" Eliminates an else branch. Suggested-by: Igor Mammedov Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_piix.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1df309b8e2..d07218a8c9 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -122,11 +122,11 @@ static void pc_init1(MachineState *machine, BusState *idebus[MAX_IDE_BUS]; ISADevice *rtc_state; MemoryRegion *ram_memory; - MemoryRegion *pci_memory; - MemoryRegion *rom_memory; + MemoryRegion *pci_memory =3D NULL; + MemoryRegion *rom_memory =3D system_memory; ram_addr_t lowmem; - uint64_t hole64_size; - Object *i440fx_host; + uint64_t hole64_size =3D 0; + Object *i440fx_host =3D NULL; =20 /* * Calculate ram split, for memory below and above 4G. It's a bit @@ -205,11 +205,6 @@ static void pc_init1(MachineState *machine, hole64_size =3D object_property_get_uint(i440fx_host, PCI_HOST_PROP_PCI_HOLE64_SI= ZE, &error_abort); - } else { - pci_memory =3D NULL; - rom_memory =3D system_memory; - i440fx_host =3D NULL; - hole64_size =3D 0; } =20 pc_guest_info_init(pcms); --=20 2.41.0 From nobody Tue Feb 10 10:03:12 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1687981992; cv=none; d=zohomail.com; s=zohoarc; b=CKmKVrmNmBss8kJhp49Sb2w+HNwzqE6oMhGoEWR7aX8McaFdlGIMKaQjxlgXYW1dDxRXC9GAPDEEkTbNeP/K2IxOm0l1wqDrAUz7P9Q4EbU5CodiFfgPn2a7pIpx7JLUxWIx5WpWtvnjTcPU3grdtllZDZi+94g19b4VQSH8vgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687981992; h=Content-Type:Content-Transfer-Encoding:Cc: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=vuZVGOxAdERUIbSNFIHqfH0CMoojuSo58L7TfE1HkoU=; b=M/RWK2Nu221vJP/TZqH/cKSHkk+34VI06AST3VTt15Pbj1ihPE6DzwUhxV0gh2/iqAZ6cYShvjxcwSHuxlTmvo081Htxcdw7lSAcbW78RLA4+7VEcMeqE18z7t9RVd/iRNLgypUsydSU2e/qhoGyn5cIeTG4BCW/mXvKL89AudY= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168798199286980.75892121000038; Wed, 28 Jun 2023 12:53:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEbDP-0004m0-Mz; Wed, 28 Jun 2023 15:52:35 -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 1qEbDO-0004lY-3G for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:34 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEbDM-0005ki-B7 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 15:52:33 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-991c786369cso23591066b.1 for ; Wed, 28 Jun 2023 12:52:31 -0700 (PDT) Received: from archlinux.. (dynamic-077-191-074-208.77.191.pool.telefonica.de. [77.191.74.208]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm6142817ejb.172.2023.06.28.12.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 12:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687981951; x=1690573951; 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=vuZVGOxAdERUIbSNFIHqfH0CMoojuSo58L7TfE1HkoU=; b=H38jqLkdOVLCAUiqIUZOfzr7ditKus67r8uMLTb3RNT1oYdu7zm1AUYtDChBZmSSRa 3SVuGbCO5fnBlybbNVTkfbSas7y6/RAy2ZFymtKsiTV9504UD4jIl/0fqnTf1duCEDSO fWCdb3HCVXHxU8qu8y29LnGC/kKIuEbhTHXAEO8qETMMXUtmZ3KH7OqBHIk1XV/MsTON 0T/kDTxkCpsJNHs+f/y5vQX6UoKIo3uKcZ+eBct088+BVmSXbCARqSTdkQgx7UpcBCPO 3+UQQ1Jd0Sq6/uJ1JPj9kWAL0H/oAQOYVrhNfIVI0TRlg8O4hVpwCUvjnIbaKdHA2en3 F3Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687981951; x=1690573951; 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=vuZVGOxAdERUIbSNFIHqfH0CMoojuSo58L7TfE1HkoU=; b=dqnhWiqHhB1s7ohBuc3q32n3xwxhRrYRq82sskCjMlapVIeUkwFV5J+edE3KOTnqpX sk36jf1HgN5lyf0sBydO5dezYKGsHEG9z50l00AArafLLF+ophRiv2tH1607ivEElJ+2 Hp9vT54bvuVTVghv7yT+MpEz8s4NXGDZ2IJh+hoVpsKXY3dNEatPro0jjL1c2pzsMm86 nGJLfvu/f2pR+5icqtXsmkXSwoKQOD88sBIY2e6qp3uL8p7r9Ksb1OBbYwy3jiBii3Bq JNLOawc3J8MAiz8E0XTa0ou63ETK4XFN/ip5884TbyZeeMODL7i/MiXT31AmGvJcS2n4 1owA== X-Gm-Message-State: AC+VfDwIDldbJbWcI6ag0aIdzi4jhH7+jC5d/NoOzfrq9lYqTzy0zIwc sZZKHeYRmHLd7wXzHoqk0v5cj+NARp0= X-Google-Smtp-Source: ACHHUZ5/7G/5+vha9GIQqJbK8Qx4sUtUiP910aKgaiWhIv9EEVMmh2FS86wL6GRvWsBCLT9SC7+6Ag== X-Received: by 2002:a17:907:72c7:b0:98c:e72c:6b83 with SMTP id du7-20020a17090772c700b0098ce72c6b83mr18037098ejc.45.1687981950760; Wed, 28 Jun 2023 12:52:30 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Bernhard Beschow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 16/16] hw/i386/pc_piix: Move i440fx' realize near its qdev_new() Date: Wed, 28 Jun 2023 21:52:04 +0200 Message-ID: <20230628195204.1241-17-shentey@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628195204.1241-1-shentey@gmail.com> References: <20230628195204.1241-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::631; envelope-from=shentey@gmail.com; helo=mail-ej1-x631.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687981994882100003 I440FX realization is currently mixed with PIIX3 creation. Furthermore, it = is common practice to only set properties between a device's qdev_new() and qdev_realize(). Clean up to resolve both issues. Since I440FX spawns a PCI bus let's also move the pci_bus initialization th= ere. Note that when running `qemu-system-x86_64 -M pc -S` before and after this patch, `info mtree` in the QEMU console doesn't show any differences except= that the ordering is different. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_piix.c | 57 ++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index d07218a8c9..b18443d3df 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -114,7 +114,7 @@ static void pc_init1(MachineState *machine, X86MachineState *x86ms =3D X86_MACHINE(machine); MemoryRegion *system_memory =3D get_system_memory(); MemoryRegion *system_io =3D get_system_io(); - PCIBus *pci_bus; + PCIBus *pci_bus =3D NULL; ISABus *isa_bus; int piix3_devfn =3D -1; qemu_irq smi_irq; @@ -126,7 +126,6 @@ static void pc_init1(MachineState *machine, MemoryRegion *rom_memory =3D system_memory; ram_addr_t lowmem; uint64_t hole64_size =3D 0; - Object *i440fx_host =3D NULL; =20 /* * Calculate ram split, for memory below and above 4G. It's a bit @@ -198,11 +197,37 @@ static void pc_init1(MachineState *machine, } =20 if (pcmc->pci_enabled) { + Object *phb; + pci_memory =3D g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory =3D pci_memory; - i440fx_host =3D OBJECT(qdev_new(host_type)); - hole64_size =3D object_property_get_uint(i440fx_host, + + phb =3D OBJECT(qdev_new(host_type)); + object_property_add_child(OBJECT(machine), "i440fx", phb); + object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM, + OBJECT(ram_memory), &error_fatal); + object_property_set_link(phb, PCI_HOST_PROP_PCI_MEM, + OBJECT(pci_memory), &error_fatal); + object_property_set_link(phb, PCI_HOST_PROP_SYSTEM_MEM, + OBJECT(system_memory), &error_fatal); + object_property_set_link(phb, PCI_HOST_PROP_IO_MEM, + OBJECT(system_io), &error_fatal); + object_property_set_uint(phb, PCI_HOST_BELOW_4G_MEM_SIZE, + x86ms->below_4g_mem_size, &error_fatal); + object_property_set_uint(phb, PCI_HOST_ABOVE_4G_MEM_SIZE, + x86ms->above_4g_mem_size, &error_fatal); + object_property_set_str(phb, I440FX_HOST_PROP_PCI_TYPE, pci_type, + &error_fatal); + sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); + + pci_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pci.0")); + pci_bus_map_irqs(pci_bus, + xen_enabled() ? xen_pci_slot_get_pirq + : pc_pci_slot_get_pirq); + pcms->bus =3D pci_bus; + + hole64_size =3D object_property_get_uint(phb, PCI_HOST_PROP_PCI_HOLE64_SI= ZE, &error_abort); } @@ -238,29 +263,6 @@ static void pc_init1(MachineState *machine, PIIX3State *piix3; PCIDevice *pci_dev; =20 - object_property_add_child(OBJECT(machine), "i440fx", i440fx_host); - object_property_set_link(i440fx_host, PCI_HOST_PROP_RAM_MEM, - OBJECT(ram_memory), &error_fatal); - object_property_set_link(i440fx_host, PCI_HOST_PROP_PCI_MEM, - OBJECT(pci_memory), &error_fatal); - object_property_set_link(i440fx_host, PCI_HOST_PROP_SYSTEM_MEM, - OBJECT(system_memory), &error_fatal); - object_property_set_link(i440fx_host, PCI_HOST_PROP_IO_MEM, - OBJECT(system_io), &error_fatal); - object_property_set_uint(i440fx_host, PCI_HOST_BELOW_4G_MEM_SIZE, - x86ms->below_4g_mem_size, &error_fatal); - object_property_set_uint(i440fx_host, PCI_HOST_ABOVE_4G_MEM_SIZE, - x86ms->above_4g_mem_size, &error_fatal); - object_property_set_str(i440fx_host, I440FX_HOST_PROP_PCI_TYPE, - pci_type, &error_fatal); - sysbus_realize_and_unref(SYS_BUS_DEVICE(i440fx_host), &error_fatal= ); - - pci_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(i440fx_host), "pci.0= ")); - pci_bus_map_irqs(pci_bus, - xen_enabled() ? xen_pci_slot_get_pirq - : pc_pci_slot_get_pirq); - pcms->bus =3D pci_bus; - pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, TYPE_PIIX3_DEVICE); =20 @@ -285,7 +287,6 @@ static void pc_init1(MachineState *machine, rtc_state =3D ISA_DEVICE(object_resolve_path_component(OBJECT(pci_= dev), "rtc")); } else { - pci_bus =3D NULL; isa_bus =3D isa_bus_new(NULL, system_memory, system_io, &error_abort); =20 --=20 2.41.0