From patchwork Wed Oct 18 13:12:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850826 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=SrSJkTYO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WZP0sg3z20Pd for ; Thu, 19 Oct 2023 00:16:13 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6ME-0007PL-D0; Wed, 18 Oct 2023 09:13:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6Lk-00075N-Qy for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:39 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6Lh-0000eh-0t for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:35 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c523ac38fbso46009641fa.0 for ; Wed, 18 Oct 2023 06:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634749; x=1698239549; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WuH7XtOKs5G9Ns2H+BnAt+HjsoiLIzrJP7Sikrea0Vo=; b=SrSJkTYOkevL7GWhmn+UksdlmmebYoVEuuwc/4qVjplfAedN/SrDBvnNvee/v8vT4H ujqxKqDUfDXjgu+7zT6y8HyCMyr5vdGcDu89V/C8Zg60x7QeeFehfct5l10+SokgFsE3 hUA2eJ9j7IK+Y6T3HVYeUAMOk+Dvaz+HLHyHxsnkJYPHIol0Thq6g7DSw4lwOdmJgafp Ey/ID04u2Re5GcQ2qTdegqtyV7sOp3dgn6fCfTcT4LGDFn1SCM8SqzFe8/EJM/KfEgAA qcxj6UokGAMjMzDGqqX+apre3Cv/m+pqo9/JxBDOF/dMrAAIxxXISoHifUHx7ToJBWXT KS5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634749; x=1698239549; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WuH7XtOKs5G9Ns2H+BnAt+HjsoiLIzrJP7Sikrea0Vo=; b=d6jv8nkP5erkKIfzW9CY5sP7V4yr32IXzy94ZXaCKPL7ka70s1teL6ygE6l/tO32YF NT1jDSTpaHGqfyL8eRp9T9uttMFJak8kpB0xGhTzUZodcT9eEgUpLjXiOoK0wpfqYHvr aWblVjGIAWyaECBpx7sD4q2GU3tWN5R7kt5ND8dZnFG3a6QVPdvMpAxTYtg94Qj7xD1n yfB8+6+hl+5QPGEw9F4T+G9Da7+AAkXPTvnml4PfQGrRh9IrvVL9rxLaoKVG1RYAkccc YLloAiJCnOwQac+ZGbQOMAy64SlP0B0YhHstizspndav5712rmWEkm8XfTvkIq/WQT4r tjxg== X-Gm-Message-State: AOJu0YyV8eBLu4D+c9dG5UoSvf2W0IHz/BQcnUTn74BaWo4n+IO8gZQB NhfFZURZucqbJxf0MupgEXtKyAr1Dm6KxdpPMfM= X-Google-Smtp-Source: AGHT+IHLPxsD0sCBOFgs9a222m+CPiKUuLKlMJozJW90w1t4MDN0n0qh0oWAR1/30qtstysx+luFhA== X-Received: by 2002:ac2:4d86:0:b0:500:d970:6541 with SMTP id g6-20020ac24d86000000b00500d9706541mr3793512lfe.39.1697634749089; Wed, 18 Oct 2023 06:12:29 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id b42-20020a509f2d000000b0053e43492ef1sm2855045edf.65.2023.10.18.06.12.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:12:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/8] hw/sd/pxa2xx: Realize sysbus device before accessing it Date: Wed, 18 Oct 2023 15:12:13 +0200 Message-ID: <20231018131220.84380-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org sysbus_mmio_map() and sysbus_connect_irq() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/pxa2xx_mmci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 124fbf8bbd..9f7a880bac 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -483,11 +483,11 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, dev = qdev_new(TYPE_PXA2XX_MMCI); sbd = SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(sbd, &error_fatal); sysbus_mmio_map(sbd, 0, base); sysbus_connect_irq(sbd, 0, irq); qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma); qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma); - sysbus_realize_and_unref(sbd, &error_fatal); return PXA2XX_MMCI(dev); } From patchwork Wed Oct 18 13:12:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=nwLHPQxc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WWG50Scz20cx for ; Thu, 19 Oct 2023 00:13:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6MR-0007ds-JI; Wed, 18 Oct 2023 09:13:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6Lq-00075p-AF for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:46 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6Lk-0000fM-WB for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:42 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9b6559cbd74so1176723666b.1 for ; Wed, 18 Oct 2023 06:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634755; x=1698239555; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AJfJ06RDafLRLEOQTU58KKvhb0KtBRhLr9Bft9JesEY=; b=nwLHPQxcxrq0eIiAVJQcQdEJTcBjisfsAsYuM+ZewX85WmC0wdX/3bzAZGTLo9mucG NJzDa41pPtkflueCbvcHh/xzOWCYid6oIKuCUmWH+fxV0NtHuKn/YKprso7D6zs81pIB mjh4WE1vRoXLdxysBEm34RaNrVTlzL9bRtQ3IHVLlsWIW5vkuUQviNZgdTrE0nWDQN+8 vmqZYGz7TyKrmgePGS/v+0Co5AcgBdv1dliA7/Ld640ztZ/IMYExicsQD5NvdUNYKhAx voc0Jdz/TTJcF/jpFcX3JOFAtzkw/5LMMsFQM3JB1Bb7YAAe/R/B2HX8PdEj2+dXsoH0 cFNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634755; x=1698239555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AJfJ06RDafLRLEOQTU58KKvhb0KtBRhLr9Bft9JesEY=; b=kERiIwSSaDxCeKJUSQbEHGwq8p4oHDfnRn5vBinaFNglRV7VICXh4owyBzVKv8sH9j +ajXu6BnBVOgchg/RCQqOHBJUZmRpmYgUaVkDMlbSIrjb0AKwDpFllr86AneQWToGjHt GDA/e0aZ5d3GXzyIi4O6sezW+YeXfOvl1yqdA30dMjzx0TSwYTQz6HvAFmi3iPVT3dZD heNxdFoG+2qdvGWyXiioTz2wVtH5LgbMYc0/yd8Mg1J6nDrnoykObGKzwKDJraE/Jzbv tkW3LclF1pDs+md10vLbxKr250X01YOUxgCdh+P+RsuMDn/+m5jhujN5O0Jya3tDDuJt Omkg== X-Gm-Message-State: AOJu0Yxdb3EVJ2r+ughy1xv4UVBYif6UJCqd6id1AWMK3ftolj6FG65c Xs5tCGNLdfbS1dNUyAvbr18hUbGC+pPmaPlGipo= X-Google-Smtp-Source: AGHT+IEhye1VJhb3Hz7aHt6f4DRfkmZq7F7Sf0JcZYdaawkRznya3z7iWohlpu6DW7Pr3nnkIUnd3Q== X-Received: by 2002:a17:906:fe4b:b0:9ae:6388:e09b with SMTP id wz11-20020a170906fe4b00b009ae6388e09bmr3768847ejb.40.1697634754942; Wed, 18 Oct 2023 06:12:34 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id og49-20020a1709071df100b009c657110cf2sm1664374ejc.99.2023.10.18.06.12.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:12:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/8] hw/sd/pxa2xx: Do not open-code sysbus_create_simple() Date: Wed, 18 Oct 2023 15:12:14 +0200 Message-ID: <20231018131220.84380-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/pxa2xx_mmci.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 9f7a880bac..4749e935d8 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -479,13 +479,8 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, qemu_irq irq, qemu_irq rx_dma, qemu_irq tx_dma) { DeviceState *dev; - SysBusDevice *sbd; - dev = qdev_new(TYPE_PXA2XX_MMCI); - sbd = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(sbd, &error_fatal); - sysbus_mmio_map(sbd, 0, base); - sysbus_connect_irq(sbd, 0, irq); + dev = sysbus_create_simple(TYPE_PXA2XX_MMCI, base, irq); qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma); qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma); From patchwork Wed Oct 18 13:12:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850830 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Kh8udEtt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WZl4f0Mz20Pd for ; Thu, 19 Oct 2023 00:16:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6Mc-0007tg-Py; Wed, 18 Oct 2023 09:13:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6Lt-000768-HE for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:47 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6Lr-0000hN-2B for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:45 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9ad8a822508so1111690166b.0 for ; Wed, 18 Oct 2023 06:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634760; x=1698239560; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e3Wrm2+hEgcQGJPeHM5sv3LDR90OXcyWyLu0fpUZ2rw=; b=Kh8udEtt+dWC2Gmh54JzfmUZD7PGqUegm5Xw+jEe4HwJ23FSD2UiIhqUONX12uKVCc IWSO1zckDCSXF6ARHGaRkoNIDejbkBJQgPZeFHPpIGQEbDd9DmAdlwSE9xYgymBGJHdw NeTIEgN3xC/PyzdZuV4qh4ZAVl45FrEtMDLln0Iou2ZOhXHWJLZCC9PB1lYfE/rwp8cO eODPn2cp9i5/9IVae0uMZFt7Q/nZL9v7JsSE1tD4dbo1ctL0vj6/PG/uHIwkICAYex+H 2OBVY9JV7t3l5Lx8uzOvxWny2HxYFew0cvuCxNW8jpprTBjeE729PllxDnn13N6Xn5as aV9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634760; x=1698239560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e3Wrm2+hEgcQGJPeHM5sv3LDR90OXcyWyLu0fpUZ2rw=; b=OxhUN3r8zh3wLDBPdajgPTNN/T0Xxk5yAecp4Xve0wCv8eA4FnC2nR1Kvpd01B9PAM 9U/LTMx4jMW7J2XDFR5czqOCCasMpS32ddJSd7l3xDMU77ZtrxsA1OvaxeKB14YloS7t OeeqNbRcKMLAF96bEz6W36AGwD6DfagojnSDsoY8Ep3LBCNXDgxhW0MEU1UBHpmmvedP 5VlmTl0G2vEu8kUfjZRlpgYkT+IAp/TfZkv4BYeX+/g9L3D3cks0mFzyukIAItLJbeH7 WdSeNzTCmGodAEgIN4PQDqXoZa09UO9PKWwXSUWZsNofeSUjHJYZFcZXeo5fYNVIEP6O wA0w== X-Gm-Message-State: AOJu0Yxy1Ln9k5RuzXc7KUTpmdzUljxKhFrK/uz27a9O2oJ8qtNnusWp 7DBfJvDuhi0RmzloVxaWwTOIg4Z50QtuXoQyalk= X-Google-Smtp-Source: AGHT+IGrJh/dXC82ML7++cZkWfhm29VHzsu3GfQ0NX8aAyqBEG+jc6d1/tsU3cGYW4D8ixTLWf9sUQ== X-Received: by 2002:a17:907:97c3:b0:9c5:8a6b:29e with SMTP id js3-20020a17090797c300b009c58a6b029emr4246757ejc.13.1697634760760; Wed, 18 Oct 2023 06:12:40 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id gz8-20020a170906f2c800b009bd9ac83a9fsm1639471ejb.152.2023.10.18.06.12.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:12:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 3/8] hw/pcmcia/pxa2xx: Realize sysbus device before accessing it Date: Wed, 18 Oct 2023 15:12:15 +0200 Message-ID: <20231018131220.84380-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé --- hw/pcmcia/pxa2xx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c index fcca7e571b..e7264feb45 100644 --- a/hw/pcmcia/pxa2xx.c +++ b/hw/pcmcia/pxa2xx.c @@ -142,15 +142,12 @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, hwaddr base) { DeviceState *dev; - PXA2xxPCMCIAState *s; dev = qdev_new(TYPE_PXA2XX_PCMCIA); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - s = PXA2XX_PCMCIA(dev); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - return s; + return PXA2XX_PCMCIA(dev); } static void pxa2xx_pcmcia_initfn(Object *obj) From patchwork Wed Oct 18 13:12:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=lEcKY7oq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WYx2jXtz20Pd for ; Thu, 19 Oct 2023 00:15:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6MQ-0007cq-O6; Wed, 18 Oct 2023 09:13:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6M0-0007D7-JB for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:53 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6Lx-0000ls-Gs for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:51 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-53e84912038so6548852a12.1 for ; Wed, 18 Oct 2023 06:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634767; x=1698239567; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IrXKI6jVLRlYzi/YxZFiozSO1YVRsr5CmuAToS28wAk=; b=lEcKY7oq2aVDkJm9QEs7FF5I3qgwi4I4I4k6eW8OU5ATE+X7eqO5wqD0bUs6Jg9uu5 oLu/4FPHja7mGpsNAA+K87PzaeRvAybNfUn6bvQoT6FmKJDN/Wi5KpvQvph7DwcpYNMu H+xZNuAXf+wf917HlcW2QgBeSMm+HD3MfZhaIahiHwEL6A6wlz/NH5/w+ZB8ZFuAHlUh 5QIw0vfW54YY5DuIRTBG4i/BDXM4W7CpYkLqhhW7iNZ0M2CYtPNARZgo5MWi9WkFDcVl LcnAVhkA5Vr4S13bo7vi5n5r363CvUgm9DPTC4CZw/TewOYMsrxrKlx665e9gE290FU4 YKjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634767; x=1698239567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IrXKI6jVLRlYzi/YxZFiozSO1YVRsr5CmuAToS28wAk=; b=Cps3aA+g6YzjAQcDPwPYmOnrBv0EYe4bcSLLKJPBbpkCuC/V5r3CGshR6RuLjgGC4R wOdsdCm8hbv2matO/RDanyT4/+XK2dJfzyfZQaHmJrTO4bNf3IpLvAK7RKxYtS3mudFY wqTWFlgjh3vOTQHagQwMEZyNf/3hjFj5pNqGJU3GLnb8T11sMYEM9WGK620/gSgoRYfo BjCLLP4qHcP2UBhiXngo8VkWro10AEaBMYfE36caFYeBpkaARkoSX/VlDOLdoOtu1IL0 E59papLGacM1Bi8Fse5+wOYZx/WRKVlY/RbmKvtkeul9DvXoMhantbj4KJ/jOmRyHNLh s14Q== X-Gm-Message-State: AOJu0Yxd+penHoY8/0QWKgDSs1kO2crgcQA5GE2SUgpKUDIUCluwaiNf moDWEf4nl+aTEG88GradZq1Jg9kct7hY4bPiIhk= X-Google-Smtp-Source: AGHT+IG28bY9i0EuG4kzlcU6ITOWPTBzM5x1JQJeFr/IgKFr7SknhPRFLxlzUw1DwqToMA3nBd996A== X-Received: by 2002:a17:906:7310:b0:9be:53ef:211d with SMTP id di16-20020a170906731000b009be53ef211dmr3340434ejc.72.1697634766801; Wed, 18 Oct 2023 06:12:46 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id 7-20020a17090602c700b009b97aa5a3aesm1689320ejk.34.2023.10.18.06.12.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:12:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 4/8] hw/pcmcia/pxa2xx: Do not open-code sysbus_create_simple() Date: Wed, 18 Oct 2023 15:12:16 +0200 Message-ID: <20231018131220.84380-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=philmd@linaro.org; helo=mail-ed1-x531.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/pcmcia/pxa2xx.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c index e7264feb45..a2ab96d749 100644 --- a/hw/pcmcia/pxa2xx.c +++ b/hw/pcmcia/pxa2xx.c @@ -141,13 +141,7 @@ static void pxa2xx_pcmcia_set_irq(void *opaque, int line, int level) PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, hwaddr base) { - DeviceState *dev; - - dev = qdev_new(TYPE_PXA2XX_PCMCIA); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - - return PXA2XX_PCMCIA(dev); + return PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, base, NULL)); } static void pxa2xx_pcmcia_initfn(Object *obj) From patchwork Wed Oct 18 13:12:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Rr63uc5f; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WZl52X3z20cx for ; Thu, 19 Oct 2023 00:16:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6Mc-0007oe-Ac; Wed, 18 Oct 2023 09:13:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6M5-0007KT-VC for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:58 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6M4-0000mt-7S for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:12:57 -0400 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-9c53e8b7cf4so407302766b.1 for ; Wed, 18 Oct 2023 06:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634773; x=1698239573; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kCYRI8Q1kvi4VpcB4GZtS6fXIL0c6XiuN6TOx6QUjpw=; b=Rr63uc5fQQU2B+Ih95WeWIDcUNdFoPgfNIxwcgQLvsFzFI3HAaCFoulhBojd10hOHt WPu9AbaRkTo36eV5xT2hSzwKANGZIEsbuksxEVKft8kB/l55oY7DpcN3+lZQKN+BWT1r ruqECkI0I/zV7Yii4jiOmJR2qSsgEo2JMbOA7f9/o2l2ccPLa34NPc9jWfXFHiBpCQaz OiKanezl+gZeVHIZYEbeNxmj0HOGzoGdfKwG1no6cig8pqA+N4KL22uJ7Es5z0MNG5wE 7Fk6J0srEyl4ZNDbUYEKNbSmZcLxAeVS9Xq2Ejm08iggFACLjhosq/+V+PRC4u9mJKwP FpmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634773; x=1698239573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kCYRI8Q1kvi4VpcB4GZtS6fXIL0c6XiuN6TOx6QUjpw=; b=tVv0ODvWJ3o0XXvb9mOLRJ6HfZjF0TkF+GGF/W/xazRTi3H60D3gVA6q+8U1Gys3EI 4yl/uU0d5x2A/1D+6y26AdtA5gaQvwtmJMkGp6AzQqsUEYwnwl5BaNX//lMBvOsKjCWg IjEmYnJW4gtoewGI4mBVCwZHw/UV2+zOudNFKRC9xJL0N+f5tvP1ArhrpeziVtBiZLRm 37+tLEtGq2mG8kVqgs8hA9T2gq5uld+elABIT5tj9L5FwiGBlayA+578lE8m47wPdYNe nndvYYu7sqjn/wr+qKsApywJSERWBIPoJGKEJFU7fqdfuLdivD93fs+YDu9M6CCkIaaj VNvQ== X-Gm-Message-State: AOJu0Yz8IP3olaJJ1BDbVipug9M3xvpUTqiNxcptElkva2ldPNWi33PK nuJ/Jams+idMrr2udGT1kppg+aIh5ph1ebLLj0s= X-Google-Smtp-Source: AGHT+IF3KSuet3hbCGLegbYpLDGx2fb4oHMpFEpEFbcjnQbMjQTg6WUKkfdPwkr9lV6B+Pre7OhvsA== X-Received: by 2002:a17:907:7f23:b0:9b2:982e:339a with SMTP id qf35-20020a1709077f2300b009b2982e339amr3668353ejc.22.1697634772894; Wed, 18 Oct 2023 06:12:52 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id m15-20020a1709066d0f00b0099d804da2e9sm1663596ejr.225.2023.10.18.06.12.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:12:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 5/8] hw/pcmcia/pxa2xx: Inline pxa2xx_pcmcia_init() Date: Wed, 18 Oct 2023 15:12:17 +0200 Message-ID: <20231018131220.84380-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=philmd@linaro.org; helo=mail-ej1-x634.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/pxa.h | 2 -- hw/arm/pxa2xx.c | 12 ++++++++---- hw/pcmcia/pxa2xx.c | 6 ------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h index 54eb895e42..4c6caee113 100644 --- a/include/hw/arm/pxa.h +++ b/include/hw/arm/pxa.h @@ -100,8 +100,6 @@ void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly, #define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia" OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxPCMCIAState, PXA2XX_PCMCIA) -PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, - hwaddr base); int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card); int pxa2xx_pcmcia_detach(void *opaque); void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq); diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 07d5dd8691..601ddd8766 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -2205,8 +2205,10 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *cpu_type) sysbus_create_simple("sysbus-ohci", 0x4c000000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); - s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); - s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); + s->pcmcia[0] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, + 0x20000000, NULL)); + s->pcmcia[1] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, + 0x30000000, NULL)); sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); @@ -2338,8 +2340,10 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } - s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); - s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); + s->pcmcia[0] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, + 0x20000000, NULL)); + s->pcmcia[1] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, + 0x30000000, NULL)); sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c index a2ab96d749..e3111fdf1a 100644 --- a/hw/pcmcia/pxa2xx.c +++ b/hw/pcmcia/pxa2xx.c @@ -138,12 +138,6 @@ static void pxa2xx_pcmcia_set_irq(void *opaque, int line, int level) qemu_set_irq(s->irq, level); } -PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, - hwaddr base) -{ - return PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, base, NULL)); -} - static void pxa2xx_pcmcia_initfn(Object *obj) { SysBusDevice *sbd = SYS_BUS_DEVICE(obj); From patchwork Wed Oct 18 13:12:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iDpXstlN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WY33v0fz20cx for ; Thu, 19 Oct 2023 00:15:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6Mf-00084k-GR; Wed, 18 Oct 2023 09:13:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6ME-0007US-TD for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:08 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6MC-0000nZ-MH for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:06 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9be7e3fa1daso717471066b.3 for ; Wed, 18 Oct 2023 06:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634779; x=1698239579; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LSmy0AQ2ctzt4sBy/4+sAM4ntN11b2Cq/iHR2Msv118=; b=iDpXstlN666ZVOTwhvyAupBsi3yQxTf7owBAhUvQTDKr3KsmvN3d+t/QmmHu2a7hRK BvL4yfzQmrG+3lVvk0uhUCSn7JXe58L7axP6CWmi/GYkdeSgaZ4UJ7I1a54glYX221Lb HajR2VLAhO/EmLoqiBRYxALlHbiekQtl1ZbwFBf7I7TM7tq3hWazlu68XMIxQGy7wri9 02RseXHLlnpF088A8uQ4CU+rRP9d7eja94aU0U1PuKgyYOaLBFVxJAhRCP54MMErv6cc eDH44f4npliktk5mFJcPhMS7IUeYtp05caueLDj4rH/c+DbjfZJEu/ExJNlzOFHfpb6n 7k7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634779; x=1698239579; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LSmy0AQ2ctzt4sBy/4+sAM4ntN11b2Cq/iHR2Msv118=; b=RcDLKY7ps0nFNxOCNEtCoUNTDsyowfxCeuQ7VigLSCJeVjIXCZc9VJ+ZkZBvYWQgCk bfyjzIYW6VqRMWo9HEq3q12DEr4c2ZeNUvOs8fZlfIwZGdXvlSwcaVcwpEdb8rB/En6W qRBdoD7no3mvroLBYWMrWcIXFADlssMwoxU7i8HDwGaUoJ6Sk9SxK39edzrZ2xIWdjAZ 4Lsw5fAPqrsKLp7w7Dspe427uFIjAMZvyeXh1QWyQupq0MX7h36medcRi4BIIv0VPd7g SWyx2D6kKN4+rTAUGvd/Fz6nu+jznKDe8ZFALx15NYHLoqwqs8MfmRwuW/CDFuUliUCr N9PQ== X-Gm-Message-State: AOJu0YzirK7g+u6TGqsEht/OK5Bmlt8pCyXQZfuDNbaTNln8WGZlph5p LbBEpdBxrokxVyvMq0G4HT8V8vtYpYvy5Q1zftA= X-Google-Smtp-Source: AGHT+IFqErLiIY1EehFLNQBS+yGt4TLTAfeTc+xBwH+rsFDoW+RZTCsfbXycJe+ZDhO3K56qqk1GQw== X-Received: by 2002:a17:906:db04:b0:9a1:f21e:cdff with SMTP id xj4-20020a170906db0400b009a1f21ecdffmr3882712ejb.23.1697634778895; Wed, 18 Oct 2023 06:12:58 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id k13-20020a170906680d00b009ae69c303aasm1644229ejr.137.2023.10.18.06.12.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:12:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 6/8] hw/intc/pxa2xx: Convert to Resettable interface Date: Wed, 18 Oct 2023 15:12:18 +0200 Message-ID: <20231018131220.84380-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=philmd@linaro.org; helo=mail-ej1-x630.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Factor reset code out of the DeviceRealize() handler. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/pxa2xx_pic.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 47132ab982..2eb869a605 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -271,12 +271,9 @@ static int pxa2xx_pic_post_load(void *opaque, int version_id) return 0; } -DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) +static void pxa2xx_pic_reset_hold(Object *obj) { - DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); - PXA2xxPICState *s = PXA2XX_PIC(dev); - - s->cpu = cpu; + PXA2xxPICState *s = PXA2XX_PIC(obj); s->int_pending[0] = 0; s->int_pending[1] = 0; @@ -284,6 +281,14 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) s->int_enabled[1] = 0; s->is_fiq[0] = 0; s->is_fiq[1] = 0; +} + +DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) +{ + DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); + PXA2xxPICState *s = PXA2XX_PIC(dev); + + s->cpu = cpu; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); @@ -319,9 +324,11 @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); dc->desc = "PXA2xx PIC"; dc->vmsd = &vmstate_pxa2xx_pic_regs; + rc->phases.hold = pxa2xx_pic_reset_hold; } static const TypeInfo pxa2xx_pic_info = { From patchwork Wed Oct 18 13:12:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Y40qUJps; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WZV267nz20Pd for ; Thu, 19 Oct 2023 00:16:18 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6MY-0007hN-DY; Wed, 18 Oct 2023 09:13:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6MH-0007Vy-G0 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:09 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6MF-0000np-Gw for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:08 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9bf0ac97fdeso629287966b.2 for ; Wed, 18 Oct 2023 06:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634785; x=1698239585; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RG5zLlWN/LC4pJbPVJoFLnGQz4i0tpH2bVvTXsYTeOI=; b=Y40qUJpsJNbgIx7vMG4lVxRCHty9Ljn6M0yZK+HaEQAypC8qhPzq1UluE9H4t36JLD UOJa/+4sBIZCtt5jYosk+zkz6jlPq24GUzna2iYVu8RXY6L9c3QoSFLtbXvPdhq3k+aw lV1J1cKXn2OTzQeTlcL4ZuHi83Hj3d31zTOQ4nRhU+rGIzCSOCQ0yavFDcxG4ZSPiZKH Sua1K6hqVJ3K9cTo9Tb/dcXyyuzO0eQVXZGe8872SBrBA52Gt71RipA+tW9iFJ5rEK4j o9PpXBmNrZqg01gFK1i5CJN8AYbeoutckxjNJ6axNOuc8vrwT6IMvQI4XRWuVUUg2Afz cexg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634785; x=1698239585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RG5zLlWN/LC4pJbPVJoFLnGQz4i0tpH2bVvTXsYTeOI=; b=p+134V6PbtO2i7D0uHQjl5WWHwHI77mquGgghulbY4sYXg176QbjwqRywWgh7EtZ2C hbvoyv0oU/dhfJk2LXvpTGccYGAzvOI8/Lz8+PxvLHvEgYAe00ZpugcZ9vwUeotSmvEs K8jM13E6gmTtXmpVg133pVX6Rjsxi6Fq6eGRrd078/rjiNd37hYYhw52Yu86jm4ZZYAq w2V/WeYQkdD5NiipjradPApUY25hFxyAXYj6fu7CTkMKMdjXi68LvQGvMK3vT5QGHyTR F8ldSEg5Rrw+h59uNIKbUXjQsl74dDmpFDTRUpnA+fW/gYcHl2Zvf/Srr7I6aZfNCUxd bC9w== X-Gm-Message-State: AOJu0Yy2foVQzydRSi3Tgj+0w2YvnmiepXh5zmeKkCepXmKAs+hUZo9w ZkSwibZzJEdYHA0HiqRVIeE94zPipJcoa6yyrWA= X-Google-Smtp-Source: AGHT+IGtGtNUR8YRpNO306+BreZI4qPcjO2aL2779WmqHWTW2wxjTHwL99N0WF+xh4/6nuhjLp8ORA== X-Received: by 2002:a17:907:d48d:b0:9c6:7ec2:e129 with SMTP id vj13-20020a170907d48d00b009c67ec2e129mr2603043ejc.42.1697634784797; Wed, 18 Oct 2023 06:13:04 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id z6-20020a17090674c600b00992e14af9c3sm1686110ejl.143.2023.10.18.06.13.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:13:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 7/8] hw/intc/pxa2xx: Pass CPU reference using QOM link property Date: Wed, 18 Oct 2023 15:12:19 +0200 Message-ID: <20231018131220.84380-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org QOM objects shouldn't access each other internals fields except using the QOM API. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/pxa2xx_pic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 2eb869a605..7e180635c2 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -15,6 +15,7 @@ #include "cpu.h" #include "hw/arm/pxa.h" #include "hw/sysbus.h" +#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qom/object.h" #include "target/arm/cpregs.h" @@ -288,7 +289,8 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); PXA2xxPICState *s = PXA2XX_PIC(dev); - s->cpu = cpu; + object_property_set_link(OBJECT(dev), "arm-cpu", + OBJECT(cpu), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); @@ -321,11 +323,18 @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { }, }; +static Property pxa2xx_pic_properties[] = { + DEFINE_PROP_LINK("arm-cpu", PXA2xxPICState, cpu, + TYPE_ARM_CPU, ARMCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); ResettableClass *rc = RESETTABLE_CLASS(klass); + device_class_set_props(dc, pxa2xx_pic_properties); dc->desc = "PXA2xx PIC"; dc->vmsd = &vmstate_pxa2xx_pic_regs; rc->phases.hold = pxa2xx_pic_reset_hold; From patchwork Wed Oct 18 13:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1850827 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YNZvZ6K0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9WZT299tz20Pd for ; Thu, 19 Oct 2023 00:16:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt6N4-00007B-VM; Wed, 18 Oct 2023 09:14:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt6MN-0007b3-0g for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:16 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt6ML-0000of-39 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 09:13:14 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-53b32dca0bfso14261878a12.0 for ; Wed, 18 Oct 2023 06:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697634790; x=1698239590; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jWeKlxu/1oSXjew02PYYb/4LgtdqaZA73Poob6GIouM=; b=YNZvZ6K0YcIXBcbBIDv4OiqqgWqEh/JmrCof4jtgfbzYl5zPwvcXU4rbO1j+QKKa7+ FDXL6agrVGyveRgM7zycpXbIXfCKViargDR9ZtHFwmT1Y58sZXmeTiBnlY73iDoqFUPG ZM42Yjh9pUIooDHqJLOWqFjCSSPZy+E1dNXA1nLrDHMGXSt35Kb80mJqSk0tY1buKi9c v/DXxE7WCMSK7RfIYs1YfTDeWuOCAqvBUg0rLFCnO6jknWtFaavCysgv5D614w7uLze/ H8wgoeAtkz0K7MaZdW1mRq5cqX9wgBSY9z6U85Ut3NzNYqpqajGovXRMCqSF9Ww335l2 FUTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634790; x=1698239590; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jWeKlxu/1oSXjew02PYYb/4LgtdqaZA73Poob6GIouM=; b=ntC+tfzMyDPme5UjyRMEJMFY6JRkG4AYq8SL5xhyO0bKkb5ZqZcYwU14iB9Royjl1x p0+McjlyJug7xtxgwhjc2x1i51bVRjCYUa/p0LeGxxTeNfS75LYso5USDa48FMp4rno0 45vExGo9KcaCtkxihUZiMj/LGIXp7MJcZjClWVPG0nNAvO3uyZ6DJ6RwLpS8uAG/hg0L jyvaZ0UF5KNQ16NLH5Bs91ju3rZKVh4bjBw6OgDImVXEF82zi8nLJseqUF0WVyG30/GO pMj4XudGUDFNMeU8FKsLpDgMJw0QUYSBHAeURINkp8rfve8fL8Q5nONYg9F9mJrABN/j tNgQ== X-Gm-Message-State: AOJu0YzvKnx2kI6kNJ0gMnrAHH6Ep+QNEt05LcEHJJiRHi8fITDWjhmP vYxNYGtIZjbhOh4BDR+Z0VyQTyFZQKFNe19sxtw= X-Google-Smtp-Source: AGHT+IHrcevyqdf6b09vgOg9YFrBu1ad/Xsw0RgKi05Oc4T+HWvK4hCBJt7Pvzl8q+jWs+jBnecERw== X-Received: by 2002:a50:cb88:0:b0:533:4a89:5b2e with SMTP id k8-20020a50cb88000000b005334a895b2emr4718728edi.1.1697634790666; Wed, 18 Oct 2023 06:13:10 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id k3-20020aa7c043000000b0053ecef8786asm2763606edo.75.2023.10.18.06.13.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 06:13:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 8/8] hw/intc/pxa2xx: Factor pxa2xx_pic_realize() out of pxa2xx_pic_init() Date: Wed, 18 Oct 2023 15:12:20 +0200 Message-ID: <20231018131220.84380-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018131220.84380-1-philmd@linaro.org> References: <20231018131220.84380-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=philmd@linaro.org; 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/pxa2xx_pic.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 7e180635c2..1373a0d275 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -287,12 +287,18 @@ static void pxa2xx_pic_reset_hold(Object *obj) DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) { DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); - PXA2xxPICState *s = PXA2XX_PIC(dev); object_property_set_link(OBJECT(dev), "arm-cpu", OBJECT(cpu), &error_abort); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + + return dev; +} + +static void pxa2xx_pic_realize(DeviceState *dev, Error **errp) +{ + PXA2xxPICState *s = PXA2XX_PIC(dev); qdev_init_gpio_in(dev, pxa2xx_pic_set_irq, PXA2XX_PIC_SRCS); @@ -300,12 +306,9 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) memory_region_init_io(&s->iomem, OBJECT(s), &pxa2xx_pic_ops, s, "pxa2xx-pic", 0x00100000); sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); /* Enable IC coprocessor access. */ - define_arm_cp_regs_with_opaque(cpu, pxa_pic_cp_reginfo, s); - - return dev; + define_arm_cp_regs_with_opaque(s->cpu, pxa_pic_cp_reginfo, s); } static const VMStateDescription vmstate_pxa2xx_pic_regs = { @@ -335,6 +338,7 @@ static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) ResettableClass *rc = RESETTABLE_CLASS(klass); device_class_set_props(dc, pxa2xx_pic_properties); + dc->realize = pxa2xx_pic_realize; dc->desc = "PXA2xx PIC"; dc->vmsd = &vmstate_pxa2xx_pic_regs; rc->phases.hold = pxa2xx_pic_reset_hold;