From nobody Mon Feb 9 10:12:12 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=1621374994; cv=none; d=zohomail.com; s=zohoarc; b=PItjDax5qFMNT/VBMCHzCTEjT0jM+nxWBIvLE5u4txV1S1eigvKNzyLrqVUeFbcSKEpnA8B0Igl5tgkk3SAZEdeZFJ8poSXoJ6IIYKO+YJbFMrj7LlzA5TwbXp1pbO2gepJTxwMew3xhs4b+WXZyvXH62W+f6vHMxq7DXC0vO0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374994; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=rr3mNRHifEVHB6ysNxRHbVJ3RkaEoRT+Kli4CYUxdaw=; b=lIiunsxuVuAN9Owp7Fb2V+xzdZauVM2tlhw1BJP4H/iMXcUzWxfOe8WJb89ZrFtamMGBKJa8P0DQT+bfJkqS2GRkcrpVgF6IlbN6FVC2MuCpqdjDR+r/FhRgeU++nHvO9xyYCFHs+YxHn5v7hY6ZQO/MtxxqGzqP+VwRG2zR+q8= 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 1621374994599410.9103711443971; Tue, 18 May 2021 14:56:34 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-Sa2LAkqAMbOBjl2MRituDw-1; Tue, 18 May 2021 17:56:32 -0400 Received: by mail-ed1-f70.google.com with SMTP id m6-20020aa7c4860000b029038d4e973878so2318190edq.10 for ; Tue, 18 May 2021 14:56:31 -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 c7sm13670451ede.37.2021.05.18.14.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374993; 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=rr3mNRHifEVHB6ysNxRHbVJ3RkaEoRT+Kli4CYUxdaw=; b=IAXepeNF4u2/Ggk10NccD6cMiAfhu1G0TqgqLQjZBSYEH/5dXcpq2RjDin6xB9hqTVbJvY 1STt+yRJUWcM+TnHPzOBKgPNnD3ccfnzzIm+UlJw0CAiuVz9qMpQi+J5je3W1DXM6RW9D3 BBiv1TouUOtX13ZPZQ9UZ5UKRJ48z4Q= X-MC-Unique: Sa2LAkqAMbOBjl2MRituDw-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=rr3mNRHifEVHB6ysNxRHbVJ3RkaEoRT+Kli4CYUxdaw=; b=fgyako80tyujn6EzkzGQktG4pgPjKLdpLs4zDQRRHUWCxmT+fopcgIzUdkydcp4gac 8GQvM3q8iIOIScT0ZkRiTkuNin7viFVYx3ZxlFhtIN13XgiU6yn2hxZsodHxl2F+g/xw 17cdr81h/nKo0LX970s07ct8FV72uTss8pqugA2A9+SGpZIsgSIYNC+7aXKsLSjV917P bBJX2JlGED9kyPvY5hPG46MVV34Ro2Iystq0lq4+MUQKg7F7Nuz0XGKhL/ZHi1RxqZgN pL1l6TMiWAtq6rT5HpMiyuDbCH83O9yf3N8kkrsrdwaarNWzAUD7BknAJpwzf+ZVtQme E++Q== X-Gm-Message-State: AOAM533Ea1jVT6xNU9Ophi6MuS1FhdTKdLp15P5lO1/QnHeonhylxN+O KrBaJ6Qq9AxHxGF+WsOz8YzJ3PJgzi5nQdmO8bxahOTsLfilCWBLNePn4bDyX4mgbdtDbpDP2N7 sIdugYLqNAGyU/g== X-Received: by 2002:a17:906:5617:: with SMTP id f23mr7893902ejq.298.1621374990963; Tue, 18 May 2021 14:56:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsFcpSCXAucTyHeAi1k0VOvDyNCeNXtdGnJ99bhDASi8/TFB5x3F0I5efwdIWIZr5S4HhNkw== X-Received: by 2002:a17:906:5617:: with SMTP id f23mr7893893ejq.298.1621374990829; Tue, 18 May 2021 14:56:30 -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 09/11] hw/ide: Let ide_init_ioport() take an ISA bus argument instead of device Date: Tue, 18 May 2021 23:55:43 +0200 Message-Id: <20210518215545.1793947-10-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) Both callers to ide_init_ioport() have access to the ISA bus of the device, so can pass it directly. This allows ide_init_ioport() to directly call isa_bus_register_portio_list(). Note, now the callers become the owner of the PortioList. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/internal.h | 3 ++- hw/ide/ioport.c | 11 ++++++----- hw/ide/isa.c | 3 ++- hw/ide/piix.c | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 2d09162eeb7..141f53006a9 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -624,7 +624,8 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDED= riveKind kind, int chs_trans, Error **errp); void ide_init2(IDEBus *bus, qemu_irq irq); void ide_exit(IDEState *s); -void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2); +void ide_init_ioport(IDEBus *bus, ISABus *isabus, Object *owner, + int iobase, int iobase2); void ide_register_restart_cb(IDEBus *bus); =20 void ide_exec_cmd(IDEBus *bus, uint32_t val); diff --git a/hw/ide/ioport.c b/hw/ide/ioport.c index b613ff3bbaf..be2309459e1 100644 --- a/hw/ide/ioport.c +++ b/hw/ide/ioport.c @@ -50,15 +50,16 @@ static const MemoryRegionPortio ide_portio2_list[] =3D { PORTIO_END_OF_LIST(), }; =20 -void ide_init_ioport(IDEBus *bus, ISADevice *dev, int iobase, int iobase2) +void ide_init_ioport(IDEBus *bus, ISABus *isabus, Object *owner, + int iobase, int iobase2) { /* ??? Assume only ISA and PCI configurations, and that the PCI-ISA bridge has been setup properly to always register with ISA. */ - isa_register_portio_list(dev, &bus->portio_list, - iobase, ide_portio_list, bus, "ide"); + isa_bus_register_portio_list(isabus, owner, &bus->portio_list, + iobase, ide_portio_list, bus, "ide"); =20 if (iobase2) { - isa_register_portio_list(dev, &bus->portio2_list, - iobase2, ide_portio2_list, bus, "ide"); + isa_bus_register_portio_list(isabus, owner, &bus->portio2_list, + iobase2, ide_portio2_list, bus, "ide"= ); } } diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 6bc19de2265..e7cf6714c8f 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -74,7 +74,8 @@ static void isa_ide_realizefn(DeviceState *dev, Error **e= rrp) ISAIDEState *s =3D ISA_IDE(dev); =20 ide_bus_new(&s->bus, sizeof(s->bus), dev, 0, 2); - ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2); + ide_init_ioport(&s->bus, isa_bus_from_device(isadev), OBJECT(dev), + s->iobase, s->iobase2); isa_init_irq(isadev, &s->irq, s->isairq); ide_init2(&s->bus, s->irq); vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s); diff --git a/hw/ide/piix.c b/hw/ide/piix.c index debbc0023dc..0d6966fc7cb 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -137,8 +137,8 @@ static void pci_piix_init_ports(PCIIDEState *d) { =20 for (i =3D 0; i < 2; i++) { ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2); - ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase, - port_info[i].iobase2); + ide_init_ioport(&d->bus[i], d->isa_bus, OBJECT(d), + port_info[i].iobase, port_info[i].iobase2); ide_init2(&d->bus[i], isa_bus_get_irq(d->isa_bus, port_info[i].isa= irq)); =20 bmdma_init(&d->bus[i], &d->bmdma[i], d); --=20 2.26.3