From nobody Fri May 17 16:25:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1611805079; cv=none; d=zohomail.com; s=zohoarc; b=KcyZaV3BTLUJ/Jg3zdJA4P1ObuYWfXONRpQ0DOftl00Vk8ITe+JrJ4VAQJeJ1gZePUOFl6Lkyj6Ilh58zd1CEFoujNRbNaHe8pXLN0vdfdxPg+H4UgZQeYnO67V+2bVtvIOq9s5yxiYplmo4y0ylg41dvSSm9bxPB4ZA9JbgjVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611805079; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=2TvIvkeqlt7iKDLohob+JM0A4aIwF+QFrj6135CGq/o=; b=ckgsV8DumYmowTSfrK1nJTvMUK7TqLT2yYvapZOFMNtqiVseRnUuWVm0AjjyEsm8n/DWLF+xTMBWa0lymf5GUTTebWSip8XJzcRuzeQpG/8n8Z4fWkxiDTy8JvPH9H9ScKwm73KnMo2PAnF5B7lULnvZgnnBoHyhGTU5D3piQbM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161180507986128.976727016376003; Wed, 27 Jan 2021 19:37:59 -0800 (PST) Received: from localhost ([::1]:52722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4y86-0000ae-B2 for importer@patchew.org; Wed, 27 Jan 2021 22:37:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4y7B-00007u-NZ for qemu-devel@nongnu.org; Wed, 27 Jan 2021 22:37:01 -0500 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]:38075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4y79-00011z-UM for qemu-devel@nongnu.org; Wed, 27 Jan 2021 22:37:01 -0500 Received: by mail-il1-x12b.google.com with SMTP id a1so3976175ilr.5 for ; Wed, 27 Jan 2021 19:36:59 -0800 (PST) Received: from localhost.localdomain (c-98-223-182-45.hsd1.il.comcast.net. [98.223.182.45]) by smtp.gmail.com with ESMTPSA id y1sm1984027ioj.32.2021.01.27.19.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jan 2021 19:36:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=modwiz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2TvIvkeqlt7iKDLohob+JM0A4aIwF+QFrj6135CGq/o=; b=ezFEoVJlu1HONc/2FSW4Q07HerF6LF49Vt9zLypK7idXSS7Oc7Xu0o4cg/Wt/3+v63 ic+bI2XVf6nreJfLDJFpXMESncFt+UAYOmHbt9Spxoyj+gj5xVsBQdAKFoSJntvA2UbV uY+3zMMFGzkXn4Oz49q6xwSoo8MXhgb3xNwKTkkpavxijm2OJoYI42utYpr3RLJQBBkG ligCLFGfPCWBX7VSvSt/2D3jsVfRyMo02UicHdKkiK96oZhMnEhRaI7dtrHOVugx5xlF 6gTzf9thiByJzpzV/gRgC5gVjK3f2MAbcU63DVU/RoHGVGyvVuwEqha8GnKo6DQEgZbp O2BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2TvIvkeqlt7iKDLohob+JM0A4aIwF+QFrj6135CGq/o=; b=pY3wP2hsJRGdw1U4ySykpTvtkeYsmQux7UTY6+9cxaENIIqwll8gu6gfpEI7hI8SCb i6W8FP5IW84Ei5Yze4X+Zu7vrb/nrnen/2m32n4LCDwDNwGGbkOJLXGV3Q6kroi58w0t LvcM5UCZkhSwCEln6xwXbHoHTvG83M/jWg1qteJsEPJtY0NLZoxeFbk2Yp/MmWcYqY6t arBqHoWszWvvTMk4t0qHipo41E54ForMypFstT2TxlhPMSkWrfpe9q8Rtm25TCcKWWdw dz9GoTKr8XwMd9VazkLpy/WnpaNhkTpPCqJ/GzRyOBjMPXkRohYVC3YwmKU+FW5zno3T ZmnQ== X-Gm-Message-State: AOAM533gGzq7qRz/cKrfrEqhASFsxURxXzmieHogTI82AtAGrxQ7QRAa QG0svbnVaufukeGh7DKcaUX+pg== X-Google-Smtp-Source: ABdhPJyRuXKVO4Nfhs0C7249adNGpLhnWPTYeYIQz6xBtvA22uFRfobeQsx+wTdO9v31djWbO11xrQ== X-Received: by 2002:a92:bbcb:: with SMTP id x72mr10897395ilk.104.1611805018277; Wed, 27 Jan 2021 19:36:58 -0800 (PST) From: Iris Johnson To: Iris Johnson Subject: [PATCH] hw/char/exynos4210_uart: Fix buffer size reporting with FIFO disabled Date: Thu, 28 Jan 2021 03:36:55 +0000 Message-Id: <20210128033655.1029577-1-iris@modwiz.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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: none client-ip=2607:f8b0:4864:20::12b; envelope-from=iris@modwiz.com; helo=mail-il1-x12b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mitsyanko , "open list:All patches CC here" , "open list:Exynos" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Currently the Exynos 4210 UART code always reports available FIFO space when the backend checks for buffer space. When the FIFO is disabled this is behavior causes the backend chardev code to replace the data before the guest can read it. This patch changes adds the logic to report the capacity properly when the FIFO is not being used. Buglink: https://bugs.launchpad.net/qemu/+bug/1913344 Signed-off-by: Iris Johnson --- hw/char/exynos4210_uart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 6361df2ad3..9b21d201b3 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -553,7 +553,11 @@ static int exynos4210_uart_can_receive(void *opaque) { Exynos4210UartState *s =3D (Exynos4210UartState *)opaque; =20 - return fifo_empty_elements_number(&s->rx); + if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) { + return fifo_empty_elements_number(&s->rx); + } else { + return !(s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY); + } } =20 static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int = size) --=20 2.25.1