[PATCH v3 1/2] migration/rdma: Try to register On-Demand Paging memory region

2021-09-10 Thread Li Zhijian
Previously, for the fsdax mem-backend-file, it will register failed with Operation not supported. In this case, we can try to register it with On-Demand Paging[1] like what rpma_mr_reg() does on rpma[2]. [1]: https://community.mellanox.com/s/article/understanding-on-demand-paging--odp-x [2]: http

Re: [PULL 0/7] Migration.next patches

2021-09-10 Thread Juan Quintela
"lizhij...@fujitsu.com" wrote: > On 10/09/2021 13:20, Li Zhijian wrote: >> >> >> On 10/09/2021 00:10, Juan Quintela wrote: >>> "Li, Zhijian" wrote: on 2021/9/9 21:42, Peter Maydell wrote: > On Thu, 9 Sept 2021 at 11:36, Juan Quintela wrote: > Fails to build, FreeBSD: > > ../

Questions on setting guest CPU models with ARM kvm enabled

2021-09-10 Thread Jingyi Wang
Hi all, On ARM hardware, as qemu docs describes, "Named CPU models generally do not work with KVM." May I ask what is the main obstacle to setting a guest CPU model on later host hardware? For example, if I want to start Cortex-A57 guest on Cortex-A72 host, I noticed that there is not muc

Re: [PATCH v11 7/7] [RISCV_PM] Allow experimental J-ext to be turned on

2021-09-10 Thread Bin Meng
On Fri, Sep 10, 2021 at 3:13 AM Alexey Baturo wrote: > > Signed-off-by: Alexey Baturo > Reviewed-by: Alistair Francis > --- > target/riscv/cpu.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c > index f5fdc31fb9..4a1dd41818 100644 > --- a/tar

Re: [PATCH v11 1/7] [RISCV_PM] Add J-extension into RISC-V

2021-09-10 Thread Bin Meng
On Fri, Sep 10, 2021 at 3:00 AM Alexey Baturo wrote: > > Signed-off-by: Alexey Baturo > Reviewed-by: Richard Henderson > Reviewed-by: Alistair Francis > --- > target/riscv/cpu.h | 2 ++ > 1 file changed, 2 insertions(+) > Reviewed-by: Bin Meng

[PATCH v9 03/16] machine: Uniformly use maxcpus to calculate the omitted parameters

2021-09-10 Thread Yanan Wang
We are currently using maxcpus to calculate the omitted sockets but using cpus to calculate the omitted cores/threads. This makes cmdlines like: -smp cpus=8,maxcpus=16 -smp cpus=8,cores=4,maxcpus=16 -smp cpus=8,threads=2,maxcpus=16 work fine but the ones like: -smp cpus=8,sockets=2,maxcpus=

[PATCH v9 02/16] machine: Minor refactor/fix for the smp parsers

2021-09-10 Thread Yanan Wang
To pave the way for the functional improvement in later patches, make some refactor/cleanup for the smp parsers, including using local maxcpus instead of ms->smp.max_cpus in the calculation, defaulting dies to 0 initially like other members, cleanup the sanity check for dies. We actually also fix

[PATCH v9 01/16] machine: Deprecate "parameter=0" SMP configurations

2021-09-10 Thread Yanan Wang
In the SMP configuration, we should either provide a topology parameter with a reasonable value (greater than zero) or just omit it and QEMU will compute the missing value. The users shouldn't provide a configuration with any parameter of it specified as zero (e.g. -smp 8,sockets=0) which could po

[PATCH v9 05/16] machine: Improve the error reporting of smp parsing

2021-09-10 Thread Yanan Wang
We have two requirements for a valid SMP configuration: the product of "sockets * cores * threads" must represent all the possible cpus, i.e., max_cpus, and then must include the initially present cpus, i.e., smp_cpus. So we only need to ensure 1) "sockets * cores * threads == maxcpus" at first an

[PATCH v9 08/16] machine: Prefer cores over sockets in smp parsing since 6.2

2021-09-10 Thread Yanan Wang
In the real SMP hardware topology world, it's much more likely that we have high cores-per-socket counts and few sockets totally. While the current preference of sockets over cores in smp parsing results in a virtual cpu topology with low cores-per-sockets counts and a large number of sockets, whic

[PATCH v9 00/16] machine: smp parsing fixes and improvement

2021-09-10 Thread Yanan Wang
Hello, This is a new version v9 rebased on latest upstream commit bd662023e6. There are two more patches (#6 and #7) added to optimize qtest/numa-test to avoid affect from -smp parsing changes. Please review. This series has been tested locally on x86_64 and aarch64 machines, which are available

[PATCH v9 06/16] qtest/numa-test: Use detailed -smp CLIs in pc_dynamic_cpu_cfg

2021-09-10 Thread Yanan Wang
Since commit 80d7835749 (qemu-options: rewrite help for -smp options), the preference of sockets/cores in -smp parsing is considered liable to change, and actually we are going to change it in a coming commit. So it'll be more stable to use detailed -smp CLIs in testing if we have strong dependency

[PATCH v9 10/16] machine: Tweak the order of topology members in struct CpuTopology

2021-09-10 Thread Yanan Wang
Now that all the possible topology parameters are integrated in struct CpuTopology, tweak the order of topology members to be "cpus/sockets/ dies/cores/threads/maxcpus" for readability and consistency. We also tweak the comment by adding explanation of dies parameter. Signed-off-by: Yanan Wang Re

[PATCH v9 12/16] machine: Remove smp_parse callback from MachineClass

2021-09-10 Thread Yanan Wang
Now we have a generic smp parser for all arches, and there will not be any other arch specific ones, so let's remove the callback from MachineClass and call the parser directly. Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/core/machine.c | 3 +-- include/hw/boards.h | 5 - 2

[PATCH v9 11/16] machine: Make smp_parse generic enough for all arches

2021-09-10 Thread Yanan Wang
Currently the only difference between smp_parse and pc_smp_parse is the support of dies parameter and the related error reporting. With some arch compat variables like "bool dies_supported", we can make smp_parse generic enough for all arches and the PC specific one can be removed. Making smp_pars

[PATCH v9 04/16] machine: Set the value of cpus to match maxcpus if it's omitted

2021-09-10 Thread Yanan Wang
Currently we directly calculate the omitted cpus based on the given incomplete collection of parameters. This makes some cmdlines like: -smp maxcpus=16 -smp sockets=2,maxcpus=16 -smp sockets=2,dies=2,maxcpus=16 -smp sockets=2,cores=4,maxcpus=16 not work. We should probably set the value of

[PATCH v9 13/16] machine: Move smp_prefer_sockets to struct SMPCompatProps

2021-09-10 Thread Yanan Wang
Now we have a common structure SMPCompatProps used to store information about SMP compatibility stuff, so we can also move smp_prefer_sockets there for cleaner code. No functional change intended. Signed-off-by: Yanan Wang Acked-by: David Gibson Reviewed-by: Andrew Jones --- hw/arm/virt.c

[PATCH v9 14/16] machine: Put all sanity-check in the generic SMP parser

2021-09-10 Thread Yanan Wang
Put both sanity-check of the input SMP configuration and sanity-check of the output SMP configuration uniformly in the generic parser. Then machine_set_smp() will become cleaner, also all the invalid scenarios can be tested only by calling the parser. Signed-off-by: Yanan Wang Reviewed-by: Andrew

[PATCH v9 09/16] machine: Use ms instead of global current_machine in sanity-check

2021-09-10 Thread Yanan Wang
In the sanity-check of smp_cpus and max_cpus against mc in function machine_set_smp(), we are now using ms->smp.max_cpus for the check but using current_machine->smp.max_cpus in the error message. Tweak this by uniformly using the local ms. Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones Rev

[PATCH v9 16/16] tests/unit: Add a unit test for smp parsing

2021-09-10 Thread Yanan Wang
Add a QEMU unit test for the parsing of given SMP configuration. Since all the parsing logic is in generic function smp_parse(), this test passes different SMP configurations to the function and compare the parsing result with what is expected. In the test, all possible collections of the topology

[PATCH v9 15/16] machine: Split out the smp parsing code

2021-09-10 Thread Yanan Wang
We are going to introduce an unit test for the parser smp_parse() in hw/core/machine.c, but now machine.c is only built in softmmu. In order to solve the build dependency on the smp parsing code and avoid building unrelated stuff for the unit tests, move the related code from machine.c into a new

[PATCH v9 07/16] qtest/numa-test: Use detailed -smp CLI in test_def_cpu_split

2021-09-10 Thread Yanan Wang
Since commit 80d7835749 (qemu-options: rewrite help for -smp options), the preference of sockets/cores in -smp parsing is considered liable to change, and actually we are going to change it in a coming commit. So it'll be more stable to use detailed -smp CLIs in the testcases that have strong depen

Re: [RFC v3 12/32] rust: provide a common crate for QEMU

2021-09-10 Thread Marc-André Lureau
Hi On Fri, Sep 10, 2021 at 5:19 AM Alistair Francis wrote: > On Tue, Sep 7, 2021 at 10:41 PM wrote: > > > > From: Marc-André Lureau > > > > This crates provides common bindings and facilities for QEMU C API > > shared by various projects. > > > > Most importantly, it defines the conversion tra

Re: [PATCH v4] hw/arm/aspeed: Add Fuji machine type

2021-09-10 Thread Cédric Le Goater
On 9/7/21 4:05 PM, Peter Delevoryas wrote: > > >> On Sep 7, 2021, at 1:59 AM, Joel Stanley wrote: >> >> On Mon, 6 Sept 2021 at 13:31, wrote: >>> >>> From: Peter Delevoryas >>> >>> This adds a new machine type "fuji-bmc" based on the following device tree: >>> >>> https://github.com/torvalds/li

Re: Implementing isochronous transfers in hw/hcd-ohci.c

2021-09-10 Thread Gerd Hoffmann
Hi, > > > * TODO: > > > * o Isochronous transfers > > Most likely yes, audio devices typically use iso endpints. > The usb-audio device works for the fedora guest, so would this not indicate > that the iso endpoints are already working? Indeed, so probably the comment is just outdated. ta

RE: [PATCH v4 10/14] migration: add support to migrate shared regions list

2021-09-10 Thread Wang, Wei W
> From: Brijesh Singh > > When memory encryption is enabled, the hypervisor maintains a shared > regions list which is referred by hypervisor during migration to check if > page is > private or shared. This list is built during the VM bootup and must be > migrated > to the target host so that h

RE: [PATCH v4 14/14] kvm: Add support for userspace MSR filtering and handling of MSR_KVM_MIGRATION_CONTROL.

2021-09-10 Thread Wang, Wei W
On Wednesday, August 4, 2021 8:00 PM, Ashish Kalra wrote: > +/* > + * Currently this exit is only used by SEV guests for > + * MSR_KVM_MIGRATION_CONTROL to indicate if the guest > + * is ready for migration. > + */ > +static int kvm_handle_x86_msr(X86CPU *cpu, struct kvm_run *run) { > +static u

Re: Questions on setting guest CPU models with ARM kvm enabled

2021-09-10 Thread Andrew Jones
On Fri, Sep 10, 2021 at 10:40:30AM +0800, Jingyi Wang wrote: > Hi all, > On ARM hardware, as qemu docs describes, "Named CPU models generally > do not work with KVM." May I ask what is the main obstacle to setting a > guest CPU model on later host hardware? Currently KVM does not give the user

Re: [PATCH v9 06/16] qtest/numa-test: Use detailed -smp CLIs in pc_dynamic_cpu_cfg

2021-09-10 Thread Andrew Jones
On Fri, Sep 10, 2021 at 03:30:15PM +0800, Yanan Wang wrote: > Since commit 80d7835749 (qemu-options: rewrite help for -smp options), > the preference of sockets/cores in -smp parsing is considered liable > to change, and actually we are going to change it in a coming commit. > So it'll be more stab

Re: [PATCH v9 07/16] qtest/numa-test: Use detailed -smp CLI in test_def_cpu_split

2021-09-10 Thread Andrew Jones
On Fri, Sep 10, 2021 at 03:30:16PM +0800, Yanan Wang wrote: > Since commit 80d7835749 (qemu-options: rewrite help for -smp options), > the preference of sockets/cores in -smp parsing is considered liable > to change, and actually we are going to change it in a coming commit. > So it'll be more stab

Re: [PATCH 1/2] vfio/pci: Fix vfio-pci sub-page MMIO BAR mmaping in live migration

2021-09-10 Thread Kunkun Jiang
Hi Alex, On 2021/9/9 4:45, Alex Williamson wrote: On Fri, 3 Sep 2021 17:36:10 +0800 Kunkun Jiang wrote: We expand MemoryRegions of vfio-pci sub-page MMIO BARs to vfio_pci_write_config to improve IO performance. The MemoryRegions of destination VM will not be expanded successful in live migrat

Re: [PATCH 2/2] vfio/common: Add trace point when a MMIO RAM section less than PAGE_SIZE

2021-09-10 Thread Kunkun Jiang
Hi Alex, On 2021/9/9 4:45, Alex Williamson wrote: On Fri, 3 Sep 2021 17:36:11 +0800 Kunkun Jiang wrote: The MSI-X structures of some devices and other non-MSI-X structures are in the same BAR. They may share one host page, especially in the case of large page granularity, suck as 64K. s/suck

Re: [PULL 0/7] Migration.next patches

2021-09-10 Thread lizhij...@fujitsu.com
On 10/09/2021 15:00, Juan Quintela wrote: > ++ git diff-index --quiet --ignore-submodules=all HEAD -- > ++ echo HEAD > + git archive --format tar --prefix slirp/ HEAD > + test 0 -ne 0 > + tar --concatenate --file /tmp/kk.tar /tmp/kk.sub.WKj1o6oP/submodule.tar > tar: Skipping to next header > tar:

Re: [PATCH v4 10/14] migration: add support to migrate shared regions list

2021-09-10 Thread Ashish Kalra
Hello Wang, On Fri, Sep 10, 2021 at 07:54:10AM +, Wang, Wei W wrote: > > From: Brijesh Singh > > > > When memory encryption is enabled, the hypervisor maintains a shared > > regions list which is referred by hypervisor during migration to check if > > page is > > private or shared. This li

Re: [PATCH v2] qemu-options: show -spice options only if #ifdef CONFIG_SPICE

2021-09-10 Thread Gerd Hoffmann
On Thu, Sep 09, 2021 at 07:19:22PM +0400, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau > > Fixes: > https://bugzilla.redhat.com/show_bug.cgi?id=1982600 > > Signed-off-by: Marc-André Lureau Reviewed-by: Gerd Hoffmann take care, Gerd

[PATCH] block/mirror: fix NULL pointer dereference in mirror_wait_on_conflicts()

2021-09-10 Thread Stefano Garzarella
In mirror_iteration() we call mirror_wait_on_conflicts() with `self` parameter set to NULL. Starting from commit d44dae1a7c we dereference `self` pointer in mirror_wait_on_conflicts() without checks if it is not NULL. Backtrace: Program terminated with signal SIGSEGV, Segmentation fault. #0

RE: [PATCH v4 10/14] migration: add support to migrate shared regions list

2021-09-10 Thread Wang, Wei W
On Friday, September 10, 2021 4:48 PM, Ashish Kalra wrote: > On Fri, Sep 10, 2021 at 07:54:10AM +, Wang, Wei W wrote: > There has been a long discussion on this implementation on KVM mailing list. > Tracking shared memory via a list of ranges instead of using bitmap is more > optimal. Most of t

Re: [PATCH v4 14/14] kvm: Add support for userspace MSR filtering and handling of MSR_KVM_MIGRATION_CONTROL.

2021-09-10 Thread Ashish Kalra
On Fri, Sep 10, 2021 at 07:56:36AM +, Wang, Wei W wrote: > On Wednesday, August 4, 2021 8:00 PM, Ashish Kalra wrote: > > +/* > > + * Currently this exit is only used by SEV guests for > > + * MSR_KVM_MIGRATION_CONTROL to indicate if the guest > > + * is ready for migration. > > + */ > > +static

Re: SMMU Stage 2 translation in QEMU

2021-09-10 Thread Peter Maydell
On Thu, 9 Sept 2021 at 21:18, wrote: > I am trying to understand the approach required for an emulated SMMU to > convert IPAs(from each qemu guest) to PAs(respective host addresses) > using stage 2 tables. > > The questions i have are:- > > 1) Since SMMU stage 2 tables are expected to be created a

Re: [PATCH 1/4] target/arm: Add TB flag for "MVE insns not predicated"

2021-09-10 Thread Peter Maydell
On Fri, 10 Sept 2021 at 07:46, Richard Henderson wrote: > > On 9/9/21 3:46 PM, Peter Maydell wrote: > > On Fri, 3 Sept 2021 at 14:58, Richard Henderson > > wrote: > >> I think you need to go ahead and end the TB and resync immediately. > >> Just set dc->base.is_jmp = DISAS_UPDATE_NOCHAIN instead.

RE: [PATCH v4 14/14] kvm: Add support for userspace MSR filtering and handling of MSR_KVM_MIGRATION_CONTROL.

2021-09-10 Thread Wang, Wei W
On Friday, September 10, 2021 5:14 PM, Ashish Kalra wrote: > > It seems this is enabled/disabled by the guest, which means that the guest > can always refuse to be migrated? > > > > Yes. > > Are there any specific concerns/issues with that ? It's kind of wired if everybody rejects to migrate fro

[PATCH] qxl: fix pre-save logic

2021-09-10 Thread Gerd Hoffmann
Oops. Logic is backwards. Fixes: 39b8a183e2f3 ("qxl: remove assert in qxl_pre_save.") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/610 Resolves: https://bugzilla.redhat.com//show_bug.cgi?id=2002907 Signed-off-by: Gerd Hoffmann --- hw/display/qxl.c | 2 +- 1 file changed, 1 insertion(

Re: [PATCH v4 13/14] migration: for SEV live migration bump downtime limit to 1s.

2021-09-10 Thread Daniel P . Berrangé
On Wed, Aug 04, 2021 at 11:59:47AM +, Ashish Kalra wrote: > From: Ashish Kalra > > Now, qemu has a default expected downtime of 300 ms and > SEV Live migration has a page-per-second bandwidth of 350-450 pages > ( SEV Live migration being generally slow due to guest RAM pages > being migrated

Re: [PATCH v4 10/14] migration: add support to migrate shared regions list

2021-09-10 Thread Ashish Kalra
On Fri, Sep 10, 2021 at 09:11:09AM +, Wang, Wei W wrote: > On Friday, September 10, 2021 4:48 PM, Ashish Kalra wrote: > > On Fri, Sep 10, 2021 at 07:54:10AM +, Wang, Wei W wrote: > > There has been a long discussion on this implementation on KVM mailing list. > > Tracking shared memory via

Re: [PATCH] qxl: fix pre-save logic

2021-09-10 Thread Marc-André Lureau
On Fri, Sep 10, 2021 at 1:43 PM Gerd Hoffmann wrote: > Oops. Logic is backwards. > > Fixes: 39b8a183e2f3 ("qxl: remove assert in qxl_pre_save.") > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/610 > Resolves: https://bugzilla.redhat.com//show_bug.cgi?id=2002907 > Signed-off-by: Gerd Ho

Re: [PATCH v4 02/14] doc: update AMD SEV to include Live migration flow

2021-09-10 Thread Daniel P . Berrangé
On Wed, Aug 04, 2021 at 11:53:47AM +, Ashish Kalra wrote: > From: Brijesh Singh > > Signed-off-by: Brijesh Singh > Signed-off-by: Ashish Kalra > --- > docs/amd-memory-encryption.txt | 46 +- > 1 file changed, 45 insertions(+), 1 deletion(-) > > diff --git a

Re: [PATCH] qxl: fix pre-save logic

2021-09-10 Thread Daniel P . Berrangé
On Fri, Sep 10, 2021 at 11:42:03AM +0200, Gerd Hoffmann wrote: > Oops. Logic is backwards. > > Fixes: 39b8a183e2f3 ("qxl: remove assert in qxl_pre_save.") Urgh, I looked at that commit yesterday several times and was blind to the bug too ! > Resolves: https://gitlab.com/qemu-project/qemu/-/issu

Re: [PULL 00/12] qemu-sparc queue 20210908

2021-09-10 Thread Peter Maydell
On Wed, 8 Sept 2021 at 12:55, Mark Cave-Ayland wrote: > > The following changes since commit abf7aee72ea66944a62962603e4c2381f5e473e7: > > Merge remote-tracking branch > 'remotes/thuth-gitlab/tags/s390x-pull-request-2021-09-07' into staging > (2021-09-07 17:46:13 +0100) > > are available in th

Re: [PATCH v4 13/14] migration: for SEV live migration bump downtime limit to 1s.

2021-09-10 Thread Ashish Kalra via
On Fri, Sep 10, 2021 at 10:43:50AM +0100, Daniel P. Berrangé wrote: > On Wed, Aug 04, 2021 at 11:59:47AM +, Ashish Kalra wrote: > > From: Ashish Kalra > > > > Now, qemu has a default expected downtime of 300 ms and > > SEV Live migration has a page-per-second bandwidth of 350-450 pages > > (

[PULL 0/3] Input 20210910 patches

2021-09-10 Thread Gerd Hoffmann
The following changes since commit bd662023e683850c085e98c8ff8297142c2dd9f2: Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-20210908' into staging (2021-09-08 11:06:17 +0100) are available in the Git repository at: git://git.kraxel.org/qemu tags/input-202

[PULL 3/3] ps2: migration support for command reply queue

2021-09-10 Thread Gerd Hoffmann
From: Volker Rümelin Add migration support for the PS/2 keyboard command reply queue. Signed-off-by: Volker Rümelin Message-Id: <20210810133258.8231-3-vr_q...@t-online.de> Signed-off-by: Gerd Hoffmann --- hw/input/ps2.c | 40 ++-- 1 file changed, 34 inserti

[PULL 2/3] ps2: use a separate keyboard command reply queue

2021-09-10 Thread Gerd Hoffmann
From: Volker Rümelin A PS/2 keyboard has a separate command reply queue that is independent of the key queue. This prevents that command replies and keyboard input mix. Keyboard command replies take precedence over queued keystrokes. A new keyboard command removes any remaining command replies fr

[PULL 1/3] ps2: use the whole ps2 buffer but keep queue size

2021-09-10 Thread Gerd Hoffmann
From: Volker Rümelin Extend the used ps2 buffer size to the available buffer size but keep the maximum ps2 queue size. The next patch needs a few bytes of the larger buffer size. Signed-off-by: Volker Rümelin Message-Id: <20210810133258.8231-1-vr_q...@t-online.de> Signed-off-by: Gerd Hoffmann

[PATCH v2 0/3] The HMP/QMP interfaces in Qemu SGX

2021-09-10 Thread Yang Zhong
This patchset supply HMP/QMP interfaces to monitor and Libvirt, with those interfaces, we can check the SGX info from VM side or check host SGX capabilities from Libvirt side. This patchset is splitted from below link(from patch26 to patch30): https://patchew.org/QEMU/20210719112136.57018-1-yang.z

[PATCH v2 2/3] qmp: Add the qmp_query_sgx_capabilities()

2021-09-10 Thread Yang Zhong
Libvirt can use qmp_query_sgx_capabilities() to get the host sgx capabilities to decide how to allocate SGX EPC size to VM. Signed-off-by: Yang Zhong --- hw/i386/sgx.c | 66 ++ include/hw/i386/sgx.h | 1 + qapi/misc-target.json | 18 +++

[PATCH v2 3/3] pc: Cleanup the SGX definitions

2021-09-10 Thread Yang Zhong
This patch only cleanup SGX definitions in the the pc.h file. Signed-off-by: Yang Zhong --- include/hw/i386/pc.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index a5ae380b4b..4c77489961 100644 --- a/include/hw/i386/p

[PATCH v2 1/3] monitor: Add HMP and QMP interfaces

2021-09-10 Thread Yang Zhong
The QMP and HMP interfaces can be used by monitor or QMP tools to retrieve the SGX information from VM side when SGX is enabled on Intel platform. Signed-off-by: Yang Zhong --- hmp-commands-info.hx | 15 + hw/i386/sgx.c| 29 include/hw

Re: [PATCH] block/mirror: fix NULL pointer dereference in mirror_wait_on_conflicts()

2021-09-10 Thread Vladimir Sementsov-Ogievskiy
10.09.2021 11:56, Stefano Garzarella wrote: In mirror_iteration() we call mirror_wait_on_conflicts() with `self` parameter set to NULL. Starting from commit d44dae1a7c we dereference `self` pointer in mirror_wait_on_conflicts() without checks if it is not NULL. Backtrace: Program terminated

[PATCH 0/2] fix crash if try to migrate during backup

2021-09-10 Thread Vladimir Sementsov-Ogievskiy
Hi all! We faced a crash and here is a fix. Look at the commits for details. Vladimir Sementsov-Ogievskiy (2): tests: add migrate-during-backup block: bdrv_inactivate_recurse(): check for permissions and fix crash block.c | 8 ++ .../qemu-iotests/tests

[PATCH 1/2] tests: add migrate-during-backup

2021-09-10 Thread Vladimir Sementsov-Ogievskiy
Add a simple test which tries to run migration during backup. bdrv_inactivate_all() should fail. But due to bug (see next commit with fix) it doesn't, nodes are inactivated and continued backup crashes on assertion "assert(!(bs->open_flags & BDRV_O_INACTIVE));" in bdrv_co_write_req_prepare(). Sign

[PATCH 2/2] block: bdrv_inactivate_recurse(): check for permissions and fix crash

2021-09-10 Thread Vladimir Sementsov-Ogievskiy
We must not inactivate child when parent has write permissions on it. Calling .bdrv_inactivate() doesn't help: actually only qcow2 has this handler and it is used to flush caches, not for permission manipulations. So, let's simply check cumulative parent permissions before inactivating the node.

Re: [PATCH] softmmu: fix watchpoint processing in icount mode

2021-09-10 Thread David Hildenbrand
On 07.09.21 13:30, Pavel Dovgalyuk wrote: Watchpoint processing code restores vCPU state twice: in tb_check_watchpoint and in cpu_loop_exit_restore/cpu_restore_state. Normally it does not affect anything, but in icount mode instruction counter is incremented twice and becomes incorrect. This patc

[PATCH v3 00/22] target/ppc: DFP instructions using decodetree

2021-09-10 Thread Luis Pires
This series moves all existing DFP instructions to decodetree and implements the 2 new instructions (dcffixqq and dctfixqq) from Power ISA 3.1. In order to implement dcffixqq, divu128/divs128 were modified to support 128-bit quotients (previously, they were limited to 64-bit quotients), along with

[PATCH v3 05/22] host-utils: move checks out of divu128/divs128

2021-09-10 Thread Luis Pires
In preparation for changing the divu128/divs128 implementations to allow for quotients larger than 64 bits, move the div-by-zero and overflow checks to the callers. Signed-off-by: Luis Pires --- include/hw/clock.h| 5 +++-- include/qemu/host-utils.h | 36 +---

[PATCH v3 03/22] host-utils: introduce uabs64()

2021-09-10 Thread Luis Pires
Introduce uabs64(), a function that returns the absolute value of a 64-bit int as an unsigned value. This avoids the undefined behavior for common abs implementations, where abs of the most negative value is undefined. Signed-off-by: Luis Pires Reviewed-by: Richard Henderson Reviewed-by: Eduardo

[PATCH v3 02/22] host-utils: fix missing zero-extension in divs128

2021-09-10 Thread Luis Pires
*plow (lower 64 bits of the dividend) is passed into divs128() as a signed 64-bit integer. When building an __int128_t from it, it must be zero-extended, instead of sign-extended. Suggested-by: Richard Henderson Signed-off-by: Luis Pires --- include/qemu/host-utils.h | 2 +- 1 file changed, 1 i

[PATCH v3 04/22] i386/kvm: Replace abs64() with uabs64() from host-utils

2021-09-10 Thread Luis Pires
Drop abs64() and use uabs64() from host-utils, which avoids an undefined behavior when taking abs of the most negative value. Signed-off-by: Luis Pires Reviewed-by: Richard Henderson Reviewed-by: Eduardo Habkost --- hw/i386/kvm/i8254.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-

[PATCH v3 01/22] host-utils: Fix overflow detection in divu128()

2021-09-10 Thread Luis Pires
The previous code didn't detect overflows if the high 64-bit of the dividend were equal to the 64-bit divisor. In that case, 64 bits wouldn't be enough to hold the quotient. Signed-off-by: Luis Pires Reviewed-by: Richard Henderson --- util/host-utils.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v3 11/22] target/ppc: Introduce REQUIRE_FPU

2021-09-10 Thread Luis Pires
From: Fernando Valle Signed-off-by: Fernando Valle Signed-off-by: Luis Pires Reviewed-by: Richard Henderson --- target/ppc/translate.c | 8 1 file changed, 8 insertions(+) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 4749ecdaa9..5489b4b6e0 100644 --- a/target/p

[PATCH v3 20/22] target/ppc: Move dqua[q], drrnd[q] to decodetree

2021-09-10 Thread Luis Pires
Move the following instructions to decodetree: dqua: DFP Quantize dquaq: DFP Quantize Quad drrnd: DFP Reround drrndq: DFP Reround Quad Signed-off-by: Luis Pires Reviewed-by: Philippe Mathieu-Daudé --- target/ppc/dfp_helper.c | 8 ++--- target/ppc/helper.h | 8 +

[PATCH v3 06/22] host-utils: move udiv_qrnnd() to host-utils

2021-09-10 Thread Luis Pires
Move udiv_qrnnd() from include/fpu/softfloat-macros.h to host-utils, so it can be reused by divu128(). Signed-off-by: Luis Pires --- include/fpu/softfloat-macros.h | 82 -- include/qemu/host-utils.h | 81 + 2 files changed, 81

[PATCH v3 13/22] host-utils: Introduce mulu128

2021-09-10 Thread Luis Pires
Signed-off-by: Luis Pires Reviewed-by: Richard Henderson --- include/qemu/host-utils.h | 36 1 file changed, 36 insertions(+) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index eee58c0874..8360146979 100644 --- a/include/qemu/host-utils

[PATCH v3 08/22] host-utils: add unit tests for divu128/divs128

2021-09-10 Thread Luis Pires
Signed-off-by: Luis Pires --- tests/unit/meson.build | 1 + tests/unit/test-div128.c | 197 +++ 2 files changed, 198 insertions(+) create mode 100644 tests/unit/test-div128.c diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 5736d285b2..9

[PATCH v3 07/22] host-utils: add 128-bit quotient support to divu128/divs128

2021-09-10 Thread Luis Pires
These will be used to implement new decimal floating point instructions from Power ISA 3.1. A new argument, prem, was added to divu128/divs128 to receive the remainder, freeing up phigh to receive the high 64 bits of the quotient. Signed-off-by: Luis Pires --- include/hw/clock.h| 8 +-

[PATCH v3 14/22] libdecnumber: Introduce decNumberIntegralToInt128

2021-09-10 Thread Luis Pires
This will be used to implement PowerPC's dctfixqq. Signed-off-by: Luis Pires Reviewed-by: Richard Henderson --- include/libdecnumber/decNumber.h | 2 + include/libdecnumber/decNumberLocal.h | 2 +- libdecnumber/decContext.c | 7 +- libdecnumber/decNumber.c | 95

[PATCH v3 12/22] target/ppc: Implement DCFFIXQQ

2021-09-10 Thread Luis Pires
Implement the following PowerISA v3.1 instruction: dcffixqq: DFP Convert From Fixed Quadword Quad Signed-off-by: Luis Pires --- target/ppc/dfp_helper.c | 11 +++ target/ppc/helper.h | 1 + target/ppc/insn32.decode| 8 target/ppc/translat

[PATCH v3 09/22] libdecnumber: introduce decNumberFrom[U]Int128

2021-09-10 Thread Luis Pires
This will be used to implement PowerPC's dcffixqq. Signed-off-by: Luis Pires Reviewed-by: Richard Henderson --- include/libdecnumber/decNumber.h | 2 ++ libdecnumber/decNumber.c | 36 2 files changed, 38 insertions(+) diff --git a/include/libdecnumber/

[PATCH v3 18/22] target/ppc: Move dcmp{u, o}[q], dts{tex, tsf, tsfi}[q] to decodetree

2021-09-10 Thread Luis Pires
Move the following instructions to decodetree: dcmpu:DFP Compare Unordered dcmpuq: DFP Compare Unordered Quad dcmpo:DFP Compare Ordered dcmpoq: DFP Compare Ordered Quad dtstex: DFP Test Exponent dtstexq: DFP Test Exponent Quad dtstsf: DFP Test Significance dtstsfq: DFP Test Signif

[PATCH v3 16/22] target/ppc: Move dtstdc[q]/dtstdg[q] to decodetree

2021-09-10 Thread Luis Pires
Move the following instructions to decodetree: dtstdc: DFP Test Data Class dtstdcq: DFP Test Data Class Quad dtstdg: DFP Test Data Group dtstdgq: DFP Test Data Group Quad Signed-off-by: Luis Pires Reviewed-by: Philippe Mathieu-Daudé --- target/ppc/dfp_helper.c | 8 +++ target

[PATCH v3 10/22] target/ppc: Move REQUIRE_ALTIVEC/VECTOR to translate.c

2021-09-10 Thread Luis Pires
From: Bruno Larsen Move REQUIRE_ALTIVEC to translate.c and rename it to REQUIRE_VECTOR. Signed-off-by: Bruno Larsen Signed-off-by: Matheus Ferst Signed-off-by: Fernando Valle Signed-off-by: Luis Pires Reviewed-by: Richard Henderson Acked-by: David Gibson --- target/ppc/translate.c

[PATCH v3 21/22] target/ppc: Move dct{dp, qpq}, dr{sp, dpq}, dc{f, t}fix[q], dxex[q] to decodetree

2021-09-10 Thread Luis Pires
Move the following instructions to decodetree: dctdp: DFP Convert To DFP Long dctqpq: DFP Convert To DFP Extended drsp:DFP Round To DFP Short drdpq: DFP Round To DFP Long dcffix: DFP Convert From Fixed dcffixq: DFP Convert From Fixed Quad dctfix: DFP Convert To Fixed dctfixq: DFP Convert

[PATCH v3 22/22] target/ppc: Move ddedpd[q], denbcd[q], dscli[q], dscri[q] to decodetree

2021-09-10 Thread Luis Pires
Move the following instructions to decodetree: ddedpd: DFP Decode DPD To BCD ddedpdq: DFP Decode DPD To BCD Quad denbcd: DFP Encode BCD To DPD denbcdq: DFP Encode BCD To DPD Quad dscli: DFP Shift Significand Left Immediate dscliq: DFP Shift Significand Left Immediate Quad dscri: DFP Shift Si

[PATCH v3 15/22] target/ppc: Implement DCTFIXQQ

2021-09-10 Thread Luis Pires
Implement the following PowerISA v3.1 instruction: dctfixqq: DFP Convert To Fixed Quadword Quad Signed-off-by: Luis Pires --- target/ppc/dfp_helper.c | 53 + target/ppc/helper.h | 1 + target/ppc/insn32.decode| 5 +++ target/p

Re: Implementing isochronous transfers in hw/hcd-ohci.c

2021-09-10 Thread BALATON Zoltan
On Fri, 10 Sep 2021, Howard Spoelstra wrote: On Fri, Sep 10, 2021 at 7:07 AM Gerd Hoffmann wrote: On Thu, Sep 09, 2021 at 05:06:17PM -0400, Programmingkid wrote: Hi Gerd, Howard and I were talking about USB audio problems with Mac OS guests. We think the issue might be with frames being sen

[PATCH v3 17/22] target/ppc: Move d{add, sub, mul, div, iex}[q] to decodetree

2021-09-10 Thread Luis Pires
Move the following instructions to decodetree: dadd: DFP Add daddq: DFP Add Quad dsub: DFP Subtract dsubq: DFP Subtract Quad dmul: DFP Multiply dmulq: DFP Multiply Quad ddiv: DFP Divide ddivq: DFP Divide Quad diex: DFP Insert Biased Exponent diexq: DFP Insert Biased Exponent Quad Signed-off-b

[PATCH v3 19/22] target/ppc: Move dquai[q], drint{x, n}[q] to decodetree

2021-09-10 Thread Luis Pires
Move the following instructions to decodetree: dquai: DFP Quantize Immediate dquaiq: DFP Quantize Immediate Quad drintx: DFP Round to FP Integer With Inexact drintxq: DFP Round to FP Integer With Inexact Quad drintn: DFP Round to FP Integer Without Inexact drintnq: DFP Round to FP Integer With

Re: [PATCH] block/mirror: fix NULL pointer dereference in mirror_wait_on_conflicts()

2021-09-10 Thread Stefano Garzarella
On Fri, Sep 10, 2021 at 01:37:40PM +0300, Vladimir Sementsov-Ogievskiy wrote: 10.09.2021 11:56, Stefano Garzarella wrote: In mirror_iteration() we call mirror_wait_on_conflicts() with `self` parameter set to NULL. Starting from commit d44dae1a7c we dereference `self` pointer in mirror_wait_on_c

Re: [PATCH] tcg/arm: Fix tcg_out_vec_op function signature

2021-09-10 Thread Richard Henderson
On 9/8/21 8:53 PM, Jose R. Ziviani wrote: Commit 5e8892db93 fixed several function signatures but tcg_out_vec_op for arm is missing. It causes a build error on armv6 and armv7: tcg-target.c.inc:2718:42: error: argument 5 of type 'const TCGArg *' {aka 'const unsigned int *'} declared as a pointer

Re: [PATCH] block/mirror: fix NULL pointer dereference in mirror_wait_on_conflicts()

2021-09-10 Thread Vladimir Sementsov-Ogievskiy
10.09.2021 14:42, Stefano Garzarella wrote: On Fri, Sep 10, 2021 at 01:37:40PM +0300, Vladimir Sementsov-Ogievskiy wrote: 10.09.2021 11:56, Stefano Garzarella wrote: In mirror_iteration() we call mirror_wait_on_conflicts() with `self` parameter set to NULL. Starting from commit d44dae1a7c we d

Re: [PATCH RFC v2 09/16] vfio-user: region read/write

2021-09-10 Thread John Levon
On Fri, Sep 10, 2021 at 06:07:56AM +, John Johnson wrote: > >>> On Mon, Aug 16, 2021 at 09:42:42AM -0700, Elena Ufimtseva wrote: > >>> > +int vfio_user_region_write(VFIODevice *vbasedev, uint32_t index, > + uint64_t offset, uint32_t count, void *data) > >>>

Re: SMMU Stage 2 translation in QEMU

2021-09-10 Thread shashi . mallela
I am referring to the latter,"purely emulated QEMU with an emulated SMMU that handles accesses to emulated devices" Thanks Shashi On Fri, 2021-09-10 at 10:25 +0100, Peter Maydell wrote: > On Thu, 9 Sept 2021 at 21:18, wrote: > > I am trying to understand the approach required for an emulated > >

Re: [PULL 00/12] Q800 patches

2021-09-10 Thread Peter Maydell
On Wed, 8 Sept 2021 at 16:40, Laurent Vivier wrote: > > The following changes since commit abf7aee72ea66944a62962603e4c2381f5e473e7: > > Merge remote-tracking branch > 'remotes/thuth-gitlab/tags/s390x-pull-request-2021-09-07' into staging > (2021-09-07 17:46:13 +0100) > > are available in the

Re: [PATCH v2 1/3] monitor: Add HMP and QMP interfaces

2021-09-10 Thread Philippe Mathieu-Daudé
On 9/10/21 12:22 PM, Yang Zhong wrote: > The QMP and HMP interfaces can be used by monitor or QMP tools to retrieve > the SGX information from VM side when SGX is enabled on Intel platform. > > Signed-off-by: Yang Zhong > --- > hmp-commands-info.hx | 15 + > hw/i386/sgx.c

Re: [PATCH v2 2/3] qmp: Add the qmp_query_sgx_capabilities()

2021-09-10 Thread Philippe Mathieu-Daudé
On 9/10/21 12:22 PM, Yang Zhong wrote: > Libvirt can use qmp_query_sgx_capabilities() to get the host > sgx capabilities to decide how to allocate SGX EPC size to VM. > > Signed-off-by: Yang Zhong > --- > hw/i386/sgx.c | 66 ++ > include/hw/i386/s

[PATCH v2] block/mirror: fix NULL pointer dereference in mirror_wait_on_conflicts()

2021-09-10 Thread Stefano Garzarella
In mirror_iteration() we call mirror_wait_on_conflicts() with `self` parameter set to NULL. Starting from commit d44dae1a7c we dereference `self` pointer in mirror_wait_on_conflicts() without checks if it is not NULL. Backtrace: Program terminated with signal SIGSEGV, Segmentation fault. #0

Re: [PATCH v4] hw/arm/aspeed: Add Fuji machine type

2021-09-10 Thread Philippe Mathieu-Daudé
On 9/10/21 9:49 AM, Cédric Le Goater wrote: > On 9/7/21 4:05 PM, Peter Delevoryas wrote: >> >>> On Sep 7, 2021, at 1:59 AM, Joel Stanley wrote: >>> >>> On Mon, 6 Sept 2021 at 13:31, wrote: From: Peter Delevoryas This adds a new machine type "fuji-bmc" based on the following d

Re: [PATCH v4 17/21] LoongArch Linux User Emulation

2021-09-10 Thread Richard Henderson
On 9/8/21 11:50 AM, Song Gao wrote: Hi Richard, On 09/05/2021 06:04 PM, Richard Henderson wrote: +struct sigframe { +    uint32_t sf_ass[4]; /* argument save space for o32 */ Surely there is no "o32" for loongarch? Yes, qemu only support 64bit. but the kernel has 'o32'.  Shoul

Re: [PATCH 1/5] docs/devel: document expectations for QAPI data modelling for QMP

2021-09-10 Thread Daniel P . Berrangé
On Thu, Sep 09, 2021 at 11:33:20AM +0200, Markus Armbruster wrote: > Daniel P. Berrangé writes: > > > Traditionally we have required that newly added QMP commands will model > > any returned data using fine grained QAPI types. This is good for > > commands that are intended to be consumed by mach

Re: SMMU Stage 2 translation in QEMU

2021-09-10 Thread Peter Maydell
On Fri, 10 Sept 2021 at 13:39, wrote: > > I am referring to the latter,"purely emulated QEMU with an emulated > SMMU that handles accesses to emulated devices" In that case, the stage 2 tables are set up by the guest code (running at emulated EL2), just as they would be if it were running on real

Re: [PULL 0/7] Migration.next patches

2021-09-10 Thread Philippe Mathieu-Daudé
On 9/10/21 7:27 AM, lizhij...@fujitsu.com wrote: > On 10/09/2021 13:20, Li Zhijian wrote: >> On 10/09/2021 00:10, Juan Quintela wrote: >>> "Li, Zhijian" wrote: on 2021/9/9 21:42, Peter Maydell wrote: > On Thu, 9 Sept 2021 at 11:36, Juan Quintela wrote: > Fails to build, FreeBSD:

  1   2   >