From patchwork Fri Jun 3 18:50:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60D20C433EF for ; Fri, 3 Jun 2022 18:53:20 +0000 (UTC) Received: from localhost ([::1]:49078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCQB-0001Pj-4m for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:53:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCO5-00077J-Co for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:10 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]:46785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCNz-00047a-Mn for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:06 -0400 Received: by mail-ej1-x62a.google.com with SMTP id v1so6920867ejg.13 for ; Fri, 03 Jun 2022 11:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pifMGYyd/ecYV4qzC4zVBKV2RM1UsX5S3JVieo52U/k=; b=QkADCmxHQkqL+htS63P5nl2FZjfiEfsFUtNF2sDsErTAYVb6ch6N5JNKKtXC/yWg6O rZipRLf5Bjj2vX7gxNW+dTUY+MAed9+VW/KzDkIAaOCoM6osmsgWMdPwe4cBQlDFcUe3 g84sime7UgtX7+tXsO4/8IKCkUR9T7ya9jtf9keSkldz5rrqS/Z4ihcXADhSP9ZnlRNg oCtsdkoLKi7SvyC8XuFizFGseVguo/Rm4qaQk9/scOTKJB7p5TDqVftRzESyW/v9+sEO u/URWLDjKO85H4KXyLDOu6PB+vgoFN4bOmC7er0IYvUvE+DhLeksgI6tJpE5ArhDo3J7 CfJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pifMGYyd/ecYV4qzC4zVBKV2RM1UsX5S3JVieo52U/k=; b=6wVW8ygiyYJCCSwMXIcyWr3UWHaYG4ZvHuzxYOcwMsW28tDYxSwOnlwGCLm+nGDDyO LKy0K9kxQquvxCzAI22/c6bCkUg/IXjTO4r2NLjS3gJAk/DXcMFwd8rJ1dfw3XPx2jgu qFxBGrTD9yIdFKom9uB7kuroZHq3ne/KgftvPxkK0XrWzH9Pk9gcp8MzqZkX3XLBWS1k ig1dNf7YN0/9TZjRsiks1y5x4Q2k+kjiWkOeTSWA81emXg5m8JviPh5sYDN/BLpoCPrY 63Ic+5jbc0ANHCij/oQEsJFwDGU6H92am05MbdzGtBXK4ulwsyrH39j2iCKH1VmObNBM 0I7w== X-Gm-Message-State: AOAM533HwU++nzdhNII2AEd/yFAqDDLNpiZcCI8l1bX+YbT3/hEu/g8t nL5GId370g/yrx550F/DQTn22ALpZbgaWA== X-Google-Smtp-Source: ABdhPJzZqxfhZ8eT/03EJqXwJJe5CQ2pBuya9Y/IT9/MVdpNo3nEgtgeIs0KOTJMigw4+WeU+7bm5Q== X-Received: by 2002:a17:907:a0c8:b0:6f6:d3e4:49a5 with SMTP id hw8-20020a170907a0c800b006f6d3e449a5mr10019322ejc.644.1654282261813; Fri, 03 Jun 2022 11:51:01 -0700 (PDT) Received: from osoxes.fritz.box (pd9ed79c4.dip0.t-ipconnect.de. [217.237.121.196]) by smtp.gmail.com with ESMTPSA id f25-20020a170906139900b006fe8c831632sm3066160ejc.73.2022.06.03.11.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:01 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Aurelien Jarno , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , =?utf-8?q?Herv=C3=A9_Poussineau?= , Paolo Bonzini , Bernhard Beschow Subject: [PATCH v4 00/11] QOM'ify PIIX southbridge creation Date: Fri, 3 Jun 2022 20:50:34 +0200 Message-Id: <20220603185045.143789-1-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=shentey@gmail.com; helo=mail-ej1-x62a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" v4: * Rebase onto https://patchew.org/QEMU/20220530112718.26582-1-philippe.mathieu.daude@gmail.com/ * Cosmetics (fix typo, omit "include") (Mark, Philippe) * Split piix3 and piix4 (Philippe) * s/Found-by/Reported-by/ (Philippe) * Don't alias smbus (Mark) v3: * Rebase onto 'hw/acpi/piix4: remove legacy piix4_pm_init() function' (Mark) [1] * Use embedded structs for touched PCI devices (Mark) * Fix piix4's rtc embedded struct to be initialized by object_initialize_child() (Peter) [2] Testing done: 1) `make check-avocado` for --target-list=x86_64-softmmu,mips-softmmu Result: All pass. 2) * `qemu-system-x86_64 -M pc -m 2G -cdrom archlinux-2022.05.01-x86_64.iso` * `qemu-system-mipsel -M malta -kernel vmlinux-3.2.0-4-4kc-malta -hda debian_wheezy_mipsel_standard.qcow2 -append "root=/dev/sda1 console=tty0"` In both cases the system booted successfully and it was possible to shut down the system using the `poweroff` command. v2: * Preserve `DeviceState *` as return value of piix4_create() (Mark) * Aggregate all type name movements into first commit (Mark) * Have piix4 southbridge rather than malta board instantiate piix4 pm (me) Testing done: 1) `make check-avocado` for --target-list=x86_64-softmmu,mips-softmmu Result: All pass. 2) Modify pci_piix3_realize() to start with error_setg(errp, "This is a test"); Then start `qemu-system-x86_64 -M pc -m 1G -accel kvm -cpu host -cdrom archlinux-2022.05.01-x86_64.iso`. Result: qemu-system-x86_64 aborts with: "This is a test" v1: The piix3 and piix4 southbridge devices still rely on create() functions which are deprecated. This series resolves these functions piece by piece to modernize the code. Both devices are modified in lockstep where possible to provide more context. Testing done: * `qemu-system-x86_64 -M pc -m 2G -cdrom archlinux-2022.05.01-x86_64.iso` * `qemu-system-mipsel -M malta -kernel vmlinux-3.2.0-4-4kc-malta -hda debian_wheezy_mipsel_standard.qcow2 -append "root=/dev/sda1 console=tty0"` In both cases the system booted successfully and it was possible to shut down the system using the `poweroff` command. [1] https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg05686.html [2] https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg01128.html Bernhard Beschow (11): hw/southbridge/piix: Aggregate all PIIX southbridge type names hw/isa/piix4: Use object_initialize_child() for embedded struct hw/isa/piix4: Move pci_map_irq_fn' near pci_set_irq_fn hw/isa/piix4: QOM'ify PCI device creation and wiring hw/isa/piix4: Factor out ISABus retrieval from piix4_create() hw/isa/piix4: QOM'ify PIIX4 PM creation hw/isa/piix4: Inline and remove piix4_create() hw/isa/piix3: Move pci_map_irq_fn near pci_set_irq_fn hw/isa/piix3: QOM'ify PCI device creation and wiring hw/isa/piix3: Factor out ISABus retrieval from piix3_create() hw/isa/piix3: Inline and remove piix3_create() hw/i386/pc_piix.c | 7 +- hw/isa/piix3.c | 98 +++++++++++++++------------- hw/isa/piix4.c | 119 +++++++++++++++++----------------- hw/mips/malta.c | 9 ++- include/hw/isa/isa.h | 2 - include/hw/southbridge/piix.h | 6 +- 6 files changed, 128 insertions(+), 113 deletions(-) Reviewed-by: Mark Cave-Ayland