From nobody Sun May 12 23:44:35 2024 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=reject dis=none) header.from=ledger.fr ARC-Seal: i=1; a=rsa-sha256; t=1638110833; cv=none; d=zohomail.com; s=zohoarc; b=TR9H9bYWsYZkxeSGKei1+yekLbkZs4BAWMpIAbjl0F+luUe0FJ2ao+TPnazyvkVUPwuqyQXOiIqLRlycFsjskueOv3wTe4HSgQilBGxdjBzoeL1yk8MEe7ztzQm8oZQZEMyQv/qgV4st3ZAUoSCrrGh1frCd8qYT/QajuZSaAHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638110833; h=Content-Type: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=jQoro6MoOyYUvAaYJa4JACu0dwvVZreQOV6JS13Ptk8=; b=UA/rBb/2rttLw7jjBnfJeg07pwudbUGNuYtQ1rSuWamDPNAHuBOzMBebE7x8qRZ8mkE1AuxBqs2NfnJkAShJK86W8EUH+PCdKUCm9x2s+xk+aWuQzALslBMfKCzmu16ZsORDPNFa2poLqnU/eUAOzKIKUVo5QGUNsFDJG3Mnh5c= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638110833582118.12439497648654; Sun, 28 Nov 2021 06:47:13 -0800 (PST) Received: from localhost ([::1]:35284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrLSS-0005I5-3Q for importer@patchew.org; Sun, 28 Nov 2021 09:47:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrIyF-0007Ha-GW for qemu-devel@nongnu.org; Sun, 28 Nov 2021 07:07:52 -0500 Received: from [2a00:1450:4864:20::32b] (port=55038 helo=mail-wm1-x32b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mrIyC-0004rt-R7 for qemu-devel@nongnu.org; Sun, 28 Nov 2021 07:07:51 -0500 Received: by mail-wm1-x32b.google.com with SMTP id i12so12244534wmq.4 for ; Sun, 28 Nov 2021 04:07:47 -0800 (PST) Received: from LPPS0075.home (2a01cb08019bba004d97cdf5dfbba74f.ipv6.abo.wanadoo.fr. [2a01:cb08:19b:ba00:4d97:cdf5:dfbb:a74f]) by smtp.gmail.com with ESMTPSA id m20sm19183537wmq.11.2021.11.28.04.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Nov 2021 04:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ledger.fr; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jQoro6MoOyYUvAaYJa4JACu0dwvVZreQOV6JS13Ptk8=; b=O8oFiQ9hBBzTUG3fwHvqRw/rehQB6sfWHINy/iPzv+bnE2OAPQl6iK106Sp9ALyeb9 lLORORU2R/exVSlwLONfqfpWwL+Kk9HB6E18RgKzpX49tb3qd9H2zW2oDEvPfDLdfw7E UHwSaj5eSJp0kQzs8msP/GaTdTsvvxM461KTiQOnJQ/chgfbcY5vj9M9EjyU6k6+QHta 85RjVXRiGyyiGRU06vhtLyTtwidaubv8MAxx8ajMg8AXzDX/pKYsh8q/8GrOYaEmfiEl d94AuQgWVJzwgrn9iV5KTtElto1R0U3aCVl0Ef5adFI8Q+1EkdDAeLbL3RRUfCBEOBmC Psqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jQoro6MoOyYUvAaYJa4JACu0dwvVZreQOV6JS13Ptk8=; b=MJv5C8dp+lluelEAqWLYMIzSl6q7chU5oszbp0PtzVpwZAOhQJ/43nbqOURqbjSZU+ lzjOysOAu53kqweob7A9SPbtH+SqLq3dvHvF9C9X7spMf3yEjV1Dv6yu85e/7/xsRh9/ vwAJw1f+6MvgCdj2wBIvfy4uNvCtT9/mP6NWI9x6fawJ4CP4qXtmttnUQaAgpgU5G9cy 9XPdt9yDYBQA+0+a0gtT2h5ap443PdQVxLAVuE/8QQG+jZPDF2jK9HZysMBjITAeAmTM m81FLBJZlvLa1Z2R8T03d1xCuSxwPg71ZDRTf5snA9Kp67MWoYyRN4VbCLl5IRLZHQsg y36Q== X-Gm-Message-State: AOAM532USYJ7K9MEEQBz9gbNv4gfnfKjSV+wZKF8G7XAVlgmXn3vcJTz hhD7uhG5OzyNe80MqJrN1pVTYGWkylnAkNFM7VUK9NVGFhsPOPw10bHNzfTTXLgMVzicy2D3oda rkETpA3CmVKFC/D2I04Q= X-Google-Smtp-Source: ABdhPJzUiz1it6NzEKL5qyf1c/cyMCSWnpK8b3/lpkvKdeQmiFxAey8i60PE6/9BU8c1KeYnKGjy8A== X-Received: by 2002:a7b:c194:: with SMTP id y20mr29579780wmi.61.1638101265614; Sun, 28 Nov 2021 04:07:45 -0800 (PST) From: =?UTF-8?q?Olivier=20H=C3=A9riveaux?= To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, alistair@alistair23.me, peter.maydell@linaro.org, =?UTF-8?q?Olivier=20H=C3=A9riveaux?= Subject: [PATCH] Fix STM32F2XX USART data register readout Date: Sun, 28 Nov 2021 13:07:23 +0100 Message-Id: <20211128120723.4053-1-olivier.heriveaux@ledger.fr> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32b (failed) 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: permerror client-ip=2a00:1450:4864:20::32b; envelope-from=olivier.heriveaux@ledger.fr; helo=mail-wm1-x32b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 28 Nov 2021 09:45:39 -0500 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" X-ZohoMail-DKIM: pass (identity @ledger.fr) X-ZM-MESSAGEID: 1638110835145100001 Content-Type: text/plain; charset="utf-8" Fix issue where the data register may be overwritten by next character reception before being read and returned. Signed-off-by: Olivier H=C3=A9riveaux Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell --- hw/char/stm32f2xx_usart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index 8df0832424..fde67f4f03 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -103,10 +103,11 @@ static uint64_t stm32f2xx_usart_read(void *opaque, hw= addr addr, return retvalue; case USART_DR: DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usar= t_dr); + retvalue =3D s->usart_dr & 0x3FF; s->usart_sr &=3D ~USART_SR_RXNE; qemu_chr_fe_accept_input(&s->chr); qemu_set_irq(s->irq, 0); - return s->usart_dr & 0x3FF; + return retvalue; case USART_BRR: return s->usart_brr; case USART_CR1: --=20 2.17.1 --=20 Les informations contenues dans ce message =C3=A9lectronique ainsi que cell= es=20 contenues dans les documents attach=C3=A9s sont strictement confidentielles= et=20 sont destin=C3=A9es =C3=A0 l'usage exclusif du (des) destinataire(s) nomm= =C3=A9(s). Toute=20 divulgation, distribution ou reproduction, m=C3=AAme partielle, en est=20 strictement interdite sauf autorisation =C3=A9crite et expresse de l=E2=80= =99=C3=A9metteur. Si vous recevez ce message par erreur, veuillez le notifier imm=C3=A9diatem= ent =C3=A0=20 son =C3=A9metteur par retour, et le d=C3=A9truire ainsi que tous les docume= nts qui y=20 sont attach=C3=A9s. The information contained in this email and in any=20 document enclosed is strictly confidential and is intended solely for the=20 use of the individual or entity to which it is addressed. Partial or total=20 disclosure, distribution or reproduction of its contents is strictly=20 prohibited unless expressly approved in writing by the sender. If you have=20 received this communication in error, please notify us immediately by=20 responding to this email, and then delete the message and its attached=20 files from your system.