From nobody Sun Feb 23 11:07:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1740043886; cv=none; d=zohomail.com; s=zohoarc; b=CuanMMmaxbNkGyU4IpwG4jOIumySlNsGmA/JNAMyI4gCt83Mq0n01y4nDSsrD7UErT+H6iEFM/KaOaXalc3VrmmftrYiNfDrGmU5yCK8Buc7TEQ4YqDJM4X9Qesk/ukTkc73ow4kCx7sKyMWpHUkGli35lqXFf3qCbpR8iTNpAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740043886; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H2/xpK9DtdqY8a6ieh8rBtI4fW+GPrI9nBJmXLMfGvA=; b=Qn8K5kgSPv3rW5Yvtt6wP1oA5H5WH7ChG3zbUqUA/gZP+ONHWbgDyh9QboYAAvi4IY9q+4A7SpviAhpVhWyfQ1aDTTn1mfHloasA4AaWmB5m3rKXkbOIVlN0FYlkvR2d1GHA3QjZKoiDsvdZZnE1Oa70Nkm2kqwiHk7SRQTCvMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1740043886879815.1721751200545; Thu, 20 Feb 2025 01:31:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tl2tU-0001oH-R7; Thu, 20 Feb 2025 04:30:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tl2tR-0001bO-5Y for qemu-devel@nongnu.org; Thu, 20 Feb 2025 04:30:53 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tl2tP-0003qo-7D for qemu-devel@nongnu.org; Thu, 20 Feb 2025 04:30:52 -0500 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2211acda7f6so12885145ad.3 for ; Thu, 20 Feb 2025 01:30:50 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-732700c1c31sm8603468b3a.1.2025.02.20.01.30.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 20 Feb 2025 01:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740043849; x=1740648649; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H2/xpK9DtdqY8a6ieh8rBtI4fW+GPrI9nBJmXLMfGvA=; b=dsCNQMJUk9YRM/bPZpnEkGMnRDtPaLDKPqbcffO6SecXbs1h017VeP5xaIXxeRn91y xtlpFx/5h4Vr+fzUTzmhTUKK2L8ulCV8r7mBdlvialyYpDJKnvA06dIqADFFPSfZK8lR ay91ie1Dx8iapmYysTD/lQeOHstCPTtCtnLKS07HeLMUwWdLgAja+e24HIqj3yDtjoXo n6zPUeEoe1TsspXFVuXpQBfhZRVy/xvDnqBEmD0zh06QlFUgaHt4m05I3tpDbejiLpRo URFvtmn33Hev4Rqq1Mh4Vd0B7Lg2Lxab2PD+hfPmO86RBt7vHu8PeNBhF9NXb0UKCHnb a3gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740043849; x=1740648649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H2/xpK9DtdqY8a6ieh8rBtI4fW+GPrI9nBJmXLMfGvA=; b=h/3YmiEJjfibSwbPAb/bXQXHUeRRxEklXcqE4zDIlun/K3nhVMnhNeC5F0VkhVhG7e upmM1ow4wX8W/imAOxTopBRIGtQ1hcqu3x/Fc9gWiukUP8dbNEQECNhk56H7vWRH+qed en94GI67zQGaYSFAGfViDlEmoVtDinqhbYEA7qlblYWQwt5ZkVJpZBHkiLO1/FpHzqlM DyjCn5wnnjtzXGu64+w36m1oIS9REd1sz9hjt5t7Du5kZscdmpMUll6e7NjMRvqOUQDK ZVFLf+Bsfcp43KYJV7eQ1qiszSYFJyWqyZJ1T49MUjULeIbAn+HtwGjvqy969gz1GFUl R8iQ== X-Gm-Message-State: AOJu0Yx7z/BUVaQWyfzIdE+hfZhij0VjcC/e+F28Ywpdm0FMrbs6LQCP HxIvz1wEA4Cx7Ghy/V8g0WVvleS22Dc6gNirkaZx78B5yaXj/hz6tl+B+WbVG1cTrNxS3B6wCqg 1J9Y= X-Gm-Gg: ASbGnctdJAra+bGHK7Gey4BNZJ41O8HHAThPK7nZsFJ3NR8BwTGcwqLwOjK3AZz2pfZ I905VJCKHQ7GqxxIJW/quKhFtRtwKrhj9iMDI1jNGN34lYbOHs8BVibRClFpyiaupK/gS8p8ier KROPx1RLd/aBa1nPwdikYAhEHaQWn6E4RJGHYvCfWupvdLDzZl/gN+vUeDTLJcIFzkWbm9sb4S9 vo/3T2IDsGaQ35fDbMszd14JcaFKfyb3OS2wnpFJpGA2CwN2B/qmYIYI58hedtptzBNZ5eGb1eB 7aaeWBTGOKT1G6pV6/cz5ycpInVHEHheBf3vb8k3TDDqBZlW9nnLPwSjdPKGQCitTg== X-Google-Smtp-Source: AGHT+IHIx4leUuspMjpWzO+3Wj2A3mhErhuiD2Bz9XyO1/h5M4RnaibopAF5vU8f3ZAYNAwt67HZkg== X-Received: by 2002:aa7:8889:0:b0:730:979d:e80e with SMTP id d2e1a72fcca58-7329de640dbmr11337339b3a.7.1740043849365; Thu, 20 Feb 2025 01:30:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Magnus Damm , Thomas Huth , Shin'ichiro Kawasaki , Rayhan Faizel , qemu-arm@nongnu.org, Evgeny Iakovlev , Paolo Bonzini , Peter Maydell , Luc Michel , Yoshinori Sato Subject: [PATCH v2 6/9] hw/char/imx_serial: Really use RX FIFO depth Date: Thu, 20 Feb 2025 10:28:59 +0100 Message-ID: <20250220092903.3726-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250220092903.3726-1-philmd@linaro.org> References: <20250220092903.3726-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1740043888392019000 While we model a 32-elements RX FIFO since the IMX serial model was introduced in commit 988f2442971 ("hw/char/imx_serial: Implement receive FIFO and ageing timer") we only read 1 char at a time! Have the IOCanReadHandler handler return how many elements are available, and use that in the IOReadHandler handler. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- hw/char/imx_serial.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 38b4865157e..6f14f8403a9 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -386,7 +386,8 @@ static void imx_serial_write(void *opaque, hwaddr offse= t, static int imx_can_receive(void *opaque) { IMXSerialState *s =3D (IMXSerialState *)opaque; - return s->ucr2 & UCR2_RXEN && fifo32_num_used(&s->rx_fifo) < FIFO_SIZE; + + return s->ucr2 & UCR2_RXEN ? fifo32_num_free(&s->rx_fifo) : 0; } =20 static void imx_put_data(void *opaque, uint32_t value) @@ -417,7 +418,10 @@ static void imx_receive(void *opaque, const uint8_t *b= uf, int size) IMXSerialState *s =3D (IMXSerialState *)opaque; =20 s->usr2 |=3D USR2_WAKE; - imx_put_data(opaque, *buf); + + for (int i =3D 0; i < size; i++) { + imx_put_data(opaque, buf[i]); + } } =20 static void imx_event(void *opaque, QEMUChrEvent event) --=20 2.47.1