From nobody Wed Nov 5 13:48:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149709808977982.37263719270015; Sat, 10 Jun 2017 05:34:49 -0700 (PDT) Received: from localhost ([::1]:58409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfbL-0001HW-Bz for importer@patchew.org; Sat, 10 Jun 2017 08:34:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfXV-0006iB-Oa for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJfXU-0001dX-FR for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:49 -0400 Received: from chuckie.co.uk ([82.165.15.123]:33302 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJfXU-0001cl-92 for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:48 -0400 Received: from host109-151-159-193.range109-151.btcentralplus.com ([109.151.159.193] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dJfXJ-0003ll-1J; Sat, 10 Jun 2017 13:30:37 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, rjones@redhat.com, pbonzini@redhat.com, somlo@cmu.edu, lersek@redhat.com, mst@redhat.com, ehabkost@redhat.com Date: Sat, 10 Jun 2017 13:30:16 +0100 Message-Id: <1497097821-32754-2-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.151.159.193 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 1/6] fw_cfg: move initialisation of FWCfgState into instance_init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvram/fw_cfg.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 316fca9..144e0c6 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -1017,6 +1017,15 @@ FWCfgState *fw_cfg_find(void) return FW_CFG(object_resolve_path(FW_CFG_PATH, NULL)); } =20 +static void fw_cfg_init(Object *obj) +{ + FWCfgState *s =3D FW_CFG(obj); + + s->entries[0] =3D g_new0(FWCfgEntry, fw_cfg_max_entry(s)); + s->entries[1] =3D g_new0(FWCfgEntry, fw_cfg_max_entry(s)); + s->entry_order =3D g_new0(int, fw_cfg_max_entry(s)); +} + static void fw_cfg_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -1030,6 +1039,7 @@ static const TypeInfo fw_cfg_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .abstract =3D true, .instance_size =3D sizeof(FWCfgState), + .instance_init =3D fw_cfg_init, .class_init =3D fw_cfg_class_init, }; =20 @@ -1052,10 +1062,6 @@ static void fw_cfg_file_slots_allocate(FWCfgState *s= , Error **errp) file_slots_max); return; } - - s->entries[0] =3D g_new0(FWCfgEntry, fw_cfg_max_entry(s)); - s->entries[1] =3D g_new0(FWCfgEntry, fw_cfg_max_entry(s)); - s->entry_order =3D g_new0(int, fw_cfg_max_entry(s)); } =20 static Property fw_cfg_io_properties[] =3D { --=20 1.7.10.4 From nobody Wed Nov 5 13:48:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497098090228201.06602910663605; Sat, 10 Jun 2017 05:34:50 -0700 (PDT) Received: from localhost ([::1]:58411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfbL-0001IM-Sw for importer@patchew.org; Sat, 10 Jun 2017 08:34:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfXV-0006iC-OX for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJfXU-0001dR-2e for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:49 -0400 Received: from chuckie.co.uk ([82.165.15.123]:33297 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJfXT-0001ci-RL for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:47 -0400 Received: from host109-151-159-193.range109-151.btcentralplus.com ([109.151.159.193] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dJfXK-0003ll-8V; Sat, 10 Jun 2017 13:30:39 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, rjones@redhat.com, pbonzini@redhat.com, somlo@cmu.edu, lersek@redhat.com, mst@redhat.com, ehabkost@redhat.com Date: Sat, 10 Jun 2017 13:30:17 +0100 Message-Id: <1497097821-32754-3-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.151.159.193 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 2/6] fw_cfg: move qdev_init_nofail() out from fw_cfg_init1() into callers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mark Cave-Ayland --- hw/nvram/fw_cfg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 144e0c6..1313bfd 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -919,8 +919,6 @@ static void fw_cfg_init1(DeviceState *dev) =20 object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NUL= L); =20 - qdev_init_nofail(dev); - fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4); fw_cfg_add_bytes(s, FW_CFG_UUID, &qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)!machine->enable_graphic= s); @@ -948,6 +946,8 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_= t dma_iobase, } =20 fw_cfg_init1(dev); + qdev_init_nofail(dev); + s =3D FW_CFG(dev); =20 if (s->dma_enabled) { @@ -985,6 +985,7 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, } =20 fw_cfg_init1(dev); + qdev_init_nofail(dev); =20 sbd =3D SYS_BUS_DEVICE(dev); sysbus_mmio_map(sbd, 0, ctl_addr); --=20 1.7.10.4 From nobody Wed Nov 5 13:48:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497098093721180.4058518697442; Sat, 10 Jun 2017 05:34:53 -0700 (PDT) Received: from localhost ([::1]:58413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfbP-0001Lt-J0 for importer@patchew.org; Sat, 10 Jun 2017 08:34:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfXX-0006ii-Pw for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJfXW-0001eJ-RX for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:51 -0400 Received: from chuckie.co.uk ([82.165.15.123]:33310 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJfXW-0001cs-Ke for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:50 -0400 Received: from host109-151-159-193.range109-151.btcentralplus.com ([109.151.159.193] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dJfXL-0003ll-OZ; Sat, 10 Jun 2017 13:30:40 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, rjones@redhat.com, pbonzini@redhat.com, somlo@cmu.edu, lersek@redhat.com, mst@redhat.com, ehabkost@redhat.com Date: Sat, 10 Jun 2017 13:30:18 +0100 Message-Id: <1497097821-32754-4-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.151.159.193 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 3/6] fw_cfg: move setting of FW_CFG_ID into fw_cfg_init1() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The dma_enabled property enables us to set the FW_CFG_ID version accordingly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvram/fw_cfg.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 1313bfd..f7b78a9 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -914,12 +914,19 @@ static void fw_cfg_init1(DeviceState *dev) { FWCfgState *s =3D FW_CFG(dev); MachineState *machine =3D MACHINE(qdev_get_machine()); + uint32_t version =3D FW_CFG_VERSION; =20 assert(!object_resolve_path(FW_CFG_PATH, NULL)); =20 object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NUL= L); =20 fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4); + + if (s->dma_enabled) { + version |=3D FW_CFG_VERSION_DMA; + } + + fw_cfg_add_i32(s, FW_CFG_ID, version); fw_cfg_add_bytes(s, FW_CFG_UUID, &qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)!machine->enable_graphic= s); fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu); @@ -935,7 +942,6 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_= t dma_iobase, { DeviceState *dev; FWCfgState *s; - uint32_t version =3D FW_CFG_VERSION; bool dma_requested =3D dma_iobase && dma_as; =20 dev =3D qdev_create(NULL, TYPE_FW_CFG_IO); @@ -954,12 +960,8 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32= _t dma_iobase, /* 64 bits for the address field */ s->dma_as =3D dma_as; s->dma_addr =3D 0; - - version |=3D FW_CFG_VERSION_DMA; } =20 - fw_cfg_add_i32(s, FW_CFG_ID, version); - return s; } =20 @@ -975,7 +977,6 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, DeviceState *dev; SysBusDevice *sbd; FWCfgState *s; - uint32_t version =3D FW_CFG_VERSION; bool dma_requested =3D dma_addr && dma_as; =20 dev =3D qdev_create(NULL, TYPE_FW_CFG_MEM); @@ -997,11 +998,8 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, s->dma_as =3D dma_as; s->dma_addr =3D 0; sysbus_mmio_map(sbd, 2, dma_addr); - version |=3D FW_CFG_VERSION_DMA; } =20 - fw_cfg_add_i32(s, FW_CFG_ID, version); - return s; } =20 --=20 1.7.10.4 From nobody Wed Nov 5 13:48:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497098186889287.32845929894484; Sat, 10 Jun 2017 05:36:26 -0700 (PDT) Received: from localhost ([::1]:58430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfcu-0002X8-NP for importer@patchew.org; Sat, 10 Jun 2017 08:36:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfXY-0006in-37 for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJfXX-0001eS-5Y for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:52 -0400 Received: from chuckie.co.uk ([82.165.15.123]:33312 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJfXW-0001cu-UT for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:51 -0400 Received: from host109-151-159-193.range109-151.btcentralplus.com ([109.151.159.193] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dJfXN-0003ll-6N; Sat, 10 Jun 2017 13:30:42 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, rjones@redhat.com, pbonzini@redhat.com, somlo@cmu.edu, lersek@redhat.com, mst@redhat.com, ehabkost@redhat.com Date: Sat, 10 Jun 2017 13:30:19 +0100 Message-Id: <1497097821-32754-5-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.151.159.193 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 4/6] fw_cfg: move fw_cfg_init1() into the fw_cfg_*_realize() functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" And rename to fw_cfg_common_realize() which better describes its role. Signed-off-by: Mark Cave-Ayland --- hw/nvram/fw_cfg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index f7b78a9..87b4392 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -910,7 +910,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, vo= id *data) =20 =20 =20 -static void fw_cfg_init1(DeviceState *dev) +static void fw_cfg_common_realize(DeviceState *dev) { FWCfgState *s =3D FW_CFG(dev); MachineState *machine =3D MACHINE(qdev_get_machine()); @@ -951,7 +951,6 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_= t dma_iobase, qdev_prop_set_bit(dev, "dma_enabled", false); } =20 - fw_cfg_init1(dev); qdev_init_nofail(dev); =20 s =3D FW_CFG(dev); @@ -985,7 +984,6 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, qdev_prop_set_bit(dev, "dma_enabled", false); } =20 - fw_cfg_init1(dev); qdev_init_nofail(dev); =20 sbd =3D SYS_BUS_DEVICE(dev); @@ -1085,6 +1083,8 @@ static void fw_cfg_io_realize(DeviceState *dev, Error= **errp) return; } =20 + fw_cfg_common_realize(dev); + /* when using port i/o, the 8-bit data register ALWAYS overlaps * with half of the 16-bit control register. Hence, the total size * of the i/o region used is FW_CFG_CTL_SIZE */ @@ -1138,6 +1138,8 @@ static void fw_cfg_mem_realize(DeviceState *dev, Erro= r **errp) return; } =20 + fw_cfg_common_realize(dev); + memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops, FW_CFG(s), "fwcfg.ctl", FW_CFG_CTL_SIZE); sysbus_init_mmio(sbd, &s->ctl_iomem); --=20 1.7.10.4 From nobody Wed Nov 5 13:48:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497097952806625.3041854346664; Sat, 10 Jun 2017 05:32:32 -0700 (PDT) Received: from localhost ([::1]:58405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfZ7-0007cq-Kj for importer@patchew.org; Sat, 10 Jun 2017 08:32:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfXX-0006ih-95 for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJfXW-0001e8-Ei for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:51 -0400 Received: from chuckie.co.uk ([82.165.15.123]:33305 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJfXW-0001cp-6b for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:50 -0400 Received: from host109-151-159-193.range109-151.btcentralplus.com ([109.151.159.193] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dJfXO-0003ll-Gn; Sat, 10 Jun 2017 13:30:43 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, rjones@redhat.com, pbonzini@redhat.com, somlo@cmu.edu, lersek@redhat.com, mst@redhat.com, ehabkost@redhat.com Date: Sat, 10 Jun 2017 13:30:20 +0100 Message-Id: <1497097821-32754-6-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.151.159.193 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 5/6] fw_cfg: use sysbus_init_mmio() in fw_cfg_io_realize() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This brings the function in line with fw_cfg_mem_realize(), deferring the actual mapping until outside of the realize function. Signed-off-by: Mark Cave-Ayland --- hw/nvram/fw_cfg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 87b4392..4159316 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -941,6 +941,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_= t dma_iobase, AddressSpace *dma_as) { DeviceState *dev; + SysBusDevice *sbd; FWCfgState *s; bool dma_requested =3D dma_iobase && dma_as; =20 @@ -953,12 +954,16 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint3= 2_t dma_iobase, =20 qdev_init_nofail(dev); =20 + sbd =3D SYS_BUS_DEVICE(dev); + sysbus_add_io(sbd, iobase, sysbus_mmio_get_region(sbd, 0)); + s =3D FW_CFG(dev); =20 if (s->dma_enabled) { /* 64 bits for the address field */ s->dma_as =3D dma_as; s->dma_addr =3D 0; + sysbus_add_io(sbd, dma_iobase, sysbus_mmio_get_region(sbd, 1)); } =20 return s; @@ -1090,13 +1095,13 @@ static void fw_cfg_io_realize(DeviceState *dev, Err= or **errp) * of the i/o region used is FW_CFG_CTL_SIZE */ memory_region_init_io(&s->comb_iomem, OBJECT(s), &fw_cfg_comb_mem_ops, FW_CFG(s), "fwcfg", FW_CFG_CTL_SIZE); - sysbus_add_io(sbd, s->iobase, &s->comb_iomem); + sysbus_init_mmio(sbd, &s->comb_iomem); =20 if (FW_CFG(s)->dma_enabled) { memory_region_init_io(&FW_CFG(s)->dma_iomem, OBJECT(s), &fw_cfg_dma_mem_ops, FW_CFG(s), "fwcfg.dma", sizeof(dma_addr_t)); - sysbus_add_io(sbd, s->dma_iobase, &FW_CFG(s)->dma_iomem); + sysbus_init_mmio(sbd, &FW_CFG(s)->dma_iomem); } } =20 --=20 1.7.10.4 From nobody Wed Nov 5 13:48:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497097946747651.9638183754988; Sat, 10 Jun 2017 05:32:26 -0700 (PDT) Received: from localhost ([::1]:58404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfZ2-0007af-L3 for importer@patchew.org; Sat, 10 Jun 2017 08:32:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJfXV-0006iD-Oa for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJfXS-0001dE-3a for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:49 -0400 Received: from chuckie.co.uk ([82.165.15.123]:33315 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJfXR-0001d2-T3 for qemu-devel@nongnu.org; Sat, 10 Jun 2017 08:30:46 -0400 Received: from host109-151-159-193.range109-151.btcentralplus.com ([109.151.159.193] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dJfXP-0003ll-Oo; Sat, 10 Jun 2017 13:30:44 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, rjones@redhat.com, pbonzini@redhat.com, somlo@cmu.edu, lersek@redhat.com, mst@redhat.com, ehabkost@redhat.com Date: Sat, 10 Jun 2017 13:30:21 +0100 Message-Id: <1497097821-32754-7-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1497097821-32754-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.151.159.193 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 6/6] fw_cfg: move QOM type defines into fw_cfg.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This allows the device to be instantiated externally. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvram/fw_cfg.c | 8 -------- include/hw/nvram/fw_cfg.h | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 4159316..b77de00 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -40,14 +40,6 @@ #define FW_CFG_NAME "fw_cfg" #define FW_CFG_PATH "/machine/" FW_CFG_NAME =20 -#define TYPE_FW_CFG "fw_cfg" -#define TYPE_FW_CFG_IO "fw_cfg_io" -#define TYPE_FW_CFG_MEM "fw_cfg_mem" - -#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG) -#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO) -#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM) - /* FW_CFG_VERSION bits */ #define FW_CFG_VERSION 0x01 #define FW_CFG_VERSION_DMA 0x02 diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index b980cba..e515698 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -4,6 +4,14 @@ #include "exec/hwaddr.h" #include "hw/nvram/fw_cfg_keys.h" =20 +#define TYPE_FW_CFG "fw_cfg" +#define TYPE_FW_CFG_IO "fw_cfg_io" +#define TYPE_FW_CFG_MEM "fw_cfg_mem" + +#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG) +#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO) +#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM) + typedef struct FWCfgFile { uint32_t size; /* file size */ uint16_t select; /* write this to 0x510 to read it */ --=20 1.7.10.4