ppc-for-2.6 queue 20160225
The following changes since commit 1b1624092d1f1f746adea6e1237a07f6788c2e3d:
Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20160223-1' into staging (2016-02-23 16:14:17 +0000)
are available in the git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-2.6-20160225
for you to fetch changes up to 388e47c75be411979c420abbc76a250597f4ea94:
ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv (2016-02-25 13:58:44 +1100)
----------------------------------------------------------------
ppc patch queue for 2016-02-25
Hopefully final queue before qemu-2.6 soft freeze. Currently accumulated patches for target-ppc, pseries machine type and related devices:
* SLOF firmware update
- Many new features, including virtio 1.0 non-legacy support
* H_PAGE_INIT hypercall implementation
* Small cleanups and bugfixes.
----------------------------------------------------------------
Alexey Kardashevskiy (1):
pseries: Update SLOF firmware image to 20160223
Greg Kurz (1):
spapr: initialize local Error pointer
Thomas Huth (3):
hw/ppc/spapr: Implement the h_page_init hypercall
ppc/kvm: Use error_report() instead of cpu_abort() for user-triggerable errors ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv
hw/ppc/spapr.c | 2 +- hw/ppc/spapr_hcall.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ pc-bios/README | 2 +- pc-bios/slof.bin | Bin 914712 -> 923832 bytes roms/SLOF | 2 +- target-ppc/kvm.c | 11 ++++++++-- target-ppc/kvm_ppc.h | 36 +++++++++++++++++++++++++++++-- 7 files changed, 106 insertions(+), 7 deletions(-)
[Qemu-devel] [PULL 5/5] ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv
From: Thomas Huth <[email protected]>
Using a CPU type that does not match the host is not possible when using the kvm-hv kernel module - the PVR is checked in the kernel function kvm_arch_vcpu_ioctl_set_sregs_hv() and rejected with -EINVAL if it does not match the host.
However, when the user tries to specify a non-matching CPU type, QEMU currently only reports "kvm_init_vcpu failed: Invalid argument", and this is of course not very helpful for the user to solve the problem. So this patch adds a more descriptive error message that tells the user to specify "-cpu host" instead.
--- target-ppc/kvm.c | 4 ++++ 1 file changed, 4 insertions(+)
target-ppc/kvm.c +4 -0
@@ -513,6 +513,10 @@ int kvm_arch_init_vcpu(CPUState *cs)/* Synchronize sregs with kvm */ ret =kvm_arch_sync_sregs (cpu);if (ret) { +if (ret == -EINVAL ) { +error_report ("Register sync failed... If you're using kvm-hv.ko," +" only \"-cpu host\" is possible" ); + }return ret; }
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 2/5] hw/ppc/spapr: Implement the h_page_init hypercall
In reply to David GibsonFrom: Thomas Huth <[email protected]>
This hypercall either initializes a page with zeros, or copies another page.
According to LoPAPR, the i-cache of the page should also be flushed if using H_ICACHE_INVALIDATE or H_ICACHE_SYNCHRONIZE, and the d-cache should be synchronized to the RAM if the H_ICACHE_SYNCHRONIZE flag is used. For this, two new functions are introduced, kvmppc_dcbst_range() and kvmppc_icbi()_range, which use the corresponding assembler instructions to flush the caches if running with KVM on Power. If the code runs with TCG instead, the code only uses tb_flush(), assuming that this will be enough for synchronization.
--- hw/ppc/spapr_hcall.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ target-ppc/kvm_ppc.h | 36 +++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 2 deletions(-)
hw/ppc/spapr_hcall.c +60 -0
@@ -386,6 +386,65 @@ static target_ulong h_set_xdabr(PowerPCCPU *cpu, sPAPRMachineState *spapr,return H_SUCCESS ; } +static target_ulong h_page_init (PowerPCCPU *cpu,sPAPRMachineState *spapr, +target_ulong opcode,target_ulong *args) +{ +target_ulong flags = args[0 ]; +hwaddr dst = args[1 ]; +hwaddr src = args[2 ]; +hwaddr len =TARGET_PAGE_SIZE ; +uint8_t *pdst, *psrc; +target_long ret =H_SUCCESS ; + +if (flags & ~(H_ICACHE_SYNCHRONIZE |H_ICACHE_INVALIDATE + |H_COPY_PAGE |H_ZERO_PAGE )) { +qemu_log_mask (LOG_UNIMP ,"h_page_init: Bad flags (" TARGET_FMT_lx"\n" , + flags); +return H_PARAMETER ; + } + +/* Map-in destination */ +if (!is_ram_address (spapr, dst) || (dst & ~TARGET_PAGE_MASK ) !=0 ) { +return H_PARAMETER ; + } + pdst =cpu_physical_memory_map (dst, &len,1 ); +if (!pdst || len !=TARGET_PAGE_SIZE ) { +return H_PARAMETER ; + } + +if (flags &H_COPY_PAGE ) { +/* Map-in source, copy to destination, and unmap source again */ +if (!is_ram_address (spapr, src) || (src & ~TARGET_PAGE_MASK ) !=0 ) { + ret =H_PARAMETER ; + goto unmap_out; + } + psrc =cpu_physical_memory_map (src, &len,0 ); +if (!psrc || len !=TARGET_PAGE_SIZE ) { + ret =H_PARAMETER ; + goto unmap_out; + } +memcpy (pdst, psrc, len); +cpu_physical_memory_unmap (psrc, len,0 , len); + }else if (flags &H_ZERO_PAGE ) { +memset (pdst,0 , len);/* Just clear the destination page */ + } + +if (kvm_enabled () && (flags &H_ICACHE_SYNCHRONIZE ) !=0 ) { +kvmppc_dcbst_range (cpu, pdst, len); + } +if (flags & (H_ICACHE_SYNCHRONIZE |H_ICACHE_INVALIDATE )) { +if (kvm_enabled ()) { +kvmppc_icbi_range (cpu, pdst, len); + }else { +tb_flush (CPU (cpu)); + } + } + +unmap_out: +cpu_physical_memory_unmap (pdst,TARGET_PAGE_SIZE ,1 , len); +return ret; +} +#define FLAGS_REGISTER_VPA 0x0000200000000000ULL#define FLAGS_REGISTER_DTL 0x0000400000000000ULL#define FLAGS_REGISTER_SLBSHADOW 0x0000600000000000ULL
@@ -1045,6 +1104,7 @@ static void hypercall_register_types(void)spapr_register_hypercall (H_SET_SPRG0 , h_set_sprg0);spapr_register_hypercall (H_SET_DABR , h_set_dabr);spapr_register_hypercall (H_SET_XDABR , h_set_xdabr); +spapr_register_hypercall (H_PAGE_INIT , h_page_init);spapr_register_hypercall (H_SET_MODE , h_set_mode);/* "debugger" hcalls (also used by SLOF). Note: We do -not- differenciate
target-ppc/kvm_ppc.h +34 -2
@@ -249,15 +249,47 @@ static inline int kvmppc_enable_hwrng(void)#endif #ifndef CONFIG_KVM +#define kvmppc_eieio () do { } while (0) -#else + +static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +} + +static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +} + +#else /* CONFIG_KVM */ +#define kvmppc_eieio () \ do { \ if (kvm_enabled()) { \ asm volatile("eieio" : : : "memory"); \ } \ } while (0) -#endif + +/* Store data cache blocks back to memory */ +static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { + asmvolatile ("dcbst 0,%0" : :"r" (p) :"memory" ); + } +} + +/* Invalidate instruction cache blocks */ +static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { + asmvolatile ("icbi 0,%0" : :"r" (p)); + } +} + +#endif /* CONFIG_KVM */ #ifndef KVM_INTERRUPT_SET #define KVM_INTERRUPT_SET -1
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 3/5] spapr: initialize local Error pointer
In reply to David GibsonFrom: Greg Kurz <[email protected]>
This fixes a crash in the target QEMU during migration.
Broken in commit c5f54f3.
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
@@ -1528,7 +1528,7 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id) section_hdr =qemu_get_be32 (f);if (section_hdr) { -Error *local_err; +Error *local_err =NULL ;/* First section gives the htab size */ spapr_reallocate_hpt (spapr, section_hdr, &local_err);
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 4/5] ppc/kvm: Use error_report() instead of cpu_abort() for user-triggerable errors
In reply to David GibsonFrom: Thomas Huth <[email protected]>
Setting the KVM_CAP_PPC_PAPR capability can fail if either the KVM kernel module does not support it, or if the specified vCPU type is not a 64-bit Book3-S CPU type. For example, the user can trigger it easily with "-M pseries -cpu G2leLS" when using the kvm-pr kernel module. So the error should not be reported with cpu_abort() since this function is rather meant for reporting programming errors than reporting user-triggerable errors (it prints out all CPU registers and then calls abort() to kills the program - two things that the normal user does not expect here) . So let's use error_report() with exit(1) here instead.
A similar problem exists in the code that sets the KVM_CAP_PPC_EPR capability, so while we're at it, fix that, too.
--- target-ppc/kvm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
target-ppc/kvm.c +5 -2
@@ -23,6 +23,7 @@#include <linux/kvm.h> #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h"
@@ -1993,7 +1994,8 @@ void kvmppc_set_papr(PowerPCCPU *cpu) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_PPC_PAPR ,0 );if (ret) { -cpu_abort (cs,"This KVM version does not support PAPR\n" ); +error_report ("This vCPU type or KVM version does not support PAPR" ); +exit (1 ); }/* Update the capability flag so we sync the right information
@@ -2013,7 +2015,8 @@ void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_PPC_EPR ,0 , mpic_proxy);if (ret && mpic_proxy) { -cpu_abort (cs,"This KVM version does not support EPR\n" ); +error_report ("This KVM version does not support EPR" ); +exit (1 ); } }
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 1/5] pseries: Update SLOF firmware image to 20160223
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
The main change is virtio 1.0 support.
The complete changelog is:
Quoted 56 lines
dhcp: fix warning messages when calling
strtoip()
virtio-scsi: enable virtio 1.0
virtio-scsi: usevirtio_filldesc api
virtio-scsi: use idx during initialization
virtio-net: enable virtio 1.0
virtio-blk: enable virtio 1.0
virtio: 1.0 helper to read 16/32/64 bit value
virtio: add and enable 1.0 device setup
virtio: 1.0 guest features negotiation
virtio: update features set/get register accessor
virtio: make all virtio apis 1.0 aware
virtio: add 64-bit virtio helpers for 1.0
virtio: add virtio 1.0 related struct and defines
virtio: get rid of type variable invirtio_device
virtio-net: move setup-mac to the open routine
virtio-net: makenet_hdr_sizea variable
virtio-net: replace vq array with vq_{tx,rx}
virtio-net: usevirtio_fill_desc
virtio-{net,blk,scsi,9p}: use status variable
virtio-blk: add helpers for filling descriptors virtio-{blk,9p}: enable resetting the device
virtio: introduce helper for initializing virt queue
virtio: fix code style/design issues.
fix code style inbyteorder.h
pci: add byte read/write helper routines
virtio-net: fix gcc warnings (-Wextra)
virtio-blk: fix gcc warnings (-Wextra)
readme: Add a note about coding style
dhcp: Remove duplicatedstrtoip()
ethernet: Fix gcc warnings
net-snk: Fix gcc warnings
net-snk: Fix coding style
net-snk: Fix memory leak indhcp6_process_options()
net-snk: Fix memory leak inip6_to_multicast_mac()/send_ipv6()
net-snk: Remove badNEIGHBOUR_SOLICITATIONcode insend_ipv6()Fix dma-alloc and dma-map-in functions on board-js2x
net-snk: Allow stateless autoconfig IPv6 addresses withIP_INIT_IPV6_MANUAL
net-snk: Simplify theip6_is_multicast()function
net-snk: Move global variable definition out of the header file
net-snk: Prefer non-link-local unicast IPv6 addresses if possible
net-snk: Fix the check for link-local addresses when receiving RAs
net-snk: Remove junk at the end of IPv6 TFTP ACK and error packets Fix format strings inusb-ohci.c
net-snk: Get rid of junk at the end of sent DHCPv6 packets
net-snk: Use transaction IDs in DHCPv4, too
net-snk: Make use of DHCPv6 transaction IDs
net-snk: Seed the pseudo-random number generator
libc: Addsrand()call
libc: Fix therand()function to return non-zero values
net-snk: Improve printed text when booting via network
Increase temporary buffer size of ibm,client-architecture-support call Move archsupport.fs into board-qemu directory
boot: stop booting when we encounter HALT
fat-files: Fix bug with root-entries = 0 on certain FAT32 file systems
usb: print unhandled descriptor in debug mode
Improve stack usage with libnvramget_partitionfunction
Quoted 8 lines
Improve stack usage in libnvram environment variable code
libc: Port vsnprintf back from skiboot
Move the code for rfill into a separate function
Rework wrapper fornew_nvram_partition()and fix possible bug in there Stack optimization in libusb: split upsetup_new_device()Check for stack overflow in paflof engine
Clean up pending packet variable in ipv4 code
Fix tracking of pending outgoing packets when handling ARP replies
--- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 914712 -> 923832 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
@@ -17,7 +17,7 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20151103. + built from git tag qemu-slof-20160223. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456 +Subproject commit e3d05727a074619fc12d0a67f05cf2c42c875cce
Signature · 1 line
2.5.0
Peter Maydell
AppliedQuoted 15 lines · David Gibson
The following changes since commit
1b1624092d1f1f746adea6e1237a07f6788c2e3d:Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20160223-1' into staging (2016-02-23 16:14:17 +0000)
are available in the git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-2.6-20160225for you to fetch changes up to
388e47c75be411979c420abbc76a250597f4ea94:ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv (2016-02-25 13:58:44 +1100)
----------------------------------------------------------------
ppc patch queue for 2016-02-25
Quoted 7 lines
Hopefully final queue before qemu-2.6 soft freeze. Currently accumulated patches for target-ppc, pseries machine type and related devices:
* SLOF firmware update
- Many new features, including virtio 1.0 non-legacy support
*H_PAGE_INIThypercall implementation
* Small cleanups and bugfixes.
Applied, thanks.
-- PMM