From patchwork Mon Jul 9 07:43:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="b5TAFDWF"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHRX0jCnz9s19 for ; Mon, 9 Jul 2018 17:44:56 +1000 (AEST) Received: from localhost ([::1]:39704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqr-00054G-Jx for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:44:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq7-00052x-Ab for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq4-0002AG-8H for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:07 -0400 Received: from ozlabs.org ([203.11.71.1]:37659) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq3-00028l-PK; Mon, 09 Jul 2018 03:44:04 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQR6MKTz9s1R; Mon, 9 Jul 2018 17:43:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122239; bh=WLn37f4Y//iG9x7hNDMj0rT4/JEybsCeSRIqYj6aO+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5TAFDWFAQ0Gvr+3CnWxuwuRlZw/mtITgIg8/1zcaTeGCPxVmKzcJtujtGDkZXXE5 vbkW8dbuwm0UunrYbqPKIgTdyFt3hcgALrVD0L5+L4GrkUHwx4qhbs54c9cQBpSsdE heEvVRT/0PEm0DMnkD9kqXour2z5oGc3m61hL+/o= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:35 +1000 Message-Id: <20180709074350.27086-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 01/16] ppc: fix default VGA display for Mac machines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland Commit 29f9cef39e "ppc: Include vga cirrus card into the compiling process" changed the default display adapter for all PPC machines to cirrus. Unfortunately it missed setting the default display type to stdvga for both Mac machines causing the display to fail to initialise under OpenBIOS. Update the MachineClass for both Old World and New World Macs so that the default std(vga) display adapter is the default if no options are specified which fixes the display for the Mac machines. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ppc/mac_newworld.c | 1 + hw/ppc/mac_oldworld.c | 1 + 2 files changed, 2 insertions(+) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index d11980166f..2ca294664b 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -525,6 +525,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data) mc->block_default_type = IF_IDE; mc->max_cpus = MAX_CPUS; mc->default_boot_order = "cd"; + mc->default_display = "std"; mc->kvm_type = core99_kvm_type; #ifdef TARGET_PPC64 mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1"); diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 06ed6f660e..064d7eb30a 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -383,6 +383,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data) mc->default_boot_order = "cd"; mc->kvm_type = heathrow_kvm_type; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("750_v3.1"); + mc->default_display = "std"; } static const TypeInfo ppc_heathrow_machine_info = { From patchwork Mon Jul 9 07:43:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="mDDLIOjp"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHRX5tvyz9s1B for ; Mon, 9 Jul 2018 17:44:56 +1000 (AEST) Received: from localhost ([::1]:39705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqs-00054g-En for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:44:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq6-00052w-M9 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq4-0002Ay-QJ for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:06 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:51621) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq4-00028p-3Q; Mon, 09 Jul 2018 03:44:04 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS0MfJz9s1B; Mon, 9 Jul 2018 17:43:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=Kl66ftRR2PbEUenRgNI7yDlAF6dZoZQyXh2JmpzJCB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDDLIOjpxgSxGDKcB+51mEjmaRtL1Clegvju+omkBYgMUaC0IGmIW5PZFiH1FEUVE +ixY/KGgc2WlFc/ki5y5wzozJnzn/mg397kTPhFvacjxtDH85mBa1mnrY5qQ0cEube 5oi00kJvSr1o5S4gWrMYUCvC88fib4ni4TuW/ty4= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:37 +1000 Message-Id: <20180709074350.27086-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 03/16] sm501: Implement i2c part for reading monitor EDID X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: BALATON Zoltan Emulate the i2c part of SM501 which is used to access the EDID info from a monitor. The vmstate structure is changed and its version is increased but SM501 is only used on SH and PPC sam460ex machines that don't support cross-version migration. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: David Gibson --- default-configs/ppc-softmmu.mak | 1 + default-configs/ppcemb-softmmu.mak | 1 + default-configs/sh4-softmmu.mak | 2 + default-configs/sh4eb-softmmu.mak | 2 + hw/display/sm501.c | 147 ++++++++++++++++++++++++++++- 5 files changed, 149 insertions(+), 4 deletions(-) diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak index 6f12bf84f0..3181bbf163 100644 --- a/default-configs/ppc-softmmu.mak +++ b/default-configs/ppc-softmmu.mak @@ -25,6 +25,7 @@ CONFIG_ETSEC=y CONFIG_SAM460EX=y CONFIG_USB_EHCI_SYSBUS=y CONFIG_SM501=y +CONFIG_DDC=y CONFIG_IDE_SII3112=y CONFIG_I2C=y CONFIG_BITBANG_I2C=y diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak index 37af1930b3..ac44f150c6 100644 --- a/default-configs/ppcemb-softmmu.mak +++ b/default-configs/ppcemb-softmmu.mak @@ -17,6 +17,7 @@ CONFIG_XILINX=y CONFIG_XILINX_ETHLITE=y CONFIG_USB_EHCI_SYSBUS=y CONFIG_SM501=y +CONFIG_DDC=y CONFIG_IDE_SII3112=y CONFIG_I2C=y CONFIG_BITBANG_I2C=y diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.mak index 546d855088..caeccd55be 100644 --- a/default-configs/sh4-softmmu.mak +++ b/default-configs/sh4-softmmu.mak @@ -9,6 +9,8 @@ CONFIG_PFLASH_CFI02=y CONFIG_SH4=y CONFIG_IDE_MMIO=y CONFIG_SM501=y +CONFIG_I2C=y +CONFIG_DDC=y CONFIG_ISA_TESTDEV=y CONFIG_I82378=y CONFIG_I8259=y diff --git a/default-configs/sh4eb-softmmu.mak b/default-configs/sh4eb-softmmu.mak index 2d3fd49663..53b9cd7b5a 100644 --- a/default-configs/sh4eb-softmmu.mak +++ b/default-configs/sh4eb-softmmu.mak @@ -9,6 +9,8 @@ CONFIG_PFLASH_CFI02=y CONFIG_SH4=y CONFIG_IDE_MMIO=y CONFIG_SM501=y +CONFIG_I2C=y +CONFIG_DDC=y CONFIG_ISA_TESTDEV=y CONFIG_I82378=y CONFIG_I8259=y diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 9dec0d3218..05c964bea1 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qapi/error.h" +#include "qemu/log.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" @@ -34,6 +35,8 @@ #include "hw/devices.h" #include "hw/sysbus.h" #include "hw/pci/pci.h" +#include "hw/i2c/i2c.h" +#include "hw/i2c/i2c-ddc.h" #include "qemu/range.h" #include "ui/pixel_ops.h" @@ -216,6 +219,14 @@ #define SM501_I2C_SLAVE_ADDRESS (0x03) #define SM501_I2C_DATA (0x04) +#define SM501_I2C_CONTROL_START (1 << 2) +#define SM501_I2C_CONTROL_ENABLE (1 << 0) + +#define SM501_I2C_STATUS_COMPLETE (1 << 3) +#define SM501_I2C_STATUS_ERROR (1 << 2) + +#define SM501_I2C_RESET_ERROR (1 << 2) + /* SSP base */ #define SM501_SSP (0x020000) @@ -471,10 +482,12 @@ typedef struct SM501State { MemoryRegion local_mem_region; MemoryRegion mmio_region; MemoryRegion system_config_region; + MemoryRegion i2c_region; MemoryRegion disp_ctrl_region; MemoryRegion twoD_engine_region; uint32_t last_width; uint32_t last_height; + I2CBus *i2c_bus; /* mmio registers */ uint32_t system_control; @@ -487,6 +500,11 @@ typedef struct SM501State { uint32_t misc_timing; uint32_t power_mode_control; + uint8_t i2c_byte_count; + uint8_t i2c_status; + uint8_t i2c_addr; + uint8_t i2c_data[16]; + uint32_t uart0_ier; uint32_t uart0_lcr; uint32_t uart0_mcr; @@ -897,6 +915,109 @@ static const MemoryRegionOps sm501_system_config_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +static uint64_t sm501_i2c_read(void *opaque, hwaddr addr, unsigned size) +{ + SM501State *s = (SM501State *)opaque; + uint8_t ret = 0; + + switch (addr) { + case SM501_I2C_BYTE_COUNT: + ret = s->i2c_byte_count; + break; + case SM501_I2C_STATUS: + ret = s->i2c_status; + break; + case SM501_I2C_SLAVE_ADDRESS: + ret = s->i2c_addr; + break; + case SM501_I2C_DATA ... SM501_I2C_DATA + 15: + ret = s->i2c_data[addr - SM501_I2C_DATA]; + break; + default: + qemu_log_mask(LOG_UNIMP, "sm501 i2c : not implemented register read." + " addr=0x%" HWADDR_PRIx "\n", addr); + } + + SM501_DPRINTF("sm501 i2c regs : read addr=%" HWADDR_PRIx " val=%x\n", + addr, ret); + return ret; +} + +static void sm501_i2c_write(void *opaque, hwaddr addr, uint64_t value, + unsigned size) +{ + SM501State *s = (SM501State *)opaque; + SM501_DPRINTF("sm501 i2c regs : write addr=%" HWADDR_PRIx + " val=%" PRIx64 "\n", addr, value); + + switch (addr) { + case SM501_I2C_BYTE_COUNT: + s->i2c_byte_count = value & 0xf; + break; + case SM501_I2C_CONTROL: + if (value & SM501_I2C_CONTROL_ENABLE) { + if (value & SM501_I2C_CONTROL_START) { + int res = i2c_start_transfer(s->i2c_bus, + s->i2c_addr >> 1, + s->i2c_addr & 1); + s->i2c_status |= (res ? SM501_I2C_STATUS_ERROR : 0); + if (!res) { + int i; + SM501_DPRINTF("sm501 i2c : transferring %d bytes to 0x%x\n", + s->i2c_byte_count + 1, s->i2c_addr >> 1); + for (i = 0; i <= s->i2c_byte_count; i++) { + res = i2c_send_recv(s->i2c_bus, &s->i2c_data[i], + !(s->i2c_addr & 1)); + if (res) { + SM501_DPRINTF("sm501 i2c : transfer failed" + " i=%d, res=%d\n", i, res); + s->i2c_status |= (res ? SM501_I2C_STATUS_ERROR : 0); + return; + } + } + if (i) { + SM501_DPRINTF("sm501 i2c : transferred %d bytes\n", i); + s->i2c_status = SM501_I2C_STATUS_COMPLETE; + } + } + } else { + SM501_DPRINTF("sm501 i2c : end transfer\n"); + i2c_end_transfer(s->i2c_bus); + s->i2c_status &= ~SM501_I2C_STATUS_ERROR; + } + } + break; + case SM501_I2C_RESET: + if ((value & SM501_I2C_RESET_ERROR) == 0) { + s->i2c_status &= ~SM501_I2C_STATUS_ERROR; + } + break; + case SM501_I2C_SLAVE_ADDRESS: + s->i2c_addr = value & 0xff; + break; + case SM501_I2C_DATA ... SM501_I2C_DATA + 15: + s->i2c_data[addr - SM501_I2C_DATA] = value & 0xff; + break; + default: + qemu_log_mask(LOG_UNIMP, "sm501 i2c : not implemented register write. " + "addr=0x%" HWADDR_PRIx " val=%" PRIx64 "\n", addr, value); + } +} + +static const MemoryRegionOps sm501_i2c_ops = { + .read = sm501_i2c_read, + .write = sm501_i2c_write, + .valid = { + .min_access_size = 1, + .max_access_size = 1, + }, + .impl = { + .min_access_size = 1, + .max_access_size = 1, + }, + .endianness = DEVICE_LITTLE_ENDIAN, +}; + static uint32_t sm501_palette_read(void *opaque, hwaddr addr) { SM501State *s = (SM501State *)opaque; @@ -1577,6 +1698,10 @@ static void sm501_reset(SM501State *s) s->irq_mask = 0; s->misc_timing = 0; s->power_mode_control = 0; + s->i2c_byte_count = 0; + s->i2c_status = 0; + s->i2c_addr = 0; + memset(s->i2c_data, 0, 16); s->dc_panel_control = 0x00010000; /* FIFO level 3 */ s->dc_video_control = 0; s->dc_crt_control = 0x00010000; @@ -1615,6 +1740,12 @@ static void sm501_init(SM501State *s, DeviceState *dev, memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA); s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region); + /* i2c */ + s->i2c_bus = i2c_init_bus(dev, "sm501.i2c"); + /* ddc */ + I2CDDCState *ddc = I2CDDC(qdev_create(BUS(s->i2c_bus), TYPE_I2CDDC)); + i2c_set_slave_address(I2C_SLAVE(ddc), 0x50); + /* mmio */ memory_region_init(&s->mmio_region, OBJECT(dev), "sm501.mmio", MMIO_SIZE); memory_region_init_io(&s->system_config_region, OBJECT(dev), @@ -1622,6 +1753,9 @@ static void sm501_init(SM501State *s, DeviceState *dev, "sm501-system-config", 0x6c); memory_region_add_subregion(&s->mmio_region, SM501_SYS_CONFIG, &s->system_config_region); + memory_region_init_io(&s->i2c_region, OBJECT(dev), &sm501_i2c_ops, s, + "sm501-i2c", 0x14); + memory_region_add_subregion(&s->mmio_region, SM501_I2C, &s->i2c_region); memory_region_init_io(&s->disp_ctrl_region, OBJECT(dev), &sm501_disp_ctrl_ops, s, "sm501-disp-ctrl", 0x1000); @@ -1705,6 +1839,11 @@ static const VMStateDescription vmstate_sm501_state = { VMSTATE_UINT32(twoD_destination_base, SM501State), VMSTATE_UINT32(twoD_alpha, SM501State), VMSTATE_UINT32(twoD_wrap, SM501State), + /* Added in version 2 */ + VMSTATE_UINT8(i2c_byte_count, SM501State), + VMSTATE_UINT8(i2c_status, SM501State), + VMSTATE_UINT8(i2c_addr, SM501State), + VMSTATE_UINT8_ARRAY(i2c_data, SM501State, 16), VMSTATE_END_OF_LIST() } }; @@ -1770,8 +1909,8 @@ static void sm501_reset_sysbus(DeviceState *dev) static const VMStateDescription vmstate_sm501_sysbus = { .name = TYPE_SYSBUS_SM501, - .version_id = 1, - .minimum_version_id = 1, + .version_id = 2, + .minimum_version_id = 2, .fields = (VMStateField[]) { VMSTATE_STRUCT(state, SM501SysBusState, 1, vmstate_sm501_state, SM501State), @@ -1843,8 +1982,8 @@ static void sm501_reset_pci(DeviceState *dev) static const VMStateDescription vmstate_sm501_pci = { .name = TYPE_PCI_SM501, - .version_id = 1, - .minimum_version_id = 1, + .version_id = 2, + .minimum_version_id = 2, .fields = (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, SM501PCIState), VMSTATE_STRUCT(state, SM501PCIState, 1, From patchwork Mon Jul 9 07:43:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="XIkta34S"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHWJ468yz9s00 for ; Mon, 9 Jul 2018 17:48:12 +1000 (AEST) Received: from localhost ([::1]:39722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQu2-0007lv-5u for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:48:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq5-00052f-Ej for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq4-0002Ac-Ef for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:05 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:59613) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq4-00028o-1Z; Mon, 09 Jul 2018 03:44:04 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS1HBcz9s1b; Mon, 9 Jul 2018 17:43:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=rXki+7d3256sgFXV02Qnk7jleWx4jlhogkI/OQoo6tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIkta34SfOBcomby2Bz51NoP9Ogl6UpAIC+32qkLL5vEj4BZLpTTZ4NxH9PZ/liQH wi6waXL1zfBGrn8xbf+Z68JxDuaJZ/gWKXOqobFW1EqKVPtdB4fWkf9rZt/bGDNPUm AxBgjkLIZ/rMeGyrWnEunVZHjCtj9/kmKaRfKfZc= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:38 +1000 Message-Id: <20180709074350.27086-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 04/16] sm501: Perform a full update after palette change X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Bauer , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Sebastian Bauer Changing the palette of a color index has as an immediate effect on all pixels with the corresponding index on real hardware. Performing a full update after a palette change is a simple way to emulate this effect. Signed-off-by: Sebastian Bauer Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 05c964bea1..b095134d6f 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -487,6 +487,7 @@ typedef struct SM501State { MemoryRegion twoD_engine_region; uint32_t last_width; uint32_t last_height; + bool do_full_update; /* perform a full update next time */ I2CBus *i2c_bus; /* mmio registers */ @@ -1042,6 +1043,7 @@ static void sm501_palette_write(void *opaque, hwaddr addr, assert(range_covers_byte(0, 0x400 * 3, addr)); *(uint32_t *)&s->dc_palette[addr] = value; + s->do_full_update = true; } static uint64_t sm501_disp_ctrl_read(void *opaque, hwaddr addr, @@ -1630,6 +1632,12 @@ static void sm501_update_display(void *opaque) full_update = 1; } + /* someone else requested a full update */ + if (s->do_full_update) { + s->do_full_update = false; + full_update = 1; + } + /* draw each line according to conditions */ snap = memory_region_snapshot_and_clear_dirty(&s->local_mem_region, offset, width * height * src_bpp, DIRTY_MEMORY_VGA); From patchwork Mon Jul 9 07:43:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="AEY9y3Ae"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHWN1bjCz9s00 for ; Mon, 9 Jul 2018 17:48:16 +1000 (AEST) Received: from localhost ([::1]:39723 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQu5-0007mr-R7 for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:48:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq8-00053C-IG for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq7-0002Da-JE for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:08 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:54083) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq7-0002Au-6M; Mon, 09 Jul 2018 03:44:07 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS33Gqz9s21; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=KELtYZs+KGH2LCza3YVbFGN78Xfkg6P7KNGA9WMTdzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEY9y3Ae0OntPUiW7jkoXjD7VuvmvCaW7c1tNLgPl/jLrJqAe3MeP9AGc6gIM3NOb YmsYiA1O2VmIJe6ETQbfkN0AS8de/uGM6aa0qM165zkXBbvykzWKkGDeOFJBepbh0l eXGfoVxJSp1COPnYdx7oqFe25T7Qyap8i+hYL2Bk= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:39 +1000 Message-Id: <20180709074350.27086-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 05/16] sm501: Use values from the pitch register for 2D operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Bauer , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Sebastian Bauer Before, crt_h_total was used for src_width and dst_width. This is a property of the current display setting and not relevant for the 2D operation that also can be done off-screen. The pitch register's purpose is to describe line pitch relevant of the 2D operation. Signed-off-by: Sebastian Bauer Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index b095134d6f..d4878f01c0 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -709,8 +709,8 @@ static void sm501_2d_operation(SM501State *s) /* get frame buffer info */ uint8_t *src = s->local_mem + (s->twoD_source_base & 0x03FFFFFF); uint8_t *dst = s->local_mem + (s->twoD_destination_base & 0x03FFFFFF); - int src_width = (s->dc_crt_h_total & 0x00000FFF) + 1; - int dst_width = (s->dc_crt_h_total & 0x00000FFF) + 1; + int src_width = s->twoD_pitch & 0x1FFF; + int dst_width = (s->twoD_pitch >> 16) & 0x1FFF; if (addressing != 0x0) { printf("%s: only XY addressing is supported.\n", __func__); From patchwork Mon Jul 9 07:43:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941143 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="p53pRXe+"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHfq6Ggrz9s1B for ; Mon, 9 Jul 2018 17:54:43 +1000 (AEST) Received: from localhost ([::1]:39759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcR0L-0004WW-E7 for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:54:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq9-00053m-Fn for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq7-0002E9-W0 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:09 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:33577) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq7-0002BA-7c; Mon, 09 Jul 2018 03:44:07 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS4v8Yz9s2R; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=Th6+ZBTQI1ljjatnqH4MUDQSIaTbOY3VOfkYpK4MM+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p53pRXe+cHgvc9m69djBtnhFoicko0fjO47Q+KLNJeAQQorl1yaK9CRFCkSf3aHgs LInwg699IimvNXMs04xuA5VieiuSAr7OPQL1FYHOXE9rCgWrC33jsALrlIfbkUA1GP TLXDcD97kgsu1ErcZWRgV8fxNMobhgJleQfPjbQA= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:40 +1000 Message-Id: <20180709074350.27086-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 06/16] sm501: Implement negated destination raster operation mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Bauer , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Sebastian Bauer Add support for the negated destination operation mode. This is used e.g. by AmigaOS for the INVERSEVID drawing mode. With this change, the cursor in the shell and non-immediate window adjustment are working now. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index d4878f01c0..0b44d95169 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -705,6 +705,8 @@ static void sm501_2d_operation(SM501State *s) uint32_t color = s->twoD_foreground; int format_flags = (s->twoD_stretch >> 20) & 0x3; int addressing = (s->twoD_stretch >> 16) & 0xF; + int rop_mode = (s->twoD_control >> 15) & 0x1; /* 1 for rop2, else rop3 */ + int rop = s->twoD_control & 0xFF; /* get frame buffer info */ uint8_t *src = s->local_mem + (s->twoD_source_base & 0x03FFFFFF); @@ -729,6 +731,8 @@ static void sm501_2d_operation(SM501State *s) int y, x, index_d, index_s; \ for (y = 0; y < operation_height; y++) { \ for (x = 0; x < operation_width; x++) { \ + _pixel_type val; \ + \ if (rtl) { \ index_s = ((src_y - y) * src_width + src_x - x) * _bpp; \ index_d = ((dst_y - y) * dst_width + dst_x - x) * _bpp; \ @@ -736,7 +740,13 @@ static void sm501_2d_operation(SM501State *s) index_s = ((src_y + y) * src_width + src_x + x) * _bpp; \ index_d = ((dst_y + y) * dst_width + dst_x + x) * _bpp; \ } \ - *(_pixel_type *)&dst[index_d] = *(_pixel_type *)&src[index_s];\ + if (rop_mode == 1 && rop == 5) { \ + /* Invert dest */ \ + val = ~*(_pixel_type *)&dst[index_d]; \ + } else { \ + val = *(_pixel_type *)&src[index_s]; \ + } \ + *(_pixel_type *)&dst[index_d] = val; \ } \ } \ } From patchwork Mon Jul 9 07:43:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941140 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="pxJX7U6J"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHb66kxJz9s00 for ; Mon, 9 Jul 2018 17:51:30 +1000 (AEST) Received: from localhost ([::1]:39738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQxB-00021E-Np for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:51:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq8-000531-8E for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq7-0002D6-5A for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:08 -0400 Received: from ozlabs.org ([203.11.71.1]:51937) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq6-0002Aq-PH; Mon, 09 Jul 2018 03:44:07 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS4BQlz9s29; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=1XixQfBjF9oDe8h/dsXqCfzISjyVmavgcodWxH4zDMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxJX7U6JORwKqGNRsxKPO6ac6MIfQXoisbZCmluoIP7To7yheRpHC8vxpTdAk0Bt9 DgYdwAJBJqGezXPWbwMDWomo0K8QlA3mUGu5zlZ776Ig9T3xEROR5QzPSZ09Wu4tyE hb+iVEbab1WP6B0My27Zai1cDOxoenzb/FLGQ6ZI= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:41 +1000 Message-Id: <20180709074350.27086-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 07/16] sm501: Log unimplemented raster operation modes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Bauer , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Sebastian Bauer The sm501 currently implements only a very limited set of raster operation modes. After this change, unknown raster operation modes are logged so these can be easily spotted. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 0b44d95169..ebd139006e 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -706,6 +706,8 @@ static void sm501_2d_operation(SM501State *s) int format_flags = (s->twoD_stretch >> 20) & 0x3; int addressing = (s->twoD_stretch >> 16) & 0xF; int rop_mode = (s->twoD_control >> 15) & 0x1; /* 1 for rop2, else rop3 */ + /* 1 if rop2 source is the pattern, otherwise the source is the bitmap */ + int rop2_source_is_pattern = (s->twoD_control >> 14) & 0x1; int rop = s->twoD_control & 0xFF; /* get frame buffer info */ @@ -719,6 +721,27 @@ static void sm501_2d_operation(SM501State *s) abort(); } + if (rop_mode == 0) { + if (rop != 0xcc) { + /* Anything other than plain copies are not supported */ + qemu_log_mask(LOG_UNIMP, "sm501: rop3 mode with rop %x is not " + "supported.\n", rop); + } + } else { + if (rop2_source_is_pattern && rop != 0x5) { + /* For pattern source, we support only inverse dest */ + qemu_log_mask(LOG_UNIMP, "sm501: rop2 source being the pattern and " + "rop %x is not supported.\n", rop); + } else { + if (rop != 0x5 && rop != 0xc) { + /* Anything other than plain copies or inverse dest is not + * supported */ + qemu_log_mask(LOG_UNIMP, "sm501: rop mode %x is not " + "supported.\n", rop); + } + } + } + if ((s->twoD_source_base & 0x08000000) || (s->twoD_destination_base & 0x08000000)) { printf("%s: only local memory is supported.\n", __func__); From patchwork Mon Jul 9 07:43:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941145 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="NfHrHWt0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHjC6LJsz9s00 for ; Mon, 9 Jul 2018 17:56:46 +1000 (AEST) Received: from localhost ([::1]:39783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcR2K-0006KQ-8Q for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:56:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq9-00053a-8C for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq7-0002Dv-Qv for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:09 -0400 Received: from ozlabs.org ([203.11.71.1]:55635) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq7-0002B8-6I; Mon, 09 Jul 2018 03:44:07 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS6x9Jz9s5R; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=XunpEvgt5s8r5KiLcwi0V+OsjPsa9DcOE/nc/aADvpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NfHrHWt0S9nAXfsRpwb50lNB02cgVKDe4YmumWaDnA0McW+Sly342u4yTWLOyW9ux DAh+97H68hZLvWNRZfqkg8fn+ZP2dzIQ76bZ/LA8j+f4qY2mBpth8SA6oTt/jcWcAL k/jeWbIRZ4PU4wDcQ/NnkdYcNrubRlfbWW5nb39c= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:42 +1000 Message-Id: <20180709074350.27086-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 08/16] sm501: Fix support for non-zero frame buffer start address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Bauer , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: BALATON Zoltan Display updates and drawing hardware cursor did not work when frame buffer address was non-zero. Fix this by taking the frame buffer address into account in these cases. This fixes screen dragging on AmigaOS. Based on patch by Sebastian Bauer. Signed-off-by: Sebastian Bauer Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index ebd139006e..10ee008eb2 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -586,6 +586,11 @@ static uint32_t get_local_mem_size_index(uint32_t size) return index; } +static ram_addr_t get_fb_addr(SM501State *s, int crt) +{ + return (crt ? s->dc_crt_fb_addr : s->dc_panel_fb_addr) & 0x3FFFFF0; +} + static inline int get_width(SM501State *s, int crt) { int width = crt ? s->dc_crt_h_total : s->dc_panel_h_total; @@ -688,7 +693,8 @@ static inline void hwc_invalidate(SM501State *s, int crt) start *= w * bpp; end *= w * bpp; - memory_region_set_dirty(&s->local_mem_region, start, end - start); + memory_region_set_dirty(&s->local_mem_region, + get_fb_addr(s, crt) + start, end - start); } static void sm501_2d_operation(SM501State *s) @@ -1213,6 +1219,9 @@ static void sm501_disp_ctrl_write(void *opaque, hwaddr addr, break; case SM501_DC_PANEL_FB_ADDR: s->dc_panel_fb_addr = value & 0x8FFFFFF0; + if (value & 0x8000000) { + qemu_log_mask(LOG_UNIMP, "Panel external memory not supported\n"); + } break; case SM501_DC_PANEL_FB_OFFSET: s->dc_panel_fb_offset = value & 0x3FF03FF0; @@ -1273,6 +1282,9 @@ static void sm501_disp_ctrl_write(void *opaque, hwaddr addr, break; case SM501_DC_CRT_FB_ADDR: s->dc_crt_fb_addr = value & 0x8FFFFFF0; + if (value & 0x8000000) { + qemu_log_mask(LOG_UNIMP, "CRT external memory not supported\n"); + } break; case SM501_DC_CRT_FB_OFFSET: s->dc_crt_fb_offset = value & 0x3FF03FF0; @@ -1615,7 +1627,7 @@ static void sm501_update_display(void *opaque) draw_hwc_line_func *draw_hwc_line = NULL; int full_update = 0; int y_start = -1; - ram_addr_t offset = 0; + ram_addr_t offset; uint32_t *palette; uint8_t hwc_palette[3 * 3]; uint8_t *hwc_src = NULL; @@ -1672,9 +1684,10 @@ static void sm501_update_display(void *opaque) } /* draw each line according to conditions */ + offset = get_fb_addr(s, crt); snap = memory_region_snapshot_and_clear_dirty(&s->local_mem_region, offset, width * height * src_bpp, DIRTY_MEMORY_VGA); - for (y = 0, offset = 0; y < height; y++, offset += width * src_bpp) { + for (y = 0; y < height; y++, offset += width * src_bpp) { int update, update_hwc; /* check if hardware cursor is enabled and we're within its range */ From patchwork Mon Jul 9 07:43:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941136 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="fc6YL6La"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHWF3vzJz9s00 for ; Mon, 9 Jul 2018 17:48:09 +1000 (AEST) Received: from localhost ([::1]:39718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQtz-0007j6-5S for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:48:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq8-000530-5F for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq7-0002DC-53 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:08 -0400 Received: from ozlabs.org ([203.11.71.1]:41957) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq6-0002B5-QF; Mon, 09 Jul 2018 03:44:07 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS5d2Nz9s2L; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=7GfICPQPsIbTS3iUKmiQ6IVG2sGsquE2IFeAxz7ENq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fc6YL6La1MPIsl1DYOPV95J2DyjXGCDa8eGQJBLZMNMZSoGi078b+2ATZYw2GsMC/ Rfe0MLcTqkDDfXYN/+h6gpDZK4TQ9QQ9e8WxJXzfJHY2rRqq3Lzek9kFB9MdW2Tfcm Q1nk+F1UKhODHYKXAxt1RQvrQB9OTc4ikn8gCI3g= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:43 +1000 Message-Id: <20180709074350.27086-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 09/16] sm501: Set updated region dirty after 2D operation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: BALATON Zoltan Set the changed memory region dirty after performed a 2D operation to ensure that the screen is updated properly. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 10ee008eb2..3661a89f60 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -715,12 +715,16 @@ static void sm501_2d_operation(SM501State *s) /* 1 if rop2 source is the pattern, otherwise the source is the bitmap */ int rop2_source_is_pattern = (s->twoD_control >> 14) & 0x1; int rop = s->twoD_control & 0xFF; + uint32_t src_base = s->twoD_source_base & 0x03FFFFFF; + uint32_t dst_base = s->twoD_destination_base & 0x03FFFFFF; /* get frame buffer info */ - uint8_t *src = s->local_mem + (s->twoD_source_base & 0x03FFFFFF); - uint8_t *dst = s->local_mem + (s->twoD_destination_base & 0x03FFFFFF); + uint8_t *src = s->local_mem + src_base; + uint8_t *dst = s->local_mem + dst_base; int src_width = s->twoD_pitch & 0x1FFF; int dst_width = (s->twoD_pitch >> 16) & 0x1FFF; + int crt = (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0; + int fb_len = get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt); if (addressing != 0x0) { printf("%s: only XY addressing is supported.\n", __func__); @@ -821,6 +825,15 @@ static void sm501_2d_operation(SM501State *s) abort(); break; } + + if (dst_base >= get_fb_addr(s, crt) && + dst_base <= get_fb_addr(s, crt) + fb_len) { + int dst_len = MIN(fb_len, ((dst_y + operation_height - 1) * dst_width + + dst_x + operation_width) * (1 << format_flags)); + if (dst_len) { + memory_region_set_dirty(&s->local_mem_region, dst_base, dst_len); + } + } } static uint64_t sm501_system_config_read(void *opaque, hwaddr addr, From patchwork Mon Jul 9 07:43:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="X//lJpmB"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHnK5YHHz9s1B for ; Mon, 9 Jul 2018 18:00:21 +1000 (AEST) Received: from localhost ([::1]:39799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcR5n-0000QO-FE for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 04:00:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqB-00056V-JV for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQqA-0002HY-B1 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:11 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:35391) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq9-0002Dh-Qu; Mon, 09 Jul 2018 03:44:10 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQT1VFxz9s6w; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122241; bh=hJfdzynxclGbpMXGrg+8lDg1mJS6JdjY8f6oMGvUYc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X//lJpmBHDy00H5SKOu0003h1EmNNfQlUKhTCCx0kF8ZCI4HjfpTmekTP9nfzmh0p /UUhLZ9eaSsPK5GoXUUC+18uH+/x0Ets1DIKrpwdr3Lvt3I3bbC/lbqOo2FhKFB05G fETtJism1onUFXBkgld1PI/NXTWM8/fyS6OP0yYo= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:44 +1000 Message-Id: <20180709074350.27086-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 10/16] ppc440_uc: Fix a copy/paste error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Missed in 3c409c1927e, hopefully reported by Coverity. Fixes: Coverity CID 1393788 (Copy-paste error) Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/ppc/ppc440_uc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 0bbaa6844a..09ccda548f 100644 --- a/hw/ppc/ppc440_uc.c +++ b/hw/ppc/ppc440_uc.c @@ -935,7 +935,7 @@ static void dcr_write_dma(void *opaque, int dcrn, uint32_t val) if (wptr) { cpu_physical_memory_unmap(wptr, wlen, 1, didx); } - if (wptr) { + if (rptr) { cpu_physical_memory_unmap(rptr, rlen, 0, sidx); } } From patchwork Mon Jul 9 07:43:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="b5IJOcSv"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHRY39b5z9s1R for ; Mon, 9 Jul 2018 17:44:57 +1000 (AEST) Received: from localhost ([::1]:39706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqs-000564-Pa for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:44:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq8-000537-E4 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq7-0002DN-EQ for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:08 -0400 Received: from ozlabs.org ([203.11.71.1]:38919) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq7-0002BH-2B; Mon, 09 Jul 2018 03:44:07 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQT0QKxz9s2t; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122241; bh=Vx6H7vdyofbvlMuF8nGkqGO0ITxmAl4BazPBsry5cxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5IJOcSvAP/xQYvdI9cwr8wyE+bIL8CGSZdDNbWvA1Fc+5sub4txWcz7kdapNXt4v roFVTlLq2/poi/4OJi5rNke6t7kxzX/gpU/DulVO1AmXz7ECyrwat4/PGT5fRAJchA X+AUldMJCYKWFNLwMou3BHKfttUwfwZSpR460/B8= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:45 +1000 Message-Id: <20180709074350.27086-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 11/16] target/ppc: fix build on ppc64 host X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Laurent Vivier , groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier When I try to build a ppc64 target on a ppc64 host (gcc 8.1.1), I have: .../target/ppc/int_helper.c: In function 'helper_vinsertb': .../target/ppc/int_helper.c:1954:32: error: array subscript 18446744073709551608 is above array bounds of 'uint8_t[16]' {aka 'unsigned char[16]'} [-Werror=array-bounds] memmove(&r->u8[index], &b->u8[8 - sizeof(r->element)], \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../target/ppc/int_helper.c:1965:1: note: in expansion of macro 'VINSERT' If we compare with the macro for ppc64le, we can see sizeof(r->element[0]) should be used instead of sizeof(r->element). And VINSERT uses only u8, u16, u32 and u64, so the maximum value of sizeof(r->element[0]) is 8 Suggested-by: Dr. David Alan Gilbert Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/int_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 03d37da79f..d52338ed71 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1951,7 +1951,7 @@ VSPLT(w, u32) #define VINSERT(suffix, element) \ void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t index) \ { \ - memmove(&r->u8[index], &b->u8[8 - sizeof(r->element)], \ + memmove(&r->u8[index], &b->u8[8 - sizeof(r->element[0])], \ sizeof(r->element[0])); \ } #else From patchwork Mon Jul 9 07:43:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941141 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="RMQLrLGE"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHbL6qB9z9s1B for ; Mon, 9 Jul 2018 17:51:42 +1000 (AEST) Received: from localhost ([::1]:39744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQxQ-0002Dm-HV for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:51:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQq9-00053X-75 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq7-0002Dk-Lv for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:09 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:47135) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq7-0002BQ-9L; Mon, 09 Jul 2018 03:44:07 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQS6LJmz9s3C; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122240; bh=xYqUj5DQEPHPxstrVLczmDhjbY8mk5/1v9din9Kolas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMQLrLGEhvd2hANFM2rrBCb0H0cXxeLoD4mvAZWxmkMEjGocyYaMragUCSve29f+U lvweLoVf1uBei+haNGVvfq+xacv8kAgkBqw5GijhDpPCl/gcvY2KTL8lkyQKmYyNIW imI9liSYqvPXwWmvAItP2ktevmwTeV5chM8ZFAmg= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:46 +1000 Message-Id: <20180709074350.27086-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 12/16] ppc: fix default VGA display for PReP machines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland Commit 29f9cef "ppc: Include vga cirrus card into the compiling process" changed the default display adapter for all PPC machines to cirrus. Unfortunately it missed setting the default display type to stdvga for both PReP machines causing the display to fail to initialise under OpenHackWare. Update the MachineClass for both prep and 40p machines so that the default std(vga) display adapter is the default if no options are specified which fixes the display for the PReP machines. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ppc/prep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 6689407b3d..3401570d98 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -682,6 +682,7 @@ static void prep_machine_init(MachineClass *mc) mc->max_cpus = MAX_CPUS; mc->default_boot_order = "cad"; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("602"); + mc->default_display = "std"; } static int prep_set_cmos_checksum(DeviceState *dev, void *opaque) @@ -888,6 +889,7 @@ static void ibm_40p_machine_init(MachineClass *mc) mc->block_default_type = IF_SCSI; mc->default_boot_order = "c"; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("604"); + mc->default_display = "std"; } DEFINE_MACHINE("40p", ibm_40p_machine_init) From patchwork Mon Jul 9 07:43:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941147 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="hJFnOHPI"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHlP6WZlz9s1b for ; Mon, 9 Jul 2018 17:58:41 +1000 (AEST) Received: from localhost ([::1]:39789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcR4B-0007Rr-F0 for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:58:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqA-00054j-8D for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQq8-0002EY-80 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:10 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:45441) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq7-0002Bj-PX; Mon, 09 Jul 2018 03:44:08 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQT0yLdz9s4Y; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122241; bh=xNnHLBW+i98lxM8rvNlbgGDJUjkIt7iJRZJj1OjCiH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hJFnOHPIyNKKojAD1FfvyDPxuUIph7Vf+qaMIizqda5nnWPHv+17i7AmOsdjsE2rv RJFhy+L8hkBg98F85SKB5Wnn4CJpXK6vyXaTCUKJDE56GNertfKcXafgxp3UDRhGv9 K6NxeWVXQO52ruZNQqHSYrwC2RlVC+1nEMF2XWfU= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:47 +1000 Message-Id: <20180709074350.27086-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 13/16] sam460ex: Update u-boot-sam460ex firmware X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: BALATON Zoltan Update the submodule and u-boot-sam460-20100605.bin to include following fixes from Sebastian Bauer: - Fix build with newer gcc - Decrease unnecessary delay which fixes slow booting from CD Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- pc-bios/u-boot-sam460-20100605.bin | Bin 524288 -> 524288 bytes roms/u-boot-sam460ex | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/u-boot-sam460-20100605.bin b/pc-bios/u-boot-sam460-20100605.bin index 99408f8e957b26e735e5befa98fa3d51a90d95f6..e17de77c1974382144625632c709c29a1a86edef 100755 GIT binary patch delta 84 zcmZo@P-tjSm>@3hRhpw@3hpIo9~WTaqZU}&zOt6*quWny4uV5B*DBiE%S#%+v@Tql@>JErrT gWSj-0+gF@q1Y#y2W(HywAZ7((w(ToUvPYN!08um@+W-In diff --git a/roms/u-boot-sam460ex b/roms/u-boot-sam460ex index 8ee007c421..60b3916f33 160000 --- a/roms/u-boot-sam460ex +++ b/roms/u-boot-sam460ex @@ -1 +1 @@ -Subproject commit 8ee007c4216fd6a0d760589e8405ce4494497aa0 +Subproject commit 60b3916f33e617a815973c5a6df77055b2e3a588 From patchwork Mon Jul 9 07:43:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="SsH4mN/s"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHjX3z7Hz9s00 for ; Mon, 9 Jul 2018 17:57:04 +1000 (AEST) Received: from localhost ([::1]:39785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcR2c-0006UK-5Y for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:57:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqC-00057Y-AH for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQqA-0002I9-SD for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:12 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:48993) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQqA-0002EO-Cy; Mon, 09 Jul 2018 03:44:10 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQT4Nxhz9s8J; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122241; bh=imb2UC2WJio8r+bSGauEh1WzzK//ac1XvwROuTAnBzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SsH4mN/snakYIdYny3hUAr27+d3pjwOGgKavT2g+JKqhV7Ai7rU7faIFEOf1OldJw CeTp3L1LYYIA2NVzykIRHRw5CWBekw4FEdXI3rxiT6BGuoO8AoD8m003As/QC8IiBa XWuvs1qgws8cAvVM23cUo13pxoW/NcHTA2kvwZ2U= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:48 +1000 Message-Id: <20180709074350.27086-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 14/16] sam460ex: Check for errors from libfdt functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In a couple of places sam460ex_load_device_tree() calls "raw" libfdt functions which can fail, but doesn't check for error codes. At best, if these fail the guest will be silently started in a non-standard state, or it could fail entirely. Fix this by using the _FDT() helper macro which aborts on a libfdt failure. Signed-off-by: David Gibson --- hw/ppc/sam460ex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 7eed2ec601..1661e036f3 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -36,6 +36,7 @@ #include "hw/i2c/ppc4xx_i2c.h" #include "hw/i2c/smbus.h" #include "hw/usb/hcd-ehci.h" +#include "hw/ppc/fdt.h" #include @@ -318,13 +319,13 @@ static int sam460ex_load_device_tree(hwaddr addr, /* Remove cpm node if it exists (it is not emulated) */ offset = fdt_path_offset(fdt, "/cpm"); if (offset >= 0) { - fdt_nop_node(fdt, offset); + _FDT(fdt_nop_node(fdt, offset)); } /* set serial port clocks */ offset = fdt_node_offset_by_compatible(fdt, -1, "ns16550"); while (offset >= 0) { - fdt_setprop_cell(fdt, offset, "clock-frequency", UART_FREQ); + _FDT(fdt_setprop_cell(fdt, offset, "clock-frequency", UART_FREQ)); offset = fdt_node_offset_by_compatible(fdt, offset, "ns16550"); } From patchwork Mon Jul 9 07:43:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="E5H8xk+Q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHgJ39WHz9s19 for ; Mon, 9 Jul 2018 17:55:08 +1000 (AEST) Received: from localhost ([::1]:39764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcR0j-0004rE-PH for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:55:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqB-00055u-5g for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQqA-0002H5-0G for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:11 -0400 Received: from ozlabs.org ([203.11.71.1]:49169) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq9-0002Df-JE; Mon, 09 Jul 2018 03:44:09 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQT2Mygz9s3T; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122241; bh=lA0AjYCmItaLelH9A90rgEzTc6afeG3cpfUcUq/CSm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5H8xk+QxKifrYx6ufVJgUvXknZ/Gb3dq1oprDNG8cduWA4FTmYM0YjxTwfvs4k1g lqHawmFDpdulUXI/0Rw3oFR+OTkMcg/WJpWp+0fYz+Opn/Id2svi5laexxH6wLlRum AVlrMWzHFQz6JXWlHHfaoibWvxIz+5GhXFq+rqrk= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:49 +1000 Message-Id: <20180709074350.27086-16-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 15/16] sam460ex: Don't check for errors from qemu_fdt_*() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The qemu_fdt_*() helper functions already exit with a message instead of returning errors, so we don't need to check for errors in the caller. Signed-off-by: David Gibson --- hw/ppc/sam460ex.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 1661e036f3..8194f32cd3 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -276,32 +276,18 @@ static int sam460ex_load_device_tree(hwaddr addr, /* Manipulate device tree in memory. */ - ret = qemu_fdt_setprop(fdt, "/memory", "reg", mem_reg_property, - sizeof(mem_reg_property)); - if (ret < 0) { - error_report("couldn't set /memory/reg"); - } + qemu_fdt_setprop(fdt, "/memory", "reg", mem_reg_property, + sizeof(mem_reg_property)); /* default FDT doesn't have a /chosen node... */ qemu_fdt_add_subnode(fdt, "/chosen"); - ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start", - initrd_base); - if (ret < 0) { - error_report("couldn't set /chosen/linux,initrd-start"); - } + qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start", initrd_base); - ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", - (initrd_base + initrd_size)); - if (ret < 0) { - error_report("couldn't set /chosen/linux,initrd-end"); - } + qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", + (initrd_base + initrd_size)); - ret = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", - kernel_cmdline); - if (ret < 0) { - error_report("couldn't set /chosen/bootargs"); - } + qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline); /* Copy data from the host device tree into the guest. Since the guest can * directly access the timebase without host involvement, we must expose From patchwork Mon Jul 9 07:43:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 941142 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="E/SVj4Aw"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PHbW1Z6Bz9s00 for ; Mon, 9 Jul 2018 17:51:51 +1000 (AEST) Received: from localhost ([::1]:39745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQxY-0002Hp-Or for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 03:51:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQqB-00056D-AJ for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQqA-0002HP-8Z for qemu-devel@nongnu.org; Mon, 09 Jul 2018 03:44:11 -0400 Received: from ozlabs.org ([203.11.71.1]:44799) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcQq9-0002E4-QI; Mon, 09 Jul 2018 03:44:10 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41PHQT3229z9s7G; Mon, 9 Jul 2018 17:44:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531122241; bh=hd+Fel4FBBvWm5X/tHf38tuGGLNU5nTCwfgcP87OTUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E/SVj4Aw41wN31URqcTSTGg8kx8VjLt9/cQkNOTEp4K/3fChWUaeUJAr9tiKu9kvx 14ygiUM/YKMhB7bX6Eoa9fNJW0AU3bz3qmps6942/jkJH/iHeS9TdOpCKrUbIXJW4/ UlS3xjgWCpxuOvmlEt89GXdgSW7AH1zj55A5snVk= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 9 Jul 2018 17:43:50 +1000 Message-Id: <20180709074350.27086-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709074350.27086-1-david@gibson.dropbear.id.au> References: <20180709074350.27086-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 16/16] sam460ex: Make sam460ex_load_device_tree() handle all errors internally X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" sam460ex_load_device_tree() handles nearly all possible errors by simply exiting (within helper functions and macros). It handles two early error cases by returning an error. There's no particular point to this, so make it handle those directly as well, removing the need for the caller to handle a failure. As a bonus it gives us more specific error messages. Signed-off-by: David Gibson --- hw/ppc/sam460ex.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 8194f32cd3..e2b7028843 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -255,7 +255,6 @@ static int sam460ex_load_device_tree(hwaddr addr, hwaddr initrd_size, const char *kernel_cmdline) { - int ret = -1; uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(ramsize) }; char *filename; int fdt_size; @@ -266,12 +265,14 @@ static int sam460ex_load_device_tree(hwaddr addr, filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE); if (!filename) { - goto out; + error_report("Couldn't find dtb file `%s'", BINARY_DEVICE_TREE_FILE); + exit(1); } fdt = load_device_tree(filename, &fdt_size); g_free(filename); - if (fdt == NULL) { - goto out; + if (!fdt) { + error_report("Couldn't load dtb file `%s'", filename); + exit(1); } /* Manipulate device tree in memory. */ @@ -325,11 +326,8 @@ static int sam460ex_load_device_tree(hwaddr addr, rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr); g_free(fdt); - ret = fdt_size; - -out: - return ret; + return fdt_size; } /* Create reset TLB entries for BookE, mapping only the flash memory. */ @@ -599,10 +597,6 @@ static void sam460ex_init(MachineState *machine) dt_size = sam460ex_load_device_tree(FDT_ADDR, machine->ram_size, RAMDISK_ADDR, initrd_size, machine->kernel_cmdline); - if (dt_size < 0) { - error_report("couldn't load device tree"); - exit(1); - } boot_info->dt_base = FDT_ADDR; boot_info->dt_size = dt_size;