qemu/hw
Andrew Yuan 76723b8ed7 hw/net/cadence_gem: Fix the mask/compare/disable-mask logic
Our current handling of the mask/compare logic in the Cadence
GEM ethernet device is wrong:
 (1) we load the same byte twice from rx_buf when
     creating the compare value
 (2) we ignore the DISABLE_MASK flag

The "Cadence IP for Gigabit Ethernet MAC Part Number: IP7014 IP Rev:
R1p12 - Doc Rev: 1.3 User Guide" states that if the DISABLE_MASK bit
in type2_compare_x_word_1 is set, the mask_value field in
type2_compare_x_word_0 is used as an additional 2 byte Compare Value.

Correct these bugs:
 * in the !disable_mask codepath, use lduw_le_p() so we
   correctly load a 16-bit value for comparison
 * in the disable_mask codepath, we load a full 4-byte value
   from rx_buf for the comparison, set the compare value to
   the whole of the cr0 register (i.e. the concatenation of
   the mask and compare fields), and set mask to 0xffffffff
   to force a 32-bit comparison

Signed-off-by: Andrew Yuan <andrew.yuan@jaguarmicro.com>
Message-id: 20241219061658.805-1-andrew.yuan@jaguarmicro.com
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[PMM: Expand commit message and comment]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2025-02-07 16:09:20 +00:00
..
9pfs Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
acpi hw/acpi: Add vmclock device 2025-01-15 17:43:24 -05:00
adc include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
alpha hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
arm hw/arm/fsl-imx7: Add local 'mpcore/gic' variables 2025-02-07 16:09:19 +00:00
audio Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
avr hw/loader: Pass ELFDATA endian order argument to load_elf_as() 2025-01-31 19:36:44 +01:00
block xen: do not use '%ms' scanf specifier 2025-01-15 17:06:49 +00:00
char hw/char/pci-multi: Convert legacy qemu_allocate_irqs to qemu_init_irq 2025-01-31 19:36:44 +01:00
core Misc HW patches 2025-02-02 11:09:03 -05:00
cpu hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro 2025-02-07 16:09:19 +00:00
cxl Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
display virtio-gpu: Add definition for resource_uuid feature 2025-01-15 13:05:26 -05:00
dma Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
fsi hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
gpio hw/gpio/imx_gpio: Turn DPRINTF() into trace events 2025-01-13 17:16:04 +01:00
hppa Misc HW patches 2025-02-02 11:09:03 -05:00
hyperv Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
i2c hw/i2c/imx_i2c: Convert DPRINTF() to trace events 2025-01-13 17:16:04 +01:00
i386 hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
ide Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
input Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
intc hw/intc/loongarch_ipi: Use alternative implemation for cpu_by_arch_id 2025-01-15 14:36:19 +08:00
ipack hw/ipack: Remove legacy qemu_allocate_irqs() use 2025-01-31 19:36:44 +01:00
ipmi Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
isa Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
loongarch hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
m68k hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
mem hw/cxl: Fix msix_notify: Assertion vector < dev->msix_entries_nr 2025-01-15 13:07:30 -05:00
microblaze hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
mips hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
misc Misc HW patches 2025-02-02 11:09:03 -05:00
net hw/net/cadence_gem: Fix the mask/compare/disable-mask logic 2025-02-07 16:09:20 +00:00
nubus include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
nvme Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
nvram fw_cfg: Don't set callback_opaque NULL in fw_cfg_modify_bytes_read() 2024-12-31 21:21:34 +01:00
openrisc hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
pci pci/msix: Fix msix pba read vector poll end calculation 2025-01-15 13:06:41 -05:00
pci-bridge Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
pci-host hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
ppc hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
remote Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
riscv hw/loader: Pass ELFDATA endian order argument to load_elf_ram_sym() 2025-01-31 19:36:44 +01:00
rtc Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
rx hw/rx/rx-gdbsim: Remove unnecessary uses of &first_cpu 2025-01-31 19:05:38 +01:00
s390x Misc HW patches 2025-02-02 11:09:03 -05:00
scsi Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
sd hw/sd: Remove unused SDState::enable 2025-01-31 19:36:44 +01:00
sensor hw/sensor: Replace type_register() with type_register_static() 2024-12-10 18:49:25 +01:00
sh4 hw/sh4/r2d: Convert legacy qemu_allocate_irqs() to qemu_init_irqs() 2025-01-31 19:36:44 +01:00
smbios include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
sparc hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
sparc64 hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
ssi Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
timer hw/timer/aspeed: Add AST2700 Support 2025-01-27 09:38:15 +01:00
tpm Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
tricore hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
ufs hw/ufs: Adjust value to match CPU's endian format 2025-01-13 17:16:04 +01:00
usb hw/usb/hcd-ehci: Fix debug printf format string 2025-01-31 19:36:44 +01:00
vfio hw/pci: Use -1 as the default value for rombar 2025-01-09 18:16:18 +01:00
virtio virtio-mem-pci: Allow setting nvectors, so we can use MSI-X 2025-01-30 10:39:37 +01:00
watchdog aspeed/wdt: Support software reset mode for AST2600 2025-01-27 09:38:15 +01:00
xen hw/xen: Use xs_node_read() from xenstore_read_str() instead of open-coding it 2025-01-15 17:07:27 +00:00
xenpv include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
xtensa hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
Kconfig hw: Remove PCMCIA subsystem 2024-10-15 15:16:17 +01:00
meson.build hw: Remove PCMCIA subsystem 2024-10-15 15:16:17 +01:00