From nobody Fri Dec 19 17:42:38 2025 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=fel.cvut.cz ARC-Seal: i=1; a=rsa-sha256; t=1702550875; cv=none; d=zohomail.com; s=zohoarc; b=Gz7XOWetqHE/nbUffnHHAvge1Pk9/Ypz8Vm/gSH+edmQv5H5Yaus3JmvkCg27eTgGU+JwaLW2s3636jtW+ggGeYHja1A2bz/MWEtV/km0RKrEFhY36MndFjoY4ivW/Fx/wxkOZPvjtIf8uKb9BBQMUJXINjKWvSp3MIzIVBNOes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702550875; 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=Zb5APN4uqaSzAZKkjptFJnQGnBUdOdxQ+b/ocH9eVmU=; b=n9td8Tez+Vl6tir4fqfq6ywGUU3UXRE+t0UPVLTwKrF8ykoEa7BLg4TjFvMsKuXsUGfR29w+MAjF9pkIKiztCVjC1mLYIvgoXrK2elR+0TLpMtt7ZmTinVX0od1yJKgQfMr5J/hPuXcqzXrMzzwgfbGqLxEDDdq1VtFONAkK1xo= 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 1702550875292169.91696885984607; Thu, 14 Dec 2023 02:47:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDjF3-0001hl-6Z; Thu, 14 Dec 2023 05:46:57 -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 1rDjF1-0001hQ-3T; Thu, 14 Dec 2023 05:46:55 -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 1rDjEz-0005pe-1u; Thu, 14 Dec 2023 05:46:54 -0500 Received: from localhost (styx2022 [192.168.200.17]) by smtpx.fel.cvut.cz (Postfix) with ESMTP id 07EDF159C5; Thu, 14 Dec 2023 11:46:48 +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 oofccjdfPLoY; Thu, 14 Dec 2023 11:46:46 +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 001DA157E1; Thu, 14 Dec 2023 11:46:44 +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=1702550806; bh=Zb5APN4uqaSzAZKkjptFJnQGnBUdOdxQ+b/ocH9eVmU=; h=From:To:Cc:Subject:Date:From; b=CfFcBEWgx3jxYdZaYDC/ctx4mZxjYixKSERKV6urScOtLY1rpTa6+3EvGTeJV3s2H q9wWTYJZD/AtZQaULbxxznofV9dUaKvLfiDCCdetVfMLOLZhK8mRxSkFicee2nSTwB MWjN9IKz0iyql3lkP8D8VQxYj9aMIruvy4NGVE+TzGGUzVkXS/okDVVdmf6s9HrPky 9aoE2QeRA09PryR0de4kqJY0MTq3TbIcnhRORVHOjmNRNoXTcrhUFGnHXIwBr9avvN TknFnPOBuqZeBW1d7r4ZVM9FrK5e3eNamdHaDcIMEpGAV8fPzGCLWpr4RDePqDRsBk pKW/WDXpvnP7A== From: Pavel Pisa To: qemu-devel@nongnu.org, Philippe Mathieu-Daude , Grant Ramsay Cc: Paolo Bonzini , Vikram Garhwal , Jin-Yang , qemu-stable@nongnu.org, Pavel Pisa Subject: [PATCH] hw/net/can/sja1000: fix bug for single acceptance filer and standard frame Date: Thu, 14 Dec 2023 11:46:23 +0100 Message-Id: <20231214104623.31147-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: 1702550877306100003 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 --- 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