Re: QEMU 6.2.0: Segfault while calling address_space_init from emulated device

2022-05-17 Thread Karthik Poduval
Hi Peter, I am building it from git but not directly but via Yocto Kirkstone (it was originally designed to build via downloaded tarball archive). I will add the --enable-werror to the build recipe. May I ask why address_space_init should be called from device realize and not init ? On Tue, May

Re: QEMU 6.2.0: Segfault while calling address_space_init from emulated device

2022-05-17 Thread Peter Maydell
On Tue, 17 May 2022 at 04:39, Karthik Poduval wrote: > Ok digging deeper, there was a compiler warning about a missing > prototype of get_system_memory but I never thought it would lead to > this sort of an issue. If you're building QEMU from git it should default to "warnings are errors". If

Re: QEMU 6.2.0: Segfault while calling address_space_init from emulated device

2022-05-16 Thread Karthik Poduval
Ok digging deeper, there was a compiler warning about a missing prototype of get_system_memory but I never thought it would lead to this sort of an issue. The fix now is pretty simple to include the header where get_system_memory is defined.

Re: QEMU 6.2.0: Segfault while calling address_space_init from emulated device

2022-05-16 Thread Karthik Poduval
I was able to get it to work with a workaround. After doing some gdb debugging it shows that the system_memory global was being populated before the m2m_scaler device was being initialized. Printing system_meory vs mr (argumet) to the crashing function shows the pointer value to be truncated.

Re: QEMU 6.2.0: Segfault while calling address_space_init from emulated device

2022-05-16 Thread Karthik Poduval
Hi All, I still need help, any help would be greatly appreciated. Turned on address sanitizers (config option --enable-sanitizers). It pointed to a heap overflow in xilinx code. SUMMARY: AddressSanitizer: heap-buffer-overflow ../git/hw/dma/xlnx_csu_dma.c:722 in xlnx_csu_dma_class_init So

QEMU 6.2.0: Segfault while calling address_space_init from emulated device

2022-05-15 Thread Karthik Poduval
Hi All, I am trying to create a virtual mem2mem scaler device in QEMU (for the purposes of writing a mem2mem driver tutorial). I created the mem2mem device as shown here. https://github.com/karthikpoduval/qemu/blob/scaler-bringup/hw/misc/m2m_scaler.c I added this MMIO device to the arm virt.c