From patchwork Fri Oct 20 15:06:21 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: 1852627 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=ypt5z6oc; 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 4SBnyc5MlJz23kP for ; Sat, 21 Oct 2023 02:08:08 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtr5I-0005cB-7q; Fri, 20 Oct 2023 11:06:44 -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 1qtr5G-0005bk-DQ for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:06:42 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtr5E-0001Ld-Ly for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:06:42 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-99c3d3c3db9so143366966b.3 for ; Fri, 20 Oct 2023 08:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697814398; x=1698419198; 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=LfVWFHCjBq/tqfdnBzt5xPqvbfwJpX/7kEv+608Z6sg=; b=ypt5z6ocfHBqyCc0dp68ZNG392QWtMEhfs5qReu/yi25XtdsHRMuhMQYywJ5tL/DAs YkvtKqGTeaej1BfOLjO6xqxkp8XNvLwmEzEe9hqNeLRIgMJ0ydfQJEnhxeCoqGyyTcKB Ng+48sz7KqyG7h9Il+gWPp0JyMZpVFpRHcCdEa32jbpN8pLTky2d1JTMfSC9gWPG7d0B mApjlc/ijuV/zcEuSDP4EWlanaOGuMdyUI20uAO9aqJxr/rN3BiMX7Y1pJkeb0J0j5RG m5gfBPoPsRMrVhkhEGSo4gUWkoqhMucq79YDSYYym97DkzfVHmVXZdG2nLEHYRhCiUFE 1yVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697814398; x=1698419198; 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=LfVWFHCjBq/tqfdnBzt5xPqvbfwJpX/7kEv+608Z6sg=; b=RGxQbD65oDpCuy+1pIggrNFOETP5P+VFhg5g2Dl5MmwmYDWzAJsmQ9tiwGEhe6hFN/ 7dilNLBIAwDLS0bpyx06Pqw+oMqgqgeVkr+PuMqXvb6DjfPia+NJvipgtwMpKpc0dhRy uefNeQnuAS+EUBpAJRLkOsRO+PVhFWzFNq12QaQgm4wO9zPNcJdYAXfVq7Ahar8G8eFV u++sfdetrxJCs0DfeDtvTzFgaecZo8PZH8geibmtXiwQd/DCQJQQ8RzrOE2QwpmmVyu0 UzQbxt4zHa++BANl+7wD6m+EOuBduJZg66+HGP6ZrLLuc6CkysNI7jfCUYs8R6s3ZxYP Wdlw== X-Gm-Message-State: AOJu0YyqhSPIEWtxU9Ok9BWzzIHcLkM45PjJLndT0h+LhFxIYZ+N3dpj jt86R3CD3wLNFURcSANkJsSwO6jzwnlFW5xz4Fk= X-Google-Smtp-Source: AGHT+IGr3083arpP587iLw/EQFuJZL+OBVggqZxv2z3Y77UCbPj8JX1yKLi+IORS+eKuxomJKKUmuw== X-Received: by 2002:a17:907:948e:b0:9bf:9c58:e91e with SMTP id dm14-20020a170907948e00b009bf9c58e91emr1397181ejc.56.1697814396835; Fri, 20 Oct 2023 08:06:36 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id m19-20020a1709066d1300b0099bd453357esm1645245ejr.41.2023.10.20.08.06.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 08:06:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/6] hw/m68k/irqc: Pass CPU using QOM link property Date: Fri, 20 Oct 2023 17:06:21 +0200 Message-ID: <20231020150627.56893-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020150627.56893-1-philmd@linaro.org> References: <20231020150627.56893-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=philmd@linaro.org; helo=mail-ej1-x62e.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' global. Pass it from the board code. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- include/hw/intc/m68k_irqc.h | 1 + hw/intc/m68k_irqc.c | 10 +++++++++- hw/m68k/virt.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/hw/intc/m68k_irqc.h b/include/hw/intc/m68k_irqc.h index ef91f21812..693e33b0aa 100644 --- a/include/hw/intc/m68k_irqc.h +++ b/include/hw/intc/m68k_irqc.h @@ -33,6 +33,7 @@ typedef struct M68KIRQCState { SysBusDevice parent_obj; uint8_t ipr; + ArchCPU *cpu; /* statistics */ uint64_t stats_irq_count[M68K_IRQC_LEVEL_NUM]; diff --git a/hw/intc/m68k_irqc.c b/hw/intc/m68k_irqc.c index 0c515e4ecb..e09705eeaf 100644 --- a/hw/intc/m68k_irqc.c +++ b/hw/intc/m68k_irqc.c @@ -11,6 +11,7 @@ #include "cpu.h" #include "migration/vmstate.h" #include "monitor/monitor.h" +#include "hw/qdev-properties.h" #include "hw/nmi.h" #include "hw/intc/intc.h" #include "hw/intc/m68k_irqc.h" @@ -35,7 +36,7 @@ static void m68k_irqc_print_info(InterruptStatsProvider *obj, Monitor *mon) static void m68k_set_irq(void *opaque, int irq, int level) { M68KIRQCState *s = opaque; - M68kCPU *cpu = M68K_CPU(first_cpu); + M68kCPU *cpu = M68K_CPU(s->cpu); int i; if (level) { @@ -85,12 +86,19 @@ static const VMStateDescription vmstate_m68k_irqc = { } }; +static Property m68k_irqc_properties[] = { + DEFINE_PROP_LINK("m68k-cpu", M68KIRQCState, cpu, + TYPE_M68K_CPU, ArchCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + static void m68k_irqc_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(oc); + device_class_set_props(dc, m68k_irqc_properties); nc->nmi_monitor_handler = m68k_nmi; dc->reset = m68k_irqc_reset; dc->vmsd = &vmstate_m68k_irqc; diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index 2dd3c99894..da35e74bd9 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -155,6 +155,8 @@ static void virt_init(MachineState *machine) /* IRQ Controller */ irqc_dev = qdev_new(TYPE_M68K_IRQC); + object_property_set_link(OBJECT(irqc_dev), "m68k-cpu", + OBJECT(first_cpu), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(irqc_dev), &error_fatal); /* From patchwork Fri Oct 20 15:06:22 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: 1852624 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=xIl831Hh; 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 4SBny21wj4z23kP for ; Sat, 21 Oct 2023 02:07:38 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtr5O-0005cv-L2; Fri, 20 Oct 2023 11:06:50 -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 1qtr5M-0005cS-PR for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:06:49 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtr5L-0001M2-2B for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:06:48 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9be3b66f254so140839766b.3 for ; Fri, 20 Oct 2023 08:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697814405; x=1698419205; 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=68n6n0mII6+P8wsMRhocKE/9XK5lu0Lo0YDMzSDC/I4=; b=xIl831Hh8E603sIVCyxP6Gsy6PszG+v9WNJBJQU6s9peNbHvXsN0DW6kbwWEYG3bUL fpeAwhavwc+weo3nTBthoCOZudS6sEZbH8MHEjjl0TBhU+oUea2o87g14mtBUNKoWYXh 7OOBR4oyBWFfw5fowHdioFCEKxcD9Y53B+WYL3xA/ZnEzsXmsDJJDXeqw5QZ2cbUFCRv Y7e8CQHUeAb9YlqzduvtKY/ElJ3U8GPR8Dj6YEIJVibQrm3jOjIO90jvKOXyWBafaexh 1hifWZbG3E4n77sjuC9F47VsuNuzOkVDApruvTAFBWP+C/wwGw9DAF4xqhj1izFz1Bk8 sGJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697814405; x=1698419205; 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=68n6n0mII6+P8wsMRhocKE/9XK5lu0Lo0YDMzSDC/I4=; b=XrPxvzuqEqqdJ1I/+BQQoEusWd76IhrHE5ZcJJuU8wLlbYMHFm8XZK1XtmruE0zDh5 M7YXPI4wtb30P4stok+x7j2f3fZJukJfk0hdYnGxfrS0TgNU6am0l0PDj0aOm31es6bY haBI4sgqfgNbYggGiPZ6LPITzY7RMqdqoXHniLjD6QT1iJaJlqR7EXM44XxmGiFDyk4u Hjo/vtoZhgy4rBEw+D//GiHVOfFt7jgTlAvEhSrOUZv/ix/WqNWTWeqtx3RALluJbmk9 e+OzONcAMmf+nZXi6JzFosDLEVtH5e2yx0r9TQPc3hEvH+uvOgmp4tSYQsG4kQDOQWM/ xRvw== X-Gm-Message-State: AOJu0YySXj1YDSj6c2hrSy4M0boJF+F/rCsQlFrxPwEOZ9/I8NQaZxH2 gkGRcKrzVPZoG7WVLoFn8eqi8ajQoyV1zPcRQDA= X-Google-Smtp-Source: AGHT+IHagumdG3cBzEcHgi4cKaEgJkrvbg8lVtmvbKHa82clsV15H0jHS6G2xWqZkwHShh9tTqGozQ== X-Received: by 2002:a17:906:7315:b0:9be:71ab:fb5e with SMTP id di21-20020a170906731500b009be71abfb5emr1908651ejc.22.1697814404882; Fri, 20 Oct 2023 08:06:44 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id u10-20020a17090657ca00b009b8dbdd5203sm1666524ejr.107.2023.10.20.08.06.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 08:06:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/6] hw/m68k/mcf5206: Pass CPU using QOM link property Date: Fri, 20 Oct 2023 17:06:22 +0200 Message-ID: <20231020150627.56893-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020150627.56893-1-philmd@linaro.org> References: <20231020150627.56893-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.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 from the board code. Signed-off-by: Philippe Mathieu-Daudé Tested-by: Thomas Huth Reviewed-by: Thomas Huth --- hw/m68k/an5206.c | 2 ++ hw/m68k/mcf5206.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index 11ae4c9795..f51c93088f 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -26,6 +26,8 @@ static void mcf5206_init(MemoryRegion *sysmem, uint32_t base) SysBusDevice *s; dev = qdev_new(TYPE_MCF5206_MBAR); + object_property_set_link(OBJECT(dev), "m68k-cpu", + OBJECT(first_cpu), &error_abort); s = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); 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 Fri Oct 20 15:06:23 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: 1852630 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=r1YIj93W; 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 4SBnz3539Rz23kP for ; Sat, 21 Oct 2023 02:08:31 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtr5X-0005so-96; Fri, 20 Oct 2023 11:06:59 -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 1qtr5W-0005j1-5e for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:06:58 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtr5Q-0001Ma-AW for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:06:57 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9c75ceea588so142262666b.3 for ; Fri, 20 Oct 2023 08:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697814410; x=1698419210; 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=5z5NktVu9Z3pjJNFKKbdLfwCXi08dnJZpEWAcQaa1vg=; b=r1YIj93WUSMi2ovpYgFOf6NZfLwK7fczygGvAZ/3OKiTXzoQBid4lN0RWd0gfPzoFA UGO3ipZmYImqH0trxXAfQ/gtutuqk3eaWtWi8+g0eUujAAX40N/mlYL+W8ibzXsoc6cN 0rrqRuLkUp6J31LZnXkEJPUXydHX3iU0zbc1cYEL6ixwGytJp7IaMZYb0KE4r5T3flQJ AaOlaQDMFZEaqEvCYaVWMF/5lXFvzj+StR7pb4hBMfXhE4y87WrElvgqjGH4dz9ZgcuV OVnkF+ZPpr6iiZ2rTGxZ8JB35fJj/f3yRdeCezywaNqC8IxhpZV1cu3bSr8Kfs/G7Zuf qqyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697814410; x=1698419210; 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=5z5NktVu9Z3pjJNFKKbdLfwCXi08dnJZpEWAcQaa1vg=; b=dm5nrPpKGZ3sAdXlvn/vXxsdrXGhf6Dqcir3nuRNiTe0NSyouiw2aJkvdklEgTCqh7 kdQ0Nhv04clts5WWnjlM4atJdaS5wgwnkz1pFAzdRW09i7wkDqcMvdKBfTPNl0Axmh11 cknO6TpdxfgTX25iuQNJ2k1QRTW9BP8blHp+cfLlJpeyslGgAUen/9KoC/df+/IT9inB Qrhp9ewVM6ObnmzC3Vxm6aItCjUSXbUEiuukROoVJRnDFhRuvmTdG5irL6rlaLMTNcWB 6PJBfs3336AVhG5Xg90jf+85pTG0jD7BNDcUkFubVQEIXyW/vuyyrK2zkDJfo67NeZYK BSgA== X-Gm-Message-State: AOJu0YyY71HUVsXqhbA9nwKEtGPp4rtRJ9/iRHeN8TJYgWCGQC0GEgzL 2H7riAZdP/0tAD19sSgZdd4CXEj7vbddHbbbJtg= X-Google-Smtp-Source: AGHT+IGq6+JLTNqAIQfuz3/8ppC+sJgAJ38w9hpdZhuNF+7s3+tPWebnqTxNKqdDJX8G8LjLqqOxOA== X-Received: by 2002:a17:907:3d94:b0:9ba:fe6:225 with SMTP id he20-20020a1709073d9400b009ba0fe60225mr1518327ejc.55.1697814410576; Fri, 20 Oct 2023 08:06:50 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id d11-20020a170906040b00b0099bd046170fsm1672198eja.104.2023.10.20.08.06.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 08:06:50 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 3/6] hw/m68k/mcf_intc: Expose MMIO region via SysBus API Date: Fri, 20 Oct 2023 17:06:23 +0200 Message-ID: <20231020150627.56893-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020150627.56893-1-philmd@linaro.org> References: <20231020150627.56893-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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. 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é 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 Fri Oct 20 15:06:24 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: 1852631 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=SHEfxeky; 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 4SBnz52qKdz23kP for ; Sat, 21 Oct 2023 02:08:33 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtr5a-000681-4T; Fri, 20 Oct 2023 11:07:02 -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 1qtr5Y-00062A-3Y for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:07:00 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtr5W-0001OF-95 for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:06:59 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-51e28cac164so4283141a12.1 for ; Fri, 20 Oct 2023 08:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697814416; x=1698419216; 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=DGRPHT/WBPalUJTx91B3yYyqtqOtvzDargUZTDcy7QI=; b=SHEfxekyZ7yfjC+tw7SoR2u9yjSim0obd62kJbpEeNNT0qqdH+mPa/13s6Y2M83YIy FqBmKxCllByLJ1VDTpkeH6koOL7GWdl4ZrGEEDFNnMHWh+sixCNRTZLpBgBsSEuvfjK5 3x243RYSkdglYsvqaYpN1PUwV2ObyNWFrvvhKrP+J3gWpan1avKOab6u0bY0TBhOqU8Q JlHHccj7cNJzMjZeSr+5Y0b+Zu6DYft9M+AJwP0EvJtM8gdMAAiCNLRy2wFMtXYDOn6u IkyJfOu+1EsEZS6HtninDZlmVM8zgfT0OKgiplxoSrhRTSK3Hj3M7m2m2LpMYB3apVIZ bBGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697814416; x=1698419216; 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=DGRPHT/WBPalUJTx91B3yYyqtqOtvzDargUZTDcy7QI=; b=fOS1KMNdLZHxZ1Yqo9R9jweIkP4XQmrQZwFLddNL0XnmcE9BW1TBJ4/1mBvNJNlRwJ z+/vQ4OgRMgQiNAWs00xgj0rb/CD4qdDGhAinUwMY4k1cP5V2Zir/4IWg8tgke7s43+l IGeKDplU2b16FCUyTVhTIsr6kJMlnG1s0vaBbim3EG5ruY+qV+tgrzFiggBbaRiRv+zU xJ3wGksTfLvtOhVqXKBcIKYHVmSXK9lXOEt6QBpGS5VDz4W9Q8I8SwW7jTvr+ZMYoN0L EfmEfW1nHOQ8Vehyj2uKawH4Tn7920NnoEL6f343T85gDixelQnv0zvju1Yf2Os8AOOA yqHg== X-Gm-Message-State: AOJu0Ywick0BvxHsZAzGJRBqt+aV6z+THTXlzSuvPLmiyg49vF3QaNF+ 1ZKK+NL7X/uCR74d9/UatU8vgnNDCybkYwYcdLA= X-Google-Smtp-Source: AGHT+IHNeoWbm/asXaUWROPfr09CIgVyIRWg2xMPIU8t+pRpJrQZfssiGPUEIwnYr+WgBbcOXgd0fg== X-Received: by 2002:a17:906:4fc7:b0:9bf:c00f:654a with SMTP id i7-20020a1709064fc700b009bfc00f654amr1755999ejw.24.1697814416331; Fri, 20 Oct 2023 08:06:56 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id xa17-20020a170907b9d100b009b913aa7cdasm1665815ejc.92.2023.10.20.08.06.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 08:06:56 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 4/6] hw/m68k/mcf_intc: Pass CPU using QOM link property Date: Fri, 20 Oct 2023 17:06:24 +0200 Message-ID: <20231020150627.56893-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020150627.56893-1-philmd@linaro.org> References: <20231020150627.56893-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philmd@linaro.org; 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, 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é 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 Fri Oct 20 15:06:25 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: 1852623 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=qObmGYqp; 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 4SBny14P8wz20cX for ; Sat, 21 Oct 2023 02:07:37 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtr5i-0006Rf-41; Fri, 20 Oct 2023 11:07:10 -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 1qtr5g-0006Jw-0y for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:07:08 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtr5e-0001Os-3v for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:07:07 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9c2a0725825so143769966b.2 for ; Fri, 20 Oct 2023 08:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697814422; x=1698419222; 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=c0zvSCA6AYDZV2ErRdt/jshRiMTPrawiKivetLDL0Ao=; b=qObmGYqpNx+Y9Yos4/6Gxj3LJLotzanwAGws++IG/gGvx6TFh5+HwSSSk4eRqWNJXH xx5b5Iq3pGbJ9kKTOYg8EFHkKxG4N2pq55Cx0iv4ku/IJbK1z1MgiEXRPDnVctMeiApk tZFWRGIWBDdAZF9RtsBqWstz2oJkdgM35WMtUzQG8H9eUTc3rKNNmhjzuu/sjXAy3CAP x0qUzEwCfq+eJCsCHFnhfM6ziy03erYIDeEC7VQJh9MUf3qtQHSf75Og1ZceCrwwZ+Sk 53EzLPBsqb9iViaACD5Mib539XM5dGcbBYom5zVVBPyqCTr9rYYz5TcmZ1dM8J8Oup3F xyhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697814422; x=1698419222; 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=c0zvSCA6AYDZV2ErRdt/jshRiMTPrawiKivetLDL0Ao=; b=j7nGbN8MpcJKaGJ8ISOHI8fZU/AxjrkMe8yyP3yukZ4CXbyFzRm0pV9a8S7JA6i7JR Mx92dACHbtwJWCBD7uONoV3BifJCp/b62Wnyp+++9MIpHIQL59ZCQwWekzkts5ub3Ja6 gnUpp1rrwhP4UKyHRhDoug9Sxr48Dtz8JsQtAuZOlWB30A87Ov9uREtNl3Bs3lnhk8aw /TD3d3qHMmb0MM8JV/Lwlp+iSezV+EAZzun2bERDghsb0V/3FI55HsMHYOomSUe9/XBQ wU2SIGgyLeKOQUybDHSJVUZ4Tu+6mkti6aQeOkIWHQiBucbpYKzO2cvTGKSKXxzKB2Sz W3Tw== X-Gm-Message-State: AOJu0YxH2vsLwqTt7mD0o6FHypncxiqT595hA4YyMsxI90B9vPrAV9lT LGYJbxZiV3cn3VIhL8qN3cZywsmQ/7D8TjbXnww= X-Google-Smtp-Source: AGHT+IEiseBgxPQUKadqWjRYy8Gxfrp1aC/zyiKLQ1MwIveSKbBVtV5nPXWg+tJiO0oOnPP3uWy5Hg== X-Received: by 2002:a17:907:6088:b0:9ad:8aac:362b with SMTP id ht8-20020a170907608800b009ad8aac362bmr1851341ejc.23.1697814422591; Fri, 20 Oct 2023 08:07:02 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id m10-20020a170906234a00b009b29668fce7sm1646701eja.113.2023.10.20.08.07.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 08:07:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 5/6] hw/m68k/next-cube: Do not open-code sysbus_create_simple() Date: Fri, 20 Oct 2023 17:06:25 +0200 Message-ID: <20231020150627.56893-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020150627.56893-1-philmd@linaro.org> References: <20231020150627.56893-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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é Tested-by: Thomas Huth 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 Fri Oct 20 15:06:26 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: 1852628 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=lki/Gtg0; 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 4SBnyn3g62z20cX for ; Sat, 21 Oct 2023 02:08:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtr5m-0006Su-C6; Fri, 20 Oct 2023 11:07:14 -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 1qtr5k-0006SP-90 for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:07:12 -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 1qtr5i-0001PG-GA for qemu-devel@nongnu.org; Fri, 20 Oct 2023 11:07:12 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-53ebf429b4fso1383596a12.1 for ; Fri, 20 Oct 2023 08:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697814428; x=1698419228; 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=z/fRhNmq79+XHZUXC8+nvKpVzDw/8FAnvz0rAnEH2zo=; b=lki/Gtg0XryT53IIrqlGJWbUN2lWwFOryfaV2fRpIUm9naXiM17v9JRSbKtSMAK6Ox rXEBHxUh3Q7kL1yeTy8MmHYa6r/18wRazb52Iw6LlzS6+iag080jinLuyTFqaTH+Xiv1 Pf22IUaxF59LXBKSUztyZ0jrzluSPjYugv3HTaSTWW+r/y9lruDmh0npCDL9CTSZqCDd arriCtSaQA4QvT+8Llsz+//NWQKQhP0RDGUaqOTYUHqArbk8EkD0y2itB8ihe/quDszj 2GEH+a5VUuAPwIU6t9xFX0WphfOtQ5hAqjN3jbADozY3nhXGVRIdLEnUAnTY04Sclcuh emDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697814428; x=1698419228; 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=z/fRhNmq79+XHZUXC8+nvKpVzDw/8FAnvz0rAnEH2zo=; b=cXUCoyvId4Qzs4mvzRCNjmerRjgwuoRQMn05hLDHABu/rGjpVTZDdWXPfwUyZfWwsM MQQW3O/IK1d/saau2JuYGtHpFpv30ImjuyAfv88hkWHiT1brSmXpu9E4fItFyfYihSgd iSEj+2wQXg2/kBtXG2KgFjrqWV+ge8Td2Vc1zY1EK5FzQkC/PmLvh+TmDgkbluPDQm6x OmANeCrMw6phIieWJloSr3362TNkTgpHt2RVi2WiAxFbellyYgHkIHjC4dUHcmR01xm7 zhw9/Q4xC0KZXrgKF6iQfVz2V9vdOiNogB44hMruvZCO5XV3y+r7K5X6CFU6YVgN3wZE iKHg== X-Gm-Message-State: AOJu0YwMIDn0LRk/0rwD62WEgZggoWDcmUe98QgqlZOp4CNOoSUlRA8i NclqZWVRRZ3U/jg4fkjy1eunj3M4KCElTmlmRdA= X-Google-Smtp-Source: AGHT+IEzg7gMhvsXYBUwo183EmWt6jShB8u7ucc8N80D2uNRbtsqa32mdbXOKOm2SuIF85P7aTBbzw== X-Received: by 2002:a50:9fc8:0:b0:52d:212d:78ee with SMTP id c66-20020a509fc8000000b0052d212d78eemr1644661edf.25.1697814428448; Fri, 20 Oct 2023 08:07:08 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id j8-20020a50ed08000000b00533dad8a9c5sm1607276eds.38.2023.10.20.08.07.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 08:07:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 6/6] hw/m68k/virt: Do not open-code sysbus_create_simple() Date: Fri, 20 Oct 2023 17:06:26 +0200 Message-ID: <20231020150627.56893-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020150627.56893-1-philmd@linaro.org> References: <20231020150627.56893-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=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: 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 da35e74bd9..31038b8bb0 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;