From patchwork Thu Sep 1 16:25:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12962923 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 B7012ECAAD3 for ; Thu, 1 Sep 2022 16:42:49 +0000 (UTC) Received: from localhost ([::1]:42856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTnHE-0006RT-MI for qemu-devel@archiver.kernel.org; Thu, 01 Sep 2022 12:42:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTn20-0001v8-G6 for qemu-devel@nongnu.org; Thu, 01 Sep 2022 12:27:07 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:34582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTn1x-0001Sk-SS for qemu-devel@nongnu.org; Thu, 01 Sep 2022 12:27:04 -0400 Received: by mail-ej1-x629.google.com with SMTP id y3so35860461ejc.1 for ; Thu, 01 Sep 2022 09:27:01 -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=bCZYZWD3Kd3XMd5O2nNXe28bh4cYB+1rKUIfZeHrag8=; b=npas1mwmoEMnI/XueUoXBwuDTiPv0flL71XBeo2ie6fN1Pd/4A2BXnZElvPRbS/Mvj Vl+72DqRxXRM8xKqCsf6aU/pSr1X61J2ZbSbvd89z+Admta3OXRh2mYK3mFn0cdSOSdz zNLw7et4MLSgdAouSdFD6u6T8gWiO+J6QcQhbjpTtigskYuNS9oBnomswCjj05Anc3G8 qqd380cfImpeZ8UMCQs/3NQizBSBkAhggfgqNoe9Ol90lybJp8n6xeqFzSaDp0xpkOnS Mr/m+35ZP99S7y+QNRuFrFR9QhHDGqaAPpfKptdjIsRLX/L20EaikEPm54Ambn6NkRrZ ht+w== 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=bCZYZWD3Kd3XMd5O2nNXe28bh4cYB+1rKUIfZeHrag8=; b=L07IhXOn+HFMt3QrH3hW4OJd6qvQ9vE1Kea8CZEBlz8h1LggdbMEjFnczD8sn8C6yj xlrLotY9nRJq5AWxobzO2vYz0mGldf5TR27BJcu0cr++Bp89CvB2boa29SaZBw5oVM4w Nh/coJm7HQ771rsr66mukaXHKRGq/cEkgZhzxYcEqHc1bz0hfBLZxnJC+tEGh+jIE/34 FJT6OpkDVYYYeo3h/bdgUGR0WsbYbSH0oyOq1PzA7CZVHAuK3zWZIsBuGJJ3pouj8EeH bz3WMnSc14xGcCT4I1EwdIjzw0jJqpVp1NZgV5LAcfn3NBYfYh3CZChe5kdxhlcu7hIw jgPA== X-Gm-Message-State: ACgBeo3AQIPIwIpuf7D7vd5fLvfJOzMjvfzbnMsq58NN4h/v0qlTIUMb Mt8IwTPd71rDStw6Se2ggDR54l/7g+Q= X-Google-Smtp-Source: AA6agR7tvMKBeEKWe7A2TJ+FHGUD+ggzRLKsqxif/mmsFY8tB5Pw8PTZ5hvSJtLoFJbCCZbSeq1toA== X-Received: by 2002:a17:907:2d20:b0:741:a251:1f10 with SMTP id gs32-20020a1709072d2000b00741a2511f10mr11867640ejc.400.1662049621018; Thu, 01 Sep 2022 09:27:01 -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 p6-20020aa7d306000000b00447c0dcbb99sm1587672edq.83.2022.09.01.09.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 09:27:00 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Her?= =?utf-8?q?v=C3=A9_Poussineau?= , Aurelien Jarno , Paolo Bonzini , Eduardo Habkost , Richard Henderson , Jiaxun Yang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH 14/42] hw/isa/piix3: Modernize reset handling Date: Thu, 1 Sep 2022 18:25:45 +0200 Message-Id: <20220901162613.6939-15-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220901162613.6939-1-shentey@gmail.com> References: <20220901162613.6939-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=shentey@gmail.com; helo=mail-ej1-x629.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" Rather than registering the reset handler via a function which appends the handler to a global list, prefer to implement it as a virtual method - PIIX4 does the same already. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix3.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index c8c2dd6048..0350f70706 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -31,7 +31,6 @@ #include "hw/qdev-properties.h" #include "hw/isa/isa.h" #include "hw/xen/xen.h" -#include "sysemu/reset.h" #include "sysemu/runstate.h" #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" @@ -156,9 +155,9 @@ static void piix3_write_config_xen(PCIDevice *dev, piix3_write_config(dev, address, val, len); } -static void piix3_reset(void *opaque) +static void piix3_reset(DeviceState *dev) { - PIIX3State *d = opaque; + PIIX3State *d = PIIX3_PCI_DEVICE(dev); uint8_t *pci_conf = d->dev.config; pci_conf[0x04] = 0x07; /* master, memory and I/O */ @@ -321,8 +320,6 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) memory_region_add_subregion_overlap(pci_address_space_io(dev), PIIX_RCR_IOPORT, &d->rcr_mem, 1); - qemu_register_reset(piix3_reset, d); - i8257_dma_init(isa_bus, 0); /* RTC */ @@ -397,6 +394,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); + dc->reset = piix3_reset; dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix3; dc->hotpluggable = false;