From nobody Mon Feb 9 23:39:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374967; cv=none; d=zohomail.com; s=zohoarc; b=XC/L3UVV+VSZCVe4ZCC+yD2lBrHdv6ulvsr1KpIimmK0OyoAvSTG7JN6yJgCskY5DI8+E72AFSl+UE/PVAC/38dX36Gcey20/K4FqgbXETMKnysQ2MIIcrgS/jDlRT7ApsqfIPnyRo8jWhFo3MTWO4KeUI0n0HhRMk+XkLAEXrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374967; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=gn9E3ldchIQVg6abwyiugztlAOCm9ATrI49DFupz98Y=; b=XRaYq+GNXnX/ty1ZGoqiP+Rc7bprw9bnUASVa8WlrobjpSCLiZJOxgUIcdVtaVakZF4i2UvjU5mI3ZJLp2NTHsAOUDERCtV5FmxXxZDrbErL9N8klXSIQ3nOJ18kNpnbGWmdWqpsEl/+CuTwPDA+Vb9L8t3H0Qc/7k8G12ggGRw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621374967550756.1224397746148; Tue, 18 May 2021 14:56:07 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-BvkOBHV9M3KzoKEuBDi3cA-1; Tue, 18 May 2021 17:56:02 -0400 Received: by mail-ej1-f70.google.com with SMTP id la2-20020a170906ad82b02903d4bcc8de3bso2943079ejb.4 for ; Tue, 18 May 2021 14:56:02 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id zg18sm3285302ejb.41.2021.05.18.14.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374966; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gn9E3ldchIQVg6abwyiugztlAOCm9ATrI49DFupz98Y=; b=fx3wJBRJtrWiMlnMzzFP8ONzeCNEh4zGOeTVq92Dfz2p1QL93VJ4loPw2TYwkceqom9+Ql NU1RmriOJi8ENYGRIVret98xhCRZCRU8FaPL+l1f5M60Fc76YspD7YJTpr01Zr6Htu1cr9 rux2f8wWizmY3pKeX6Z4KqdtW/hs1b4= X-MC-Unique: BvkOBHV9M3KzoKEuBDi3cA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gn9E3ldchIQVg6abwyiugztlAOCm9ATrI49DFupz98Y=; b=XQWKuErjCzITnKqYUUv6QzGjlAuQuqCsqjkMF5xo7QFXWsFrnhXwAb8q9RV/mYRdLS tVMfOXYQIpxH3Zx2c6yPlrm46SfytiBrGts3jprWytK0+kjRSAUZY+M8yJN229KH1QYM 2mVUvGpRQYHNWXqbGmrs7oB5iQfActqlJA7hpkgCj1INy/eS9jPUlvopZaNKrS5BADp8 zQdQvZw3ts+POxToCkO3p8e/DeGgrIms/ejTcyBr1g5+N49Q2G+dZsKd3j/DEOnKEvK+ 4cOyEaGOZj7GHLzQSqx6gaCyStf+WvxodCxHufaGlsgam7IH+/BrhWrzovvfbVknm469 1bTw== X-Gm-Message-State: AOAM531ASEP9LZje34bumK3lNaSV3UbJKZdXtdtPMyxbzkc0ICaWvkua olbPnewqbBImrTFJcP7KBPGOKUVQnW0KKBY5UjH5jOcdZ6mVw7J+xTHl5qxDFDWgunbvVatSIFB LmAwdtDJzo08UKA== X-Received: by 2002:aa7:c789:: with SMTP id n9mr9670495eds.352.1621374961621; Tue, 18 May 2021 14:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgc8iWE4iB6idJShlAeZwhnPROOUoOUE7+ks3AVxbdhNDGXzEmoj0aqRcNnCUWsppBXEOQ0A== X-Received: by 2002:aa7:c789:: with SMTP id n9mr9670485eds.352.1621374961501; Tue, 18 May 2021 14:56:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 03/11] hw/ide/piix: Set the ISA-bus QOM link Date: Tue, 18 May 2021 23:55:37 +0200 Message-Id: <20210518215545.1793947-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Set the ISA Bus link property on the PIIX IDE object from the two unique users, the PC machine and the PIIX4 function. Add a check in pci_piix_ide_realize() to be sure this property is set. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_piix.c | 2 ++ hw/ide/piix.c | 5 +++++ hw/isa/piix4.c | 10 +++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index fb606c14768..d799c8004df 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -246,6 +246,8 @@ static void pc_init1(MachineState *machine, =20 dev =3D pci_new(piix3_devfn + 1, xen_enabled() ? "piix3-ide-xen" : "piix3-ide"); + object_property_set_link(OBJECT(dev), "isa-bus", + OBJECT(isa_bus), &error_abort); pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); idebus[0] =3D qdev_get_child_bus(&dev->qdev, "ide.0"); diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 48da68da37f..3aef9b1e21c 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -152,6 +152,11 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error= **errp) PCIIDEState *d =3D PCI_IDE(dev); uint8_t *pci_conf =3D dev->config; =20 + if (!d->isa_bus) { + error_setg(errp, "piix-ide: 'isa-bus' link not set"); + return; + } + pci_conf[PCI_CLASS_PROG] =3D 0x80; // legacy ATA mode =20 bmdma_setup_bar(d); diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index d60f161ecf4..ef11c2d1f8d 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -248,20 +248,24 @@ static void piix4_register_types(void) =20 type_init(piix4_register_types) =20 -DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbu= s) +DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_busp, I2CBus **smb= us) { PCIDevice *pci; DeviceState *dev; + ISABus *isa_bus; int devfn =3D PCI_DEVFN(10, 0); =20 pci =3D pci_create_simple_multifunction(pci_bus, devfn, true, TYPE_PIIX4_PCI_DEVICE); dev =3D DEVICE(pci); - if (isa_bus) { - *isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + if (isa_busp) { + *isa_busp =3D isa_bus; } =20 pci =3D pci_new(devfn + 1, "piix4-ide"); + object_property_set_link(OBJECT(pci), "isa-bus", + OBJECT(isa_bus), &error_abort); pci_realize_and_unref(pci, pci_bus, &error_abort); pci_ide_create_devs(pci); =20 --=20 2.26.3