From patchwork Fri Feb 9 12:32:25 2024 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: 771321 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp824351wre; Fri, 9 Feb 2024 04:34:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWgkxIEVVKXfkBcYiYmI2G3i46slGZovJuxZaQnYGBGSDYGANERFfu/w86AqsBUdxhDbf8 X-Received: by 2002:a05:6830:44ac:b0:6dd:dbda:539e with SMTP id r44-20020a05683044ac00b006dddbda539emr1711415otv.16.1707482079815; Fri, 09 Feb 2024 04:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707482079; cv=none; d=google.com; s=arc-20160816; b=shA3NEcQgbpm2Ym2j5MIdsHxaHVgdRt2P3MtRo1r5QCd6Cp38GfGXsI7hbY6TWyNUm H1aJHxjtJr3Buw6nNHhmKtlG2x5m91ulCf6kxai0mZN7VTkqrlqyCq7Z19RWHUYYJiS4 4iZyQFPUN+0h7I2Np3+KCKnoG12a6mVSdt2jAxfhzpufoWALSyfkr5phFmsR5kMO6bUb lu/API5y4GlhFdMH/n2lrT+pVi4BgmL8W5rUWvjGpW3RNZALfCkKv3b9zipgIYDpz4bx tBvpJBan/vGtkS/C5S2NI4VWeTh6VsvE4mClwqqKWyKiTP4oHs7l3IMoAFH2e01+odzf RceQ== 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:dkim-signature; bh=JcayKF0S5fuq4dnazv16i3De/3X7znpGdXMiaRyrsN4=; fh=MxdIzl23z48eTTu70dMwaaJQIRneWHduQxwRvo3xwhg=; b=GWKA/Dw8RaW8F4UNxuw7VGbxFlf69zLkB8b2Gt7iWU0ut8iCwODfqPF8vp+ZY35Z7A SlJFT7HATnuMxdXPkFR0yfBwSD1yhTK4akrWmYgiuuY6UNOtleuvlXfQ/mczHQ6cOPI9 YuW2UAl0Bq/+G6Qi69F8PK1JlL1DPq4x71nsWxwtBO7qhcaVK8/rpqL3kfSfawjIfg7J F3jbc6Qw4j4b2k827HB7pwQxoMy2IuXraf8dZapabiW3u3T24+0qEd4QiLjIOubv1lOV UqGJMr/ZjxLMPdVz+uPJH/9oXQ80RxX6/jbqT2DdWgEC6nS7LNK4g7zHZTion7kxawp4 SRCw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XCRm0pow; 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 X-Forwarded-Encrypted: i=1; AJvYcCWGbok3aVPXU2uuM5IcIhS6TgomZ0XmQgMfDZPgXQrg3uLd50y1dbe6xkw/Y/iQKUjnmzWKnZqztPQU5z25JJg0 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o15-20020a05622a008f00b0042c446997d0si1771089qtw.379.2024.02.09.04.34.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Feb 2024 04:34:39 -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=XCRm0pow; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYQ4T-0008T0-5G; Fri, 09 Feb 2024 07:33:33 -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 1rYQ49-00087O-OP for qemu-devel@nongnu.org; Fri, 09 Feb 2024 07:33:18 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYQ47-0001xg-DJ for qemu-devel@nongnu.org; Fri, 09 Feb 2024 07:33:13 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4107d76dfa8so1174745e9.0 for ; Fri, 09 Feb 2024 04:33:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707481990; x=1708086790; 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=JcayKF0S5fuq4dnazv16i3De/3X7znpGdXMiaRyrsN4=; b=XCRm0powtD18ImmQOnuaDlzHAu+kJi3KZG8PWL/Qsk528rduJwThTRRXKaJT9sTYrc Tqrl4w7LGWypUE4C9UiH7x6TFfTOqyCYwwgXuSZzZhes50mF3heweyWE1jxOXUn15aYa iRclmcF3hb7vFlVe4lFirDQrL6p1B6qlQBrcQd3EZbhqabzbMeH0YD8BVuXZnx/an8Z2 oIzdMdUMFN6FHTjOsblg2HZ6wLw0YraEefbFLuN+InA49Jx6+2gRw6vJYKVTHO9dlQBQ +d8QBSISALzvLKaKNJWUH3/YICE//sjsva+ZML1fIIxYMyfF3T1IfpLtDYQubQih6c8I e9CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707481990; x=1708086790; 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=JcayKF0S5fuq4dnazv16i3De/3X7znpGdXMiaRyrsN4=; b=Al2v4tp5wgv5xFfmLkJ+R973D3Xfrg/zomZQ6a9K8WpoaFUgnwxFCgaSp+lJe0Phhi 6F3Z4ny9OdZY3Amzj+yyjVYrLWhLUZhm5S48dxBr5JFOz6ugaYVw3MXHiIy+YuY2fRxQ WBth+qB217G4Om3IFjurHNVRvqH+TCDWelbIB5y9rHf4BMkdk3tZIjBURjsTPu0zP39d 8Uq/E81o/9WRxKycJz6KsHgEcLX/KfrqQPxuPeRxEUG5kEVq4KSyIqm8Fgm5fV5IxIJ1 H7hA/rDJUeJlx3SU7gHe7zxdAm8RaUGsmqkZi3iyY12GtyTMGYBwSaSGUwCtpXvl5jiX V29Q== X-Gm-Message-State: AOJu0YzvjD4iIgsiKPmnQmeBwRv0XFKh1rmoshfdmHgZrpdNbxg6jiF2 AU5AFi80bWJOeR7KRLEAycA/AhnlTekiAiVo8Q7QIOwsF6Zh1kbWyAOnnuX95aqlrIVnFAu7YhG y X-Received: by 2002:a05:600c:474a:b0:40e:f632:494c with SMTP id w10-20020a05600c474a00b0040ef632494cmr1082594wmo.30.1707481989975; Fri, 09 Feb 2024 04:33:09 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWm7AlHq26PilrZzGO+lwC+lnCRy4B0mshbZq/Z/Vz/tNNgW7nFvgHSEn3NR4kNBb1QD1bYsB9sbTCQkuIplJZ2vp9wxhLxJ2K3GM700Ez9NaVI54aJS8pvb27MxRewqDqmPyV6XX8JX6NJR4CFxRuIk0nKUBCz9Tu73w0MVJP/g/uTEy2H8/Q29lGIP3sPfaP5lHgQAq28YDAttTHR8JOJsF9QPi8M916fOKpYfk+PGy7LswYbdFiAG4IFdlY/lQ+jYeehao+iI7x1u/l3AZxsOrPT38dPcNvKFKcyYfMGHcHS51TINF0/9eO8AGsu08buzgh7OtDd/xs= Received: from m1x-phil.lan ([176.187.218.105]) by smtp.gmail.com with ESMTPSA id l4-20020a05600c4f0400b0040ecdd672fasm540810wmq.13.2024.02.09.04.33.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 09 Feb 2024 04:33:09 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Jiaxun Yang , qemu-block@nongnu.org, John Snow , qemu-ppc@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" Subject: [RFC PATCH 7/7] hw/misc/mac_via: Have VIA1 child access parent IRQ once realized Date: Fri, 9 Feb 2024 13:32:25 +0100 Message-ID: <20240209123226.32576-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240209123226.32576-1-philmd@linaro.org> References: <20240209123226.32576-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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 We shouldn't call qdev_get_gpio_in() on unrealized devices. Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/mac_via.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index db6142b5f4..67e51430bf 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -1246,7 +1246,6 @@ static void mos6522_q800_via1_realize(DeviceState *dev, Error **errp) v1s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET; adb_register_autopoll_callback(adb_bus, adb_via_poll, v1s); - v1s->adb_data_ready = qdev_get_gpio_in(dev, VIA1_IRQ_ADB_READY_BIT); if (v1s->blk) { int64_t len = blk_getlength(v1s->blk); @@ -1270,6 +1269,13 @@ static void mos6522_q800_via1_realize(DeviceState *dev, Error **errp) } } +static void mos6522_q800_via1_wire(DeviceState *dev) +{ + MOS6522Q800VIA1State *v1s = MOS6522_Q800_VIA1(dev); + + v1s->adb_data_ready = qdev_get_gpio_in(dev, VIA1_IRQ_ADB_READY_BIT); +} + static void mos6522_q800_via1_init(Object *obj) { MOS6522Q800VIA1State *v1s = MOS6522_Q800_VIA1(obj); @@ -1336,6 +1342,7 @@ static void mos6522_q800_via1_class_init(ObjectClass *oc, void *data) MOS6522DeviceClass *mdc = MOS6522_CLASS(oc); dc->realize = mos6522_q800_via1_realize; + dc->wire = mos6522_q800_via1_wire; resettable_class_set_parent_phases(rc, NULL, mos6522_q800_via1_reset_hold, NULL, &mdc->parent_phases); dc->vmsd = &vmstate_q800_via1;