From patchwork Sun Jun 26 17:44:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895820 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB5C6C43334 for ; Sun, 26 Jun 2022 17:52:15 +0000 (UTC) Received: from localhost ([::1]:51342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WQg-0001sG-RE for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:52:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKU-0001Nr-IU for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:45:51 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:44982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKS-0008Kf-Bj for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:45:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=MYbsknRH0/n9h0FiN61Ir/pQmHwr4gvFPu1T7T48vIg=; b=UjNURMPXdMhnSxVxYekCGMEggM 2E/aqaxbKXrVCm/r0MppV0CawaPYmRiTIi0FXQFOyh8HrJqiCfk5Bzr0JktAFwyD2G7mOHb/v+5Vf gxDcCKm6UbZlEPNnj8QeAKTmkO99wEsnnjxM4mNBXX8dW2zVsFH7vcU2Sw8qep2FAW0eKkyIFv+6v v6i/rqMiwISt18ViBsE84plbe0j1pwiQ+38KncPKMUTiHK2ZzH/4+cD7soTti8vo5vEo/uol+Fp8R ijugRq6t1tGRZqCPo2t7oZvA9j7oG0ruWiIuunWbEXVbbzdIofZ3gOpZPacI4qjDQO2kMFM2qVHSp zpShVKobEnC/dkEGWzTDPATDbo7i2u7SNTPzwJPjAly+RUdXdFWzpuJW3X6gib8uWA7tpDK2AjHPD D/7m/sG0Ck4kKT1QjJv+lM6jce4E2ScfS8A5PWacNlFJWvCjxg9wEijv5N2UWBoBUxzNQTc+wkPG4 VdxTHWh4P5KulryOQJVpLidOqB4FAhfIP6y743m+YMwOMey+UH5FxathScR8bbT1ENIygAaQtWlmA Bw1r6tz8BkITthbAfEhvPDOV+f3HedzLIfGT6X3PBvhypUFNBV25ivaoiTJ5qNJqpWdu6dVRiUZvZ NtMVxwEpsSWWQSRRwrvDT9mpvNcZQXt9GhI/ZvvJQ=; 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 1o5WJE-0007KY-2d; Sun, 26 Jun 2022 18:44:36 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:37 +0100 Message-Id: <20220626174531.969187-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 01/55] ps2: checkpatch fixes 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-2-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 154 +++++++++++++++++++++++++++---------------------- 1 file changed, 86 insertions(+), 68 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index c16df1de7a..67dd2eca84 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -34,41 +34,41 @@ #include "trace.h" /* Keyboard Commands */ -#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ -#define KBD_CMD_ECHO 0xEE -#define KBD_CMD_SCANCODE 0xF0 /* Get/set scancode set */ -#define KBD_CMD_GET_ID 0xF2 /* get keyboard ID */ -#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ -#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ -#define KBD_CMD_RESET_DISABLE 0xF5 /* reset and disable scanning */ -#define KBD_CMD_RESET_ENABLE 0xF6 /* reset and enable scanning */ -#define KBD_CMD_RESET 0xFF /* Reset */ +#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ +#define KBD_CMD_ECHO 0xEE +#define KBD_CMD_SCANCODE 0xF0 /* Get/set scancode set */ +#define KBD_CMD_GET_ID 0xF2 /* get keyboard ID */ +#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ +#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ +#define KBD_CMD_RESET_DISABLE 0xF5 /* reset and disable scanning */ +#define KBD_CMD_RESET_ENABLE 0xF6 /* reset and enable scanning */ +#define KBD_CMD_RESET 0xFF /* Reset */ #define KBD_CMD_SET_MAKE_BREAK 0xFC /* Set Make and Break mode */ #define KBD_CMD_SET_TYPEMATIC 0xFA /* Set Typematic Make and Break mode */ /* Keyboard Replies */ -#define KBD_REPLY_POR 0xAA /* Power on reset */ -#define KBD_REPLY_ID 0xAB /* Keyboard ID */ -#define KBD_REPLY_ACK 0xFA /* Command ACK */ -#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ +#define KBD_REPLY_POR 0xAA /* Power on reset */ +#define KBD_REPLY_ID 0xAB /* Keyboard ID */ +#define KBD_REPLY_ACK 0xFA /* Command ACK */ +#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ /* Mouse Commands */ -#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */ -#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */ -#define AUX_SET_RES 0xE8 /* Set resolution */ -#define AUX_GET_SCALE 0xE9 /* Get scaling factor */ -#define AUX_SET_STREAM 0xEA /* Set stream mode */ -#define AUX_POLL 0xEB /* Poll */ -#define AUX_RESET_WRAP 0xEC /* Reset wrap mode */ -#define AUX_SET_WRAP 0xEE /* Set wrap mode */ -#define AUX_SET_REMOTE 0xF0 /* Set remote mode */ -#define AUX_GET_TYPE 0xF2 /* Get type */ -#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */ -#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */ -#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */ -#define AUX_SET_DEFAULT 0xF6 -#define AUX_RESET 0xFF /* Reset aux device */ -#define AUX_ACK 0xFA /* Command byte ACK. */ +#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */ +#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */ +#define AUX_SET_RES 0xE8 /* Set resolution */ +#define AUX_GET_SCALE 0xE9 /* Get scaling factor */ +#define AUX_SET_STREAM 0xEA /* Set stream mode */ +#define AUX_POLL 0xEB /* Poll */ +#define AUX_RESET_WRAP 0xEC /* Reset wrap mode */ +#define AUX_SET_WRAP 0xEE /* Set wrap mode */ +#define AUX_SET_REMOTE 0xF0 /* Set remote mode */ +#define AUX_GET_TYPE 0xF2 /* Get type */ +#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */ +#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */ +#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */ +#define AUX_SET_DEFAULT 0xF6 +#define AUX_RESET 0xFF /* Reset aux device */ +#define AUX_ACK 0xFA /* Command byte ACK. */ #define MOUSE_STATUS_REMOTE 0x40 #define MOUSE_STATUS_ENABLED 0x20 @@ -436,8 +436,9 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src, } } } else { - if (qcode < qemu_input_map_qcode_to_atset1_len) + if (qcode < qemu_input_map_qcode_to_atset1_len) { keycode = qemu_input_map_qcode_to_atset1[qcode]; + } if (keycode) { if (keycode & 0xff00) { ps2_put_keycode(s, keycode >> 8); @@ -530,8 +531,9 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src, } } } else { - if (qcode < qemu_input_map_qcode_to_atset2_len) + if (qcode < qemu_input_map_qcode_to_atset2_len) { keycode = qemu_input_map_qcode_to_atset2[qcode]; + } if (keycode) { if (keycode & 0xff00) { ps2_put_keycode(s, keycode >> 8); @@ -546,8 +548,9 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src, } } } else if (s->scancode_set == 3) { - if (qcode < qemu_input_map_qcode_to_atset3_len) + if (qcode < qemu_input_map_qcode_to_atset3_len) { keycode = qemu_input_map_qcode_to_atset3[qcode]; + } if (keycode) { /* FIXME: break code should be configured on a key by key basis */ if (!key->down) { @@ -569,8 +572,10 @@ uint32_t ps2_read_data(PS2State *s) trace_ps2_read_data(s); q = &s->queue; if (q->count == 0) { - /* NOTE: if no data left, we return the last keyboard one - (needed for EMM386) */ + /* + * NOTE: if no data left, we return the last keyboard one + * (needed for EMM386) + */ /* XXX: need a timer to do things correctly */ index = q->rptr - 1; if (index < 0) { @@ -619,10 +624,10 @@ void ps2_write_keyboard(void *opaque, int val) trace_ps2_write_keyboard(opaque, val); ps2_cqueue_reset(&s->common); - switch(s->common.write_cmd) { + switch (s->common.write_cmd) { default: case -1: - switch(val) { + switch (val) { case 0x00: ps2_cqueue_1(&s->common, KBD_REPLY_ACK); break; @@ -632,7 +637,7 @@ void ps2_write_keyboard(void *opaque, int val) case KBD_CMD_GET_ID: /* We emulate a MF2 AT keyboard here */ ps2_cqueue_3(&s->common, KBD_REPLY_ACK, KBD_REPLY_ID, - s->translate ? 0x41 : 0x83); + s->translate ? 0x41 : 0x83); break; case KBD_CMD_ECHO: ps2_cqueue_1(&s->common, KBD_CMD_ECHO); @@ -661,8 +666,8 @@ void ps2_write_keyboard(void *opaque, int val) case KBD_CMD_RESET: ps2_reset_keyboard(s); ps2_cqueue_2(&s->common, - KBD_REPLY_ACK, - KBD_REPLY_POR); + KBD_REPLY_ACK, + KBD_REPLY_POR); break; case KBD_CMD_SET_TYPEMATIC: ps2_cqueue_1(&s->common, KBD_REPLY_ACK); @@ -700,9 +705,11 @@ void ps2_write_keyboard(void *opaque, int val) } } -/* Set the scancode translation mode. - 0 = raw scancodes. - 1 = translated scancodes (used by qemu internally). */ +/* + * Set the scancode translation mode. + * 0 = raw scancodes. + * 1 = translated scancodes (used by qemu internally). + */ void ps2_keyboard_set_translation(void *opaque, int mode) { @@ -727,30 +734,33 @@ static int ps2_mouse_send_packet(PS2MouseState *s) dz1 = s->mouse_dz; dw1 = s->mouse_dw; /* XXX: increase range to 8 bits ? */ - if (dx1 > 127) + if (dx1 > 127) { dx1 = 127; - else if (dx1 < -127) + } else if (dx1 < -127) { dx1 = -127; - if (dy1 > 127) + } + if (dy1 > 127) { dy1 = 127; - else if (dy1 < -127) + } else if (dy1 < -127) { dy1 = -127; + } b = 0x08 | ((dx1 < 0) << 4) | ((dy1 < 0) << 5) | (s->mouse_buttons & 0x07); ps2_queue_noirq(&s->common, b); ps2_queue_noirq(&s->common, dx1 & 0xff); ps2_queue_noirq(&s->common, dy1 & 0xff); /* extra byte for IMPS/2 or IMEX */ - switch(s->mouse_type) { + switch (s->mouse_type) { default: /* Just ignore the wheels if not supported */ s->mouse_dz = 0; s->mouse_dw = 0; break; case 3: - if (dz1 > 127) + if (dz1 > 127) { dz1 = 127; - else if (dz1 < -127) - dz1 = -127; + } else if (dz1 < -127) { + dz1 = -127; + } ps2_queue_noirq(&s->common, dz1 & 0xff); s->mouse_dz -= dz1; s->mouse_dw = 0; @@ -816,8 +826,9 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src, InputBtnEvent *btn; /* check if deltas are recorded when disabled */ - if (!(s->mouse_status & MOUSE_STATUS_ENABLED)) + if (!(s->mouse_status & MOUSE_STATUS_ENABLED)) { return; + } switch (evt->type) { case INPUT_EVENT_KIND_REL: @@ -868,8 +879,10 @@ static void ps2_mouse_sync(DeviceState *dev) qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); } if (!(s->mouse_status & MOUSE_STATUS_REMOTE)) { - /* if not remote, send event. Multiple events are sent if - too big deltas */ + /* + * if not remote, send event. Multiple events are sent if + * too big deltas + */ while (ps2_mouse_send_packet(s)) { if (s->mouse_dx == 0 && s->mouse_dy == 0 && s->mouse_dz == 0 && s->mouse_dw == 0) { @@ -892,7 +905,7 @@ void ps2_write_mouse(void *opaque, int val) PS2MouseState *s = (PS2MouseState *)opaque; trace_ps2_write_mouse(opaque, val); - switch(s->common.write_cmd) { + switch (s->common.write_cmd) { default: case -1: /* mouse command */ @@ -906,7 +919,7 @@ void ps2_write_mouse(void *opaque, int val) return; } } - switch(val) { + switch (val) { case AUX_SET_SCALE11: s->mouse_status &= ~MOUSE_STATUS_SCALE21; ps2_queue(&s->common, AUX_ACK); @@ -980,28 +993,32 @@ void ps2_write_mouse(void *opaque, int val) case AUX_SET_SAMPLE: s->mouse_sample_rate = val; /* detect IMPS/2 or IMEX */ - switch(s->mouse_detect_state) { + switch (s->mouse_detect_state) { default: case 0: - if (val == 200) + if (val == 200) { s->mouse_detect_state = 1; + } break; case 1: - if (val == 100) + if (val == 100) { s->mouse_detect_state = 2; - else if (val == 200) + } else if (val == 200) { s->mouse_detect_state = 3; - else + } else { s->mouse_detect_state = 0; + } break; case 2: - if (val == 80) + if (val == 80) { s->mouse_type = 3; /* IMPS/2 */ + } s->mouse_detect_state = 0; break; case 3: - if (val == 80) + if (val == 80) { s->mouse_type = 4; /* IMEX */ + } s->mouse_detect_state = 0; break; } @@ -1154,13 +1171,14 @@ static const VMStateDescription vmstate_ps2_keyboard_cqueue = { } }; -static int ps2_kbd_post_load(void* opaque, int version_id) +static int ps2_kbd_post_load(void *opaque, int version_id) { - PS2KbdState *s = (PS2KbdState*)opaque; + PS2KbdState *s = (PS2KbdState *)opaque; PS2State *ps2 = &s->common; - if (version_id == 2) - s->scancode_set=2; + if (version_id == 2) { + s->scancode_set = 2; + } ps2_common_post_load(ps2); @@ -1176,10 +1194,10 @@ static const VMStateDescription vmstate_ps2_keyboard = { VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State), VMSTATE_INT32(scan_enabled, PS2KbdState), VMSTATE_INT32(translate, PS2KbdState), - VMSTATE_INT32_V(scancode_set, PS2KbdState,3), + VMSTATE_INT32_V(scancode_set, PS2KbdState, 3), VMSTATE_END_OF_LIST() }, - .subsections = (const VMStateDescription*[]) { + .subsections = (const VMStateDescription * []) { &vmstate_ps2_keyboard_ledstate, &vmstate_ps2_keyboard_need_high_bit, &vmstate_ps2_keyboard_cqueue, From patchwork Sun Jun 26 17:44:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 448C6C43334 for ; Sun, 26 Jun 2022 17:49:23 +0000 (UTC) Received: from localhost ([::1]:42616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WNs-0004M4-Cc for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:49:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKZ-0001O9-U7 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:02 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:44990) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKW-0008Kz-OM for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:45:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=3c8LZ7lwJGM6UsltFoeVrKrMFOBOfG5nlGNHi8yZus4=; b=l2WtmKQsvVUw7b7TkXeoNAkU1E y/VbyZT90kDsGgYMnvwv6xNGVmse1EHBtYomqADURNcxKqXLoU13NNGApNzg3+jB0FffXr3vLK2AL d/mdMpmfdbacK19duTh9u5vFcpf3hA84ojEKW6Vmfn4UqYcPx2We5Q3J+mdhW+xeatZUv0l1W99c8 vFfW0nJwNZ9iY49cUH4omrMfVGvLabCSGc5+OZjEt91gjOhk5NUOlJ400MmfJYNG+3JOotuY6TQ77 qRArUL3P/iS0E/vHaMwyzKHzdJi2i/vrAH39cDpPk+ahBdPMhiTdJrLE1NNQfoj0JSdJocfjS1leB crLsMH/DSvqxzthrN+C4GbYkU7FuFBrCMfRBZAWudlU4wWFZG6kq2xEfk15p0Yvj8x8AFQ8HGv9Mv aZp4sZuHaQNubswcGfE+ZnKV8b3fa28BsF4yW9KCrv/DG1Jsw3qKNen+IGwotki+o6bVgDxMtcrG5 m3gimC7FxC7J/+CYRPcTGvD6GMLAROUXpn5REBhpr75Lg2yfOComkR/XHlwcE2lESUM+Xyeb0M0bT 4wt7YN1z7sqx/zU1LrlCCBTUR9hDP7NCOBolTYaCJBD9/jS/7R+5EGOv2d5B6kT7S15bxpCrchSjV A1Rx3I2mmMMMSYTcBjq0cmV0fVXtgzEz+34CxmGik=; 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 1o5WJI-0007KY-BM; Sun, 26 Jun 2022 18:44:40 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:38 +0100 Message-Id: <20220626174531.969187-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 02/55] ps2: QOMify PS2State 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Make PS2State a new abstract PS2_DEVICE QOM type to represent the common functionality shared between PS2 keyboard and mouse devices. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-3-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 67dd2eca84..514e55cbb6 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" +#include "hw/sysbus.h" #include "hw/input/ps2.h" #include "migration/vmstate.h" #include "ui/console.h" @@ -96,12 +97,17 @@ typedef struct { } PS2Queue; struct PS2State { + SysBusDevice parent_obj; + PS2Queue queue; int32_t write_cmd; void (*update_irq)(void *, int); void *update_arg; }; +#define TYPE_PS2_DEVICE "ps2-device" +OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) + typedef struct { PS2State common; int scan_enabled; @@ -1277,3 +1283,25 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) qemu_register_reset(ps2_mouse_reset, s); return s; } + +static void ps2_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + +static const TypeInfo ps2_info = { + .name = TYPE_PS2_DEVICE, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PS2State), + .class_init = ps2_class_init, + .abstract = true +}; + +static void ps2_register_types(void) +{ + type_register_static(&ps2_info); +} + +type_init(ps2_register_types) From patchwork Sun Jun 26 17:44:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B127C433EF for ; Sun, 26 Jun 2022 17:52:16 +0000 (UTC) Received: from localhost ([::1]:51406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WQh-0001uy-Om for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:52:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKc-0001OE-Oe for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:02 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:44994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKa-0008L9-Rm for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:45:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=qF2ib9a3TV4Z9QxylkCCDNvkDBnDkUi8d79dl/SrpCU=; b=b/iCmQq3EJ9OEs24MrRLaLO9LK TS0Tak7D15Idm6g0/TK5MiKoctnj5MGk2S04rbuYtk2FfWzrxXwEecyOE+AMfg7+bCWxeoYpot/MK unmZyeTe1lcjK53MGcYonAKAAibFbqE7B83vj/cL90ArHDehGAgEon/d0b4DRUVBvbFXP4/TR3UuH WeZnfzQrvVwAL9BimVky3ZVy39yELsegwwpwAYcK0ZY1prG8EEvn+hJvUhQk23hTKpz0zvqR47L++ vckY7AKKmEoLdUQ6dI7ejkir+MfNy6kGnPTp2kkWU11dmy/q8obHCqfNY4zgfuWfyqo3rNzQQUSOF wJRTLufZ1Ni73p1J/t0/r0Jzm2sK6hBRG13j5m6VVcVl9KW76DxsKBRZz9m75keKNPXRHN9O72iUH V20XVhMGf43tQX6mK8LPivy2Q8etLBG7QKl6Q+eGSrDm9JUmQ3/JBwwPytneZkvyOBjFe3X619TcV lUpkTXjhidsFqfBYpBSnT+cjFmL9uPeixfBDGWPf/6yrDrPZvY/5RcDyBOe/4UfzIEMdFVDITorZp daCcC2rK8NRe/fDqUFJ+YWhiylg23mp5QtcRZi4OBarJcyb4hLsBNzXZAO9K5uQpVb+uJ2XHsf9Am aNge8NOWGuoP3PQYB+YFrMmV5qotHVrcmql+6YRbU=; 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 1o5WJM-0007KY-HV; Sun, 26 Jun 2022 18:44:44 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:39 +0100 Message-Id: <20220626174531.969187-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 03/55] ps2: QOMify PS2KbdState 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Make PS2KbdState into a new PS2_KBD_DEVICE QOM type which inherits from the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-4-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 104 ++++++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 514e55cbb6..14eb777c3f 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -31,6 +31,7 @@ #include "ui/input.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" +#include "qapi/error.h" #include "trace.h" @@ -108,15 +109,19 @@ struct PS2State { #define TYPE_PS2_DEVICE "ps2-device" OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) -typedef struct { - PS2State common; +struct PS2KbdState { + PS2State parent_obj; + int scan_enabled; int translate; int scancode_set; /* 1=XT, 2=AT, 3=PS/2 */ int ledstate; bool need_high_bit; unsigned int modifiers; /* bitmask of MOD_* constants above */ -} PS2KbdState; +}; + +#define TYPE_PS2_KBD_DEVICE "ps2-kbd" +OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) typedef struct { PS2State common; @@ -330,6 +335,7 @@ static void ps2_cqueue_reset(PS2State *s) static void ps2_put_keycode(void *opaque, int keycode) { PS2KbdState *s = opaque; + PS2State *ps = PS2_DEVICE(s); trace_ps2_put_keycode(opaque, keycode); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); @@ -338,13 +344,13 @@ static void ps2_put_keycode(void *opaque, int keycode) if (keycode == 0xf0) { s->need_high_bit = true; } else if (s->need_high_bit) { - ps2_queue(&s->common, translate_table[keycode] | 0x80); + ps2_queue(ps, translate_table[keycode] | 0x80); s->need_high_bit = false; } else { - ps2_queue(&s->common, translate_table[keycode]); + ps2_queue(ps, translate_table[keycode]); } } else { - ps2_queue(&s->common, keycode); + ps2_queue(ps, keycode); } } @@ -617,96 +623,99 @@ static void ps2_set_ledstate(PS2KbdState *s, int ledstate) static void ps2_reset_keyboard(PS2KbdState *s) { + PS2State *ps2 = PS2_DEVICE(s); + trace_ps2_reset_keyboard(s); s->scan_enabled = 1; s->scancode_set = 2; - ps2_reset_queue(&s->common); + ps2_reset_queue(ps2); ps2_set_ledstate(s, 0); } void ps2_write_keyboard(void *opaque, int val) { PS2KbdState *s = (PS2KbdState *)opaque; + PS2State *ps2 = PS2_DEVICE(s); trace_ps2_write_keyboard(opaque, val); - ps2_cqueue_reset(&s->common); - switch (s->common.write_cmd) { + ps2_cqueue_reset(ps2); + switch (ps2->write_cmd) { default: case -1: switch (val) { case 0x00: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case 0x05: - ps2_cqueue_1(&s->common, KBD_REPLY_RESEND); + ps2_cqueue_1(ps2, KBD_REPLY_RESEND); break; case KBD_CMD_GET_ID: /* We emulate a MF2 AT keyboard here */ - ps2_cqueue_3(&s->common, KBD_REPLY_ACK, KBD_REPLY_ID, + ps2_cqueue_3(ps2, KBD_REPLY_ACK, KBD_REPLY_ID, s->translate ? 0x41 : 0x83); break; case KBD_CMD_ECHO: - ps2_cqueue_1(&s->common, KBD_CMD_ECHO); + ps2_cqueue_1(ps2, KBD_CMD_ECHO); break; case KBD_CMD_ENABLE: s->scan_enabled = 1; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_SCANCODE: case KBD_CMD_SET_LEDS: case KBD_CMD_SET_RATE: case KBD_CMD_SET_MAKE_BREAK: - s->common.write_cmd = val; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2->write_cmd = val; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_RESET_DISABLE: ps2_reset_keyboard(s); s->scan_enabled = 0; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_RESET_ENABLE: ps2_reset_keyboard(s); s->scan_enabled = 1; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_RESET: ps2_reset_keyboard(s); - ps2_cqueue_2(&s->common, + ps2_cqueue_2(ps2, KBD_REPLY_ACK, KBD_REPLY_POR); break; case KBD_CMD_SET_TYPEMATIC: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; default: - ps2_cqueue_1(&s->common, KBD_REPLY_RESEND); + ps2_cqueue_1(ps2, KBD_REPLY_RESEND); break; } break; case KBD_CMD_SET_MAKE_BREAK: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd = -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd = -1; break; case KBD_CMD_SCANCODE: if (val == 0) { - ps2_cqueue_2(&s->common, KBD_REPLY_ACK, s->translate ? + ps2_cqueue_2(ps2, KBD_REPLY_ACK, s->translate ? translate_table[s->scancode_set] : s->scancode_set); } else if (val >= 1 && val <= 3) { s->scancode_set = val; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); } else { - ps2_cqueue_1(&s->common, KBD_REPLY_RESEND); + ps2_cqueue_1(ps2, KBD_REPLY_RESEND); } - s->common.write_cmd = -1; + ps2->write_cmd = -1; break; case KBD_CMD_SET_LEDS: ps2_set_ledstate(s, val); - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd = -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd = -1; break; case KBD_CMD_SET_RATE: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd = -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd = -1; break; } } @@ -1075,9 +1084,10 @@ static void ps2_common_post_load(PS2State *s) static void ps2_kbd_reset(void *opaque) { PS2KbdState *s = (PS2KbdState *) opaque; + PS2State *ps2 = PS2_DEVICE(s); trace_ps2_kbd_reset(opaque); - ps2_common_reset(&s->common); + ps2_common_reset(ps2); s->scan_enabled = 1; s->translate = 0; s->scancode_set = 2; @@ -1164,15 +1174,16 @@ static const VMStateDescription vmstate_ps2_keyboard_need_high_bit = { static bool ps2_keyboard_cqueue_needed(void *opaque) { PS2KbdState *s = opaque; + PS2State *ps2 = PS2_DEVICE(s); - return s->common.queue.cwptr != -1; /* the queue is mostly empty */ + return ps2->queue.cwptr != -1; /* the queue is mostly empty */ } static const VMStateDescription vmstate_ps2_keyboard_cqueue = { .name = "ps2kbd/command_reply_queue", .needed = ps2_keyboard_cqueue_needed, .fields = (VMStateField[]) { - VMSTATE_INT32(common.queue.cwptr, PS2KbdState), + VMSTATE_INT32(parent_obj.queue.cwptr, PS2KbdState), VMSTATE_END_OF_LIST() } }; @@ -1180,7 +1191,7 @@ static const VMStateDescription vmstate_ps2_keyboard_cqueue = { static int ps2_kbd_post_load(void *opaque, int version_id) { PS2KbdState *s = (PS2KbdState *)opaque; - PS2State *ps2 = &s->common; + PS2State *ps2 = PS2_DEVICE(s); if (version_id == 2) { s->scancode_set = 2; @@ -1197,7 +1208,8 @@ static const VMStateDescription vmstate_ps2_keyboard = { .minimum_version_id = 2, .post_load = ps2_kbd_post_load, .fields = (VMStateField[]) { - VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State), + VMSTATE_STRUCT(parent_obj, PS2KbdState, 0, vmstate_ps2_common, + PS2State), VMSTATE_INT32(scan_enabled, PS2KbdState), VMSTATE_INT32(translate, PS2KbdState), VMSTATE_INT32_V(scancode_set, PS2KbdState, 3), @@ -1250,11 +1262,18 @@ static QemuInputHandler ps2_keyboard_handler = { void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) { - PS2KbdState *s = g_new0(PS2KbdState, 1); + DeviceState *dev; + PS2KbdState *s; + PS2State *ps2; + + dev = qdev_new(TYPE_PS2_KBD_DEVICE); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = PS2_KBD_DEVICE(dev); + ps2 = PS2_DEVICE(s); trace_ps2_kbd_init(s); - s->common.update_irq = update_irq; - s->common.update_arg = update_arg; + ps2->update_irq = update_irq; + ps2->update_arg = update_arg; s->scancode_set = 2; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); qemu_input_handler_register((DeviceState *)s, @@ -1284,6 +1303,12 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) return s; } +static const TypeInfo ps2_kbd_info = { + .name = TYPE_PS2_KBD_DEVICE, + .parent = TYPE_PS2_DEVICE, + .instance_size = sizeof(PS2KbdState), +}; + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -1302,6 +1327,7 @@ static const TypeInfo ps2_info = { static void ps2_register_types(void) { type_register_static(&ps2_info); + type_register_static(&ps2_kbd_info); } type_init(ps2_register_types) From patchwork Sun Jun 26 17:44:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 243C1C43334 for ; Sun, 26 Jun 2022 17:49:29 +0000 (UTC) Received: from localhost ([::1]:42662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WNz-0004Ny-PZ for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:49:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKg-0001OO-UG for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:03 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKf-0008LJ-0Q for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=xM/ZsR3vL/mcygkoe1HK/kU0rflmUD5nWXFZvv+ZGZA=; b=BeXqJOSoTAKA+rNJUfiy707k7Q TBaoJ3lF8kdnLFttHO1OCA0xs93169J23jEgqLTvk86s/5U9bkH0lH1pfpTsR93RgfyS3xPLlD5+d eCW8imRQY6w9wnAdfzMYHJ0vYvvdCDtnvknPbteW1pAikN+DscbOVs0aaAQTjNDgEiqS76X6bHdJk SHHDXl+tykKwbU0IiRZFqofntVvnjA4KGbj4laj7t10xi+BKbps3+FThqid1IdErWXGDdPsjJOw8M X0gcjOoJ0t9XMB1exsxkxA4oWtrDBP2chpSqAjSBhu4KByz/l/X8EWaNGiKGVUxY+lnq+Ndup12JO 7BPHDK4y/s5BE5yhK45Z8hIc+RKeV92EY83ORwrd2w5XwCWTRwf8FQWSel4z2wuhas9ATECkWQO4o 8UPELg79ZRN0+4vBNqtsW/TI9QxsWzIr5cFSrwTuctUHZYTsmpiOTqg9+0bPf7xT87okyW1kLgv7O QEj2iu/MSx01eOBffOWWN7rru8PtTA6ZTQVovWE8rQK8u3xErUb3ZgtjEOM2TQTiMebW+5XUYzy79 uXZG+ldoew9q3mJzzoZZN0bPA4S0iGElQtB7HLZA96o5bcqkjS90HRdLoLM68QKKiBDWUOGF1vXN3 kyP5qmvEcGKFHi0kjDY1gjtX5GQbezrIsYD4VIsew=; 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 1o5WJQ-0007KY-SN; Sun, 26 Jun 2022 18:44:48 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:40 +0100 Message-Id: <20220626174531.969187-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 04/55] ps2: QOMify PS2MouseState 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Make PS2MouseState into a new PS2_MOUSE_DEVICE QOM type which inherits from the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-5-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 98 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 38 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 14eb777c3f..ee7c36d4f2 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -123,8 +123,9 @@ struct PS2KbdState { #define TYPE_PS2_KBD_DEVICE "ps2-kbd" OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) -typedef struct { - PS2State common; +struct PS2MouseState { + PS2State parent_obj; + uint8_t mouse_status; uint8_t mouse_resolution; uint8_t mouse_sample_rate; @@ -136,7 +137,10 @@ typedef struct { int mouse_dz; int mouse_dw; uint8_t mouse_buttons; -} PS2MouseState; +}; + +#define TYPE_PS2_MOUSE_DEVICE "ps2-mouse" +OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) static uint8_t translate_table[256] = { 0xff, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x3c, 0x58, @@ -735,12 +739,13 @@ void ps2_keyboard_set_translation(void *opaque, int mode) static int ps2_mouse_send_packet(PS2MouseState *s) { + PS2State *ps2 = PS2_DEVICE(s); /* IMPS/2 and IMEX send 4 bytes, PS2 sends 3 bytes */ const int needed = s->mouse_type ? 4 : 3; unsigned int b; int dx1, dy1, dz1, dw1; - if (PS2_QUEUE_SIZE - s->common.queue.count < needed) { + if (PS2_QUEUE_SIZE - ps2->queue.count < needed) { return 0; } @@ -760,9 +765,9 @@ static int ps2_mouse_send_packet(PS2MouseState *s) dy1 = -127; } b = 0x08 | ((dx1 < 0) << 4) | ((dy1 < 0) << 5) | (s->mouse_buttons & 0x07); - ps2_queue_noirq(&s->common, b); - ps2_queue_noirq(&s->common, dx1 & 0xff); - ps2_queue_noirq(&s->common, dy1 & 0xff); + ps2_queue_noirq(ps2, b); + ps2_queue_noirq(ps2, dx1 & 0xff); + ps2_queue_noirq(ps2, dy1 & 0xff); /* extra byte for IMPS/2 or IMEX */ switch (s->mouse_type) { default: @@ -776,7 +781,7 @@ static int ps2_mouse_send_packet(PS2MouseState *s) } else if (dz1 < -127) { dz1 = -127; } - ps2_queue_noirq(&s->common, dz1 & 0xff); + ps2_queue_noirq(ps2, dz1 & 0xff); s->mouse_dz -= dz1; s->mouse_dw = 0; break; @@ -812,11 +817,11 @@ static int ps2_mouse_send_packet(PS2MouseState *s) b = (dz1 & 0x0f) | ((s->mouse_buttons & 0x18) << 1); s->mouse_dz -= dz1; } - ps2_queue_noirq(&s->common, b); + ps2_queue_noirq(ps2, b); break; } - ps2_raise_irq(&s->common); + ps2_raise_irq(ps2); trace_ps2_mouse_send_packet(s, dx1, dy1, dz1, b); /* update deltas */ @@ -918,85 +923,86 @@ void ps2_mouse_fake_event(void *opaque) void ps2_write_mouse(void *opaque, int val) { PS2MouseState *s = (PS2MouseState *)opaque; + PS2State *ps2 = PS2_DEVICE(s); trace_ps2_write_mouse(opaque, val); - switch (s->common.write_cmd) { + switch (ps2->write_cmd) { default: case -1: /* mouse command */ if (s->mouse_wrap) { if (val == AUX_RESET_WRAP) { s->mouse_wrap = 0; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); return; } else if (val != AUX_RESET) { - ps2_queue(&s->common, val); + ps2_queue(ps2, val); return; } } switch (val) { case AUX_SET_SCALE11: s->mouse_status &= ~MOUSE_STATUS_SCALE21; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_SCALE21: s->mouse_status |= MOUSE_STATUS_SCALE21; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_STREAM: s->mouse_status &= ~MOUSE_STATUS_REMOTE; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_WRAP: s->mouse_wrap = 1; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_REMOTE: s->mouse_status |= MOUSE_STATUS_REMOTE; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_GET_TYPE: - ps2_queue_2(&s->common, + ps2_queue_2(ps2, AUX_ACK, s->mouse_type); break; case AUX_SET_RES: case AUX_SET_SAMPLE: - s->common.write_cmd = val; - ps2_queue(&s->common, AUX_ACK); + ps2->write_cmd = val; + ps2_queue(ps2, AUX_ACK); break; case AUX_GET_SCALE: - ps2_queue_4(&s->common, + ps2_queue_4(ps2, AUX_ACK, s->mouse_status, s->mouse_resolution, s->mouse_sample_rate); break; case AUX_POLL: - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); ps2_mouse_send_packet(s); break; case AUX_ENABLE_DEV: s->mouse_status |= MOUSE_STATUS_ENABLED; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_DISABLE_DEV: s->mouse_status &= ~MOUSE_STATUS_ENABLED; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_DEFAULT: s->mouse_sample_rate = 100; s->mouse_resolution = 2; s->mouse_status = 0; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_RESET: s->mouse_sample_rate = 100; s->mouse_resolution = 2; s->mouse_status = 0; s->mouse_type = 0; - ps2_reset_queue(&s->common); - ps2_queue_3(&s->common, + ps2_reset_queue(ps2); + ps2_queue_3(ps2, AUX_ACK, 0xaa, s->mouse_type); @@ -1037,13 +1043,13 @@ void ps2_write_mouse(void *opaque, int val) s->mouse_detect_state = 0; break; } - ps2_queue(&s->common, AUX_ACK); - s->common.write_cmd = -1; + ps2_queue(ps2, AUX_ACK); + ps2->write_cmd = -1; break; case AUX_SET_RES: s->mouse_resolution = val; - ps2_queue(&s->common, AUX_ACK); - s->common.write_cmd = -1; + ps2_queue(ps2, AUX_ACK); + ps2->write_cmd = -1; break; } } @@ -1097,9 +1103,10 @@ static void ps2_kbd_reset(void *opaque) static void ps2_mouse_reset(void *opaque) { PS2MouseState *s = (PS2MouseState *) opaque; + PS2State *ps2 = PS2_DEVICE(s); trace_ps2_mouse_reset(opaque); - ps2_common_reset(&s->common); + ps2_common_reset(ps2); s->mouse_status = 0; s->mouse_resolution = 0; s->mouse_sample_rate = 0; @@ -1226,7 +1233,7 @@ static const VMStateDescription vmstate_ps2_keyboard = { static int ps2_mouse_post_load(void *opaque, int version_id) { PS2MouseState *s = (PS2MouseState *)opaque; - PS2State *ps2 = &s->common; + PS2State *ps2 = PS2_DEVICE(s); ps2_common_post_load(ps2); @@ -1239,7 +1246,8 @@ static const VMStateDescription vmstate_ps2_mouse = { .minimum_version_id = 2, .post_load = ps2_mouse_post_load, .fields = (VMStateField[]) { - VMSTATE_STRUCT(common, PS2MouseState, 0, vmstate_ps2_common, PS2State), + VMSTATE_STRUCT(parent_obj, PS2MouseState, 0, vmstate_ps2_common, + PS2State), VMSTATE_UINT8(mouse_status, PS2MouseState), VMSTATE_UINT8(mouse_resolution, PS2MouseState), VMSTATE_UINT8(mouse_sample_rate, PS2MouseState), @@ -1291,11 +1299,18 @@ static QemuInputHandler ps2_mouse_handler = { void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) { - PS2MouseState *s = g_new0(PS2MouseState, 1); + DeviceState *dev; + PS2MouseState *s; + PS2State *ps2; + + dev = qdev_new(TYPE_PS2_MOUSE_DEVICE); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = PS2_MOUSE_DEVICE(dev); + ps2 = PS2_DEVICE(s); trace_ps2_mouse_init(s); - s->common.update_irq = update_irq; - s->common.update_arg = update_arg; + ps2->update_irq = update_irq; + ps2->update_arg = update_arg; vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); qemu_input_handler_register((DeviceState *)s, &ps2_mouse_handler); @@ -1309,6 +1324,12 @@ static const TypeInfo ps2_kbd_info = { .instance_size = sizeof(PS2KbdState), }; +static const TypeInfo ps2_mouse_info = { + .name = TYPE_PS2_MOUSE_DEVICE, + .parent = TYPE_PS2_DEVICE, + .instance_size = sizeof(PS2MouseState), +}; + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -1328,6 +1349,7 @@ static void ps2_register_types(void) { type_register_static(&ps2_info); type_register_static(&ps2_kbd_info); + type_register_static(&ps2_mouse_info); } type_init(ps2_register_types) From patchwork Sun Jun 26 17:44:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7A6F3C433EF for ; Sun, 26 Jun 2022 17:55:28 +0000 (UTC) Received: from localhost ([::1]:60110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WTm-0007iU-B4 for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:55:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKk-0001R2-Qk for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:07 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKj-0008Ls-70 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=BZml7I+V+rWrg5ez6I5ApogNyKuRqt18HAY3/rRCWZg=; b=ZPTYiGO0ma8vJkMUfTcIppznT7 cjKf4/914qivygR0nYi8MIklXEUMZfuqsEnu0IbGJ3ITiBQYnGf1n/cX3biWWykmRtGpXB9AoODiP rroEczvFsTMBrR49xrAlsnj4jp0CNh7mKYW8BBbCRPFldI9bpCVwBPmDalWsea5KXLYNcz0En6uqU FM7OEwaBz9xsLsG8F/6ppZoyqluFV9ABiZQcB6DGMC4phP7LEK4zFTGT/AtZimTH3R5bLRj50jVJV gpuy0wEGF/kVU4/9u1zo5mg93pzCCJa7KzvA94PqKFTE59OuCvp17n5+0QHsIyeTLfugxemn6gob0 ceJR6+hRFzrpNW9eW2ifRYt8+zuYWAGXQEFJqfBmCqrGXdvinZW8I5h0BZA2btV+pLwSqnfyKmrRL 0vBRjjIt7camtKBVgzLfY4Lfxx+WpfvX58x+k1RP1+XBxm4rxJTX+TIDjta8lhu6owryj4BNIXdj4 pO/zMEiz+oOGJkDxA7oG0m6Xrqjpzy1w6apTG96143uEo7JJaExrb6LBC/oQJH32Z+RUxdOmcmrzw Rzy0Q2SKYisDm0qRp3BCEQW+yEOcGn+t6Ay77fCWgKk6lu/oaJ41B1pFqsGTGEjfohJTU86ZhDYQW 1lyf9quF1N22KxvrN+h1v/5HyZyQq8Jzk/S/UAAeU=; 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 1o5WJU-0007KY-RM; Sun, 26 Jun 2022 18:44:53 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:41 +0100 Message-Id: <20220626174531.969187-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 05/55] ps2: move QOM type definitions from ps2.c to ps2.h 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move the QOM type definitions into the ps2.h header file to allow the new QOM types to be used by other devices. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-6-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 55 --------------------------------------- include/hw/input/ps2.h | 58 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index ee7c36d4f2..f4bad9876a 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -76,11 +76,6 @@ #define MOUSE_STATUS_ENABLED 0x20 #define MOUSE_STATUS_SCALE21 0x10 -/* - * PS/2 buffer size. Keep 256 bytes for compatibility with - * older QEMU versions. - */ -#define PS2_BUFFER_SIZE 256 #define PS2_QUEUE_SIZE 16 /* Queue size required by PS/2 protocol */ #define PS2_QUEUE_HEADROOM 8 /* Queue size for keyboard command replies */ @@ -92,56 +87,6 @@ #define MOD_SHIFT_R (1 << 4) #define MOD_ALT_R (1 << 5) -typedef struct { - uint8_t data[PS2_BUFFER_SIZE]; - int rptr, wptr, cwptr, count; -} PS2Queue; - -struct PS2State { - SysBusDevice parent_obj; - - PS2Queue queue; - int32_t write_cmd; - void (*update_irq)(void *, int); - void *update_arg; -}; - -#define TYPE_PS2_DEVICE "ps2-device" -OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) - -struct PS2KbdState { - PS2State parent_obj; - - int scan_enabled; - int translate; - int scancode_set; /* 1=XT, 2=AT, 3=PS/2 */ - int ledstate; - bool need_high_bit; - unsigned int modifiers; /* bitmask of MOD_* constants above */ -}; - -#define TYPE_PS2_KBD_DEVICE "ps2-kbd" -OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) - -struct PS2MouseState { - PS2State parent_obj; - - uint8_t mouse_status; - uint8_t mouse_resolution; - uint8_t mouse_sample_rate; - uint8_t mouse_wrap; - uint8_t mouse_type; /* 0 = PS2, 3 = IMPS/2, 4 = IMEX */ - uint8_t mouse_detect_state; - int mouse_dx; /* current values, needed for 'poll' mode */ - int mouse_dy; - int mouse_dz; - int mouse_dw; - uint8_t mouse_buttons; -}; - -#define TYPE_PS2_MOUSE_DEVICE "ps2-mouse" -OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) - static uint8_t translate_table[256] = { 0xff, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x3c, 0x58, 0x64, 0x44, 0x42, 0x40, 0x3e, 0x0f, 0x29, 0x59, diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 35d983897a..7f2c3f6090 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -25,13 +25,69 @@ #ifndef HW_PS2_H #define HW_PS2_H +#include "hw/sysbus.h" + #define PS2_MOUSE_BUTTON_LEFT 0x01 #define PS2_MOUSE_BUTTON_RIGHT 0x02 #define PS2_MOUSE_BUTTON_MIDDLE 0x04 #define PS2_MOUSE_BUTTON_SIDE 0x08 #define PS2_MOUSE_BUTTON_EXTRA 0x10 -typedef struct PS2State PS2State; +/* + * PS/2 buffer size. Keep 256 bytes for compatibility with + * older QEMU versions. + */ +#define PS2_BUFFER_SIZE 256 + +typedef struct { + uint8_t data[PS2_BUFFER_SIZE]; + int rptr, wptr, cwptr, count; +} PS2Queue; + +struct PS2State { + SysBusDevice parent_obj; + + PS2Queue queue; + int32_t write_cmd; + void (*update_irq)(void *, int); + void *update_arg; +}; + +#define TYPE_PS2_DEVICE "ps2-device" +OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) + +struct PS2KbdState { + PS2State parent_obj; + + int scan_enabled; + int translate; + int scancode_set; /* 1=XT, 2=AT, 3=PS/2 */ + int ledstate; + bool need_high_bit; + unsigned int modifiers; /* bitmask of MOD_* constants above */ +}; + +#define TYPE_PS2_KBD_DEVICE "ps2-kbd" +OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) + +struct PS2MouseState { + PS2State parent_obj; + + uint8_t mouse_status; + uint8_t mouse_resolution; + uint8_t mouse_sample_rate; + uint8_t mouse_wrap; + uint8_t mouse_type; /* 0 = PS2, 3 = IMPS/2, 4 = IMEX */ + uint8_t mouse_detect_state; + int mouse_dx; /* current values, needed for 'poll' mode */ + int mouse_dy; + int mouse_dz; + int mouse_dw; + uint8_t mouse_buttons; +}; + +#define TYPE_PS2_MOUSE_DEVICE "ps2-mouse" +OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) /* ps2.c */ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); From patchwork Sun Jun 26 17:44:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C20DC43334 for ; Sun, 26 Jun 2022 17:55:28 +0000 (UTC) Received: from localhost ([::1]:60226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WTn-0007mq-3j for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:55:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKp-0001aA-88 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:11 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKn-0008MK-H3 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=KWT39DuVUAjEaQ5p8Bdy+SR+9EyArFYmvEyLuvcUSaY=; b=ex/l3kd/H3HzXSP9TtBn3Pcww0 sN69/6cBxIchrjr5bEO++VHBS176SziK76PyGQOCVvqP9W/G9mZioWc1gGcMPpYtAbiTenVMs8n+c LURk7pCPFfN+tl1o8SgJ/PHga2T8xpMiaCMkZwN26cntVETIiCZCLG+vooelbOsyZt29bysJRo8+d ONf2i7kU0e54AJ2f4657N2r28GsHM6rUM9cLAeBVm5HFF80wn5ER3TRF/ePptnKHt/HTzYSUtsjQ+ xQOWDfYoyQNqQ97Jl97TsBdDpY3zIFYYc42r7vnwd7CvR+i+FrAMgmRCfU/sOM5tjEmhVDJlvFBbB d4DVGIs/gcSuvJ1OCuTObBubKFeCT2EsPcei+JZdxd7q/2gwVb39NrFiNNFFV28MnZ+bT+yQPvaTL 4bHuIaEpsCbqzX8odQZw/xJDAOWLBL2aaqBeP3GHn9+sagqUW0ZCcX+7h4PZzeoPsDibJjVINizyw Bhz+cocQPNysnILH44mc7JkXNByS7snVBbPmJai5kS/tl20xKFovsNTEfEabVJOmRVQz4ai6SdRiV QAl0KGUi6aMB7dzH1oM4dw7NAbuHxfHsrLH05oIioUreGrbu86GzY/WugIgulOaQqiVM1t4394LlB I2OE0FZsd820yeeR6UZSjoz+VO779glxceiPlF9Kk=; 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 1o5WJZ-0007KY-7h; Sun, 26 Jun 2022 18:44:57 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:42 +0100 Message-Id: <20220626174531.969187-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 06/55] ps2: improve function prototypes in ps2.c and ps2.h 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" With the latest changes it is now possible to improve some of the function prototypes in ps2.c and ps.h to use the appropriate PS2KbdState or PS2MouseState type instead of being a void opaque. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-7-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 22 +++++++++------------- include/hw/input/ps2.h | 8 ++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index f4bad9876a..3a770f3b78 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -581,12 +581,11 @@ static void ps2_reset_keyboard(PS2KbdState *s) ps2_set_ledstate(s, 0); } -void ps2_write_keyboard(void *opaque, int val) +void ps2_write_keyboard(PS2KbdState *s, int val) { - PS2KbdState *s = (PS2KbdState *)opaque; PS2State *ps2 = PS2_DEVICE(s); - trace_ps2_write_keyboard(opaque, val); + trace_ps2_write_keyboard(s, val); ps2_cqueue_reset(ps2); switch (ps2->write_cmd) { default: @@ -675,10 +674,9 @@ void ps2_write_keyboard(void *opaque, int val) * 1 = translated scancodes (used by qemu internally). */ -void ps2_keyboard_set_translation(void *opaque, int mode) +void ps2_keyboard_set_translation(PS2KbdState *s, int mode) { - PS2KbdState *s = (PS2KbdState *)opaque; - trace_ps2_keyboard_set_translation(opaque, mode); + trace_ps2_keyboard_set_translation(s, mode); s->translate = mode; } @@ -857,20 +855,18 @@ static void ps2_mouse_sync(DeviceState *dev) } } -void ps2_mouse_fake_event(void *opaque) +void ps2_mouse_fake_event(PS2MouseState *s) { - PS2MouseState *s = opaque; - trace_ps2_mouse_fake_event(opaque); + trace_ps2_mouse_fake_event(s); s->mouse_dx++; - ps2_mouse_sync(opaque); + ps2_mouse_sync(DEVICE(s)); } -void ps2_write_mouse(void *opaque, int val) +void ps2_write_mouse(PS2MouseState *s, int val) { - PS2MouseState *s = (PS2MouseState *)opaque; PS2State *ps2 = PS2_DEVICE(s); - trace_ps2_write_mouse(opaque, val); + trace_ps2_write_mouse(s, val); switch (ps2->write_cmd) { default: case -1: diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 7f2c3f6090..1a3321d77e 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -92,8 +92,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) /* ps2.c */ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); -void ps2_write_mouse(void *, int val); -void ps2_write_keyboard(void *, int val); +void ps2_write_mouse(PS2MouseState *s, int val); +void ps2_write_keyboard(PS2KbdState *s, int val); uint32_t ps2_read_data(PS2State *s); void ps2_queue_noirq(PS2State *s, int b); void ps2_raise_irq(PS2State *s); @@ -101,8 +101,8 @@ void ps2_queue(PS2State *s, int b); void ps2_queue_2(PS2State *s, int b1, int b2); void ps2_queue_3(PS2State *s, int b1, int b2, int b3); void ps2_queue_4(PS2State *s, int b1, int b2, int b3, int b4); -void ps2_keyboard_set_translation(void *opaque, int mode); -void ps2_mouse_fake_event(void *opaque); +void ps2_keyboard_set_translation(PS2KbdState *s, int mode); +void ps2_mouse_fake_event(PS2MouseState *s); int ps2_queue_empty(PS2State *s); #endif /* HW_PS2_H */ From patchwork Sun Jun 26 17:44:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64291C43334 for ; Sun, 26 Jun 2022 17:57:52 +0000 (UTC) Received: from localhost ([::1]:40588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WW7-0005Aj-Eh for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:57:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKs-0001jl-IT for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:14 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKr-0008Mn-2C for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=AbxRoqFnQwPjRro55F6eoaJuuWNbzTHPITWuPNLRkR0=; b=VQOW2/e7xxA6JS7HtepzfJ9Hur zZxD28z5e+XefaCEF3PKNLdGn8RLQrKckWalYRXv5/Vf5eUczhDgtasnwThmKhm8LrO58wlTqL1Ku L/ZonARDDDdH4bg+z8H/V5FrgGbUGFLUaVHIOnlQMW2auURbjfE9eJk95MVZZKlj13h8WYprObFQV mHCYPGpYA+QRjA0JndCt4Qc+zhPyjC9MqIc+85/+1H/mGuhVouF9I2aSgmuuP5l3h5Xcg06CpeOFu 1TGiO+Y4uWKde26S7X02MlQnoR32CWOuWrMzVVcSIYgBFcEFphSLBItdy6dHXHdylZdKBMNXfG9I7 QtsKPMowiIzBg3CFvsDsMTiWxrrhF+n3TSYolP7LUAc4UA9AFdLaJWUX8RpNoXaHJBVdplcm7PEud clbf6jzSXe2PYtlgPqK6BOYL2KiA3u5cNXgXmUXPxVEixsO8lwu8ORx+aUVpcKcaarOW5dqPFBCch 395GoskufA63/JsJsOROGAr35U9eTeTFV94aNzcY1f3OCiF3IWgZklaaGdyj2oP7rihQskut9oS7c ZZPoIY4/pdZD1UngOdU6YxNfZJp1jS/WjoiBRO9c9xISljUgS18DW8Lse1buRXSQs1G6fcMkUBa/W A3arGzXbhlmTEM0DHjgzVaI37y/QOFdkrLi+eA7mQ=; 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 1o5WJd-0007KY-Fn; Sun, 26 Jun 2022 18:45:00 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:43 +0100 Message-Id: <20220626174531.969187-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 07/55] ps2: introduce PS2DeviceClass 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This is in preparation for allowing the new PS2_KBD_DEVICE and PS2_MOUSE_DEVICE QOM types to reference the parent PS2_DEVICE device reset() function. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-8-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 1 + include/hw/input/ps2.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 3a770f3b78..fd5236690a 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1283,6 +1283,7 @@ static const TypeInfo ps2_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(PS2State), .class_init = ps2_class_init, + .class_size = sizeof(PS2DeviceClass), .abstract = true }; diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 1a3321d77e..aef892b5e6 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -33,6 +33,10 @@ #define PS2_MOUSE_BUTTON_SIDE 0x08 #define PS2_MOUSE_BUTTON_EXTRA 0x10 +struct PS2DeviceClass { + SysBusDeviceClass parent_class; +}; + /* * PS/2 buffer size. Keep 256 bytes for compatibility with * older QEMU versions. @@ -54,7 +58,7 @@ struct PS2State { }; #define TYPE_PS2_DEVICE "ps2-device" -OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) +OBJECT_DECLARE_TYPE(PS2State, PS2DeviceClass, PS2_DEVICE) struct PS2KbdState { PS2State parent_obj; From patchwork Sun Jun 26 17:44:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F90AC433EF for ; Sun, 26 Jun 2022 17:49:48 +0000 (UTC) Received: from localhost ([::1]:43544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WOJ-0004z0-Kg for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:49:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKw-0001tD-FU for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:18 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKu-0008N3-S3 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=j3hPQGMgIu2J/Lk8J9CEciXvxP6KCVU6d0OyszPOF00=; b=0I04zuUGQ5M46SdxD33eyF6IHu 2ROUXW8djjBlhfDtFoLsbeqy68S7AwldmQTH4ubK2Y+ohz1nfHa7/ShBOMUuyqKLQQEhZrdNvIapY Eptyi6wylbPtzoww+XJmE2dxx0Pl9wyz5rr2vfcpSsqUyXcJ11GKO3JWlhMj9QBTAbxn42qYqZnJI j3RJqmTxjuBsI+FCKtECQDzUGsYzUzqv/7hnvBoXOCJepTNSOXOxwEZ9f2hk1uuUSS52/qadFbgcA PpMYCoxPjWLInFnfBpP0CIZ5x9vUQpWxu49F9qJv9/p8IRh03zvY0HjmNEvUZcHOQ3LgdGkOYlA/W +aM/io0pbxhFOVEQoP0ra9DPVGe4uOqYBxeI3vHaf9nyu1ff2Qcpep+ED2D4F/nWjuSnuRYiX2xUh d/MbGqGAj7M8MolsICVZ/9RQN7DJjhGqzAqMhs0Tf6SLQkbrmSu6HURflnk6jRIvhss70kbhjoBMt HkCFwKZtvTCJnfWKfYfCso6eXU3Zi4xVmA1MCfzbxVoiNuQdZ5w5VsP5VWTQNegldg+UYRT1F8uf5 bXPo9akZL3q0bQRalnNVzhPokKwunyBz7B2LDzA+xRNx/3D2v7AraBGIlzBES2G6TQuTJLlkVnjVj 1cy5gMF2PKsUWu9m6wsjZlvD/Zo7rRJrqbvNYxYXQ=; 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 1o5WJh-0007KY-0h; Sun, 26 Jun 2022 18:45:04 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:44 +0100 Message-Id: <20220626174531.969187-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 08/55] ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The functionality of ps2_common_reset() can be moved into a new ps2_reset() function for the PS2_DEVICE QOM type. Update PS2DeviceClass to hold a reference to the parent reset function and update the PS2_KBD_DEVICE and PS2_MOUSE_DEVICE types to use device_class_set_parent_reset() accordingly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-9-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 48 ++++++++++++++++++++++++++++++------------ include/hw/input/ps2.h | 2 ++ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index fd5236690a..f6f5514f0b 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -995,8 +995,10 @@ void ps2_write_mouse(PS2MouseState *s, int val) } } -static void ps2_common_reset(PS2State *s) +static void ps2_reset(DeviceState *dev) { + PS2State *s = PS2_DEVICE(dev); + s->write_cmd = -1; ps2_reset_queue(s); s->update_irq(s->update_arg, 0); @@ -1028,26 +1030,28 @@ static void ps2_common_post_load(PS2State *s) q->cwptr = ccount ? (q->rptr + ccount) & (PS2_BUFFER_SIZE - 1) : -1; } -static void ps2_kbd_reset(void *opaque) +static void ps2_kbd_reset(DeviceState *dev) { - PS2KbdState *s = (PS2KbdState *) opaque; - PS2State *ps2 = PS2_DEVICE(s); + PS2DeviceClass *ps2dc = PS2_DEVICE_GET_CLASS(dev); + PS2KbdState *s = PS2_KBD_DEVICE(dev); + + trace_ps2_kbd_reset(s); + ps2dc->parent_reset(dev); - trace_ps2_kbd_reset(opaque); - ps2_common_reset(ps2); s->scan_enabled = 1; s->translate = 0; s->scancode_set = 2; s->modifiers = 0; } -static void ps2_mouse_reset(void *opaque) +static void ps2_mouse_reset(DeviceState *dev) { - PS2MouseState *s = (PS2MouseState *) opaque; - PS2State *ps2 = PS2_DEVICE(s); + PS2DeviceClass *ps2dc = PS2_DEVICE_GET_CLASS(dev); + PS2MouseState *s = PS2_MOUSE_DEVICE(dev); + + trace_ps2_mouse_reset(s); + ps2dc->parent_reset(dev); - trace_ps2_mouse_reset(opaque); - ps2_common_reset(ps2); s->mouse_status = 0; s->mouse_resolution = 0; s->mouse_sample_rate = 0; @@ -1227,7 +1231,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); qemu_input_handler_register((DeviceState *)s, &ps2_keyboard_handler); - qemu_register_reset(ps2_kbd_reset, s); return s; } @@ -1255,26 +1258,45 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); qemu_input_handler_register((DeviceState *)s, &ps2_mouse_handler); - qemu_register_reset(ps2_mouse_reset, s); return s; } +static void ps2_kbd_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + + device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); +} + static const TypeInfo ps2_kbd_info = { .name = TYPE_PS2_KBD_DEVICE, .parent = TYPE_PS2_DEVICE, .instance_size = sizeof(PS2KbdState), + .class_init = ps2_kbd_class_init }; +static void ps2_mouse_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + + device_class_set_parent_reset(dc, ps2_mouse_reset, + &ps2dc->parent_reset); +} + static const TypeInfo ps2_mouse_info = { .name = TYPE_PS2_MOUSE_DEVICE, .parent = TYPE_PS2_DEVICE, .instance_size = sizeof(PS2MouseState), + .class_init = ps2_mouse_class_init }; static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->reset = ps2_reset; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index aef892b5e6..4be27de316 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -35,6 +35,8 @@ struct PS2DeviceClass { SysBusDeviceClass parent_class; + + DeviceReset parent_reset; }; /* From patchwork Sun Jun 26 17:44:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895822 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42599CCA47C for ; Sun, 26 Jun 2022 17:52:17 +0000 (UTC) Received: from localhost ([::1]:51520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WQi-0001z0-5O for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:52:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WL0-00026h-NL for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:22 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45030) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WKz-0008OO-6B for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=h14xVD2zdDwX5hDRQSprtOSSHnihkpQ6P1q3W39zMw8=; b=jyKvp36ehNK1VLKX/nZNgLRah5 M1SuwfWoNyBdBlRiVQ6hBhu/2PkgI1CfK3w8xx4ZZ2oVmynfzI/muNGSr1E1wJ0cxKdmCeWL19vrh 6K2+GYQ0GfIaAfmW8HUM7AmXOeR4z0i+13IcOf1QNW8+/8MtXCKGaxuWCyZ4/IebCTEQp/gyzq8gb fQ119sH7os3Wq9W7cOGgwDZK568MRT7k47vn06KZtyTO1bHtSD1YkqB/hH2IBWDYrAjdqW4ixrRXP KkHi4V/Nii9pcpDhZG62KPjPTiDDBRIP3wI+g2INqEhBsrTirv20TDK+V4f0leXElCCLbYUGNsZq3 Q45YJ2NV8mFAVoM9BHhGMVZI7TtTrgmo5VXMRofBed/NpepygqsYEETehuKAGmghn5Uj4kHKespeJ N6t9WGmtWqdzvs7M9DIhdKZvBtc3EoWIkhW22Izm28Eyh6QvjV1Of1oT6V/HMot1XXsbpHc+eXgRe ceeDCD93pRIr33KdxelbT+6EZek3Of1hMRg3EzuDKamjhtSazs2pQyXExlvXlNhdwQIZ/serzTkWq kIJj7MD5+brBkS3GYt8SAdFsZ66RLqHgXNkT6WI8gQTLPvju4TjC89FaLneSWwgLlx9ln4PPSRX3N 2HcOZgieRY4w+Hw4xiXNzcuLSvxwyl5Otw1muzkHE=; 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 1o5WJk-0007KY-VQ; Sun, 26 Jun 2022 18:45:09 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:45 +0100 Message-Id: <20220626174531.969187-10-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 09/55] ps2: remove duplicate setting of scancode_set in ps2_kbd_init() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The default value for scancode_set is already set in ps2_kbd_reset() so there is no need to duplicate this in ps2_kbd_init(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-10-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index f6f5514f0b..8018e39b17 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1227,7 +1227,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) trace_ps2_kbd_init(s); ps2->update_irq = update_irq; ps2->update_arg = update_arg; - s->scancode_set = 2; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); qemu_input_handler_register((DeviceState *)s, &ps2_keyboard_handler); From patchwork Sun Jun 26 17:44:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B05A4C433EF for ; Sun, 26 Jun 2022 17:52:31 +0000 (UTC) Received: from localhost ([::1]:52390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WQw-0002Y5-PV for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:52:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WL4-0002Cq-3n for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:26 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WL2-0008Oc-KE for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=G6JS/joUS82h2wujkBp2Ea2A9lzUQf916n/VgoQVylc=; b=03P9KdE9kfmWVlkyWd7x896R2U dJZI82E4ks2syOd434CvvJS9yX+44YEAnmu73scTxww+cLdOlqZSFuQh8Cg0LBJ2XrM/tXgZtJB2H ZRJziJgmzasbXnkGB1e49nRCNubhvI/Bh6KX+iWGYP5u26gRPJ6O37Vd0Y1rXY6RumQJkOCY20kb6 27wBqVTWsDt7/zQ7tMyjEwZWX/SjkEQGc4z9XeMQJj8mMoGaRQz1dBJxqWys83u1Zn5FcDExXhHxU ++KfHWXnlusTjnAHGybzRiskwHXaYiw4dvURGcb8A7TNxwc5/TK9YsI39jCb+WEr+VEWpZLuAr7dD PMHbBjo5fzRhxzvxOuL1O7L0EYTM1Hnoi+YLS/sTkn4I57WXP7XmyOctG8S6VeLBdPxH9gPMIGE7K zx4Co1O1QMgJmLoqYYk5sbQglrEHb/L/1eHa7zF9yCVzgpL5dxt0GrUUJuRV3BjNPDUouJgpZpGUR SPcLO1jIjaJaD4RUmioDCth9hc6KvZJONRESX4nGGkH6IE7Qr/WY1jItK42d9ih+ctw6crvia6Efl 1FA5QD1uD9B9eDT7eKk4snTcOQwqC/mDpEjwPlO6XvHAbB/Y+gce7aYYwJES/B0JjtA5SPacLFSqg /7FWAPcFs1OsG0BPkZvAkkema6zGYFHdxKajMDwLM=; 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 1o5WJp-0007KY-65; Sun, 26 Jun 2022 18:45:12 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:46 +0100 Message-Id: <20220626174531.969187-11-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 10/55] ps2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move the registration of ps2_keyboard_handler from ps2_kbd_init() to a new ps2_kbd_realize() function. Since the abstract PS2_DEVICE parent class doesn't have a realize() function then it is not necessary to store the reference to it in PS2DeviceClass and use device_class_set_parent_realize(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-11-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 8018e39b17..62ea4c228b 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1213,6 +1213,11 @@ static QemuInputHandler ps2_keyboard_handler = { .event = ps2_keyboard_event, }; +static void ps2_kbd_realize(DeviceState *dev, Error **errp) +{ + qemu_input_handler_register(dev, &ps2_keyboard_handler); +} + void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) { DeviceState *dev; @@ -1228,8 +1233,7 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) ps2->update_irq = update_irq; ps2->update_arg = update_arg; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); - qemu_input_handler_register((DeviceState *)s, - &ps2_keyboard_handler); + return s; } @@ -1265,6 +1269,7 @@ static void ps2_kbd_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + dc->realize = ps2_kbd_realize; device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); } From patchwork Sun Jun 26 17:44:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43952C43334 for ; Sun, 26 Jun 2022 18:02:06 +0000 (UTC) Received: from localhost ([::1]:49368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WaD-00031s-C2 for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:02:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WL4-0002Fa-Rl for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:26 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45042) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WL3-0008Og-3a for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=jyi1v2lTle/IO80e+1WvatRNcZQ5Q2R+F8PeLDBy21k=; b=s+Is3joWGbvUd2TSrUJTW427pR 8gQajR+SCd9QDR+kKIx20vaaHKS4JzCfKwzQu1HqHRVWjxHgq6H/bXKg3N748EjNrsKyyanb0cBUG 3Z37PO1j5ndHWBsYcGQIyUh++qWaTgSiJtJLiTf1qwVQuSxX6oV3TUjQDg4m1dOLFyvpZue1+VjRG hAy2lVorkfWkrPQNITKVrVvYtg6gDuXnKDIUz7js9rxNPOLZlmVJOumElUUCaYZD4iMO36tKQdgj7 lK5Fi9gldUcNU9dhD4M+fh1aX9uCiFkhSWxUCK6enRl8V4Cg12EIuVgFCeUaUdA4xMHy1a1jEh3aS uh3MzP4ypOEg1qF8wi1ffx3bzyUA4uv2jqIiR/AhKCfFdYCIFOR+Oc+KGGo/apBwOCzUCmY6oiufU 5aodwKjWzPBellDRQ8UFO4rR5skC3peezWGDCV1ujkOlyAERqq38qc7NmsI/fRiustMtHn8EoZXJ0 YQvbCBLyb4tnjm0oc2g6NgbP7i3bRSlvxEtJVPa2NWG73gqLYFC5QehfnKn60z/H/Mg5PQpeFkaAv wwBV9EWsTeTQ0fFerptbp9i0nmOWOoUEUZKZybPeTh7B5lHanXysNlfEbUXNbEHBIBRe4Mimli471 5V0gjLcgps6LExEX7835MMAGeVEJaxgXW+Na7wC4s=; 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 1o5WJs-0007KY-O8; Sun, 26 Jun 2022 18:45:13 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:47 +0100 Message-Id: <20220626174531.969187-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 11/55] ps2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move the registration of ps2_mouse_handler from ps2_mouse_init() to a new ps2_mouse_realize() function. Since the abstract PS2_DEVICE parent class doesn't have a realize() function then it is not necessary to store the reference to it in PS2DeviceClass and use device_class_set_parent_realize(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-12-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 62ea4c228b..eae7df2096 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1244,6 +1244,11 @@ static QemuInputHandler ps2_mouse_handler = { .sync = ps2_mouse_sync, }; +static void ps2_mouse_realize(DeviceState *dev, Error **errp) +{ + qemu_input_handler_register(dev, &ps2_mouse_handler); +} + void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) { DeviceState *dev; @@ -1259,8 +1264,6 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) ps2->update_irq = update_irq; ps2->update_arg = update_arg; vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); - qemu_input_handler_register((DeviceState *)s, - &ps2_mouse_handler); return s; } @@ -1285,6 +1288,7 @@ static void ps2_mouse_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + dc->realize = ps2_mouse_realize; device_class_set_parent_reset(dc, ps2_mouse_reset, &ps2dc->parent_reset); } From patchwork Sun Jun 26 17:44:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A0DBCCA47C for ; Sun, 26 Jun 2022 17:57:53 +0000 (UTC) Received: from localhost ([::1]:40446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WW8-00055V-A4 for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:57:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WL8-0002SK-Jy for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:35 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WL7-0008PT-1p for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=v3BeuKvN1HFFVFyhxPG45d5c0zcz/a+eu42PlpVEBdw=; b=jXecmCYOf/jDrdPnCBbDxFQvYZ JNbiGsfTbXYfVDlCaj7YAVryvpmNGE3RJ+dP9F+MkV2XTwAGhKlp/U9z1cOG6/w1fIg/0p89YIPcO WU43jrjMOazrhvlfsLjf3GQqNxDUdy8dXlote3PW5aFHlFK9Ov6gsHcHmRWKmAkshnbYDPOtyHETL cEoIcA/Kk2468GfwpDJkfRHuuVFytbuj1JgnZ5eUaM9Vml/FN6H/o58WsXHsxT8LVjlla6jO+TtrZ OMNhVd9lkqQ70+TmLR0rXDU+KKoiiGLQrMzKnNl3FzKu+E4o9kNvOeR+1aHFVQK5OOI6uLcjPdmzC PneupnsbdmwRONrVDsKPRiL768/iPQLWNuGYCchgGpJarLiSwSfBQTKDYzMCXeJjt3i2cDqtO7a+I 7+wr6qcZxJQEyJSRRRXE/64AkOSSO8y7ZIsJiZJbu6LsS5l9UieNnhxw1FudIfk5Q2vVAf+rIVYcd CmVIKlcbLrcomz/XcbIyln7H2M5uhREog792EVorAqQrs3GkUvhsFtmLOM/FPB/R6mRdz0e1gVaOn eZvgWuRjrrCX03Yc77f71e2VSLvzmsk/7VZ6d6jOwfAdesxcpy0KrkqqaiLPBLzxoY8EKHftuyoIC 9fQFcXcvLajhF55sJeF8XhvdemRv4REbqofEgIGB4=; 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 1o5WJt-0007KY-5o; Sun, 26 Jun 2022 18:45:16 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:48 +0100 Message-Id: <20220626174531.969187-13-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 12/55] ps2: don't use vmstate_register() in ps2_kbd_init() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Since PS2_KBD_DEVICE is a qdev device then vmstate_ps2_keyboard can be registered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2 parameters to vmstate_register() are NULL and 0 respectively. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-13-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index eae7df2096..97e9172ba5 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1232,7 +1232,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) trace_ps2_kbd_init(s); ps2->update_irq = update_irq; ps2->update_arg = update_arg; - vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); return s; } @@ -1274,6 +1273,7 @@ static void ps2_kbd_class_init(ObjectClass *klass, void *data) dc->realize = ps2_kbd_realize; device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); + dc->vmsd = &vmstate_ps2_keyboard; } static const TypeInfo ps2_kbd_info = { From patchwork Sun Jun 26 17:44:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE4B5C433EF for ; Sun, 26 Jun 2022 18:06:19 +0000 (UTC) Received: from localhost ([::1]:58188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WeI-0000eJ-TK for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:06:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLC-0002TZ-9T for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:35 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLA-0008Pg-Ts for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=cTTrpQLj1bbuK16iDEk6hUYWZTXUmrGhT9l4JDVXaxA=; b=UrcjsXRS2BTQrd9qhUiHrmjMC3 b7CALBpCQwHPTEt21FSuyXh86tNY9IjZ2sg9mNPAotcDbUa6oY41yWFNMS9QVM7I5TKpvBG3/a7iv 7k4gWR258azuZRr79/pfpnmz6VVXFlo0WeokR5MQTMjS1WaWmmEgGa4yYyP84zeJ92cbr0TuYjGaL Rs1gqLbJhbCN7+SiOcO4h1N4ecN63+042q9IEmZuSDFHYQXBAe2w7sNshWwHO64F3xPDPuWPZUcTu 71J/1g+5iISO5YxanrcaYjws7jf72Co+jsQI5Bb/tOtUROaT1qZJeEe9qXSh7wI30jbE8+ZrFpDY3 Q9gMS9TtfamCJ5J6ltltabaoZ3xVQ1T8B+2cPrSL5BQCo2/6AP/gbsEKxho98EPD92D/vXWPOlLtw s5RTQ2+7EBo6PzP5N2Nvgy4GVZIxKef1tycvMf4tY2qOXu2Dur3MkKrk9w/DH7ng+7IExWLtEiph8 pyIs+SkJF+Fu3S56SrVrZ+kXBZ/uvQpERrAxC41eoyVZFskr9fjBCFne7uFMvNZlXwqG22+jeJ0bg F7lEPDEcnaJNFthFn7Rmrtvii6V3kwPJ7RR2NgK06XznHUYbY4c6KLYn90MxH1KQFIdzjDUsF+1nz Y7NHSpWF4nc9oP0W0aWLUrtHcP/MkJ3IFF20I1l7c=; 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 1o5WJx-0007KY-0j; Sun, 26 Jun 2022 18:45:20 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:49 +0100 Message-Id: <20220626174531.969187-14-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 13/55] ps2: don't use vmstate_register() in ps2_mouse_init() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Since PS2_MOUSE_DEVICE is a qdev device then vmstate_ps2_mouse can be registered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2 parameters to vmstate_register() are NULL and 0 respectively. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-14-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 97e9172ba5..9c046ac500 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1262,7 +1262,6 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) trace_ps2_mouse_init(s); ps2->update_irq = update_irq; ps2->update_arg = update_arg; - vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); return s; } @@ -1291,6 +1290,7 @@ static void ps2_mouse_class_init(ObjectClass *klass, void *data) dc->realize = ps2_mouse_realize; device_class_set_parent_reset(dc, ps2_mouse_reset, &ps2dc->parent_reset); + dc->vmsd = &vmstate_ps2_mouse; } static const TypeInfo ps2_mouse_info = { From patchwork Sun Jun 26 17:44:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CEACC433EF for ; Sun, 26 Jun 2022 17:55:41 +0000 (UTC) Received: from localhost ([::1]:33020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WU0-0008Th-7S for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:55:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLG-0002fJ-D4 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:38 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLE-0008Pu-Qd for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=nTv/GntpdFOeKbpIoIbnma4io06TzyCNKdAwqPdh5t4=; b=yULPkJxmrM/IQRBsKhHWN+j9YI 73Id0JyyBBCNAdsZmeZp8Dnn8KDgUDpPyPWJg8GRL7Dh8x+FTHIWo6KjeMofkbE4gWDUbY7NZyOjR KuHclUgnEazYTrahj47S5f0bazFMfigXusX8sE3XVdLeEXbZXnnYQWyAawNKIacSwLtqx80jSJIG2 VR+ikSwWf6w08u+8V7Yg2XOBoBO5+6h4M8qngKy9jleHBiahKAsk+n7XKk+TRDAxLFAHhOEH5Eh+p w7uZGbCunTBLWdj9MFu3Epk22yrzu/tp5TZTlKh+yvY4z9w+gL/9wz8F60ZdHYHuuF7QB83Ua2tCz QcOa4srY5QBGsCFEgwv7IaRw4WeB61e32AG0zz3/6fh3xdCBWJgc+oX0HB3qo2EcCjgBj2KjyMO7P rr/s+zwo8DFnBo1F9T0xOmsNeRFgf4L5CfpM8xoD1bd+EF28L5Zu9Hmx8wz2TGqE+5alJw4LCgsj+ WlO+o4BvAKh4UI2vGo59u6RXtCb5vrp5xaedOrUy48gv/6D1sBMeVzWgH+RnT09Ybt4byjP1H08ig mB/31Ghnzi62bugALHLp8Tk8aIjzrthFmIh1gJCjCehVgawJaWyQVBzQqa65PVUzJB2opy5Ih55Kv jUOaBqU5AzQhRG7DKEwbwowfwwtZOVcQ6WftTi/HE=; 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 1o5WK0-0007KY-Ib; Sun, 26 Jun 2022 18:45:24 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:50 +0100 Message-Id: <20220626174531.969187-15-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 14/55] pl050: checkpatch fixes 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patch also includes a couple of minor spacing updates. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-15-mark.cave-ayland@ilande.co.uk> --- hw/input/pl050.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index d279b6c148..889a0674d3 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -53,8 +53,9 @@ static const VMStateDescription vmstate_pl050 = { #define PL050_KMIC (1 << 1) #define PL050_KMID (1 << 0) -static const unsigned char pl050_id[] = -{ 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; +static const unsigned char pl050_id[] = { + 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 +}; static void pl050_update(void *opaque, int level) { @@ -71,8 +72,10 @@ static uint64_t pl050_read(void *opaque, hwaddr offset, unsigned size) { PL050State *s = (PL050State *)opaque; - if (offset >= 0xfe0 && offset < 0x1000) + + if (offset >= 0xfe0 && offset < 0x1000) { return pl050_id[(offset - 0xfe0) >> 2]; + } switch (offset >> 2) { case 0: /* KMICR */ @@ -88,16 +91,19 @@ static uint64_t pl050_read(void *opaque, hwaddr offset, val = (val ^ (val >> 1)) & 1; stat = PL050_TXEMPTY; - if (val) + if (val) { stat |= PL050_RXPARITY; - if (s->pending) + } + if (s->pending) { stat |= PL050_RXFULL; + } return stat; } case 2: /* KMIDATA */ - if (s->pending) + if (s->pending) { s->last = ps2_read_data(s->dev); + } return s->last; case 3: /* KMICLKDIV */ return s->clk; @@ -114,6 +120,7 @@ static void pl050_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { PL050State *s = (PL050State *)opaque; + switch (offset >> 2) { case 0: /* KMICR */ s->cr = value; From patchwork Sun Jun 26 17:44:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0109C43334 for ; Sun, 26 Jun 2022 17:58:04 +0000 (UTC) Received: from localhost ([::1]:41584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WWJ-0005w7-Uf for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:58:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLQ-00035I-Uw for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:48 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45068) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLP-0008Pw-5D for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=mTBDnjeMfjleuZ6uNlkYwnj6Dy8vKD4kLgQGW6RsGVA=; b=Mt/hTzQjmHGSHydDUTNYtEREcW LLy+dqyL6qh51jHoIQPxYq4x43rybEMrPysA2bHxeODXXHMn2owOp4iiUGRSc1K/6KCXWKHx5qlPt DHpNO0KHfddYkZr2ZUgNKfQg6W9TqWzGwH8tY3VG5PfHvYWBNcPaTT/vQ+B3xeqg9DOAHvW5h8qDt 3/hinlV4i+ULr1J3Nu+LRh91y46Ujg8vhE1meHUrROO2KG8CWQLxEjMJZGwWiYNQLFeGzRo4MyQCY bMBHA2rgx8K3Pw1xOx8AsenT4RYF0fALcgf85GqMwz7mE1U+y1Hl8udW6PFKtJkfubDvoQfYoDTYJ 7Rsxn01m6KVygIhOYl9hMmPum34+5mNru/rV+MyajhfUcFV3cIEcYnWn+g0Q4JuD2n/uAa3Fpj3sR FxAwOv8KWi7MBpeSMI8A8KBi1o4PzS/xODofiWWSUmZQOTk+iEu2rcPI1aIWougPPlj6E1d6rgGRF i0eJbsgOqzPaGXLeOqWV5IP932Zu7mKUPcbRBKgPsoLnzXtWDDzQy4xAU1MrsudMHOHa1EaJ16bmj aDVFNop3jlGrbZ5OFlmx3i0/2q7HsiGHTXvVFZCUKeIb+sFAozO46EiS5dsu4i5K660fzDGSEM137 e5sb5aiT6BMziZ7fJFGR93S4cP2M/ZGLf/p/E8CRE=; 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 1o5WK4-0007KY-PE; Sun, 26 Jun 2022 18:45:25 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:51 +0100 Message-Id: <20220626174531.969187-16-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 15/55] pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This will soon allow pl050_set_irq() to be used as a GPIO input function. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-16-mark.cave-ayland@ilande.co.uk> --- hw/input/pl050.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 889a0674d3..66f8c20d9f 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -57,15 +57,20 @@ static const unsigned char pl050_id[] = { 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; -static void pl050_update(void *opaque, int level) +static void pl050_update_irq(PL050State *s) +{ + int level = (s->pending && (s->cr & 0x10) != 0) + || (s->cr & 0x08) != 0; + + qemu_set_irq(s->irq, level); +} + +static void pl050_set_irq(void *opaque, int level) { PL050State *s = (PL050State *)opaque; - int raise; s->pending = level; - raise = (s->pending && (s->cr & 0x10) != 0) - || (s->cr & 0x08) != 0; - qemu_set_irq(s->irq, raise); + pl050_update_irq(s); } static uint64_t pl050_read(void *opaque, hwaddr offset, @@ -124,7 +129,7 @@ static void pl050_write(void *opaque, hwaddr offset, switch (offset >> 2) { case 0: /* KMICR */ s->cr = value; - pl050_update(s, s->pending); + pl050_update_irq(s); /* ??? Need to implement the enable/disable bit. */ break; case 2: /* KMIDATA */ @@ -159,9 +164,9 @@ static void pl050_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev = ps2_mouse_init(pl050_update, s); + s->dev = ps2_mouse_init(pl050_set_irq, s); } else { - s->dev = ps2_kbd_init(pl050_update, s); + s->dev = ps2_kbd_init(pl050_set_irq, s); } } From patchwork Sun Jun 26 17:44:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F7AEC433EF for ; Sun, 26 Jun 2022 18:02:25 +0000 (UTC) Received: from localhost ([::1]:50466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WaV-0003ke-Uu for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:02:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLU-0003Cl-W7 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:54 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLT-0008QV-4d for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=nVbIrGc4vOmodznrkPB09EvKicunfquxzhLWhRzQEw4=; b=Cl0a1PdutQh8ieUrmY2MSBGfks GsJAy+GQ4plGqdDLvASn8pLOQlEVYxVal9/DqC6bIv6JxRVQTM4TVRJtmcRs3GAOZahc7zdLxN2AO yf30hPJfC1SJ8ENqAH+Twv9yD3+JRsOPUDZ7gRpGzWiz21vUn63hus5pGH0lPVKn1h+m8H+H25vCo eOGkBV+43EzIUjMTR8rLXSrPcUQeV96wvsyo1DzD2OodqywqbSdR+IQR7H4uuHQ0wyZdJ/uWeJjfw Nj+WyKhfmw/UglJxep7NIbBey1O/BHaAPw0nCJ2r9/ZBpiS/0GoEpwVu3hT5px/um/Y9TPJY82Ln5 clfVPzqNwq6jyrS09kPdVdZg115AOy0d2TAtLYmre10B0S8s8s5kt4x6H7+aBbTF3LUlf3sE1x8sX OUOiu0JNmK0sQtzdJ2Z+zopmn31mlzkdHW7vL6RiO3iLiOxUICx0tDYPBW4Iie3soQw0BShd7rHkV mednYWLsEGLuirDgLXmepJaKSrdVigWseWbaYfW3pXSYLgpp6eQfkMMfBZrO2+FjROc5ikT1Go5cA 2HJSzVB985T6j4xTNjwZhuNnokNmwhr6Yk9c0qz1XRlqIuf7S1/ezNf+o7IAyZBvdonkTBmAC5+YG LO87MtKNKRF5Ca7Irn82bfUAQQzrgFCQLEOLSNzco=; 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 1o5WK5-0007KY-5e; Sun, 26 Jun 2022 18:45:28 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:52 +0100 Message-Id: <20220626174531.969187-17-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 16/55] lasips2: spacing fixes 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This helps improve the readability of lasips2.c. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-17-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 94f18be4cd..2ac3433014 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -205,7 +205,6 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size) break; case REG_PS2_STATUS: - ret = LASIPS2_STATUS_DATSHD | LASIPS2_STATUS_CLKSHD; if (port->control & LASIPS2_CONTROL_DIAG) { @@ -238,9 +237,9 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size) __func__, addr); break; } + trace_lasips2_reg_read(size, port->id, addr, lasips2_read_reg_name(addr), ret); - return ret; } @@ -257,6 +256,7 @@ static const MemoryRegionOps lasips2_reg_ops = { static void ps2dev_update_irq(void *opaque, int level) { LASIPS2Port *port = opaque; + port->irq = level; lasips2_update_irq(port->parent); } From patchwork Sun Jun 26 17:44:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B604C43334 for ; Sun, 26 Jun 2022 18:06:35 +0000 (UTC) Received: from localhost ([::1]:59222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WeY-0001KQ-JK for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:06:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLY-0003ER-O9 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:56 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLX-0008QZ-6P for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:46:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=T0/8kru0KvAIppaEYfijXCOmacMiTEBKpJSz+cHMFJg=; b=Ugl0XrLiXSfyagBmFBdLgh6zs6 ZEl/41z/7LpOfrE3jsSZ5VUPSKRySQBR8k9jC6iNkVZm4Ope/YjtfhjSioYg0VOB95ZTJ73qvPPZ7 rs2GMhmQmTnpD7G4ZYdvYnokewowjT2UWB94s4+c1KExiVZgrlM71wSeTgubBeNYtc8r1EfoaVdX+ M3lO28QnLYC6Qkc/863PzYdm2PuAhHWo6rYoP1lLmNEwu0mhyJeINy50Zc7w1WBMn5QAD3fE/XHyH js0ut6ZUXCx0wJ24HgYGq/UgsX6QHJhO30OmX/e2yT5C6julRi1ODVE7Q6rncLBVV4DDG7UDORDDD xW0FJnIXnU1HU/vYKzpu/l32n2A9z/w30qaG/TCOy0ZzCiZZxRRKLsM19bYEKY150y2ChoGK3Ee6E zkmr5yQZdaLRbG1YiRjbYLx276SYxqVNpySR097U6wEXSpWS3xdU3Ywt7dnYnaFhJ6BKDYk8NFRrz 1Q9luCMH+4ChAefs7YederFODpg0J1D2R563x/VDZI/pwz1DjOMP80wEOhYgYjGLk/q+Ig3uyA5e/ YTdNLT6Zh9/WXAI6ZukLuOf9e5fnZ539q3w24Qswbx7LmY2e8GagmPMHwh6mOUe/FGh0CWaUSe0hO HZnzskKxf3072vhFqHH/9/LYudUjIXLmvWjmlrzpU=; 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 1o5WK9-0007KY-24; Sun, 26 Jun 2022 18:45:33 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:53 +0100 Message-Id: <20220626174531.969187-18-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 17/55] lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This better reflects that the IRQ input opaque is a LASIPS2Port structure and not a PS2_DEVICE. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-18-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 2ac3433014..adfde1684f 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -253,7 +253,7 @@ static const MemoryRegionOps lasips2_reg_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static void ps2dev_update_irq(void *opaque, int level) +static void lasips2_port_set_irq(void *opaque, int level) { LASIPS2Port *port = opaque; @@ -275,8 +275,8 @@ void lasips2_init(MemoryRegion *address_space, vmstate_register(NULL, base, &vmstate_lasips2, s); - s->kbd.dev = ps2_kbd_init(ps2dev_update_irq, &s->kbd); - s->mouse.dev = ps2_mouse_init(ps2dev_update_irq, &s->mouse); + s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); + s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd, "lasips2-kbd", 0x100); From patchwork Sun Jun 26 17:44:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2961FC43334 for ; Sun, 26 Jun 2022 18:08:49 +0000 (UTC) Received: from localhost ([::1]:38672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wgi-0006XO-2a for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:08:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLr-0003M1-4y for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:16 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLb-0008Qi-Gh for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=LPLjbTZ4t8ScxcNN0tsE0402KyBbOogD6jvBu+aV//s=; b=cldwHFvatgvBymTaTa3PGE9nd8 ZIT4kDgulGsM1nVpIpj8BlNdFN4aweFYSxUtisK6eSwxxPWXug0BuXGLKbf10kWFFlvTKetfkK7F3 qhCONP2+yUPYoqjagIcyxOw/98GKD7DUHcPKmR/69Qgzc45PX2+Zn0AKj35brrAGbLKVWs9AP9LJD SqFpr9+DZhQaJGcYTOF0fChCwAGLd1rhsvd9RWE033AadmBsVDYua/zTJJmcQBDqDBg2wIqCq6cYT A1aQD3YAa8DN5YsZ3LB0PjSWN0g6zz8Tmf71jXeJuu6DfVZedr/6fw6ZPXqzfKWA0DZTD7duRiAlL th1y9FtgvyooxsKu93fi0tOHLUyatAooclezIRgOkXkGerAE4eMxqgO4T8GYOJYkmfVEcjolxfjXa 5OxZ1JuRKH6XvgEKAez0bT51IDtscwXkxudLDn2OG+BDIQlUJrEPBx58xOz6NoiGmSe9eXo5vp+jx btT9q4lia50QDseCvs4IZYXtVI68jpww5hdULNKbxXhVRYJAfJFXuJue/ie2XQvvQQDmi7WlwbsCX 1gZQ+rYOprCOeYiOlT7L5vg68RTpbVxAhyEpWwbH44+7qGBzQ6qSX5zq6SqKUSiV/GSxoBgntkpXV kVs6aVjY/q7h8SghDVIv7EBERYojAzM+x7PogBGCs=; 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 1o5WKD-0007KY-AR; Sun, 26 Jun 2022 18:45:37 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:54 +0100 Message-Id: <20220626174531.969187-19-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 18/55] pckbd: checkpatch fixes 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-19-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 150 ++++++++++++++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 53 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 45c40fe3f3..c18a1a7fae 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -39,49 +39,86 @@ #include "trace.h" -/* Keyboard Controller Commands */ -#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */ -#define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */ -#define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */ -#define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */ -#define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */ -#define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */ -#define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */ -#define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */ -#define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */ -#define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */ -#define KBD_CCMD_READ_INPORT 0xC0 /* read input port */ -#define KBD_CCMD_READ_OUTPORT 0xD0 /* read output port */ -#define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */ -#define KBD_CCMD_WRITE_OBUF 0xD2 -#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if - initiated by the auxiliary device */ -#define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ -#define KBD_CCMD_DISABLE_A20 0xDD /* HP vectra only ? */ -#define KBD_CCMD_ENABLE_A20 0xDF /* HP vectra only ? */ -#define KBD_CCMD_PULSE_BITS_3_0 0xF0 /* Pulse bits 3-0 of the output port P2. */ -#define KBD_CCMD_RESET 0xFE /* Pulse bit 0 of the output port P2 = CPU reset. */ -#define KBD_CCMD_NO_OP 0xFF /* Pulse no bits of the output port P2. */ +/* Keyboard Controller Commands */ + +/* Read mode bits */ +#define KBD_CCMD_READ_MODE 0x20 +/* Write mode bits */ +#define KBD_CCMD_WRITE_MODE 0x60 +/* Get controller version */ +#define KBD_CCMD_GET_VERSION 0xA1 +/* Disable mouse interface */ +#define KBD_CCMD_MOUSE_DISABLE 0xA7 +/* Enable mouse interface */ +#define KBD_CCMD_MOUSE_ENABLE 0xA8 +/* Mouse interface test */ +#define KBD_CCMD_TEST_MOUSE 0xA9 +/* Controller self test */ +#define KBD_CCMD_SELF_TEST 0xAA +/* Keyboard interface test */ +#define KBD_CCMD_KBD_TEST 0xAB +/* Keyboard interface disable */ +#define KBD_CCMD_KBD_DISABLE 0xAD +/* Keyboard interface enable */ +#define KBD_CCMD_KBD_ENABLE 0xAE +/* read input port */ +#define KBD_CCMD_READ_INPORT 0xC0 +/* read output port */ +#define KBD_CCMD_READ_OUTPORT 0xD0 +/* write output port */ +#define KBD_CCMD_WRITE_OUTPORT 0xD1 +#define KBD_CCMD_WRITE_OBUF 0xD2 +/* Write to output buffer as if initiated by the auxiliary device */ +#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 +/* Write the following byte to the mouse */ +#define KBD_CCMD_WRITE_MOUSE 0xD4 +/* HP vectra only ? */ +#define KBD_CCMD_DISABLE_A20 0xDD +/* HP vectra only ? */ +#define KBD_CCMD_ENABLE_A20 0xDF +/* Pulse bits 3-0 of the output port P2. */ +#define KBD_CCMD_PULSE_BITS_3_0 0xF0 +/* Pulse bit 0 of the output port P2 = CPU reset. */ +#define KBD_CCMD_RESET 0xFE +/* Pulse no bits of the output port P2. */ +#define KBD_CCMD_NO_OP 0xFF /* Status Register Bits */ -#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */ -#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */ -#define KBD_STAT_SELFTEST 0x04 /* Self test successful */ -#define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */ -#define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */ -#define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */ -#define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */ -#define KBD_STAT_PERR 0x80 /* Parity error */ + +/* Keyboard output buffer full */ +#define KBD_STAT_OBF 0x01 +/* Keyboard input buffer full */ +#define KBD_STAT_IBF 0x02 +/* Self test successful */ +#define KBD_STAT_SELFTEST 0x04 +/* Last write was a command write (0=data) */ +#define KBD_STAT_CMD 0x08 +/* Zero if keyboard locked */ +#define KBD_STAT_UNLOCKED 0x10 +/* Mouse output buffer full */ +#define KBD_STAT_MOUSE_OBF 0x20 +/* General receive/xmit timeout */ +#define KBD_STAT_GTO 0x40 +/* Parity error */ +#define KBD_STAT_PERR 0x80 /* Controller Mode Register Bits */ -#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ -#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ -#define KBD_MODE_SYS 0x04 /* The system flag (?) */ -#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */ -#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ -#define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */ -#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ -#define KBD_MODE_RFU 0x80 + +/* Keyboard data generate IRQ1 */ +#define KBD_MODE_KBD_INT 0x01 +/* Mouse data generate IRQ12 */ +#define KBD_MODE_MOUSE_INT 0x02 +/* The system flag (?) */ +#define KBD_MODE_SYS 0x04 +/* The keylock doesn't affect the keyboard if set */ +#define KBD_MODE_NO_KEYLOCK 0x08 +/* Disable keyboard interface */ +#define KBD_MODE_DISABLE_KBD 0x10 +/* Disable mouse interface */ +#define KBD_MODE_DISABLE_MOUSE 0x20 +/* Scan code conversion to PC format */ +#define KBD_MODE_KCC 0x40 +#define KBD_MODE_RFU 0x80 /* Output Port Bits */ #define KBD_OUT_RESET 0x01 /* 1=normal mode, 0=reset */ @@ -89,7 +126,8 @@ #define KBD_OUT_OBF 0x10 /* Keyboard output buffer full */ #define KBD_OUT_MOUSE_OBF 0x20 /* Mouse output buffer full */ -/* OSes typically write 0xdd/0xdf to turn the A20 line off and on. +/* + * OSes typically write 0xdd/0xdf to turn the A20 line off and on. * We make the default value of the outport include these four bits, * so that the subsection is rarely necessary. */ @@ -133,8 +171,10 @@ typedef struct KBDState { hwaddr mask; } KBDState; -/* XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be - incorrect, but it avoids having to simulate exact delays */ +/* + * XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be + * incorrect, but it avoids having to simulate exact delays + */ static void kbd_update_irq_lines(KBDState *s) { int irq_kbd_level, irq_mouse_level; @@ -302,21 +342,23 @@ static void kbd_write_command(void *opaque, hwaddr addr, trace_pckbd_kbd_write_command(val); - /* Bits 3-0 of the output port P2 of the keyboard controller may be pulsed + /* + * Bits 3-0 of the output port P2 of the keyboard controller may be pulsed * low for approximately 6 micro seconds. Bits 3-0 of the KBD_CCMD_PULSE * command specify the output port bits to be pulsed. * 0: Bit should be pulsed. 1: Bit should not be modified. * The only useful version of this command is pulsing bit 0, * which does a CPU reset. */ - if((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) { - if(!(val & 1)) + if ((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) { + if (!(val & 1)) { val = KBD_CCMD_RESET; - else + } else { val = KBD_CCMD_NO_OP; + } } - switch(val) { + switch (val) { case KBD_CCMD_READ_MODE: kbd_queue(s, s->mode, 0); break; @@ -409,7 +451,7 @@ static void kbd_write_data(void *opaque, hwaddr addr, trace_pckbd_kbd_write_data(val); - switch(s->write_cmd) { + switch (s->write_cmd) { case 0: ps2_write_keyboard(s->kbd, val); /* sending data to the keyboard reenables PS/2 communication */ @@ -607,7 +649,7 @@ static const VMStateDescription vmstate_kbd = { VMSTATE_UINT8(pending_tmp, KBDState), VMSTATE_END_OF_LIST() }, - .subsections = (const VMStateDescription*[]) { + .subsections = (const VMStateDescription * []) { &vmstate_kbd_outport, &vmstate_kbd_extended_state, NULL @@ -619,10 +661,11 @@ static uint64_t kbd_mm_readfn(void *opaque, hwaddr addr, unsigned size) { KBDState *s = opaque; - if (addr & s->mask) + if (addr & s->mask) { return kbd_read_status(s, 0, 1) & 0xff; - else + } else { return kbd_read_data(s, 0, 1) & 0xff; + } } static void kbd_mm_writefn(void *opaque, hwaddr addr, @@ -630,10 +673,11 @@ static void kbd_mm_writefn(void *opaque, hwaddr addr, { KBDState *s = opaque; - if (addr & s->mask) + if (addr & s->mask) { kbd_write_command(s, 0, value & 0xff, 1); - else + } else { kbd_write_data(s, 0, value & 0xff, 1); + } } From patchwork Sun Jun 26 17:44:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F399C43334 for ; Sun, 26 Jun 2022 18:03:29 +0000 (UTC) Received: from localhost ([::1]:52196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WbY-0004vk-9n for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:03:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLr-0003M0-4b for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:17 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45092) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLf-0008RE-Gn for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=xqAQx69OFfHewtrEYYQeUe4W5WyLC1wb0ecyArMrfY8=; b=wrquJZv8qfyjm3Cvl8JgpIyfU2 gQQ7qjVBX34E0CvVkX3gn6DhY+BzZCT/6X70pZUKi47OgWUuJW/MlW3pho+rxTG948RPdZcWgUCX0 taUKcBIXqbLvYHB39SrYsLVP59x14vLg2VXPvyUirUpi0xQb3FKWNTBIgbOgTOBJi655YLnmACYRt DGtsHZ/cm0z1P+fDQuZHmgVKujfmaMrolyZgRvU24JI06WLCHFb/Ekt3QTY/7LFzpasTJJMuJnIhu daQz7yBH+hCeOaVBc9pUuleuDvQwJ9Wth1Qzb+Vm4A4OqVa8lATQHlCKz9lBnAnsc8iesJwNDolXe HXOWzXqDh68e8oxYCXOBz6uYpGryjfOjq51XQIlC8iOd0WrQilHqdRVtZduq0s9lB4Y1NdzYtUlek 8F0qoc7Xko4zifV4WyhPf1Ia+KnGtdpcsCESdJUHlfJ9h9S1ZJeFcZT5dTaZrJmZsup9ehz+AmMpL TeBvo4xFGCd66tdkxn9IF2ckPSVEGccmSCInenUm62oD/FAc23zqSFPMPuJoE7caHmmpaMl4y08SW vtAlOqLgJZN7hhD3M1XPB3Dryzt/eiE/sRu4kZHY2xoIYPoTfgAKQbQiyatlpZk87tZNIh6CXRmGL OzBolh/LMVu5mjWptZ5O1AjWT8O9cZeWdtSTv7YMQ=; 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 1o5WKH-0007KY-JX; Sun, 26 Jun 2022 18:45:41 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:55 +0100 Message-Id: <20220626174531.969187-20-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 19/55] pckbd: move KBDState from pckbd.c to i8042.h 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This allows the QOM types in pckbd.c to be used elsewhere by simply including i8042.h. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-20-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 24 ------------------------ include/hw/input/i8042.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c18a1a7fae..7b14cd007e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -146,30 +146,6 @@ #define KBD_OBSRC_MOUSE 0x02 #define KBD_OBSRC_CTRL 0x04 -typedef struct KBDState { - uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ - uint8_t status; - uint8_t mode; - uint8_t outport; - uint32_t migration_flags; - uint32_t obsrc; - bool outport_present; - bool extended_state; - bool extended_state_loaded; - /* Bitmask of devices with data available. */ - uint8_t pending; - uint8_t obdata; - uint8_t cbdata; - uint8_t pending_tmp; - void *kbd; - void *mouse; - QEMUTimer *throttle_timer; - - qemu_irq irq_kbd; - qemu_irq irq_mouse; - qemu_irq a20_out; - hwaddr mask; -} KBDState; /* * XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index e070f546e4..84b5aa7f23 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -11,6 +11,31 @@ #include "hw/isa/isa.h" #include "qom/object.h" +typedef struct KBDState { + uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ + uint8_t status; + uint8_t mode; + uint8_t outport; + uint32_t migration_flags; + uint32_t obsrc; + bool outport_present; + bool extended_state; + bool extended_state_loaded; + /* Bitmask of devices with data available. */ + uint8_t pending; + uint8_t obdata; + uint8_t cbdata; + uint8_t pending_tmp; + void *kbd; + void *mouse; + QEMUTimer *throttle_timer; + + qemu_irq irq_kbd; + qemu_irq irq_mouse; + qemu_irq a20_out; + hwaddr mask; +} KBDState; + #define TYPE_I8042 "i8042" OBJECT_DECLARE_SIMPLE_TYPE(ISAKBDState, I8042) From patchwork Sun Jun 26 17:44:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67621C433EF for ; Sun, 26 Jun 2022 18:07:00 +0000 (UTC) Received: from localhost ([::1]:60990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wex-0002W4-DR for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:06:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLs-0003MM-9y for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:17 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLj-0008RU-9F for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc: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=ffEIle0RGdymNzShb95uqFJlGbjQZny04LTKy9xBLCQ=; b=MeMg7f/Q7wkd9JB1wL0DgITj9n c0LrQP36wCumvib6xgUI2WxPWD6GO9NitvUntBOrqSE9h7qEkUQnqKKIeMNBnekqtxoBwl4gWEuT/ DmFbt1RyKtAjvwevDVXPi6QJ61sPTfqx7YiLtSy11V6SqhZSvuxrSPtXrfXK+akfeMDjWpzbmfkX0 6auPPt5bKRvR1sHZsVQWWJwpOnBeS59jZjrgEXTUDTHZqFwmeDcFoHcpUXY9xRfTuqOvZbm4AUm2Y iNwSuYCV8xy7hKMVL2bAZxaxJbcDAQ0wt85nc4UTTKV0KZspnGqpteqEXowjMuP4mGblL15LGIsBu kmXlBDoKO+NnS9UNOqiX0ZllwkLknaSUurt0MWqE0DjUIOvZAE1P9Vu7POEIYHxDQVcHvZ5rS2Jiz mSeiQf7zo2zSjjnGm4boSsQ5ygMklCaeBjjRg5gq2GmfBtkuL8HMr2glx/eO8ebHgt+7rhQ6jI9AS 2f+npb7Rn0JAPCVSLvzBuZy3whkpMexpr/D9YiA1CkUtbMaMCp2SnRXqv7LNldmw0Joxh4xYaxa16 s7dHueIMprV6IHrLCZFsidSzknMUCGcADWSP6PK3MATpQfLFaPVAVe57vzVwEFbELbFwxCuduHqtw 4vJ83ZMGrCeH+PiXVtbOS8NgusBD++It2GErbDXig=; 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 1o5WKL-0007KY-Gg; Sun, 26 Jun 2022 18:45:45 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:56 +0100 Message-Id: <20220626174531.969187-21-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 20/55] pckbd: move ISAKBDState from pckbd.c to i8042.h 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This allows the QOM types in pckbd.c to be used elsewhere by simply including i8042.h. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Acked-by: Helge Deller Message-Id: <20220624134109.881989-21-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 10 ---------- include/hw/input/i8042.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 7b14cd007e..f99e10cfcf 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -686,16 +686,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, qemu_register_reset(kbd_reset, s); } -struct ISAKBDState { - ISADevice parent_obj; - - KBDState kbd; - bool kbd_throttle; - MemoryRegion io[2]; - uint8_t kbd_irq; - uint8_t mouse_irq; -}; - void i8042_isa_mouse_fake_event(ISAKBDState *isa) { KBDState *s = &isa->kbd; diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 84b5aa7f23..a246250d1f 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -39,6 +39,16 @@ typedef struct KBDState { #define TYPE_I8042 "i8042" OBJECT_DECLARE_SIMPLE_TYPE(ISAKBDState, I8042) +struct ISAKBDState { + ISADevice parent_obj; + + KBDState kbd; + bool kbd_throttle; + MemoryRegion io[2]; + uint8_t kbd_irq; + uint8_t mouse_irq; +}; + #define I8042_A20_LINE "a20" From patchwork Sun Jun 26 17:44:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D013C433EF for ; Sun, 26 Jun 2022 18:09:12 +0000 (UTC) Received: from localhost ([::1]:40320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wh5-0007dG-Eq for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:09:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLw-0003No-Uc for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:21 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLu-0008TV-7G for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:19 -0400 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=auHlZ+wkV6v3/EEN8/cki5WMOS9NxMTa97s3q/YR2hU=; b=SiJq2xpfoc2r4IiBo7/6tNM9gr uNJCFrFFh9hsbILEcLc2H3b+SWxuxn7Sb235I0w6haWqDWeKusI4090jCy8FQITFi/fYVxybbVwG8 GIwzSp6LYynuG7zxCptGbIgfIx2/WVpK7USoeWsMljWQK6mxG3WV7AhhGBA28HOPjctx7gyNk4UJ6 rd1HSypaUz1sHMKPngi60xfzhZjS9SYz6mRue9lnMDGT+lN2D6cAy2ooTF2B77cGyLQaAahe+N+oy XryCWbSsQZGxf6Qi3CP1g1ma3B2wzH7EFPekwg3isQEAeDlgsd2jhVzBiyHCw4oDrzwrrJy4IQn43 ghhQnAMRyygMA3UcR0ScqWFi0kXnW8Sd0JSRoQuKUGa+tQLKAWUyqRA2zmX4KucamCCFM21KMTCHo /SouZyK5mSjO+3ooiI9ILnUu+222TP52mbIuEGpURvGQzISCxYchdbdvBOe56t8dTBYUXv22VS7o0 q172Vl5rRzRWR7w3RYR5euDvFuzR4PYWwjQbQx6pqbNtDLBvhSbkIK6nkdkcUcwCN7j8PDv62T7lw wwIeopNqiKJfKmsNG2r8tNmnO3npYHK7X9iS998YBZkc5g7t8GvPEwYl8i5IrcOBUOsj1n3ts/kcW mB6wenX6n6/Pxn+fH951VclgBJSq7uWlK3gpmAiTM=; 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 1o5WKP-0007KY-C0; Sun, 26 Jun 2022 18:45:49 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:57 +0100 Message-Id: <20220626174531.969187-22-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 21/55] pckbd: introduce new I8042_MMIO QOM type 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Currently i8042_mm_init() creates a new KBDState directly which is used by the MIPS magnum machine. Introduce a new I8042_MMIO QOM type that will soon be used to allow the MIPS magnum machine to be wired up using standard qdev GPIOs. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-22-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 22 +++++++++++++++++++++- include/hw/input/i8042.h | 10 ++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index f99e10cfcf..89a41ed566 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,11 +665,23 @@ static const MemoryRegionOps i8042_mmio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +static void i8042_mmio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, MemoryRegion *region, ram_addr_t size, hwaddr mask) { - KBDState *s = g_new0(KBDState, 1); + DeviceState *dev; + KBDState *s; + + dev = qdev_new(TYPE_I8042_MMIO); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = &I8042_MMIO(dev)->kbd; s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; @@ -686,6 +698,13 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, qemu_register_reset(kbd_reset, s); } +static const TypeInfo i8042_mmio_info = { + .name = TYPE_I8042_MMIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(MMIOKBDState), + .class_init = i8042_mmio_class_init +}; + void i8042_isa_mouse_fake_event(ISAKBDState *isa) { KBDState *s = &isa->kbd; @@ -841,6 +860,7 @@ static const TypeInfo i8042_info = { static void i8042_register_types(void) { type_register_static(&i8042_info); + type_register_static(&i8042_mmio_info); } type_init(i8042_register_types) diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index a246250d1f..b7df9ace6e 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -9,6 +9,7 @@ #define HW_INPUT_I8042_H #include "hw/isa/isa.h" +#include "hw/sysbus.h" #include "qom/object.h" typedef struct KBDState { @@ -49,6 +50,15 @@ struct ISAKBDState { uint8_t mouse_irq; }; +#define TYPE_I8042_MMIO "i8042-mmio" +OBJECT_DECLARE_SIMPLE_TYPE(MMIOKBDState, I8042_MMIO) + +struct MMIOKBDState { + SysBusDevice parent_obj; + + KBDState kbd; +}; + #define I8042_A20_LINE "a20" From patchwork Sun Jun 26 17:44:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DBFDCCA480 for ; Sun, 26 Jun 2022 17:57:53 +0000 (UTC) Received: from localhost ([::1]:40508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WW8-00057j-CT for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:57:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMA-0003Uy-0J for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:34 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLy-0008W7-Lm for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:31 -0400 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=ChwdzZCD5tiDT3DLMhvPjceW/hwuRQ7KyEMw1NT0BHo=; b=MzIxX06dKBpVpuneUsF+gXmAUT oskM90trR+Gjk7fmgd5njqOwQ8VGCvPL8CgG2/F9iQg2fCkaxyPXyY4ZzeBDDcCag9M4EUQN0XPl7 jyvbp5yeADecmYpkBis1lY8EBxXrNrTPceeyYkycMGfnIexLYnolIDnGgUoTjvlbIC5L/ozKELHlc IxT4toQYa8s95SiBK6LNGSUoShhz5+E8e2P9usadGwPF8yjdpUlLog1ds9rA+TWLbbZebi/emSwbb n3W6GsjVGjhLVsxc9du4vBMSX884d3cDIU8TPv0b7Xr7NWTbJGj7BYntVZZUN5mavZehFZ/ylimpB M4dWxQEs/H8Uq/PLMcIY2EOwW/+S64bg/2oblbP4DZbZKZXszoGLlyC8nsVpPrG7y9R7FAJYDBsZJ EVv/ng6uTp8tKg4STdOTXhlCJVMWS439soVbyLChsn6jEb+UvRJUn6YrDS/pYBfjiuzBl2osoczzD XwyJZapgdndwzZLIoybxUOsoCcC4Ev5bxWOreF4oiqBQ7uZA7ca3nzMDHeY4fDkF1TjOaagCD5Ly4 AjU/QGlCWpgmhiXmyH182YLHbzCnpMFrmQU0V01Z8uQGuyif3BZ4a/JDhRUcjKnaNOfMF4jdiV4ZU lQhZDlBVzF6iK4/BEyM2+Zj8POpKItH6GT2tlQ9s4=; 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 1o5WKT-0007KY-7c; Sun, 26 Jun 2022 18:45:53 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:58 +0100 Message-Id: <20220626174531.969187-23-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 22/55] pckbd: implement i8042_mmio_reset() for I8042_MMIO device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This allows the I8042_MMIO reset function to be registered directly within the DeviceClass rather than using qemu_register_reset() directly. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Message-Id: <20220624134109.881989-23-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 89a41ed566..7b520d0eb4 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,10 +665,19 @@ static const MemoryRegionOps i8042_mmio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +static void i8042_mmio_reset(DeviceState *dev) +{ + MMIOKBDState *s = I8042_MMIO(dev); + KBDState *ks = &s->kbd; + + kbd_reset(ks); +} + static void i8042_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->reset = i8042_mmio_reset; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -695,7 +704,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); - qemu_register_reset(kbd_reset, s); } static const TypeInfo i8042_mmio_info = { From patchwork Sun Jun 26 17:44:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895828 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE0B0CCA480 for ; Sun, 26 Jun 2022 17:55:28 +0000 (UTC) Received: from localhost ([::1]:60298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WTn-0007pN-O5 for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 13:55:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WM0-0003Re-E0 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:25 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45116) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLz-00005u-0l for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:24 -0400 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=pYkmy/S6vnAh6j+r88llMr2m9qY7DUnZp+fCNpt+oGE=; b=JwoXUjyZSJWgkndFuIcPVFc22z 5ve1gjfTOFJx54KjDPL9898NP679rPU4kblKi9+KV+sJ322FsW122PcsX+alo1NRwV3c0nZOgpvbL b2szxeokpMPqcM9xW7cegDUhwiR4P5ZrCW8926p2Db2KJByGD1GkpRh7Bdi/YNi+b/0xhLCgXVyxK 2ns/xhbQY95UVcaBtyhNDAxTaQuFEPunipdcF0RwRQ+TP4lui9UhAIbIGLN3NEzYYbqy79Uvlxzn6 yBJYVfx2R8ZK6DP0b0Y32tG5OAha+2fNTGW9NTBxsVxGCzzYgml8DBzWATbO+75v5EMKzywEkvsxw gA0hHVpZQNuL0ZAqVoAktAWk0/Fz3Nawjr5PB4AqM10C3q0shf3oi2utaCaAWRkCtznPVAkX6C9cm Sxht3ZkXiXpIoCFq3LKYMJIo4NGWvXBF/jRd38xRZu8/V5qJh+3tMdZ13CmWqRKLUhb1gu1chxQH5 17ya1VW+LTpDwIphHr5Ob8QDg3vgmosnbx3zOJE70VVwOONLu71LksMAKAAiFG8JdjEkzOoiF/yY8 2/tzF7BMpFXrOfwV7VE3d8uKf5Ietl0EKUugjR16ritcwT3iD+5S33B87sGTMZriPr9zsEpLTQQ6G E41ge3844ygt531h67qbv6g5D1jo7YYeY2ROj4yjk=; 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 1o5WKX-0007KY-EJ; Sun, 26 Jun 2022 18:45:56 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:44:59 +0100 Message-Id: <20220626174531.969187-24-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 23/55] pckbd: add mask qdev property to I8042_MMIO device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This allows the KBDState mask value to be set using a qdev property rather than directly in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-24-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 7b520d0eb4..c04a2c587e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -673,11 +673,17 @@ static void i8042_mmio_reset(DeviceState *dev) kbd_reset(ks); } +static Property i8042_mmio_properties[] = { + DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), + DEFINE_PROP_END_OF_LIST(), +}; + static void i8042_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->reset = i8042_mmio_reset; + device_class_set_props(dc, i8042_mmio_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -689,12 +695,12 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, KBDState *s; dev = qdev_new(TYPE_I8042_MMIO); + qdev_prop_set_uint64(dev, "mask", mask); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = &I8042_MMIO(dev)->kbd; s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; - s->mask = mask; s->extended_state = true; From patchwork Sun Jun 26 17:45:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7303C43334 for ; Sun, 26 Jun 2022 18:12:13 +0000 (UTC) Received: from localhost ([::1]:48930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wk0-00051u-UD for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:12:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WM1-0003Rg-Jg for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:25 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WLz-000069-4m for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:25 -0400 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=64HO1bV36j5AyTcnfECUSqVUIdsjQZjYmqhIwl1K0/0=; b=EWgOR8Z0AzepBFfKuO/Gd/O4fT Iq87KlUCNhcBsWCwRePSJkJ1GyxeUYL9Lpq0KMpbLSK20mljVP10LfS8lJLHrT1PQl/GArDtpGNeZ YTnT3TzvnMaT1icgR/wD7eytuD9uYiSCw6QsWb26rwh1G3mQINR5ij2IddpoDbBYtqSoxJOCR6143 E+75KkGkWGIllLwT/v7NCLjqiSJIjPfUqgcKQStX0BcDAoYxfPs6lrQiQkZvmNn8SQjExq2xTcpmA h7UpzNYnpdTHtWSDHqY4kLsA50+LU69s5f1cq3op4VH5Yn3q9AE601S5/RsWh7QBUE4exD0etjrdM YRO1P1H7rGK40XvtlvUWG1ILgw737CRuncWEG3M9gVLvRSFyJfWtDefhjiNj6ziKrib9WdgvcSXZn CzsDOAMNb8frTxtn/kCm3xwpRRIHL/WfWah248bx9LaHry3blcZBuEkqj89QrO6cd20mndgRwjbrW +n+/uA7youqolJgT2tc4ciwp/dgW+Db+FhhOXXuQys4uTJeo1EufVoq5q7VBpMdCEdSGHc6Ww/rPx mpHD7m2d1y3LStM46B4OWjO19hpOB0+YfQirVqDrwPZS3IlILNVGJEMYPKz3UY/yztVVrrHp4KefH RAiVPYJpjGkzmO06PPbYWrRYI4G2JwUijPSQSvWF0=; 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 1o5WKb-0007KY-0k; Sun, 26 Jun 2022 18:46:01 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:00 +0100 Message-Id: <20220626174531.969187-25-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 24/55] pckbd: add size qdev property to I8042_MMIO device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This will soon be used to set the size of the register memory region using a qdev property. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-25-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 2 ++ include/hw/input/i8042.h | 1 + 2 files changed, 3 insertions(+) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c04a2c587e..a70442e0f8 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -675,6 +675,7 @@ static void i8042_mmio_reset(DeviceState *dev) static Property i8042_mmio_properties[] = { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), + DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), DEFINE_PROP_END_OF_LIST(), }; @@ -696,6 +697,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, dev = qdev_new(TYPE_I8042_MMIO); qdev_prop_set_uint64(dev, "mask", mask); + qdev_prop_set_uint32(dev, "size", size); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = &I8042_MMIO(dev)->kbd; diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index b7df9ace6e..ac4098b957 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -57,6 +57,7 @@ struct MMIOKBDState { SysBusDevice parent_obj; KBDState kbd; + uint32_t size; }; #define I8042_A20_LINE "a20" From patchwork Sun Jun 26 17:45:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9637C43334 for ; Sun, 26 Jun 2022 18:09:24 +0000 (UTC) Received: from localhost ([::1]:41188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WhH-0008Bq-Oo for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:09:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMB-0003Vq-AM for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:35 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WM3-00006x-8n for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:35 -0400 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=7EtO8uIrt3uYXAmqi0X+kOyDMKvvHO6GUp3IaFCyKVU=; b=dSejvid6AC7Pm8LGlRnadDwHgV cKtwcP9ap23wDsUKPhxPUNUSiHR4OzMUgQnncs1d+qO/loFhplyx/uI6mRN3hsa59VazNUikmmVFE WomY5Nxl9wbc2YT/BQcX29HKAHZz/9dBsgA8+hFZc180RXXgc8k0a4m+EcFQ08+rq8Knrz5r4Fn72 EnOXX6pDnUp6ak/BpB4t/Zph+92OxQo5w3O6dAz6ZnwM5ruuG7jI4O+YglC9FhRvcBKaK+yuSiOll fBCELnAsALVJmJtZqONaGLTFdmwcW8tNQg4iYX5kqr081kw1pKfG2VwJtlJiqMgEPLCbGuPvFIMuw Lws2Ym3B4VfNb68dumy8SDvuuv8XN2Nk4XohRFaMVeavpYfq1dK0FmyspiQqXegJlfpKOIBMoEJJ4 XDGJBn+jnzq5qtVg/H17BSvXeUgM27GOY+06jUwQ0vvhutHW2nbyGObGVEZ9gvkZPSmPVY3Cn9sGx aTTmB66ZWoyhOtB42ry1zxVdjNwyLiPH20QkNOg2HEbAbcobMBGSkMyTJ3Rj/R5BjfYNOX3c6iYZt FajDOW53QOZqSEQFv8Pwm5PT8ZU14SY4NSX9j4FSKBZ4ND0H9Tgs2lxcJGYNFYHGlmV/7tkREaLG6 LtArFC07xIz+DrgVw5QNZhmZXhQatdf6v3wtMd6JA=; 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 1o5WKf-0007KY-94; Sun, 26 Jun 2022 18:46:05 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:01 +0100 Message-Id: <20220626174531.969187-26-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 25/55] pckbd: implement i8042_mmio_realize() function 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move the initialisation of the register memory region to the I8042_MMIO device realize function and expose it using sysbus_init_mmio(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-26-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 14 +++++++++++++- include/hw/input/i8042.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index a70442e0f8..bc51f7eedd 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -673,6 +673,17 @@ static void i8042_mmio_reset(DeviceState *dev) kbd_reset(ks); } +static void i8042_mmio_realize(DeviceState *dev, Error **errp) +{ + MMIOKBDState *s = I8042_MMIO(dev); + KBDState *ks = &s->kbd; + + memory_region_init_io(&s->region, OBJECT(dev), &i8042_mmio_ops, ks, + "i8042", s->size); + + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region); +} + static Property i8042_mmio_properties[] = { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), @@ -683,6 +694,7 @@ static void i8042_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->realize = i8042_mmio_realize; dc->reset = i8042_mmio_reset; device_class_set_props(dc, i8042_mmio_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); @@ -708,7 +720,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, vmstate_register(NULL, 0, &vmstate_kbd, s); - memory_region_init_io(region, NULL, &i8042_mmio_ops, s, "i8042", size); + region = &I8042_MMIO(dev)->region; s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index ac4098b957..59d695a9dd 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -58,6 +58,7 @@ struct MMIOKBDState { KBDState kbd; uint32_t size; + MemoryRegion region; }; #define I8042_A20_LINE "a20" From patchwork Sun Jun 26 17:45:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5B6FC43334 for ; Sun, 26 Jun 2022 18:02:03 +0000 (UTC) Received: from localhost ([::1]:49312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WaA-0002zf-HH for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:02:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMB-0003Vr-CT for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:35 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45134) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WM7-00008X-F0 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:35 -0400 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=KT5oCv9iIYJUEGOtkEnSL8ldikhjTdzTvQigmesYOWE=; b=KeWB/x5qSpVJCqB36ROmDmVLQP 614GuNTVRrqNNliDzPPwmAheCycvV9BH6tYO2nxVhPHOoVegMaE2+sDwe2PqfJE9oEKK3hIlQDYXh y6SrthJM9wGrIHRGmN6kwS7kY8edYzj86RSmp2KozOTceommos/hJoqBOav0RiGEFAw50/bLjBy2w nhYPNVDeZ63YCFv9QHQ59c0qELt7gJz3TDeF5krL8SDHt6Ilb+effbj5jr20H+XOyvv5zkpw1bQdR 8H8L+b/FFe6bgtLKb/fB3A9ibX8ksG/Tpz5Frhjgh58619jvb4jcqWx5zIa52OZFrjNU9y/5YAijZ ZuLdP2mp0fMASh/4YN5a22o9SnJkyx5IdsRRbFoory2KGlhy58azzrbkhiZUJewPLVxJlc6721WXY 2nCxsWIJO6xAinOtJ5SykthS/NBBYtcvFgeszdG2WuRyDqndC6Dx0h+U1gDfe4kEpmWwvf6jmcZOW 9VIPmnSZahqw0Wa657BUFjWWJsjPP0ip2lWmD/eqXbAXplUgqkHUfiaxYk/rqmrl62v9usjRiX8CN gkP4Q7wawWW+fsYxST0p/zbChdSTNquRl8y4m/tuAXXAczAyfHS5gIea/zhjW+r1JiAsAxaYRLXC9 nzPxe4FdRmJueFDFVwk51Bc/0M0Ih6ntDTw30u8pQ=; 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 1o5WKj-0007KY-Ej; Sun, 26 Jun 2022 18:46:09 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:02 +0100 Message-Id: <20220626174531.969187-27-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 26/55] pckbd: implement i8042_mmio_init() function 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This enables use to set the required value of extended_state directly during device init rather than in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Message-Id: <20220624134109.881989-27-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index bc51f7eedd..b8623d2f9a 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -684,6 +684,14 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region); } +static void i8042_mmio_init(Object *obj) +{ + MMIOKBDState *s = I8042_MMIO(obj); + KBDState *ks = &s->kbd; + + ks->extended_state = true; +} + static Property i8042_mmio_properties[] = { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), @@ -716,8 +724,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; - s->extended_state = true; - vmstate_register(NULL, 0, &vmstate_kbd, s); region = &I8042_MMIO(dev)->region; @@ -729,6 +735,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, static const TypeInfo i8042_mmio_info = { .name = TYPE_I8042_MMIO, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = i8042_mmio_init, .instance_size = sizeof(MMIOKBDState), .class_init = i8042_mmio_class_init }; From patchwork Sun Jun 26 17:45:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31CBCC433EF for ; Sun, 26 Jun 2022 18:12:21 +0000 (UTC) Received: from localhost ([::1]:49606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wk8-0005Tw-AA for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:12:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMD-0003Wr-Dm for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:39 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMB-00008z-UG for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:37 -0400 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=cAjb10wPrLGEXsmvUIGx0r4+8eSqf6cm4Jha9xfzR/k=; b=wWrbc5BPjZVrsWuFRVzZHJc11q vC9foRrXdrMTD73VKRpoqzmvbAtQsf4cAh+cMlNVDROZJ4cX+YyjHCn8Nzrb6f9N2sO5HIOBXbrYa U3BpbxX8B7tDz0/GcThJIKwGQPymxxDhp5AtcUEiGUEEp/v1H3TcvA6FQ+/+VpGGKUCRVNRnBfMkW VYtbLvXX05Fak7lx1IgzUSVoyMH0CsHl+7XALEzW2ZWTsqgEbo9lOkSJwVZegNvZGphGZPXEIblRM I6C5G1wqJs4LenXNIQkOFzmkXoxdSXIHQWKTzdzkV/VOLw+gcUf1SalpmmjobT+U164lk875DDRXe Jjz6JHGEIkfIiGpSqgcKKs6glj7vzVmhwNJ7RhYGJX8ODhRlyN5cWJ7606qfEs5qxTO88cqMk+tk3 indAIdxoOwfqOhRlQ4u2dhhWMpoF9qS1wHl8UKiddLjKaHhuf9EyD/HzCn8RoR4dV/u0Yyzx9IUjk 28NqdWk7hhsPVA9V+VZ5O61qFNoxXQR4ianYuvxpcvjBcQOMhFYbU3564qRZsPypMxIgoC8kPXS2t Gi5zMpz1wXrVSYeJe9p4jE79otYbVcxYJ0z622JfP3qRwlVg1kBhOyeaHNWr5ZeVdqzIlhQjYArwo r0mtxefFquIH1itl7F3OjzaeKj4JRaOsai0ewRfeA=; 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 1o5WKn-0007KY-Kt; Sun, 26 Jun 2022 18:46:13 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:03 +0100 Message-Id: <20220626174531.969187-28-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 27/55] pckbd: alter i8042_mm_init() to return a I8042_MMIO device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This exposes the I8042_MMIO device to the caller to allow the register memory region to be mapped outside of i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-28-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 8 +++++--- include/hw/input/i8042.h | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index b8623d2f9a..702dab056c 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -708,9 +708,9 @@ static void i8042_mmio_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask) +MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, + MemoryRegion *region, ram_addr_t size, + hwaddr mask) { DeviceState *dev; KBDState *s; @@ -730,6 +730,8 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); + + return I8042_MMIO(dev); } static const TypeInfo i8042_mmio_info = { diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 59d695a9dd..d05cd33e3c 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -64,9 +64,9 @@ struct MMIOKBDState { #define I8042_A20_LINE "a20" -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask); +MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, + MemoryRegion *region, ram_addr_t size, + hwaddr mask); void i8042_isa_mouse_fake_event(ISAKBDState *isa); void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); From patchwork Sun Jun 26 17:45:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A85ECC43334 for ; Sun, 26 Jun 2022 18:14:07 +0000 (UTC) Received: from localhost ([::1]:58120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wlq-0002gk-QC for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:14:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMJ-0003ao-VG for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:46 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMI-000098-F7 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:43 -0400 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=F3cnwem9rqkTEdrQWnGFpojiWUrZ9qr/kCnHgAw6uzQ=; b=FSQ8fWTLTtsY7Pwh14v047gTyg TQv1fLvHsdN2WsT/4xPZmJ+aK6591yGmtnLeJND6POGUNEY9DSvS8tmAAkuHRsL55rfyqpt6eR1P/ IENPVCqD+4C5hmJybYWSStx1QOCwcvbM9A9Jt1fAkHIG4gYEKF7NKUnLD8XvBQ1ZsB+jCyTtHHe9s sJoadeyeVgKhinNWkNcAc1452oDfpfXYvgoHcqYkOYrPv+8uzA8pQ5uFUAXWLbCCscfaizQLmdNYh nnW1WlBrjkO7uLZs9gDAlxhl0ax053OgLBXWHozpA8JOttf6GeY4G/Vomc/pfF9Ua1T16i/lY5z1S +n0I75ohIIw/XHYiILftme+a4Zr/7gxuQrzsVNbgPXvi1kTlEzQb/AOJYXlcl/HSeaLDjZT2V9IMc lWkcGSt6p/mmuprUYSXKUzqF/q7GwGE5yeWMqrfkRpCfaF4/tMJaHTOjHyADa+tNxzRZgJjmc9mqr DE+YaRptNhNmKyPNAsbuSoS/6BStQf2h7UohhgLn7k1Sq3EG1YXAFVXaqxfp6owm09lfgSwDqFKD6 LLU+DPRGXSiNOZNYSKp107/fToTuIYmJtSz5apLwqtIEij4E6oQc5cpX4KilMX+10XHeNv+zjg6Ax 5rIo73NAGJ6s4LbY/CEdM6/uD1cOy6EKXgu0Fl8sU=; 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 1o5WKs-0007KY-0E; Sun, 26 Jun 2022 18:46:14 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:04 +0100 Message-Id: <20220626174531.969187-29-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 28/55] pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Now that the register memory region is exposed as a SysBus memory region, move the mapping of the I8042_MMIO registers from i8042_mm_init() to the MIPS magnum machine (which is its only user). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-29-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 5 +---- hw/mips/jazz.c | 11 +++++++---- include/hw/input/i8042.h | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 702dab056c..8708595eed 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -709,8 +709,7 @@ static void i8042_mmio_class_init(ObjectClass *klass, void *data) } MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask) + ram_addr_t size, hwaddr mask) { DeviceState *dev; KBDState *s; @@ -726,8 +725,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, vmstate_register(NULL, 0, &vmstate_kbd, s); - region = &I8042_MMIO(dev)->region; - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 96dc6ab32d..1eb8bd5018 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -136,11 +136,11 @@ static void mips_jazz_init(MachineState *machine, MemoryRegion *isa_mem = g_new(MemoryRegion, 1); MemoryRegion *isa_io = g_new(MemoryRegion, 1); MemoryRegion *rtc = g_new(MemoryRegion, 1); - MemoryRegion *i8042 = g_new(MemoryRegion, 1); MemoryRegion *dma_dummy = g_new(MemoryRegion, 1); MemoryRegion *dp8393x_prom = g_new(MemoryRegion, 1); NICInfo *nd; DeviceState *dev, *rc4030; + MMIOKBDState *i8042; SysBusDevice *sysbus; ISABus *isa_bus; ISADevice *pit; @@ -361,9 +361,12 @@ static void mips_jazz_init(MachineState *machine, memory_region_add_subregion(address_space, 0x80004000, rtc); /* Keyboard (i8042) */ - i8042_mm_init(qdev_get_gpio_in(rc4030, 6), qdev_get_gpio_in(rc4030, 7), - i8042, 0x1000, 0x1); - memory_region_add_subregion(address_space, 0x80005000, i8042); + i8042 = i8042_mm_init(qdev_get_gpio_in(rc4030, 6), + qdev_get_gpio_in(rc4030, 7), + 0x1000, 0x1); + memory_region_add_subregion(address_space, 0x80005000, + sysbus_mmio_get_region(SYS_BUS_DEVICE(i8042), + 0)); /* Serial ports */ serial_mm_init(address_space, 0x80006000, 0, diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index d05cd33e3c..9d1f8af964 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -65,8 +65,7 @@ struct MMIOKBDState { MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask); + ram_addr_t size, hwaddr mask); void i8042_isa_mouse_fake_event(ISAKBDState *isa); void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); From patchwork Sun Jun 26 17:45:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFEFDC43334 for ; Sun, 26 Jun 2022 18:13:59 +0000 (UTC) Received: from localhost ([::1]:57430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wli-0002EO-Vj for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:13:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WML-0003au-9f for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:46 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMJ-00009E-O2 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:44 -0400 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=LXmH14SVZ8DJV3hrf0A4042X6H2IoarjKDLcJ5ibVWA=; b=tGJ0ESUmCR5pzGGZ6n3a669buN DnhW+sQfMkd1VxmpMprHEoPA8DRqe0UrmSc6sk60mylCyG0tmJ8SJWUqAiW9HvOZMK+l8YzGQw0yL AElldg9Sfi5X368Wm/DxwvVd6QexDEJlk9LZIFBt5x9IoT3/t6euIHpL+moaQoEYQBEtdedr3nfZm DNLa2dkIFfZmX8eTE/KwiJ47YoJY6brbqZ70H49Dvhjq5DBQJ+WwAiEkt+++3kYnVksCk+tfbEbhG lEyBqAAMGcahZC838JRWfNSb4c9qjRVEq68q95OIjr2BX/rzXcg8gps3VNF0e+RHIOGEWbDcTYvTL ZNgyGH7ffMI/KkXpigOqkZIIMUmKUmztNApkIBnlEy01aa7P336jJzchU9MSybGyZ19WvBWYZ2H6T 5B8XBxGllF3na5uC3YtiIQ7ZN1lb9owwaqi3MhirV6O54p4Z623lAhzv1hPxpL9Sn6cdmVpINEzPf 19C2JCwTtDxwQvRjIzND2fTw1YQf6tYg4dHF40JqkufLOOZCPbAYuiWOEc72XhAbimQiY0t24esxC nrkcAQsCg85a5BqHOR6vSfmOSMbmJS3V/mGUBqxeBy0uN5DNFUucjIuagJcFjGY4iDzQL7dOIcQGT QrXoW7ioO9tmntMZ7SqJ88wQvD/TK3jjmTv+1Mor0=; 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 1o5WKs-0007KY-P1; Sun, 26 Jun 2022 18:46:18 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:05 +0100 Message-Id: <20220626174531.969187-30-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 29/55] pckbd: more vmstate_register() from i8042_mm_init() to i8042_mmio_realize() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Note in this case it is not possible to register a (new) VMStateDescription in the DeviceClass without breaking migration compatibility for the MIPS magnum machine. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Message-Id: <20220624134109.881989-30-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 8708595eed..1ab76793ea 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -682,6 +682,9 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp) "i8042", s->size); sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region); + + /* Note we can't use dc->vmsd without breaking migration compatibility */ + vmstate_register(NULL, 0, &vmstate_kbd, ks); } static void i8042_mmio_init(Object *obj) @@ -723,8 +726,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; - vmstate_register(NULL, 0, &vmstate_kbd, s); - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); From patchwork Sun Jun 26 17:45:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895838 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4F72C433EF for ; Sun, 26 Jun 2022 18:06:11 +0000 (UTC) Received: from localhost ([::1]:58072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WeA-0000aP-Qp for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:06:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMN-0003bY-9E for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45158) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMK-00009a-8D for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:45 -0400 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=SX5sGDsYhnrMkHelRj4QfC540JSg6IFOdLXbq5ato8M=; b=HVO2Mvx90L459+EEZKAqKA4gIX MMz+ahG6zRtZszxcenn6/nSdENt8+/SYmlcDHrwUyXREkOCu/SjG019tljS8ZaoFKQ8PoM5D06GQ4 4u6BwQKvDEMzqNXB9tWtA+SVwlDI0q3VetAA4tRXGQlCtkv8BLkS66dCeEqZmYbJadMWAVVO2xoMr 0hCnv2oee4QtCT8di2LgfaaFmruF0jgKaeQADTt1x39MSHrNE08ZFG/t+cYee2pAJFVC4rni2zIAr zkXa2H3TA9c9SjRYAeFfQAZ0JNDSI1vetDmFsPUIHUytsKdGHtxAj7q8Ihe3za7As//Kz4OFVBshl NlOih8HH3vSmS9thgR/k3bpsMFw3TwVwNSuYe2vrSCGOL/MXaVtpwM2TD5vAERVkqrlePGV2gtIWO 16VAHbBQgGc2coVHCxbUgm4r2g4s3xnzygI1ydvmR4/Fg+2juCpL6gI5fzxT6PA5Dv+GWTTqFi6jJ XYZkik0gxCl0I4Bcddajl+ZJch2A50eRsF3m84+DkJrgjLYbD3pRNfaca5QbbbAjYIGteGfCYKEGj 2Fl9/F0fvmkRBmvyR32taQdCTcljJMqCtqq79utKMoFRZJ8Pw0hR5+tXhJjIkr+vjx5ngdzb7+Ddb +vy3Qdj0Fq1gwTffK2LaMIaKmB8FCBrm+NqB/PpDs=; 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 1o5WKw-0007KY-OQ; Sun, 26 Jun 2022 18:46:22 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:06 +0100 Message-Id: <20220626174531.969187-31-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 30/55] pckbd: move ps2_kbd_init() and ps2_mouse_init() to i8042_mmio_realize() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move ps2_kbd_init() and ps2_mouse_init() from i8042_mm_init() to i8042_mmio_realize() to further reduce the initialisation logic done in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-31-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 1ab76793ea..72843f770e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -685,6 +685,9 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp) /* Note we can't use dc->vmsd without breaking migration compatibility */ vmstate_register(NULL, 0, &vmstate_kbd, ks); + + ks->kbd = ps2_kbd_init(kbd_update_kbd_irq, ks); + ks->mouse = ps2_mouse_init(kbd_update_aux_irq, ks); } static void i8042_mmio_init(Object *obj) @@ -726,9 +729,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); - s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); - return I8042_MMIO(dev); } From patchwork Sun Jun 26 17:45:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 793C7C43334 for ; Sun, 26 Jun 2022 18:08:45 +0000 (UTC) Received: from localhost ([::1]:38354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wge-0006JB-JE for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:08:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMV-0003vd-3B for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:55 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMO-0000A7-1a for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:54 -0400 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=V5VZyOKYKJumebR040/WcY+thJDB9ZncWnfrphsxbUU=; b=jZ50deckk4geE1Xr7E0A7ys1CU yjIzNtF4ZnRb44RHDe/JnKxBqNliKLBmcM7ehtlf17tMlssrbWFNotjJITzxG920FQum944UUBsoU +bZN5/ld9qF50AQ8/EBXxY5bB6baaT/K+FDzAmavfRL43UPwSue5N09hvenfGHeni6xfkc/k5VeD/ Hw4UTfW3q5To2n9NqeEmxp7IN3fmopvn/PvOoPl2dQItw6ymcxeyiRQwa+Csr8XzmrAcxBKOH8+r0 yZKeIxw9nHze5njj25QtHAEJB1ib1/QZvK88bG3mSpEiu08wz2ZEhT8xCo/9xxDWqRVoW/4mEwr/K 38mgXGN00uSgnN+ZdxUdl7PEAQ5U98o3SNgcgI5zBSBujpDAcURKhgmbTIQXdVa1+7ziZrN/DA+qc N7DIfsyK7bDPLHkdHcusy1S5oRD5Ot2+7kRfEmgd/03kYF3RyTXyhx9athvwGy4iKwiYd7ONSTm9o q5NfI9Rm/BKLbQzKtxmOG1UHTs3FXk7tu+s8VtzKf+vv1Yc6FTPL1hVRQoTxefNHaX71PunUap9Mu Kykny17PczGVg1P11M6SgFhrz03oWOSvx1hspuwF0LsKUrovA7CErx8fC/TD5vFkIUpubLWlGwK8S SsVsIaQWblZgsrCW5fY5ids0C3PDhagwPD9E/yqic=; 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 1o5WL0-0007KY-B9; Sun, 26 Jun 2022 18:46:26 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:07 +0100 Message-Id: <20220626174531.969187-32-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 31/55] ps2: make ps2_raise_irq() function static 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This function is no longer used outside of ps2.c and so can be declared static. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-32-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 2 +- include/hw/input/ps2.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 9c046ac500..24c9853d37 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -172,7 +172,7 @@ void ps2_queue_noirq(PS2State *s, int b) q->count++; } -void ps2_raise_irq(PS2State *s) +static void ps2_raise_irq(PS2State *s) { s->update_irq(s->update_arg, 1); } diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 4be27de316..410ec66baf 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -102,7 +102,6 @@ void ps2_write_mouse(PS2MouseState *s, int val); void ps2_write_keyboard(PS2KbdState *s, int val); uint32_t ps2_read_data(PS2State *s); void ps2_queue_noirq(PS2State *s, int b); -void ps2_raise_irq(PS2State *s); void ps2_queue(PS2State *s, int b); void ps2_queue_2(PS2State *s, int b1, int b2); void ps2_queue_3(PS2State *s, int b1, int b2, int b3); From patchwork Sun Jun 26 17:45:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 287BAC433EF for ; Sun, 26 Jun 2022 18:12:07 +0000 (UTC) Received: from localhost ([::1]:48294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wju-0004cM-9o for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMT-0003uF-Gq for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:54 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45170) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMS-0000AK-5G for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:53 -0400 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=oSpM6Xi7UMvwmFWkzMU6tKEbxnTapoCEtahCdc3oDiI=; b=ptnqUNk8PmtBP4P1lDe+IgmmYr 620Q8H4X5agP4hpwEYpyKuw3tD51eJf0+8vM8rI+X5TBLz3gMCZ4TLLWTpVk/MjvDzQb33mLOg8yU U1H/wv5AIfBBuMt4HGvnYtRYblml+zVWhkLBcYEKBtd56XK8T2RWGofYY8RGRHi0Gfvt3YGRphfmz M0iB6t6jhh1Rndvr6ve4bbeoiax63AGwLA/boabCPPprHPhEUj1z74KfBJaNOrymSni8TfccU7uU3 xhpUbdg4BBgdruI+AEhIvWhD9r4bKgRHEJsxfrbC0I0xbK0ni4wvWU8Evwbyq39P3ygFPZlvHVgDC vTO/yY7sJ0UbKwS3/xZnLYtOIGf/VQCLxYIwrTnISvSj66yf/BNFXWyjN3HPc2HREXhCN8IvjmQ1S gCP+seGOwU+6KplcoClLPaBz5XPE9EoD23AOKj4WtmNoi0PvzhNmM9Z7/6btYtzyP+4UmLf2HrFGD 1bTH1cmYBSaYR6uO1Hf2Lray4VAtgqaH/Zfcw4QlB5P7yoIOHTVF5l8SAyEx0wVsoeA7yOzbLJuyL M/s/nwbrcer6hlwjhsCIod7wAmKGKx5mwlQxzK150tXR4+xopfaEvGWN6S3gVH8sMOlNyQh9bRtAO zv3ppmPgcN+tPCNa1gFHSnGEFADfm36rt1DOzoLU0=; 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 1o5WL4-0007KY-5J; Sun, 26 Jun 2022 18:46:30 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:08 +0100 Message-Id: <20220626174531.969187-33-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 32/55] ps2: use ps2_raise_irq() instead of calling update_irq() directly 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This consolidates the logic of raising the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-33-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 24c9853d37..a14281bc54 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -557,7 +557,7 @@ uint32_t ps2_read_data(PS2State *s) s->update_irq(s->update_arg, 0); /* reassert IRQs if data left */ if (q->count) { - s->update_irq(s->update_arg, 1); + ps2_raise_irq(s); } } return val; From patchwork Sun Jun 26 17:45:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895856 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6973AC433EF for ; Sun, 26 Jun 2022 18:17:01 +0000 (UTC) Received: from localhost ([::1]:38396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Woe-0008T0-Ex for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:17:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMX-0003xo-Ug for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:57 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMW-0000Al-2y for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:47:57 -0400 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=Y8I5iXHqcdgO10+xLFQE805ot4zcDs5uMhaH5m5DFE8=; b=x8iAwmEVpiv3cmrdbD9wmK6XQg IR85muHp/5nYFKa8dE4va/y1Y9w3pwXTeQHteAmpd36Iz2eEjEDXXl/Oi+AJRS7uRh3eDNpyHtR5v TYuLuOoftNFwdpxyRGwGG1bxlDSKzlQIJCIB/gYVRtQ4wb2+OJ3cqi3eOxtDDlsyxZ1rQ1al2XlM9 uB2epFuP/oDOsQxJdRFzh10nWLCWc5Fqhiln+bJjunJ7i96zAmXRPXMY4PIoCiVbhd1tltTPp/NHp S706Op+zMABxDgGUPrcufhnhX4f9sOcydgVXGRbqVlZljkKM5w3/sIkZakuVlM4GayOphdi5bYIvX 6Js8anuoHxR17ds0h6cWnVvAwrNpfzdaORxUdll1DeVCi/gI39ThkPlkMtjGOHniiKfbXcNMvS9tz lakj+MdvVvbvMoI9aYnflDyBWTXTuhl0ydFzFFv3onFzYOCB/eygRP9GwPet/1usfboDqwjeZuTJF GV0P9PiqtnlWNKpaaSSbqGyxeFk/7DkCCjwBYFegiSTJCtWQq3J4anXfSScJXFJShcPwYrYY8/ixR nBPwXczpGolgzhPEzTha1XrHMRMlN1va5phmboVv2kFrvy97wGal+I57V1BHCvuh7EYr7XChP2nq9 h4uOqfVFcvPsIWSe5aKsFOonbmnS8qjWj91e/sQoI=; 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 1o5WL8-0007KY-Bk; Sun, 26 Jun 2022 18:46:34 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:09 +0100 Message-Id: <20220626174531.969187-34-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 33/55] ps2: introduce ps2_lower_irq() instead of calling update_irq() directly 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This consolidates the logic of lowering the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-34-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index a14281bc54..bc0bcf1789 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -177,6 +177,11 @@ static void ps2_raise_irq(PS2State *s) s->update_irq(s->update_arg, 1); } +static void ps2_lower_irq(PS2State *s) +{ + s->update_irq(s->update_arg, 0); +} + void ps2_queue(PS2State *s, int b) { if (PS2_QUEUE_SIZE - s->queue.count < 1) { @@ -554,7 +559,7 @@ uint32_t ps2_read_data(PS2State *s) q->cwptr = -1; } /* reading deasserts IRQ */ - s->update_irq(s->update_arg, 0); + ps2_lower_irq(s); /* reassert IRQs if data left */ if (q->count) { ps2_raise_irq(s); @@ -1001,7 +1006,7 @@ static void ps2_reset(DeviceState *dev) s->write_cmd = -1; ps2_reset_queue(s); - s->update_irq(s->update_arg, 0); + ps2_lower_irq(s); } static void ps2_common_post_load(PS2State *s) From patchwork Sun Jun 26 17:45:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F509C43334 for ; Sun, 26 Jun 2022 18:13:52 +0000 (UTC) Received: from localhost ([::1]:56786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wlb-0001o1-Kq for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:13:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMb-00042b-Nj for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:02 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45182) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMa-0000B7-9N for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:01 -0400 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=b6iyRxUXG16P/L0+HBYWOtNM/81L10TPLi/mWAgu3cE=; b=gQJX1tZQ9QwgMbdofzVg1dLU7+ 5xKsybQU559TsZXrdYprj7FtD3wW1WWn4C+kMSjC6DnjjPHT/jOpdRkjb43qyHWKtqp5mU4nn90AR e6BFcIqefeeA8j9qPE9B7Ku0mvuQ9YVgv6EZ15I3Bya/T5VdbV/E0ONyJzYyAF3dT+OKWV4FLHcGT l8GTBw22vnZU4y9tyvWDAcLPU6pUOsY+AUr2YVXSfj0KRRJF1VPgcmyXG87niWt0iGWNqYwg8k73k 2jcIt5YyJAjhI7tHkVf4KOKUQCHIgeFJGfmlm6F+4SFT12jMUFiJy/xsZRoRLvI5ZdIS9/nkpyu4T iQpZ8fwV8EAeU2R+i0+TbG1x/cFUwO6IhkH3A50yNoYPoGGTjXNnd2tw2qyRx0rs04DHv/WfY3cVl mR7ogwmJLkAFAve8as6SXqm2+/kzbaF1H1q+Fcaov8f1kZZ6ERdrN9gAva0joJMAkjmjhXMprIBxU f7iMCbPkzGIJgM9blVLw3iZ+EvKDe5dk/vl/IEiroqujoXh/mRdYBOiAouq1UIkyH4xCxF+BHQnBc TCkgQ8A/4/UzWz7Wz5Prd2GLFDXxh28R3lEGWvT9+Hzqmh2g55k1GEtmZ9Av5x0Ae7AcLWISOkZuo QXQlQ0Y3nTPEeVz65kAoIzGCafDhcRv7efVmeDAko=; 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 1o5WLC-0007KY-7A; Sun, 26 Jun 2022 18:46:38 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:10 +0100 Message-Id: <20220626174531.969187-35-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 34/55] ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Define the gpio for the PS2 output IRQ in ps2_init() and add logic to optionally use it in ps2_raise_irq() and ps2_lower_irq() if the gpio is connected. If the gpio is not connected then call the legacy update_irq() function as before. This allows the incremental conversion of devices from the legacy update_irq() function to use gpios instead. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-35-mark.cave-ayland@ilande.co.uk> --- hw/input/ps2.c | 21 +++++++++++++++++++-- include/hw/input/ps2.h | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index bc0bcf1789..98c6206fb8 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" +#include "hw/irq.h" #include "hw/sysbus.h" #include "hw/input/ps2.h" #include "migration/vmstate.h" @@ -174,12 +175,20 @@ void ps2_queue_noirq(PS2State *s, int b) static void ps2_raise_irq(PS2State *s) { - s->update_irq(s->update_arg, 1); + if (qemu_irq_is_connected(s->irq)) { + qemu_set_irq(s->irq, 1); + } else { + s->update_irq(s->update_arg, 1); + } } static void ps2_lower_irq(PS2State *s) { - s->update_irq(s->update_arg, 0); + if (qemu_irq_is_connected(s->irq)) { + qemu_set_irq(s->irq, 0); + } else { + s->update_irq(s->update_arg, 0); + } } void ps2_queue(PS2State *s, int b) @@ -1305,6 +1314,13 @@ static const TypeInfo ps2_mouse_info = { .class_init = ps2_mouse_class_init }; +static void ps2_init(Object *obj) +{ + PS2State *s = PS2_DEVICE(obj); + + qdev_init_gpio_out(DEVICE(obj), &s->irq, 1); +} + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -1316,6 +1332,7 @@ static void ps2_class_init(ObjectClass *klass, void *data) static const TypeInfo ps2_info = { .name = TYPE_PS2_DEVICE, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = ps2_init, .instance_size = sizeof(PS2State), .class_init = ps2_class_init, .class_size = sizeof(PS2DeviceClass), diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 410ec66baf..5422aee9aa 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -50,11 +50,15 @@ typedef struct { int rptr, wptr, cwptr, count; } PS2Queue; +/* Output IRQ */ +#define PS2_DEVICE_IRQ 0 + struct PS2State { SysBusDevice parent_obj; PS2Queue queue; int32_t write_cmd; + qemu_irq irq; void (*update_irq)(void *, int); void *update_arg; }; From patchwork Sun Jun 26 17:45:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF658C433EF for ; Sun, 26 Jun 2022 18:19:33 +0000 (UTC) Received: from localhost ([::1]:46982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wr5-0005qo-PS for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:19:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMg-00046c-2H for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:11 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMe-0000BI-4s for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:05 -0400 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=ET6Qr9qwFkYBCBzPcwCVTQxz52+wcmPrWIHSlxt45r8=; b=w/HuMTeWhIV3fETLZRNlZd1c6m +m32cnHKOk+15QeOvRqjjdOpULmthRtrfDKzmeJ7PCJO/RbA+PqrC389izHF2Z9lyDZvZ4+xz4/iC xJQUDtiDCrAPWObl8eFiivtsSD223VXgsmkKwHfgncGCfjGrH+5XBgiXBM/lXQXBIdVX6xZ2WCU5W kZT6NcEhtVUfsfCtAj3sQ8harwzgq4bxZ/gXWyGf39fjFQI59/iuusTue2giyg87S44OBkXEGNLvx 2SKRpjJicrupSR9jtAbuAuf+FD7p6TobaETzZs5WwgBQp9y6kn4d6i96uVr904ffa5wMNZvlYUV+7 RrnZrxMOb6DERg5dqdlch9bNosSR3kktxkjxpc6MtRSN4Em56HXRPhe4JHK8j+iOAvK79Eu3eP/zM adKXNKvARvw83HtAsFqgWlk7p+2qc9Vldm+AfhgWq7tcA8BtCrE7gn9dp0GqeHcGb0ZZzvwxuqqhQ odGs86/vyZyQotjvMW59Kf8t6rLB/0AdWBuQ/Sv2yJ5fcrYpBt1BpHj1tkhh0BokOnheI5VWiiN7c zTMiagAL9fQV6omH6Z3zy2OVcqwztc6TOmpTLcnauA29VCDQDGubiqndQV8Y3RPnZPd8GFwS8tLSw 2X5cV1r25vnB39OfcY5f7FCHwp4amsYAHWtW4g0WE=; 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 1o5WLG-0007KY-F6; Sun, 26 Jun 2022 18:46:42 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:11 +0100 Message-Id: <20220626174531.969187-36-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 35/55] pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This allows both IRQs to be declared as a single qdev gpio array. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-36-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 12 ++++++------ include/hw/input/i8042.h | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 72843f770e..5d7c969fc6 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -170,8 +170,8 @@ static void kbd_update_irq_lines(KBDState *s) } } } - qemu_set_irq(s->irq_kbd, irq_kbd_level); - qemu_set_irq(s->irq_mouse, irq_mouse_level); + qemu_set_irq(s->irqs[I8042_KBD_IRQ], irq_kbd_level); + qemu_set_irq(s->irqs[I8042_MOUSE_IRQ], irq_mouse_level); } static void kbd_deassert_irq(KBDState *s) @@ -726,8 +726,8 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = &I8042_MMIO(dev)->kbd; - s->irq_kbd = kbd_irq; - s->irq_mouse = mouse_irq; + s->irqs[I8042_KBD_IRQ] = kbd_irq; + s->irqs[I8042_MOUSE_IRQ] = mouse_irq; return I8042_MMIO(dev); } @@ -813,8 +813,8 @@ static void i8042_realizefn(DeviceState *dev, Error **errp) return; } - s->irq_kbd = isa_get_irq(isadev, isa_s->kbd_irq); - s->irq_mouse = isa_get_irq(isadev, isa_s->mouse_irq); + s->irqs[I8042_KBD_IRQ] = isa_get_irq(isadev, isa_s->kbd_irq); + s->irqs[I8042_MOUSE_IRQ] = isa_get_irq(isadev, isa_s->mouse_irq); isa_register_ioport(isadev, isa_s->io + 0, 0x60); isa_register_ioport(isadev, isa_s->io + 1, 0x64); diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 9d1f8af964..4ba2664377 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -12,6 +12,9 @@ #include "hw/sysbus.h" #include "qom/object.h" +#define I8042_KBD_IRQ 0 +#define I8042_MOUSE_IRQ 1 + typedef struct KBDState { uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ uint8_t status; @@ -31,8 +34,7 @@ typedef struct KBDState { void *mouse; QEMUTimer *throttle_timer; - qemu_irq irq_kbd; - qemu_irq irq_mouse; + qemu_irq irqs[2]; qemu_irq a20_out; hwaddr mask; } KBDState; From patchwork Sun Jun 26 17:45:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9F85C433EF for ; Sun, 26 Jun 2022 18:11:50 +0000 (UTC) Received: from localhost ([::1]:46830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wjd-0003cP-TP for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:11:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMl-00048K-Tp for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:14 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMi-0000Bo-8R for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:09 -0400 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=Nt/5+eB9QW9rdJcmBBwJHYEcRho05ayp0AUk0xz9jZI=; b=AKQi/Wn/N+DcsaThVykeyxJcow gCnwPkKy2vEBSVTIDdBzgnP/koq86xp7AtsuGTRd9zpBJhlyzTWRhKYVo69AEsdYLygcBZkPnvBfp 82KLaiKBU+5BPu+ft9b7QlqhCXT/nsgKKKvsh8wARAoDDDdjD55H9/RjEcnwv/Vd1bEnyC4mFOAAp HCRHBDKPCMs4BeLcsa3gr3IJaw+c7uOjmdrJCW+DGX/E0WlZE9fRSm6TaV1rv3Bb+VYYi1gymlhEE Z/e/4S+jSFqhG8niUAvBBJ6MNP/tWhRBpIsZ96e4IXG4UebcBioGAF5ooWvqQRPhtqTyuRscegYXH iOO045atOLH/RXAMHoFXRIynwrCVZ1+0M9sFME0/zWVQz3FtDkzO/O2xw4TyoU4uAMprft8ci/yug pLBV+GmHUy6pCEU6DWj/9ClDvy/Zx+KzaCi364G+zz6fwE1xTQFhHbA95SVrm8scOppeL4xm2T6UA EQ/Hbv0a516A4zT/Npty8zis9PYVh9CM9tHesWk2FO5pWtT/97qN5d47IR+wlJPPgPWEgL5sHRAVx ZDVRYZb5m7FecXAhJcq26d9lC1bP+vXDhcoNxF4Mtlx+y2mjQH/9uBniluWcqvMeoJCwfZLssitUJ 0MXUD3qhU7sKebJDl7yMp0sMPU3wYHxQl6GtW+EMs=; 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 1o5WLK-0007KY-Ag; Sun, 26 Jun 2022 18:46:46 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:12 +0100 Message-Id: <20220626174531.969187-37-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 36/55] 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add a new pl050_init() function which initialises a qdev input gpio for handling incoming PS2 IRQs, and then wire up the PS2 device to use it. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Message-Id: <20220624134109.881989-37-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/pl050.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 66f8c20d9f..c665a4fc99 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -65,7 +65,7 @@ static void pl050_update_irq(PL050State *s) qemu_set_irq(s->irq, level); } -static void pl050_set_irq(void *opaque, int level) +static void pl050_set_irq(void *opaque, int n, int level) { PL050State *s = (PL050State *)opaque; @@ -164,10 +164,12 @@ static void pl050_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev = ps2_mouse_init(pl050_set_irq, s); + s->dev = ps2_mouse_init(NULL, NULL); } else { - s->dev = ps2_kbd_init(pl050_set_irq, s); + s->dev = ps2_kbd_init(NULL, NULL); } + qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-input-irq", 0)); } static void pl050_keyboard_init(Object *obj) @@ -196,6 +198,11 @@ static const TypeInfo pl050_mouse_info = { .instance_init = pl050_mouse_init, }; +static void pl050_init(Object *obj) +{ + qdev_init_gpio_in_named(DEVICE(obj), pl050_set_irq, "ps2-input-irq", 1); +} + static void pl050_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -207,6 +214,7 @@ static void pl050_class_init(ObjectClass *oc, void *data) static const TypeInfo pl050_type_info = { .name = TYPE_PL050, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = pl050_init, .instance_size = sizeof(PL050State), .abstract = true, .class_init = pl050_class_init, From patchwork Sun Jun 26 17:45:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11F66C43334 for ; Sun, 26 Jun 2022 18:22:57 +0000 (UTC) Received: from localhost ([::1]:55180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WuO-0003BB-5N for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:22:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMo-00048s-CN for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:15 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMm-0000Cb-FQ for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:13 -0400 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=eZwtXKiZwI5c1fcTdneXtq4K3yDO5HLTy0rKYDtmtLE=; b=YML/Jqnt48MpoSWfwLxsGIzoRt BJJcwFFoFYBV7JbBu8UOXLrTjl6YLJ9LSH2WJ4r8tCT4tM+Ub3JuiD1gjh3DhC4J0SNl/r1a+2b8m 1jOQYUtaO6z+wO8zDijKawOHDfi2yf5fe5Jqu0B1JjHYNoJnEns0KXoogzJv2XXa10MsT4UHn5zWE Md0p7LqIMqAtLZbqFTsRT1wkoX0poofN773fPgemXqbEI0x9GIVip/OX8pyv/cDaKoJk6++TvhP0V UhHjnN2wmFCuu+2gX8M4bunYYvY4sFh8KTRUKb1bpHn3TMjf2VWPy6zJaTteswfkgknESZwEBfDJX hweZAejBwZXP78ZR+qf4joyJt+SDUyHdNtVb9NPvbmIRdy1rV6hxFpWNLItbn+fN9VFg23JWUTgFz CQS0YD97LefwQM6tjqqRgwwSMtMLSWtjlRLvkkecBR3gaUAc71zfUZT4V8aRYuVjGql5njURdRlhd r/ENSueXnCFaX4nv84sSe9JvaxHHR29AwmS3ohWR+NSjfQ01tmxNQuZ3UoDXCZBxQdLT3j5f5MV0t alpR131WDjehBTVFQr6mv3KFNk9Q9M22mUcKrpxxosyvwnuvOP0znf9t++Z4WwHSf5ooxGGPJsXiZ i4wsJe64JjM0ipF3pRIs137A7w+4WSAig8YIXvBz0=; 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 1o5WLO-0007KY-FU; Sun, 26 Jun 2022 18:46:50 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:13 +0100 Message-Id: <20220626174531.969187-38-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 37/55] pl050: add QEMU interface comment 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This describes the PL050 device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Message-Id: <20220624134109.881989-38-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/pl050.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index c665a4fc99..ffaa72dea4 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -7,6 +7,14 @@ * This code is licensed under the GPL. */ +/* + * QEMU interface: + * + sysbus MMIO region 0: MemoryRegion defining the PL050 registers + * + Named GPIO input "ps2-input-irq": set to 1 if the downstream PS2 device + * has asserted its irq + * + sysbus IRQ 0: PL050 output irq + */ + #include "qemu/osdep.h" #include "hw/sysbus.h" #include "migration/vmstate.h" From patchwork Sun Jun 26 17:45:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A809EC43334 for ; Sun, 26 Jun 2022 18:16:50 +0000 (UTC) Received: from localhost ([::1]:37720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WoT-00081t-KB for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:16:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMu-0004HT-1P for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:20 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMq-0000Cp-LF for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:18 -0400 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=dj4b93yQlcecz4RK3yXUrii0j6rqBshDKqbsmXi6h5Q=; b=C5kYLhjJdjAnwLrVTRsLTS+MtB 69odJnEWvXd7+0M3DQ33+d6Qq2vrIFRvEno2OOoc6sOgPJlD6IX1cNYHzvgyqQPUFunEoE113es0M HdKvZRNyCkK6wxxvZ5YI1efHyqWOQSz4yp/VGN//SwWlriT32xf4vMcNarWrRzbjpHKYAxcgKRSGY b43Q1yel8WbCWuXC7m+i+1Z4d09q9WUHo2xWjqx4Y0Awa1mT+rJCBz3q+A7yRnmBRWg/ERxiDK90I AIPYpua9A7NZ0gV8RS7UREwQE/gQA4YQVDN9P9E3e3RNbEQMDPirZrWPggoNanwsoLHjFpY3LdJhy vBcSwuv09LST6AB1RTASjPHRKdR5+FRwIxJBD5m+mmCEO4neBsBxon8oPvAGAeWiprn33rjtel0U6 LQoWMyOD5TQc344SCcNqT7K+fggWLspbaQeEYFhcSOnjCQ/E1evgoo0L+c4AXgGpcjel5vfpgUTWs hiA2f9qe3E+seTdGMCWsOn8ORpAVkOjJTS943N7o2X+up1558E7AyNAnj8BcHSn8KySIl/vh9JYAU 3ChvheeyqXNsAT9K/rIN8Y5fuJUQpdE2aib0Tpx5g9tK30lM3McWMzjHvPWV4KSUWodRD/usM7FrQ 1hT+yptqycEA94ldubKt14mVvZB0E+WV/f7ilFr50=; 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 1o5WLS-0007KY-JY; Sun, 26 Jun 2022 18:46:54 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:14 +0100 Message-Id: <20220626174531.969187-39-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 38/55] lasips2: QOMify LASIPS2State 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Currently lasip2_init() creates a new LASIPS2State directly which is used by the HPPA machine. Introduce a new LASIPS2 QOM type that will soon be used to allow the HPPA machine to be wired up using standard qdev GPIOs. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-39-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index adfde1684f..db0a791e6c 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "hw/qdev-properties.h" +#include "hw/sysbus.h" #include "hw/input/ps2.h" #include "hw/input/lasips2.h" #include "exec/hwaddr.h" @@ -31,6 +32,7 @@ #include "exec/address-spaces.h" #include "migration/vmstate.h" #include "hw/irq.h" +#include "qapi/error.h" struct LASIPS2State; @@ -45,11 +47,16 @@ typedef struct LASIPS2Port { bool irq; } LASIPS2Port; -typedef struct LASIPS2State { +struct LASIPS2State { + SysBusDevice parent_obj; + LASIPS2Port kbd; LASIPS2Port mouse; qemu_irq irq; -} LASIPS2State; +}; + +#define TYPE_LASIPS2 "lasips2" +OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) static const VMStateDescription vmstate_lasips2 = { .name = "lasips2", @@ -265,8 +272,11 @@ void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq) { LASIPS2State *s; + DeviceState *dev; - s = g_new0(LASIPS2State, 1); + dev = qdev_new(TYPE_LASIPS2); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = LASIPS2(dev); s->irq = irq; s->mouse.id = 1; @@ -286,3 +296,16 @@ void lasips2_init(MemoryRegion *address_space, "lasips2-mouse", 0x100); memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg); } + +static const TypeInfo lasips2_info = { + .name = TYPE_LASIPS2, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(LASIPS2State) +}; + +static void lasips2_register_types(void) +{ + type_register_static(&lasips2_info); +} + +type_init(lasips2_register_types) From patchwork Sun Jun 26 17:45:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F980C43334 for ; Sun, 26 Jun 2022 18:19:20 +0000 (UTC) Received: from localhost ([::1]:45958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wqt-00059a-JK for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:19:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMx-0004M0-Ut for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMv-0000Cy-MV for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:22 -0400 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=w5mQUtXpv4wruk+LCaB0jufzVeLYciUHNK7tvuIMIzo=; b=1MJDnqRDf+NHq9Ec6Y3yqJazic NcyA9X9gzB3hmE8HlKONyVTMwhfzm1gPOXyJwPG/sSy7NwUvqlgtFOc7apS11vgD9WjvfJUG4o7+1 d8W8/3xcqv59WGWPC5vIM7U8QzXGBzoP373ZcRwvypgOjkKYcX0Lpmr5vOoZRabGZ1nf+BGnRvi3y 4RuJYF137W4tqp4awu07lv3rYGZ6Uvh9rO8LM3gG7iF+R0zUp/+kkUDQzWNiuvMLhK2JSFA544r6Q 6++ATWJBape8rEKTgkqgkstFdWySM57YU1ug71qcs1LNzdoISnFyGTCz7Th8gBh5QoQCfr36pvc1p jtJafmFIWMq3a01fnEHIqGYra9oJ7HtNsPnFH5mrWYnrgXwG0lE54bp5lSxKmIRYTn39bJC5QAfUj lgDSOL3kH9af7mL2lFZd2bHX3rmz5p1zjQ3j7Wq2ZXjZ0vZ9cuxlp5tSG7RRf+Jsf8gNfdJMtrnPB 5pGSAPQE+HANcGfycmipN4Mrg8jVFxvcTwHYgqIiuu6E0XtuOnuAtOzuP1l9fhKRhBYAUcOC869cC d8nHZ9u6NQLoSfv9lyeeS1gXBizqCUQIUFjjkgTQm9EShGNJhKBSq3Hupiyhjtfsu0tRHbVnsb88h Gp1cj5QUSPBOZvem1HFzxZjA2SDjKLBo3KRb7JCzY=; 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 1o5WLW-0007KY-RD; Sun, 26 Jun 2022 18:46:58 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:15 +0100 Message-Id: <20220626174531.969187-40-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 39/55] lasips2: move lasips2 QOM types from lasips2.c to lasips2.h 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This allows the QOM types in lasips2.c to be used elsewhere by simply including lasips2.h. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-40-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 23 ----------------------- include/hw/input/lasips2.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index db0a791e6c..2caa80bd3c 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -35,29 +35,6 @@ #include "qapi/error.h" -struct LASIPS2State; -typedef struct LASIPS2Port { - struct LASIPS2State *parent; - MemoryRegion reg; - void *dev; - uint8_t id; - uint8_t control; - uint8_t buf; - bool loopback_rbne; - bool irq; -} LASIPS2Port; - -struct LASIPS2State { - SysBusDevice parent_obj; - - LASIPS2Port kbd; - LASIPS2Port mouse; - qemu_irq irq; -}; - -#define TYPE_LASIPS2 "lasips2" -OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) - static const VMStateDescription vmstate_lasips2 = { .name = "lasips2", .version_id = 0, diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 0cd7b59064..ddcea74c14 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -8,8 +8,30 @@ #define HW_INPUT_LASIPS2_H #include "exec/hwaddr.h" +#include "hw/sysbus.h" + +struct LASIPS2State; +typedef struct LASIPS2Port { + struct LASIPS2State *parent; + MemoryRegion reg; + void *dev; + uint8_t id; + uint8_t control; + uint8_t buf; + bool loopback_rbne; + bool irq; +} LASIPS2Port; + +struct LASIPS2State { + SysBusDevice parent_obj; + + LASIPS2Port kbd; + LASIPS2Port mouse; + qemu_irq irq; +}; #define TYPE_LASIPS2 "lasips2" +OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); From patchwork Sun Jun 26 17:45:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78215C433EF for ; Sun, 26 Jun 2022 18:17:54 +0000 (UTC) Received: from localhost ([::1]:41064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WpV-0001sd-Gm for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:17:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WN1-0004Ot-M8 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:27 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMy-0000DN-5t for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:26 -0400 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=aKFbRIcWFNZtWWNVhHZBz+4+ChCToO0MtBXjzfrTaQU=; b=bYRI+ekd11RIVbOozf9UpGMudL 0t3dJh7X3KRHqSricPo5ZoMJlPrmyLXlOBJVEqWaIrLxUE1d6JP+E/kuujgMnaJCyAANoSfrVirjK 3yjtG0ERzd5nMSmlyOIGcEfbWHoIs3U2nrINKm5EqmxZc5gyThlSUdFvTI7lxBn2aMvcsvVK8MTJj EqtpqK4KLm2p7lFn2LRXuajmM3tERlNRWpybTot3DbuMilcKqVtesr8vFYX3W0P2el1sGpe9fuef4 +qBiVKnQxdBFTpg0l6lcDEyHkUAHLSmu0P613pLoH6OisiTMqYeI54tOWpHiosyKz6DFEGaGYD32w QnF3rQqGMgEeqQdyt16EZ0jO33Aq+S71oVTfP/W3CjrMr3iVKm/bVSlUug7ImmGFWnRqXZJFUV7Dv I707FXgziRJ/RuC1zSJ+syowNoAVKd04zbqU81C08mXV4KA6acgrf3PTNl5pLekzZFnEnWCrzwpLK SDS33apH0G7yINscB5hgf+MAJtNUC6j73aq8NQCcJiOxjqtyrB/C7JkfgRgawjNQj02oNIrAjRwAs Tjfocb8FdfOv+sOMiumzKhjOMvExwUb4qX4quGF7lLSwb3XR+c0KsPTwwULRyYfCOl2qJFIeBB6Pw SXNglx98C/EV+/VTDY9GVAKAgRYfaldAZyetuAL+0=; 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 1o5WLa-0007KY-Ng; Sun, 26 Jun 2022 18:47:02 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:16 +0100 Message-Id: <20220626174531.969187-41-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 40/55] lasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS2 device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" When QOMifying a device it is typical to use _init() as the suffix for an instance_init function, however this name is already in use by the legacy LASIPS2 wrapper function. Eventually the wrapper function will be removed, but for now rename it to lasips2_initfn() to avoid a naming collision. At the same time update lasips2_initfn() return the LASIPS2 device so that it can later be accessed using qdev APIs by the HPPA machine. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-41-mark.cave-ayland@ilande.co.uk> --- hw/hppa/machine.c | 4 ++-- hw/input/lasips2.c | 6 ++++-- include/hw/input/lasips2.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 63b9dd2396..72677aeb2a 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -280,8 +280,8 @@ static void machine_hppa_init(MachineState *machine) } /* PS/2 Keyboard/Mouse */ - lasips2_init(addr_space, LASI_PS2KBD_HPA, - qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA)); + lasips2_initfn(addr_space, LASI_PS2KBD_HPA, + qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA)); /* register power switch emulation */ qemu_register_powerdown_notifier(&hppa_system_powerdown_notifier); diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 2caa80bd3c..85da4081e3 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -245,8 +245,8 @@ static void lasips2_port_set_irq(void *opaque, int level) lasips2_update_irq(port->parent); } -void lasips2_init(MemoryRegion *address_space, - hwaddr base, qemu_irq irq) +LASIPS2State *lasips2_initfn(MemoryRegion *address_space, + hwaddr base, qemu_irq irq) { LASIPS2State *s; DeviceState *dev; @@ -272,6 +272,8 @@ void lasips2_init(MemoryRegion *address_space, memory_region_init_io(&s->mouse.reg, NULL, &lasips2_reg_ops, &s->mouse, "lasips2-mouse", 0x100); memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg); + + return s; } static const TypeInfo lasips2_info = { diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index ddcea74c14..5a35c22f73 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -33,6 +33,7 @@ struct LASIPS2State { #define TYPE_LASIPS2 "lasips2" OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) -void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); +LASIPS2State *lasips2_initfn(MemoryRegion *address_space, hwaddr base, + qemu_irq irq); #endif /* HW_INPUT_LASIPS2_H */ From patchwork Sun Jun 26 17:45:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 221D8C433EF for ; Sun, 26 Jun 2022 18:26:15 +0000 (UTC) Received: from localhost ([::1]:35444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wxa-0000dQ-0I for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:26:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WN1-0004Or-LW for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:27 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WMy-0000DQ-H4 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:26 -0400 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=LeXiucJ8qhCBXXYLXa1/WdtxadtXPiU4qX02evmxMlw=; b=amK46NNNNlGdlyOUVZ78iTZ+/z LkNg9bZmMVIKNyNM0AxKraB0/gah2yIezot5cVGi+/dLTwNDsFJeXus+Op+adCXfpjsLE3fZq0LZs Evan0RyaGtkXrTnHksYrPgl4XbgUl1Qi0HZGxc8tsSOlPo19+jE+QFMTnz4pqeswH6CQ1Jc2ZUnMu UZYm2huMF2XUxZMah1hy1U0PxdA5T7x0lMpif15U72msPYSTa7gu0cRpb9xZQuW3RCRo55PeVVEXr 8jRMPCI3pbGCk127ZAXLJ/OBI25Af0wMjYS/iXjmSfOCChzi0i6IsVAdbMCQD6x7+ru5Bskak+uWv 3929jO5tuQrhBOZPaERC3CkUi/GgM6jyNNHnQ//CZ7EuYTauylp1JoBJe/FMgCSH+9D//QuZwGnMe cuOspfCVspDv4nzhE37/YY7sPWdCImyES6a+2j6QvtoNhlC+LN0H68Ugb8u6XvrdS5lRxc0DY0cdT 8eSwNVpNz2i0B1jyWHG0HpgDQ8lfDMDsKROMpdKlC5nkyOiOEQgteaOsvSCEZwI6l5Kh8KZWJ9cBQ MSoLYmZD1vWlyOIY5ocbnrXztnRs80FBlUcXKHvpmLdeenrT8kxeDnxdcLFtkZdiN0KgimMueYSsw bgM5RJCRwsd6m9jeuXfC5HKZzx59JDO2O8k/2gatA=; 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 1o5WLe-0007KY-AA; Sun, 26 Jun 2022 18:47:02 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:17 +0100 Message-Id: <20220626174531.969187-42-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 41/55] lasips2: implement lasips2_init() function 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move the initialisation of the keyboard and mouse memory regions to lasips2_init() and expose them as SysBus memory regions. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-42-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 85da4081e3..8d3a2d88e8 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -265,20 +265,30 @@ LASIPS2State *lasips2_initfn(MemoryRegion *address_space, s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); - memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd, - "lasips2-kbd", 0x100); memory_region_add_subregion(address_space, base, &s->kbd.reg); - memory_region_init_io(&s->mouse.reg, NULL, &lasips2_reg_ops, &s->mouse, - "lasips2-mouse", 0x100); memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg); return s; } +static void lasips2_init(Object *obj) +{ + LASIPS2State *s = LASIPS2(obj); + + memory_region_init_io(&s->kbd.reg, obj, &lasips2_reg_ops, &s->kbd, + "lasips2-kbd", 0x100); + memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse, + "lasips2-mouse", 0x100); + + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->kbd.reg); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); +} + static const TypeInfo lasips2_info = { .name = TYPE_LASIPS2, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = lasips2_init, .instance_size = sizeof(LASIPS2State) }; From patchwork Sun Jun 26 17:45:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EF79C433EF for ; Sun, 26 Jun 2022 18:20:07 +0000 (UTC) Received: from localhost ([::1]:49632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wre-0007ap-4q for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:20:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WN5-0004Sl-Gh for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:31 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45230) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WN2-0000Dp-2E for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:30 -0400 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=OtrVDbFDL/E9B/0ydD5nzT50LewpUskAQenLIPnEueY=; b=WlMLRW4/4KZX48TvvvJSjLFD9J mn7h8biqm+Bd9aPhNyXtMgQTiLjcCtxvOs9+8S1ppyBab9WTww5cGh8hYgCNMmKiFazjbmUdC1+vD KWGvExx5m93XWbdHysJHCBl8/dnsjWA2Fdb6Nz4BWkdz+sJBVq25nTImRRLrQIQyDXzVm58bK+zzT K8UHD07TVYP8l1umQC0bwI4PyIGF+BWKqLjQ+KMuzhLpfWlZkXcLmP1w01NlV5TqODggCh4HX7NsI d7MnisrmVVQNuV/Abp6oD2moqNDhYK4EPXL4eWm3/I31Ky+/5trxCteCY1mKxUMxlhKg/rUBd7NhD MIIS1YsWTQnLXK1Y9eD71hxnY16HCdeIzC+oLC7boVzFJHALzqOL5Po88SUl2Dp+leKf9o1BinMdf IhlFzPxcIw4sIGU1UzlPnN0dbbDqxec8TwT1ZfyIIaEUUPlv74VqO47c6mgMowTMzQSV1bohBKfu7 mEugl+hBSNfRo1174eXcCjWfpfvL/ZyU0RveXdYdxE2qw+/8q1f+NaUHCuvL63JEhypFOs0VZ7mJ2 sp04T1A7wLuNl0E43ixwejnAHYPPdO3/Xy31wIbIfiU7VsZUEms/JdLMvqP/tJSbA0OGEB/6JSlUk gmpQteHvbZ5ZCHyBLY0HaMRCJmMEXwqa3YQRydmv4=; 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 1o5WLe-0007KY-MH; Sun, 26 Jun 2022 18:47:06 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:18 +0100 Message-Id: <20220626174531.969187-43-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 42/55] lasips2: move mapping of LASIPS2 registers to HPPA machine 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Now that the register memory regions are exposed as SysBus memory regions, move the mapping of the LASIPS2 registers from lasips2_initfn() to the HPPA machine (which is its only user). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-43-mark.cave-ayland@ilande.co.uk> --- hw/hppa/machine.c | 11 +++++++++-- hw/input/lasips2.c | 7 +------ include/hw/input/lasips2.h | 3 +-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 72677aeb2a..44ecd446c3 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -280,8 +280,15 @@ static void machine_hppa_init(MachineState *machine) } /* PS/2 Keyboard/Mouse */ - lasips2_initfn(addr_space, LASI_PS2KBD_HPA, - qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA)); + dev = DEVICE(lasips2_initfn(LASI_PS2KBD_HPA, + qdev_get_gpio_in(lasi_dev, + LASI_IRQ_PS2KBD_HPA))); + memory_region_add_subregion(addr_space, LASI_PS2KBD_HPA, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), + 0)); + memory_region_add_subregion(addr_space, LASI_PS2KBD_HPA + 0x100, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), + 1)); /* register power switch emulation */ qemu_register_powerdown_notifier(&hppa_system_powerdown_notifier); diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 8d3a2d88e8..84e7a1feee 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -245,8 +245,7 @@ static void lasips2_port_set_irq(void *opaque, int level) lasips2_update_irq(port->parent); } -LASIPS2State *lasips2_initfn(MemoryRegion *address_space, - hwaddr base, qemu_irq irq) +LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) { LASIPS2State *s; DeviceState *dev; @@ -265,10 +264,6 @@ LASIPS2State *lasips2_initfn(MemoryRegion *address_space, s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); - memory_region_add_subregion(address_space, base, &s->kbd.reg); - - memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg); - return s; } diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 5a35c22f73..b9723073e1 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -33,7 +33,6 @@ struct LASIPS2State { #define TYPE_LASIPS2 "lasips2" OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) -LASIPS2State *lasips2_initfn(MemoryRegion *address_space, hwaddr base, - qemu_irq irq); +LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq); #endif /* HW_INPUT_LASIPS2_H */ From patchwork Sun Jun 26 17:45:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97F27C43334 for ; Sun, 26 Jun 2022 18:23:48 +0000 (UTC) Received: from localhost ([::1]:58062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WvD-00055o-MB for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:23:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WND-0004a4-95 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45236) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WN7-0000F7-NX for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:38 -0400 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=+4hIj16/wprw9VgDB1xXkfyh0tpZIWUMpPR7C0Xt1J4=; b=szzbBnVonfpOppxjflOnR/fic9 EJv/VebJfNz9AVf48360ft+hOtEaxEEdsdbDjOz+oz6ROY8yfGjFaZZlT87YjAzFGp/2leWS3zpbH eNt5zdYnYp4Tboh22s8Okc7RvwUwjtDH5kWHQOjk2g2Ny9nmRPq3J4Nhgzy0S6SJTBvc2PkdOkgrt LdeWrQUZ0Z1KHLvzIznoXoJZLE/ewHT7OgnnA/g17XAOScKUPy2Akfq9itpVAMngUSDe5JFDyTyu2 w0Hntplchh9mEz4uCR9taCySIioWTKOxhXfI0KCF/oRPiJtNr3I2hoW22K4ZEO127L0Kqun1PsRd4 O3rBPE+t5WpA0oNsUApvxYWG0P7StrFvz2QpUry5iDoA3Grtglx25mzc0li0iXHDeqlyCdjpEdIlB stEHlp34ZTbN81d2X7VTAGRve3pwtw+PMgjNcIYKDr9UQJMaesIH4Sc/Ya1isuToj5DhhPuDnYNOj Ju/L3V027CuA4ettAUvN6GZhGNdZ1LjsMUhz6wxFqBUabQvI6q5ST0l6k2JjaduLzKDFGno0b3NVF j1cZZP2ExNWTFBsVRuezc7/HzUxGYuzyba3Sx+o6H73IS64a07H1DNXGJeY71whbsFSSunb7EzuDM zC9AmGP+5Z8JOR4LNwPGSsSp46uZqeCEc9irUyl2w=; 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 1o5WLi-0007KY-6Y; Sun, 26 Jun 2022 18:47:10 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:19 +0100 Message-Id: <20220626174531.969187-44-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 43/55] lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This can be improved once the ps2_kbd_init() and ps2_mouse_init() functions have been removed, but for now move the existing logic from lasi_initfn() to lasi_init(). At the same time explicitly set keyboard port id to 0, even if it isn't technically required. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-44-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 84e7a1feee..bd89c03996 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -255,9 +255,6 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) s = LASIPS2(dev); s->irq = irq; - s->mouse.id = 1; - s->kbd.parent = s; - s->mouse.parent = s; vmstate_register(NULL, base, &vmstate_lasips2, s); @@ -271,6 +268,11 @@ static void lasips2_init(Object *obj) { LASIPS2State *s = LASIPS2(obj); + s->kbd.id = 0; + s->mouse.id = 1; + s->kbd.parent = s; + s->mouse.parent = s; + memory_region_init_io(&s->kbd.reg, obj, &lasips2_reg_ops, &s->kbd, "lasips2-kbd", 0x100); memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse, From patchwork Sun Jun 26 17:45:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3810CC43334 for ; Sun, 26 Jun 2022 18:29:40 +0000 (UTC) Received: from localhost ([::1]:43760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5X0t-0006Pd-Ao for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:29:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WND-0004a5-9q for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45242) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNB-0000FO-Dl for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:38 -0400 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=p3UvMcGPT0tWv6H2blfLWWDsh94xXwoz6z/4ub3DHwU=; b=bMstN+D0OT5FVxDjGsmaEgu64j E9C5g0uGe1BRkV1//vJH74GaOhkyfgE7AiYBPfxtypOnBqky1HH88w0whKfu9X1ctNOsYcbjs4DI2 8XenLA9kPxP32favqZfSwCqPiM0Fd9k+hsHXJ0xc3QWeBkwqlENg3tpyfcQdaDWcuqbGt4VrjsXNw 8LgoiYf+1Im5PSx1pwOflWWgPKpjPgam01/ybSgjiiCzVhfmM4NHzT/30Ym26/g4hPZKl7hLuwqWj B2O3ldvJbzBAzNhKOqGoljfwB22ZsA9dWXDy6VKADMlDoGM3cTqlcYdGuU1VX7h10P8jaU3yZt6ci HEuIy4raoCOGfL5SAVLsgV+vMuf9EBSqBCo2dXsZwqBcIyEBsxrWp5SbQh0/NIOESrW25P4BxRvxc oDHTsXwoyTw2MQbYWJjiiMV2jGFmON4nwFrYN5Uti14h7WdBrB7/6p03fysY3jZhB6cI25h2eAxhA 9VK3bXvJBxUP/ZrDUtN+b5vrCnZxdN4nQLKaxbxQlsDDi9BnwDGB4c02hLRSC/f7RAwJzSVIMhVI3 jBSKWBYfytJ2wu6NGgD6US8ARayQ56nvA1li/OfMCdxQOWt7wtILc+fMS3PqWMzUWd/3ooW7UhbzD Uz9sLhcAVOJAycUz2uSITNZqwF8+YEQR5ZPGd333Q=; 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 1o5WLm-0007KY-DD; Sun, 26 Jun 2022 18:47:14 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:20 +0100 Message-Id: <20220626174531.969187-45-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 44/55] lasips2: add base property 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This is in preparation for handling vmstate_register() within the device. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Message-Id: <20220624134109.881989-45-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 17 ++++++++++++++++- include/hw/input/lasips2.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index bd89c03996..81beb5b614 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -251,6 +251,7 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) DeviceState *dev; dev = qdev_new(TYPE_LASIPS2); + qdev_prop_set_uint64(dev, "base", base); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = LASIPS2(dev); @@ -282,11 +283,25 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); } +static Property lasips2_properties[] = { + DEFINE_PROP_UINT64("base", LASIPS2State, base, UINT64_MAX), + DEFINE_PROP_END_OF_LIST(), +}; + +static void lasips2_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + device_class_set_props(dc, lasips2_properties); + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + static const TypeInfo lasips2_info = { .name = TYPE_LASIPS2, .parent = TYPE_SYS_BUS_DEVICE, .instance_init = lasips2_init, - .instance_size = sizeof(LASIPS2State) + .instance_size = sizeof(LASIPS2State), + .class_init = lasips2_class_init, }; static void lasips2_register_types(void) diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index b9723073e1..7e4437b925 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -25,6 +25,7 @@ typedef struct LASIPS2Port { struct LASIPS2State { SysBusDevice parent_obj; + hwaddr base; LASIPS2Port kbd; LASIPS2Port mouse; qemu_irq irq; From patchwork Sun Jun 26 17:45:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3371DC433EF for ; Sun, 26 Jun 2022 18:13:24 +0000 (UTC) Received: from localhost ([::1]:55214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wl9-0000lK-6v for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:13:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNG-0004bA-KA for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:42 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45248) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNF-0000G3-60 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:42 -0400 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=yX9EeOMaBsxuZOXfnnKXJiaeqWK7gCVY11wECuSrFpA=; b=BV6+hk6+vQokBZeQZeGHX58mFC tlVpwJLAaiVCik2G89PJaTzUeD/t8kHWRQycKY/KOBu9Ag3LbM4JgOCVtBNRA2QwawM3ekGQWecG6 jmZIWjDJamStiIb2TvNWvxIQWm+RdGYnKupA6X+gwVEnevRUDa7+424crutuubMjwX3C+eFQHMhpQ s5GVsucNKTg2McqYzZrolLIyqMDmmW+BlDyQsJR8nVO6htqESL1Nm/xHyBvxWM356Oz4xAIZBxlmo J38XMNAwJffPUrIlJko3AU1u1A2WwMY8bS4lyZoa1TRhC2ZcjbMggPdWE+CZIcVOVorotfQsoj6Ny 0xUnKsOl5JTFww27bGYiSUfukW+JgB4poCRQM+iTfeU4AxeMPo3s4QLLVne4PoQEhdtQVEiCsESLg tyuUPrF9ExS7D9EE5eKIKomzCVEK38cGqLnf/8X4oXbbkeZLU4x/fH7rpeYLd3U0UvNyb3U2yNvaU XwxUSlw47497YctaBtozD4o50zvZJOrYIUfAPPrJbFdYZ2raK27ROkgmgPlrHbz36Fx8f71ue7iW+ FF869QutFo3UpCdirYNOgjRGfXTdNjwVXsyASfUwgLp7S5XDtJpy0SanJ2vltAGL38FbrfD1lA9Ws OWKq6Gu5YA1xS8UX1ooU0m+r6nEstXtaGJWXBIGlU=; 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 1o5WLq-0007KY-KR; Sun, 26 Jun 2022 18:47:18 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:21 +0100 Message-Id: <20220626174531.969187-46-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 45/55] lasips2: implement lasips2_realize() 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move ps2_kbd_init() and ps2_mouse_init() from lasips2_initfn() to lasips2_realize. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-46-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 81beb5b614..49405191cb 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -256,13 +256,17 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) s = LASIPS2(dev); s->irq = irq; + return s; +} + +static void lasips2_realize(DeviceState *dev, Error **errp) +{ + LASIPS2State *s = LASIPS2(dev); - vmstate_register(NULL, base, &vmstate_lasips2, s); + vmstate_register(NULL, s->base, &vmstate_lasips2, s); s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); - - return s; } static void lasips2_init(Object *obj) @@ -292,6 +296,7 @@ static void lasips2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->realize = lasips2_realize; device_class_set_props(dc, lasips2_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } From patchwork Sun Jun 26 17:45:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F958C433EF for ; Sun, 26 Jun 2022 18:16:20 +0000 (UTC) Received: from localhost ([::1]:35412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wnz-0006Mh-9s for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:16:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNK-0004hf-BS for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:46 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNI-0000GC-NZ for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:46 -0400 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=97CdfCmZa2Lr0PHkOmsEee/cAbPASY9ehGSw+JXywwo=; b=cDdu59czgbQK0fJSIYLopuM4ex KFFUoR6NTGtRgtsN7StaIB21X1+CzD+YS7xdtycl19/DlVJBQwzTDp7fdourtwINH2mV3kYMulG2R qWrCJuesl87CoyfwHja81DKmxSHwoli7QVuzdSMteLztqa/0lkkLpvzy5z4grKiFc9w556lV2dFC1 6nKi1NGymj1Mh3RcrPO26QstxALq96x0sw1GHeNEdpcpLxDws5LM1vGTG4MScdVH835qIJZytWBPR EETHP1cOD7kueVggEj+Z0us5qlLIlv2JAt3+ihcXVfjW2qpY6p0Mv5DGBva4YcJKRUopGtvyeHotZ 7kW5j0UcmCVXkEamxwYvLT9Ye28TD4PwlwDw/xAsxBSv+M8v5ZtU+FXQpbgavJ3Lpnw4bQfTnGJk2 NR3PTBXcZFb7+O9phYC3BXIBJl1lA8I7EQTTb0duJV91r2mcVrx5BQgsh90Bi6C1mPMCQG6Y8lAtM aFjS6Qk+5q1tip9Xrxp8CwJIi5rlltzZR86bSzVsLLddxuiBG/ACGOSTmpHatV22VTFYnfqd+i0F9 6jFh3vuTfI6KRPxRUDsYWrAWwvgHgImokgqSqDzldP1/1w0LewuxH9hkfzrRQB1/bW3s7MsRGQxmz P+ZxK1zCc8mGoj1lkqo/x/MigExiM5wFXrG/SGKX0=; 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 1o5WLu-0007KY-Qi; Sun, 26 Jun 2022 18:47:22 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:22 +0100 Message-Id: <20220626174531.969187-47-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 46/55] lasips2: use sysbus IRQ for output IRQ 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This enables the IRQ to be wired up using sysbus_connect_irq() in lasips2_initfn(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Message-Id: <20220624134109.881989-47-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 49405191cb..bd72505411 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -247,16 +247,15 @@ static void lasips2_port_set_irq(void *opaque, int level) LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) { - LASIPS2State *s; DeviceState *dev; dev = qdev_new(TYPE_LASIPS2); qdev_prop_set_uint64(dev, "base", base); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - s = LASIPS2(dev); - s->irq = irq; - return s; + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); + + return LASIPS2(dev); } static void lasips2_realize(DeviceState *dev, Error **errp) @@ -285,6 +284,8 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->kbd.reg); sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); + + sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); } static Property lasips2_properties[] = { From patchwork Sun Jun 26 17:45:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 206B3C43334 for ; Sun, 26 Jun 2022 18:34:07 +0000 (UTC) Received: from localhost ([::1]:51724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5X5C-0003vZ-0D for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:34:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNO-0004tV-0T for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:50 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45260) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNM-0000GL-AZ for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:49 -0400 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=HQkoPwsImv45VDlQctHLH1Icq4Wy4yM2X6rr1GWdsFg=; b=STn0peYAjJ+T7AWAUtA+EP9RJR Q7uaLiX8eFkMeP/w6Hi4WdKBI4VVvJoe7c0HXjCIplFi8DtSPZjrT8MJ5pwwbXUNkh//6sm5tbUjt jdMQ5AkvozTsmZl0AV2YuTDNEwXNOy6duE9WwCcbFT8HQrpxl4eAY1/Mb82t1MyYsKTcsXpHF/7Re xXWbAkfif2MPvZhyqF7W6686cRgfOik1QO60XuCOslu1U8Xl+uC8CcrdFLxfV9Sha5WyNbjmeeue0 gDUlTGjIAGv0VqTo0wDaFaF+DIDAVBRRqxI42Pxv6R3XwmNJftNcKphVrcwNo4XkC/YFx37s2ITQw 4RJEXpDYfdatVx91u3y+5orXjZDOVyjhP1unKeUPjETHIkKPKCJxh+/9E072w8JRO8i2eWLSQsxcO 2pzA9CZ9YCOUvuqRozK8BvFUx+uRFDbADRJcRNokwi9kHJ8VeRl6Fste1vMIo6NByxGeF5S4L/ezW ndVTYVPS2GfaU94eN045D3c84CdlGyru5S0OxO9hWceTFT859k3faxj6dwX+vH7+Qh5YacSIqzPIm O0vBjcLc3/0OnDrqpcTkr35WIgB4xfI3rS6L867PAw5SfSlWEcgx61Lo/eG63OFTN/IcCXkeoB070 g3IP4f7UOXheAH45XWppgr9a/G5/IW2Nk6pAIHOLI=; 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 1o5WLy-0007KY-LE; Sun, 26 Jun 2022 18:47:26 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:23 +0100 Message-Id: <20220626174531.969187-48-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 47/55] lasips2: 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add a qdev gpio input in lasips2_init() by taking the existing lasips2_port_set_irq() function, updating it accordingly and then renaming to lasips2_set_irq(). Use these new qdev gpio inputs to wire up the PS2 keyboard and mouse devices. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Message-Id: <20220624134109.881989-48-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index bd72505411..a6e14e0e6b 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -237,9 +237,19 @@ static const MemoryRegionOps lasips2_reg_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static void lasips2_port_set_irq(void *opaque, int level) +static void lasips2_set_kbd_irq(void *opaque, int n, int level) { - LASIPS2Port *port = opaque; + LASIPS2State *s = LASIPS2(opaque); + LASIPS2Port *port = &s->kbd; + + port->irq = level; + lasips2_update_irq(port->parent); +} + +static void lasips2_set_mouse_irq(void *opaque, int n, int level) +{ + LASIPS2State *s = LASIPS2(opaque); + LASIPS2Port *port = &s->mouse; port->irq = level; lasips2_update_irq(port->parent); @@ -264,8 +274,14 @@ static void lasips2_realize(DeviceState *dev, Error **errp) vmstate_register(NULL, s->base, &vmstate_lasips2, s); - s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); - s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); + s->kbd.dev = ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", + 0)); + s->mouse.dev = ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq", + 0)); } static void lasips2_init(Object *obj) @@ -286,6 +302,11 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); + + qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_kbd_irq, + "ps2-kbd-input-irq", 1); + qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_mouse_irq, + "ps2-mouse-input-irq", 1); } static Property lasips2_properties[] = { From patchwork Sun Jun 26 17:45:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 337A0C43334 for ; Sun, 26 Jun 2022 18:26:58 +0000 (UTC) Received: from localhost ([::1]:38176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WyH-0002Xr-4A for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:26:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNR-000576-HO for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:53 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45266) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNQ-0000Gy-2l for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:53 -0400 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=z783vrdJX4jvHDoeJCTvbpadpC7HUVDKNfmziNDxwEo=; b=HRE+NpjpB+yVQiPXX/FNfCsHsK N504Ya/WWNiHZbjIvjrTIyrguHhq1HQAMr8L7b5YdNO3i1w2qckId8/v1hDa8aNfvG7qh3SpyzTeC kWTBm5PHgGtT+x5QEn9xUcIGqQWI2YW6yOs1yEAi0YDr8+Gte/0IYw11lV2W2DW/AHFpLQwp/EjVV X8qcN9P8bsqER0O/p/SIGe1Q9TKEzlhK9SAmwryZnBpFC55HhGt+TL98C6aYrc3MPhd2L/397Ck1h Q5LHS+cQRRHz4N08sUEI/EdBvH3Sez+MruGU7P428/+WJdFo+xxM3OtZwxH6Qxecx6Qobz1MypK/n T0DcTh1ojN4mu3vUpyiIU95siRr1a1WuSLGh1/sImPHOfKE9TWRtWZs4XfL0tx/6ccIQqUIDb1iw1 D8fSnCJO0zs3pIhwybkuhMZToVOiQmdNLLhQyuMEcgS1ZQM+r+AFMuGC1TYvT1JNEMM1tOoANoPnP t1bgQ0aRFr8wzpUpVtvztp0XiVrN6rJBmjnGsMmMyvusobAXdc3sfFptuRDTMG+emZH72PpmAPuR2 hWMRjjBtAbRnqNRWnVN8nTaIrS0sWetc4hSOaDWau7PiFmm8+ySAD0R0HVu3LKphg5D/j0WwUaK7U eLl5H6O9Ri/oCjgS5zRaGzwUOcYx0z/QUFv9irvd8=; 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 1o5WM2-0007KY-Gd; Sun, 26 Jun 2022 18:47:30 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:24 +0100 Message-Id: <20220626174531.969187-49-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 48/55] lasips2: add QEMU interface comment 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This describes the LASI PS2 device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Message-Id: <20220624134109.881989-49-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- include/hw/input/lasips2.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 7e4437b925..03f0c9e9f9 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -4,6 +4,20 @@ * Copyright (c) 2019 Sven Schnelle * */ + +/* + * QEMU interface: + * + sysbus MMIO region 0: MemoryRegion defining the LASI PS2 keyboard + * registers + * + sysbus MMIO region 1: MemoryRegion defining the LASI PS2 mouse + * registers + * + sysbus IRQ 0: LASI PS2 output irq + * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2 + * keyboard device has asserted its irq + * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2 + * mouse device has asserted its irq + */ + #ifndef HW_INPUT_LASIPS2_H #define HW_INPUT_LASIPS2_H From patchwork Sun Jun 26 17:45:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895862 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E36EC433EF for ; Sun, 26 Jun 2022 18:22:49 +0000 (UTC) Received: from localhost ([::1]:54440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WuG-0002gj-3i for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:22:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNV-0005EH-BF for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:58 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45272) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WNT-0000HC-IB for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:48:57 -0400 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=mXD61TUWWwbSsZip6Rgqx/ZdPGKlksXhFJeeHmwGPh0=; b=b9Xvrr8IGKX2HR05YW1UOlu3df tXapiSSvLsqRMddlGwnKzCGvAw18kI0W3XRLlNWVowTU3fKsjHSTgqyPZzAtbCvfxisMPh0Q+wRLx mNypf9g0SHk+Ce84rkqNEhbq4N+tpSHo29U+N6DCVgUTfWQHRP47Hl7Fbr3iUuAEXx2r/yKnTHiWl 9yyHCQfeL26Ci6O0mS9eYGasFlBY3L3mM3uxUvwRDwEzGYX3NYMSe5d7XWEexjXQogJpjlzOLWrA8 yJAC/rvpYBz1T61Xv2d5wOdXZEGSZUFPajxM2inkQicNLJRRm4pB7Z7M6dkHRQl9k0yFG4YKWiOTs 9ZmDhbG2mn4zjmKseWPR6rmlFw0oP6zZdCi882bXcnpocvs8ZXOW8sPuGrH68WNv8eUJnE63M1XT8 Wf+PUcYriT58QqO3HjquknUnkz9ydP+Tf+CdI2paD/mKoSCzWwrOkXcUisR8r8xYBIDybiklY+A5A PVGyCmsrAAlqagnKCSDHBh/cH8FP/wlyfjRLhU2KadpsU1k4X+sURqPNE0huLGtIHYyooEpoBUgwF f2ZVIVcWh6KnLJJK2jFzGi0v6vQm1rVTw1Xn4pviyJ6d6IlmfihYM+4Qpff+oZ3o7wTH8A3M+epQ1 yfZ+XDyNb1hYXYHjEEfW3293zyl4nnGBf3GOCeTHk=; 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 1o5WM6-0007KY-6i; Sun, 26 Jun 2022 18:47:33 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:25 +0100 Message-Id: <20220626174531.969187-50-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 49/55] pckbd: switch I8042_MMIO device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire up the PS2 keyboard and mouse devices to use it. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-50-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 5d7c969fc6..ee306428a3 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,6 +665,22 @@ static const MemoryRegionOps i8042_mmio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +static void i8042_mmio_set_kbd_irq(void *opaque, int n, int level) +{ + MMIOKBDState *s = I8042_MMIO(opaque); + KBDState *ks = &s->kbd; + + kbd_update_kbd_irq(ks, level); +} + +static void i8042_mmio_set_mouse_irq(void *opaque, int n, int level) +{ + MMIOKBDState *s = I8042_MMIO(opaque); + KBDState *ks = &s->kbd; + + kbd_update_aux_irq(ks, level); +} + static void i8042_mmio_reset(DeviceState *dev) { MMIOKBDState *s = I8042_MMIO(dev); @@ -686,8 +702,14 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp) /* Note we can't use dc->vmsd without breaking migration compatibility */ vmstate_register(NULL, 0, &vmstate_kbd, ks); - ks->kbd = ps2_kbd_init(kbd_update_kbd_irq, ks); - ks->mouse = ps2_mouse_init(kbd_update_aux_irq, ks); + ks->kbd = ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", + 0)); + ks->mouse = ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq", + 0)); } static void i8042_mmio_init(Object *obj) @@ -696,6 +718,12 @@ static void i8042_mmio_init(Object *obj) KBDState *ks = &s->kbd; ks->extended_state = true; + + qdev_init_gpio_out(DEVICE(obj), ks->irqs, 2); + qdev_init_gpio_in_named(DEVICE(obj), i8042_mmio_set_kbd_irq, + "ps2-kbd-input-irq", 1); + qdev_init_gpio_in_named(DEVICE(obj), i8042_mmio_set_mouse_irq, + "ps2-mouse-input-irq", 1); } static Property i8042_mmio_properties[] = { @@ -718,16 +746,14 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, ram_addr_t size, hwaddr mask) { DeviceState *dev; - KBDState *s; dev = qdev_new(TYPE_I8042_MMIO); qdev_prop_set_uint64(dev, "mask", mask); qdev_prop_set_uint32(dev, "size", size); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - s = &I8042_MMIO(dev)->kbd; - s->irqs[I8042_KBD_IRQ] = kbd_irq; - s->irqs[I8042_MOUSE_IRQ] = mouse_irq; + qdev_connect_gpio_out(dev, I8042_KBD_IRQ, kbd_irq); + qdev_connect_gpio_out(dev, I8042_MOUSE_IRQ, mouse_irq); return I8042_MMIO(dev); } From patchwork Sun Jun 26 17:45:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACB3EC433EF for ; Sun, 26 Jun 2022 18:31:09 +0000 (UTC) Received: from localhost ([::1]:46688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5X2K-0008W5-J7 for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:31:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WS3-0005Xl-Cp for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:39 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WS1-0000wm-9D for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:38 -0400 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=zQKkpwGZxCh3KoMzMCtFItcG/IrBQ8JhFurBTqhXVJ4=; b=N83zQL7U9DRAOsDpjEFRHsXY35 mk2vU7kCnR11ilojQoEhawPXwVyzOZvODKmlrHfiEsA+qMXSwCm0FSNyvCuwa9l6/OgX8XVgM5N+1 Jhz9BszqCuVH98ie0rfoWj3Z8ikrcAZq45HAmyDs4X2n4CjmDDV0oe4h3kV6exwaRhtgwQEAJNLhq /EYuy9bzeNyz2sQmSDLyo9N5gtPR5crFlsIAwfhl7wmhZn4grN+u5wj+bD0l4HwfdslIYQRQQsYxF 6LlQn3/kjcwQhqAbcjRzwZEaapFugfFF9kHKeb0c1i3y7p3AKQ8jmQpuXTT/UtaivZpxaND+E6mGY 4VK+WeKlnzWUJrqoDcyWKfgqqUQKHYBly8KypQn80yn3Bbgm/yFRai19wBLL7CnrO4ebIgV39mnrD C8sg49N4gnDGzzVdiDHyeUOms/WyT0YZWgY93n0bllHTbcGNe0q67PT16gjRp7S1ybY6v10PTjhCY /HiLMhc+IA6O45mZfvP8HTjsou4muRK5YPoOQPLFB8UpfdAQDJ/sboVkZ3yirQ9VNjRzHTt5EbxUJ q95NareW1SLQuE6JgKrDAuN9qchaLOhqqExzyPCirMoj5PnZ+b/bOd3nmfn30+HzFkUG4GS2GTUyg Y9uWILHRjMrSi7tHlRlUz+R9cN7/ly/tbaCNyBBF0=; 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 1o5WM9-0007KY-No; Sun, 26 Jun 2022 18:47:37 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:26 +0100 Message-Id: <20220626174531.969187-51-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 50/55] pckbd: add QEMU interface comment for I8042_MMIO device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This describes the I8042_MMIO device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Message-Id: <20220624134109.881989-51-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- include/hw/input/i8042.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 4ba2664377..d4747b62b8 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -52,6 +52,17 @@ struct ISAKBDState { uint8_t mouse_irq; }; +/* + * QEMU interface: + * + sysbus MMIO region 0: MemoryRegion defining the command/status/data + * registers (access determined by mask property and access type) + * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2 + * keyboard device has asserted its irq + * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2 + * mouse device has asserted its irq + * + Unnamed GPIO output 0-1: i8042 output irqs for keyboard (0) or mouse (1) + */ + #define TYPE_I8042_MMIO "i8042-mmio" OBJECT_DECLARE_SIMPLE_TYPE(MMIOKBDState, I8042_MMIO) From patchwork Sun Jun 26 17:45:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2008C43334 for ; Sun, 26 Jun 2022 18:36:16 +0000 (UTC) Received: from localhost ([::1]:58056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5X7H-0008TM-Qv for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:36:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSB-0005Zc-AE for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WS4-0000xD-HY for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:42 -0400 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=UrTrhI4ZHDBVA3zY3jrVw/QjkSmppvXZMjErcrPy788=; b=Ni3kDYj/vKAs7g+7wkkcIQ6RDJ RqKQVB16ek3rnaKa+pz/J4M7W3e75tkFpesgABK83tjuHLoMrl5drZiiS9G4d5kHqZogP/tTxSmtG m6XnjC87yLo9EJJrhB18gbXpdhHCHj2zZkIcThL5sgxwxpECb8/LQ2pwvt/lxBJ+hZGJKRc+n/8L3 kGZjGbDsfLpyNXAHRIPUOyFVrShxgU2pE6xZk63ywH09dh8X1vRDh6QGX2aRORCHh9z/QwpiPi60w AQ9/8DMgKoaSy8MLOKlJEq+Rc+jimDXnMMqwu6AI2toZ51wUug8QsepIkTNMjzPt7h3KoFx7Wc7n8 51Oq6a2rIdqW5gW1n9SE7sPd7agm0Q5fwxzL8V29lrPYzUgYqr7UCmr50Nfp5avrzhz7EXBRPm4Hr 4B7iyM1DxS7nxhkqQVlAClOrYVwkgxHSDL5ipRI+SJgMx9ebZ4OEd4HXPT2F4y/wbdu4y6zpWC8cL SVlO2n+GegUXEcqsVUd4zc1kn2wPR49QXIyzDK3tYqwXq/lwdrgLdbUKv8Q+Kom61WLoujMpVWwV4 VvfTMLjDdAsuwbVZRiE4fxjwIyqRvIGlUFqu6BHll9YUfBjXBmLEA5uMhdOamI8z4NaU4iUC2lyyo RXqoI5QrDo7GprqwQ4lZucpxWVOvq7OSaSLXZQDB4=; 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 1o5WMD-0007KY-Tc; Sun, 26 Jun 2022 18:47:41 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:27 +0100 Message-Id: <20220626174531.969187-52-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 51/55] pckbd: add i8042_reset() function to I8042 device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This means that it is no longer necessary to call qemu_register_reset() manually within i8042_realizefn(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-52-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index ee306428a3..ff76c0636d 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -808,6 +808,14 @@ static const MemoryRegionOps i8042_cmd_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +static void i8042_reset(DeviceState *dev) +{ + ISAKBDState *s = I8042(dev); + KBDState *ks = &s->kbd; + + kbd_reset(ks); +} + static void i8042_initfn(Object *obj) { ISAKBDState *isa_s = I8042(obj); @@ -854,7 +862,6 @@ static void i8042_realizefn(DeviceState *dev, Error **errp) s->throttle_timer = timer_new_us(QEMU_CLOCK_VIRTUAL, kbd_throttle_timeout, s); } - qemu_register_reset(kbd_reset, s); } static void i8042_build_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -900,6 +907,7 @@ static void i8042_class_initfn(ObjectClass *klass, void *data) AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); device_class_set_props(dc, i8042_properties); + dc->reset = i8042_reset; dc->realize = i8042_realizefn; dc->vmsd = &vmstate_kbd_isa; adevc->build_dev_aml = i8042_build_aml; From patchwork Sun Jun 26 17:45:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08DA7C433EF for ; Sun, 26 Jun 2022 18:34:49 +0000 (UTC) Received: from localhost ([::1]:54752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5X5s-0006BA-U3 for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:34:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSM-00060d-3P for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:58 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSK-0000yS-MJ for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:57 -0400 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=pt/hGxz5VqBEMrPCCaTXmyaZIii4IoWMyH/2nE3n1Uo=; b=gY9BR+UwlBu1VBGhjNl6fI5jtJ 4+hm7slav2RuDJ5ns2tRX1EAQ2D2FxsDMj2FusYdGcM+rOVfK5C/3aY7pEEF6m167BgCHfff5jQGq 4dFj4Ze68RFiqLkOvbrk+h4LtDQ3Y30sOe08QHhMvxNsXfTLT+OQipK6QGs8G7nvwgq6+1EkTjNyq kh+I1U+GpSwMsV6dEP+21e++WOcB3X649MCByB3sNLLmW2Vw6+7FtBCZcubVrWfwFlYA/tcT7hQPF Eupr4bBQccEGveuaEi9Pncfzuhe2Pb9nHNrNUtowZ7hVVwHphU/mXb/CadekQbKtCQYF6TM9U7HCk 2tQIZpNN/Yk2NSiWcmmH6eyH9geiolLdpmjxIVhO8vfGhiFmy0SYAbelds8Rq4Nmu+Yqg+QGqthnW gQ0w5pUK1gQwfBG5pTys2NupSA7liukqB5+2jK1j297OAluZyrDWf114KcdwbkSvy59PtYMvV/hi1 9rUS6OnsDLOUBn1qhAh3zV4PDdQOF6KfMT5TEMVicAXcDO3iMoX9w2VnGX5CyjSopHB8sLF6oFqcE YozQY9oN54dCJspzXHXiTsvaKI8a5iON8R5zv/zlBmOlc8Ghs9pVApjBlPaxZ1fT7d+eunHA7Ri89 R/H8jkfRXJJCWxkPuCk3HN5MPOQg4FGH/9GRCeE2c=; 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 1o5WMH-0007KY-Oh; Sun, 26 Jun 2022 18:47:45 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:28 +0100 Message-Id: <20220626174531.969187-53-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 52/55] pckbd: switch I8042 device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire up the PS2 keyboard and mouse devices to use it. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-53-mark.cave-ayland@ilande.co.uk> --- hw/input/pckbd.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index ff76c0636d..18f27abc58 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -808,6 +808,23 @@ static const MemoryRegionOps i8042_cmd_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +static void i8042_set_kbd_irq(void *opaque, int n, int level) +{ + ISAKBDState *s = I8042(opaque); + KBDState *ks = &s->kbd; + + kbd_update_kbd_irq(ks, level); +} + +static void i8042_set_mouse_irq(void *opaque, int n, int level) +{ + ISAKBDState *s = I8042(opaque); + KBDState *ks = &s->kbd; + + kbd_update_aux_irq(ks, level); +} + + static void i8042_reset(DeviceState *dev) { ISAKBDState *s = I8042(dev); @@ -827,6 +844,12 @@ static void i8042_initfn(Object *obj) "i8042-cmd", 1); qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, I8042_A20_LINE, 1); + + qdev_init_gpio_out(DEVICE(obj), s->irqs, 2); + qdev_init_gpio_in_named(DEVICE(obj), i8042_set_kbd_irq, + "ps2-kbd-input-irq", 1); + qdev_init_gpio_in_named(DEVICE(obj), i8042_set_mouse_irq, + "ps2-mouse-input-irq", 1); } static void i8042_realizefn(DeviceState *dev, Error **errp) @@ -847,14 +870,20 @@ static void i8042_realizefn(DeviceState *dev, Error **errp) return; } - s->irqs[I8042_KBD_IRQ] = isa_get_irq(isadev, isa_s->kbd_irq); - s->irqs[I8042_MOUSE_IRQ] = isa_get_irq(isadev, isa_s->mouse_irq); + isa_connect_gpio_out(isadev, I8042_KBD_IRQ, isa_s->kbd_irq); + isa_connect_gpio_out(isadev, I8042_MOUSE_IRQ, isa_s->mouse_irq); isa_register_ioport(isadev, isa_s->io + 0, 0x60); isa_register_ioport(isadev, isa_s->io + 1, 0x64); - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); - s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); + s->kbd = ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", + 0)); + s->mouse = ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq", + 0)); if (isa_s->kbd_throttle && !isa_s->kbd.extended_state) { warn_report(TYPE_I8042 ": can't enable kbd-throttle without" " extended-state, disabling kbd-throttle"); From patchwork Sun Jun 26 17:45:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71739C43334 for ; Sun, 26 Jun 2022 18:25:51 +0000 (UTC) Received: from localhost ([::1]:34424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5WxA-0008H0-IN for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:25:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSG-0005rU-ID for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:52 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSF-0000xp-5K for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:52 -0400 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=8eCfNUm5vJhjFcFCMiawsT7CCWIH9C+rsIP8prC6Kc8=; b=nQTgUWmbVnemoYTa4OY5q3KgeW THltCN02P7sD9+KExR3BdXAD9QamkoKlcHUkeyYPYURfr9Z6Vn9sNyFwHJ7b9S+VLMHMl4K5a5dKq zYHDapEv+OMyuxYqXiVVzZMT5RZHHnoCO0xmuJFwRqPGuzpNlimS7vsMC+cUKbFXeSpL1jI4xdeZM fK56tie+FN5fhswZmAUIjLvLlOsQa0dU9QX6xYJ24ynogruvHkZ2uWo6ev0+pjPHIzCP9EPKiRXam Dxps1QP3wEkZ3/hsAmaIqiwQdj6Wb+4/vzzUC4C3zfvLJwzkYDokfcJzjhWRU59Wxwz5iEdyI7dgV smizLIeznEtuM6nV1Jzxo8RxFwCYPjPf4ld34IPaw5SjeKXMBB1E14sJ0s6sT24HTMXct8/fVw2FO Be3I71CQCYx2NhGzk15QSSO0On5F/eXkOscZBWdz9OB0HzRzZKAjYUq/wi5dYxOl0sx+s6M2MohGV BF9IOZsJrE3wN8Qp1giMw+i/jivjDyiBwvLIoaXDyX03txREXq11KoP0/iPnsPHPQ1gUUnaPEjreZ ie6pKOUM+QgN3MulRHfAkR2bZr2wIWYHstzq/qN6sx2w3nGKLyUqk8b2DwcU7O7T2pvewEeattJSh Dl3+CabKsEn/CHB1DSb2oeRXI7kHvgur5S535wp5I=; 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 1o5WML-0007KY-Jq; Sun, 26 Jun 2022 18:47:49 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:29 +0100 Message-Id: <20220626174531.969187-54-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 53/55] pckbd: add QEMU interface comment for I8042 device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This describes the I8042 device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Message-Id: <20220624134109.881989-54-mark.cave-ayland@ilande.co.uk> Reviewed-by: Peter Maydell --- include/hw/input/i8042.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index d4747b62b8..ca933d8e1b 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -39,6 +39,16 @@ typedef struct KBDState { hwaddr mask; } KBDState; +/* + * QEMU interface: + * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2 + * keyboard device has asserted its irq + * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2 + * mouse device has asserted its irq + * + Named GPIO output "a20": A20 line for x86 PCs + * + Unnamed GPIO output 0-1: i8042 output irqs for keyboard (0) or mouse (1) + */ + #define TYPE_I8042 "i8042" OBJECT_DECLARE_SIMPLE_TYPE(ISAKBDState, I8042) From patchwork Sun Jun 26 17:45:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A799C43334 for ; Sun, 26 Jun 2022 18:39:15 +0000 (UTC) Received: from localhost ([::1]:34370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5XAA-0003JN-6c for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:39:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSJ-00060a-Gy for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:58 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45322) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSH-0000y0-LU for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:55 -0400 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=DEGDwtWAz88eZMF+Rdl89YpmlNrQkSN1Qqv7bjyriPg=; b=O2P9S3vV7tb3aU9XgNxOtR2n4v g9HNA+enjRQ+V15xMMBOptvssLLMa8HWENQUy453xr/EioDZ4T4A6cyvgzxBUpxwtg9Mf8ip0bQEl mwoEoyqXnKDrmtbztPS5jjDt7cZRXCHwyLMXpSSDNRtgyMu7bG5bdYSYsGC7GuSIYWfoudEbms3Oi x2oTfF60n8aIEkvw93aDLliqQqd1WC2svr6QHajQW89bSyBPIXAe8+G6hEP7FyVMzPQbkC9gABkwz QI2jRzSwYuEKVEAs8fSHOckzgbOZ2n3TG7ZGvrzlRJ4x6Qk50bi95UzMBLqusIMcBOJAuffONmA/d prgMELI/ZyfbUlLjReqQcuWcpAr8aDum+JOTl3+O4xuuT5GBz6iAmYqhmLvjDHT6DLdm2nyl8P+Xw kGjjfzOmBQWyHZbYSvUB2r/Zhh2v0+OTLpnE9/xLbGXkQUhowblm3B3Abc0SDAJsMl4aVwduxX2RP SmjIYSFlFZME4AAw+kdpEo4xyEmK65uPxhCTL1BBnQAXgrJ7iiMssivmKFoR8sz4pp8RNIOqUeznP v1TROoF4/qlZ63qm0JEZ4AHIMQn1p0VNIkEJ5u/LQmD4KoTPLZ+5TQ+94CMa/PBBEy7sR4o5c/K7H 8HSImBcY8ouXJTHxihFXCKOrW6/ylcdeCi5pwpvLg=; 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 1o5WMP-0007KY-Od; Sun, 26 Jun 2022 18:47:53 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:30 +0100 Message-Id: <20220626174531.969187-55-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 54/55] ps2: remove update_irq() function and update_arg parameter 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Now that all the PS2 devices have been converted to use GPIOs the update_irq() callback function and the update_arg parameter can be removed. This allows these arguments to be completely removed from ps2_kbd_init() and ps2_mouse_init(), along with the transitional logic that was added to ps2_raise_irq() and ps2_lower_irq(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell Message-Id: <20220624134109.881989-55-mark.cave-ayland@ilande.co.uk> --- hw/input/lasips2.c | 4 ++-- hw/input/pckbd.c | 8 ++++---- hw/input/pl050.c | 4 ++-- hw/input/ps2.c | 25 ++++--------------------- include/hw/input/ps2.h | 6 ++---- 5 files changed, 14 insertions(+), 33 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index a6e14e0e6b..9223cb0af4 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -274,11 +274,11 @@ static void lasips2_realize(DeviceState *dev, Error **errp) vmstate_register(NULL, s->base, &vmstate_lasips2, s); - s->kbd.dev = ps2_kbd_init(NULL, NULL); + s->kbd.dev = ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", 0)); - s->mouse.dev = ps2_mouse_init(NULL, NULL); + s->mouse.dev = ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq", 0)); diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 18f27abc58..9184411c3e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -702,11 +702,11 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp) /* Note we can't use dc->vmsd without breaking migration compatibility */ vmstate_register(NULL, 0, &vmstate_kbd, ks); - ks->kbd = ps2_kbd_init(NULL, NULL); + ks->kbd = ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", 0)); - ks->mouse = ps2_mouse_init(NULL, NULL); + ks->mouse = ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq", 0)); @@ -876,11 +876,11 @@ static void i8042_realizefn(DeviceState *dev, Error **errp) isa_register_ioport(isadev, isa_s->io + 0, 0x60); isa_register_ioport(isadev, isa_s->io + 1, 0x64); - s->kbd = ps2_kbd_init(NULL, NULL); + s->kbd = ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", 0)); - s->mouse = ps2_mouse_init(NULL, NULL); + s->mouse = ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq", 0)); diff --git a/hw/input/pl050.c b/hw/input/pl050.c index ffaa72dea4..209cc001cf 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -172,9 +172,9 @@ static void pl050_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev = ps2_mouse_init(NULL, NULL); + s->dev = ps2_mouse_init(); } else { - s->dev = ps2_kbd_init(NULL, NULL); + s->dev = ps2_kbd_init(); } qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-input-irq", 0)); diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 98c6206fb8..59bac28ac8 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -175,20 +175,12 @@ void ps2_queue_noirq(PS2State *s, int b) static void ps2_raise_irq(PS2State *s) { - if (qemu_irq_is_connected(s->irq)) { - qemu_set_irq(s->irq, 1); - } else { - s->update_irq(s->update_arg, 1); - } + qemu_set_irq(s->irq, 1); } static void ps2_lower_irq(PS2State *s) { - if (qemu_irq_is_connected(s->irq)) { - qemu_set_irq(s->irq, 0); - } else { - s->update_irq(s->update_arg, 0); - } + qemu_set_irq(s->irq, 0); } void ps2_queue(PS2State *s, int b) @@ -1232,21 +1224,16 @@ static void ps2_kbd_realize(DeviceState *dev, Error **errp) qemu_input_handler_register(dev, &ps2_keyboard_handler); } -void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) +void *ps2_kbd_init(void) { DeviceState *dev; PS2KbdState *s; - PS2State *ps2; dev = qdev_new(TYPE_PS2_KBD_DEVICE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = PS2_KBD_DEVICE(dev); - ps2 = PS2_DEVICE(s); trace_ps2_kbd_init(s); - ps2->update_irq = update_irq; - ps2->update_arg = update_arg; - return s; } @@ -1262,20 +1249,16 @@ static void ps2_mouse_realize(DeviceState *dev, Error **errp) qemu_input_handler_register(dev, &ps2_mouse_handler); } -void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) +void *ps2_mouse_init(void) { DeviceState *dev; PS2MouseState *s; - PS2State *ps2; dev = qdev_new(TYPE_PS2_MOUSE_DEVICE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = PS2_MOUSE_DEVICE(dev); - ps2 = PS2_DEVICE(s); trace_ps2_mouse_init(s); - ps2->update_irq = update_irq; - ps2->update_arg = update_arg; return s; } diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 5422aee9aa..a78619d8cb 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -59,8 +59,6 @@ struct PS2State { PS2Queue queue; int32_t write_cmd; qemu_irq irq; - void (*update_irq)(void *, int); - void *update_arg; }; #define TYPE_PS2_DEVICE "ps2-device" @@ -100,8 +98,8 @@ struct PS2MouseState { OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) /* ps2.c */ -void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); -void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); +void *ps2_kbd_init(void); +void *ps2_mouse_init(void); void ps2_write_mouse(PS2MouseState *s, int val); void ps2_write_keyboard(PS2KbdState *s, int val); uint32_t ps2_read_data(PS2State *s); From patchwork Sun Jun 26 17:45:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 12895861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3FA81C433EF for ; Sun, 26 Jun 2022 18:22:11 +0000 (UTC) Received: from localhost ([::1]:52686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5Wte-0001Tu-C8 for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 14:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSE-0005hW-2k for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:50 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:45312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5WSC-0000xc-Kg for qemu-devel@nongnu.org; Sun, 26 Jun 2022 13:53:49 -0400 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=DdfsgBk5Hv35aSUZHdyDtgQuMj2it9QBOMnBaPOa99g=; b=hvbzfHimgZFDaMikV1823xxWuw WxBwQ4GJ+JRRvAW8HfaKRMHCJFdpMgNMc+n6SY5C3Bk0q+ys+3GOggUt4hpa0nyRWsSLoRrdCMRnD ss27St2U/URs4BCBBSOQZLWZ/vkorOa5QZwjFoB84a2lcJMQIR2WkJNNk78bUVuhquw7O/qZNeT59 ttoG7KkLTPrU2kGO02Wa2LIOV86F5j1kcqzkfQiHkw/N5y1S/WA0RQG7zGSMQK93gwSNzPlhuZMns kD2mQkBceZMVksv0L2SF9mn0rNYGWfoY0tsXrtLZdL4LBpF89lh506TRuSwYBSwD1p2M4u1MuNk2s QWOgal/iI4ztox4axuP1AUsi0a3VdOIgWbC80oihleiHcdO/RAlI6B/jb8VReNS9GdNbPATIMcX52 F0TKO/vOZKFLcu2hAvhBkc05vEG9YbAHsPj3b7Bg2kquNdTv4E1MfyV1knvklpR8RIU80O/cB5Bo9 wikdnuySKQQRH6ZsLDAEOqfRyj3ZYwR85wfvHnWzkcEA6u+lJQg6JCUeJGW34w78NFogSRs5Fx0Go SmJDCFFGcyV+xjeEcQbEyOKFDO4STcBd/Y2Nss1Bi79rQ488EVHf073sL6KPNLAl2PHuuwc4W0Dxf utsp0tsB27eajR32EUu2UkYeGuSjbV3Xvem8+JYDA=; 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 1o5WMT-0007KY-Kl; Sun, 26 Jun 2022 18:47:57 +0100 From: Mark Cave-Ayland To: richard.henderson@linaro.org, qemu-devel@nongnu.org Date: Sun, 26 Jun 2022 18:45:31 +0100 Message-Id: <20220626174531.969187-56-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> References: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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: [PULL 55/55] artist: set memory region owners for buffers to the artist device 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This fixes the output of "info qom-tree" so that the buffers appear as children of the artist device, rather than underneath the "unattached" container. Signed-off-by: Mark Cave-Ayland Message-Id: <20220624160839.886649-1-mark.cave-ayland@ilande.co.uk> Reviewed-by: Helge Deller --- hw/display/artist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/artist.c b/hw/display/artist.c index eadaef0d46..fde050c882 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -1358,7 +1358,7 @@ static void artist_create_buffer(ARTISTState *s, const char *name, { struct vram_buffer *buf = s->vram_buffer + idx; - memory_region_init_ram(&buf->mr, NULL, name, width * height, + memory_region_init_ram(&buf->mr, OBJECT(s), name, width * height, &error_fatal); memory_region_add_subregion_overlap(&s->mem_as_root, *offset, &buf->mr, 0);