From patchwork Fri Jan 10 18:27:58 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: 856284 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp369584wrc; Fri, 10 Jan 2025 10:28:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWKvij0gCj7CGolFBiOrOeCLdh/4LGe6UwUIUWdczoFij4nxo6MT1MF+i2DLtV9ZmXO19m0dQ==@linaro.org X-Google-Smtp-Source: AGHT+IHrJ3MCwWjZ39EkVRG+oHhG6b4DIbDqoLN9oy/60jIC9Zm/4BJpSt24RW45jvbkfwqjOcIX X-Received: by 2002:a05:620a:190a:b0:7b6:e9db:3b21 with SMTP id af79cd13be357-7bcd9708520mr1824763485a.14.1736533732577; Fri, 10 Jan 2025 10:28:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736533732; cv=none; d=google.com; s=arc-20240605; b=E6+nxRoySJ7shDfPHL8JpXTmceauIMY2l9s4G51J7aGoGf39ZQXItETrvbZaoCSzYN n3Hq/sCqJawpfm5VNt4OCArOmYwFT6rw5AxUqOqDD6k21vKKLpRLjd8rHjh38b9bE83d VC6cc/DBDBcXkF+M2QLm+dg8YzOp1qMuRTvSPcGOKpK40v1EnUa7MjMxqgqHfKnJTvb+ UBwK34MseAPrHfPBw+aFBbp7pLpJTvLYMkNrx7PsYkjCH9qsQxQmTrXnJkSA6HL5KLN7 2KotKLpK96XfnSWeQSKitfkX/8m2E+v5X7TtRXK02xwd9bT0Ira2k6X1GZVoUXhMrUXe G9bg== 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=zE4qjB0uSRkjg+MUXEy5a73ggSq4M0TRcq7NiIJZjTs=; fh=55AMkU65muUNEfSUDay349Ye7JvT2KZydShfpkveXkE=; b=P1xbCBa2f40RyjUj9Shkz0HbzkcGhepd6dptXlj2xMpaGX/VLmCFBuMrwAvYMZwVuO OG1JaTsyPGzLqIU2oNaymL7dm9+R7ASxxZB23dnDvTnsVMkwf+nfpRwUU9bI85XzElOO qRQFNAgOtTl3BRkgzHXGX0bCX9+dnlshHFs0jq4/dmHLN2aby9nW8b+MdmBj9X4MUnAt Nu3H9wLWNiQUwdMeth3e00uAFBRUmna/igtlwFRrmClH5iIJp1nWnKYqrBO/RWXiZfS2 OMb4Se4wno+1xurmYhj6Id1l83aIbaAUKYhqamR5JNR5QJQoobs7IVI2ZrxfT3ucgcqA iIpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fo4SA+W+; 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-7bce322b577si446092385a.97.2025.01.10.10.28.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jan 2025 10:28:52 -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=fo4SA+W+; 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 1tWJk0-00020u-L3; Fri, 10 Jan 2025 13:28:16 -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 1tWJjv-00020L-Ck for qemu-devel@nongnu.org; Fri, 10 Jan 2025 13:28:11 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tWJjt-0007OX-3H for qemu-devel@nongnu.org; Fri, 10 Jan 2025 13:28:10 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4361dc6322fso17484385e9.3 for ; Fri, 10 Jan 2025 10:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736533687; x=1737138487; 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=zE4qjB0uSRkjg+MUXEy5a73ggSq4M0TRcq7NiIJZjTs=; b=fo4SA+W+L6epcOyn9/VDBAm8ZSi8k3EwHmdChUZD8kJvfrmDrAUlrl4xINZI2tqyS7 vwQRK9Zr1ZhY5i225UOo39qOdwMy69cF6oIXDhjUllj9QV+ckMmzMxVEQggal2by57S1 OaYIsVBCZBe4QX7I5ZfA06Ow/sWQX0PI99e6KUhrteywWRVm6A1noJ5AA+ujQBaCO2CP BLygbX2O3ec4XBshk/oGUgBdJUOcYL06Tp4+kWx4FyY1mXezxJOZGDN8qGOu2lxN2YPw 5/kaHNaKvqfm3hb0x+Lwfp8GyS4G/Zf5rGl5/fSvYLib01LhhVhXzRjJLrwpW0JfHihA WVZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736533687; x=1737138487; 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=zE4qjB0uSRkjg+MUXEy5a73ggSq4M0TRcq7NiIJZjTs=; b=QdZRokCp0OP3pcxeurkDbjj/HJX7IkMMOTWcuJDJJthMy51ZMOuV7zULM3SCmrvim7 qfLINJzuiOZqMonhD0P+RPhlxLwuQ/Nyf1XIDrq6m0lKceltPY4TYJrzo+Ftma4AG9z0 WGYTF3oKsiSDAR4LmgXkWX4avuDENLuq9CiENhw5OFBdJoizO1kSPQclsAE5ihsRd1jA v6RUxWPCgi1gotewzIWcgnS6lW0vQ1Rewnc4iMcp8lLZxHkBBaqkl2GwZKg4+bzXV60u l2ACghhCzZGAbBdXToA/uSKeoAoaPexPWkOeRHVeLPxUsRiqFuEMS5a4PdmCkSMPv7y7 nZqw== X-Gm-Message-State: AOJu0YyuytjCwk/O/YCgAMltzLLUDwcmzMCavIOaTqWMlbpT5FEwKO5z O7jlMbKOu+AsQwkbygv8xdyiKTgxCwAsLR59K6nmiRMPFb4wtpQOUXYkJx2pycRMeaXrM0p87qU WiXs= X-Gm-Gg: ASbGncuCZo/T/FNB/QbYYYhPSy8UrQ3ZQQnmmvLEYrMKAqJCFrxe5ELaMd01p3a/KCw +rzFi7Sr0uzByUsUCqQ90gM+M/3ooEpcGpbBWKQZ11i5J63CEi9Y7Sw9v+qt9RMnmNz42qia83H 6MRsgZQDdsT59CHmHVxEpSl6N0WAdyK99vyX0y1BvVi0Rc2a8r8ObCI2RpYmz8EvsNFkI5u/2vm tjUJzN198bcziwhnC3NqvQIYlWQRxrMyDfGfBgDJDffFxnOfmNXKg+8bOll/tLX+R/hBJzD2RrX FiR94J4guXjcYeKetkI2y+NDBpxnsxs= X-Received: by 2002:a05:600c:310c:b0:434:f8a0:9dc5 with SMTP id 5b1f17b1804b1-436e26a8c21mr111801255e9.13.1736533687220; Fri, 10 Jan 2025 10:28:07 -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-436e9d8fc81sm60544255e9.5.2025.01.10.10.28.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 Jan 2025 10:28:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland , Peter Maydell , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] hw/char/serial: Ensure SerialState::irq is set when realizing Date: Fri, 10 Jan 2025 19:27:58 +0100 Message-ID: <20250110182759.84071-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110182759.84071-1-philmd@linaro.org> References: <20250110182759.84071-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org SerialState::irq must be set by parent when the object is realized. Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier --- hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 7578e863cfe..5ad2c0e8443 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -106,11 +106,11 @@ static void multi_serial_pci_realize(PCIDevice *dev, Error **errp) for (i = 0; i < nports; i++) { s = pci->state + i; + s->irq = pci->irqs[i]; if (!qdev_realize(DEVICE(s), NULL, errp)) { multi_serial_pci_exit(dev); return; } - s->irq = pci->irqs[i]; pci->name[i] = g_strdup_printf("uart #%zu", i + 1); memory_region_init_io(&s->io, OBJECT(pci), &serial_io_ops, s, pci->name[i], 8); diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index 6659cef5d4b..d31a3ccf03b 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -49,13 +49,13 @@ static void serial_pci_realize(PCIDevice *dev, Error **errp) PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev); SerialState *s = &pci->state; + s->irq = pci_allocate_irq(&pci->dev); if (!qdev_realize(DEVICE(s), NULL, errp)) { return; } pci->dev.config[PCI_CLASS_PROG] = pci->prog_if; pci->dev.config[PCI_INTERRUPT_PIN] = 0x01; - s->irq = pci_allocate_irq(&pci->dev); memory_region_init_io(&s->io, OBJECT(pci), &serial_io_ops, s, "serial", 8); pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io); diff --git a/hw/char/serial.c b/hw/char/serial.c index 70044e14a0f..562931685e7 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -923,6 +923,8 @@ static void serial_realize(DeviceState *dev, Error **errp) { SerialState *s = SERIAL(dev); + assert(s->irq); + s->modem_status_poll = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) serial_update_msl, s); s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) fifo_timeout_int, s);