[QEMU-devel][RFC PATCH 1/1] backends/hostmem: qapi/qom: Add an ObjectOption for memory-backend-* called HostMemType and its arg 'cxlram'

2023-12-31 Thread Ho-Ren (Jack) Chuang
Introduce a new configuration option 'host-mem-type=' in the '-object memory-backend-ram', allowing users to specify from which type of memory to allocate. Users can specify 'cxlram' as an argument, and QEMU will then automatically locate CXL RAM NUMA nodes and use them as the backend memory. For

Re: [PATCH for-8.2?] target/i386: Fix 32-bit wrapping of pc/eip computation

2023-12-31 Thread Richard Henderson
On 12/25/23 07:49, Michael Tokarev wrote: 12.12.2023 20:25, Richard Henderson: In 32-bit mode, pc = eip + cs_base is also 32-bit, and must wrap. Failure to do so results in incorrect memory exceptions to the guest. Before 732d548732ed, this was implicitly done via truncation to target_ulong but

Re: [PATCH] tcg/i386: use 8-bit OR or XOR for unsigned 8-bit immediates

2023-12-31 Thread Richard Henderson
On 12/28/23 23:05, Paolo Bonzini wrote: In the case where OR or XOR has an 8-bit immediate between 128 and 255, we can operate on a low-byte register and shorten the output by two or three bytes (two if a prefix byte is needed for REX.B). Signed-off-by: Paolo Bonzini ---

Re: [PATCH v2] tcg/i386: convert add/sub of 128 to sub/add of -128

2023-12-31 Thread Richard Henderson
On 12/28/23 23:05, Paolo Bonzini wrote: Extend the existing conditional that generates INC/DEC, to also swap an ADD for a SUB and vice versa when the immediate is 128. This facilitates using OPC_ARITH_EvIb instead of OPC_ARITH_EvIz. Best reviewed with "git diff -b". Signed-off-by: Paolo

[PATCH 4/5] migration: Implement 'qatzip' methods using QAT

2023-12-31 Thread Bryan Zhang
Uses QAT to offload deflate compression in the 'qatzip' compression method for multifd migration. Signed-off-by: Bryan Zhang Signed-off-by: Hao Xiang --- migration/multifd-qatzip.c | 314 +++-- 1 file changed, 301 insertions(+), 13 deletions(-) diff --git

[PATCH 2/5] migration: Add compression level parameter for QATzip

2023-12-31 Thread Bryan Zhang
Adds support for a parameter to specify QATzip compression level. This is a preparatory commit for a subsequent commit that will actually use QATzip compression. Signed-off-by: Bryan Zhang Signed-off-by: Hao Xiang --- migration/migration-hmp-cmds.c | 4 migration/options.c|

[PATCH 5/5] migration: Add integration test for 'qatzip' compression method

2023-12-31 Thread Bryan Zhang
Adds an integration test for 'qatzip'. Signed-off-by: Bryan Zhang Signed-off-by: Hao Xiang --- tests/qtest/meson.build | 4 tests/qtest/migration-test.c | 37 2 files changed, 41 insertions(+) diff --git a/tests/qtest/meson.build

[PATCH 3/5] migration: Introduce unimplemented 'qatzip' compression method

2023-12-31 Thread Bryan Zhang
Adds support for 'qatzip' as an option for the multifd compression method parameter, but copy-pastes the no-op logic to leave the actual methods effectively unimplemented. This is in preparation of a subsequent commit that will implement actually using QAT for compression and decompression.

[PATCH 1/5] meson: Introduce 'qatzip' feature to the build system.

2023-12-31 Thread Bryan Zhang
Add a 'qatzip' feature, which is automatically disabled, and which depends on the QATzip library if enabled. Signed-off-by: Bryan Zhang Signed-off-by: Hao Xiang --- meson.build | 10 ++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3

Re: [PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes

2023-12-31 Thread BALATON Zoltan
On Sun, 31 Dec 2023, Paolo Bonzini wrote: Do not go through the panning buffer unless the address wraps in the middle of the line. Signed-off-by: Paolo Bonzini --- hw/display/vga-helpers.h | 12 1 file changed, 12 insertions(+) diff --git a/hw/display/vga-helpers.h

Re: [PATCH 3/8] vga: mask addresses in non-VESA modes to 256k

2023-12-31 Thread BALATON Zoltan
On Sun, 31 Dec 2023, Paolo Bonzini wrote: This allows setting the start address to a high value, and reading the bottom of the screen from the beginning of VRAM. Commander Keen 4 ("Goodbye, Galaxy!") relies on this behavior. Signed-off-by: Paolo Bonzini --- hw/display/vga-helpers.h | 9

Re: [PATCH 1/8] vga: remove unused macros

2023-12-31 Thread BALATON Zoltan
On Sun, 31 Dec 2023, Paolo Bonzini wrote: Signed-off-by: Paolo Bonzini --- hw/display/vga.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/hw/display/vga.c b/hw/display/vga.c index 37557c3442a..18d966ecd3e 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -103,12 +103,6

Re: [PATCH v2 1/1] docs: pcie: describe PCIe option ROMs

2023-12-31 Thread Heinrich Schuchardt
On 8/14/22 17:32, Heinrich Schuchardt wrote: Provide a descriptions of the options that control the emulation of option ROMS for PCIe devices. Signed-off-by: Heinrich Schuchardt --- v2: correct description of rombar property use romfile= to suppress option ROM loading ---

[PATCH] vfio/migration: Add helper function to set state or reset device

2023-12-31 Thread Avihai Horon
There are several places where failure in setting the device state leads to a device reset, which is done by setting ERROR as the recover state. Add a helper function that sets the device state and resets the device in case of failure. This will make the code cleaner and remove duplicate

[PATCH 0/8] vga: improve emulation fidelity

2023-12-31 Thread Paolo Bonzini
This implements horizontal pel panning, which is used by games such as the Commander Keen series, and also reimplements word and odd/even modes so that they work in graphics modes; this mostly fixes Jazz Jackrabbit's graphics. There are still some issues with Cirrus VGA, and also Keen expects the

[PATCH 6/8] vga: reindent memory access code

2023-12-31 Thread Paolo Bonzini
The next patch will reuse latched memory access in text modes. Start with a patch that moves the latched access code out of the "if". Best reviewed with "git diff -b". Signed-off-by: Paolo Bonzini --- hw/display/vga.c | 211 --- 1 file changed, 110

[PATCH 4/8] vga: implement horizontal pel panning in graphics modes

2023-12-31 Thread Paolo Bonzini
This implements smooth scrolling, as used for example by Commander Keen and Second Reality. Unfortunately, this is not enough to avoid tearing in Commander Keen, because sometimes the wrong start address is used for a frame. On real EGA, the panning register is sampled on every line, while the

[PATCH 1/8] vga: remove unused macros

2023-12-31 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- hw/display/vga.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/hw/display/vga.c b/hw/display/vga.c index 37557c3442a..18d966ecd3e 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -103,12 +103,6 @@ const uint8_t gr_mask[16] = { #define

[PATCH 7/8] vga: use latches in odd/even mode too

2023-12-31 Thread Paolo Bonzini
Jazz Jackrabbit uses odd/even mode with 256-color graphics. This is probably so that it can do very fast blitting with a decent resolution (two pixels, compared to four pixels for "regular" mode X). Accesses still use all planes (reads go to the latches and the game uses read mode 1 so that the

[PATCH 2/8] vga: introduce VGADisplayParams

2023-12-31 Thread Paolo Bonzini
The next patches will introduce more parameters that cause a full refresh. Instead of adding arguments to get_offsets and lines to update_basic_params, do everything through a struct. Signed-off-by: Paolo Bonzini --- hw/display/cirrus_vga.c | 24 +--- hw/display/vga.c| 82

[PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes

2023-12-31 Thread Paolo Bonzini
Do not go through the panning buffer unless the address wraps in the middle of the line. Signed-off-by: Paolo Bonzini --- hw/display/vga-helpers.h | 12 1 file changed, 12 insertions(+) diff --git a/hw/display/vga-helpers.h b/hw/display/vga-helpers.h index 29933562c45..60ddb27d946

[PATCH 8/8] vga: sort-of implement word and double-word access modes

2023-12-31 Thread Paolo Bonzini
Jazz Jackrabbit has a very unusual VGA setup, where it uses odd/even mode with 256-color graphics. Probably, it wants to use fast VRAM-to-VRAM copies without having to store 4 copies of the sprites as needed in mode X, one for each mod-4 alignment; odd/even mode simplifies the code a lot if it's

[PATCH 3/8] vga: mask addresses in non-VESA modes to 256k

2023-12-31 Thread Paolo Bonzini
This allows setting the start address to a high value, and reading the bottom of the screen from the beginning of VRAM. Commander Keen 4 ("Goodbye, Galaxy!") relies on this behavior. Signed-off-by: Paolo Bonzini --- hw/display/vga-helpers.h | 9 + hw/display/vga.c | 3 +++ 2

[PATCH 00/11] migration: Misc cleanups and fixes

2023-12-31 Thread Avihai Horon
Hi, This series contains misc cleanups and fixes in migration code that I noticed while going over the code. Thanks. Avihai Horon (11): migration: Remove migrate_max_downtime() declaration migration: Remove nulling of hostname in migrate_init() migration: Refactor

[PATCH 03/11] migration: Refactor migration_incoming_setup()

2023-12-31 Thread Avihai Horon
Commit 6720c2b32725 ("migration: check magic value for deciding the mapping of channels") extracted the only code that could fail in migration_incoming_setup(). Now migration_incoming_setup() can't fail, so refactor it to return void and remove errp parameter. Signed-off-by: Avihai Horon ---

[PATCH 01/11] migration: Remove migrate_max_downtime() declaration

2023-12-31 Thread Avihai Horon
migrate_max_downtime() has been removed long ago, but its declaration was mistakenly left. Remove it. Signed-off-by: Avihai Horon --- migration/migration.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index cf2c9c88e0..b3c9288c38 100644 ---

[PATCH 09/11] migration: Fix migration_channel_read_peek() error path

2023-12-31 Thread Avihai Horon
migration_channel_read_peek() calls qio_channel_readv_full() and handles both cases of return value == 0 and return value < 0 the same way, by calling error_setg() with errp. However, if return value < 0, errp is already set, so calling error_setg() with errp will lead to an assert. Fix it by

[PATCH 02/11] migration: Remove nulling of hostname in migrate_init()

2023-12-31 Thread Avihai Horon
MigrationState->hostname is set to NULL in migrate_init(). This is redundant because it is already freed and set to NULL in migrade_fd_cleanup(). Remove it. Signed-off-by: Avihai Horon --- migration/migration.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/migration.c

[PATCH 07/11] migration/multifd: Fix leaking of Error in TLS error flow

2023-12-31 Thread Avihai Horon
If there is an error in multifd TLS handshake task, multifd_tls_outgoing_handshake() retrieves the error with qio_task_propagate_error() but never frees it. Fix it by freeing the obtained Error. In addition, the error is not reported at all, so report it with migrate_set_error(). Fixes:

[PATCH 05/11] migration/multifd: Fix error message in multifd_recv_initial_packet()

2023-12-31 Thread Avihai Horon
In multifd_recv_initial_packet(), if MultiFDInit_t->id is greater than the configured number of multifd channels, an irrelevant error message about multifd version is printed. Change the error message to a relevant one about the channel id. Signed-off-by: Avihai Horon --- migration/multifd.c |

[PATCH 11/11] migration/multifd: Remove unnecessary usage of local Error

2023-12-31 Thread Avihai Horon
According to Error API, usage of ERRP_GUARD() or a local Error instead of errp is needed if errp is passed to void functions, where it is later dereferenced to see if an error occurred. There are several places in multifd.c that use local Error although it is not needed. Change these places to

[PATCH 08/11] migration/multifd: Remove error_setg() in migration_ioc_process_incoming()

2023-12-31 Thread Avihai Horon
If multifd_load_setup() fails in migration_ioc_process_incoming(), error_setg() is called with errp. This will lead to an assert because in that case errp already contains an error. Fix it by removing the redundant error_setg(). Fixes: 6720c2b32725 ("migration: check magic value for deciding the

[PATCH 04/11] migration: Remove errp parameter in migration_fd_process_incoming()

2023-12-31 Thread Avihai Horon
Errp parameter in migration_fd_process_incoming() is unused. Remove it. Signed-off-by: Avihai Horon --- migration/migration.h | 2 +- migration/migration.c | 2 +- migration/rdma.c | 6 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/migration/migration.h

[PATCH 10/11] migration: Remove unnecessary usage of local Error

2023-12-31 Thread Avihai Horon
According to Error API, usage of ERRP_GUARD() or a local Error instead of errp is needed if errp is passed to void functions, where it is later dereferenced to see if an error occurred. There are several places in migration.c that use local Error although it is not needed. Change these places to

[PATCH 06/11] migration/multifd: Simplify multifd_channel_connect() if else statement

2023-12-31 Thread Avihai Horon
The else branch in multifd_channel_connect() is redundant because when the if branch is taken the function returns. Simplify the code by removing the else branch. Signed-off-by: Avihai Horon --- migration/multifd.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git

[PULL 32/46] meson: move program checks together

2023-12-31 Thread Paolo Bonzini
Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- meson.build | 107 +++- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/meson.build b/meson.build index c437e9f55e6..3a1f4cbb90f 100644 --- a/meson.build +++

[PULL 22/46] target/i386: implement CMPccXADD

2023-12-31 Thread Paolo Bonzini
The main difficulty here is that a page fault when writing to the destination must not overwrite the flags. Therefore, the flags computation must be inlined instead of using gen_jcc1*. For simplicity, I am using an unconditional cmpxchg operation, that becomes a NOP if the comparison fails.

[PULL 40/46] meson: remove OS definitions from config_targetos

2023-12-31 Thread Paolo Bonzini
CONFIG_DARWIN, CONFIG_LINUX and CONFIG_BSD are used in some rules, but only CONFIG_LINUX has substantial use. Convert them all to if...endif. Signed-off-by: Paolo Bonzini --- accel/tcg/meson.build | 4 +++- backends/meson.build | 4 +++- block/meson.build | 4 +++- fsdev/meson.build

[PULL 38/46] meson: move subdirs to "Collect sources" section

2023-12-31 Thread Paolo Bonzini
Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- meson.build | 66 ++--- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/meson.build b/meson.build index 151db21c038..21335055ef8 100644 --- a/meson.build +++

[PULL 33/46] meson: move option validation together

2023-12-31 Thread Paolo Bonzini
Check options before compiler flags, because some compiler flags are incompatible with modules. Signed-off-by: Paolo Bonzini --- meson.build | 137 ++-- 1 file changed, 68 insertions(+), 69 deletions(-) diff --git a/meson.build b/meson.build

[PULL 39/46] meson: always probe u2f and canokey if the option is enabled

2023-12-31 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 21335055ef8..7344e363826 100644 --- a/meson.build +++ b/meson.build @@ -1828,12 +1828,12 @@ if not get_option('smartcard').auto() or have_system

[PULL 31/46] meson: add more sections to main meson.build

2023-12-31 Thread Paolo Bonzini
Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- meson.build | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 6c77d9687de..c437e9f55e6 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,10 @@

[PULL 21/46] target/i386: introduce flags writeback mechanism

2023-12-31 Thread Paolo Bonzini
ALU instructions can write to both memory and flags. If the CC_SRC* and CC_DST locations have been written already when a memory access causes a fault, the value in CC_SRC* and CC_DST might be interpreted with the wrong CC_OP (the one that is in effect before the instruction. Besides just using

[PULL 26/46] meson: remove unused variable

2023-12-31 Thread Paolo Bonzini
Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- tests/bench/meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/bench/meson.build b/tests/bench/meson.build index 3c799dbd983..7e76338a52d 100644 --- a/tests/bench/meson.build +++

[PULL 43/46] meson: remove CONFIG_ALL

2023-12-31 Thread Paolo Bonzini
CONFIG_ALL is tricky to use and was ported over to Meson from the recursive processing of Makefile variables. Meson sourcesets however have all_sources() and all_dependencies() methods that remove the need for it. Signed-off-by: Paolo Bonzini --- docs/devel/build-system.rst | 15

[PULL 19/46] target/i386: move operand load and writeback out of gen_cmovcc1

2023-12-31 Thread Paolo Bonzini
Similar to gen_setcc1, make gen_cmovcc1 receive TCGv. This is more friendly to simultaneous implementation in the old and the new decoder. A small wart is that s->T0 of CMOV is currently the *second* argument (which would ordinarily be in T1). Therefore, the condition has to be inverted in

[PULL 44/46] meson: rename config_all

2023-12-31 Thread Paolo Bonzini
config_all now lists only accelerators, rename it to indicate its actual content. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- hw/mips/meson.build | 2 +- meson.build | 16 target/arm/meson.build | 2 +- target/mips/meson.build | 2

[PULL 35/46] meson: keep subprojects together

2023-12-31 Thread Paolo Bonzini
And move away dependencies that are not subprojects anymore. Signed-off-by: Paolo Bonzini --- meson.build | 72 ++--- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/meson.build b/meson.build index 1867e0428b1..efb36c762e9 100644

[PULL 37/46] meson: move config-host.h definitions together

2023-12-31 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- meson.build | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/meson.build b/meson.build index 5c54441a3cd..151db21c038 100644 --- a/meson.build +++ b/meson.build @@ -40,7 +40,6 @@ qemu_moddir = get_option('libdir')

[PULL 06/46] target/i386: clean up cpu_cc_compute_all

2023-12-31 Thread Paolo Bonzini
cpu_cc_compute_all() has an argument that is always equal to CC_OP for historical reasons (dating back to commit a7812ae4123, "TCG variable type checking.", 2008-11-17, which added the argument to helper_cc_compute_all). It does not make sense for the argument to have any other value, so

[PULL 28/46] Makefile: clean qemu-iotests output

2023-12-31 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- Makefile | 1 + configure | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 676a4a54f48..8f369903356 100644 --- a/Makefile +++ b/Makefile @@ -202,6 +202,7 @@ clean: recurse-clean ! -path

[PULL 36/46] meson: move CFI detection code with other compiler flags

2023-12-31 Thread Paolo Bonzini
Keep it together with the other compiler modes, and before dependencies. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- meson.build | 80 ++--- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/meson.build

[PULL 46/46] meson.build: report graphics backends separately

2023-12-31 Thread Paolo Bonzini
From: Alex Bennée To enable accelerated VirtIO GPUs for the guest we need the rendering support on the host, which currently it's reported in the configuration summary under the "dependencies" section. Add a graphics backend section and report the status of the VirGL and Rutabaga support

[PULL 23/46] target/i386: the sgx_epc_get_section stub is reachable

2023-12-31 Thread Paolo Bonzini
The sgx_epc_get_section stub is reachable from cpu_x86_cpuid. It should not assert, instead it should just return true just like the "real" sgx_epc_get_section does when SGX is disabled. Reported-by: Vladimír Beneš Cc: qemu-sta...@nongnu.org Signed-off-by: Paolo Bonzini Message-ID:

[PULL 30/46] configure: unify again the case arms in probe_target_compiler

2023-12-31 Thread Paolo Bonzini
Remove assignments that match the default, and group the targets for debian-legacy-test-cross and debian-all-test-cross into a single arm. Signed-off-by: Paolo Bonzini --- configure | 87 ++- 1 file changed, 28 insertions(+), 59 deletions(-)

[PULL 41/46] meson: remove CONFIG_POSIX and CONFIG_WIN32 from config_targetos

2023-12-31 Thread Paolo Bonzini
For consistency with other OSes, use if...endif for rules that are target-independent. Signed-off-by: Paolo Bonzini --- backends/meson.build | 6 -- block/meson.build| 7 +-- chardev/meson.build | 26 ++ hw/usb/meson.build | 4 +++- meson.build

[PULL 29/46] configure: remove unnecessary subshell

2023-12-31 Thread Paolo Bonzini
Do not use a subshell to hide the shadowing of $config_host_mak. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- configure | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 9885cfed792..ed2d220040d 100755 ---

[PULL 01/46] configure: use a native non-cross compiler for linux-user

2023-12-31 Thread Paolo Bonzini
Commit c2118e9e1ab ("configure: don't try a "native" cross for linux-user", 2023-11-23) sought to avoid issues with using the native compiler with a cross-endian or cross-bitness setup. However, in doing so it ended up requiring a cross compiler setup (and most likely a slow compiler setup) even

[PULL 16/46] target/i386: do not use s->tmp4 for push

2023-12-31 Thread Paolo Bonzini
Just create a temporary for the occasion. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index b79c312465b..afe0fa6c65f

[PULL 24/46] esp: check for NULL result from scsi_device_find()

2023-12-31 Thread Paolo Bonzini
From: Alexandra Diupina Add a 'current_lun' check for a null value to avoid null pointer dereferencing and recover host if NULL return Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 4eb8606560 (esp: store lun coming from the MESSAGE OUT phase) Signed-off-by: Alexandra

[PULL 27/46] meson: use version_compare() to compare version

2023-12-31 Thread Paolo Bonzini
While a simple lexicographic comparison usually works, it is less robust than a more specific algorithm designed to compare versions. Signed-off-by: Paolo Bonzini --- qga/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/meson.build b/qga/meson.build index

[PULL 03/46] target/i386: speedup JO/SETO after MUL or IMUL

2023-12-31 Thread Paolo Bonzini
OF is equal to the carry flag, so use the same CCPrepare. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 8fb80011a22..a16eb8d4008

[PULL 42/46] meson: remove config_targetos

2023-12-31 Thread Paolo Bonzini
config_targetos is now empty and can be removed; its use in sourcesets that do not involve target-specific files can be replaced with an empty dictionary. In fact, at this point *all* sourcesets that do not involve target-specific files are just glorified mutable arrays. Enforce that they never

[PULL 45/46] configure, meson: rename targetos to host_os

2023-12-31 Thread Paolo Bonzini
This variable is about the host OS, not the target. It is used a lot more since the Meson conversion, but the original sin dates back to 2003. Time to fix it. Signed-off-by: Paolo Bonzini --- accel/tcg/meson.build| 2 +- backends/meson.build | 4 +-

[PULL 25/46] meson: fix type of "relocatable" option

2023-12-31 Thread Paolo Bonzini
Since the option is of boolean type, the default value should be a boolean rather than a string. Signed-off-by: Paolo Bonzini --- meson_options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson_options.txt b/meson_options.txt index c9baeda6395..0a99a059ec8 100644 ---

[PULL 12/46] target/i386: do not decode string source/destination into decode->mem

2023-12-31 Thread Paolo Bonzini
decode->mem is only used if one operand has has_ea == true. String operations will not use decode->mem and will load A0 on their own, because they are the only case of two memory operands in a single instruction. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini ---

[PULL 17/46] target/i386: do not use s->tmp0 for jumps on ECX ==/!= 0

2023-12-31 Thread Paolo Bonzini
Create a new temporary, to ease the register allocator's work. Creation of the temporary is pushed into gen_ext_tl, which also allows NULL as the first parameter now. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 9 ++--- 1 file changed, 6

[PULL 34/46] meson: move accelerator dependency checks together

2023-12-31 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- meson.build | 175 +++- 1 file changed, 91 insertions(+), 84 deletions(-) diff --git a/meson.build b/meson.build index 2c6f09352c9..1867e0428b1 100644 --- a/meson.build +++ b/meson.build @@ -602,7 +602,10 @@ if

[PULL 04/46] target/i386: remove unnecessary arguments from raise_interrupt

2023-12-31 Thread Paolo Bonzini
is_int is always 1, and error_code is always zero. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/excp_helper.c | 7 +++ target/i386/tcg/helper-tcg.h | 3 +-- target/i386/tcg/misc_helper.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff

[PULL 14/46] target/i386: do not clobber T0 on string operations

2023-12-31 Thread Paolo Bonzini
The new decoder would rather have the operand in T0 when expanding SCAS, rather than use R_EAX directly as gen_scas currently does. This makes SCAS more similar to CMP and SUB, in that CC_DST = T0 - T1. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini ---

[PULL 20/46] target/i386: adjust decoding of J operand

2023-12-31 Thread Paolo Bonzini
gen_jcc() has been changed to accept a relative offset since the new decoder was written. Adjust the J operand, which is meant to be used with jump instructions such as gen_jcc(), to not include the program counter and to not truncate the result, as both operations are now performed by common

[PULL 11/46] target/i386: add X86_SPECIALs for MOVSX and MOVZX

2023-12-31 Thread Paolo Bonzini
Usually the registers are just moved into s->T0 without much care for their operand size. However, in some cases we can get more efficient code if the operand fetching logic syncs with the emission function on what is nicer. All the current uses are mostly demonstrative and only reduce the code

[PULL 18/46] target/i386: prepare for implementation of STOS/SCAS in new decoder

2023-12-31 Thread Paolo Bonzini
Do not use gen_op, and pull the load from the accumulator into disas_insn. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/translate.c

[PULL 02/46] target/i386: optimize computation of JL and JLE from flags

2023-12-31 Thread Paolo Bonzini
Take advantage of the fact that there can be no 1 bits between SF and OF. If they were adjacent, you could sum SF and get a carry only if SF was already set. Then the value of OF in the sum is the XOR of OF itself, the carry (which is SF) and 0 (the value of the OF bit in the addend): this is

[PULL 10/46] target/i386: rename zext0/zext2 and make them closer to the manual

2023-12-31 Thread Paolo Bonzini
X86_SPECIAL_ZExtOp0 and X86_SPECIAL_ZExtOp2 are poorly named; they are a hack that is needed by scalar insertion and extraction instructions, and not really related to zero extension: for PEXTR the zero extension is done by the generation functions, for PINSR the high bits are not used at all and

[PULL 15/46] target/i386: split eflags computation out of gen_compute_eflags

2023-12-31 Thread Paolo Bonzini
The new x86 decoder wants the gen_* functions to compute EFLAGS before writeback, which can be an issue for instructions with a memory destination such as ARPL or shifts. Extract code to compute the EFLAGS without clobbering CC_SRC, in case the memory write causes a fault. The flags writeback

[PULL 13/46] target/i386: do not clobber A0 in POP translation

2023-12-31 Thread Paolo Bonzini
The new decoder likes to compute the address in A0 very early, so the gen_lea_v_seg in gen_pop_T0 would clobber the address of the memory operand. Instead use T0 since it is already available and will be overwritten immediately after. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini

[PULL 00/46] (mostly) target/i386 and meson changes for 2023-12-31

2023-12-31 Thread Paolo Bonzini
The following changes since commit 191710c221f65b1542f6ea7fa4d30dde6e134fd7: Merge tag 'pull-request-2023-12-20' of https://gitlab.com/thuth/qemu into staging (2023-12-20 09:40:16 -0500) are available in the Git repository at: https://gitlab.com/bonzini/qemu.git tags/for-upstream for you

[PULL 09/46] target/i386: avoid trunc and ext for MULX and RORX

2023-12-31 Thread Paolo Bonzini
Use _tl operations for 32-bit operands on 32-bit targets, and only go through trunc and extu ops for 64-bit targets. While the trunc/ext ops should be pretty much free after optimization, the optimizer also does not like having the same temporary used in multiple EBBs. Therefore it is nicer to

[PULL 08/46] target/i386: reimplement check for validity of LOCK prefix

2023-12-31 Thread Paolo Bonzini
The previous check erroneously allowed CMP to be modified with LOCK. Instead, tag explicitly the instructions that do support LOCK. Acked-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 17 ++--- target/i386/tcg/decode-new.h | 3 +++

[PULL 07/46] target/i386: document more deviations from the manual

2023-12-31 Thread Paolo Bonzini
Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 12 1 file changed, 12 insertions(+) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc index 2bdbb1bba0f..232c6a45c96 100644 ---

[PULL 05/46] target/i386: remove unnecessary truncations

2023-12-31 Thread Paolo Bonzini
gen_lea_v_seg (called by gen_add_A0_ds_seg) already zeroes any bits of s->A0 beyond s->aflag. It does so before summing the segment base and, if not in 64-bit mode, also after summing it. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/emit.c.inc | 4 +---