[{"id":1764959,"web_url":"http://patchwork.ozlabs.org/comment/1764959/","msgid":"<26693abe-07a2-1744-1a8d-4d08941837c5@amsat.org>","list_archive_url":null,"date":"2017-09-07T21:38:24","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n> Smartfusion2 SoC has hardened Microcontroller subsystem\n> and flash based FPGA fabric. This patch adds support for\n> Microcontroller subsystem in the SoC.\n> \n> Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n> ---\n>   default-configs/arm-softmmu.mak |   1 +\n>   hw/arm/Makefile.objs            |   1 +\n>   hw/arm/msf2-soc.c               | 218 ++++++++++++++++++++++++++++++++++++++++\n>   include/hw/arm/msf2-soc.h       |  66 ++++++++++++\n>   4 files changed, 286 insertions(+)\n>   create mode 100644 hw/arm/msf2-soc.c\n>   create mode 100644 include/hw/arm/msf2-soc.h\n> \n> diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak\n> index bbdd3c1..5059d13 100644\n> --- a/default-configs/arm-softmmu.mak\n> +++ b/default-configs/arm-softmmu.mak\n> @@ -129,3 +129,4 @@ CONFIG_ACPI=y\n>   CONFIG_SMBIOS=y\n>   CONFIG_ASPEED_SOC=y\n>   CONFIG_GPIO_KEY=y\n> +CONFIG_MSF2=y\n> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs\n> index a2e56ec..df36a03 100644\n> --- a/hw/arm/Makefile.objs\n> +++ b/hw/arm/Makefile.objs\n> @@ -19,3 +19,4 @@ obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o\n>   obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o\n>   obj-$(CONFIG_ASPEED_SOC) += aspeed_soc.o aspeed.o\n>   obj-$(CONFIG_MPS2) += mps2.o\n> +obj-$(CONFIG_MSF2) += msf2-soc.o\n> diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c\n> new file mode 100644\n> index 0000000..47fffa4\n> --- /dev/null\n> +++ b/hw/arm/msf2-soc.c\n> @@ -0,0 +1,218 @@\n> +/*\n> + * SmartFusion2 SoC emulation.\n> + *\n> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> + *\n> + * Permission is hereby granted, free of charge, to any person obtaining a copy\n> + * of this software and associated documentation files (the \"Software\"), to deal\n> + * in the Software without restriction, including without limitation the rights\n> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> + * copies of the Software, and to permit persons to whom the Software is\n> + * furnished to do so, subject to the following conditions:\n> + *\n> + * The above copyright notice and this permission notice shall be included in\n> + * all copies or substantial portions of the Software.\n> + *\n> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> + * THE SOFTWARE.\n> + */\n> +\n> +#include \"qemu/osdep.h\"\n> +#include \"qapi/error.h\"\n> +#include \"qemu-common.h\"\n> +#include \"hw/arm/arm.h\"\n> +#include \"exec/address-spaces.h\"\n> +#include \"hw/char/serial.h\"\n> +#include \"hw/boards.h\"\n> +#include \"sysemu/block-backend.h\"\n> +#include \"qemu/cutils.h\"\n> +#include \"hw/arm/msf2-soc.h\"\n> +\n> +#define MSF2_TIMER_BASE       0x40004000\n> +#define MSF2_SYSREG_BASE      0x40038000\n> +\n> +#define ENVM_BASE_ADDRESS     0x60000000\n> +\n> +#define SRAM_BASE_ADDRESS     0x20000000\n> +\n> +#define MSF2_ENVM_MAX_SIZE        (512 * K_BYTE)\n> +\n> +/*\n> + * eSRAM max size is 80k without SECDED(Single error correction and\n> + * dual error detection) feature and 64k with SECDED.\n> + * We do not support SECDED now.\n> + */\n> +#define MSF2_ESRAM_MAX_SIZE       (80 * K_BYTE)\n> +\n> +static const uint32_t spi_addr[MSF2_NUM_SPIS] = { 0x40001000 , 0x40011000 };\n> +static const uint32_t uart_addr[MSF2_NUM_UARTS] = { 0x40000000 , 0x40010000 };\n> +\n> +static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 };\n> +static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 };\n> +static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 };\n> +\n> +static void m2sxxx_soc_initfn(Object *obj)\n> +{\n> +    MSF2State *s = MSF2_SOC(obj);\n> +    int i;\n> +\n> +    object_initialize(&s->armv7m, sizeof(s->armv7m), TYPE_ARMV7M);\n> +    qdev_set_parent_bus(DEVICE(&s->armv7m), sysbus_get_default());\n> +\n> +    object_initialize(&s->sysreg, sizeof(s->sysreg), TYPE_MSF2_SYSREG);\n> +    qdev_set_parent_bus(DEVICE(&s->sysreg), sysbus_get_default());\n> +\n> +    object_initialize(&s->timer, sizeof(s->timer), TYPE_MSS_TIMER);\n> +    qdev_set_parent_bus(DEVICE(&s->timer), sysbus_get_default());\n> +\n> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n> +        object_initialize(&s->spi[i], sizeof(s->spi[i]),\n> +                          TYPE_MSS_SPI);\n> +        qdev_set_parent_bus(DEVICE(&s->spi[i]), sysbus_get_default());\n> +    }\n> +}\n> +\n> +static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)\n> +{\n> +    MSF2State *s = MSF2_SOC(dev_soc);\n> +    DeviceState *dev, *armv7m;\n> +    SysBusDevice *busdev;\n> +    Error *err = NULL;\n> +    int i;\n> +\n> +    MemoryRegion *system_memory = get_system_memory();\n> +    MemoryRegion *nvm = g_new(MemoryRegion, 1);\n> +    MemoryRegion *nvm_alias = g_new(MemoryRegion, 1);\n> +    MemoryRegion *sram = g_new(MemoryRegion, 1);\n> +\n> +    memory_region_init_rom(nvm, NULL, \"MSF2.eNVM\", s->envm_size,\n> +                           &error_fatal);\n> +    /*\n> +     * On power-on, the eNVM region 0x60000000 is automatically\n> +     * remapped to the Cortex-M3 processor executable region\n> +     * start address (0x0). We do not support remapping other eNVM,\n> +     * eSRAM and DDR regions by guest(via Sysreg) currently.\n> +     */\n> +    memory_region_init_alias(nvm_alias, NULL, \"MSF2.eNVM.alias\",\n\nyou can drop the \".alias\", this function already prepends \"alias \"\n\n> +                             nvm, 0, s->envm_size);\n> +\n> +    memory_region_add_subregion(system_memory, ENVM_BASE_ADDRESS, nvm);\n> +    memory_region_add_subregion(system_memory, 0, nvm_alias);\n> +\n> +    memory_region_init_ram(sram, NULL, \"MSF2.eSRAM\", s->esram_size,\n> +                           &error_fatal);\n> +    memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);\n> +\n> +    armv7m = DEVICE(&s->armv7m);\n> +    qdev_prop_set_uint32(armv7m, \"num-irq\", 81);\n> +    qdev_prop_set_string(armv7m, \"cpu-model\", \"cortex-m3\");\n> +    object_property_set_link(OBJECT(&s->armv7m), OBJECT(get_system_memory()),\n> +                                     \"memory\", &error_abort);\n> +    object_property_set_bool(OBJECT(&s->armv7m), true, \"realized\", &err);\n> +    if (err != NULL) {\n> +        error_propagate(errp, err);\n> +        return;\n> +    }\n> +\n> +    system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;\n> +\n> +    for (i = 0; i < MSF2_NUM_UARTS; i++) {\n> +        if (serial_hds[i]) {\n> +            serial_mm_init(get_system_memory(), uart_addr[i], 2,\n> +                           qdev_get_gpio_in(armv7m, uart_irq[i]),\n> +                           115200, serial_hds[i], DEVICE_NATIVE_ENDIAN);\n> +        }\n> +    }\n> +\n> +    dev = DEVICE(&s->timer);\n> +    /* APB0 clock is the timer input clock */\n> +    qdev_prop_set_uint32(dev, \"clock-frequency\", s->m3clk / s->apb0div);\n> +    object_property_set_bool(OBJECT(&s->timer), true, \"realized\", &err);\n> +    if (err != NULL) {\n> +        error_propagate(errp, err);\n> +        return;\n> +    }\n> +    busdev = SYS_BUS_DEVICE(dev);\n> +    sysbus_mmio_map(busdev, 0, MSF2_TIMER_BASE);\n> +    sysbus_connect_irq(busdev, 0,\n> +                           qdev_get_gpio_in(armv7m, timer_irq[0]));\n> +    sysbus_connect_irq(busdev, 1,\n> +                           qdev_get_gpio_in(armv7m, timer_irq[1]));\n> +\n> +    dev = DEVICE(&s->sysreg);\n> +    qdev_prop_set_uint32(dev, \"apb0divisor\", s->apb0div);\n> +    qdev_prop_set_uint32(dev, \"apb1divisor\", s->apb1div);\n> +    object_property_set_bool(OBJECT(&s->sysreg), true, \"realized\", &err);\n> +    if (err != NULL) {\n> +        error_propagate(errp, err);\n> +        return;\n> +    }\n> +    busdev = SYS_BUS_DEVICE(dev);\n> +    sysbus_mmio_map(busdev, 0, MSF2_SYSREG_BASE);\n> +\n> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n> +        gchar *bus_name;\n> +\n> +        object_property_set_bool(OBJECT(&s->spi[i]), true, \"realized\", &err);\n> +        if (err != NULL) {\n> +            error_propagate(errp, err);\n> +            return;\n> +        }\n> +\n> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]);\n> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,\n> +                           qdev_get_gpio_in(armv7m, spi_irq[i]));\n> +\n> +        /* Alias controller SPI bus to the SoC itself */\n> +        bus_name = g_strdup_printf(\"spi%d\", i);\n> +        object_property_add_alias(OBJECT(s), bus_name,\n> +                                  OBJECT(&s->spi[i]), \"spi\",\n> +                                  &error_abort);\n> +        g_free(bus_name);\n> +    }\n> +}\n> +\n> +static Property m2sxxx_soc_properties[] = {\n> +    /*\n> +     * part name specifies the type of SmartFusion2 device variant(this\n> +     * property is for information purpose only.\n> +     */\n> +    DEFINE_PROP_STRING(\"part-name\", MSF2State, part_name),\n> +    DEFINE_PROP_UINT64(\"eNVM-size\", MSF2State, envm_size, MSF2_ENVM_MAX_SIZE),\n> +    DEFINE_PROP_UINT64(\"eSRAM-size\", MSF2State, esram_size,\n> +                        MSF2_ESRAM_MAX_SIZE),\n> +    /* Libero GUI shows 100Mhz as default for clocks */\n> +    DEFINE_PROP_UINT32(\"m3clk\", MSF2State, m3clk, 100 * 1000000),\n> +    /* default divisors in Libero GUI */\n> +    DEFINE_PROP_UINT32(\"apb0div\", MSF2State, apb0div, 2),\n> +    DEFINE_PROP_UINT32(\"apb1div\", MSF2State, apb1div, 2),\n> +    DEFINE_PROP_END_OF_LIST(),\n> +};\n> +\n> +static void m2sxxx_soc_class_init(ObjectClass *klass, void *data)\n> +{\n> +    DeviceClass *dc = DEVICE_CLASS(klass);\n> +\n> +    dc->realize = m2sxxx_soc_realize;\n> +    dc->props = m2sxxx_soc_properties;\n> +}\n> +\n> +static const TypeInfo m2sxxx_soc_info = {\n> +    .name          = TYPE_MSF2_SOC,\n> +    .parent        = TYPE_SYS_BUS_DEVICE,\n> +    .instance_size = sizeof(MSF2State),\n> +    .instance_init = m2sxxx_soc_initfn,\n> +    .class_init    = m2sxxx_soc_class_init,\n> +};\n> +\n> +static void m2sxxx_soc_types(void)\n> +{\n> +    type_register_static(&m2sxxx_soc_info);\n> +}\n> +\n> +type_init(m2sxxx_soc_types)\n> diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h\n> new file mode 100644\n> index 0000000..eb239fa\n> --- /dev/null\n> +++ b/include/hw/arm/msf2-soc.h\n> @@ -0,0 +1,66 @@\n> +/*\n> + * Microsemi Smartfusion2 SoC\n> + *\n> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> + *\n> + * Permission is hereby granted, free of charge, to any person obtaining a copy\n> + * of this software and associated documentation files (the \"Software\"), to deal\n> + * in the Software without restriction, including without limitation the rights\n> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> + * copies of the Software, and to permit persons to whom the Software is\n> + * furnished to do so, subject to the following conditions:\n> + *\n> + * The above copyright notice and this permission notice shall be included in\n> + * all copies or substantial portions of the Software.\n> + *\n> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> + * THE SOFTWARE.\n> + */\n> +\n> +#ifndef HW_ARM_MSF2_SOC_H\n> +#define HW_ARM_MSF2_SOC_H\n> +\n> +#include \"hw/arm/armv7m.h\"\n> +#include \"hw/timer/mss-timer.h\"\n> +#include \"hw/misc/msf2-sysreg.h\"\n> +#include \"hw/ssi/mss-spi.h\"\n> +\n> +#define TYPE_MSF2_SOC     \"msf2-soc\"\n> +#define MSF2_SOC(obj)     OBJECT_CHECK(MSF2State, (obj), TYPE_MSF2_SOC)\n> +\n> +#define MSF2_NUM_SPIS         2\n> +#define MSF2_NUM_UARTS        2\n> +\n> +/*\n> + * System timer consists of two programmable 32-bit\n> + * decrementing counters that generate individual interrupts to\n> + * the Cortex-M3 processor\n> + */\n> +#define MSF2_NUM_TIMERS       2\n> +\n> +typedef struct MSF2State {\n> +    /*< private >*/\n> +    SysBusDevice parent_obj;\n> +    /*< public >*/\n> +\n> +    ARMv7MState armv7m;\n> +\n> +    char *part_name;\n> +    uint64_t envm_size;\n> +    uint64_t esram_size;\n> +\n> +    uint32_t m3clk;\n> +    uint32_t apb0div;\n> +    uint32_t apb1div;\n> +\n> +    MSF2SysregState sysreg;\n> +    MSSTimerState timer;\n> +    MSSSpiState spi[MSF2_NUM_SPIS];\n> +} MSF2State;\n> +\n> +#endif\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"lkqcX8U9\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpDP12kv5z9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 07:39:17 +1000 (AEST)","from localhost ([::1]:42357 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dq4W3-0003tp-Ht\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 17:39:15 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:51998)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dq4Va-0003oc-OL\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 17:38:52 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dq4VV-0003in-7B\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 17:38:46 -0400","from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33052)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dq4VJ-0003bL-CR; Thu, 07 Sep 2017 17:38:29 -0400","by mail-qk0-x243.google.com with SMTP id g128so551092qke.0;\n\tThu, 07 Sep 2017 14:38:29 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tu1sm216571qtu.96.2017.09.07.14.38.26\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 07 Sep 2017 14:38:28 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=yfT2oSTPsBGYoDXQpsEfA93ANpvURpZ15OP0mjgZjx8=;\n\tb=lkqcX8U9Gnw5RO4FSWgHLwCpalWQ3InvMl410pyQNF3iyHq/ktbjKVRxdMGIv41p4m\n\tOkMP1dQrWcirvMm5yTiYfqG8s+3/qIogAXaIm6Z9a1f6zpuThUeBCJAj+Ri89eP868J6\n\tUBQ3VUcgo5wZRpgoS/DvkHpynDTktuFgsi88nwoFVrxyOeywUhY5eSpjRRjwQaqqmzxG\n\twNdLG+tTTYstztvqXdI91BREx4aePBLjLx7BMTbezP7CoCoap45Mw2HLxwweNIQaQ5fS\n\trOWePwzHJbWfG5TuD7lyxW9yHuhnc0vtEeNGgtWTKDjbOC+RYqmYNRF7RcNhiQDjzjdx\n\ti8pQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=yfT2oSTPsBGYoDXQpsEfA93ANpvURpZ15OP0mjgZjx8=;\n\tb=jPdYgOuZXut84GdZLbGNBuUzUO/XN+2asq0PeCu/ufhbu2fpWP9OwGoT2cuscSyRbw\n\tXRdxTcXXM3Fxzey7cTbzYvStzw4LgKvh0XY9aNVhcB1Ap4e+JytTl5C8LJjN2HbwLq81\n\tOiN2yM7pRko8+Pv1itwLOVw1o38fEfaxyckybFsQ3HEtCTEdB8Mp0iPQHQVg4f7QwRKw\n\tYC7gSuSXq17epwMcyLNkYKooLlqNlJCtOJX5uMJzg68cZbLtpU8ZwPbFMTnr87Zelx7N\n\tcendpopf3V/rMnYHm8ktOVKi4m1Q/0/UDN16XOGabSLU/Fg/PwtHymR6nWL4cogY15qC\n\tv3gQ==","X-Gm-Message-State":"AHPjjUiPKAQdUnDxKG/Bxpp3/gAEya6BrsV5Vk96EWaRPz5TspD6XMBH\n\t333R9WqO4K8W9Q==","X-Google-Smtp-Source":"AOwi7QD3enhEHVcqQeTeA1ssmG0Mp/Sdq+SbTFMSkmrtB7cifjtMeXgWOpBXN0nxkDc3o5Qr/or/Qw==","X-Received":"by 10.55.122.67 with SMTP id v64mr952128qkc.21.1504820308581;\n\tThu, 07 Sep 2017 14:38:28 -0700 (PDT)","To":"Subbaraya Sundeep <sundeep.lkml@gmail.com>, qemu-devel@nongnu.org,\n\tqemu-arm@nongnu.org","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-5-git-send-email-sundeep.lkml@gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<26693abe-07a2-1744-1a8d-4d08941837c5@amsat.org>","Date":"Thu, 7 Sep 2017 18:38:24 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<1504812251-23438-5-git-send-email-sundeep.lkml@gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c09::243","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, alistair23@gmail.com,\n\tcrosthwaite.peter@gmail.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1764965,"web_url":"http://patchwork.ozlabs.org/comment/1764965/","msgid":"<2b183ac5-36d8-1da6-cbac-4c6366f23261@amsat.org>","list_archive_url":null,"date":"2017-09-07T21:44:30","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"Hi Subbaraya,\n\nvery good work!\n\nOn 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n> Hi Qemu-devel,\n> \n> I am trying to add Smartfusion2 SoC.\n> SoC is from Microsemi and System on Module(SOM)\n> board is from Emcraft systems. Smartfusion2 has hardened\n> Microcontroller(Cortex-M3)based Sub System and FPGA fabric.\n> At the moment only system timer, sysreg and SPI\n> controller are modelled.\n> \n> Testing:\n> ./arm-softmmu/qemu-system-arm -M smartfusion2-som -serial mon:stdio \\\n> -kernel u-boot.bin -display none -drive file=spi.bin,if=mtd,format=raw\n\n\"-M emcraft-sf2\" ;)\n\nU-Boot 2010.03-00147-g7da5092 (Jul 03 2017 - 09:04:50)\n\nCPU  : SmartFusion2 SoC (Cortex-M3 Hard IP)\nFreqs: CORTEX-M3=142MHz,PCLK0=71MHz,PCLK1=71MHz\nBoard: M2S-FG484-SOM Rev 1A, www.emcraft.com\nDRAM:  64 MB\n*** Warning - bad CRC, using default environment\n\nIn:    serial\nOut:   serial\nErr:   serial\nNet:   M2S_MAC\nHit any key to stop autoboot:  0\n16384 KiB S25FL128P_64K at 0:0 is now current device\n## Booting kernel from Legacy Image at a0007fc0 ...\n    Image Name:   dtskernel\n    Image Type:   ARM Linux Kernel Image (uncompressed)\n    Data Size:    2664224 Bytes =  2.5 MB\n    Load Address: a0008000\n    Entry Point:  a0008001\n    Verifying Checksum ... OK\n    Loading Kernel Image ... OK\nOK\n\nStarting kernel ...\n\nNVIC: Bad read offset 0xd74\n[    0.000000] Booting Linux on physical CPU 0x0\n[    0.000000] Linux version 4.5.0-00001-g3aa90e8-dirty \n(sundeep@sundeep-Vostro-3458) (gcc version 5.4.0 (GCC) ) #102 PREEMPT \nTue May 16 19:43:40 IST 2017\n[    0.000000] CPU: ARMv7-M [410fc231] revision 1 (ARMv7M), cr=00000000\n[    0.000000] CPU: unknown data cache, unknown instruction cache\n[    0.000000] Machine model: Microsemi SmartFusion 2 development board\n[    0.000000] Kernel command line: console=ttyS0,115200n8 panic=10 \nmem=64M@0xa0000000 earlyprintk\n[    0.000000] Memory: 62204K/65536K available (1472K kernel code, 73K \nrwdata, 652K rodata, 400K init, 120K bss, 3332K reserved, 0K cma-reserved)\n[    0.000000] NR_IRQS:16 nr_irqs:16 16\n[    0.001178] sched_clock: 32 bits at 83MHz, resolution 12ns, wraps \nevery 25873297401ns\n[    0.003085] clocksource: msf2_clocksource: mask: 0xffffffff \nmax_cycles: 0xffffffff, max_idle_ns: 23027234290 ns\n[    0.009732] timer at 40004000, irq=16\n[    0.014475] Calibrating delay loop... 442.36 BogoMIPS (lpj=2211840)\n[    0.653685] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled\n[    0.690789] console [ttyS0] disabled\n[    0.696659] 40000000.serial: ttyS0 at MMIO 0x40000000 (irq = 17, \nbase_baud = 5187500) is a 16550\n[    0.702725] console [ttyS0] enabled\n[    0.826251] Freeing unused kernel memory: 400K (a021c000 - a0280000)\ninit started: BusyBox v1.24.1 (2017-05-15 09:57:00 IST)\n~ #\n\n(qemu) info mtree\naddress-space: cpu-memory\n   0000000000000000-ffffffffffffffff (prio 0, i/o): armv7m-container\n     0000000000000000-ffffffffffffffff (prio -1, i/o): system\n       0000000000000000-000000000003ffff (prio 0, i/o): alias \nMSF2.eNVM.alias @MSF2.eNVM 0000000000000000-000000000003ffff\n       0000000020000000-000000002000ffff (prio 0, ram): MSF2.eSRAM\n       0000000040000000-000000004000001f (prio 0, i/o): serial\n       0000000040001000-000000004000103f (prio 0, i/o): mss-spi\n       0000000040004000-000000004000402f (prio 0, i/o): mss-timer\n       0000000040011000-000000004001103f (prio 0, i/o): mss-spi\n       0000000040038000-00000000400382ff (prio 0, i/o): msf2-sysreg\n       0000000060000000-000000006003ffff (prio 0, rom): MSF2.eNVM\n       00000000a0000000-00000000a3ffffff (prio 0, ram): ddr-ram\n     0000000022000000-0000000023ffffff (prio 0, i/o): bitband\n     0000000042000000-0000000043ffffff (prio 0, i/o): bitband\n     00000000e000e000-00000000e000efff (prio 0, i/o): nvic\n       00000000e000e000-00000000e000efff (prio 0, i/o): nvic_sysregs\n       00000000e000e010-00000000e000e0ef (prio 1, i/o): systick\n\n(qemu) info qtree\nbus: main-system-bus\n   type System\n   dev: msf2-soc, id \"\"\n     part-name = \"M2S010\"\n     eNVM-size = 262144 (0x40000)\n     eSRAM-size = 65536 (0x10000)\n     m3clk = 142000000 (0x876bf80)\n     apb0div = 2 (0x2)\n     apb1div = 2 (0x2)\n   dev: mss-spi, id \"\"\n     gpio-out \"sysbus-irq\" 2\n     mmio 0000000040011000/0000000000000040\n     bus: spi\n       type SSI\n   dev: mss-spi, id \"\"\n     gpio-out \"sysbus-irq\" 2\n     mmio 0000000040001000/0000000000000040\n     bus: spi\n       type SSI\n       dev: s25sl12801, id \"\"\n         gpio-in \"ssi-gpio-cs\" 1\n         nonvolatile-cfg = 36863 (0x8fff)\n         spansion-cr1nv = 0 (0x0)\n         spansion-cr2nv = 1 (0x1)\n         spansion-cr3nv = 2 (0x2)\n         spansion-cr4nv = 16 (0x10)\n         drive = \"mtd0\"\n   dev: mss-timer, id \"\"\n     gpio-out \"sysbus-irq\" 2\n     clock-frequency = 71000000 (0x43b5fc0)\n     mmio 0000000040004000/0000000000000030\n   dev: msf2-sysreg, id \"\"\n     apb0divisor = 2 (0x2)\n     apb1divisor = 2 (0x2)\n     mmio 0000000040038000/0000000000000300\n\nSo far:\nTested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n\nJust some comments (no need to fix):\n\nM2S-FG484-SOM> reset\nresetting ...\nM2S-FG484-SOM>\n\nHmm no reset, I was expecting some unimp/guest-error warning.\n\nM2S-FG484-SOM> tftpboot\nm2s_eth_init: FIFO initialization timeout\n*** m2s_mac_dump_regs FIFO init:\n  DMA TX CTRL=00000000;DESC=00000000;STAT=00000000\n  DMA RX CTRL=00000000;DESC=00000000;STAT=00000000\n  DMA IRQ 00000000/00000000\n  CFG1=00000000;CFG2=00000000;IFG=00000000;HD=00000000;MFL=00000000\n  IFCTRL=00000000;IFSTAT=00000000;ADR1=00000000;ADR2=00000000\n  FIFO CFG 00000000/00000000/00000000/00000000/00000000/00000000/\n  FIFO ACC \n00000000/00000000/00000000/00000000/00000000/00000000/00000000/00000000/\n\n(same unimp/guest-error warning)\n\nM2S-FG484-SOM> sf erase 0 0x1000\nUNHANDLED EXCEPTION: HARD FAULT\n   R0\t= 00000072  R1\t= 00000072\n   R2\t= 09fa3af0  R3\t= 004c8000\n   R12\t= 00000004  LR\t= 00000a27\n   PC\t= 0000ec98  PSR\t= 01000000\n[hang]\nIN:\n0x0000029e:  e7fe       b.n     0x29e\n\n\n> \n> Binaries u-boot.bin and spi.bin are at:\n> https://github.com/Subbaraya-Sundeep/qemu-test-binaries.git\n> \n> U-boot is from Emcraft with modified\n>      - SPI driver not to use PDMA.\n>      - ugly hack to pass dtb to kernel in r1.\n> @\n> https://github.com/Subbaraya-Sundeep/emcraft-uboot-sf2.git\n> \n> Linux is 4.5 linux with Smartfusion2 SoC dts and clocksource\n> driver added by myself @\n> https://github.com/Subbaraya-Sundeep/linux.git\n> \n> v8:\n> \tmemory_region_init_ram to memory_region_init_rom in soc\n> \t%s/emcraft_sf2_init/emcraft_sf2_s2s010_init/g in som\n> \tAdded mc->ignore_memory_transaction_failures = true in som\n> \t\tas per latest commit.\n> \tCode simplifications as suggested by Alistair in sysreg and ssi.\n> \n> v7:\n> \tRemoved vmstate_register_ram_global as per latest commit\n> \tMoved header files to C which are local to C source files\n> \tRemoved abort() from msf2-sysreg.c\n> \tAdded VMStateDescription in mss-timer.c\n> \n> v6:\n>      Moved some defines from header files to source files\n>      Added properties m3clk, apb0div, apb0div1 properties\n>      to soc.\n>      Added properties apb0divisor, apb1divisor to sysreg\n>      Update system_clock_source in msf2-soc.c\n>      Changed machine name smartfusion2-som->emcraft-sf2\n> \n> v5\n>      As per Philippe comments:\n>          Added abort in Sysreg if guest tries to remap memory\n>          other than default mapping.\n>          Use of CONFIG_MSF2 in Makefile for soc.c\n>          Fixed incorrect logic in timer model.\n>          Renamed msf2-timer.c -> mss-timer.c\n>                  msf2-spi.c -> mss-spi.c also type names\n>          Renamed function msf2_init->emcraft_sf2_init in msf2-som.c\n>          Added part-name,eNVM-size,eSRAM-size,pclk0 and pclk1\n>              properties to soc.\n>          Pass soc part-name,memory size and clock rate properties from som.\n> v4:\n>      Fixed build failure by using PRIx macros.\n> v3:\n>      Added SoC file and board file as per Alistair comments.\n> v2:\n>      Added SPI controller so that u-boot loads kernel from spi flash.\n> v1:\n>      Initial patch set with timer and sysreg\n> \n> Thanks,\n> Sundeep\n> \n> \n> Subbaraya Sundeep (5):\n>    msf2: Add Smartfusion2 System timer\n>    msf2: Microsemi Smartfusion2 System Register block\n>    msf2: Add Smartfusion2 SPI controller\n>    msf2: Add Smartfusion2 SoC\n>    msf2: Add Emcraft's Smartfusion2 SOM kit\n> \n>   default-configs/arm-softmmu.mak |   1 +\n>   hw/arm/Makefile.objs            |   1 +\n>   hw/arm/msf2-soc.c               | 218 ++++++++++++++++++++++\n>   hw/arm/msf2-som.c               |  95 ++++++++++\n>   hw/misc/Makefile.objs           |   1 +\n>   hw/misc/msf2-sysreg.c           | 195 +++++++++++++++++++\n>   hw/ssi/Makefile.objs            |   1 +\n>   hw/ssi/mss-spi.c                | 404 ++++++++++++++++++++++++++++++++++++++++\n>   hw/timer/Makefile.objs          |   1 +\n>   hw/timer/mss-timer.c            | 289 ++++++++++++++++++++++++++++\n>   include/hw/arm/msf2-soc.h       |  66 +++++++\n>   include/hw/misc/msf2-sysreg.h   |  78 ++++++++\n>   include/hw/ssi/mss-spi.h        |  58 ++++++\n>   include/hw/timer/mss-timer.h    |  64 +++++++\n>   14 files changed, 1472 insertions(+)\n>   create mode 100644 hw/arm/msf2-soc.c\n>   create mode 100644 hw/arm/msf2-som.c\n>   create mode 100644 hw/misc/msf2-sysreg.c\n>   create mode 100644 hw/ssi/mss-spi.c\n>   create mode 100644 hw/timer/mss-timer.c\n>   create mode 100644 include/hw/arm/msf2-soc.h\n>   create mode 100644 include/hw/misc/msf2-sysreg.h\n>   create mode 100644 include/hw/ssi/mss-spi.h\n>   create mode 100644 include/hw/timer/mss-timer.h\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"u86rZu0s\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpDXC0TBCz9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 07:45:31 +1000 (AEST)","from localhost ([::1]:42379 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dq4c5-0006AY-6o\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 17:45:29 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:55283)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dq4bU-00064Y-UG\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 17:44:58 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dq4bP-0000Rx-KO\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 17:44:52 -0400","from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:35097)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dq4bD-0000Fb-OB; Thu, 07 Sep 2017 17:44:35 -0400","by mail-qt0-x244.google.com with SMTP id p55so570423qtc.2;\n\tThu, 07 Sep 2017 14:44:35 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\ti124sm215276qkf.84.2017.09.07.14.44.31\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 07 Sep 2017 14:44:33 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=uS0TBca4vW+9/bKtWLDe3N0AN8cuMpjCCs9W9BviKt4=;\n\tb=u86rZu0sG0lB5B0UxUYppmmYEQ6wxarGpRh5lO1l9qkuH1QipNL9FdZ4oOTVR7YAhi\n\tpl5vIw6iKMlp4YqhN+NDnXdFa3YUoY9669bDyG4zkzL4UZ/MpVtHXSZSzDH+y1Vi3hVo\n\teRUPbafnixKv9CJoCyeGNwZmlJtcqB7Sl+a1iY2qQRr1WqQY5/CHnmGEGl3Bd/dRrJjg\n\tjATLS3RpYo7ZdbQGNTxDi1akFzc6PH4sycjnoZfDz3pqAQhwx85AP7NeIvNmzDwTiv1a\n\tmO9y/kS+yTziZ9+nbrQqntYIw/+5V9VKJs44AXrpjbBlOl59jb+eNwc6lbgmAegms3gY\n\tFNdw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=uS0TBca4vW+9/bKtWLDe3N0AN8cuMpjCCs9W9BviKt4=;\n\tb=PsbsyYuRh6CqkkQhT3L76br+iY2yaELQT1TXQTKzdvOKZB6SUNSeHcWO/wD6+k6W4S\n\tAF8md//BksbWQqTT82nV/xGkLSoJvmO2q/CRl637z+WxHBaCtOZGIWe6/zU31oNC55SB\n\t10/73P+kA6TdNTSII0PoCBj02DXfIp6eE7BH0o7TBjQC8FJc6Vrv+a/3SDZoQB1JJTcZ\n\tAqynctF+yTIiMaQN0u6S1CdtKO5QGiUQ815Zc6m9vunJvn1CpFjYqwyNY1QX6h0A5Ba3\n\t7rEabJ/HNl4VnkuYVZt81L+x/Ic3IDxVsKriAqONz6gaIoIDKlHuScJPL51GmRjwPpgm\n\thtFQ==","X-Gm-Message-State":"AHPjjUinb56Yt4ikRLXNtRUq8dr4OVygY4bl2+SdbQYZt/YFynfESHoE\n\tIeL1zYPMyQz9Tw==","X-Google-Smtp-Source":"AOwi7QDsXKs9AtGiIyyIWegKRR044Ylyz/bIKR0c2gMvG5i/bS1ZCCENJ54+bg0CKJbhnc4V9XwpNw==","X-Received":"by 10.200.36.215 with SMTP id t23mr1086611qtt.185.1504820674823; \n\tThu, 07 Sep 2017 14:44:34 -0700 (PDT)","To":"Subbaraya Sundeep <sundeep.lkml@gmail.com>, qemu-devel@nongnu.org,\n\tqemu-arm@nongnu.org","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<2b183ac5-36d8-1da6-cbac-4c6366f23261@amsat.org>","Date":"Thu, 7 Sep 2017 18:44:30 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c0d::244","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, alistair23@gmail.com,\n\tcrosthwaite.peter@gmail.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1765122,"web_url":"http://patchwork.ozlabs.org/comment/1765122/","msgid":"<CALHRZuoJjSkSYaM9xz8xo2R-=oQEx5a1bkhSirc=NmEpxeG2AQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-08T07:24:29","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Phillipe,\n\nOn Fri, Sep 8, 2017 at 3:14 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\nwrote:\n\n> Hi Subbaraya,\n>\n> very good work!\n>\n> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>\n>> Hi Qemu-devel,\n>>\n>> I am trying to add Smartfusion2 SoC.\n>> SoC is from Microsemi and System on Module(SOM)\n>> board is from Emcraft systems. Smartfusion2 has hardened\n>> Microcontroller(Cortex-M3)based Sub System and FPGA fabric.\n>> At the moment only system timer, sysreg and SPI\n>> controller are modelled.\n>>\n>> Testing:\n>> ./arm-softmmu/qemu-system-arm -M smartfusion2-som -serial mon:stdio \\\n>> -kernel u-boot.bin -display none -drive file=spi.bin,if=mtd,format=raw\n>>\n>\n> \"-M emcraft-sf2\" ;)\n>\n\ncopy/paste error :)\n\n>\n> U-Boot 2010.03-00147-g7da5092 (Jul 03 2017 - 09:04:50)\n>\n> CPU  : SmartFusion2 SoC (Cortex-M3 Hard IP)\n> Freqs: CORTEX-M3=142MHz,PCLK0=71MHz,PCLK1=71MHz\n> Board: M2S-FG484-SOM Rev 1A, www.emcraft.com\n> DRAM:  64 MB\n> *** Warning - bad CRC, using default environment\n>\n> In:    serial\n> Out:   serial\n> Err:   serial\n> Net:   M2S_MAC\n> Hit any key to stop autoboot:  0\n> 16384 KiB S25FL128P_64K at 0:0 is now current device\n> ## Booting kernel from Legacy Image at a0007fc0 ...\n>    Image Name:   dtskernel\n>    Image Type:   ARM Linux Kernel Image (uncompressed)\n>    Data Size:    2664224 Bytes =  2.5 MB\n>    Load Address: a0008000\n>    Entry Point:  a0008001\n>    Verifying Checksum ... OK\n>    Loading Kernel Image ... OK\n> OK\n>\n> Starting kernel ...\n>\n> NVIC: Bad read offset 0xd74\n> [    0.000000] Booting Linux on physical CPU 0x0\n> [    0.000000] Linux version 4.5.0-00001-g3aa90e8-dirty\n> (sundeep@sundeep-Vostro-3458) (gcc version 5.4.0 (GCC) ) #102 PREEMPT Tue\n> May 16 19:43:40 IST 2017\n> [    0.000000] CPU: ARMv7-M [410fc231] revision 1 (ARMv7M), cr=00000000\n> [    0.000000] CPU: unknown data cache, unknown instruction cache\n> [    0.000000] Machine model: Microsemi SmartFusion 2 development board\n> [    0.000000] Kernel command line: console=ttyS0,115200n8 panic=10\n> mem=64M@0xa0000000 earlyprintk\n> [    0.000000] Memory: 62204K/65536K available (1472K kernel code, 73K\n> rwdata, 652K rodata, 400K init, 120K bss, 3332K reserved, 0K cma-reserved)\n> [    0.000000] NR_IRQS:16 nr_irqs:16 16\n> [    0.001178] sched_clock: 32 bits at 83MHz, resolution 12ns, wraps every\n> 25873297401ns\n> [    0.003085] clocksource: msf2_clocksource: mask: 0xffffffff max_cycles:\n> 0xffffffff, max_idle_ns: 23027234290 ns\n> [    0.009732] timer at 40004000, irq=16\n> [    0.014475] Calibrating delay loop... 442.36 BogoMIPS (lpj=2211840)\n> [    0.653685] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled\n> [    0.690789] console [ttyS0] disabled\n> [    0.696659] 40000000.serial: ttyS0 at MMIO 0x40000000 (irq = 17,\n> base_baud = 5187500) is a 16550\n> [    0.702725] console [ttyS0] enabled\n> [    0.826251] Freeing unused kernel memory: 400K (a021c000 - a0280000)\n> init started: BusyBox v1.24.1 (2017-05-15 09:57:00 IST)\n> ~ #\n>\n> (qemu) info mtree\n> address-space: cpu-memory\n>   0000000000000000-ffffffffffffffff (prio 0, i/o): armv7m-container\n>     0000000000000000-ffffffffffffffff (prio -1, i/o): system\n>       0000000000000000-000000000003ffff (prio 0, i/o): alias\n> MSF2.eNVM.alias @MSF2.eNVM 0000000000000000-000000000003ffff\n>       0000000020000000-000000002000ffff (prio 0, ram): MSF2.eSRAM\n>       0000000040000000-000000004000001f (prio 0, i/o): serial\n>       0000000040001000-000000004000103f (prio 0, i/o): mss-spi\n>       0000000040004000-000000004000402f (prio 0, i/o): mss-timer\n>       0000000040011000-000000004001103f (prio 0, i/o): mss-spi\n>       0000000040038000-00000000400382ff (prio 0, i/o): msf2-sysreg\n>       0000000060000000-000000006003ffff (prio 0, rom): MSF2.eNVM\n>       00000000a0000000-00000000a3ffffff (prio 0, ram): ddr-ram\n>     0000000022000000-0000000023ffffff (prio 0, i/o): bitband\n>     0000000042000000-0000000043ffffff (prio 0, i/o): bitband\n>     00000000e000e000-00000000e000efff (prio 0, i/o): nvic\n>       00000000e000e000-00000000e000efff (prio 0, i/o): nvic_sysregs\n>       00000000e000e010-00000000e000e0ef (prio 1, i/o): systick\n>\n> (qemu) info qtree\n> bus: main-system-bus\n>   type System\n>   dev: msf2-soc, id \"\"\n>     part-name = \"M2S010\"\n>     eNVM-size = 262144 (0x40000)\n>     eSRAM-size = 65536 (0x10000)\n>     m3clk = 142000000 (0x876bf80)\n>     apb0div = 2 (0x2)\n>     apb1div = 2 (0x2)\n>   dev: mss-spi, id \"\"\n>     gpio-out \"sysbus-irq\" 2\n>     mmio 0000000040011000/0000000000000040\n>     bus: spi\n>       type SSI\n>   dev: mss-spi, id \"\"\n>     gpio-out \"sysbus-irq\" 2\n>     mmio 0000000040001000/0000000000000040\n>     bus: spi\n>       type SSI\n>       dev: s25sl12801, id \"\"\n>         gpio-in \"ssi-gpio-cs\" 1\n>         nonvolatile-cfg = 36863 (0x8fff)\n>         spansion-cr1nv = 0 (0x0)\n>         spansion-cr2nv = 1 (0x1)\n>         spansion-cr3nv = 2 (0x2)\n>         spansion-cr4nv = 16 (0x10)\n>         drive = \"mtd0\"\n>   dev: mss-timer, id \"\"\n>     gpio-out \"sysbus-irq\" 2\n>     clock-frequency = 71000000 (0x43b5fc0)\n>     mmio 0000000040004000/0000000000000030\n>   dev: msf2-sysreg, id \"\"\n>     apb0divisor = 2 (0x2)\n>     apb1divisor = 2 (0x2)\n>     mmio 0000000040038000/0000000000000300\n>\n> So far:\n> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n>\n\nThanks for testing.\n\n\n> Just some comments (no need to fix):\n>\n\nThank you, I will look into these errors once the patchset gets into the\ntree.\n\n>\n> M2S-FG484-SOM> reset\n> resetting ...\n> M2S-FG484-SOM>\n>\n> Hmm no reset, I was expecting some unimp/guest-error warning.\n>\n> M2S-FG484-SOM> tftpboot\n> m2s_eth_init: FIFO initialization timeout\n> *** m2s_mac_dump_regs FIFO init:\n>  DMA TX CTRL=00000000;DESC=00000000;STAT=00000000\n>  DMA RX CTRL=00000000;DESC=00000000;STAT=00000000\n>  DMA IRQ 00000000/00000000\n>  CFG1=00000000;CFG2=00000000;IFG=00000000;HD=00000000;MFL=00000000\n>  IFCTRL=00000000;IFSTAT=00000000;ADR1=00000000;ADR2=00000000\n>  FIFO CFG 00000000/00000000/00000000/00000000/00000000/00000000/\n>  FIFO ACC 00000000/00000000/00000000/00000000/00000000/00000000/000000\n> 00/00000000/\n>\n> (same unimp/guest-error warning)\n>\n\nIf device is not implemented how do I print warning when guest access that\ndevice?\n\nThanks,\nSundeep\n\n>\n> M2S-FG484-SOM> sf erase 0 0x1000\n> UNHANDLED EXCEPTION: HARD FAULT\n>   R0    = 00000072  R1  = 00000072\n>   R2    = 09fa3af0  R3  = 004c8000\n>   R12   = 00000004  LR  = 00000a27\n>   PC    = 0000ec98  PSR = 01000000\n> [hang]\n> IN:\n> 0x0000029e:  e7fe       b.n     0x29e\n\n\n>\n\n>\n>\n>> Binaries u-boot.bin and spi.bin are at:\n>> https://github.com/Subbaraya-Sundeep/qemu-test-binaries.git\n>>\n>> U-boot is from Emcraft with modified\n>>      - SPI driver not to use PDMA.\n>>      - ugly hack to pass dtb to kernel in r1.\n>> @\n>> https://github.com/Subbaraya-Sundeep/emcraft-uboot-sf2.git\n>>\n>> Linux is 4.5 linux with Smartfusion2 SoC dts and clocksource\n>> driver added by myself @\n>> https://github.com/Subbaraya-Sundeep/linux.git\n>>\n>> v8:\n>>         memory_region_init_ram to memory_region_init_rom in soc\n>>         %s/emcraft_sf2_init/emcraft_sf2_s2s010_init/g in som\n>>         Added mc->ignore_memory_transaction_failures = true in som\n>>                 as per latest commit.\n>>         Code simplifications as suggested by Alistair in sysreg and ssi.\n>>\n>> v7:\n>>         Removed vmstate_register_ram_global as per latest commit\n>>         Moved header files to C which are local to C source files\n>>         Removed abort() from msf2-sysreg.c\n>>         Added VMStateDescription in mss-timer.c\n>>\n>> v6:\n>>      Moved some defines from header files to source files\n>>      Added properties m3clk, apb0div, apb0div1 properties\n>>      to soc.\n>>      Added properties apb0divisor, apb1divisor to sysreg\n>>      Update system_clock_source in msf2-soc.c\n>>      Changed machine name smartfusion2-som->emcraft-sf2\n>>\n>> v5\n>>      As per Philippe comments:\n>>          Added abort in Sysreg if guest tries to remap memory\n>>          other than default mapping.\n>>          Use of CONFIG_MSF2 in Makefile for soc.c\n>>          Fixed incorrect logic in timer model.\n>>          Renamed msf2-timer.c -> mss-timer.c\n>>                  msf2-spi.c -> mss-spi.c also type names\n>>          Renamed function msf2_init->emcraft_sf2_init in msf2-som.c\n>>          Added part-name,eNVM-size,eSRAM-size,pclk0 and pclk1\n>>              properties to soc.\n>>          Pass soc part-name,memory size and clock rate properties from\n>> som.\n>> v4:\n>>      Fixed build failure by using PRIx macros.\n>> v3:\n>>      Added SoC file and board file as per Alistair comments.\n>> v2:\n>>      Added SPI controller so that u-boot loads kernel from spi flash.\n>> v1:\n>>      Initial patch set with timer and sysreg\n>>\n>> Thanks,\n>> Sundeep\n>>\n>>\n>> Subbaraya Sundeep (5):\n>>    msf2: Add Smartfusion2 System timer\n>>    msf2: Microsemi Smartfusion2 System Register block\n>>    msf2: Add Smartfusion2 SPI controller\n>>    msf2: Add Smartfusion2 SoC\n>>    msf2: Add Emcraft's Smartfusion2 SOM kit\n>>\n>>   default-configs/arm-softmmu.mak |   1 +\n>>   hw/arm/Makefile.objs            |   1 +\n>>   hw/arm/msf2-soc.c               | 218 ++++++++++++++++++++++\n>>   hw/arm/msf2-som.c               |  95 ++++++++++\n>>   hw/misc/Makefile.objs           |   1 +\n>>   hw/misc/msf2-sysreg.c           | 195 +++++++++++++++++++\n>>   hw/ssi/Makefile.objs            |   1 +\n>>   hw/ssi/mss-spi.c                | 404 ++++++++++++++++++++++++++++++\n>> ++++++++++\n>>   hw/timer/Makefile.objs          |   1 +\n>>   hw/timer/mss-timer.c            | 289 ++++++++++++++++++++++++++++\n>>   include/hw/arm/msf2-soc.h       |  66 +++++++\n>>   include/hw/misc/msf2-sysreg.h   |  78 ++++++++\n>>   include/hw/ssi/mss-spi.h        |  58 ++++++\n>>   include/hw/timer/mss-timer.h    |  64 +++++++\n>>   14 files changed, 1472 insertions(+)\n>>   create mode 100644 hw/arm/msf2-soc.c\n>>   create mode 100644 hw/arm/msf2-som.c\n>>   create mode 100644 hw/misc/msf2-sysreg.c\n>>   create mode 100644 hw/ssi/mss-spi.c\n>>   create mode 100644 hw/timer/mss-timer.c\n>>   create mode 100644 include/hw/arm/msf2-soc.h\n>>   create mode 100644 include/hw/misc/msf2-sysreg.h\n>>   create mode 100644 include/hw/ssi/mss-spi.h\n>>   create mode 100644 include/hw/timer/mss-timer.h\n>>\n>>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"H2zLN2h8\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpTP64dN7z9s83\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 17:25:13 +1000 (AEST)","from localhost ([::1]:43671 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dqDf3-0005kW-Bu\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 03:25:09 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:33288)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dqDeX-0005kH-8W\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 03:24:43 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dqDeQ-00050I-N1\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 03:24:37 -0400","from mail-vk0-x236.google.com ([2607:f8b0:400c:c05::236]:36166)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dqDeQ-0004zR-FQ; Fri, 08 Sep 2017 03:24:30 -0400","by mail-vk0-x236.google.com with SMTP id v203so2514245vkv.3;\n\tFri, 08 Sep 2017 00:24:30 -0700 (PDT)","by 10.176.75.196 with HTTP; Fri, 8 Sep 2017 00:24:29 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=pZ7afL/BzUtsS/pd5pnDIGkclJFJDCNWiTPw34CDfFM=;\n\tb=H2zLN2h89dmtYgp7qzZ8cH3+vfyNC0WXRT6JNMRcgM65QPNvKDuIwUfK6aT3/LxFOX\n\tS0uw6z//OFprCEJ+G2ZDoNDVN2OsXrmBy4tx2RCof+JGyxkSyXhkU4OyhgYJz00GAGcI\n\tzi9jBBahS8/3TLi38APf5xmH+ahW7ELdBDlvP01wvk/HrUXpqhcFOnWOZUJW4MMbgoli\n\tgPZeIW5Gyd9HwcNXCM3xEbfV/fQ0b/yd1gowyPn0VgNgF0FxWnbzVUhyygMQMlbFpeWv\n\ts0if6cOAr6RnkDt0cbwQvszUVvXo94880wbQsqXMf3baYYTN8NuZRA5/tCZ0NmePBrsG\n\tXDWQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=pZ7afL/BzUtsS/pd5pnDIGkclJFJDCNWiTPw34CDfFM=;\n\tb=gWUtz0Xo/pjlce8TraOWvBYAh5Dsg62Iw4Q+a8eHdK88PTyHaLT9XauSTGzg4B/76M\n\tqriGZbVeJkOgdqklz5lATa4vV+RUFi4Fm58GrHthVokpNLba2fGiJX2c2YLCElgVyNGV\n\t+UDCmUt7Vl8/bsn0PdU0/mIb+rKOWZ+AgvNp9Of8rJSloxIpWTsSk3u+ZLiFwIXBiNKF\n\t2+8TAO6MsrOaiUCr2lyHthe8xfBWC1uFuNZZfDC5yr+jChDchrs2v8Uxftt9PEyDVTqQ\n\txHNySq/63mFlpRUheFLwGTmJ98iJ2FwwGszymxvW+XmaGjycz9y5VJsXaMY4ctxIw0eL\n\taNCA==","X-Gm-Message-State":"AHPjjUjzNu0+VMr4SAp1hr1R2/im6DGIAbvyXctHNK21GYS/XVJqCSdo\n\tCOA6emhEXkCwo6ALG3orY7fcBJVplw==","X-Google-Smtp-Source":"AOwi7QDJEsWyhsz8kd5gCNifGR7tnzQMGDW55gQXSw6210tSxgNZknNq+r0mlJgl65/RlDy0lJ1bSXoFkCQkFncJ8yU=","X-Received":"by 10.31.185.209 with SMTP id j200mr1201550vkf.198.1504855469773;\n\tFri, 08 Sep 2017 00:24:29 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<2b183ac5-36d8-1da6-cbac-4c6366f23261@amsat.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<2b183ac5-36d8-1da6-cbac-4c6366f23261@amsat.org>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Fri, 8 Sep 2017 12:54:29 +0530","Message-ID":"<CALHRZuoJjSkSYaM9xz8xo2R-=oQEx5a1bkhSirc=NmEpxeG2AQ@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c05::236","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>,\n\tAlistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1765126,"web_url":"http://patchwork.ozlabs.org/comment/1765126/","msgid":"<CALHRZurB_6GT+KccybDgWb8bPdU89Ey1si46HnbQgsLuHYCh_w@mail.gmail.com>","list_archive_url":null,"date":"2017-09-08T07:26:02","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Philippe,\n\nOn Fri, Sep 8, 2017 at 3:08 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\nwrote:\n\n> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>\n>> Smartfusion2 SoC has hardened Microcontroller subsystem\n>> and flash based FPGA fabric. This patch adds support for\n>> Microcontroller subsystem in the SoC.\n>>\n>> Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n>> ---\n>>   default-configs/arm-softmmu.mak |   1 +\n>>   hw/arm/Makefile.objs            |   1 +\n>>   hw/arm/msf2-soc.c               | 218 ++++++++++++++++++++++++++++++\n>> ++++++++++\n>>   include/hw/arm/msf2-soc.h       |  66 ++++++++++++\n>>   4 files changed, 286 insertions(+)\n>>   create mode 100644 hw/arm/msf2-soc.c\n>>   create mode 100644 include/hw/arm/msf2-soc.h\n>>\n>> diff --git a/default-configs/arm-softmmu.mak\n>> b/default-configs/arm-softmmu.mak\n>> index bbdd3c1..5059d13 100644\n>> --- a/default-configs/arm-softmmu.mak\n>> +++ b/default-configs/arm-softmmu.mak\n>> @@ -129,3 +129,4 @@ CONFIG_ACPI=y\n>>   CONFIG_SMBIOS=y\n>>   CONFIG_ASPEED_SOC=y\n>>   CONFIG_GPIO_KEY=y\n>> +CONFIG_MSF2=y\n>> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs\n>> index a2e56ec..df36a03 100644\n>> --- a/hw/arm/Makefile.objs\n>> +++ b/hw/arm/Makefile.objs\n>> @@ -19,3 +19,4 @@ obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o\n>>   obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o\n>>   obj-$(CONFIG_ASPEED_SOC) += aspeed_soc.o aspeed.o\n>>   obj-$(CONFIG_MPS2) += mps2.o\n>> +obj-$(CONFIG_MSF2) += msf2-soc.o\n>> diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c\n>> new file mode 100644\n>> index 0000000..47fffa4\n>> --- /dev/null\n>> +++ b/hw/arm/msf2-soc.c\n>> @@ -0,0 +1,218 @@\n>> +/*\n>> + * SmartFusion2 SoC emulation.\n>> + *\n>> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>> + *\n>> + * Permission is hereby granted, free of charge, to any person obtaining\n>> a copy\n>> + * of this software and associated documentation files (the \"Software\"),\n>> to deal\n>> + * in the Software without restriction, including without limitation the\n>> rights\n>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or\n>> sell\n>> + * copies of the Software, and to permit persons to whom the Software is\n>> + * furnished to do so, subject to the following conditions:\n>> + *\n>> + * The above copyright notice and this permission notice shall be\n>> included in\n>> + * all copies or substantial portions of the Software.\n>> + *\n>> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n>> EXPRESS OR\n>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n>> MERCHANTABILITY,\n>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n>> SHALL\n>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n>> OTHER\n>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n>> ARISING FROM,\n>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n>> DEALINGS IN\n>> + * THE SOFTWARE.\n>> + */\n>> +\n>> +#include \"qemu/osdep.h\"\n>> +#include \"qapi/error.h\"\n>> +#include \"qemu-common.h\"\n>> +#include \"hw/arm/arm.h\"\n>> +#include \"exec/address-spaces.h\"\n>> +#include \"hw/char/serial.h\"\n>> +#include \"hw/boards.h\"\n>> +#include \"sysemu/block-backend.h\"\n>> +#include \"qemu/cutils.h\"\n>> +#include \"hw/arm/msf2-soc.h\"\n>> +\n>> +#define MSF2_TIMER_BASE       0x40004000\n>> +#define MSF2_SYSREG_BASE      0x40038000\n>> +\n>> +#define ENVM_BASE_ADDRESS     0x60000000\n>> +\n>> +#define SRAM_BASE_ADDRESS     0x20000000\n>> +\n>> +#define MSF2_ENVM_MAX_SIZE        (512 * K_BYTE)\n>> +\n>> +/*\n>> + * eSRAM max size is 80k without SECDED(Single error correction and\n>> + * dual error detection) feature and 64k with SECDED.\n>> + * We do not support SECDED now.\n>> + */\n>> +#define MSF2_ESRAM_MAX_SIZE       (80 * K_BYTE)\n>> +\n>> +static const uint32_t spi_addr[MSF2_NUM_SPIS] = { 0x40001000 ,\n>> 0x40011000 };\n>> +static const uint32_t uart_addr[MSF2_NUM_UARTS] = { 0x40000000 ,\n>> 0x40010000 };\n>> +\n>> +static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 };\n>> +static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 };\n>> +static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 };\n>> +\n>> +static void m2sxxx_soc_initfn(Object *obj)\n>> +{\n>> +    MSF2State *s = MSF2_SOC(obj);\n>> +    int i;\n>> +\n>> +    object_initialize(&s->armv7m, sizeof(s->armv7m), TYPE_ARMV7M);\n>> +    qdev_set_parent_bus(DEVICE(&s->armv7m), sysbus_get_default());\n>> +\n>> +    object_initialize(&s->sysreg, sizeof(s->sysreg), TYPE_MSF2_SYSREG);\n>> +    qdev_set_parent_bus(DEVICE(&s->sysreg), sysbus_get_default());\n>> +\n>> +    object_initialize(&s->timer, sizeof(s->timer), TYPE_MSS_TIMER);\n>> +    qdev_set_parent_bus(DEVICE(&s->timer), sysbus_get_default());\n>> +\n>> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n>> +        object_initialize(&s->spi[i], sizeof(s->spi[i]),\n>> +                          TYPE_MSS_SPI);\n>> +        qdev_set_parent_bus(DEVICE(&s->spi[i]), sysbus_get_default());\n>> +    }\n>> +}\n>> +\n>> +static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)\n>> +{\n>> +    MSF2State *s = MSF2_SOC(dev_soc);\n>> +    DeviceState *dev, *armv7m;\n>> +    SysBusDevice *busdev;\n>> +    Error *err = NULL;\n>> +    int i;\n>> +\n>> +    MemoryRegion *system_memory = get_system_memory();\n>> +    MemoryRegion *nvm = g_new(MemoryRegion, 1);\n>> +    MemoryRegion *nvm_alias = g_new(MemoryRegion, 1);\n>> +    MemoryRegion *sram = g_new(MemoryRegion, 1);\n>> +\n>> +    memory_region_init_rom(nvm, NULL, \"MSF2.eNVM\", s->envm_size,\n>> +                           &error_fatal);\n>> +    /*\n>> +     * On power-on, the eNVM region 0x60000000 is automatically\n>> +     * remapped to the Cortex-M3 processor executable region\n>> +     * start address (0x0). We do not support remapping other eNVM,\n>> +     * eSRAM and DDR regions by guest(via Sysreg) currently.\n>> +     */\n>> +    memory_region_init_alias(nvm_alias, NULL, \"MSF2.eNVM.alias\",\n>>\n>\n> you can drop the \".alias\", this function already prepends \"alias \"\n\n\n.remap sounds good?\n\nThanks,\nSundeep\n\n>\n>\n> +                             nvm, 0, s->envm_size);\n>> +\n>> +    memory_region_add_subregion(system_memory, ENVM_BASE_ADDRESS, nvm);\n>> +    memory_region_add_subregion(system_memory, 0, nvm_alias);\n>> +\n>> +    memory_region_init_ram(sram, NULL, \"MSF2.eSRAM\", s->esram_size,\n>> +                           &error_fatal);\n>> +    memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);\n>> +\n>> +    armv7m = DEVICE(&s->armv7m);\n>> +    qdev_prop_set_uint32(armv7m, \"num-irq\", 81);\n>> +    qdev_prop_set_string(armv7m, \"cpu-model\", \"cortex-m3\");\n>> +    object_property_set_link(OBJECT(&s->armv7m),\n>> OBJECT(get_system_memory()),\n>> +                                     \"memory\", &error_abort);\n>> +    object_property_set_bool(OBJECT(&s->armv7m), true, \"realized\",\n>> &err);\n>> +    if (err != NULL) {\n>> +        error_propagate(errp, err);\n>> +        return;\n>> +    }\n>> +\n>> +    system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;\n>> +\n>> +    for (i = 0; i < MSF2_NUM_UARTS; i++) {\n>> +        if (serial_hds[i]) {\n>> +            serial_mm_init(get_system_memory(), uart_addr[i], 2,\n>> +                           qdev_get_gpio_in(armv7m, uart_irq[i]),\n>> +                           115200, serial_hds[i], DEVICE_NATIVE_ENDIAN);\n>> +        }\n>> +    }\n>> +\n>> +    dev = DEVICE(&s->timer);\n>> +    /* APB0 clock is the timer input clock */\n>> +    qdev_prop_set_uint32(dev, \"clock-frequency\", s->m3clk / s->apb0div);\n>> +    object_property_set_bool(OBJECT(&s->timer), true, \"realized\", &err);\n>> +    if (err != NULL) {\n>> +        error_propagate(errp, err);\n>> +        return;\n>> +    }\n>> +    busdev = SYS_BUS_DEVICE(dev);\n>> +    sysbus_mmio_map(busdev, 0, MSF2_TIMER_BASE);\n>> +    sysbus_connect_irq(busdev, 0,\n>> +                           qdev_get_gpio_in(armv7m, timer_irq[0]));\n>> +    sysbus_connect_irq(busdev, 1,\n>> +                           qdev_get_gpio_in(armv7m, timer_irq[1]));\n>> +\n>> +    dev = DEVICE(&s->sysreg);\n>> +    qdev_prop_set_uint32(dev, \"apb0divisor\", s->apb0div);\n>> +    qdev_prop_set_uint32(dev, \"apb1divisor\", s->apb1div);\n>> +    object_property_set_bool(OBJECT(&s->sysreg), true, \"realized\",\n>> &err);\n>> +    if (err != NULL) {\n>> +        error_propagate(errp, err);\n>> +        return;\n>> +    }\n>> +    busdev = SYS_BUS_DEVICE(dev);\n>> +    sysbus_mmio_map(busdev, 0, MSF2_SYSREG_BASE);\n>> +\n>> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n>> +        gchar *bus_name;\n>> +\n>> +        object_property_set_bool(OBJECT(&s->spi[i]), true, \"realized\",\n>> &err);\n>> +        if (err != NULL) {\n>> +            error_propagate(errp, err);\n>> +            return;\n>> +        }\n>> +\n>> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]);\n>> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,\n>> +                           qdev_get_gpio_in(armv7m, spi_irq[i]));\n>> +\n>> +        /* Alias controller SPI bus to the SoC itself */\n>> +        bus_name = g_strdup_printf(\"spi%d\", i);\n>> +        object_property_add_alias(OBJECT(s), bus_name,\n>> +                                  OBJECT(&s->spi[i]), \"spi\",\n>> +                                  &error_abort);\n>> +        g_free(bus_name);\n>> +    }\n>> +}\n>> +\n>> +static Property m2sxxx_soc_properties[] = {\n>> +    /*\n>> +     * part name specifies the type of SmartFusion2 device variant(this\n>> +     * property is for information purpose only.\n>> +     */\n>> +    DEFINE_PROP_STRING(\"part-name\", MSF2State, part_name),\n>> +    DEFINE_PROP_UINT64(\"eNVM-size\", MSF2State, envm_size,\n>> MSF2_ENVM_MAX_SIZE),\n>> +    DEFINE_PROP_UINT64(\"eSRAM-size\", MSF2State, esram_size,\n>> +                        MSF2_ESRAM_MAX_SIZE),\n>> +    /* Libero GUI shows 100Mhz as default for clocks */\n>> +    DEFINE_PROP_UINT32(\"m3clk\", MSF2State, m3clk, 100 * 1000000),\n>> +    /* default divisors in Libero GUI */\n>> +    DEFINE_PROP_UINT32(\"apb0div\", MSF2State, apb0div, 2),\n>> +    DEFINE_PROP_UINT32(\"apb1div\", MSF2State, apb1div, 2),\n>> +    DEFINE_PROP_END_OF_LIST(),\n>> +};\n>> +\n>> +static void m2sxxx_soc_class_init(ObjectClass *klass, void *data)\n>> +{\n>> +    DeviceClass *dc = DEVICE_CLASS(klass);\n>> +\n>> +    dc->realize = m2sxxx_soc_realize;\n>> +    dc->props = m2sxxx_soc_properties;\n>> +}\n>> +\n>> +static const TypeInfo m2sxxx_soc_info = {\n>> +    .name          = TYPE_MSF2_SOC,\n>> +    .parent        = TYPE_SYS_BUS_DEVICE,\n>> +    .instance_size = sizeof(MSF2State),\n>> +    .instance_init = m2sxxx_soc_initfn,\n>> +    .class_init    = m2sxxx_soc_class_init,\n>> +};\n>> +\n>> +static void m2sxxx_soc_types(void)\n>> +{\n>> +    type_register_static(&m2sxxx_soc_info);\n>> +}\n>> +\n>> +type_init(m2sxxx_soc_types)\n>> diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h\n>> new file mode 100644\n>> index 0000000..eb239fa\n>> --- /dev/null\n>> +++ b/include/hw/arm/msf2-soc.h\n>> @@ -0,0 +1,66 @@\n>> +/*\n>> + * Microsemi Smartfusion2 SoC\n>> + *\n>> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>> + *\n>> + * Permission is hereby granted, free of charge, to any person obtaining\n>> a copy\n>> + * of this software and associated documentation files (the \"Software\"),\n>> to deal\n>> + * in the Software without restriction, including without limitation the\n>> rights\n>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or\n>> sell\n>> + * copies of the Software, and to permit persons to whom the Software is\n>> + * furnished to do so, subject to the following conditions:\n>> + *\n>> + * The above copyright notice and this permission notice shall be\n>> included in\n>> + * all copies or substantial portions of the Software.\n>> + *\n>> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n>> EXPRESS OR\n>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n>> MERCHANTABILITY,\n>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n>> SHALL\n>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n>> OTHER\n>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n>> ARISING FROM,\n>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n>> DEALINGS IN\n>> + * THE SOFTWARE.\n>> + */\n>> +\n>> +#ifndef HW_ARM_MSF2_SOC_H\n>> +#define HW_ARM_MSF2_SOC_H\n>> +\n>> +#include \"hw/arm/armv7m.h\"\n>> +#include \"hw/timer/mss-timer.h\"\n>> +#include \"hw/misc/msf2-sysreg.h\"\n>> +#include \"hw/ssi/mss-spi.h\"\n>> +\n>> +#define TYPE_MSF2_SOC     \"msf2-soc\"\n>> +#define MSF2_SOC(obj)     OBJECT_CHECK(MSF2State, (obj), TYPE_MSF2_SOC)\n>> +\n>> +#define MSF2_NUM_SPIS         2\n>> +#define MSF2_NUM_UARTS        2\n>> +\n>> +/*\n>> + * System timer consists of two programmable 32-bit\n>> + * decrementing counters that generate individual interrupts to\n>> + * the Cortex-M3 processor\n>> + */\n>> +#define MSF2_NUM_TIMERS       2\n>> +\n>> +typedef struct MSF2State {\n>> +    /*< private >*/\n>> +    SysBusDevice parent_obj;\n>> +    /*< public >*/\n>> +\n>> +    ARMv7MState armv7m;\n>> +\n>> +    char *part_name;\n>> +    uint64_t envm_size;\n>> +    uint64_t esram_size;\n>> +\n>> +    uint32_t m3clk;\n>> +    uint32_t apb0div;\n>> +    uint32_t apb1div;\n>> +\n>> +    MSF2SysregState sysreg;\n>> +    MSSTimerState timer;\n>> +    MSSSpiState spi[MSF2_NUM_SPIS];\n>> +} MSF2State;\n>> +\n>> +#endif\n>>\n>>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Hx/nzkgT\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpTQm5CTGz9sBd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 17:26:40 +1000 (AEST)","from localhost ([::1]:43685 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dqDgU-0006VT-Sb\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 03:26:38 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:33896)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dqDg2-0006UV-U2\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 03:26:17 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dqDfv-0006Ho-Nh\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 03:26:10 -0400","from mail-ua0-x244.google.com ([2607:f8b0:400c:c08::244]:35807)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dqDfv-0006Hd-FT; Fri, 08 Sep 2017 03:26:03 -0400","by mail-ua0-x244.google.com with SMTP id g47so538661uad.2;\n\tFri, 08 Sep 2017 00:26:03 -0700 (PDT)","by 10.176.75.196 with HTTP; Fri, 8 Sep 2017 00:26:02 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=LbqLFgHqW5HG36/O1uIrZGWO68t8H2mYs+WM6x9qKyM=;\n\tb=Hx/nzkgTP//02XMmt+ndPYd/BZ5f6SDTmj1pbWnJOi95B9Loz6aHnklfB6Q210uojv\n\tup95GjCfsj2OhZ9DWi4HPJ+o9uuovGIWGyGDk3O/kHK69T2z9GUk/4bW5SzBiX4Ja8OW\n\tEvu3z4aTq3qQKCLk9dSTMLeTwXHo/B6KZ4YhoW/L8a4j1Qt0us5ATPHymiQkAvVyZzqm\n\tov0pMLghgWYy93SZi72Y7rNk7uFIkpzP0ja9fe4dxAhjljjpyvQ6g0m4LOum8OFdarXo\n\t/9Xwb8BTP9VVm4+8n49n4Cd67Gvbeh+gc6xYWPg4/3rq8XSypEfmdukzm7g07k/Cz+4Y\n\teH3w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=LbqLFgHqW5HG36/O1uIrZGWO68t8H2mYs+WM6x9qKyM=;\n\tb=qfmowqy+OEgxs6VTtNniaqOSvsCSu61WvK9ThViy3BIYHLWj8CyRTlFc+MgMjVupXY\n\tFarveZWXQUBinAuQHAQbx/ohUJSPUjIksohiyITBFdVHID4v7pC6lNLQSM1XWbobTfsT\n\twOhZM2HHIkZ4e/evc3jcNR+/e2y5XOLrVW1qvupfVjot72aR53LuXtQIC09NrL9OXVtL\n\tHn6+3B4jXs8mGNeJHhmd8gYJUdYAGPtRah1g9ImF7L84V2ov3whLLdBVVo2taV9hsp+H\n\tPuyKreUMpZcwqJ0v6+Sf+dkYlMf8r0Xh+bR4ROnZLcI+34batCM/IsWa3tWvCry8pB+U\n\ttMmw==","X-Gm-Message-State":"AHPjjUhVwj8isZUJe+lA/pzY97Y8FF6ZNi7wCfRzN7wwYvJr+gEE63ql\n\tXF1YQSSyznlvlP+0Oq71M97FkM1yEw==","X-Google-Smtp-Source":"AOwi7QDoxMQcaLcC4l7U2g8mOYQQkwgE7qV7mNF/R/FwB6qFS3sqyDN4qzWTzdQdBQCO50lj21CwVMeERY3TzgEKrCA=","X-Received":"by 10.176.1.180 with SMTP id 49mr1183999ual.159.1504855562879;\n\tFri, 08 Sep 2017 00:26:02 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<26693abe-07a2-1744-1a8d-4d08941837c5@amsat.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-5-git-send-email-sundeep.lkml@gmail.com>\n\t<26693abe-07a2-1744-1a8d-4d08941837c5@amsat.org>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Fri, 8 Sep 2017 12:56:02 +0530","Message-ID":"<CALHRZurB_6GT+KccybDgWb8bPdU89Ey1si46HnbQgsLuHYCh_w@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c08::244","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>,\n\tAlistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1767436,"web_url":"http://patchwork.ozlabs.org/comment/1767436/","msgid":"<CAKmqyKPbqO-6-B_k7vp9yjJ_BPMNPpZ8YcANXpiccXmmqBijpw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-12T23:50:35","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 3/5] msf2: Add Smartfusion2\n\tSPI controller","submitter":{"id":64571,"url":"http://patchwork.ozlabs.org/api/people/64571/","name":"Alistair Francis","email":"alistair23@gmail.com"},"content":"On Thu, Sep 7, 2017 at 12:24 PM, Subbaraya Sundeep\n<sundeep.lkml@gmail.com> wrote:\n> Modelled Microsemi's Smartfusion2 SPI controller.\n>\n> Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n\nReviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n\nThanks,\nAlistair\n\n> ---\n>  hw/ssi/Makefile.objs     |   1 +\n>  hw/ssi/mss-spi.c         | 404 +++++++++++++++++++++++++++++++++++++++++++++++\n>  include/hw/ssi/mss-spi.h |  58 +++++++\n>  3 files changed, 463 insertions(+)\n>  create mode 100644 hw/ssi/mss-spi.c\n>  create mode 100644 include/hw/ssi/mss-spi.h\n>\n> diff --git a/hw/ssi/Makefile.objs b/hw/ssi/Makefile.objs\n> index 487add2..f5bcc65 100644\n> --- a/hw/ssi/Makefile.objs\n> +++ b/hw/ssi/Makefile.objs\n> @@ -4,6 +4,7 @@ common-obj-$(CONFIG_XILINX_SPI) += xilinx_spi.o\n>  common-obj-$(CONFIG_XILINX_SPIPS) += xilinx_spips.o\n>  common-obj-$(CONFIG_ASPEED_SOC) += aspeed_smc.o\n>  common-obj-$(CONFIG_STM32F2XX_SPI) += stm32f2xx_spi.o\n> +common-obj-$(CONFIG_MSF2) += mss-spi.o\n>\n>  obj-$(CONFIG_OMAP) += omap_spi.o\n>  obj-$(CONFIG_IMX) += imx_spi.o\n> diff --git a/hw/ssi/mss-spi.c b/hw/ssi/mss-spi.c\n> new file mode 100644\n> index 0000000..5a8e308\n> --- /dev/null\n> +++ b/hw/ssi/mss-spi.c\n> @@ -0,0 +1,404 @@\n> +/*\n> + * Block model of SPI controller present in\n> + * Microsemi's SmartFusion2 and SmartFusion SoCs.\n> + *\n> + * Copyright (C) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> + *\n> + * Permission is hereby granted, free of charge, to any person obtaining a copy\n> + * of this software and associated documentation files (the \"Software\"), to deal\n> + * in the Software without restriction, including without limitation the rights\n> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> + * copies of the Software, and to permit persons to whom the Software is\n> + * furnished to do so, subject to the following conditions:\n> + *\n> + * The above copyright notice and this permission notice shall be included in\n> + * all copies or substantial portions of the Software.\n> + *\n> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> + * THE SOFTWARE.\n> + */\n> +\n> +#include \"qemu/osdep.h\"\n> +#include \"hw/ssi/mss-spi.h\"\n> +#include \"qemu/log.h\"\n> +\n> +#ifndef MSS_SPI_ERR_DEBUG\n> +#define MSS_SPI_ERR_DEBUG   0\n> +#endif\n> +\n> +#define DB_PRINT_L(lvl, fmt, args...) do { \\\n> +    if (MSS_SPI_ERR_DEBUG >= lvl) { \\\n> +        qemu_log(\"%s: \" fmt \"\\n\", __func__, ## args); \\\n> +    } \\\n> +} while (0);\n> +\n> +#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)\n> +\n> +#define FIFO_CAPACITY         32\n> +\n> +#define R_SPI_CONTROL         0\n> +#define R_SPI_DFSIZE          1\n> +#define R_SPI_STATUS          2\n> +#define R_SPI_INTCLR          3\n> +#define R_SPI_RX              4\n> +#define R_SPI_TX              5\n> +#define R_SPI_CLKGEN          6\n> +#define R_SPI_SS              7\n> +#define R_SPI_MIS             8\n> +#define R_SPI_RIS             9\n> +\n> +#define S_TXDONE             (1 << 0)\n> +#define S_RXRDY              (1 << 1)\n> +#define S_RXCHOVRF           (1 << 2)\n> +#define S_RXFIFOFUL          (1 << 4)\n> +#define S_RXFIFOFULNXT       (1 << 5)\n> +#define S_RXFIFOEMP          (1 << 6)\n> +#define S_RXFIFOEMPNXT       (1 << 7)\n> +#define S_TXFIFOFUL          (1 << 8)\n> +#define S_TXFIFOFULNXT       (1 << 9)\n> +#define S_TXFIFOEMP          (1 << 10)\n> +#define S_TXFIFOEMPNXT       (1 << 11)\n> +#define S_FRAMESTART         (1 << 12)\n> +#define S_SSEL               (1 << 13)\n> +#define S_ACTIVE             (1 << 14)\n> +\n> +#define C_ENABLE             (1 << 0)\n> +#define C_MODE               (1 << 1)\n> +#define C_INTRXDATA          (1 << 4)\n> +#define C_INTTXDATA          (1 << 5)\n> +#define C_INTRXOVRFLO        (1 << 6)\n> +#define C_SPS                (1 << 26)\n> +#define C_BIGFIFO            (1 << 29)\n> +#define C_RESET              (1 << 31)\n> +\n> +#define FRAMESZ_MASK         0x1F\n> +#define FMCOUNT_MASK         0x00FFFF00\n> +#define FMCOUNT_SHIFT        8\n> +\n> +static void txfifo_reset(MSSSpiState *s)\n> +{\n> +    fifo32_reset(&s->tx_fifo);\n> +\n> +    s->regs[R_SPI_STATUS] &= ~S_TXFIFOFUL;\n> +    s->regs[R_SPI_STATUS] |= S_TXFIFOEMP;\n> +}\n> +\n> +static void rxfifo_reset(MSSSpiState *s)\n> +{\n> +    fifo32_reset(&s->rx_fifo);\n> +\n> +    s->regs[R_SPI_STATUS] &= ~S_RXFIFOFUL;\n> +    s->regs[R_SPI_STATUS] |= S_RXFIFOEMP;\n> +}\n> +\n> +static void set_fifodepth(MSSSpiState *s)\n> +{\n> +    unsigned int size = s->regs[R_SPI_DFSIZE] & FRAMESZ_MASK;\n> +\n> +    if (size <= 8) {\n> +        s->fifo_depth = 32;\n> +    } else if (size <= 16) {\n> +        s->fifo_depth = 16;\n> +    } else if (size <= 32) {\n> +        s->fifo_depth = 8;\n> +    } else {\n> +        s->fifo_depth = 4;\n> +    }\n> +}\n> +\n> +static void update_mis(MSSSpiState *s)\n> +{\n> +    uint32_t reg = s->regs[R_SPI_CONTROL];\n> +    uint32_t tmp;\n> +\n> +    /*\n> +     * form the Control register interrupt enable bits\n> +     * same as RIS, MIS and Interrupt clear registers for simplicity\n> +     */\n> +    tmp = ((reg & C_INTRXOVRFLO) >> 4) | ((reg & C_INTRXDATA) >> 3) |\n> +           ((reg & C_INTTXDATA) >> 5);\n> +    s->regs[R_SPI_MIS] |= tmp & s->regs[R_SPI_RIS];\n> +}\n> +\n> +static void spi_update_irq(MSSSpiState *s)\n> +{\n> +    int irq;\n> +\n> +    update_mis(s);\n> +    irq = !!(s->regs[R_SPI_MIS]);\n> +\n> +    qemu_set_irq(s->irq, irq);\n> +}\n> +\n> +static void mss_spi_reset(DeviceState *d)\n> +{\n> +    MSSSpiState *s = MSS_SPI(d);\n> +\n> +    memset(s->regs, 0, sizeof s->regs);\n> +    s->regs[R_SPI_CONTROL] = 0x80000102;\n> +    s->regs[R_SPI_DFSIZE] = 0x4;\n> +    s->regs[R_SPI_STATUS] = S_SSEL | S_TXFIFOEMP | S_RXFIFOEMP;\n> +    s->regs[R_SPI_CLKGEN] = 0x7;\n> +    s->regs[R_SPI_RIS] = 0x0;\n> +\n> +    s->fifo_depth = 4;\n> +    s->frame_count = 1;\n> +    s->enabled = false;\n> +\n> +    rxfifo_reset(s);\n> +    txfifo_reset(s);\n> +}\n> +\n> +static uint64_t\n> +spi_read(void *opaque, hwaddr addr, unsigned int size)\n> +{\n> +    MSSSpiState *s = opaque;\n> +    uint32_t ret = 0;\n> +\n> +    addr >>= 2;\n> +    switch (addr) {\n> +    case R_SPI_RX:\n> +        s->regs[R_SPI_STATUS] &= ~S_RXFIFOFUL;\n> +        s->regs[R_SPI_STATUS] &= ~S_RXCHOVRF;\n> +        ret = fifo32_pop(&s->rx_fifo);\n> +        if (fifo32_is_empty(&s->rx_fifo)) {\n> +            s->regs[R_SPI_STATUS] |= S_RXFIFOEMP;\n> +        }\n> +        break;\n> +\n> +    case R_SPI_MIS:\n> +        update_mis(s);\n> +        ret = s->regs[R_SPI_MIS];\n> +        break;\n> +\n> +    default:\n> +        if (addr < ARRAY_SIZE(s->regs)) {\n> +            ret = s->regs[addr];\n> +        } else {\n> +            qemu_log_mask(LOG_GUEST_ERROR,\n> +                         \"%s: Bad offset 0x%\" HWADDR_PRIx \"\\n\", __func__,\n> +                         addr * 4);\n> +            return ret;\n> +        }\n> +        break;\n> +    }\n> +\n> +    DB_PRINT(\"addr=0x%\" HWADDR_PRIx \" = 0x%\" PRIx32, addr * 4, ret);\n> +    spi_update_irq(s);\n> +    return ret;\n> +}\n> +\n> +static void assert_cs(MSSSpiState *s)\n> +{\n> +    qemu_set_irq(s->cs_line, 0);\n> +}\n> +\n> +static void deassert_cs(MSSSpiState *s)\n> +{\n> +    qemu_set_irq(s->cs_line, 1);\n> +}\n> +\n> +static void spi_flush_txfifo(MSSSpiState *s)\n> +{\n> +    uint32_t tx;\n> +    uint32_t rx;\n> +    bool sps = !!(s->regs[R_SPI_CONTROL] & C_SPS);\n> +\n> +    /*\n> +     * Chip Select(CS) is automatically controlled by this controller.\n> +     * If SPS bit is set in Control register then CS is asserted\n> +     * until all the frames set in frame count of Control register are\n> +     * transferred. If SPS is not set then CS pulses between frames.\n> +     * Note that Slave Select register specifies which of the CS line\n> +     * has to be controlled automatically by controller. Bits SS[7:1] are for\n> +     * masters in FPGA fabric since we model only Microcontroller subsystem\n> +     * of Smartfusion2 we control only one CS(SS[0]) line.\n> +     */\n> +    while (!fifo32_is_empty(&s->tx_fifo) && s->frame_count) {\n> +        assert_cs(s);\n> +\n> +        s->regs[R_SPI_STATUS] &= ~(S_TXDONE | S_RXRDY);\n> +\n> +        tx = fifo32_pop(&s->tx_fifo);\n> +        DB_PRINT(\"data tx:0x%\" PRIx32, tx);\n> +        rx = ssi_transfer(s->spi, tx);\n> +        DB_PRINT(\"data rx:0x%\" PRIx32, rx);\n> +\n> +        if (fifo32_num_used(&s->rx_fifo) == s->fifo_depth) {\n> +            s->regs[R_SPI_STATUS] |= S_RXCHOVRF;\n> +            s->regs[R_SPI_RIS] |= S_RXCHOVRF;\n> +        } else {\n> +            fifo32_push(&s->rx_fifo, rx);\n> +            s->regs[R_SPI_STATUS] &= ~S_RXFIFOEMP;\n> +            if (fifo32_num_used(&s->rx_fifo) == (s->fifo_depth - 1)) {\n> +                s->regs[R_SPI_STATUS] |= S_RXFIFOFULNXT;\n> +            } else if (fifo32_num_used(&s->rx_fifo) == s->fifo_depth) {\n> +                s->regs[R_SPI_STATUS] |= S_RXFIFOFUL;\n> +            }\n> +        }\n> +        s->frame_count--;\n> +        if (!sps) {\n> +            deassert_cs(s);\n> +        }\n> +    }\n> +\n> +    if (!s->frame_count) {\n> +        s->frame_count = (s->regs[R_SPI_CONTROL] & FMCOUNT_MASK) >>\n> +                            FMCOUNT_SHIFT;\n> +        deassert_cs(s);\n> +        s->regs[R_SPI_RIS] |= S_TXDONE | S_RXRDY;\n> +        s->regs[R_SPI_STATUS] |= S_TXDONE | S_RXRDY;\n> +   }\n> +}\n> +\n> +static void spi_write(void *opaque, hwaddr addr,\n> +            uint64_t val64, unsigned int size)\n> +{\n> +    MSSSpiState *s = opaque;\n> +    uint32_t value = val64;\n> +\n> +    DB_PRINT(\"addr=0x%\" HWADDR_PRIx \" =0x%\" PRIx32, addr, value);\n> +    addr >>= 2;\n> +\n> +    switch (addr) {\n> +    case R_SPI_TX:\n> +        /* adding to already full FIFO */\n> +        if (fifo32_num_used(&s->tx_fifo) == s->fifo_depth) {\n> +            break;\n> +        }\n> +        s->regs[R_SPI_STATUS] &= ~S_TXFIFOEMP;\n> +        fifo32_push(&s->tx_fifo, value);\n> +        if (fifo32_num_used(&s->tx_fifo) == (s->fifo_depth - 1)) {\n> +            s->regs[R_SPI_STATUS] |= S_TXFIFOFULNXT;\n> +        } else if (fifo32_num_used(&s->tx_fifo) == s->fifo_depth) {\n> +            s->regs[R_SPI_STATUS] |= S_TXFIFOFUL;\n> +        }\n> +        if (s->enabled) {\n> +            spi_flush_txfifo(s);\n> +        }\n> +        break;\n> +\n> +    case R_SPI_CONTROL:\n> +        s->regs[R_SPI_CONTROL] = value;\n> +        if (value & C_BIGFIFO) {\n> +            set_fifodepth(s);\n> +        } else {\n> +            s->fifo_depth = 4;\n> +        }\n> +        s->enabled = value & C_ENABLE;\n> +        s->frame_count = (value & FMCOUNT_MASK) >> FMCOUNT_SHIFT;\n> +        if (value & C_RESET) {\n> +            mss_spi_reset(DEVICE(s));\n> +        }\n> +        break;\n> +\n> +    case R_SPI_DFSIZE:\n> +        if (s->enabled) {\n> +            break;\n> +        }\n> +        s->regs[R_SPI_DFSIZE] = value;\n> +        break;\n> +\n> +    case R_SPI_INTCLR:\n> +        s->regs[R_SPI_INTCLR] = value;\n> +        if (value & S_TXDONE) {\n> +            s->regs[R_SPI_RIS] &= ~S_TXDONE;\n> +        }\n> +        if (value & S_RXRDY) {\n> +            s->regs[R_SPI_RIS] &= ~S_RXRDY;\n> +        }\n> +        if (value & S_RXCHOVRF) {\n> +            s->regs[R_SPI_RIS] &= ~S_RXCHOVRF;\n> +        }\n> +        break;\n> +\n> +    case R_SPI_MIS:\n> +    case R_SPI_STATUS:\n> +    case R_SPI_RIS:\n> +            qemu_log_mask(LOG_GUEST_ERROR,\n> +                         \"%s: Write to read only register 0x%\" HWADDR_PRIx \"\\n\",\n> +                         __func__, addr * 4);\n> +        break;\n> +\n> +    default:\n> +        if (addr < ARRAY_SIZE(s->regs)) {\n> +            s->regs[addr] = value;\n> +        } else {\n> +            qemu_log_mask(LOG_GUEST_ERROR,\n> +                         \"%s: Bad offset 0x%\" HWADDR_PRIx \"\\n\", __func__,\n> +                         addr * 4);\n> +        }\n> +        break;\n> +    }\n> +\n> +    spi_update_irq(s);\n> +}\n> +\n> +static const MemoryRegionOps spi_ops = {\n> +    .read = spi_read,\n> +    .write = spi_write,\n> +    .endianness = DEVICE_NATIVE_ENDIAN,\n> +    .valid = {\n> +        .min_access_size = 1,\n> +        .max_access_size = 4\n> +    }\n> +};\n> +\n> +static void mss_spi_realize(DeviceState *dev, Error **errp)\n> +{\n> +    MSSSpiState *s = MSS_SPI(dev);\n> +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);\n> +\n> +    s->spi = ssi_create_bus(dev, \"spi\");\n> +\n> +    sysbus_init_irq(sbd, &s->irq);\n> +    ssi_auto_connect_slaves(dev, &s->cs_line, s->spi);\n> +    sysbus_init_irq(sbd, &s->cs_line);\n> +\n> +    memory_region_init_io(&s->mmio, OBJECT(s), &spi_ops, s,\n> +                          TYPE_MSS_SPI, R_SPI_MAX * 4);\n> +    sysbus_init_mmio(sbd, &s->mmio);\n> +\n> +    fifo32_create(&s->tx_fifo, FIFO_CAPACITY);\n> +    fifo32_create(&s->rx_fifo, FIFO_CAPACITY);\n> +}\n> +\n> +static const VMStateDescription vmstate_mss_spi = {\n> +    .name = TYPE_MSS_SPI,\n> +    .version_id = 1,\n> +    .minimum_version_id = 1,\n> +    .fields = (VMStateField[]) {\n> +        VMSTATE_FIFO32(tx_fifo, MSSSpiState),\n> +        VMSTATE_FIFO32(rx_fifo, MSSSpiState),\n> +        VMSTATE_UINT32_ARRAY(regs, MSSSpiState, R_SPI_MAX),\n> +        VMSTATE_END_OF_LIST()\n> +    }\n> +};\n> +\n> +static void mss_spi_class_init(ObjectClass *klass, void *data)\n> +{\n> +    DeviceClass *dc = DEVICE_CLASS(klass);\n> +\n> +    dc->realize = mss_spi_realize;\n> +    dc->reset = mss_spi_reset;\n> +    dc->vmsd = &vmstate_mss_spi;\n> +}\n> +\n> +static const TypeInfo mss_spi_info = {\n> +    .name           = TYPE_MSS_SPI,\n> +    .parent         = TYPE_SYS_BUS_DEVICE,\n> +    .instance_size  = sizeof(MSSSpiState),\n> +    .class_init     = mss_spi_class_init,\n> +};\n> +\n> +static void mss_spi_register_types(void)\n> +{\n> +    type_register_static(&mss_spi_info);\n> +}\n> +\n> +type_init(mss_spi_register_types)\n> diff --git a/include/hw/ssi/mss-spi.h b/include/hw/ssi/mss-spi.h\n> new file mode 100644\n> index 0000000..f0cf324\n> --- /dev/null\n> +++ b/include/hw/ssi/mss-spi.h\n> @@ -0,0 +1,58 @@\n> +/*\n> + * Microsemi SmartFusion2 SPI\n> + *\n> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> + *\n> + * Permission is hereby granted, free of charge, to any person obtaining a copy\n> + * of this software and associated documentation files (the \"Software\"), to deal\n> + * in the Software without restriction, including without limitation the rights\n> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> + * copies of the Software, and to permit persons to whom the Software is\n> + * furnished to do so, subject to the following conditions:\n> + *\n> + * The above copyright notice and this permission notice shall be included in\n> + * all copies or substantial portions of the Software.\n> + *\n> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> + * THE SOFTWARE.\n> + */\n> +\n> +#ifndef HW_MSS_SPI_H\n> +#define HW_MSS_SPI_H\n> +\n> +#include \"hw/sysbus.h\"\n> +#include \"hw/ssi/ssi.h\"\n> +#include \"qemu/fifo32.h\"\n> +\n> +#define TYPE_MSS_SPI   \"mss-spi\"\n> +#define MSS_SPI(obj)   OBJECT_CHECK(MSSSpiState, (obj), TYPE_MSS_SPI)\n> +\n> +#define R_SPI_MAX             16\n> +\n> +typedef struct MSSSpiState {\n> +    SysBusDevice parent_obj;\n> +\n> +    MemoryRegion mmio;\n> +\n> +    qemu_irq irq;\n> +\n> +    qemu_irq cs_line;\n> +\n> +    SSIBus *spi;\n> +\n> +    Fifo32 rx_fifo;\n> +    Fifo32 tx_fifo;\n> +\n> +    int fifo_depth;\n> +    uint32_t frame_count;\n> +    bool enabled;\n> +\n> +    uint32_t regs[R_SPI_MAX];\n> +} MSSSpiState;\n> +\n> +#endif /* HW_MSS_SPI_H */\n> --\n> 2.5.0\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"sjHcfflC\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsM5N6PpYz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 09:51:36 +1000 (AEST)","from localhost ([::1]:39314 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1druxq-0004lb-EO\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 19:51:34 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:40947)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <alistair23@gmail.com>) id 1druxT-0004jB-8D\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 19:51:13 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <alistair23@gmail.com>) id 1druxR-0005oV-72\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 19:51:11 -0400","from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:38142)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <alistair23@gmail.com>)\n\tid 1druxQ-0005nY-SD; Tue, 12 Sep 2017 19:51:09 -0400","by mail-wm0-x241.google.com with SMTP id x17so10073885wmd.5;\n\tTue, 12 Sep 2017 16:51:07 -0700 (PDT)","by 10.28.191.130 with HTTP; Tue, 12 Sep 2017 16:50:35 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=/b6D68+r0PC5Ij9vKYELxxgmVkO+zo8gCNYrFnAVjRw=;\n\tb=sjHcfflCIkoQLYmpjTVAdb491ogyBNwWJCi5BqAjhsJBqIJ8PwNrcyKMkI75DIfjSl\n\tuD7bRBiYqTfMv4b/jlpD5/hhfuj68cJWEN0CHfoaiiSh6H2g0JPIEui3s/hHTo5l8YBE\n\trHhPPAEsi2YJnPBuoZ5LnpDhjN5xxrgECOiL+Z1PFOVYQsMaQdIct4CQSn0J6Gm6WHCA\n\tWA49Ez/e4uoSOyArrUD+//7TU0loqcXgmA27vaS/+juVnghv8CRn0SamP1XhFUoko0Jt\n\tsuiv6SjL2QeLdvrXSLfYtLRdEAysVDQykBvOUn7XyfjUaJkYA6qsOVy9oz6BGF0xEhxW\n\tYlKw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=/b6D68+r0PC5Ij9vKYELxxgmVkO+zo8gCNYrFnAVjRw=;\n\tb=feAkwoGYHrLpr5hvh72wbsfDYdEGZA9/wBYIqZMuSPWNRxhrvgRSawZYNKBrukVJbj\n\tbfW0WdHqe1ORg87Bv6ZysGrJL6rg9DqMSbPQDW0x+43mvkxkPUOTOb740lnhjWBEbmby\n\t//fbklsgmncgvrGfs+/4ovFigMFvKx0PTFHVMERlQSLmGshugYdIAXFSXgMZrzniZuPE\n\tn+zFqT+5+cFXWhIf91etxkWuAnzx9ePiui1i9BivT6j3Z1wcCeX1upDxlmEwDSqxQzwO\n\tDPnIbj4UfoXBT9ub0aBXabgRaeG1bXIZpHCsv8EOkEYyL7qgXb7iGi5kg91vwSQyvFAf\n\tA0Gg==","X-Gm-Message-State":"AHPjjUhSyO3wghGcbrIIHXoKhYnSBFCm28nIc1LPSriTjrrbprkYlClh\n\tB1TMsoGIY42R3cZiRSj76ZfB76YV7Eo4cGF7hgI=","X-Google-Smtp-Source":"AOwi7QDO/5qv2QXZJjrfOyLDrRe+1fA1DdKtKp8kidQ4dyJRSY5c4SNEoAm/AROxjsd+nmuIC6sXdPoEttxfuFae+vE=","X-Received":"by 10.28.130.130 with SMTP id e124mr792244wmd.75.1505260266246; \n\tTue, 12 Sep 2017 16:51:06 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1504812251-23438-4-git-send-email-sundeep.lkml@gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-4-git-send-email-sundeep.lkml@gmail.com>","From":"Alistair Francis <alistair23@gmail.com>","Date":"Tue, 12 Sep 2017 16:50:35 -0700","Message-ID":"<CAKmqyKPbqO-6-B_k7vp9yjJ_BPMNPpZ8YcANXpiccXmmqBijpw@mail.gmail.com>","To":"Subbaraya Sundeep <sundeep.lkml@gmail.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c09::241","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 3/5] msf2: Add Smartfusion2\n\tSPI controller","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, =?utf-8?q?Philippe_Mathieu-D?=\n\t=?utf-8?b?YXVkw6k=?= <f4bug@amsat.org>, \tqemu-arm <qemu-arm@nongnu.org>,\n\t\"qemu-devel@nongnu.org Developers\" <qemu-devel@nongnu.org>, \n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1767457,"web_url":"http://patchwork.ozlabs.org/comment/1767457/","msgid":"<CALHRZup=Dmt28Qt41a58rmMKo0eQ4dgwv1=oxx93QEL=RdW9fA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-13T02:21:08","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 3/5] msf2: Add Smartfusion2\n\tSPI controller","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Alistair,\n\nOn Wed, Sep 13, 2017 at 5:20 AM, Alistair Francis <alistair23@gmail.com>\nwrote:\n\n> On Thu, Sep 7, 2017 at 12:24 PM, Subbaraya Sundeep\n> <sundeep.lkml@gmail.com> wrote:\n> > Modelled Microsemi's Smartfusion2 SPI controller.\n> >\n> > Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>\n> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n>\n> Thank you,\nSundeep\n\n\n> Thanks,\n> Alistair\n>\n> > ---\n> >  hw/ssi/Makefile.objs     |   1 +\n> >  hw/ssi/mss-spi.c         | 404 ++++++++++++++++++++++++++++++\n> +++++++++++++++++\n> >  include/hw/ssi/mss-spi.h |  58 +++++++\n> >  3 files changed, 463 insertions(+)\n> >  create mode 100644 hw/ssi/mss-spi.c\n> >  create mode 100644 include/hw/ssi/mss-spi.h\n> >\n> > diff --git a/hw/ssi/Makefile.objs b/hw/ssi/Makefile.objs\n> > index 487add2..f5bcc65 100644\n> > --- a/hw/ssi/Makefile.objs\n> > +++ b/hw/ssi/Makefile.objs\n> > @@ -4,6 +4,7 @@ common-obj-$(CONFIG_XILINX_SPI) += xilinx_spi.o\n> >  common-obj-$(CONFIG_XILINX_SPIPS) += xilinx_spips.o\n> >  common-obj-$(CONFIG_ASPEED_SOC) += aspeed_smc.o\n> >  common-obj-$(CONFIG_STM32F2XX_SPI) += stm32f2xx_spi.o\n> > +common-obj-$(CONFIG_MSF2) += mss-spi.o\n> >\n> >  obj-$(CONFIG_OMAP) += omap_spi.o\n> >  obj-$(CONFIG_IMX) += imx_spi.o\n> > diff --git a/hw/ssi/mss-spi.c b/hw/ssi/mss-spi.c\n> > new file mode 100644\n> > index 0000000..5a8e308\n> > --- /dev/null\n> > +++ b/hw/ssi/mss-spi.c\n> > @@ -0,0 +1,404 @@\n> > +/*\n> > + * Block model of SPI controller present in\n> > + * Microsemi's SmartFusion2 and SmartFusion SoCs.\n> > + *\n> > + * Copyright (C) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> > + *\n> > + * Permission is hereby granted, free of charge, to any person\n> obtaining a copy\n> > + * of this software and associated documentation files (the\n> \"Software\"), to deal\n> > + * in the Software without restriction, including without limitation\n> the rights\n> > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or\n> sell\n> > + * copies of the Software, and to permit persons to whom the Software is\n> > + * furnished to do so, subject to the following conditions:\n> > + *\n> > + * The above copyright notice and this permission notice shall be\n> included in\n> > + * all copies or substantial portions of the Software.\n> > + *\n> > + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR\n> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n> MERCHANTABILITY,\n> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n> SHALL\n> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n> OTHER\n> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n> ARISING FROM,\n> > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n> DEALINGS IN\n> > + * THE SOFTWARE.\n> > + */\n> > +\n> > +#include \"qemu/osdep.h\"\n> > +#include \"hw/ssi/mss-spi.h\"\n> > +#include \"qemu/log.h\"\n> > +\n> > +#ifndef MSS_SPI_ERR_DEBUG\n> > +#define MSS_SPI_ERR_DEBUG   0\n> > +#endif\n> > +\n> > +#define DB_PRINT_L(lvl, fmt, args...) do { \\\n> > +    if (MSS_SPI_ERR_DEBUG >= lvl) { \\\n> > +        qemu_log(\"%s: \" fmt \"\\n\", __func__, ## args); \\\n> > +    } \\\n> > +} while (0);\n> > +\n> > +#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)\n> > +\n> > +#define FIFO_CAPACITY         32\n> > +\n> > +#define R_SPI_CONTROL         0\n> > +#define R_SPI_DFSIZE          1\n> > +#define R_SPI_STATUS          2\n> > +#define R_SPI_INTCLR          3\n> > +#define R_SPI_RX              4\n> > +#define R_SPI_TX              5\n> > +#define R_SPI_CLKGEN          6\n> > +#define R_SPI_SS              7\n> > +#define R_SPI_MIS             8\n> > +#define R_SPI_RIS             9\n> > +\n> > +#define S_TXDONE             (1 << 0)\n> > +#define S_RXRDY              (1 << 1)\n> > +#define S_RXCHOVRF           (1 << 2)\n> > +#define S_RXFIFOFUL          (1 << 4)\n> > +#define S_RXFIFOFULNXT       (1 << 5)\n> > +#define S_RXFIFOEMP          (1 << 6)\n> > +#define S_RXFIFOEMPNXT       (1 << 7)\n> > +#define S_TXFIFOFUL          (1 << 8)\n> > +#define S_TXFIFOFULNXT       (1 << 9)\n> > +#define S_TXFIFOEMP          (1 << 10)\n> > +#define S_TXFIFOEMPNXT       (1 << 11)\n> > +#define S_FRAMESTART         (1 << 12)\n> > +#define S_SSEL               (1 << 13)\n> > +#define S_ACTIVE             (1 << 14)\n> > +\n> > +#define C_ENABLE             (1 << 0)\n> > +#define C_MODE               (1 << 1)\n> > +#define C_INTRXDATA          (1 << 4)\n> > +#define C_INTTXDATA          (1 << 5)\n> > +#define C_INTRXOVRFLO        (1 << 6)\n> > +#define C_SPS                (1 << 26)\n> > +#define C_BIGFIFO            (1 << 29)\n> > +#define C_RESET              (1 << 31)\n> > +\n> > +#define FRAMESZ_MASK         0x1F\n> > +#define FMCOUNT_MASK         0x00FFFF00\n> > +#define FMCOUNT_SHIFT        8\n> > +\n> > +static void txfifo_reset(MSSSpiState *s)\n> > +{\n> > +    fifo32_reset(&s->tx_fifo);\n> > +\n> > +    s->regs[R_SPI_STATUS] &= ~S_TXFIFOFUL;\n> > +    s->regs[R_SPI_STATUS] |= S_TXFIFOEMP;\n> > +}\n> > +\n> > +static void rxfifo_reset(MSSSpiState *s)\n> > +{\n> > +    fifo32_reset(&s->rx_fifo);\n> > +\n> > +    s->regs[R_SPI_STATUS] &= ~S_RXFIFOFUL;\n> > +    s->regs[R_SPI_STATUS] |= S_RXFIFOEMP;\n> > +}\n> > +\n> > +static void set_fifodepth(MSSSpiState *s)\n> > +{\n> > +    unsigned int size = s->regs[R_SPI_DFSIZE] & FRAMESZ_MASK;\n> > +\n> > +    if (size <= 8) {\n> > +        s->fifo_depth = 32;\n> > +    } else if (size <= 16) {\n> > +        s->fifo_depth = 16;\n> > +    } else if (size <= 32) {\n> > +        s->fifo_depth = 8;\n> > +    } else {\n> > +        s->fifo_depth = 4;\n> > +    }\n> > +}\n> > +\n> > +static void update_mis(MSSSpiState *s)\n> > +{\n> > +    uint32_t reg = s->regs[R_SPI_CONTROL];\n> > +    uint32_t tmp;\n> > +\n> > +    /*\n> > +     * form the Control register interrupt enable bits\n> > +     * same as RIS, MIS and Interrupt clear registers for simplicity\n> > +     */\n> > +    tmp = ((reg & C_INTRXOVRFLO) >> 4) | ((reg & C_INTRXDATA) >> 3) |\n> > +           ((reg & C_INTTXDATA) >> 5);\n> > +    s->regs[R_SPI_MIS] |= tmp & s->regs[R_SPI_RIS];\n> > +}\n> > +\n> > +static void spi_update_irq(MSSSpiState *s)\n> > +{\n> > +    int irq;\n> > +\n> > +    update_mis(s);\n> > +    irq = !!(s->regs[R_SPI_MIS]);\n> > +\n> > +    qemu_set_irq(s->irq, irq);\n> > +}\n> > +\n> > +static void mss_spi_reset(DeviceState *d)\n> > +{\n> > +    MSSSpiState *s = MSS_SPI(d);\n> > +\n> > +    memset(s->regs, 0, sizeof s->regs);\n> > +    s->regs[R_SPI_CONTROL] = 0x80000102;\n> > +    s->regs[R_SPI_DFSIZE] = 0x4;\n> > +    s->regs[R_SPI_STATUS] = S_SSEL | S_TXFIFOEMP | S_RXFIFOEMP;\n> > +    s->regs[R_SPI_CLKGEN] = 0x7;\n> > +    s->regs[R_SPI_RIS] = 0x0;\n> > +\n> > +    s->fifo_depth = 4;\n> > +    s->frame_count = 1;\n> > +    s->enabled = false;\n> > +\n> > +    rxfifo_reset(s);\n> > +    txfifo_reset(s);\n> > +}\n> > +\n> > +static uint64_t\n> > +spi_read(void *opaque, hwaddr addr, unsigned int size)\n> > +{\n> > +    MSSSpiState *s = opaque;\n> > +    uint32_t ret = 0;\n> > +\n> > +    addr >>= 2;\n> > +    switch (addr) {\n> > +    case R_SPI_RX:\n> > +        s->regs[R_SPI_STATUS] &= ~S_RXFIFOFUL;\n> > +        s->regs[R_SPI_STATUS] &= ~S_RXCHOVRF;\n> > +        ret = fifo32_pop(&s->rx_fifo);\n> > +        if (fifo32_is_empty(&s->rx_fifo)) {\n> > +            s->regs[R_SPI_STATUS] |= S_RXFIFOEMP;\n> > +        }\n> > +        break;\n> > +\n> > +    case R_SPI_MIS:\n> > +        update_mis(s);\n> > +        ret = s->regs[R_SPI_MIS];\n> > +        break;\n> > +\n> > +    default:\n> > +        if (addr < ARRAY_SIZE(s->regs)) {\n> > +            ret = s->regs[addr];\n> > +        } else {\n> > +            qemu_log_mask(LOG_GUEST_ERROR,\n> > +                         \"%s: Bad offset 0x%\" HWADDR_PRIx \"\\n\",\n> __func__,\n> > +                         addr * 4);\n> > +            return ret;\n> > +        }\n> > +        break;\n> > +    }\n> > +\n> > +    DB_PRINT(\"addr=0x%\" HWADDR_PRIx \" = 0x%\" PRIx32, addr * 4, ret);\n> > +    spi_update_irq(s);\n> > +    return ret;\n> > +}\n> > +\n> > +static void assert_cs(MSSSpiState *s)\n> > +{\n> > +    qemu_set_irq(s->cs_line, 0);\n> > +}\n> > +\n> > +static void deassert_cs(MSSSpiState *s)\n> > +{\n> > +    qemu_set_irq(s->cs_line, 1);\n> > +}\n> > +\n> > +static void spi_flush_txfifo(MSSSpiState *s)\n> > +{\n> > +    uint32_t tx;\n> > +    uint32_t rx;\n> > +    bool sps = !!(s->regs[R_SPI_CONTROL] & C_SPS);\n> > +\n> > +    /*\n> > +     * Chip Select(CS) is automatically controlled by this controller.\n> > +     * If SPS bit is set in Control register then CS is asserted\n> > +     * until all the frames set in frame count of Control register are\n> > +     * transferred. If SPS is not set then CS pulses between frames.\n> > +     * Note that Slave Select register specifies which of the CS line\n> > +     * has to be controlled automatically by controller. Bits SS[7:1]\n> are for\n> > +     * masters in FPGA fabric since we model only Microcontroller\n> subsystem\n> > +     * of Smartfusion2 we control only one CS(SS[0]) line.\n> > +     */\n> > +    while (!fifo32_is_empty(&s->tx_fifo) && s->frame_count) {\n> > +        assert_cs(s);\n> > +\n> > +        s->regs[R_SPI_STATUS] &= ~(S_TXDONE | S_RXRDY);\n> > +\n> > +        tx = fifo32_pop(&s->tx_fifo);\n> > +        DB_PRINT(\"data tx:0x%\" PRIx32, tx);\n> > +        rx = ssi_transfer(s->spi, tx);\n> > +        DB_PRINT(\"data rx:0x%\" PRIx32, rx);\n> > +\n> > +        if (fifo32_num_used(&s->rx_fifo) == s->fifo_depth) {\n> > +            s->regs[R_SPI_STATUS] |= S_RXCHOVRF;\n> > +            s->regs[R_SPI_RIS] |= S_RXCHOVRF;\n> > +        } else {\n> > +            fifo32_push(&s->rx_fifo, rx);\n> > +            s->regs[R_SPI_STATUS] &= ~S_RXFIFOEMP;\n> > +            if (fifo32_num_used(&s->rx_fifo) == (s->fifo_depth - 1)) {\n> > +                s->regs[R_SPI_STATUS] |= S_RXFIFOFULNXT;\n> > +            } else if (fifo32_num_used(&s->rx_fifo) == s->fifo_depth) {\n> > +                s->regs[R_SPI_STATUS] |= S_RXFIFOFUL;\n> > +            }\n> > +        }\n> > +        s->frame_count--;\n> > +        if (!sps) {\n> > +            deassert_cs(s);\n> > +        }\n> > +    }\n> > +\n> > +    if (!s->frame_count) {\n> > +        s->frame_count = (s->regs[R_SPI_CONTROL] & FMCOUNT_MASK) >>\n> > +                            FMCOUNT_SHIFT;\n> > +        deassert_cs(s);\n> > +        s->regs[R_SPI_RIS] |= S_TXDONE | S_RXRDY;\n> > +        s->regs[R_SPI_STATUS] |= S_TXDONE | S_RXRDY;\n> > +   }\n> > +}\n> > +\n> > +static void spi_write(void *opaque, hwaddr addr,\n> > +            uint64_t val64, unsigned int size)\n> > +{\n> > +    MSSSpiState *s = opaque;\n> > +    uint32_t value = val64;\n> > +\n> > +    DB_PRINT(\"addr=0x%\" HWADDR_PRIx \" =0x%\" PRIx32, addr, value);\n> > +    addr >>= 2;\n> > +\n> > +    switch (addr) {\n> > +    case R_SPI_TX:\n> > +        /* adding to already full FIFO */\n> > +        if (fifo32_num_used(&s->tx_fifo) == s->fifo_depth) {\n> > +            break;\n> > +        }\n> > +        s->regs[R_SPI_STATUS] &= ~S_TXFIFOEMP;\n> > +        fifo32_push(&s->tx_fifo, value);\n> > +        if (fifo32_num_used(&s->tx_fifo) == (s->fifo_depth - 1)) {\n> > +            s->regs[R_SPI_STATUS] |= S_TXFIFOFULNXT;\n> > +        } else if (fifo32_num_used(&s->tx_fifo) == s->fifo_depth) {\n> > +            s->regs[R_SPI_STATUS] |= S_TXFIFOFUL;\n> > +        }\n> > +        if (s->enabled) {\n> > +            spi_flush_txfifo(s);\n> > +        }\n> > +        break;\n> > +\n> > +    case R_SPI_CONTROL:\n> > +        s->regs[R_SPI_CONTROL] = value;\n> > +        if (value & C_BIGFIFO) {\n> > +            set_fifodepth(s);\n> > +        } else {\n> > +            s->fifo_depth = 4;\n> > +        }\n> > +        s->enabled = value & C_ENABLE;\n> > +        s->frame_count = (value & FMCOUNT_MASK) >> FMCOUNT_SHIFT;\n> > +        if (value & C_RESET) {\n> > +            mss_spi_reset(DEVICE(s));\n> > +        }\n> > +        break;\n> > +\n> > +    case R_SPI_DFSIZE:\n> > +        if (s->enabled) {\n> > +            break;\n> > +        }\n> > +        s->regs[R_SPI_DFSIZE] = value;\n> > +        break;\n> > +\n> > +    case R_SPI_INTCLR:\n> > +        s->regs[R_SPI_INTCLR] = value;\n> > +        if (value & S_TXDONE) {\n> > +            s->regs[R_SPI_RIS] &= ~S_TXDONE;\n> > +        }\n> > +        if (value & S_RXRDY) {\n> > +            s->regs[R_SPI_RIS] &= ~S_RXRDY;\n> > +        }\n> > +        if (value & S_RXCHOVRF) {\n> > +            s->regs[R_SPI_RIS] &= ~S_RXCHOVRF;\n> > +        }\n> > +        break;\n> > +\n> > +    case R_SPI_MIS:\n> > +    case R_SPI_STATUS:\n> > +    case R_SPI_RIS:\n> > +            qemu_log_mask(LOG_GUEST_ERROR,\n> > +                         \"%s: Write to read only register 0x%\"\n> HWADDR_PRIx \"\\n\",\n> > +                         __func__, addr * 4);\n> > +        break;\n> > +\n> > +    default:\n> > +        if (addr < ARRAY_SIZE(s->regs)) {\n> > +            s->regs[addr] = value;\n> > +        } else {\n> > +            qemu_log_mask(LOG_GUEST_ERROR,\n> > +                         \"%s: Bad offset 0x%\" HWADDR_PRIx \"\\n\",\n> __func__,\n> > +                         addr * 4);\n> > +        }\n> > +        break;\n> > +    }\n> > +\n> > +    spi_update_irq(s);\n> > +}\n> > +\n> > +static const MemoryRegionOps spi_ops = {\n> > +    .read = spi_read,\n> > +    .write = spi_write,\n> > +    .endianness = DEVICE_NATIVE_ENDIAN,\n> > +    .valid = {\n> > +        .min_access_size = 1,\n> > +        .max_access_size = 4\n> > +    }\n> > +};\n> > +\n> > +static void mss_spi_realize(DeviceState *dev, Error **errp)\n> > +{\n> > +    MSSSpiState *s = MSS_SPI(dev);\n> > +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);\n> > +\n> > +    s->spi = ssi_create_bus(dev, \"spi\");\n> > +\n> > +    sysbus_init_irq(sbd, &s->irq);\n> > +    ssi_auto_connect_slaves(dev, &s->cs_line, s->spi);\n> > +    sysbus_init_irq(sbd, &s->cs_line);\n> > +\n> > +    memory_region_init_io(&s->mmio, OBJECT(s), &spi_ops, s,\n> > +                          TYPE_MSS_SPI, R_SPI_MAX * 4);\n> > +    sysbus_init_mmio(sbd, &s->mmio);\n> > +\n> > +    fifo32_create(&s->tx_fifo, FIFO_CAPACITY);\n> > +    fifo32_create(&s->rx_fifo, FIFO_CAPACITY);\n> > +}\n> > +\n> > +static const VMStateDescription vmstate_mss_spi = {\n> > +    .name = TYPE_MSS_SPI,\n> > +    .version_id = 1,\n> > +    .minimum_version_id = 1,\n> > +    .fields = (VMStateField[]) {\n> > +        VMSTATE_FIFO32(tx_fifo, MSSSpiState),\n> > +        VMSTATE_FIFO32(rx_fifo, MSSSpiState),\n> > +        VMSTATE_UINT32_ARRAY(regs, MSSSpiState, R_SPI_MAX),\n> > +        VMSTATE_END_OF_LIST()\n> > +    }\n> > +};\n> > +\n> > +static void mss_spi_class_init(ObjectClass *klass, void *data)\n> > +{\n> > +    DeviceClass *dc = DEVICE_CLASS(klass);\n> > +\n> > +    dc->realize = mss_spi_realize;\n> > +    dc->reset = mss_spi_reset;\n> > +    dc->vmsd = &vmstate_mss_spi;\n> > +}\n> > +\n> > +static const TypeInfo mss_spi_info = {\n> > +    .name           = TYPE_MSS_SPI,\n> > +    .parent         = TYPE_SYS_BUS_DEVICE,\n> > +    .instance_size  = sizeof(MSSSpiState),\n> > +    .class_init     = mss_spi_class_init,\n> > +};\n> > +\n> > +static void mss_spi_register_types(void)\n> > +{\n> > +    type_register_static(&mss_spi_info);\n> > +}\n> > +\n> > +type_init(mss_spi_register_types)\n> > diff --git a/include/hw/ssi/mss-spi.h b/include/hw/ssi/mss-spi.h\n> > new file mode 100644\n> > index 0000000..f0cf324\n> > --- /dev/null\n> > +++ b/include/hw/ssi/mss-spi.h\n> > @@ -0,0 +1,58 @@\n> > +/*\n> > + * Microsemi SmartFusion2 SPI\n> > + *\n> > + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> > + *\n> > + * Permission is hereby granted, free of charge, to any person\n> obtaining a copy\n> > + * of this software and associated documentation files (the\n> \"Software\"), to deal\n> > + * in the Software without restriction, including without limitation\n> the rights\n> > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or\n> sell\n> > + * copies of the Software, and to permit persons to whom the Software is\n> > + * furnished to do so, subject to the following conditions:\n> > + *\n> > + * The above copyright notice and this permission notice shall be\n> included in\n> > + * all copies or substantial portions of the Software.\n> > + *\n> > + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR\n> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n> MERCHANTABILITY,\n> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n> SHALL\n> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n> OTHER\n> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n> ARISING FROM,\n> > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n> DEALINGS IN\n> > + * THE SOFTWARE.\n> > + */\n> > +\n> > +#ifndef HW_MSS_SPI_H\n> > +#define HW_MSS_SPI_H\n> > +\n> > +#include \"hw/sysbus.h\"\n> > +#include \"hw/ssi/ssi.h\"\n> > +#include \"qemu/fifo32.h\"\n> > +\n> > +#define TYPE_MSS_SPI   \"mss-spi\"\n> > +#define MSS_SPI(obj)   OBJECT_CHECK(MSSSpiState, (obj), TYPE_MSS_SPI)\n> > +\n> > +#define R_SPI_MAX             16\n> > +\n> > +typedef struct MSSSpiState {\n> > +    SysBusDevice parent_obj;\n> > +\n> > +    MemoryRegion mmio;\n> > +\n> > +    qemu_irq irq;\n> > +\n> > +    qemu_irq cs_line;\n> > +\n> > +    SSIBus *spi;\n> > +\n> > +    Fifo32 rx_fifo;\n> > +    Fifo32 tx_fifo;\n> > +\n> > +    int fifo_depth;\n> > +    uint32_t frame_count;\n> > +    bool enabled;\n> > +\n> > +    uint32_t regs[R_SPI_MAX];\n> > +} MSSSpiState;\n> > +\n> > +#endif /* HW_MSS_SPI_H */\n> > --\n> > 2.5.0\n> >\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"PCgMEVLZ\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsQQk2FPhz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 12:21:47 +1000 (AEST)","from localhost ([::1]:39664 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drxJ9-0000Rm-PF\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 22:21:43 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:56239)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1drxIg-0000Ra-QR\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 22:21:18 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1drxIc-00060o-Qn\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 22:21:14 -0400","from mail-ua0-x236.google.com ([2607:f8b0:400c:c08::236]:38714)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1drxIc-0005xw-Iz; Tue, 12 Sep 2017 22:21:10 -0400","by mail-ua0-x236.google.com with SMTP id l24so17293673uaa.5;\n\tTue, 12 Sep 2017 19:21:09 -0700 (PDT)","by 10.176.66.68 with HTTP; Tue, 12 Sep 2017 19:21:08 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=cVuHozTc2w8UAOVK7Hz/Z89Qx5Qd2OY4JUIL3E9XyzM=;\n\tb=PCgMEVLZAiSHB4Da1Hh+nnh1Q4gg5HMYnHX0o4BkD/ibb5gG9DH2PJKcVEkMY7te1P\n\t+ZsHI8rXG3tzzju4ss6e3eljvsJrXdFFXHIN44chovp8PluWqOsJRzXOhccGjvqGFZZy\n\t5wFEd4YpyKRV0jKY/mVkZDYlj7Ms5vftb40Gg4J0d2k6xoxj3FHk6AnQ2W5TlW71BGYl\n\tnKE8eGl+5/Gp80HdYR73A1CZmag2nPw14u4cGHmgsKtIVquIMQFVxIWGwDdwrXkBppwM\n\tbWb/JNkY/fvzlz6d2xwHg2S8OMj+Gc8UBuUgGYaCftHRUbVJYWeZI4EspioJWxiMk7l5\n\t24BQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=cVuHozTc2w8UAOVK7Hz/Z89Qx5Qd2OY4JUIL3E9XyzM=;\n\tb=dVAaMHIpMpHWrde1N0i6NxgD78509QuHEqLZezdipg+bWQ1im4yZmN51wjKwE43c/O\n\tYW7Jk01A7DYKYvEOTcc3cN/E/paGhx7DKOEWlcek10OpFnEq7Ejt1Gzd7f7FAvwusc6G\n\tg0BxaZmWuDW8fXIdnGIV1ZKL/Gb8a1+w+K48z1rBOtLBPJ8eMK4Li24hA5JhMXMqv+tn\n\t2Rmfv8SM7t2D1TprJft+dHU0wfJfIpKrFbRG6jeb2iduqR7jYuDhRjMesoRLmyVNRiXw\n\tre+Zi+sh6EPzeFVeqeRHt0fIjIi3zqt7qnBycQS9ugBG36MzBknzKZNuHrpBX7g9QmnL\n\tC/6A==","X-Gm-Message-State":"AHPjjUjvGC0vlMT8x9RDelEwcmeSQ8jKxs0Bag5UBN9pPa+Ex/qKa6cz\n\ty2agxrAy1Kr+tXS4C5O6pRpMWElHR7MeSeeNRDE=","X-Google-Smtp-Source":"ADKCNb6K19dT4hJmKxFso/EU15xkI/QJgj2wU5W6pTggBvPadPwes9XMxY+g4HaLcjOgQSZmsdicv3PKjYed/kVbm/w=","X-Received":"by 10.176.3.51 with SMTP id 48mr14263759uat.67.1505269268753;\n\tTue, 12 Sep 2017 19:21:08 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAKmqyKPbqO-6-B_k7vp9yjJ_BPMNPpZ8YcANXpiccXmmqBijpw@mail.gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-4-git-send-email-sundeep.lkml@gmail.com>\n\t<CAKmqyKPbqO-6-B_k7vp9yjJ_BPMNPpZ8YcANXpiccXmmqBijpw@mail.gmail.com>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Wed, 13 Sep 2017 07:51:08 +0530","Message-ID":"<CALHRZup=Dmt28Qt41a58rmMKo0eQ4dgwv1=oxx93QEL=RdW9fA@mail.gmail.com>","To":"Alistair Francis <alistair23@gmail.com>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c08::236","Content-Type":"text/plain; charset=\"UTF-8\"","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 3/5] msf2: Add Smartfusion2\n\tSPI controller","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, =?utf-8?q?Philippe_Mathieu-D?=\n\t=?utf-8?b?YXVkw6k=?= <f4bug@amsat.org>, \tqemu-arm <qemu-arm@nongnu.org>,\n\t\"qemu-devel@nongnu.org Developers\" <qemu-devel@nongnu.org>, \n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1767708,"web_url":"http://patchwork.ozlabs.org/comment/1767708/","msgid":"<CALHRZurVQzOX+U7OioHGiMKSoZNSOA77zqhyEGgp=H_5fKC7qg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-13T09:21:58","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Philippe,\n\nAll patches got Reviewed-by. Do you want me to change alias to remap and\nsend\nv9 or wait so that you get time to review?\n\nThanks,\nSundeep\n\nOn Fri, Sep 8, 2017 at 12:56 PM, sundeep subbaraya <sundeep.lkml@gmail.com>\nwrote:\n\n> Hi Philippe,\n>\n> On Fri, Sep 8, 2017 at 3:08 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\n> wrote:\n>\n>> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>>\n>>> Smartfusion2 SoC has hardened Microcontroller subsystem\n>>> and flash based FPGA fabric. This patch adds support for\n>>> Microcontroller subsystem in the SoC.\n>>>\n>>> Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>>> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n>>> ---\n>>>   default-configs/arm-softmmu.mak |   1 +\n>>>   hw/arm/Makefile.objs            |   1 +\n>>>   hw/arm/msf2-soc.c               | 218 ++++++++++++++++++++++++++++++\n>>> ++++++++++\n>>>   include/hw/arm/msf2-soc.h       |  66 ++++++++++++\n>>>   4 files changed, 286 insertions(+)\n>>>   create mode 100644 hw/arm/msf2-soc.c\n>>>   create mode 100644 include/hw/arm/msf2-soc.h\n>>>\n>>> diff --git a/default-configs/arm-softmmu.mak\n>>> b/default-configs/arm-softmmu.mak\n>>> index bbdd3c1..5059d13 100644\n>>> --- a/default-configs/arm-softmmu.mak\n>>> +++ b/default-configs/arm-softmmu.mak\n>>> @@ -129,3 +129,4 @@ CONFIG_ACPI=y\n>>>   CONFIG_SMBIOS=y\n>>>   CONFIG_ASPEED_SOC=y\n>>>   CONFIG_GPIO_KEY=y\n>>> +CONFIG_MSF2=y\n>>> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs\n>>> index a2e56ec..df36a03 100644\n>>> --- a/hw/arm/Makefile.objs\n>>> +++ b/hw/arm/Makefile.objs\n>>> @@ -19,3 +19,4 @@ obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o\n>>>   obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o\n>>>   obj-$(CONFIG_ASPEED_SOC) += aspeed_soc.o aspeed.o\n>>>   obj-$(CONFIG_MPS2) += mps2.o\n>>> +obj-$(CONFIG_MSF2) += msf2-soc.o\n>>> diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c\n>>> new file mode 100644\n>>> index 0000000..47fffa4\n>>> --- /dev/null\n>>> +++ b/hw/arm/msf2-soc.c\n>>> @@ -0,0 +1,218 @@\n>>> +/*\n>>> + * SmartFusion2 SoC emulation.\n>>> + *\n>>> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>>> + *\n>>> + * Permission is hereby granted, free of charge, to any person\n>>> obtaining a copy\n>>> + * of this software and associated documentation files (the\n>>> \"Software\"), to deal\n>>> + * in the Software without restriction, including without limitation\n>>> the rights\n>>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or\n>>> sell\n>>> + * copies of the Software, and to permit persons to whom the Software is\n>>> + * furnished to do so, subject to the following conditions:\n>>> + *\n>>> + * The above copyright notice and this permission notice shall be\n>>> included in\n>>> + * all copies or substantial portions of the Software.\n>>> + *\n>>> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n>>> EXPRESS OR\n>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n>>> MERCHANTABILITY,\n>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n>>> SHALL\n>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n>>> OTHER\n>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n>>> ARISING FROM,\n>>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n>>> DEALINGS IN\n>>> + * THE SOFTWARE.\n>>> + */\n>>> +\n>>> +#include \"qemu/osdep.h\"\n>>> +#include \"qapi/error.h\"\n>>> +#include \"qemu-common.h\"\n>>> +#include \"hw/arm/arm.h\"\n>>> +#include \"exec/address-spaces.h\"\n>>> +#include \"hw/char/serial.h\"\n>>> +#include \"hw/boards.h\"\n>>> +#include \"sysemu/block-backend.h\"\n>>> +#include \"qemu/cutils.h\"\n>>> +#include \"hw/arm/msf2-soc.h\"\n>>> +\n>>> +#define MSF2_TIMER_BASE       0x40004000\n>>> +#define MSF2_SYSREG_BASE      0x40038000\n>>> +\n>>> +#define ENVM_BASE_ADDRESS     0x60000000\n>>> +\n>>> +#define SRAM_BASE_ADDRESS     0x20000000\n>>> +\n>>> +#define MSF2_ENVM_MAX_SIZE        (512 * K_BYTE)\n>>> +\n>>> +/*\n>>> + * eSRAM max size is 80k without SECDED(Single error correction and\n>>> + * dual error detection) feature and 64k with SECDED.\n>>> + * We do not support SECDED now.\n>>> + */\n>>> +#define MSF2_ESRAM_MAX_SIZE       (80 * K_BYTE)\n>>> +\n>>> +static const uint32_t spi_addr[MSF2_NUM_SPIS] = { 0x40001000 ,\n>>> 0x40011000 };\n>>> +static const uint32_t uart_addr[MSF2_NUM_UARTS] = { 0x40000000 ,\n>>> 0x40010000 };\n>>> +\n>>> +static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 };\n>>> +static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 };\n>>> +static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 };\n>>> +\n>>> +static void m2sxxx_soc_initfn(Object *obj)\n>>> +{\n>>> +    MSF2State *s = MSF2_SOC(obj);\n>>> +    int i;\n>>> +\n>>> +    object_initialize(&s->armv7m, sizeof(s->armv7m), TYPE_ARMV7M);\n>>> +    qdev_set_parent_bus(DEVICE(&s->armv7m), sysbus_get_default());\n>>> +\n>>> +    object_initialize(&s->sysreg, sizeof(s->sysreg), TYPE_MSF2_SYSREG);\n>>> +    qdev_set_parent_bus(DEVICE(&s->sysreg), sysbus_get_default());\n>>> +\n>>> +    object_initialize(&s->timer, sizeof(s->timer), TYPE_MSS_TIMER);\n>>> +    qdev_set_parent_bus(DEVICE(&s->timer), sysbus_get_default());\n>>> +\n>>> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n>>> +        object_initialize(&s->spi[i], sizeof(s->spi[i]),\n>>> +                          TYPE_MSS_SPI);\n>>> +        qdev_set_parent_bus(DEVICE(&s->spi[i]), sysbus_get_default());\n>>> +    }\n>>> +}\n>>> +\n>>> +static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)\n>>> +{\n>>> +    MSF2State *s = MSF2_SOC(dev_soc);\n>>> +    DeviceState *dev, *armv7m;\n>>> +    SysBusDevice *busdev;\n>>> +    Error *err = NULL;\n>>> +    int i;\n>>> +\n>>> +    MemoryRegion *system_memory = get_system_memory();\n>>> +    MemoryRegion *nvm = g_new(MemoryRegion, 1);\n>>> +    MemoryRegion *nvm_alias = g_new(MemoryRegion, 1);\n>>> +    MemoryRegion *sram = g_new(MemoryRegion, 1);\n>>> +\n>>> +    memory_region_init_rom(nvm, NULL, \"MSF2.eNVM\", s->envm_size,\n>>> +                           &error_fatal);\n>>> +    /*\n>>> +     * On power-on, the eNVM region 0x60000000 is automatically\n>>> +     * remapped to the Cortex-M3 processor executable region\n>>> +     * start address (0x0). We do not support remapping other eNVM,\n>>> +     * eSRAM and DDR regions by guest(via Sysreg) currently.\n>>> +     */\n>>> +    memory_region_init_alias(nvm_alias, NULL, \"MSF2.eNVM.alias\",\n>>>\n>>\n>> you can drop the \".alias\", this function already prepends \"alias \"\n>\n>\n> .remap sounds good?\n>\n> Thanks,\n> Sundeep\n>\n>>\n>>\n>> +                             nvm, 0, s->envm_size);\n>>> +\n>>> +    memory_region_add_subregion(system_memory, ENVM_BASE_ADDRESS, nvm);\n>>> +    memory_region_add_subregion(system_memory, 0, nvm_alias);\n>>> +\n>>> +    memory_region_init_ram(sram, NULL, \"MSF2.eSRAM\", s->esram_size,\n>>> +                           &error_fatal);\n>>> +    memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS,\n>>> sram);\n>>> +\n>>> +    armv7m = DEVICE(&s->armv7m);\n>>> +    qdev_prop_set_uint32(armv7m, \"num-irq\", 81);\n>>> +    qdev_prop_set_string(armv7m, \"cpu-model\", \"cortex-m3\");\n>>> +    object_property_set_link(OBJECT(&s->armv7m),\n>>> OBJECT(get_system_memory()),\n>>> +                                     \"memory\", &error_abort);\n>>> +    object_property_set_bool(OBJECT(&s->armv7m), true, \"realized\",\n>>> &err);\n>>> +    if (err != NULL) {\n>>> +        error_propagate(errp, err);\n>>> +        return;\n>>> +    }\n>>> +\n>>> +    system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;\n>>> +\n>>> +    for (i = 0; i < MSF2_NUM_UARTS; i++) {\n>>> +        if (serial_hds[i]) {\n>>> +            serial_mm_init(get_system_memory(), uart_addr[i], 2,\n>>> +                           qdev_get_gpio_in(armv7m, uart_irq[i]),\n>>> +                           115200, serial_hds[i], DEVICE_NATIVE_ENDIAN);\n>>> +        }\n>>> +    }\n>>> +\n>>> +    dev = DEVICE(&s->timer);\n>>> +    /* APB0 clock is the timer input clock */\n>>> +    qdev_prop_set_uint32(dev, \"clock-frequency\", s->m3clk / s->apb0div);\n>>> +    object_property_set_bool(OBJECT(&s->timer), true, \"realized\",\n>>> &err);\n>>> +    if (err != NULL) {\n>>> +        error_propagate(errp, err);\n>>> +        return;\n>>> +    }\n>>> +    busdev = SYS_BUS_DEVICE(dev);\n>>> +    sysbus_mmio_map(busdev, 0, MSF2_TIMER_BASE);\n>>> +    sysbus_connect_irq(busdev, 0,\n>>> +                           qdev_get_gpio_in(armv7m, timer_irq[0]));\n>>> +    sysbus_connect_irq(busdev, 1,\n>>> +                           qdev_get_gpio_in(armv7m, timer_irq[1]));\n>>> +\n>>> +    dev = DEVICE(&s->sysreg);\n>>> +    qdev_prop_set_uint32(dev, \"apb0divisor\", s->apb0div);\n>>> +    qdev_prop_set_uint32(dev, \"apb1divisor\", s->apb1div);\n>>> +    object_property_set_bool(OBJECT(&s->sysreg), true, \"realized\",\n>>> &err);\n>>> +    if (err != NULL) {\n>>> +        error_propagate(errp, err);\n>>> +        return;\n>>> +    }\n>>> +    busdev = SYS_BUS_DEVICE(dev);\n>>> +    sysbus_mmio_map(busdev, 0, MSF2_SYSREG_BASE);\n>>> +\n>>> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n>>> +        gchar *bus_name;\n>>> +\n>>> +        object_property_set_bool(OBJECT(&s->spi[i]), true, \"realized\",\n>>> &err);\n>>> +        if (err != NULL) {\n>>> +            error_propagate(errp, err);\n>>> +            return;\n>>> +        }\n>>> +\n>>> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]);\n>>> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,\n>>> +                           qdev_get_gpio_in(armv7m, spi_irq[i]));\n>>> +\n>>> +        /* Alias controller SPI bus to the SoC itself */\n>>> +        bus_name = g_strdup_printf(\"spi%d\", i);\n>>> +        object_property_add_alias(OBJECT(s), bus_name,\n>>> +                                  OBJECT(&s->spi[i]), \"spi\",\n>>> +                                  &error_abort);\n>>> +        g_free(bus_name);\n>>> +    }\n>>> +}\n>>> +\n>>> +static Property m2sxxx_soc_properties[] = {\n>>> +    /*\n>>> +     * part name specifies the type of SmartFusion2 device variant(this\n>>> +     * property is for information purpose only.\n>>> +     */\n>>> +    DEFINE_PROP_STRING(\"part-name\", MSF2State, part_name),\n>>> +    DEFINE_PROP_UINT64(\"eNVM-size\", MSF2State, envm_size,\n>>> MSF2_ENVM_MAX_SIZE),\n>>> +    DEFINE_PROP_UINT64(\"eSRAM-size\", MSF2State, esram_size,\n>>> +                        MSF2_ESRAM_MAX_SIZE),\n>>> +    /* Libero GUI shows 100Mhz as default for clocks */\n>>> +    DEFINE_PROP_UINT32(\"m3clk\", MSF2State, m3clk, 100 * 1000000),\n>>> +    /* default divisors in Libero GUI */\n>>> +    DEFINE_PROP_UINT32(\"apb0div\", MSF2State, apb0div, 2),\n>>> +    DEFINE_PROP_UINT32(\"apb1div\", MSF2State, apb1div, 2),\n>>> +    DEFINE_PROP_END_OF_LIST(),\n>>> +};\n>>> +\n>>> +static void m2sxxx_soc_class_init(ObjectClass *klass, void *data)\n>>> +{\n>>> +    DeviceClass *dc = DEVICE_CLASS(klass);\n>>> +\n>>> +    dc->realize = m2sxxx_soc_realize;\n>>> +    dc->props = m2sxxx_soc_properties;\n>>> +}\n>>> +\n>>> +static const TypeInfo m2sxxx_soc_info = {\n>>> +    .name          = TYPE_MSF2_SOC,\n>>> +    .parent        = TYPE_SYS_BUS_DEVICE,\n>>> +    .instance_size = sizeof(MSF2State),\n>>> +    .instance_init = m2sxxx_soc_initfn,\n>>> +    .class_init    = m2sxxx_soc_class_init,\n>>> +};\n>>> +\n>>> +static void m2sxxx_soc_types(void)\n>>> +{\n>>> +    type_register_static(&m2sxxx_soc_info);\n>>> +}\n>>> +\n>>> +type_init(m2sxxx_soc_types)\n>>> diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h\n>>> new file mode 100644\n>>> index 0000000..eb239fa\n>>> --- /dev/null\n>>> +++ b/include/hw/arm/msf2-soc.h\n>>> @@ -0,0 +1,66 @@\n>>> +/*\n>>> + * Microsemi Smartfusion2 SoC\n>>> + *\n>>> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>>> + *\n>>> + * Permission is hereby granted, free of charge, to any person\n>>> obtaining a copy\n>>> + * of this software and associated documentation files (the\n>>> \"Software\"), to deal\n>>> + * in the Software without restriction, including without limitation\n>>> the rights\n>>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or\n>>> sell\n>>> + * copies of the Software, and to permit persons to whom the Software is\n>>> + * furnished to do so, subject to the following conditions:\n>>> + *\n>>> + * The above copyright notice and this permission notice shall be\n>>> included in\n>>> + * all copies or substantial portions of the Software.\n>>> + *\n>>> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n>>> EXPRESS OR\n>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n>>> MERCHANTABILITY,\n>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n>>> SHALL\n>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n>>> OTHER\n>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n>>> ARISING FROM,\n>>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n>>> DEALINGS IN\n>>> + * THE SOFTWARE.\n>>> + */\n>>> +\n>>> +#ifndef HW_ARM_MSF2_SOC_H\n>>> +#define HW_ARM_MSF2_SOC_H\n>>> +\n>>> +#include \"hw/arm/armv7m.h\"\n>>> +#include \"hw/timer/mss-timer.h\"\n>>> +#include \"hw/misc/msf2-sysreg.h\"\n>>> +#include \"hw/ssi/mss-spi.h\"\n>>> +\n>>> +#define TYPE_MSF2_SOC     \"msf2-soc\"\n>>> +#define MSF2_SOC(obj)     OBJECT_CHECK(MSF2State, (obj), TYPE_MSF2_SOC)\n>>> +\n>>> +#define MSF2_NUM_SPIS         2\n>>> +#define MSF2_NUM_UARTS        2\n>>> +\n>>> +/*\n>>> + * System timer consists of two programmable 32-bit\n>>> + * decrementing counters that generate individual interrupts to\n>>> + * the Cortex-M3 processor\n>>> + */\n>>> +#define MSF2_NUM_TIMERS       2\n>>> +\n>>> +typedef struct MSF2State {\n>>> +    /*< private >*/\n>>> +    SysBusDevice parent_obj;\n>>> +    /*< public >*/\n>>> +\n>>> +    ARMv7MState armv7m;\n>>> +\n>>> +    char *part_name;\n>>> +    uint64_t envm_size;\n>>> +    uint64_t esram_size;\n>>> +\n>>> +    uint32_t m3clk;\n>>> +    uint32_t apb0div;\n>>> +    uint32_t apb1div;\n>>> +\n>>> +    MSF2SysregState sysreg;\n>>> +    MSSTimerState timer;\n>>> +    MSSSpiState spi[MSF2_NUM_SPIS];\n>>> +} MSF2State;\n>>> +\n>>> +#endif\n>>>\n>>>\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"rPaJ+MFP\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsbmJ48yVz9s7v\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 19:22:40 +1000 (AEST)","from localhost ([::1]:41154 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1ds3sU-0001Gq-Iw\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 05:22:38 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:44452)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1ds3rv-0001Bl-P8\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 05:22:06 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1ds3rs-0003m9-CI\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 05:22:03 -0400","from mail-vk0-x230.google.com ([2607:f8b0:400c:c05::230]:33964)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1ds3rs-0003lh-4b; Wed, 13 Sep 2017 05:22:00 -0400","by mail-vk0-x230.google.com with SMTP id o22so15451715vke.1;\n\tWed, 13 Sep 2017 02:22:00 -0700 (PDT)","by 10.176.66.68 with HTTP; Wed, 13 Sep 2017 02:21:58 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=EHvZY+5WrNh4a0dfOH4d0NqXKhwTCN/eHmj8IA316qY=;\n\tb=rPaJ+MFPIltbs3zRU9zpawyb1XU+pW6LeZ773DOtTzHZYKwPPZk2O2L7UnSpH20E8z\n\ts5Pt6yIuzv/5WdwFnOde6t9zoykF8kOpVLMVhCd7PhOZrzmf55cn6UwTaPLk80paxLbT\n\twUSnnJpGPOoasEAZ6hgGANRnZOOQB/Az4JPhZiGbo2otORg0Hhafvg7Xb8mdyqnWH1Q1\n\tbjpBYPdlPUR9SbTGNcbZiFJM4jrXXOEh+82ssdqp+wpH1jekeSEoSy1XiDXRiedWNMuX\n\tWl8Ignvxlrk+Y4X5ShAjqo+Ux/FQunY0LHYBT/w2rZqw0khgryZ3lQnMnDpCdVuMEADr\n\t6JLQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=EHvZY+5WrNh4a0dfOH4d0NqXKhwTCN/eHmj8IA316qY=;\n\tb=nMGohmJn+PKWz3bWUpwXm8adMKU7uCj3dKAnpiLyLV4D7q4Y0Fy7z0ib0fmzosV1Gd\n\tgRZlSc9AnwZSZrWoPs1sl+zxvHxPmgdLzc2Plw5RJgIlfsti/svFF3+kuvd1qlTsOISs\n\tk145bqcdqXymJtnkx+g1GxFPy9C/7M7w7f0HLT8aQyTB4oDd5Vhf3uSZW8fOLcY7cUG3\n\tzyhUUkiQ46Y/fNLSIhe7beeBENiZwTc3v3yVZL1Ysyn/MOs3SfdGXg9gGUaFPITqHzKA\n\t9ZD5lA6KCNMLZRwTJG+BpMMsGWOSw7rooOnKgLSc6Z/l5vSgjmjbblFspjmtVAm+DVrD\n\thzfw==","X-Gm-Message-State":"AHPjjUjQyNA6rzH565ettCnmaUTY6hzUCirNYGsraY56wt37whRRnTJl\n\tYtBdAlY6rNbFte0s4iyxH7DsRZegumqYp4R+DBI=","X-Google-Smtp-Source":"AOwi7QCMLpFGMe1X4FCeS7leGM+Paxk62Opv4VEO4aVx1ZMQ6MjvoGQdB+dLH7Mc8HpxLTMTBCKnKoOcldPhY11ntPc=","X-Received":"by 10.31.160.204 with SMTP id\n\tj195mr12711176vke.172.1505294519248; \n\tWed, 13 Sep 2017 02:21:59 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CALHRZurB_6GT+KccybDgWb8bPdU89Ey1si46HnbQgsLuHYCh_w@mail.gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-5-git-send-email-sundeep.lkml@gmail.com>\n\t<26693abe-07a2-1744-1a8d-4d08941837c5@amsat.org>\n\t<CALHRZurB_6GT+KccybDgWb8bPdU89Ey1si46HnbQgsLuHYCh_w@mail.gmail.com>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Wed, 13 Sep 2017 14:51:58 +0530","Message-ID":"<CALHRZurVQzOX+U7OioHGiMKSoZNSOA77zqhyEGgp=H_5fKC7qg@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c05::230","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>,\n\tAlistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768033,"web_url":"http://patchwork.ozlabs.org/comment/1768033/","msgid":"<CALHRZuq_bAYZBE_uo7mTynNhH=hMpBZ=dN4=+XS3ERiv_hHbYw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-13T17:07:24","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Philippe,\n\nOn Wed, Sep 13, 2017 at 2:51 PM, sundeep subbaraya <sundeep.lkml@gmail.com>\nwrote:\n\n> Hi Philippe,\n>\n> All patches got Reviewed-by. Do you want me to change alias to remap and\n> send\n> v9 or wait so that you get time to review?\n>\n> Sorry. My bad, I overlooked your comment. I will just drop alias and send\nv9.\n\nThanks,\nSundeep\n\n\n> Thanks,\n> Sundeep\n>\n> On Fri, Sep 8, 2017 at 12:56 PM, sundeep subbaraya <sundeep.lkml@gmail.com\n> > wrote:\n>\n>> Hi Philippe,\n>>\n>> On Fri, Sep 8, 2017 at 3:08 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\n>> wrote:\n>>\n>>> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>>>\n>>>> Smartfusion2 SoC has hardened Microcontroller subsystem\n>>>> and flash based FPGA fabric. This patch adds support for\n>>>> Microcontroller subsystem in the SoC.\n>>>>\n>>>> Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>>>> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n>>>> ---\n>>>>   default-configs/arm-softmmu.mak |   1 +\n>>>>   hw/arm/Makefile.objs            |   1 +\n>>>>   hw/arm/msf2-soc.c               | 218 ++++++++++++++++++++++++++++++\n>>>> ++++++++++\n>>>>   include/hw/arm/msf2-soc.h       |  66 ++++++++++++\n>>>>   4 files changed, 286 insertions(+)\n>>>>   create mode 100644 hw/arm/msf2-soc.c\n>>>>   create mode 100644 include/hw/arm/msf2-soc.h\n>>>>\n>>>> diff --git a/default-configs/arm-softmmu.mak\n>>>> b/default-configs/arm-softmmu.mak\n>>>> index bbdd3c1..5059d13 100644\n>>>> --- a/default-configs/arm-softmmu.mak\n>>>> +++ b/default-configs/arm-softmmu.mak\n>>>> @@ -129,3 +129,4 @@ CONFIG_ACPI=y\n>>>>   CONFIG_SMBIOS=y\n>>>>   CONFIG_ASPEED_SOC=y\n>>>>   CONFIG_GPIO_KEY=y\n>>>> +CONFIG_MSF2=y\n>>>> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs\n>>>> index a2e56ec..df36a03 100644\n>>>> --- a/hw/arm/Makefile.objs\n>>>> +++ b/hw/arm/Makefile.objs\n>>>> @@ -19,3 +19,4 @@ obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o\n>>>>   obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o\n>>>>   obj-$(CONFIG_ASPEED_SOC) += aspeed_soc.o aspeed.o\n>>>>   obj-$(CONFIG_MPS2) += mps2.o\n>>>> +obj-$(CONFIG_MSF2) += msf2-soc.o\n>>>> diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c\n>>>> new file mode 100644\n>>>> index 0000000..47fffa4\n>>>> --- /dev/null\n>>>> +++ b/hw/arm/msf2-soc.c\n>>>> @@ -0,0 +1,218 @@\n>>>> +/*\n>>>> + * SmartFusion2 SoC emulation.\n>>>> + *\n>>>> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>>>> + *\n>>>> + * Permission is hereby granted, free of charge, to any person\n>>>> obtaining a copy\n>>>> + * of this software and associated documentation files (the\n>>>> \"Software\"), to deal\n>>>> + * in the Software without restriction, including without limitation\n>>>> the rights\n>>>> + * to use, copy, modify, merge, publish, distribute, sublicense,\n>>>> and/or sell\n>>>> + * copies of the Software, and to permit persons to whom the Software\n>>>> is\n>>>> + * furnished to do so, subject to the following conditions:\n>>>> + *\n>>>> + * The above copyright notice and this permission notice shall be\n>>>> included in\n>>>> + * all copies or substantial portions of the Software.\n>>>> + *\n>>>> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n>>>> EXPRESS OR\n>>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n>>>> MERCHANTABILITY,\n>>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n>>>> SHALL\n>>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES\n>>>> OR OTHER\n>>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n>>>> ARISING FROM,\n>>>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n>>>> DEALINGS IN\n>>>> + * THE SOFTWARE.\n>>>> + */\n>>>> +\n>>>> +#include \"qemu/osdep.h\"\n>>>> +#include \"qapi/error.h\"\n>>>> +#include \"qemu-common.h\"\n>>>> +#include \"hw/arm/arm.h\"\n>>>> +#include \"exec/address-spaces.h\"\n>>>> +#include \"hw/char/serial.h\"\n>>>> +#include \"hw/boards.h\"\n>>>> +#include \"sysemu/block-backend.h\"\n>>>> +#include \"qemu/cutils.h\"\n>>>> +#include \"hw/arm/msf2-soc.h\"\n>>>> +\n>>>> +#define MSF2_TIMER_BASE       0x40004000\n>>>> +#define MSF2_SYSREG_BASE      0x40038000\n>>>> +\n>>>> +#define ENVM_BASE_ADDRESS     0x60000000\n>>>> +\n>>>> +#define SRAM_BASE_ADDRESS     0x20000000\n>>>> +\n>>>> +#define MSF2_ENVM_MAX_SIZE        (512 * K_BYTE)\n>>>> +\n>>>> +/*\n>>>> + * eSRAM max size is 80k without SECDED(Single error correction and\n>>>> + * dual error detection) feature and 64k with SECDED.\n>>>> + * We do not support SECDED now.\n>>>> + */\n>>>> +#define MSF2_ESRAM_MAX_SIZE       (80 * K_BYTE)\n>>>> +\n>>>> +static const uint32_t spi_addr[MSF2_NUM_SPIS] = { 0x40001000 ,\n>>>> 0x40011000 };\n>>>> +static const uint32_t uart_addr[MSF2_NUM_UARTS] = { 0x40000000 ,\n>>>> 0x40010000 };\n>>>> +\n>>>> +static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 };\n>>>> +static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 };\n>>>> +static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 };\n>>>> +\n>>>> +static void m2sxxx_soc_initfn(Object *obj)\n>>>> +{\n>>>> +    MSF2State *s = MSF2_SOC(obj);\n>>>> +    int i;\n>>>> +\n>>>> +    object_initialize(&s->armv7m, sizeof(s->armv7m), TYPE_ARMV7M);\n>>>> +    qdev_set_parent_bus(DEVICE(&s->armv7m), sysbus_get_default());\n>>>> +\n>>>> +    object_initialize(&s->sysreg, sizeof(s->sysreg), TYPE_MSF2_SYSREG);\n>>>> +    qdev_set_parent_bus(DEVICE(&s->sysreg), sysbus_get_default());\n>>>> +\n>>>> +    object_initialize(&s->timer, sizeof(s->timer), TYPE_MSS_TIMER);\n>>>> +    qdev_set_parent_bus(DEVICE(&s->timer), sysbus_get_default());\n>>>> +\n>>>> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n>>>> +        object_initialize(&s->spi[i], sizeof(s->spi[i]),\n>>>> +                          TYPE_MSS_SPI);\n>>>> +        qdev_set_parent_bus(DEVICE(&s->spi[i]), sysbus_get_default());\n>>>> +    }\n>>>> +}\n>>>> +\n>>>> +static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)\n>>>> +{\n>>>> +    MSF2State *s = MSF2_SOC(dev_soc);\n>>>> +    DeviceState *dev, *armv7m;\n>>>> +    SysBusDevice *busdev;\n>>>> +    Error *err = NULL;\n>>>> +    int i;\n>>>> +\n>>>> +    MemoryRegion *system_memory = get_system_memory();\n>>>> +    MemoryRegion *nvm = g_new(MemoryRegion, 1);\n>>>> +    MemoryRegion *nvm_alias = g_new(MemoryRegion, 1);\n>>>> +    MemoryRegion *sram = g_new(MemoryRegion, 1);\n>>>> +\n>>>> +    memory_region_init_rom(nvm, NULL, \"MSF2.eNVM\", s->envm_size,\n>>>> +                           &error_fatal);\n>>>> +    /*\n>>>> +     * On power-on, the eNVM region 0x60000000 is automatically\n>>>> +     * remapped to the Cortex-M3 processor executable region\n>>>> +     * start address (0x0). We do not support remapping other eNVM,\n>>>> +     * eSRAM and DDR regions by guest(via Sysreg) currently.\n>>>> +     */\n>>>> +    memory_region_init_alias(nvm_alias, NULL, \"MSF2.eNVM.alias\",\n>>>>\n>>>\n>>> you can drop the \".alias\", this function already prepends \"alias \"\n>>\n>>\n>> .remap sounds good?\n>>\n>> Thanks,\n>> Sundeep\n>>\n>>>\n>>>\n>>> +                             nvm, 0, s->envm_size);\n>>>> +\n>>>> +    memory_region_add_subregion(system_memory, ENVM_BASE_ADDRESS,\n>>>> nvm);\n>>>> +    memory_region_add_subregion(system_memory, 0, nvm_alias);\n>>>> +\n>>>> +    memory_region_init_ram(sram, NULL, \"MSF2.eSRAM\", s->esram_size,\n>>>> +                           &error_fatal);\n>>>> +    memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS,\n>>>> sram);\n>>>> +\n>>>> +    armv7m = DEVICE(&s->armv7m);\n>>>> +    qdev_prop_set_uint32(armv7m, \"num-irq\", 81);\n>>>> +    qdev_prop_set_string(armv7m, \"cpu-model\", \"cortex-m3\");\n>>>> +    object_property_set_link(OBJECT(&s->armv7m),\n>>>> OBJECT(get_system_memory()),\n>>>> +                                     \"memory\", &error_abort);\n>>>> +    object_property_set_bool(OBJECT(&s->armv7m), true, \"realized\",\n>>>> &err);\n>>>> +    if (err != NULL) {\n>>>> +        error_propagate(errp, err);\n>>>> +        return;\n>>>> +    }\n>>>> +\n>>>> +    system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;\n>>>> +\n>>>> +    for (i = 0; i < MSF2_NUM_UARTS; i++) {\n>>>> +        if (serial_hds[i]) {\n>>>> +            serial_mm_init(get_system_memory(), uart_addr[i], 2,\n>>>> +                           qdev_get_gpio_in(armv7m, uart_irq[i]),\n>>>> +                           115200, serial_hds[i],\n>>>> DEVICE_NATIVE_ENDIAN);\n>>>> +        }\n>>>> +    }\n>>>> +\n>>>> +    dev = DEVICE(&s->timer);\n>>>> +    /* APB0 clock is the timer input clock */\n>>>> +    qdev_prop_set_uint32(dev, \"clock-frequency\", s->m3clk /\n>>>> s->apb0div);\n>>>> +    object_property_set_bool(OBJECT(&s->timer), true, \"realized\",\n>>>> &err);\n>>>> +    if (err != NULL) {\n>>>> +        error_propagate(errp, err);\n>>>> +        return;\n>>>> +    }\n>>>> +    busdev = SYS_BUS_DEVICE(dev);\n>>>> +    sysbus_mmio_map(busdev, 0, MSF2_TIMER_BASE);\n>>>> +    sysbus_connect_irq(busdev, 0,\n>>>> +                           qdev_get_gpio_in(armv7m, timer_irq[0]));\n>>>> +    sysbus_connect_irq(busdev, 1,\n>>>> +                           qdev_get_gpio_in(armv7m, timer_irq[1]));\n>>>> +\n>>>> +    dev = DEVICE(&s->sysreg);\n>>>> +    qdev_prop_set_uint32(dev, \"apb0divisor\", s->apb0div);\n>>>> +    qdev_prop_set_uint32(dev, \"apb1divisor\", s->apb1div);\n>>>> +    object_property_set_bool(OBJECT(&s->sysreg), true, \"realized\",\n>>>> &err);\n>>>> +    if (err != NULL) {\n>>>> +        error_propagate(errp, err);\n>>>> +        return;\n>>>> +    }\n>>>> +    busdev = SYS_BUS_DEVICE(dev);\n>>>> +    sysbus_mmio_map(busdev, 0, MSF2_SYSREG_BASE);\n>>>> +\n>>>> +    for (i = 0; i < MSF2_NUM_SPIS; i++) {\n>>>> +        gchar *bus_name;\n>>>> +\n>>>> +        object_property_set_bool(OBJECT(&s->spi[i]), true,\n>>>> \"realized\", &err);\n>>>> +        if (err != NULL) {\n>>>> +            error_propagate(errp, err);\n>>>> +            return;\n>>>> +        }\n>>>> +\n>>>> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]);\n>>>> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,\n>>>> +                           qdev_get_gpio_in(armv7m, spi_irq[i]));\n>>>> +\n>>>> +        /* Alias controller SPI bus to the SoC itself */\n>>>> +        bus_name = g_strdup_printf(\"spi%d\", i);\n>>>> +        object_property_add_alias(OBJECT(s), bus_name,\n>>>> +                                  OBJECT(&s->spi[i]), \"spi\",\n>>>> +                                  &error_abort);\n>>>> +        g_free(bus_name);\n>>>> +    }\n>>>> +}\n>>>> +\n>>>> +static Property m2sxxx_soc_properties[] = {\n>>>> +    /*\n>>>> +     * part name specifies the type of SmartFusion2 device variant(this\n>>>> +     * property is for information purpose only.\n>>>> +     */\n>>>> +    DEFINE_PROP_STRING(\"part-name\", MSF2State, part_name),\n>>>> +    DEFINE_PROP_UINT64(\"eNVM-size\", MSF2State, envm_size,\n>>>> MSF2_ENVM_MAX_SIZE),\n>>>> +    DEFINE_PROP_UINT64(\"eSRAM-size\", MSF2State, esram_size,\n>>>> +                        MSF2_ESRAM_MAX_SIZE),\n>>>> +    /* Libero GUI shows 100Mhz as default for clocks */\n>>>> +    DEFINE_PROP_UINT32(\"m3clk\", MSF2State, m3clk, 100 * 1000000),\n>>>> +    /* default divisors in Libero GUI */\n>>>> +    DEFINE_PROP_UINT32(\"apb0div\", MSF2State, apb0div, 2),\n>>>> +    DEFINE_PROP_UINT32(\"apb1div\", MSF2State, apb1div, 2),\n>>>> +    DEFINE_PROP_END_OF_LIST(),\n>>>> +};\n>>>> +\n>>>> +static void m2sxxx_soc_class_init(ObjectClass *klass, void *data)\n>>>> +{\n>>>> +    DeviceClass *dc = DEVICE_CLASS(klass);\n>>>> +\n>>>> +    dc->realize = m2sxxx_soc_realize;\n>>>> +    dc->props = m2sxxx_soc_properties;\n>>>> +}\n>>>> +\n>>>> +static const TypeInfo m2sxxx_soc_info = {\n>>>> +    .name          = TYPE_MSF2_SOC,\n>>>> +    .parent        = TYPE_SYS_BUS_DEVICE,\n>>>> +    .instance_size = sizeof(MSF2State),\n>>>> +    .instance_init = m2sxxx_soc_initfn,\n>>>> +    .class_init    = m2sxxx_soc_class_init,\n>>>> +};\n>>>> +\n>>>> +static void m2sxxx_soc_types(void)\n>>>> +{\n>>>> +    type_register_static(&m2sxxx_soc_info);\n>>>> +}\n>>>> +\n>>>> +type_init(m2sxxx_soc_types)\n>>>> diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h\n>>>> new file mode 100644\n>>>> index 0000000..eb239fa\n>>>> --- /dev/null\n>>>> +++ b/include/hw/arm/msf2-soc.h\n>>>> @@ -0,0 +1,66 @@\n>>>> +/*\n>>>> + * Microsemi Smartfusion2 SoC\n>>>> + *\n>>>> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>>>> + *\n>>>> + * Permission is hereby granted, free of charge, to any person\n>>>> obtaining a copy\n>>>> + * of this software and associated documentation files (the\n>>>> \"Software\"), to deal\n>>>> + * in the Software without restriction, including without limitation\n>>>> the rights\n>>>> + * to use, copy, modify, merge, publish, distribute, sublicense,\n>>>> and/or sell\n>>>> + * copies of the Software, and to permit persons to whom the Software\n>>>> is\n>>>> + * furnished to do so, subject to the following conditions:\n>>>> + *\n>>>> + * The above copyright notice and this permission notice shall be\n>>>> included in\n>>>> + * all copies or substantial portions of the Software.\n>>>> + *\n>>>> + * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n>>>> EXPRESS OR\n>>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n>>>> MERCHANTABILITY,\n>>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n>>>> SHALL\n>>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES\n>>>> OR OTHER\n>>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n>>>> ARISING FROM,\n>>>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n>>>> DEALINGS IN\n>>>> + * THE SOFTWARE.\n>>>> + */\n>>>> +\n>>>> +#ifndef HW_ARM_MSF2_SOC_H\n>>>> +#define HW_ARM_MSF2_SOC_H\n>>>> +\n>>>> +#include \"hw/arm/armv7m.h\"\n>>>> +#include \"hw/timer/mss-timer.h\"\n>>>> +#include \"hw/misc/msf2-sysreg.h\"\n>>>> +#include \"hw/ssi/mss-spi.h\"\n>>>> +\n>>>> +#define TYPE_MSF2_SOC     \"msf2-soc\"\n>>>> +#define MSF2_SOC(obj)     OBJECT_CHECK(MSF2State, (obj), TYPE_MSF2_SOC)\n>>>> +\n>>>> +#define MSF2_NUM_SPIS         2\n>>>> +#define MSF2_NUM_UARTS        2\n>>>> +\n>>>> +/*\n>>>> + * System timer consists of two programmable 32-bit\n>>>> + * decrementing counters that generate individual interrupts to\n>>>> + * the Cortex-M3 processor\n>>>> + */\n>>>> +#define MSF2_NUM_TIMERS       2\n>>>> +\n>>>> +typedef struct MSF2State {\n>>>> +    /*< private >*/\n>>>> +    SysBusDevice parent_obj;\n>>>> +    /*< public >*/\n>>>> +\n>>>> +    ARMv7MState armv7m;\n>>>> +\n>>>> +    char *part_name;\n>>>> +    uint64_t envm_size;\n>>>> +    uint64_t esram_size;\n>>>> +\n>>>> +    uint32_t m3clk;\n>>>> +    uint32_t apb0div;\n>>>> +    uint32_t apb1div;\n>>>> +\n>>>> +    MSF2SysregState sysreg;\n>>>> +    MSSTimerState timer;\n>>>> +    MSSSpiState spi[MSF2_NUM_SPIS];\n>>>> +} MSF2State;\n>>>> +\n>>>> +#endif\n>>>>\n>>>>\n>>\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"bhRYiI0k\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsp5X244Pz9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 03:08:11 +1000 (AEST)","from localhost ([::1]:43708 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsB8y-0008FW-Pc\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 13:08:08 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57807)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dsB8L-0008Ee-4f\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 13:07:32 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dsB8H-0005AU-I3\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 13:07:29 -0400","from mail-vk0-x22f.google.com ([2607:f8b0:400c:c05::22f]:43887)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dsB8H-00059w-9o; Wed, 13 Sep 2017 13:07:25 -0400","by mail-vk0-x22f.google.com with SMTP id t10so948564vke.0;\n\tWed, 13 Sep 2017 10:07:25 -0700 (PDT)","by 10.176.66.68 with HTTP; Wed, 13 Sep 2017 10:07:24 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=Z70o3UPMiETNhxLT8Tu23sre2BubS6KcoG2MO3Yuj0M=;\n\tb=bhRYiI0kLYOW+nEmY5QsP83qUi2E8kHQcZTs35bns2jzn0BhbzxCrf37+/z+mWqSD3\n\tlVgSr7pppq1xpIaCpAPPGtAKv76B2D6uiMhm1pF577Xq58Kzv251Ni1YPRcG520kkC0t\n\t8ozl7pyyn30fk7Of9HHr+7scoYNApI2H4LqgZrxeWn5/PTYGFNxYIpesnopyAWsTnNYB\n\twQgaOsAYxMbP6YgUa+Prs0XwD1mVhmvhIUE2f86A+5m37zZQNKRp2gUSDXu1TqBTholo\n\tME9jZ1I8KJbE4gbcCrZYfeTJ6h9/P7/QtetTctO7sTJ1dBx6mDvgUNZjA2+F1sfoF9ot\n\tzBpw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=Z70o3UPMiETNhxLT8Tu23sre2BubS6KcoG2MO3Yuj0M=;\n\tb=fYtsiLX9ZpB8/Zk1zVpMmGXeC2/zeMQEqf/lIcF/FDqA/Rg9t61DRG6tYvUshBOgSr\n\tkfJuhUli1l6XVwdURE9XZ22JurcvzQTazpNMtQod7MSNrWxhBJr5eiRsw3aDkMwu2dGL\n\t4BSEZyyB+yk6icGVot+Up5jdfdKHfgOAnXLfUgZ8hIbuGk3YBD1ppOTaq97g2mP9CJ9o\n\t8F75IkAhKXKdy30Vofrybh0XXUS1J8hE8LvgpURFnXaEIeunjYQN0ufv0gmpd67h5+9O\n\ttUDO0AZXu2HKiGoTSyN8UWmPD4LXHflDIjQabXkCFrdTMHSf0fV42voGbejgIEtqo5ti\n\tsucQ==","X-Gm-Message-State":"AHPjjUiXeWUhk3VAWRYWoKn8GPV/oCgOVrWngYh1r+4JUKTZ9BS0YtUR\n\tXVa98uUqHRUfhWhGKSkIgEiIUSKRbgdSmPwyzhk=","X-Google-Smtp-Source":"AOwi7QDM4Uoi3EACXgfcGbg5yLCWxFl2gQ481C1eaZ72aNp2y9KOAuQbC9XpgT15MKROuXehnbyq4ka21jiOr8/RlA0=","X-Received":"by 10.31.203.197 with SMTP id\n\tb188mr13505051vkg.150.1505322444532; \n\tWed, 13 Sep 2017 10:07:24 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CALHRZurVQzOX+U7OioHGiMKSoZNSOA77zqhyEGgp=H_5fKC7qg@mail.gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-5-git-send-email-sundeep.lkml@gmail.com>\n\t<26693abe-07a2-1744-1a8d-4d08941837c5@amsat.org>\n\t<CALHRZurB_6GT+KccybDgWb8bPdU89Ey1si46HnbQgsLuHYCh_w@mail.gmail.com>\n\t<CALHRZurVQzOX+U7OioHGiMKSoZNSOA77zqhyEGgp=H_5fKC7qg@mail.gmail.com>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Wed, 13 Sep 2017 22:37:24 +0530","Message-ID":"<CALHRZuq_bAYZBE_uo7mTynNhH=hMpBZ=dN4=+XS3ERiv_hHbYw@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c05::22f","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>,\n\tAlistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768046,"web_url":"http://patchwork.ozlabs.org/comment/1768046/","msgid":"<f5ac4d0e-dc40-8ca4-c0a2-a7b34752549b@amsat.org>","list_archive_url":null,"date":"2017-09-13T17:24:39","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"Hi Sundeep,\n\nOn 09/13/2017 06:21 AM, sundeep subbaraya wrote:\n> All patches got Reviewed-by. Do you want me to change alias to remap and\n> send\n\nThis is just cosmetic for the \"alias MSF2.eNVM.alias\":\n\n(qemu) info mtree\naddress-space: cpu-memory\n   0000000000000000-ffffffffffffffff (prio 0, i/o): armv7m-container\n     0000000000000000-ffffffffffffffff (prio -1, i/o): system\n       0000000000000000-000000000003ffff (prio 0, i/o): alias \nMSF2.eNVM.alias @MSF2.eNVM 0000000000000000-000000000003ffff\n       0000000020000000-000000002000ffff (prio 0, ram): MSF2.eSRAM\n       0000000060000000-000000006003ffff (prio 0, rom): MSF2.eNVM\n       00000000a0000000-00000000a3ffffff (prio 0, ram): ddr-ram\n\n > v9 or wait so that you get time to review?\n\nI have a draft for your patch 2, I'll send within the day.\n\nRegards,\n\nPhil.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"JuQK/l1n\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xspTD6dLMz9ryT\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 03:25:19 +1000 (AEST)","from localhost ([::1]:43795 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsBPY-00050e-Ei\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 13:25:16 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37266)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsBP7-0004zI-RJ\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 13:24:54 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsBP6-00051T-UZ\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 13:24:49 -0400","from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:48951)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsBP1-0004vN-Hl; Wed, 13 Sep 2017 13:24:43 -0400","by mail-qt0-x235.google.com with SMTP id q8so2170638qtb.5;\n\tWed, 13 Sep 2017 10:24:43 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tu133sm9564540qka.92.2017.09.13.10.24.40\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 13 Sep 2017 10:24:42 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=rS0Qw9tHDIcx8mFobPbwqpsjwvzUNcttJdOzzjBZ0Fg=;\n\tb=JuQK/l1n+5NZvuMcODi7xAS+5fNFtnqiaVO2R0JnY+rRypNWnNTKdeQ2cz41FPulab\n\tmdZ/wqVLpiPHPk/gX3FNBB+8okbTez1D0rjX6cWjh8yx+pF837gdAO4ph50rdFWY3Pzt\n\t0WEAA6iKfepmljDxDhQkamF3qmRhDx6lRsHK/Aq13olhhYheE4Xw9Yqnvzx5gQ2uA27K\n\tbYHC/dwZNwoU0GDBYjmWq51FmKHdpC6zF1u043nvdYYWKGKzAvTiXQ8TM4zcbA63pfs1\n\tuUb81uyacxESru/tBPT82hU+8Em79X6mr4I84AkPvRW58z9S0rqKPMorsvSpnXCUKcYQ\n\t9zIQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=rS0Qw9tHDIcx8mFobPbwqpsjwvzUNcttJdOzzjBZ0Fg=;\n\tb=Aq+LG484lr2ZLFje4l/kG5SusfooUska6gjlQpHmY9JWNwUnLhjAfcQ1zpyG7wWOaq\n\t29+bpGyjtSfUFQHr33urbvZdOvPmRIJCTMo8fqlKY7HPfoEgQoNXcImBlTB1+CDn4JG5\n\tHgeyGtWP3p/67W6jtG1cngsS01X0BQ835OM3kFjNZjbZ9XgRqinsUgtay/cCjZxKmD9O\n\t62AI25X5bQy/FdyFvF5VqMR9sJhAr2cnSImttK/rZ8HnafXxYDL15QkFHOrGc5XZdL/P\n\txKDQC/3qjpV4+H5VQJfVxtCvhlpk6a6d5qRnuzw8ruXm2d3ElxxMrRZj3YmGf9lrqMML\n\tIBJQ==","X-Gm-Message-State":"AHPjjUjGyDu2HBc36iiq11ecHsWR+gu2maeteyuf0QAHEOFTLUYXwAj+\n\tvAR/IXWFXjXavw==","X-Google-Smtp-Source":"AOwi7QCy5w6QHdlmSRQv50wD+bVeE3C9gW2MpUGNbI1lfSEdS4Vl/GURIcR7fYZw2RiKcSBGeTVCqw==","X-Received":"by 10.200.54.3 with SMTP id m3mr25836671qtb.195.1505323483003;\n\tWed, 13 Sep 2017 10:24:43 -0700 (PDT)","To":"sundeep subbaraya <sundeep.lkml@gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-5-git-send-email-sundeep.lkml@gmail.com>\n\t<26693abe-07a2-1744-1a8d-4d08941837c5@amsat.org>\n\t<CALHRZurB_6GT+KccybDgWb8bPdU89Ey1si46HnbQgsLuHYCh_w@mail.gmail.com>\n\t<CALHRZurVQzOX+U7OioHGiMKSoZNSOA77zqhyEGgp=H_5fKC7qg@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<f5ac4d0e-dc40-8ca4-c0a2-a7b34752549b@amsat.org>","Date":"Wed, 13 Sep 2017 14:24:39 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<CALHRZurVQzOX+U7OioHGiMKSoZNSOA77zqhyEGgp=H_5fKC7qg@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c0d::235","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 4/5] msf2: Add Smartfusion2\n\tSoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>,\n\tAlistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768332,"web_url":"http://patchwork.ozlabs.org/comment/1768332/","msgid":"<28d6a84f-3a32-78ea-7a87-055fb14e1641@amsat.org>","list_archive_url":null,"date":"2017-09-14T04:10:16","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"On 09/08/2017 04:24 AM, sundeep subbaraya wrote:\n> Hi Phillipe,\n> \n> On Fri, Sep 8, 2017 at 3:14 AM, Philippe Mathieu-Daudé <f4bug@amsat.org \n> <mailto:f4bug@amsat.org>> wrote:\n> \n>     Hi Subbaraya,\n> \n>     very good work!\n> \n>     On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n> \n>         Hi Qemu-devel,\n> \n>         I am trying to add Smartfusion2 SoC.\n>         SoC is from Microsemi and System on Module(SOM)\n>         board is from Emcraft systems. Smartfusion2 has hardened\n>         Microcontroller(Cortex-M3)based Sub System and FPGA fabric.\n>         At the moment only system timer, sysreg and SPI\n>         controller are modelled.\n> \n>         Testing:\n>         ./arm-softmmu/qemu-system-arm -M smartfusion2-som -serial\n>         mon:stdio \\\n>         -kernel u-boot.bin -display none -drive\n>         file=spi.bin,if=mtd,format=raw\n> \n> \n>     \"-M emcraft-sf2\" ;)\n> \n> \n> copy/paste error :)\n> \n> \n>     U-Boot 2010.03-00147-g7da5092 (Jul 03 2017 - 09:04:50)\n> \n>     CPU  : SmartFusion2 SoC (Cortex-M3 Hard IP)\n>     Freqs: CORTEX-M3=142MHz,PCLK0=71MHz,PCLK1=71MHz\n>     Board: M2S-FG484-SOM Rev 1A, www.emcraft.com <http://www.emcraft.com>\n>     DRAM:  64 MB\n>     *** Warning - bad CRC, using default environment\n> \n>     In:    serial\n>     Out:   serial\n>     Err:   serial\n>     Net:   M2S_MAC\n>     Hit any key to stop autoboot:  0\n>     16384 KiB S25FL128P_64K at 0:0 is now current device\n>     ## Booting kernel from Legacy Image at a0007fc0 ...\n>         Image Name:   dtskernel\n>         Image Type:   ARM Linux Kernel Image (uncompressed)\n>         Data Size:    2664224 Bytes =  2.5 MB\n>         Load Address: a0008000\n>         Entry Point:  a0008001\n>         Verifying Checksum ... OK\n>         Loading Kernel Image ... OK\n>     OK\n> \n>     Starting kernel ...\n> \n>     NVIC: Bad read offset 0xd74\n>     [    0.000000] Booting Linux on physical CPU 0x0\n>     [    0.000000] Linux version 4.5.0-00001-g3aa90e8-dirty\n>     (sundeep@sundeep-Vostro-3458) (gcc version 5.4.0 (GCC) ) #102\n>     PREEMPT Tue May 16 19:43:40 IST 2017\n>     [    0.000000] CPU: ARMv7-M [410fc231] revision 1 (ARMv7M), cr=00000000\n>     [    0.000000] CPU: unknown data cache, unknown instruction cache\n>     [    0.000000] Machine model: Microsemi SmartFusion 2 development board\n>     [    0.000000] Kernel command line: console=ttyS0,115200n8 panic=10\n>     mem=64M@0xa0000000 earlyprintk\n>     [    0.000000] Memory: 62204K/65536K available (1472K kernel code,\n>     73K rwdata, 652K rodata, 400K init, 120K bss, 3332K reserved, 0K\n>     cma-reserved)\n>     [    0.000000] NR_IRQS:16 nr_irqs:16 16\n>     [    0.001178] sched_clock: 32 bits at 83MHz, resolution 12ns, wraps\n>     every 25873297401ns\n>     [    0.003085] clocksource: msf2_clocksource: mask: 0xffffffff\n>     max_cycles: 0xffffffff, max_idle_ns: 23027234290 ns\n>     [    0.009732] timer at 40004000, irq=16\n>     [    0.014475] Calibrating delay loop... 442.36 BogoMIPS (lpj=2211840)\n>     [    0.653685] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled\n>     [    0.690789] console [ttyS0] disabled\n>     [    0.696659] 40000000.serial: ttyS0 at MMIO 0x40000000 (irq = 17,\n>     base_baud = 5187500) is a 16550\n>     [    0.702725] console [ttyS0] enabled\n>     [    0.826251] Freeing unused kernel memory: 400K (a021c000 - a0280000)\n>     init started: BusyBox v1.24.1 (2017-05-15 09:57:00 IST)\n>     ~ #\n> \n>     (qemu) info mtree\n>     address-space: cpu-memory\n>        0000000000000000-ffffffffffffffff (prio 0, i/o): armv7m-container\n>          0000000000000000-ffffffffffffffff (prio -1, i/o): system\n>            0000000000000000-000000000003ffff (prio 0, i/o): alias\n>     MSF2.eNVM.alias @MSF2.eNVM 0000000000000000-000000000003ffff\n>            0000000020000000-000000002000ffff (prio 0, ram): MSF2.eSRAM\n>            0000000040000000-000000004000001f (prio 0, i/o): serial\n>            0000000040001000-000000004000103f (prio 0, i/o): mss-spi\n>            0000000040004000-000000004000402f (prio 0, i/o): mss-timer\n>            0000000040011000-000000004001103f (prio 0, i/o): mss-spi\n>            0000000040038000-00000000400382ff (prio 0, i/o): msf2-sysreg\n>            0000000060000000-000000006003ffff (prio 0, rom): MSF2.eNVM\n>            00000000a0000000-00000000a3ffffff (prio 0, ram): ddr-ram\n>          0000000022000000-0000000023ffffff (prio 0, i/o): bitband\n>          0000000042000000-0000000043ffffff (prio 0, i/o): bitband\n>          00000000e000e000-00000000e000efff (prio 0, i/o): nvic\n>            00000000e000e000-00000000e000efff (prio 0, i/o): nvic_sysregs\n>            00000000e000e010-00000000e000e0ef (prio 1, i/o): systick\n> \n>     (qemu) info qtree\n>     bus: main-system-bus\n>        type System\n>        dev: msf2-soc, id \"\"\n>          part-name = \"M2S010\"\n>          eNVM-size = 262144 (0x40000)\n>          eSRAM-size = 65536 (0x10000)\n>          m3clk = 142000000 (0x876bf80)\n>          apb0div = 2 (0x2)\n>          apb1div = 2 (0x2)\n>        dev: mss-spi, id \"\"\n>          gpio-out \"sysbus-irq\" 2\n>          mmio 0000000040011000/0000000000000040\n>          bus: spi\n>            type SSI\n>        dev: mss-spi, id \"\"\n>          gpio-out \"sysbus-irq\" 2\n>          mmio 0000000040001000/0000000000000040\n>          bus: spi\n>            type SSI\n>            dev: s25sl12801, id \"\"\n>              gpio-in \"ssi-gpio-cs\" 1\n>              nonvolatile-cfg = 36863 (0x8fff)\n>              spansion-cr1nv = 0 (0x0)\n>              spansion-cr2nv = 1 (0x1)\n>              spansion-cr3nv = 2 (0x2)\n>              spansion-cr4nv = 16 (0x10)\n>              drive = \"mtd0\"\n>        dev: mss-timer, id \"\"\n>          gpio-out \"sysbus-irq\" 2\n>          clock-frequency = 71000000 (0x43b5fc0)\n>          mmio 0000000040004000/0000000000000030\n>        dev: msf2-sysreg, id \"\"\n>          apb0divisor = 2 (0x2)\n>          apb1divisor = 2 (0x2)\n>          mmio 0000000040038000/0000000000000300\n> \n>     So far:\n>     Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org\n>     <mailto:f4bug@amsat.org>>\n> \n> \n> Thanks for testing.\n> \n> \n>     Just some comments (no need to fix):\n> \n> \n> Thank you, I will look into these errors once the patchset gets into the \n> tree.\n> \n> \n>     M2S-FG484-SOM> reset\n>     resetting ...\n>     M2S-FG484-SOM>\n> \n>     Hmm no reset, I was expecting some unimp/guest-error warning.\n> \n>     M2S-FG484-SOM> tftpboot\n>     m2s_eth_init: FIFO initialization timeout\n>     *** m2s_mac_dump_regs FIFO init:\n>       DMA TX CTRL=00000000;DESC=00000000;STAT=00000000\n>       DMA RX CTRL=00000000;DESC=00000000;STAT=00000000\n>       DMA IRQ 00000000/00000000\n>       CFG1=00000000;CFG2=00000000;IFG=00000000;HD=00000000;MFL=00000000\n>       IFCTRL=00000000;IFSTAT=00000000;ADR1=00000000;ADR2=00000000\n>       FIFO CFG 00000000/00000000/00000000/00000000/00000000/00000000/\n>       FIFO ACC\n>     00000000/00000000/00000000/00000000/00000000/00000000/00000000/00000000/\n> \n>     (same unimp/guest-error warning)\n> \n> If device is not implemented how do I print warning when guest access \n> that device?\n\nin hw/arm/msf2-soc.c:\n\n     create_unimplemented_device(\"emac\",  0x40041000, 0x1000);\n\nand while here:\n\n     create_unimplemented_device(\"i2c_0\", 0x40002000, 0x1000);\n     create_unimplemented_device(\"i2c_1\", 0x40012000, 0x1000);\n     create_unimplemented_device(\"rtc\",   0x40017000, 0x1000);\n     create_unimplemented_device(\"usb\",   0x40043000, 0x1000);\n\nThen you'll see unimp access running \"qemu-system-arm -d unimp\"\n\nThis can be another patch although.\n\nRegards,\n\nPhil.\n\n> \n> Thanks,\n> Sundeep\n> \n> \n>     M2S-FG484-SOM> sf erase 0 0x1000\n>     UNHANDLED EXCEPTION: HARD FAULT\n>        R0    = 00000072  R1  = 00000072\n>        R2    = 09fa3af0  R3  = 004c8000\n>        R12   = 00000004  LR  = 00000a27\n>        PC    = 0000ec98  PSR = 01000000\n>     [hang]\n>     IN:\n>     0x0000029e:  e7fe       b.n     0x29e\n> \n> \n> \n> \n> \n>         Binaries u-boot.bin and spi.bin are at:\n>         https://github.com/Subbaraya-Sundeep/qemu-test-binaries.git\n>         <https://github.com/Subbaraya-Sundeep/qemu-test-binaries.git>\n> \n>         U-boot is from Emcraft with modified\n>               - SPI driver not to use PDMA.\n>               - ugly hack to pass dtb to kernel in r1.\n>         @\n>         https://github.com/Subbaraya-Sundeep/emcraft-uboot-sf2.git\n>         <https://github.com/Subbaraya-Sundeep/emcraft-uboot-sf2.git>\n> \n>         Linux is 4.5 linux with Smartfusion2 SoC dts and clocksource\n>         driver added by myself @\n>         https://github.com/Subbaraya-Sundeep/linux.git\n>         <https://github.com/Subbaraya-Sundeep/linux.git>\n> \n>         v8:\n>                  memory_region_init_ram to memory_region_init_rom in soc\n>                  %s/emcraft_sf2_init/emcraft_sf2_s2s010_init/g in som\n>                  Added mc->ignore_memory_transaction_failures = true in som\n>                          as per latest commit.\n>                  Code simplifications as suggested by Alistair in sysreg\n>         and ssi.\n> \n>         v7:\n>                  Removed vmstate_register_ram_global as per latest commit\n>                  Moved header files to C which are local to C source files\n>                  Removed abort() from msf2-sysreg.c\n>                  Added VMStateDescription in mss-timer.c\n> \n>         v6:\n>               Moved some defines from header files to source files\n>               Added properties m3clk, apb0div, apb0div1 properties\n>               to soc.\n>               Added properties apb0divisor, apb1divisor to sysreg\n>               Update system_clock_source in msf2-soc.c\n>               Changed machine name smartfusion2-som->emcraft-sf2\n> \n>         v5\n>               As per Philippe comments:\n>                   Added abort in Sysreg if guest tries to remap memory\n>                   other than default mapping.\n>                   Use of CONFIG_MSF2 in Makefile for soc.c\n>                   Fixed incorrect logic in timer model.\n>                   Renamed msf2-timer.c -> mss-timer.c\n>                           msf2-spi.c -> mss-spi.c also type names\n>                   Renamed function msf2_init->emcraft_sf2_init in msf2-som.c\n>                   Added part-name,eNVM-size,eSRAM-size,pclk0 and pclk1\n>                       properties to soc.\n>                   Pass soc part-name,memory size and clock rate\n>         properties from som.\n>         v4:\n>               Fixed build failure by using PRIx macros.\n>         v3:\n>               Added SoC file and board file as per Alistair comments.\n>         v2:\n>               Added SPI controller so that u-boot loads kernel from spi\n>         flash.\n>         v1:\n>               Initial patch set with timer and sysreg\n> \n>         Thanks,\n>         Sundeep\n> \n> \n>         Subbaraya Sundeep (5):\n>             msf2: Add Smartfusion2 System timer\n>             msf2: Microsemi Smartfusion2 System Register block\n>             msf2: Add Smartfusion2 SPI controller\n>             msf2: Add Smartfusion2 SoC\n>             msf2: Add Emcraft's Smartfusion2 SOM kit\n> \n>            default-configs/arm-softmmu.ma <http://arm-softmmu.ma>k |   1 +\n>            hw/arm/Makefile.objs            |   1 +\n>            hw/arm/msf2-soc.c               | 218 ++++++++++++++++++++++\n>            hw/arm/msf2-som.c               |  95 ++++++++++\n>            hw/misc/Makefile.objs           |   1 +\n>            hw/misc/msf2-sysreg.c           | 195 +++++++++++++++++++\n>            hw/ssi/Makefile.objs            |   1 +\n>            hw/ssi/mss-spi.c                | 404\n>         ++++++++++++++++++++++++++++++++++++++++\n>            hw/timer/Makefile.objs          |   1 +\n>            hw/timer/mss-timer.c            | 289\n>         ++++++++++++++++++++++++++++\n>            include/hw/arm/msf2-soc.h       |  66 +++++++\n>            include/hw/misc/msf2-sysreg.h   |  78 ++++++++\n>            include/hw/ssi/mss-spi.h        |  58 ++++++\n>            include/hw/timer/mss-timer.h    |  64 +++++++\n>            14 files changed, 1472 insertions(+)\n>            create mode 100644 hw/arm/msf2-soc.c\n>            create mode 100644 hw/arm/msf2-som.c\n>            create mode 100644 hw/misc/msf2-sysreg.c\n>            create mode 100644 hw/ssi/mss-spi.c\n>            create mode 100644 hw/timer/mss-timer.c\n>            create mode 100644 include/hw/arm/msf2-soc.h\n>            create mode 100644 include/hw/misc/msf2-sysreg.h\n>            create mode 100644 include/hw/ssi/mss-spi.h\n>            create mode 100644 include/hw/timer/mss-timer.h\n> \n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"BKW+GiRz\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xt4pF6Dzvz9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 14:10:59 +1000 (AEST)","from localhost ([::1]:45660 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsLUO-00066Y-Su\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 00:10:56 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:43045)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsLTz-00063e-2V\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 00:10:35 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsLTv-0003pZ-5p\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 00:10:29 -0400","from mail-qt0-x22d.google.com ([2607:f8b0:400d:c0d::22d]:46234)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsLTo-0003kC-I1; Thu, 14 Sep 2017 00:10:20 -0400","by mail-qt0-x22d.google.com with SMTP id s18so4991426qta.3;\n\tWed, 13 Sep 2017 21:10:20 -0700 (PDT)","from [192.168.1.240] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\ti39sm11061268qte.11.2017.09.13.21.10.17\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 13 Sep 2017 21:10:19 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=tz+Rh74cGnHRFQFtZwTutICp1/llxDjXoUWpCgEMnrU=;\n\tb=BKW+GiRzdqjDY9uu8OXg4ibe3Wb3V/JW8xceHpOuq4bJvSwAMKkWT2vpjTb3jnuUli\n\tJBkIxMvSnQdcssOdBtLUL5g7eRFupkmyMn0hghkGlgjH74gNb3PrnwJmVHWZ+eE+SKgn\n\tOiFAXYuQPIRUyhq4yzMJM2A+O9vlLJKXVVvYhvgQDhyDV6DROBqkuxzJnhpcDDv4qbi7\n\tmWmDOxM18aGYjh4oQbDKCcD3gsXvJGEjxhP85d5AdsaORP1B5UkY6sljZUG9/h+L30EM\n\tcoq8fD/DC9tP0qAYhuRrUMVGXBC4gwB4HMfr7PUcW7HuZEkAgIL4Dld/g7UvHqsQNAyL\n\tWjow==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=tz+Rh74cGnHRFQFtZwTutICp1/llxDjXoUWpCgEMnrU=;\n\tb=sK7S8XVDb/P/cl0bTHpay0/nr0V41J7mLyzyJYB3lLhJ75twloGz+Pjhw3dUnvoEm3\n\t8BSjAVAAMcuAeHQyqdvpgD2XIXopTOYedJeYqj6XXND6BtRZNPkNlilXqlqTUVoXfli9\n\tRAJhVmuN4HuhI/cBh2104JZSuV3phVtLK0eufnEfpYZ94l0N7CkrArsL90GqU+Q0LWGQ\n\t5eYX8WnntaPLBk+Q4U2NC66srqnj5W1QNwDLNb0WYVYj1JP56NupRIv/6IZ9TJcMvQLO\n\trx31drwD+ozxOb/Jk0PQCnDToMtSsJnyQJ0+WULLTR5zJmqFURSNw1NFNRqmT5PEsolF\n\tYlDA==","X-Gm-Message-State":"AHPjjUh+zdruHJY1s/F8tbo5GUbkxcypTF9T2UDX9pxTkOVdngGXa+YS\n\tHZZQ848rvZNfzw==","X-Google-Smtp-Source":"AOwi7QCOTlX0Wxz7H36aCGCb8BiuAg3VIo5PqY387b8442SlsDoHW+Fd5noz4ZO3HVscw06a5L+EdA==","X-Received":"by 10.200.43.123 with SMTP id 56mr28027287qtv.15.1505362219834; \n\tWed, 13 Sep 2017 21:10:19 -0700 (PDT)","To":"sundeep subbaraya <sundeep.lkml@gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<2b183ac5-36d8-1da6-cbac-4c6366f23261@amsat.org>\n\t<CALHRZuoJjSkSYaM9xz8xo2R-=oQEx5a1bkhSirc=NmEpxeG2AQ@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<28d6a84f-3a32-78ea-7a87-055fb14e1641@amsat.org>","Date":"Thu, 14 Sep 2017 01:10:16 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<CALHRZuoJjSkSYaM9xz8xo2R-=oQEx5a1bkhSirc=NmEpxeG2AQ@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c0d::22d","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>,\n\tAlistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768338,"web_url":"http://patchwork.ozlabs.org/comment/1768338/","msgid":"<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","list_archive_url":null,"date":"2017-09-14T04:36:31","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"Hi Sundeep,\n\nOn 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n> Added Sytem register block of Smartfusion2.\n> This block has PLL registers which are accessed by guest.\n> \n> Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n> ---\n>   hw/misc/Makefile.objs         |   1 +\n>   hw/misc/msf2-sysreg.c         | 195 ++++++++++++++++++++++++++++++++++++++++++\n>   include/hw/misc/msf2-sysreg.h |  78 +++++++++++++++++\n>   3 files changed, 274 insertions(+)\n>   create mode 100644 hw/misc/msf2-sysreg.c\n>   create mode 100644 include/hw/misc/msf2-sysreg.h\n> \n> diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs\n> index 29fb922..e8f0a02 100644\n> --- a/hw/misc/Makefile.objs\n> +++ b/hw/misc/Makefile.objs\n> @@ -59,3 +59,4 @@ obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o\n>   obj-$(CONFIG_AUX) += auxbus.o\n>   obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o\n>   obj-y += mmio_interface.o\n> +obj-$(CONFIG_MSF2) += msf2-sysreg.o\n> diff --git a/hw/misc/msf2-sysreg.c b/hw/misc/msf2-sysreg.c\n> new file mode 100644\n> index 0000000..40d603d\n> --- /dev/null\n> +++ b/hw/misc/msf2-sysreg.c\n> @@ -0,0 +1,195 @@\n> +/*\n> + * System Register block model of Microsemi SmartFusion2.\n> + *\n> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> + *\n> + * This program is free software; you can redistribute it and/or\n> + * modify it under the terms of the GNU General Public License\n> + * as published by the Free Software Foundation; either version\n> + * 2 of the License, or (at your option) any later version.\n> + *\n> + * You should have received a copy of the GNU General Public License along\n> + * with this program; if not, see <http://www.gnu.org/licenses/>.\n> + */\n> +\n> +#include \"qemu/osdep.h\"\n> +#include \"qemu/log.h\"\n> +#include \"hw/misc/msf2-sysreg.h\"\n> +\n> +#ifndef MSF2_SYSREG_ERR_DEBUG\n> +#define MSF2_SYSREG_ERR_DEBUG  0\n> +#endif\n> +\n> +#define DB_PRINT_L(lvl, fmt, args...) do { \\\n> +    if (MSF2_SYSREG_ERR_DEBUG >= lvl) { \\\n> +        qemu_log(\"%s: \" fmt \"\\n\", __func__, ## args); \\\n> +    } \\\n> +} while (0);\n> +\n> +#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)\n> +\n> +static inline int msf2_divbits(uint32_t div)\n\nPlease directly use ctz32() instead of msf2_divbits()\n\n> +{\n> +    int ret = 0;\n> +\n> +    switch (div) {\n> +    case 1:\n> +        ret = 0;\n> +        break;\n> +    case 2:\n> +        ret = 1;\n> +        break;\n> +    case 4:\n> +        ret = 2;\n> +        break;\n> +    case 8:\n> +        ret = 4;\n> +        break;\n> +    case 16:\n> +        ret = 5;\n> +        break;\n> +    case 32:\n> +        ret = 6;\n> +        break;\n> +    default:\n> +        break;\n> +    }\n> +\n> +    return ret;\n> +}\n> +\n> +static void msf2_sysreg_reset(DeviceState *d)\n> +{\n> +    MSF2SysregState *s = MSF2_SYSREG(d);\n> +\n> +    DB_PRINT(\"RESET\");\n> +\n> +    s->regs[MSSDDR_PLL_STATUS_LOW_CR] = 0x021A2358;\n> +    s->regs[MSSDDR_PLL_STATUS] = 0x3;\n> +    s->regs[MSSDDR_FACC1_CR] = msf2_divbits(s->apb0div) << 5 |\n> +                               msf2_divbits(s->apb1div) << 2;\n> +}\n> +\n> +static uint64_t msf2_sysreg_read(void *opaque, hwaddr offset,\n> +    unsigned size)\n> +{\n> +    MSF2SysregState *s = opaque;\n> +    uint32_t ret = 0;\n> +\n> +    offset >>= 2;\n> +    if (offset < ARRAY_SIZE(s->regs)) {\n\nThis comment is controversial, I'll let Peter nod.\n\nThe SYSREG behaves differently regarding which bus access it (CPU, AHB).\nYou are implementing CPU access to the SYSREG, the registers have \ndifferent permissions when accessed by the CPU. (see the SmartFusion2 \nUser Guide: Table 21-1 \"Register Types\" and Table 21-2 \"Register Map\").\n\nI'd think of this stub:\n\nswitch(reg) {\ncase register_supported1:\ncase register_supported2:\ncase register_supported3:\n            ret = s->regs[offset];\n      \t   trace_msf2_sysreg_read(offset, ret);\n            break;\ncase RO-U:\n            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal AHB access 0x%08\"...\n            break;\ncase W1P:\n            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal read access ...\n            break;\ncase RW:\ncase RW-P:\ncase RO:\ncase RO-P:\ndefault:\n            ret = s->regs[offset];\n            qemu_log_mask(LOG_UNIMP, \"...\n            break;\n}\n\nAnyway keep this comment for further improvements, it's probably not \nuseful for your use case.\n\n> +        ret = s->regs[offset];\n> +        DB_PRINT(\"addr: 0x%08\" HWADDR_PRIx \" data: 0x%08\" PRIx32,\n> +                    offset << 2, ret);\n\nCan you replace DB_PRINT by traces? such:\n\n\t   trace_msf2_sysreg_read(...);\n\n> +    } else {\n> +        qemu_log_mask(LOG_GUEST_ERROR,\n> +                    \"%s: Bad offset 0x%08\" HWADDR_PRIx \"\\n\", __func__,\n> +                    offset << 2);\n> +    }\n> +\n> +    return ret;\n> +}\n> +\n> +static void msf2_sysreg_write(void *opaque, hwaddr offset,\n> +                          uint64_t val, unsigned size)\n> +{\n> +    MSF2SysregState *s = opaque;\n> +    uint32_t newval = val;\n> +\n> +    DB_PRINT(\"addr: 0x%08\" HWADDR_PRIx \" data: 0x%08\" PRIx64,\n> +            offset, val);\n> +\n> +    offset >>= 2;\n> +\n> +    switch (offset) {\n> +    case MSSDDR_PLL_STATUS:\n\t   trace_msf2_sysreg_write_pll_status();\n\n> +        break;\n> +\n> +    case ESRAM_CR:\n> +        if (newval != s->regs[ESRAM_CR]) {\n> +            qemu_log_mask(LOG_GUEST_ERROR,\n\nSince this isn't a guest error, use LOG_UNIMP instead.\n\n> +                       TYPE_MSF2_SYSREG\": eSRAM remapping not supported\\n\");\n> +        }\n> +        break;\n> +\n> +    case DDR_CR:\n> +        if (newval != s->regs[DDR_CR]) {\n> +            qemu_log_mask(LOG_GUEST_ERROR,\n\nLOG_UNIMP\n\n> +                       TYPE_MSF2_SYSREG\": DDR remapping not supported\\n\");\n> +        }\n> +        break;\n> +\n> +    case ENVM_REMAP_BASE_CR:\n> +        if (newval != s->regs[ENVM_REMAP_BASE_CR]) {\n> +            qemu_log_mask(LOG_GUEST_ERROR,\n\nLOG_UNIMP\n\n> +                       TYPE_MSF2_SYSREG\": eNVM remapping not supported\\n\");\n> +        }\n> +        break;\n> +\n\nOr shorter:\n\n     case ESRAM_CR:\n     case DDR_CR:\n     case ENVM_REMAP_BASE_CR:\n          oldval = s->regs[offset];\n          if (oldval ^ newval) {\n              qemu_log_mask(LOG_UNIMP,\n                         TYPE_MSF2_SYSREG\": remapping not supported\\n\");\n          }\n          break;\n\n\n> +    default:\n> +        if (offset < ARRAY_SIZE(s->regs)) {\n\n\t   trace_msf2_sysreg_write(offset, val, s->regs[offset]);\n\n> +            s->regs[offset] = newval;\n> +        } else {\n> +            qemu_log_mask(LOG_GUEST_ERROR,\n> +                        \"%s: Bad offset 0x%08\" HWADDR_PRIx \"\\n\", __func__,\n> +                        offset << 2);\n> +        }\n> +        break;\n> +    }\n> +}\n\nGood work, almost there, next respin should be ready for Peter to take \nin arm-next :)\n\nRegards,\n\nPhil.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jO/dqOnc\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xt5Nh0zbtz9sP1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 14:37:24 +1000 (AEST)","from localhost ([::1]:45723 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsLty-0000gf-77\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 00:37:22 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53418)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsLtL-0000eZ-Ax\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 00:36:44 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsLtJ-0001vF-30\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 00:36:42 -0400","from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:44516)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsLtE-0001qj-3S; Thu, 14 Sep 2017 00:36:36 -0400","by mail-qk0-x22b.google.com with SMTP id b23so5047520qkg.1;\n\tWed, 13 Sep 2017 21:36:35 -0700 (PDT)","from [192.168.1.240] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\te39sm10875229qtb.67.2017.09.13.21.36.32\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 13 Sep 2017 21:36:34 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:subject:to:cc:references:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=qvNL9svjg5AS0ARV4bzfEgBC44WlBGgigdO7g+BEaTc=;\n\tb=jO/dqOncgnkPK0lCQV33Vq2tf83Zqzyq3Uws+govwt+VpKa680xsQZFzXrMR7rPKmW\n\tBz5g/0w7ZmkGcfS+UsriBpQ1UmOmO9bK0XHSo3dXqerkons2rOCVFN2x9Y+Y1q5i/TR2\n\tUK92rs4eDuWQY2MRYCD64G2vG6uu8kG0OMKOOVGJuhDM600Ps1AScJsvlwaIW4bhPBKy\n\tERVhR4wYaO/1TbOqJAbwExFLPkdHuE/vrc1oUnKTqjmBkGDhSiofGyT6yVrJJQwmxxkN\n\tF7cNSnNb5F8iPFPsi/ll2RcCcnJwLQ1kFkOggdG3MLhAaF2kZKL0t+pod73hCGO8PSu8\n\tIaaQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:subject:to:cc:references:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=qvNL9svjg5AS0ARV4bzfEgBC44WlBGgigdO7g+BEaTc=;\n\tb=K6J2SBWo7vyzfFMiUUwpwU29Cb7zMLTo6+43gRwggQDXKswsaa0ZYsOLKkDD6i0rU2\n\tGPuQyUJ2hySZBiaSUamVxsq05LUFRQAvjF0/sxnV8lhmUwC886TL4HfsrWD79z55Adh0\n\t07g5wZvKT7X8WZAf5HHOn2DDd1kzpFV9Gr6YoCqRv0wJnIH7PbfxYO36AhROF8WtGlIR\n\tyQ6jMd63/vehF96pyNjINkGhpixymRnNqOz+8BYfeyvl3d8CeTuhWiY6B4UzmClgEw19\n\tc7T0ktPYWym3dzGP3RH8olpulOy7n3AskYKviXmgg2YvdJjbTJ0o+byFRa1u5NWGFXIQ\n\t2hTA==","X-Gm-Message-State":"AHPjjUgbPEy2SpBAeMXA5cDfOd2D/3X0jRbIFvt0i5sT7yT/zZLYs3Ui\n\t2/CHAIi/v0P5Kr/omBk=","X-Google-Smtp-Source":"AOwi7QBgXdV6v6RRw9y4ZnvRUjAkE9quzHFcu4WixEgrj89Z4fhZhclZGeQteSGTSwgP/2rj6wk7pA==","X-Received":"by 10.55.174.65 with SMTP id x62mr1039453qke.200.1505363795387; \n\tWed, 13 Sep 2017 21:36:35 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","To":"Subbaraya Sundeep <sundeep.lkml@gmail.com>, qemu-devel@nongnu.org,\n\tqemu-arm@nongnu.org, peter.maydell@linaro.org, alistair23@gmail.com","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>","Message-ID":"<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","Date":"Thu, 14 Sep 2017 01:36:31 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c09::22b","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"crosthwaite.peter@gmail.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768580,"web_url":"http://patchwork.ozlabs.org/comment/1768580/","msgid":"<CAFEAcA8KUtG=2Cr_PndUqOxp5PN6bTJR_t=s+Ch+Y2WVfHVjQg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T13:13:13","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On 14 September 2017 at 05:36, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:\n> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>> +static uint64_t msf2_sysreg_read(void *opaque, hwaddr offset,\n>> +    unsigned size)\n>> +{\n>> +    MSF2SysregState *s = opaque;\n>> +    uint32_t ret = 0;\n>> +\n>> +    offset >>= 2;\n>> +    if (offset < ARRAY_SIZE(s->regs)) {\n>\n>\n> This comment is controversial, I'll let Peter nod.\n>\n> The SYSREG behaves differently regarding which bus access it (CPU, AHB).\n> You are implementing CPU access to the SYSREG, the registers have different\n> permissions when accessed by the CPU. (see the SmartFusion2 User Guide:\n> Table 21-1 \"Register Types\" and Table 21-2 \"Register Map\").\n>\n> I'd think of this stub:\n>\n> switch(reg) {\n> case register_supported1:\n> case register_supported2:\n> case register_supported3:\n>            ret = s->regs[offset];\n>            trace_msf2_sysreg_read(offset, ret);\n>            break;\n> case RO-U:\n>            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal AHB access 0x%08\"...\n>            break;\n> case W1P:\n>            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal read access ...\n>            break;\n> case RW:\n> case RW-P:\n> case RO:\n> case RO-P:\n> default:\n>            ret = s->regs[offset];\n>            qemu_log_mask(LOG_UNIMP, \"...\n>            break;\n> }\n\nThis doesn't look entirely right, since this is the read interface.\nShouldn't we be allowing pretty much all of these register types\nexcept maybe W1P to do a read?\n\nOn the other hand, in the write function we should probably not allow\nwrites to registers documented as read only.\n\nthanks\n-- PMM","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"XPGB1cwk\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtJrv24Fyz9sPs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 23:14:07 +1000 (AEST)","from localhost ([::1]:47771 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsTy1-0001Du-9d\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 09:14:05 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:52812)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsTxY-0001B1-Qk\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 09:13:42 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsTxX-0005QV-F9\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 09:13:36 -0400","from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:47490)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)\n\tid 1dsTxX-0005PH-86\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 09:13:35 -0400","by mail-wm0-x229.google.com with SMTP id 13so303409wmq.2\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 06:13:35 -0700 (PDT)","by 10.223.139.215 with HTTP; Thu, 14 Sep 2017 06:13:13 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=61kL2nDQfyCQMPWMOnpyLCSI/jkDrumN6w+0yjxFiSw=;\n\tb=XPGB1cwk5NCbmkH/0ClZIPeVJ47c3lQ087nmwq9S738SMaiiAmJq107h9dRgulv6bh\n\tSdRmoITFXPBymAdUrMlMRFBdWgUFef/E5pKKTcedKzVt51zO7273ULO8JuyOR30WqiTZ\n\tOc+qy3CZXXYTWDa44bOqD1D59iCeSGASZmLh0=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=61kL2nDQfyCQMPWMOnpyLCSI/jkDrumN6w+0yjxFiSw=;\n\tb=sZNMg0IwkT4mUf3OnEs587eRfopxJaDlKvP5DDC4ozcU/Yex3rOTjaPNz6UWTsQX/t\n\tLAeW0bxsRVIWpezwdgtxgOft7czN609DXo8GYlikEq7pvzfOV/e0SDWxcS7SVi99Zw9q\n\tP7p1aWrIciLtqrVNhleugp1Pidu/oHymTNC25EC/HMiUQqJ4+Vf50pj7dsJUAQjEH8MO\n\tH4EQ10DDtfx7UrakDfiuJ0kOP81pOys/011grs7UgcWAnrDHVb9q181qMwIt5/qwrrIn\n\tg1iuAja8YKVXale2nIZPGsrGSkNiTMFmzBigsaWQH99uX/glEKCTL4S40EMrdGDtPdTS\n\t+2Rw==","X-Gm-Message-State":"AHPjjUjfQ0ux/rmCn13GBazwg6nbyO0i1+RDV0F0cQgqiYzvxmvbJZCg\n\tygcmnSKUDVCSnY2x32gcLWmPuxCnLCktLgWyqfmBHA==","X-Google-Smtp-Source":"AOwi7QDHK24MDzR50mocd6/s9qFdNNNi7mHAsyk9Kndv4G2zB0l0di8AaPJx+MxHDOwfc1CtwNPt5+ZMJJ40m5MOyLA=","X-Received":"by 10.28.52.81 with SMTP id b78mr1939886wma.11.1505394814187;\n\tThu, 14 Sep 2017 06:13:34 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>\n\t<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Thu, 14 Sep 2017 14:13:13 +0100","Message-ID":"<CAFEAcA8KUtG=2Cr_PndUqOxp5PN6bTJR_t=s+Ch+Y2WVfHVjQg@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c09::229","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Alistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>,\n\tqemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>, \n\tSubbaraya Sundeep <sundeep.lkml@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768674,"web_url":"http://patchwork.ozlabs.org/comment/1768674/","msgid":"<CALHRZupPj2cJJAr57n+E6Q0xF1qpsewHsDzS03mQmoHfL98j6g@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T15:30:09","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Philippe,\n\nOn Thu, Sep 14, 2017 at 6:43 PM, Peter Maydell <peter.maydell@linaro.org>\nwrote:\n\n> On 14 September 2017 at 05:36, Philippe Mathieu-Daudé <f4bug@amsat.org>\n> wrote:\n> > On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n> >> +static uint64_t msf2_sysreg_read(void *opaque, hwaddr offset,\n> >> +    unsigned size)\n> >> +{\n> >> +    MSF2SysregState *s = opaque;\n> >> +    uint32_t ret = 0;\n> >> +\n> >> +    offset >>= 2;\n> >> +    if (offset < ARRAY_SIZE(s->regs)) {\n> >\n> >\n> > This comment is controversial, I'll let Peter nod.\n> >\n> > The SYSREG behaves differently regarding which bus access it (CPU, AHB).\n> > You are implementing CPU access to the SYSREG, the registers have\n> different\n> > permissions when accessed by the CPU. (see the SmartFusion2 User Guide:\n> > Table 21-1 \"Register Types\" and Table 21-2 \"Register Map\").\n>\n\nCPU is also one of the bus masters in AHB matrix (Fig 6.1 in page 248).\n\n>\n> > I'd think of this stub:\n> >\n> > switch(reg) {\n> > case register_supported1:\n> > case register_supported2:\n> > case register_supported3:\n> >            ret = s->regs[offset];\n> >            trace_msf2_sysreg_read(offset, ret);\n> >            break;\n> > case RO-U:\n> >            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal AHB access 0x%08\"...\n> >            break;\n> > case W1P:\n> >            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal read access ...\n> >            break;\n> > case RW:\n> > case RW-P:\n> > case RO:\n> > case RO-P:\n> > default:\n> >            ret = s->regs[offset];\n> >            qemu_log_mask(LOG_UNIMP, \"...\n> >            break;\n> > }\n>\n\nThis sounds good to me and will fix later by rearranging registers in enum\nsorted\nbased on type (RO, RW, etc.,) and use those ranges in switch case.\n\n>\n> This doesn't look entirely right, since this is the read interface.\n> Shouldn't we be allowing pretty much all of these register types\n> except maybe W1P to do a read?\n>\n\nPeter, some of the registers are not allowed to access by CPU and are only\nset during\ndevice programming. For those registers Philippe is suggesting to log\n\"Illegal AHB access\"\nwhen guest is trying to read/write.\n\nThanks,\nSundeep\n\n\n>\n> On the other hand, in the write function we should probably not allow\n> writes to registers documented as read only.\n>\n> thanks\n> -- PMM\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"U1E9EDqn\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtMtX0p6tz9sP1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 01:30:43 +1000 (AEST)","from localhost ([::1]:48435 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsW6C-0006RP-7Z\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 11:30:40 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:47044)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dsW5m-0006QS-5a\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:30:20 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dsW5k-00070f-W8\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:30:14 -0400","from mail-ua0-x22c.google.com ([2607:f8b0:400c:c08::22c]:53204)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dsW5k-0006zV-QL; Thu, 14 Sep 2017 11:30:12 -0400","by mail-ua0-x22c.google.com with SMTP id n38so392033uai.9;\n\tThu, 14 Sep 2017 08:30:11 -0700 (PDT)","by 10.176.66.68 with HTTP; Thu, 14 Sep 2017 08:30:09 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=uoL0rAVAjnod2aNRTKL5AYA5i2fQCr1Vxv/wSdsQRsc=;\n\tb=U1E9EDqnN8qhEv6SivZAjv6+1ZVqqMb55InsGAdneraHqEChBLAYjdtQvK8381CmKQ\n\tQIDyi/wzP39sBd7yPj+GdXH4ZzLfN18hqHz9ow+hY8SXu3hzajF6tpM4VIozPsTjkLEU\n\tQYX1VQSEkpGC2Xzu9foQcf51pUbd6GdRUzvHzFg+xx5fvHbVcDbEhBSsh7MN4tBTz61o\n\tWRKCNkyH/ay139pOPMruX75h1NrIhRzmFYYKsGpJtBYs57i7Jaiz4DkDC+jdVNqRV08o\n\tNSoWCruVkTS6RMTzI00BzhYjzjPGU6kzSutXilbxipFDxp6NnJAzReP/GLCEYuHVXzu5\n\t6izQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=uoL0rAVAjnod2aNRTKL5AYA5i2fQCr1Vxv/wSdsQRsc=;\n\tb=buubVGnfS7j60NrLDl0IlUl0r1FVxu+HvQYqvzx9cg9M6xcGcBEPmpGZm9r7vUD6qS\n\tOFxlNpxNvDWP1GANVmhjDrpwmHOKVqig0OITyQcTe+AwTl4w2WQXMhIQPrH6zXkFoZWW\n\tJIsKJGdXqUn8n3hEV03EngSDBqh6sqAwmYIs1naCe83W4yeleyeLD1gmLRnHyOP3YQr9\n\thhzlpXAweFIKuC+R85YViFV6kaRlWvkv86i5exbcZ/3X2PyLss6uUNbT76OPkTu4YLZg\n\t4EHn+EFxIEBXVzrOIqUVVduaIuoPhbraP4ojko19EUzJK4UJWShR8oDQNm2ZdfsLQEnd\n\t36iQ==","X-Gm-Message-State":"AHPjjUj0ALOSeSyC8S9aEDboTQIjffzMMx9B1S/0RTPPnWGCkhW3HB75\n\t/de9XpURVJQOq+j4m3hb9aACGq0IU3ZWdjhZw3c=","X-Google-Smtp-Source":"AOwi7QCEEEEUXUkqmC634Bj+DNiOQRHCl1UEgkrGIeOc6pMcmnyhUVMOgNCUtSo/SHo73RmpSSzGb8cTaI+l57qpveI=","X-Received":"by 10.176.76.214 with SMTP id e22mr18632880uag.16.1505403010255; \n\tThu, 14 Sep 2017 08:30:10 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAFEAcA8KUtG=2Cr_PndUqOxp5PN6bTJR_t=s+Ch+Y2WVfHVjQg@mail.gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>\n\t<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>\n\t<CAFEAcA8KUtG=2Cr_PndUqOxp5PN6bTJR_t=s+Ch+Y2WVfHVjQg@mail.gmail.com>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Thu, 14 Sep 2017 21:00:09 +0530","Message-ID":"<CALHRZupPj2cJJAr57n+E6Q0xF1qpsewHsDzS03mQmoHfL98j6g@mail.gmail.com>","To":"Peter Maydell <peter.maydell@linaro.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c08::22c","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Alistair Francis <alistair23@gmail.com>, Peter Crosthwaite\n\t<crosthwaite.peter@gmail.com>, \tqemu-arm <qemu-arm@nongnu.org>,\n\t=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768680,"web_url":"http://patchwork.ozlabs.org/comment/1768680/","msgid":"<CALHRZuqSSc6bj0rpHNAncK302LxA8bk4b1EiSkLyreF20aQorw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T15:34:33","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Philippe,\n\nOn Thu, Sep 14, 2017 at 10:06 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\nwrote:\n\n> Hi Sundeep,\n>\n>\n> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>\n>> Added Sytem register block of Smartfusion2.\n>> This block has PLL registers which are accessed by guest.\n>>\n>> Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>\n>> ---\n>>   hw/misc/Makefile.objs         |   1 +\n>>   hw/misc/msf2-sysreg.c         | 195 ++++++++++++++++++++++++++++++\n>> ++++++++++++\n>>   include/hw/misc/msf2-sysreg.h |  78 +++++++++++++++++\n>>   3 files changed, 274 insertions(+)\n>>   create mode 100644 hw/misc/msf2-sysreg.c\n>>   create mode 100644 include/hw/misc/msf2-sysreg.h\n>>\n>> diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs\n>> index 29fb922..e8f0a02 100644\n>> --- a/hw/misc/Makefile.objs\n>> +++ b/hw/misc/Makefile.objs\n>> @@ -59,3 +59,4 @@ obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o\n>>   obj-$(CONFIG_AUX) += auxbus.o\n>>   obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o\n>>   obj-y += mmio_interface.o\n>> +obj-$(CONFIG_MSF2) += msf2-sysreg.o\n>> diff --git a/hw/misc/msf2-sysreg.c b/hw/misc/msf2-sysreg.c\n>> new file mode 100644\n>> index 0000000..40d603d\n>> --- /dev/null\n>> +++ b/hw/misc/msf2-sysreg.c\n>> @@ -0,0 +1,195 @@\n>> +/*\n>> + * System Register block model of Microsemi SmartFusion2.\n>> + *\n>> + * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n>> + *\n>> + * This program is free software; you can redistribute it and/or\n>> + * modify it under the terms of the GNU General Public License\n>> + * as published by the Free Software Foundation; either version\n>> + * 2 of the License, or (at your option) any later version.\n>> + *\n>> + * You should have received a copy of the GNU General Public License\n>> along\n>> + * with this program; if not, see <http://www.gnu.org/licenses/>.\n>> + */\n>> +\n>> +#include \"qemu/osdep.h\"\n>> +#include \"qemu/log.h\"\n>> +#include \"hw/misc/msf2-sysreg.h\"\n>> +\n>> +#ifndef MSF2_SYSREG_ERR_DEBUG\n>> +#define MSF2_SYSREG_ERR_DEBUG  0\n>> +#endif\n>> +\n>> +#define DB_PRINT_L(lvl, fmt, args...) do { \\\n>> +    if (MSF2_SYSREG_ERR_DEBUG >= lvl) { \\\n>> +        qemu_log(\"%s: \" fmt \"\\n\", __func__, ## args); \\\n>> +    } \\\n>> +} while (0);\n>> +\n>> +#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)\n>> +\n>> +static inline int msf2_divbits(uint32_t div)\n>>\n>\n> Please directly use ctz32() instead of msf2_divbits()\n>\n> ctz32() will not work for input 8,16,32 so need to use msf2_divbits().\n\n>\n> +{\n>> +    int ret = 0;\n>> +\n>> +    switch (div) {\n>> +    case 1:\n>> +        ret = 0;\n>> +        break;\n>> +    case 2:\n>> +        ret = 1;\n>> +        break;\n>> +    case 4:\n>> +        ret = 2;\n>> +        break;\n>> +    case 8:\n>> +        ret = 4;\n>> +        break;\n>> +    case 16:\n>> +        ret = 5;\n>> +        break;\n>> +    case 32:\n>> +        ret = 6;\n>> +        break;\n>> +    default:\n>> +        break;\n>> +    }\n>> +\n>> +    return ret;\n>> +}\n>> +\n>> +static void msf2_sysreg_reset(DeviceState *d)\n>> +{\n>> +    MSF2SysregState *s = MSF2_SYSREG(d);\n>> +\n>> +    DB_PRINT(\"RESET\");\n>> +\n>> +    s->regs[MSSDDR_PLL_STATUS_LOW_CR] = 0x021A2358;\n>> +    s->regs[MSSDDR_PLL_STATUS] = 0x3;\n>> +    s->regs[MSSDDR_FACC1_CR] = msf2_divbits(s->apb0div) << 5 |\n>> +                               msf2_divbits(s->apb1div) << 2;\n>> +}\n>> +\n>> +static uint64_t msf2_sysreg_read(void *opaque, hwaddr offset,\n>> +    unsigned size)\n>> +{\n>> +    MSF2SysregState *s = opaque;\n>> +    uint32_t ret = 0;\n>> +\n>> +    offset >>= 2;\n>> +    if (offset < ARRAY_SIZE(s->regs)) {\n>>\n>\n> This comment is controversial, I'll let Peter nod.\n>\n> The SYSREG behaves differently regarding which bus access it (CPU, AHB).\n> You are implementing CPU access to the SYSREG, the registers have\n> different permissions when accessed by the CPU. (see the SmartFusion2 User\n> Guide: Table 21-1 \"Register Types\" and Table 21-2 \"Register Map\").\n>\n> I'd think of this stub:\n>\n> switch(reg) {\n> case register_supported1:\n> case register_supported2:\n> case register_supported3:\n>            ret = s->regs[offset];\n>            trace_msf2_sysreg_read(offset, ret);\n>            break;\n> case RO-U:\n>            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal AHB access 0x%08\"...\n>            break;\n> case W1P:\n>            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal read access ...\n>            break;\n> case RW:\n> case RW-P:\n> case RO:\n> case RO-P:\n> default:\n>            ret = s->regs[offset];\n>            qemu_log_mask(LOG_UNIMP, \"...\n>            break;\n> }\n>\n> Anyway keep this comment for further improvements, it's probably not\n> useful for your use case.\n\n\nSure will remember this comment and fix it later.\n\n>\n>\n> +        ret = s->regs[offset];\n>> +        DB_PRINT(\"addr: 0x%08\" HWADDR_PRIx \" data: 0x%08\" PRIx32,\n>> +                    offset << 2, ret);\n>>\n>\n> Can you replace DB_PRINT by traces? such:\n>\n>            trace_msf2_sysreg_read(...);\n\n\nOk\n\n>\n>\n> +    } else {\n>> +        qemu_log_mask(LOG_GUEST_ERROR,\n>> +                    \"%s: Bad offset 0x%08\" HWADDR_PRIx \"\\n\", __func__,\n>> +                    offset << 2);\n>> +    }\n>> +\n>> +    return ret;\n>> +}\n>> +\n>> +static void msf2_sysreg_write(void *opaque, hwaddr offset,\n>> +                          uint64_t val, unsigned size)\n>> +{\n>> +    MSF2SysregState *s = opaque;\n>> +    uint32_t newval = val;\n>> +\n>> +    DB_PRINT(\"addr: 0x%08\" HWADDR_PRIx \" data: 0x%08\" PRIx64,\n>> +            offset, val);\n>> +\n>> +    offset >>= 2;\n>> +\n>> +    switch (offset) {\n>> +    case MSSDDR_PLL_STATUS:\n>>\n>            trace_msf2_sysreg_write_pll_status();\n>\n> +        break;\n>> +\n>> +    case ESRAM_CR:\n>> +        if (newval != s->regs[ESRAM_CR]) {\n>> +            qemu_log_mask(LOG_GUEST_ERROR,\n>>\n>\n> Since this isn't a guest error, use LOG_UNIMP instead.\n>\n> Ok\n\n> +                       TYPE_MSF2_SYSREG\": eSRAM remapping not\n>> supported\\n\");\n>> +        }\n>> +        break;\n>> +\n>> +    case DDR_CR:\n>> +        if (newval != s->regs[DDR_CR]) {\n>> +            qemu_log_mask(LOG_GUEST_ERROR,\n>>\n>\n> LOG_UNIMP\n>\n> Ok\n\n> +                       TYPE_MSF2_SYSREG\": DDR remapping not supported\\n\");\n>> +        }\n>> +        break;\n>> +\n>> +    case ENVM_REMAP_BASE_CR:\n>> +        if (newval != s->regs[ENVM_REMAP_BASE_CR]) {\n>> +            qemu_log_mask(LOG_GUEST_ERROR,\n>>\n>\n> LOG_UNIMP\n>\n> Ok\n\n> +                       TYPE_MSF2_SYSREG\": eNVM remapping not\n>> supported\\n\");\n>> +        }\n>> +        break;\n>> +\n>>\n>\n> Or shorter:\n>\n>     case ESRAM_CR:\n>     case DDR_CR:\n>     case ENVM_REMAP_BASE_CR:\n>          oldval = s->regs[offset];\n>          if (oldval ^ newval) {\n>              qemu_log_mask(LOG_UNIMP,\n>                         TYPE_MSF2_SYSREG\": remapping not supported\\n\");\n>          }\n>          break;\n>\n> Ok\n\n>\n> +    default:\n>> +        if (offset < ARRAY_SIZE(s->regs)) {\n>>\n>\n>            trace_msf2_sysreg_write(offset, val, s->regs[offset]);\n>\n> +            s->regs[offset] = newval;\n>> +        } else {\n>> +            qemu_log_mask(LOG_GUEST_ERROR,\n>> +                        \"%s: Bad offset 0x%08\" HWADDR_PRIx \"\\n\",\n>> __func__,\n>> +                        offset << 2);\n>> +        }\n>> +        break;\n>> +    }\n>> +}\n>>\n>\n> Good work, almost there, next respin should be ready for Peter to take in\n> arm-next :)\n>\n> Thank you,\nSundeep\n\n\n> Regards,\n>\n> Phil.\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"mCJI6Sbp\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtN016740z9sPt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 01:35:29 +1000 (AEST)","from localhost ([::1]:48457 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsWAp-0000qr-Sj\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 11:35:27 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:49764)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dsWA1-0000lD-Aj\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:34:39 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dsW9z-00027S-1u\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:34:37 -0400","from mail-vk0-x232.google.com ([2607:f8b0:400c:c05::232]:51333)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dsW9y-00026l-S4; Thu, 14 Sep 2017 11:34:35 -0400","by mail-vk0-x232.google.com with SMTP id g68so338189vki.8;\n\tThu, 14 Sep 2017 08:34:34 -0700 (PDT)","by 10.176.66.68 with HTTP; Thu, 14 Sep 2017 08:34:33 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=NtIZs0OQRDbRAbjJpgSOo3i5DA9fA/xgtuP5B0+UdJk=;\n\tb=mCJI6Sbp6dM1BWQj8Oz8Yaae99omHU9e5hnocdzNZoZ8LJhF8RSnUMwgIj/uTBaNqX\n\tPrt7twWSIySRn+lV1PJGXVOl6kuUaH4V5/LLbF3pk02YesB1YNz80wv9/1xP2NeMV2Cj\n\tmLC78ol1ajNDaYg4OfoRhNfKsHVlOeLSnTuFpOEP7friLDS5jAZc71sD7UTB1K2kx+5u\n\try39wAOJcBbTvfSmmHNh/4iuXD2sOOzyEJcZRixP9ewR0Opm0Lt80ONtdw5FyfuYUeRq\n\taS0qef6ewQCo0AwVACWhG3skD6Pobwp2zlMUFMYfLgDElR5pzdPN5HZAqojRTguPctX1\n\tFmgA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=NtIZs0OQRDbRAbjJpgSOo3i5DA9fA/xgtuP5B0+UdJk=;\n\tb=TS1bNnSu434uUGL8VBagJ5Ci++gT+Cy8C3f38HQk7H9eIAS4gqZZprMn1FLfMt7Sj6\n\tR8bU9mI6teUozhZO0Zf4Ebe1V5Zni2i6H4sxmqPS65cW8kEmhJfrpwt7gFNgr9FlcFps\n\t781SpxrCeGm6dvUDcSc8As+p2Be8LK5K2iCR20RVH5TJRyIiaxmydBhpohnFze68Laf6\n\tq1VkANnUsxARvcAFVVSevHHrafmCbZqi/pfLgjdMmTVsXmgVvNe8216+s+4yzogrt9ud\n\tcnuveRoibh3r1NyzkzxKRrQ1wiSfvU3VXbI7vVu25spkkn32zBOZb4uVz8OZqGGn+st3\n\taj9w==","X-Gm-Message-State":"AHPjjUigw6H8EFpUkUlrGxIAc+pcVrFyvoJbJ1NzdbCHBp8Kxho9r9BE\n\tv9Qwg3hPVRdfjEIgbZA27U0yHzFB3HB7MI/kFK4=","X-Google-Smtp-Source":"AOwi7QASeQ47Y0p5BXvSz51FbfcmgfounL5QZMabgWSxLcThsiqqIky8W3i6+36qPj9g/Bg5Bvng0+D71vvM63IhCkA=","X-Received":"by 10.31.185.209 with SMTP id\n\tj200mr16570820vkf.198.1505403274182; \n\tThu, 14 Sep 2017 08:34:34 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>\n\t<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Thu, 14 Sep 2017 21:04:33 +0530","Message-ID":"<CALHRZuqSSc6bj0rpHNAncK302LxA8bk4b1EiSkLyreF20aQorw@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c05::232","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>,\n\tqemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>, \n\tAlistair Francis <alistair23@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768743,"web_url":"http://patchwork.ozlabs.org/comment/1768743/","msgid":"<CAKmqyKONrzpGxwvirPcb+-XZk=9WhwWKcSD_=BicmTQ2ZLQFEA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T17:06:43","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","submitter":{"id":64571,"url":"http://patchwork.ozlabs.org/api/people/64571/","name":"Alistair Francis","email":"alistair23@gmail.com"},"content":"On Wed, Sep 13, 2017 at 9:10 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:\n> On 09/08/2017 04:24 AM, sundeep subbaraya wrote:\n>>\n>> Hi Phillipe,\n>>\n>> On Fri, Sep 8, 2017 at 3:14 AM, Philippe Mathieu-Daudé <f4bug@amsat.org\n>> <mailto:f4bug@amsat.org>> wrote:\n>>\n>>     Hi Subbaraya,\n>>\n>>     very good work!\n>>\n>>     On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>>\n>>         Hi Qemu-devel,\n>>\n>>         I am trying to add Smartfusion2 SoC.\n>>         SoC is from Microsemi and System on Module(SOM)\n>>         board is from Emcraft systems. Smartfusion2 has hardened\n>>         Microcontroller(Cortex-M3)based Sub System and FPGA fabric.\n>>         At the moment only system timer, sysreg and SPI\n>>         controller are modelled.\n>>\n>>         Testing:\n>>         ./arm-softmmu/qemu-system-arm -M smartfusion2-som -serial\n>>         mon:stdio \\\n>>         -kernel u-boot.bin -display none -drive\n>>         file=spi.bin,if=mtd,format=raw\n>>\n>>\n>>     \"-M emcraft-sf2\" ;)\n>>\n>>\n>> copy/paste error :)\n>>\n>>\n>>     U-Boot 2010.03-00147-g7da5092 (Jul 03 2017 - 09:04:50)\n>>\n>>     CPU  : SmartFusion2 SoC (Cortex-M3 Hard IP)\n>>     Freqs: CORTEX-M3=142MHz,PCLK0=71MHz,PCLK1=71MHz\n>>     Board: M2S-FG484-SOM Rev 1A, www.emcraft.com <http://www.emcraft.com>\n>>\n>>     DRAM:  64 MB\n>>     *** Warning - bad CRC, using default environment\n>>\n>>     In:    serial\n>>     Out:   serial\n>>     Err:   serial\n>>     Net:   M2S_MAC\n>>     Hit any key to stop autoboot:  0\n>>     16384 KiB S25FL128P_64K at 0:0 is now current device\n>>     ## Booting kernel from Legacy Image at a0007fc0 ...\n>>         Image Name:   dtskernel\n>>         Image Type:   ARM Linux Kernel Image (uncompressed)\n>>         Data Size:    2664224 Bytes =  2.5 MB\n>>         Load Address: a0008000\n>>         Entry Point:  a0008001\n>>         Verifying Checksum ... OK\n>>         Loading Kernel Image ... OK\n>>     OK\n>>\n>>     Starting kernel ...\n>>\n>>     NVIC: Bad read offset 0xd74\n>>     [    0.000000] Booting Linux on physical CPU 0x0\n>>     [    0.000000] Linux version 4.5.0-00001-g3aa90e8-dirty\n>>     (sundeep@sundeep-Vostro-3458) (gcc version 5.4.0 (GCC) ) #102\n>>     PREEMPT Tue May 16 19:43:40 IST 2017\n>>     [    0.000000] CPU: ARMv7-M [410fc231] revision 1 (ARMv7M),\n>> cr=00000000\n>>     [    0.000000] CPU: unknown data cache, unknown instruction cache\n>>     [    0.000000] Machine model: Microsemi SmartFusion 2 development\n>> board\n>>     [    0.000000] Kernel command line: console=ttyS0,115200n8 panic=10\n>>     mem=64M@0xa0000000 earlyprintk\n>>     [    0.000000] Memory: 62204K/65536K available (1472K kernel code,\n>>     73K rwdata, 652K rodata, 400K init, 120K bss, 3332K reserved, 0K\n>>     cma-reserved)\n>>     [    0.000000] NR_IRQS:16 nr_irqs:16 16\n>>     [    0.001178] sched_clock: 32 bits at 83MHz, resolution 12ns, wraps\n>>     every 25873297401ns\n>>     [    0.003085] clocksource: msf2_clocksource: mask: 0xffffffff\n>>     max_cycles: 0xffffffff, max_idle_ns: 23027234290 ns\n>>     [    0.009732] timer at 40004000, irq=16\n>>     [    0.014475] Calibrating delay loop... 442.36 BogoMIPS (lpj=2211840)\n>>     [    0.653685] Serial: 8250/16550 driver, 1 ports, IRQ sharing\n>> disabled\n>>     [    0.690789] console [ttyS0] disabled\n>>     [    0.696659] 40000000.serial: ttyS0 at MMIO 0x40000000 (irq = 17,\n>>     base_baud = 5187500) is a 16550\n>>     [    0.702725] console [ttyS0] enabled\n>>     [    0.826251] Freeing unused kernel memory: 400K (a021c000 -\n>> a0280000)\n>>     init started: BusyBox v1.24.1 (2017-05-15 09:57:00 IST)\n>>     ~ #\n>>\n>>     (qemu) info mtree\n>>     address-space: cpu-memory\n>>        0000000000000000-ffffffffffffffff (prio 0, i/o): armv7m-container\n>>          0000000000000000-ffffffffffffffff (prio -1, i/o): system\n>>            0000000000000000-000000000003ffff (prio 0, i/o): alias\n>>     MSF2.eNVM.alias @MSF2.eNVM 0000000000000000-000000000003ffff\n>>            0000000020000000-000000002000ffff (prio 0, ram): MSF2.eSRAM\n>>            0000000040000000-000000004000001f (prio 0, i/o): serial\n>>            0000000040001000-000000004000103f (prio 0, i/o): mss-spi\n>>            0000000040004000-000000004000402f (prio 0, i/o): mss-timer\n>>            0000000040011000-000000004001103f (prio 0, i/o): mss-spi\n>>            0000000040038000-00000000400382ff (prio 0, i/o): msf2-sysreg\n>>            0000000060000000-000000006003ffff (prio 0, rom): MSF2.eNVM\n>>            00000000a0000000-00000000a3ffffff (prio 0, ram): ddr-ram\n>>          0000000022000000-0000000023ffffff (prio 0, i/o): bitband\n>>          0000000042000000-0000000043ffffff (prio 0, i/o): bitband\n>>          00000000e000e000-00000000e000efff (prio 0, i/o): nvic\n>>            00000000e000e000-00000000e000efff (prio 0, i/o): nvic_sysregs\n>>            00000000e000e010-00000000e000e0ef (prio 1, i/o): systick\n>>\n>>     (qemu) info qtree\n>>     bus: main-system-bus\n>>        type System\n>>        dev: msf2-soc, id \"\"\n>>          part-name = \"M2S010\"\n>>          eNVM-size = 262144 (0x40000)\n>>          eSRAM-size = 65536 (0x10000)\n>>          m3clk = 142000000 (0x876bf80)\n>>          apb0div = 2 (0x2)\n>>          apb1div = 2 (0x2)\n>>        dev: mss-spi, id \"\"\n>>          gpio-out \"sysbus-irq\" 2\n>>          mmio 0000000040011000/0000000000000040\n>>          bus: spi\n>>            type SSI\n>>        dev: mss-spi, id \"\"\n>>          gpio-out \"sysbus-irq\" 2\n>>          mmio 0000000040001000/0000000000000040\n>>          bus: spi\n>>            type SSI\n>>            dev: s25sl12801, id \"\"\n>>              gpio-in \"ssi-gpio-cs\" 1\n>>              nonvolatile-cfg = 36863 (0x8fff)\n>>              spansion-cr1nv = 0 (0x0)\n>>              spansion-cr2nv = 1 (0x1)\n>>              spansion-cr3nv = 2 (0x2)\n>>              spansion-cr4nv = 16 (0x10)\n>>              drive = \"mtd0\"\n>>        dev: mss-timer, id \"\"\n>>          gpio-out \"sysbus-irq\" 2\n>>          clock-frequency = 71000000 (0x43b5fc0)\n>>          mmio 0000000040004000/0000000000000030\n>>        dev: msf2-sysreg, id \"\"\n>>          apb0divisor = 2 (0x2)\n>>          apb1divisor = 2 (0x2)\n>>          mmio 0000000040038000/0000000000000300\n>>\n>>     So far:\n>>     Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org\n>>     <mailto:f4bug@amsat.org>>\n>>\n>>\n>> Thanks for testing.\n>>\n>>\n>>     Just some comments (no need to fix):\n>>\n>>\n>> Thank you, I will look into these errors once the patchset gets into the\n>> tree.\n>>\n>>\n>>     M2S-FG484-SOM> reset\n>>     resetting ...\n>>     M2S-FG484-SOM>\n>>\n>>     Hmm no reset, I was expecting some unimp/guest-error warning.\n>>\n>>     M2S-FG484-SOM> tftpboot\n>>     m2s_eth_init: FIFO initialization timeout\n>>     *** m2s_mac_dump_regs FIFO init:\n>>       DMA TX CTRL=00000000;DESC=00000000;STAT=00000000\n>>       DMA RX CTRL=00000000;DESC=00000000;STAT=00000000\n>>       DMA IRQ 00000000/00000000\n>>       CFG1=00000000;CFG2=00000000;IFG=00000000;HD=00000000;MFL=00000000\n>>       IFCTRL=00000000;IFSTAT=00000000;ADR1=00000000;ADR2=00000000\n>>       FIFO CFG 00000000/00000000/00000000/00000000/00000000/00000000/\n>>       FIFO ACC\n>>\n>> 00000000/00000000/00000000/00000000/00000000/00000000/00000000/00000000/\n>>\n>>     (same unimp/guest-error warning)\n>>\n>> If device is not implemented how do I print warning when guest access that\n>> device?\n>\n>\n> in hw/arm/msf2-soc.c:\n>\n>     create_unimplemented_device(\"emac\",  0x40041000, 0x1000);\n>\n> and while here:\n>\n>     create_unimplemented_device(\"i2c_0\", 0x40002000, 0x1000);\n>     create_unimplemented_device(\"i2c_1\", 0x40012000, 0x1000);\n>     create_unimplemented_device(\"rtc\",   0x40017000, 0x1000);\n>     create_unimplemented_device(\"usb\",   0x40043000, 0x1000);\n>\n> Then you'll see unimp access running \"qemu-system-arm -d unimp\"\n>\n> This can be another patch although.\n\nOnce you have all the devices there you can enable bus access errors\nas well. That's a future patch set though.\n\nThanks,\nAlistair\n\n>\n> Regards,\n>\n> Phil.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"H3XLgK9r\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtQ2h676yz9s7f\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 03:07:55 +1000 (AEST)","from localhost ([::1]:49031 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsXcH-0000t8-Ew\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 13:07:53 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:48056)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <alistair23@gmail.com>) id 1dsXbi-0000ql-1x\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:07:19 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <alistair23@gmail.com>) id 1dsXbg-0005Gi-AM\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:07:18 -0400","from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:56597)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <alistair23@gmail.com>)\n\tid 1dsXbg-0005EM-0u; Thu, 14 Sep 2017 13:07:16 -0400","by mail-wr0-x235.google.com with SMTP id r74so861345wrb.13;\n\tThu, 14 Sep 2017 10:07:14 -0700 (PDT)","by 10.28.191.130 with HTTP; Thu, 14 Sep 2017 10:06:43 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=qKisanqug/v2ZEnExBQGzWGjSwElMXzJ+H4BFb51M/8=;\n\tb=H3XLgK9r3Ms4VHIPh7nyEh+aqqySa0qMLQTDwyVkR1H8MggGU7aaiLdhcqUsQc+4hU\n\tP50G0EkfSfYlRlt4ReoFA+d8HEvYEZ1pf4+BdBXaW+Tm6QOiioWijkVbeDRz7ec13rMH\n\t8bGzL2Lo4DJWxflE5RCZAWlQNY3ZNwDTqtxYdoHrMrSUVADAZIj6DQNsjSHR9V6jYCFE\n\tjoGqPkOijLabGt3vLDNV76Z/uE4mxzd5O7CIC3zYm5XI23ybcJFPmD7jBp5K6S06FNG/\n\t7kD7VoSJ5EPy+GRCvWsBSoSfl9oAQeC3jm9SZGiEl5KUGfTN0IhEy/lk7BHW1+SL+8FB\n\tYhiA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=qKisanqug/v2ZEnExBQGzWGjSwElMXzJ+H4BFb51M/8=;\n\tb=XhWTNN3VMptjwy1l+gjN4yuQPWu0TwmFro47/LcWramL8da04JRlMS27WG+Z8olEvO\n\trNt9207EMZfSRawiJd2CRXScQPUl+e9Edik8DN25VDUoUeLLeeVV0DXgVm7pZ4QFcdhC\n\tNJAiWtgZrqvZ5mVIPnQ6sFSWmiWFrDavrFEyy/cFXLjQPwdc8905twkSVNyKPSsANBt8\n\tF4ndgbKZM6G62yRvxuvCc7oyHhl6rJCauj17WaJKPs5mBeHq7s2eDNbMVXuG8/joYYhj\n\tYMl9MU9NJ/aYMvVZH+7b/R0WA5YMbD76LlYgLEVRAbBp8+zhneHVCE5W+D17hUrI9tvV\n\t+RXQ==","X-Gm-Message-State":"AHPjjUg3FNHBwMsFsI1Kt4rnURS2iEcroin1lKMwW2ACYpi8BKGDlS5N\n\t2Pxd95k29ZKO1RkjYNBULX7VgIIw/htHlJmdl6I=","X-Google-Smtp-Source":"ADKCNb7F2KdHNa7A/zy8hMa2U1PbXmaH/qJ3OCJi8DM0gQaEYvnSb7BCwJlI48m6HYfpXitZg4oTSS9BIVv3bzbmYlU=","X-Received":"by 10.223.169.143 with SMTP id\n\tb15mr15837403wrd.127.1505408833610; \n\tThu, 14 Sep 2017 10:07:13 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<28d6a84f-3a32-78ea-7a87-055fb14e1641@amsat.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<2b183ac5-36d8-1da6-cbac-4c6366f23261@amsat.org>\n\t<CALHRZuoJjSkSYaM9xz8xo2R-=oQEx5a1bkhSirc=NmEpxeG2AQ@mail.gmail.com>\n\t<28d6a84f-3a32-78ea-7a87-055fb14e1641@amsat.org>","From":"Alistair Francis <alistair23@gmail.com>","Date":"Thu, 14 Sep 2017 10:06:43 -0700","Message-ID":"<CAKmqyKONrzpGxwvirPcb+-XZk=9WhwWKcSD_=BicmTQ2ZLQFEA@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c0c::235","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>,\n\tqemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>, \n\tsundeep subbaraya <sundeep.lkml@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768744,"web_url":"http://patchwork.ozlabs.org/comment/1768744/","msgid":"<CAFEAcA_D=4M2vyo4m2xPi_hFDCmoKHk5kLY3s1ota602ywgHTQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T17:14:54","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 5/5] msf2: Add Emcraft's\n\tSmartfusion2 SOM kit","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On 7 September 2017 at 20:24, Subbaraya Sundeep <sundeep.lkml@gmail.com> wrote:\n> Emulated Emcraft's Smartfusion2 System On Module starter\n> kit.\n> +static void emcraft_sf2_machine_init(MachineClass *mc)\n> +{\n> +    mc->desc = \"SmartFusion2 SOM kit from Emcraft (M2S010)\";\n> +    mc->init = emcraft_sf2_s2s010_init;\n> +    mc->ignore_memory_transaction_failures = true;\n\nPlease don't set ignore_memory_transaction_failures in new boards.\nThis is a legacy-old-code-only flag.\n\nNew boards should define enough devices, either properly\nor using create_unimplemented_device(), to make whatever code\nthey're being tested against run.\n\nThis is a firm requirement for this code to go into master,\nbecause once we let a board in with the flag set it's almost\nimpossible to clear it because we don't know what guest\ncode that previously worked on the board will now break.\n\nthanks\n-- PMM","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"HUpdaLES\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtQCm1M54z9sRg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 03:15:47 +1000 (AEST)","from localhost ([::1]:49065 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsXjs-0007PQ-Qj\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 13:15:44 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:52788)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsXjQ-0007LO-SA\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:15:22 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsXjQ-0007sa-0T\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:15:16 -0400","from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:51941)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)\n\tid 1dsXjP-0007re-Ob\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:15:15 -0400","by mail-wr0-x22b.google.com with SMTP id z39so874534wrb.8\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 10:15:15 -0700 (PDT)","by 10.223.139.215 with HTTP; Thu, 14 Sep 2017 10:14:54 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=E4RL7bxWmZLacx8RtxssyG8Qu5ATu6Dp6UYNutGi5eM=;\n\tb=HUpdaLESsP9zWqlgQbcgVeT176JabDD8f/amChfj3NgQgVOwhhIHFIO/pjuXFOkcoi\n\toaOoRSGaMux1sLhCxi1I1vXk0OXBoLoc7Nd+R5sxAG7Trozpsr2en1ss6qV9DJgOLDro\n\tnPHH2h6jiGNBz80aKbf62qRvgxi64gqrXZ09A=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=E4RL7bxWmZLacx8RtxssyG8Qu5ATu6Dp6UYNutGi5eM=;\n\tb=RxJPSCVEvgups9X1jTtM2JRVt3z8ljlCCCuo1UugMcXNvma8LIMqYqC1COMP175e9f\n\tXiHF7EcFkLntUgAcCU6r8Ipu4WdzNV1S1ukVq6QRkWQSGtKk9ERdJJOId77AWcR/xJHF\n\tn5+WhnLPM9jMzBSg8eDXlzIBGgyBS45/sTy+afZf2U24+SLEmN3yLkFDWhxBLyzEBg9B\n\tOuR4BtxBEZS+kvU1X71+tZZuPLvOBSJW4kdAsIa6Hoy5xF+NoQI7JeYsPXzERyAJ1q0n\n\tdrehUgHFfOB3Z80D98KrYLPWORbZeMikSdL4yZ3exCWQU81rm6w6AHevnu47+65Kt1Nm\n\tpScA==","X-Gm-Message-State":"AHPjjUi80J5se4i5BTBsvPNdDS5T5ZS7D8y0wO+9fdWzGEWAlGK05Lvq\n\tH56hped/hE5fMhTToLidhXoPQB7sSP5Rm3PEEkb7eQ==","X-Google-Smtp-Source":"ADKCNb53DbnaVv7aoGf7upALFKbxn6So3cWthMZiJaKEIVkfPTsvtAWEWGwzPtgVBW2bDCD4PbPHrsQ88BNsyG9lw1w=","X-Received":"by 10.223.175.100 with SMTP id\n\tz91mr20330667wrc.177.1505409314736; \n\tThu, 14 Sep 2017 10:15:14 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1504812251-23438-6-git-send-email-sundeep.lkml@gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-6-git-send-email-sundeep.lkml@gmail.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Thu, 14 Sep 2017 18:14:54 +0100","Message-ID":"<CAFEAcA_D=4M2vyo4m2xPi_hFDCmoKHk5kLY3s1ota602ywgHTQ@mail.gmail.com>","To":"Subbaraya Sundeep <sundeep.lkml@gmail.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c0c::22b","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 5/5] msf2: Add Emcraft's\n\tSmartfusion2 SOM kit","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Alistair Francis <alistair23@gmail.com>, =?utf-8?q?Philippe_Mathieu-Da?=\n\t=?utf-8?q?ud=C3=A9?= <f4bug@amsat.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>, Peter Crosthwaite\n\t<crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768748,"web_url":"http://patchwork.ozlabs.org/comment/1768748/","msgid":"<CAFEAcA-Dz_xw3pXTHg9kV2qT+fw=jfgrdw63QeWHCnSxKb0e+w@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T17:17:02","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On 14 September 2017 at 18:06, Alistair Francis <alistair23@gmail.com> wrote:\n> Once you have all the devices there you can enable bus access errors\n> as well. That's a future patch set though.\n\nAh, I hadn't noticed this code was opting out of bus access\nerrors; I don't want to permit new boards which do that,\nso we do need to fix that in this round. (I just sent an\nemail to that effect in reply to patch 1.)\n\nthanks\n-- PMM","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"HjhUACXJ\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtQGB41T0z9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 03:17:54 +1000 (AEST)","from localhost ([::1]:49074 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsXlw-0000Ku-Ef\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 13:17:52 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53770)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsXlV-0000K9-Cu\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:17:26 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsXlU-0002MW-J6\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:17:25 -0400","from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]:43236)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)\n\tid 1dsXlU-0002LU-DF\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:17:24 -0400","by mail-wr0-x22e.google.com with SMTP id a43so12073wrc.0\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 10:17:24 -0700 (PDT)","by 10.223.139.215 with HTTP; Thu, 14 Sep 2017 10:17:02 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=mULNCl149x/pmNat6fbR7Q7mQ4SSCK0ziY7ort2gg9w=;\n\tb=HjhUACXJcgpp2usVe7UZ1AKthBVM9YH7Mxc838rfBPeCQdaj4wZ1JLc508J/hiG3xu\n\tzqvSb86tYDiC35g5coS2cYuREMFJqFCMkPLvF+8pieGkfARxUYHG2ME6Aw+bgS9Z/6AY\n\t9Piqqa7NSbXiVY24qhxWL4hfDjDEmfX1BP3Iw=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=mULNCl149x/pmNat6fbR7Q7mQ4SSCK0ziY7ort2gg9w=;\n\tb=qDR5nGOwYas5HAc+4ixF0N0S7XHfg3521g37udV+3jehoqtoiZzPV+6obAL7BHlTfn\n\tugTVZ1XIvLvQ/3L2YTkitBl0dejZ8YBuMtMfzqVb10XB0E+/0ObDkwIlfAOtghp4SFvI\n\tQ6ztE3FT2UotUci+NXMvvAeMG5BSw6u6URml7A4HRnfPCaW9Nf9jC+R+L5y0XSMDDPkK\n\t6aAU5aUwH2URx8xGNTaqRocuFIpsSjouMkkP2gCVnantujFmZgSErtalZHVYuG8VtUif\n\tZ2TS8TBFGIdG6v6/LlPQWQ0zbWTHs6AGOP3wlEsfYEeWZZmgsUZS16kb6yFiSV7I1y0G\n\tVewA==","X-Gm-Message-State":"AHPjjUi/cfAwuOLRyG/9QNz2zdmZhcvat/FLxqqlAslbnFoIkT7WRRsL\n\tjhnmbt+nOhxKpr+QprwJQwQfz/ITjVfGQOHBp0kwiw==","X-Google-Smtp-Source":"ADKCNb7gXrzkmnVXPoP6WA2unxkmDgb0aNrnPGrRIhLmzY7QttDO5k+MD8o4NlsOgWYowXgb4OEOTXuGoJmN+iPWXiM=","X-Received":"by 10.223.198.202 with SMTP id\n\tc10mr18847556wrh.230.1505409443473; \n\tThu, 14 Sep 2017 10:17:23 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAKmqyKONrzpGxwvirPcb+-XZk=9WhwWKcSD_=BicmTQ2ZLQFEA@mail.gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<2b183ac5-36d8-1da6-cbac-4c6366f23261@amsat.org>\n\t<CALHRZuoJjSkSYaM9xz8xo2R-=oQEx5a1bkhSirc=NmEpxeG2AQ@mail.gmail.com>\n\t<28d6a84f-3a32-78ea-7a87-055fb14e1641@amsat.org>\n\t<CAKmqyKONrzpGxwvirPcb+-XZk=9WhwWKcSD_=BicmTQ2ZLQFEA@mail.gmail.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Thu, 14 Sep 2017 18:17:02 +0100","Message-ID":"<CAFEAcA-Dz_xw3pXTHg9kV2qT+fw=jfgrdw63QeWHCnSxKb0e+w@mail.gmail.com>","To":"Alistair Francis <alistair23@gmail.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c0c::22e","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 0/5] Add support for\n\tSmartfusion2 SoC","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"QEMU Developers <qemu-devel@nongnu.org>, Peter Crosthwaite\n\t<crosthwaite.peter@gmail.com>, \tqemu-arm <qemu-arm@nongnu.org>,\n\t=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>,\n\tsundeep subbaraya <sundeep.lkml@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768754,"web_url":"http://patchwork.ozlabs.org/comment/1768754/","msgid":"<ac9843a0-7121-57df-681f-fc5321b6d4c6@amsat.org>","list_archive_url":null,"date":"2017-09-14T17:45:16","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 5/5] msf2: Add Emcraft's\n\tSmartfusion2 SOM kit","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"On 09/14/2017 02:14 PM, Peter Maydell wrote:\n> On 7 September 2017 at 20:24, Subbaraya Sundeep <sundeep.lkml@gmail.com> wrote:\n>> Emulated Emcraft's Smartfusion2 System On Module starter\n>> kit.\n>> +static void emcraft_sf2_machine_init(MachineClass *mc)\n>> +{\n>> +    mc->desc = \"SmartFusion2 SOM kit from Emcraft (M2S010)\";\n>> +    mc->init = emcraft_sf2_s2s010_init;\n>> +    mc->ignore_memory_transaction_failures = true;\n> \n> Please don't set ignore_memory_transaction_failures in new boards.\n> This is a legacy-old-code-only flag.\nWhat about adding a such check in scripts/checkpatch.pl ?\n\n     if ($line =~ /ignore_memory_transaction_failures\\s+=/) {\n         ERROR(\"ignore_memory_transaction_failures() is a \nlegacy-old-code-only flag\\n\" . $herecurr);\n     }\n\n> \n> New boards should define enough devices, either properly\n> or using create_unimplemented_device(), to make whatever code\n> they're being tested against run.\n> \n> This is a firm requirement for this code to go into master,\n> because once we let a board in with the flag set it's almost\n> impossible to clear it because we don't know what guest\n> code that previously worked on the board will now break.\n> \n> thanks\n> -- PMM\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"UQVGoiPq\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtQtR07DNz9s72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 03:45:50 +1000 (AEST)","from localhost ([::1]:49159 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsYCy-0004tg-V6\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 13:45:48 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:41526)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsYCd-0004sN-R6\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:45:28 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsYCd-0002f0-2s\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 13:45:27 -0400","from mail-qk0-x22e.google.com ([2607:f8b0:400d:c09::22e]:44616)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsYCW-0002Zg-PJ; Thu, 14 Sep 2017 13:45:20 -0400","by mail-qk0-x22e.google.com with SMTP id b23so82993qkg.1;\n\tThu, 14 Sep 2017 10:45:20 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tn85sm11332294qke.53.2017.09.14.10.45.17\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Sep 2017 10:45:19 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=BwRpBdIIrbnjCWs4843v3R/yvpfBZ6nYFIcV5m2G7yo=;\n\tb=UQVGoiPqtGAzQFQhj3D+eLUPB8doGJ18TgzJX/e1o88/zzfVB7Z/Di+IvRvXRSuWgi\n\tTBUN7ouTBKZVS64qlo4bL2+52DI49xedZ6EjcDCucxIVHSuc4aU+zpen560sfNwtOyV0\n\tdRn0UdxRWS/49IRCmEZeC8JpUAWyFEcuxsIshdJPtOaMCVkXY2E2cd4oOsFsyaYILJjW\n\t7d2We2eYlPVdv/5i+AzTFjG+5FggsEjpUtpB3LXyVPESjFdEGjjYctvh6WdwzNu40kG7\n\tSVQLANKn8+AubGJydzt04vrWq+NA8SDtMtk905c566mVJtRMcDgShOMljvmK5BP6CBri\n\t2I3A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=BwRpBdIIrbnjCWs4843v3R/yvpfBZ6nYFIcV5m2G7yo=;\n\tb=scLqcOnO1O79hkxSkhphFy9mI00kzTHsN2zBs7afvqlX2yWb21u8CuaNl0ij/pt7pX\n\tqCiadt+JJaSyd8vv7oFD4AJLPkC8KI39p1lgtiLUe9Nrf2o78gpDe7C44YW34skNPrPo\n\t/gKeTRj2ibR8hUTNZcnmmltxAxAePmjMySmm6K7pIZNQt2Np1yLXb4gaWp1KOSD612P8\n\tU3YrCTTsNdm8iqXYC18trJR/pGmS1j0kECYJSxAtbr2gosG+lpukRsO0dnoh+fsCQdVU\n\tAr7usxXB8vmtEYmPROy2gEuLZc3ZBj9bDKJoP7xCIL3vsO/RtGjDF7tIk0/PF8p9Uz8d\n\tTfpw==","X-Gm-Message-State":"AHPjjUjPEMmMxqXyMyNmoODvXJa++ZQnVZbueBQ4l8Z4op5ngDRAxVnQ\n\tRaBqIk+/uvZmlQ==","X-Google-Smtp-Source":"AOwi7QBi7bjwoJIaU5vFXtklGXNeTXsIu3vEPolSDrfaTDbmZTbK7QhkgvnxFskSb8p4hgN+uQiMsQ==","X-Received":"by 10.233.221.199 with SMTP id\n\tr190mr3859079qkf.174.1505411120186; \n\tThu, 14 Sep 2017 10:45:20 -0700 (PDT)","To":"Peter Maydell <peter.maydell@linaro.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-6-git-send-email-sundeep.lkml@gmail.com>\n\t<CAFEAcA_D=4M2vyo4m2xPi_hFDCmoKHk5kLY3s1ota602ywgHTQ@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<ac9843a0-7121-57df-681f-fc5321b6d4c6@amsat.org>","Date":"Thu, 14 Sep 2017 14:45:16 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<CAFEAcA_D=4M2vyo4m2xPi_hFDCmoKHk5kLY3s1ota602ywgHTQ@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c09::22e","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 5/5] msf2: Add Emcraft's\n\tSmartfusion2 SOM kit","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Alistair Francis <alistair23@gmail.com>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>,\n\tqemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>, \n\tSubbaraya Sundeep <sundeep.lkml@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768765,"web_url":"http://patchwork.ozlabs.org/comment/1768765/","msgid":"<99bf0b39-f889-7873-55cf-05ac3a55a55e@amsat.org>","list_archive_url":null,"date":"2017-09-14T18:05:21","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":">>>> +static uint64_t msf2_sysreg_read(void *opaque, hwaddr offset,\n>>>> +    unsigned size)\n>>>> +{\n>>>> +    MSF2SysregState *s = opaque;\n>>>> +    uint32_t ret = 0;\n>>>> +\n>>>> +    offset >>= 2;\n>>>> +    if (offset < ARRAY_SIZE(s->regs)) {\n>>>\n>>>\n>>> This comment is controversial, I'll let Peter nod.\n>>>\n>>> The SYSREG behaves differently regarding which bus access it (CPU, AHB).\n>>> You are implementing CPU access to the SYSREG, the registers have\n>> different\n>>> permissions when accessed by the CPU. (see the SmartFusion2 User Guide:\n>>> Table 21-1 \"Register Types\" and Table 21-2 \"Register Map\").\n>>\n> \n> CPU is also one of the bus masters in AHB matrix (Fig 6.1 in page 248).\n\nI was worried about Fabric access but Peter remembered me QEMU doesn't \nmodel it ;)\n\n>>> I'd think of this stub:\n>>>\n>>> switch(reg) {\n>>> case register_supported1:\n>>> case register_supported2:\n>>> case register_supported3:\n>>>             ret = s->regs[offset];\n>>>             trace_msf2_sysreg_read(offset, ret);\n>>>             break;\n>>> case RO-U:\n>>>             qemu_log_mask(LOG_GUEST_ERROR, \"Illegal AHB access 0x%08\"...\n>>>             break;\n>>> case W1P:\n>>>             qemu_log_mask(LOG_GUEST_ERROR, \"Illegal read access ...\n>>>             break;\n>>> case RW:\n>>> case RW-P:\n>>> case RO:\n>>> case RO-P:\n>>> default:\n>>>             ret = s->regs[offset];\n>>>             qemu_log_mask(LOG_UNIMP, \"...\n>>>             break;\n>>> }\n>>\n> \n> This sounds good to me and will fix later by rearranging registers in enum\n> sorted\n> based on type (RO, RW, etc.,) and use those ranges in switch case.\n\nThe Register API (hw/register.h) is helpful to check such properties but \nmight turn your code harder to read.\n\n>>\n>> This doesn't look entirely right, since this is the read interface.\n>> Shouldn't we be allowing pretty much all of these register types\n>> except maybe W1P to do a read?\n>>\n> \n> Peter, some of the registers are not allowed to access by CPU and are only\n> set during\n> device programming. For those registers Philippe is suggesting to log\n> \"Illegal AHB access\"\n> when guest is trying to read/write.\n\nI was worried about accessing those registers when the flash \nWriteProtect bit is set, however the eNVM flash library is not Open \nSource, it is unlikely a guest access those registers, and if it is the \nlibrary then MicroSemi already tried it on real hardware.\nThere is probably no need to worry about \"Illegal AHB access\" :)\n\n>> On the other hand, in the write function we should probably not allow\n>> writes to registers documented as read only.\n\nSurely.\n\ntrace_msf2_sysreg_write(offset, s->regs[offset], ret);\n\nswitch(reg) {\ncase register_supported1:\ncase register_supported2:\ncase register_supported3:\n            s->regs[offset] = ret;\n            break;\ncase RO:\ncase RO-P:\ncase RO-U:\n            qemu_log_mask(LOG_GUEST_ERROR, \"Illegal write access on RO...\n            break;\ndefault:\n            qemu_log_mask(LOG_UNIMP, \"...\n            break;\n}","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"eKSlhWpM\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtRVj0ygNz9s7p\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 04:13:49 +1000 (AEST)","from localhost ([::1]:49329 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsYe3-0005lW-2s\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 14:13:47 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57792)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsYW4-00006X-TU\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:05:34 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsYW3-00080c-JG\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 14:05:32 -0400","from mail-qt0-x231.google.com ([2607:f8b0:400d:c0d::231]:46150)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dsYVx-0007ve-Qb; Thu, 14 Sep 2017 14:05:25 -0400","by mail-qt0-x231.google.com with SMTP id s18so138989qta.3;\n\tThu, 14 Sep 2017 11:05:25 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tx189sm11182829qkd.70.2017.09.14.11.05.22\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Sep 2017 11:05:24 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=YlqhK39bUbf60GcRMRcIiguN4zjCFyjMV/kXsz9BJ2Q=;\n\tb=eKSlhWpMNhZMBxbPyLpkD0xyG5K0yGOOz/JoZFliwOU8KhwE11btoXfe6hrR1iGDgj\n\th3sPkKUuv2Cn6DTIZisHbTPOC7G/ODT+0A0/pWiuPc6jao/AYs8Rk9bLjSr/3t/xYAeU\n\t3F+KInwRBUYWMQLMX8liosgcT1L5n/V36iz2lW2oCY5+TLg2uXlgYvJIpmrm1rOeIkoZ\n\tk08ctJAK7JiuC0u1jQpz+MyMy6iDjWgdxIThBNWMyAxzfQv8XBA9/8lmvDEI60Y6m3AE\n\tQlOFIH01Nzk7O0p0EbtEDZBtKT5svnQ75MyZtEpxr6ghD7EjEympth4V4J3ekhrU+HD0\n\tDlJg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=YlqhK39bUbf60GcRMRcIiguN4zjCFyjMV/kXsz9BJ2Q=;\n\tb=pwP3bjrQkMI0UbjShCwJI2F5IeqmmzlqzYPqwpDR1M1pSJ9n97k/tlN8QBETBEjU8f\n\t0SWP5S2PP5BmP3bNOLL+Fn8aWMzEhkBm7gxe7zQ35HnRsoY5s7k2dPZJw6EwlssYpnvD\n\tJk69OLokSNoSqF51ompeP7tqM26vDuK/3YI9G5nW2hF6J68mi581sxW3xxusyLT8ZAs/\n\tNQGMRv+oAzmZEY4xYGtBoLsX9kjpo1aq1bcROa/V7Lc2/0Zt/NuYuFU4gQ+vwdpkuLYL\n\tut4FWT07Qk5BeDZCq2OO9eGMLFlY6vg4MxV9s/rCNTV2d1GMKtQRp2f2gDx+IZ3bQfS6\n\tn3dQ==","X-Gm-Message-State":"AHPjjUjNfjEyWORrFQBVg3m56uBuj4dTJPiieaQXfCmSHT2ORTU1XfdB\n\tc9C0f2qnXeaJ0Q==","X-Google-Smtp-Source":"AOwi7QD2JwiDpuID3o3o40GgIqcwhNUk6IHayq6AIZiwqHiJLxoGRJLjKQmO6xyVj29QmzZMIkBt9w==","X-Received":"by 10.200.5.2 with SMTP id u2mr10561645qtg.131.1505412325220;\n\tThu, 14 Sep 2017 11:05:25 -0700 (PDT)","To":"sundeep subbaraya <sundeep.lkml@gmail.com>,\n\tPeter Maydell <peter.maydell@linaro.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>\n\t<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>\n\t<CAFEAcA8KUtG=2Cr_PndUqOxp5PN6bTJR_t=s+Ch+Y2WVfHVjQg@mail.gmail.com>\n\t<CALHRZupPj2cJJAr57n+E6Q0xF1qpsewHsDzS03mQmoHfL98j6g@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<99bf0b39-f889-7873-55cf-05ac3a55a55e@amsat.org>","Date":"Thu, 14 Sep 2017 15:05:21 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<CALHRZupPj2cJJAr57n+E6Q0xF1qpsewHsDzS03mQmoHfL98j6g@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c0d::231","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Alistair Francis <alistair23@gmail.com>, qemu-arm <qemu-arm@nongnu.org>, \n\tQEMU Developers <qemu-devel@nongnu.org>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768959,"web_url":"http://patchwork.ozlabs.org/comment/1768959/","msgid":"<CALHRZuoviT4xbYLVWPybVTkASZquxhcQU=h4+YC1KK=1SW=VWQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-15T06:31:33","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 5/5] msf2: Add Emcraft's\n\tSmartfusion2 SOM kit","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Peter,\n\nOn Thu, Sep 14, 2017 at 10:44 PM, Peter Maydell <peter.maydell@linaro.org>\nwrote:\n\n> On 7 September 2017 at 20:24, Subbaraya Sundeep <sundeep.lkml@gmail.com>\n> wrote:\n> > Emulated Emcraft's Smartfusion2 System On Module starter\n> > kit.\n> > +static void emcraft_sf2_machine_init(MachineClass *mc)\n> > +{\n> > +    mc->desc = \"SmartFusion2 SOM kit from Emcraft (M2S010)\";\n> > +    mc->init = emcraft_sf2_s2s010_init;\n> > +    mc->ignore_memory_transaction_failures = true;\n>\n> Please don't set ignore_memory_transaction_failures in new boards.\n> This is a legacy-old-code-only flag.\n>\n> New boards should define enough devices, either properly\n> or using create_unimplemented_device(), to make whatever code\n> they're being tested against run.\n>\n> This is a firm requirement for this code to go into master,\n> because once we let a board in with the flag set it's almost\n> impossible to clear it because we don't know what guest\n> code that previously worked on the board will now break.\n>\n\nOk. I am working on it and will send next spin with this fix.\n\nThanks,\nSundeep\n\n\n> thanks\n> -- PMM\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"bksKvdBE\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtltd1tLkz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 16:32:06 +1000 (AEST)","from localhost ([::1]:51550 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dskAV-0007rt-NY\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 02:32:03 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59954)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dskA3-0007qI-OJ\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 02:31:36 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dskA2-0003fS-D5\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 02:31:35 -0400","from mail-vk0-x243.google.com ([2607:f8b0:400c:c05::243]:38138)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dskA2-0003f6-7v; Fri, 15 Sep 2017 02:31:34 -0400","by mail-vk0-x243.google.com with SMTP id o22so359766vke.5;\n\tThu, 14 Sep 2017 23:31:34 -0700 (PDT)","by 10.176.66.68 with HTTP; Thu, 14 Sep 2017 23:31:33 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=sX0eqCHU1joHRIpmkEEodvvF2uJDIoMJkagmscqWRtw=;\n\tb=bksKvdBEdkpcEgxzbpCVw/+SyjlndGrxjwQ4AiS2TCGSOVH1Sz8NmRiW6g62i2/VMc\n\t/q3Z1+UbV3G5MLg1FDXiuzuIvmY5LcwHAX2o4nVRjTrnKRmF+mlam+8jRvffUh2eOs9m\n\tpjZPHrePS95KEF1KAStDN/mD2usmpGyukSYHbJqb18ZUV0m1Nl4ZTcd6N3aDwQtdW/rw\n\tQiYckF1dFSDOEkj6oChL7t3WsxPlh0ZBZ0Pq8t1rrAO4v0ZQgQ9quNOE+pbOAVVd6pIJ\n\tVrscY7kbExjBhs2X5HEYNS03uoFjVSRlqIK1aqvh7h5TPMc2phAF9DXr2Vu6KVmykE6E\n\t2+TA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=sX0eqCHU1joHRIpmkEEodvvF2uJDIoMJkagmscqWRtw=;\n\tb=tkIgvaE8ZdKR+63un3Onb+eMNWYnwFbQ61Z+2UlQfUuisJ12f347S1iaA/KZQ382ng\n\tn4UQFHufgA52yY3Ubrr+3Q4Ypxm3Ia/j4kxbT3ndEYhCpTOjv+N18zmUqOkCwO3M/4Ej\n\twIlFpCii0gkWXq//DveVqCPL2tYlfJSSiRdx6z++AqdlPuGSYQivyPbCnKmx84e7crf6\n\tGAhcVAWAhkmXa2tHLUVMvSfTS3OKz3MiXPPkpQHG38hi9LcwMcOb9tGSKZyWnaE8qi2K\n\tM2fQFCocccCyWOMb6IpaA7GsZSBH93Eg9FM2oNfOVi/7Ho3uS7T5Qrbt+VrQUjSn2C3U\n\tanTQ==","X-Gm-Message-State":"AHPjjUgwIsbaIvwBbN7/FgZ0PsrXhJ64I4N2MO9F6zbyw4p85KHuX4Ro\n\t8DiEwoYieQE0d61EmZwlACZrwjXuXTlk5kmrTzw=","X-Google-Smtp-Source":"AOwi7QBUsMg8PCDNrK/xBVKMIGr5KzyVpH6dZ7rRGFccF9Epgc3NFNyPz1l3DuzYyXoErAcYOnTMIp1lULUHPYZlgW4=","X-Received":"by 10.31.181.200 with SMTP id e191mr14981350vkf.55.1505457093508;\n\tThu, 14 Sep 2017 23:31:33 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAFEAcA_D=4M2vyo4m2xPi_hFDCmoKHk5kLY3s1ota602ywgHTQ@mail.gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-6-git-send-email-sundeep.lkml@gmail.com>\n\t<CAFEAcA_D=4M2vyo4m2xPi_hFDCmoKHk5kLY3s1ota602ywgHTQ@mail.gmail.com>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Fri, 15 Sep 2017 12:01:33 +0530","Message-ID":"<CALHRZuoviT4xbYLVWPybVTkASZquxhcQU=h4+YC1KK=1SW=VWQ@mail.gmail.com>","To":"Peter Maydell <peter.maydell@linaro.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c05::243","Content-Type":"text/plain; charset=\"UTF-8\"","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 5/5] msf2: Add Emcraft's\n\tSmartfusion2 SOM kit","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Alistair Francis <alistair23@gmail.com>, =?utf-8?q?Philippe_Mathieu-Da?=\n\t=?utf-8?q?ud=C3=A9?= <f4bug@amsat.org>, qemu-arm <qemu-arm@nongnu.org>,\n\tQEMU Developers <qemu-devel@nongnu.org>, Peter Crosthwaite\n\t<crosthwaite.peter@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1769825,"web_url":"http://patchwork.ozlabs.org/comment/1769825/","msgid":"<3618281c-b4f9-3a1a-8b6f-f87dfeb54e45@amsat.org>","list_archive_url":null,"date":"2017-09-17T23:57:23","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"Hi Sundeep,\n\nOn 09/14/2017 01:36 AM, Philippe Mathieu-Daudé wrote:\n> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n[...]\n>> +static inline int msf2_divbits(uint32_t div)\n> \n> Please directly use ctz32() instead of msf2_divbits()\n\nIt seems you missed this review comment in your v9.\n\n> \n>> +{\n>> +    int ret = 0;\n>> +\n>> +    switch (div) {\n>> +    case 1:\n>> +        ret = 0;\n>> +        break;\n>> +    case 2:\n>> +        ret = 1;\n>> +        break;\n>> +    case 4:\n>> +        ret = 2;\n>> +        break;\n>> +    case 8:\n>> +        ret = 4;\n>> +        break;\n>> +    case 16:\n>> +        ret = 5;\n>> +        break;\n>> +    case 32:\n>> +        ret = 6;\n>> +        break;\n>> +    default:\n>> +        break;\n>> +    }\n>> +\n>> +    return ret;\n>> +}","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ZkIzMFMG\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwR0Z0nJTz9s7h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 09:58:02 +1000 (AEST)","from localhost ([::1]:34043 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtjRn-0005hk-5W\n\tfor incoming@patchwork.ozlabs.org; Sun, 17 Sep 2017 19:57:59 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:55745)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtjRO-0005gA-2e\n\tfor qemu-devel@nongnu.org; Sun, 17 Sep 2017 19:57:34 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtjRN-00069H-3M\n\tfor qemu-devel@nongnu.org; Sun, 17 Sep 2017 19:57:34 -0400","from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:55095)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtjRH-00067O-Va; Sun, 17 Sep 2017 19:57:28 -0400","by mail-qt0-x235.google.com with SMTP id i13so6116087qtc.11;\n\tSun, 17 Sep 2017 16:57:27 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tg15sm4279445qtk.47.2017.09.17.16.57.24\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 17 Sep 2017 16:57:26 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:from:to:cc:references:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=gIVbESx5iaYy8G+vszQ2UHPqCHk14lrXkU7y8GXn03Q=;\n\tb=ZkIzMFMG5JVb5n8lT+94vHUJCRCYFaJRVkDdnwITve+Glnkxh8M8ZXbyMhV0AUT2MI\n\tVxDfV/za+/ma7PGD6GQJLtMeJwl0htd4RI5Gh8oUzy+h2KHYfj6DVgb755EV4wdAWyR4\n\t2luzzCIC4Hqrbkw+Vjqj2MQT9AK0sdRGMVmTXmwlo4HSpERvxFT5uin5RGhZvkXfG+tY\n\tvFudC4LQJ4gUTk/skTJINJaFZAVcpp07Xg9sTddTZSi7fRVfQxoHc/Vxl4sxwi1y9r6S\n\tzvzHS04UBOCmMI/NtQU55yH0lxvYqLmuAeaZmcOONMLE/MJ/BGlEbjdAK1H5cD331MDa\n\t1iTw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:from:to:cc:references:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=gIVbESx5iaYy8G+vszQ2UHPqCHk14lrXkU7y8GXn03Q=;\n\tb=MFj6RMNq/5WWQ4l2YYhbkbrJx6MP38MwITSuH2ZBVB0Fj+KUtJQ991WkW07reYr+T6\n\tuHMNyfamhsv20MWhnOakW+Yl2W58wzSyGpN2iOyCJl4bSNmDAHY/7evgAUKdulvdHE5/\n\tirE2uex58WpRpvemo7JwUTvnUW9HqSwknJqlcQOcWoJSU61SSre7ur2wf3Un1fAt0Mal\n\tItLlzd4de24aZFB3diPIugak/4iEJFrXQejA/iTISAlVyIdIUygSFCppEtfdwj1K3ccm\n\tf27+RzjgiOmHwqSuPv8ccBvLgvn6GEfBou87upWBPUWlIHfcroWvLTYfTw2baJsnQime\n\tIGcg==","X-Gm-Message-State":"AHPjjUiB5xEibC8fOyFVnDMvXQFcHmXfW76qFY128U5awOWskfMzAhPJ\n\tUzVeRG4iIluUUw==","X-Google-Smtp-Source":"AOwi7QB9lIziwU6XiypoewQ/O7yZZ2Q+ox9bALepCwZWqLaWryciQN5CujSaa+Mb3Gs3X0HIinnQKA==","X-Received":"by 10.200.44.107 with SMTP id e40mr44492383qta.262.1505692647342;\n\tSun, 17 Sep 2017 16:57:27 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","To":"Subbaraya Sundeep <sundeep.lkml@gmail.com>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>\n\t<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","Message-ID":"<3618281c-b4f9-3a1a-8b6f-f87dfeb54e45@amsat.org>","Date":"Sun, 17 Sep 2017 20:57:23 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c0d::235","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, crosthwaite.peter@gmail.com,\n\tqemu-arm@nongnu.org, qemu-devel@nongnu.org, alistair23@gmail.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1769888,"web_url":"http://patchwork.ozlabs.org/comment/1769888/","msgid":"<CALHRZuoba-57L-95NrCHBn-+_DUcg9PQTbaOz4ENwPyX+Ysa3w@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T06:29:46","subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"content":"Hi Philippe,\n\nOn Mon, Sep 18, 2017 at 5:27 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\nwrote:\n\n> Hi Sundeep,\n>\n> On 09/14/2017 01:36 AM, Philippe Mathieu-Daudé wrote:\n>\n>> On 09/07/2017 04:24 PM, Subbaraya Sundeep wrote:\n>>\n> [...]\n>\n>> +static inline int msf2_divbits(uint32_t div)\n>>>\n>>\n>> Please directly use ctz32() instead of msf2_divbits()\n>>\n>\n> It seems you missed this review comment in your v9.\n\n\nctz32(1) = 0\nctz32(2) = 1\nctz32(4) = 2\nctz32(8) = 3\nctz32(16) = 4\nctz32(32) = 5\n\nbut for inputs 8,16,32 output should be 4,5,6 so didn't use ctz32().\nI replied to this comment in the same mail chain earlier. Please check.\n\nThanks,\nSundeep\n\n>\n>\n>\n>> +{\n>>> +    int ret = 0;\n>>> +\n>>> +    switch (div) {\n>>> +    case 1:\n>>> +        ret = 0;\n>>> +        break;\n>>> +    case 2:\n>>> +        ret = 1;\n>>> +        break;\n>>> +    case 4:\n>>> +        ret = 2;\n>>> +        break;\n>>> +    case 8:\n>>> +        ret = 4;\n>>> +        break;\n>>> +    case 16:\n>>> +        ret = 5;\n>>> +        break;\n>>> +    case 32:\n>>> +        ret = 6;\n>>> +        break;\n>>> +    default:\n>>> +        break;\n>>> +    }\n>>> +\n>>> +    return ret;\n>>> +}\n>>>\n>>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"XITxt/JO\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwbjD0RtYz9ryr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 16:30:19 +1000 (AEST)","from localhost ([::1]:34870 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtpZQ-0000Ic-7j\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 02:30:16 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:45251)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtpZ0-0000IF-DW\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 02:29:51 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtpYz-0005yl-71\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 02:29:50 -0400","from mail-ua0-x241.google.com ([2607:f8b0:400c:c08::241]:38376)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dtpYz-0005yO-14; Mon, 18 Sep 2017 02:29:49 -0400","by mail-ua0-x241.google.com with SMTP id l24so2302749uaa.5;\n\tSun, 17 Sep 2017 23:29:47 -0700 (PDT)","by 10.176.66.68 with HTTP; Sun, 17 Sep 2017 23:29:46 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=1v/N5lt5HdqtbkiuQ0E87DvEica8lI5ZK3THdVeUKv8=;\n\tb=XITxt/JOymtX71OegrwQP5k9PJujw7pVOkj/FogNBZWgDApgFrRpZD82CO3ncKn5K2\n\tc/Jw9Kcz+kjvWuA8Bv9raPCBqtsI7XZr3kHNqoCCE2f3ZmpNNZb6P7EqFaOdyxGugN9B\n\tN1t6doFSCUju83HvU9LVT+v3tcSmNrOMbwwyzQ3mrR1LLSkBF0PKBaTB0YPFqxT5jHKK\n\tKkFYWrYE569/9QHcCm5rUcPaKKcWMFttVSREMGZXeyEwHfQ7ld/Iu1U5EJDCCfL6cowO\n\twuNq7tJEU+aMzAW9cnOwiC0h+5SEe8UTVfOqkDhbkQxWKrHvmy4ggyD2JWQ6OtNytPpT\n\tAu1g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=1v/N5lt5HdqtbkiuQ0E87DvEica8lI5ZK3THdVeUKv8=;\n\tb=t2VyzfeEGwWvGJhyydNqDTo8+0EQIrJkPSM8BQlb6yFFxzwbpi1HAlu3purRK9CJLg\n\tqamcZFg2rU69YPJ+fSSodrvW5iKPDBd4kKkSlSfPJgOkoMe0E973xfuDI+AkTkv+XRGJ\n\tuJyYvAIr/yU0J7PxjydAf0Ff7VcFyhLfzITtGbpfmnTpjrUxZLWp3c4QPrxoDmBfv4N0\n\tABkSDF3Amt3cT/OVn2WvWxuYk+QUKXcnZK3msT4wWeLvstApIaqWalnpglFsF3i5s0d7\n\tBlfnc4Y8UVAI6PDAHiDEkiqKba1wvuc0n05EnC7YBRKatRTzloih8rbWJuvWtSnW9vBO\n\t/AaQ==","X-Gm-Message-State":"AHPjjUhOvu91AqtTOuWIWrAqLcgcBbdmVTivOypGLwro5O2b4T6JBgOW\n\tdmUHAcukgTm0SyNMe06F7KW3z/MCvCz7WTkkTIM=","X-Google-Smtp-Source":"ADKCNb7h1xaYY0Tak09PalhzmK50aQ8WaSC2nBNetZ/iZbCZhqJ6cIPsAwx+KwbeVe9WCQ40BQZDKjR8sx7PNH2Y2z0=","X-Received":"by 10.176.3.51 with SMTP id 48mr29336642uat.67.1505716187202;\n\tSun, 17 Sep 2017 23:29:47 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<3618281c-b4f9-3a1a-8b6f-f87dfeb54e45@amsat.org>","References":"<1504812251-23438-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1504812251-23438-3-git-send-email-sundeep.lkml@gmail.com>\n\t<a9891f10-9643-96ee-7f99-7a384b9ea302@amsat.org>\n\t<3618281c-b4f9-3a1a-8b6f-f87dfeb54e45@amsat.org>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Mon, 18 Sep 2017 11:59:46 +0530","Message-ID":"<CALHRZuoba-57L-95NrCHBn-+_DUcg9PQTbaOz4ENwPyX+Ysa3w@mail.gmail.com>","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400c:c08::241","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v8 PATCH 2/5] msf2: Microsemi\n\tSmartfusion2 System Register block","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Peter Maydell <peter.maydell@linaro.org>,\n\tPeter Crosthwaite <crosthwaite.peter@gmail.com>,\n\tqemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>, \n\tAlistair Francis <alistair23@gmail.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]