Re: [PATCH 9/9] accel/tcg: Pass last not end to tb_invalidate_phys_range

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 03:13, Richard Henderson wrote: Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 2 +-

Re: [PATCH v3 12/16] slirp: unregister the win32 SOCKET

2023-03-05 Thread Marc-André Lureau
Hi On Thu, Mar 2, 2023 at 10:45 PM Stefan Berger wrote: > > > On 2/21/23 07:47, marcandre.lur...@redhat.com wrote: > > From: Marc-André Lureau > > > > Presumably, this is what should happen when the SOCKET is to be removed. > > (it probably worked until now because closesocket() does it

Re: [PATCH v3 14/16] win32: avoid mixing SOCKET and file descriptor space

2023-03-05 Thread Marc-André Lureau
Hi On Fri, Mar 3, 2023 at 12:54 AM Stefan Berger wrote: > > > > On 2/21/23 07:47, marcandre.lur...@redhat.com wrote: > > From: Marc-André Lureau > > > > Until now, a win32 SOCKET handle is often cast to an int file > > descriptor, as this is what other OS use for sockets. When necessary, > >

Re: [PATCH 7/9] accel/tcg: Pass last not end to page_collection_lock

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 03:13, Richard Henderson wrote: Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Fixes a bug in the loop comparision where "<= end" would lock one more page

Re: [PATCH 6/9] accel/tcg: Pass last not end to PAGE_FOR_EACH_TB

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 03:13, Richard Henderson wrote: Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Signed-off-by: Richard Henderson --- accel/tcg/tb-maint.c | 28

Re: [PATCH 5/9] accel/tcg: Pass last not end to page_reset_target_data

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 03:13, Richard Henderson wrote: Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 2 +-

Re: [PATCH 4/9] accel/tcg: Pass last not end to page_set_flags

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 03:13, Richard Henderson wrote: Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1528 Signed-off-by:

Re: [PATCH] scsi: megasas: Internal cdbs have 16-byte length

2023-03-05 Thread Fiona Ebner
Am 03.03.23 um 16:10 schrieb Guenter Roeck: > On 3/3/23 01:02, Fiona Ebner wrote: >> Am 28.02.23 um 18:11 schrieb Guenter Roeck: >>> Host drivers do not necessarily set cdb_len in megasas io commands. >>> With commits 6d1511cea0 ("scsi: Reject commands if the CDB length >>> exceeds buf_len") and

Re: [PATCH 2/9] linux-user: Rename max_reserved_va in main

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 03:13, Richard Henderson wrote: Rename to local_max_va, to avoid a conflict with the next patch. Signed-off-by: Richard Henderson --- linux-user/main.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v2 1/5] tcg: Do not elide memory barriers for !CF_PARALLEL

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 02:57, Richard Henderson wrote: The virtio devices require proper memory ordering between the vcpus and the iothreads. Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v2 5/5] accel/tcg: Remove check_tcg_memory_orders_compatible

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 02:57, Richard Henderson wrote: We now issue host memory barriers to match the guest memory order. Continue to disable MTTCG only if the guest has not been ported. Signed-off-by: Richard Henderson --- accel/tcg/tcg-all.c | 34 -- 1 file changed, 8

Re: [PATCH v2 3/5] tcg: Create tcg_req_mo

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 02:57, Richard Henderson wrote: Split out the logic to emit a host memory barrier in response to a guest memory operation. Do not provide a true default for TCG_GUEST_DEFAULT_MO because the defined() check will still be useful for determining if a guest has been updated for MTTCG.

Re: [PATCH v2 2/5] tcg: Elide memory barriers implied by the host memory model

2023-03-05 Thread Philippe Mathieu-Daudé
On 6/3/23 02:57, Richard Henderson wrote: Reduce the set of required barriers to those needed by the host right from the beginning. Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v4 1/9] hw/pci-host/i440fx: Inline sysbus_add_io()

2023-03-05 Thread Bernhard Beschow
Am 22. Februar 2023 18:05:51 UTC schrieb Bernhard Beschow : > > >Am 22. Februar 2023 10:58:08 UTC schrieb "Philippe Mathieu-Daudé" >: >>On 13/2/23 17:19, Bernhard Beschow wrote: >>> sysbus_add_io() just wraps memory_region_add_subregion() while also >>> obscuring where the memory is attached.

[PULL 09/27] audio/audio_template: use g_new0() to replace audio_calloc()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Replace audio_calloc() with the equivalent g_new0(). With a n_structs argument >= 1, g_new0() never returns NULL. Also remove the unnecessary NULL checks. Signed-off-by: Volker Rümelin Reviewed-by: Daniel P. Berrangé Reviewed-by: Marc-André Lureau Message-Id:

[PULL 25/27] audio: handle leftover audio frame from upsampling

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Upsampling may leave one remaining audio frame in the input buffer. The emulated audio playback devices are currently resposible to write this audio frame again in the next write cycle. Push that task down to audio_pcm_sw_write. This is another step towards an audio

[PULL 23/27] audio: rename variables in audio_pcm_sw_read()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin The audio_pcm_sw_read() function uses a few very unspecific variable names. Rename them for better readability. ret => total_out total => total_in size => buf_len samples => frames_out_max Acked-by: Mark Cave-Ayland Reviewed-by: Marc-André Lureau Signed-off-by: Volker

[PULL 24/27] audio: make recording packet length calculation exact

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Introduce the new function st_rate_frames_out() to calculate the exact number of audio output frames the resampling code can generate from a given number of audio input frames. When upsampling, this function returns the maximum number of output frames. This new function

[PULL 16/27] audio: replace the resampling loop in audio_pcm_sw_write()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Replace the resampling loop in audio_pcm_sw_write() with the new function audio_pcm_sw_resample_out(). Unlike the old resample loop the new function will try to consume input frames even if the output buffer is full. This is necessary when downsampling to avoid reading less

[PULL 10/27] audio: remove audio_calloc() function

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Now that the last call site of audio_calloc() was removed, remove the unused audio_calloc() function. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Volker Rümelin Reviewed-by: Marc-André Lureau Message-Id: <20230121094735.11644-9-vr_q...@t-online.de> ---

[PULL 22/27] audio: replace the resampling loop in audio_pcm_sw_read()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Replace the resampling loop in audio_pcm_sw_read() with the new function audio_pcm_sw_resample_in(). Unlike the old resample loop the new function will try to consume input frames even if the output buffer is full. This is necessary when downsampling to avoid reading less

[PULL 26/27] audio/audio_template: substitute sw->hw with hw

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Substitute sw->hw with hw in the audio_pcm_sw_alloc_resources_* functions. Acked-by: Mark Cave-Ayland Reviewed-by: Marc-André Lureau Signed-off-by: Volker Rümelin Message-Id: <20230224190555.7409-14-vr_q...@t-online.de> --- audio/audio_template.h | 6 +++--- 1 file

[PULL 27/27] audio: remove sw->ratio

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Simplify the resample buffer size calculation. For audio playback we have sw->ratio = ((int64_t)sw->hw->info.freq << 32) / sw->info.freq; samples = ((int64_t)sw->HWBUF.size << 32) / sw->ratio; This can be simplified to samples = muldiv64(sw->HWBUF.size, sw->info.freq,

[PULL 13/27] audio: change type of mix_buf and conv_buf

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Change the type of mix_buf in struct HWVoiceOut and conv_buf in struct HWVoiceIn from STSampleBuffer * to STSampleBuffer. However, a buffer pointer is still needed. For this reason in struct STSampleBuffer samples[] is changed to *buffer. This is a preparation for the next

[PULL 11/27] alsaaudio: change default playback settings

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin The currently used default playback settings in the ALSA audio backend are a bit unfortunate. With a few emulated audio devices, audio playback does not work properly. Here is a short part of the debug log while audio is playing (elapsed time in seconds). audio: Elapsed

[PULL 07/27] audio/alsaaudio: use g_new0() instead of audio_calloc()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Replace audio_calloc() with the equivalent g_new0(). The value of the g_new0() argument count is >= 1, which means g_new0() will never return NULL. Also remove the unnecessary NULL check. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by:

[PULL 21/27] audio: make playback packet length calculation exact

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Introduce the new function st_rate_frames_in() to calculate the exact number of audio input frames needed to get a given number of audio output frames. The exact number of frames depends only on the difference of opos - ipos and the number of output frames. When

[PULL 08/27] audio/audio_template: use g_malloc0() to replace audio_calloc()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Use g_malloc0() as a direct replacement for audio_calloc(). Since the type of the parameter n_bytes of the function g_malloc0() is unsigned, the type of the variables voice_size_out and voice_size_in has been changed to size_t. This means that the function argument no

[PULL 20/27] audio: remove unused noop_conv() function

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin The function audio_capture_mix_and_clear() no longer uses audio_pcm_sw_write() to resample audio frames from one internal buffer to another. For this reason, the noop_conv() function is now unused. Remove it. Acked-by: Mark Cave-Ayland Reviewed-by: Marc-André Lureau

[PULL 18/27] audio: rename variables in audio_pcm_sw_write()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin The audio_pcm_sw_write() function uses a lot of very unspecific variable names. Rename them for better readability. ret => total_in total => total_out size => buf_len hwsamples => hw->mix_buf.size samples => frames_in_max Acked-by: Mark Cave-Ayland Reviewed-by: Marc-André

[PULL 12/27] alsaaudio: reintroduce default recording settings

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Audio recording with ALSA default settings currently doesn't work. The debug log shows updates every 0.75s and 1.5s. audio: Elapsed since last alsa run (running): 0.743030 audio: Elapsed since last alsa run (running): 1.486048 audio: Elapsed since last alsa run (running):

[PULL 15/27] audio: make the resampling code greedy

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Read the maximum possible number of audio frames instead of the minimum necessary number of frames when the audio stream is downsampled and the output buffer is limited. This makes the function symmetrical to upsampling when the input buffer is limited. The maximum possible

[PULL 05/27] audio: remove unused #define AUDIO_STRINGIFY

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Remove the unused #define AUDIO_STRINGIFY. It was last used before commit 470bcabd8f ("audio: Replace AUDIO_FUNC with __func__"). Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Volker Rümelin Reviewed-by: Marc-André Lureau Message-Id:

[PULL 19/27] audio: don't misuse audio_pcm_sw_write()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin The audio_pcm_sw_write() function is intended to convert a PCM audio stream to the internal representation, adjust the volume, and then mix it with the other audio streams with a possibly changed sample rate in mix_buf. In order for the audio_capture_mix_and_clear() function

[PULL 17/27] audio: remove sw == NULL check

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin All call sites of audio_pcm_sw_write() guarantee that sw is not NULL. Remove the unnecessary NULL check. Acked-by: Mark Cave-Ayland Reviewed-by: Marc-André Lureau Signed-off-by: Volker Rümelin Message-Id: <20230224190555.7409-5-vr_q...@t-online.de> --- audio/audio.c | 4

[PULL 14/27] audio: change type and name of the resample buffer

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Change the type of the resample buffer from struct st_sample * to STSampleBuffer. Also change the name from buf to resample_buf for better readability. The new variables resample_buf.size and resample_buf.pos will be used after the next patches. There is no functional

[PULL 04/27] audio: rename hardware store to backend

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Use a consistent friendly name for the HWVoiceOut and HWVoiceIn structures. Reviewed-by: Thomas Huth Signed-off-by: Volker Rümelin Reviewed-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230121094735.11644-3-vr_q...@t-online.de> ---

[PULL 02/27] audio: log unimplemented audio device sample rates

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Some emulated audio devices allow guests to select very low sample rates that the audio subsystem doesn't support. The lowest supported sample rate depends on the audio backend used and in most cases can be changed with various -audiodev arguments. Until now, the audio_bug

[PULL 01/27] MAINTAINERS: add myself to ui/ and audio/

2023-03-05 Thread marcandre . lureau
From: Marc-André Lureau Helping out with patch review & queue handling. Signed-off-by: Marc-André Lureau Reviewed-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230207085610.1033536-1-marcandre.lur...@redhat.com> --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)

[PULL 06/27] audio/mixeng: use g_new0() instead of audio_calloc()

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Replace audio_calloc() with the equivalent g_new0(). With a n_structs argument of 1, g_new0() never returns NULL. Also remove the unnecessary NULL checks. Reviewed-by: Richard Henderson Signed-off-by: Volker Rümelin Reviewed-by: Marc-André Lureau Message-Id:

[PULL 03/27] audio: don't show unnecessary error messages

2023-03-05 Thread marcandre . lureau
From: Volker Rümelin Let the audio_pcm_create_voice_pair_* functions handle error reporting. This avoids an additional error message in case the guest selected an unimplemented sample rate. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Volker Rümelin Reviewed-by: Marc-André Lureau

[PULL 00/27] Audio patches

2023-03-05 Thread marcandre . lureau
From: Marc-André Lureau The following changes since commit 2946e1af2704bf6584f57d4e3aec49d1d5f3ecc0: configure: Disable thread-safety warnings on macOS (2023-03-04 14:03:46 +) are available in the Git repository at: https://gitlab.com/marcandre.lureau/qemu.git tags/audio-pull-request

Re: [PATCH] hw/intc/ioapic: Update KVM routes before redelivering IRQ, on RTE update

2023-03-05 Thread David Woodhouse
On 5 March 2023 22:36:18 GMT, Peter Xu wrote: >On Sun, Mar 05, 2023 at 06:43:42PM +, >> --- >> Alternative fixes might have been just to remove the part in >> ioapic_service() which delivers the IRQ via kvm_set_irq() because >> surely delivering as MSI ought to work just fine anyway in

Re: [PATCH v5 00/16] hw/9pfs: Add 9pfs support for Windows

2023-03-05 Thread Bin Meng
On Mon, Feb 20, 2023 at 6:10 PM Bin Meng wrote: > > At present there is no Windows support for 9p file system. > This series adds initial Windows support for 9p file system. > > 'local' file system backend driver is supported on Windows, > including open, read, write, close, rename, remove, etc.

Re: [PATCH v3 1/2] target/riscv: add Zicond as an experimental extension

2023-03-05 Thread Alistair Francis
On Wed, Feb 8, 2023 at 12:40 AM Philipp Tomsich wrote: > > This implements the Zicond (conditional integer operations) extension, > as of version 1.0-draft-20230120 as an experimental extension in QEMU > ("x-zicond"). > > The Zicond extension acts as a building block for branchless sequences >

Re: [PATCH] memory: avoid unnecessary iteration when updating ioeventfds

2023-03-05 Thread Jason Wang
On Mon, Mar 6, 2023 at 5:27 AM Peter Xu wrote: > > On Wed, Mar 01, 2023 at 04:36:20PM +0800, Jason Wang wrote: > > On Tue, Feb 28, 2023 at 10:25 PM Longpeng(Mike) > > wrote: > > > > > > From: Longpeng > > > > > > When updating ioeventfds, we need to iterate all address spaces and > > > iterate

Re: [PATCH v4 01/15] vdpa net: move iova tree creation from init to start

2023-03-05 Thread Jason Wang
On Fri, Mar 3, 2023 at 4:01 PM Eugenio Perez Martin wrote: > > On Fri, Mar 3, 2023 at 4:32 AM Jason Wang wrote: > > > > > > 在 2023/3/1 15:01, Eugenio Perez Martin 写道: > > > On Mon, Feb 27, 2023 at 8:04 AM Jason Wang wrote: > > >> > > >> 在 2023/2/24 23:54, Eugenio Pérez 写道: > > >>> Only create

Re: [PATCH v4 12/15] vdpa: block migration if device has unsupported features

2023-03-05 Thread Jason Wang
On Fri, Mar 3, 2023 at 4:58 PM Eugenio Perez Martin wrote: > > On Fri, Mar 3, 2023 at 4:48 AM Jason Wang wrote: > > > > > > 在 2023/3/2 03:32, Eugenio Perez Martin 写道: > > > On Mon, Feb 27, 2023 at 9:20 AM Jason Wang wrote: > > >> On Mon, Feb 27, 2023 at 4:15 PM Jason Wang wrote: > > >>> > >

Re: [PATCH v13 2/2] vhost-vdpa: add support for vIOMMU

2023-03-05 Thread Jason Wang
在 2023/2/8 10:57, Cindy Lu 写道: 1.Add support for vIOMMU. Add the new function to deal with iommu MR. - during iommu_region_add register a specific IOMMU notifier, and store all notifiers in a list. - during iommu_region_del, compare and delete the IOMMU notifier from the list - since the

Re: [PATCH v13 1/2] vhost: expose function vhost_dev_has_iommu()

2023-03-05 Thread Jason Wang
On Wed, Feb 8, 2023 at 10:57 AM Cindy Lu wrote: > > To support vIOMMU in vdpa, need to exposed the function > vhost_dev_has_iommu, vdpa will use this function to check > if vIOMMU enable. > > Signed-off-by: Cindy Lu Acked-by: Jason Wang Thanks > --- > hw/virtio/vhost.c | 2 +- >

Re: [PATCH v3 09/14] hw/net/tulip: Finish QOM conversion

2023-03-05 Thread Jason Wang
On Tue, Feb 28, 2023 at 9:39 PM Philippe Mathieu-Daudé wrote: > > Hi Jason, do you Ack this patch? Yes. Acked-by: Jason Wang Thanks > > On 13/2/23 19:43, Philippe Mathieu-Daudé wrote: > > Use the TULIP() and DEVICE() QOM type-checking macros. > > Remove uses of DO_UPCAST(). > > > >

Re: [PATCH v3 00/13] vfio/migration: Device dirty page tracking

2023-03-05 Thread Alex Williamson
On Sun, 5 Mar 2023 23:33:35 + Joao Martins wrote: > On 05/03/2023 20:57, Alex Williamson wrote: > > On Sat, 4 Mar 2023 01:43:30 + > > Joao Martins wrote: > > > >> Hey, > >> > >> Presented herewith a series based on the basic VFIO migration protocol v2 > >> implementation [1]. > >> >

[PATCH 2/9] linux-user: Rename max_reserved_va in main

2023-03-05 Thread Richard Henderson
Rename to local_max_va, to avoid a conflict with the next patch. Signed-off-by: Richard Henderson --- linux-user/main.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index f4dea25242..5fcaddffc2 100644 --- a/linux-user/main.c

[PATCH 9/9] accel/tcg: Pass last not end to tb_invalidate_phys_range

2023-03-05 Thread Richard Henderson
Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 2 +- accel/tcg/tb-maint.c | 31

[PATCH 1/9] linux-user: Diagnose incorrect -R size

2023-03-05 Thread Richard Henderson
Zero is the value for 'off', and should not be used with -R. We have been enforcing host page alignment for the non-R fallback of MAX_RESERVED_VA, but failing to enforce for -R. Signed-off-by: Richard Henderson --- linux-user/main.c | 10 ++ 1 file changed, 10 insertions(+) diff --git

[PATCH 6/9] accel/tcg: Pass last not end to PAGE_FOR_EACH_TB

2023-03-05 Thread Richard Henderson
Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Signed-off-by: Richard Henderson --- accel/tcg/tb-maint.c | 28 1 file changed, 16

[PATCH 4/9] accel/tcg: Pass last not end to page_set_flags

2023-03-05 Thread Richard Henderson
Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1528 Signed-off-by: Richard Henderson --- include/exec/cpu-all.h

[PATCH 7/9] accel/tcg: Pass last not end to page_collection_lock

2023-03-05 Thread Richard Henderson
Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Fixes a bug in the loop comparision where "<= end" would lock one more page than required. Signed-off-by: Richard

[PATCH 3/9] include/exec: Replace reserved_va with max_reserved_va

2023-03-05 Thread Richard Henderson
In addition to the rename, change the semantics to be the last byte of the guest va, rather than the following byte. This avoids some overflow conditions. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 15 --- linux-user/arm/target_cpu.h | 2 +- bsd-user/main.c

[PATCH 0/9] accel/tcg: Fix page_set_flags and related [#1528]

2023-03-05 Thread Richard Henderson
The primary issue is that of overflow, where "end" for the last page of the 32-bit address space overflows to 0. The fix is to use "last" instead, which can always be represented. This requires that we adjust reserved_va as well, because of -/* - * There are a number of places where we assign

[PATCH 8/9] accel/tcg: Pass last not end to tb_invalidate_phys_page_range__locked

2023-03-05 Thread Richard Henderson
Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Properly truncate tb_last to the end of the page; the comment about tb_end being past the end of the page being ok is not

[PATCH 5/9] accel/tcg: Pass last not end to page_reset_target_data

2023-03-05 Thread Richard Henderson
Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 2 +- accel/tcg/user-exec.c | 11 +--

[PATCH v2 5/5] accel/tcg: Remove check_tcg_memory_orders_compatible

2023-03-05 Thread Richard Henderson
We now issue host memory barriers to match the guest memory order. Continue to disable MTTCG only if the guest has not been ported. Signed-off-by: Richard Henderson --- accel/tcg/tcg-all.c | 34 -- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git

[PATCH v2 3/5] tcg: Create tcg_req_mo

2023-03-05 Thread Richard Henderson
Split out the logic to emit a host memory barrier in response to a guest memory operation. Do not provide a true default for TCG_GUEST_DEFAULT_MO because the defined() check will still be useful for determining if a guest has been updated for MTTCG. Signed-off-by: Richard Henderson ---

[PATCH v2 4/5] tcg: Add host memory barriers to cpu_ldst.h interfaces

2023-03-05 Thread Richard Henderson
Bring the majority of helpers into line with the rest of tcg in respecting guest memory ordering. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 14 ++ accel/tcg/cputlb.c| 2 ++ accel/tcg/user-exec.c | 14 ++ 3 files changed, 30 insertions(+) diff

[PATCH v2 1/5] tcg: Do not elide memory barriers for !CF_PARALLEL

2023-03-05 Thread Richard Henderson
The virtio devices require proper memory ordering between the vcpus and the iothreads. Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 77658a88f0..75fdcdaac7 100644 ---

[PATCH v2 2/5] tcg: Elide memory barriers implied by the host memory model

2023-03-05 Thread Richard Henderson
Reduce the set of required barriers to those needed by the host right from the beginning. Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 75fdcdaac7..2721c1cab9 100644 ---

[PATCH v2 0/5] tcg: Issue memory barriers for guest memory model

2023-03-05 Thread Richard Henderson
Version 1 was very nearly 2 years ago: https://lore.kernel.org/qemu-devel/20210316220735.2048137-1-richard.hender...@linaro.org/ I didn't persue it at the time because at the time it didn't actually fix the s390x-on-aarch64 problems. I'm re-posting this now because of Paolo's "missing barriers

[PULL 72/84] target/hexagon/idef-parser: Use gen_tmp for gen_rvalue_pred

2023-03-05 Thread Richard Henderson
The allocation is immediately followed by either tcg_gen_mov_i32 or gen_read_preg (which contains tcg_gen_mov_i32), so the zero initialization is immediately discarded. Reviewed-by: Taylor Simpson Signed-off-by: Richard Henderson --- target/hexagon/idef-parser/parser-helpers.c | 2 +- 1 file

[PULL 65/84] target/tricore: Drop tcg_temp_free

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/tricore/translate.c | 540 + 1 file changed, 4 insertions(+), 536 deletions(-) diff --git a/target/tricore/translate.c

[PULL 51/84] target/riscv: Drop temp_new

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries, therefore there's no need to record temps for later freeing. Replace the few uses with tcg_temp_new. Reviewed-by: Weiwei Li Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/riscv/translate.c

[PULL 60/84] target/xtensa: Drop reset_sar_tracker

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Remove sar_m32_allocated, as sar_m32 non-null is equivalent. Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git

[PULL 50/84] target/riscv: Drop ftemp_new

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries, therefore there's no need to record temps for later freeing. Replace the few uses with tcg_temp_new_i64. Reviewed-by: Weiwei Li Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/riscv/translate.c | 24

[PULL 75/84] target/microblaze: Avoid tcg_const_* throughout

2023-03-05 Thread Richard Henderson
All uses are strictly read-only. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 35 +++ 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/target/microblaze/translate.c

[PULL 04/84] target/sparc: Use tlb_set_page_full

2023-03-05 Thread Richard Henderson
Pass CPUTLBEntryFull to get_physical_address instead of a collection of pointers. Acked-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sparc/mmu_helper.c | 121 +- 1 file changed, 54 insertions(+), 67

[PULL 07/84] softmmu: Check watchpoints for read+write at once

2023-03-05 Thread Richard Henderson
Atomic operations are read-modify-write, and we'd like to be able to test both read and write with one call. This is easy enough, with BP_MEM_READ | BP_MEM_WRITE. Add BP_HIT_SHIFT to make it easy to set BP_WATCHPOINT_HIT_*. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson

[PULL 83/84] target/xtensa: Split constant in bit shift

2023-03-05 Thread Richard Henderson
Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 2903c73f8e..f906ba7ed5 100644 --- a/target/xtensa/translate.c +++

[PULL 43/84] target/m68k: Drop mark_to_release

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries, therefore there's no need to record temps for later freeing. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/m68k/translate.c | 55 ++--- 1 file changed, 13 insertions(+), 42

[PULL 61/84] target/xtensa: Drop tcg_temp_free

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 107 -- 1 file changed, 107 deletions(-) diff --git a/target/xtensa/translate.c

[PULL 53/84] target/rx: Drop tcg_temp_free

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/rx/translate.c | 84 --- 1 file changed, 84 deletions(-) diff --git a/target/rx/translate.c b/target/rx/translate.c index

[PULL 84/84] target/xtensa: Avoid tcg_const_i32

2023-03-05 Thread Richard Henderson
All remaining uses are strictly read-only. Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index f906ba7ed5..0cf3075649

[PULL 77/84] target/s390x: Split out gen_ri2

2023-03-05 Thread Richard Henderson
Use tcg_constant_i64. Adjust in2_mri2_* to allocate a new temporary for the output, using gen_ri2 for the address. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 23 ++- 1 file changed, 14 insertions(+), 9

[PULL 22/84] target/arm: Drop tcg_temp_free from translator-m-nocp.c

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-m-nocp.c | 20 1 file changed, 20 deletions(-) diff --git a/target/arm/tcg/translate-m-nocp.c

[PULL 48/84] target/openrisc: Drop tcg_temp_free

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 39 - 1 file changed, 39 deletions(-) diff --git a/target/openrisc/translate.c

[PULL 82/84] target/xtensa: Use tcg_gen_subfi_i32 in translate_sll

2023-03-05 Thread Richard Henderson
Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 41b84082de..2903c73f8e 100644 --- a/target/xtensa/translate.c +++

[PULL 71/84] target/hexagon/idef-parser: Use gen_tmp for gen_pred_assign

2023-03-05 Thread Richard Henderson
The allocation is immediately followed by tcg_gen_mov_i32, so the initial assignment of zero is discarded. Reviewed-by: Taylor Simpson Signed-off-by: Richard Henderson --- target/hexagon/idef-parser/parser-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PULL 39/84] target/hexagon/idef-parser: Drop HexValue.is_manual

2023-03-05 Thread Richard Henderson
This field is no longer used. Reviewed-by: Taylor Simpson Signed-off-by: Richard Henderson --- target/hexagon/idef-parser/idef-parser.h| 1 - target/hexagon/idef-parser/parser-helpers.c | 15 --- target/hexagon/idef-parser/idef-parser.y| 2 -- 3 files changed, 18

[PULL 23/84] target/arm: Drop tcg_temp_free from translator-mve.c

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-mve.c | 52 -- 1 file changed, 52 deletions(-) diff --git a/target/arm/tcg/translate-mve.c

[PULL 81/84] target/xtensa: Avoid tcg_const_i32 in translate_l32r

2023-03-05 Thread Richard Henderson
Use addi on the addition side and tcg_constant_i32 on the other. Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index

[PULL 78/84] target/sparc: Avoid tcg_const_{tl,i32}

2023-03-05 Thread Richard Henderson
All remaining uses are strictly read-only. Reviewed-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 80 +++- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/target/sparc/translate.c

[PULL 76/84] target/riscv: Avoid tcg_const_*

2023-03-05 Thread Richard Henderson
All uses are strictly read-only. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/riscv/translate.c | 4 ++-- target/riscv/insn_trans/trans_rvv.c.inc | 4 ++-- target/riscv/insn_trans/trans_rvzfh.c.inc | 2 +- 3 files changed, 5 insertions(+),

[PULL 70/84] target/hexagon/idef-parser: Use gen_tmp for LPCFG

2023-03-05 Thread Richard Henderson
The GET_USR_FIELD macro initializes the output, so the initial assignment of zero is discarded. This is the only use of get_tmp_value outside of parser-helper.c, so make it static. Reviewed-by: Taylor Simpson Signed-off-by: Richard Henderson --- target/hexagon/idef-parser/parser-helpers.h | 6

[PULL 56/84] target/sparc: Drop get_temp_i32

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries, therefore there's no need to record temps for later freeing. Replace the few uses with tcg_temp_new_i32. Reviewed-by: Peter Maydell Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 23

[PULL 09/84] include/qemu/cpuid: Introduce xgetbv_low

2023-03-05 Thread Richard Henderson
Replace the two uses of asm to expand xgetbv with an inline function. Since one of the two has been using the mnemonic, assume that the comment about "older versions of the assember" is obsolete, as even that is 4 years old. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson

[PULL 73/84] target/hexagon/idef-parser: Use gen_constant for gen_extend_tcg_width_op

2023-03-05 Thread Richard Henderson
We already have a temporary, res, which we can use for the intermediate shift result. Simplify the constant to -1 instead of 0xf*f. This was the last use of gen_tmp_value, so remove it. Reviewed-by: Taylor Simpson Signed-off-by: Richard Henderson ---

[PULL 57/84] target/sparc: Remove egress label in disas_sparc_context

2023-03-05 Thread Richard Henderson
Reviewed-by: Peter Maydell Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a20426202e..560fb32e28 100644 ---

[PULL 80/84] target/xtensa: Tidy translate_clamps

2023-03-05 Thread Richard Henderson
All writes to arg[0].out; use tcg_constant_i32. Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index

[PULL 74/84] target/i386: Simplify POPF

2023-03-05 Thread Richard Henderson
Compute the eflags write mask separately, leaving one call to the helper. Use tcg_constant_i32. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 55 - 1 file changed, 11 insertions(+), 44 deletions(-)

[PULL 21/84] target/arm: Drop tcg_temp_free from translator-a64.c

2023-03-05 Thread Richard Henderson
Translators are no longer required to free tcg temporaries. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 468 + 1 file changed, 11 insertions(+), 457 deletions(-) diff --git a/target/arm/tcg/translate-a64.c

[PULL 64/84] target/mips: Fix trans_mult_acc return

2023-03-05 Thread Richard Henderson
Success from trans_* subroutines should be true. Fixes: 5fa38eedbd ("target/mips: Convert Vr54xx MACC* opcodes to decodetree") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/mips/tcg/vr54xx_translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

  1   2   3   >