Re: [PATCH v2 3/5] hw/misc: Add npcm7xx random number generator

2020-10-21 Thread Thomas Huth
On 21/10/2020 23.35, Havard Skinnemoen via wrote: > The RNG module returns a byte of randomness when the Data Valid bit is > set. > > This implementation ignores the prescaler setting, and loads a new value > into RNGD every time RNGCS is read while the RNG is enabled and random > data is

Re: [PATCH v2 2/5] hw/timer: Adding watchdog for NPCM7XX Timer.

2020-10-21 Thread Thomas Huth
On 21/10/2020 23.35, Havard Skinnemoen via wrote: > From: Hao Wu > > The watchdog is part of NPCM7XX's timer module. Its behavior is > controlled by the WTCR register in the timer. > > When enabled, the watchdog issues an interrupt signal after a pre-set > amount of cycles, and issues a reset

[PATCH v7] sev: add sev-inject-launch-secret

2020-10-21 Thread tobin
From: Tobin Feldman-Fitzthum AMD SEV allows a guest owner to inject a secret blob into the memory of a virtual machine. The secret is encrypted with the SEV Transport Encryption Key and integrity is guaranteed with the Transport Integrity Key. Although QEMU facilitates the injection of the

Re: [PATCH v6] sev: add sev-inject-launch-secret

2020-10-21 Thread Tobin Feldman-Fitzthum
On 2020-10-22 00:16, to...@linux.ibm.com wrote: From: Tobin Feldman-Fitzthum AMD SEV allows a guest owner to inject a secret blob into the memory of a virtual machine. The secret is encrypted with the SEV Transport Encryption Key and integrity is guaranteed with the Transport Integrity Key.

Re: [PATCH v6 6/6] migration-test: Only hide error if !QTEST_LOG

2020-10-21 Thread Thomas Huth
On 21/10/2020 23.27, Peter Xu wrote: > The errors are very useful when debugging qtest failures, especially when > QTEST_LOG=1 is set. Let's allow override MigrateStart.hide_stderr when > QTEST_LOG=1 is specified, because that means the user wants to be verbose. > > Not very nice to introduce

[PATCH 1/2] hw/riscv: sifive_u: Allow passing custom DTB

2020-10-21 Thread Anup Patel
Extend sifive_u machine to allow passing custom DTB using "-dtb" command-line parameter. This will help users pass modified DTB or Linux SiFive DTB to sifive_u machine. Signed-off-by: Anup Patel --- hw/riscv/sifive_u.c | 28 1 file changed, 20 insertions(+), 8

[PATCH 2/2] hw/riscv: virt: Allow passing custom DTB

2020-10-21 Thread Anup Patel
Extend virt machine to allow passing custom DTB using "-dtb" command-line parameter. This will help users pass modified DTB to virt machine. Signed-off-by: Anup Patel --- hw/riscv/virt.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git

Re: [PATCH v1 6/6] tests/acceptance: pick a random gdb port for reverse debugging

2020-10-21 Thread Thomas Huth
On 21/10/2020 18.31, Alex Bennée wrote: > Currently the test randomly fails if you are using a shared machine > due to contention on the well known port 1234. We can ameliorate this > a bit by picking a random non-ephemeral port although it doesn't > totally avoid the problem. While we could use a

[PULL 07/14] spice: move display_add_client() to QemuSpiceOps.

2020-10-21 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-8-kra...@redhat.com --- include/ui/qemu-spice-module.h | 1 + include/ui/qemu-spice.h| 6 -- monitor/qmp-cmds.c | 2 +- ui/spice-core.c| 3 ++- ui/spice-module.c

[PULL 10/14] modules: dependencies infrastructure

2020-10-21 Thread Gerd Hoffmann
Allow modules depending on other modules. module_load_file() gets the option to export symbols (by not adding the G_MODULE_BIND_LOCAL flag). module_load_one() will check the module dependency list to figure (a) whenever are other modules must be loaded first, or (b) the module should export the

[PULL 05/14] spice: move add_interface() to QemuSpiceOps.

2020-10-21 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-6-kra...@redhat.com --- include/ui/qemu-spice-module.h | 7 +++ include/ui/qemu-spice.h| 1 - audio/spiceaudio.c | 4 ++-- chardev/spice.c| 2 +- ui/spice-core.c

[PULL 14/14] opengl: build opengl helper code modular

2020-10-21 Thread Gerd Hoffmann
Removes opengl dependency from core qemu. The number of shared libraries for qemu-system-x86_64 goes down from 66 to 60 on my system. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-15-kra...@redhat.com --- util/module.c | 7 +++

[PULL 12/14] spice: flip modules switch

2020-10-21 Thread Gerd Hoffmann
Build spice core code as module. This removes libspice-server and a handful of indirect dependencies from core qemu. The number of shared libraries for qemu-system-x86_64 goes down from 73 to 66 on my system. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id:

[PULL 13/14] opengl: build egl-headless display modular

2020-10-21 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-14-kra...@redhat.com --- ui/meson.build | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/meson.build b/ui/meson.build index 509739709ef2..537e5e067358 100644 ---

[PULL 03/14] spice: move qemu_spice_init() to QemuSpiceOps.

2020-10-21 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-4-kra...@redhat.com --- include/ui/qemu-spice-module.h | 1 + include/ui/qemu-spice.h| 5 - softmmu/vl.c | 2 +- ui/spice-core.c| 3 ++- ui/spice-module.c

[PULL 06/14] spice: move auth functions to QemuSpiceOps.

2020-10-21 Thread Gerd Hoffmann
Move qemu_spice_set_passwd() and qemu_spice_set_pw_expire() functions to QemuSpiceOps. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-7-kra...@redhat.com --- include/ui/qemu-spice-module.h | 3 +++ include/ui/qemu-spice.h| 14

[PULL 09/14] spice: load module when enabled on the cmdline

2020-10-21 Thread Gerd Hoffmann
In case the spice opts are not registered, try loading the spice module. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-10-kra...@redhat.com --- softmmu/vl.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/softmmu/vl.c

[PULL 01/14] spice: add module helpers

2020-10-21 Thread Gerd Hoffmann
Add new spice-module.c + qemu-spice-module.h files. The code needed to support modular spice will be there. For starters this will be only the using_spice variable, more will follow ... Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id:

[PULL 00/14] Modules 20201022 patches

2020-10-21 Thread Gerd Hoffmann
The following changes since commit 4c41341af76cfc85b5a6c0f87de4838672ab9f89: Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20201020' into staging (2020-10-20 11:20:36 +0100) are available in the Git repository at: git://git.kraxel.org/qemu tags/modules-20201022-pull-request

[PULL 11/14] modules: add spice dependencies

2020-10-21 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-12-kra...@redhat.com --- util/module.c | 5 + 1 file changed, 5 insertions(+) diff --git a/util/module.c b/util/module.c index 0c0f258923dc..21237dcc24df 100644 --- a/util/module.c +++

[PULL 02/14] spice: add QemuSpiceOps, move migrate_info

2020-10-21 Thread Gerd Hoffmann
Add QemuSpiceOps struct. This struct holds function pointers to the spice functions. It will be initialized with pointers to the stub functions. When spice gets initialized the function pointers will be re-written to the real functions. The spice stubs will move from qemu-spice.h to

[PULL 08/14] spice: wire up monitor in QemuSpiceOps.

2020-10-21 Thread Gerd Hoffmann
Rename qmp_query_spice() to qmp_query_spice_real(), add to QemuSpiceOps. Add new qmp_query_spice() function which calls the real function via QemuSpiceOps if available, otherwise return SpiceInfo.enabled = false. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id:

[PULL 04/14] spice: move display_init() to QemuSpiceOps.

2020-10-21 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201019075224.14803-5-kra...@redhat.com --- include/ui/qemu-spice-module.h | 1 + include/ui/qemu-spice.h| 7 --- softmmu/vl.c | 2 +- ui/spice-core.c| 1 + ui/spice-module.c

Re: [PATCH 03/22] machine: move UP defaults to class_base_init

2020-10-21 Thread Thomas Huth
On 21/10/2020 22.56, Paolo Bonzini wrote: > Clean up vl.c, default min/max/default_cpus to uniprocessor > directly in the QOM class initialization code. > > Signed-off-by: Paolo Bonzini > --- > hw/core/machine.c | 6 +- > softmmu/vl.c | 5 - > 2 files changed, 5 insertions(+), 6

Re: [PATCH 02/22] machine: remove deprecated -machine enforce-config-section option

2020-10-21 Thread Thomas Huth
On 21/10/2020 22.56, Paolo Bonzini wrote: > Deprecated since 3.1 and complicates the initialization sequence, > remove it. > > Signed-off-by: Paolo Bonzini > --- > docs/system/deprecated.rst | 12 ++-- > hw/core/machine.c | 24 +--- > include/hw/boards.h

Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset

2020-10-21 Thread Markus Armbruster
Eduardo Habkost writes: > On Wed, Oct 21, 2020 at 02:24:08PM +0200, Igor Mammedov wrote: >> On Fri, 9 Oct 2020 12:01:13 -0400 >> Eduardo Habkost wrote: >> >> > The existing object_class_property_add_uint*_ptr() functions are >> > not very useful, because they need a pointer to the property >>

Re: [PATCH v1 4/6] gitlab: skip checkpatch.pl checks if no commit delta on branch

2020-10-21 Thread Thomas Huth
On 21/10/2020 18.31, Alex Bennée wrote: > From: Daniel P. Berrangé > > If the current branch is synced to the current upstream git master, > there are no commits that need checking. This causes checkpatch.pl > to print an error that it found no commits. We need to avoid calling > checkpatch.pl

Re: [PATCH 1/5] pc-dimm: Drop @errp argument of pc_dimm_plug()

2020-10-21 Thread David Gibson
On Mon, Oct 19, 2020 at 10:48:04AM +0200, Greg Kurz wrote: > pc_dimm_plug() doesn't use it. It only aborts on error. > > Drop @errp and adapt the callers accordingly. > > Signed-off-by: Greg Kurz Reviewed-by: David Gibson ppc parts Acked-by: David Gibson > --- > hw/arm/virt.c|

Re: [PATCH 0/5] spapr: Error handling fixes and cleanups (round 3)

2020-10-21 Thread David Gibson
On Mon, Oct 19, 2020 at 10:47:52AM +0200, Greg Kurz wrote: > Hi, > > This is a followup to a previous cleanup for the sPAPR code: > > https://lists.gnu.org/archive/html/qemu-devel/2020-09/msg04860.html > > The last two patches had to be dropped because they were wrongly assuming > that

Re: [PATCH 2/5] spapr: Use appropriate getter for PC_DIMM_ADDR_PROP

2020-10-21 Thread David Gibson
On Mon, Oct 19, 2020 at 10:48:16AM +0200, Greg Kurz wrote: > The PC_DIMM_ADDR_PROP property is defined as: > > DEFINE_PROP_UINT64(PC_DIMM_ADDR_PROP, PCDIMMDevice, addr, 0), > > Use object_property_get_uint() instead of object_property_get_int(). > > Signed-off-by: Greg Kurz Acked-by:

Re: [PATCH v2 0/5] spapr: Fix and cleanups for sPAPR CPU core

2020-10-21 Thread David Gibson
On Thu, Oct 15, 2020 at 11:18:18PM +0200, Greg Kurz wrote: > While reading the code _again_ I spotted a memory leak and I realized > that the realize/unrealize paths are uselessly complex and not really > symmetrical. > > This series fixes the leak and re-shuffles the code to make it cleaner. >

Re: [PATCH 3/5] spapr: Use appropriate getter for PC_DIMM_SLOT_PROP

2020-10-21 Thread David Gibson
On Mon, Oct 19, 2020 at 10:48:27AM +0200, Greg Kurz wrote: > The PC_DIMM_SLOT_PROP property is defined as: > > DEFINE_PROP_INT32(PC_DIMM_SLOT_PROP, PCDIMMDevice, slot, > PC_DIMM_UNASSIGNED_SLOT), > > Use object_property_get_int() instead of object_property_get_uint(). >

[PATCH v6] sev: add sev-inject-launch-secret

2020-10-21 Thread tobin
From: Tobin Feldman-Fitzthum AMD SEV allows a guest owner to inject a secret blob into the memory of a virtual machine. The secret is encrypted with the SEV Transport Encryption Key and integrity is guaranteed with the Transport Integrity Key. Although QEMU facilitates the injection of the

Re: 答复: [PATCH 1/1] Skip flatview_simplify() for cpu vendor zhaoxin

2020-10-21 Thread Paolo Bonzini
On 22/10/20 05:02, FelixCui-oc wrote: > In addition, before write pam registers, flatview_simplify() has merged > a very large range.For example, > > this large range is 0xc-0xbfff. So even if EHCI is configured to > not allocate buffers in low memory, > > this bug will still

答复: [PATCH 1/1] Skip flatview_simplify() for cpu vendor zhaoxin

2020-10-21 Thread FelixCui-oc
hi , >I assume it's the BIOS's driver and it's choosing a range in low memory, >but still I'm not sure why its DMA is racing against the PAM update >(which is done very early). Felix, do you know the answer? This bug is triggered by make_bios_readonly() in seabios. Make_bios_readonly() will

Re: [PATCH v3 1/2] hw/block/nvme: add dulbe support

2020-10-21 Thread Keith Busch
On Thu, Oct 22, 2020 at 12:17:35AM +0200, Klaus Jensen wrote: > +for (int i = 1; i <= n->num_namespaces; i++) { You can call me old-school, but I don't think C should have allowed mixed declarations with code.

Re: [PATCH] WHPX: Fix WHPX build break

2020-10-21 Thread Paolo Bonzini
On 22/10/20 02:27, Sunil Muthuswamy wrote: > With upstream commit#8a19980e3fc4, logic was introduced to only > allow WHPX build on x64. But, the logic checks for the cpu family > and not the cpu. On my fedora container build, the cpu family is > x86 and the cpu is x86_64. Fixing the build break by

Re: [PATCH v3 2/2] hw/block/nvme: add the dataset management command

2020-10-21 Thread Keith Busch
On Thu, Oct 22, 2020 at 12:17:36AM +0200, Klaus Jensen wrote: > +static void nvme_aio_discard_cb(void *opaque, int ret) > +{ > +NvmeRequest *req = opaque; > +int *discards = req->opaque; > + > +trace_pci_nvme_aio_discard_cb(nvme_cid(req)); > + > +if (ret) { > +req->status =

Re: [PATCH v3 1/2] hw/block/nvme: add dulbe support

2020-10-21 Thread Keith Busch
On Thu, Oct 22, 2020 at 12:17:35AM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > Add support for reporting the Deallocated or Unwritten Logical Block > Error (DULBE). > > Rely on the block status flags reported by the block layer and consider > any block with the BDRV_BLOCK_ZERO flag to

[PATCH] WHPX: Fix WHPX build break

2020-10-21 Thread Sunil Muthuswamy
With upstream commit#8a19980e3fc4, logic was introduced to only allow WHPX build on x64. But, the logic checks for the cpu family and not the cpu. On my fedora container build, the cpu family is x86 and the cpu is x86_64. Fixing the build break by checking for the cpu, instead of the cpu family.

[Bug 1900918] Re: PXB devices

2020-10-21 Thread bwidawsk
*** This bug is a duplicate of bug 1900919 *** https://bugs.launchpad.net/bugs/1900919 I accidentally double submitted this, and this one has the wrong description. Please close and use #1900919 instead. ** This bug has been marked a duplicate of bug 1900919 PXB selected as root bus

RE: [PATCH v7 05/11] hw/block/nvme: Support Zoned Namespace Command Set

2020-10-21 Thread Dmitry Fomichev
> -Original Message- > From: Klaus Jensen > Sent: Wednesday, October 21, 2020 6:26 AM > To: Dmitry Fomichev > Cc: Keith Busch ; Klaus Jensen > ; Kevin Wolf ; Philippe > Mathieu-Daudé ; Maxim Levitsky > ; Fam Zheng ; Niklas Cassel > ; Damien Le Moal ; > qemu-bl...@nongnu.org;

[Bug 1900919] [NEW] PXB selected as root bus incorrectly

2020-10-21 Thread bwidawsk
Public bug reported: release: 4c41341af76cfc85b5a6c0f87de4838672ab9f89 qdev_device_add() will search for the "closest" bus possible, and bail out early if that bus is a root bus. pxb devices are considered root buses and so if you either 1. Add a PCI device on the QEMU command line *after* a

[PATCH v3 2/2] hw/block/nvme: add the dataset management command

2020-10-21 Thread Klaus Jensen
From: Klaus Jensen Add support for the Dataset Management command and the Deallocate attribute. Deallocation results in discards being sent to the underlying block device. Whether of not the blocks are actually deallocated is affected by the same factors as Write Zeroes (see previous commit).

[Bug 1900918] [NEW] PXB devices

2020-10-21 Thread bwidawsk
Public bug reported: release: 4c41341af76cfc85b5a6c0f87de4838672ab9f89 qdev_device_add() will search for the "closest" bus possible, and bail out early if that bus is a root bus. pxb devices are considered root buses and so if you either 1. Add a PCI device on the QEMU command line *after* a

[PATCH v3 0/2] hw/block/nvme: dulbe and dsm support

2020-10-21 Thread Klaus Jensen
From: Klaus Jensen This adds support for the Deallocated or Unwritten Logical Block error recovery feature as well as the Dataset Management command. I wanted to add support for the NPDG and NPDA fields such that the host could get a hint on how many blocks to request deallocation of for the

[PATCH v3 1/2] hw/block/nvme: add dulbe support

2020-10-21 Thread Klaus Jensen
From: Klaus Jensen Add support for reporting the Deallocated or Unwritten Logical Block Error (DULBE). Rely on the block status flags reported by the block layer and consider any block with the BDRV_BLOCK_ZERO flag to be deallocated. Multiple factors affect when a Write Zeroes command result

[PATCH v2 4/5] hw/arm/npcm7xx: Add EHCI and OHCI controllers

2020-10-21 Thread Havard Skinnemoen via
The NPCM730 and NPCM750 chips have a single USB host port shared between a USB 2.0 EHCI host controller and a USB 1.1 OHCI host controller. This adds support for both of them. Testing notes: * With -device usb-kbd, qemu will automatically insert a full-speed hub, and the keyboard becomes

[PATCH v6 2/6] migration: Introduce migrate_send_rp_message_req_pages()

2020-10-21 Thread Peter Xu
This is another layer wrapper for sending a page request to the source VM. The new migrate_send_rp_message_req_pages() will be used elsewhere in coming patches. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/migration.c | 10 -- migration/migration.h | 2 ++

[PATCH v6 0/6] migration/postcopy: Sync faulted addresses after network recovered

2020-10-21 Thread Peter Xu
v6: - fix page mask to use ramblock psize [Dave] v5: - added one test patch for easier debugging for migration-test - added one fix patch [1] for another postcopy race - fixed a bug that could trigger when host/guest page size differs v4: - use "void */ulong" instead of "uint64_t" where proper

[PATCH v2 5/5] hw/gpio: Add GPIO model for Nuvoton NPCM7xx

2020-10-21 Thread Havard Skinnemoen via
The NPCM7xx chips have multiple GPIO controllers that are mostly identical except for some minor differences like the reset values of some registers. Each controller controls up to 32 pins. Each individual pin is modeled as a pair of unnamed GPIOs -- one for emitting the actual pin state, and one

[PATCH v2 3/5] hw/misc: Add npcm7xx random number generator

2020-10-21 Thread Havard Skinnemoen via
The RNG module returns a byte of randomness when the Data Valid bit is set. This implementation ignores the prescaler setting, and loads a new value into RNGD every time RNGCS is read while the RNG is enabled and random data is available. A qtest featuring some simple randomness tests is

[PATCH v6 16/16] scripts/oss-fuzz: remove the generic-fuzz target

2020-10-21 Thread Alexander Bulekov
generic-fuzz is not a standalone fuzzer - it requires some env variables to be set. On oss-fuzz, we set these with some predefined generic-fuzz-{...} targets, that are thin wrappers around generic-fuzz. Remove generic-fuzz from the oss-fuzz build, so oss-fuzz does not treat it as a standalone

[PATCH v2 1/5] Move npcm7xx_timer_reached_zero call out of npcm7xx_timer_pause

2020-10-21 Thread Havard Skinnemoen via
This allows us to reuse npcm7xx_timer_pause for the watchdog timer. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Havard Skinnemoen --- hw/timer/npcm7xx_timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/timer/npcm7xx_timer.c b/hw/timer/npcm7xx_timer.c

[PATCH v2 2/5] hw/timer: Adding watchdog for NPCM7XX Timer.

2020-10-21 Thread Havard Skinnemoen via
From: Hao Wu The watchdog is part of NPCM7XX's timer module. Its behavior is controlled by the WTCR register in the timer. When enabled, the watchdog issues an interrupt signal after a pre-set amount of cycles, and issues a reset signal shortly after that. Reviewed-by: Tyrone Ting

[PATCH v6 14/16] fuzz: add generic-fuzz configs for oss-fuzz

2020-10-21 Thread Alexander Bulekov
Predefine some generic-fuzz configs. For each of these, we will create a separate FuzzTarget that can be selected through argv0 and, therefore, fuzzed on oss-fuzz. Signed-off-by: Alexander Bulekov --- tests/qtest/fuzz/generic_fuzz_configs.h | 121 1 file changed, 121

[PATCH v6 6/6] migration-test: Only hide error if !QTEST_LOG

2020-10-21 Thread Peter Xu
The errors are very useful when debugging qtest failures, especially when QTEST_LOG=1 is set. Let's allow override MigrateStart.hide_stderr when QTEST_LOG=1 is specified, because that means the user wants to be verbose. Not very nice to introduce the first QTEST_LOG env access in

[PATCH v2 0/5] Additional NPCM7xx features, devices and tests

2020-10-21 Thread Havard Skinnemoen via
This is an update to the initial NPCM7xx patch series adding - Watchdog timer support. This makes the reboot command work. - Random Number Generator device. - USB Host Controllers. - GPIO Controllers. The watchdog was implemented by my new teammate Hao Wu. Expect to see more patches from

[PATCH v6 12/16] fuzz: Add instructions for using generic-fuzz

2020-10-21 Thread Alexander Bulekov
Reviewed-by: Darren Kenny Signed-off-by: Alexander Bulekov --- docs/devel/fuzzing.txt | 39 +++ 1 file changed, 39 insertions(+) diff --git a/docs/devel/fuzzing.txt b/docs/devel/fuzzing.txt index 96d71c94d7..03585c1a9b 100644 --- a/docs/devel/fuzzing.txt +++

[PATCH v6 4/6] migration: Sync requested pages after postcopy recovery

2020-10-21 Thread Peter Xu
We synchronize the requested pages right after a postcopy recovery happens. This helps to synchronize the prioritized pages on source so that the faulted threads can be served faster. Reported-by: Xiaohui Li Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/savevm.c

[PATCH v6 5/6] migration/postcopy: Release fd before going into 'postcopy-pause'

2020-10-21 Thread Peter Xu
Logically below race could trigger with the old code: test programmigration thread wait_until('postcopy-pause') postcopy_pause()

[PATCH v6 3/6] migration: Maintain postcopy faulted addresses

2020-10-21 Thread Peter Xu
Maintain a list of faulted addresses on the destination host for which we're waiting on. This is implemented using a GTree rather than a real list to make sure even there're plenty of vCPUs/threads that are faulting, the lookup will still be fast with O(log(N)) (because we'll do that after

[PATCH v6 08/16] fuzz: add a DISABLE_PCI op to generic-fuzzer

2020-10-21 Thread Alexander Bulekov
This new operation is used in the next commit, which concatenates two fuzzer-generated inputs. With this operation, we can prevent the second input from clobbering the PCI configuration performed by the first. Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny ---

[PATCH v6 1/6] migration: Pass incoming state into qemu_ufd_copy_ioctl()

2020-10-21 Thread Peter Xu
It'll be used in follow up patches to access more fields out of it. Meanwhile fetch the userfaultfd inside the function. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git

[PATCH v6 06/16] fuzz: Add fuzzer callbacks to DMA-read functions

2020-10-21 Thread Alexander Bulekov
We should be careful to not call any functions besides fuzz_dma_read_cb. Without --enable-fuzzing, fuzz_dma_read_cb is an empty inlined function. Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny --- include/exec/memory.h | 1 + include/exec/memory_ldst_cached.h.inc |

[PATCH v6 15/16] fuzz: register predefined generic-fuzz configs

2020-10-21 Thread Alexander Bulekov
We call get_generic_fuzz_configs, which fills an array with predefined {name, args, objects} triples. For each of these, we add a new FuzzTarget, that uses a small wrapper to set QEMU_FUZZ_{ARGS,OBJECTS} to the corresponding predefined values. Signed-off-by: Alexander Bulekov ---

[PATCH v6 10/16] scripts/oss-fuzz: Add script to reorder a generic-fuzzer trace

2020-10-21 Thread Alexander Bulekov
The generic-fuzzer uses hooks to fulfill DMA requests just-in-time. This means that if we try to use QTEST_LOG=1 to build a reproducer, the DMA writes will be logged _after_ the in/out/read/write that triggered the DMA read. To work work around this, the generic-fuzzer annotates these just-in time

[PATCH v6 09/16] fuzz: add a crossover function to generic-fuzzer

2020-10-21 Thread Alexander Bulekov
Reviewed-by: Darren Kenny Signed-off-by: Alexander Bulekov --- tests/qtest/fuzz/generic_fuzz.c | 86 + 1 file changed, 86 insertions(+) diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c index fb8bf4a112..f739937827 100644 ---

[PATCH v6 02/16] fuzz: Add generic virtual-device fuzzer

2020-10-21 Thread Alexander Bulekov
This is a generic fuzzer designed to fuzz a virtual device's MemoryRegions, as long as they exist within the Memory or Port IO (if it exists) AddressSpaces. The fuzzer's input is interpreted into a sequence of qtest commands (outb, readw, etc). The interpreted commands are separated by a magic

[PATCH v6 13/16] fuzz: add an "opaque" to the FuzzTarget struct

2020-10-21 Thread Alexander Bulekov
It can be useful to register FuzzTargets that have nearly-identical initialization handlers (e.g. for using the same fuzzing code, with different configuration options). Add an opaque pointer to the FuzzTarget struct, so that FuzzTargets can hold some data, useful for storing target-specific

[PATCH v6 05/16] fuzz: Declare DMA Read callback function

2020-10-21 Thread Alexander Bulekov
This patch declares the fuzz_dma_read_cb function and uses the preprocessor and linker(weak symbols) to handle these cases: When we build softmmu/all with --enable-fuzzing, there should be no strong symbol defined for fuzz_dma_read_cb, and we link against a weak stub function. When we build

[PATCH v6 00/16] Add a Generic Virtual Device Fuzzer

2020-10-21 Thread Alexander Bulekov
v6: - Some More "General" -> "Generic" - Fix broken build between commits (build-tested after each commit and through gitlab CI) - Fix some predefined generic-fuzz configs that failed to run v5: - Replace GArray-based predefined fuzzer configs with a static struct array

[PATCH v6 07/16] fuzz: Add support for custom crossover functions

2020-10-21 Thread Alexander Bulekov
libfuzzer supports a "custom crossover function". Libfuzzer often tries to blend two inputs to create a new interesting input. Sometimes, we have a better idea about how to blend inputs together. This change allows fuzzers to specify a custom function for blending two inputs together.

[PATCH v6 11/16] scripts/oss-fuzz: Add crash trace minimization script

2020-10-21 Thread Alexander Bulekov
Once we find a crash, we can convert it into a QTest trace. Usually this trace will contain many operations that are unneeded to reproduce the crash. This script tries to minimize the crashing trace, by removing operations and trimming QTest bufwrite(write addr len data...) commands.

[PATCH v6 01/16] memory: Add FlatView foreach function

2020-10-21 Thread Alexander Bulekov
Acked-by: Paolo Bonzini Signed-off-by: Alexander Bulekov --- include/exec/memory.h | 5 + softmmu/memory.c | 9 + 2 files changed, 14 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 622207bde1..042918dd16 100644 --- a/include/exec/memory.h +++

[PATCH 12/22] vl: move bios_name out of softmmu/vl.c

2020-10-21 Thread Paolo Bonzini
bios_name is a legacy variable used by machine code. Hide it from softmmu/vl.c. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 5 + softmmu/vl.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index

[PATCH 21/22] vl: separate qemu_create_early_backends

2020-10-21 Thread Paolo Bonzini
"Early" backends are created before the machine and can be used as machine options. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 123 +++ 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index

[PATCH 13/22] vl: extract various command line validation snippets to a new function

2020-10-21 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 78 ++-- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index e32e209a82..f8b1ffb46e 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -123,6 +123,7 @@

[PATCH v6 03/16] fuzz: Add PCI features to the generic fuzzer

2020-10-21 Thread Alexander Bulekov
This patch compares TYPE_PCI_DEVICE objects against the user-provided matching pattern. If there is a match, we use some hacks and leverage QOS to map each possible BAR for that device. Now fuzzed inputs might be converted to pci_read/write commands which target specific. This means that we can

[PATCH 10/22] vl: extract qemu_init_subsystems

2020-10-21 Thread Paolo Bonzini
Group a bunch of subsystem initializations that can be done right after command line parsing. Remove initializations that can be done simply as global variable initializers. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 94 1 file changed,

[PATCH 19/22] vl: extract default devices to separate functions

2020-10-21 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 216 +++ 1 file changed, 114 insertions(+), 102 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index e58572dbd8..0a6f47e7d6 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -125,7 +125,9 @@

[PATCH 11/22] vl: move prelaunch part of qemu_init to a new function

2020-10-21 Thread Paolo Bonzini
The final part of qemu_init, starting with the completion of board init, is already relatively clean. Split it out of qemu_init so that qemu_init keeps only the messy parts. Signed-off-by: Paolo Bonzini --- include/sysemu/sysemu.h | 1 + softmmu/vl.c| 238

[PATCH 16/22] vl: create "-net nic -net user" default earlier

2020-10-21 Thread Paolo Bonzini
Create it together with other default backends, even though the processing is done later. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 122bf1821b..8577667b8f 100644 ---

[PATCH v6 04/16] fuzz: Add DMA support to the generic-fuzzer

2020-10-21 Thread Alexander Bulekov
When a virtual-device tries to access some buffer in memory over DMA, we add call-backs into the fuzzer(next commit). The fuzzer checks verifies that the DMA request maps to a physical RAM address and fills the memory with fuzzer-provided data. The patterns that we use to fill this memory are

[PATCH 18/22] vl: move semihosting command line fallback to qemu_finish_machine_init

2020-10-21 Thread Paolo Bonzini
Move more sane parts of the huge qemu_init function out of it. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 75e57133ad..e58572dbd8 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@

[PATCH 08/22] vl: split various early command line options to a separate function

2020-10-21 Thread Paolo Bonzini
Various options affect the global state of QEMU including the rest of qemu_init, and they need to be called very early. Group them together in a function that is called at the beginning. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 202 --- 1

[PATCH 22/22] vl: separate qemu_create_late_backends

2020-10-21 Thread Paolo Bonzini
"Late" backends are created after the machine. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 64 ++-- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 866df5bb7c..f36ec16cad 100644 ---

[PATCH 15/22] vl: extract various command line desugaring snippets to a new function

2020-10-21 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 39 +-- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 3607cd4357..122bf1821b 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -126,6 +126,7 @@ static const char

[PATCH 09/22] vl: move various initialization routines out of qemu_init

2020-10-21 Thread Paolo Bonzini
Some very simple initialization routines can be nested in existing subsystem-level functions, do that to simplify qemu_init. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 3 +++ include/hw/qdev-core.h | 8 migration/migration.c | 4 softmmu/qdev-monitor.c | 6 --

[PATCH 14/22] vl: preconfig and loadvm are mutually exclusive

2020-10-21 Thread Paolo Bonzini
Just like -incoming. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index f8b1ffb46e..3607cd4357 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -124,6 +124,7 @@ static const char *mem_path;

[PATCH 07/22] trace: remove argument from trace_init_file

2020-10-21 Thread Paolo Bonzini
It is not needed, all the callers are just saving what was retrieved from -trace and trace_init_file can retrieve it on its own. Signed-off-by: Paolo Bonzini --- bsd-user/main.c | 6 ++ linux-user/main.c| 6 ++ qemu-img.c

[PATCH 17/22] vl: load plugins as late as possible

2020-10-21 Thread Paolo Bonzini
There is no need to load plugins in the middle of default device processing, move -plugin handling just before preconfig is entered. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c

[PATCH 20/22] vl: move CHECKPOINT_INIT after preconfig

2020-10-21 Thread Paolo Bonzini
Move CHECKPOINT_INIT right before the machine initialization is completed. Everything before is essentially an extension of command line parsing. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/softmmu/vl.c

[PATCH 05/22] vl: extract validation of -smp to machine.c

2020-10-21 Thread Paolo Bonzini
Once smp_parse is done, the validation operates on the MachineState. There is no reason for that code to be in vl.c. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 23 +++ include/hw/boards.h | 1 + softmmu/vl.c| 20 ++-- 3 files changed, 26

[PATCH 04/22] machine: move SMP initialization from vl.c

2020-10-21 Thread Paolo Bonzini
Initialize the object's values from the class when the object is created, no need to have vl.c do it for us. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 7 +++ softmmu/vl.c | 7 --- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/core/machine.c

[PATCH 02/22] machine: remove deprecated -machine enforce-config-section option

2020-10-21 Thread Paolo Bonzini
Deprecated since 3.1 and complicates the initialization sequence, remove it. Signed-off-by: Paolo Bonzini --- docs/system/deprecated.rst | 12 ++-- hw/core/machine.c | 24 +--- include/hw/boards.h| 1 - migration/migration.c | 10 --

[PATCH 01/22] semihosting: fix order of initialization functions

2020-10-21 Thread Paolo Bonzini
qemu_semihosting_console_init uses semihosting.chardev which is set by qemu_semihosting_connect_chardevs. Thus qemu_semihosting_connect_chardevs has to be called first. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git

[RFC PATCH 00/22] cleanup qemu_init and make sense of command line processing

2020-10-21 Thread Paolo Bonzini
This series cleans up qemu_init, grouping together code that does a similar function. In particular: * generic initialization of various subsystemd is placed in separate functions * code that was randomly placed in vl.c is moved to machine.c * early options that affect the whole program are

[PATCH 03/22] machine: move UP defaults to class_base_init

2020-10-21 Thread Paolo Bonzini
Clean up vl.c, default min/max/default_cpus to uniprocessor directly in the QOM class initialization code. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 6 +- softmmu/vl.c | 5 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/core/machine.c

[PATCH 06/22] vl: remove bogus check

2020-10-21 Thread Paolo Bonzini
There is no reason to prevent -preconfig -daemonize. Of course if no monitor is defined there will be no way to start the VM, but that is a user error. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index

  1   2   3   4   >