qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Pavel Pisa <pisa@fel.cvut.cz>,
	qemu-devel@nongnu.org, Philippe Mathieu-Daude <philmd@redhat.com>,
	Grant Ramsay <gramsay@enphaseenergy.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Vikram Garhwal <fnu.vikram@xilinx.com>,
	Jin-Yang <jinyang.sia@gmail.com>,
	qemu-stable@nongnu.org, Pavel Pisa <pisa@cmp.felk.cvut.cz>
Subject: Re: [PATCH] hw/net/can/sja1000: fix bug for single acceptance filer and standard frame
Date: Thu, 14 Dec 2023 17:27:55 +0100	[thread overview]
Message-ID: <7bb74bc6-8806-4e54-9ccb-7f973e34558b@linaro.org> (raw)
In-Reply-To: <20231214104623.31147-1-pisa@fel.cvut.cz>

On 14/12/23 11:46, Pavel Pisa wrote:
> 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.
> 

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2028
Fixes: 733210e754 ("hw/net/can: SJA1000 chip register level emulation")

> Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
> Reported-by: Grant Ramsay <gramsay@enphaseenergy.com>
> ---
>   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 *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;



  reply	other threads:[~2023-12-14 16:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 10:46 [PATCH] hw/net/can/sja1000: fix bug for single acceptance filer and standard frame Pavel Pisa
2023-12-14 16:27 ` Philippe Mathieu-Daudé [this message]
2024-01-03 22:28 ` Bernhard Beschow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bb74bc6-8806-4e54-9ccb-7f973e34558b@linaro.org \
    --to=philmd@linaro.org \
    --cc=fnu.vikram@xilinx.com \
    --cc=gramsay@enphaseenergy.com \
    --cc=jinyang.sia@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=pisa@cmp.felk.cvut.cz \
    --cc=pisa@fel.cvut.cz \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).