From nobody Mon Feb 9 11:32:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1661886735; cv=none; d=zohomail.com; s=zohoarc; b=aXxjHk+JdQGFXw828mLkuLGf6nOiWu+VGrqbMIsWXSW1jl6wDUmweoHNaOeG6W3u6ND/mdkgNmG/+LWh7m/uY/4iDrVGfbcIY2W5+Cg5NE+O90zu/xM9mxPgqxMA3RXBmlFe1UlqwxohIGVFMoq95jURmWUBIDLvKo2ybW8DuRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661886735; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8L5YJCGnOGv/sZ/kFDTIW1ESegeAponyNXEmVyZVv9M=; b=PSWG3LPWIpXqEwoiPOMgXdI3M/tfcmbwh9vnpVfMhb4BTKWj/FVpBgkgZjyo1q68WzLerezsCiXZL+/pMIOHEn2ks6hVFUS9UrDtibo3WYhwcUmawVHqhyLEsYpkw/O/aMV2vvacTcRRP/5OBQX76Ho1Qz2AZys0+ycioBxqsss= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166188673560023.942969891405596; Tue, 30 Aug 2022 12:12:15 -0700 (PDT) Received: from localhost ([::1]:43296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6ej-0003v4-TQ for importer@patchew.org; Tue, 30 Aug 2022 15:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6UA-00033n-95; Tue, 30 Aug 2022 15:01:18 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT6U8-0008Qs-EF; Tue, 30 Aug 2022 15:01:17 -0400 Received: by mail-wr1-x42f.google.com with SMTP id bu22so15105669wrb.3; Tue, 30 Aug 2022 12:01:15 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id j18-20020adfea52000000b002206203ed3dsm9821285wrn.29.2022.08.30.12.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 12:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=8L5YJCGnOGv/sZ/kFDTIW1ESegeAponyNXEmVyZVv9M=; b=ScUkSv4ZGviWrDTkebkyxHDLl2pHRAHsg8MEVbO9zrhmi/ZtmccAvVHKFsbAlYiDaY jAzNLsGgC5eLy/De+V8UXvszBLlmtEF40/tCYu3lXfxJwTLECZ0pkc7px3zvjZQjb06A SefLkPhTY/1Kzy4FtVQVlemZlMBcJQYRuQnq9l4qhXexXqLpWoFdxlRp2Gdt+VZdvBY6 5bPhdiin1d2DJgbjDgfqHzQIAya/izob3jJLk0wPaMXlRvh+L/M+QgWlS2Pih+Fo/s9B /MfOw5BlhfesKMe6eYvMNK/ALelzRZNxJ/HH6ePfllR9l7jrS1NuAz1tiE9jRfEIAANv sMxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=8L5YJCGnOGv/sZ/kFDTIW1ESegeAponyNXEmVyZVv9M=; b=JU/mN/ud9hrxW0jSGc2b8RtgEe7fzykG1zA4Y2KJKxsPX2hbqC16Or73SbH30QSYpD 2GHOrl3eti7915h+tR0diaPg/4d6QNMcvPGR+2NU0RTetA5hixMDoXNXg/tp5uLP80cn XRhO5IMg/M9cTq35nKg9c64oLIV0aJ042qwZyNjD7/EaK8bEe61M8XBndf1ykveWYHx4 B/vx/bORwnK7mrJhuXlZehtATeIlUudx6gkMlPc3zDopyfr3VPylGPCUPy0nBW77TF+F piHtmg5lCp3XVhuuKj9QJy9dHNC3oj/Woqhgd11UK+ynLXiT4paPR8sE8AJ0OsDDjkCL VZyA== X-Gm-Message-State: ACgBeo3o/szOP+Mu9CgNop/f/V1Yu0s0Tjl9/WO/G63BAnswrvgZU2L/ mnauwa/c6vzjcsh3qgq0u1YNAbM+HZI= X-Google-Smtp-Source: AA6agR7vMQDiA+7YckN5XlWvkpZ6NN8B/dF7Q5TZoSIYaj6Tq6oqeBI1jBG/kEU+4AkOgRXTVnnixg== X-Received: by 2002:a05:6000:156f:b0:225:57be:3978 with SMTP id 15-20020a056000156f00b0022557be3978mr9769261wrz.122.1661886073871; Tue, 30 Aug 2022 12:01:13 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Huacai Chen , BALATON Zoltan , Jiaxun Yang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v2 05/10] hw/isa/vt82c686: Instantiate IDE function in host device Date: Tue, 30 Aug 2022 21:00:43 +0200 Message-Id: <20220830190048.67448-6-shentey@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830190048.67448-1-shentey@gmail.com> References: <20220830190048.67448-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=shentey@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1661886736216100001 Content-Type: text/plain; charset="utf-8" The IDE function is closely tied to the ISA function (e.g. the IDE interrupt routing happens there), so it makes sense that the IDE function is instantiated within the south bridge itself. Signed-off-by: Bernhard Beschow --- configs/devices/mips64el-softmmu/default.mak | 1 - hw/isa/Kconfig | 1 + hw/isa/vt82c686.c | 17 +++++++++++++++++ hw/mips/fuloong2e.c | 8 ++++---- hw/ppc/Kconfig | 1 - hw/ppc/pegasos2.c | 9 ++++----- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/configs/devices/mips64el-softmmu/default.mak b/configs/devices= /mips64el-softmmu/default.mak index c610749ac1..d5188f7ea5 100644 --- a/configs/devices/mips64el-softmmu/default.mak +++ b/configs/devices/mips64el-softmmu/default.mak @@ -1,7 +1,6 @@ # Default configuration for mips64el-softmmu =20 include ../mips-softmmu/common.mak -CONFIG_IDE_VIA=3Dy CONFIG_FULOONG=3Dy CONFIG_LOONGSON3V=3Dy CONFIG_ATI_VGA=3Dy 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 =20 diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 37e37b3855..9d946cea54 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -17,6 +17,7 @@ #include "hw/isa/vt82c686.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/ide/pci.h" #include "hw/isa/isa.h" #include "hw/isa/superio.h" #include "hw/intc/i8259.h" @@ -544,6 +545,7 @@ struct ViaISAState { qemu_irq cpu_intr; qemu_irq *isa_irqs; ViaSuperIOState via_sio; + PCIIDEState ide; }; =20 static const VMStateDescription vmstate_via =3D { @@ -556,10 +558,18 @@ static const VMStateDescription vmstate_via =3D { } }; =20 +static void via_isa_init(Object *obj) +{ + ViaISAState *s =3D VIA_ISA(obj); + + object_initialize_child(obj, "ide", &s->ide, "via-ide"); +} + static const TypeInfo via_isa_info =3D { .name =3D TYPE_VIA_ISA, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(ViaISAState), + .instance_init =3D via_isa_init, .abstract =3D true, .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, @@ -583,6 +593,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp) { ViaISAState *s =3D VIA_ISA(d); DeviceState *dev =3D DEVICE(d); + PCIBus *pci_bus =3D 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; + } } =20 /* TYPE_VT82C686B_ISA */ diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 5ee546f5f6..32605901e7 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -199,13 +199,13 @@ static void main_cpu_reset(void *opaque) static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq= intc, I2CBus **i2c_bus) { - PCIDevice *dev; + PCIDevice *dev, *via; =20 - dev =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), t= rue, + via =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), t= rue, TYPE_VT82C686B_ISA); - qdev_connect_gpio_out(DEVICE(dev), 0, intc); + qdev_connect_gpio_out(DEVICE(via), 0, intc); =20 - dev =3D pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); + dev =3D PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); =20 pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index 400511c6b7..18565e966b 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -74,7 +74,6 @@ config PEGASOS2 bool select MV64361 select VT82C686 - select IDE_VIA select SMBUS_EEPROM select VOF # This should come with VT82C686 diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 61f4263953..8bc528a560 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -102,7 +102,7 @@ static void pegasos2_init(MachineState *machine) CPUPPCState *env; MemoryRegion *rom =3D g_new(MemoryRegion, 1); PCIBus *pci_bus; - PCIDevice *dev; + PCIDevice *dev, *via; I2CBus *i2c_bus; const char *fwname =3D machine->firmware ?: PROM_FILENAME; char *filename; @@ -160,13 +160,12 @@ static void pegasos2_init(MachineState *machine) =20 /* VIA VT8231 South Bridge (multifunction PCI device) */ /* VT8231 function 0: PCI-to-ISA Bridge */ - dev =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), tru= e, + via =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), tru= e, 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)); =20 - /* VT8231 function 1: IDE Controller */ - dev =3D pci_create_simple(pci_bus, PCI_DEVFN(12, 1), "via-ide"); + dev =3D PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); =20 /* VT8231 function 2-3: USB Ports */ --=20 2.37.2