From nobody Sun Nov 24 09:26:43 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=1723832327; cv=none; d=zohomail.com; s=zohoarc; b=dYLxg+E2jQQ5yU+qCNGLpkf65xJOgBqVI1QQin1d78DPKWe+smsK/TKZ/6CdAdUq7UnIFyojRDv+LQnP6RJ7/b7JuaPEc+MM8z1A+vy5I9wZkPzvEye1WR88xytUUfVKczcnNlh2eyyjGyM3BBAbKPqKBNXARxbwChlTCIfMsDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723832327; 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=Hpykp3v3nUS3no6XDt2FDZxaHDZOI6A5wRB8LlJUTdQ=; b=Ni1gJnHsXFkr4Dm2YEax1IxQonG7my3uD8VSgQTaoC/66ppLbMnj8TgxsWBuPMVxvjjQx31x/ytL6pJpVehm2hMZhq4zQ0tUhXM6DHXT5A1PgHWMFBb5qARJxlLGKcCr/zIz+TjMtdtiAZYX7xoWzBRcp0kIQGVXdPv1vzM3lAw= 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 1723832327557910.3092866132821; Fri, 16 Aug 2024 11:18:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sf1X2-0004LI-TI; Fri, 16 Aug 2024 14:18:36 -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 1sezwe-0003GX-FR for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:56 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sezwZ-0002KG-7h for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:56 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2d3ed48c748so159303a91.3 for ; Fri, 16 Aug 2024 09:36:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 09:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schmorgal.com; s=google; t=1723826210; x=1724431010; 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=Hpykp3v3nUS3no6XDt2FDZxaHDZOI6A5wRB8LlJUTdQ=; b=VqjC/92pQ54Pj0Mzn0kzAxfEQ8vMZgqMoxKEGM8NHas1Te9LJ782Jc26Iit+mpCJlw NZXlzFdsEu9FZBxeLWOC67oHdI/Hc9N/it/e45W/oEC5OyfN9qzbHio+55WheMWVo5og IU6eJu6OTJbcn+S0/0+brYUdc8Pl9vMNnwbYA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723826210; x=1724431010; 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=Hpykp3v3nUS3no6XDt2FDZxaHDZOI6A5wRB8LlJUTdQ=; b=NgiopPYQOz4Y1EutX65XKzKXwP7hSD/gqVecXZrC6ehQMo9ck334vleFacT2VCc4np I663NNIefw8hrr8SUNWLVgSrxfVFip/U09jd5Ee3ZaQ8wBlkyW8iTmmozpWRgSIOqJgb rVv5a9HPoJ8fbvxkgX4ty6U8CeL4qxNLp5AvOSJexuTHSTWIGnPFgDuYOLKoM2O80Cm/ BSueFj2DwUwqYtCT/3Bjw9uy4Z+9YtrhvF/Ccjy2RJSf3xniDGC3WVclvaueFmzs3Qzj Ct//S6DGdIZN94CB4Zs5woz5m0BHkd7nVGWHz6yLLzXvdMEYfg05SDDHhAUsIUGp5QxE UMHA== X-Forwarded-Encrypted: i=1; AJvYcCWRAc+mgtRjqTKiMzyvnx1SKwdv15StKeT13t4L9Ny5ZdDUsffsjLpbJC6ZSpiZiKWs6jpT8uWWkVxL@nongnu.org X-Gm-Message-State: AOJu0YzrcMhB7JZCTsJiIPhhkSZChZFaULzVC9csD7XCFd5QmWvAevVI TfUWiy/GAhjm4D+NZGrPeZDfe/VOUE7XNWsjnCXDMxugtWfzPXdfm8f0CmGg1UE= X-Google-Smtp-Source: AGHT+IHtue1ofcS5v4Hx4+pAt9Dw9ZXebnre/TFnx2PeOqt8lj0qBsytmNORWwtiXFPBgWyZLAcGKg== X-Received: by 2002:a17:90a:ad83:b0:2cd:1e0d:a4c8 with SMTP id 98e67ed59e1d1-2d3e02ebd87mr2208763a91.3.1723826209538; Fri, 16 Aug 2024 09:36:49 -0700 (PDT) From: Doug Brown To: Vikram Garhwal , Francisco Iglesias , Pavel Pisa Cc: Jason Wang , qemu-devel@nongnu.org, Doug Brown Subject: [PATCH 1/5] hw/net/can/xlnx-versal-canfd: Fix interrupt level Date: Fri, 16 Aug 2024 09:35:01 -0700 Message-Id: <20240816163504.789393-2-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::1030; envelope-from=doug@schmorgal.com; helo=mail-pj1-x1030.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:34 -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: 1723832329662116600 Content-Type: text/plain; charset="utf-8" The interrupt level should be 0 or 1. The existing code was using the interrupt flags to determine the level. In the only machine currently supported (xlnx-versal-virt), the GICv3 was masking off all bits except bit 0 when applying it, resulting in the IRQ never being delivered. Signed-off-by: Doug Brown Reviewed-by: Francisco Iglesias --- hw/net/can/xlnx-versal-canfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index 5f083c21e9..ad0c4da3c8 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -682,8 +682,8 @@ static uint8_t canfd_dlc_array[8] =3D {8, 12, 16, 20, 2= 4, 32, 48, 64}; =20 static void canfd_update_irq(XlnxVersalCANFDState *s) { - unsigned int irq =3D s->regs[R_INTERRUPT_STATUS_REGISTER] & - s->regs[R_INTERRUPT_ENABLE_REGISTER]; + const bool irq =3D (s->regs[R_INTERRUPT_STATUS_REGISTER] & + s->regs[R_INTERRUPT_ENABLE_REGISTER]) !=3D 0; g_autofree char *path =3D object_get_canonical_path(OBJECT(s)); =20 /* RX watermark interrupts. */ --=20 2.34.1 From nobody Sun Nov 24 09:26:43 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=1723832375; cv=none; d=zohomail.com; s=zohoarc; b=Hxi1qqd+p7LrQ4akn5zIYo221BfhZElmBZwFy8AbYAn8Facpc+iDcyX2QAyK/B1st3tOnp2VMWbgeGzf4T/PICVLxziCvuGQXH1sj+CvyLXM2hoGly5wtwdxh8yQVhfK70sUI1EckEzboWYPTi1BXOxIIf4dg+sKD8la+LHKCJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723832375; 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=dXryEFEA7lHJuOcvJ0eJXPDARQuNMSDNxcV14dvqN78=; b=TaEC/IwSMODNlHVOCoxbr4Z/KNk9u+nnLNt49ztnAxOtSv0OPPfRo2V1gK8OFF/Va7zRXbVUWWBL3ZrzZAy4wffi6Y2KB59P+D/V6FsgLTKohqE3S2U33daUFRyCp27sOLw18bai1Msgj74XDBosG4+bWn241SuPQGGbV4AnPLs= 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 1723832375031940.7050976739063; Fri, 16 Aug 2024 11:19:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sf1X0-0004B8-A9; Fri, 16 Aug 2024 14:18:34 -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 1sezwc-0003D9-JN for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:54 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sezwb-0002KV-2I for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:54 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2d3d486d8bdso251140a91.3 for ; Fri, 16 Aug 2024 09:36:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 09:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schmorgal.com; s=google; t=1723826212; x=1724431012; 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=dXryEFEA7lHJuOcvJ0eJXPDARQuNMSDNxcV14dvqN78=; b=d0GqBKRtoaTCNLivq0lRpT4CCGMYk7DRCsew2uhH2tgS5PLWx6qdZutkEAB7+H5K/b AL/K87ntTi/UWEpBwIJnE4ueA0A2E6jnAuIma2NKn65AamgPn0DJTOkSEuckv7lBJC7q aePjlDQepZVe79g+dM+JtZZTZ4ha9eD7ThNqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723826212; x=1724431012; 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=dXryEFEA7lHJuOcvJ0eJXPDARQuNMSDNxcV14dvqN78=; b=uhtVLT0/0JstRtU4wz15bIA6KYPOOcH5WoeAFGuBeC8EEAwOx0/5gFVerxkQFaTvH+ 8HeEnvWFEm+RVURKaiPKC/ZUMovNAWa0At+8xpx7OkdVxrojMN085mg30dWDQySLHMJa sIywBr45b1S+RB1DDdI5DdsOYnDfieRH9hKhlb+zRJXaMuZFMo26R8Ld1flMYPi5yq7t eh8tjGCWdJhs49/PW4w1tVzK6uTi3OYlCxr9E3W4ClbBRweL/7qkomJpYUIdPsfKHhP9 LIB5yLPOiEh03cwF4g/ikAzs2jp+PTCQKrP83+JknE5bdTyA9TlB+B0IOrdPi3UTUypU 4DNw== X-Forwarded-Encrypted: i=1; AJvYcCWbnd7IGyrx5XMgPv711+emrdM+Y7AsIzvRVh7mpevOePBxDYxvDISd38wEx3FuBpLPTsLwzMIGDYx2niP1D1iJh908B6w= X-Gm-Message-State: AOJu0YzixDAt/J+r1GJJ2O3zHn6SgnELFOMyX07QAz18bKBfulmqLhfo ueCaRvZiNr32sI8xdXV0V2uw0pIxc4Yai1wakZxW1WFE4PE0cZT/26LehXmNU+s= X-Google-Smtp-Source: AGHT+IG1xMWqUlrBaBAM2Ig1Zy3oH2zeBxbPZinOUbKwoliYaJUy1oxjBTWzR1J+iAELeEsTT6ugXQ== X-Received: by 2002:a17:90a:9a9:b0:2c4:cd15:3e4b with SMTP id 98e67ed59e1d1-2d3e086417amr2226352a91.4.1723826211670; Fri, 16 Aug 2024 09:36:51 -0700 (PDT) From: Doug Brown To: Vikram Garhwal , Francisco Iglesias , Pavel Pisa Cc: Jason Wang , qemu-devel@nongnu.org, Doug Brown Subject: [PATCH 2/5] hw/net/can/xlnx-versal-canfd: Fix CAN FD flag check Date: Fri, 16 Aug 2024 09:35:02 -0700 Message-Id: <20240816163504.789393-3-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::102d; envelope-from=doug@schmorgal.com; helo=mail-pj1-x102d.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:29 -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: 1723832375976116600 Content-Type: text/plain; charset="utf-8" When checking the QEMU_CAN_FRMF_TYPE_FD flag, we need to ignore other potentially set flags. Before this change, received CAN FD frames from SocketCAN weren't being recognized as CAN FD. Signed-off-by: Doug Brown Reviewed-by: Francisco Iglesias Reviewed-by: Pavel Pisa --- hw/net/can/xlnx-versal-canfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index ad0c4da3c8..8968672b84 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -1003,7 +1003,7 @@ static void store_rx_sequential(XlnxVersalCANFDState = *s, =20 dlc =3D frame->can_dlc; =20 - if (frame->flags =3D=3D QEMU_CAN_FRMF_TYPE_FD) { + if (frame->flags & QEMU_CAN_FRMF_TYPE_FD) { is_canfd_frame =3D true; =20 /* Store dlc value in Xilinx specific format. */ --=20 2.34.1 From nobody Sun Nov 24 09:26:43 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=1723832387; cv=none; d=zohomail.com; s=zohoarc; b=ecFlNBQCrLsBH9UH8UWA0lhLq5+m5fTNAkN2KIUzx70XSMWYA7jIN8WOo9/Pr1FFF1FruJKLahz3U4RXtcIxacEDlbJcEaY3K5jMa8lmBYiBbJ6OcmlavCGqkW/sNPzmuOu+CbswGL+VkxcwnAcI8dfP+l2anP+oM94mHxT6srs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723832387; 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=arg2TvA2GPM8gZ2q2s2JlR3QumG7iRuQQq7xe/+qsBo=; b=AYc2pjPvqvldkJmtWZk0V94brbZ1Og7v49mWZ9XvcGYsnA7e46fX0x/B5wW8iKzhF24ikXXF9bPKIh7zhr7WZuu/aW7mAKhduw7soFVNOw5340sq6uXLBF5QBh9IizglR1PjpSfAcmM3QBx60wbjckb+gRpSHWjSwmovAWQu47I= 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 1723832387729846.8401204634754; Fri, 16 Aug 2024 11:19:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sf1X3-0004O4-Ii; Fri, 16 Aug 2024 14:18:37 -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 1sezwe-0003GZ-Iq for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:56 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sezwc-0002KZ-Qf for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:56 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2d3e6fd744fso140153a91.3 for ; Fri, 16 Aug 2024 09:36:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 09:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schmorgal.com; s=google; t=1723826213; x=1724431013; 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=arg2TvA2GPM8gZ2q2s2JlR3QumG7iRuQQq7xe/+qsBo=; b=WFK6eqnZwsB/413xoHiWSa8YYHDM1Y5xomg9GPY7DdtysBkYxJH5RVVQqkmcesUkF+ Z8qajv/8glpmlgy7h4tUOns3jsu2zm7dSDmj1sDHtJez1Bw74xD21XCRbts858uZnbVe QeG8La9+KREf62bXjVxZ7wPfG3DuT6u0y++kw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723826213; x=1724431013; 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=arg2TvA2GPM8gZ2q2s2JlR3QumG7iRuQQq7xe/+qsBo=; b=Dw20SEGgSh2KpIg/iFZcc/PjixVpkByn7F0T0CmSCmoNpF5hECAHASRYnLLyerPDSu cr5FuDvuGGklnl5J5CvrmiaueLyiUVy3Dxq9gtm1F1PzKrY+tEmgsKotQ5tivyRrRbQq CJDAvfxlXSwn91SoywcRD4f7bn8qYbLhNvLmg2hleTWwYqOzT4NaUvGiYVy7Ex69b3FT rXR1E/VPqGfMQTdlInIWQN7TH0rE4pCEN86NrGlrIY4MnoN95G8hA8MI1qAFVz41ZbeZ ZIPRUag8MH9lfR9p8ZfH+3S4KNGu0eryIGSVf4CXcBbBgDdgMTVPwW7YCn3Q2TQwXya4 F5Dw== X-Forwarded-Encrypted: i=1; AJvYcCWAB6dnajPMuHNOjqjAR+u7ThjIVz2/d5zAwaiIWaqdDKcbGcYuLe7chlVV4FlrStj+ac4bOXLngovR@nongnu.org X-Gm-Message-State: AOJu0YzoN8fV+H9dUB/LxBr7+VYGQo74/BUkgq7t/8dY6nOiAP1nZHDW ItuoTnPT70shd7Gk2+YxEKoy6AjqTfw2+uJAAYLdXz/txIo+pBfrSbTuXsu/it50ceWAij1ngGY I96r/2A== X-Google-Smtp-Source: AGHT+IH6FsrYq3xYeN+0mTYBT1bY3l8I2ngn3RLvNXgzVs0mUr5pGTzRQ5xEVSmhszfhfAmPXNReqQ== X-Received: by 2002:a05:6a20:394a:b0:1c2:9009:f6f with SMTP id adf61e73a8af0-1c9a1e9bb9amr2043871637.4.1723826213350; Fri, 16 Aug 2024 09:36:53 -0700 (PDT) From: Doug Brown To: Vikram Garhwal , Francisco Iglesias , Pavel Pisa Cc: Jason Wang , qemu-devel@nongnu.org, Doug Brown Subject: [PATCH 3/5] hw/net/can/xlnx-versal-canfd: Translate CAN ID registers Date: Fri, 16 Aug 2024 09:35:03 -0700 Message-Id: <20240816163504.789393-4-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::1034; envelope-from=doug@schmorgal.com; helo=mail-pj1-x1034.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:35 -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: 1723832389523116600 Content-Type: text/plain; charset="utf-8" Previously the emulated CAN ID register was being set to the exact same value stored in qemu_can_frame.can_id. This doesn't work correctly because the Xilinx IP core uses a different bit arrangement than qemu_can_frame for all of its ID registers. Correct this problem for both RX and TX, including RX filtering. Signed-off-by: Doug Brown Reviewed-by: Francisco Iglesias --- hw/net/can/xlnx-versal-canfd.c | 53 ++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index 8968672b84..1704b558d0 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -869,6 +869,8 @@ static void regs2frame(XlnxVersalCANFDState *s, qemu_ca= n_frame *frame, uint32_t val =3D 0; uint32_t dlc_reg_val =3D 0; uint32_t dlc_value =3D 0; + uint32_t id_reg_val =3D 0; + bool is_rtr =3D false; =20 /* Check that reg_num should be within TX register space. */ assert(reg_num <=3D R_TB_ID_REGISTER + (NUM_REGS_PER_MSG_SPACE * @@ -877,7 +879,20 @@ static void regs2frame(XlnxVersalCANFDState *s, qemu_c= an_frame *frame, dlc_reg_val =3D s->regs[reg_num + 1]; dlc_value =3D FIELD_EX32(dlc_reg_val, TB0_DLC_REGISTER, DLC); =20 - frame->can_id =3D s->regs[reg_num]; + id_reg_val =3D s->regs[reg_num]; + if (FIELD_EX32(id_reg_val, TB_ID_REGISTER, IDE)) { + frame->can_id =3D (FIELD_EX32(id_reg_val, TB_ID_REGISTER, ID) << 1= 8) | + (FIELD_EX32(id_reg_val, TB_ID_REGISTER, ID_EXT)) | + QEMU_CAN_EFF_FLAG; + if (FIELD_EX32(id_reg_val, TB_ID_REGISTER, RTR_RRS)) { + is_rtr =3D true; + } + } else { + frame->can_id =3D FIELD_EX32(id_reg_val, TB_ID_REGISTER, ID); + if (FIELD_EX32(id_reg_val, TB_ID_REGISTER, SRR_RTR_RRS)) { + is_rtr =3D true; + } + } =20 if (FIELD_EX32(dlc_reg_val, TB0_DLC_REGISTER, FDF)) { /* @@ -923,6 +938,10 @@ static void regs2frame(XlnxVersalCANFDState *s, qemu_c= an_frame *frame, } else { frame->can_dlc =3D dlc_value; } + + if (is_rtr) { + frame->can_id |=3D QEMU_CAN_RTR_FLAG; + } } =20 for (j =3D 0; j < frame->can_dlc; j++) { @@ -948,6 +967,33 @@ static void process_cancellation_requests(XlnxVersalCA= NFDState *s) canfd_update_irq(s); } =20 +static uint32_t frame_to_reg_id(const qemu_can_frame *frame) +{ + uint32_t id_reg_val =3D 0; + const bool is_canfd_frame =3D frame->flags & QEMU_CAN_FRMF_TYPE_FD; + const bool is_rtr =3D !is_canfd_frame && (frame->can_id & QEMU_CAN_RTR= _FLAG); + + if (frame->can_id & QEMU_CAN_EFF_FLAG) { + id_reg_val |=3D FIELD_DP32(0, RB_ID_REGISTER, ID, + (frame->can_id & QEMU_CAN_EFF_MASK) >> 18= ); + id_reg_val |=3D FIELD_DP32(0, RB_ID_REGISTER, ID_EXT, + frame->can_id & QEMU_CAN_EFF_MASK); + id_reg_val |=3D FIELD_DP32(0, RB_ID_REGISTER, IDE, 1); + id_reg_val |=3D FIELD_DP32(0, RB_ID_REGISTER, SRR_RTR_RRS, 1); + if (is_rtr) { + id_reg_val |=3D FIELD_DP32(0, RB_ID_REGISTER, RTR_RRS, 1); + } + } else { + id_reg_val |=3D FIELD_DP32(0, RB_ID_REGISTER, ID, + frame->can_id & QEMU_CAN_SFF_MASK); + if (is_rtr) { + id_reg_val |=3D FIELD_DP32(0, RB_ID_REGISTER, SRR_RTR_RRS, 1); + } + } + + return id_reg_val; +} + static void store_rx_sequential(XlnxVersalCANFDState *s, const qemu_can_frame *frame, uint32_t fill_level, uint32_t read_index, @@ -999,7 +1045,7 @@ static void store_rx_sequential(XlnxVersalCANFDState *= s, NUM_REGS_PER_MSG_SPACE= )); } =20 - s->regs[store_location] =3D frame->can_id; + s->regs[store_location] =3D frame_to_reg_id(frame); =20 dlc =3D frame->can_dlc; =20 @@ -1090,11 +1136,12 @@ static void update_rx_sequential(XlnxVersalCANFDSta= te *s, if (s->regs[R_ACCEPTANCE_FILTER_CONTROL_REGISTER]) { uint32_t acceptance_filter_status =3D s->regs[R_ACCEPTANCE_FILTER_CONTROL_REGIST= ER]; + const uint32_t reg_id =3D frame_to_reg_id(frame); =20 for (i =3D 0; i < 32; i++) { if (acceptance_filter_status & 0x1) { uint32_t msg_id_masked =3D s->regs[R_AFMR_REGISTER + 2 * i= ] & - frame->can_id; + reg_id; uint32_t afir_id_masked =3D s->regs[R_AFIR_REGISTER + 2 * = i] & s->regs[R_AFMR_REGISTER + 2 * i]; uint16_t std_msg_id_masked =3D FIELD_EX32(msg_id_masked, --=20 2.34.1 From nobody Sun Nov 24 09:26:43 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 From nobody Sun Nov 24 09:26:43 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=1723832401; cv=none; d=zohomail.com; s=zohoarc; b=SQec8Hxz2PoSUtaTz1DDKlSMLRh6cEwauuWhH2eZdqYdHiV5FWKoaRq57HFCVGDmrxgI/qdnniJ7EhsaQWyTNykzloPVsmzKX96SdtnZaCV1XYtec28tMXIExk7JtNkHicD6CNXB2aTAuwFQsRDkdCIiJq1UqaT/VybEH4k4tWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723832401; 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=kFdvC6MeP6yP93X/5WA8Lf++mX0YuQiplIojlGAQD34=; b=FU0FH9Fv3NtMbxe9jclxKDVTKLK18DVDbqrl1T0kNaRr7h8L24YhPFuP+tSPaFrPXatEp9LUe1Tkmuxr0Tfqhf3wVCb6Q/2TGwgkym+sTevuCpsejWqHFulfo2eSom8ThffYwOaZSvsGR/zIHkOX/fKmbWtqwaBJip8wuCHI7Ms= 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 1723832401304749.9737725993944; Fri, 16 Aug 2024 11:20:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sf1XA-0004tr-O8; Fri, 16 Aug 2024 14:18:44 -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 1sezwh-0003J0-IR for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:59 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sezwg-0002L0-0Z for qemu-devel@nongnu.org; Fri, 16 Aug 2024 12:36:59 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2d3c99c5d69so303064a91.1 for ; Fri, 16 Aug 2024 09:36:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 09:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schmorgal.com; s=google; t=1723826216; x=1724431016; 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=kFdvC6MeP6yP93X/5WA8Lf++mX0YuQiplIojlGAQD34=; b=BNoD6jCCWFMYRbCRO8qxJSpdiRlkmwOBmm3cYQjiZkgsufwZlUCOzcpZGTz+aAGfQ7 1z9Gmg8lblU95EZMWq1fDSEucw7+F7Xkg202L/E6sen9390wNdbCBAOO/QsgVIMWJXQn ZKQLwjEsNgPR08m8NZozOFdmj1/nEFz2dmLSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723826216; x=1724431016; 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=kFdvC6MeP6yP93X/5WA8Lf++mX0YuQiplIojlGAQD34=; b=us6QK2DtE0eJWG6aoCA5tXbGu9T4mTBZQYtryMkTraZjrKAZPi0hMEdKFb9t+YBWe/ zcVjlYAq+uwWJF3oxMQeZ2kGpM6T9IrsYE6AeT1hDZWY2OLFJ+0om8RXlvTXwkhXdsZu WeTQXvfiLBBnHQRhaYSHg4bxguQh/Z0RTGCpV/K+/3R7to8weQqDi6GmHTAhWdzCKTjA sd1R4QTQd49/QA7gF/7b3H1UaCy4BQTE09USYa7UU2BZVudl5wP2SWfVWPEVtis5x3mB ozLScp4ZZ7nbThxiJ84gLwGU1Cvk2YMwWYVnUOOYf23Yc/Zc8dzj/ggkSDf7PBoqJr95 Ft4g== X-Forwarded-Encrypted: i=1; AJvYcCWRjCs5fYAL3nlNxq7wpoGfW0jy4Hd+8988kaeYRyaA/jdv2nOgCtg2RT+QWC0hy7e7S9MGzWQFUIvZkc4MkbnteWFDnzc= X-Gm-Message-State: AOJu0YzF/uCX+hmzAqbBmXhUnDBBDiFh8JIPGIFtbDTxb188m9vNgacf NE2BxEh0heLrcC/9A+LzjtRMw4AQW1ZJ2VEFuQzZFome1bNXXg8CvTP3zNJqv9I= X-Google-Smtp-Source: AGHT+IHmWA36aomK2A2/el1m/B1FdBylg7BZTz/BhCM5RRLZiXvw7jp6k+m5SlwCquHKZfBrsGDVMA== X-Received: by 2002:a05:6a21:788e:b0:1c4:c007:51b7 with SMTP id adf61e73a8af0-1c9a2a456f3mr2103118637.6.1723826216349; Fri, 16 Aug 2024 09:36:56 -0700 (PDT) From: Doug Brown To: Vikram Garhwal , Francisco Iglesias , Pavel Pisa Cc: Jason Wang , qemu-devel@nongnu.org, Doug Brown Subject: [PATCH 5/5] hw/net/can/xlnx-versal-canfd: Handle RX of short FD frames Date: Fri, 16 Aug 2024 09:35:05 -0700 Message-Id: <20240816163504.789393-6-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::102b; envelope-from=doug@schmorgal.com; helo=mail-pj1-x102b.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:43 -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: 1723832401558116600 Content-Type: text/plain; charset="utf-8" There was no case for handling received CAN FD frames with a DLC of 0-8. This was already handled properly with TX. Add similar code for RX. Signed-off-by: Doug Brown Reviewed-by: Francisco Iglesias --- hw/net/can/xlnx-versal-canfd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index fda1e7016a..ce68dab46a 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -1052,10 +1052,15 @@ static void store_rx_sequential(XlnxVersalCANFDStat= e *s, if (frame->flags & QEMU_CAN_FRMF_TYPE_FD) { is_canfd_frame =3D true; =20 - /* Store dlc value in Xilinx specific format. */ - for (i =3D 0; i < ARRAY_SIZE(canfd_dlc_array); i++) { - if (canfd_dlc_array[i] =3D=3D frame->can_dlc) { - dlc_reg_val =3D FIELD_DP32(0, RB_DLC_REGISTER, DLC, 8 = + i); + if (dlc <=3D 8) { + dlc_reg_val =3D FIELD_DP32(0, RB_DLC_REGISTER, DLC, dlc); + } else { + /* Store dlc value in Xilinx specific format. */ + for (i =3D 0; i < ARRAY_SIZE(canfd_dlc_array); i++) { + if (canfd_dlc_array[i] =3D=3D frame->can_dlc) { + dlc_reg_val =3D FIELD_DP32(0, RB_DLC_REGISTER, DLC, + 8 + i); + } } } } else { --=20 2.34.1