From patchwork Fri Jun 3 18:50:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869334 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 9DD1DC43334 for ; Fri, 3 Jun 2022 18:53:23 +0000 (UTC) Received: from localhost ([::1]:49186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCQE-0001Tn-PC for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:53:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCO5-00077K-DH for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:10 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:44841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO0-00047r-Al for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:06 -0400 Received: by mail-ej1-x62b.google.com with SMTP id kq6so4597400ejb.11 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=WRQy+p9QHBhbhdctUoVX94Tio3w4hP8sJtMALXRbrgI=; b=I+KWJK5wdnGCNQatXmeewgCvNV3aI++/RCNIUlAB7p9Hx1k9AOqSPUJPRRz6R6Jmib 231VQRo86xC9Lpj1rbnu/sOexMfqcB3dU5cEO5P9/9lvXyT45Eq1wxohixxsrcq45jWa qivF8O0gTf1eLMwnNKzWdoyyOPAcfgSXmsq5XNhK8Vr/LlBmTTAt5wNfcmT/43id88bd BvB3FMRvuEb5uOAKSNry/KkhTq3m5WCATOk9JaXQ+xBa1dMsM1H1hom+83W/7PHvbmZs DSZBmydGZ3AcVrMrJPRSSnwi5Hn13TC0eoHPE01btkMOqNUor6rU8jumy4rao/z9aHpi 4ElA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=WRQy+p9QHBhbhdctUoVX94Tio3w4hP8sJtMALXRbrgI=; b=LgMrm6D9OZCC7aGX6cNDOwqMYYdzHGqLvQMGih6B+PbBCW+n4YA7ohSVE2xc8yp8tG olKx6JiPLFb21J1cFZ5cA5TscQtxHVofT6JYpJ/ww0YX23+qaDN2+oYC7vKtibLI0+r6 pOuw5OlNECLTMATeaXpnOV5hYmSMqD3zbGHU4rge/BXgw5kwSYOReNiqT2T7niNX/6o+ 5yjZLKDK7/qkecYjiiJKt5mLbwjawdkkBHx/XokxEg2rLNPBsPwOVx2gt8VZu6Ow6xnx 7KSTSBM7YR/4qnCqw1MObLXm6lo1SGqKzdkMOKT5OuhCVKILV1rJiLebOk1xE4kCdkkc +jCA== X-Gm-Message-State: AOAM5333x5zAe71nRr6fgojJGEQFgcSyO+8Nr/aenAlakW5rv/WoLziQ CcgohYitU/TW74cy1KPiBMjtYjlSq9iRig== X-Google-Smtp-Source: ABdhPJwWSK0mloEc7bHzrGOo/wz3YA1l10SFJRCPBC5y+2vHvXSH6y3kAagX+FpyzCZG5PQvXV+PZQ== X-Received: by 2002:a17:906:99c1:b0:6fe:b01d:134 with SMTP id s1-20020a17090699c100b006feb01d0134mr9821740ejn.598.1654282262709; Fri, 03 Jun 2022 11:51:02 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:02 -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 , Mark Cave-Ayland Subject: [PATCH v4 01/11] hw/southbridge/piix: Aggregate all PIIX southbridge type names Date: Fri, 3 Jun 2022 20:50:35 +0200 Message-Id: <20220603185045.143789-2-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=shentey@gmail.com; helo=mail-ej1-x62b.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" TYPE_PIIX3_PCI_DEVICE resides there as already, so add the remaining ones, too. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix3.c | 3 --- include/hw/isa/isa.h | 2 -- include/hw/southbridge/piix.h | 4 ++++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index dab901c9ad..d96ce2b788 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -35,9 +35,6 @@ #define XEN_PIIX_NUM_PIRQS 128ULL -#define TYPE_PIIX3_DEVICE "PIIX3" -#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" - static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) { qemu_set_irq(piix3->pic[pic_irq], diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 034d706ba1..e9fa2f5cea 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -144,6 +144,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d) return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); } -#define TYPE_PIIX4_PCI_DEVICE "piix4-isa" - #endif diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 976b4da582..3b97186f75 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -64,6 +64,10 @@ typedef struct PIIXState PIIX3State; DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, TYPE_PIIX3_PCI_DEVICE) +#define TYPE_PIIX3_DEVICE "PIIX3" +#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" +#define TYPE_PIIX4_PCI_DEVICE "piix4-isa" + PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus); DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus); From patchwork Fri Jun 3 18:50:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869338 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 13E27CCA47C for ; Fri, 3 Jun 2022 18:56:19 +0000 (UTC) Received: from localhost ([::1]:57784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCT4-0007Bt-6e for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:56:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCO5-00077M-Ea for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:10 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:40620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO1-00048B-F7 for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:06 -0400 Received: by mail-ej1-x636.google.com with SMTP id fu3so16122361ejc.7 for ; Fri, 03 Jun 2022 11:51:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=zsrYs9v+j1ezvORFnoGAQqRmm4nxMzuK/3Qj8II5VG4=; b=f03RNSjLDYDV1Xcd8f96z1+MNrrs82v5G1g1ZXYM9gBJsZAKgXrTdi/G6vIgqAhdJU yVCTKnNhLm6Tg/EzH+lQ04RUKs5IP46b7qy4/XMgIprA3qHtJGlG0Ks+s6EqIqEOFPD6 wY8TyIJz4o2K6RsFdgk1yVUhTrM4CQPtBAnYtDHkLMr8sVJ5Yd34r6m6qlS2jQethcNU tJ3vPQZTkkmQxy5PadfOrzF7cA/nFSZFNMKIe/wC/dn4YKflweLk13F4sBDvw4R3gYD2 urAWCJ7QwTy6JUlCK6u+kEUvjorQGYcOb9pZBmPWZo1DHAVEzQ08KyZEdTqPdUalSz2b 60oQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zsrYs9v+j1ezvORFnoGAQqRmm4nxMzuK/3Qj8II5VG4=; b=MRPO6HnwJtjMeX64gDazDX2eyZJUY5RJ3Sg5H93q8BgGSHArF0iWPT0tzFjGAnPhEB 0GyNGNlDVW0JD5/4VN4usQuIEELGBxqkqY3YTJgAcVQuV9GB2kTNklqs0U7+y0Rbl4Wb dPJkz34oo60duSnc1eSaMFp6mMxP5dMJVlIofYBNRFSSIIDphxPpE3Y1rcLqu6Scvl7n gjEM9K1LZtqZkaKeJWyrKBtwTZRdZOcYSNHN5LeZPLRRETx/VVv22m/81RxGx6JSk0sP N0DiZs6A4mZvj46xjaBQHA7tUY0jXyJYoKj/mJxm4kRJxE6VLz3MyopjeeJuWbwgSoDX jzNA== X-Gm-Message-State: AOAM532PRkXTyLj09WUVsLskqbmaV4ohsUlM5F9LyjstTu4IHkRrdeIZ CYDr98DiWFHTR9g3VesYRLSMazLKdJ2JSg== X-Google-Smtp-Source: ABdhPJxacIlHswXk79YvmaZi/5wEqK6+EQ9ZNgtS4j4dJfc2wtJSQWPB/mmmSrMlbWFzy2kTZY15+g== X-Received: by 2002:a17:907:2d2a:b0:710:76a1:4d89 with SMTP id gs42-20020a1709072d2a00b0071076a14d89mr300271ejc.307.1654282263816; Fri, 03 Jun 2022 11:51:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:03 -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 , Peter Maydell Subject: [PATCH v4 02/11] hw/isa/piix4: Use object_initialize_child() for embedded struct Date: Fri, 3 Jun 2022 20:50:36 +0200 Message-Id: <20220603185045.143789-3-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=shentey@gmail.com; helo=mail-ej1-x636.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" Reported-by: Peter Maydell Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 9a6d981037..1d04fb6a55 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -224,7 +224,7 @@ static void piix4_init(Object *obj) { PIIX4State *s = PIIX4_PCI_DEVICE(obj); - object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC); + object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); } static void piix4_class_init(ObjectClass *klass, void *data) From patchwork Fri Jun 3 18:50:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869332 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 461E5C43334 for ; Fri, 3 Jun 2022 18:53:21 +0000 (UTC) Received: from localhost ([::1]:49142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCQB-0001S5-MR for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:53:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCO7-00078J-NI for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:11 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:34357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO5-00048p-2F for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:11 -0400 Received: by mail-ej1-x633.google.com with SMTP id q21so17644467ejm.1 for ; Fri, 03 Jun 2022 11:51:06 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=w+VBxhxh0gSBVm9fr937VMDDWJs7ypGS7SXewGU/qvQ=; b=nMBcEmvzYazMSmOM+6PchFb6GHzW4PR+GwBeOLg/ec4KyuXvazUlVwesC3IL+dsqKA FuqRDJcxyqZ5geAFCGVy9HEuakns9XjnT3edMdNedW9fx4h4AZnk8Nwo3RBbqRgnO8rp gnjKnEkfv32jeuYQkKE1kQn7bbMDIrG+NXH36bf0foC2PJJsBfI+jQ0iPwnxGG3HJW8t j9K8+EMFUhayUlWUDR6gQ/fjj/KT+qroWUvLmTQfKqTsbXTcHQFNaSkZpFW6DfspS4zK VwvpiJVwFz/RDwsOMkkhYDlEjilfiSx8HV+1mAgy6WwOG08as/QC+6PlXwZjZMI1SZDu ThPQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=w+VBxhxh0gSBVm9fr937VMDDWJs7ypGS7SXewGU/qvQ=; b=xYiKjhCtuo3edKRzs3xaXUs9J7VPqinSIFzW2GcZqxAZx6qUlhzsJA/y0l0QMsDFhD MQvBgoIoMgnyx93FSqG4qJjqAztRazMn3znMqEHvz9uvff54DeOxW0C0o6PVLuux+p9U owL9DXAJ7tEtMB9TjtMVoYkCoqYjD+0dMF5KourySjZ7Ic0h8OrNeiaWqKdbQmDnuYv2 CZSn4y32E7zoWNQyjpBVZv7MyhHk0Akd3d8n4G4OXwQDwd9unfZwK6DHSDByo8+t8dEs c4Pj7+kbf1EKnrOr+ZSXjYDQlqd54z3n8LGpZS/PdONXVuQkE1VLeVxy8wL9sbyQYO91 RPpg== X-Gm-Message-State: AOAM531l2emVqkzdJJCdpopQA4I2XWuZ8pK0pLX4i0Q6e9lJA88ReGfv HPln1IYe0B3KDwMAP5BYSw2E0+TWcw5wIA== X-Google-Smtp-Source: ABdhPJysHlDfP9FYhPKp2znJhlxn4OFCjLsNlBQznkSoblZy7z8Rb3GhGGY9fNEQnDO8jyJRSDDMhg== X-Received: by 2002:a17:907:868c:b0:6fe:fd7a:e0d7 with SMTP id qa12-20020a170907868c00b006fefd7ae0d7mr9880899ejc.90.1654282265505; Fri, 03 Jun 2022 11:51:05 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:04 -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 , Mark Cave-Ayland Subject: [PATCH v4 03/11] hw/isa/piix4: Move pci_map_irq_fn' near pci_set_irq_fn Date: Fri, 3 Jun 2022 20:50:37 +0200 Message-Id: <20220603185045.143789-4-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=shentey@gmail.com; helo=mail-ej1-x633.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" The pci_map_irq_fn was implemented below type_init() which made it inaccessible to QOM functions. So move it up. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix4.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 1d04fb6a55..18aa24424f 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -74,6 +74,31 @@ static void piix4_set_irq(void *opaque, int irq_num, int level) } } +static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) +{ + int slot; + + slot = PCI_SLOT(pci_dev->devfn); + + switch (slot) { + /* PIIX4 USB */ + case 10: + return 3; + /* AMD 79C973 Ethernet */ + case 11: + return 1; + /* Crystal 4281 Sound */ + case 12: + return 2; + /* PCI slot 1 to 4 */ + case 18 ... 21: + return ((slot - 18) + irq_num) & 0x03; + /* Unknown device, don't do any translation */ + default: + return irq_num; + } +} + static void piix4_isa_reset(DeviceState *dev) { PIIX4State *d = PIIX4_PCI_DEVICE(dev); @@ -266,31 +291,6 @@ static void piix4_register_types(void) type_init(piix4_register_types) -static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) -{ - int slot; - - slot = PCI_SLOT(pci_dev->devfn); - - switch (slot) { - /* PIIX4 USB */ - case 10: - return 3; - /* AMD 79C973 Ethernet */ - case 11: - return 1; - /* Crystal 4281 Sound */ - case 12: - return 2; - /* PCI slot 1 to 4 */ - case 18 ... 21: - return ((slot - 18) + irq_num) & 0x03; - /* Unknown device, don't do any translation */ - default: - return irq_num; - } -} - DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) { PIIX4State *s; From patchwork Fri Jun 3 18:50:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869339 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 3CA82C433EF for ; Fri, 3 Jun 2022 18:59:20 +0000 (UTC) Received: from localhost ([::1]:36348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCVz-0003QP-8W for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCO6-00077V-PF for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:10 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:42814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO5-00048x-27 for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:10 -0400 Received: by mail-ed1-x532.google.com with SMTP id n28so11299717edb.9 for ; Fri, 03 Jun 2022 11:51:07 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=INWHJdCEzGhmN69hiuG+Qj1A8L6gKWutj0DTiMvIB5Q=; b=duuMEbFnpsbxxmA2fiQRqu5AKm5dOhMCahzcDIuBAT9j2mnRZPKAhIL1Fi4GXjHRdx aYJ3hN0PRV0MtFF/9sbmlG0SWRCrjO78G6EAxPD4TgulAb7BbJPZQhvkbWUmh3LBF14O 6Q1EPBv9koimVXv59qlmVM1z3a+uGhPHPaZtg39KOXxv6Mk1GD9YqKkG9KG1kzKrKen8 p+9V6PfBI1smChTpRlyoC3bm5OsVy9tuLC1RdoqOaKfrPlgucdhM4aq6lRHf0wI8qWVX VpOr1+n7GiJTeuq1FXlgIGQoar6pUPMH0W1OMHN9w+V0Ui3//dqmmljvP7GcDiyhcwTs xYTQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=INWHJdCEzGhmN69hiuG+Qj1A8L6gKWutj0DTiMvIB5Q=; b=JoqXQuyOoAqez69LYgYZFEsA6IykXM7JMa8JzjA7x2ctFx5mwjLNtqAuGR1H+IXMiB OF+dkjCJN0nYi93RlGrOz3ACZosiDXB9NpHBQV+P6Ax5qah8tUiHzjTaYgNWxho+QvZQ SmHNk2MG0Ujck0hAP6b4g8eSAuP+w11xtBy9RBs0CEiJR30UIRo+K/uohWfhjUoHGMNo zUZJPO+RFKgIR3b6dAsSYZfRYZ/20Fm3WIVAEY5bqwu4kXtGDt36UEOf5w/5e802m+Fy 70jqYYkEDiDO/8zngAApvSGTHtH2e9m6nuUvslXYTEVf06ZRBQroVfnstHbLEmrRybnR akOw== X-Gm-Message-State: AOAM530C9lEwwUrLH0QVtu9wG66qnzjJKMFzxFtG+AbAD6N90aI80oVZ SNr7kd56I1EBxSveDE8Rt3Ed1wwJH5GJvA== X-Google-Smtp-Source: ABdhPJw4tmGLk/1Xp/iEPARnj0s7Ac1Ahx37R88Inrr/3pn8QNJajorqtBOfTk0bUbYmxCQ+DQJHIw== X-Received: by 2002:a05:6402:516e:b0:42d:c48b:b724 with SMTP id d14-20020a056402516e00b0042dc48bb724mr12406610ede.93.1654282266632; Fri, 03 Jun 2022 11:51:06 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:06 -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 04/11] hw/isa/piix4: QOM'ify PCI device creation and wiring Date: Fri, 3 Jun 2022 20:50:38 +0200 Message-Id: <20220603185045.143789-5-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=shentey@gmail.com; helo=mail-ed1-x532.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" PCI interrupt wiring and device creation were performed in create() functions which are obsolete. Move these tasks into QOM functions to modernize the code. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix4.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 18aa24424f..058bebb5e2 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -35,6 +35,7 @@ #include "hw/rtc/mc146818rtc.h" #include "hw/ide/pci.h" #include "hw/acpi/piix4.h" +#include "hw/usb/hcd-uhci.h" #include "migration/vmstate.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" @@ -46,6 +47,8 @@ struct PIIX4State { qemu_irq *isa; RTCState rtc; + PCIIDEState ide; + UHCIState uhci; /* Reset Control Register */ MemoryRegion rcr_mem; uint8_t rcr; @@ -205,6 +208,7 @@ static const MemoryRegionOps piix4_rcr_ops = { static void piix4_realize(PCIDevice *dev, Error **errp) { PIIX4State *s = PIIX4_PCI_DEVICE(dev); + PCIBus *pci_bus = pci_get_bus(dev); ISABus *isa_bus; qemu_irq *i8259_out_irq; @@ -243,6 +247,21 @@ static void piix4_realize(PCIDevice *dev, Error **errp) return; } s->rtc.irq = isa_get_irq(ISA_DEVICE(&s->rtc), s->rtc.isairq); + + /* IDE */ + qdev_prop_set_int32(DEVICE(&s->ide), "addr", dev->devfn + 1); + if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) { + return; + } + pci_ide_create_devs(PCI_DEVICE(&s->ide)); + + /* USB */ + qdev_prop_set_int32(DEVICE(&s->uhci), "addr", dev->devfn + 2); + if (!qdev_realize(DEVICE(&s->uhci), BUS(pci_bus), errp)) { + return; + } + + pci_bus_irqs(pci_bus, piix4_set_irq, pci_slot_get_pirq, s, PIIX_NUM_PIRQS); } static void piix4_init(Object *obj) @@ -250,6 +269,8 @@ static void piix4_init(Object *obj) PIIX4State *s = PIIX4_PCI_DEVICE(obj); object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); + object_initialize_child(obj, "ide", &s->ide, "piix4-ide"); + object_initialize_child(obj, "uhci", &s->uhci, "piix4-usb-uhci"); } static void piix4_class_init(ObjectClass *klass, void *data) @@ -293,7 +314,6 @@ type_init(piix4_register_types) DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) { - PIIX4State *s; PCIDevice *pci; DeviceState *dev; int devfn = PCI_DEVFN(10, 0); @@ -301,15 +321,11 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) pci = pci_create_simple_multifunction(pci_bus, devfn, true, TYPE_PIIX4_PCI_DEVICE); dev = DEVICE(pci); - s = PIIX4_PCI_DEVICE(pci); + if (isa_bus) { *isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); } - pci = pci_create_simple(pci_bus, devfn + 1, "piix4-ide"); - pci_ide_create_devs(pci); - - pci_create_simple(pci_bus, devfn + 2, "piix4-usb-uhci"); if (smbus) { pci = pci_new(devfn + 3, TYPE_PIIX4_PM); qdev_prop_set_uint32(DEVICE(pci), "smb_io_base", 0x1100); @@ -320,7 +336,5 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) *smbus = I2C_BUS(qdev_get_child_bus(DEVICE(pci), "i2c")); } - pci_bus_irqs(pci_bus, piix4_set_irq, pci_slot_get_pirq, s, PIIX_NUM_PIRQS); - return dev; } From patchwork Fri Jun 3 18:50:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869333 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 82AD7CCA473 for ; Fri, 3 Jun 2022 18:53:22 +0000 (UTC) Received: from localhost ([::1]:49176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCQD-0001TX-LB for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:53:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCO7-00078d-Tu for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:12 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:46785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO5-000493-4q for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:11 -0400 Received: by mail-ej1-x629.google.com with SMTP id v1so6921289ejg.13 for ; Fri, 03 Jun 2022 11:51:08 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=hiYBO+N7jIAM2+stGie02AILzVrsGsOeOjsOm9ex25w=; b=qcSFa+CjdyGMu4BtneDS1h2fU58B07eDFJ8rHYvMuk2JngrnshtBe1WcDw2WQSLR82 rhsis1SnnBUYeAghSPQcj/yQPBUdqWQH7oW7hPr25mDctykVfEGVjXSh98m3Plh2qjqK pOtpxVD6xmIEXKrBTQAdmzJ7phVw7VI7JoHLo/+pv+tgyF36dtWjqRAfjtDDFqlBAiiJ jDUTgpnYNeKlOqib1qv9j1sei6SNYM7Up+U6MVOrABFwzFT+tBYp523xK6clC/BwuuUI 7H+xYsMRPRNluKKKVdhFAD5cRLiiVE6s6m0g/GlBh6Ja5SFHvcfQUwdwsIOXBb2c8WY3 nE4A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=hiYBO+N7jIAM2+stGie02AILzVrsGsOeOjsOm9ex25w=; b=PxbUlXIFklixBImtkM1OevK2l27zF2ogsubZZd32o6SShjD1miTOLImdFphX7EebRR B7vJftXJ6wqg0DWpzViMsOI6YcK0hfExGwiGh55thuHrJsyo0XggXmKISrufQ1X6qZ0D 3n4+iy0tTGlrFwhECd6QxktJA6SFd/DsK0oqM/11creRed39KAD10KP1mXD6zp3s/ZZp 7wb9Au0XSXuSCt8ACfTQOE8akQuYDVcIPjN/IbJ1GTmjfslu0UheyRcEmrQKrrPqpaGw NokgnuoU5WCQMnZ4J4kFUkQGT6ir44Wh/BDdSAWwKVOEGOxQ6uKGT8rGe8o3r6XsE8Ov kDxw== X-Gm-Message-State: AOAM532IwYry8EXn1WPflrY7uTkGOHvGEsTXFK8/K6AKSr3OImStasfT PtU38Mn44SKoBRnaP6wv9er+YT7ukM2daw== X-Google-Smtp-Source: ABdhPJxwqmGSFJq0Ksy9kB/6+H3mzMyjmReuUgs3RU/fOaN3pMJTr3y7s0KimZMCALYxoMKWdQ1K6w== X-Received: by 2002:a17:907:3c81:b0:6e6:cf3e:6e14 with SMTP id gl1-20020a1709073c8100b006e6cf3e6e14mr10038017ejc.181.1654282267662; Fri, 03 Jun 2022 11:51:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:07 -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 , Mark Cave-Ayland Subject: [PATCH v4 05/11] hw/isa/piix4: Factor out ISABus retrieval from piix4_create() Date: Fri, 3 Jun 2022 20:50:39 +0200 Message-Id: <20220603185045.143789-6-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-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" Modernizes the code. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix4.c | 6 +----- hw/mips/malta.c | 3 ++- include/hw/southbridge/piix.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 058bebb5e2..96df21a610 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -312,7 +312,7 @@ static void piix4_register_types(void) type_init(piix4_register_types) -DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) +DeviceState *piix4_create(PCIBus *pci_bus, I2CBus **smbus) { PCIDevice *pci; DeviceState *dev; @@ -322,10 +322,6 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) TYPE_PIIX4_PCI_DEVICE); dev = DEVICE(pci); - if (isa_bus) { - *isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); - } - if (smbus) { pci = pci_new(devfn + 3, TYPE_PIIX4_PM); qdev_prop_set_uint32(DEVICE(pci), "smb_io_base", 0x1100); diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 9ffdc5b8f1..e446b25ad0 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1399,7 +1399,8 @@ void mips_malta_init(MachineState *machine) empty_slot_init("GT64120", 0, 0x20000000); /* Southbridge */ - dev = piix4_create(pci_bus, &isa_bus, &smbus); + dev = piix4_create(pci_bus, &smbus); + isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); /* Interrupt controller */ qdev_connect_gpio_out_named(dev, "intr", 0, i8259_irq); diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 3b97186f75..dab5c9704e 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -70,6 +70,6 @@ DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus); -DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus); +DeviceState *piix4_create(PCIBus *pci_bus, I2CBus **smbus); #endif From patchwork Fri Jun 3 18:50:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869336 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 46AA6C433EF for ; Fri, 3 Jun 2022 18:56:18 +0000 (UTC) Received: from localhost ([::1]:57770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCT3-0007BT-CF for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:56:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCO8-00078n-IO for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:12 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:40795) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO6-00049m-6i for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:12 -0400 Received: by mail-ed1-x530.google.com with SMTP id w27so11283363edl.7 for ; Fri, 03 Jun 2022 11:51:09 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=x+b0Zu1GpfMHDnb2ysjGbnPDUKZFXcnMEMYykhWD4rs=; b=Ei93CIWqMJLoRBjXg5cXJZTCH7jUkaOANSpvzFw/7ySPTy1vFiTApeRjfpmK8HZ3XH TVW1By4KZERnZ5G7AVCW569s+p/VSVrP435QZzMA93nijzc8jviItX4ZRdZdHDOttQzM EVbaiLiG0DNXN746UQyUXQH6SpphiHmiQ0+aPDPUTSf4Kr0T2Kja4Pop66WxiDFRxt4j 1w2OMJQMGdhaM1/ktW6FB1MBkVvFvb8cbdkNhkaD4P+Cgiv+jWRKQzDPFMRHdsog+p2B 86anmce/J4t3Yh9DtpwQ1DQN3LeeDePPaqDFL/HuIPffQmGjKiAT0A+ROpychgri8QgL 5eFA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=x+b0Zu1GpfMHDnb2ysjGbnPDUKZFXcnMEMYykhWD4rs=; b=3CPoBVVKo7qIzdzWn3THmFp3Q43yE1RQCMw0Ak0FINf40Gx5/qgMOs93jieX+qmq/2 qZkEQ5eBBZB2+ImJoueI3AZvND0QfUGVfNH9W7LozyHV0dGpSXj9BIrHTbzOGtTaR8pF AOdx9UgmJt+nJloJrjluL+GmLnsvrcL1BwUxoer5h7QvvTWjfvKZeCzTNtgCjeBMsnDz jwM448w74EP3ZRxI+X4Rcp/Rd142bDzv8UE4kduqMnJ8RhePW/S11rgFmW4ElS5Gmixj 3UMFWXHiDAx/DSGKF0k/LQuSkIujEsPvR2NpEC3amx3RbDaoZndWmUcuIIxprvKD84UA pQBA== X-Gm-Message-State: AOAM533aTS54lT2k+yed1c2Qry6WpuPoVbNUR3bL0nV45p1TnoRINkzo NUkOPXNoMbk799QOZhvi9URKuaCdG2FBaQ== X-Google-Smtp-Source: ABdhPJwzis9RPDPNTemaStprXTug8QsHp2LQ9HX0JH9DCbJzco7bXmkVV13BvX5os9FGDlkKLzkmgQ== X-Received: by 2002:a05:6402:254e:b0:42b:4633:e53e with SMTP id l14-20020a056402254e00b0042b4633e53emr12485663edb.314.1654282268634; Fri, 03 Jun 2022 11:51:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:08 -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 06/11] hw/isa/piix4: QOM'ify PIIX4 PM creation Date: Fri, 3 Jun 2022 20:50:40 +0200 Message-Id: <20220603185045.143789-7-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=shentey@gmail.com; helo=mail-ed1-x530.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" Just like the real hardware, create the PIIX4 ACPI controller as part of the PIIX4 southbridge. This also mirrors how the IDE and USB functions are already created. Signed-off-by: Bernhard Beschow --- hw/isa/piix4.c | 24 +++++++++++++----------- hw/mips/malta.c | 5 ++++- include/hw/southbridge/piix.h | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 96df21a610..d97b245df3 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -49,6 +49,7 @@ struct PIIX4State { RTCState rtc; PCIIDEState ide; UHCIState uhci; + PIIX4PMState pm; /* Reset Control Register */ MemoryRegion rcr_mem; uint8_t rcr; @@ -261,6 +262,13 @@ static void piix4_realize(PCIDevice *dev, Error **errp) return; } + /* ACPI controller */ + qdev_prop_set_int32(DEVICE(&s->pm), "addr", dev->devfn + 3); + if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) { + return; + } + qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa[9]); + pci_bus_irqs(pci_bus, piix4_set_irq, pci_slot_get_pirq, s, PIIX_NUM_PIRQS); } @@ -271,6 +279,10 @@ static void piix4_init(Object *obj) object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); object_initialize_child(obj, "ide", &s->ide, "piix4-ide"); object_initialize_child(obj, "uhci", &s->uhci, "piix4-usb-uhci"); + + object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM); + qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", 0x1100); + qdev_prop_set_bit(DEVICE(&s->pm), "smm-enabled", 0); } static void piix4_class_init(ObjectClass *klass, void *data) @@ -312,7 +324,7 @@ static void piix4_register_types(void) type_init(piix4_register_types) -DeviceState *piix4_create(PCIBus *pci_bus, I2CBus **smbus) +DeviceState *piix4_create(PCIBus *pci_bus) { PCIDevice *pci; DeviceState *dev; @@ -322,15 +334,5 @@ DeviceState *piix4_create(PCIBus *pci_bus, I2CBus **smbus) TYPE_PIIX4_PCI_DEVICE); dev = DEVICE(pci); - if (smbus) { - pci = pci_new(devfn + 3, TYPE_PIIX4_PM); - qdev_prop_set_uint32(DEVICE(pci), "smb_io_base", 0x1100); - qdev_prop_set_bit(DEVICE(pci), "smm-enabled", 0); - pci_realize_and_unref(pci, pci_bus, &error_fatal); - qdev_connect_gpio_out(DEVICE(pci), 0, - qdev_get_gpio_in_named(dev, "isa", 9)); - *smbus = I2C_BUS(qdev_get_child_bus(DEVICE(pci), "i2c")); - } - return dev; } diff --git a/hw/mips/malta.c b/hw/mips/malta.c index e446b25ad0..be9f26d841 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1238,6 +1238,7 @@ void mips_malta_init(MachineState *machine) int be; MaltaState *s; DeviceState *dev; + DeviceState *pm_dev; s = MIPS_MALTA(qdev_new(TYPE_MIPS_MALTA)); sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal); @@ -1399,8 +1400,10 @@ void mips_malta_init(MachineState *machine) empty_slot_init("GT64120", 0, 0x20000000); /* Southbridge */ - dev = piix4_create(pci_bus, &smbus); + dev = piix4_create(pci_bus); isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + pm_dev = DEVICE(object_resolve_path_component(OBJECT(dev), "pm")); + smbus = I2C_BUS(qdev_get_child_bus(pm_dev, "i2c")); /* Interrupt controller */ qdev_connect_gpio_out_named(dev, "intr", 0, i8259_irq); diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index dab5c9704e..2357ce0287 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -70,6 +70,6 @@ DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus); -DeviceState *piix4_create(PCIBus *pci_bus, I2CBus **smbus); +DeviceState *piix4_create(PCIBus *pci_bus); #endif From patchwork Fri Jun 3 18:50:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869362 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 0C0E5C43334 for ; Fri, 3 Jun 2022 19:02:44 +0000 (UTC) Received: from localhost ([::1]:40794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCZH-0006XR-4C for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 15:02:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCOA-0007Cz-Ug for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:15 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:40794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO8-0004AZ-AE for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:13 -0400 Received: by mail-ed1-x52e.google.com with SMTP id w27so11283474edl.7 for ; Fri, 03 Jun 2022 11:51:11 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=zrOO35qYt2V3te37RfBRgK7i5bd7cvuNNbZAPeTba8M=; b=KfwlXeRL9BT7wL0pQQZdEg/bEwgMJtTKlmfsJrCFRRJCh+UC+ZYSvYEMqFfYoECV79 2+5UrjtqfLNUyr5MUWD+tUphg4/UHjI5Y8CNAyO4ji5xEnooJoQIzdxtQGxCpudGjep+ wLFXQ3lQzgIgiIFA6yqaj6yrp2GUoF9/PohRjfR22tQ1jyAm+wvUkNZBbFJNYtsCBFsa a2Xsyf1y0G33PjXU8JvMGqECZiNoVliGeqJeUSQSLtLMiYRzuH9fJ8qohfRUm7niQpio 0C+7P97+NktqkXT9LktPpLt99/jZZZA+HDJ0xdSEICccMcYsYybmsSDvG1e7E2IpDGmS jdjg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zrOO35qYt2V3te37RfBRgK7i5bd7cvuNNbZAPeTba8M=; b=k0/erGvKpA9dsWHN6PUBYQY/sN94A6w2LeJHBcImN+BLdi91/uFfT/jTYeHNAQ6uLW xCi5/d1NYu2ZpX6s1wyjGTLGCHKKlttR7HsCYKc3UJo+w8XzwkZf0ClV+KvIskampRZb Q69NRrWF2LkQa60/wPCTDTG8v59+zjbq6vdlv//8SDu35thZhhwbxKElldn9SHBeYXyV bqtDlvRSUqyRBd79evyXodjCKl7y7egl3eX74PGhm7XhAgL8ehl4eQ49EdNhOn7KkyCs HktBBzMTNd9ZLH6A4Gfx9C/do8ectjH+cHxskaiU5mKftzQ7zkBtWaWVgKyADBqLfg5n cC5Q== X-Gm-Message-State: AOAM532yyeAg+Ky4Myo8lONHQAxjuRCAv40LGbI4WYfQ5d/u3CQM2004 imQPkybKVhxmrSIkbQybZydFLFt0DNBT7A== X-Google-Smtp-Source: ABdhPJzHcpwiExyprP2Ts2kcgGQkpbWERlG3k68jzUIq3Qbw4/RI1KrNNEZITVwQaD1zqiIOUbnXfg== X-Received: by 2002:a05:6402:11ca:b0:42b:d282:4932 with SMTP id j10-20020a05640211ca00b0042bd2824932mr12449383edw.421.1654282270527; Fri, 03 Jun 2022 11:51:10 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:09 -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 07/11] hw/isa/piix4: Inline and remove piix4_create() Date: Fri, 3 Jun 2022 20:50:41 +0200 Message-Id: <20220603185045.143789-8-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=shentey@gmail.com; helo=mail-ed1-x52e.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" During the previous changesets piix4_create() became a trivial wrapper around more generic functions. Modernize the code. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix4.c | 13 ------------- hw/mips/malta.c | 5 ++++- include/hw/southbridge/piix.h | 2 -- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index d97b245df3..15f344dbb7 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -323,16 +323,3 @@ static void piix4_register_types(void) } type_init(piix4_register_types) - -DeviceState *piix4_create(PCIBus *pci_bus) -{ - PCIDevice *pci; - DeviceState *dev; - int devfn = PCI_DEVFN(10, 0); - - pci = pci_create_simple_multifunction(pci_bus, devfn, true, - TYPE_PIIX4_PCI_DEVICE); - dev = DEVICE(pci); - - return dev; -} diff --git a/hw/mips/malta.c b/hw/mips/malta.c index be9f26d841..7a0ec513b0 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1237,6 +1237,7 @@ void mips_malta_init(MachineState *machine) int fl_idx = 0; int be; MaltaState *s; + PCIDevice *piix4; DeviceState *dev; DeviceState *pm_dev; @@ -1400,7 +1401,9 @@ void mips_malta_init(MachineState *machine) empty_slot_init("GT64120", 0, 0x20000000); /* Southbridge */ - dev = piix4_create(pci_bus); + piix4 = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), true, + TYPE_PIIX4_PCI_DEVICE); + dev = DEVICE(piix4); isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); pm_dev = DEVICE(object_resolve_path_component(OBJECT(dev), "pm")); smbus = I2C_BUS(qdev_get_child_bus(pm_dev, "i2c")); diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 2357ce0287..9a2dd93c2d 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -70,6 +70,4 @@ DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus); -DeviceState *piix4_create(PCIBus *pci_bus); - #endif From patchwork Fri Jun 3 18:50:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869337 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 A3CB6C43334 for ; Fri, 3 Jun 2022 18:56:18 +0000 (UTC) Received: from localhost ([::1]:57814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCT3-0007DH-O2 for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:56:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCOB-0007DF-0W for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:16 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:37773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCO9-0004BC-Dj for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:14 -0400 Received: by mail-ej1-x62f.google.com with SMTP id gl15so3736507ejb.4 for ; Fri, 03 Jun 2022 11:51:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=z2E0qTaPT0rwn/y0lNnZ/aNt1ZAGrawia4pom9sqpdw=; b=WNAaVTapejdu7NDn2BAGoV9512worsjW+Oa5ASgUHmOEh2IGXHvnQWkSSJ/Zu+PMt8 TuwVIHOvSkXYCU/nXjXFqzW8SGPcHPnFuOnQbbNQkkxrtOsJeXdLZsqIrSKNNNIlnUmc MVkwkBIFoXy5B6AMsxSy0pLd9ZmxFYcGqSGMq7CTUm9fCJ5r2qxOjHEHLrW6+etTPsSL NCzJ/5gYMWwmcZvE3Fc7uxJ5lDPN56QugGb/aJCuIcUE9ZFKkFJNf1JlA2AwzqzVmTL3 q0sOEsBWgZkqkLkSgrqsbrbp0eKs6v4+xWCPozkFrbB5yzlh8Ox1WqK6SxfwkVAc1nPM U27w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=z2E0qTaPT0rwn/y0lNnZ/aNt1ZAGrawia4pom9sqpdw=; b=sX9SicD88KuDGYnXffgfIF+HpEAYdZxt3oIwEcI22ch/jXH1nYKzcsennRFxLOJ5U/ lKic6fW641JoOZQNsOWfSfwXj3vo9Km+BjfwSL2Kh6VY3qZqfosKZBW8Zj3vDHbTRZJJ /HdAoz8FQmkGMZ8gfUG3qZraH2hjMRnWshfJ6hmXQPPEDDhypRdCQncbYvZgU2lnnlJ0 ZHRgFaVQmz0R25AlCQ5d5adU6dGPs2kIkFP9ausSCgKn+MgaSUMGTfWnqiAXmmQz5Bwe scAvYao9ds3T6VVvDxIWIRhHSDWij/mhMxrhTI/HFoI/Yv/RsQe195Y80eTX51q+Tepv Cdyw== X-Gm-Message-State: AOAM533JAtpCgB+qgxJkOyst+sdqiunIEb3P3A1OBYtvzqKIyMHiANZD URt1yUDAyY+tfBbmBWr0QcvTFST4RyXDBg== X-Google-Smtp-Source: ABdhPJyri6RdwNn92N0sCtiTa1ATygvi+4UANLSAGGzVRQIDocxQEe8dfBYpxHXRe9V46gqWDx+LOg== X-Received: by 2002:a17:907:7642:b0:706:fd3a:61f0 with SMTP id kj2-20020a170907764200b00706fd3a61f0mr9785725ejc.503.1654282271729; Fri, 03 Jun 2022 11:51:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:11 -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 , Mark Cave-Ayland Subject: [PATCH v4 08/11] hw/isa/piix3: Move pci_map_irq_fn near pci_set_irq_fn Date: Fri, 3 Jun 2022 20:50:42 +0200 Message-Id: <20220603185045.143789-9-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=shentey@gmail.com; helo=mail-ej1-x62f.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" The pci_map_irq_fn was implemented below type_init() which made it inaccessible to QOM functions. So move it up. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix3.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index d96ce2b788..c7a9014c3f 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -78,6 +78,17 @@ static void piix3_set_irq(void *opaque, int pirq, int level) piix3_set_irq_level(piix3, pirq, level); } +/* + * Return the global irq number corresponding to a given device irq + * pin. We could also use the bus number to have a more precise mapping. + */ +static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) +{ + int slot_addend; + slot_addend = PCI_SLOT(pci_dev->devfn) - 1; + return (pci_intx + slot_addend) & 3; +} + static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) { PIIX3State *piix3 = opaque; @@ -350,17 +361,6 @@ static void piix3_register_types(void) type_init(piix3_register_types) -/* - * Return the global irq number corresponding to a given device irq - * pin. We could also use the bus number to have a more precise mapping. - */ -static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) -{ - int slot_addend; - slot_addend = PCI_SLOT(pci_dev->devfn) - 1; - return (pci_intx + slot_addend) & 3; -} - PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus) { PIIX3State *piix3; From patchwork Fri Jun 3 18:50:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869340 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 9D7CCC43334 for ; Fri, 3 Jun 2022 18:59:20 +0000 (UTC) Received: from localhost ([::1]:36330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCVz-0003Q1-Lg for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCOC-0007Dx-9I for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:16 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:37776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCOA-0004Bu-Ml for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:16 -0400 Received: by mail-ej1-x632.google.com with SMTP id gl15so3736608ejb.4 for ; Fri, 03 Jun 2022 11:51:14 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=IxlhUXhWWLGkh4tQNKHeVva8WuCFxq7n16eNJytTjtI=; b=AAegG21Trd/rndetxiIlYtW7EGuzL2OUeiwu5ArvPmOKDsEscLwX4Gcj0bOuOqWHMS 8TJfKNl2NP8um+zkirmR09qLkdaaTxVKwqFJwnmEwM6uaRiCRy3vEsqXpgaDZ7CDfp9l Hl1BwgqrOoLCrqzkYKq806qIfhRjLoUJdjnPJ2k+l50HVi+W17Fl6Y5wJTOrTbRj84Zi lG8odoDAeBQvPcPuh0DOd5UDt3sPbNk2aHWj5g8rjFjUfqJsKs1tyCRIbPxkm+zlFNkp Mdoe9tgqPIxP5SZ85PhpkeczMbLIcSO4MClvo/Ic9usu71akkBiCRLhmY8bbTLVHod4W SHCg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=IxlhUXhWWLGkh4tQNKHeVva8WuCFxq7n16eNJytTjtI=; b=bjlRXKbew/LZJvg3bXzyQJiRJLo3FxZdqaWVar7KcLTKBAu+NZioCgHPhR7DTvDOKR 5ieAKlTusJqCG5y+EmHgBCq7hW4xfx3ZbvfaIu6/UWEhvslZgcdAkzmFEjRgk5NSznX7 kJtW5e5MrjabQxDd14bxvwL5ulyyiX2gm0EiC/iFRGt5FO9K1mlCy9B+G4oeASwe20Lc uLtFn7MymqGanCJgkSrE4scZ74QuaWfDGy6k8aUpF+0EZLwqPFbgZJ/yYHq54lEKwHY1 VupcvYbIIzfnAM10A+baG/p/pT1CcS2C/QGCA58hRekT25+btZDj/stNEDF/IuSK3IbI E3fg== X-Gm-Message-State: AOAM532oU7L32tzgaeVVkDJpXYtYUmNcO/vU4HEjtx8833y4Jdvmbxcq hPTIj2YkXCfui7W6BgaYQjJSmfxqLqnveg== X-Google-Smtp-Source: ABdhPJyOkrRwp8QCGD3s8IF4O3QQRHmgQ0EFLmAPWXf8Gk0WlFOHnqT8AQMDpzSR8LMbppV8gDMFRw== X-Received: by 2002:a17:906:c155:b0:708:21b1:dcf6 with SMTP id dp21-20020a170906c15500b0070821b1dcf6mr10003170ejc.661.1654282273135; Fri, 03 Jun 2022 11:51:13 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:12 -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 09/11] hw/isa/piix3: QOM'ify PCI device creation and wiring Date: Fri, 3 Jun 2022 20:50:43 +0200 Message-Id: <20220603185045.143789-10-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=shentey@gmail.com; helo=mail-ej1-x632.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" PCI interrupt wiring was performed in create() functions which are obsolete. Move these tasks into QOM functions to modernize the code. In order to avoid duplicate checking for xen_enabled() the realize methods are now split. Signed-off-by: Bernhard Beschow --- hw/isa/piix3.c | 67 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index c7a9014c3f..de532cc692 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qemu/range.h" +#include "qapi/error.h" #include "hw/southbridge/piix.h" #include "hw/irq.h" #include "hw/isa/isa.h" @@ -277,7 +278,7 @@ static const MemoryRegionOps rcr_ops = { .endianness = DEVICE_LITTLE_ENDIAN }; -static void piix3_realize(PCIDevice *dev, Error **errp) +static void pci_piix3_realize(PCIDevice *dev, Error **errp) { PIIX3State *d = PIIX3_PCI_DEVICE(dev); @@ -302,7 +303,6 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix3; dc->hotpluggable = false; - k->realize = piix3_realize; k->vendor_id = PCI_VENDOR_ID_INTEL; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; @@ -326,11 +326,28 @@ static const TypeInfo piix3_pci_type_info = { }, }; +static void piix3_realize(PCIDevice *dev, Error **errp) +{ + ERRP_GUARD(); + PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); + PCIBus *pci_bus = pci_get_bus(dev); + + pci_piix3_realize(dev, errp); + if (*errp) { + return; + } + + pci_bus_irqs(pci_bus, piix3_set_irq, pci_slot_get_pirq, + piix3, PIIX_NUM_PIRQS); + pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq); +}; + static void piix3_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->config_write = piix3_write_config; + k->realize = piix3_realize; } static const TypeInfo piix3_info = { @@ -339,11 +356,33 @@ static const TypeInfo piix3_info = { .class_init = piix3_class_init, }; +static void piix3_xen_realize(PCIDevice *dev, Error **errp) +{ + ERRP_GUARD(); + PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); + PCIBus *pci_bus = pci_get_bus(dev); + + pci_piix3_realize(dev, errp); + if (*errp) { + return; + } + + /* + * Xen supports additional interrupt routes from the PCI devices to + * the IOAPIC: the four pins of each PCI device on the bus are also + * connected to the IOAPIC directly. + * These additional routes can be discovered through ACPI. + */ + pci_bus_irqs(pci_bus, xen_piix3_set_irq, xen_pci_slot_get_pirq, + piix3, XEN_PIIX_NUM_PIRQS); +}; + static void piix3_xen_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->config_write = piix3_write_config_xen; + k->realize = piix3_xen_realize; }; static const TypeInfo piix3_xen_info = { @@ -365,27 +404,11 @@ PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus) { PIIX3State *piix3; PCIDevice *pci_dev; + const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE + : TYPE_PIIX3_DEVICE; - /* - * Xen supports additional interrupt routes from the PCI devices to - * the IOAPIC: the four pins of each PCI device on the bus are also - * connected to the IOAPIC directly. - * These additional routes can be discovered through ACPI. - */ - if (xen_enabled()) { - pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, - TYPE_PIIX3_XEN_DEVICE); - piix3 = PIIX3_PCI_DEVICE(pci_dev); - pci_bus_irqs(pci_bus, xen_piix3_set_irq, xen_pci_slot_get_pirq, - piix3, XEN_PIIX_NUM_PIRQS); - } else { - pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, - TYPE_PIIX3_DEVICE); - piix3 = PIIX3_PCI_DEVICE(pci_dev); - pci_bus_irqs(pci_bus, piix3_set_irq, pci_slot_get_pirq, - piix3, PIIX_NUM_PIRQS); - pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq); - } + pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); + piix3 = PIIX3_PCI_DEVICE(pci_dev); *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); return piix3; From patchwork Fri Jun 3 18:50:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 12869335 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 02799C433EF for ; Fri, 3 Jun 2022 18:56:10 +0000 (UTC) Received: from localhost ([::1]:57490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCSu-000703-8Q for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 14:56:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCOE-0007Hp-Ge for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:18 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:41783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCOC-0004CH-Ld for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:17 -0400 Received: by mail-ej1-x62c.google.com with SMTP id u12so17610052eja.8 for ; Fri, 03 Jun 2022 11:51:16 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=QHXHopLynfUeqrSBaWrq8DdgLg5VwHyVMXO3auGVcqg=; b=H3xiMqPyhHZZi5zDwocEyX7Z8lV8FMMfO4LvC5nWz7njnG1UY+8iY6soXiAdxqUZcj ib7HgYRXPb/f6Wak4bXTMbJF4rKUMuB06s2Xj4rUXNbHOuENYvU/K6i7Ao4tj2vHe9rH iK+bznS7WBdH9+46qAL+CQUpcCWpYiSwEtXLWO3pixlYViVYGeMKNcK8b8IdkafvKcx+ 65fircniyo9XLCI3PkSSkff8ecLmF9dk6iJCHUFrb3RsLTsvoC5x7wzLuZaJMp1gTTed fXaMvGv9mWiQDzH8/YdFXgcQ1kDYUW23faEMmXgUQ1YQ6KBqvA+BmmIOMbiwJK+CqJmG h9/A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=QHXHopLynfUeqrSBaWrq8DdgLg5VwHyVMXO3auGVcqg=; b=BI+05G6cWmOTwGz8LM5pQDmvEhLtqOpnU4kQVQnj85AAW0/oZ4DaDsT7v71zkJ/C+i ZH9PddwDPsML1W49mvB6HaEMuqYHbxx6KRlfnjhq9rPsBTQzilUHJ1QRePHB/MpKrkns PXsZTqPRp6uQtyuceoC28Dy1aCBVcV15itChsb/vDTuRC26NA1ygz5Cy0uZaBjwIUe1r WxsKb2Ra7GZ2fCPbppos/YkLX+hpBqXUQF/3LoNo3G1SFvtcWqiCrprFEfkEET45fndS 4uGy/LJXFfmNb7pTJnOJ9PfzPSTxLOBaBPuN4QYKSSluWqfxPvKs9omxL4xgt9A68MdF p1GQ== X-Gm-Message-State: AOAM532Uq7t+2+hdHxHVqDAfdZ1hXQWKg65wKmEZIwG7mYdDtA3tuiRd 5KYjR7sISZo2pwVM1dSpJoXpV9mwWooUog== X-Google-Smtp-Source: ABdhPJzw/AXHHEuT4JykRq0JuJnLe5uBPc9/3jO9Dz8K0u2fj3tq8mNhvlQmx9/Dja3n8QvV2j5y+A== X-Received: by 2002:a17:907:7f06:b0:6fe:b81f:f885 with SMTP id qf6-20020a1709077f0600b006feb81ff885mr9999583ejc.621.1654282275117; Fri, 03 Jun 2022 11:51:15 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:14 -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 , Mark Cave-Ayland Subject: [PATCH v4 10/11] hw/isa/piix3: Factor out ISABus retrieval from piix3_create() Date: Fri, 3 Jun 2022 20:50:44 +0200 Message-Id: <20220603185045.143789-11-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=shentey@gmail.com; helo=mail-ej1-x62c.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" Modernizes the code. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland --- hw/i386/pc_piix.c | 3 ++- hw/isa/piix3.c | 3 +-- include/hw/southbridge/piix.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index d6668b7c06..c884d1a489 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -207,9 +207,10 @@ static void pc_init1(MachineState *machine, pci_memory, ram_memory); pcms->bus = pci_bus; - piix3 = piix3_create(pci_bus, &isa_bus); + piix3 = piix3_create(pci_bus); piix3->pic = x86ms->gsi; piix3_devfn = piix3->dev.devfn; + isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); } else { pci_bus = NULL; i440fx_state = NULL; diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index de532cc692..c6ff7795f4 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -400,7 +400,7 @@ static void piix3_register_types(void) type_init(piix3_register_types) -PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus) +PIIX3State *piix3_create(PCIBus *pci_bus) { PIIX3State *piix3; PCIDevice *pci_dev; @@ -409,7 +409,6 @@ PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus) pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); piix3 = PIIX3_PCI_DEVICE(pci_dev); - *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); return piix3; } diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 9a2dd93c2d..f805fb8683 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -68,6 +68,6 @@ DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" -PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus); +PIIX3State *piix3_create(PCIBus *pci_bus); #endif From patchwork Fri Jun 3 18:50: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: 12869363 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 82C64C43334 for ; Fri, 3 Jun 2022 19:02:47 +0000 (UTC) Received: from localhost ([::1]:40842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxCZK-0006ZJ-HO for qemu-devel@archiver.kernel.org; Fri, 03 Jun 2022 15:02:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxCOF-0007Jk-Mu for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:19 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:36607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxCOE-0004CR-8l for qemu-devel@nongnu.org; Fri, 03 Jun 2022 14:51:19 -0400 Received: by mail-ed1-x52b.google.com with SMTP id fd25so11315430edb.3 for ; Fri, 03 Jun 2022 11:51:17 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Jc4MKfgMJx8u8UCAhQmdavk8QSdZLeuW9RwLxX0XHzY=; b=dSrA32Bq09z+93G3SA44grIgVCtQ8Vzgf0Upp/Dk+ileI8/Tsu1lXNogB5QR+nEu4r PC+Cgi+ZmG40SH42np8w4+VaB7WJmFI5zgLyfqWdXCYyw5EbTPvGJwiZfZkBpl/rtypy pspfCXKIUU+NnEiGriiTbEevGJGKc5Gj6ZoQDkCLugInvRPMWZl3QK9b3elFDOk/6S3E 1KPxneN5KeqLGqofbdBA94Eqxn3kRljuhkIG7vOCbB8ktzBa2C9xjxuTFreiKWdYgWoH CO8kTsjymCyyq0gDRdwLs/1SPgVJMJBz8qOOl/GHBCVIIqL+oANLlaGZQvET2xVr3jT1 xPNg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jc4MKfgMJx8u8UCAhQmdavk8QSdZLeuW9RwLxX0XHzY=; b=oeyhjk8bVRTCq1CrKqNwQyG8E2NQON9nhC1NnRLcuPNqoalOsn9ToZ2fpX6pxAELjP EiwVO6+9BMUDS7SYpd8wwABNyJwIvEHpra/wb9x06hWTCXe2AtfdbbNGcmGaP9J1ury/ u1Abk/Hz4Ay9BFWcEng0p07+azVappNzdWDkk0SkZFDN5FPVdQnB+Kgto1OsjAtSjFfY o0+Ijp/qBEtAwGUfOP2IyjGj6i22pKN6/kOwBi/KGpo6/8zEooSSvL89HbOCvkCn7I52 LS6Nu5feA4prLpC4CjUiXyOaoc8yywhL/ZLWwh/fjThoGdD67/q5MktklL9+OALsbixf bGvg== X-Gm-Message-State: AOAM530JYX97vQglwON5tmKP9FQCmm7yKfpzW65uY2hB+/eCyw/a/5Zt EUU4//5nYnSoztKCJVIMJoW4wi2FYsCvYA== X-Google-Smtp-Source: ABdhPJzbQTZ0RbuNdOajp3U7Ts2M/O0282vsaiE37xNi/hpOeJHdz8AIWiYLFnNX/ITIiD9qji0uhw== X-Received: by 2002:aa7:c55a:0:b0:42a:adfa:9150 with SMTP id s26-20020aa7c55a000000b0042aadfa9150mr12325038edr.57.1654282275973; Fri, 03 Jun 2022 11:51:15 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 11:51:15 -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 11/11] hw/isa/piix3: Inline and remove piix3_create() Date: Fri, 3 Jun 2022 20:50:45 +0200 Message-Id: <20220603185045.143789-12-shentey@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603185045.143789-1-shentey@gmail.com> References: <20220603185045.143789-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=shentey@gmail.com; helo=mail-ed1-x52b.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" During the previous changesets piix3_create() became a trivial wrapper around more generic functions. Modernize the code. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- hw/i386/pc_piix.c | 6 +++++- hw/isa/piix3.c | 13 ------------- include/hw/southbridge/piix.h | 2 -- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c884d1a489..b58fbd4815 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -197,6 +197,9 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { PIIX3State *piix3; + PCIDevice *pci_dev; + const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE + : TYPE_PIIX3_DEVICE; pci_bus = i440fx_init(host_type, pci_type, @@ -207,7 +210,8 @@ static void pc_init1(MachineState *machine, pci_memory, ram_memory); pcms->bus = pci_bus; - piix3 = piix3_create(pci_bus); + pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); + piix3 = PIIX3_PCI_DEVICE(pci_dev); piix3->pic = x86ms->gsi; piix3_devfn = piix3->dev.devfn; isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index c6ff7795f4..01c376b39a 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -399,16 +399,3 @@ static void piix3_register_types(void) } type_init(piix3_register_types) - -PIIX3State *piix3_create(PCIBus *pci_bus) -{ - PIIX3State *piix3; - PCIDevice *pci_dev; - const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE - : TYPE_PIIX3_DEVICE; - - pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); - piix3 = PIIX3_PCI_DEVICE(pci_dev); - - return piix3; -} diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index f805fb8683..2693778b23 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -68,6 +68,4 @@ DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" -PIIX3State *piix3_create(PCIBus *pci_bus); - #endif