Re: [PATCH 49/51] io/channel-watch: Fix socket watch on Windows

2022-09-06 Thread Bin Meng
Hi Clément, On Mon, Sep 5, 2022 at 4:10 PM Clément Chigot wrote: > > Hi all, > > I did reach the same issue while trying to connect a gdb to qemu on > Windows hosts. Some inputs send by gdb aren't getting correctly pulled, > they will be retrieved only once g_poll times out. > > As you explained

Re: [PATCH V3 3/3] hw/riscv: virt: Enable booting S-mode firmware from pflash

2022-09-06 Thread Andrew Jones
On Tue, Sep 06, 2022 at 09:54:51AM +0530, Sunil V L wrote: > To boot S-mode firmware payload like EDK2 from persistent > flash storage, qemu needs to pass the flash address as the > next_addr in fw_dynamic_info to the opensbi. > > When both -kernel and -pflash options are provided in command line,

Re: [PATCH V3 2/3] hw/riscv: virt: Move create_fw_cfg() prior to loading kernel

2022-09-06 Thread Andrew Jones
On Tue, Sep 06, 2022 at 09:54:50AM +0530, Sunil V L wrote: > To enable both -kernel and -pflash options, the fw_cfg needs to be > created prior to loading the kernel. > > Signed-off-by: Sunil V L > --- > hw/riscv/virt.c | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) > >

Re: [PATCH V3 1/3] hw/arm,loongarch: Move load_image_to_fw_cfg() to common location

2022-09-06 Thread Andrew Jones
On Tue, Sep 06, 2022 at 09:54:49AM +0530, Sunil V L wrote: > load_image_to_fw_cfg() is duplicated by both arm and loongarch. The same > function will be required by riscv too. So, it's time to refactor and > move this function to a common path. > > Signed-off-by: Sunil V L > --- > hw/arm/boot.c

[PATCH v3 1/5] virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size

2022-09-06 Thread Daniil Tatianin
This is the first step towards moving all device config size calculation logic into the virtio core code. In particular, this adds a struct that contains all the necessary information for common virtio code to be able to calculate the final config size for a device. This is expected to be used with

[PATCH v3 5/5] vhost-user-blk: dynamically resize config space based on features

2022-09-06 Thread Daniil Tatianin
Make vhost-user-blk backwards compatible when migrating from older VMs running with modern features turned off, the same way it was done for virtio-blk in 20764be0421c ("virtio-blk: set config size depending on the features enabled") It's currently impossible to migrate from an older VM with vhos

[PATCH v3 2/5] virtio-blk: move config size params to virtio-blk-common

2022-09-06 Thread Daniil Tatianin
This way we can reuse it for other virtio-blk devices, e.g vhost-user-blk, which currently does not control its config space size dynamically. Signed-off-by: Daniil Tatianin Reviewed-by: Raphael Norwitz --- MAINTAINERS | 2 ++ hw/block/meson.build |

[PATCH v3 4/5] vhost-user-blk: make 'config_wce' part of 'host_features'

2022-09-06 Thread Daniil Tatianin
No reason to have this be a separate field. This also makes it more akin to what the virtio-blk device does. Signed-off-by: Daniil Tatianin Reviewed-by: Raphael Norwitz --- hw/block/vhost-user-blk.c | 6 ++ include/hw/virtio/vhost-user-blk.h | 1 - 2 files changed, 2 insertions(+),

[PATCH v3 3/5] vhost-user-blk: make it possible to disable write-zeroes/discard

2022-09-06 Thread Daniil Tatianin
It is useful to have the ability to disable these features for compatibility with older VMs that don't have these implemented. Signed-off-by: Daniil Tatianin Reviewed-by: Raphael Norwitz --- hw/block/vhost-user-blk.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/b

Re: [RFC PATCH] hw/acpi: do not let OSPM set pcie native hotplug when acpi hotplug is enabled

2022-09-06 Thread Igor Mammedov
On Mon, 5 Sep 2022 22:25:25 +0530 (IST) Ani Sinha wrote: > On Mon, 5 Sep 2022, Ani Sinha wrote: > > > > > > > > > > > > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > > > > index 0355bd3dda..3dc9379f27 100644 > > > > --- a/hw/i386/acpi-build.c > > > > +++ b/hw/i386/acpi-build.

[PATCH v3 0/5] vhost-user-blk: dynamically resize config space based on features

2022-09-06 Thread Daniil Tatianin
This patch set attempts to align vhost-user-blk with virtio-blk in terms of backward compatibility and flexibility. It also improves the virtio core by introducing new common code that can be used by a virtio device to calculate its config space size. In particular it adds the following things: -

Re: [PATCH v3 0/5] linux-user: Passthrough MADV_DONTNEED for certain file mappings

2022-09-06 Thread Richard Henderson
On 9/6/22 01:08, Ilya Leoshkevich wrote: Hi, This series is made of patches from [1]. I've added a test and noticed that madvise(MADV_DONTNEED) was broken on alpha, fixing which required adding per-arch MADV_* definitions. This in turn affected the strace patch, so it made sense to make a series

Re: [RFC PATCH] hw/acpi: do not let OSPM set pcie native hotplug when acpi hotplug is enabled

2022-09-06 Thread Ani Sinha
On Tue, 6 Sep 2022, Igor Mammedov wrote: > On Mon, 5 Sep 2022 22:25:25 +0530 (IST) > Ani Sinha wrote: > > > On Mon, 5 Sep 2022, Ani Sinha wrote: > > > > > > > > > > > > > > > > > > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > > > > > index 0355bd3dda..3dc9379f27 100644 > > >

Re: [PATCH 49/51] io/channel-watch: Fix socket watch on Windows

2022-09-06 Thread Clément Chigot
Hi Bin, > On Mon, Sep 5, 2022 at 4:10 PM Clément Chigot wrote: > > > > Hi all, > > > > I did reach the same issue while trying to connect a gdb to qemu on > > Windows hosts. Some inputs send by gdb aren't getting correctly pulled, > > they will be retrieved only once g_poll times out. > > > > As

Re: [PATCH v2 0/7] Allow semihosting from user mode

2022-09-06 Thread Richard Henderson
On 8/22/22 15:12, Peter Maydell wrote: Currently our semihosting implementations usually prohibit use of semihosting calls in system emulation from the guest userspace. This is a very long standing behaviour justified originally "to provide some semblance of security" (since code with access to

Re: [PATCH v3 6/6] include/exec: Introduce TARGET_PAGE_ENTRY_EXTRA

2022-09-06 Thread Richard Henderson
On 9/5/22 22:28, Philippe Mathieu-Daudé wrote: +    /* + * Allow target-specific additions to this structure. + * This may be used to cache items from the guest cpu + * page tables for later use by the implementation. + */ +#ifdef TARGET_PAGE_ENTRY_EXTRA +    TARGET_PAGE_ENTRY_EXT

Re: sphinx-build is really slow, any way to improve that?

2022-09-06 Thread Daniel P . Berrangé
On Mon, Sep 05, 2022 at 10:21:55PM +0100, Peter Maydell wrote: > On Mon, 5 Sept 2022 at 20:51, Claudio Fontana wrote: > > when I build qemu, there is a lot of time spent at the end of the build > > where one cpu goes 100% on sphinx-build. > > > > Is there some way to parallelize that? It seems it

Re: [PATCH v1 3/8] migration: Introduce dirty-limit capability

2022-09-06 Thread Markus Armbruster
Hyman Huang writes: > 在 2022/9/5 17:32, Markus Armbruster 写道: >> Hyman Huang writes: >> >>> 在 2022/9/2 16:07, Markus Armbruster 写道: huang...@chinatelecom.cn writes: > From: Hyman Huang(黄勇) > > Introduce migration dirty-limit capability, which can > be turned on before

Re: [PATCH 49/51] io/channel-watch: Fix socket watch on Windows

2022-09-06 Thread Bin Meng
Hi Clément, On Tue, Sep 6, 2022 at 3:41 PM Clément Chigot wrote: > > Hi Bin, > > > On Mon, Sep 5, 2022 at 4:10 PM Clément Chigot wrote: > > > > > > Hi all, > > > > > > I did reach the same issue while trying to connect a gdb to qemu on > > > Windows hosts. Some inputs send by gdb aren't getting

Re: sphinx-build is really slow, any way to improve that?

2022-09-06 Thread Markus Armbruster
Peter Maydell writes: > On Mon, 5 Sept 2022 at 20:51, Claudio Fontana wrote: >> when I build qemu, there is a lot of time spent at the end of the build >> where one cpu goes 100% on sphinx-build. >> >> Is there some way to parallelize that? It seems it is the current bottleneck >> for rebuilds

Re: [PATCH v2 00/11] Introduce new acpi/smbios python tests using biosbits

2022-09-06 Thread Michael S. Tsirkin
On Tue, Sep 06, 2022 at 11:56:33AM +0530, Ani Sinha wrote: > On Thu, Jul 14, 2022 at 6:54 PM Peter Maydell > wrote: > > > > On Mon, 11 Jul 2022 at 10:34, Michael S. Tsirkin wrote: > > > > > > On Sun, Jul 10, 2022 at 10:30:03PM +0530, Ani Sinha wrote: > > > > Changelog: > > > > v2: > > > > - a n

Re: [PATCH v9 03/10] s390x/cpu topology: reporting the CPU topology to the guest

2022-09-06 Thread Nico Boehr
Quoting Pierre Morel (2022-09-02 09:55:24) > The guest can use the STSI instruction to get a buffer filled > with the CPU topology description. > > Let us implement the STSI instruction for the basis CPU topology > level, level 2. I like this. It is so much simpler. Thanks. [...] > diff --git a/

Re: [RFC] module: removed unused function argument "mayfail"

2022-09-06 Thread Claudio Fontana
On 9/5/22 22:55, Philippe Mathieu-Daudé wrote: > On 5/9/22 17:55, Claudio Fontana wrote: >> mayfail is always passed as false for every invocation throughout the >> program. >> It controls whether to printf or not to printf an error on >> g_module_open failure. >> >> Remove this unused argument. >

[PULL v3 08/20] accel/tcg: Properly implement get_page_addr_code for user-only

2022-09-06 Thread Richard Henderson
The current implementation is a no-op, simply returning addr. This is incorrect, because we ought to be checking the page permissions for execution. Make get_page_addr_code inline for both implementations. Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Acked-by: Alistair Francis Signed

[PULL v3 00/20] tcg patch queue

2022-09-06 Thread Richard Henderson
5 18:01:02 -0400) are available in the Git repository at: https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20220906 for you to fetch changes up to 00c07344fa245b22e895b363320ba4cd0ec1088a: target/riscv: Make translator stop before the end of a page (2022-09-06 08:0

[PULL v3 03/20] linux-user/x86_64: Allocate vsyscall page as a commpage

2022-09-06 Thread Richard Henderson
We're about to start validating PAGE_EXEC, which means that we've got to mark the vsyscall page executable. We had been special casing this entirely within translate. Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- linux-user/elfload.c | 23

Re: [PATCH v9 06/10] s390x/cpu_topology: resetting the Topology-Change-Report

2022-09-06 Thread Nico Boehr
Quoting Pierre Morel (2022-09-02 09:55:27) > During a subsystem reset the Topology-Change-Report is cleared > by the machine. > Let's ask KVM to clear the Modified Topology Change Report (MTCR) > bit of the SCA in the case of a subsystem reset. > > Signed-off-by: Pierre Morel Reviewed-by: Nico

[PULL v3 02/20] linux-user/hppa: Allocate page zero as a commpage

2022-09-06 Thread Richard Henderson
We're about to start validating PAGE_EXEC, which means that we've got to mark page zero executable. We had been special casing this entirely within translate. Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- linux-user/elfload.c | 34

[PULL v3 01/20] linux-user/arm: Mark the commpage executable

2022-09-06 Thread Richard Henderson
We're about to start validating PAGE_EXEC, which means that we've got to mark the commpage executable. We had been placing the commpage outside of reserved_va, which was incorrect and lead to an abort. Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson ---

[PULL v3 09/20] accel/tcg: Unlock mmap_lock after longjmp

2022-09-06 Thread Richard Henderson
The mmap_lock is held around tb_gen_code. While the comment is correct that the lock is dropped when tb_gen_code runs out of memory, the lock is *not* dropped when an exception is raised reading code for translation. Acked-by: Alistair Francis Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkev

[PULL v3 07/20] accel/tcg: Introduce is_same_page()

2022-09-06 Thread Richard Henderson
From: Ilya Leoshkevich Introduce a function that checks whether a given address is on the same page as where disassembly started. Having it improves readability of the following patches. Reviewed-by: Alistair Francis Signed-off-by: Ilya Leoshkevich Message-Id: <20220811095534.241224-3-...@linu

[PULL v3 04/20] linux-user: Honor PT_GNU_STACK

2022-09-06 Thread Richard Henderson
Map the stack executable if required by default or on demand. Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- include/elf.h| 1 + linux-user/qemu.h| 1 + linux-user/elfload.c | 19 ++- 3 files changed, 20 insertions(+),

[PULL v3 11/20] accel/tcg: Move qemu_ram_addr_from_host_nofail to physmem.c

2022-09-06 Thread Richard Henderson
The base qemu_ram_addr_from_host function is already in softmmu/physmem.c; move the nofail version to be adjacent. Reviewed-by: Alistair Francis Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- include/exec/cpu-common.h | 1 + accel/tcg/cputlb.c

[PULL v3 05/20] linux-user: Clear translations on mprotect()

2022-09-06 Thread Richard Henderson
From: Ilya Leoshkevich Currently it's possible to execute pages that do not have PAGE_EXEC if there is an existing translation block. Fix by invalidating TBs that touch the affected pages. Signed-off-by: Ilya Leoshkevich Message-Id: <20220817150506.592862-2-...@linux.ibm.com> Signed-off-by: Ric

[PULL v3 10/20] accel/tcg: Make tb_htable_lookup static

2022-09-06 Thread Richard Henderson
The function is not used outside of cpu-exec.c. Move it and its subroutines up in the file, before the first use. Reviewed-by: Alistair Francis Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 3 - accel/tcg/cpu-exec.c

[PULL v3 13/20] accel/tcg: Document the faulting lookup in tb_lookup_cmp

2022-09-06 Thread Richard Henderson
It was non-obvious to me why we can raise an exception in the middle of a comparison function, but it works. While nearby, use TARGET_PAGE_ALIGN instead of open-coding. Acked-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 11 ++- 1 file changed, 10 inse

[PULL v3 18/20] target/i386: Make translator stop before the end of a page

2022-09-06 Thread Richard Henderson
From: Ilya Leoshkevich Right now translator stops right *after* the end of a page, which breaks reporting of fault locations when the last instruction of a multi-insn translation block crosses a page boundary. An implementation, like the one arm and s390x have, would require an i386 length disas

[PULL v3 16/20] accel/tcg: Add fast path for translator_ld*

2022-09-06 Thread Richard Henderson
Cache the translation from guest to host address, so we may use direct loads when we hit on the primary translation page. Look up the second translation page only once, during translation. This obviates another lookup of the second page within tb_gen_code after translation. Fixes a bug in that pl

[PULL v3 06/20] tests/tcg/i386: Move smc_code2 to an executable section

2022-09-06 Thread Richard Henderson
We're about to start validating PAGE_EXEC, which means that we've got to put this code into a section that is both writable and executable. Note that this test did not run on hardware beforehand either. Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson ---

[PULL v3 19/20] target/riscv: Add MAX_INSN_LEN and insn_len

2022-09-06 Thread Richard Henderson
These will be useful in properly ending the TB. Reviewed-by: Alistair Francis Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/riscv/translate.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/riscv/transla

[PULL v3 15/20] accel/tcg: Add pc and host_pc params to gen_intermediate_code

2022-09-06 Thread Richard Henderson
Pass these along to translator_loop -- pc may be used instead of tb->pc, and host_pc is currently unused. Adjust all targets at one time. Acked-by: Alistair Francis Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 1

[PULL v3 14/20] accel/tcg: Remove translator_ldsw

2022-09-06 Thread Richard Henderson
The only user can easily use translator_lduw and adjust the type to signed during the return. Reviewed-by: Alistair Francis Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- include/exec/translator.h | 1 - target/i386/tcg/translate.c | 2 +- 2 file

[PULL v3 12/20] accel/tcg: Use probe_access_internal for softmmu get_page_addr_code_hostp

2022-09-06 Thread Richard Henderson
Simplify the implementation of get_page_addr_code_hostp by reusing the existing probe_access infrastructure. Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 76 -- 1 file changed, 26 in

[PULL v3 20/20] target/riscv: Make translator stop before the end of a page

2022-09-06 Thread Richard Henderson
Right now the translator stops right *after* the end of a page, which breaks reporting of fault locations when the last instruction of a multi-insn translation block crosses a page boundary. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1155 Reviewed-by: Alistair Francis Acked-by: Ilya

[PATCH 04/11] crypto: validate that LUKS payload doesn't overlap with header

2022-09-06 Thread Daniel P . Berrangé
We already validate that LUKS keyslots don't overlap with the header, or with each other. This closes the remain hole in validation of LUKS file regions. Signed-off-by: Daniel P. Berrangé --- crypto/block-luks.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/crypto/block-luks.c b/cry

[PULL v3 17/20] target/s390x: Make translator stop before the end of a page

2022-09-06 Thread Richard Henderson
From: Ilya Leoshkevich Right now translator stops right *after* the end of a page, which breaks reporting of fault locations when the last instruction of a multi-insn translation block crosses a page boundary. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Message-Id: <20220817

[PATCH 11/11] crypto: add test cases for many malformed LUKS header scenarios

2022-09-06 Thread Daniel P . Berrangé
Validate that we diagnose each malformed LUKS header scenario with a distinct error report. Signed-off-by: Daniel P. Berrangé --- tests/unit/test-crypto-block.c | 299 + 1 file changed, 299 insertions(+) diff --git a/tests/unit/test-crypto-block.c b/tests/unit/te

[PATCH 08/11] crypto: split off helpers for converting LUKS header endianess

2022-09-06 Thread Daniel P . Berrangé
The unit test suite is shortly going to want to convert header endianness separately from the main I/O functions. Signed-off-by: Daniel P. Berrangé --- crypto/block-luks-priv.h | 6 +++ crypto/block-luks.c | 79 2 files changed, 53 insertions(+), 32

[PATCH 00/11] crypto: improve robustness of LUKS metadata validation

2022-09-06 Thread Daniel P . Berrangé
Richard pointed out that we didn't do all that much validation against bad parameters in the LUKS header metadata. This series adds a bunch more validation checks along with unit tests to demonstrate they are having effect against maliciously crafted headers. Daniel P. Berrangé (11): crypto: san

[PATCH 02/11] crypto: enforce that LUKS stripes is always a fixed value

2022-09-06 Thread Daniel P . Berrangé
Although the LUKS stripes are encoded in the keyslot header and so potentially configurable, in pratice the cryptsetup impl mandates this has the fixed value 4000. To avoid incompatibility apply the same enforcement in QEMU too. This also caps the memory usage for key material when QEMU tries to op

[PATCH 09/11] crypto: quote algorithm names in error messages

2022-09-06 Thread Daniel P . Berrangé
If given a malformed LUKS header, it is possible that the algorithm names end up being an empty string. This leads to confusing error messages unless quoting is used to highlight where the empty string is subsituted in the error message. Signed-off-by: Daniel P. Berrangé --- crypto/block-luks.c

[PATCH 05/11] crypto: strengthen the check for key slots overlapping with LUKS header

2022-09-06 Thread Daniel P . Berrangé
The LUKS header data on disk is a fixed size, however, there's expected to be a gap between the end of the header and the first key slot to get alignment with the 2nd sector on 4k drives. This wasn't originally part of the LUKS spec, but was always part of the reference implementation, so it is wor

Re: [PATCH v9 04/10] hw/core: introducing drawer and books for s390x

2022-09-06 Thread Markus Armbruster
Pierre Morel writes: > S390x defines two topology levels above sockets: nbooks and drawers. nbooks or books? > Let's add these two levels inside the CPU topology implementation. > > Signed-off-by: Pierre Morel > --- [...] > diff --git a/qapi/machine.json b/qapi/machine.json > index 6afd1936b

[PATCH 06/11] crypto: check that LUKS PBKDF2 iterations count is non-zero

2022-09-06 Thread Daniel P . Berrangé
Both the master key and key slot passphrases are run through the PBKDF2 algorithm. The iterations count is expected to be generally very large (many 10's or 100's of 1000s). It is hard to define a low level cutoff, but we can certainly say that iterations count should be non-zero. A zero count like

[PATCH 03/11] crypto: enforce that key material doesn't overlap with LUKS header

2022-09-06 Thread Daniel P . Berrangé
We already check that key material doesn't overlap between key slots, and that it doesn't overlap with the payload. We didn't check for overlap with the LUKS header. Signed-off-by: Daniel P. Berrangé --- crypto/block-luks.c | 8 1 file changed, 8 insertions(+) diff --git a/crypto/block

[PATCH V4 1/3] hw/arm, loongarch: Move load_image_to_fw_cfg() to common location

2022-09-06 Thread Sunil V L
load_image_to_fw_cfg() is duplicated by both arm and loongarch. The same function will be required by riscv too. So, it's time to refactor and move this function to a common path. Signed-off-by: Sunil V L Reviewed-by: Andrew Jones --- hw/arm/boot.c | 49 -

[PATCH 10/11] crypto: ensure LUKS tests run with GNUTLS crypto provider

2022-09-06 Thread Daniel P . Berrangé
GNUTLS is supported as a crypto provider since commit cc4c7c738297958b3d1d16269f57d71d22f5a9ff Author: Daniel P. Berrangé Date: Wed Jun 30 17:20:02 2021 +0100 crypto: introduce build system for gnutls crypto backend So enable the LUKS tests in this config. Signed-off-by: Daniel P.

[PATCH V4 3/3] hw/riscv: virt: Enable booting S-mode firmware from pflash

2022-09-06 Thread Sunil V L
To boot S-mode firmware payload like EDK2 from persistent flash storage, qemu needs to pass the flash address as the next_addr in fw_dynamic_info to the opensbi. When both -kernel and -pflash options are provided in command line, the kernel (and initrd if -initrd) will be copied to fw_cfg table. T

[PATCH 07/11] crypto: split LUKS header definitions off into file

2022-09-06 Thread Daniel P . Berrangé
This will allow unit testing code to use the structs. Signed-off-by: Daniel P. Berrangé --- crypto/block-luks-priv.h | 137 +++ crypto/block-luks.c | 94 +-- 2 files changed, 138 insertions(+), 93 deletions(-) create mode 100644

[PATCH V4 2/3] hw/riscv: virt: Move create_fw_cfg() prior to loading kernel

2022-09-06 Thread Sunil V L
To enable both -kernel and -pflash options, the fw_cfg needs to be created prior to loading the kernel. Signed-off-by: Sunil V L Reviewed-by: Andrew Jones --- hw/riscv/virt.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c ind

[PATCH 01/11] crypto: sanity check that LUKS header strings are NUL-terminated

2022-09-06 Thread Daniel P . Berrangé
The LUKS spec requires that header strings are NUL-terminated, and our code relies on that. Protect against maliciously crafted headers by adding validation. Signed-off-by: Daniel P. Berrangé --- crypto/block-luks.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/crypto/b

[PATCH v4 0/7] tcg: pc-relative translation blocks

2022-09-06 Thread Richard Henderson
The goal here is to reduce the amount of code generation when the guest kernel enables address space randomization. This requires extensive changes to each target, so opt-in with TARGET_TB_PCREL. This is split out of v3, which also contained target/arm changes, as I now have patches for x86 and s

[PATCH v4 2/7] accel/tcg: Use DisasContextBase in plugin_gen_tb_start

2022-09-06 Thread Richard Henderson
Use the pc coming from db->pc_first rather than the TB. Use the cached host_addr rather than re-computing for the first page. We still need a separate lookup for the second page because it won't be computed for DisasContextBase until the translator actually performs a read from the page. Signed-

[PATCH v4 1/7] accel/tcg: Use bool for page_find_alloc

2022-09-06 Thread Richard Henderson
Bool is more appropriate type for the alloc parameter. Signed-off-by: Richard Henderson --- accel/tcg/translate-all.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index f5e8592d4a..d2946f8e59 100644 --- a

Re: [PATCH 02/11] crypto: enforce that LUKS stripes is always a fixed value

2022-09-06 Thread Richard W.M. Jones
On Tue, Sep 06, 2022 at 09:41:38AM +0100, Daniel P. Berrangé wrote: > Although the LUKS stripes are encoded in the keyslot header and so > potentially configurable, in pratice the cryptsetup impl mandates > this has the fixed value 4000. To avoid incompatibility apply the > same enforcement in QEMU

Re: [PATCH 06/11] crypto: check that LUKS PBKDF2 iterations count is non-zero

2022-09-06 Thread Richard W.M. Jones
On Tue, Sep 06, 2022 at 09:41:42AM +0100, Daniel P. Berrangé wrote: > Both the master key and key slot passphrases are run through the PBKDF2 > algorithm. The iterations count is expected to be generally very large > (many 10's or 100's of 1000s). It is hard to define a low level cutoff, > but we c

[PATCH v4 4/7] include/hw/core: Create struct CPUJumpCache

2022-09-06 Thread Richard Henderson
Wrap the bare TranslationBlock pointer into a structure. Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 8 ++-- accel/tcg/cpu-exec.c | 9 ++--- accel/tcg/cputlb.c| 2 +- accel/tcg/translate-all.c | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-)

[PATCH V4 0/3] hw/riscv: virt: Enable booting S-mode firmware from pflash

2022-09-06 Thread Sunil V L
This series adds the support to boot S-mode FW like EDK2 from the flash. The S-mode firmware should be kept in pflash unit 1. When -kernel (and -initrd) option is also provided along with the flash, the kernel (and initrd) will be loaded into fw_cfg table and opensbi will branch to the flash addre

[PATCH v4 3/7] accel/tcg: Do not align tb->page_addr[0]

2022-09-06 Thread Richard Henderson
Let tb->page_addr[0] contain the offset within the page of the start of the translation block. We need to recover this value anyway at various points, and it is easier to discard the page offset when it's not needed, which happens naturally via the existing find_page shift. Signed-off-by: Richard

[PATCH v4 6/7] accel/tcg: Introduce TARGET_TB_PCREL

2022-09-06 Thread Richard Henderson
Prepare for targets to be able to produce TBs that can run in more than one virtual context. Signed-off-by: Richard Henderson --- include/exec/cpu-defs.h | 3 +++ include/exec/exec-all.h | 41 ++--- include/hw/core/cpu.h | 1 + accel/tcg/cpu-exec.c | 55 +++

[PATCH v4 5/7] accel/tcg: Introduce tb_pc and tb_pc_log

2022-09-06 Thread Richard Henderson
The availability of tb->pc will shortly be conditional. Introduce accessor functions to minimize ifdefs. Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 12 ++ accel/tcg/cpu-exec.c| 20 - accel/tcg/translate-all.c

[PATCH v4 7/7] accel/tcg: Split log_cpu_exec into inline and slow path

2022-09-06 Thread Richard Henderson
Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 7fe42269ea..ac8eec7f54 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -292,12 +292,1

Re: [PATCH 00/11] crypto: improve robustness of LUKS metadata validation

2022-09-06 Thread Richard W.M. Jones
On Tue, Sep 06, 2022 at 09:41:36AM +0100, Daniel P. Berrangé wrote: > Richard pointed out that we didn't do all that much validation against > bad parameters in the LUKS header metadata. This series adds a bunch > more validation checks along with unit tests to demonstrate they are > having effect

[PATCH v4 7/9] target/arm: Introduce gen_pc_plus_diff for aarch64

2022-09-06 Thread Richard Henderson
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 41 +++--- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a

Re: [PATCH 04/11] crypto: validate that LUKS payload doesn't overlap with header

2022-09-06 Thread Richard W.M. Jones
On Tue, Sep 06, 2022 at 09:41:40AM +0100, Daniel P. Berrangé wrote: > We already validate that LUKS keyslots don't overlap with the > header, or with each other. This closes the remain hole in remain -> remaining > validation of LUKS file regions. > > Signed-off-by: Daniel P. Berrangé > --- >

Re: [PATCH v4 0/7] tcg: pc-relative translation blocks

2022-09-06 Thread Richard Henderson
On 9/6/22 10:11, Richard Henderson wrote: The goal here is to reduce the amount of code generation when the guest kernel enables address space randomization. This requires extensive changes to each target, so opt-in with TARGET_TB_PCREL. This is split out of v3, which also contained target/arm

[PATCH v4 6/9] target/arm: Change gen_jmp* to work on displacements

2022-09-06 Thread Richard Henderson
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson --- target/arm/translate.c | 35 --- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 63a4

Re: [PATCH 01/11] crypto: sanity check that LUKS header strings are NUL-terminated

2022-09-06 Thread Richard W.M. Jones
On Tue, Sep 06, 2022 at 09:41:37AM +0100, Daniel P. Berrangé wrote: > The LUKS spec requires that header strings are NUL-terminated, and our > code relies on that. Protect against maliciously crafted headers by > adding validation. > > Signed-off-by: Daniel P. Berrangé > --- > crypto/block-luks.

Re: [PATCH v4 0/7] tcg: pc-relative translation blocks

2022-09-06 Thread Richard Henderson
On 9/6/22 10:28, Richard Henderson wrote: On 9/6/22 10:11, Richard Henderson wrote: The goal here is to reduce the amount of code generation when the guest kernel enables address space randomization.  This requires extensive changes to each target, so opt-in with TARGET_TB_PCREL. This is split

[PATCH v4 2/9] target/arm: Change gen_goto_tb to work on displacements

2022-09-06 Thread Richard Henderson
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 40 -- target/arm/translate.c | 10 ++ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/target

[PATCH v2 01/23] target/i386: Remove pc_start

2022-09-06 Thread Richard Henderson
The DisasContext member and the disas_insn local variable of the same name are identical to DisasContextBase.pc_next. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 114 +++- 1 file changed, 60 insertions(+), 54 deletions(-) diff --git a/targe

Re: [PATCH] accel: print an error message and exit if plugin not loaded

2022-09-06 Thread Gerd Hoffmann
> In any case, the only thing that "mayfail" seems to control, is in > module_load_file, and is a single printf: > > g_module = g_module_open(fname, flags); > if (!g_module) { > if (!mayfail) { > fprintf(stderr, "Failed to open module: %s\n", > g_mo

[PATCH v4 9/9] target/arm: Enable TARGET_TB_PCREL

2022-09-06 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/arm/cpu-param.h | 2 ++ target/arm/translate.h | 6 target/arm/cpu.c | 23 +++--- target/arm/translate-a64.c | 37 ++- target/arm/translate.c | 62 ++ 5 files c

[PATCH v2 05/23] target/i386: Create gen_update_eip_cur

2022-09-06 Thread Richard Henderson
Like gen_update_cc_op, sync EIP before doing something that could raise an exception. Replace all gen_jmp_im that use s->base.pc_next. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 52 - 1 file changed, 28 insertions(+), 24 deletions(-)

[PATCH v4 5/9] target/arm: Change gen_exception_internal to work on displacements

2022-09-06 Thread Richard Henderson
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 6 +++--- target/arm/translate.c | 10 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/

[PATCH v4 0/9] target/arm: pc-relative translation blocks

2022-09-06 Thread Richard Henderson
This is the Arm specific changes required to reduce the amount of translation for address space randomization. This is a re-base and split, with no other significant changes over v3. r~ Based-on: 20220906091126.298041-1-richard.hender...@linaro.org ("[PATCH v4 0/7] tcg: pc-relative translation

[PATCH v2 07/23] target/i386: Introduce DISAS_EOB*

2022-09-06 Thread Richard Henderson
Add a few DISAS_TARGET_* aliases to reduce the number of calls to gen_eob() and gen_eob_inhibit_irq(). So far, only update i386_tr_translate_insn for exiting the block because of single-step or previous inhibit irq. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 23 +

[PATCH v2 00/23] target/i386: pc-relative translation blocks

2022-09-06 Thread Richard Henderson
This is the x86 specific changes required to reduce the amount of translation for address space randomization. This is a re-base, with no other significant changes over v1. r~ Based-on: 20220906091126.298041-1-richard.hender...@linaro.org ("[PATCH v4 0/7] tcg: pc-relative translation blocks")

[PATCH v4 1/9] target/arm: Introduce curr_insn_len

2022-09-06 Thread Richard Henderson
A simple helper to retrieve the length of the current insn. Signed-off-by: Richard Henderson --- target/arm/translate.h | 5 + target/arm/translate-vfp.c | 2 +- target/arm/translate.c | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/target/arm/translate.h b/

[PATCH v4 8/9] target/arm: Introduce gen_pc_plus_diff for aarch32

2022-09-06 Thread Richard Henderson
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson --- target/arm/translate.c | 29 ++--- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 4d13e365e2

[PATCH v2 09/23] target/i386: Use DISAS_EOB_NEXT

2022-09-06 Thread Richard Henderson
Replace sequences of gen_update_cc_op, gen_update_eip_next, and gen_eob with the new is_jmp enumerator. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 40 - 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/target/i386/tcg/tra

[PATCH v2 12/23] target/i386: Remove cur_eip, next_eip arguments to gen_repz*

2022-09-06 Thread Richard Henderson
All callers pass s->base.pc_next and s->pc, which we can just as well compute within the functions. Pull out common helpers and reduce the amount of code under macros. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 116 ++-- 1 file changed, 57

[PATCH v2 03/23] target/i386: Remove cur_eip argument to gen_exception

2022-09-06 Thread Richard Henderson
All callers pass s->base.pc_next - s->cs_base, which we can just as well compute within the function. Note the special case of EXCP_VSYSCALL in which s->cs_base didn't have the subtraction, but cs_base is always zero in 64-bit mode, when vsyscall is used. Signed-off-by: Richard Henderson --- ta

[PATCH v4 3/9] target/arm: Change gen_*set_pc_im to gen_*update_pc

2022-09-06 Thread Richard Henderson
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values by passing in pc difference. Signed-off-by: Richard Henderson --- target/arm/translate-a32.h | 2 +- target/arm/translate.h | 6 ++-- target/arm/translate-a64.c | 32 +- target/arm/translate-vfp.c | 2 +

[PATCH v2 17/23] target/i386: Create gen_jmp_rel

2022-09-06 Thread Richard Henderson
Create a common helper for pc-relative branches. The jmp jb insn was missing a mask for CODE32. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 57 ++--- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/target/i386/tcg/translate.c

[PATCH v2 15/23] target/i386: Create eip_next_*

2022-09-06 Thread Richard Henderson
Create helpers for loading the address of the next insn. Use tcg_constant_* in adjacent code where convenient. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 44 +++-- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/target/i386/

[PATCH v2 23/23] target/i386: Enable TARGET_TB_PCREL

2022-09-06 Thread Richard Henderson
Signed-off-by: Richard Henderson --- target/i386/cpu-param.h | 1 + target/i386/tcg/tcg-cpu.c | 8 ++-- target/i386/tcg/translate.c | 86 ++--- 3 files changed, 77 insertions(+), 18 deletions(-) diff --git a/target/i386/cpu-param.h b/target/i386/cpu-param.

[PATCH v2 08/23] target/i386: Use DISAS_EOB* in gen_movl_seg_T0

2022-09-06 Thread Richard Henderson
Set is_jmp properly in gen_movl_seg_T0, so that the callers need to nothing special. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i38

[PATCH v4 4/9] target/arm: Change gen_exception_insn* to work on displacements

2022-09-06 Thread Richard Henderson
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values. Signed-off-by: Richard Henderson --- target/arm/translate.h| 4 ++-- target/arm/translate-a64.c| 28 +++-- target/arm/translate-m-nocp.c | 6 +++--- target/arm/translate-mve.c| 2 +- ta

[PATCH v2 21/23] target/i386: Use gen_jmp_rel for DISAS_TOO_MANY

2022-09-06 Thread Richard Henderson
With gen_jmp_rel, we may chain between two translation blocks which may only be separated because of TB size limits. Signed-off-by: Richard Henderson --- 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 i

  1   2   3   >