From patchwork Tue Aug 30 19:00:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=d1idZiiO; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHHhP3wqJz1yfm for ; Wed, 31 Aug 2022 05:40:05 +1000 (AEST) Received: from localhost ([::1]:49218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT75f-00040Q-DK for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:40:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6U7-0002zO-Tj; Tue, 30 Aug 2022 15:01:15 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:44869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6U5-0008Pm-40; Tue, 30 Aug 2022 15:01:15 -0400 Received: by mail-wr1-x434.google.com with SMTP id c7so8782076wrp.11; Tue, 30 Aug 2022 12:01:09 -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=I6X3vE/Uc+qT5j8hdi0r3ATIc1MxCB7p/1oogRD6oQc=; b=d1idZiiO6JRXKJMWClh0UTH9/yyRd/YSKVTkugPmJXbFs5aqGd7QXjCat4b/WtdayH wcuK7clRj2flNe50gcGY02zRyhn7JBUOMR9hVkhy1vOWBjGcSrimMbL5Lb7BDvggnrFN 7N5L6EFttsh7/u4Kjn0Y/PHeRtB78zxk+kcbwMs5g5baDBMlVvfd1M4TxzJbhFTzAY1r aDwqmd2G0D8fLyTkNigd97E5Yzny6GLswm+Z/gVN2jRYE6l9fOmriVxcs/lcIHMw7tr2 gP6uawySfKzVCwPBbO4B7Ssiqc3RpWZT8micDHXCkXmgOlN6NsudMAniyqL6wR2oJc9A s3og== 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=I6X3vE/Uc+qT5j8hdi0r3ATIc1MxCB7p/1oogRD6oQc=; b=qcDeND9tt02nMWr72oWfrZOVyGbHcDKfs/HgBvslZvjjxg1yYUP7UMlBRnv05/v6ol ma65XBHkcKfHNg6OrK1VJ5aKlJ5WWCUxLRlBrpxxbLcIE0EhNwb4FRAhq6Rh82XMqL/A QyF3G1Zm1NemCe+OTd+JgRFa1NOtVw8RbFYzW+6xquVl6cX0bfYpvHqyIks92cY2e+c/ Y7Cbr3RE/5giRP4ZE0vLRylrqqL1PWeWu0+QZhGelQ8WYUMapTiHKbgZ59Q4CchxvW6S nkHyCmhXqEUgoJuQIC4k9acIVfjgzHqEbt3VzNiXzWhT/CsvZ24No2G2Wbr7W7Slz8NW L04Q== X-Gm-Message-State: ACgBeo3azNzNuGn/DjWakRLnvtyYIW7qGJ+EuJ70AOK7Yb7gFZ0ApRBN TGylEnIueFbdZZJOiy21MjTXHhWR5QA= X-Google-Smtp-Source: AA6agR4LXe7AVFSTlnIpp2i08+FKN3ei/WQ84MV9Hg+WGXOTk8ajC/eBUWnsRbj6gHQVbuCf1CoD7Q== X-Received: by 2002:adf:d23b:0:b0:226:d4e4:4a6 with SMTP id k27-20020adfd23b000000b00226d4e404a6mr8216655wrh.246.1661886067918; Tue, 30 Aug 2022 12:01:07 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:07 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 01/10] hw/isa/vt82c686: Resolve chip-specific realize methods Date: Tue, 30 Aug 2022 21:00:39 +0200 Message-Id: <20220830190048.67448-2-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=shentey@gmail.com; helo=mail-wr1-x434.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+incoming=patchwork.ozlabs.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 - like constructors in object-oriented languages. 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 Tue Aug 30 19:00:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=eOeNsH8K; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHHl85BtPz1yh5 for ; Wed, 31 Aug 2022 05:42:28 +1000 (AEST) Received: from localhost ([::1]:51160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT77w-0007HQ-Qn for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:42:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6U7-0002z5-Oi; Tue, 30 Aug 2022 15:01:15 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6U5-0008Px-8K; Tue, 30 Aug 2022 15:01:15 -0400 Received: by mail-wr1-x434.google.com with SMTP id m16so15416081wru.9; Tue, 30 Aug 2022 12:01:11 -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=eOeNsH8K41tkz/6zpSHEsRuQy4gmv0LLrFaaQPD4kJgok53EenZjKGW5U7kIGPZKG6 2wbSkXBStMjDrH0B8PiW2rKMmF3iCl5MZXSa1UK5+nZCifRsOzgSGRBd1Pd9Psw8T6VY jllAjBjEBEsF47Fg80iBT2qeXLVEq3LKMbF/OUQYNmR0gBME/RooGE+TgeeSkM6YmqpY 4SlYiJd+4xo5mNiP25xq6csWEq6dmUmukaBpzrflKACOgO/kFzOJBiJFPF4hl1aj277a gETCrpuF+6anPsA/EoyIDPRMFMYLBe4KQ8Lm4QdBvn6cdI/itXHXWI4fICIO+Y+i7O31 bz3w== 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=7B7qPXQnYXzUX0ArDrjPLnXMK+LrFE0aT6E8zBwhZtn9aUchetgeLOzftiwe0QoTfg RpPF0MXa+hJVTFlB3Px8CFLqIIF9yb6j09UFICpyBBgXsEfauBIuP3tSme33aHwqUFu+ Ft/OtOcaLpFUAz+3dIEwrRtAEjUxyyPTRUtjHBqV9rCgmPW+db8Ag90tKPZ4cxmsIxwl yFwWfDnkPPkUGMobNpZyBIW53oLxY/uNL2KrRQVcPfVLQH0p4g+fnsAGMlQJyYTutR5a Sg8BHq/YBC47sOZTv32p03wW1x3XuguAf2Xp6bh3Dh/HgNJENbCw8N3PBUEIaINgkoNJ 6dCw== X-Gm-Message-State: ACgBeo0hEZhixeYQ+1/XD0TincZYo1y8rNa5daq2S3giBc4j7/bh1gj1 bYvsk51yC0x7RMjvTEIJ/dgGuQKHslU= X-Google-Smtp-Source: AA6agR5DPe59namO6iGM/LMidoCsi741yv94jjOmPI7z+8Idi+NebIWdVxEe7h+teafVyhCQuVIq8Q== X-Received: by 2002:a05:6000:68c:b0:226:e12f:6ec8 with SMTP id bo12-20020a056000068c00b00226e12f6ec8mr2977434wrb.681.1661886069449; Tue, 30 Aug 2022 12:01:09 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:08 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 02/10] hw/isa/vt82c686: Resolve unneeded attribute Date: Tue, 30 Aug 2022 21:00:40 +0200 Message-Id: <20220830190048.67448-3-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=shentey@gmail.com; helo=mail-wr1-x434.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+incoming=patchwork.ozlabs.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 Tue Aug 30 19:00:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672026 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=UUaxz5+2; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHGvY5Q2lz1yh5 for ; Wed, 31 Aug 2022 05:04:41 +1000 (AEST) Received: from localhost ([::1]:34654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6XO-0003mS-Ut for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:04:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6U7-0002zG-SW; Tue, 30 Aug 2022 15:01:15 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:45932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6U5-0008Q4-6f; Tue, 30 Aug 2022 15:01:15 -0400 Received: by mail-wm1-x330.google.com with SMTP id bd26-20020a05600c1f1a00b003a5e82a6474so6688663wmb.4; Tue, 30 Aug 2022 12:01:12 -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=UUaxz5+2s6p5K2ocrffAUQAs92DhIiDxyXL1KIsvkHlzetPTN4ToDH9cCoXaVH9Ant 2Dz7NrOWe9p1eA04qpFR0zlCAa8VemW5NFnketywxtj7sm06N42iTZduZcAVtFVJxEg1 0Jeer4CtaJQnd6U1uj4xVDgIruU6r1SlONV5ZNW1LlfEJx2YR00wBlfpw8W9KU8dHHhe AeNutSDy+sJnAC34Gy85gkcDiYA/Vlt+KFZk7JW8oJotGwYA41GbsaZXwG0lgyeu9mTd a1lgKkZQ3IlYQa9cNuxJ/vgEEvzOn3HthpiEww88Sh2PmqEfcMqyILq4owp7t8HyTUjV oMcg== 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=iLxdH2lx3drGMxxnfH16f9ODvkUU3pEthP/F9CcEXOEwjGRwzYUIWA0R9G3ii+9GqM TO0+v3gwmHyFQS6pUziLwCTvijyXhjzbumiCsctsyWD3V4pDHS3mmxHnIuwdH6QhDPXu JXvcJEOzA/y9egWWiP5lj9dJDhkPdvBy5l0yvqQLBxjUIurIJ0AkuewWWtI1HBp/0dw5 gt9qti8ocCTrOBLDopVE7eonc6cnQFEi2dTUItMCUkiYo8lsOhGoCluLehZTKj4pI729 9VFNDNvQLhq0MJMwaaXAUktzhzHZG9CYEIJX8EeZradQM4EOBwNnqbIMYFrfJg4J4RB2 KG3A== X-Gm-Message-State: ACgBeo3+e9tj6xO3sMVz1zDkgEcWj0KF501nCPUTEFeGi18YogMUyE0P 57ucFt6GmL9Xrvi+DObLAsrwswYb1U4= X-Google-Smtp-Source: AA6agR4Ye03AduSgHY9isI53Sb8WLfcwXH/cwwye5g8p58MfWcowyiL1YFBeETObHQMRyq1rwKNFMQ== X-Received: by 2002:a05:600c:4152:b0:3a6:48c0:509c with SMTP id h18-20020a05600c415200b003a648c0509cmr10656417wmm.24.1661886070630; Tue, 30 Aug 2022 12:01:10 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:10 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 03/10] hw/isa/vt82c686: Prefer pci_address_space() over get_system_memory() Date: Tue, 30 Aug 2022 21:00:41 +0200 Message-Id: <20220830190048.67448-4-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=shentey@gmail.com; helo=mail-wm1-x330.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+incoming=patchwork.ozlabs.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 Tue Aug 30 19:00:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=WESj1nLk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHHgm23mBz1ync for ; Wed, 31 Aug 2022 05:39:30 +1000 (AEST) Received: from localhost ([::1]:44700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT755-0003fv-8F for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:39:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6U7-0002z7-Pc; Tue, 30 Aug 2022 15:01:15 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:38453) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6U6-0008QL-3o; Tue, 30 Aug 2022 15:01:15 -0400 Received: by mail-wr1-x42c.google.com with SMTP id b5so15438653wrr.5; Tue, 30 Aug 2022 12:01:13 -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=Fx1C6ZMee1HHX03173gg4I05UJSTEyK7YG48dW/CDUw=; b=WESj1nLkPiMUH8auqlrS4Hpd6POEmL6gR6Y+HZXeMQnH+4InIu3pmGbAKCMTOohnED jrny6Kiv81VkeqwwAZSmM+TE3W5E/r62nuxRdtdUeGYdpI3I3PTUUcpJky7qu/We7DNR TvI0ee9IxXBSk7JYLO0EJ72He0blr1ggPgJ92Me52d3CSwMwPTZ+TIV63I0Pn4OHK6Zo 9cHplrFiulIGyOJVv8P7+YBm9IrmJpLfv4382RxD0IoGQ6Ri0/wOelo+FaOLcndqb03O Gg4aOC4Vhn/CAktD1DsNvXLNGgextZz2T9ItaGHNj5XLgJI2xPjDuf6r88WSDY4EeqWZ Iwzw== 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=Fx1C6ZMee1HHX03173gg4I05UJSTEyK7YG48dW/CDUw=; b=gqe1aKUZJBMGhMr7YoLFyj8LeRQZwipfCr4/T9P1HSe+i3nAmqHRpoxxe+iK0Emqd8 XZnzdJnC7LX/H7KCthDNiqxdtpQ2n5EjzK2jHImrOFH8kgs+AvfbWtwH657TPF+za/Su 5CUFlm5vOQ8ssZf4EEm1i4n8b5CWUmd/topRs/SBqOLH7jwXwGGL0s1foDkdxCA53VGD uxqkXgdsPyTZx+vbQ/1oIdSNItqTfG15X/nnZcu7eXWhMYE8UkP3UPsFCJn5zUFoP1Ax yZIqWc9lzAm8zDBs2hYbBG+GcQPUnnqFcG3WkCdRbCfMIwRIkZNKwnMwI2oMhXnALfBd EMzw== X-Gm-Message-State: ACgBeo3iZPff8VCo+bDYzZkhX7h2pYf5ShpqygEZNhZpxeVSlPe4naoi /FZmaICQuWVAfcc/64qe6rVzdtg1gz8= X-Google-Smtp-Source: AA6agR6GcNPkls9iXaEoi7KaSCPTQCzh22hswsGKfU7udt2Xgd+IMm45gLGRHHx27FryO8ywxt5Fxg== X-Received: by 2002:a05:6000:2a4:b0:226:da29:2afb with SMTP id l4-20020a05600002a400b00226da292afbmr6519637wry.206.1661886072105; Tue, 30 Aug 2022 12:01:12 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:11 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 04/10] hw/isa/vt82c686: Reuse errp Date: Tue, 30 Aug 2022 21:00:42 +0200 Message-Id: <20220830190048.67448-5-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=shentey@gmail.com; helo=mail-wr1-x42c.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+incoming=patchwork.ozlabs.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 5582c0b179..37e37b3855 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -590,7 +590,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); From patchwork Tue Aug 30 19:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ScUkSv4Z; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHH3G57Rqz1yfm for ; Wed, 31 Aug 2022 05:11:22 +1000 (AEST) Received: from localhost ([::1]:42860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6ds-0001hK-Jl for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6UA-00033n-95; Tue, 30 Aug 2022 15:01:18 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6U8-0008Qs-EF; Tue, 30 Aug 2022 15:01:17 -0400 Received: by mail-wr1-x42f.google.com with SMTP id bu22so15105669wrb.3; Tue, 30 Aug 2022 12:01:15 -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=8L5YJCGnOGv/sZ/kFDTIW1ESegeAponyNXEmVyZVv9M=; b=ScUkSv4ZGviWrDTkebkyxHDLl2pHRAHsg8MEVbO9zrhmi/ZtmccAvVHKFsbAlYiDaY jAzNLsGgC5eLy/De+V8UXvszBLlmtEF40/tCYu3lXfxJwTLECZ0pkc7px3zvjZQjb06A SefLkPhTY/1Kzy4FtVQVlemZlMBcJQYRuQnq9l4qhXexXqLpWoFdxlRp2Gdt+VZdvBY6 5bPhdiin1d2DJgbjDgfqHzQIAya/izob3jJLk0wPaMXlRvh+L/M+QgWlS2Pih+Fo/s9B /MfOw5BlhfesKMe6eYvMNK/ALelzRZNxJ/HH6ePfllR9l7jrS1NuAz1tiE9jRfEIAANv sMxw== 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=8L5YJCGnOGv/sZ/kFDTIW1ESegeAponyNXEmVyZVv9M=; b=JU/mN/ud9hrxW0jSGc2b8RtgEe7fzykG1zA4Y2KJKxsPX2hbqC16Or73SbH30QSYpD 2GHOrl3eti7915h+tR0diaPg/4d6QNMcvPGR+2NU0RTetA5hixMDoXNXg/tp5uLP80cn XRhO5IMg/M9cTq35nKg9c64oLIV0aJ042qwZyNjD7/EaK8bEe61M8XBndf1ykveWYHx4 B/vx/bORwnK7mrJhuXlZehtATeIlUudx6gkMlPc3zDopyfr3VPylGPCUPy0nBW77TF+F piHtmg5lCp3XVhuuKj9QJy9dHNC3oj/Woqhgd11UK+ynLXiT4paPR8sE8AJ0OsDDjkCL VZyA== X-Gm-Message-State: ACgBeo3o/szOP+Mu9CgNop/f/V1Yu0s0Tjl9/WO/G63BAnswrvgZU2L/ mnauwa/c6vzjcsh3qgq0u1YNAbM+HZI= X-Google-Smtp-Source: AA6agR7vMQDiA+7YckN5XlWvkpZ6NN8B/dF7Q5TZoSIYaj6Tq6oqeBI1jBG/kEU+4AkOgRXTVnnixg== X-Received: by 2002:a05:6000:156f:b0:225:57be:3978 with SMTP id 15-20020a056000156f00b0022557be3978mr9769261wrz.122.1661886073871; Tue, 30 Aug 2022 12:01:13 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:13 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 05/10] hw/isa/vt82c686: Instantiate IDE function in host device Date: Tue, 30 Aug 2022 21:00:43 +0200 Message-Id: <20220830190048.67448-6-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=shentey@gmail.com; helo=mail-wr1-x42f.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+incoming=patchwork.ozlabs.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 south bridge itself. Signed-off-by: Bernhard Beschow --- configs/devices/mips64el-softmmu/default.mak | 1 - hw/isa/Kconfig | 1 + hw/isa/vt82c686.c | 17 +++++++++++++++++ hw/mips/fuloong2e.c | 8 ++++---- hw/ppc/Kconfig | 1 - hw/ppc/pegasos2.c | 9 ++++----- 6 files changed, 26 insertions(+), 11 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 37e37b3855..9d946cea54 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; @@ -612,6 +623,12 @@ 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; + } } /* TYPE_VT82C686B_ISA */ diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 5ee546f5f6..32605901e7 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -199,13 +199,13 @@ static void main_cpu_reset(void *opaque) static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, I2CBus **i2c_bus) { - PCIDevice *dev; + PCIDevice *dev, *via; - dev = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), true, + via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), true, TYPE_VT82C686B_ISA); - qdev_connect_gpio_out(DEVICE(dev), 0, intc); + qdev_connect_gpio_out(DEVICE(via), 0, intc); - dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); + dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "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..8bc528a560 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -102,7 +102,7 @@ static void pegasos2_init(MachineState *machine) CPUPPCState *env; MemoryRegion *rom = g_new(MemoryRegion, 1); PCIBus *pci_bus; - PCIDevice *dev; + PCIDevice *dev, *via; I2CBus *i2c_bus; const char *fwname = machine->firmware ?: PROM_FILENAME; char *filename; @@ -160,13 +160,12 @@ static void pegasos2_init(MachineState *machine) /* VIA VT8231 South Bridge (multifunction PCI device) */ /* VT8231 function 0: PCI-to-ISA Bridge */ - dev = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), true, + via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), true, TYPE_VT8231_ISA); - qdev_connect_gpio_out(DEVICE(dev), 0, + qdev_connect_gpio_out(DEVICE(via), 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"); + dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); /* VT8231 function 2-3: USB Ports */ From patchwork Tue Aug 30 19:00:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=VbiJ2agf; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHH6P5KS5z1yfm for ; Wed, 31 Aug 2022 05:14:05 +1000 (AEST) Received: from localhost ([::1]:49410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6gV-0006YS-KH for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:14:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6UB-00036L-CZ; Tue, 30 Aug 2022 15:01:19 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:33550) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6U9-0008RW-BU; Tue, 30 Aug 2022 15:01:19 -0400 Received: by mail-wr1-x435.google.com with SMTP id k9so15486519wri.0; Tue, 30 Aug 2022 12:01:16 -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=Z7zkiUKq4zn6nt4eEGe3a2HvPXZSJU1RDsgycY8W8fE=; b=VbiJ2agfFdlqk235n68okjVPn9uhb/46iJoJvwPULAaTLPukM/4DXrJKK7nAkhoSov 1CfwrDEE9zVJKKFFacRMuFzaEG+KzHaC4yOlhXzE0xlnLlkal0x7xuEyaaGSITt3i6mW IyRn6Ujjb4Ry95JFUA3mmNn3d9I9P7Qqvq75FIRlZvo5/cgFloE8Ir4miS1lrvvzQH2O BkS1nRFfDS86TtkOxMiMyX+v7ImzaWUxepUmFk/QohjWZZJiUvs3z4F46hbV9yZi3a6s xQaCKdKm53l5JdL13ZVFTsnJDnn3qDGl7tefknJfi8i8gXg8NIZAqvocS/GxdNbQwxn2 cxow== 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=Z7zkiUKq4zn6nt4eEGe3a2HvPXZSJU1RDsgycY8W8fE=; b=n2RJWv/rxm10/fG0uT8zYjUCYQTc5q5VnHvn7FLI9GAwN6TwL/rReaEvJ58GKxZVZL 3o5esa8QQi3U45AAmooIO07Hb3saWOq6X41E6hXCR3cZKCQD2slv1DO0wF44HBRr/7S2 i5mNjvo0srkOTo241oXA29eNt9qEv1cEcyTR83v0r+r74zcPpu/9WdtlF6iT7wgJRewb CovxGUeAMdjR2o/34ovM0jY9PESepfZUAwOdWKElzzr/0V66nKyVD6y5QqA5iZ0+yYyq pPu46eqC0wSu6RpJDUP1Gn+/Fq6kceH/lwZyb4b2x/UZk+koQLNmlFoY6fQE9m8+rdD1 2+iQ== X-Gm-Message-State: ACgBeo0+dt3GZlin64VR+Psx0CY7+qVe4DcE05r/pKr7NLx6fSMgD9YU +1Cqd+ACw5KGUJvoNx3qc93Gt+EFyF4= X-Google-Smtp-Source: AA6agR7tYA+9GYqwCxCyeOjWxbMc5INIAg21s2b57MVsXCsfqh6q55YqtXD/ligz7vyH8lOOgIkoJg== X-Received: by 2002:a5d:64ab:0:b0:226:d997:ad5c with SMTP id m11-20020a5d64ab000000b00226d997ad5cmr6675450wrp.602.1661886075342; Tue, 30 Aug 2022 12:01:15 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:14 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 06/10] hw/isa/vt82c686: Instantiate USB functions in host device Date: Tue, 30 Aug 2022 21:00:44 +0200 Message-Id: <20220830190048.67448-7-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=shentey@gmail.com; helo=mail-wr1-x435.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The USB functions can be enabled/disabled through the ISA function. Also its interrupt routing can be influenced there. 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 9d946cea54..6aba7f29de 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 = { @@ -629,6 +633,14 @@ static void via_isa_realize(PCIDevice *d, Error **errp) if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) { return; } + + /* 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 32605901e7..dc92223b76 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -208,9 +208,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, dev = PCI_DEVICE(object_resolve_path_component(OBJECT(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"); - 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 8bc528a560..85cca6f7a6 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -168,10 +168,6 @@ static void pegasos2_init(MachineState *machine) dev = PCI_DEVICE(object_resolve_path_component(OBJECT(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"); - /* 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 Tue Aug 30 19:00:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=RMYkKum2; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHHD730YLz1ynd for ; Wed, 31 Aug 2022 05:19:03 +1000 (AEST) Received: from localhost ([::1]:50416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6lJ-0002eh-75 for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:19:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6UC-00038T-BL; Tue, 30 Aug 2022 15:01:25 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:45932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6UA-0008Q4-CQ; Tue, 30 Aug 2022 15:01:19 -0400 Received: by mail-wm1-x330.google.com with SMTP id bd26-20020a05600c1f1a00b003a5e82a6474so6688857wmb.4; Tue, 30 Aug 2022 12:01:17 -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=0tHl4cxkn8o0GZy8/Ma1WXNR3cPMru32DFXp05W5Ldo=; b=RMYkKum2pEd9/paFlev2ASfyfBd3+VLWTw9fFFPfN7o1zFmKy3FwZRSnEe5ngo4BQN Vo6wv2PVRuaf0ENojSlxGnczLaBVUkoF1NZC01pICr2jYxAsIh2DYpuTk89+OaogJRE3 Nlct5JL1icQSolV5I3Fx1ASFVlR1Rh4cmgh9DLJTwT6vwO/M4FwWTryCvXIlyuVn6O2P nUGILAIUnfm/WBoa8v7qhnCKmjxa+7NgS+rYImnisN0k5WHeBtDQ8791s60C28XyEP6r ooNyCZ+7lDtnKXg+AqnRmNn4lagzuQJe7s1ExfD8/yIraY5tl2nxb/KJoerNzOmxwJdI sg+g== 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=0tHl4cxkn8o0GZy8/Ma1WXNR3cPMru32DFXp05W5Ldo=; b=TyGuK2L0Zs4GodVQ/Gwb/Lr/DJB84dMbC6GeBwXjWDJIiwEJWThk1lwQ0TAwrEibQZ vGKDxBFo+izu5b/RWT0/YFNJgl/t0Zs8qJJe53UC673X6ntBBtaz1hmckncdOJ7WayL6 yuwXmr44d8m1mJ19myoLPRPJRbkReTIFF0mLgq9wUR6Wz42/+ct2RDtme/e8hJeFS9+m Izr0rjJCMGYBt50rRHg8AtNDmnBFRaPBg8XSf9jDE7ADMEnveNAVPsSWXPEBYaPWS/HX PL4lWqt+vR1XqMDk8OawNY5vJCsMneK+2xA/1/zSn16Zhff87dd5+GukSbQmbqnxlMJB G5IQ== X-Gm-Message-State: ACgBeo09jnO3bnbCzGzNLB16rSP18Q0w482XdXZM8W2YpKeeb1y0Stxs 4KpKLd1xqArnGDVm2u7MKTjxUcKErn0= X-Google-Smtp-Source: AA6agR4WfTwFCXa81azBBERXsbXpk2dinjhotYWJ0nGoL2daRuVkY9892YZs/32VsXDdFUHP7+Iz2w== X-Received: by 2002:a05:600c:1d14:b0:3a5:e8ba:f394 with SMTP id l20-20020a05600c1d1400b003a5e8baf394mr10416213wms.137.1661886077095; Tue, 30 Aug 2022 12:01:17 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:16 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 07/10] hw/isa/vt82c686: Instantiate PM function in host device Date: Tue, 30 Aug 2022 21:00:45 +0200 Message-Id: <20220830190048.67448-8-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=shentey@gmail.com; helo=mail-wm1-x330.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The PM controller has activity bits which monitor activity of other built-in devices in the host device. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 12 ++++++++++++ hw/mips/fuloong2e.c | 2 +- hw/ppc/pegasos2.c | 3 +-- include/hw/isa/vt82c686.h | 2 -- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 6aba7f29de..4e66570655 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -40,6 +40,9 @@ #define TYPE_VIA_PM "via-pm" OBJECT_DECLARE_SIMPLE_TYPE(ViaPMState, VIA_PM) +#define TYPE_VT82C686B_PM "vt82c686b-pm" +#define TYPE_VT8231_PM "vt8231-pm" + struct ViaPMState { PCIDevice dev; MemoryRegion io; @@ -548,6 +551,7 @@ struct ViaISAState { ViaSuperIOState via_sio; PCIIDEState ide; UHCIState uhci[2]; + ViaPMState pm; }; static const VMStateDescription vmstate_via = { @@ -641,6 +645,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 */ @@ -683,6 +693,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) @@ -746,6 +757,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 dc92223b76..377108d313 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -208,7 +208,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); - dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 4), TYPE_VT82C686B_PM); + dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "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 85cca6f7a6..e32944ee2b 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -168,8 +168,7 @@ static void pegasos2_init(MachineState *machine) dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); - /* 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(via), "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); diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index 56ac141be3..559f7c8926 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -4,9 +4,7 @@ #include "hw/pci/pci.h" #define TYPE_VT82C686B_ISA "vt82c686b-isa" -#define TYPE_VT82C686B_PM "vt82c686b-pm" #define TYPE_VT8231_ISA "vt8231-isa" -#define TYPE_VT8231_PM "vt8231-pm" #define TYPE_VIA_AC97 "via-ac97" #define TYPE_VIA_MC97 "via-mc97" From patchwork Tue Aug 30 19:00:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Vq0HKZQa; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHHmH3vfLz1yh5 for ; Wed, 31 Aug 2022 05:43:27 +1000 (AEST) Received: from localhost ([::1]:44634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT78v-00085Z-Bi for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:43:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6UI-0003A8-1G; Tue, 30 Aug 2022 15:01:29 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:43703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6UD-0008SF-1c; Tue, 30 Aug 2022 15:01:25 -0400 Received: by mail-wm1-x32e.google.com with SMTP id ay39-20020a05600c1e2700b003a5503a80cfso6703277wmb.2; Tue, 30 Aug 2022 12:01:20 -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=0EO7KtOsw0C06qyl69zDnh5KxcY3cif0atwpxtZ2XmY=; b=Vq0HKZQaGEPyjJd+dFzbIufxthuiJCBqC0RnPPa09X1ahcQO59MlqgqLZw4CjgOCNq uD3IQG+vMF45iU7/VwMRWfxKsLAhIRTAWSCY4fcsefm+ZD+u7wV8B9J+/zVJ+vnbWVR8 tN+qmW/yDsfTdTjW2d2J80bAVJESzQbuKABLP5YevEscDYD1/neahPsW7/ndyxh3jgX/ Odd5oEZg1+3dOMU1vwoBioECDEqKhQ4XT9p9ueY6H4BCMpbeF9wyttjTtD2hcTaKPOwJ L0MQDdlPLMLn/FDulhbgSq9iM9s+fYnoegxTwtPLGOfVkgMjYxymx6Rc3bf9MvRYsjNE UA8A== 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=0EO7KtOsw0C06qyl69zDnh5KxcY3cif0atwpxtZ2XmY=; b=VlYcKGliLkKrKbYGjdgIN5JjRww0W6NQhgwvJzH7q84YsCQ2x/LRRaM1FeHtlRGs9C +nXdbNQhkMK8mWCI+ZqCaBO8SWDPNEmMoHQJrfEtP0pdvgsCG1aeD4OWyOMIP3PYeGdf nJ+6Dw65P4lKMjNDWdZnQdt1+IEXmOtEqIhPRNjh0XzFQo/Ymc1DPQaWVOxJOwxEJuqM r6rEJXNeIMA2WM1E53LuldO3BWSoM8ZqvohSpg6b5yVV4oap+3meygYPSzPAuCdKK54h XLFc5eBN38S4EpXyA0IHAk5qVeXafwVRyIvAybNnoiJpZrrMIPfVMANYjKsHcwMYMdw2 3BUA== X-Gm-Message-State: ACgBeo2MibIVwxmqwTquemQRbE2xcwRRINOAoLak89dP+h1uimWQGv5i g0Jnt6Dg4bXtG1ym2+7G7mqd4XDMWiI= X-Google-Smtp-Source: AA6agR5lkJxAX5cb5bsQH3tmWVQa7jY04c44xoN6fUP7xLvS7vS+kPRSviDs5GZlE1ZTHk6JbRS79A== X-Received: by 2002:a05:600c:4fd4:b0:3a6:2694:e3bc with SMTP id o20-20020a05600c4fd400b003a62694e3bcmr10257134wmq.60.1661886078765; Tue, 30 Aug 2022 12:01:18 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:18 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 08/10] hw/isa/vt82c686: Instantiate AC97 and MC97 functions in host device Date: Tue, 30 Aug 2022 21:00:46 +0200 Message-Id: <20220830190048.67448-9-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=shentey@gmail.com; helo=mail-wm1-x32e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The AC97 function's wakeup status is wired to the PM function and both the AC97 and MC97 interrupt routing is determined by the ISA function. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 16 ++++++++++++++++ hw/mips/fuloong2e.c | 4 ---- hw/ppc/pegasos2.c | 5 ----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 4e66570655..150e9401d0 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -552,6 +552,8 @@ struct ViaISAState { PCIIDEState ide; UHCIState uhci[2]; ViaPMState pm; + PCIDevice ac97; + PCIDevice mc97; }; static const VMStateDescription vmstate_via = { @@ -571,6 +573,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 = { @@ -651,6 +655,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 377108d313..2d8723ab74 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -210,10 +210,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "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 e32944ee2b..09fdb7557f 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -159,7 +159,6 @@ static void pegasos2_init(MachineState *machine) pci_bus = mv64361_get_pci_bus(pm->mv, 1); /* VIA VT8231 South Bridge (multifunction PCI device) */ - /* VT8231 function 0: PCI-to-ISA Bridge */ via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), true, TYPE_VT8231_ISA); qdev_connect_gpio_out(DEVICE(via), 0, @@ -173,10 +172,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 Tue Aug 30 19:00: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: 1672050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=An+eGfSD; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHHNb4d53z1yfm for ; Wed, 31 Aug 2022 05:26:23 +1000 (AEST) Received: from localhost ([::1]:40286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6sP-0007JZ-EY for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:26:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6UI-0003AD-A9; Tue, 30 Aug 2022 15:01:29 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:44807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6UG-0008Sb-Kh; Tue, 30 Aug 2022 15:01:26 -0400 Received: by mail-wm1-x32c.google.com with SMTP id n17-20020a05600c501100b003a84bf9b68bso1749785wmr.3; Tue, 30 Aug 2022 12:01:21 -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=nmcgz1gXNUhjBIJ2W+p0Z4n0UItAGPtSr6Xm0Wuhb+I=; b=An+eGfSD+AE2PHtzmk2e8PZsnFyUbJnrf/QEH3yB91l8C7ySWPZ4XaHjCXNRVf4xlU UBrBRdGZgZs2tbIx/bLQBuqa63ENMLIFAGX8qe7c6M8N9KnGUACbpoL7FjSkMuQN16Wx kfFI+avXMA6LT4XNgL3XjoKLs1Lum98oA82sL+vTtR4K3T0g3ttDY7is5sQSRefDgJBe bQOaYqKBuQBoIuPc12fEwnaFMFyAaK7CqFr1XhGb8hw3Fou1A4p7/e/uiu5tEnPPzeHM kmC/EXAsKIOxAWp5MX3Vx1CqhlMDlI8HYlmqfhMlLtCW/pz7NEEkWTpiGiEfw44jBnTU c3SQ== 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=nmcgz1gXNUhjBIJ2W+p0Z4n0UItAGPtSr6Xm0Wuhb+I=; b=7bde+7adfSzxSE9z5zpzpUtlUFl4Dt5QD6EtP0v3QPV0PpxP8ZOEqerG++B7x6LoEA YRyt08w3qO9IAjDwvLSqakSmbtMn3zITcDdKuoPYRWSq5dRl44vSYwQolTisSrwH+Vyp /toeJhx/xtRyBLYktJ2339ws5pwiciG0Ijd3iXnwXuLCJ0p6NaPBwa7Tz2VyxwBzIzfC EFN0oZ4tCZopW4VlI6bSyqC/zcEZO0+YJTeR0TQSysMSDyTBei1N0QyLH5Nwg/E8IvJU zw0gQX0ApsMCHr39cq8dhXKSyyurbIk/1HwcV3DQOZqIH+liCFUBAfZOtORZjgMfwYEY KOjw== X-Gm-Message-State: ACgBeo11w23JFWiw0h037bwNkwVYTeRO4Hx7Qd2XqSSdsnYyh3qwsK64 6/Spw2+zWJYarqWfthYwLgSPPDmrxyY= X-Google-Smtp-Source: AA6agR7lw4ZVou8XLMiZMbL+PqXr/YxD+SltTYJqxqi27QY7l9vhaq7cuqp2aBIhXr+37DO8PTtGIw== X-Received: by 2002:a05:600c:1f1a:b0:3a6:2569:496b with SMTP id bd26-20020a05600c1f1a00b003a62569496bmr10341278wmb.176.1661886080079; Tue, 30 Aug 2022 12:01:20 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:19 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 09/10] hw/isa/vt82c686: Embed RTCState in host device Date: Tue, 30 Aug 2022 21:00:47 +0200 Message-Id: <20220830190048.67448-10-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=shentey@gmail.com; helo=mail-wm1-x32c.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Embed the rtc in the host device, analoguous to the other child devices and analoguous to PIIX4. 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 150e9401d0..0ef9446374 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -549,6 +549,7 @@ struct ViaISAState { qemu_irq cpu_intr; qemu_irq *isa_irqs; ViaSuperIOState via_sio; + RTCState rtc; PCIIDEState ide; UHCIState uhci[2]; ViaPMState pm; @@ -570,6 +571,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"); @@ -623,7 +625,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 Tue Aug 30 19:00: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: 1672054 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=cLc6/bMC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHHSZ1qlLz1ynf for ; Wed, 31 Aug 2022 05:29:50 +1000 (AEST) Received: from localhost ([::1]:60162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6vk-0003Yo-4N for incoming@patchwork.ozlabs.org; Tue, 30 Aug 2022 15:29:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6UJ-0003AG-JT; Tue, 30 Aug 2022 15:01:29 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:39860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6UG-0008Sj-SR; Tue, 30 Aug 2022 15:01:27 -0400 Received: by mail-wr1-x436.google.com with SMTP id az27so15444427wrb.6; Tue, 30 Aug 2022 12:01:24 -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=8B7eBgW29BU1C+cqonsxs06FxkT27yX/E40I1fAu85w=; b=cLc6/bMCqeJYwneMRYn2aCmmu5jCYB1VWTb1Bpl5z9IetCEbHCsR3gpEsIEOI4LuYi zeZyXNBVgvZxIfiuBRMK3T+APl8rCOPeH7cx6YgYHZBGXddB6AiTdN0080IchJrPB1H6 h18bGrbmQgGazyB8m+SzbX2mhsDbifl+Z8M7m5jIhlexzbq+l2PAfrk/NznU00fvhUUY 1kWCMszjNx0XpooutTsC3RQsp37s5XyslF2biiXxE6V4vFBHowFX+KtAtSLnYwhmdOGB xuOmaZ8ZLfNf8yX5RUbhith8+xIDayhybMtHj20qkdRN05xNVLXzETRUGhbToXIuWo2Z 7Bew== 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=8B7eBgW29BU1C+cqonsxs06FxkT27yX/E40I1fAu85w=; b=60Rwsr2I3/UCpg9ckdrQhF8toMCq9Ftnh8BQTDoVyFGXe0Ijo2kcKs1hZ+shM4TuTq Q0yEMkCbmQR1lCMngopFNbFTTzPPNa7pNmd6upoWUI2OsprkT3l5MK9IyDhs9o7Ie2GW owb4HbjcyxcgoEYKQPpVkCyPyhdva80yhq5oRFQO9u+BQeB5GMQhuZ9oDeejD6YxD6fl V+OmhhAoyyFBBb8S2BKFGmEjG7dfS6jO/thbB/rZtF0yABwteTfbBMuzKJPHNynEk/+c dbI1PuVhpZh71DK7ciAV0lYsqFmPGMh7whDJbMzech73IDcePN1als8ST6frzuj0jvaR qseg== X-Gm-Message-State: ACgBeo3gpQFdkZ+XuQ/Dk1PwfPoZLnGeN+siojb6xgqtMH0jqZg2iyHX jVodxZKYidtAzVRpYjOorFLdXU1Hz8M= X-Google-Smtp-Source: AA6agR7weKuqtPDz5lxMBcq2EhtOySKLwrEYUoeh128Ga3fMbNxVBUpu/e0RW72ooRoZceIQ6ZyeQg== X-Received: by 2002:a5d:4746:0:b0:226:da9e:46bc with SMTP id o6-20020a5d4746000000b00226da9e46bcmr6401595wrs.665.1661886082884; Tue, 30 Aug 2022 12:01:22 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:21 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 10/10] hw/isa/vt82c686: Create rtc-time alias in boards instead Date: Tue, 30 Aug 2022 21:00:48 +0200 Message-Id: <20220830190048.67448-11-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=shentey@gmail.com; helo=mail-wr1-x436.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" According to good QOM practice, an object should only deal with objects of its own sub tree. Having devices create an alias on the machine object doesn't respect this good practice. To resolve this, create the alias in the machine's code. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 2 -- hw/mips/fuloong2e.c | 4 ++++ hw/ppc/pegasos2.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 0ef9446374..a23ffbb3ff 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -631,8 +631,6 @@ static void via_isa_realize(PCIDevice *d, Error **errp) 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++) { diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 2d8723ab74..0f4cfe1188 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -203,6 +203,10 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), true, TYPE_VT82C686B_ISA); + object_property_add_alias(qdev_get_machine(), "rtc-time", + object_resolve_path_component(OBJECT(via), + "rtc"), + "date"); qdev_connect_gpio_out(DEVICE(via), 0, intc); dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 09fdb7557f..f50e1d8b3f 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -161,6 +161,10 @@ static void pegasos2_init(MachineState *machine) /* VIA VT8231 South Bridge (multifunction PCI device) */ via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), true, TYPE_VT8231_ISA); + object_property_add_alias(qdev_get_machine(), "rtc-time", + object_resolve_path_component(OBJECT(via), + "rtc"), + "date"); qdev_connect_gpio_out(DEVICE(via), 0, qdev_get_gpio_in_named(pm->mv, "gpp", 31));