From nobody Tue Nov 26 20:23:55 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=fel.cvut.cz ARC-Seal: i=1; a=rsa-sha256; t=1704323812; cv=none; d=zohomail.com; s=zohoarc; b=XOo5KewVQ33cjh644Om1mZcifWL7WAQ1LMTp3ifFoF/fCA/95RYUPi1vY2/prC9v3TKVcshL6+9wTXqtdW1ECHQDsCqgBwBgidtQUZSj7Cl84P1OE4PBTXrvNZleBrGJCmrA4CkjLtc4998MJmVCIqnqaURcJad1gfDcczRBsGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704323812; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7dz3jA9cVKgB4RXtRmPv/VHf4tNEsltK8GJPDgOcDb8=; b=Yjp8D+kmqOLhl3JkgP2zHzfohSTXd/Wdur/z7RDp1N8oGNTaeVkJEyNmfyBEUOk17nqjty7mlaJmtkGANYW8fcCrxevOYYmTFMGSpazwmRD5MZx9PbnlbJnq8aBcvUJKgO8CZsohibloHkUhZzMsjwPIbsGKex0Jx/xMGhyvJeU= 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 1704323811770675.9855072440655; Wed, 3 Jan 2024 15:16:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLASN-0002jf-D1; Wed, 03 Jan 2024 18:15:27 -0500 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 1rLASJ-0002iT-UN; Wed, 03 Jan 2024 18:15:24 -0500 Received: from smtpx.feld.cvut.cz ([147.32.210.153] helo=smtpx.fel.cvut.cz) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1rLASF-0007l9-Ah; Wed, 03 Jan 2024 18:15:23 -0500 Received: from localhost (styx2022 [192.168.200.17]) by smtpx.fel.cvut.cz (Postfix) with ESMTP id 4367529384; Thu, 4 Jan 2024 00:15:15 +0100 (CET) Received: from smtpx.fel.cvut.cz ([192.168.200.2]) by localhost (styx2022.feld.cvut.cz [192.168.200.17]) (amavisd-new, port 10060) with ESMTP id K7sJouRDKA6o; Thu, 4 Jan 2024 00:15:09 +0100 (CET) Received: from fel.cvut.cz (ip-78-102-109-231.bb.vodafone.cz [78.102.109.231]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pisa) by smtpx.fel.cvut.cz (Postfix) with ESMTPSA id B780829066; Thu, 4 Jan 2024 00:15:06 +0100 (CET) X-Virus-Scanned: IMAP STYX AMAVIS Authentication-Results: styx2022.feld.cvut.cz (amavisd-new); dkim=pass (2048-bit key) header.d=fel.cvut.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fel.cvut.cz; s=felmail; t=1704323709; bh=7dz3jA9cVKgB4RXtRmPv/VHf4tNEsltK8GJPDgOcDb8=; h=From:To:Cc:Subject:Date:From; b=UalYTnt6a2vMr/bYx/A+bFCJU1lcYNXRgzDqmlh6G+P3/bIVubACouwewc7UWY/Iw biuotHHI21DT3jCoE3U4oyea6x/X/Ex7taao6bw4b3eRq2wiawGyGOxx7mO4qsYJYh mQ1vwXMFrlU1a30SVJMIfVmgphtwWVxY6F7msXpS8Izsb3tM+FOvakPL9emcO47I9y JDn6VFpBdR+4LC6v4QHs4maBzgTm25Fn9sqhR8EJ/mC2KNP156qSggNt4TCzUXnKkG aEYGtKwlX13wR+T2UgdWxHNkiUXTaXerCS1Q7bj44CzbfCpjdZ60jED0AjXSYTf9t7 72Im8fYF6qeUw== From: Pavel Pisa To: qemu-devel@nongnu.org, Philippe Mathieu-Daude , Grant Ramsay Cc: Paolo Bonzini , Vikram Garhwal , Jin-Yang , Bernhard Beschow , qemu-stable@nongnu.org, Pavel Pisa Subject: [PATCH v2] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame Date: Thu, 4 Jan 2024 00:14:26 +0100 Message-Id: <20240103231426.5685-1-pisa@fel.cvut.cz> X-Mailer: git-send-email 2.39.2 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=147.32.210.153; envelope-from=pisa@fel.cvut.cz; helo=smtpx.fel.cvut.cz X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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-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 @fel.cvut.cz) X-ZM-MESSAGEID: 1704323814821100003 Content-Type: text/plain; charset="utf-8" From: Pavel Pisa A CAN sja1000 standard frame filter mask has been computed and applied incorrectly for standard frames when single Acceptance Filter Mode (MOD_AFM =3D 1) has been selected. The problem has not been found by Linux kernel testing because it uses dual filter mode (MOD_AFM =3D 0) and leaves falters fully open. The problem has been noticed by Grant Ramsay when testing with Zephyr RTOS which uses single filter mode. Signed-off-by: Pavel Pisa Reported-by: Grant Ramsay Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2028 Fixes: 733210e754 ("hw/net/can: SJA1000 chip register level emulation") --- hw/net/can/can_sja1000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 73201f9139..575df7d2f8 100644 --- a/hw/net/can/can_sja1000.c +++ b/hw/net/can/can_sja1000.c @@ -108,7 +108,7 @@ void can_sja_single_filter(struct qemu_can_filter *filt= er, } =20 filter->can_mask =3D (uint32_t)amr[0] << 3; - filter->can_mask |=3D (uint32_t)amr[1] << 5; + filter->can_mask |=3D (uint32_t)amr[1] >> 5; filter->can_mask =3D ~filter->can_mask & QEMU_CAN_SFF_MASK; if (!(amr[1] & 0x10)) { filter->can_mask |=3D QEMU_CAN_RTR_FLAG; --=20 2.39.2