From nobody Mon May 6 09:48:55 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 150626467312796.3229497968374; Sun, 24 Sep 2017 07:51:13 -0700 (PDT) Received: from localhost ([::1]:38429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8FQ-0004rZ-Aj for importer@patchew.org; Sun, 24 Sep 2017 10:51:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Cb-0002gT-A8 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dw8Ca-0002H8-E9 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:13 -0400 Received: from chuckie.co.uk ([82.165.15.123]:49763 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 1dw8CW-000292-Gq; Sun, 24 Sep 2017 10:48:08 -0400 Received: from host86-191-82-173.range86-191.btcentralplus.com ([86.191.82.173] 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 1dw8CR-0006gI-DU; Sun, 24 Sep 2017 15:48:04 +0100 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Sun, 24 Sep 2017 15:47:40 +0100 Message-Id: <1506264466-28252-2-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.82.173 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/7] mac_dbdma: remove unused IO fields from DBDMAState 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_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These fields were used to manually handle IO requests that weren't aligned to a sector boundary before this feature was supported by the block API. Once the block API changed to support byte-aligned IO requests, the macio controller was switched over to use it in commit be1e343 but these fields were accidentally left behind. Remove them, including the initialisation in DBDMA_init(). Signed-off-by: Mark Cave-Ayland --- hw/misc/macio/mac_dbdma.c | 2 -- include/hw/ppc/mac_dbdma.h | 4 ---- 2 files changed, 6 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 3fe5073..9795172 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -893,9 +893,7 @@ void* DBDMA_init (MemoryRegion **dbdma_mem) s =3D g_malloc0(sizeof(DBDMAState)); =20 for (i =3D 0; i < DBDMA_CHANNELS; i++) { - DBDMA_io *io =3D &s->channels[i].io; DBDMA_channel *ch =3D &s->channels[i]; - qemu_iovec_init(&io->iov, 1); =20 ch->rw =3D dbdma_unassigned_rw; ch->flush =3D dbdma_unassigned_flush; diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index a860387..21bd66f 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -42,10 +42,6 @@ struct DBDMA_io { DBDMA_end dma_end; /* DMA is in progress, don't start another one */ bool processing; - /* unaligned last sector of a request */ - uint8_t head_remainder[0x200]; - uint8_t tail_remainder[0x200]; - QEMUIOVector iov; /* DMA request */ void *dma_mem; dma_addr_t dma_len; --=20 1.7.10.4 From nobody Mon May 6 09:48:55 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506264778089167.33967054224286; Sun, 24 Sep 2017 07:52:58 -0700 (PDT) Received: from localhost ([::1]:38439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8H1-0006Vz-3x for importer@patchew.org; Sun, 24 Sep 2017 10:52:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Cb-0002gb-E8 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dw8Ca-0002H1-DD for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:13 -0400 Received: from chuckie.co.uk ([82.165.15.123]:49769 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 1dw8CX-00029N-8T; Sun, 24 Sep 2017 10:48:09 -0400 Received: from host86-191-82-173.range86-191.btcentralplus.com ([86.191.82.173] 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 1dw8CS-0006gI-Kh; Sun, 24 Sep 2017 15:48:05 +0100 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Sun, 24 Sep 2017 15:47:41 +0100 Message-Id: <1506264466-28252-3-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.82.173 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/7] mac_dbdma: QOMify 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_6 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/misc/macio/mac_dbdma.c | 59 ++++++++++++++++++++++++++++++++++++----= ---- include/hw/ppc/mac_dbdma.h | 6 +++++ 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 9795172..302f131 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -851,13 +851,14 @@ static const VMStateDescription vmstate_dbdma =3D { } }; =20 -static void dbdma_reset(void *opaque) +static void mac_dbdma_reset(DeviceState *d) { - DBDMAState *s =3D opaque; + DBDMAState *s =3D MAC_DBDMA(d); int i; =20 - for (i =3D 0; i < DBDMA_CHANNELS; i++) + for (i =3D 0; i < DBDMA_CHANNELS; i++) { memset(s->channels[i].regs, 0, DBDMA_SIZE); + } } =20 static void dbdma_unassigned_rw(DBDMA_io *io) @@ -888,9 +889,22 @@ static void dbdma_unassigned_flush(DBDMA_io *io) void* DBDMA_init (MemoryRegion **dbdma_mem) { DBDMAState *s; - int i; + SysBusDevice *sbd; + + s =3D MAC_DBDMA(object_new(TYPE_MAC_DBDMA)); + object_property_set_bool(OBJECT(s), true, "realized", NULL); + + sbd =3D SYS_BUS_DEVICE(s); + *dbdma_mem =3D sysbus_mmio_get_region(sbd, 0); =20 - s =3D g_malloc0(sizeof(DBDMAState)); + return s; +} + +static void mac_dbdma_init(Object *obj) +{ + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + DBDMAState *s =3D MAC_DBDMA(obj); + int i; =20 for (i =3D 0; i < DBDMA_CHANNELS; i++) { DBDMA_channel *ch =3D &s->channels[i]; @@ -901,12 +915,37 @@ void* DBDMA_init (MemoryRegion **dbdma_mem) ch->io.channel =3D ch; } =20 - memory_region_init_io(&s->mem, NULL, &dbdma_ops, s, "dbdma", 0x1000); - *dbdma_mem =3D &s->mem; - vmstate_register(NULL, -1, &vmstate_dbdma, s); - qemu_register_reset(dbdma_reset, s); + memory_region_init_io(&s->mem, obj, &dbdma_ops, s, "dbdma", 0x1000); + sysbus_init_mmio(sbd, &s->mem); +} + +static void mac_dbdma_realize(DeviceState *dev, Error **errp) +{ + DBDMAState *s =3D MAC_DBDMA(dev); =20 s->bh =3D qemu_bh_new(DBDMA_run_bh, s); +} =20 - return s; +static void mac_dbdma_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + + dc->realize =3D mac_dbdma_realize; + dc->reset =3D mac_dbdma_reset; + dc->vmsd =3D &vmstate_dbdma; } + +static const TypeInfo mac_dbdma_type_info =3D { + .name =3D TYPE_MAC_DBDMA, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(DBDMAState), + .instance_init =3D mac_dbdma_init, + .class_init =3D mac_dbdma_class_init +}; + +static void mac_dbdma_register_types(void) +{ + type_register_static(&mac_dbdma_type_info); +} + +type_init(mac_dbdma_register_types) diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 21bd66f..4bc6274 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -26,6 +26,7 @@ #include "exec/memory.h" #include "qemu/iov.h" #include "sysemu/dma.h" +#include "hw/sysbus.h" =20 typedef struct DBDMA_io DBDMA_io; =20 @@ -160,6 +161,8 @@ typedef struct DBDMA_channel { } DBDMA_channel; =20 typedef struct { + SysBusDevice parent_obj; + MemoryRegion mem; DBDMA_channel channels[DBDMA_CHANNELS]; QEMUBH *bh; @@ -173,4 +176,7 @@ void DBDMA_register_channel(void *dbdma, int nchan, qem= u_irq irq, void DBDMA_kick(DBDMAState *dbdma); void* DBDMA_init (MemoryRegion **dbdma_mem); =20 +#define TYPE_MAC_DBDMA "mac-dbdma" +#define MAC_DBDMA(obj) OBJECT_CHECK(DBDMAState, (obj), TYPE_MAC_DBDMA) + #endif --=20 1.7.10.4 From nobody Mon May 6 09:48:55 2024 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.zohomail.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 1506264814280285.7025056532941; Sun, 24 Sep 2017 07:53:34 -0700 (PDT) Received: from localhost ([::1]:38441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Ha-0006yY-Hq for importer@patchew.org; Sun, 24 Sep 2017 10:53:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Cb-0002hK-W6 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dw8Ca-0002HE-Hz for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:13 -0400 Received: from chuckie.co.uk ([82.165.15.123]:49765 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 1dw8CW-00029A-LS; Sun, 24 Sep 2017 10:48:08 -0400 Received: from host86-191-82-173.range86-191.btcentralplus.com ([86.191.82.173] 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 1dw8CU-0006gI-0m; Sun, 24 Sep 2017 15:48:07 +0100 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Sun, 24 Sep 2017 15:47:42 +0100 Message-Id: <1506264466-28252-4-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.82.173 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/7] mac_dbdma: remove DBDMA_init() function 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" Instead we can now instantiate the MAC_DBDMA object directly within the macio device. We also add the DBDMA device as a child property so that it is possible to retrieve later. Signed-off-by: Mark Cave-Ayland --- hw/misc/macio/mac_dbdma.c | 14 -------------- hw/misc/macio/macio.c | 16 ++++++++++++---- include/hw/ppc/mac_dbdma.h | 1 - 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 302f131..0eddf2e 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -886,20 +886,6 @@ static void dbdma_unassigned_flush(DBDMA_io *io) __func__, ch->channel); } =20 -void* DBDMA_init (MemoryRegion **dbdma_mem) -{ - DBDMAState *s; - SysBusDevice *sbd; - - s =3D MAC_DBDMA(object_new(TYPE_MAC_DBDMA)); - object_property_set_bool(OBJECT(s), true, "realized", NULL); - - sbd =3D SYS_BUS_DEVICE(s); - *dbdma_mem =3D sysbus_mmio_get_region(sbd, 0); - - return s; -} - static void mac_dbdma_init(Object *obj) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 5d57f45..f459f17 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -41,7 +41,7 @@ typedef struct MacIOState =20 MemoryRegion bar; CUDAState cuda; - void *dbdma; + DBDMAState *dbdma; MemoryRegion *pic_mem; MemoryRegion *escc_mem; uint64_t frequency; @@ -127,10 +127,15 @@ static void macio_common_realize(PCIDevice *d, Error = **errp) MacIOState *s =3D MACIO(d); SysBusDevice *sysbus_dev; Error *err =3D NULL; - MemoryRegion *dbdma_mem; =20 - s->dbdma =3D DBDMA_init(&dbdma_mem); - memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem); + object_property_set_bool(OBJECT(s->dbdma), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + sysbus_dev =3D SYS_BUS_DEVICE(s->dbdma); + memory_region_add_subregion(&s->bar, 0x08000, + sysbus_mmio_get_region(sysbus_dev, 0)); =20 object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err); if (err) { @@ -334,6 +339,9 @@ static void macio_instance_init(Object *obj) object_initialize(&s->cuda, sizeof(s->cuda), TYPE_CUDA); qdev_set_parent_bus(DEVICE(&s->cuda), sysbus_get_default()); object_property_add_child(obj, "cuda", OBJECT(&s->cuda), NULL); + + s->dbdma =3D MAC_DBDMA(object_new(TYPE_MAC_DBDMA)); + object_property_add_child(obj, "dbdma", OBJECT(s->dbdma), NULL); } =20 static const VMStateDescription vmstate_macio_oldworld =3D { diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 4bc6274..26cc469 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -174,7 +174,6 @@ void DBDMA_register_channel(void *dbdma, int nchan, qem= u_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque); void DBDMA_kick(DBDMAState *dbdma); -void* DBDMA_init (MemoryRegion **dbdma_mem); =20 #define TYPE_MAC_DBDMA "mac-dbdma" #define MAC_DBDMA(obj) OBJECT_CHECK(DBDMAState, (obj), TYPE_MAC_DBDMA) --=20 1.7.10.4 From nobody Mon May 6 09:48:55 2024 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.zohomail.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 150626464492342.85660756496179; Sun, 24 Sep 2017 07:50:44 -0700 (PDT) Received: from localhost ([::1]:38428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8F2-0004SB-2B for importer@patchew.org; Sun, 24 Sep 2017 10:50:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Cb-0002gv-Lq for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dw8Ca-0002HU-LY for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:13 -0400 Received: from chuckie.co.uk ([82.165.15.123]:49771 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 1dw8CX-00029p-TW; Sun, 24 Sep 2017 10:48:10 -0400 Received: from host86-191-82-173.range86-191.btcentralplus.com ([86.191.82.173] 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 1dw8CV-0006gI-BC; Sun, 24 Sep 2017 15:48:08 +0100 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Sun, 24 Sep 2017 15:47:43 +0100 Message-Id: <1506264466-28252-5-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.82.173 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/7] macio: pass channel into MACIOIDEState via qdev property 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" One of the reasons macio_ide_register_dma() needs to exist is because the channel id isn't passed into the MACIO_IDE object. Pass in the channel id using a qdev property to remove this requirement. Signed-off-by: Mark Cave-Ayland --- hw/ide/macio.c | 10 ++++++++-- hw/misc/macio/macio.c | 4 +++- hw/ppc/mac.h | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 18ae952..19d5f5a 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -452,12 +452,18 @@ static void macio_ide_initfn(Object *obj) s->ide_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 1); } =20 +static Property macio_ide_properties[] =3D { + DEFINE_PROP_UINT32("channel", MACIOIDEState, channel, 0), + DEFINE_PROP_END_OF_LIST(), +}; + static void macio_ide_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); =20 dc->realize =3D macio_ide_realizefn; dc->reset =3D macio_ide_reset; + dc->props =3D macio_ide_properties; dc->vmsd =3D &vmstate_pmac; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -487,10 +493,10 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInf= o **hd_table) } } =20 -void macio_ide_register_dma(MACIOIDEState *s, void *dbdma, int channel) +void macio_ide_register_dma(MACIOIDEState *s, void *dbdma) { s->dbdma =3D dbdma; - DBDMA_register_channel(dbdma, channel, s->dma_irq, + DBDMA_register_channel(dbdma, s->channel, s->dma_irq, pmac_ide_transfer, pmac_ide_flush, s); } =20 diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index f459f17..41b377e 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -159,7 +159,9 @@ static void macio_realize_ide(MacIOState *s, MACIOIDESt= ate *ide, sysbus_dev =3D SYS_BUS_DEVICE(ide); sysbus_connect_irq(sysbus_dev, 0, irq0); sysbus_connect_irq(sysbus_dev, 1, irq1); - macio_ide_register_dma(ide, s->dbdma, dmaid); + qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid); + macio_ide_register_dma(ide, s->dbdma); + object_property_set_bool(OBJECT(ide), true, "realized", errp); } =20 diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 300fc8a..b3a26c4 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -131,7 +131,7 @@ typedef struct MACIOIDEState { /*< private >*/ SysBusDevice parent_obj; /*< public >*/ - + uint32_t channel; qemu_irq real_ide_irq; qemu_irq real_dma_irq; qemu_irq ide_irq; @@ -147,7 +147,7 @@ typedef struct MACIOIDEState { } MACIOIDEState; =20 void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); -void macio_ide_register_dma(MACIOIDEState *ide, void *dbdma, int channel); +void macio_ide_register_dma(MACIOIDEState *ide, void *dbdma); =20 void macio_init(PCIDevice *dev, MemoryRegion *pic_mem, --=20 1.7.10.4 From nobody Mon May 6 09:48:55 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 1506264935084800.7859392885128; Sun, 24 Sep 2017 07:55:35 -0700 (PDT) Received: from localhost ([::1]:38451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Je-0000Pr-CN for importer@patchew.org; Sun, 24 Sep 2017 10:55:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Cc-0002hu-LR for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dw8Cb-0002Iz-Sl for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:14 -0400 Received: from chuckie.co.uk ([82.165.15.123]:49775 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 1dw8CZ-0002AZ-4h; Sun, 24 Sep 2017 10:48:11 -0400 Received: from host86-191-82-173.range86-191.btcentralplus.com ([86.191.82.173] 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 1dw8CW-0006gI-Io; Sun, 24 Sep 2017 15:48:09 +0100 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Sun, 24 Sep 2017 15:47:44 +0100 Message-Id: <1506264466-28252-6-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.82.173 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/7] macio: use object link between MACIO_IDE and MAC_DBDMA object 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_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Using a standard QOM object link we can pass a reference to the MAC_DBDMA controller to the MACIO_IDE object which removes the last external parameter to macio_ide_register_dma(). Signed-off-by: Mark Cave-Ayland --- hw/ide/macio.c | 9 ++++++--- hw/misc/macio/macio.c | 3 ++- hw/ppc/mac.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 19d5f5a..ce194c6 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -450,6 +450,10 @@ static void macio_ide_initfn(Object *obj) sysbus_init_irq(d, &s->real_dma_irq); s->dma_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 0); s->ide_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 1); + + object_property_add_link(obj, "dbdma", TYPE_MAC_DBDMA, + (Object **) &s->dbdma, + qdev_prop_allow_set_link_before_realize, 0, N= ULL); } =20 static Property macio_ide_properties[] =3D { @@ -493,10 +497,9 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo= **hd_table) } } =20 -void macio_ide_register_dma(MACIOIDEState *s, void *dbdma) +void macio_ide_register_dma(MACIOIDEState *s) { - s->dbdma =3D dbdma; - DBDMA_register_channel(dbdma, s->channel, s->dma_irq, + DBDMA_register_channel(s->dbdma, s->channel, s->dma_irq, pmac_ide_transfer, pmac_ide_flush, s); } =20 diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 41b377e..9aa7e75 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -160,7 +160,8 @@ static void macio_realize_ide(MacIOState *s, MACIOIDESt= ate *ide, sysbus_connect_irq(sysbus_dev, 0, irq0); sysbus_connect_irq(sysbus_dev, 1, irq1); qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid); - macio_ide_register_dma(ide, s->dbdma); + object_property_set_link(OBJECT(ide), OBJECT(s->dbdma), "dbdma", errp); + macio_ide_register_dma(ide); =20 object_property_set_bool(OBJECT(ide), true, "realized", errp); } diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index b3a26c4..b501af1 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -147,7 +147,7 @@ typedef struct MACIOIDEState { } MACIOIDEState; =20 void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); -void macio_ide_register_dma(MACIOIDEState *ide, void *dbdma); +void macio_ide_register_dma(MACIOIDEState *ide); =20 void macio_init(PCIDevice *dev, MemoryRegion *pic_mem, --=20 1.7.10.4 From nobody Mon May 6 09:48:55 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 1506264804209359.6626468036993; Sun, 24 Sep 2017 07:53:24 -0700 (PDT) Received: from localhost ([::1]:38440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8HM-0006pb-ER for importer@patchew.org; Sun, 24 Sep 2017 10:53:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Ce-0002jU-88 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dw8Cd-0002K8-9a for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:16 -0400 Received: from chuckie.co.uk ([82.165.15.123]:49778 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 1dw8Ca-0002Bi-IR; Sun, 24 Sep 2017 10:48:12 -0400 Received: from host86-191-82-173.range86-191.btcentralplus.com ([86.191.82.173] 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 1dw8CX-0006gI-RP; Sun, 24 Sep 2017 15:48:11 +0100 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Sun, 24 Sep 2017 15:47:45 +0100 Message-Id: <1506264466-28252-7-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.82.173 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/7] mac_dbdma: change DBDMA_register_channel to a MAC_DBDMA type method 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_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Using this we can change the MACIO_IDE instance to register the channel itself via a type method instead of requiring a separate DBDMA_register_channel() function. As a consequence of this it is now possible to remove the old external macio_ide_register_dma() function. Signed-off-by: Mark Cave-Ayland --- hw/ide/macio.c | 12 ++++++------ hw/misc/macio/mac_dbdma.c | 9 +++++---- hw/misc/macio/macio.c | 1 - include/hw/ppc/mac_dbdma.h | 9 ++++----- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index ce194c6..b296017 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -411,12 +411,18 @@ static const IDEDMAOps dbdma_ops =3D { static void macio_ide_realizefn(DeviceState *dev, Error **errp) { MACIOIDEState *s =3D MACIO_IDE(dev); + DBDMAState *dbdma; =20 ide_init2(&s->bus, s->ide_irq); =20 /* Register DMA callbacks */ s->dma.ops =3D &dbdma_ops; s->bus.dma =3D &s->dma; + + /* Register DBDMA channel */ + dbdma =3D MAC_DBDMA(object_property_get_link(OBJECT(dev), "dbdma", err= p)); + dbdma->register_channel(dbdma, s->channel, s->dma_irq, + pmac_ide_transfer, pmac_ide_flush, s); } =20 static void pmac_ide_irq(void *opaque, int n, int level) @@ -497,10 +503,4 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo= **hd_table) } } =20 -void macio_ide_register_dma(MACIOIDEState *s) -{ - DBDMA_register_channel(s->dbdma, s->channel, s->dma_irq, - pmac_ide_transfer, pmac_ide_flush, s); -} - type_init(macio_ide_register_types) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 0eddf2e..addb97d 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -557,11 +557,10 @@ void DBDMA_kick(DBDMAState *dbdma) qemu_bh_schedule(dbdma->bh); } =20 -void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq, - DBDMA_rw rw, DBDMA_flush flush, - void *opaque) +static void +dbdma_register_channel(DBDMAState *s, int nchan, qemu_irq irq, + DBDMA_rw rw, DBDMA_flush flush, void *opaque) { - DBDMAState *s =3D dbdma; DBDMA_channel *ch =3D &s->channels[nchan]; =20 DBDMA_DPRINTFCH(ch, "DBDMA_register_channel 0x%x\n", nchan); @@ -903,6 +902,8 @@ static void mac_dbdma_init(Object *obj) =20 memory_region_init_io(&s->mem, obj, &dbdma_ops, s, "dbdma", 0x1000); sysbus_init_mmio(sbd, &s->mem); + + s->register_channel =3D dbdma_register_channel; } =20 static void mac_dbdma_realize(DeviceState *dev, Error **errp) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 9aa7e75..533331a 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -161,7 +161,6 @@ static void macio_realize_ide(MacIOState *s, MACIOIDESt= ate *ide, sysbus_connect_irq(sysbus_dev, 1, irq1); qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid); object_property_set_link(OBJECT(ide), OBJECT(s->dbdma), "dbdma", errp); - macio_ide_register_dma(ide); =20 object_property_set_bool(OBJECT(ide), true, "realized", errp); } diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 26cc469..d6a38c5 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -160,19 +160,18 @@ typedef struct DBDMA_channel { dbdma_cmd current; } DBDMA_channel; =20 -typedef struct { +typedef struct DBDMAState { SysBusDevice parent_obj; =20 MemoryRegion mem; DBDMA_channel channels[DBDMA_CHANNELS]; QEMUBH *bh; + + void (*register_channel)(struct DBDMAState *s, int nchan, qemu_irq irq, + DBDMA_rw rw, DBDMA_flush flush, void *opaque); } DBDMAState; =20 /* Externally callable functions */ - -void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq, - DBDMA_rw rw, DBDMA_flush flush, - void *opaque); void DBDMA_kick(DBDMAState *dbdma); =20 #define TYPE_MAC_DBDMA "mac-dbdma" --=20 1.7.10.4 From nobody Mon May 6 09:48:55 2024 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.zohomail.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 1506264904070977.9074896489525; Sun, 24 Sep 2017 07:55:04 -0700 (PDT) Received: from localhost ([::1]:38447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8J4-0008M2-Bb for importer@patchew.org; Sun, 24 Sep 2017 10:54:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dw8Cb-0002gw-M1 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dw8Ca-0002HK-IX for qemu-devel@nongnu.org; Sun, 24 Sep 2017 10:48:13 -0400 Received: from chuckie.co.uk ([82.165.15.123]:49780 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 1dw8CW-0002Cu-FF; Sun, 24 Sep 2017 10:48:08 -0400 Received: from host86-191-82-173.range86-191.btcentralplus.com ([86.191.82.173] 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 1dw8CZ-0006gI-8O; Sun, 24 Sep 2017 15:48:12 +0100 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Sun, 24 Sep 2017 15:47:46 +0100 Message-Id: <1506264466-28252-8-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1506264466-28252-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.82.173 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 7/7] mac_dbdma: change DBDMA_kick to a MAC_DBDMA type method 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" With this we can now remove the last external method used to interface between macio and DBDMA. Signed-off-by: Mark Cave-Ayland --- hw/ide/macio.c | 3 ++- hw/misc/macio/mac_dbdma.c | 19 ++++++++++--------- include/hw/ppc/mac_dbdma.h | 4 +--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index b296017..6f7f286 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -384,6 +384,7 @@ static void ide_dbdma_start(IDEDMA *dma, IDEState *s, BlockCompletionFunc *cb) { MACIOIDEState *m =3D container_of(dma, MACIOIDEState, dma); + DBDMAState *dbdma =3D (DBDMAState *)m->dbdma; =20 s->io_buffer_index =3D 0; if (s->drive_kind =3D=3D IDE_CD) { @@ -399,7 +400,7 @@ static void ide_dbdma_start(IDEDMA *dma, IDEState *s, MACIO_DPRINTF("-------------------------\n"); =20 m->dma_active =3D true; - DBDMA_kick(m->dbdma); + dbdma->kick(dbdma); } =20 static const IDEDMAOps dbdma_ops =3D { diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index addb97d..f8375db 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -301,6 +301,11 @@ wait: channel_run(ch); } =20 +static void dbdma_kick(DBDMAState *dbdma) +{ + qemu_bh_schedule(dbdma->bh); +} + static void start_output(DBDMA_channel *ch, int key, uint32_t addr, uint16_t req_count, int is_last) { @@ -381,7 +386,7 @@ static void load_word(DBDMA_channel *ch, int key, uint3= 2_t addr, next(ch); =20 wait: - DBDMA_kick(dbdma_from_ch(ch)); + dbdma_kick(dbdma_from_ch(ch)); } =20 static void store_word(DBDMA_channel *ch, int key, uint32_t addr, @@ -413,7 +418,7 @@ static void store_word(DBDMA_channel *ch, int key, uint= 32_t addr, next(ch); =20 wait: - DBDMA_kick(dbdma_from_ch(ch)); + dbdma_kick(dbdma_from_ch(ch)); } =20 static void nop(DBDMA_channel *ch) @@ -430,7 +435,7 @@ static void nop(DBDMA_channel *ch) conditional_branch(ch); =20 wait: - DBDMA_kick(dbdma_from_ch(ch)); + dbdma_kick(dbdma_from_ch(ch)); } =20 static void stop(DBDMA_channel *ch) @@ -552,11 +557,6 @@ static void DBDMA_run_bh(void *opaque) DBDMA_DPRINTF("<- DBDMA_run_bh\n"); } =20 -void DBDMA_kick(DBDMAState *dbdma) -{ - qemu_bh_schedule(dbdma->bh); -} - static void dbdma_register_channel(DBDMAState *s, int nchan, qemu_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque) @@ -686,7 +686,7 @@ static void dbdma_control_write(DBDMA_channel *ch) =20 /* If active, make sure the BH gets to run */ if (status & ACTIVE) { - DBDMA_kick(dbdma_from_ch(ch)); + dbdma_kick(dbdma_from_ch(ch)); } } =20 @@ -904,6 +904,7 @@ static void mac_dbdma_init(Object *obj) sysbus_init_mmio(sbd, &s->mem); =20 s->register_channel =3D dbdma_register_channel; + s->kick =3D dbdma_kick; } =20 static void mac_dbdma_realize(DeviceState *dev, Error **errp) diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index d6a38c5..a30f8d8 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -169,11 +169,9 @@ typedef struct DBDMAState { =20 void (*register_channel)(struct DBDMAState *s, int nchan, qemu_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque); + void (*kick)(struct DBDMAState *s); } DBDMAState; =20 -/* Externally callable functions */ -void DBDMA_kick(DBDMAState *dbdma); - #define TYPE_MAC_DBDMA "mac-dbdma" #define MAC_DBDMA(obj) OBJECT_CHECK(DBDMAState, (obj), TYPE_MAC_DBDMA) =20 --=20 1.7.10.4