From nobody Sun Nov 24 06:11:31 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1726240586; cv=none; d=zohomail.com; s=zohoarc; b=LCPxxccxnNb79o7ijWGJUxzZWHAaRez6wZQ2TILUMzOy5GdrOiaq70EBAYujrGVZwdz9ibOhyyauiuasN5Ug5qwOpqYv1Y/8H+As4T/wCVSQNbiGSRmK2CZhwzZmJdyz8yLp9Qr++YuViUZMJ9p495yMI9IHtP6rBGqsZDIxXbA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726240586; h=Content-Transfer-Encoding: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:Cc; bh=4FM2OayOf1fgQoj9kOGqYfKVibltYv0skfRKZ4uJLb0=; b=n51Ks21s05vsldPAd/BcMxd8nstD3UlqlUEP5WLDuM+1BPF5A9bhvK1raOSyrDt7ZstnA7QZZq/y7LX1TOz5ilECi7G5sEUFYTzuGLRhVoowFaXJGAqlKzKEzHbptHsM3Gx0Gbg8svd+U+qz/ZtWyHKrDXn7WoxmOYfvgr+3JO8= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726240586291378.73797786279954; Fri, 13 Sep 2024 08:16:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp80w-0004Zx-Vm; Fri, 13 Sep 2024 11:15:20 -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 1sp80C-0002If-Fg for qemu-devel@nongnu.org; Fri, 13 Sep 2024 11:14:28 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sp80A-0007og-1v for qemu-devel@nongnu.org; Fri, 13 Sep 2024 11:14:27 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-42cbaf9bfdbso9516205e9.0 for ; Fri, 13 Sep 2024 08:14:25 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42d9b16bfbfsm29152325e9.22.2024.09.13.08.14.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726240464; x=1726845264; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4FM2OayOf1fgQoj9kOGqYfKVibltYv0skfRKZ4uJLb0=; b=bV6sIT27l4TcQiJC7+sczp04VRFUFg5kWJ1Tl5FLHladJ0kKKp0fP+5+aKGe7M0Fpt uzmSnTU13muR5mU3lBl09clBAjCG3Vlq6996lIm2llZayUdr+BjTfZp37WmBpy8S5daZ vWKcDYo49M96NQOIlieQxcA6CzKNCFL05kKK8tL/F2btp5Tv6t2lW0jFWeU3OMaUZd+D eabc+kmfuBodjgTMQRS2c0jVTAUFq5Bp5wa6Y0jJTqsLfWS3/kojIckvYS5pWCxxBXGy 5Jia1ktMSr5MaVMzLPrYpTZKHJ+ah3BLYOYxzDSf66sSqdeNIbd53AdPhivf4xjiRhTH VyWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240464; x=1726845264; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4FM2OayOf1fgQoj9kOGqYfKVibltYv0skfRKZ4uJLb0=; b=BspLtA/5GNpRgew0aT/5LDJh8DrYgb/JR6NO4UpvhiBX1XruC08wLRwx3VoASTSyV3 nzB0SY1kp9Cb3W6ulu3KyTgfA2KutGlw1Hw6TaQ+FlDC9Q61A/VU7qxNDw/00FFJkFqn WVTnC5KvpD65IY0l9n29/wkKFYQM2hMZHF3ZhGNlMjqP2rzF5R0b0FARbdg0ExsmbVd4 kT/dnZnSnHEn0T9O3INzj8zFyafHkgRqKwFy49ZZ33h5CY+BHOX1WJXraTZ6j9fe68bc RYX7AjY84uAEGZTRT9U62Q2R/+b4klMBxvz/HYhVWXY58ibspWFlBoOL//TNhO4csVxR 95/g== X-Gm-Message-State: AOJu0YykWJSUnA8aYhY6Ggom5d4ybG5E6RodQOyJZ+PcIRlDuzY3bvzZ yk3996n2gHaVaR26Sjhw0LBWuuKX6gZGjwbsYH5zig/A7/6bGiXrCYUeGSavwIh8HF4RXgJmLgp l X-Google-Smtp-Source: AGHT+IGwOTzOePe/UnrYu2xiijR6YdazFn8f6KJhL9rbu58+fGkIYYYRzjmuPzDi/BgNpY0rLHDziQ== X-Received: by 2002:a05:600c:45cf:b0:42c:b9b1:8342 with SMTP id 5b1f17b1804b1-42d90829ad9mr21644355e9.19.1726240464276; Fri, 13 Sep 2024 08:14:24 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/27] hw/net/can/xlnx-versal-canfd: Handle flags correctly Date: Fri, 13 Sep 2024 16:14:04 +0100 Message-Id: <20240913151411.2167922-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913151411.2167922-1-peter.maydell@linaro.org> References: <20240913151411.2167922-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @linaro.org) X-ZM-MESSAGEID: 1726240588213116600 Content-Type: text/plain; charset="utf-8" From: Doug Brown Add support for QEMU_CAN_FRMF_ESI and QEMU_CAN_FRMF_BRS flags, and ensure frame->flags is always initialized to 0. Note that the Xilinx IP core doesn't allow manually setting the ESI bit during transmits, so it's only implemented for the receive case. Signed-off-by: Doug Brown Reviewed-by: Pavel Pisa Message-id: 20240827034927.66659-5-doug@schmorgal.com Signed-off-by: Peter Maydell --- hw/net/can/xlnx-versal-canfd.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index 9e825746736..9fba5b9dfc5 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -872,6 +872,8 @@ static void regs2frame(XlnxVersalCANFDState *s, qemu_ca= n_frame *frame, uint32_t id_reg_val =3D 0; bool is_rtr =3D false; =20 + frame->flags =3D 0; + /* Check that reg_num should be within TX register space. */ assert(reg_num <=3D R_TB_ID_REGISTER + (NUM_REGS_PER_MSG_SPACE * s->cfg.tx_fifo)); @@ -913,7 +915,7 @@ static void regs2frame(XlnxVersalCANFDState *s, qemu_ca= n_frame *frame, * 15 49 - 64 */ =20 - frame->flags =3D QEMU_CAN_FRMF_TYPE_FD; + frame->flags |=3D QEMU_CAN_FRMF_TYPE_FD; =20 if (dlc_value < 8) { frame->can_dlc =3D dlc_value; @@ -921,6 +923,10 @@ static void regs2frame(XlnxVersalCANFDState *s, qemu_c= an_frame *frame, assert((dlc_value - 8) < ARRAY_SIZE(canfd_dlc_array)); frame->can_dlc =3D canfd_dlc_array[dlc_value - 8]; } + + if (FIELD_EX32(dlc_reg_val, TB0_DLC_REGISTER, BRS)) { + frame->flags |=3D QEMU_CAN_FRMF_BRS; + } } else { /* * FD Format bit not set that means it is a CAN Frame. @@ -1058,6 +1064,13 @@ static void store_rx_sequential(XlnxVersalCANFDState= *s, dlc_reg_val =3D FIELD_DP32(0, RB_DLC_REGISTER, DLC, 8 = + i); } } + + if (frame->flags & QEMU_CAN_FRMF_BRS) { + dlc_reg_val |=3D FIELD_DP32(0, RB_DLC_REGISTER, BRS, 1); + } + if (frame->flags & QEMU_CAN_FRMF_ESI) { + dlc_reg_val |=3D FIELD_DP32(0, RB_DLC_REGISTER, ESI, 1); + } } else { is_canfd_frame =3D false; =20 --=20 2.34.1