From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83BA6C5B572 for ; Tue, 25 Aug 2026 04:05:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wyiPg-0006Hr-ET; Tue, 25 Aug 2026 00:05:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wyiPe-0006HD-9c for qemu-riscv@nongnu.org; Tue, 25 Aug 2026 00:05:26 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wyiPc-0007dM-MU for qemu-riscv@nongnu.org; Tue, 25 Aug 2026 00:05:26 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2caf228a910so33237425ad.2 for ; Mon, 24 Aug 2026 21:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787630723; x=1788235523; 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:content-type; bh=r9YZtJePZ3XT7IoRh5uSQAmm2CNF2ALweHO4SvoI3s4=; b=FIPwN1mCqMpPRzI7qAiRnstt843eeHXP4thBPy6SIU/pk5cmGaWzNiv6fnkJYReM32 uvEHYaWoN3MCrmX32m7S+CTF4eZ95n1vHTqmfAaw2Rtpd4PLjI63MrR/6BadJmxKOh19 2iEJlLiQ2RWUTpsw7r4Xzf92T/Uxxi0UPADXNxP+8jVrMWOWM1r8jEcBvzGWvQDpqTgo WCHY4VkxiVp+UBZlJqo4jktXvCBbGmRQ8fDy6my3uzkW4Jneyj3v5W/Q0Jw4N/GObF9n DVJYd04jHh6tzVcWMWxKObkVD1pBPS/fCqwtgMq/Kl9TCCWeqIFOmDqx8EyX4vrM9yt9 3t1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787630723; x=1788235523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=r9YZtJePZ3XT7IoRh5uSQAmm2CNF2ALweHO4SvoI3s4=; b=Tlb6CVsvODt7/ptGgtQpOcSjzx0Ft3Bd2wDQWUd1M6WlrGHSmRxaru/ZPm3yaOhH2z OjZ4p2YZUwrn+E6VqauFU6bmAMsgrL5nqh2WDceKah6RKZTlJ9n18WxRj8vIPksV/Tq3 9+wKM+WAXb4f0aCS3J574GnXZ3CtcsRmZoNYEWnBh3jg5EDiR4508Tuwiqv/QpI1dn4T rkqCbQf3jjrAZhRFFmLtBy6k3CsDkKCaAerJHCb4MRx8agSELgtcCYxE1d/aFPzJqaLH nT007Soz74t5rjifqO6G8F3CtvQkBHsUKBqOVWvq14ohlUvqz01EMNufWqUgLcxVUB2Y NVJw== X-Forwarded-Encrypted: i=1; AHgh+Rp2FVB/NMz/nBxJ/vN87FSeEkCE6kl28giMuWUj18vfFbYSJDF8y5aIM3LKkQQPTEpD5yh9x7EX1wTQ@nongnu.org X-Gm-Message-State: AFuF++kgFGvR4j5WQf4KwkJORlGKF63LE/bFwbesS9KJEvJEGxKaKPiq VY3cvHoZY4awxw9SSQdk/Yj8IGM1WWegxEHDj9HgfsKTyZH2ziIUjVMR X-Gm-Gg: AR+sD11BbbHEVbcshO6RK0QEwkug1wAl4Balu4FIjeXZGZ6T1ZJiVk8LoxEbJL49dZZ uP4CbdHSSYm1TrTI6jDIAV0ZFT6fAzq+JmAkw2KoopVPHcQN8JOmNIzX0ErOAxFAP4smRyRZnUH Hfvzhxdvgi+cehcr0PDHoTzfJ6XLmR3WHAtkQikhFGvfL2oCMCbbR58EKMpcSeGmrKv2rwreIWi htj23pBKuK+blbkiXJPfQ6VIXbId1InkZSZSTUz8QCy+ko2OmBPVclAM/melw3HSiZkEH3+zU+K 6mJw49wt+bSWNhlIYnQpe0szl7TPrgpEFdjBzX81plFA6fQ4k0YGUz3eghnIvtII7neHfqwQTuo XEAfOKVp+x4cYzaxZW1F0inFtaE74GQjOq2Bh0k5FA3kkfCVLPOVWU/oI2eb35m4PQjitIDcV6O g+DaLpMg+CCr+osJeqr0bLZSB6M1YBAcdbdZGl5fnIb/G2whdjC++hv39/lxqUloYQkhPmOvgCv a/0TYCJc2AGrMCVhHMljJ3rwVg3Zo6PzA== X-Received: by 2002:a17:903:3888:b0:2d0:cc92:f7c2 with SMTP id d9443c01a7336-2d670b4cdc9mr431321115ad.1.1787630723312; Mon, 24 Aug 2026 21:05:23 -0700 (PDT) Received: from lima-default.tail89d63.ts.net ([159.196.41.205]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-327f909adc8sm34104212eec.2.2026.08.24.21.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 21:05:22 -0700 (PDT) From: stephensportia@gmail.com To: qemu-devel@nongnu.org Cc: Palmer Dabbelt , Peter Maydell , Jamin Lin , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Steven Lee , Andrew Jeffery , Harsh Prateek Bora , Subbaraya Sundeep , Troy Lee , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alistair Francis , Strahinja Jankovic , qemu-arm@nongnu.org, Tyrone Ting , Nicholas Piggin , Aditya Gupta , Kane Chen , Francisco Iglesias , Joel Stanley , Hao Wu , Glenn Miles , qemu-riscv@nongnu.org, Jean-Christophe Dubois , Portia Stephens Subject: [PATCH 2/4] hw/ssi/pl022: Fix dropped upper bytes of ssi transfer Date: Tue, 25 Aug 2026 14:04:50 +1000 Message-ID: <20260825040452.1322251-3-stephensportia@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825040452.1322251-1-stephensportia@gmail.com> References: <20260825040452.1322251-1-stephensportia@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=stephensportia@gmail.com; helo=mail-pl1-x62f.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, FREEMAIL_FROM=0.001, 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-riscv@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-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org From: Portia Stephens The pl022 model suports transferring a 8-bit or 16-bit frame width. The 16-bit transfer is broken since the upper 8-bits are being dropped by the SSI peripheral transfer function. Fix this by adding a second call to ssi_transfer8() when the frame wdith is 16-bits. Signed-off-by: Portia Stephens --- hw/ssi/pl022.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c index eaac664ec5..f4ade45ca9 100644 --- a/hw/ssi/pl022.c +++ b/hw/ssi/pl022.c @@ -74,7 +74,6 @@ static void pl022_xfer(PL022State *s) { int i; int o; - int val; if ((s->cr1 & PL022_CR1_SSE) == 0) { pl022_update(s); @@ -99,13 +98,18 @@ static void pl022_xfer(PL022State *s) the transfer has completed. */ while (s->tx_fifo_len && s->rx_fifo_len < 8) { DPRINTF("xfer\n"); - val = s->tx_fifo[i]; + uint16_t tx = s->tx_fifo[i]; + uint16_t rx = 0; if (s->cr1 & PL022_CR1_LBM) { /* Loopback mode. */ + rx = tx; } else { - val = ssi_transfer8(s->ssi, val); + if (s->bitmask > 0xff) { + rx |= (ssi_transfer8(s->ssi, (tx >> 8) & 0xff) << 8); + } + rx |= ssi_transfer8(s->ssi, tx & 0xff); } - s->rx_fifo[o] = val & s->bitmask; + s->rx_fifo[o] = rx & s->bitmask; i = (i + 1) & 7; o = (o + 1) & 7; s->tx_fifo_len--; -- 2.43.0