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];