From nobody Wed Nov 27 19:35:22 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697644886; cv=none; d=zohomail.com; s=zohoarc; b=P5z2IFfU1Qee6gwI0MMBreJ1jg0AsjPKtxvlpHgfstPkm+3NLMO2usxwbKMYlgIATPpQhMQwvUFbEOl0ZItehGnuOcHAcrFoedXb+UpqIbgHsmMqETKL9lXH+IFs8mAO8MnCn1uZxk859jtelS8Y6w3NUm8P3Cx8nIA3QPotu6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697644886; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wdW5p2c96Dn9Sqn4Mq3yZdrJbR8XrzKqICqhYWPrQfc=; b=THphTvBsv4iCuNv97BnNqYXAYEk+oDr43ojK9o2TM9jLRgHQxGmT96EWhQFqYBWpDtEl21duoETzlJ2ld/q9S+3XeIygXNp2A8WZrbEMDmZHdfDnnqBpHDDcZB6obOeQo64cppIzfa6ug6HOXkJg7BF5tP6qiq4nxUeQICC/fF0= 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 1697644886830494.4434513656022; Wed, 18 Oct 2023 09:01:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wS-0000uS-24; Wed, 18 Oct 2023 11:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vP-0006ho-Uz for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vN-0007K1-Vz for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:35 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-XvKCq_HzMQWkmTPHP8fzBg-1; Wed, 18 Oct 2023 11:57:31 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32db6a28e24so1980122f8f.0 for ; Wed, 18 Oct 2023 08:57:30 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id w8-20020a5d6808000000b0031779a6b451sm2365060wru.83.2023.10.18.08.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wdW5p2c96Dn9Sqn4Mq3yZdrJbR8XrzKqICqhYWPrQfc=; b=VP3j2Ns1dvBc81Cy2NM0KVKHH7szJ3RYF8eZoF1HT2W1yV3G/zBb3hVRS9LTqnO3M/A778 PmmbskFFmyK/Tq2Gx86z8c/nGd4KuW6FK69Dc8jv6hG7rEvmrOGogMyJHWNAbQOBq2UaWg uaDboWS6fWzWNv1vttbHRo0yxA/4b+I= X-MC-Unique: XvKCq_HzMQWkmTPHP8fzBg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644649; x=1698249449; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wdW5p2c96Dn9Sqn4Mq3yZdrJbR8XrzKqICqhYWPrQfc=; b=BKnzaClnJll/BpM7Ce7gyFexbY1S+uXQrf2ByxdAFvKaXmTdYcaCZyhq1qHaVGV8Zt dNTzTxuZ+FUfWjRv0J1Kpi51YzygRhNheP/P0rzi+PAY0FkTMCPYxaEbgArj6nEH1qrL fj41jcKNK6TZl94AYzZtz+MZsjvoKkMt9wAlHBr54UzxUfW9Sz7NNh+t30q/i2rZNXse 8PYl5k7NRfz2/VIuzHCU4Zr5oT9ptamODr+o16W/JYUAvZDBKSeG+K9GWt0wa+oZGWNy RxwZXdI3uUfOWyyRQNdBmRLdinQDgKb5C7GMKUoBvPLwI3udRE3Q9uF1l94/BaNOhaou kkTQ== X-Gm-Message-State: AOJu0YyVDW7ce6j/cPxgReY5ghhNdCz+Vu7/OEe2iOVt/AIXVskSA+KK KXXX9FaYoqQzdsAKRHrVBPjhsTgOmmR21AJIum+7GOYCHutaujbgtkkh762GXGg9JE4YE1IkSHq 4xUqSwwPF14hkdPTy5Xr6pIzyEMhE3PyATZOK6NAhiRiuhc2YSVEyepvGI4T/QCk5E/abtZ8= X-Received: by 2002:a5d:470f:0:b0:32d:888a:c2cf with SMTP id y15-20020a5d470f000000b0032d888ac2cfmr4088418wrq.7.1697644648960; Wed, 18 Oct 2023 08:57:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDvCZXuWhxewbG5kW/FjX6vfgy+wozFSFLc+mHqWHJLHpBLMKluHvUkP4qJ1MoptiwcDD5fQ== X-Received: by 2002:a5d:470f:0:b0:32d:888a:c2cf with SMTP id y15-20020a5d470f000000b0032d888ac2cfmr4088402wrq.7.1697644648608; Wed, 18 Oct 2023 08:57:28 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , =?utf-8?B?SGVydsOp?= Poussineau , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 53/83] hw/isa/piix3: Create IDE controller in host device Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697644888881100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow The IDE controller is an integral part of PIIX3 (function 1). So create it = as part of the south bridge. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-12-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 2 ++ hw/i386/pc_piix.c | 13 ++++++------- hw/isa/piix3.c | 9 +++++++++ hw/i386/Kconfig | 1 - hw/isa/Kconfig | 1 + 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index b07ff6bb26..1daeff397c 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -13,6 +13,7 @@ #define HW_SOUTHBRIDGE_PIIX_H =20 #include "hw/pci/pci_device.h" +#include "hw/ide/pci.h" #include "hw/rtc/mc146818rtc.h" =20 /* PIRQRC[A:D]: PIRQx Route Control Registers */ @@ -52,6 +53,7 @@ struct PIIXState { int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; =20 MC146818RtcState rtc; + PCIIDEState ide; =20 /* Reset Control Register contents */ uint8_t rcr; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 5988656279..c98a997482 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -43,7 +43,6 @@ #include "net/net.h" #include "hw/ide/isa.h" #include "hw/ide/pci.h" -#include "hw/ide/piix.h" #include "hw/irq.h" #include "sysemu/kvm.h" #include "hw/i386/kvm/clock.h" @@ -290,6 +289,10 @@ static void pc_init1(MachineState *machine, isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0")); rtc_state =3D ISA_DEVICE(object_resolve_path_component(OBJECT(pci_= dev), "rtc")); + dev =3D DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide= ")); + pci_ide_create_devs(PCI_DEVICE(dev)); + idebus[0] =3D qdev_get_child_bus(dev, "ide.0"); + idebus[1] =3D qdev_get_child_bus(dev, "ide.1"); } else { isa_bus =3D isa_bus_new(NULL, system_memory, system_io, &error_abort); @@ -301,6 +304,8 @@ static void pc_init1(MachineState *machine, =20 i8257_dma_init(isa_bus, 0); pcms->hpet_enabled =3D false; + idebus[0] =3D NULL; + idebus[1] =3D NULL; } =20 if (x86ms->pic =3D=3D ON_OFF_AUTO_ON || x86ms->pic =3D=3D ON_OFF_AUTO_= AUTO) { @@ -329,12 +334,6 @@ static void pc_init1(MachineState *machine, pc_nic_init(pcmc, isa_bus, pci_bus); =20 if (pcmc->pci_enabled) { - PCIDevice *dev; - - dev =3D pci_create_simple(pci_bus, piix3_devfn + 1, TYPE_PIIX3_IDE= ); - pci_ide_create_devs(dev); - idebus[0] =3D qdev_get_child_bus(&dev->qdev, "ide.0"); - idebus[1] =3D qdev_get_child_bus(&dev->qdev, "ide.1"); pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); } #ifdef CONFIG_IDE_ISA diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 11d72ca2bb..3f1dabade0 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -29,6 +29,7 @@ #include "hw/southbridge/piix.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/ide/piix.h" #include "hw/isa/isa.h" #include "sysemu/runstate.h" #include "migration/vmstate.h" @@ -265,6 +266,7 @@ static const MemoryRegionOps rcr_ops =3D { static void pci_piix3_realize(PCIDevice *dev, Error **errp) { PIIX3State *d =3D PIIX3_PCI_DEVICE(dev); + PCIBus *pci_bus =3D pci_get_bus(dev); ISABus *isa_bus; uint32_t irq; =20 @@ -290,6 +292,12 @@ static void pci_piix3_realize(PCIDevice *dev, Error **= errp) } irq =3D object_property_get_uint(OBJECT(&d->rtc), "irq", &error_fatal); isa_connect_gpio_out(ISA_DEVICE(&d->rtc), 0, irq); + + /* IDE */ + qdev_prop_set_int32(DEVICE(&d->ide), "addr", dev->devfn + 1); + if (!qdev_realize(DEVICE(&d->ide), BUS(pci_bus), errp)) { + return; + } } =20 static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -321,6 +329,7 @@ static void pci_piix3_init(Object *obj) ISA_NUM_IRQS); =20 object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); + object_initialize_child(obj, "ide", &d->ide, TYPE_PIIX3_IDE); } =20 static void pci_piix3_class_init(ObjectClass *klass, void *data) diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index 9051083c1e..ade817f1b6 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -73,7 +73,6 @@ config I440FX select PC_ACPI select PCI_I440FX select PIIX3 - select IDE_PIIX select DIMM select SMBIOS select FW_CFG_DMA diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index c10cbc5fc1..28345edbb3 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -34,6 +34,7 @@ config PC87312 config PIIX3 bool select I8257 + select IDE_PIIX select ISA_BUS select MC146818RTC =20 --=20 MST