From patchwork Thu Nov 2 10:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740440 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp738410wrv; Thu, 2 Nov 2023 03:08:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEj+EqxJoHLnErAAHaV+WiDAY1L7QzP0/R+zZuO0DxFLhlqqxgt53wj0rjS/bKEBseOmzus X-Received: by 2002:a05:620a:4622:b0:773:ca5c:4556 with SMTP id br34-20020a05620a462200b00773ca5c4556mr11213834qkb.10.1698919715479; Thu, 02 Nov 2023 03:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919715; cv=none; d=google.com; s=arc-20160816; b=cUuAXhqpHmMtpUh6ncwONocr2m+FmqJ/IP6jvHtf1a4OimQmeT9jddPiqg3LN8Q8NT M37UE2JjcR3kDFwUgG/a3iYelGP957x7a8Y5rXtzAu1QIBtFklpGvrC2bCF4d0EheBgt 19wM/GPd6WoZ2wx8r8xOq6NtqG2RH2vWPOQbbRANue7R3Xkz1gj7x08irxx7D+ZhLD9m 2M4G7kFqlWozh8jkD/2xNeJ7BLiinDGJjUrnDPs88MXvd2dzKBTqebEd9sEwQpz4KWhQ cc94CyXm3AWqIvR91Ng4jJaJhvYkzK2N/mLroW+khsFWy2ZOHY9GHdqq5BUkM8YdIZNt Xsxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=1g5l7WLPwmx/2FQG+3S+vPUT3Z4s0SPpwegU2qPgNuw=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=ZoVKKqX+xksE2DWWim6ot764/VMu84Z61RWXJlPFTCdo6alp0kkdUagFZH51XLm8rT 8XciyZEMpMCfS+fA/9aDYvQxIpsXfCBGJxaeC3XXIDeNlgvkjwju7s8J+g8rXatYR6A2 lckqGiHyPS/Ocz/GwGazsZ5erCAgy4Ow1vYTbbiU0npyZKb3e8BTl2mVxHa6icszywt8 Wy+dCZYKnox+/d7WDMqwK71ZuBmbtBwBve3Y1QhG3mTWLKnfYVyHXGcNMLTBJ7DvOcgi f/o6AX1gGCaO4Ebwit0Swyw9w31HAk7cibszUzJEhgcNo+j5s7vs0tgiP6ROVXPXpwsD U5Qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k28-20020a05620a143c00b00767dfe07ec4si4019501qkj.164.2023.11.02.03.08.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:08:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaL-0001nN-1p; Thu, 02 Nov 2023 06:05:57 -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 1qyUaJ-0001mR-3N for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:55 -0400 Received: from mail-ej1-f47.google.com ([209.85.218.47]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaH-0003Fv-HE for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:54 -0400 Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso115437366b.1 for ; Thu, 02 Nov 2023 03:05:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919552; x=1699524352; 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=1g5l7WLPwmx/2FQG+3S+vPUT3Z4s0SPpwegU2qPgNuw=; b=DmGo06lZAmdxB/qR6iawjZ6Ua5wd8G843uW44q9V/FUIOdORZJ+mCj0aKkN2NI8BmT 2Tf93/HgtAW9y0uApXeHuSDh4INskXBuVtVYZsL53ZjYrYwuOAz5S6jkThWt4rMO0h5K K7cjFwWrwi+Co6LujG2U19o8wsMCf3jJhDuy9I1jxg6M3eHGa8PYB/VvrLXgZVFjnE01 5wdm3kZb7lP/obRnj77cQ/93cC1VI1u8rrpA8LMC6YTqOxNj98ajnuT+NIHly9uSylYe Ay3WC9PbiKkFFLok4TKxeeZYGxFLkMgSs5yFnkiP6kABTYRpL7DWRoVFghXg87g6YbX5 inNQ== X-Gm-Message-State: AOJu0YwYi2u5cut49FUtfNDyNl9ezLH6+ahTUz0wejsS5jYfoTshfrny 2bDEOnPHsgWW41KbAvK4wLS8LR+WtDQ= X-Received: by 2002:a17:907:9289:b0:9bf:388e:8e93 with SMTP id bw9-20020a170907928900b009bf388e8e93mr3972942ejc.0.1698919551849; Thu, 02 Nov 2023 03:05:51 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:51 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 01/10] hw/m68k/irqc: Pass CPU using QOM link property Date: Thu, 2 Nov 2023 11:05:34 +0100 Message-ID: <20231102100543.4875-2-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.47; envelope-from=th.huth@gmail.com; helo=mail-ej1-f47.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Avoid the interrupt controller directly access the 'first_cpu' global. Pass 'cpu' from the board code. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20231024083010.12453-2-philmd@linaro.org> Signed-off-by: Thomas Huth --- hw/intc/m68k_irqc.c | 10 +++++++++- hw/m68k/virt.c | 2 ++ include/hw/intc/m68k_irqc.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) 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..e7dc188855 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(cpu), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(irqc_dev), &error_fatal); /* 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]; From patchwork Thu Nov 2 10:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740442 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp738493wrv; Thu, 2 Nov 2023 03:08:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoyq6bet54fxF6nQ2IzwNXtfBjEu3WOHlxiD/yg8vo7YD6o3+6ANyEgwgWix+4uCrJGao4 X-Received: by 2002:a05:620a:4d8f:b0:777:6d:b877 with SMTP id uw15-20020a05620a4d8f00b00777006db877mr15189611qkn.68.1698919720865; Thu, 02 Nov 2023 03:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919720; cv=none; d=google.com; s=arc-20160816; b=rZgzxL3MZtrmMBu8kg6ab+4L72NcqHnPaxPtE6iR/YSatWycHR6lhGrETELZcSq8Ax Z82/EKhsPKGkBDEFyUjnMOY46Ruaq82NBhWortB4C0fABbvxc3d09bSh8eYWfZQYRpQe m96zCdnHIw2a/WATpSlHAsUqCKZLwWNFPMsO6z1zI+F5L9U+UtX9lW9o/ZILTt72rk1g AODjUnbVu9YVgCCAsHLcNaicGc2PqTQ6u2/PJtGx4Eq6umNMaYK8WnMpyHWLrYIwXe1h /giAxmlwAn8WV4WimWzYKzIHFiFluI30vzixepOo2Vut23mcHAyQTlO+shOfQpATcKUW mFCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=nL0Y9TbMWZl0LQx6cxYpTPkWBi5TFH+TySFwvCTQt/Q=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=nr4JmO9UNa5X0KL+iV9N+mCTsuFEBXbFDj47eqFsRETDFtHm/WyVI86SfACh31/DNp DB+uBpX/AVsxOKArmmUw9KfvF1I6zL/TQARoBkPsLKSwZ+Qjk8dOeOddvKb/Q/Yg8l4j IzWMvpmmQpmgD3D68vDvJSdODbZ/PECxwn8ihQ13ZehX0oIKUnTw74y0sehxDaqrHQce 2kvPaz2fN54w/nanpM/Lh93M6WRu04YchNGlDp2mhX+wpXU0b7enJFtKG710UyECIazc c/3gsTmsA89FL4LUBFBYgfHZYzt16NxO8EcdTu0HCeRWtlDJ+0vLNnClinB4KE6WjveH jwxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f4-20020a05620a408400b0077433fe23b1si4208619qko.277.2023.11.02.03.08.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:08:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaL-0001ni-HN; Thu, 02 Nov 2023 06:05:57 -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 1qyUaK-0001mh-4v for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:56 -0400 Received: from mail-ej1-f54.google.com ([209.85.218.54]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaI-0003Fy-Ki for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:55 -0400 Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-99357737980so108573666b.2 for ; Thu, 02 Nov 2023 03:05:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919553; x=1699524353; 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=nL0Y9TbMWZl0LQx6cxYpTPkWBi5TFH+TySFwvCTQt/Q=; b=I3+rRo9D1Ch11P+aZcxmJZWYxQP7QNlDyfBlRqMqCa0LGTp8x3/i1xbffm3NASyFVE 6/zL89/4zmamHgMZpFcIYQBfJyaVEnGXdFia+HHTFsEtcOLH51b/wLF/z9JzNl10E6+F NJ2mWXW4aC+h/NUePlWLZDk0Ps0fa6z8dhsRK4uti4ieQ86frR/OsjiUvMl0W7PcqwiH 7BWO9ugoF/6ypBD3yMLwkyDo1lo5+4yk28ZENNqcUBKQihHdeYiotMjaAYVOT3KeSZH5 z/hZUT1W/j7ssPc6U7iI6MuTMNo+uhdMd+ZDmoyi2bTN9bMEdq8VP39OZEOJhCeseRNh tWvQ== X-Gm-Message-State: AOJu0YyIOBg0ym0L1GBVmvsTJJVRAKIuafO8YlvfVk4FYb46P5XKF82O lLqrhn+G3ABIG0zlu5F+aU8akJgcprE= X-Received: by 2002:a17:907:7255:b0:9bf:10f3:e435 with SMTP id ds21-20020a170907725500b009bf10f3e435mr4210725ejc.1.1698919552892; Thu, 02 Nov 2023 03:05:52 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:52 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 02/10] hw/m68k/mcf5206: Pass CPU using QOM link property Date: Thu, 2 Nov 2023 11:05:35 +0100 Message-ID: <20231102100543.4875-3-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.54; envelope-from=th.huth@gmail.com; helo=mail-ej1-f54.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é Message-ID: <20231024083010.12453-3-philmd@linaro.org> Signed-off-by: Thomas Huth --- 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 Thu Nov 2 10:05:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740441 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp738381wrv; Thu, 2 Nov 2023 03:08:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnOsKc6RLEPvYGQ50dEsfLT9Vefh/1dzkorW0u7xrdhMbdgMP+c/cpkML0GXKgYCwdvo8k X-Received: by 2002:ac8:5951:0:b0:41e:1d17:4ca1 with SMTP id 17-20020ac85951000000b0041e1d174ca1mr19870828qtz.67.1698919712203; Thu, 02 Nov 2023 03:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919712; cv=none; d=google.com; s=arc-20160816; b=OcjM3zRUKVEKuGJ8KHb74yQ13TNozz2Af650t5EHrphu9Qle9M7a1OB49fyeDZKayU geFPlD50Z7vaXEM/O+obFQXfM9YiLsNDHK0ttgcnzFaCN3eUWkVDk7bIlsl545NX7jEy nZKn5+uquRfjt0Np/IrY+a+i886CTwCKECZ+dJppmszH0oMA15bBsexZIcTp3nTVcruz +bT9Ik3G+n4IcfSjAvCSpK/6ugpas4JE4sPLf59nGoemd/2ttO6kF43q5ZsP+G5ohrWc Sj6p6kPm4hvGEM6OSKTjA957J1jgVpr02DmlUXdd5LkJn0oh9mbFetMKB/5AjB81JGXQ gF8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=HHTnDGBwSfNOPSScc4QpqW/YOvwGN4xwgsL/sR4G1s0=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=g2yA00WFsEB1mXFH+txnHUQCsJ2wXWAak5zTd+Re6zV3owN53p3pIU0TCtLD4yr9Bs 3V4n51+WnD9W47zxQdkghaElYnTftI0DKilZfdNzA96fwr/gd62djDTJQ9MrklPFHHnC lWgINCcM/w+7EnxqbQqlFouWCpVRM3cu1tUnjLTcxLZuMApuMSKmbD4U9lQ2uWfis1AW TB3USSYVvZQH8HwOguxvwQ55EnORAliUx6pnZMidlnQdp9fcU247TRulR9xe3Gwsdpae DeR9CAUpHST49F1gWK04G8PXUVWZ2N9rW4rRp6r5YAxZbK7IvGenEenw226gBjo/MV2A tUrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b12-20020ac87fcc000000b004035b30ed1bsi4236240qtk.589.2023.11.02.03.08.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:08:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaM-0001ns-4h; Thu, 02 Nov 2023 06:05:58 -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 1qyUaK-0001n7-RY for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:56 -0400 Received: from mail-ej1-f43.google.com ([209.85.218.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaJ-0003G6-CB for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:56 -0400 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-9d274222b5dso113710966b.3 for ; Thu, 02 Nov 2023 03:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919554; x=1699524354; 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=HHTnDGBwSfNOPSScc4QpqW/YOvwGN4xwgsL/sR4G1s0=; b=GTOU9+B5K6gI8OOjDpK21RGIySp6dHrry34g2BLZzrWvywghh1st0hLYabTRhbQ4zl ro7QTh3war/dLA0PyLfmQRJ+no2QJkIteC21y0yDmEFOcstofxvpQVA92bI+UsZh/BYm K1Fl9vOPBK5fmiFlm7CM3wIeQlhjJuzLno5KnP/EaSUmFX6ZOimjelitBCGUzeRbGGnf QkpOWvoKTstEuAsDp5OtitX11nDFTUCq0uG5BfW3VaMjm8qG5PBPFfkNWUAAas0r8cpl baR+EWZieHpBFohMDStzdFGmy6sEPJqVoERw/9ebtR9KfnyyIpByHoqZsq5xzBDXZNzw FwoQ== X-Gm-Message-State: AOJu0YwLJH3PFXH0M3n3ASOfBi0FLWz32qBRgyVt8tiHQpZ2PEjq2cbM ee4Bi/brWpfziUxwhNf4IKw2Fz0liBo= X-Received: by 2002:a17:907:3601:b0:9c6:c987:4434 with SMTP id bk1-20020a170907360100b009c6c9874434mr3536547ejc.45.1698919553890; Thu, 02 Nov 2023 03:05:53 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:53 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 03/10] hw/m68k/mcf_intc: Expose MMIO region via SysBus API Date: Thu, 2 Nov 2023 11:05:36 +0100 Message-ID: <20231102100543.4875-4-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.43; envelope-from=th.huth@gmail.com; helo=mail-ej1-f43.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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 Message-ID: <20231024083010.12453-4-philmd@linaro.org> Signed-off-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 Thu Nov 2 10:05:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740437 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp736987wrv; Thu, 2 Nov 2023 03:06:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHB1Wx3B4gGCcN/DT8gpsZOSAuzuPNKoLOwnx42BS0Be0RQE6ZL3AclAMjG8bs8RVvHy1nF X-Received: by 2002:a05:6214:29ee:b0:670:635f:6c67 with SMTP id jv14-20020a05621429ee00b00670635f6c67mr17427743qvb.63.1698919597280; Thu, 02 Nov 2023 03:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919597; cv=none; d=google.com; s=arc-20160816; b=v6sqbf2EpYzVjCrLqYV2XojvDQ4YotFVEPNl+Zq0jY/90CGaC58BlLgP9vqaCsSPb0 S2iP/tSK6mPRrSIXJrrf+l9uuZ0FQwD00QuBiEZ8cHAUhH4QqpdIbvhhdJQZiwpaxYkA oLyBQU/T4TrjSCvqcb3Pdm0YIIOrj3UeAzLMWoXCvsa1zkgC6YA9Ubgyg6amHyvTOC/c sqf2Vv1DjkOvM6OzP5eE9dmKpOGLdLS6D0Ct7FJoOkGTGMa9fqxAvPlKigLG1jynmnH+ FkUwopoJfO94HQd7QqOsY/KUCsp2hza9ISRnaxXBn55k+Hizfy098TqSU3kHDDNL/Aa5 qSOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=b4aU3XAKLeX+XGRwvVl+KDuHHFhHb9tLltsT3xNn8sc=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=0azjOUJHykB0Xb8JF6NKy0+vEhjGpTvRXK/s9hC4dHQ/Pw/7wMxfOjR0y67ZtfCTpY t0NysoftWStiknubuMfarlUDeeT48VljZYpL9XAUJRPvhmXg57b6ly+prGXIMf+WTpXR sP11XmDKZVfuAbU4e9KUv2y12HwWb/KkaJnV3iPXLPbGOWKybpKBTBzF3xjO9XC4N+l4 rwIleJoC32Th2ex+efJPvYGYm5s92dXKkKvPAVSKcl5IUlFiMgjC9Daayfbch6LCxzWU X9xLCUNF13SBdoC2XyJA73bJHrCjEVg8h/fv436Kwk81oTISwdjddbHJ61OAlCSYGyiK KGCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v6-20020ad45286000000b0065d051fc43dsi4101017qvr.187.2023.11.02.03.06.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:06:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaN-0001oV-Rn; Thu, 02 Nov 2023 06:05: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 1qyUaM-0001np-06 for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:58 -0400 Received: from mail-ej1-f46.google.com ([209.85.218.46]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaK-0003GO-Dn for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:57 -0400 Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-9d224dca585so110991766b.1 for ; Thu, 02 Nov 2023 03:05:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919555; x=1699524355; 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=b4aU3XAKLeX+XGRwvVl+KDuHHFhHb9tLltsT3xNn8sc=; b=XgoW3ISEbTnof3S9+0vOsUIyDpiHoC2tjynBpw4g3ac2E6eg38fJBtdJ2uQtJHK+70 0iRDY7eVh2iOrbHJDcGaQfRsdd8w80AZepSZAJy7dcHHXq8qXmf1enVesBaxoh4mQldN psg6d05YntWlMvdDFY9cdFs06LBG2NKaAkMcnk7cpmwjKjXusI5hNlUHxjQseHV4kCYT /gOE7Ay3uRMPBM0NNN1tGwRvp1WfPYB896TJ0Ag5NtWaXGOQp6nqijj7dKL/YV2vHlVT +XZuDsWq+ZEpJw/0qlgh8uqr5Xr11LbrjmYEDs5uoPexn6UIojZTIChHH/eHVn/6apOb K8/g== X-Gm-Message-State: AOJu0YxPIS3BuiQ0EhHvuDajw0zzHznraNneoDHykgRd3R1jIug0pDDs bhpBtSlIITFFyFeXy2B1OO0R7+0XnqQ= X-Received: by 2002:a17:907:a45:b0:9a6:1446:852c with SMTP id be5-20020a1709070a4500b009a61446852cmr4074504ejc.27.1698919554884; Thu, 02 Nov 2023 03:05:54 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:54 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 04/10] hw/m68k/mcf_intc: Pass CPU using QOM link property Date: Thu, 2 Nov 2023 11:05:37 +0100 Message-ID: <20231102100543.4875-5-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.46; envelope-from=th.huth@gmail.com; helo=mail-ej1-f46.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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 Message-ID: <20231024083010.12453-5-philmd@linaro.org> Signed-off-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 Thu Nov 2 10:05:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740436 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp736985wrv; Thu, 2 Nov 2023 03:06:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9lDqmJ0vfMoytTxIvgLfDmwC5aLZbws8Yk3cy3Z2z/lR32dCEj5xgQA4Jh+VoNBs8tr3y X-Received: by 2002:a05:6871:490f:b0:1f0:597d:fe25 with SMTP id tw15-20020a056871490f00b001f0597dfe25mr492310oab.45.1698919597281; Thu, 02 Nov 2023 03:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919597; cv=none; d=google.com; s=arc-20160816; b=TSCLysDowPK4eZLJrUv2tO0s6uhR+z72gK2E7S+xKoFN8juk7egWD8HR6Yr4L4J7GL wh5U0edz47sAIIMTOYiBvG6MrJ5aWDfBJvzFb4ooBiZWdZ1rJGVPQ+ygDus+v4ESCLEv FObkkcQOrgvgeDeXmb90pEBlU/WIOopJJM69C/IzaTZYKe7IYPzdJRCGWHzlVC3SOzB3 QvJKBpt0YlC/OyLGEGtHC4vu0q213kEn/zKp8SSrEQh3DIF8HP/I70NPw4OQjA9yHHLx 3A1jgzJr+UCFLgzBp/0FO+Nqjg+PaWla7yehvibRD8RpGHVW55oRMQPnoX183h1wtLLw ABRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=bf2kNhCkpvCEnz1DEQWyTqLO5YTEMKoovu/EJ+x2rmc=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=Y1RUX7QftIIlLCcpLrLFlKT8HjcreUtcMYqRHcAX3t5a86hiFi3+r48OxPZUv59hBB ZapzVg8HhcGLY5zGrEUdUj3X4Gxb4R1+jVkjU7Fm4O7AVR5MwohkagpTDncXLOJUm0pm i6eE0sQWl5YI+/kJmpT5YpulaMhPTWkwTrErL0lvFiwFb6HbskKOWm5eV/wqAAY0hqOQ w2OBUDsxiy/rCwTmXr7mwhf9mq3yQu0TpogfCo4XYoY50choDQaNTQjIfbnZaEIgnXwf RYDGTyN5VwxxcAmYqTRIAfjI9xCQ02i8Q+WMhXaFNINUSIhO1KBCc4yd0GIW6J+YSl2m XWBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p10-20020a05622a13ca00b004180bc0da71si4147169qtk.71.2023.11.02.03.06.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:06:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaQ-0001p5-F3; Thu, 02 Nov 2023 06:06: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 1qyUaO-0001oX-Io for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:06:00 -0400 Received: from mail-ej1-f52.google.com ([209.85.218.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaL-0003I3-TS for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:06:00 -0400 Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-9c41e95efcbso105642966b.3 for ; Thu, 02 Nov 2023 03:05:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919556; x=1699524356; 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=bf2kNhCkpvCEnz1DEQWyTqLO5YTEMKoovu/EJ+x2rmc=; b=Y9RynoZSUVQ6ASsscJjUzgIzB6D/qzpmfoBpvGSXSG7jneptT3cSyM7rxbd9/b9JQD 4IvAXFfj02PM84jWiZbEHGk7uhlO9e/q5BErsjQrguIdPxJ7E2adTIvIUhRJAK5r3nn/ v/ISodVEqaTqTzRHYUQQhYK86x8XRKpWtgnlKVMVEiFhLgpNWwuGgHstTHcvoG3CCZiq /3tbeYJUZMIO8ML7tje3LsP7UfgJ9255FKiMT2I6SqyKrBV6X54ntGAVAaQYFNloQCM+ OCSsguSO5lHhRATZj0QJimJmW/cMIKDZU81shn4IEVIn22eC4Qp3VXNrIGPOVjGUdzww +7yg== X-Gm-Message-State: AOJu0YymyL9RoyrC6efREhfW7MkL/MRQUDuKn07ZWhaP75V3hBddNXUw RLRSQhtt3zUF5m1e6mmh3vjaebvsrUE= X-Received: by 2002:a17:907:97d6:b0:9bf:77ae:3aa9 with SMTP id js22-20020a17090797d600b009bf77ae3aa9mr3773951ejc.24.1698919555867; Thu, 02 Nov 2023 03:05:55 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:55 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 05/10] hw/m68k/next-cube: Do not open-code sysbus_create_simple() Date: Thu, 2 Nov 2023 11:05:38 +0100 Message-ID: <20231102100543.4875-6-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.52; envelope-from=th.huth@gmail.com; helo=mail-ej1-f52.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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 Message-ID: <20231024083010.12453-6-philmd@linaro.org> Signed-off-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 Thu Nov 2 10:05:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740439 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp738371wrv; Thu, 2 Nov 2023 03:08:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoS33wr4xVR6XX24k3LNaHutBE7jSl5yRtYpT5lUh+uLUin7Xa/6Lor8K/pHjj4zLgEi6X X-Received: by 2002:a05:620a:29c6:b0:774:267d:4252 with SMTP id s6-20020a05620a29c600b00774267d4252mr6710095qkp.15.1698919711261; Thu, 02 Nov 2023 03:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919711; cv=none; d=google.com; s=arc-20160816; b=J45mdAmz5p12vHX/7f6bM7yuHn5uEvJBqoa2UFNtqnZCe5hfPaFXTJQGfXkJkz88pZ kpTp3pFArJNssFdjsWkc2PHuuYLZU87a+D25iMexoBELKw78oe7XRtMAiwOTL/swOr4k 8ux+Pj3si2cl69b6v2vYKAhPKGDNPNvwbpxSFA5O4iWH3immBx+AUCSZiKLB60BWyBx1 oDt8Qw9lGM8QrwjhPKnLveuDAVppSF09B3UmHjdcpG/rg7E3ltqGt2f2DYL4xMlvvMGU +/8MWFK+/TbmjnRoK+W73n87USL17sdQewL9ygvLefCM4JayY3EHbEr7f9oCDGx7kVy2 crbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=dmbBzGtCdH6WgFZlHcRHMhoK0u8/EdFxfTPO8UY1JO4=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=mQghUMfCpFalQbodnptJoKcQpNWnSubryCCHKqJ9w5WM/nij/hrX6UFn3Ue+tEpliz 4rRtDd79LP2GZsGM9lDNdD/iCFB2YCr1+etOkC6odtEvjDIu+RgVYjDLy3Bo/gDapnWD ZimBRRo66YuB552jiprTXPIm7D+nAJSwP+4NMmTvAOxfhtEaEsGnqcXxUY1S0drkI+RE mCF/ddMpp6WlK+/uxdZzzhnpiaSgovcfbeu1idzT80D20hD5PlLI34EPYvLOHEvt+n8y UMK5qfYF1o/ASmEoF4YTuuEwP+bO3nfNP68YvxaDFGrmpUL+fTfTQjqyXcBWHQYJBxl/ vhcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i1-20020ad44ba1000000b0065af5e98ed5si4066806qvw.290.2023.11.02.03.08.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:08:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaR-0001pg-Mf; Thu, 02 Nov 2023 06:06:03 -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 1qyUaP-0001of-OT for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:06:01 -0400 Received: from mail-ej1-f47.google.com ([209.85.218.47]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaN-0003I7-KW for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:06:01 -0400 Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-9d242846194so107643266b.1 for ; Thu, 02 Nov 2023 03:05:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919557; x=1699524357; 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=dmbBzGtCdH6WgFZlHcRHMhoK0u8/EdFxfTPO8UY1JO4=; b=RCZq5IXvIgB/oSYDJZV0TsJ9MZFXo5xfYxSuXckKCoU1wm903LPOXfbcoGDRfoIaE4 mNnEo1wykp+vnjXNHy0OwQwexoVpHFAy6NSUNslDwtpfR6V923T98QTZ8rGnwsxJWvpE 9+NwiIMIxeIXotppduan3TGfKnvH6I/6bREZb9ldKGZ7YhkyDG0UfvthittE5xdL3mPN DhJkgwnRwHVCimRt6jhoblld34KYnuIh0lBjNvMwK4TkXXlLNupEfiQQ/Y8ygxHZBGfW qYY7VVlXW3eYOKy4NHAJRyFoVhGMKdzLWtRVt3bYHtoU5LN/2hn77CedTo4/gbM2sbjp UhjQ== X-Gm-Message-State: AOJu0Yygbh/5e/S8yQp5bXSrAct8/iRErRAFq32y0YGZ/BAGGxHZGzcV zm3b0Sminwx+2wp+3eDyHBfaA+Zhizs= X-Received: by 2002:a17:906:db01:b0:9b2:a96c:9290 with SMTP id xj1-20020a170906db0100b009b2a96c9290mr3402597ejb.33.1698919556962; Thu, 02 Nov 2023 03:05:56 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:56 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 06/10] hw/m68k/virt: Do not open-code sysbus_create_simple() Date: Thu, 2 Nov 2023 11:05:39 +0100 Message-ID: <20231102100543.4875-7-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.47; envelope-from=th.huth@gmail.com; helo=mail-ej1-f47.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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 Message-ID: <20231024083010.12453-7-philmd@linaro.org> Signed-off-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; From patchwork Thu Nov 2 10:05:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740438 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp737634wrv; Thu, 2 Nov 2023 03:07:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvY+JdzdNgpP7w86r8kbqzVdib/NjhgDp3Q2CHHF3tFC2hHfP6ON/ZkUh4l9MdI0QMDKh4 X-Received: by 2002:a05:6808:1389:b0:3b2:e60d:27f6 with SMTP id c9-20020a056808138900b003b2e60d27f6mr22855782oiw.29.1698919648447; Thu, 02 Nov 2023 03:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919648; cv=none; d=google.com; s=arc-20160816; b=tucKqdkSc2THnHO/JIJ8qcvMxQma7nPLVIUj0Fy9AG4HlZffXEnGJyJTVDuawP4Gc3 /rIaAcwckXGgy6FC78uzFbsFWTYLWOAlyATdKS0Qq2qY+71PQnS7EQgaBhAer4Y8Zf2l EiBD7PfdiSV4D9QV4uxLGJEetZn2WBPiGo2NUpLmJjaZAzsfQvot3k7jvsYmQIvaiZAh c1AjPPB44mv4mbywpTA+zdcgZw8EFnctnNMlzTopcCb8Ji/l8L0rbHviJsEfy4SEoiXa USH+xaOrRd8Y+5K+ZyDhCri+wlEA+GRphoph8O71c+4h5mGVmS+lGoRhBjjzlKv9dx0X PE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Q9wRpJQSdYBWKaTUTBDuByfEDItBoYOl7xYTvQ6DLvg=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=M99MudtWD2bopaqS3IH5FeAw0hZFQQbfwgk1H4ead5fAC1FcrCBCDkU4RItgZEafD1 CTWwyc1GlSsWOTO1LsFjh/whV9tCEkKRTAE7MsFrU+qZGCdt6qMHl3aUVIawiquwi05m sm2/2VRRnDWcA50+I/fk2OXnsQGzsfECIKg7CVaTYeUYoIQmM/JUhCM79n0S7mIebeOc f4SctyaT/UtwTwQsgTE5nG3mtU36VL1Jzj/5O7I0cczijA+Tn8F+aPL5LC4dMmfOQWWl LYsKHE6RUYc7tV8wZl+NfQDPXoiNbGt3UMtAIMLzRhmfI21u/n1GxFJORepxnGTTkAdz 61pA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x13-20020a05620a098d00b0077a2952b488si4016530qkx.689.2023.11.02.03.07.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:07:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaT-0001qY-TV; Thu, 02 Nov 2023 06:06:05 -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 1qyUaP-0001ol-Us for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:06:01 -0400 Received: from mail-ej1-f50.google.com ([209.85.218.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaN-0003IM-9j for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:06:01 -0400 Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-9d2c54482fbso113566666b.2 for ; Thu, 02 Nov 2023 03:05:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919558; x=1699524358; 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=Q9wRpJQSdYBWKaTUTBDuByfEDItBoYOl7xYTvQ6DLvg=; b=mDBo5n7CRjVIceoZYM/Dc7p0tKtRAsj4jaBpUnYQS0SOUlzkaNbKALR2VvpwcBn5iQ 0Dst488KgwNFvFTDNdKUoELdeHf5zd2QtG5pV2SIFtaw8/Kf/BVCkTXuWIgcOpcsCi0M JZWSf2suEN+x/Wh/CR+RDQPtFhV4zJypLaBCb/O73DdCitF990PEoXxRTiEcuw9NWSg6 /YmecjGSE99xp/m92h7rEMlQp4HvYnJEiwNSDTT24eUxaegAQm8/iDJRSpvKQEcfvPFD NqYXE/IJwqqv9JsvJ4a6uMEvIdtAI9Wzdh0LCoaz5HaaBag/glxaDppCfOR+kbIhKlMM DplA== X-Gm-Message-State: AOJu0YylFnw3IV1WSMqjDtmXgLm0UkBabkND8Od3g74+vdr02QQkd+SP D0nya+sXnh1Scan08obO57+McYkB64o= X-Received: by 2002:a17:907:36c5:b0:9d5:7c41:cd0a with SMTP id bj5-20020a17090736c500b009d57c41cd0amr4059888ejc.19.1698919557884; Thu, 02 Nov 2023 03:05:57 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:57 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 07/10] hw/char/mcf_uart: Have mcf_uart_create() return DeviceState Date: Thu, 2 Nov 2023 11:05:40 +0100 Message-ID: <20231102100543.4875-8-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.50; envelope-from=th.huth@gmail.com; helo=mail-ej1-f50.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé There is no point in having mcf_uart_init() demote the DeviceState pointer and return a void one. Directly return the real typedef. mcf_uart_init() do both init + realize: rename as mcf_uart_create(). Similarly, mcf_uart_mm_init() do init / realize / mmap: rename as mcf_uart_create_mmap(). Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20231019104929.16517-1-philmd@linaro.org> Signed-off-by: Thomas Huth --- hw/char/mcf_uart.c | 13 +++++++------ hw/m68k/mcf5206.c | 6 +++--- hw/m68k/mcf5208.c | 6 +++--- include/hw/m68k/mcf.h | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index 6fa4ac502c..f9cbc9bdc4 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -342,25 +342,26 @@ static void mcf_uart_register(void) type_init(mcf_uart_register) -void *mcf_uart_init(qemu_irq irq, Chardev *chrdrv) +DeviceState *mcf_uart_create(qemu_irq irq, Chardev *chrdrv) { - DeviceState *dev; + DeviceState *dev; dev = qdev_new(TYPE_MCF_UART); if (chrdrv) { qdev_prop_set_chr(dev, "chardev", chrdrv); } sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); return dev; } -void mcf_uart_mm_init(hwaddr base, qemu_irq irq, Chardev *chrdrv) +DeviceState *mcf_uart_create_mmap(hwaddr base, qemu_irq irq, Chardev *chrdrv) { - DeviceState *dev; + DeviceState *dev; - dev = mcf_uart_init(irq, chrdrv); + dev = mcf_uart_create(irq, chrdrv); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + + return dev; } diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index f920ca2ceb..a46a23538d 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -168,7 +168,7 @@ typedef struct { MemoryRegion iomem; qemu_irq *pic; m5206_timer_state *timer[2]; - void *uart[2]; + DeviceState *uart[2]; uint8_t scr; uint8_t icr[14]; uint16_t imr; /* 1 == interrupt is masked. */ @@ -600,8 +600,8 @@ static void mcf5206_mbar_realize(DeviceState *dev, Error **errp) s->pic = qemu_allocate_irqs(m5206_mbar_set_irq, s, 14); s->timer[0] = m5206_timer_init(s->pic[9]); 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->uart[0] = mcf_uart_create(s->pic[12], serial_hd(0)); + s->uart[1] = mcf_uart_create(s->pic[13], serial_hd(1)); } static Property mcf5206_mbar_properties[] = { diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index be1033f84f..d22d8536db 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -261,9 +261,9 @@ static void mcf5208evb_init(MachineState *machine) /* Internal peripherals. */ pic = mcf_intc_init(address_space_mem, 0xfc048000, cpu); - mcf_uart_mm_init(0xfc060000, pic[26], serial_hd(0)); - mcf_uart_mm_init(0xfc064000, pic[27], serial_hd(1)); - mcf_uart_mm_init(0xfc068000, pic[28], serial_hd(2)); + mcf_uart_create_mmap(0xfc060000, pic[26], serial_hd(0)); + mcf_uart_create_mmap(0xfc064000, pic[27], serial_hd(1)); + mcf_uart_create_mmap(0xfc068000, pic[28], serial_hd(2)); mcf5208_sys_init(address_space_mem, pic); diff --git a/include/hw/m68k/mcf.h b/include/hw/m68k/mcf.h index 8cbd587bbf..5d9f876ffe 100644 --- a/include/hw/m68k/mcf.h +++ b/include/hw/m68k/mcf.h @@ -10,8 +10,8 @@ uint64_t mcf_uart_read(void *opaque, hwaddr addr, unsigned size); void mcf_uart_write(void *opaque, hwaddr addr, uint64_t val, unsigned size); -void *mcf_uart_init(qemu_irq irq, Chardev *chr); -void mcf_uart_mm_init(hwaddr base, qemu_irq irq, Chardev *chr); +DeviceState *mcf_uart_create(qemu_irq irq, Chardev *chr); +DeviceState *mcf_uart_create_mmap(hwaddr base, qemu_irq irq, Chardev *chr); /* mcf_intc.c */ qemu_irq *mcf_intc_init(struct MemoryRegion *sysmem,