]> Git Repo - qemu.git/log
qemu.git
5 years agoppc/spapr: Use proper HPTE accessors for H_READ
Benjamin Herrenschmidt [Thu, 11 Apr 2019 08:00:00 +0000 (10:00 +0200)]
ppc/spapr: Use proper HPTE accessors for H_READ

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Message-Id: <20190411080004[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agotarget/ppc: Don't check UPRT in radix mode when in HV real mode
Benjamin Herrenschmidt [Thu, 11 Apr 2019 07:59:59 +0000 (09:59 +0200)]
target/ppc: Don't check UPRT in radix mode when in HV real mode

It appears that during kexec, we run for a while in hypervisor
real mode with LPCR:HR set and LPCR:UPRT clear, which trips
the assertion in ppc_radix64_handle_mmu_fault().

First this shouldn't be an assertion, it's a guest error.

Then we shouldn't be checking these things in hypervisor real
mode (or in virtual hypervisor guest real mode which is similar)
as the real HW won't use those LPCR bits in those cases anyway,
so technically it's ok to have this discrepancy.

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Message-Id: <20190411080004[email protected]>
[dwg: Fix for 32-bit builds]
Signed-off-by: David Gibson <[email protected]>
5 years agotarget/ppc/kvm: Convert DPRINTF to traces
Greg Kurz [Fri, 5 Apr 2019 08:05:24 +0000 (10:05 +0200)]
target/ppc/kvm: Convert DPRINTF to traces

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <155445152490.302073.17033451726459859333[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agotarget/ppc/trace-events: Fix trivial typo
Greg Kurz [Fri, 5 Apr 2019 08:05:19 +0000 (10:05 +0200)]
target/ppc/trace-events: Fix trivial typo

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <155445151931.302073.18436485925081597460[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agospapr: Drop duplicate PCI swizzle code
Greg Kurz [Fri, 5 Apr 2019 16:30:48 +0000 (18:30 +0200)]
spapr: Drop duplicate PCI swizzle code

LSI mapping in spapr currently open-codes standard PCI swizzling. It thus
duplicates the code of pci_swizzle_map_irq_fn().

Expose the swizzling formula so that it can be used with a slot number
when building the device tree. Simply drop pci_spapr_map_irq() and call
pci_swizzle_map_irq_fn() instead.

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <155448184841.8446.13959787238854054119[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agospapr_pci: Get rid of duplicate code for node name creation
Greg Kurz [Fri, 5 Apr 2019 16:30:43 +0000 (18:30 +0200)]
spapr_pci: Get rid of duplicate code for node name creation

According to the changelog of 298a971024534, SpaprPhbState::dtbusname was
introduced to "make it easier to relate the guest and qemu views of memory
to each other", hence its name.

Use it when creating the PHB node to avoid code duplication.

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <155448184292.8446.8225650773162648595[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agotarget/ppc: Style fixes for translate/spe-impl.inc.c
David Gibson [Thu, 21 Mar 2019 12:46:54 +0000 (23:46 +1100)]
target/ppc: Style fixes for translate/spe-impl.inc.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for translate/vmx-impl.inc.c
David Gibson [Thu, 21 Mar 2019 12:47:02 +0000 (23:47 +1100)]
target/ppc: Style fixes for translate/vmx-impl.inc.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for translate/vsx-impl.inc.c
David Gibson [Thu, 21 Mar 2019 12:47:10 +0000 (23:47 +1100)]
target/ppc: Style fixes for translate/vsx-impl.inc.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for translate/fp-impl.inc.c
David Gibson [Thu, 21 Mar 2019 12:39:46 +0000 (23:39 +1100)]
target/ppc: Style fixes for translate/fp-impl.inc.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for translate.c
David Gibson [Thu, 21 Mar 2019 11:57:28 +0000 (22:57 +1100)]
target/ppc: Style fixes for translate.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for translate_init.inc.c
David Gibson [Thu, 21 Mar 2019 11:45:46 +0000 (22:45 +1100)]
target/ppc: Style fixes for translate_init.inc.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for monitor.c
David Gibson [Thu, 21 Mar 2019 11:43:09 +0000 (22:43 +1100)]
target/ppc: Style fixes for monitor.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for mmu_helper.c
David Gibson [Thu, 21 Mar 2019 11:36:09 +0000 (22:36 +1100)]
target/ppc: Style fixes for mmu_helper.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for mmu-hash64.[ch]
David Gibson [Thu, 21 Mar 2019 11:32:53 +0000 (22:32 +1100)]
target/ppc: Style fixes for mmu-hash64.[ch]

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for mmu-hash32.[ch]
David Gibson [Thu, 21 Mar 2019 11:29:06 +0000 (22:29 +1100)]
target/ppc: Style fixes for mmu-hash32.[ch]

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for misc_helper.c
David Gibson [Thu, 21 Mar 2019 11:27:42 +0000 (22:27 +1100)]
target/ppc: Style fixes for misc_helper.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for mfrom_table.inc.c & mfrom_table_gen.c
David Gibson [Thu, 21 Mar 2019 11:25:50 +0000 (22:25 +1100)]
target/ppc: Style fixes for mfrom_table.inc.c & mfrom_table_gen.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for mem_helper.c
David Gibson [Thu, 21 Mar 2019 11:22:13 +0000 (22:22 +1100)]
target/ppc: Style fixes for mem_helper.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for machine.c
David Gibson [Thu, 21 Mar 2019 11:10:19 +0000 (22:10 +1100)]
target/ppc: Style fixes for machine.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for kvm_ppc.h and kvm.c
David Gibson [Thu, 21 Mar 2019 10:47:25 +0000 (21:47 +1100)]
target/ppc: Style fixes for kvm_ppc.h and kvm.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for helper_regs.h
David Gibson [Thu, 21 Mar 2019 10:41:17 +0000 (21:41 +1100)]
target/ppc: Style fixes for helper_regs.h

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for gdbstub.c
David Gibson [Thu, 21 Mar 2019 10:31:45 +0000 (21:31 +1100)]
target/ppc: Style fixes for gdbstub.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for excp_helper.c
David Gibson [Thu, 21 Mar 2019 10:20:28 +0000 (21:20 +1100)]
target/ppc: Style fixes for excp_helper.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for dfp_helper.c
David Gibson [Thu, 21 Mar 2019 06:08:17 +0000 (17:08 +1100)]
target/ppc: Style fixes for dfp_helper.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for fpu_helper.c
David Gibson [Thu, 21 Mar 2019 06:01:06 +0000 (17:01 +1100)]
target/ppc: Style fixes for fpu_helper.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for int_helper.c
David Gibson [Thu, 21 Mar 2019 05:50:18 +0000 (16:50 +1100)]
target/ppc: Style fixes for int_helper.c

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for cpu.[ch]
David Gibson [Thu, 21 Mar 2019 05:29:36 +0000 (16:29 +1100)]
target/ppc: Style fixes for cpu.[ch]

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agotarget/ppc: Style fixes for ppc-models.[ch]
David Gibson [Thu, 21 Mar 2019 05:25:02 +0000 (16:25 +1100)]
target/ppc: Style fixes for ppc-models.[ch]

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
5 years agospapr/irq: remove spapr_ics_create()
Cédric Le Goater [Thu, 21 Mar 2019 14:49:11 +0000 (15:49 +0100)]
spapr/irq: remove spapr_ics_create()

spapr_ics_create() is only called once. Merge it in spapr_irq_init_xics()
and simplify a bit the error handling by using 'error_fatal' .

Signed-off-by: Cédric Le Goater <[email protected]>
Message-Id: <20190321144914[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agospapr/rtas: modify spapr_rtas_register() to remove RTAS handlers
Cédric Le Goater [Thu, 21 Mar 2019 14:49:07 +0000 (15:49 +0100)]
spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers

Removing RTAS handlers will become necessary when the new pseries
machine supporting multiple interrupt mode is introduced.

Signed-off-by: Cédric Le Goater <[email protected]>
Message-Id: <20190321144914[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agohw/ppc/prep: Drop useless inclusion of "hw/input/i8042.h"
Philippe Mathieu-Daudé [Sat, 16 Mar 2019 20:15:28 +0000 (21:15 +0100)]
hw/ppc/prep: Drop useless inclusion of "hw/input/i8042.h"

In commit 47973a2dbf we split the last generic chipset out of
the PC board, but missed to remove the i8042 keyboard controller.
This omission was later fixed in commit 7cb00357c1, but here we
forgot to remove the "i8042.h" include. Do it now.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20190316201528[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agospapr: Support NVIDIA V100 GPU with NVLink2
Alexey Kardashevskiy [Tue, 12 Mar 2019 08:21:03 +0000 (19:21 +1100)]
spapr: Support NVIDIA V100 GPU with NVLink2

NVIDIA V100 GPUs have on-board RAM which is mapped into the host memory
space and accessible as normal RAM via an NVLink bus. The VFIO-PCI driver
implements special regions for such GPUs and emulates an NVLink bridge.
NVLink2-enabled POWER9 CPUs also provide address translation services
which includes an ATS shootdown (ATSD) register exported via the NVLink
bridge device.

This adds a quirk to VFIO to map the GPU memory and create an MR;
the new MR is stored in a PCI device as a QOM link. The sPAPR PCI uses
this to get the MR and map it to the system address space.
Another quirk does the same for ATSD.

This adds additional steps to sPAPR PHB setup:

1. Search for specific GPUs and NPUs, collect findings in
sPAPRPHBState::nvgpus, manage system address space mappings;

2. Add device-specific properties such as "ibm,npu", "ibm,gpu",
"memory-block", "link-speed" to advertise the NVLink2 function to
the guest;

3. Add "mmio-atsd" to vPHB to advertise the ATSD capability;

4. Add new memory blocks (with extra "linux,memory-usable" to prevent
the guest OS from accessing the new memory until it is onlined) and
npuphb# nodes representing an NPU unit for every vPHB as the GPU driver
uses it for link discovery.

This allocates space for GPU RAM and ATSD like we do for MMIOs by
adding 2 new parameters to the phb_placement() hook. Older machine types
set these to zero.

This puts new memory nodes in a separate NUMA node to as the GPU RAM
needs to be configured equally distant from any other node in the system.
Unlike the host setup which assigns numa ids from 255 downwards, this
adds new NUMA nodes after the user configures nodes or from 1 if none
were configured.

This adds requirement similar to EEH - one IOMMU group per vPHB.
The reason for this is that ATSD registers belong to a physical NPU
so they cannot invalidate translations on GPUs attached to another NPU.
It is guaranteed by the host platform as it does not mix NVLink bridges
or GPUs from different NPU in the same IOMMU group. If more than one
IOMMU group is detected on a vPHB, this disables ATSD support for that
vPHB and prints a warning.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
[aw: for vfio portions]
Acked-by: Alex Williamson <[email protected]>
Message-Id: <20190312082103[email protected]>
Signed-off-by: David Gibson <[email protected]>
5 years agoPass through cache information for TOPOEXT CPUs
Stanislav Lanci [Tue, 16 Apr 2019 12:38:33 +0000 (14:38 +0200)]
Pass through cache information for TOPOEXT CPUs

Signed-off-by: Stanislav Lanci <[email protected]>
Message-Id: <20190416123833[email protected]>
[ehabkost: removed redundant comment line]
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agoCategorize devices: iommu
Ernest Esene [Wed, 27 Mar 2019 17:05:18 +0000 (18:05 +0100)]
Categorize devices: iommu

Set category and description for iommu devices.

Signed-off-by: Ernest Esene <[email protected]>
Message-Id: <20190327170518.GA16887@erokenlabserver>
Reviewed-by: Eduardo Habkost <[email protected]>
[ehabkost: edited commit message]
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agoCategorize devices: IGD passthrough ISA bridge
Ernest Esene [Wed, 27 Mar 2019 16:53:56 +0000 (17:53 +0100)]
Categorize devices: IGD passthrough ISA bridge

Set category for the device.

Signed-off-by: Ernest Esene <[email protected]>
Message-Id: <20190327133714.GA9329@erokenlabserver>
Reviewed-by: Eduardo Habkost <[email protected]>
[ehabkost: edited commit message]
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agoi386: Add new Hygon 'Dhyana' CPU model
Pu Wen [Tue, 16 Apr 2019 12:06:13 +0000 (20:06 +0800)]
i386: Add new Hygon 'Dhyana' CPU model

Add a new base CPU model called 'Dhyana' to model processors from Hygon
Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1].
So add Hygon Dhyana support to Qemu is necessary to create Hygon's own
CPU model.

Reference:
[1] https://git.kernel.org/tip/fec98069fb72fb656304a3e52265e0c2fc9adf87

Signed-off-by: Pu Wen <[email protected]>
Message-Id: <1555416373[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agocputlb: Fix io_readx() to respect the access_type
Shahab Vahedi [Sat, 20 Apr 2019 07:22:37 +0000 (09:22 +0200)]
cputlb: Fix io_readx() to respect the access_type

This change adapts io_readx() to its input access_type. Currently
io_readx() treats any memory access as a read, although it has an
input argument "MMUAccessType access_type". This results in:

1) Calling the tlb_fill() only with MMU_DATA_LOAD
2) Considering only entry->addr_read as the tlb_addr

Buglink: https://bugs.launchpad.net/qemu/+bug/1825359
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Shahab Vahedi <[email protected]>
Message-Id: <20190420072236[email protected]>
[rth: Remove assert; fix expression formatting.]
Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg/arm: Restrict constant pool displacement to 12 bits
Richard Henderson [Thu, 25 Apr 2019 17:39:39 +0000 (10:39 -0700)]
tcg/arm: Restrict constant pool displacement to 12 bits

This will not necessarily restrict the size of the TB, since for v7
the majority of constant pool usage is for calls from the out-of-line
ldst code, which is already at the end of the TB.  But this does
allow us to save one insn per reference on the off-chance.

Signed-off-by: Richard Henderson <[email protected]>
5 years agoutil/mmap-alloc: support MAP_SYNC in qemu_ram_mmap()
Zhang Yi [Mon, 22 Apr 2019 00:48:48 +0000 (08:48 +0800)]
util/mmap-alloc: support MAP_SYNC in qemu_ram_mmap()

When a file supporting DAX is used as vNVDIMM backend, mmap it with
MAP_SYNC flag in addition which can ensure file system metadata
synced in each guest writes to the backend file, without other QEMU
actions (e.g., periodic fsync() by QEMU).

Current, We have below different possible use cases:

1. pmem=on is set, shared=on is set, MAP_SYNC supported:
   a: backend is a dax supporting file.
    - MAP_SYNC will active.
   b: backend is not a dax supporting file.
    - mmap will trigger a warning. then MAP_SYNC flag will be ignored

2. The rest of cases:
   - we will never pass the MAP_SYNC to mmap2

Signed-off-by: Haozhong Zhang <[email protected]>
Signed-off-by: Zhang Yi <[email protected]>
[ehabkost: Rebased patch to latest code on master]
Signed-off-by: Eduardo Habkost <[email protected]>
Signed-off-by: Wei Yang <[email protected]>
Tested-by: Wei Yang <[email protected]>
Message-Id: <20190422004849[email protected]>
[ehabkost: squashed documentation patch]
Message-Id: <20190422004849[email protected]>
[ehabkost: documentation fixup]
Reviewed-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Pankaj Gupta <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agolinux-headers: add linux/mman.h.
Zhang Yi [Fri, 8 Feb 2019 10:11:00 +0000 (18:11 +0800)]
linux-headers: add linux/mman.h.

Update it to 4.20-rc1

Signed-off-by: Zhang Yi <[email protected]>
Message-Id: <f9346f1816b940a4231524a84d57a2cac8466ccc.1549555521[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agoscripts/update-linux-headers: add linux/mman.h
Zhang Yi [Fri, 8 Feb 2019 10:10:49 +0000 (18:10 +0800)]
scripts/update-linux-headers: add linux/mman.h

Add linux/mman.h,asm/mman.h,asm/mman-common.h to linux-headers,
So we can use more mmap2 flags.

Signed-off-by: Zhang Yi <[email protected]>
Message-Id: <f65c78d74859f815aa9c4f97407eb33361a6672c.1549555521[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agoutil/mmap-alloc: Add a 'is_pmem' parameter to qemu_ram_mmap
Zhang Yi [Fri, 8 Feb 2019 10:10:37 +0000 (18:10 +0800)]
util/mmap-alloc: Add a 'is_pmem' parameter to qemu_ram_mmap

besides the existing 'shared' flags, we are going to add
'is_pmem' to qemu_ram_mmap(), which indicated the memory backend
file is a persist memory.

Signed-off-by: Haozhong Zhang <[email protected]>
Signed-off-by: Zhang Yi <[email protected]>
Reviewed-by: Pankaj Gupta <[email protected]>
Message-Id: <786c46862cfeb253ee0ea2f44d62ffe76edb7fa4.1549555521[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Pankaj Gupta <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agocpu: Fix crash with empty -cpu option
Eduardo Habkost [Thu, 18 Apr 2019 03:45:01 +0000 (00:45 -0300)]
cpu: Fix crash with empty -cpu option

Fix the following crash:

  $ qemu-system-x86_64 -cpu ''
  qemu-system-x86_64: qom/cpu.c:291: cpu_class_by_name: \
      Assertion `cpu_model && cc->class_by_name' failed.

Regression test script included.

Fixes: 99193d8f2ef5 ("cpu: drop unnecessary NULL check and cpu_common_class_by_name()")
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20190418034501[email protected]>
Reviewed-by: Stefano Garzarella <[email protected]>
Tested-by: Stefano Garzarella <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agocpu: Rename parse_cpu_model() to parse_cpu_option()
Eduardo Habkost [Wed, 17 Apr 2019 02:59:40 +0000 (23:59 -0300)]
cpu: Rename parse_cpu_model() to parse_cpu_option()

The "model[,option...]" string parsed by the function is not just
a CPU model.  Rename the function and its argument to indicate it
expects the full "-cpu" option to be provided.

Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20190417025944[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agovl: Simplify machine_parse()
Markus Armbruster [Fri, 5 Apr 2019 06:41:21 +0000 (14:41 +0800)]
vl: Simplify machine_parse()

Exploit that argument @name is nerver null.  Check is_help_option()
first, because that's what we do elsewhere.  If we (foolishly!)
defined a machine named "help", -machine help would now print help
instead of selecting the machine named "help".

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Wei Yang <[email protected]>
Message-Id: <20190405064121[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agovl: Clean up after previous commit
Markus Armbruster [Fri, 5 Apr 2019 06:41:20 +0000 (14:41 +0800)]
vl: Clean up after previous commit

Since the previous commit, find_machine() and find_default_machine()
don't have to deallocate on return.  This permits further
simplifications.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Wei Yang <[email protected]>
Message-Id: <20190405064121[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agovl.c: allocate TYPE_MACHINE list once during bootup
Wei Yang [Fri, 5 Apr 2019 06:41:19 +0000 (14:41 +0800)]
vl.c: allocate TYPE_MACHINE list once during bootup

Now all the functions used to select machine is local and the call flow
looks like below:

    select_machine()
        find_default_machine()
        machine_parse()
            find_machine()

All these related function will need a GSList for TYPE_MACHINE.
Currently we allocate this list each time we use it, while this is not
necessary to do so because we don't need to modify this.

This patch make the TYPE_MACHINE list allocation in select_machine and
pass this to its child for use.

Signed-off-by: Wei Yang <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Message-Id: <20190405064121[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agovl.c: make find_default_machine() local
Wei Yang [Fri, 5 Apr 2019 06:41:18 +0000 (14:41 +0800)]
vl.c: make find_default_machine() local

Function find_default_machine() is introduced by commit 2c8cffa599b7
"vl: make find_default_machine externally visible", and it was used
outside of vl.c until commit a904410af5f1 "pc_sysfw: remove the rom_only
property".

Commit a904410af5f1 "pc_sysfw: remove the rom_only property" removed the
only user of find_default_machine() outside vl.c, but neglected to make
it static. Do that now.

Signed-off-by: Wei Yang <[email protected]>
Message-Id: <20190405064121[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agohw: add compat machines for 4.1
Cornelia Huck [Thu, 11 Apr 2019 10:20:25 +0000 (12:20 +0200)]
hw: add compat machines for 4.1

Add 4.1 machine types for arm/i440fx/q35/s390x/spapr.

Signed-off-by: Cornelia Huck <[email protected]>
Message-Id: <20190411102025[email protected]>
Acked-by: Greg Kurz <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
5 years agoMerge tag 's390-ccw-bios-2019-04-12' into s390-next-staging
Cornelia Huck [Thu, 25 Apr 2019 12:08:17 +0000 (14:08 +0200)]
Merge tag 's390-ccw-bios-2019-04-12' into s390-next-staging

Support for booting from a vfio-ccw passthrough dasd device

# gpg: Signature made Fri 12 Apr 2019 01:17:03 PM CEST
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <[email protected]>" [full]
# gpg:                 aka "Thomas Huth <[email protected]>" [undefined]
# gpg:                 aka "Thomas Huth <[email protected]>" [undefined]
# gpg:                 aka "Thomas Huth <[email protected]>" [unknown]

* tag 's390-ccw-bios-2019-04-12':
  pc-bios/s390: Update firmware images
  s390-bios: Use control unit type to find bootable devices
  s390-bios: Support booting from real dasd device
  s390-bios: Add channel command codes/structs needed for dasd-ipl
  s390-bios: Use control unit type to determine boot method
  s390-bios: Refactor virtio to run channel programs via cio
  s390-bios: Factor finding boot device out of virtio code path
  s390-bios: Extend find_dev() for non-virtio devices
  s390-bios: cio error handling
  s390-bios: Support for running format-0/1 channel programs
  s390-bios: ptr2u32 and u32toptr
  s390-bios: Map low core memory
  s390-bios: Decouple channel i/o logic from virtio
  s390-bios: Clean up cio.h
  s390-bios: decouple common boot logic from virtio
  s390-bios: decouple cio setup from virtio
  s390 vfio-ccw: Add bootindex property and IPLB data

Signed-off-by: Cornelia Huck <[email protected]>
5 years agoexec: Introduce qemu_maxrampagesize() and rename qemu_getrampagesize()
David Hildenbrand [Wed, 17 Apr 2019 11:31:43 +0000 (13:31 +0200)]
exec: Introduce qemu_maxrampagesize() and rename qemu_getrampagesize()

Rename qemu_getrampagesize() to qemu_minrampagesize(). While at it,
properly rename find_max_supported_pagesize() to
find_min_backend_pagesize().

s390x is actually interested into the maximum ram pagesize, so
introduce and use qemu_maxrampagesize().

Add a TODO, indicating that looking at any mapped memory backends is not
100% correct in some cases.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20190417113143[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
5 years agos390x/kvm: Configure page size after memory has actually been initialized
David Hildenbrand [Wed, 17 Apr 2019 11:31:42 +0000 (13:31 +0200)]
s390x/kvm: Configure page size after memory has actually been initialized

Right now we configure the pagesize quite early, when initializing KVM.
This is long before system memory is actually allocated via
memory_region_allocate_system_memory(), and therefore memory backends
marked as mapped.

Instead, let's configure the maximum page size after initializing
memory in s390_memory_init(). cap_hpage_1m is still properly
configured before creating any CPUs, and therefore before configuring
the CPU model and eventually enabling CMMA.

This is not a fix but rather a preparation for the future, when initial
memory might reside on memory backends (not the case for s390x right now)
We will replace qemu_getrampagesize() soon by a function that will always
return the maximum page size (not the minimum page size, which only
works by pure luck so far, as there are no memory backends).

Acked-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20190417113143[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
5 years agotcg/ppc: Allow the constant pool to overflow at 32k
Richard Henderson [Mon, 22 Apr 2019 17:12:33 +0000 (17:12 +0000)]
tcg/ppc: Allow the constant pool to overflow at 32k

There is no point in coding for a 2GB offset when the max TB size
is already limited to 64k.  If we further restrict to 32k then we
can eliminate the extra ADDIS instruction.

Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Restart TB generation after out-of-line ldst overflow
Richard Henderson [Sun, 21 Apr 2019 21:51:00 +0000 (14:51 -0700)]
tcg: Restart TB generation after out-of-line ldst overflow

This is part c of relocation overflow handling.

Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Restart TB generation after constant pool overflow
Richard Henderson [Sun, 21 Apr 2019 20:51:56 +0000 (13:51 -0700)]
tcg: Restart TB generation after constant pool overflow

This is part b of relocation overflow handling.

Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Restart TB generation after relocation overflow
Richard Henderson [Sun, 21 Apr 2019 20:34:35 +0000 (13:34 -0700)]
tcg: Restart TB generation after relocation overflow

If the TB generates too much code, such that backend relocations
overflow, try again with a smaller TB.  In support of this, move
relocation processing from a random place within tcg_out_op, in
the handling of branch opcodes, to a new function at the end of
tcg_gen_code.

This is not a complete solution, as there are additional relocs
generated for out-of-line ldst handling and constant pools.

Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Restart after TB code generation overflow
Richard Henderson [Tue, 16 Apr 2019 08:06:39 +0000 (22:06 -1000)]
tcg: Restart after TB code generation overflow

If a TB generates too much code, try again with fewer insns.

Fixes: https://bugs.launchpad.net/bugs/1824853
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Hoist max_insns computation to tb_gen_code
Richard Henderson [Tue, 16 Apr 2019 06:54:54 +0000 (20:54 -1000)]
tcg: Hoist max_insns computation to tb_gen_code

In order to handle TB's that translate to too much code, we
need to place the control of the length of the translation
in the hands of the code gen master loop.

Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg/aarch64: Support INDEX_op_extract2_{i32,i64}
Richard Henderson [Mon, 25 Feb 2019 21:25:46 +0000 (13:25 -0800)]
tcg/aarch64: Support INDEX_op_extract2_{i32,i64}

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg/arm: Support INDEX_op_extract2_i32
Richard Henderson [Mon, 25 Feb 2019 21:20:01 +0000 (13:20 -0800)]
tcg/arm: Support INDEX_op_extract2_i32

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg/i386: Support INDEX_op_extract2_{i32,i64}
Richard Henderson [Mon, 25 Feb 2019 19:42:35 +0000 (11:42 -0800)]
tcg/i386: Support INDEX_op_extract2_{i32,i64}

Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Use extract2 in tcg_gen_deposit_{i32,i64}
Richard Henderson [Mon, 25 Feb 2019 19:10:53 +0000 (11:10 -0800)]
tcg: Use extract2 in tcg_gen_deposit_{i32,i64}

Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Use deposit and extract2 in tcg_gen_shifti_i64
Richard Henderson [Mon, 25 Feb 2019 18:58:15 +0000 (10:58 -0800)]
tcg: Use deposit and extract2 in tcg_gen_shifti_i64

Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Add INDEX_op_extract2_{i32,i64}
Richard Henderson [Mon, 25 Feb 2019 18:29:25 +0000 (10:29 -0800)]
tcg: Add INDEX_op_extract2_{i32,i64}

This will let backends implement the double-word shift operation.

Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
5 years agotcg: Implement tcg_gen_extract2_{i32,i64}
David Hildenbrand [Mon, 25 Feb 2019 15:42:04 +0000 (16:42 +0100)]
tcg: Implement tcg_gen_extract2_{i32,i64}

Will be helpful for s390x. Input 128 bit and output 64 bit only,
which is sufficient for now.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20190225154204[email protected]>
[rth: Add matching tcg_gen_extract2_i32.]
Signed-off-by: Richard Henderson <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/lersek/tags/edk2-pull-2019-04-22' into staging
Peter Maydell [Wed, 24 Apr 2019 12:19:41 +0000 (13:19 +0100)]
Merge remote-tracking branch 'remotes/lersek/tags/edk2-pull-2019-04-22' into staging

Advance the roms/edk2 submodule to the "edk2-stable201903" release, and
build and capture platform firmware binaries from that release. The
binaries are meant to be used by both end-users and by the "BIOS tables"
unit tests in qtest ("make check").

# gpg: Signature made Mon 22 Apr 2019 19:20:08 BST
# gpg:                using RSA key D39DA71E0D496CFA
# gpg: Good signature from "Laszlo Ersek <[email protected]>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: F5D9 660F 1BA5 F310 A95A  C5E0 466A EAE0 6125 3988
#      Subkey fingerprint: B3A5 5D3F 88A8 90ED 2E63  3E8D D39D A71E 0D49 6CFA

* remotes/lersek/tags/edk2-pull-2019-04-22:
  MAINTAINERS: add the "EDK2 Firmware" subsystem
  Makefile: install the edk2 firmware images and their descriptors
  tests: add missing dependency to build QTEST_QEMU_BINARY, round 2
  pc-bios: document the edk2 firmware images; add firmware descriptors
  pc-bios: add edk2 firmware binaries and variable store templates
  roms: build edk2 firmware binaries and variable store templates
  roms/Makefile: replace the $(EDK2_EFIROM) target with "edk2-basetools"
  roms/edk2-funcs.sh: add the qemu_edk2_get_thread_count() function
  roms/edk2: advance to tag edk2-stable201903
  tests/uefi-test-tools/build.sh: work around TianoCore#1607
  roms/edk2-funcs.sh: require gcc-4.8+ for building i386 and x86_64
  roms: lift "edk2-funcs.sh" from "tests/uefi-test-tools/build.sh"

Signed-off-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-error-monitor-2019-04-18'...
Peter Maydell [Wed, 24 Apr 2019 10:55:48 +0000 (11:55 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-monitor-2019-04-18' into staging

Error reporting & monitor patches for 2019-04-18

# gpg: Signature made Thu 18 Apr 2019 21:40:41 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <[email protected]>" [full]
# gpg:                 aka "Markus Armbruster <[email protected]>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-monitor-2019-04-18: (36 commits)
  include: Move fprintf_function to disas/
  disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
  monitor: Clean up how monitor_disas() funnels output to monitor
  qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
  qemu-print: New qemu_fprintf(), qemu_vfprintf()
  qom/cpu: Simplify how CPUClass::dump_statistics() prints
  target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
  target: Clean up how the dump_mmu() print
  target: Simplify how the TARGET_cpu_list() print
  memory: Clean up how mtree_info() prints
  block/qapi: Clean up how we print to monitor or stdout
  qsp: Simplify how qsp_report() prints
  tcg: Simplify how dump_drift_info() prints
  tcg: Simplify how dump_exec_info() prints
  tcg: Simplify how dump_opcount_info() prints
  trace: Simplify how st_print_trace_file_status() prints
  include: Include fprintf-fn.h only where needed
  monitor: Simplify how -device/device_add print help
  char-pty: Print "char device redirected" message to stdout
  char: Make -chardev help print to stdout
  ...

Signed-off-by: Peter Maydell <[email protected]>
5 years agoOpen 4.1 development tree
Peter Maydell [Wed, 24 Apr 2019 09:12:22 +0000 (10:12 +0100)]
Open 4.1 development tree

Signed-off-by: Peter Maydell <[email protected]>
5 years agoUpdate version for v4.0.0 release
Peter Maydell [Tue, 23 Apr 2019 16:32:17 +0000 (17:32 +0100)]
Update version for v4.0.0 release

Signed-off-by: Peter Maydell <[email protected]>
5 years agoinclude: Move fprintf_function to disas/
Markus Armbruster [Wed, 17 Apr 2019 19:18:05 +0000 (21:18 +0200)]
include: Move fprintf_function to disas/

The previous commits have eliminated fprintf_function outside
disassemblers, simplifying code and cleaning up the ugly type-punning
fprintf_function seems to attract.  Move fprintf_function to
include/disas/dis-asm.h to reduce the temptation to abuse it.

I considered renaming it to fprintf_ftype (reverting that part of
commit 6e2d864edf5, v0.14.0) to get us closer to binutils, but I
figure the fork is too distant to make this worthwhile.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agodisas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
Markus Armbruster [Wed, 17 Apr 2019 19:18:04 +0000 (21:18 +0200)]
disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h

Commit dc99065b5f9 (v0.1.0) added dis-asm.h from binutils.

Commit 43d4145a986 (v0.1.5) inlined bfd.h into dis-asm.h to remove the
dependency on binutils.

Commit 76cad71136b (v1.4.0) moved dis-asm.h to include/disas/bfd.h.
The new name is confusing when you try to match against (pre GPLv3+)
binutils.  Rename it back.  Keep it in the same directory, of course.

Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20190417191805[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
5 years agomonitor: Clean up how monitor_disas() funnels output to monitor
Markus Armbruster [Wed, 17 Apr 2019 19:18:03 +0000 (21:18 +0200)]
monitor: Clean up how monitor_disas() funnels output to monitor

INIT_DISASSEMBLE_INFO() takes an fprintf()-like callback and a FILE *
to pass to it.  monitor_disas() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Pass qemu_fprintf() and NULL instead.

monitor_fprintf() is now unused; delete it.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>
[Commit message typo corrected]

5 years agoqom/cpu: Simplify how CPUClass:cpu_dump_state() prints
Markus Armbruster [Wed, 17 Apr 2019 19:18:02 +0000 (21:18 +0200)]
qom/cpu: Simplify how CPUClass:cpu_dump_state() prints

CPUClass method dump_statistics() takes an fprintf()-like callback and
a FILE * to pass to it.  Most callers pass fprintf() and stderr.
log_cpu_state() passes fprintf() and qemu_log_file.
hmp_info_registers() passes monitor_fprintf() and the current monitor
cast to FILE *.  monitor_fprintf() casts it right back, and is
otherwise identical to monitor_printf().

The callback gets passed around a lot, which is tiresome.  The
type-punning around monitor_fprintf() is ugly.

Drop the callback, and call qemu_fprintf() instead.  Also gets rid of
the type-punning, since qemu_fprintf() takes NULL instead of the
current monitor cast to FILE *.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agoqemu-print: New qemu_fprintf(), qemu_vfprintf()
Markus Armbruster [Wed, 17 Apr 2019 19:18:01 +0000 (21:18 +0200)]
qemu-print: New qemu_fprintf(), qemu_vfprintf()

Code that doesn't want to know about current monitor vs. stdout
vs. stderr takes an fprintf_function callback and a FILE * argument to
pass to it.  Actual arguments are either fprintf() and stdout or
stderr, or monitor_fprintf() and the current monitor cast to FILE *.
monitor_fprintf() casts it right back, and is otherwise identical to
monitor_printf().  The type-punning is ugly.

New qemu_fprintf() and qemu_vprintf() address this need without type
punning: they are like fprintf() and vfprintf(), except they print to
the current monitor when passed a null FILE *.  The next commits will
put them to use.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agoqom/cpu: Simplify how CPUClass::dump_statistics() prints
Markus Armbruster [Wed, 17 Apr 2019 19:18:00 +0000 (21:18 +0200)]
qom/cpu: Simplify how CPUClass::dump_statistics() prints

CPUClass method dump_statistics() takes an fprintf()-like callback and
a FILE * to pass to it.

Its only caller hmp_info_cpustats() (via cpu_dump_statistics()) passes
monitor_fprintf() and the current monitor cast to FILE *.
monitor_fprintf() casts it right back, and is otherwise identical to
monitor_printf().  The type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agotarget/i386: Simplify how x86_cpu_dump_local_apic_state() prints
Markus Armbruster [Wed, 17 Apr 2019 19:17:59 +0000 (21:17 +0200)]
target/i386: Simplify how x86_cpu_dump_local_apic_state() prints

x86_cpu_dump_local_apic_state() takes an fprintf()-like callback and a
FILE * to pass to it, and so do its helper functions.

Its only caller hmp_info_local_apic() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agotarget: Clean up how the dump_mmu() print
Markus Armbruster [Wed, 17 Apr 2019 19:17:58 +0000 (21:17 +0200)]
target: Clean up how the dump_mmu() print

The various dump_mmu() take an fprintf()-like callback and a FILE * to
pass to it, and so do their helper functions.  Passing around callback
and argument is rather tiresome.

Most dump_mmu() are called only by the target's hmp_info_tlb().  These
all pass monitor_printf() cast to fprintf_function and the current
monitor cast to FILE *.

SPARC's dump_mmu() gets also called from target/sparc/ldst_helper.c a
few times #ifdef DEBUG_MMU.  These calls pass fprintf() and stdout.

The type-punning is technically undefined behaviour, but works in
practice.  Clean up: drop the callback, and call qemu_printf()
instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agotarget: Simplify how the TARGET_cpu_list() print
Markus Armbruster [Wed, 17 Apr 2019 19:17:57 +0000 (21:17 +0200)]
target: Simplify how the TARGET_cpu_list() print

The various TARGET_cpu_list() take an fprintf()-like callback and a
FILE * to pass to it.  Their callers (vl.c's main() via list_cpus(),
bsd-user/main.c's main(), linux-user/main.c's main()) all pass
fprintf() and stdout.  Thus, the flexibility provided by the (rather
tiresome) indirection isn't actually used.

Drop the callback, and call qemu_printf() instead.

Calling printf() would also work, but would make the code unsuitable
for monitor context without making it simpler.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20190417191805[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
5 years agomemory: Clean up how mtree_info() prints
Markus Armbruster [Wed, 17 Apr 2019 19:17:56 +0000 (21:17 +0200)]
memory: Clean up how mtree_info() prints

mtree_info() takes an fprintf()-like callback and a FILE * to pass to
it, and so do its helper functions.  Passing around callback and
argument is rather tiresome.

Its only caller hmp_info_mtree() passes monitor_printf() cast to
fprintf_function and the current monitor cast to FILE *.

The type-punning is technically undefined behaviour, but works in
practice.  Clean up: drop the callback, and call qemu_printf()
instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agoblock/qapi: Clean up how we print to monitor or stdout
Markus Armbruster [Wed, 17 Apr 2019 19:17:55 +0000 (21:17 +0200)]
block/qapi: Clean up how we print to monitor or stdout

bdrv_snapshot_dump(), bdrv_image_info_specific_dump(),
bdrv_image_info_dump() and their helpers take an fprintf()-like
callback and a FILE * to pass to it.

hmp.c passes monitor_printf() cast to fprintf_function and the current
monitor cast to FILE *.

qemu-img.c and qemu-io-cmds.c pass fprintf and stdout.

The type-punning is technically undefined behaviour, but works in
practice.  Clean up: drop the callback, and call qemu_printf()
instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agoqsp: Simplify how qsp_report() prints
Markus Armbruster [Wed, 17 Apr 2019 19:17:54 +0000 (21:17 +0200)]
qsp: Simplify how qsp_report() prints

qsp_report() takes an fprintf()-like callback and a FILE * to pass to
it.

Its only caller hmp_sync_profile() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agotcg: Simplify how dump_drift_info() prints
Markus Armbruster [Wed, 17 Apr 2019 19:17:53 +0000 (21:17 +0200)]
tcg: Simplify how dump_drift_info() prints

dump_drift_info() takes an fprintf()-like callback and a FILE * to pass
to it.

Its only caller hmp_info_jit() passes monitor_fprintf() and a Monitor
* cast to FILE *.  monitor_fprintf() casts it right back, and is
otherwise identical to monitor_printf().  The type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agotcg: Simplify how dump_exec_info() prints
Markus Armbruster [Wed, 17 Apr 2019 19:17:52 +0000 (21:17 +0200)]
tcg: Simplify how dump_exec_info() prints

dump_exec_info() takes an fprintf()-like callback and a FILE * to pass
to it.

Its only caller hmp_info_jit() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agotcg: Simplify how dump_opcount_info() prints
Markus Armbruster [Wed, 17 Apr 2019 19:17:51 +0000 (21:17 +0200)]
tcg: Simplify how dump_opcount_info() prints

dump_opcount_info() takes an fprintf()-like callback and a FILE * to
pass to it.

Its only caller hmp_info_opcount() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agotrace: Simplify how st_print_trace_file_status() prints
Markus Armbruster [Wed, 17 Apr 2019 19:17:50 +0000 (21:17 +0200)]
trace: Simplify how st_print_trace_file_status() prints

st_print_trace_file_status() takes an fprintf()-like callback and a
FILE * to pass to it.

Its only caller hmp_trace_file() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agoinclude: Include fprintf-fn.h only where needed
Markus Armbruster [Wed, 17 Apr 2019 19:17:49 +0000 (21:17 +0200)]
include: Include fprintf-fn.h only where needed

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417191805[email protected]>

5 years agomonitor: Simplify how -device/device_add print help
Markus Armbruster [Wed, 17 Apr 2019 19:06:41 +0000 (21:06 +0200)]
monitor: Simplify how -device/device_add print help

Commit a95db58f210 added monitor_vfprintf() as an error_printf()
generalized from stderr to arbitrary streams, then used it wrapped in
helper out_printf() to print -device/device_add help to stdout.  Use
qemu_printf() instead, and delete monitor_vfprintf() and out_printf().

Cc: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agochar-pty: Print "char device redirected" message to stdout
Markus Armbruster [Wed, 17 Apr 2019 19:06:40 +0000 (21:06 +0200)]
char-pty: Print "char device redirected" message to stdout

char_pty_open() prints a "char device redirected to PTY_NAME (label
LABEL)" message to the current monitor or else to stderr.  This is not
an error, so it shouldn't go to stderr.  Print it to stdout instead.

Why is it even printed?  No other ChardevClass::open() prints anything
on success.  It's because you need to know PTY_NAME to actually use
this char device, e.g. like e.g. "socat STDIO,cfmakeraw FILE:PTY_NAME"
to use the monitor's readline interface.  You can get PTY_NAME with
"info chardev" (a.k.a. query-chardev for QMP), but only if you already
have a monitor.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20190417190641[email protected]>
Reviewed-by: Eric Blake <[email protected]>
5 years agochar: Make -chardev help print to stdout
Markus Armbruster [Wed, 17 Apr 2019 19:06:39 +0000 (21:06 +0200)]
char: Make -chardev help print to stdout

Command line help explicitly requested by the user should be printed
to stdout, not stderr.  We do elsewhere.  Adjust -chardev to match:
use qemu_printf() instead of error_printf().  Plain printf() would be
wrong because we need to print to the current monitor for "chardev-add
help".

Cc: "Marc-André Lureau" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agoblockdev: Make -drive format=help print to stdout
Markus Armbruster [Wed, 17 Apr 2019 19:06:38 +0000 (21:06 +0200)]
blockdev: Make -drive format=help print to stdout

Command line help explicitly requested by the user should be printed
to stdout, not stderr.  We do elsewhere.  Adjust -drive to match: use
qemu_printf() instead of error_printf().  Plain printf() would be
wrong because we need to print to the current monitor for "drive_add
... format=help".

Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: [email protected]
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agoqemu-print: New qemu_printf(), qemu_vprintf() etc.
Markus Armbruster [Wed, 17 Apr 2019 19:06:37 +0000 (21:06 +0200)]
qemu-print: New qemu_printf(), qemu_vprintf() etc.

We commonly want to print to the current monitor if we have one, else
to stdout/stderr.  For stderr, have error_printf().  For stdout, all
we have is monitor_vfprintf(), which is rather unwieldy.  We often
print to stderr just because error_printf() is easier.

New qemu_printf() and qemu_vprintf() do exactly what's needed.  The
next commits will put them to use.

Cc: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agomonitor error: Make printf()-like functions return a value
Markus Armbruster [Wed, 17 Apr 2019 19:06:36 +0000 (21:06 +0200)]
monitor error: Make printf()-like functions return a value

printf() & friends return the number of characters written on success,
negative value on error.

monitor_printf(), monitor_vfprintf(), monitor_vprintf(),
error_printf(), error_printf_unless_qmp(), error_vprintf(), and
error_vprintf_unless_qmp() return void.  Some of them carry a TODO
comment asking for int instead.

Improve them to return int like printf() does.

This makes our use of monitor_printf() as fprintf_function slightly
less dirty: the function cast no longer adds a return value that isn't
there.  It still changes a parameter's pointer type.  That will be
addressed in a future commit.

monitor_vfprintf() always returns zero.  Improve it to return the
proper value.

Cc: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agovl: Make -machine $TYPE,help and -accel help print to stdout
Markus Armbruster [Wed, 17 Apr 2019 19:06:35 +0000 (21:06 +0200)]
vl: Make -machine $TYPE,help and -accel help print to stdout

Command line help help explicitly requested by the user should be
printed to stdout, not stderr.  We do elsewhere.  Adjust -machine
$TYPE,help and -accel help to match: use printf() instead of
error_printf().

Cc: Marcel Apfelbaum <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agos390x/kvm: Report warnings with warn_report(), not error_printf()
Markus Armbruster [Wed, 17 Apr 2019 19:06:34 +0000 (21:06 +0200)]
s390x/kvm: Report warnings with warn_report(), not error_printf()

kvm_s390_mem_op() can fail in two ways: when !cap_mem_op, it returns
-ENOSYS, and when kvm_vcpu_ioctl() fails, it returns -errno set by
ioctl().  Its caller s390_cpu_virt_mem_rw() recovers from both
failures.

kvm_s390_mem_op() prints "KVM_S390_MEM_OP failed" with error_printf()
in the latter failure mode.  Since this is obviously a warning, use
warn_report().

Perhaps the reporting should be left to the caller.  It could warn on
failure other than -ENOSYS.

Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agovfio: Report warnings with warn_report(), not error_printf()
Markus Armbruster [Wed, 17 Apr 2019 19:06:33 +0000 (21:06 +0200)]
vfio: Report warnings with warn_report(), not error_printf()

Cc: Alex Williamson <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20190417190641[email protected]>
Acked-by: Alex Williamson <[email protected]>
5 years agohpet: Report warnings with warn_report(), not error_printf()
Markus Armbruster [Wed, 17 Apr 2019 19:06:32 +0000 (21:06 +0200)]
hpet: Report warnings with warn_report(), not error_printf()

Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agopci: Report fatal errors with error_report(), not error_printf()
Markus Armbruster [Wed, 17 Apr 2019 19:06:31 +0000 (21:06 +0200)]
pci: Report fatal errors with error_report(), not error_printf()

Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agomips/boston: Report errors with error_report(), not error_printf()
Markus Armbruster [Wed, 17 Apr 2019 19:06:30 +0000 (21:06 +0200)]
mips/boston: Report errors with error_report(), not error_printf()

Cc: Paul Burton <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20190417190641[email protected]>

5 years agoloader-fit: Wean off error_printf()
Markus Armbruster [Wed, 17 Apr 2019 19:06:29 +0000 (21:06 +0200)]
loader-fit: Wean off error_printf()

load_fit() reports errors with error_printf() instead of
error_report().  Worse, it even reports errors it actually recovers
from, in fit_cfg_compatible() and fit_load_fdt().  Messed up in
initial commit 51b58561c1d.

Convert the helper functions for load_fit() to Error.  Make sure each
failure path sets an error.

Fix fit_cfg_compatible() and fit_load_fdt() not to report errors they
actually recover from.

Convert load_fit() to error_report().

Cc: Paul Burton <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20190417190641[email protected]>

This page took 0.091284 seconds and 4 git commands to generate.