From patchwork Mon Aug 22 22:43:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4065FC32774 for ; Mon, 22 Aug 2022 22:55:12 +0000 (UTC) Received: from localhost ([::1]:45958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGK7-0001wk-ET for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:55:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGA6-0003rO-I5; Mon, 22 Aug 2022 18:44:51 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:46844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGA4-0007vd-T2; Mon, 22 Aug 2022 18:44:50 -0400 Received: by mail-ed1-x536.google.com with SMTP id s11so15761338edd.13; Mon, 22 Aug 2022 15:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=gNxGFhfTsaBI0LgZx1xEG8EunxZiX5hZtX81XqJAWHg=; b=QGn0TTagzMGPPfpwBxaqg2lWj9RhfUxaaGmCwIXhvYXJ2ypajQ9IXWyckEVriTGxoj caezscLzB60s7v1oQ7xvXkCBXRQgjzyCCOEkp3X/3qJYeJaHV4R1Wa9wLpkvHhTuCg92 xvAq1O5UhAuzLnQIhcLZLDNwJs3Ra6cKXsYFcz/sxm90Ya/3x7lnTgS6UObAPie7JgsX Xg+FXAuP4wSXVbfMvr1sadhwrzydjlzDtWVXRNCvUktZFqKedSNaWofsSPXTrBORzH/K AzYyrG3BWoPrcitM6NOIZ9cVKtTpi4ifiM3+eVhgwfiwIPMvGwvqW0MLe5D+BgdPC4uc z/Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=gNxGFhfTsaBI0LgZx1xEG8EunxZiX5hZtX81XqJAWHg=; b=kegtSL7nG4/cjWGxGzJgrqD48J7rIV59d3xZERqeyTzRRsYJbkLWjQMZDyIYWaqaQr SdqMjNbFH2wKb4DOCTSP5LMj3N46kuN9bTLjE3aHxaqB+jxuwdpjsKcrILEMvwmIeTzZ y051Ygzp+NzFAN8RhxSqirjNcshK79kqLUR/GtCzw8+cTm3khUu3zpoWiH7S7RpxF+bz 3ZqGK/1QQikhaQeIjpmlKbMdbUrsL/oohrb7Gi03c0/UyUlrYJIDWTxrTHi4mND00GeL 3JYv6KXRMspFuv/lPYRlkyKqlBZl/+fLLT5/a0pTeouG5DvXx8SeBfNEmiFSCmjm5jjD iSwQ== X-Gm-Message-State: ACgBeo0byz4m5xwn5mlx0QDWUMeFfcK9PmKv/PYaW/aFJss+fO7XxGrb GVHJnnNrrkfKQd7PExDSzmBawNVPG5w= X-Google-Smtp-Source: AA6agR50IKLVIqHvgIg0XepNpfGpkeT1GLz0zlX6XY37/bmZD4Pm9vRADD6/VVHT4o+Dnx2yWB0Itw== X-Received: by 2002:a05:6402:350e:b0:446:145d:a3bb with SMTP id b14-20020a056402350e00b00446145da3bbmr1072112edd.23.1661208286031; Mon, 22 Aug 2022 15:44:46 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:45 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 1/9] hw/isa/vt82c686: QOM'ify Super I/O creation Date: Tue, 23 Aug 2022 00:43:47 +0200 Message-Id: <20220822224355.11753-2-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=shentey@gmail.com; helo=mail-ed1-x536.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The object creation now happens in chip-specific init methods which allows the realize methods to be consolidated into one method. Shifting the logic into the init methods has the addidional advantage that the parent object's init methods are called implicitly. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 8f656251b8..0217c98fe4 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -544,7 +544,7 @@ struct ViaISAState { qemu_irq cpu_intr; qemu_irq *isa_irqs; ISABus *isa_bus; - ViaSuperIOState *via_sio; + ViaSuperIOState via_sio; }; static const VMStateDescription vmstate_via = { @@ -602,6 +602,11 @@ static void via_isa_realize(PCIDevice *d, Error **errp) d->wmask[i] = 0; } } + + /* Super I/O */ + if (!qdev_realize(DEVICE(&s->via_sio), BUS(s->isa_bus), errp)) { + return; + } } /* TYPE_VT82C686B_ISA */ @@ -615,7 +620,7 @@ static void vt82c686b_write_config(PCIDevice *d, uint32_t addr, pci_default_write_config(d, addr, val, len); if (addr == 0x85) { /* BIT(1): enable or disable superio config io ports */ - via_superio_io_enable(s->via_sio, val & BIT(1)); + via_superio_io_enable(&s->via_sio, val & BIT(1)); } } @@ -639,13 +644,11 @@ static void vt82c686b_isa_reset(DeviceState *dev) pci_conf[0x77] = 0x10; /* GPIO Control 1/2/3/4 */ } -static void vt82c686b_realize(PCIDevice *d, Error **errp) +static void vt82c686b_init(Object *obj) { - ViaISAState *s = VIA_ISA(d); + ViaISAState *s = VIA_ISA(obj); - via_isa_realize(d, errp); - s->via_sio = VIA_SUPERIO(isa_create_simple(s->isa_bus, - TYPE_VT82C686B_SUPERIO)); + object_initialize_child(obj, "sio", &s->via_sio, TYPE_VT82C686B_SUPERIO); } static void vt82c686b_class_init(ObjectClass *klass, void *data) @@ -653,7 +656,7 @@ static void vt82c686b_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->realize = vt82c686b_realize; + k->realize = via_isa_realize; k->config_write = vt82c686b_write_config; k->vendor_id = PCI_VENDOR_ID_VIA; k->device_id = PCI_DEVICE_ID_VIA_82C686B_ISA; @@ -670,6 +673,7 @@ static const TypeInfo vt82c686b_isa_info = { .name = TYPE_VT82C686B_ISA, .parent = TYPE_VIA_ISA, .instance_size = sizeof(ViaISAState), + .instance_init = vt82c686b_init, .class_init = vt82c686b_class_init, }; @@ -684,7 +688,7 @@ static void vt8231_write_config(PCIDevice *d, uint32_t addr, pci_default_write_config(d, addr, val, len); if (addr == 0x50) { /* BIT(2): enable or disable superio config io ports */ - via_superio_io_enable(s->via_sio, val & BIT(2)); + via_superio_io_enable(&s->via_sio, val & BIT(2)); } } @@ -703,13 +707,11 @@ static void vt8231_isa_reset(DeviceState *dev) pci_conf[0x6b] = 0x01; /* Fast IR I/O Base */ } -static void vt8231_realize(PCIDevice *d, Error **errp) +static void vt8231_init(Object *obj) { - ViaISAState *s = VIA_ISA(d); + ViaISAState *s = VIA_ISA(obj); - via_isa_realize(d, errp); - s->via_sio = VIA_SUPERIO(isa_create_simple(s->isa_bus, - TYPE_VT8231_SUPERIO)); + object_initialize_child(obj, "sio", &s->via_sio, TYPE_VT8231_SUPERIO); } static void vt8231_class_init(ObjectClass *klass, void *data) @@ -717,7 +719,7 @@ static void vt8231_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->realize = vt8231_realize; + k->realize = via_isa_realize; k->config_write = vt8231_write_config; k->vendor_id = PCI_VENDOR_ID_VIA; k->device_id = PCI_DEVICE_ID_VIA_8231_ISA; @@ -734,6 +736,7 @@ static const TypeInfo vt8231_isa_info = { .name = TYPE_VT8231_ISA, .parent = TYPE_VIA_ISA, .instance_size = sizeof(ViaISAState), + .instance_init = vt8231_init, .class_init = vt8231_class_init, }; From patchwork Mon Aug 22 22:43:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951452 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 906ADC28D13 for ; Mon, 22 Aug 2022 22:57:48 +0000 (UTC) Received: from localhost ([::1]:57368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGMd-000526-LX for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:57:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGA6-0003rP-QR; Mon, 22 Aug 2022 18:44:51 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:44651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGA5-0007w8-4p; Mon, 22 Aug 2022 18:44:50 -0400 Received: by mail-ed1-x535.google.com with SMTP id t5so15781524edc.11; Mon, 22 Aug 2022 15:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=tfjpe0kq5Hqkrre7mfBlqhm29F5/cPJTQ5XTLa09A84=; b=FUxaEQ4Ecdgv8e4TWRpTemcMEzcgYSm2tbFi1yz6MCirDPj4YF66JFNSSgNN5sODaH kN9Lz412i2a46N7eNQnZ0ILiv9mYdobf4Go3S5U5W4NZqJnrXMWuGgrv0XA9hb03UV7Q g4m7pQOT/PU90Opax8P5IVn0/zVahGqxXO5EzBT2k2IjlV+bQBFpkkXmDDBjksDWSf1B ZYrVPcQBTBVevHj+5epQzYLAzNLdo0enS36YnvMPGML3WrqLFeSQxSwsm+JMYD70FUom Ww6Hv5Lbm6WMuJuvlLWwEd7Ts6I1VN/ktcIOMzwXi9O9B/9gyVQeK1YH51IdMdq9nf0E eKQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=tfjpe0kq5Hqkrre7mfBlqhm29F5/cPJTQ5XTLa09A84=; b=abzxC8mqUnZjJJRQYSKgsEr7+CnRph2/DFwbHGU5s2CZU2dcNqe/87oeIooKDRa+Zx NGleXM3MDgNcAOWl6OXsIb5yVB7ofpek9byNkMH8igGMHTlGPki5SJZmrCkF9mSViM4L FBnJ2C533BvymjJc6//A+rPhxXWdqbXxBJxGhlA9qLm6r0wT8XNMdkEJNtGYFfx8j06U MFPe1ZDnUEhrnMtoRvXmarRXCU6ERN11ug0MCXtUM4b1GGeUmUhM6UBrMKiohqAxqfbC yR/HtH50e4c1+N7wSdnNOIDTFGe6dRGjVU5AkSC6/RRU3WOGA32Hdi1PA5i48z9x6hM+ RM/A== X-Gm-Message-State: ACgBeo3NkIuB2QJTiL3eAXtjCx6Mz80P/xs7k1FDQ0er8vnlpD1E0TC5 ildh7YCmsx3j4eyC3EO46lhpMf5ExxY= X-Google-Smtp-Source: AA6agR4XkemkbnYDMPRPeXjhM6TWKVZa7A6rcI34QIBlgyvIqd3fxhHwp3YibG6gwKVd/OX+YY0yiw== X-Received: by 2002:aa7:cd78:0:b0:446:49f4:1c0f with SMTP id ca24-20020aa7cd78000000b0044649f41c0fmr1076383edb.342.1661208286827; Mon, 22 Aug 2022 15:44:46 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:46 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 2/9] hw/isa/vt82c686: Resolve unneeded attribute Date: Tue, 23 Aug 2022 00:43:48 +0200 Message-Id: <20220822224355.11753-3-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=shentey@gmail.com; helo=mail-ed1-x535.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Now that also the super io device is realized in the common realize method, the isa_bus attribute can be turned into a temporary. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 0217c98fe4..9d12e1cae4 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -543,7 +543,6 @@ struct ViaISAState { PCIDevice dev; qemu_irq cpu_intr; qemu_irq *isa_irqs; - ISABus *isa_bus; ViaSuperIOState via_sio; }; @@ -585,17 +584,18 @@ static void via_isa_realize(PCIDevice *d, Error **errp) ViaISAState *s = VIA_ISA(d); DeviceState *dev = DEVICE(d); qemu_irq *isa_irq; + ISABus *isa_bus; int i; qdev_init_gpio_out(dev, &s->cpu_intr, 1); isa_irq = qemu_allocate_irqs(via_isa_request_i8259_irq, s, 1); - s->isa_bus = isa_bus_new(dev, get_system_memory(), pci_address_space_io(d), + isa_bus = isa_bus_new(dev, get_system_memory(), pci_address_space_io(d), &error_fatal); - s->isa_irqs = i8259_init(s->isa_bus, *isa_irq); - isa_bus_irqs(s->isa_bus, s->isa_irqs); - i8254_pit_init(s->isa_bus, 0x40, 0, NULL); - i8257_dma_init(s->isa_bus, 0); - mc146818_rtc_init(s->isa_bus, 2000, NULL); + s->isa_irqs = i8259_init(isa_bus, *isa_irq); + isa_bus_irqs(isa_bus, s->isa_irqs); + i8254_pit_init(isa_bus, 0x40, 0, NULL); + i8257_dma_init(isa_bus, 0); + mc146818_rtc_init(isa_bus, 2000, NULL); for (i = 0; i < PCI_CONFIG_HEADER_SIZE; i++) { if (i < PCI_COMMAND || i >= PCI_REVISION_ID) { @@ -604,7 +604,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp) } /* Super I/O */ - if (!qdev_realize(DEVICE(&s->via_sio), BUS(s->isa_bus), errp)) { + if (!qdev_realize(DEVICE(&s->via_sio), BUS(isa_bus), errp)) { return; } } From patchwork Mon Aug 22 22:43:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1182C28D13 for ; Mon, 22 Aug 2022 22:50:57 +0000 (UTC) Received: from localhost ([::1]:50022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGG1-0000v3-2r for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:50:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGA7-0003rm-Bs; Mon, 22 Aug 2022 18:44:51 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:41945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGA5-0007wF-QY; Mon, 22 Aug 2022 18:44:51 -0400 Received: by mail-ed1-x530.google.com with SMTP id r4so15786592edi.8; Mon, 22 Aug 2022 15:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=stKyWe1aP4GErtwepvDPTmPyOUKRJLsF/b+AUrVbyU4=; b=TD5s5qOka1o5m4GLfGGzUpDT1aAKDxmKjDCfe0/LfqvFw0Bs2vFQznTbnupsoXyOXM QRRALm5XJdLVkhlXxu9UwWn/17GzPUuMuikp2YTLh9Hze9SRm8j5hysr935P70NQwNrm APy7P0ij/P+djAQAlBmTElUBZPU04a+5cn+5aLK6JbYbriku5GEkgKabPZr7iGeQfBc7 efo/uiCeKMZ7dzwRqyyIKaNLZuFQiy0DvdZQrRm7mKhhUjpctq2M59c2kgeq1iM5wqHX IIVI3tEE3IaT22TjuT6lbwKUBfuCnT08i2RJ7rx3aNNts97yEuh6WgjTqHQmuVpSZdkA o0sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=stKyWe1aP4GErtwepvDPTmPyOUKRJLsF/b+AUrVbyU4=; b=4L6coTPVH/T+hejaIOeb3pOD5RAestIqs2MFqEub+09Q2/LqveYuBw0ZrQtqG82Pie dhUIWZJFL1yGbwNciUErwSbKFX2aDLNxmIiTJg2JiI4Wjc+nHLBCmgoOg66blApW/emD 9H94hsUHjtKk1tMFxKNHkK9jItSC2jQzDiksJ+r8zJodTH1SOs8jiBBmFrK2y0XVgUIA HEv/YGQo42CtbGbn8jh+QQfLr8xVhMlLLKDFCiw/NOtAgAxDi4nrA1f4C4YK2TvK5sqz Gbue5atCYZQc2ACXHCKzNmWVo2flvgJTSelY7ogyolHY15Q0u+bZPagpab4mXIQg4CtL acGw== X-Gm-Message-State: ACgBeo1omb3OO+yflJDCckvaRN2uiNVP8RmHH+BpOnXadK+/VfTLOZa5 QAKrxdUYRWDf7ueDC11rWZwpcbMgPEY= X-Google-Smtp-Source: AA6agR4YJ1eY6IGzKTbW3H90Ps1mfJ7gTRBVQ1oTmFrOwV3o1uwj/KLiVHEQpWxfi4nwKjfeDsKzPA== X-Received: by 2002:aa7:d802:0:b0:445:e618:fae8 with SMTP id v2-20020aa7d802000000b00445e618fae8mr1087375edq.182.1661208287879; Mon, 22 Aug 2022 15:44:47 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:47 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 3/9] hw/isa/vt82c686: Prefer pci_address_space() over get_system_memory() Date: Tue, 23 Aug 2022 00:43:49 +0200 Message-Id: <20220822224355.11753-4-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=shentey@gmail.com; helo=mail-ed1-x530.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Unlike get_system_memory(), pci_address_space() respects the memory tree available to the parent device. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 9d12e1cae4..5582c0b179 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -589,7 +589,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp) qdev_init_gpio_out(dev, &s->cpu_intr, 1); isa_irq = qemu_allocate_irqs(via_isa_request_i8259_irq, s, 1); - isa_bus = isa_bus_new(dev, get_system_memory(), pci_address_space_io(d), + isa_bus = isa_bus_new(dev, pci_address_space(d), pci_address_space_io(d), &error_fatal); s->isa_irqs = i8259_init(isa_bus, *isa_irq); isa_bus_irqs(isa_bus, s->isa_irqs); From patchwork Mon Aug 22 22:43:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D56A2C28D13 for ; Mon, 22 Aug 2022 22:50:20 +0000 (UTC) Received: from localhost ([::1]:39782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGFP-0007lj-SU for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:50:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGA9-0003tN-7M; Mon, 22 Aug 2022 18:44:53 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:37778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGA6-0007x0-Vv; Mon, 22 Aug 2022 18:44:52 -0400 Received: by mail-ej1-x631.google.com with SMTP id h22so13819015ejk.4; Mon, 22 Aug 2022 15:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=yh6eXj+s/y3Kqh9yHIMHNRqkOwKLsphLuDulPE5HrfY=; b=SO3ZakNdoJmgcBTZ1I7SoooTMG+5S3o2SquCinMpyga64Hn3+Y3sxxqyErAe71eCCz iMbAo5Dkts/Qo7AI/WdORzcmwSJ5ogvDZxiQRIu3SlRJ/Bb601iTubOBhR5nGPbPvox+ G1qS/igE7s1jQAXVG/oTdb7pcOoAZ0G+qruEfMnrO6C+6WvP+1JUjRVw+M3LBsvFyeLP MWpukT6Qs/EUy/7lD0yrmPh6R/mV1oiNIK13OXRMXBvQ43PSqTeFUiwqKgDgHrLd1vx9 bvsxFe8VkCrghmaws0j8T3TMtD83LxstblVL1e/iV2Phfh10CD4/bLCZ9iR+aoXXX3ul s1gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=yh6eXj+s/y3Kqh9yHIMHNRqkOwKLsphLuDulPE5HrfY=; b=0P8VBfSPqEo0gYTXxRHlao+2Kwk83N+zAHfKgSWKlSt+bSXiDdO3mEBUYsMPCEEKhH q6tn3WwPnFpDINeAHPXIHfzJytMp/m18vVn8Ueem26/P81gRGC30KXHO0PmAwp7POoGV 7rY3PPKME4/S8i8YapXSy/ugN8vTVpSC/EU5avkPdGwn1ffD8KKvB0HZgCka+MWRg9oz xoKSpfCddo1jdRMUAaUrhMPSDORFQxLQ2DD8+Vp4FanfcB94GoCAi9c+4E1WQEj8v30l qQN1t895GylcDx2kYfWACRpmIttdSa+2AoOQyrYN9OC6xzvMg2Z6kBKCE5+lDqCZ2lvS J5AQ== X-Gm-Message-State: ACgBeo0SHPQ0nW+EM70KTT2My3n2t/7J9IfzMwWg5EDj8Vj+oXQoF6R1 vTQg0xQA7BUGaYtv0xDkk8ZQjL+tF6c= X-Google-Smtp-Source: AA6agR5Jagz+u5YF9lbj8Tgpp8/5dUCv1NQGHVhm1FF0MLWwDHxabNTrEeZeX+lLQyQUu5YkMyTvMw== X-Received: by 2002:a17:907:2d12:b0:731:6a4e:ceb0 with SMTP id gs18-20020a1709072d1200b007316a4eceb0mr14304934ejc.115.1661208288908; Mon, 22 Aug 2022 15:44:48 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:48 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 4/9] hw/isa/vt82c686: QOM'ify via-ide creation Date: Tue, 23 Aug 2022 00:43:50 +0200 Message-Id: <20220822224355.11753-5-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The IDE function is closely tied to the ISA function (e.g. the IDE interrupt routing happens there), so it makes sense that the IDE function is instantiated within the southbridge itself. As a side effect, duplicated code in the boards is resolved. Signed-off-by: Bernhard Beschow --- configs/devices/mips64el-softmmu/default.mak | 1 - hw/isa/Kconfig | 1 + hw/isa/vt82c686.c | 18 ++++++++++++++++++ hw/mips/fuloong2e.c | 3 --- hw/ppc/Kconfig | 1 - hw/ppc/pegasos2.c | 4 ---- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/configs/devices/mips64el-softmmu/default.mak b/configs/devices/mips64el-softmmu/default.mak index c610749ac1..d5188f7ea5 100644 --- a/configs/devices/mips64el-softmmu/default.mak +++ b/configs/devices/mips64el-softmmu/default.mak @@ -1,7 +1,6 @@ # Default configuration for mips64el-softmmu include ../mips-softmmu/common.mak -CONFIG_IDE_VIA=y CONFIG_FULOONG=y CONFIG_LOONGSON3V=y CONFIG_ATI_VGA=y diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index d42143a991..20de7e9294 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -53,6 +53,7 @@ config VT82C686 select I8254 select I8257 select I8259 + select IDE_VIA select MC146818RTC select PARALLEL diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 5582c0b179..37d9ed635d 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -17,6 +17,7 @@ #include "hw/isa/vt82c686.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/ide/pci.h" #include "hw/isa/isa.h" #include "hw/isa/superio.h" #include "hw/intc/i8259.h" @@ -544,6 +545,7 @@ struct ViaISAState { qemu_irq cpu_intr; qemu_irq *isa_irqs; ViaSuperIOState via_sio; + PCIIDEState ide; }; static const VMStateDescription vmstate_via = { @@ -556,10 +558,18 @@ static const VMStateDescription vmstate_via = { } }; +static void via_isa_init(Object *obj) +{ + ViaISAState *s = VIA_ISA(obj); + + object_initialize_child(obj, "ide", &s->ide, "via-ide"); +} + static const TypeInfo via_isa_info = { .name = TYPE_VIA_ISA, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(ViaISAState), + .instance_init = via_isa_init, .abstract = true, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, @@ -583,6 +593,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp) { ViaISAState *s = VIA_ISA(d); DeviceState *dev = DEVICE(d); + PCIBus *pci_bus = pci_get_bus(d); qemu_irq *isa_irq; ISABus *isa_bus; int i; @@ -607,6 +618,13 @@ static void via_isa_realize(PCIDevice *d, Error **errp) if (!qdev_realize(DEVICE(&s->via_sio), BUS(isa_bus), errp)) { return; } + + /* Function 1: IDE */ + qdev_prop_set_int32(DEVICE(&s->ide), "addr", d->devfn + 1); + if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) { + return; + } + pci_ide_create_devs(PCI_DEVICE(&s->ide)); } /* TYPE_VT82C686B_ISA */ diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 5ee546f5f6..dae263c1e3 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -205,9 +205,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, TYPE_VT82C686B_ISA); qdev_connect_gpio_out(DEVICE(dev), 0, intc); - dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); - pci_ide_create_devs(dev); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), "vt82c686b-usb-uhci"); diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index 400511c6b7..18565e966b 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -74,7 +74,6 @@ config PEGASOS2 bool select MV64361 select VT82C686 - select IDE_VIA select SMBUS_EEPROM select VOF # This should come with VT82C686 diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 61f4263953..2f59d08ad1 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -165,10 +165,6 @@ static void pegasos2_init(MachineState *machine) qdev_connect_gpio_out(DEVICE(dev), 0, qdev_get_gpio_in_named(pm->mv, "gpp", 31)); - /* VT8231 function 1: IDE Controller */ - dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 1), "via-ide"); - pci_ide_create_devs(dev); - /* VT8231 function 2-3: USB Ports */ pci_create_simple(pci_bus, PCI_DEVFN(12, 2), "vt82c686b-usb-uhci"); pci_create_simple(pci_bus, PCI_DEVFN(12, 3), "vt82c686b-usb-uhci"); From patchwork Mon Aug 22 22:43:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 325EFC28D13 for ; Mon, 22 Aug 2022 22:53:00 +0000 (UTC) Received: from localhost ([::1]:45334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGHz-00057T-8D for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:52:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGA9-0003u0-CW; Mon, 22 Aug 2022 18:44:53 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:44651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGA7-0007w8-Bt; Mon, 22 Aug 2022 18:44:52 -0400 Received: by mail-ed1-x535.google.com with SMTP id t5so15781686edc.11; Mon, 22 Aug 2022 15:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=HZGV+UnNspEYU91zMSEmgVnT3X3ciL4QmZdJwaYuKS0=; b=NtzwsLsf0n4iCfEXpT1jw3gCeWgpzLv+u0Dulzl7Loh59xbmF4SKppaxxljMLOeVXE f9jtsMQn0oPViNcg96F9aIT7vCNfLQKw9B8gNNJ3OYL8n6Xw5BLlHnhUlvmhDgi9zdZj AzP2DLO4gpCZvrI2hMQgnmmdnv/nkCA2KRUlokK4HzqVYrJXCC76P4fJd8iEgO31bxSD EjHO/dSHQBpu/p+sulSvB5tec8FsdZzLUlqA4k1xo40Hpzla/Pp7VdC5Co0kuqMUsgV+ oShVgdMXf6tbSHGIZJ2neMaAB64qbgAaXHsvU2NCH7nuMJAD8TD2sF2JxHiFU4yDFBKi AJbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=HZGV+UnNspEYU91zMSEmgVnT3X3ciL4QmZdJwaYuKS0=; b=FNF0Mg3WeMmF55LAK9bJG8kvvqwdUUjGDlAX92hj2YQb21zaiGVm1UJA6GYXFyAMUG oq2miFBfY759h/vVfPw0U/rfI2/MjeZ6j3UPgRp2IYR2T0I1KEY609ktxc32OTwFV4G7 xjxWJLec9nxbiFPUz9jtWHKxaNd7fyXbjuEvFV9nnJ0InwzszTEydrX9+1ZfQ/c7+GWK bx4uXraa4/ozVCjbVuk0Voi8g1oM6j1YbPMfRZBz+3mjS2y4NatFIM/1yPmYw6vnZ6uV 3CNhPzHQuH4FAKVbU+XKxdDYDbHr9HLaC4Rr7N6ouSwP+BWCG0I0aFWqfNKRqtRIDYFW rZIg== X-Gm-Message-State: ACgBeo3pM2nOLI6S1iF+65UtaqpDkf80J+p+WpuNy3FWyIhfrJ5g7SNJ fIMC3rzKodUI1Og9ACin01fwN8YrR14= X-Google-Smtp-Source: AA6agR4mZQFBtHfA2XDl+n/Jgk5uF6kWBqWKNhuX7VrYV+agldPl/DrNeEgLF7lUwzD31ZfAKgNZQg== X-Received: by 2002:a05:6402:14e:b0:443:f58:17e9 with SMTP id s14-20020a056402014e00b004430f5817e9mr1085097edu.106.1661208289938; Mon, 22 Aug 2022 15:44:49 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:49 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 5/9] hw/isa/vt82c686: QOM'ify vt82c686b-usb-uhci creation Date: Tue, 23 Aug 2022 00:43:51 +0200 Message-Id: <20220822224355.11753-6-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=shentey@gmail.com; helo=mail-ed1-x535.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Resolves duplicate code in the boards. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 12 ++++++++++++ hw/mips/fuloong2e.c | 3 --- hw/ppc/pegasos2.c | 4 ---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 37d9ed635d..c2f2e0039a 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -23,6 +23,7 @@ #include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/dma/i8257.h" +#include "hw/usb/hcd-uhci.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" #include "migration/vmstate.h" @@ -546,6 +547,7 @@ struct ViaISAState { qemu_irq *isa_irqs; ViaSuperIOState via_sio; PCIIDEState ide; + UHCIState uhci[2]; }; static const VMStateDescription vmstate_via = { @@ -563,6 +565,8 @@ static void via_isa_init(Object *obj) ViaISAState *s = VIA_ISA(obj); object_initialize_child(obj, "ide", &s->ide, "via-ide"); + object_initialize_child(obj, "uhci1", &s->uhci[0], "vt82c686b-usb-uhci"); + object_initialize_child(obj, "uhci2", &s->uhci[1], "vt82c686b-usb-uhci"); } static const TypeInfo via_isa_info = { @@ -625,6 +629,14 @@ static void via_isa_realize(PCIDevice *d, Error **errp) return; } pci_ide_create_devs(PCI_DEVICE(&s->ide)); + + /* Functions 2-3: USB Ports */ + for (i = 0; i < ARRAY_SIZE(s->uhci); ++i) { + qdev_prop_set_int32(DEVICE(&s->uhci[i]), "addr", d->devfn + 2 + i); + if (!qdev_realize(DEVICE(&s->uhci[i]), BUS(pci_bus), errp)) { + return; + } + } } /* TYPE_VT82C686B_ISA */ diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index dae263c1e3..c375107c53 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -205,9 +205,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, TYPE_VT82C686B_ISA); qdev_connect_gpio_out(DEVICE(dev), 0, intc); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), "vt82c686b-usb-uhci"); - dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 4), TYPE_VT82C686B_PM); *i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 2f59d08ad1..a1b851638a 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -165,10 +165,6 @@ static void pegasos2_init(MachineState *machine) qdev_connect_gpio_out(DEVICE(dev), 0, qdev_get_gpio_in_named(pm->mv, "gpp", 31)); - /* VT8231 function 2-3: USB Ports */ - pci_create_simple(pci_bus, PCI_DEVFN(12, 2), "vt82c686b-usb-uhci"); - pci_create_simple(pci_bus, PCI_DEVFN(12, 3), "vt82c686b-usb-uhci"); - /* VT8231 function 4: Power Management Controller */ dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 4), TYPE_VT8231_PM); i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); From patchwork Mon Aug 22 22:43:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6FD5EC28D13 for ; Mon, 22 Aug 2022 22:59:20 +0000 (UTC) Received: from localhost ([::1]:41566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGO7-0006wx-IM for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGAA-0003zP-Qz; Mon, 22 Aug 2022 18:44:54 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:39818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGA8-0007yv-Py; Mon, 22 Aug 2022 18:44:54 -0400 Received: by mail-ej1-x634.google.com with SMTP id u15so15401217ejt.6; Mon, 22 Aug 2022 15:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=fGOM0Xm04ckp9MC5UXHn04xykoRQdp6Tte8ORS+7Hbs=; b=eZ4J6T9D3YH9BIN8VEqCAEwuUx4hYehIMDEk5HhJYjw4vV/ecbSeSOOedSHaXqy7k/ 9fxkG4byw8C2JdEyKF6uMRlavVuBNrUrritmeV2FSXRdAIx5v+2Q18DICSoED3Y4zBP2 N4Een61bIcULOqECuXLvALX8milzGzWQIoDC3eZ7kvhUJa7YgBTu8L4rJDN5yGPj7e7i hdNhB9eEqLHteNbtrvx9VLd4QepaDvAmz+YHAGIhEumW3BWX0QXzIfJ9jU89IIoIFLKG 30wKKeLdAlnfPSQAwH6B56BPjOwVsC1eNZamahsRS3uVwd3vMt+W+PDlksOSltFXMJGR PufA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=fGOM0Xm04ckp9MC5UXHn04xykoRQdp6Tte8ORS+7Hbs=; b=N/hJJVlMddl67BZapYnFbOiyoxYCae8IeWJTCbuNcw+ju2pPBXWzbS+a7kr/S7xl7D mQI4Vau7BTMd+6heYpiik0qSz/eS1+UlzkSKU/huY9kzSZK9Ny+rLucjZU+MSPBs0Cmn 7WL94Imh6ibQqRHSYSnAg4C/Og3+seZgC0v0N3IWf+MWJVgnXRRO8wjFnwy7oINRdEoz tC0uwJAdhpal/Wy2v/9GAy6SJHrgPpTS8ekv7D0h47Z74YNdiEnTkn/YSiQCNFT2yx2s gXrFHsLlRsOz/brXrXYAyDBXPpKloG/ANO+6Al57vwXEPIhpK4hBTSIhwfS3R02tgpRe 3rYw== X-Gm-Message-State: ACgBeo2WNivyclP8ZcSS5T86nMmI4hGZBQU1ocGnw3h/hsGNNRi/x26w LWcK1tXJdGODfbQNzdg2EVGCGj2IgLs= X-Google-Smtp-Source: AA6agR4aUk5gdr6puV461k9Nj3QB9ZuUvWPXNq8RS7EK8mhoX0MDT9qCni5RLa37wTogYMEVIIaP3g== X-Received: by 2002:a17:907:2bc8:b0:73d:6de9:6fd3 with SMTP id gv8-20020a1709072bc800b0073d6de96fd3mr6997604ejc.752.1661208290891; Mon, 22 Aug 2022 15:44:50 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:50 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 6/9] hw/isa/vt82c686: QOM'ify pm creation Date: Tue, 23 Aug 2022 00:43:52 +0200 Message-Id: <20220822224355.11753-7-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=shentey@gmail.com; helo=mail-ej1-x634.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 9 +++++++++ hw/mips/fuloong2e.c | 2 +- hw/ppc/pegasos2.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index c2f2e0039a..b964d1a760 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -548,6 +548,7 @@ struct ViaISAState { ViaSuperIOState via_sio; PCIIDEState ide; UHCIState uhci[2]; + ViaPMState pm; }; static const VMStateDescription vmstate_via = { @@ -637,6 +638,12 @@ static void via_isa_realize(PCIDevice *d, Error **errp) return; } } + + /* Function 4: Power Management */ + qdev_prop_set_int32(DEVICE(&s->pm), "addr", d->devfn + 4); + if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) { + return; + } } /* TYPE_VT82C686B_ISA */ @@ -679,6 +686,7 @@ static void vt82c686b_init(Object *obj) ViaISAState *s = VIA_ISA(obj); object_initialize_child(obj, "sio", &s->via_sio, TYPE_VT82C686B_SUPERIO); + object_initialize_child(obj, "pm", &s->pm, TYPE_VT82C686B_PM); } static void vt82c686b_class_init(ObjectClass *klass, void *data) @@ -742,6 +750,7 @@ static void vt8231_init(Object *obj) ViaISAState *s = VIA_ISA(obj); object_initialize_child(obj, "sio", &s->via_sio, TYPE_VT8231_SUPERIO); + object_initialize_child(obj, "pm", &s->pm, TYPE_VT8231_PM); } static void vt8231_class_init(ObjectClass *klass, void *data) diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index c375107c53..f05474348f 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -205,7 +205,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, TYPE_VT82C686B_ISA); qdev_connect_gpio_out(DEVICE(dev), 0, intc); - dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 4), TYPE_VT82C686B_PM); + dev = PCI_DEVICE(object_resolve_path_component(OBJECT(dev), "pm")); *i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); /* Audio support */ diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index a1b851638a..4e29e42fba 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -166,7 +166,7 @@ static void pegasos2_init(MachineState *machine) qdev_get_gpio_in_named(pm->mv, "gpp", 31)); /* VT8231 function 4: Power Management Controller */ - dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 4), TYPE_VT8231_PM); + dev = PCI_DEVICE(object_resolve_path_component(OBJECT(dev), "pm")); i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); spd_data = spd_data_generate(DDR, machine->ram_size); smbus_eeprom_init_one(i2c_bus, 0x57, spd_data); From patchwork Mon Aug 22 22:43:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951448 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0AB2FC28D13 for ; Mon, 22 Aug 2022 22:53:17 +0000 (UTC) Received: from localhost ([::1]:39592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGIG-00061t-5E for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:53:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGAC-00043a-HP; Mon, 22 Aug 2022 18:44:56 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:35398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGA9-0007z4-Ql; Mon, 22 Aug 2022 18:44:56 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 2so7779434edx.2; Mon, 22 Aug 2022 15:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=3CwPRKRBiYaIQMewUt9MEfE1GS4VKjXvIS7/bxfYq48=; b=gHDEvC3FUfqyFFajq84kfEoqgv1tlh6/2yU6f8e8E1AgPU7S+7Gf/CnHuly66rBWov rwt46wdtNCsznsfYKSt+TWEm3sImsHf4DlSjDNPK2NwHawJyezt6orDi/long2OJweNT jGfIkjAGR/Jtk4Rhg7097ASs2HFYkpOfEDJB3+lpiwQjzjttOElLNW6SLuutB0W/oofT P9EY+n5pidIVRk734yU20TZld8XodC+v70kj/NQVZQ0MZDxbOIsZ4N9niWbnINUcNFqR kQ/fPGThI2Jcrf/L0zU0nZL5KbxoW5aezApPNkQgKRGyPGEJxLDejzGPuSfBlM0eS98K fvbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=3CwPRKRBiYaIQMewUt9MEfE1GS4VKjXvIS7/bxfYq48=; b=tYKlvqw2sPjm3V5QDdcqB4ElRLyz4pbgCYOWhPcgwU0CZEEr0NTxYYpfGUNqyooeW6 hJL0OqPosAgt1uvAXfdvdqzwb6wwkz6t1s/GggIKLSWc0YYzSQQd3vm00YrzhmwMlRtj NrqHx5CQro/gPTK82zt83MRR7d6Qzf1N5V+zd9mUURxxqQfVmZM/AxX6oAIjGhqYUTOA UpdL4vley56f69+FPimM+0BzPTEDbQMz0+nJGQHS5Gr7wkNdzx0FvGGKQ8ie4LyY/Oua taD8sMnAL2UnyDILyGfqVHgpDcotUCMmEqCdlkA+wwUgQSr784ythfzy/qrruYGJ1u6x X+/g== X-Gm-Message-State: ACgBeo3fJD+tOOvnOIcFE0OSAplo1rKWPylQnmXB13XQWomDHjfLnK08 OfVrMwcGDmYeHJp93zTmEELqF/A5SnE= X-Google-Smtp-Source: AA6agR4NwpelRSMUu2LL4fbBqZPHa0O2rFtc/oLVDISC3LjUKqDw47anVKxuCDI+SYjtT6CvHCVXzg== X-Received: by 2002:a05:6402:554:b0:446:1013:c898 with SMTP id i20-20020a056402055400b004461013c898mr1054135edx.269.1661208291820; Mon, 22 Aug 2022 15:44:51 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:51 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 7/9] hw/isa/vt82c686: QOM'ify ac97 and mc97 creation Date: Tue, 23 Aug 2022 00:43:53 +0200 Message-Id: <20220822224355.11753-8-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=shentey@gmail.com; helo=mail-ed1-x52b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Resolves duplicate code in the boards. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 16 ++++++++++++++++ hw/mips/fuloong2e.c | 4 ---- hw/ppc/pegasos2.c | 4 ---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index b964d1a760..47f2fd2669 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -549,6 +549,8 @@ struct ViaISAState { PCIIDEState ide; UHCIState uhci[2]; ViaPMState pm; + PCIDevice ac97; + PCIDevice mc97; }; static const VMStateDescription vmstate_via = { @@ -568,6 +570,8 @@ static void via_isa_init(Object *obj) object_initialize_child(obj, "ide", &s->ide, "via-ide"); object_initialize_child(obj, "uhci1", &s->uhci[0], "vt82c686b-usb-uhci"); object_initialize_child(obj, "uhci2", &s->uhci[1], "vt82c686b-usb-uhci"); + object_initialize_child(obj, "ac97", &s->ac97, TYPE_VIA_AC97); + object_initialize_child(obj, "mc97", &s->mc97, TYPE_VIA_MC97); } static const TypeInfo via_isa_info = { @@ -644,6 +648,18 @@ static void via_isa_realize(PCIDevice *d, Error **errp) if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) { return; } + + /* Function 5: AC97 Audio */ + qdev_prop_set_int32(DEVICE(&s->ac97), "addr", d->devfn + 5); + if (!qdev_realize(DEVICE(&s->ac97), BUS(pci_bus), errp)) { + return; + } + + /* Function 6: AC97 Modem */ + qdev_prop_set_int32(DEVICE(&s->mc97), "addr", d->devfn + 6); + if (!qdev_realize(DEVICE(&s->mc97), BUS(pci_bus), errp)) { + return; + } } /* TYPE_VT82C686B_ISA */ diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index f05474348f..ea1aef3049 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -207,10 +207,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, dev = PCI_DEVICE(object_resolve_path_component(OBJECT(dev), "pm")); *i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); - - /* Audio support */ - pci_create_simple(pci_bus, PCI_DEVFN(slot, 5), TYPE_VIA_AC97); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 6), TYPE_VIA_MC97); } /* Network support */ diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 4e29e42fba..89ef4aed8b 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -171,10 +171,6 @@ static void pegasos2_init(MachineState *machine) spd_data = spd_data_generate(DDR, machine->ram_size); smbus_eeprom_init_one(i2c_bus, 0x57, spd_data); - /* VT8231 function 5-6: AC97 Audio & Modem */ - pci_create_simple(pci_bus, PCI_DEVFN(12, 5), TYPE_VIA_AC97); - pci_create_simple(pci_bus, PCI_DEVFN(12, 6), TYPE_VIA_MC97); - /* other PC hardware */ pci_vga_init(pci_bus); From patchwork Mon Aug 22 22:43:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 414F3C28D13 for ; Mon, 22 Aug 2022 22:53:42 +0000 (UTC) Received: from localhost ([::1]:53504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGIf-0007NA-9J for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:53:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGAD-000466-4C; Mon, 22 Aug 2022 18:44:57 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]:43944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGAB-0007zj-Jc; Mon, 22 Aug 2022 18:44:56 -0400 Received: by mail-ej1-x62a.google.com with SMTP id gb36so24050030ejc.10; Mon, 22 Aug 2022 15:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=zz3CeQemEBsnadYMwoFXVLzgOCRsBVHg7xyGX7xks9Y=; b=gCO+cL5Ra1H6alXR2vNqn8tOCt6EWKi3vZ4oTOlxPeQglnqE0+HnV0s32jDNDxO77h hoz0DJHmKXBswmBurHXjyrDxMDuevUkPw88zcTS66HuR8hmyt9Jy4bxb6BWOhHOiHNI4 iqICao+w9/xl6Se2Rnp4tJ9x60GDfMVAsOusSJ5NV76oQUpIGjRV0Ew3tRb9Mx64AF9C MOFUsTkYkqpuZZj45qYowd4cVaijp3hv7B376WgbeYQKv8rIWXoCOnjnZh1+v7pUmXfa u9FFHgVTtJBdwZAoiXFKUFA6evFrCk6kRvRJua9YOL8938dTpT5eu1bneqPtIFmQmk1q YghQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=zz3CeQemEBsnadYMwoFXVLzgOCRsBVHg7xyGX7xks9Y=; b=YnR6oPHfztGHxnHtxG8egGOlMyxqTHWNQtekE0BVvt+ETfOYXmUQkXjWR124N+USEv KDJSoWDXYOHzqFMhqv7uemfmIlEpZeRsQM+ZRnTDMao0CcpgfMKJXGibXqLmXxTpLLC1 vl5dUertPcq6GRMsFuUo8r7gAC2kguVDP8qo9QCcVBxL+rEwzjLy3r/NkB0q1cfyA+rB SfzT94YZRJ/4Yv1+prQE6DXupz0yz0qGS+c2kAzoBjo6nLnbcQiGc4weffpLXDYFZsWY X0nFK6nGtMUhXX/4+K/raWMI1hiX9RWyckX7SYWT5QTmzpvX2EypQXet1d+s7fLbNAoh mDrg== X-Gm-Message-State: ACgBeo0K8jvuvblAE8NqDgwxPj4mYt05t+sZ8usqJDdxwvCPB4m7xiTQ CB+RJIb7JUEjC7TnGp/Of0O5jYjeoPg= X-Google-Smtp-Source: AA6agR5FKUD4Qs1l9Yav6vJSmTFqYdBTXBERCrmJ/2TK/A8pD7cJw337IcMHh/MJQIeOICqs398mww== X-Received: by 2002:a17:907:a043:b0:73d:92f5:33ee with SMTP id gz3-20020a170907a04300b0073d92f533eemr1660326ejc.432.1661208293107; Mon, 22 Aug 2022 15:44:53 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:52 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 8/9] hw/isa/vt82c686: QOM'ify RTC creation Date: Tue, 23 Aug 2022 00:43:54 +0200 Message-Id: <20220822224355.11753-9-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 47f2fd2669..ee745d5d49 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -546,6 +546,7 @@ struct ViaISAState { qemu_irq cpu_intr; qemu_irq *isa_irqs; ViaSuperIOState via_sio; + RTCState rtc; PCIIDEState ide; UHCIState uhci[2]; ViaPMState pm; @@ -567,6 +568,7 @@ static void via_isa_init(Object *obj) { ViaISAState *s = VIA_ISA(obj); + object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); object_initialize_child(obj, "ide", &s->ide, "via-ide"); object_initialize_child(obj, "uhci1", &s->uhci[0], "vt82c686b-usb-uhci"); object_initialize_child(obj, "uhci2", &s->uhci[1], "vt82c686b-usb-uhci"); @@ -615,7 +617,15 @@ static void via_isa_realize(PCIDevice *d, Error **errp) isa_bus_irqs(isa_bus, s->isa_irqs); i8254_pit_init(isa_bus, 0x40, 0, NULL); i8257_dma_init(isa_bus, 0); - mc146818_rtc_init(isa_bus, 2000, NULL); + + /* RTC */ + qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000); + if (!qdev_realize(DEVICE(&s->rtc), BUS(isa_bus), errp)) { + return; + } + object_property_add_alias(qdev_get_machine(), "rtc-time", OBJECT(&s->rtc), + "date"); + isa_connect_gpio_out(ISA_DEVICE(&s->rtc), 0, s->rtc.isairq); for (i = 0; i < PCI_CONFIG_HEADER_SIZE; i++) { if (i < PCI_COMMAND || i >= PCI_REVISION_ID) { From patchwork Mon Aug 22 22:43:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12951451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B101C28D13 for ; Mon, 22 Aug 2022 22:56:46 +0000 (UTC) Received: from localhost ([::1]:44658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQGLd-00036a-Dg for qemu-devel@archiver.kernel.org; Mon, 22 Aug 2022 18:56:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQGAF-0004CE-9W; Mon, 22 Aug 2022 18:44:59 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:35369) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQGAC-00080p-QN; Mon, 22 Aug 2022 18:44:58 -0400 Received: by mail-ej1-x62c.google.com with SMTP id n7so5945322ejh.2; Mon, 22 Aug 2022 15:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=4YQ2htG9jiUyLtO23/aR5kFL2iQ06T5w6h1p3z+Yfms=; b=pq35VYLpxBD5anMw58EaRV5kg8yMakrwEi8OyjR2PLstliT5lGl+Uo4ub5g23Q/Pag eUjZGMWZrWkXKQ0orA8NQEG8GNhT2jYNjGV7Ez3YQ5UD5c3AHaABJGP56hbIlnJM4QEN 8BRg8COQHXHCKih9lTXOO0ZVoF5rlqpc7O0Svgvg9lg+3b1dngIe7yBaVRd8PgluRkqq +/Of59oe8Ca6rcLW7AnofGnndqkPwYXRsxNZNSsRJHfnEWEBK2HAqVABLnDv4TIyv8yI WJeodlKYiRtrJhOIJlBCRf75UeX5Q8I/3ZqAyouiR4rVwjlDJ6Coi9886aaM6du2QVtR vDoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=4YQ2htG9jiUyLtO23/aR5kFL2iQ06T5w6h1p3z+Yfms=; b=1i4KdC1PAR3qp/MhmlQtHfr5a4lwbQUihNSE7lD/91ZgGpD9j/pemzfNamunKpwa8g repzOdLbvU5jQPKhn/RZqUqiganU+oE8NynHO1qTN3kr4nTsw1vwzlQZIaB3m/Z59LQl Ty7ZrtrmqSBeWYHXeDrrbaFIdwVWGkhRuu/8AInNTBdpLybL2SvDQeAYnnlc+fngp0E2 LbSUZWPRiAT+BejJKwrwnXXV1174Y1NCilhoyAZqvNlnP9+2mt5kAv7PxWFC4Rp/5Ob2 6FEFcWuypNgVj0TR4hrKWFcyRv1NkHTtn7Diu0/p3FyLyMfVzR+HZkCWwnhckVifvwYh fUOA== X-Gm-Message-State: ACgBeo19b/SVLuTXu0eZ59oPPUlar3mNFiMNqM8yaR13fFBHwGmMq0q8 9gaCpN+zbU7Aw940DzJGq6k95auQOKc= X-Google-Smtp-Source: AA6agR4DNdf/lvaQ22xSRNqBkCqVnyqvsJfAENguy0TkiLPE7XZanO35MN1qblVj6kCxFLN/1S/0Ig== X-Received: by 2002:a17:907:7e96:b0:73d:75f2:339 with SMTP id qb22-20020a1709077e9600b0073d75f20339mr5974097ejc.277.1661208293978; Mon, 22 Aug 2022 15:44:53 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-183-070-107.77.183.pool.telefonica.de. [77.183.70.107]) by smtp.gmail.com with ESMTPSA id o4-20020a170906768400b0073d7b876621sm2455758ejm.205.2022.08.22.15.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 15:44:53 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jiaxun Yang , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , qemu-ppc@nongnu.org, Bernhard Beschow Subject: [PATCH 9/9] hw/isa/vt82c686: Reuse errp Date: Tue, 23 Aug 2022 00:43:55 +0200 Message-Id: <20220822224355.11753-10-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822224355.11753-1-shentey@gmail.com> References: <20220822224355.11753-1-shentey@gmail.com> MIME-Version: 1.0 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Rather than terminating abruptly, make use of the already present errp and propagate the error to the caller. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index ee745d5d49..15aa5b39f1 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -612,7 +612,12 @@ static void via_isa_realize(PCIDevice *d, Error **errp) qdev_init_gpio_out(dev, &s->cpu_intr, 1); isa_irq = qemu_allocate_irqs(via_isa_request_i8259_irq, s, 1); isa_bus = isa_bus_new(dev, pci_address_space(d), pci_address_space_io(d), - &error_fatal); + errp); + + if (!isa_bus) { + return; + } + s->isa_irqs = i8259_init(isa_bus, *isa_irq); isa_bus_irqs(isa_bus, s->isa_irqs); i8254_pit_init(isa_bus, 0x40, 0, NULL);