Commit fa388916 authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'origin/master' into staging

* origin/master: (75 commits)
  tcg: Don't make exitreq flag a local temporary
  Makefile: Add subdir dependency on config-devices-all.mak
  make_device_config.sh: Emit dependency file to directory where included
  Revert "make_device_config.sh: Fix target path in generated dependency file"
  s390/virtio-ccw: remove redundant call to blockdev_mark_auto_del
  s390/css: Fix subchannel detection
  Allow virtio-net features for legacy s390 virtio bus
  s390: virtio-ccw maintainer
  s390: simplify kvm cpu init
  pseries: Add compatible property to root of device tree
  target-ppc: Move CPU aliases out of translate_init.c
  target-ppc: Report CPU aliases for QMP
  target-ppc: List alias names alongside CPU models
  target-ppc: Make host CPU a subclass of the host's CPU model
  PPC: xnu kernel expects FLUSH to be cleared on STOP
  PPC: Fix dma interrupt
  target-ppc: Fix PPC_DUMP_SPR_ACCESS build
  target-ppc: Synchronize FPU state with KVM
  target-ppc: Add mechanism for synchronizing SPRs with KVM
  Save memory allocation in the elf loader
  ...
parents 6e72a00f a4960ef3
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -454,6 +454,14 @@ M: Alexander Graf <agraf@suse.de>
S: Maintained
F: hw/s390-*.c

S390 Virtio-ccw
M: Cornelia Huck <cornelia.huck@de.ibm.com>
M: Alexander Graf <agraf@suse.de>
S: Supported
F: hw/s390x/s390-virtio-ccw.c
F: hw/s390x/css.[hc]
T: git git://github.com/cohuck/qemu virtio-ccw-upstr

UniCore32 Machines
-------------
PKUnity-3 SoC initramfs-with-busybox
@@ -565,6 +573,12 @@ M: Stefan Hajnoczi <stefanha@redhat.com>
S: Supported
F: hw/virtio-blk*

virtio-ccw
M: Cornelia Huck <cornelia.huck@de.ibm.com>
S: Supported
F: hw/s390x/virtio-ccw.[hc]
T: git git://github.com/cohuck/qemu virtio-ccw-upstr

virtio-serial
M: Amit Shah <amit.shah@redhat.com>
S: Supported
+4 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ endif

SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %/config-devices.mak.d, $(TARGET_DIRS))
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))

ifeq ($(SUBDIR_DEVICES_MAK),)
config-all-devices.mak:
@@ -123,6 +123,9 @@ qemu-options.def: $(SRC_PATH)/qemu-options.hx
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")

SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))

$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak

subdir-%:
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
+11 −8
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ static int glue(load_elf, SZ)(const char *name, int fd,
    struct elfhdr ehdr;
    struct elf_phdr *phdr = NULL, *ph;
    int size, i, total_size;
    elf_word mem_size;
    elf_word mem_size, file_size;
    uint64_t addr, low = (uint64_t)-1, high = 0;
    uint8_t *data = NULL;
    char label[128];
@@ -252,15 +252,17 @@ static int glue(load_elf, SZ)(const char *name, int fd,
    for(i = 0; i < ehdr.e_phnum; i++) {
        ph = &phdr[i];
        if (ph->p_type == PT_LOAD) {
            mem_size = ph->p_memsz;
            /* XXX: avoid allocating */
            data = g_malloc0(mem_size);
            mem_size = ph->p_memsz; /* Size of the ROM */
            file_size = ph->p_filesz; /* Size of the allocated data */
            data = g_malloc0(file_size);
            if (ph->p_filesz > 0) {
                if (lseek(fd, ph->p_offset, SEEK_SET) < 0)
                if (lseek(fd, ph->p_offset, SEEK_SET) < 0) {
                    goto fail;
                if (read(fd, data, ph->p_filesz) != ph->p_filesz)
                }
                if (read(fd, data, file_size) != file_size) {
                    goto fail;
                }
            }
            /* address_offset is hack for kernel images that are
               linked at the wrong physical address.  */
            if (translate_fn) {
@@ -281,7 +283,9 @@ static int glue(load_elf, SZ)(const char *name, int fd,
            }

            snprintf(label, sizeof(label), "phdr #%d: %s", i, name);
            rom_add_blob_fixed(label, data, mem_size, addr);

            /* rom_add_elf_program() seize the ownership of 'data' */
            rom_add_elf_program(label, data, file_size, mem_size, addr);

            total_size += mem_size;
            if (addr < low)
@@ -289,7 +293,6 @@ static int glue(load_elf, SZ)(const char *name, int fd,
            if ((addr + mem_size) > high)
                high = addr + mem_size;

            g_free(data);
            data = NULL;
        }
    }
+62 −13
Original line number Diff line number Diff line
@@ -533,7 +533,14 @@ typedef struct Rom Rom;
struct Rom {
    char *name;
    char *path;

    /* datasize is the amount of memory allocated in "data". If datasize is less
     * than romsize, it means that the area from datasize to romsize is filled
     * with zeros.
     */
    size_t romsize;
    size_t datasize;

    uint8_t *data;
    int isrom;
    char *fw_dir;
@@ -591,12 +598,13 @@ int rom_add_file(const char *file, const char *fw_dir,
    }
    rom->addr     = addr;
    rom->romsize  = lseek(fd, 0, SEEK_END);
    rom->data    = g_malloc0(rom->romsize);
    rom->datasize = rom->romsize;
    rom->data     = g_malloc0(rom->datasize);
    lseek(fd, 0, SEEK_SET);
    rc = read(fd, rom->data, rom->romsize);
    if (rc != rom->romsize) {
    rc = read(fd, rom->data, rom->datasize);
    if (rc != rom->datasize) {
        fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %zd)\n",
                rom->name, rc, rom->romsize);
                rom->name, rc, rom->datasize);
        goto err;
    }
    close(fd);
@@ -641,12 +649,33 @@ int rom_add_blob(const char *name, const void *blob, size_t len,
    rom->name     = g_strdup(name);
    rom->addr     = addr;
    rom->romsize  = len;
    rom->data    = g_malloc0(rom->romsize);
    rom->datasize = len;
    rom->data     = g_malloc0(rom->datasize);
    memcpy(rom->data, blob, len);
    rom_insert(rom);
    return 0;
}

/* This function is specific for elf program because we don't need to allocate
 * all the rom. We just allocate the first part and the rest is just zeros. This
 * is why romsize and datasize are different. Also, this function seize the
 * memory ownership of "data", so we don't have to allocate and copy the buffer.
 */
int rom_add_elf_program(const char *name, void *data, size_t datasize,
                        size_t romsize, hwaddr addr)
{
    Rom *rom;

    rom           = g_malloc0(sizeof(*rom));
    rom->name     = g_strdup(name);
    rom->addr     = addr;
    rom->datasize = datasize;
    rom->romsize  = romsize;
    rom->data     = data;
    rom_insert(rom);
    return 0;
}

int rom_add_vga(const char *file)
{
    return rom_add_file(file, "vgaroms", 0, -1);
@@ -668,7 +697,7 @@ static void rom_reset(void *unused)
        if (rom->data == NULL) {
            continue;
        }
        cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize);
        cpu_physical_memory_write_rom(rom->addr, rom->data, rom->datasize);
        if (rom->isrom) {
            /* rom needs to be written only once */
            g_free(rom->data);
@@ -756,13 +785,33 @@ int rom_copy(uint8_t *dest, hwaddr addr, size_t size)

        d = dest + (rom->addr - addr);
        s = rom->data;
        l = rom->romsize;
        l = rom->datasize;

        if ((d + l) > (dest + size)) {
            l = dest - d;
        }

        memcpy(d, s, l);

        if (rom->romsize > rom->datasize) {
            /* If datasize is less than romsize, it means that we didn't
             * allocate all the ROM because the trailing data are only zeros.
             */

            d += l;
            l = rom->romsize - rom->datasize;

            if ((d + l) > (dest + size)) {
                /* Rom size doesn't fit in the destination area. Adjust to avoid
                 * overflow.
                 */
                l = dest - d;
            }

            if (l > 0) {
                memset(d, 0x0, l);
            }
        }
    }

    return (d + l) - dest;
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ int rom_add_file(const char *file, const char *fw_dir,
                 hwaddr addr, int32_t bootindex);
int rom_add_blob(const char *name, const void *blob, size_t len,
                 hwaddr addr);
int rom_add_elf_program(const char *name, void *data, size_t datasize,
                        size_t romsize, hwaddr addr);
int rom_load_all(void);
void rom_set_fw(void *f);
int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
Loading