From nobody Sun Nov 24 12:59:29 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=quarantine dis=none) header.from=schmorgal.com ARC-Seal: i=1; a=rsa-sha256; t=1723832368; cv=none; d=zohomail.com; s=zohoarc; b=BUeG9bEDUzuakHr9SwtrEf7A1xb4vMrSXdxqFmMjbukXXcD+squnaw02SQ0XAEeP7Lmb4qTD7eDAJQ/c1grb+CQxCnVkBq+CCja01DZXzc3sIkKbhSXH3mr67bf0h3jR6SqqahALdDw+0FrbjITpSdVqyxU3QkSFj2r/Q7icM8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723832368; h=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=gF5wQtBRwS5BcKCR1fatsaBhyKFb2ABe75XUBpYoZfQ=; b=nnWpTTQAFlK/qA1JEKJyZzaDhysoxi+pc24Eotw86Mn4YTfP8IlNhx0QHfi9GoXQke636fCs0uqCLxJHcjfhAL8DTaJFq+AVj5vX4qhkRV9/Wo6EprMeQ+4Jgzkm9W3Wzhkcw5HzUcE68FyYBkdJdh7x4et3BqsE/A8ZnEK2huw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1723832368007684.5275432933748; Fri, 16 Aug 2024 11:19:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sf1X9-0004nW-4x; Fri, 16 Aug 2024 14:18:43 -0400 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 1sezwf-0003Hy-Tm for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:57 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sezwe-0002Kj-8t for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:57 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2d3d4862712so231738a91.2 for ; Fri, 16 Aug 2024 09:36:55 -0700 (PDT) Received: from doug-ryzen-5700G.. ([50.37.200.153]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b201sm2134285a91.15.2024.08.16.09.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 09:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schmorgal.com; s=google; t=1723826215; x=1724431015; 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=gF5wQtBRwS5BcKCR1fatsaBhyKFb2ABe75XUBpYoZfQ=; b=bOOgpPU47DHLJqCgRPm+hiL9bFX8BjxbHJ3FjbLoSfqQsK4q8iqwZP1QQ6GmO/Jl3v 2taBKBJSwsphcpZV3+Jcp92azg7E2TQd0Il8HVs4umrcXsBKder5PDM7hCm6WVzbLns0 KCQfDVo8yYtFOaW314OJCQcI9L0OSkx3eKxcE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723826215; x=1724431015; 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=gF5wQtBRwS5BcKCR1fatsaBhyKFb2ABe75XUBpYoZfQ=; b=ZrAJprBw1Wng+M1ZtHWYx4rDLrp1GWKfQsQ19XjhvpueA/0eyiJGRmuwN7lAUXvwtJ GDfRta+sjeh2phJHhAjpPVC7RSn6UQyRyYF5MYpAw2ZYBr/MAwOv6C6dpbCuuIrzb4dN /40sEBp+OaYJx7YweIyy8fcToStkFT7KsnzKS6ej96gej1Qblm9Ic753hs629M3kjVVf IZwQ6Pb1/ZoCK6Mh46YUy2zJRA1bVf69MD1J0TjaduOmEb4BP2/n7NGe07G4kqAR7lge Oj9Y4kTYVi008ndxOHPHoGTeB4oBuPqp6EachtV2A+I4M3f74IpaTcY5WAmMGTpL3c4N Nmag== X-Forwarded-Encrypted: i=1; AJvYcCW9Jj7WTbkBqMQEEM7b5WNSq2bfo4I3zEHhY7kO8AiGf9PdAtx3Mb72vgVINeR1gj5p5pIMt8HX8Y2MJUQ8R6kJggnBsfY= X-Gm-Message-State: AOJu0YwbjI5+NvZOhbl9NryCdElAK2GT/tVVOJ6zNrbKFIXHZSDqED7r /JMPDnC1QK9CBbnwBxUq2fVMbnH3mZkkYBnI9Ac7AQbdThKXRiBypzvmjfqXTBQ= X-Google-Smtp-Source: AGHT+IGzW99cJKbppBdD/yEWS+jyMZaQEUXcPyTXolnJe480/RZ09i+Lp2aJkXpbluZDqh6DlRxVSQ== X-Received: by 2002:a17:90b:124a:b0:2cb:4382:99f1 with SMTP id 98e67ed59e1d1-2d3e1e10102mr2129671a91.6.1723826214781; Fri, 16 Aug 2024 09:36:54 -0700 (PDT) From: Doug Brown To: Vikram Garhwal , Francisco Iglesias , Pavel Pisa Cc: Jason Wang , qemu-devel@nongnu.org, Doug Brown Subject: [PATCH 4/5] hw/net/can/xlnx-versal-canfd: Fix byte ordering Date: Fri, 16 Aug 2024 09:35:04 -0700 Message-Id: <20240816163504.789393-5-doug@schmorgal.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240816163504.789393-1-doug@schmorgal.com> References: <20240816163504.789393-1-doug@schmorgal.com> 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: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=doug@schmorgal.com; helo=mail-pj1-x102c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 16 Aug 2024 14:18:42 -0400 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 @schmorgal.com) X-ZM-MESSAGEID: 1723832369784116600 Content-Type: text/plain; charset="utf-8" The endianness of the CAN data was backwards in each group of 4 bytes. For example, the following data: 00 11 22 33 44 55 66 77 was showing up like this: 33 22 11 00 77 66 55 44 Fix both the TX and RX code to put the data in the correct order. Signed-off-by: Doug Brown Reviewed-by: Francisco Iglesias --- hw/net/can/xlnx-versal-canfd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index 1704b558d0..fda1e7016a 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -945,7 +945,7 @@ static void regs2frame(XlnxVersalCANFDState *s, qemu_ca= n_frame *frame, } =20 for (j =3D 0; j < frame->can_dlc; j++) { - val =3D 8 * i; + val =3D 8 * (3 - i); =20 frame->data[j] =3D extract32(s->regs[reg_num + 2 + (j / 4)], val, = 8); i++; @@ -1080,19 +1080,19 @@ static void store_rx_sequential(XlnxVersalCANFDStat= e *s, case 0: rx_reg_num =3D i / 4; =20 - data_reg_val =3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTES= 3, + data_reg_val =3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTES= 0, frame->data[i]); break; case 1: - data_reg_val |=3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTE= S2, + data_reg_val |=3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTE= S1, frame->data[i]); break; case 2: - data_reg_val |=3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTE= S1, + data_reg_val |=3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTE= S2, frame->data[i]); break; case 3: - data_reg_val |=3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTE= S0, + data_reg_val |=3D FIELD_DP32(0, RB_DW0_REGISTER, DATA_BYTE= S3, frame->data[i]); /* * Last Bytes data which means we have all 4 bytes ready to --=20 2.34.1