From nobody Wed Feb 11 07:13:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653246995841322.37287525848024; Sun, 22 May 2022 12:16:35 -0700 (PDT) Received: from localhost ([::1]:43260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr46-0008RM-Or for importer@patchew.org; Sun, 22 May 2022 15:16:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC0-00087V-7C; Sun, 22 May 2022 14:20:40 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBy-0003r4-LR; Sun, 22 May 2022 14:20:39 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nsqAQ-0007pH-Ni; Sun, 22 May 2022 19:19:07 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=v5C0a0NiReooURhc8Z24Bys3bwXGa12fpFlV54o44Ms=; b=CGlwafyV52cPesWj4uaqP4LiCZ ku1AC5i5lh1V8CDdE5um2VbQ6YR/rYIe0rJgJ+RBpTvaL/hjUPmJTf/GZlZ/l2hl4QB0Sy3EiWkFX 1Qn1LRPTRe5B0+Q6pPRY6MrvGFI5Lbn2QB39AICJcFghLU84/rvjphb1DIdryGe+1Ehr52TtSgLwF sgujo8e37bIY3LmrineqrdLVORfCf8AXT1YMktCp9YRdYaRHcWXWblVld9Vd0AASZ+67Q9thvXswQ ppdW2bX98OMyhPQZ06uzZD+/jbsF8ypEQflTZxnX2MxNowIsy7YwnYYWocpweSXUuvCFrRxXT+LrC 6F/LiR9n75Pge41PkNGElU/oOAEeJBmlMDBx2moi9Nw8PjGmld7zJ2pqw5NXH66TiIJTEokNzxOKo E13C5paGkPY3wFT/uNtknZmYHreyharsFESqwWJuIgXgeHkIYmU8QHT3BYR+9N0kt7/wqCNykpu9t y6EOM3gyAIIJi8W3uJBrHFGZ6nxfwF8STMb1H0d5nJVuB04U5rOsUU6YjoWI5bcWDsd3/1H8vsYUB DAJa21nfTSQDuUK1lacDyiiSkBzMUMljZQmGfeqAEN0tswo5lUtyJzM3XHVFTAyHNwx2ufQpQebOD /8yPUSbJTdpj4F9XcCwPP/KZkV1MTsGLxaxFLMN0U=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Sun, 22 May 2022 19:18:22 +0100 Message-Id: <20220522181836.864-37-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 36/50] pl050: switch over from update_irq() function to PS2 device gpio X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1653246997350100001 Content-Type: text/plain; charset="utf-8" Add a new pl050_init() function which initialises a qdev input gpio for han= dling incoming PS2 IRQs, and then wire up the PS2 device to use it. At the same t= ime set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_ini= t() to ensure that any accidental attempt to use the legacy update_irq() functi= on will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland --- hw/input/pl050.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 66f8c20d9f..fe6a281307 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -32,6 +32,8 @@ struct PL050State { bool is_mouse; }; =20 +#define PL050_INPUT_IRQ 0 + static const VMStateDescription vmstate_pl050 =3D { .name =3D "pl050", .version_id =3D 2, @@ -65,7 +67,7 @@ static void pl050_update_irq(PL050State *s) qemu_set_irq(s->irq, level); } =20 -static void pl050_set_irq(void *opaque, int level) +static void pl050_set_irq(void *opaque, int n, int level) { PL050State *s =3D (PL050State *)opaque; =20 @@ -164,10 +166,12 @@ static void pl050_realize(DeviceState *dev, Error **e= rrp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev =3D ps2_mouse_init(pl050_set_irq, s); + s->dev =3D ps2_mouse_init(NULL, NULL); } else { - s->dev =3D ps2_kbd_init(pl050_set_irq, s); + s->dev =3D ps2_kbd_init(NULL, NULL); } + qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, PL050_INPUT_IRQ)); } =20 static void pl050_keyboard_init(Object *obj) @@ -196,6 +200,11 @@ static const TypeInfo pl050_mouse_info =3D { .instance_init =3D pl050_mouse_init, }; =20 +static void pl050_init(Object *obj) +{ + qdev_init_gpio_in(DEVICE(obj), pl050_set_irq, 1); +} + static void pl050_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -207,6 +216,7 @@ static void pl050_class_init(ObjectClass *oc, void *dat= a) static const TypeInfo pl050_type_info =3D { .name =3D TYPE_PL050, .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_init =3D pl050_init, .instance_size =3D sizeof(PL050State), .abstract =3D true, .class_init =3D pl050_class_init, --=20 2.20.1