From patchwork Tue Mar 7 23:47:00 2023 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: 659879 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp37250wrb; Tue, 7 Mar 2023 15:48:20 -0800 (PST) X-Google-Smtp-Source: AK7set/O2fznTfppdzZyz+LCwEdEYLmWyz6g5dZQAyT6gyV6FdHxjgoQ2NnxOCstlYSweCBiYuMi X-Received: by 2002:a05:600c:a49:b0:3e2:6ec:61ea with SMTP id c9-20020a05600c0a4900b003e206ec61eamr13702974wmq.28.1678232900811; Tue, 07 Mar 2023 15:48:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678232900; cv=none; d=google.com; s=arc-20160816; b=J5J1ilh0R/dCHkBopfSXVjzkj72V1FQdC2W3pFxMBr9yL06elWksp8St7iw6MuPbV2 7egHjMcE3vuw7IdKytd/WLO5/VcliA9tgP9oxekWuYQwn8IvSTVbw3PUtf2gssZxr7BG LzZk/6IzQPnFG6B+NFSjytTEh4yaHPCMeiO5u6+hBRcIpH+eZoeXNuaK2PdRIGnL8kwn BSUV/2DgUN9NpLKW6sTNlpTZy6Ku97VNNmdYVXAU/+8YbifMsFwcmZNm9OOE78hcWn3e pv7jCi0ZGFg1C6Agj7ChQMClUEi1UhXMbBhW23T/2biOpS5g27PUSXGbwWN35lc5ciWv M2Aw== 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=Wq29WJt1laPzE2bHEihgtyn5T2vm3Jo6XB+Kog9d3Iw=; b=Pva/1rANp/OWHVfw6HjHwn4GgIWK+rRuaTNt0FWNxEgxziPVDBoPC5UaaqQ4vbICQe sNOc/Tak4Jyr8I4Gwxyh92IQmoihs1x7zCmFqWLgvxaFHPXv+Rh8Krm4D5m9s5+BflrH Of/L+hWtx/PPwL5/fnj5r+jBYWQabvRzYss5m2I9hXAPZLA6+XJzYcXQtJdtKgSRSMgd 2aNdv2eKlC1eUeCQpXY2oAjHIgPesa52bJohttA1LKN0CQj6vZdJVT8cBfz6OYFvyMZ8 oTWGPb14wuBEmUYjFyWEfOld7nK2cMpLsgTsQ5WyDsdZ1Thtejct5QEJbe4cdjwdF7T7 Z/7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w1Gy5vsU; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d13-20020a5d644d000000b002c56339208csi11818253wrw.204.2023.03.07.15.48.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Mar 2023 15:48:20 -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=w1Gy5vsU; 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 1pZh2R-0001LX-Jl; Tue, 07 Mar 2023 18:48:11 -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 1pZh2Q-0001Hn-JD for qemu-devel@nongnu.org; Tue, 07 Mar 2023 18:48:10 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZh2O-0002kH-PS for qemu-devel@nongnu.org; Tue, 07 Mar 2023 18:48:10 -0500 Received: by mail-wr1-x42d.google.com with SMTP id v16so13844939wrn.0 for ; Tue, 07 Mar 2023 15:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678232886; 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=Wq29WJt1laPzE2bHEihgtyn5T2vm3Jo6XB+Kog9d3Iw=; b=w1Gy5vsUEfSqRnLfEPGbFFWtL86IBn3FwT3iBIF8AvZjsrofTQHbaJrHAsobCOZc5X K2NEt59of3uLkdmJhP+QUuk4phOovugZzHj7ygBhCbU7y6KFQR0zrONAB5MkmnvdRM27 CB3j17FdRcoXSwSZlWHTBUssb8pjyzFZZ/0KA+ucUpgN2cry3i39PSsYSKwU6UhmnA5W dlyl1r2Qk8x+d/PcbAiuNVMTDSesEnKfXmsMfOeUeZDxqicVgGlxlVbHi5EvgiTAFEgp eLS8TTG2o/uNk98vy99gZXVS1aQ3AriLV+dhNAqZCDQV02HenfzeddN0ZAzP8aYrRqgo mJTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678232886; 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=Wq29WJt1laPzE2bHEihgtyn5T2vm3Jo6XB+Kog9d3Iw=; b=N7smRDV0GWk9zcYl/GhgbC5xKess6QaDZtv0mrpFNV0vL5hTBJepgyyUntNhJ4zv6n Pb7gxyVUo591+hy85CzYncf5VdqVQAECmcM1UPuwS9o0J6SWTpgPWbtsIX4EGesd9DjK aoTgG/Mvp+IAWD36/Kpgi0WO5n2QsxbbSsoNcgmswfSd2Ze5fwkLZGBMDjxijy7l4tVI CmaQ/A4UgkG9s/prqA/VE5KFCtRxty1lKGrIU/NiQ3mn9Duj3vu5hDI7Q4T9NOU1PFpu wdCJheSlqDdo0zYEY5MUHossl8iRndof2OkxTa6C14XDm86LGpB4akMVMjM8x2igRR4D lDuQ== X-Gm-Message-State: AO0yUKXUaEBcmCF8NjtDSR+HdDQo0AQriv2pwjRrPY1vdLfnxBu0XWnA 6vQseEmnNQF6qY5dRSPx4cMQzm29l76roTQzxNs= X-Received: by 2002:a5d:664e:0:b0:2cd:defe:cfd3 with SMTP id f14-20020a5d664e000000b002cddefecfd3mr11249576wrw.30.1678232886458; Tue, 07 Mar 2023 15:48:06 -0800 (PST) Received: from localhost.localdomain (57.red-88-29-179.dynamicip.rima-tde.net. [88.29.179.57]) by smtp.gmail.com with ESMTPSA id l13-20020adfe58d000000b002c569acab1esm13729260wrm.73.2023.03.07.15.48.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Mar 2023 15:48:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Bernhard Beschow , =?utf-8?q?Herv=C3=A9_Poussineau?= Subject: [PULL 09/20] Revert "hw/isa/i82378: Remove intermediate IRQ forwarder" Date: Wed, 8 Mar 2023 00:47:00 +0100 Message-Id: <20230307234711.55375-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230307234711.55375-1-philmd@linaro.org> References: <20230307234711.55375-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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 To be 'usable', QDev objects (which are QOM objects) must be 1/ initialized (at this point their properties can be modified), then 2/ realized (properties are consumed). Some devices (objects) might depend on other devices. When creating the 'QOM composition tree', parent objects can't be 'realized' until all their children are. We might also have circular dependencies. A common circular dependency occurs with IRQs. Device (A) has an output IRQ wired to device (B), and device (B) has one to device (A). When (A) is realized and connects its IRQ to an unrealized (B), the IRQ handler on (B) is not yet created. QEMU pass IRQ between objects as pointer. When (A) poll (B)'s IRQ, it is NULL. Later (B) is realized and its IRQ pointers are populated, but (A) keeps a reference to a NULL pointer. A common pattern to bypass this circular limitation is to use 'proxy' objects. Proxy (P) is created (and realized) before (A) and (B). Then (A) and (B) can be created in different order, it doesn't matter: (P) pointers are already populated. Commit cef2e7148e ("hw/isa/i82378: Remove intermediate IRQ forwarder") neglected the QOM/QDev circular dependency issue, and removed the 'proxy' between the southbridge, its PCI functions and the interrupt controller, resulting in PCI functions wiring output IRQs to 'NULL', leading to guest failures (IRQ never delivered) [1] [2]. Since we are entering feature freeze, it is safer to revert the offending patch until we figure a way to strengthen our APIs. [1] https://lore.kernel.org/qemu-devel/928a8552-ab62-9e6c-a492-d6453e338b9d@redhat.com/ [2] https://lore.kernel.org/qemu-devel/cover.1677628524.git.balaton@eik.bme.hu/ This reverts commit cef2e7148e32d61338de0220619d308bf42af770. Reported-by: Thomas Huth Inspired-by: Bernhard Beschow Signed-off-by: Philippe Mathieu-Daudé --- hw/isa/i82378.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c index 233059c6dc..5432ab5065 100644 --- a/hw/isa/i82378.c +++ b/hw/isa/i82378.c @@ -47,6 +47,12 @@ static const VMStateDescription vmstate_i82378 = { }, }; +static void i82378_request_out0_irq(void *opaque, int irq, int level) +{ + I82378State *s = opaque; + qemu_set_irq(s->cpu_intr, level); +} + static void i82378_request_pic_irq(void *opaque, int irq, int level) { DeviceState *dev = opaque; @@ -88,7 +94,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp) */ /* 2 82C59 (irq) */ - s->isa_irqs_in = i8259_init(isabus, s->cpu_intr); + s->isa_irqs_in = i8259_init(isabus, + qemu_allocate_irq(i82378_request_out0_irq, + s, 0)); isa_bus_register_input_irqs(isabus, s->isa_irqs_in); /* 1 82C54 (pit) */