From patchwork Thu Sep 1 11:41:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672820 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=k1dcvUjS; 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 4MJK5p6jXdz1ygc for ; Thu, 1 Sep 2022 21:47:10 +1000 (AEST) Received: from localhost ([::1]:45128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTif6-0006yP-6j for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 07:47:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaR-0005h2-AJ; Thu, 01 Sep 2022 07:42:27 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:34649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaD-0000Dt-QV; Thu, 01 Sep 2022 07:42:19 -0400 Received: by mail-ed1-x534.google.com with SMTP id z2so22203971edc.1; Thu, 01 Sep 2022 04:41:59 -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=I6LPJZUvTPv4BSyUK+1MUo2I6TDAef6EvKzOqmCgYAk=; b=k1dcvUjSiHBgrh+9Gi/sXzINSXP7R+65kpukBoLD4wJnjKOVbZW7kx9v8DkhxT2KVo Iu2tOIvO02ALbPKfP2hxMsXnGo4NWHhSGej1JQ34CHZx3sHCnfrop5vP9ude7NEKobmW r7lQqL+uzccCC2Bnp4w9O+usvaHDoF4k31eL17iSG7mfnmwZxpnJLkAw8tPWeh/S6Xk4 8ZJMRr7qiwQhxvF8rfaxvGsVCDvLgCjgREkVRAO8052cOITSzcL08YIDEXeUlhWeCKm1 2h/gaDmagcEPxx3s1XRgjFuL95tqifR63Sa0XoYsQ4B8hB8DM7jrlbYg1YrTjeOG//9E yGXA== 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=I6LPJZUvTPv4BSyUK+1MUo2I6TDAef6EvKzOqmCgYAk=; b=4VUj452KE37NsWWinhtlez70UYCmOsmR24gMWJLgHZZuLsM6AVTwscM5xXbMUaoN6a RNWwkux72EVfjo0pUpPB40M5tLRGN6/5OCxnDIslm/Zo3/A+TArYs6SwKrb+zDc47zCT fWLyeBfHNmm1f/7mz/JI3O/+AQ8fuyYMPhC9YcPaG8T9zpyfIz7ou6QwQC37Pz1uhoAy 96qBx018manxrNHytf4HviMrxMtrz5fNTeT3xr5RyHoqQJE4p9+OmInJmI1xiBa/7+Sp 7+PGYXEkbQ7N1iu+Lfr7xm/swiwGu1+m94Kb+fXIJ7W5YlEDfcROtu2dAr7mZrY8axWZ 1sSA== X-Gm-Message-State: ACgBeo0vZKTyYoJhTOzy5uP55roBqsgAsjpb19PK07zz8MFJ3n9sCqpm DKZL6jUg8XO7TvG0G2WVp3bSeWGxcv0= X-Google-Smtp-Source: AA6agR7K7azTKPj0L6UeU4QtgKkM8jrNDEiA8dG4r+1k5EeNQ5+gTvNRQrTyZODgXgb+R8IgqOYCgA== X-Received: by 2002:aa7:d612:0:b0:447:7ac7:e686 with SMTP id c18-20020aa7d612000000b004477ac7e686mr28757945edr.145.1662032518228; Thu, 01 Sep 2022 04:41:58 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:41:57 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 01/13] hw/isa/vt82c686: Resolve chip-specific realize methods Date: Thu, 1 Sep 2022 13:41:15 +0200 Message-Id: <20220901114127.53914-2-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=shentey@gmail.com; helo=mail-ed1-x534.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 Thu Sep 1 11:41:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672834 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=iqbli/39; 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 4MJKQt1n18z1yhP for ; Thu, 1 Sep 2022 22:01:56 +1000 (AEST) Received: from localhost ([::1]:41738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTitM-0002U6-Qv for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 08:01:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaO-0005gm-H6; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:35405) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaB-0000Dw-QB; Thu, 01 Sep 2022 07:42:16 -0400 Received: by mail-ed1-x52a.google.com with SMTP id y64so10367630ede.2; Thu, 01 Sep 2022 04:42:02 -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=ccpcYMGxqn8WXNFI2X2jCqAbkQ1k7CgYSp60BbZylhE=; b=iqbli/39aER7igdJYGEFqVX1qsgLdgnLDw42n246gSecn2zicCRl52uF6JEZ41GlrZ GEFHJNStdj/qZd6jrpKahHwh5XQ/P+0X4Osxlc64WWjkrKhC3ct+E6EqJRanXBi5yxfS QKfIB2FHDUurebodfmPsQlqdU6yBc8RHC67fu5ufRmE/0OuAvlCg4w5B7HVbf6z36D6P BUJa5puRd9QtTcS8g5c8brA2dc0bUFTBUFYdhKbgDAnm0XSmHEuXSIiKiiv/+DohZwFT mBB3S2e/BipoFjtGR+XdDXlBc5D39mGHMrvLTNlDO54SUWaoUiOCS+w51w1wVH0Ib7P5 Muzg== 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=ccpcYMGxqn8WXNFI2X2jCqAbkQ1k7CgYSp60BbZylhE=; b=DIm+VOy81c4+350gu8A2ChLw0tAvy9cHLWtrJzl12KC0lukRzTjoegIPIx7ToDbAEz Xj/ywOq63xKGTNXJIX2TBLIYOHPgC5ptWlVn7rfJybCKL1aomhjDTKjmVfnEhun0ivIA 4gt/ZSFQJGy5FepPulB0C8wQNNz1xqX/34UwUj2wzlN5sJ7mTNtQxgfvHUIIol2SSPXq bg76Qu2x1Tv2Cx0Vt/U5HZ74Si/s+ey040CabtJgjYdQ9U+TeIYrCIGWWy9Oh2Js8IpN XsGLPoz7CnuROAQ1atjszMRPkaoRLpueTUIhoYrr2gZg0hVa9OID+wW0Bmnz97JXYSsa bD6Q== X-Gm-Message-State: ACgBeo2/0c5tQJ9FHMs+6GuMAi/NEtwZ7PsISF24t8LP0aryPtgoZO8Q tWI08AZfNKZnyjZsl69KKmsqiyT4zzw= X-Google-Smtp-Source: AA6agR7Zg6o29Rz6zPcOtZwtBweIx7ldXgBdi/Lg2HPCh0hLmQKaWYrBmXFbuIrcQFrUBsbjwSjxYg== X-Received: by 2002:a05:6402:27d3:b0:43e:5490:27ca with SMTP id c19-20020a05640227d300b0043e549027camr29223507ede.307.1662032519040; Thu, 01 Sep 2022 04:41:59 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:41:58 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 02/13] hw/isa/vt82c686: Resolve unneeded attribute Date: Thu, 1 Sep 2022 13:41:16 +0200 Message-Id: <20220901114127.53914-3-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=shentey@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, 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 Thu Sep 1 11:41:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672830 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=nNrcfHuv; 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 4MJKGx6TVTz1ygc for ; Thu, 1 Sep 2022 21:55:05 +1000 (AEST) Received: from localhost ([::1]:39188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTimk-0004le-Vv for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 07:55:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaR-0005h3-BD; Thu, 01 Sep 2022 07:42:27 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:43972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaC-0000E1-4G; Thu, 01 Sep 2022 07:42:18 -0400 Received: by mail-ej1-x62d.google.com with SMTP id gb36so13197707ejc.10; Thu, 01 Sep 2022 04:42:01 -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=kziy975Ku9ck3Do5y4RHLxQM6WcJLVSaw/Wzvh4zx/s=; b=nNrcfHuvlVW9kpOMhNuh1N6e92wb+572ju3/hKbVAD18z/u7OI21ZPJ7Vy9MyBukk9 TqMvVCqDstaw6w9C5f0kPC0Wih/X+Ij6uK2113+u9MYy3k0KqVi1Uve0bSI3abKC7gVZ tuY0wNxtA4ptXs7HY7YxdPKxb20LWs+UhmRaJWg0rewFh83VdoduFSz/KsoVcwbHvh/i pcmfdfjSYWC8etA/aH3/i5XrRTejWuTtSbwa4isCubVtokP5hfX6Vh2DaYdQqxayONq1 GltDydv1GbaEJhKJFp/Bcp3zg9BGrUggJzHX8qXdQOS7V4aPTYU1udH1Vn50mtHi6KJH KNUg== 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=kziy975Ku9ck3Do5y4RHLxQM6WcJLVSaw/Wzvh4zx/s=; b=8EFrjSl05TKd5ByouzIXpBprkDO3H0m5dXJNsKP94VKOb0WfZwoR0mW8xXk9Ca1zGp I1/PcYWuhEoo9HqeIoSjlexxtccvYE/TytU/cKcsYH8NQiBq/ieOxgQqn/nyyzuJxqhw J36IriHT4yrZ/GeziaEDrX8V4yD7i2jc4gkkuLkN/y3ZpXrUSBof8Q6eXHYSZtNKBY5y te69FNlX1VOq82WgPuNExZzpTWaZmqLIqbBRvPT1p550EFJwr4/8FNoQvLgni5vPyYym HXW5VywtBaFFyHc5TEGrwJ22xMRF6yhl6LkIfMfn5znk1iVrs8K9naGOZ37caW6FJwza VwaA== X-Gm-Message-State: ACgBeo0omthy6N7xVZa0cpgsORDXkIirQbRbxU/A9Hd7T5kH3MfCwvoe xL7ib2OBxcDhrwz+SRgyNX4mXYeToR0= X-Google-Smtp-Source: AA6agR6qFULVX3R1Xa8MHv0QE07bJGvrOoFUqPyES5GpzCnkaNvTnMXYq18m2D4n6YmY6fKb9I8jBw== X-Received: by 2002:a17:906:e9b:b0:730:a6a1:9fc9 with SMTP id p27-20020a1709060e9b00b00730a6a19fc9mr23314410ejf.601.1662032519943; Thu, 01 Sep 2022 04:41:59 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:41:59 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 03/13] hw/isa/vt82c686: Prefer pci_address_space() over get_system_memory() Date: Thu, 1 Sep 2022 13:41:17 +0200 Message-Id: <20220901114127.53914-4-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=shentey@gmail.com; helo=mail-ej1-x62d.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 Thu Sep 1 11:41:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672836 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=XgI3Owix; 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 4MJKS13Gb4z1yhP for ; Thu, 1 Sep 2022 22:02:57 +1000 (AEST) Received: from localhost ([::1]:40876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTiuN-00040j-27 for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 08:02:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaP-0005gn-JT; Thu, 01 Sep 2022 07:42:27 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:39807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaF-0000E5-GV; Thu, 01 Sep 2022 07:42:17 -0400 Received: by mail-ed1-x535.google.com with SMTP id z8so13387249edb.6; Thu, 01 Sep 2022 04:42:02 -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=nD+jGqQYURG5xsaq+oD5YvWClrYTdwH6ZUzIb2BISlw=; b=XgI3Owix+bZcz/DlrC+KRWcmv58MDaGLzhgDEJcek60YzA7H8+92egngPfO/zywx68 NcyALEcomltHL4V31g9MNc7gdoItu5ArMLqYjYZ4oaIz9O966HoCQ7XOshxA7SQd1c2A J0E11ve+YNcV5p4AxNXRBWzv4wrWQ4PbvcrpoV+IFqyGEEFJLOfuRm/mp0yWp1GmHAsi 89IjKAOsuOtxy8cSn5n1S69toSAEudaiCHQ1ANA9ifnyD9pJJIiSCHAUED2ykJ/1QODk WQb0L16UgI/N7u4cRDddwrhJUzUV6fm66khX4s7ap94ICaZAYJ4dYMA2TcnFeisRVU9f VZmw== 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=nD+jGqQYURG5xsaq+oD5YvWClrYTdwH6ZUzIb2BISlw=; b=pEUjOiBOxNQKSikhEMnUUkoaiHstvhRm52kbtprN9CtG8G2LXRShPeBLjmhu7XpWwe W3gin1x8lVeIMzY2hG4e0jNiH/E/QHs3QzJnTaC30Q3gbAkb4yfqSf2r+2tBR5E+AGtw spdKjDuiAPMJxmbJY7jQFQQ7LyRgZ+Bb+2JtrFafKPgnPH9TNk01OQbg/mIbQ5V71FAy kC3yhyQK4rFqeQNYBPDhp2p1Ydu4wXOoC0xtKuUNgNZpPeJBkc1H2nTOmw0G7qsTtuYJ tOBVvi3GDyXzPg+bUboOd/Md6BQuKiNf6G8l8LRSwi0tPHf9gImKuwIkPhvKqZLDPEz8 pRAA== X-Gm-Message-State: ACgBeo3JrwDAT3kM6spaWotoiSJQF1dEvGlgtLU3PYtDOzbAebQ28bhg kNGWZ1ZD/3TKqjTKfY4HQkQJmxkJWIY= X-Google-Smtp-Source: AA6agR595CGKvjC3SS6TUBFuUhbsBTdXvVdFa1LtSU/QfB9miUkOYgfIJppqyPhlIuB7MFX1F5MIUA== X-Received: by 2002:a05:6402:50cb:b0:440:8bac:1e02 with SMTP id h11-20020a05640250cb00b004408bac1e02mr29137284edb.336.1662032520783; Thu, 01 Sep 2022 04:42:00 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:00 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 04/13] hw/isa/vt82c686: Reuse errp Date: Thu, 1 Sep 2022 13:41:18 +0200 Message-Id: <20220901114127.53914-5-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-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+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 Thu Sep 1 11:41:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672832 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=dFPUi+pN; 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 4MJKKg1zhxz1ygc for ; Thu, 1 Sep 2022 21:57:27 +1000 (AEST) Received: from localhost ([::1]:41110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTip3-0006Mm-4Z for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 07:57:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaQ-0005gv-D1; Thu, 01 Sep 2022 07:42:27 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:33532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaE-0000EB-4e; Thu, 01 Sep 2022 07:42:18 -0400 Received: by mail-ej1-x632.google.com with SMTP id cu2so34163396ejb.0; Thu, 01 Sep 2022 04:42:02 -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=7oW9e9CQAQ6fs7n+6iH6aAQcJgkK+/GOKyNQf68VL6Q=; b=dFPUi+pN4qPKkRxbtPdmj6e7eDiqi5Aw+4bgKxJu2uZ8I2ktwmYjFsxZEWjQc5NKNS +Jcin0ZJPjeUM/6/ND/H/0+KX4yGTn2ZfDVxmQJXbTh07OzSpD6jcZSFBVgxCp2pEdTo ckE+aJSTgTbrOLD6rHYXCu1neseYQpjxK5fgmP7OI2IczcUy5ivJdSJBbaPPEc7HD0IW ZEyETNEt6tMRzbL3feupNXDGL/k99A5eMftEvUeFYQwJ9I/EY90gS3lnDpQS8NWb2YCL 8RGpjGu9uV0TTSBPkjmQLDen/gde9s1oO6vRWGPSNuGOzsrJrWhaaVTmy/H6lnnX2HUe fyGQ== 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=7oW9e9CQAQ6fs7n+6iH6aAQcJgkK+/GOKyNQf68VL6Q=; b=TpLDFZ20EaZVcTkeA/0r1eLS9VlTvino0iYVxjTK7iVlKKvVEMcI5ge9TV0ZAzTadp B6u/EENIM44n/Eb3NVKZMtvoKNaMzxWUR3DhxB6RjyjJ8gjKetGqGvLQQ2P+7HZI18pi HJfG8BvfEAZs3C2BM9nI9/Occ93cJIzonqYO1aycDtWLaCdD94n70fmP8oqSLjTkh4rQ VcwQV2NBdEB8ALacvoMOzFHXpt43icnDeIOYHZ5MtzKSXb1PyLOJeWta0s68s7bK4xdf UD3eGGF8+vqIDIVwx5+oG+9Cg+VRa0X0EnvMW+IhPiwI1+5UgSG7cfdTNAgnX3Wuhokf 0W6w== X-Gm-Message-State: ACgBeo3I/Ra8XVuGZHbLj2tSCGl3IBkRGLlqRfcCu00ZWShvRSXZgaTv /Qc4jjm0BJR27CsTKJYwKt+/dCee9JA= X-Google-Smtp-Source: AA6agR5VLCrCvH1kAKB3UcMJdoDMIZg6h+kaJ/DzeSq4kPzlPUAwbnzAmh9F0KvQ8WRQZav43atkfw== X-Received: by 2002:a17:906:4fd2:b0:742:133b:3522 with SMTP id i18-20020a1709064fd200b00742133b3522mr9636573ejw.21.1662032521791; Thu, 01 Sep 2022 04:42:01 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:01 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 05/13] hw/isa/vt82c686: Introduce TYPE_VIA_IDE define Date: Thu, 1 Sep 2022 13:41:19 +0200 Message-Id: <20220901114127.53914-6-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=shentey@gmail.com; helo=mail-ej1-x632.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" Establishes consistency with other (VIA) devices. Signed-off-by: Bernhard Beschow Acked-by: Daniel Henrique Barboza --- hw/ide/via.c | 2 +- hw/mips/fuloong2e.c | 2 +- hw/ppc/pegasos2.c | 2 +- include/hw/isa/vt82c686.h | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 82def819c4..e1a429405d 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -230,7 +230,7 @@ static void via_ide_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_ide_info = { - .name = "via-ide", + .name = TYPE_VIA_IDE, .parent = TYPE_PCI_IDE, .class_init = via_ide_class_init, }; diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 5ee546f5f6..44225fbe33 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, 1), "via-ide"); + dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), TYPE_VIA_IDE); pci_ide_create_devs(dev); pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 61f4263953..8039775f80 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 1: IDE Controller */ - dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 1), "via-ide"); + dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 1), TYPE_VIA_IDE); pci_ide_create_devs(dev); /* VT8231 function 2-3: USB Ports */ diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index 56ac141be3..87aca3e5bb 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -8,6 +8,7 @@ #define TYPE_VT8231_ISA "vt8231-isa" #define TYPE_VT8231_PM "vt8231-pm" #define TYPE_VIA_AC97 "via-ac97" +#define TYPE_VIA_IDE "via-ide" #define TYPE_VIA_MC97 "via-mc97" void via_isa_set_irq(PCIDevice *d, int n, int level); From patchwork Thu Sep 1 11:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672833 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=B4raOLB0; 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 4MJKPV301nz1yhP for ; Thu, 1 Sep 2022 22:00:46 +1000 (AEST) Received: from localhost ([::1]:55914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTisE-0001S5-Ty for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 08:00:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaQ-0005gw-KU; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:36501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaD-0000EM-En; Thu, 01 Sep 2022 07:42:18 -0400 Received: by mail-ej1-x635.google.com with SMTP id h5so22510315ejb.3; Thu, 01 Sep 2022 04:42:04 -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=J26BIQbiLwzmWEXSRIvf/ti9jfwi26ORKPwb0BotX8Q=; b=B4raOLB0a/2msM/9rbKl+SCYZgdniB5U6uC5CowK/8KF0DkkVmRN+gTmGyVQO2xDZ9 MSZkvH+ipFUXUzIuhcW2F89WLvXZUKryfl8H3E73kX8xoGL/ZD5VuOx7QFGL5VAJfZQR uFutzgZWCZha9OB5wRkScbqV4G9JMcR3cvZz7oMNv4ErsC3JWUp6+O0izqJWZnW3aGSB tkPb8REf47KugKs2onB8zSfHo9NdYf86ZmAeA8R0ZH1wF0fVVfE1m+KimVFJAKPlS846 slgNOdQ2TuRKOq9jsjOirXRufg2bzB5XW6KxF4ZgaCVTJQegUtqH8hCKdLKcuKj6BjV1 JHEQ== 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=J26BIQbiLwzmWEXSRIvf/ti9jfwi26ORKPwb0BotX8Q=; b=Xz//FvXexablPYL+gAwTa2bK69gGl6IIPOK5lFEOe/zsPCxBrB8hf3by/tHitq1ru2 QSTpPzmThPA2te7wpiOSB+KOG3BzKQEY81VVeJCfNK+4nWJaa6vnujaqVAFLNHYKg8iz bjnLFcatMHQtFsljSz4zncsW2xlitTS8jPOng2fn39DbGTgucYgmtwizH1BG8jtqpsxE ypL/PA7PVqIgzVHJ9fz9876gJZf9kFrjhOdPOBIjJ4j8f1Ni3L0l0AxO4KzgihneOnnq tBat4jtgdf05LlOoPP2aJoEb8PEYfdRfqNPGAPxPx9fkzIt3V63qd/dMkmUPO4Y4pwuc nBRw== X-Gm-Message-State: ACgBeo1XRQi17e9HEfQ5tSC+4GKllOB5d6YuEuailI2C9iUk0Yq0VwIV 6m9E1ec2GMVFntFjguiNslkU+9n5v6o= X-Google-Smtp-Source: AA6agR7ZlqXcn6IxadR/fC2FBZ4f5QjsxIoBpePGsM96FN8QJRSuallOaLbJpOnW0TQjnZdB01C1Fg== X-Received: by 2002:a17:907:2ccc:b0:741:990f:fe48 with SMTP id hg12-20020a1709072ccc00b00741990ffe48mr12292877ejc.390.1662032522852; Thu, 01 Sep 2022 04:42:02 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:02 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 06/13] hw/isa/vt82c686: Instantiate IDE function in host device Date: Thu, 1 Sep 2022 13:41:20 +0200 Message-Id: <20220901114127.53914-7-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=shentey@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+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 Acked-by: Daniel Henrique Barboza --- 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..63c1e3b8ce 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, TYPE_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 44225fbe33..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), TYPE_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 8039775f80..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), TYPE_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 Thu Sep 1 11:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672829 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=SlwUrs3C; 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 4MJKF73gQQz1yh5 for ; Thu, 1 Sep 2022 21:53:31 +1000 (AEST) Received: from localhost ([::1]:41084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTilF-0003ko-Bt for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 07:53:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaQ-0005gx-T9; Thu, 01 Sep 2022 07:42:27 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:44584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaE-0000Ea-Cc; Thu, 01 Sep 2022 07:42:18 -0400 Received: by mail-ej1-x636.google.com with SMTP id kk26so34031239ejc.11; Thu, 01 Sep 2022 04:42:05 -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=JrsI/ne9g59XtZZjXBIVmp2BYTys8MQfr3EVDlgHowE=; b=SlwUrs3C2zc73Bdrq0Xnf7bvB3L/WMsUYGtqZiq6z7tam3PVRr5274CGhH5EqEXk+7 e3+T13FxAtPaGWQ3a/o5QugFvQmPDJIVF1SwBXItBcws5dtQtFLfXNd3S9smdB1tBDCg MkxANfxUIX2xAgV8U7tQX0hUD72YEiU6fyuMeFTuxs6ojVYXof9+9qEbNpnlVw6UDHT2 hHF9AtTqL3f3P7MTkI+rX1CPE05VeKDBHC0S5B+Bo7MdL2VCFZkRMANPeVBq3+x5eScV p7KEDtWs0Q66Xj/1is/lvpCnwwWHcb/N5/Ct91l2sCT/RCF06yEB9zukAoSDd5/4cPiX TeVA== 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=JrsI/ne9g59XtZZjXBIVmp2BYTys8MQfr3EVDlgHowE=; b=clMTqiq//qOz9nqakzIY+IyNRx2IKSVNx3+GHjee2KfBLNQjKjamzIkVKl2+rxnoy4 tDumlpWSwdlCVWHVL70lRw2ctYay/dzuN/kr0SnYrsYs4mVy67ej20B0rOAIKe/eZnSP xzDAbgWoiwZEqOhuF4gtxUKlpW4slZnBsa7fw7ow7FV6wyD7NRt3Uycc5OSS4YCJ3FkO V9q/n/S6vMIgtc8IOg03qwZRDZYQUMYbBhrgeSkfseyxzezL2osZ6GfcutFJmK+dvt1K KLTX7JcYNklROVfLbBysSiPOqKdFc0ie5VAv5abH8Ws9KymNSB6by/7cPRIJamv0FNPF CY8Q== X-Gm-Message-State: ACgBeo1arOJgW2WCCG5ZbPUiKfesHhG0kdEymk0JC0NioBghhtdv3kSu dQpUoKRKWHGKYlCan2MzTajxyuVGp/k= X-Google-Smtp-Source: AA6agR52ODAk6m2govsXpT/yoB/6UmFivJWfKT7MhVJiSfVqrDNeYMyESVfIeqD04ZM4j72IptkXhw== X-Received: by 2002:a17:907:60c7:b0:731:4b42:4e3e with SMTP id hv7-20020a17090760c700b007314b424e3emr23459351ejc.236.1662032524089; Thu, 01 Sep 2022 04:42:04 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:03 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 07/13] hw/isa/vt82c686: Introduce TYPE_VT82C686B_USB_UHCI define Date: Thu, 1 Sep 2022 13:41:21 +0200 Message-Id: <20220901114127.53914-8-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=shentey@gmail.com; helo=mail-ej1-x636.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" Suggested-by: BALATON Zoltan Signed-off-by: Bernhard Beschow Acked-by: Daniel Henrique Barboza --- hw/mips/fuloong2e.c | 4 ++-- hw/ppc/pegasos2.c | 4 ++-- hw/usb/vt82c686-uhci-pci.c | 4 ++-- include/hw/isa/vt82c686.h | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 32605901e7..6b7370f2aa 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -208,8 +208,8 @@ 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"); + pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), TYPE_VT82C686B_USB_UHCI); + pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), TYPE_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..70776558c9 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -169,8 +169,8 @@ static void pegasos2_init(MachineState *machine) 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"); + pci_create_simple(pci_bus, PCI_DEVFN(12, 2), TYPE_VT82C686B_USB_UHCI); + pci_create_simple(pci_bus, PCI_DEVFN(12, 3), TYPE_VT82C686B_USB_UHCI); /* VT8231 function 4: Power Management Controller */ dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 4), TYPE_VT8231_PM); diff --git a/hw/usb/vt82c686-uhci-pci.c b/hw/usb/vt82c686-uhci-pci.c index 0bf2b72ff0..46a901f56f 100644 --- a/hw/usb/vt82c686-uhci-pci.c +++ b/hw/usb/vt82c686-uhci-pci.c @@ -31,7 +31,7 @@ static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp) static UHCIInfo uhci_info[] = { { - .name = "vt82c686b-usb-uhci", + .name = TYPE_VT82C686B_USB_UHCI, .vendor_id = PCI_VENDOR_ID_VIA, .device_id = PCI_DEVICE_ID_VIA_UHCI, .revision = 0x01, @@ -45,7 +45,7 @@ static UHCIInfo uhci_info[] = { static const TypeInfo vt82c686b_usb_uhci_type_info = { .parent = TYPE_UHCI, - .name = "vt82c686b-usb-uhci", + .name = TYPE_VT82C686B_USB_UHCI, .class_init = uhci_data_class_init, .class_data = uhci_info, }; diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index 87aca3e5bb..e6f6dd4d43 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -5,6 +5,7 @@ #define TYPE_VT82C686B_ISA "vt82c686b-isa" #define TYPE_VT82C686B_PM "vt82c686b-pm" +#define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci" #define TYPE_VT8231_ISA "vt8231-isa" #define TYPE_VT8231_PM "vt8231-pm" #define TYPE_VIA_AC97 "via-ac97" From patchwork Thu Sep 1 11:41:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672821 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=fQK46l2h; 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 4MJK6T5dMgz1ygc for ; Thu, 1 Sep 2022 21:47:45 +1000 (AEST) Received: from localhost ([::1]:55360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTiff-0007PN-Dt for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 07:47:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaS-0005h5-9z; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:42627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaI-0000Ej-DP; Thu, 01 Sep 2022 07:42:19 -0400 Received: by mail-ed1-x532.google.com with SMTP id b44so22157819edf.9; Thu, 01 Sep 2022 04:42:06 -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=RWj9GRHrzzr15/ZkR3tiTCwed+rhxbgqjltEgakH7eA=; b=fQK46l2htxKZvYco8quosSuVPJHQXiz5L+P4M+oUcyIV9AL/at7g5xc1Vbb32xbFmv dVq/wLP6tvWbRYvzdXFlUg/qSZGJIDR0VSBDmJKyaQg7x3RRB8ey7vjGgWIaLuPAXgk6 NJ2VT5oDil9pMuzGiu98zgsNoDhCCm45uoyxBYT9HLN/GelBotU90/XvGZvmMe2+PWyH gj6d28V923rbmZQ188c73x4iPI8BLj/gXO7N1N4/Eet+I44U3KNvDWNs+seZbPqFdlR1 vAoIImvegwYFjl2TafHPdwdfRd8ek/mZ/StvwJdIes5w9voo/lHib9DV8lXZAM54oomp dtsA== 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=RWj9GRHrzzr15/ZkR3tiTCwed+rhxbgqjltEgakH7eA=; b=HTiH2QNhX5oaNPiaA+Noufh9X+eS9UbBPJJWKUc6jWib4Ps1dyyD+9mQ0C3Z3Frhrk uJRHbVr/nWYtOW6lmH910g60fAeNMkfEsdazOi52ZubiCTQWQ7tfCvYfgyFdhFXysbSG Ow6DDvkgRznyUkurOGVagUDgei1uiC97TKkUXdvk1+FLFPesqx4SSKssRZ9TngKm6mqK AHZ9+UqvU/m8XiFG1tTL5pahZpqtVMKhLQfB0h5vUMjzcSgpVv9/3WRvZ9KK/+6NOUmF kf5qeuzoVLWzz61Xksh3qvzzerEwGCviR6x0kEyCO9Hzaa1+YHR3L8vLFQ937mgxy0oZ RQrQ== X-Gm-Message-State: ACgBeo2P8pt4Sln2jcTlYzzcpsiPOGAJcTevwplJOyKcKh5/ZwnZU+AW EBaeQYHs19mgUNrTvBaxj7Q25nr1rgU= X-Google-Smtp-Source: AA6agR5T6cvC+pJXX1YDHni6N2UrRX/Hb81NVPUS2rxo11za+nTjf3IF92NJ0zhSWl4Ww6C6kTTcSQ== X-Received: by 2002:a05:6402:2684:b0:448:6a69:4b59 with SMTP id w4-20020a056402268400b004486a694b59mr16060987edd.390.1662032524965; Thu, 01 Sep 2022 04:42:04 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:04 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 08/13] hw/isa/vt82c686: Instantiate USB functions in host device Date: Thu, 1 Sep 2022 13:41:22 +0200 Message-Id: <20220901114127.53914-9-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=shentey@gmail.com; helo=mail-ed1-x532.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 Acked-by: Daniel Henrique Barboza --- 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 63c1e3b8ce..f05fd9948a 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, TYPE_VIA_IDE); + object_initialize_child(obj, "uhci1", &s->uhci[0], TYPE_VT82C686B_USB_UHCI); + object_initialize_child(obj, "uhci2", &s->uhci[1], TYPE_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 6b7370f2aa..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), TYPE_VT82C686B_USB_UHCI); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), TYPE_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 70776558c9..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), TYPE_VT82C686B_USB_UHCI); - pci_create_simple(pci_bus, PCI_DEVFN(12, 3), TYPE_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 Thu Sep 1 11:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672835 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=C9KrqMOH; 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 4MJKRX1TLgz1yhP for ; Thu, 1 Sep 2022 22:02:32 +1000 (AEST) Received: from localhost ([::1]:49424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTitx-0002wG-Ui for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 08:02:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaS-0005h4-3r; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:34652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaI-0000F9-DO; Thu, 01 Sep 2022 07:42:19 -0400 Received: by mail-ed1-x536.google.com with SMTP id z2so22204424edc.1; Thu, 01 Sep 2022 04:42:07 -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=Jlk6oFJAY+l1qPvv1++yQk3ViQamm2gz/v6Qx4/s2dE=; b=C9KrqMOHd6yQ/681FA4yf7A6WJ5fPS00SASNlBIlXCEQAKWhbxMYq1BNsQ26J3CrPJ DtS48RZhZriQyFopZrpGqp2a8rNZPmQn3AMo+ZxJ4CLE9MEX34LQy4VoybTM1zOCV6AY 6xpc4bXr8XbqDYzMag/y1ixUGTLbjquOP4+1vj0hLSn2SBvYmWm/63QRl8Peq5Af/Mh0 iziFoX8yCj7/SFSttboKhftlFM/NfZCCBMsICkb4ZRoCymegAlgwZpRBLPUoFn6X9dKL f7LAW94ab988drCjIUmkRDq+t6WexD/RRemhCZd6d8KC124aGEDr72SapbZPYIEdzN8m s/Pw== 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=Jlk6oFJAY+l1qPvv1++yQk3ViQamm2gz/v6Qx4/s2dE=; b=7qcc7topd2UmlmnQ56MTgkMSY4/BjbhwIDEOSdcd1RBKaFADM/ohqgaY0CSIsVW8ar 0diDsaMKwSmFq8Au1wtckz0BZ3C6ga8lK76IYrFOG+JWXdbswQk1kBebZN9hpackAamp ZcJyvG5FGRQ3tJ1M+VYnFlwgqACCmIFRMUrRnHoTHUN6G8B/vVL418mNXk8th7aJieb8 SVcrNUHhuU08v3m7LtJEMA2sH2u5Pv6snVmoNRn2i88QOBFmw3azeslqiC3PlB+1/Nmg 59tyH5d0m4WBM6PFnc13aTtkPmVOurmdl5NLApUvPVfsZVeVJHuL+ALa4tkg2nomjTGh pclQ== X-Gm-Message-State: ACgBeo3TxPNRm7bCPcWaIx+a9qiqb6KPWckDULmCXUsQcMufU3BVxVy8 dC3mmkv9jmRAX7BVu2A+pTTxbgKjCIA= X-Google-Smtp-Source: AA6agR7n7h1daxfK+MPXF28eoK2fdqRhgdN76Q+PMCis9t3wsLAl+Yr7VoUtdhm6/+O3l714KOq3ig== X-Received: by 2002:aa7:d58b:0:b0:448:e63d:ee5e with SMTP id r11-20020aa7d58b000000b00448e63dee5emr8738976edq.236.1662032526210; Thu, 01 Sep 2022 04:42:06 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:05 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 09/13] hw/isa/vt82c686: Instantiate PM function in host device Date: Thu, 1 Sep 2022 13:41:23 +0200 Message-Id: <20220901114127.53914-10-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-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+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 Acked-by: Daniel Henrique Barboza --- hw/isa/vt82c686.c | 13 +++++++++++++ hw/mips/fuloong2e.c | 2 +- hw/ppc/pegasos2.c | 3 +-- include/hw/isa/vt82c686.h | 2 -- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index f05fd9948a..d048607079 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -250,6 +250,8 @@ static const ViaPMInitInfo vt82c686b_pm_init_info = { .device_id = PCI_DEVICE_ID_VIA_82C686B_PM, }; +#define TYPE_VT82C686B_PM "vt82c686b-pm" + static const TypeInfo vt82c686b_pm_info = { .name = TYPE_VT82C686B_PM, .parent = TYPE_VIA_PM, @@ -261,6 +263,8 @@ static const ViaPMInitInfo vt8231_pm_init_info = { .device_id = PCI_DEVICE_ID_VIA_8231_PM, }; +#define TYPE_VT8231_PM "vt8231-pm" + static const TypeInfo vt8231_pm_info = { .name = TYPE_VT8231_PM, .parent = TYPE_VIA_PM, @@ -548,6 +552,7 @@ struct ViaISAState { ViaSuperIOState via_sio; PCIIDEState ide; UHCIState uhci[2]; + ViaPMState pm; }; static const VMStateDescription vmstate_via = { @@ -641,6 +646,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 +694,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 +758,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 e6f6dd4d43..eaa07881c5 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -4,10 +4,8 @@ #include "hw/pci/pci.h" #define TYPE_VT82C686B_ISA "vt82c686b-isa" -#define TYPE_VT82C686B_PM "vt82c686b-pm" #define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci" #define TYPE_VT8231_ISA "vt8231-isa" -#define TYPE_VT8231_PM "vt8231-pm" #define TYPE_VIA_AC97 "via-ac97" #define TYPE_VIA_IDE "via-ide" #define TYPE_VIA_MC97 "via-mc97" From patchwork Thu Sep 1 11:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672845 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=iNVcveIk; 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 4MJKYl5x5Dz1yh5 for ; Thu, 1 Sep 2022 22:07:55 +1000 (AEST) Received: from localhost ([::1]:50790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTizB-0007kU-Lu for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 08:07:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaS-0005h6-Vf; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:46830) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaJ-0000FI-2U; Thu, 01 Sep 2022 07:42:20 -0400 Received: by mail-ej1-x62c.google.com with SMTP id bj12so34029451ejb.13; Thu, 01 Sep 2022 04:42:08 -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=yR1WuULr3CbcvDGW25RvKawDTHX0S07ta2xKevtnT3M=; b=iNVcveIkW8CgpZPcNuu6lxjXoDNUoaQY94gUJJAhV5Lao6EnMtk8CSdg212mKJDXJe m9+XmNiPMlzkawh4xIg91UDsDla81RCf68xsBUxPwZ5UvEx3/yu+9/ms9Saed3tVBTdl dx9oZBwYaOAdFIq/ZrPlC868JNbLx4fIa25CQrcc336KF3qYR7hjifiwNJ50f43Zu9R4 1S9XvZjmbF1o460oSY/Eil9G2F/JCmTEpsQDpfRws3hYs7bqUohzAU/+FqNqEZL7F8hY OhpSaM8/jEazn6c4hb8WiNdROKzGjXzcG3+a/sSWNLT4Ct0c1hStm7/7jyye6dMuLlVz teWQ== 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=yR1WuULr3CbcvDGW25RvKawDTHX0S07ta2xKevtnT3M=; b=1TPDO88YlX7ctQBxbPQwAS21dgnlk6iUDNgwdBEULPV79u81hHDidSEfPKDkUFMlnw ZFqN11BPulBwkfJCKH2bzxGB59QmnAlFdwdDRnD+IFr41Cw3e5KD0q1YkTuBHgI9cVn9 CdWRz2iYn+wuHJoS3fs+H10RTbY5BFNlYNUYYJ81fP3qQOTz7sbbhnxhOlvBeLPVbMY5 Ro8Q0fq7k8/lvISAkqnok9eP//WpcHhY/qf7/VY47GyO1Iwm5jEEcvtLShSa5Tio4Faf KpJylaCV524Ix+UWFD/YbGXNTHQF9HooZbOxBcGa5VohOqN1Ir3mWfJcBj2JQpAeFhuo wMOg== X-Gm-Message-State: ACgBeo3gNRc2kI+aNJDUPBx1y8cUHFNRrxvBS+x1HTOgeruHKAzV3Bq/ gd9/i1YYafQGON4cHNLTJDK5L/BwE88= X-Google-Smtp-Source: AA6agR5J1WFhcUJ8h0eA+427AQIRO0ClFugSUkrzCBvX0qIIzn2o1QGFEksP55l5vsVIpVPaX1GtiA== X-Received: by 2002:a17:907:75db:b0:741:4155:b52f with SMTP id jl27-20020a17090775db00b007414155b52fmr17441902ejc.638.1662032527172; Thu, 01 Sep 2022 04:42: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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:06 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 10/13] hw/isa/vt82c686: Instantiate AC97 and MC97 functions in host device Date: Thu, 1 Sep 2022 13:41:24 +0200 Message-Id: <20220901114127.53914-11-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-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+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 Acked-by: Daniel Henrique Barboza --- 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 d048607079..91686e9570 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -553,6 +553,8 @@ struct ViaISAState { PCIIDEState ide; UHCIState uhci[2]; ViaPMState pm; + PCIDevice ac97; + PCIDevice mc97; }; static const VMStateDescription vmstate_via = { @@ -572,6 +574,8 @@ static void via_isa_init(Object *obj) object_initialize_child(obj, "ide", &s->ide, TYPE_VIA_IDE); object_initialize_child(obj, "uhci1", &s->uhci[0], TYPE_VT82C686B_USB_UHCI); object_initialize_child(obj, "uhci2", &s->uhci[1], TYPE_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 = { @@ -652,6 +656,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: MC97 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 Thu Sep 1 11:41:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672847 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=cUznDKbz; 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 4MJKZ76xlrz1yh5 for ; Thu, 1 Sep 2022 22:08:15 +1000 (AEST) Received: from localhost ([::1]:50758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTizT-00006U-Pl for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 08:08:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaS-0005h7-Vq; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:41671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaJ-0000Fb-3R; Thu, 01 Sep 2022 07:42:20 -0400 Received: by mail-ej1-x636.google.com with SMTP id se27so26337976ejb.8; Thu, 01 Sep 2022 04:42: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=40swXTyiHxDICK6kn8HQbJdfXNShBC0eprLZoGOzeQU=; b=cUznDKbzAB9PaAfIFm40euE3X1BuRrxx+7dGJNilbtV1enzyTg0vZ4pMQfl1k2HimJ Pxod2VqPqImKPm5blDj1jdWMYfVGvWeqqs+X4PWfxVBEEhL6WvpTVMf877o1xMue5ZuZ XeYi550zIcw0+Rn/RUvPcJzmeEbG1uaa/Kk0nJ+0dcW1jrpa6Uma7/EKToex1nayrtmA 2QX0KTrZ7aCYjMeN5M9OKj/TKKXwjFeopx2iVWCi42W79koDxE6VThe5QmT6PPkRuwlE kKqitplRS88pdOQSRtt57xc+JliNqFdPCqBKzILazY88WLUJcWuMPy5UvMyLnxT5JxcB 0c8w== 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=40swXTyiHxDICK6kn8HQbJdfXNShBC0eprLZoGOzeQU=; b=VaWGOyjvVHZbbttIWxMEhe7WqVycXE2MxfhmSnF5jm7g21MGWS8azwEX3Kl18jbhct Rl9+5pfFEQ+mLG2DKaofqflAzeZgJb/o+Vsjq3KKJnMJS+54pxyoOHhYBcVo+X8sI1+K ihLWZi4Mj7F6sg+UeoFzANTB1yTevSMI7w45cEZsYySxFD7R1MfG2dLIqLYwegCTtkzn 2O3mn3MfbVRVIgCy8A65eAUxu5zsj8CjaBneyvEJJ17jC4qTm7ExsoIfrtTs7vFoegvq CXNl7ZNhXL4VUkWfjCI3amYdGhPGa/PwHnIh9X9Y2owEjhi9ABR7LGvK6CRUNKifOkxZ CPzQ== X-Gm-Message-State: ACgBeo2L3fk+UvbldW+QjMxo91KAJh6DB0kc+D+VVK05Va6akIGjvcCc 1PQ9iuJ8+NvjXdm2srzudj32xhaAWzg= X-Google-Smtp-Source: AA6agR4KX8BQYoh79EOsaWn2FjTXrMRMEp3Vd+iEDpCgxTqqavMzfrekOA4m07yQy5EvLkvM9z01Nw== X-Received: by 2002:a17:907:7fa5:b0:730:5d54:4c24 with SMTP id qk37-20020a1709077fa500b007305d544c24mr23646440ejc.641.1662032528073; Thu, 01 Sep 2022 04:42:08 -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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:07 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 11/13] hw/mips/fuloong2e: Inline vt82c686b_southbridge_init() and remove it Date: Thu, 1 Sep 2022 13:41:25 +0200 Message-Id: <20220901114127.53914-12-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=shentey@gmail.com; helo=mail-ej1-x636.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 previous patches moved most of this function into the via-isa device model such that it has become fairly trivial. So inline it for simplicity. Suggested-by: BALATON Zoltan Signed-off-by: Bernhard Beschow --- hw/mips/fuloong2e.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 2d8723ab74..3c46215616 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -196,22 +196,6 @@ 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, *via; - - via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), true, - TYPE_VT82C686B_ISA); - qdev_connect_gpio_out(DEVICE(via), 0, intc); - - dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); - pci_ide_create_devs(dev); - - dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "pm")); - *i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); -} - /* Network support */ static void network_init(PCIBus *pci_bus) { @@ -308,8 +292,16 @@ static void mips_fuloong2e_init(MachineState *machine) pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); /* South bridge -> IP5 */ - vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5], - &smbus); + pci_dev = pci_create_simple_multifunction(pci_bus, + PCI_DEVFN(FULOONG2E_VIA_SLOT, 0), + true, TYPE_VT82C686B_ISA); + qdev_connect_gpio_out(DEVICE(pci_dev), 0, env->irq[5]); + + dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide")); + pci_ide_create_devs(PCI_DEVICE(dev)); + + dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "pm")); + smbus = I2C_BUS(qdev_get_child_bus(dev, "i2c")); /* GPU */ if (vga_interface_type != VGA_NONE) { From patchwork Thu Sep 1 11:41:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672831 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=am6jwHFe; 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 4MJKJP6xHqz1ygc for ; Thu, 1 Sep 2022 21:56:20 +1000 (AEST) Received: from localhost ([::1]:38506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTinx-0005M9-2X for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 07:56:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaT-0005h8-77; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:44576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaJ-0000Ff-O4; Thu, 01 Sep 2022 07:42:20 -0400 Received: by mail-ej1-x62c.google.com with SMTP id kk26so34031683ejc.11; Thu, 01 Sep 2022 04:42:10 -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=gLfUGnAVToF9YqO6CURY5qXIngPZ9Wpmw00YUrrVUss=; b=am6jwHFe5kH8Pf0UMrqmNfQhYoIEzmwI60mq3pkr/PC/WyWcXJUmkuusBRI1nsjOFH 2VZyUlFm7uOK57Cd6IxOPw7QOkWNvT/SAkl5oYH5hfgkRguYC6AnalcEx4hVxZuq9/JS 0XPcUtZtvWmCyuO2MNTvRqvMnMEiZO+SYkuxXEtzDyGAh5phP2KKksoZeIphMD7bBkw6 0wwE+2fVLkprJhakl3pZ0UldRrUhrejzEIGQNNnEm66Oturxp003Vk6Oa8dHPa9lGYAB Ir+H6Z8G6RHCmNEjQ0Y242SMKZTOLauSxrB6uxhL+otIAliBWaQXQ+MvGSaCFScN3VyU YHvw== 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=gLfUGnAVToF9YqO6CURY5qXIngPZ9Wpmw00YUrrVUss=; b=Kg+DK5E1FL/I5POei4MwGJHjXrM37ro8MWI3uWdbX4hF7VyXTzqJFvB+K1ai6MVSHU EPpCPHYvl9EH+tZlVf8sbvn3JpHsZozqUb7LIlQa8e+BoApXS31KbRmYNKdfH/+ugx28 DQNs9IKGreBU/SM+hnswyZSHTX+Fl92k25Ai79DzwLJbnUrbPk3KZLpq/e4VDynqrpUX m14VSGRdMOR/+vvBRiMcSpy30zqESIwSYvhiAQrXpBhr6+OD8Yx0nq6VXijsALB36ipj ORNxjkR25469tSE1LFJNqL11Sg7ScX3nsPFEzHscPhagSV+Kuz2IGm4RuIKHWZt2JTxS Af1w== X-Gm-Message-State: ACgBeo1xbNpAa7I7ch+jki4cfwA+wt5ansmLuQgJp7xk9uiPp8or64GI Oh5CO/gwhbhlpNEpN3WTbWsbfstpfzg= X-Google-Smtp-Source: AA6agR4gBW4E3FtBYyh6LB8dS/u5ueC9EnT4YZU0nYVmFDwjSZHHPgF9Q/t8HuGiCZjyTS30cUixpQ== X-Received: by 2002:a17:907:75e8:b0:730:ccd3:2683 with SMTP id jz8-20020a17090775e800b00730ccd32683mr23417025ejc.329.1662032529151; Thu, 01 Sep 2022 04:42: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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:08 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 12/13] hw/isa/vt82c686: Embed RTCState in host device Date: Thu, 1 Sep 2022 13:41:26 +0200 Message-Id: <20220901114127.53914-13-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-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+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 91686e9570..48cd4d0036 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -550,6 +550,7 @@ struct ViaISAState { qemu_irq cpu_intr; qemu_irq *isa_irqs; ViaSuperIOState via_sio; + RTCState rtc; PCIIDEState ide; UHCIState uhci[2]; ViaPMState pm; @@ -571,6 +572,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, TYPE_VIA_IDE); object_initialize_child(obj, "uhci1", &s->uhci[0], TYPE_VT82C686B_USB_UHCI); object_initialize_child(obj, "uhci2", &s->uhci[1], TYPE_VT82C686B_USB_UHCI); @@ -624,7 +626,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 Thu Sep 1 11:41:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672860 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=l+PEsNAV; 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 4MJKhT2BwKz1yn9 for ; Thu, 1 Sep 2022 22:13:45 +1000 (AEST) Received: from localhost ([::1]:48976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTj4p-0007uC-50 for incoming@patchwork.ozlabs.org; Thu, 01 Sep 2022 08:13:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTiaT-0005h9-Ed; Thu, 01 Sep 2022 07:42:28 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:45732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTiaK-0000Fq-U9; Thu, 01 Sep 2022 07:42:21 -0400 Received: by mail-ej1-x631.google.com with SMTP id lx1so34031957ejb.12; Thu, 01 Sep 2022 04:42: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=rnyYUAu+pe0wZdjjqbLNbpR1Uc3DHa39ZGgcpBfmRM4=; b=l+PEsNAVV21HoubDpjgt1UV8McKx6tOrCUVQzaoyvb6vaG91LVcdCBwY6Wg+TIliCK 4R130Fn8wnleTOZgyKkQpC4iLHD46bvW1piXRMIujn2y7sg1WswSKjZzAv3YDR0u9Tjf AAPScqjnIKIExOt9mc5LiZYEcA6XZlTYvcToH4sZJNpHeHeaLKxLKcfFZIK9JCjyp4Le 8Flko+C5o5LM1xh2V1hKiaWTloNl/HIK5wlKPM84YuNYeOLfWYB+S6g8wd5yhCTqvN3B i8CLqChp9RPArFynNh4kxIx4DG93++LqqvaSOVr+P6GJtiAqL/mAug/qwXaTWkNeOEa0 evuw== 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=rnyYUAu+pe0wZdjjqbLNbpR1Uc3DHa39ZGgcpBfmRM4=; b=j6Qy5EiiMBj6JucteuEz7Jx0DUBnnxp5Gmu1OwkAGkdCXuIj4axYlQ74EdaEnMn4oN BNvT/OJtt/PeK0EAPYrDBLAwz4HLKPOhybRSPehbGc9k9RMQElGRbs/JEBg2/dkxeXJB cZXdOgAGAMgcmisbPv65hUnBwJWQCsE0k9VhlekPpaeKeKz1teKMJBAEoqopLjTV1BxT +QMEd9d9gf1jsXX3V9mdqAke7sxmo3c2BA01KpWTWxFGSvAbC5DKK5/IEjzdE7XkIaWb QxInN0oLCi85/AJIVV4P7o9W3uir9aODWl57hXaVHrBRYN2tQ8rkfCLiQfrrKgYvoOF2 zJNg== X-Gm-Message-State: ACgBeo1zkt6k4payq64ZCtfmQvcyOmdy3GMf+IvC8PpVtnP6WkxYePjT iMMoL+h9LuH2/7nZeU4jGryvcOGp68M= X-Google-Smtp-Source: AA6agR5K7mifTCjYvWDAFnSJu4AAEhIkWAtyCRCup0lbG/5cYOcH91Scu1UdX84o6rsvsfP9zQ0QtA== X-Received: by 2002:a17:906:7315:b0:741:5b1b:920d with SMTP id di21-20020a170906731500b007415b1b920dmr15785408ejc.484.1662032530056; Thu, 01 Sep 2022 04:42: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 f12-20020a17090660cc00b0073ddb2eff27sm8387455ejk.167.2022.09.01.04.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 04:42:09 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, John Snow , Huacai Chen , Jiaxun Yang , Gerd Hoffmann , qemu-block@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Bernhard Beschow Subject: [PATCH v5 13/13] hw/isa/vt82c686: Create rtc-time alias in boards instead Date: Thu, 1 Sep 2022 13:41:27 +0200 Message-Id: <20220901114127.53914-14-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901114127.53914-1-shentey@gmail.com> References: <20220901114127.53914-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+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 Acked-by: Daniel Henrique Barboza --- 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 48cd4d0036..3f9bd0c04d 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -632,8 +632,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 3c46215616..b478483706 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -295,6 +295,10 @@ static void mips_fuloong2e_init(MachineState *machine) pci_dev = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(FULOONG2E_VIA_SLOT, 0), true, TYPE_VT82C686B_ISA); + object_property_add_alias(OBJECT(machine), "rtc-time", + object_resolve_path_component(OBJECT(pci_dev), + "rtc"), + "date"); qdev_connect_gpio_out(DEVICE(pci_dev), 0, env->irq[5]); dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide")); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 09fdb7557f..49b753c7cc 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(OBJECT(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));