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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWzm5oAAoJEGw4ysog2bOSb8wP/iC8wxO3P2fb6gRg/QAwYWhd
 2+tbpKblUyaQU+v7YKeTRC5z2WnrGFWU69ng0Yocv2jyYMNEwmsGu2pXyooCWG8y
 0YK8yatMP7QBs27DrNHUUQLV/FH1UTEVhPtgTnGsjR6KVc5hYSnnVdHb9yvO4gxB
 Ve8v2oFC++StjH20nrPuBUbrX25QBGsvge/QEY1L9TOXZgbelJ2HSY1WcIcybta9
 od86hEq+oK2EmEAKd4e1Z417nQKYzGMDzDB4raUJEbvoZQQpySOo3CQu4OceT8pi
 K/dkZ5oOLDnVA506sWBWKqDKXCLwkcy8swk8gp1HWPG+SUND/Ewk6hz5a7KF0vdq
 6+c0EwNHL6NJlNPJKUeI4XzwtRuHCxel3MAfHS9eRQs1SrkZwHMEXQIKQJefSw2P
 vQe6B+9T0CSX3Sb6ZY6Kwp2oHhIeamIHpgHiI2dfsweSz9xMqAnxvRyzWaB1lxOL
 W4RgKF5QR8MOFRXj5bxCmOT9lbwJvHblNqCjmOuGHu63p7nQFgPKIICA+VTkmqMq
 BaW5Ks505ZHn6jSikANSjN4Zovk82qg3EpLu3tRK0BEWc04Y0XbB6okhryCqkANz
 Llhvvh8c1wFPdn7U5MUCnz4VGZs2C1smyIB0aHfALGeyQss5bYvRt6QKsfnP0uiB
 1IQJXb9Ykbw4tge8TCET
 =If7v
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160225' into staging

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.

# gpg: Signature made Thu 25 Feb 2016 03:00:56 GMT using RSA key ID 20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# 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: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.6-20160225:
  ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv
  ppc/kvm: Use error_report() instead of cpu_abort() for user-triggerable errors
  spapr: initialize local Error pointer
  hw/ppc/spapr: Implement the h_page_init hypercall
  pseries: Update SLOF firmware image to 20160223

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
master
Peter Maydell 2016-02-25 10:46:06 +00:00
commit d159148b63
7 changed files with 106 additions and 7 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

Binary file not shown.

@ -1 +1 @@
Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456
Subproject commit e3d05727a074619fc12d0a67f05cf2c42c875cce

View File

@ -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"
@ -512,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;
}
@ -1993,7 +1998,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 +2019,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);
}
}

View File

@ -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) {
asm volatile("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) {
asm volatile("icbi 0,%0" : : "r"(p));
}
}
#endif /* CONFIG_KVM */
#ifndef KVM_INTERRUPT_SET
#define KVM_INTERRUPT_SET -1