From nobody Sun Feb 23 12:07:32 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=1740043932; cv=none; d=zohomail.com; s=zohoarc; b=PwQBLBFcuarIOdLx7iP38oNowqx6X3Fjpd99FhwOMmjDBJ9qep3HOmTuOCPiIokByXjV+UyCN2XNk55BmfNeLIvrrCQu6iRVc84UNkhTIORlIUultDLWVZUlONwWFE5Z8a3w7PLpbwpKfYpmEgkJmtlaNzN/dtShPoB1AfAcA0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740043932; 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=GNUu0QLM1jJD6vp7svI4zxOCu3a+5YIL+dQ3Ih3Jc18=; b=R3BInALbUrdAMsdbgCjnTrEev1Pj1YtV/kguBzqVrAsnausS0LuOI/fkHKL+xCS5TQn3y36dZlZT65OTx2m3v0m6p4WJGjXfUwsY8Zrs//i2TH/Q0Rstbl3pSCxlvh663cZc2XIMFqqbgjwbAIf73FwYWiH33GGyKFv85hxkDys= 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 1740043932257793.354694123034; Thu, 20 Feb 2025 01:32:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tl2tN-0001KJ-7a; Thu, 20 Feb 2025 04:30:49 -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 1tl2tC-00018w-Hc for qemu-devel@nongnu.org; Thu, 20 Feb 2025 04:30:40 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tl2t9-0003nq-Ik for qemu-devel@nongnu.org; Thu, 20 Feb 2025 04:30:38 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-220d39a5627so10011875ad.1 for ; Thu, 20 Feb 2025 01:30:35 -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-7324273c8a4sm13283568b3a.85.2025.02.20.01.30.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 20 Feb 2025 01:30:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740043834; x=1740648634; 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=GNUu0QLM1jJD6vp7svI4zxOCu3a+5YIL+dQ3Ih3Jc18=; b=ccJG7RB/NrTPd4A8fwkC2nq6Of9c6sb9+p/yQVWN96xxDew2qKj+P+uVtGMnVq8TYH Rxjs1mNByDoR8ze1hOedHRN8Hoe1t1pmLeafIPHWjMYiO+fVN6IPiqFNV22UGuiJ2I/2 v2Iw27Cr9iQQJK4w2U3V5JmQ+QdXLvykSd9leyP8S8a9FtJoZhVl8qKm1QQnTPMBYCLr 19rhS2v3B85+F0Pz18FfgvSiFOoCMFHeBuRUlRBRzPoo/6bmGpF2KV/DhWRRHpmpXTrK BTushJ+NIfwABfK35YQMZF/g0FG5DsOovewhJytWeVR2q7nZptjJ+rLr40izusOxoGCM HJpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740043834; x=1740648634; 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=GNUu0QLM1jJD6vp7svI4zxOCu3a+5YIL+dQ3Ih3Jc18=; b=CL0fAvBbzebOpmFUT8Mi8lBOI7mP00gbbiJLc9/yqEKxS49DJxMgca7Zh11AN3U6gb KcuqRbJ+UkjyxdhsoZeAEWz4gPmW38bha1ViPeu1PzfIte7cEqwKuxuJLFyyQiaVZ4Ei t7AqlXpgHN+S2/89RL70tXQO2tEYGFV0KqOhNp5bcE2tMvAaW9I/gTuUlZQr8EaZM37B DcMZlLwLzHdlPK7A7W9W++52yV/W5cRFgYSbg3Kgghj65urwvZl05T5CUuG9Ypp15gZY p+zafHeQRqR/tzapvg+yinw+0o9I1wxOgf21/VTeO1XZZaR7REoRgliVJ7HHVsa22nF0 IGtQ== X-Gm-Message-State: AOJu0YyBmpmAikHXPMaudwLvkgGTdDvpceBCQmzffFMeRwWnCLJuluf8 iIFnU7qvN++ZgGkzD9IqRGhIAdiNYr+RPNmuvNnKkScIYVeFVreiteKXx3XOEziAv8oqpujH7lY fIxM= X-Gm-Gg: ASbGncvWFUEzv0Af5aqxq+UsnwYx2qm6TBSrm8tH7qTI3a44cTFUqK9R03gntF6SwNG iQSRbTHCC85RwlOjK0e+opGomke3GVgeIi93Xd1NO5CqOObyeSbLcfVY9DVnIclE1NA14hTh6bV bntmnKmKqx3tz1peIK39UZOGEJD95wk9tjN7DHPysgokVNzP4/Qilr9V7t8b07c/a9vkUCZUb3w V6VUECt4rSj4BialE9YffxeaP4rUdMM2nqL5hqErIlxPUcAHdZe43pmh0UuN/ZDdJYpUwteZdWY gZWxETCTo5xEnrj8xZ0iULMkWSK2GrR0ScQKK7lIgq8jSdHqX9jmcs58W3pKUClESg== X-Google-Smtp-Source: AGHT+IHtCdGVpk6l604E32RACxb+nA/F1wtoRn4fYgBQOiATMnUaayVbCelxsQJslZPg5LYVQHWVoQ== X-Received: by 2002:a05:6a00:21cc:b0:730:4c55:4fdf with SMTP id d2e1a72fcca58-7341725faf9mr2898714b3a.7.1740043833647; Thu, 20 Feb 2025 01:30:33 -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 5/9] hw/char/bcm2835_aux: Really use RX FIFO depth Date: Thu, 20 Feb 2025 10:28:58 +0100 Message-ID: <20250220092903.3726-6-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::634; envelope-from=philmd@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1740043932468019000 While we model a 8-elements RX FIFO since the BCM2835 AUX model was introduced in commit 97398d900ca ("bcm2835_aux: add emulation of BCM2835 AUX block") 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/bcm2835_aux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index 73ad5934067..c6e7eccf7dd 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -221,7 +221,7 @@ static int bcm2835_aux_can_receive(void *opaque) { BCM2835AuxState *s =3D opaque; =20 - return s->read_count < BCM2835_AUX_RX_FIFO_LEN; + return BCM2835_AUX_RX_FIFO_LEN - s->read_count; } =20 static void bcm2835_aux_put_fifo(void *opaque, uint8_t value) @@ -243,7 +243,9 @@ static void bcm2835_aux_put_fifo(void *opaque, uint8_t = value) =20 static void bcm2835_aux_receive(void *opaque, const uint8_t *buf, int size) { - bcm2835_aux_put_fifo(opaque, *buf); + for (int i =3D 0; i < size; i++) { + bcm2835_aux_put_fifo(opaque, buf[i]); + } } =20 static const MemoryRegionOps bcm2835_aux_ops =3D { --=20 2.47.1