[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.5 04/11] hw/net/can/sja1000: fix bug for single acceptance f
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.5 04/11] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame |
Date: |
Thu, 18 Jan 2024 15:50:42 +0300 |
From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
A CAN sja1000 standard frame filter mask has been computed and applied
incorrectly for standard frames when single Acceptance Filter Mode
(MOD_AFM = 1) has been selected. The problem has not been found
by Linux kernel testing because it uses dual filter mode (MOD_AFM = 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 <pisa@cmp.felk.cvut.cz>
Reported-by: Grant Ramsay <gramsay@enphaseenergy.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2028
Fixes: 733210e754 ("hw/net/can: SJA1000 chip register level emulation")
Message-ID: <20240103231426.5685-1-pisa@fel.cvut.cz>
(cherry picked from commit 25145a7d7735344a469551946fc2a7f19eb4aa3d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
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 *filter,
}
filter->can_mask = (uint32_t)amr[0] << 3;
- filter->can_mask |= (uint32_t)amr[1] << 5;
+ filter->can_mask |= (uint32_t)amr[1] >> 5;
filter->can_mask = ~filter->can_mask & QEMU_CAN_SFF_MASK;
if (!(amr[1] & 0x10)) {
filter->can_mask |= QEMU_CAN_RTR_FLAG;
--
2.39.2
- [Stable-8.1.5 00/11] Patch Round-up for stable 8.1.5, freeze on 2024-01-27, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 01/11] block: Fix crash when loading snapshot on inactive node, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 02/11] vl: Improve error message for conflicting -incoming and -loadvm, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 03/11] iotests: Basic tests for internal snapshots, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 04/11] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame,
Michael Tokarev <=
- [Stable-8.1.5 05/11] target/riscv: Fix mcycle/minstret increment behavior, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 06/11] chardev/char.c: fix "abstract device type" error message, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 07/11] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 08/11] util: fix build with musl libc on ppc64le, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 09/11] tests/qtest/virtio-ccw: Fix device presence checking, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 10/11] target/s390x: Fix LAE setting a wrong access register, Michael Tokarev, 2024/01/18
- [Stable-8.1.5 11/11] .gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large, Michael Tokarev, 2024/01/18