From nobody Thu Apr 3 21:44:56 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=1741138246; cv=none; d=zohomail.com; s=zohoarc; b=OUDcmWfCHqTFWsr6+RnvTWm192nHXEjmuwc1Iys8p3TIUOxiII4NMAyj+s0QDdu4yS+mZWHneQ7DFnQy9qwBBO53ygI9cCp8TjrVSYmaS2ooVIHAI1x4ABJjWdacAyhvlmbRUCizBW2kNTseRyz52MDQGZPjIqn7/kl55orXe5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741138246; 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=ZnAwaBdhJN/kNZhyvNDoVKLIcUFbc7BOsa1ZC7/+qgE=; b=drwZtosghrRb3OnD0+FgnuLwdDy/3aEx37wVlBI+fQlHV2oVwgxRAeqP9WhICPkXAmKwVqiu/LVjXdojVzxqdpVt9j0zp4RinvJtppErUuaSL1ryjBWvWExT9wPU/7JaRpG8MbgJjMsFjFyAHkzPvM7IEhGBO4A6ITznLpCrZtk= 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 1741138246846565.3930638043521; Tue, 4 Mar 2025 17:30:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpdVb-0004QT-En; Tue, 04 Mar 2025 20:25:17 -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 1tpdUI-00021w-8t for qemu-devel@nongnu.org; Tue, 04 Mar 2025 20:23:55 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tpdUG-00079J-M7 for qemu-devel@nongnu.org; Tue, 04 Mar 2025 20:23:54 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43bcad638efso10144815e9.2 for ; Tue, 04 Mar 2025 17:23:52 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-390e4795962sm19846140f8f.13.2025.03.04.17.23.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 04 Mar 2025 17:23:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741137831; x=1741742631; 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=ZnAwaBdhJN/kNZhyvNDoVKLIcUFbc7BOsa1ZC7/+qgE=; b=ckD8q9cCjeg07PFn5jvflfQRaryZPLVyiyMTnrDScblq4oZfVB7/qjFD54p+fU08Oq 2FtE90CgjjcNcS3KK05g8kqFV0m3pj5Pth/8iU9exYyZu51TMgOS8oIoy1tyMp2mwKYH Vh/CzpeGOabTwusaruXBzUvEQGqayGJ/RMju39w/HXdDNwjxqaO9z3GCYUsxFhgAwH/B Arvr3v3/3vDReg5mOzKfYit+3plxYzJiS9Y3is84moqWyGNuET8+CBM2oTkEXIxZGbez yffAFcyP91Yxs3jazH1c9gQPalEP1uV630ORxFxQp7aqSRb7jqrTL1oHrYyZ926Rmz6k sVLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741137831; x=1741742631; 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=ZnAwaBdhJN/kNZhyvNDoVKLIcUFbc7BOsa1ZC7/+qgE=; b=aXMwooP8B0sIt51phEjp8bnZnwsZpdHMLzbT+XaBmA9tkzHy0APVqlMwWW9U6PLXlt 8daVNz7BVz7NaCLqTvW0QEDBvrQCNp3A9RAHTVUi91UpHHfCYNOa6Qsdbr/oi+ep64lo ubGa+EJXO3D+fiaxMHS/ku5RFICvr+eisWYpW7pzdUoS0nSIwVcPiUkHlPzei2CtKNKD 9y09J0FMLVxDXHgytEitlPqnyrHubQ6pUIneoFPR3yXGwilxA50E/bW84sShjXsMVZ+O Fn709MBRvzQoNOXuI3jBHexGGyTMBipyeWsr/SnqJk2sis3XS7/aMCOTUonaJG6E3do0 EkvQ== X-Gm-Message-State: AOJu0YzqhoMwrdd61TksbE6cl5nu2+WlhzILdHMEtWGGEoXp2AuVz0SJ I3Gt5dpDUYnxUIbSG9Qyjm2gYpQRsV73W0j0i4JwTYKhGhXrirlJ4/h4yCdck2RSbKGJPD9QC69 RioM= X-Gm-Gg: ASbGncvSp2GAX3XleuOzwew8sEfdjrNKQgxFLppKtySYu6DnKXCBfpbKUDnScdbmaif MqfcAaM5PaQIrBJE0SYPIY+7m86oJYRmDAEYBAQXR9F160+ORkLaE5ejCfMkMxQF+S04Lu19QSr 0DxswN1tFaMvtVGx5S6sDc+nUaEuARpJorwqFw/F+bjFdZBr7rkulMwMCsJLT2tQrORyWOuzp44 2R2nXdb7KIsiZLffFvzZiMl51tLyy3oRmOqj+ok2a3qn83XgwLbeoREWb2EWbTpKifdchcA9Iud +gTNjC8Hh9LO1zr8q/H+zkOsbeYyM2ut3YhidFPJbWhPBQy4Xt1sIm8T2RPaSTpsEZRnuZqkLdu QZ+5vyEIlwM0ZkotHowk= X-Google-Smtp-Source: AGHT+IHQjFcVkrER2JAN0yrKdDyhp69G7z/M3MsPPRTR3N81lST5vwanaLoZdXDVR9aUVwms6Ax5sg== X-Received: by 2002:a05:6000:156d:b0:391:10c5:d1a9 with SMTP id ffacd0b85a97d-3911f76e3a4mr736504f8f.31.1741137830987; Tue, 04 Mar 2025 17:23:50 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Richard Henderson Subject: [PULL 23/41] hw/char/bcm2835_aux: Really use RX FIFO depth Date: Wed, 5 Mar 2025 02:21:38 +0100 Message-ID: <20250305012157.96463-24-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250305012157.96463-1-philmd@linaro.org> References: <20250305012157.96463-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=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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: 1741138248355019100 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 Reviewed-by: Richard Henderson Message-Id: <20250220092903.3726-6-philmd@linaro.org> --- 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