[Spice-commits] 8 commits - Makefile.target configure hw/etraxfs_eth.c hw/ppc.h hw/ppc440_bamboo.c hw/ppc4xx_devs.c hw/ppc_newworld.c hw/ppc_oldworld.c pc-bios/README pc-bios/openbios-ppc pc-bios/openbios-sparc32 pc-bios/openbios-sparc64 target-ppc/kvm.c target-ppc/kvm_ppc.h

Gerd Hoffmann kraxel at kemper.freedesktop.org
Fri Aug 27 02:51:44 PDT 2010


 Makefile.target          |    5 ++++-
 configure                |    4 +++-
 hw/etraxfs_eth.c         |    2 +-
 hw/ppc.h                 |    3 +++
 hw/ppc440_bamboo.c       |   39 ++++++++++++++++++---------------------
 hw/ppc4xx_devs.c         |    3 +--
 hw/ppc_newworld.c        |    7 +++++++
 hw/ppc_oldworld.c        |    7 +++++++
 pc-bios/README           |    2 +-
 pc-bios/openbios-ppc     |binary
 pc-bios/openbios-sparc32 |binary
 pc-bios/openbios-sparc64 |binary
 target-ppc/kvm.c         |   32 ++++++++++++++++++++++++++++++++
 target-ppc/kvm_ppc.h     |    1 +
 14 files changed, 78 insertions(+), 27 deletions(-)

New commits:
commit 9e84a4708f820976afd825745d4110dbaf58f431
Author: Blue Swirl <blauwirbel at gmail.com>
Date:   Thu Aug 26 18:04:18 2010 +0000

    etraxfs_eth: correct use of ! and &
    
    Combining bitwise AND and logical NOT is suspicious.
    
    Fixed by this Coccinelle script:
    // From http://article.gmane.org/gmane.linux.kernel/646367
    @@ expression E1,E2; @@
    (
     !E1 & !E2
    |
    - !E1 & E2
    + !(E1 & E2)
    )
    
    Acked-by: Edgar E. Iglesias <edgar.iglesias at gmail.com>
    Signed-off-by: Blue Swirl <blauwirbel at gmail.com>

diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c
index b897c9c..ade96f1 100644
--- a/hw/etraxfs_eth.c
+++ b/hw/etraxfs_eth.c
@@ -464,7 +464,7 @@ static int eth_match_groupaddr(struct fs_eth *eth, const unsigned char *sa)
 
 	/* First bit on the wire of a MAC address signals multicast or
 	   physical address.  */
-	if (!m_individual && !sa[0] & 1)
+	if (!m_individual && !(sa[0] & 1))
 		return 0;
 
 	/* Calculate the hash index for the GA registers. */
commit 8aa80ff82fb62787cf49e7954e0e6eb4a0429af4
Author: Blue Swirl <blauwirbel at gmail.com>
Date:   Thu Aug 26 17:57:47 2010 +0000

    Sparc: update OpenBIOS images to r859
    
    Update Sparc32 and Sparc64 OpenBIOS images to SVN revision 859.
    
    Bring also pc-bios/README up to date including the update performed by
    419ef5f1c6a9614e8ddcb0b0f826de692e7e4a43.
    
    Signed-off-by: Blue Swirl <blauwirbel at gmail.com>

diff --git a/pc-bios/README b/pc-bios/README
index 7c872bc..ec5e2e1 100644
--- a/pc-bios/README
+++ b/pc-bios/README
@@ -15,7 +15,7 @@
   firmware implementation. The goal is to implement a 100% IEEE
   1275-1994 (referred to as Open Firmware) compliant firmware.
   The included image for PowerPC (for 32 and 64 bit PPC CPUs), Sparc32
-  and Sparc64 are built from OpenBIOS SVN revision 821.
+  and Sparc64 are built from OpenBIOS SVN revision 859.
 
 - The PXE roms come from Rom-o-Matic gPXE 0.9.9 with BANNER_TIMEOUT=0
 
diff --git a/pc-bios/openbios-sparc32 b/pc-bios/openbios-sparc32
index 2eee1a6..aaff1f0 100644
Binary files a/pc-bios/openbios-sparc32 and b/pc-bios/openbios-sparc32 differ
diff --git a/pc-bios/openbios-sparc64 b/pc-bios/openbios-sparc64
index 1270ef6..a1b692e 100644
Binary files a/pc-bios/openbios-sparc64 and b/pc-bios/openbios-sparc64 differ
commit ceee6da6cff11cea77ed2169a37d27cfc62a3c22
Author: Hollis Blanchard <hollis at penguinppc.org>
Date:   Wed Aug 4 17:21:37 2010 -0700

    ppc4xx: load Bamboo kernel, initrd, and fdt at fixed addresses
    
    We can't use the return value of load_uimage() for the kernel because it
    can't account for BSS size, and the PowerPC kernel does not relocate
    blobs before zeroing BSS.
    
    Instead, we now load at the fixed addresses chosen by u-boot (the normal
    firmware for the board).
    
    Signed-off-by: Hollis Blanchard <hollis at penguinppc.org>

diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
index d471d5d..34ddf45 100644
--- a/hw/ppc440_bamboo.c
+++ b/hw/ppc440_bamboo.c
@@ -27,6 +27,11 @@
 
 #define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
 
+/* from u-boot */
+#define KERNEL_ADDR  0x1000000
+#define FDT_ADDR     0x1800000
+#define RAMDISK_ADDR 0x1900000
+
 static int bamboo_load_device_tree(target_phys_addr_t addr,
                                      uint32_t ramsize,
                                      target_phys_addr_t initrd_base,
@@ -98,10 +103,8 @@ static void bamboo_init(ram_addr_t ram_size,
     uint64_t elf_lowaddr;
     target_phys_addr_t entry = 0;
     target_phys_addr_t loadaddr = 0;
-    target_long kernel_size = 0;
-    target_ulong initrd_base = 0;
     target_long initrd_size = 0;
-    target_ulong dt_base = 0;
+    int success;
     int i;
 
     /* Setup CPU. */
@@ -118,15 +121,15 @@ static void bamboo_init(ram_addr_t ram_size,
 
     /* Load kernel. */
     if (kernel_filename) {
-        kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL);
-        if (kernel_size < 0) {
-            kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
-                                   &elf_lowaddr, NULL, 1, ELF_MACHINE, 0);
+        success = load_uimage(kernel_filename, &entry, &loadaddr, NULL);
+        if (success < 0) {
+            success = load_elf(kernel_filename, NULL, NULL, &elf_entry,
+                               &elf_lowaddr, NULL, 1, ELF_MACHINE, 0);
             entry = elf_entry;
             loadaddr = elf_lowaddr;
         }
         /* XXX try again as binary */
-        if (kernel_size < 0) {
+        if (success < 0) {
             fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     kernel_filename);
             exit(1);
@@ -135,26 +138,20 @@ static void bamboo_init(ram_addr_t ram_size,
 
     /* Load initrd. */
     if (initrd_filename) {
-        initrd_base = kernel_size + loadaddr;
-        initrd_size = load_image_targphys(initrd_filename, initrd_base,
-                                          ram_size - initrd_base);
+        initrd_size = load_image_targphys(initrd_filename, RAMDISK_ADDR,
+                                          ram_size - RAMDISK_ADDR);
 
         if (initrd_size < 0) {
-            fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
-                    initrd_filename);
+            fprintf(stderr, "qemu: could not load ram disk '%s' at %x\n",
+                    initrd_filename, RAMDISK_ADDR);
             exit(1);
         }
     }
 
     /* If we're loading a kernel directly, we must load the device tree too. */
     if (kernel_filename) {
-        if (initrd_base)
-            dt_base = initrd_base + initrd_size;
-        else
-            dt_base = kernel_size + loadaddr;
-
-        if (bamboo_load_device_tree(dt_base, ram_size,
-                        initrd_base, initrd_size, kernel_cmdline) < 0) {
+        if (bamboo_load_device_tree(FDT_ADDR, ram_size, RAMDISK_ADDR,
+                                    initrd_size, kernel_cmdline) < 0) {
             fprintf(stderr, "couldn't load device tree\n");
             exit(1);
         }
@@ -163,7 +160,7 @@ static void bamboo_init(ram_addr_t ram_size,
 
         /* Set initial guest state. */
         env->gpr[1] = (16<<20) - 8;
-        env->gpr[3] = dt_base;
+        env->gpr[3] = FDT_ADDR;
         env->nip = entry;
         /* XXX we currently depend on KVM to create some initial TLB entries. */
     }
commit a86299e53b77bfd9f80bfeb22f30e36b25233e5b
Author: Hollis Blanchard <hollis at penguinppc.org>
Date:   Wed Aug 4 17:21:36 2010 -0700

    ppc4xx: don't unregister RAM at reset
    
    The PowerPC 4xx SDRAM controller emulation unregisters RAM in its reset
    callback. However, qemu_system_reset() is now called at initialization
    time, so all RAM is unregistered before starting the guest (!).
    
    Signed-off-by: Hollis Blanchard <hollis at penguinppc.org>

diff --git a/hw/ppc4xx_devs.c b/hw/ppc4xx_devs.c
index be130c4..7f698b8 100644
--- a/hw/ppc4xx_devs.c
+++ b/hw/ppc4xx_devs.c
@@ -619,7 +619,6 @@ static void sdram_reset (void *opaque)
     /* We pre-initialize RAM banks */
     sdram->status = 0x00000000;
     sdram->cfg = 0x00800000;
-    sdram_unmap_bcr(sdram);
 }
 
 void ppc4xx_sdram_init (CPUState *env, qemu_irq irq, int nbanks,
commit d23ab92064dd40c668b55544b9b654591e8b963c
Author: Hollis Blanchard <hollis at penguinppc.org>
Date:   Wed Aug 4 17:21:35 2010 -0700

    ppc4xx: correct SDRAM controller warning message condition
    
    The message "Truncating memory to %d MiB to fit SDRAM controller limits"
    should be displayed only when a user chooses an amount of RAM which
    can't be represented by the PPC 4xx SDRAM controller (e.g. 129MB, which
    would only be valid if the controller supports a bank size of 1MB).
    
    Signed-off-by: Hollis Blanchard <hollis at penguinppc.org>

diff --git a/hw/ppc4xx_devs.c b/hw/ppc4xx_devs.c
index b15db81..be130c4 100644
--- a/hw/ppc4xx_devs.c
+++ b/hw/ppc4xx_devs.c
@@ -684,7 +684,7 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
     }
 
     ram_size -= size_left;
-    if (ram_size)
+    if (size_left)
         printf("Truncating memory to %d MiB to fit SDRAM controller limits.\n",
                (int)(ram_size >> 20));
 
commit 52ba784d357fac20e137cf1393437437c43a3fc4
Author: Hollis Blanchard <hollis at penguinppc.org>
Date:   Wed Aug 4 17:21:34 2010 -0700

    Fix "make install" with a cross toolchain
    
    We must be able to use a non-native strip executable, but not all
    versions of 'install' support the --strip-program option (e.g.
    OpenBSD). Accordingly, we can't use 'install -s', and we must run strip
    separately.
    
    Signed-off-by: Hollis Blanchard <hollis at penguinppc.org>
    Cc: blauwirbel at gmail.com

diff --git a/Makefile.target b/Makefile.target
index c8281e9..18826bb 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -329,7 +329,10 @@ clean:
 
 install: all
 ifneq ($(PROGS),)
-	$(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)"
+	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
+ifneq ($(STRIP),)
+	$(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
+endif
 endif
 
 # Include automatically generated dependency files
diff --git a/configure b/configure
index a20371c..146dac0 100755
--- a/configure
+++ b/configure
@@ -80,6 +80,7 @@ make="make"
 install="install"
 objcopy="objcopy"
 ld="ld"
+strip="strip"
 helper_cflags=""
 libs_softmmu=""
 libs_tools=""
@@ -125,6 +126,7 @@ cc="${cross_prefix}${cc}"
 ar="${cross_prefix}${ar}"
 objcopy="${cross_prefix}${objcopy}"
 ld="${cross_prefix}${ld}"
+strip="${cross_prefix}${strip}"
 
 # default flags for all hosts
 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
@@ -2227,7 +2229,7 @@ if test "$debug" = "yes" ; then
   echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
 fi
 if test "$strip_opt" = "yes" ; then
-  echo "STRIP_OPT=-s" >> $config_host_mak
+  echo "STRIP=${strip}" >> $config_host_mak
 fi
 if test "$bigendian" = "yes" ; then
   echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
commit 419ef5f1c6a9614e8ddcb0b0f826de692e7e4a43
Author: Alexander Graf <agraf at suse.de>
Date:   Thu Aug 26 18:15:20 2010 +0200

    PPC: Update openbios binary to r859
    
    This updates the openBIOS binary to r589, adding support for PPC PV feature
    pass-through in KVM.
    
    Signed-off-by: Alexander Graf <agraf at suse.de>

diff --git a/pc-bios/openbios-ppc b/pc-bios/openbios-ppc
index 9a749c8..cb0af05 100644
Binary files a/pc-bios/openbios-ppc and b/pc-bios/openbios-ppc differ
commit 45024f094c223e8096f366520414cdf1a74dbff3
Author: Alexander Graf <agraf at suse.de>
Date:   Tue Aug 3 15:22:42 2010 +0200

    PPC: Add PV hypercall transport through fw_cfg
    
    On KVM for PPC we need to tell the guest which instructions to use when
    doing a hypercall. The clean way to do this is to go through an ioctl
    from userspace and passing it on to the guest using the device tree.
    
    So let's do the qemu part here: read out the hypercall and pass it on
    to the guest's fw_cfg so openBIOS can read it out and expose it again.
    
    Signed-off-by: Alexander Graf <agraf at suse.de>

diff --git a/hw/ppc.h b/hw/ppc.h
index de13092..1251932 100644
--- a/hw/ppc.h
+++ b/hw/ppc.h
@@ -47,5 +47,8 @@ enum {
 #define FW_CFG_PPC_HEIGHT	(FW_CFG_ARCH_LOCAL + 0x01)
 #define FW_CFG_PPC_DEPTH	(FW_CFG_ARCH_LOCAL + 0x02)
 #define FW_CFG_PPC_TBFREQ	(FW_CFG_ARCH_LOCAL + 0x03)
+#define FW_CFG_PPC_IS_KVM       (FW_CFG_ARCH_LOCAL + 0x05)
+#define FW_CFG_PPC_KVM_HC       (FW_CFG_ARCH_LOCAL + 0x06)
+#define FW_CFG_PPC_KVM_PID      (FW_CFG_ARCH_LOCAL + 0x07)
 
 #define PPC_SERIAL_MM_BAUDBASE 399193
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index 639dcde..809a1cf 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -427,9 +427,16 @@ static void ppc_core99_init (ram_addr_t ram_size,
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
 
+    fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
     if (kvm_enabled()) {
 #ifdef CONFIG_KVM
+        uint8_t *hypercall;
+
         fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq());
+        hypercall = qemu_malloc(16);
+        kvmppc_get_hypercall(env, hypercall, 16);
+        fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16);
+        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid());
 #endif
     } else {
         fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, get_ticks_per_sec());
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index de6005e..a12a812 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -399,9 +399,16 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
 
+    fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
     if (kvm_enabled()) {
 #ifdef CONFIG_KVM
+        uint8_t *hypercall;
+
         fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq());
+        hypercall = qemu_malloc(16);
+        kvmppc_get_hypercall(env, hypercall, 16);
+        fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16);
+        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid());
 #endif
     } else {
         fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, get_ticks_per_sec());
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 1079ce1..14d6365 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -327,6 +327,38 @@ uint32_t kvmppc_get_tbfreq(void)
     return retval;
 }
 
+int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len)
+{
+    uint32_t *hc = (uint32_t*)buf;
+
+#ifdef KVM_CAP_PPC_GET_PVINFO
+    struct kvm_ppc_pvinfo pvinfo;
+
+    if (kvm_check_extension(env->kvm_state, KVM_CAP_PPC_GET_PVINFO) &&
+        !kvm_vm_ioctl(env->kvm_state, KVM_PPC_GET_PVINFO, &pvinfo)) {
+        memcpy(buf, pvinfo.hcall, buf_len);
+
+        return 0;
+    }
+#endif
+
+    /*
+     * Fallback to always fail hypercalls:
+     *
+     *     li r3, -1
+     *     nop
+     *     nop
+     *     nop
+     */
+
+    hc[0] = 0x3860ffff;
+    hc[1] = 0x60000000;
+    hc[2] = 0x60000000;
+    hc[3] = 0x60000000;
+
+    return 0;
+}
+
 bool kvm_arch_stop_on_emulation_error(CPUState *env)
 {
     return true;
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index e8d66e8..65e31c9 100644
--- a/target-ppc/kvm_ppc.h
+++ b/target-ppc/kvm_ppc.h
@@ -15,5 +15,6 @@ int kvmppc_read_host_property(const char *node_path, const char *prop,
                                      void *val, size_t len);
 
 uint32_t kvmppc_get_tbfreq(void);
+int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len);
 
 #endif /* __KVM_PPC_H__ */


More information about the Spice-commits mailing list