Re: [PATCH v8 5/7] net/vmnet: implement bridged mode (vmnet-bridged)

2022-01-22 Thread 李士林
Hi: I develop a custom os use qemu and use macos as host, I use the net argument '-net nic,model=pcnet -net tap,ifname=tap0,script=no,downscript=no’ when run the qemu-system-i386,then I can get the network device in my custom os: pci_device_dump: vendor id: 0x1022 pci_device_dum

Re: [PATCH 30/30] bsd-user/signal.c: do_sigaltstack

2022-01-22 Thread Warner Losh
On Fri, Jan 14, 2022 at 6:18 AM Peter Maydell wrote: > On Sun, 9 Jan 2022 at 17:08, Warner Losh wrote: > > > > Implement the meat of the sigaltstack(2) system call with do_sigaltstack. > > > > Signed-off-by: Stacey Son > > Signed-off-by: Kyle Evans > > Signed-off-by: Warner Losh > > --- > >

Re: [PATCH] tests/9pfs: fix mkdir() being called twice

2022-01-22 Thread Christian Schoenebeck
On Samstag, 22. Januar 2022 20:12:16 CET Christian Schoenebeck wrote: > The 9p test cases use mkdtemp() to create a temporary directory for > running the 'local' 9p tests with real files/dirs. Unlike mktemp() > which only generates a unique file name, mkdtemp() also creates the > directory, therefo

[PATCH] tests/9pfs: fix mkdir() being called twice

2022-01-22 Thread Christian Schoenebeck
The 9p test cases use mkdtemp() to create a temporary directory for running the 'local' 9p tests with real files/dirs. Unlike mktemp() which only generates a unique file name, mkdtemp() also creates the directory, therefore the subsequent mkdir() was wrong and caused errors on some systems. Signed

[PATCH 12/14] hw/intc/arm_gicv3_its: Check table bounds against correct limit

2022-01-22 Thread Peter Maydell
Currently when we fill in a TableDesc based on the value the guest has written to the GITS_BASER register, we calculate both: * num_entries : the number of entries in the table, constrained by the amount of memory the guest has given it * num_ids : the number of IDs we support for this table,

[PATCH 06/14] hw/intc/arm_gicv3: Honour GICD_CTLR.EnableGrp1NS for LPIs

2022-01-22 Thread Peter Maydell
The GICD_CTLR distributor register has enable bits which control whether the different interrupt groups (Group 0, Non-secure Group 1 and Secure Group 1) are forwarded to the CPU. We get this right for traditional interrupts, but forgot to account for it when adding LPIs. LPIs are always Group 1 N

[PATCH 04/14] hw/intc/arm_gicv3_its: Don't clear GITS_CREADR when GITS_CTLR.ENABLED is set

2022-01-22 Thread Peter Maydell
The current ITS code clears GITS_CREADR when GITS_CTLR.ENABLED is set. This is not correct -- guest code can validly clear ENABLED and then set it again and expect the ITS to continue processing where it left off. Remove the erroneous assignment. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv

[PATCH 08/14] hw/intc/arm_gicv3_redist: Remove unnecessary zero checks

2022-01-22 Thread Peter Maydell
The ITS-related parts of the redistributor code make some checks for whether registers like GICR_PROPBASER and GICR_PENDBASER are zero. There is no requirement in the specification for treating zeroes in these address registers specially -- they contain guest physical addresses and it is entirely v

[PATCH 11/14] hw/intc/arm_gicv3_its: Make GITS_BASER RAZ/WI for unimplemented registers

2022-01-22 Thread Peter Maydell
The ITS has a bank of 8 GITS_BASER registers, which allow the guest to specify the base address of various data tables. Each register has a read-only type field indicating which table it is for and a read-write field where the guest can write in the base address (among other things). We currently

[PATCH 09/14] hw/intc/arm_gicv3: Set GICR_CTLR.CES if LPIs are supported

2022-01-22 Thread Peter Maydell
The GICR_CTLR.CES bit is a read-only bit which is set to 1 to indicate that the GICR_CTLR.EnableLPIs bit can be written to 0 to disable LPIs (as opposed to allowing LPIs to be enabled but not subsequently disabled). Our implementation permits this, so advertise it by setting CES to 1. Signed-off-b

[PATCH 01/14] target/arm: Log CPU index in 'Taking exception' log

2022-01-22 Thread Peter Maydell
In an SMP system it can be unclear which CPU is taking an exception; add the CPU index (which is the same value used in the TCG 'Trace %d:' logging) to the "Taking exception" log line to clarify it. Signed-off-by: Peter Maydell --- target/arm/internals.h | 2 +- target/arm/helper.c| 9 ++

[PATCH 05/14] hw/intc/arm_gicv3_its: Don't clear GITS_CWRITER on writes to GITS_CBASER

2022-01-22 Thread Peter Maydell
The ITS specification says that when the guest writes to GITS_CBASER this causes GITS_CREADR to be cleared. However it does not have an equivalent clause for GITS_CWRITER. (This is because GITS_CREADR is read-only, but GITS_CWRITER is writable and the guest can initialize it.) Remove the code tha

[PATCH 07/14] hw/intc/arm_gicv3_its: Sort ITS command list into numeric order

2022-01-22 Thread Peter Maydell
The list of #defines for the ITS command packet numbers is neither in alphabetical nor numeric order. Sort it into numeric order. Signed-off-by: Peter Maydell --- hw/intc/gicv3_internal.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw

[PATCH 00/14] arm_gicv3_its: Implement MOVI and MOVALL commands

2022-01-22 Thread Peter Maydell
I noticed while working on the new-in-GICv4 ITS commands that we'd forgotten to implement the GICv3 MOVI and MOVALL commands. These move interrupts from one redistributor to another; Linux doesn't use MOVALL but does use MOVI if it wants to power down a CPU (when it needs to migrate interrupts form

[PATCH 13/14] hw/intc/arm_gicv3_its: Implement MOVALL

2022-01-22 Thread Peter Maydell
Implement the ITS MOVALL command, which takes all the pending interrupts on a source redistributor and makes the not-pending on that source redistributor and pending on a destination redistributor. This is a GICv3 ITS command which we forgot to implement. (It is not used by Linux guests.) Signed-

[PATCH 03/14] hw/intc/arm_gicv3: Initialise dma_as in GIC, not ITS

2022-01-22 Thread Peter Maydell
In our implementation, all ITSes connected to a GIC share a single AddressSpace, which we keep in the GICv3State::dma_as field and initialized based on the GIC's 'sysmem' property. The right place to set it up by calling address_space_init() is therefore in the GIC's realize method, not the ITS's r

[PATCH 10/14] hw/intc/arm_gicv3_its: Provide read accessor for translation_ops

2022-01-22 Thread Peter Maydell
The MemoryRegionOps gicv3_its_translation_ops currently provides only a .write_with_attrs function, because the only register in this region is the write-only GITS_TRANSLATER. However, if you don't provide a read function and the guest tries reading from this memory region, QEMU will crash because

[PATCH 02/14] hw/intc/arm_gicv3_its: Add tracepoints

2022-01-22 Thread Peter Maydell
The ITS currently has no tracepoints; add a minimal set that allows basic monitoring of guest register accesses and reading of commands from the command queue. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_its.c | 11 +++ hw/intc/trace-events| 8 2 files changed, 19 in

[PATCH 14/14] hw/intc/arm_gicv3_its: Implement MOVI

2022-01-22 Thread Peter Maydell
Implement the ITS MOVI command. This command specifies a (physical) LPI by DeviceID and EventID and provides a new ICID for it. The ITS must find the interrupt translation table entry for the LPI, which will tell it the old ICID. It then moves the pending state of the LPI from the old redistributor

Re: [PATCH 23/30] bsd-user/signal.c: sigset manipulation routines.

2022-01-22 Thread Kyle Evans
On Sat, Jan 22, 2022 at 10:44 AM Warner Losh wrote: > > > > On Fri, Jan 14, 2022 at 4:14 AM Peter Maydell > wrote: >> >> On Sun, 9 Jan 2022 at 16:53, Warner Losh wrote: >> > >> > target_sigemptyset: resets a set to having no bits set >> > qemu_sigorset: computes the or of two sets >> > tar

Re: [PULL 00/17] Python patches

2022-01-22 Thread Peter Maydell
On Sat, 22 Jan 2022 at 17:06, John Snow wrote: > > > > On Sat, Jan 22, 2022, 8:58 AM Peter Maydell wrote: >> >> On Sat, 22 Jan 2022 at 00:09, John Snow wrote: >> > >> > The following changes since commit >> > 5e9d14f2bea6df89c0675df953f9c839560d2266: >> > >> > Merge remote-tracking branch >>

Re: [PULL 00/17] Python patches

2022-01-22 Thread John Snow
On Sat, Jan 22, 2022, 8:58 AM Peter Maydell wrote: > On Sat, 22 Jan 2022 at 00:09, John Snow wrote: > > > > The following changes since commit > 5e9d14f2bea6df89c0675df953f9c839560d2266: > > > > Merge remote-tracking branch > 'remotes/alistair/tags/pull-riscv-to-apply-20220121-1' into staging

Re: [PATCH 23/30] bsd-user/signal.c: sigset manipulation routines.

2022-01-22 Thread Warner Losh
On Fri, Jan 14, 2022 at 4:14 AM Peter Maydell wrote: > On Sun, 9 Jan 2022 at 16:53, Warner Losh wrote: > > > > target_sigemptyset: resets a set to having no bits set > > qemu_sigorset: computes the or of two sets > > target_sigaddset: adds a signal to a set > > target_sigismember: returns

Getting privilege level of an instruction in TCG plugin

2022-01-22 Thread Milind Luthra
Hi everyone, We were writing a TCG plugin, and for every instruction executed, we wanted to know the privilege level where it was executed, i.e. was it in user mode or kernel mode. Approaches we tried: 1. We tried to use vcpu_syscall_cb/vcpu_syscall_ret_cb initially - any instruction execution b

[PATCH] hw/usb/dev-mtp: create directories with a+x mode mask

2022-01-22 Thread Volker Rümelin
Current code creates directories with mode 0644. Even the creator can't create files in the new directory. Set all x mode flags in variable mask and clear all x mode flags in function open() to preserve the current open mode. Signed-off-by: Volker Rümelin --- hw/usb/dev-mtp.c | 4 ++-- 1 file ch

Re: [PULL 00/17] Python patches

2022-01-22 Thread Peter Maydell
On Sat, 22 Jan 2022 at 00:09, John Snow wrote: > > The following changes since commit 5e9d14f2bea6df89c0675df953f9c839560d2266: > > Merge remote-tracking branch > 'remotes/alistair/tags/pull-riscv-to-apply-20220121-1' into staging > (2022-01-21 10:31:25 +) > > are available in the Git repo

[RFC PATCH] block/export/fuse: Fix build failure on FreeBSD

2022-01-22 Thread Philippe Mathieu-Daudé via
When building on FreeBSD we get: [816/6851] Compiling C object libblockdev.fa.p/block_export_fuse.c.o ../block/export/fuse.c:628:16: error: use of undeclared identifier 'FALLOC_FL_KEEP_SIZE' if (mode & FALLOC_FL_KEEP_SIZE) { ^ ../block/export/fuse.c:632:16: error: use

[PATCH v2 14/15] paaudio: fix samples vs. frames mix-up

2022-01-22 Thread Volker Rümelin
Now that the mixing buffer size no longer adds to playback latency, fix the samples vs. frames mix-up in the mixing buffer size calculation. This change will go largely unnoticed as long as the user doesn't use a buffer-size smaller than timer-period. Signed-off-by: Volker Rümelin --- audio/paau

[PATCH v2 10/15] audio: restore mixing-engine playback buffer size

2022-01-22 Thread Volker Rümelin
Commit ff095e5231 "audio: api for mixeng code free backends" introduced another FIFO for the audio subsystem with exactly the same size as the mixing-engine FIFO. Most audio backends use this generic FIFO. The generic FIFO used together with the mixing-engine FIFO doubles the audio FIFO size, becau

[PATCH v2 15/15] sdlaudio: fix samples vs. frames mix-up

2022-01-22 Thread Volker Rümelin
Fix the same samples vs. frames mix-up that the previous commit fixed for the PulseAudio backend. Signed-off-by: Volker Rümelin --- audio/sdlaudio.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index e605c787ba..797b47bbdd 100644

[PATCH v2 06/15] jackaudio: use more jack audio buffers

2022-01-22 Thread Volker Rümelin
The next patch reduces the effective qemu playback buffer size by timer-period. Increase the number of jack audio buffers by one to preserve the total effective buffer size. The size of one jack audio buffer is 512 samples. With audio defaults that's 512 samples / 44100 samples/s = 11.6 ms and only

[PATCH v2 08/15] audio: add pcm_ops function table for capture backend

2022-01-22 Thread Volker Rümelin
Add a pcm_ops function table for the capture backend. This avoids additional code in the next patches to test if the pcm_ops table is available. Signed-off-by: Volker Rümelin --- audio/audio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/audio.c b/audio/audio.c index 9e2d7fb209..5

[PATCH v2 07/15] audio: copy playback stream in sequential order

2022-01-22 Thread Volker Rümelin
Change the code to copy the playback stream in sequential order. The advantage can be seen in the next patches where the stream copy operation effectively becomes a write through operation. The following diagram shows the average buffer fill level and the stream copy sequence. ### represents a tim

[PATCH v2 05/15] paaudio: increase default latency to 46ms

2022-01-22 Thread Volker Rümelin
This is a patch to improve the pulseaudio playback experience. Asking pulseaudio for a playback latency of 15ms is quite demanding. Increase this to 46ms. The total playback latency now is 31ms larger. One of the next patches will reduce the total playback latency again by more than 46ms. Here is

[PATCH v2 01/15] audio: replace open-coded buffer arithmetic

2022-01-22 Thread Volker Rümelin
Replace open-coded buffer arithmetic with the new function audio_ring_posb(). That's the position in backward direction of a given point at a given distance. Signed-off-by: Volker Rümelin --- audio/audio.c | 25 +++-- audio/audio_int.h | 6 ++ audio/coreaudio.c | 10

[PATCH v2 04/15] audio: inline function audio_pcm_sw_get_rpos_in()

2022-01-22 Thread Volker Rümelin
Simplify code by inlining function audio_pcm_sw_get_rpos_in() at the only call site and remove the duplicated audio_bug() test. Signed-off-by: Volker Rümelin --- audio/audio.c | 23 +-- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/audio/audio.c b/audio/audio

[PATCH v2 03/15] audio: add function audio_pcm_hw_conv_in()

2022-01-22 Thread Volker Rümelin
Add a function audio_pcm_hw_conv_in() similar to the existing counterpart function audio_pcm_hw_clip_out(). This function reduces the number of calls to the pcm_ops functions get_buffer_in() and put_buffer_in(). That's one less call to get_buffer_in() and put_buffer_in() every time the conv_buffer

[PATCH v2 00/15] reduce audio playback latency

2022-01-22 Thread Volker Rümelin
This patch series reduces the playback latency for audio backends, in some cases significantly. For PulseAudio, the audio buffer is also moved from the QEMU side to the PulseAudio server side. This improves the drop-out safety for PulseAudio. I actually measured the latency reduction with the Pul

[PATCH v2 12/15] dsoundaudio: reduce effective playback buffer size

2022-01-22 Thread Volker Rümelin
Add the buffer_get_free pcm_ops function to reduce the effective playback buffer size. All intermediate audio playback buffers become temporary buffers. Signed-off-by: Volker Rümelin --- audio/dsoundaudio.c | 30 +- 1 file changed, 17 insertions(+), 13 deletions(-) d

[PATCH v2 11/15] paaudio: reduce effective playback buffer size

2022-01-22 Thread Volker Rümelin
Add the buffer_get_free pcm_ops function to reduce the effective playback buffer size. All intermediate audio playback buffers become temporary buffers. Signed-off-by: Volker Rümelin --- audio/paaudio.c | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) dif

[PATCH v2 02/15] audio: move function audio_pcm_hw_clip_out()

2022-01-22 Thread Volker Rümelin
Move the function audio_pcm_hw_clip_out() into the correct section 'Hard voice (playback)'. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Volker Rümelin --- audio/audio.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/audio/audi

[PATCH v2 13/15] ossaudio: reduce effective playback buffer size

2022-01-22 Thread Volker Rümelin
Return the free buffer size for the mmapped case in function oss_buffer_get_free() to reduce the effective playback buffer size. All intermediate audio playback buffers become temporary buffers. Signed-off-by: Volker Rümelin --- audio/ossaudio.c | 7 --- 1 file changed, 4 insertions(+), 3 de

[PATCH v2 09/15] Revert "audio: fix wavcapture segfault"

2022-01-22 Thread Volker Rümelin
This reverts commit cbaf25d1f59ee13fc7542a06ea70784f2e000c04. Since previous commit every audio backend has a pcm_ops function table. It's no longer necessary to test if the table is available. Signed-off-by: Volker Rümelin --- audio/audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletion

Re: [PATCH] hw/char/exynos4210_uart: Fix crash on trying to load VM state

2022-01-22 Thread Peter Maydell
On Sat, 22 Jan 2022 at 09:50, Philippe Mathieu-Daudé wrote: > > On 20/1/22 16:16, Peter Maydell wrote: > > The exynos4210_uart_post_load() function assumes that it is passed > > the Exynos4210UartState, but it has been attached to the > > VMStateDescription for the Exynos4210UartFIFO type. The re

[PATCH] hid: trivial change to support side and extra buttons

2022-01-22 Thread Noah Bergbauer
ping https://patchew.org/QEMU/20211126140437.79745-1-n...@statshelix.com/ This patch is really small because all of the necessary functionality is already in place. It's just a matter of setting the respective flags (instead of just ignoring the buttons) and allocating these bits in the HID descri

Re: [PATCH] hw/char/exynos4210_uart: Fix crash on trying to load VM state

2022-01-22 Thread Philippe Mathieu-Daudé via
On 20/1/22 16:16, Peter Maydell wrote: The exynos4210_uart_post_load() function assumes that it is passed the Exynos4210UartState, but it has been attached to the VMStateDescription for the Exynos4210UartFIFO type. The result is a SIGSEGV when attempting to load VM state for any machine type inc

Re: [PATCH] configure: fix parameter expansion of --cross-cc-cflags options

2022-01-22 Thread Philippe Mathieu-Daudé via
On 20/1/22 18:31, matheus.fe...@eldorado.org.br wrote: From: Matheus Ferst Without this fix, any use of --cross-cc-cflags-* causes a message like: $ ../configure --cross-cc-ppc64le=clang --cross-cc-cflags-ppc64le="-target powerpc64le-unknown-linux-gnu -sysroot ..." ../configure: 1: eval: cross

Re: [PATCH v2] hw/nvme: fix CVE-2021-3929

2022-01-22 Thread Philippe Mathieu-Daudé via
On 21/1/22 07:32, Klaus Jensen wrote: From: Klaus Jensen This fixes CVE-2021-3929 "locally" by denying DMA to the iomem of the device itself. This still allows DMA to MMIO regions of other devices (e.g. doing P2P DMA to the controller memory buffer of another NVMe device). Fixes: CVE-2021-3929

Re: [PATCH] docs: expand firmware descriptor to allow flash without NVRAM

2022-01-22 Thread Philippe Mathieu-Daudé via
+Gerd & David. On 21/1/22 16:34, Daniel P. Berrangé wrote: The current firmware descriptor schema for flash requires that both the executable to NVRAM template paths be provided. This is fine for the most common usage of EDK2 builds in virtualization where the separate _CODE and _VARS files are

[PATCH v5 1/2] qdev-properties: Add a new macro with bitmask check for uint64_t property

2022-01-22 Thread Yang Weijiang
The DEFINE_PROP_UINT64_CHECKMASK maro applies certain mask check agaist user-supplied property value, reject the value if it violates the bitmask. Co-developed-by: Like Xu Signed-off-by: Like Xu Signed-off-by: Yang Weijiang --- hw/core/qdev-properties.c| 19 +++ include/hw/

[PATCH v5 0/2] Enable legacy LBR support for guest

2022-01-22 Thread Yang Weijiang
KVM legacy LBR patches have been merged in kernel 5.12, this patchset is to expose the feature to guest from the perf capability MSR. Qemu can add LBR format in cpu option to achieve it, e.g., -cpu host,lbr-fmt=0x5, the format should match host value in IA32_PERF_CAPABILITIES. Note, KVM legacy LBR

[PATCH v5 2/2] target/i386: Add lbr-fmt vPMU option to support guest LBR

2022-01-22 Thread Yang Weijiang
The Last Branch Recording (LBR) is a performance monitor unit (PMU) feature on Intel processors which records a running trace of the most recent branches taken by the processor in the LBR stack. This option indicates the LBR format to enable for guest perf. The LBR feature is enabled if below cond