Re: [PATCH v3 2/3] vhost: Use vhost_get_used_size() in vhost_vring_set_addr()

2020-10-10 Thread Michael S. Tsirkin
On Sat, Oct 10, 2020 at 10:32:13AM +0800, Jason Wang wrote: > > On 2020/10/3 下午6:02, Greg Kurz wrote: > > The open-coded computation of the used size doesn't take the event > > into account when the VIRTIO_RING_F_EVENT_IDX feature is present. > > Fix that by using vhost_get_used_size(). > > > > S

Why guest physical addresses are not the same as the corresponding host virtual addresses in QEMU/KVM? Thanks!

2020-10-10 Thread harry harry
Hi QEMU/KVM developers, I am sorry if my email disturbs you. I did an experiment and found the guest physical addresses (GPAs) are not the same as the corresponding host virtual addresses (HVAs). I am curious about why; I think they should be the same. I am very appreciated if you can give some co

Re: [PATCH v3 12/20] hw/mips/r4k: Explicit CPU frequency is 200 MHz

2020-10-10 Thread chen huacai
Hi, Philippe, On Sun, Oct 11, 2020 at 4:43 AM Philippe Mathieu-Daudé wrote: > > Since its introduction in commit 6af0bf9c7c3, > the 'r4k' machine runs at 200 MHz. > > Signed-off-by: Philippe Mathieu-Daudé > --- > hw/mips/r4k.c | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > d

Re: [PATCH V13 6/9] target/mips: Add loongson-ext lsdc2 group of instructions

2020-10-10 Thread Huacai Chen
Hi, Philippe, On Sat, Oct 10, 2020 at 9:07 PM Philippe Mathieu-Daudé wrote: > > On 10/7/20 10:39 AM, Huacai Chen wrote: > > From: Jiaxun Yang > > > > LDC2/SDC2 opcodes have been rewritten as "load & store with offset" > > group of instructions by loongson-ext ASE. > > > > This patch add implemen

Re: [PATCH V13 8/9] hw/mips: Add Loongson-3 machine support

2020-10-10 Thread Huacai Chen
Hi, Philippe, On Sat, Oct 10, 2020 at 5:09 PM Philippe Mathieu-Daudé wrote: > > Hi Huacai, > > On 10/7/20 10:39 AM, Huacai Chen wrote: > > Add Loongson-3 based machine support, it use liointc as the interrupt > > controler and use GPEX as the pci controller. Currently it can work with > > both TC

Re: [PATCH] hw/net: move allocation to the heap due to very large stack frame

2020-10-10 Thread Li Qiang
David Gibson 于2020年10月10日周六 下午2:34写道: > > On Fri, Oct 09, 2020 at 07:02:56AM -0700, Elena Afanasova wrote: > > >From 09905773a00e417d3a37c12350d9e55466fdce8a Mon Sep 17 00:00:00 2001 > > From: Elena Afanasova > > Date: Fri, 9 Oct 2020 06:41:36 -0700 > > Subject: [PATCH] hw/net: move allocation to

Re: [PATCH] target/i386/cpu: add return value verification and ignore Error objects

2020-10-10 Thread Li Qiang
Pan Nengyuan 于2020年9月4日周五 下午3:19写道: > > 'err' is unnecessary in x86_cpu_class_check_missing_features(), we can change > x86_cpu_expand_features() > to return true on success, false on failure, then pass NULL here to remove it. > > Signed-off-by: Pan Nengyuan > Suggested-by: Markus Armbruster R

Re: [PATCH] migration/block-dirty-bitmap: fix uninitialized variable warning

2020-10-10 Thread Li Qiang
Chen Qun 于2020年10月10日周六 下午7:08写道: > > This if statement judgment is redundant and it will cause a warning: > > migration/block-dirty-bitmap.c:1090:13: warning: ‘bitmap_name’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > g_strlcpy(s->bitmap_name, bitmap_name,

Re: [PATCH] pc-dimm: remove unnecessary get_vmstate_memory_region() method

2020-10-10 Thread Maciej S. Szmigiero
On 20.09.2020 15:25, Maciej S. Szmigiero wrote: > From: "Maciej S. Szmigiero" > > The get_vmstate_memory_region() method from PCDIMMDeviceClass is only > ever called from this class and is never overridden, so it can be converted > into an ordinary function. > > Signed-off-by: Maciej S. Szmigier

Re: [PATCH] vmbus: Don't make QOM property registration conditional

2020-10-10 Thread Maciej S. Szmigiero
On 09.10.2020 23:33, Eduardo Habkost wrote: > On Fri, Oct 09, 2020 at 11:05:47PM +0200, Maciej S. Szmigiero wrote: >> On 09.10.2020 22:07, Eduardo Habkost wrote: >>> Having properties registered conditionally makes QOM type >>> introspection difficult. Instead of skipping registration of the >>> "

[PATCH v3 19/20] hw/mips/cps: Do not allow use without input clock

2020-10-10 Thread Philippe Mathieu-Daudé
Now than all QOM users provides the input clock, do not allow using a CPS without input clock connected. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/cps.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 915655b91e0..c624821315a 100644 --- a/hw/

[PATCH v3 14/20] hw/mips/mipssim: Correct CPU frequency

2020-10-10 Thread Philippe Mathieu-Daudé
The MIPSsim machine CPU frequency is too fast running at 200 MHz, while it should be 12 MHz for the 24K and 6 MHz for the 5K core. Ref: Linux commit c78cbf49c4ed ("Support for MIPSsim, the cycle accurate MIPS simulator.") Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/mipssim.c | 12

[PATCH v3 20/20] target/mips/cpu: Display warning when CPU is used without input clock

2020-10-10 Thread Philippe Mathieu-Daudé
All our QOM users provides an input clock. In order to avoid avoid future machines added without clock, display a warning. User-mode emulation use the CP0 timer with the RDHWR instruction (see commit cdfcad788394) so keep using the fixed 200 MHz clock without diplaying any warning. Only display it

[PATCH v3 18/20] hw/mips/malta: Set CPU frequency to 320 MHz

2020-10-10 Thread Philippe Mathieu-Daudé
The CoreLV card with ID 0x420's CPU clocked at 320 MHz. Create a 'cpuclk' output clock and connect it to the CPU input clock. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/malta.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/mips/malta.c b/hw/m

[PATCH v3 13/20] hw/mips/fuloong2e: Set CPU frequency to 533 MHz

2020-10-10 Thread Philippe Mathieu-Daudé
The CPU frequency is normally provided by the firmware in the "cpuclock" environment variable. The 2E board can handles up to 660MHz, but be conservative and take the same value used by the Linux kernel: 533 MHz. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/fuloong2e.c | 8 +++- 1 file

[PATCH v3 17/20] hw/mips/boston: Set CPU frequency to 1 GHz

2020-10-10 Thread Philippe Mathieu-Daudé
The I6400 can run at 1 GHz or more. Create a 'cpuclk' output clock and connect it to the CPU input clock. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/boston.c | 13 + 1 file changed, 13 insertions(+) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 1b3f69e949c..cf2296f44

[PATCH v3 11/20] target/mips/cpu: Allow the CPU to use dynamic frequencies

2020-10-10 Thread Philippe Mathieu-Daudé
Use the Clock API and let the CPU object have an input clock. If no clock is connected, keep using the default frequency of 200 MHz used since the introduction of the 'r4k' machine in commit 6af0bf9c7c3. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.h | 4 target/mips/cpu.c |

[PATCH v3 05/20] target/mips: Move cpu_mips_get_random() with CP0 helpers

2020-10-10 Thread Philippe Mathieu-Daudé
The get_random() helper uses the CP0_Wired register, which is unrelated to the CP0_Count register use as timer. Commit e16fe40c872 ("Move the MIPS CPU timer in a separate file") incorrectly moved this get_random() helper with timer specific code. Move it back to generic CP0 helpers. Reviewed-by: A

[PATCH v3 16/20] hw/mips/cps: Expose input clock and connect it to CPU cores

2020-10-10 Thread Philippe Mathieu-Daudé
Expose a qdev input clock named 'clk-in', and connect it to each core to forward-propagate the clock. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/mips/cps.h | 2 ++ hw/mips/cps.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/hw/mips/cps.h b/include/hw/mips/cps.

[PATCH v3 15/20] hw/mips/jazz: Correct CPU frequencies

2020-10-10 Thread Philippe Mathieu-Daudé
The Magnum 4000PC CPU runs at 100 MHz, and the Acer PICA-61 CPU at ~134 MHz. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/jazz.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 47723093b63..e56e36cf3f7 100644 --- a/h

[PATCH v3 03/20] hw/qdev-clock: Display error hint when clock is missing from device

2020-10-10 Thread Philippe Mathieu-Daudé
Instead of directly aborting, display a hint to help the developer figure out the problem (likely trying to connect a clock to a device pre-dating the Clock API, thus not expecting clocks). Reviewed-by: Luc Michel Reviewed-by: Damien Hedde Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe

[PATCH v3 10/20] target/mips/cpu: Make cp0_count_rate a property

2020-10-10 Thread Philippe Mathieu-Daudé
Since not all CPU implementations use a cores use a CP0 timer at half the frequency of the CPU, make this variable a property. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.h | 9 + target/mips/cpu.c | 19 +++ 2 files changed, 20 insertions(+), 8 deletions(-)

[PATCH v3 12/20] hw/mips/r4k: Explicit CPU frequency is 200 MHz

2020-10-10 Thread Philippe Mathieu-Daudé
Since its introduction in commit 6af0bf9c7c3, the 'r4k' machine runs at 200 MHz. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/r4k.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/mips/r4k.c b/hw/mips/r4k.c index 3487013a4a1..e64687b505a 100644 --- a/hw/mips/r4

[PATCH v3 06/20] target/mips/cp0_timer: Explicit unit in variable name

2020-10-10 Thread Philippe Mathieu-Daudé
Name variables holding nanoseconds with the '_ns' suffix. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cp0_timer.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/target/mips/cp0_timer.c b/target/mips/cp0_timer.c

[PATCH v3 02/20] qdev-monitor: Display frequencies scaled to SI unit

2020-10-10 Thread Philippe Mathieu-Daudé
Since commit 9f2ff99c7f2 ("qdev-monitor: print the device's clock with info qtree") we can display the clock frequencies in the monitor. Use the recently introduced freq_to_str() to display the frequencies using the closest SI unit (human friendlier). Before: (qemu) info qtree [...] dev: xi

[PATCH v3 07/20] target/mips/cp0_timer: Document TIMER_PERIOD origin

2020-10-10 Thread Philippe Mathieu-Daudé
TIMER_PERIOD value of '10 ns' can be explained looking at commit 6af0bf9c7c3doc, where the CPU frequency is 200 MHz and CP0 default count rate is half the frequency of the CPU. Document that. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cp0_timer.c | 12 +++- 1 file changed, 11

[PATCH 3/3] console: make QMP/HMP screendump run in coroutine

2020-10-10 Thread marcandre . lureau
From: Marc-André Lureau Thanks to the monitors coroutine support, the screendump handler can trigger a graphic_hw_update(), yield and let the main loop run until update is done. Then the handler is resumed, and ppm_save() will write the screen image to disk in the coroutine context (thus non-bloc

[PATCH v3 09/20] target/mips/cpu: Calculate the CP0 timer period using the CPU frequency

2020-10-10 Thread Philippe Mathieu-Daudé
The CP0 timer period is a function of the CPU frequency. Start using the default values, which will be replaced by properties in the next commits. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/mips/cpu.c

[PATCH v3 01/20] util/cutils: Introduce freq_to_str() to display Hertz units

2020-10-10 Thread Philippe Mathieu-Daudé
Introduce freq_to_str() to convert frequency values in human friendly units using the SI units for Hertz. Suggested-by: Luc Michel Reviewed-by: Alistair Francis Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/cutils.h | 12 util/cutils.c | 1

[PATCH v3 08/20] target/mips: Move cp0_count_ns to CPUMIPSState

2020-10-10 Thread Philippe Mathieu-Daudé
Currently the CP0 timer period is fixed at 10 ns, corresponding to a fixed CPU frequency of 200 MHz (using half the speed of the CPU). In few commits we will be able to use a different CPU frequency. In preparation, move the cp0_count_ns variable to CPUMIPSState so we can modify it. Signed-off-by

[PATCH 1/3] coroutine: let CoQueue wake up outside a coroutine

2020-10-10 Thread marcandre . lureau
From: Marc-André Lureau The assert() was added in commit b681a1c73e15 ("block: Repair the throttling code."), when the qemu_co_queue_do_restart() function required to be running in a coroutine. It was later made unnecessary in commit a9d9235567e7 ("coroutine-lock: reschedule coroutine on the AioC

[PATCH v3 04/20] hw/core/clock: add the clock_new helper function

2020-10-10 Thread Philippe Mathieu-Daudé
From: Luc Michel This function creates a clock and parents it to another object with a given name. It calls clock_setup_canonical_path before returning the new clock. This function is useful to create clocks in devices when one doesn't want to expose it at the qdev level (as an input or an outpu

[PATCH v3 00/20] hw/mips: Set CPU frequency

2020-10-10 Thread Philippe Mathieu-Daudé
Since v2: - Renamed "clk" -> "clk-in" - Renamed "cpuclk-out -> "cpu-refclk" Missing review: patches 6-20 ~~~ All the MIPS cores emulated by QEMU provides the Coproc#0 'Count' register which can be used as a free running timer. Since it's introduction in 2005 this timer uses a fixed frequency of

[PATCH 0/3] console: make QMP screendump use coroutine

2020-10-10 Thread marcandre . lureau
From: Marc-André Lureau Hi, Thanks to recent work by Kevin, it becomes possible to run HMP/QMP commands i= n a coroutine. The screendump command is a good target, as it requires to re-enter the main-loop in ordre to flush the display, and write to file in a non-block= ing way. Despite the flush

[PATCH 2/3] console: modify ppm_save to take a pixman image ref

2020-10-10 Thread marcandre . lureau
From: Marc-André Lureau The function is going to be called from a coroutine, and may yields. Let's ensure our image reference doesn't change over time (due to resize etc) by keeping a ref. Signed-off-by: Marc-André Lureau --- ui/console.c| 15 --- ui/trace-events | 2 +- 2 fil

[PATCH v4 4/4] hw/arm/bcm2835_peripherals: Correctly wire the SYS_timer IRQs

2020-10-10 Thread Philippe Mathieu-Daudé
The SYS_timer is not directly wired to the ARM core, but to the SoC (peripheral) interrupt controller. Fixes: 0e5bbd74064 ("hw/arm/bcm2835_peripherals: Use the SYS_timer") Reviewed-by: Luc Michel Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/bcm2835_peripheral

[PATCH v4 2/4] hw/timer/bcm2835: Rename variable holding CTRL_STATUS register

2020-10-10 Thread Philippe Mathieu-Daudé
The variable holding the CTRL_STATUS register is misnamed 'status'. Rename it 'ctrl_status' to make it more obvious this register is also used to control the peripheral. Reviewed-by: Luc Michel Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- include/hw/timer/bcm2835_sy

[PATCH v4 3/4] hw/timer/bcm2835: Support the timer COMPARE registers

2020-10-10 Thread Philippe Mathieu-Daudé
This peripheral has 1 free-running timer and 4 compare registers. Only the free-running timer is implemented. Add support the COMPARE registers (each register is wired to an IRQ). Reference: "BCM2835 ARM Peripherals" datasheet [*] chapter 12 "System Timer": The System Timer periphe

[PATCH v4 1/4] hw/timer/bcm2835: Introduce BCM2835_SYSTIMER_COUNT definition

2020-10-10 Thread Philippe Mathieu-Daudé
Use the BCM2835_SYSTIMER_COUNT definition instead of the magic '4' value. Reviewed-by: Luc Michel Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- include/hw/timer/bcm2835_systmr.h | 4 +++- hw/timer/bcm2835_systmr.c | 3 ++- 2 files changed, 5 insertions(+), 2

[PATCH v4 0/4] hw/arm/raspi: Fix SYS_timer to unbrick Linux kernels v3.7+

2020-10-10 Thread Philippe Mathieu-Daudé
In this series we implement the COMPARE registers of the SYS_timer, since they are used by Linux. This fixes the hang reported by Niek here: https://www.mail-archive.com/qemu-devel@nongnu.org/msg682090.html Since v3: - Addressed Richard review comments (arithmetic fix) Since v2: - Fixed issue in

Re: [PATCH v3 3/4] hw/timer/bcm2835: Support the timer COMPARE registers

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/3/20 7:17 PM, Richard Henderson wrote: On 10/2/20 11:42 AM, Philippe Mathieu-Daudé wrote: @@ -78,16 +71,29 @@ static void bcm2835_systmr_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { BCM2835SystemTimerState *s = BCM2835_SYST

Re: [PATCH v2 18/20] hw/mips/malta: Set CPU frequency to 320 MHz

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 7:26 PM, Philippe Mathieu-Daudé wrote: The CoreLV card with ID 0x420's CPU clocked at 320 MHz. Create a 'cpuclk' output clock and connect it to the CPU input clock. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/malta.c | 20 +--- 1 file changed, 17 insertions(

[PATCH 0/2] linux-user/microblaze: update signal handling

2020-10-10 Thread Richard Henderson
The linux microblaze port only implements rt signal handing, not the old style. This allows our linux-test to pass for mb, if you have a cross-compiler available for the build. r~ Richard Henderson (2): linux-user/microblaze: Implement rt signal frames linux-user/microblaze: Remove non-rt

[PATCH 2/2] linux-user/microblaze: Remove non-rt signal frames

2020-10-10 Thread Richard Henderson
The microblaze kernel does not support these, and uses only rt style signal frames. Signed-off-by: Richard Henderson --- linux-user/microblaze/target_signal.h | 1 - linux-user/microblaze/signal.c| 97 +-- 2 files changed, 2 insertions(+), 96 deletions(-) diff -

[PATCH v2 18/20] hw/mips/malta: Set CPU frequency to 320 MHz

2020-10-10 Thread Philippe Mathieu-Daudé
The CoreLV card with ID 0x420's CPU clocked at 320 MHz. Create a 'cpuclk' output clock and connect it to the CPU input clock. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/malta.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/mips/malta.c b/hw/m

[PATCH v2 17/20] hw/mips/boston: Set CPU frequency to 1 GHz

2020-10-10 Thread Philippe Mathieu-Daudé
The I6400 can run at 1 GHz or more. Create a 'cpuclk' output clock and connect it to the CPU input clock. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/boston.c | 13 + 1 file changed, 13 insertions(+) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 1b3f69e949c..c998140d7

[PATCH v2 20/20] target/mips/cpu: Display warning when CPU is used without input clock

2020-10-10 Thread Philippe Mathieu-Daudé
All our QOM users provides an input clock. In order to avoid avoid future machines added without clock, display a warning. User-mode emulation use the CP0 timer with the RDHWR instruction (see commit cdfcad788394) so keep using the fixed 200 MHz clock without diplaying any warning. Only display it

[PATCH v2 08/20] target/mips: Move cp0_count_ns to CPUMIPSState

2020-10-10 Thread Philippe Mathieu-Daudé
Currently the CP0 timer period is fixed at 10 ns, corresponding to a fixed CPU frequency of 200 MHz (using half the speed of the CPU). In few commits we will be able to use a different CPU frequency. In preparation, move the cp0_count_ns variable to CPUMIPSState so we can modify it. Signed-off-by

[PATCH 1/2] linux-user/microblaze: Implement rt signal frames

2020-10-10 Thread Richard Henderson
Allows microblaze to pass tests/tcg/multiarch/linux-test.c. Signed-off-by: Richard Henderson --- linux-user/microblaze/signal.c | 91 ++ 1 file changed, 82 insertions(+), 9 deletions(-) diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c

[PATCH v2 11/20] target/mips/cpu: Allow the CPU to use dynamic frequencies

2020-10-10 Thread Philippe Mathieu-Daudé
Use the Clock API and let the CPU object have an input clock. If no clock is connected, keep using the default frequency of 200 MHz used since the introduction of the 'r4k' machine in commit 6af0bf9c7c3. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.h | 4 target/mips/cpu.c |

[PATCH v2 16/20] hw/mips/cps: Expose input clock and connect it to CPU cores

2020-10-10 Thread Philippe Mathieu-Daudé
Expose a qdev input clock named 'clk', and connect it to each core. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/mips/cps.h | 2 ++ hw/mips/cps.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/hw/mips/cps.h b/include/hw/mips/cps.h index 9e35a881366..859a8d4a674 1

[PATCH v2 10/20] target/mips/cpu: Make cp0_count_rate a property

2020-10-10 Thread Philippe Mathieu-Daudé
Since not all CPU implementations use a cores use a CP0 timer at half the frequency of the CPU, make this variable a property. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.h | 9 + target/mips/cpu.c | 19 +++ 2 files changed, 20 insertions(+), 8 deletions(-)

[PATCH v2 19/20] hw/mips/cps: Do not allow use without input clock

2020-10-10 Thread Philippe Mathieu-Daudé
Now than all QOM users provides the input clock, do not allow using a CPS without input clock connected. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/cps.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index c332609f7b3..f044e500b8c 100644 --- a/hw/m

[PATCH v2 07/20] target/mips/cp0_timer: Document TIMER_PERIOD origin

2020-10-10 Thread Philippe Mathieu-Daudé
TIMER_PERIOD value of '10 ns' can be explained looking at commit 6af0bf9c7c3doc, where the CPU frequency is 200 MHz and CP0 default count rate is half the frequency of the CPU. Document that. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cp0_timer.c | 12 +++- 1 file changed, 11

[PATCH v2 03/20] hw/qdev-clock: Display error hint when clock is missing from device

2020-10-10 Thread Philippe Mathieu-Daudé
Instead of directly aborting, display a hint to help the developer figure out the problem (likely trying to connect a clock to a device pre-dating the Clock API, thus not expecting clocks). Reviewed-by: Luc Michel Reviewed-by: Damien Hedde Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe

[PATCH v2 13/20] hw/mips/fuloong2e: Set CPU frequency to 533 MHz

2020-10-10 Thread Philippe Mathieu-Daudé
The CPU frequency is normally provided by the firmware in the "cpuclock" environment variable. The 2E board can handles up to 660MHz, but be conservative and take the same value used by the Linux kernel: 533 MHz. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/fuloong2e.c | 8 +++- 1 file

[PATCH v2 15/20] hw/mips/jazz: Correct CPU frequencies

2020-10-10 Thread Philippe Mathieu-Daudé
The Magnum 4000PC CPU runs at 100 MHz, and the Acer PICA-61 CPU at ~134 MHz. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/jazz.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 47723093b63..a506cacd5a7 100644 --- a/h

[PATCH v2 06/20] target/mips/cp0_timer: Explicit unit in variable name

2020-10-10 Thread Philippe Mathieu-Daudé
Name variables holding nanoseconds with the '_ns' suffix. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cp0_timer.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/target/mips/cp0_timer.c b/target/mips/cp0_timer.c

[PATCH v2 14/20] hw/mips/mipssim: Correct CPU frequency

2020-10-10 Thread Philippe Mathieu-Daudé
The MIPSsim machine CPU frequency is too fast running at 200 MHz, while it should be 12 MHz for the 24K and 6 MHz for the 5K core. Ref: Linux commit c78cbf49c4ed ("Support for MIPSsim, the cycle accurate MIPS simulator.") Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/mipssim.c | 12

[PATCH v2 02/20] qdev-monitor: Display frequencies scaled to SI unit

2020-10-10 Thread Philippe Mathieu-Daudé
Since commit 9f2ff99c7f2 ("qdev-monitor: print the device's clock with info qtree") we can display the clock frequencies in the monitor. Use the recently introduced freq_to_str() to display the frequencies using the closest SI unit (human friendlier). Before: (qemu) info qtree [...] dev: xi

[PATCH v2 04/20] hw/core/clock: add the clock_new helper function

2020-10-10 Thread Philippe Mathieu-Daudé
From: Luc Michel This function creates a clock and parents it to another object with a given name. It calls clock_setup_canonical_path before returning the new clock. This function is useful to create clocks in devices when one doesn't want to expose it at the qdev level (as an input or an outpu

[PATCH v2 12/20] hw/mips/r4k: Explicit CPU frequency is 200 MHz

2020-10-10 Thread Philippe Mathieu-Daudé
Since its introduction in commit 6af0bf9c7c3, the 'r4k' machine runs at 200 MHz. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/r4k.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/mips/r4k.c b/hw/mips/r4k.c index 3487013a4a1..6d550c637c6 100644 --- a/hw/mips/r4

[PATCH v2 05/20] target/mips: Move cpu_mips_get_random() with CP0 helpers

2020-10-10 Thread Philippe Mathieu-Daudé
The get_random() helper uses the CP0_Wired register, which is unrelated to the CP0_Count register use as timer. Commit e16fe40c872 ("Move the MIPS CPU timer in a separate file") incorrectly moved this get_random() helper with timer specific code. Move it back to generic CP0 helpers. Reviewed-by: A

[PATCH v2 01/20] util/cutils: Introduce freq_to_str() to display Hertz units

2020-10-10 Thread Philippe Mathieu-Daudé
Introduce freq_to_str() to convert frequency values in human friendly units using the SI units for Hertz. Suggested-by: Luc Michel Reviewed-by: Alistair Francis Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/cutils.h | 12 util/cutils.c | 1

[PATCH v2 09/20] target/mips/cpu: Calculate the CP0 timer period using the CPU frequency

2020-10-10 Thread Philippe Mathieu-Daudé
The CP0 timer period is a function of the CPU frequency. Start using the default values, which will be replaced by properties in the next commits. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/mips/cpu.c

[PATCH v2 00/20] hw/mips: Set CPU frequency

2020-10-10 Thread Philippe Mathieu-Daudé
All the MIPS cores emulated by QEMU provides the Coproc#0 'Count' register which can be used as a free running timer. Since it's introduction in 2005 this timer uses a fixed frequency of 100 MHz (for a CPU freq of 200 MHz). While this is not an issue with Linux guests, it makes some firmwares beha

Re: [PATCH v2 1/3] util/cutils: Introduce freq_to_str() to display Hertz units

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/1/20 8:42 PM, Eduardo Habkost wrote: On Thu, Oct 01, 2020 at 06:43:20PM +0200, Philippe Mathieu-Daudé wrote: Introduce freq_to_str() to convert frequency values in human friendly units using the SI units for Hertz. Suggested-by: Luc Michel Signed-off-by: Philippe Mathieu-Daudé --- inc

RE: [PATCH] net/filter-rewriter: destroy g_hash_table in colo_rewriter_cleanup

2020-10-10 Thread Zhang, Chen
I already queued this patch to COLO proxy tree, then I will send a series to Jason. Thanks Chen > -Original Message- > From: Pan Nengyuan > Sent: Saturday, October 10, 2020 6:55 PM > To: Li Qiang > Cc: Qemu Developers ; Zhang, Chen > ; Jason Wang ; > zhanghailiang ; Chen Qun > ; qemu-t

Re: [PATCH v3 13/15] hw/misc/bcm2835_cprman: add sane reset values to the registers

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 3:57 PM, Luc Michel wrote: Those reset values have been extracted from a Raspberry Pi 3 model B v1.2, using the 2020-08-20 version of raspios. The dump was done using the debugfs interface of the CPRMAN driver in Linux (under '/sys/kernel/debug/clk'). Each exposed clock tree stage (PL

Re: [PATCH v3 08/15] hw/misc/bcm2835_cprman: add a PLL channel skeleton implementation

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 3:57 PM, Luc Michel wrote: PLLs are composed of multiple channels. Each channel outputs one clock signal. They are modeled as one device taking the PLL generated clock as input, and outputting a new clock. A channel shares the CM register with its parent PLL, and has its own A2W_CTRL

Re: [PATCH] hw/net: move allocation to the heap due to very large stack frame

2020-10-10 Thread Elena Afanasova
On Sat, 2020-10-10 at 17:07 +1100, David Gibson wrote: > On Fri, Oct 09, 2020 at 07:02:56AM -0700, Elena Afanasova wrote: > > > From 09905773a00e417d3a37c12350d9e55466fdce8a Mon Sep 17 00:00:00 > > > 2001 > > From: Elena Afanasova > > Date: Fri, 9 Oct 2020 06:41:36 -0700 > > Subject: [PATCH] hw/ne

Re: [PATCH v3 11/15] hw/misc/bcm2835_cprman: implement clock mux behaviour

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 3:57 PM, Luc Michel wrote: A clock mux can be configured to select one of its 10 sources through the CM_CTL register. It also embeds yet another clock divider, composed of an integer part and a fractional part. The number of bits of each part is mux dependent. Tested-by: Philippe Mat

Re: [PATCH v3 02/15] hw/core/clock: trace clock values in Hz instead of ns

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 3:57 PM, Luc Michel wrote: The nanosecond unit greatly limits the dynamic range we can display in clock value traces, for values in the order of 1GHz and more. The internal representation can go way beyond this value and it is quite common for today's clocks to be within those ranges.

Re: [PATCH v3 03/15] hw/core/clock: add the clock_new helper function

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 5:17 PM, Philippe Mathieu-Daudé wrote: On 10/10/20 3:57 PM, Luc Michel wrote: This function creates a clock and parents it to another object with a given name. It calls clock_setup_canonical_path before returning the new clock. This function is useful to create clocks in devices wh

Re: [PATCH v3 03/15] hw/core/clock: add the clock_new helper function

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 3:57 PM, Luc Michel wrote: This function creates a clock and parents it to another object with a given name. It calls clock_setup_canonical_path before returning the new clock. This function is useful to create clocks in devices when one doesn't want to expose it at the qdev level (a

[PATCH v5] hw/avr: Add limited support for avr gpio registers

2020-10-10 Thread Heecheol Yang
Add some of these features for AVR GPIO: - GPIO I/O : PORTx registers - Data Direction : DDRx registers - DDRx toggling : PINx registers Following things are not supported yet: - MCUR registers Signed-off-by: Heecheol Yang --- hw/avr/Kconfig | 1 + hw/avr/atmega.c

Re: Ping2: [PATCH v2] Emulate dip switch language layout settings on SUN keyboard

2020-10-10 Thread Artyom Tarasenko
Hi Mark, could you please pick it up? Regards, Artyom сб, 19 сент. 2020 г., 20:47 Henrik Carlqvist : > Just wanted to check that my patch hasn't been forgotten... I was hoping > that > it would make it into some branch in git. > > Do you want me to do any more changes to the patch or the descri

[PATCH v3 15/15] hw/arm/bcm2835_peripherals: connect the UART clock

2020-10-10 Thread Luc Michel
Connect the 'uart-out' clock from the CPRMAN to the PL011 instance. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Luc Michel --- hw/arm/bcm2835_peripherals.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 9d6190042d..

[PATCH v3 13/15] hw/misc/bcm2835_cprman: add sane reset values to the registers

2020-10-10 Thread Luc Michel
Those reset values have been extracted from a Raspberry Pi 3 model B v1.2, using the 2020-08-20 version of raspios. The dump was done using the debugfs interface of the CPRMAN driver in Linux (under '/sys/kernel/debug/clk'). Each exposed clock tree stage (PLLs, channels and muxes) can be observed b

[PATCH v3 12/15] hw/misc/bcm2835_cprman: add the DSI0HSCK multiplexer

2020-10-10 Thread Luc Michel
This simple mux sits between the PLL channels and the DSI0E and DSI0P clock muxes. This mux selects between PLLA-DSI0 and PLLD-DSI0 channel and outputs the selected signal to source number 4 of DSI0E/P clock muxes. It is controlled by the cm_dsi0hsck register. Reviewed-by: Philippe Mathieu-Daudé

[PATCH v3 11/15] hw/misc/bcm2835_cprman: implement clock mux behaviour

2020-10-10 Thread Luc Michel
A clock mux can be configured to select one of its 10 sources through the CM_CTL register. It also embeds yet another clock divider, composed of an integer part and a fractional part. The number of bits of each part is mux dependent. Tested-by: Philippe Mathieu-Daudé Signed-off-by: Luc Michel --

[PATCH v3 09/15] hw/misc/bcm2835_cprman: implement PLL channels behaviour

2020-10-10 Thread Luc Michel
A PLL channel is able to further divide the generated PLL frequency. The divider is given in the CTRL_A2W register. Some channels have an additional fixed divider which is always applied to the signal. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Luc Miche

[PATCH v3 14/15] hw/char/pl011: add a clock input

2020-10-10 Thread Luc Michel
Add a clock input to the PL011 UART so we can compute the current baud rate and trace it. This is intended for developers who wish to use QEMU to e.g. debug their firmware or to figure out the baud rate configured by an unknown/closed source binary. Reviewed-by: Philippe Mathieu-Daudé Signed-off-

[PATCH v3 08/15] hw/misc/bcm2835_cprman: add a PLL channel skeleton implementation

2020-10-10 Thread Luc Michel
PLLs are composed of multiple channels. Each channel outputs one clock signal. They are modeled as one device taking the PLL generated clock as input, and outputting a new clock. A channel shares the CM register with its parent PLL, and has its own A2W_CTRL register. A write to the CM register wil

[PATCH v3 10/15] hw/misc/bcm2835_cprman: add a clock mux skeleton implementation

2020-10-10 Thread Luc Michel
The clock multiplexers are the last clock stage in the CPRMAN. Each mux outputs one clock signal that goes out of the CPRMAN to the SoC peripherals. Each mux has at most 10 sources. The sources 0 to 3 are common to all muxes. They are: 0. ground (no clock signal) 1. the main oscillator (xosc

[PATCH v3 07/15] hw/misc/bcm2835_cprman: implement PLLs behaviour

2020-10-10 Thread Luc Michel
The CPRMAN PLLs generate a clock based on a prescaler, a multiplier and a divider. The prescaler doubles the parent (xosc) frequency, then the multiplier/divider are applied. The multiplier has an integer and a fractional part. This commit also implements the CPRMAN CM_LOCK register. This register

[PATCH v3 05/15] hw/arm/raspi: add a skeleton implementation of the CPRMAN

2020-10-10 Thread Luc Michel
The BCM2835 CPRMAN is the clock manager of the SoC. It is composed of a main oscillator, and several sub-components (PLLs, multiplexers, ...) to generate the BCM2835 clock tree. This commit adds a skeleton of the CPRMAN, with a dummy register read/write implementation. It embeds the main oscillato

[PATCH v3 06/15] hw/misc/bcm2835_cprman: add a PLL skeleton implementation

2020-10-10 Thread Luc Michel
There are 5 PLLs in the CPRMAN, namely PLL A, C, D, H and B. All of them take the xosc clock as input and produce a new clock. This commit adds a skeleton implementation for the PLLs as sub-devices of the CPRMAN. The PLLs are instantiated and connected internally to the main oscillator. Each PLL

[PATCH v3 03/15] hw/core/clock: add the clock_new helper function

2020-10-10 Thread Luc Michel
This function creates a clock and parents it to another object with a given name. It calls clock_setup_canonical_path before returning the new clock. This function is useful to create clocks in devices when one doesn't want to expose it at the qdev level (as an input or an output). Suggested-by:

[PATCH v3 02/15] hw/core/clock: trace clock values in Hz instead of ns

2020-10-10 Thread Luc Michel
The nanosecond unit greatly limits the dynamic range we can display in clock value traces, for values in the order of 1GHz and more. The internal representation can go way beyond this value and it is quite common for today's clocks to be within those ranges. For example, a frequency between 500MHz

[PATCH v3 01/15] hw/core/clock: provide the VMSTATE_ARRAY_CLOCK macro

2020-10-10 Thread Luc Michel
Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Damien Hedde Signed-off-by: Luc Michel --- include/hw/clock.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/hw/clock.h b/include/hw/clock.h index d357594df9..c93e6113cd 100644 --- a/include/hw/clock.h +++ b/include/hw/clock.h @

[PATCH v3 00/15] raspi: add the bcm2835 cprman clock manager

2020-10-10 Thread Luc Michel
v2 -> v3: - patch 03: moved clock_new definition to hw/core/clock.c [Phil] - patch 03: commit message typo [Clement] - patch 10: clarifications around the CM_CTL/CM_DIBV mux registers. reg_cm replaced with reg_ctl and reg_div. Add some comments for clarity. [Phil]

[PATCH v3 04/15] hw/arm/raspi: fix CPRMAN base address

2020-10-10 Thread Luc Michel
The CPRMAN (clock controller) was mapped at the watchdog/power manager address. It was also split into two unimplemented peripherals (CM and A2W) but this is really the same one, as shown by this extract of the Raspberry Pi 3 Linux device tree: watchdog@7e10 { compatible = "brc

Re: [PATCH V2 1/5] target/riscv: Add basic vmstate description of CPU

2020-10-10 Thread Richard Henderson
On 10/10/20 3:06 AM, Yifei Jiang wrote: > +++ b/target/riscv/cpu.h > @@ -311,6 +311,10 @@ extern const char * const riscv_fpr_regnames[]; > extern const char * const riscv_excp_names[]; > extern const char * const riscv_intr_names[]; > > +#ifndef CONFIG_USER_ONLY > +extern const VMStateDescript

Re: [PATCH V13 1/9] linux-headers: Update MIPS KVM type defintition

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/10/20 2:59 PM, Peter Maydell wrote: On Wed, 7 Oct 2020 at 09:44, Huacai Chen wrote: Update MIPS KVM type defintition from Linux 5.9-rc6. Signed-off-by: Huacai Chen --- Is this a sync using scripts/update-linux-headers.sh ? (I vaguely had the idea of adding a --make-commit option to

Re: [PATCH v2 11/15] hw/misc/bcm2835_cprman: implement clock mux behaviour

2020-10-10 Thread Luc Michel
On 11:04 Tue 06 Oct , Philippe Mathieu-Daudé wrote: > On 10/5/20 9:56 PM, Luc Michel wrote: > > A clock mux can be configured to select one of its 10 sources through > > the CM_CTL register. It also embeds yet another clock divider, composed > > of an integer part and a fractional part. The num

Re: [PATCH V13 6/9] target/mips: Add loongson-ext lsdc2 group of instructions

2020-10-10 Thread Philippe Mathieu-Daudé
On 10/7/20 10:39 AM, Huacai Chen wrote: From: Jiaxun Yang LDC2/SDC2 opcodes have been rewritten as "load & store with offset" group of instructions by loongson-ext ASE. This patch add implementation of these instructions: gslbx: load 1 bytes to GPR gslhx: load 2 bytes to GPR gslwx: load 4 byte

Re: [PATCH V13 1/9] linux-headers: Update MIPS KVM type defintition

2020-10-10 Thread Peter Maydell
On Wed, 7 Oct 2020 at 09:44, Huacai Chen wrote: > > Update MIPS KVM type defintition from Linux 5.9-rc6. > > Signed-off-by: Huacai Chen > --- Is this a sync using scripts/update-linux-headers.sh ? (I vaguely had the idea of adding a --make-commit option to that script so it would automatically

Re: [PATCH] target/arm: Fix SMLAD incorrect setting of Q bit

2020-10-10 Thread Peter Maydell
On Fri, 9 Oct 2020 at 23:36, Richard Henderson wrote: > > On 10/9/20 1:48 PM, Peter Maydell wrote: > > On Fri, 9 Oct 2020 at 15:47, Peter Maydell wrote: > >> +tcg_gen_extr_i64_i32(t1, t2, p64); > > > > Oh, I forgot to mention, but it looks like extr_i64_i32 > > isn't documented in tcg/REA

Re: [PATCH v2 10/15] hw/misc/bcm2835_cprman: add a clock mux skeleton implementation

2020-10-10 Thread Luc Michel
On 13:33 Sat 10 Oct , Luc Michel wrote: > On 10:40 Tue 06 Oct , Philippe Mathieu-Daudé wrote: > > On 10/5/20 9:56 PM, Luc Michel wrote: > > > The clock multiplexers are the last clock stage in the CPRMAN. Each mux > > > outputs one clock signal that goes out of the CPRMAN to the SoC > > > p

  1   2   >