From patchwork Tue Oct 24 08:30:05 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: 1854191 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=i/4aO4pG; 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 4SF4yn1906z23jV for ; Tue, 24 Oct 2023 19:31:13 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCo8-0001bq-If; Tue, 24 Oct 2023 04:30:36 -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 1qvCnz-0001W4-Bo for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:34 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvCnx-00017V-KR for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:27 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32d834ec222so2814161f8f.0 for ; Tue, 24 Oct 2023 01:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698136224; x=1698741024; 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=qgMoLhn/PijE82EW0MI6DqC9oqnirXW6IOpPCP9Xfok=; b=i/4aO4pGu6LOO/+hjJ5ptcsVu4rDxG33uOTIrf0u8alw0QMt2cjNk6NZT4nBfpy6lC mAeX8+n3SgJVkE5XwL3roKs9aQMMaDUy5nqAbB/14svK12sNt+JaLUiqoMq+6pX5L2U9 7gNCHZohnKmbVKS4sZxno11UrR++pwcPwy5sbiI1BMa5JxZpFwUo65f/L9sCMRw3GzaJ v0mGDDe8YsuW4e0+krsErn3v13t0ggyC7b/0Wt9x5sPtSiOrXQZI7aZ8GgMe94c2IoFp djzBkeXhHZMpw9jhyloMejwsULU9bMyD5dWlGWT5+x6RnhmHgh5cWjm2tKzmzv92X9X4 cHEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698136224; x=1698741024; 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=qgMoLhn/PijE82EW0MI6DqC9oqnirXW6IOpPCP9Xfok=; b=KP33yzcfex+RXLXFSaMcl+1y0H/J1TwZoPCHoih4ILsyfmepzQ5QBD8Vo1ta18WeK8 wM1dxTz1fL5FZ0bYSJOH4HibI+FNCczDQ95vZ8M7+WSgrBdscnHoPGePJgmKCqoBYbLu sNEX5cSNiiSdy97rdItm8kBXsAenxIRFHHOs1jEJyg1e4oeAHkYSy49gixnpTBebVnsm nYIhp2/tqT/djcDrXNUbWHzfh1DgpMbZAHYW3LMRN5Ul8pY25JzcCx/JeYhVY3B2/5fd 2MBCS+Ir2s4ZwD3v5PrdP86InPoRJn3CYaJYvwbPnlaw1ZxNHCaE/U2ZgGZPw6jjH70d vNaA== X-Gm-Message-State: AOJu0YzFirTdvc+cmMf5fA6SK2Ec1ly3VbcYpHUtOM/276Q13wLcIoD3 OhS00mjzVILOwlD+3P5+yeE5crCaAc92Ghxt+wk= X-Google-Smtp-Source: AGHT+IGOaZV3SgR3l8K/dUyiMtjGgy76TrU1qE+u/aqyfDNfEOhtcDcuiE4ZUgY1UKM9nsb7Kb3JkQ== X-Received: by 2002:a5d:4a4c:0:b0:32d:8907:2b18 with SMTP id v12-20020a5d4a4c000000b0032d89072b18mr9276531wrs.66.1698136223971; Tue, 24 Oct 2023 01:30:23 -0700 (PDT) Received: from m1x-phil.lan (sem44-h01-176-172-55-165.dsl.sta.abo.bbox.fr. [176.172.55.165]) by smtp.gmail.com with ESMTPSA id b14-20020a5d550e000000b0032d9caeab0fsm9394218wrv.77.2023.10.24.01.30.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Oct 2023 01:30:23 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 2/6] hw/m68k/mcf5206: Pass CPU using QOM link property Date: Tue, 24 Oct 2023 10:30:05 +0200 Message-ID: <20231024083010.12453-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231024083010.12453-1-philmd@linaro.org> References: <20231024083010.12453-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 Avoid the interrupt controller directly access the first cpu via the qemu_get_cpu() call. Pass it as argument to mcf5206_init() from the board code. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé --- hw/m68k/an5206.c | 6 ++++-- hw/m68k/mcf5206.c | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index 11ae4c9795..1e8e64f8bd 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -20,12 +20,14 @@ #define AN5206_MBAR_ADDR 0x10000000 #define AN5206_RAMBAR_ADDR 0x20000000 -static void mcf5206_init(MemoryRegion *sysmem, uint32_t base) +static void mcf5206_init(M68kCPU *cpu, MemoryRegion *sysmem, uint32_t base) { DeviceState *dev; SysBusDevice *s; dev = qdev_new(TYPE_MCF5206_MBAR); + object_property_set_link(OBJECT(dev), "m68k-cpu", + OBJECT(cpu), &error_abort); s = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); @@ -60,7 +62,7 @@ static void an5206_init(MachineState *machine) memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal); memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram); - mcf5206_init(address_space_mem, AN5206_MBAR_ADDR); + mcf5206_init(cpu, address_space_mem, AN5206_MBAR_ADDR); /* Load kernel. */ if (!kernel_filename) { diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index 2ab1b4f059..f920ca2ceb 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -10,6 +10,7 @@ #include "qemu/error-report.h" #include "qemu/log.h" #include "cpu.h" +#include "hw/qdev-properties.h" #include "hw/boards.h" #include "hw/irq.h" #include "hw/m68k/mcf.h" @@ -601,13 +602,19 @@ static void mcf5206_mbar_realize(DeviceState *dev, Error **errp) s->timer[1] = m5206_timer_init(s->pic[10]); s->uart[0] = mcf_uart_init(s->pic[12], serial_hd(0)); s->uart[1] = mcf_uart_init(s->pic[13], serial_hd(1)); - s->cpu = M68K_CPU(qemu_get_cpu(0)); } +static Property mcf5206_mbar_properties[] = { + DEFINE_PROP_LINK("m68k-cpu", m5206_mbar_state, cpu, + TYPE_M68K_CPU, M68kCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + static void mcf5206_mbar_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); + device_class_set_props(dc, mcf5206_mbar_properties); set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->desc = "MCF5206 system integration module"; dc->realize = mcf5206_mbar_realize; From patchwork Tue Oct 24 08:30:06 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: 1854196 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=Z0g/pdCR; 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 4SF5072wt9z23jV for ; Tue, 24 Oct 2023 19:32:23 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCoK-0001fL-Ve; Tue, 24 Oct 2023 04:30:48 -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 1qvCoJ-0001ey-KQ for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:47 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvCo4-0001Ag-De for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:47 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5079f3f3d7aso6626377e87.1 for ; Tue, 24 Oct 2023 01:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698136229; x=1698741029; 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=Xfu4/2AUQ8XPD1VFcNgXAyGx5PWs1jSOc11hThF88Y4=; b=Z0g/pdCR8GpN7rSJzo7N7wiKYbFrAAkiG8mDec8DWBEei5Yl7Y401ac1vOvvGpLSMF l/CmZudLybt/riy5KSC4XntMDGCvnBs3kKocPKNoW3NT5keBq3GOb+qpYOyXvvquvAD+ TwFy99FbpRz1vsn1nAkI1zwx0/1kQGvaDwTikt5CdZ8hrPppDzt3Cjib+BKIgrVjEgV8 j+fkP8f7ow/6bORxqHtTYsh+LLU1hgWn8AlELAKO8ggsxsnen6eMrjYvWVfnE7eR9875 XU98YclqnWw3pfj07mC6Jzlte5EkC+60ErFlcdSoZTkpIqDep6knipdNKZPti41Kba9j hLQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698136229; x=1698741029; 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=Xfu4/2AUQ8XPD1VFcNgXAyGx5PWs1jSOc11hThF88Y4=; b=ripKM+Gb2kYnRip7pIkseEgeW1VV0/Wj1H4YJaMGmsMFoWM3/nxDjJbIW79LJJuO5K EM5wUoC/LEih0K9a7BKPXqcr/Zq8vOuGHSo0VOL/lQ19d3VYXVyHt113hYpcNH8FeycW z3feXK8EdKBuL92Hj9dL5zRktqCkRi7k2aMmMyvSrTdigDzvKkVHAgosR7PkPe0Tymjx mWX0tMHBRArYRfmyTAgsZP/lXyT/ZYgoN4SJ9FoMb1eRC48YQ+/wFep8foB2M7JWEBfm NmKf8NFwfn5S+G4YcQrCfab40pvgbe6i+M8jswkmnC0ll7h4PoXzMGNNr39qXk60VVkQ yzKw== X-Gm-Message-State: AOJu0YzSDl2whaJXzCjnsj3bk4fla9OYPqJ6rMneGGIGqo1d0JJI/pPn lo8Ip7w7pzXiYAq3JZOj3VaGcXaLTH79fHTVCOo= X-Google-Smtp-Source: AGHT+IFthrZukM56QE4AQ27nLFAhunEabioL0ip9WqIQPQAbrPRXnx+b1Awj9LP+4j8BE9CX5wqYfQ== X-Received: by 2002:a19:5051:0:b0:504:7bb0:9d7e with SMTP id z17-20020a195051000000b005047bb09d7emr7159725lfj.27.1698136229373; Tue, 24 Oct 2023 01:30:29 -0700 (PDT) Received: from m1x-phil.lan (sem44-h01-176-172-55-165.dsl.sta.abo.bbox.fr. [176.172.55.165]) by smtp.gmail.com with ESMTPSA id d14-20020adffd8e000000b0031984b370f2sm9365431wrr.47.2023.10.24.01.30.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Oct 2023 01:30:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 3/6] hw/m68k/mcf_intc: Expose MMIO region via SysBus API Date: Tue, 24 Oct 2023 10:30:06 +0200 Message-ID: <20231024083010.12453-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231024083010.12453-1-philmd@linaro.org> References: <20231024083010.12453-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=philmd@linaro.org; helo=mail-lf1-x135.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, 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. Here the caller of mcf_intc_init() access the MMIO region from the MCF_INTC state. Avoid that by exposing that region via sysbus_init_mmio(), then get it with sysbus_mmio_get_region(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Tested-by: Thomas Huth Reviewed-by: Thomas Huth --- hw/m68k/mcf_intc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c index 4cd30188c0..1f74ea0e14 100644 --- a/hw/m68k/mcf_intc.c +++ b/hw/m68k/mcf_intc.c @@ -173,6 +173,7 @@ static void mcf_intc_instance_init(Object *obj) mcf_intc_state *s = MCF_INTC(obj); memory_region_init_io(&s->iomem, obj, &mcf_intc_ops, s, "mcf", 0x100); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); } static void mcf_intc_class_init(ObjectClass *oc, void *data) @@ -211,7 +212,8 @@ qemu_irq *mcf_intc_init(MemoryRegion *sysmem, s = MCF_INTC(dev); s->cpu = cpu; - memory_region_add_subregion(sysmem, base, &s->iomem); + memory_region_add_subregion(sysmem, base, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0)); return qemu_allocate_irqs(mcf_intc_set_irq, s, 64); } From patchwork Tue Oct 24 08:30:07 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: 1854194 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=PNljHyad; 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 4SF4zl708Kz23jV for ; Tue, 24 Oct 2023 19:32:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCoD-0001e6-Kj; Tue, 24 Oct 2023 04:30:41 -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 1qvCoB-0001d9-BY for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:39 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvCo9-0001BL-KV for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:39 -0400 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c594196344so6282201fa.3 for ; Tue, 24 Oct 2023 01:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698136236; x=1698741036; 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=jQzYUltxj5g7ekyBL7Wz4ZsV8ZVW3gL9B5H+7rR+rus=; b=PNljHyadIkI+PytbXF51RcoRqajHJxpDbXRQwfUYVjX7SovpapPNEYO72GbeUaqkM3 dgDsuWHzEru0tYO2mVKXS4xLkTPUdb2GndK3N9INlaG4TdHeu5rU8qIBtnZ4Aeij1cS/ 6xTb9V80gSLbE/QSxTJDY1ivHC5qeuSbZtBWx6r4a1FRzADxeRQovypomrkq35ieRgNo XFH8jsm7f7twYCnkkaIeQwqsQ9B4LwsqfGsSqWrTblacFj4SOUwcs9LptHcP2H0fCh0v hH77GJ804x+7Bb5Cc5/Vxn9FJlHKV3VuiJ0XZGH8NhuPdkr/5wt1cQ4UAAM9TFmApV4M 4/JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698136236; x=1698741036; 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=jQzYUltxj5g7ekyBL7Wz4ZsV8ZVW3gL9B5H+7rR+rus=; b=ezJLDTVIa1AdI3dNIdeR14opxQ79hEzmMgk5aIa0A3Upr1GnFHsajtjSktI8iGx2yK PBaHaqQJVETK7p8PTvxlgcXGiVq+tfUFSlY4k0q754zwoLFM9da0WRoZ02MmW5AbSR1L 5M16yC20fQp16GELtJWYoEWo1oH+khg3oiIdHIK40KccY64lTQFauhh97pF6TDdsi/kY rrV53dFKaE1AwaOLT1obUqSjAXLmTl0Zk0akEoGKb/ep1HhzwK7oZ3vwTg7wEO0eFXXN KW6hb5hwfcfnse7e+3IaCcvKIL/Ojp7LsBqIPbnKeTwFggD7aa1a6xOoI2oAQXPgrvGr GzOg== X-Gm-Message-State: AOJu0YzAIKFhde1WkLRx0LvyO+vPIJs2jm5Gi7NUduaiAVcjzCFg0wfv HyfQz0RN4XFcCRR9xSXv+MZEQedoEgWNfnYj5fo= X-Google-Smtp-Source: AGHT+IGl+lGDQGsNcTKSN/DCzqsDII1Z3Rgp0NwT9Z98PTSmVm1EWx/o9taFm0AAq0GSh1r09jrZFg== X-Received: by 2002:a2e:91d9:0:b0:2c5:2126:127a with SMTP id u25-20020a2e91d9000000b002c52126127amr7535501ljg.17.1698136235662; Tue, 24 Oct 2023 01:30:35 -0700 (PDT) Received: from m1x-phil.lan (sem44-h01-176-172-55-165.dsl.sta.abo.bbox.fr. [176.172.55.165]) by smtp.gmail.com with ESMTPSA id p6-20020a5d6386000000b00327b5ca093dsm9409641wru.117.2023.10.24.01.30.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Oct 2023 01:30:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 4/6] hw/m68k/mcf_intc: Pass CPU using QOM link property Date: Tue, 24 Oct 2023 10:30:07 +0200 Message-ID: <20231024083010.12453-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231024083010.12453-1-philmd@linaro.org> References: <20231024083010.12453-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=philmd@linaro.org; helo=mail-lj1-x233.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é Reviewed-by: Richard Henderson Tested-by: Thomas Huth Reviewed-by: Thomas Huth --- hw/m68k/mcf_intc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c index 1f74ea0e14..1d3b34e18c 100644 --- a/hw/m68k/mcf_intc.c +++ b/hw/m68k/mcf_intc.c @@ -14,6 +14,7 @@ #include "hw/irq.h" #include "hw/sysbus.h" #include "hw/m68k/mcf.h" +#include "hw/qdev-properties.h" #include "qom/object.h" #define TYPE_MCF_INTC "mcf-intc" @@ -176,10 +177,17 @@ static void mcf_intc_instance_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); } +static Property mcf_intc_properties[] = { + DEFINE_PROP_LINK("m68k-cpu", mcf_intc_state, cpu, + TYPE_M68K_CPU, M68kCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + static void mcf_intc_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); + device_class_set_props(dc, mcf_intc_properties); set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->reset = mcf_intc_reset; } @@ -204,16 +212,13 @@ qemu_irq *mcf_intc_init(MemoryRegion *sysmem, M68kCPU *cpu) { DeviceState *dev; - mcf_intc_state *s; dev = qdev_new(TYPE_MCF_INTC); + object_property_set_link(OBJECT(dev), "m68k-cpu", + OBJECT(cpu), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - - s = MCF_INTC(dev); - s->cpu = cpu; - memory_region_add_subregion(sysmem, base, sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0)); - return qemu_allocate_irqs(mcf_intc_set_irq, s, 64); + return qemu_allocate_irqs(mcf_intc_set_irq, dev, 64); } From patchwork Tue Oct 24 08:30:08 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: 1854192 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=Lf52840P; 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 4SF4yn6Xf2z23kh for ; Tue, 24 Oct 2023 19:31:13 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCoJ-0001en-0Y; Tue, 24 Oct 2023 04:30:47 -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 1qvCoG-0001eF-LW for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:44 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvCoE-0001Bk-Tp for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:44 -0400 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5079f3f3d7aso6626579e87.1 for ; Tue, 24 Oct 2023 01:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698136241; x=1698741041; 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=ZlPzf4Ab5QFLnbSPHtWGOn/3d8rqF62sEucKv3iijfs=; b=Lf52840PvQDuGWRF/of9bSUajlk4h+l9NZiQr8szwmL+g35GA9CUXyWAyUpPaQ6rEC 6yV9WP631G2iuCzF4lSPlEbKQFY86606MZLB7mY5cR4yLFF47vwhBHuWSv4jYYksGrPN QD5o5h9m4Eay2hvG4/HCSoVNwjCtjHL5g9DKPEJqMuplCnTlQRxHOMj/uv47JkEFtz/L w8Mc63NgppMiJMT8BotQ3uQSN1/Pqk8wQMwQ9e3DKsBr1ZajhOOOj8CIhmzSbvg6y0W2 jQWWMFZlCZ85DHNoVmCuiPdwIfkwaISXWgN0+jCiIqRwwXS923mwV+TZ0S8uNbMpWI5Z 4LnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698136241; x=1698741041; 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=ZlPzf4Ab5QFLnbSPHtWGOn/3d8rqF62sEucKv3iijfs=; b=BjvwYJVa+aRAm/cWPUEfToR+4QBVR1OxR5ARd1dT0DjzJM8J4rSMSSGowEhvBwv32s 9isgQOlEGiqymg0I/pWqW0uRAFD0cnoNnJpbAeZd52Ai4X8E3cpmhUYE5m6f/qZMyGeR DxKz8A11pEHhArmH8/yKVe0+r2xKlfY2JPy+Vq8m4m+m7yhz0Brvii/bU4pIWQgFnO5u 17VBlh1auWJ0GM8JOyqC0YC3Ae1qWEssSpI3P8AS/wlzWYlx/clxmSTkDhUtqY3RwKKs CS8NoTGgz3Lszh9lzSMMSb0URV4JNIMHyUcpAaNxMe95hWLlwi9GwRzyColFHjOVBGF2 F/Ag== X-Gm-Message-State: AOJu0YzImUkaaQIo/tx/V2l13F5eGuHCUjCmvp3WLxzvoarYZVbn43Y8 zIyIPMm0fzj7il5+q6hQ5Y0S1zSlzj45NShLxJM= X-Google-Smtp-Source: AGHT+IGZgs/c0k+6qxQNR9uA0EfRXnlgtCEp089IEH9+EDcFy5KQYW88ru9Pm/b9VAN3zoqK2VHakQ== X-Received: by 2002:ac2:5f54:0:b0:507:9b93:274b with SMTP id 20-20020ac25f54000000b005079b93274bmr7675505lfz.26.1698136241029; Tue, 24 Oct 2023 01:30:41 -0700 (PDT) Received: from m1x-phil.lan (sem44-h01-176-172-55-165.dsl.sta.abo.bbox.fr. [176.172.55.165]) by smtp.gmail.com with ESMTPSA id k12-20020a5d518c000000b0031f82743e25sm9383775wrv.67.2023.10.24.01.30.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Oct 2023 01:30:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 5/6] hw/m68k/next-cube: Do not open-code sysbus_create_simple() Date: Tue, 24 Oct 2023 10:30:08 +0200 Message-ID: <20231024083010.12453-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231024083010.12453-1-philmd@linaro.org> References: <20231024083010.12453-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=philmd@linaro.org; helo=mail-lf1-x132.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 Mechanical change using the following coccinelle script: @@ identifier dev; identifier sbd; expression qom_type; expression addr; @@ - dev = qdev_new(qom_type); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr); + dev = sysbus_create_simple(qom_type, addr, NULL); then manually removing the 'dev' variable to avoid: error: variable 'dev' set but not used [-Werror,-Wunused-but-set-variable] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- hw/m68k/next-cube.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 5d244b3b95..d17e6be8e1 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -950,7 +950,6 @@ static void next_cube_init(MachineState *machine) MemoryRegion *bmapm2 = g_new(MemoryRegion, 1); MemoryRegion *sysmem = get_system_memory(); const char *bios_name = machine->firmware ?: ROM_FILE; - DeviceState *dev; DeviceState *pcdev; /* Initialize the cpu core */ @@ -974,9 +973,7 @@ static void next_cube_init(MachineState *machine) memory_region_add_subregion(sysmem, 0x04000000, machine->ram); /* Framebuffer */ - dev = qdev_new(TYPE_NEXTFB); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0B000000); + sysbus_create_simple(TYPE_NEXTFB, 0x0B000000, NULL); /* MMIO */ sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 0, 0x02000000); @@ -993,9 +990,7 @@ static void next_cube_init(MachineState *machine) memory_region_add_subregion(sysmem, 0x820c0000, bmapm2); /* KBD */ - dev = qdev_new(TYPE_NEXTKBD); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0200e000); + sysbus_create_simple(TYPE_NEXTKBD, 0x0200e000, NULL); /* Load ROM here */ /* still not sure if the rom should also be mapped at 0x0*/ From patchwork Tue Oct 24 08:30:09 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: 1854193 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=PyHYI7+S; 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 4SF4yy5JyXz23jV for ; Tue, 24 Oct 2023 19:31:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCoO-0001fk-TN; Tue, 24 Oct 2023 04:30:52 -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 1qvCoM-0001fY-J3 for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:50 -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 1qvCoK-0001CN-G5 for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:50 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c523ac38fbso62310381fa.0 for ; Tue, 24 Oct 2023 01:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698136246; x=1698741046; 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=he7WJqvEltVxRP8YaDhG1VvbH+UnVaFuryry2MF/wd8=; b=PyHYI7+SqssB5XC7I33R4At8I/pAynzuNYJ8Nt5er3Mmtm9BJ9odugLiZibx9VjSi9 v6R6aDEBzjLCgugg/8LT0pU0Qw3OdPJ9nYi0ltw4XG898DJCc0hm7nQJA/T/F5PQsbtE aqSuaMOGKskeG/sLFqq7q1ZlhW4hNM33SWh3dn6z804Y/tUaBsIOrwwDd8n3w3i5ESGn ASuzGuvwzcsPhKuzg8Ota6eosxUVQRWB7XibMXKp4pPVSexOHomhzdJg3OOcmZHtJnlr 7LMRdDQay6axalNZaw5iTqKJO0ylLzFxWhI64mFnNhJa8eWmeoDflcNR0X/tCu8WrfpF kLHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698136246; x=1698741046; 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=he7WJqvEltVxRP8YaDhG1VvbH+UnVaFuryry2MF/wd8=; b=mTGAVJuvNprW79+4ootmXKkn9sty5/VLHJptrgKuBVKVv3q/6TFehxtstSvzbkEBHo fqKwlWDE1cgDyeaTs8pvg3xuFcBDW2+NN9G7ShRYQ95OfcyNsxFbLt/Cc0TvdqN74Qbr jBnXLuROoPSYo5sTNwQ+00XGICk8PAqrgSjBnEh5UyN1o9+1aME10MZu29Zal8QvUcXA uSSqC83GxNr2gCRh7/VJiNRU301TDJ9yeSqPM2/+BbKLgV/hWMiIAbASp/kQus2iCnBd YS7QSHq93m24ci9crohsLLyW7qIdQ74j+SGB2NCxfYx3rpe9dFju5b7EetFs9kvyBwy9 3CIA== X-Gm-Message-State: AOJu0YxFpqqWuG5rsCieDwkMuqRrwv2G1Gj93J+LEoC9rzupuIwVAh2l 1+eqMkznkIln/zPDc0/9bzSZ5OIQ+u/J00C5x0Q= X-Google-Smtp-Source: AGHT+IGg4Ef1pcPeGA4RRPgBEWCkFAyk5IKSRmuZ3gdLMQ6kUo1WvkyLxh5ovudHfVP46FOZEx4esQ== X-Received: by 2002:a05:651c:a0c:b0:2c5:24a8:c22d with SMTP id k12-20020a05651c0a0c00b002c524a8c22dmr11253759ljq.3.1698136246643; Tue, 24 Oct 2023 01:30:46 -0700 (PDT) Received: from m1x-phil.lan (sem44-h01-176-172-55-165.dsl.sta.abo.bbox.fr. [176.172.55.165]) by smtp.gmail.com with ESMTPSA id c8-20020a05600c0a4800b0040775fd5bf9sm11594619wmq.0.2023.10.24.01.30.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Oct 2023 01:30:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 6/6] hw/m68k/virt: Do not open-code sysbus_create_simple() Date: Tue, 24 Oct 2023 10:30:09 +0200 Message-ID: <20231024083010.12453-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231024083010.12453-1-philmd@linaro.org> References: <20231024083010.12453-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=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 Mechanical change using the following coccinelle script: @@ identifier dev; expression qom_type; expression addr; expression irq; @@ - dev = qdev_new(qom_type); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr); - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); + dev = sysbus_create_simple(qom_type, addr, irq); Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- hw/m68k/virt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index e7dc188855..2e49e262ee 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -201,11 +201,8 @@ static void virt_init(MachineState *machine) sysbus_connect_irq(sysbus, 0, PIC_GPIO(VIRT_GF_TTY_IRQ_BASE)); /* virt controller */ - dev = qdev_new(TYPE_VIRT_CTRL); - sysbus = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(sysbus, &error_fatal); - sysbus_mmio_map(sysbus, 0, VIRT_CTRL_MMIO_BASE); - sysbus_connect_irq(sysbus, 0, PIC_GPIO(VIRT_CTRL_IRQ_BASE)); + dev = sysbus_create_simple(TYPE_VIRT_CTRL, VIRT_CTRL_MMIO_BASE, + PIC_GPIO(VIRT_CTRL_IRQ_BASE)); /* virtio-mmio */ io_base = VIRT_VIRTIO_MMIO_BASE;