From patchwork Fri Jan 10 17:32:16 2025 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: 856271 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp345543wrc; Fri, 10 Jan 2025 09:33:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWFFrRZ30rHubBqSSDCaC7hyjdhaHLcTZApLrK9OEec+7oHbX0c10Ta8qXS7Ew9AK2n0Cdg+A==@linaro.org X-Google-Smtp-Source: AGHT+IGquGHumVSnqGYiQq44P8V4SlG2AMuiRBQoTG0KMHTcMwgRdKR5dG+8lCVBkrq5faEo7Kqq X-Received: by 2002:a05:622a:1889:b0:468:f858:6667 with SMTP id d75a77b69052e-46c7102c0f3mr174874471cf.24.1736530388125; Fri, 10 Jan 2025 09:33:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736530388; cv=none; d=google.com; s=arc-20240605; b=kPqdXglhsvMFwObyWwflabK0qvqbTZtq2UdxxZpjZlI/SPiIy4JuJj4BuwBff7mDps RNwGC93w6kayyrAgD3y3D7sFSUuprg4eSfv8uQou3vOG+uxXFkY7WTRyVm2WuwPK4XHy RY9EkjznqvDInyLlmpGi9C3R3kshLYVP+rRPB2EAxviZg4PuAGIbCKArLMEMqGrfm+Tg xzuS+T+8b3loZlIfB7UT79uzvOJRmwFyQbBE9i0HKNaEe8XIlxzdGWsVnCuUe0OKYrQM 4GnqKBqaYQLoh5jXpksFJRQqne9ZJoHY4nlz5edZZcoR1JN7Qh1ZRwioEKyUICyV3cwy fIaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:dkim-signature; bh=pG3zaZWN3xKo4fMPNgWXUV42ACJFQFragGulQEy5rlA=; fh=FgOHr1JLjn5gDuVLjDE9qQ+3Zq8rpKvSSD5fv0m1jKE=; b=VBWu7WPmeyppB6bSnbQtB304YWZnOr2e8gvHM+h0dYJNGnRaI3iZHtjkqbcPcUcOa3 Dghwfz/iBozi7iiEbw42HmuNoz4dIdaStUAbLlLLQlcIMoJJTA8c24OQGHaOFqwholRr +IgAoSKWYkSwZlFX0itDS2v5Zn/CC+6QDQO6CNDpvhgnTGQYqmQwrhLhW/qSBxg9ym5O XIJfwD8yHIORYNzXJoKcTIxybU5GjijyOgIPEwBsWN/PwyCNW1kSg/tCn9NTcf91VKVy 4hz/tPAFvk6/s5a78hrQ5u3q9+gdpWxYg/oMWBjdrr4geyxOvuRNQgz6YataW2hS8bBv sBLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rILu3Q2J; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46c873323cfsi27921311cf.52.2025.01.10.09.33.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jan 2025 09:33:08 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=rILu3Q2J; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tWIsG-0005WP-0b; Fri, 10 Jan 2025 12:32:44 -0500 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 1tWIs2-0005Tc-FQ for qemu-devel@nongnu.org; Fri, 10 Jan 2025 12:32:31 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tWIrx-00009I-UV for qemu-devel@nongnu.org; Fri, 10 Jan 2025 12:32:28 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4361f664af5so26912405e9.1 for ; Fri, 10 Jan 2025 09:32:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736530344; x=1737135144; 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=pG3zaZWN3xKo4fMPNgWXUV42ACJFQFragGulQEy5rlA=; b=rILu3Q2J0k6CtlNaKLAvB3faC6aatfR0BEKoGkmdlULzmClOJCiBEi3htZDXaf7lwm n8oaGJiZGIjPYdqCv9Q9JxIbXH1rT7jzjbHEA3hUVy9RI/c93+5E4HqBqBjjozlhHGsX bUP7ABqApoUVn+RAWrfj3ePcS6zZC2Cl8D+TL7dhl+ECaGsshEWPwgwchQZn11UiOb0a sf0n6y8efOy4JzLlreOig2oB0gH1c/vb0KBO+WEijCP4Fmia4IXb+4tNwD3UhUkrFCHg U+G8tIom1Yidi009GwDshVWbWmhInCYtUWcfXIHiVBQNiNEHs+91eb1r3F//sIrMobaD f/pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736530344; x=1737135144; 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=pG3zaZWN3xKo4fMPNgWXUV42ACJFQFragGulQEy5rlA=; b=cRVYxtp/YZs6tGbHgK2Zs01ysVdyHmm41ffVijXU4DugfxE1jZpyV/05Ug9vZv7A9s kxT+zyuzSTDTcyAAU4VBf7oyT5ISTE+pgm3fvIpfr8Dsq5fQFcBxm3jlFJpPCTgODoMX 96ox3jNg/V5Eh6eLWZEG07xI/G2kC3/8FejNAGyqFrO4+zuqu0ZDlCKRg/HGRcK9DDgb iu+ibcZMc52RjLOYV+2e5PbbSl7uqliat+M0Lrn0HS3jCOjytj2X/TR4w2EtbhCXMNM1 Nob3dFzrFsp+0mYxyg/9YNEoOCX7RYPToC3lQzL/la7C7w5kK4tCTaKjUCwlE70IeKX4 k2hw== X-Gm-Message-State: AOJu0Yyac7uCuvniIzsN60TwofHSHG6RNeYbmkIu+VEwjrbjlcIf/Zfb cfZ5Z1aqvOZX22nZANLveLch4YaHe4g6v20fakkRj2nUKKh/UvvbH1OkkKe+HhM15bnxRsvxyx6 1+cc= X-Gm-Gg: ASbGncve/sMmNOn0z5srgLmurHEstULEXCsi7k21XAxJ4w5j5e5aU5b09rCbwsyeh4V xx3cZX1WT9Or9XT5+l9hvYL2qpOCKKL0jAMdJopY1OkmyMHM95YBxaK0n2yvaZYuMiG1ZBzJBio MmRh2V1dbAk18R6/5Yyzo6+Q1QjmlVI1hjA834zZek/7oUNYrjpP+Ve0f/B6GATx+IRj3QLeFCt sEUOfu/oiNJRTyXH+c5kN+DSrSUjqp81Vg0QOi3ABhUHQtCGwyXqimAO8RfohLJr+e5Q5S3rZb6 1x9eAct8RkofRjGRmARXEQTbg8HWOgU= X-Received: by 2002:a05:600c:511f:b0:436:1b96:7072 with SMTP id 5b1f17b1804b1-436e26867f6mr117937825e9.5.1736530344082; Fri, 10 Jan 2025 09:32:24 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e9dd1957sm58173665e9.16.2025.01.10.09.32.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 Jan 2025 09:32:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Herv?= =?utf-8?q?=C3=A9_Poussineau?= , Gustavo Romero , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/2] hw/ppc/prep_systemio: Use link property to remove &first_cpu Date: Fri, 10 Jan 2025 18:32:16 +0100 Message-ID: <20250110173217.80942-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110173217.80942-1-philmd@linaro.org> References: <20250110173217.80942-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In order to avoid using the &first_cpu global, pass the CPU as link property from the 40p MachineClass::init(). Declare the link type as TYPE_POWERPC_CPU to have the CPU type checked automatically. Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/prep.c | 2 ++ hw/ppc/prep_systemio.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 3e68d8e6e20..88a9b0fa7bb 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -324,6 +324,8 @@ static void ibm_40p_init(MachineState *machine) dev = DEVICE(isa_dev); qdev_prop_set_uint32(dev, "ibm-planar-id", 0xfc); qdev_prop_set_uint32(dev, "equipment", 0xc0); + object_property_set_link(OBJECT(dev), "cpu", + OBJECT(cpu), &error_fatal); isa_realize_and_unref(isa_dev, isa_bus, &error_fatal); dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(1, 0), diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index b1f2e130f03..7cbf7e4eecd 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -44,7 +44,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(PrepSystemIoState, PREP_SYSTEMIO) struct PrepSystemIoState { ISADevice parent_obj; + MemoryRegion ppc_parity_mem; + CPUState *cpu; qemu_irq non_contiguous_io_map_irq; uint8_t sreset; /* 0x0092 */ @@ -255,14 +257,12 @@ static void prep_systemio_realize(DeviceState *dev, Error **errp) { ISADevice *isa = ISA_DEVICE(dev); PrepSystemIoState *s = PREP_SYSTEMIO(dev); - PowerPCCPU *cpu; qdev_init_gpio_out(dev, &s->non_contiguous_io_map_irq, 1); s->iomap_type = PORT0850_IOMAP_NONCONTIGUOUS; qemu_set_irq(s->non_contiguous_io_map_irq, s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS); - cpu = POWERPC_CPU(first_cpu); - s->softreset_irq = qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_HRESET); + s->softreset_irq = qdev_get_gpio_in(DEVICE(s->cpu), PPC6xx_INPUT_HRESET); isa_register_portio_list(isa, &s->portio, 0x0, ppc_io800_port_list, s, "systemio800"); @@ -288,6 +288,8 @@ static const VMStateDescription vmstate_prep_systemio = { static const Property prep_systemio_properties[] = { DEFINE_PROP_UINT8("ibm-planar-id", PrepSystemIoState, ibm_planar_id, 0), DEFINE_PROP_UINT8("equipment", PrepSystemIoState, equipment, 0), + DEFINE_PROP_LINK("cpu", PrepSystemIoState, cpu, + TYPE_POWERPC_CPU, CPUState *), }; static void prep_systemio_class_initfn(ObjectClass *klass, void *data) From patchwork Fri Jan 10 17:32:17 2025 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: 856270 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp345540wrc; Fri, 10 Jan 2025 09:33:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV/gAx6yCTeCuuzM+fzoEg6JJSsRAI3lwX5WoiSj3AjBaj+OsuscGlgCQuJI7chapCUqXqhBQ==@linaro.org X-Google-Smtp-Source: AGHT+IFBpLPOSnyhglHr8svZs5JpxG49+7sEoBiBmZMVYCvur2nYJS9YS2G1GnGCS3t71BJek4aQ X-Received: by 2002:a05:620a:4796:b0:7bc:db5d:aeb6 with SMTP id af79cd13be357-7bcdb5db077mr1119006085a.42.1736530388091; Fri, 10 Jan 2025 09:33:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736530388; cv=none; d=google.com; s=arc-20240605; b=ZIf4nU8xPyT59DnOL72Cu9/LbbmLeJm4QoshsRvlki4i4hGz8OTopKOGGNWaWDGlee fUNh0OFIz/xjhqMyl2/AVPlGVCFQm0CWTf/mFoHS/8oW+XHRWK8x0LFd+EHyEz9/BUwg Ou3WgU+QgW+9XE2ChmOkrVmntSsoPA3oBHszEEJfCS/Da1Hu6t465OcgFkeqvV/jHRrE /3GEZD+xuXZ9vFuE3awAV8as82I9lxcye9P9ZArfUstPdRIL1EH/ZF8bxjYddsq33Nwd 9I3Mp5ZWAIwRI4MQa6q1zdPCnOX6qeRDIxCXAD+ygOZqZrJeNPB8YSmmeGQ0AqllPZZW 8t+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:dkim-signature; bh=nNUbs9+iXWkzUulkoWT20NOwr2Ic+DqflysU5aQWhXA=; fh=FgOHr1JLjn5gDuVLjDE9qQ+3Zq8rpKvSSD5fv0m1jKE=; b=ZpEcPEhtlN3ectOeSIb/zpS+XpjgNlXyW/kaclGbL57SmuULZjHgtaDJV+HschivBv ux8fCC1jhRLn1M4IxpmUNmXnrDAGPn3Rd8lNSBRvv0AK6QUSL60RRR1hbDK3fe4Hdi8Q qEclRYDryCd2SVODLNPJ6n46uBw89++EMiNjfucgdv5Zj+hHr2+sEnSJhJ3HCqTG/ZQe 6/bfPyDfNC0Mby/51aPDQ3t9VVF3p10FWCoZmPSYRTCRr20sMFIZQiaryjZnt/fM884c 7F6Od9VpGj5s/L+gR9td8/nvY6eDL729Xw9/PZRr+GMn7Cve/kcYUh9qM8rcc4V7a9yV CbGA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tf+HYap5; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7bce322a699si494312385a.117.2025.01.10.09.33.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jan 2025 09:33:08 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=tf+HYap5; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tWIsJ-0005XP-M9; Fri, 10 Jan 2025 12:32:48 -0500 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 1tWIsC-0005Uh-6I for qemu-devel@nongnu.org; Fri, 10 Jan 2025 12:32:40 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tWIs9-00009h-Hc for qemu-devel@nongnu.org; Fri, 10 Jan 2025 12:32:39 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-386329da1d9so1253880f8f.1 for ; Fri, 10 Jan 2025 09:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736530349; x=1737135149; 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=nNUbs9+iXWkzUulkoWT20NOwr2Ic+DqflysU5aQWhXA=; b=tf+HYap5+HB+/KwX4SpcqsiV4RcJuKbfz3pZ6nu0W4GG7VzkwZkRggcUj3l6SOb00x KwidAFpXlqITHqK9nZ/MDKfiRIQNoQCREUzfxAECGINdkURAcFIv1cIIw9en+gyprnxL kOJkrThWUJLzbTVxvaUaOXp3IfTifnb/EYilRPuOl5C50qfqTZ1plyhU/EIkVTeklNE2 ivR4beRuLx88AzD1Ni4YMMlmm8QM0mm8H4SqVAOm8O457g2yb5coUYoSgwBUENANbfGO oc95WPYKmHS1V7ltolulZzgJRwSaBmwHpRvWRaDkrMgNbWHLobv9n6OcMTGg+x6Nh+jx MpUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736530349; x=1737135149; 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=nNUbs9+iXWkzUulkoWT20NOwr2Ic+DqflysU5aQWhXA=; b=kWB2Iq+1BZPdpiu+9kg3XlSDnUFkGijE8KR3Ldmhs9K8cRanzYWTjFaRWjSRb5zXF6 MwCZKGKMSPNj/hw55yF1shCOak3qoW1++CS8Ov9jY7WilYCHJtWSVRmou3x9ljP5Tvr0 JahswS6l5TDrcep4HIlaJOlmuougQZp+8VyovR6VZFuZCthj84z2OE7/TPKdVK07GTxQ arGv40zxmOnYaLji0GO4b73BFeaXXogO7uurRt4GLmdr6sc3g0pc2eys/7iue77H4xfZ Eb7dmTRD3XHv8rtPULbxCSmySFFjD1X53RiCKYG7uXI/JsSuycCbP90jvasYRS2tRNYh x8qg== X-Gm-Message-State: AOJu0YypKw2ZXE/nvY6HumOg9LwvH74+WOceNXR9MNzT89DrqtHtky1v Y3kqVqI0ieV6BNFcCgcleyqeKa5AnfejnYeDqgzWexeYT2oGWNYa+n2IaL4L0kNU3BumB+kP73V X6t4= X-Gm-Gg: ASbGncsAsHnJ0sEk1M+oJE8l1QS/Wx0ZYtNY4ZVPSjn5wEG+I9Ad8XRs+7hP5j9bKwl E0UZHGKn3mXVY2GQExGJB8PU00Fb5iS/szzHWg9V4xuOHpp4V2M02fWM4oMaQRz4YbZQNSrT4tX PbYfOAMrqACdf/MKKSHokhqyqAjL7TtIum/HoToQaKOZhlw2oOiugqQvqr3+yP6dBrOVDIbhMDm YT4ekAZV1BxgQm2nLfxcKS9i/teHjaLsiCfqsAm66ddG4QRx4XvnShJ9U5O1FPFuhpvDVB3qs0F DYvZ+rsGcFwunNCLBiA+rSfX3yszQ1U= X-Received: by 2002:a5d:6c63:0:b0:385:e22e:288f with SMTP id ffacd0b85a97d-38a872ea33fmr11189484f8f.31.1736530348711; Fri, 10 Jan 2025 09:32:28 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e383654sm5134100f8f.30.2025.01.10.09.32.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 Jan 2025 09:32:28 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Herv?= =?utf-8?q?=C3=A9_Poussineau?= , Gustavo Romero , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/2] hw/ppc/prep_systemio: Set IOMap IRQ in ResetExit() handler Date: Fri, 10 Jan 2025 18:32:17 +0100 Message-ID: <20250110173217.80942-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110173217.80942-1-philmd@linaro.org> References: <20250110173217.80942-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since the IOMap output IRQ is created in prep_systemio_realize(), it can not yet be wired before the device is realized, thus it is not reset properly. Fix by moving the qemu_set_irq() call in the ResetExit handler. Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/prep_systemio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index 7cbf7e4eecd..87f412891e2 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -260,8 +260,6 @@ static void prep_systemio_realize(DeviceState *dev, Error **errp) qdev_init_gpio_out(dev, &s->non_contiguous_io_map_irq, 1); s->iomap_type = PORT0850_IOMAP_NONCONTIGUOUS; - qemu_set_irq(s->non_contiguous_io_map_irq, - s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS); s->softreset_irq = qdev_get_gpio_in(DEVICE(s->cpu), PPC6xx_INPUT_HRESET); isa_register_portio_list(isa, &s->portio, 0x0, ppc_io800_port_list, s, @@ -273,6 +271,14 @@ static void prep_systemio_realize(DeviceState *dev, Error **errp) &s->ppc_parity_mem); } +static void prep_systemio_reset_exit(Object *obj, ResetType type) +{ + PrepSystemIoState *s = PREP_SYSTEMIO(obj); + + qemu_set_irq(s->non_contiguous_io_map_irq, + s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS); +} + static const VMStateDescription vmstate_prep_systemio = { .name = "prep_systemio", .version_id = 1, @@ -295,10 +301,12 @@ static const Property prep_systemio_properties[] = { static void prep_systemio_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); dc->realize = prep_systemio_realize; dc->vmsd = &vmstate_prep_systemio; device_class_set_props(dc, prep_systemio_properties); + rc->phases.exit = prep_systemio_reset_exit; } static const TypeInfo prep_systemio800_info = {