[{"id":1769826,"web_url":"http://patchwork.ozlabs.org/comment/1769826/","msgid":"<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>","list_archive_url":null,"date":"2017-09-18T01:01:56","subject":"Re: [Qemu-devel] [Qemu devel v9 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, Peter,\n\nOn 09/15/2017 01:59 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         | 168 ++++++++++++++++++++++++++++++++++++++++++\n>   hw/misc/trace-events          |   5 ++\n>   include/hw/misc/msf2-sysreg.h |  77 +++++++++++++++++++\n>   4 files changed, 251 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..dc3597b\n> --- /dev/null\n> +++ b/hw/misc/msf2-sysreg.c\n> @@ -0,0 +1,168 @@\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> +#include \"trace.h\"\n> +\n> +static inline int msf2_divbits(uint32_t div)\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\neh?\n\n> +    }\n> +\n> +    return ret;\n> +}\n> +\n> +static void msf2_sysreg_reset(DeviceState *d)\n> +{\n> +    MSF2SysregState *s = MSF2_SYSREG(d);\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\nctz32(s->apb0div) << 5 ...\n\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> +        ret = s->regs[offset];\n> +        trace_msf2_sysreg_read(offset << 2, ret);\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> +    offset >>= 2;\n> +\n> +    switch (offset) {\n> +    case MSSDDR_PLL_STATUS:\n> +        trace_msf2_sysreg_write_pll_status();\n> +        break;\n> +\n> +    case ESRAM_CR:\n> +    case DDR_CR:\n> +    case ENVM_REMAP_BASE_CR:\n> +        if (newval != s->regs[offset]) {\n> +            qemu_log_mask(LOG_UNIMP,\n> +                       TYPE_MSF2_SYSREG\": remapping not supported\\n\");\n\nI'd rather exit here than continue with inconsistent cpu, Peter what do \nyou recommend?\n\n> +        }\n> +        break;\n> +\n> +    default:\n> +        if (offset < ARRAY_SIZE(s->regs)) {\n> +            trace_msf2_sysreg_write(offset << 2, newval, s->regs[offset]);\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> +\n> +static const MemoryRegionOps sysreg_ops = {\n> +    .read = msf2_sysreg_read,\n> +    .write = msf2_sysreg_write,\n> +    .endianness = DEVICE_NATIVE_ENDIAN,\n> +};\n> +\n> +static void msf2_sysreg_init(Object *obj)\n> +{\n> +    MSF2SysregState *s = MSF2_SYSREG(obj);\n> +\n> +    memory_region_init_io(&s->iomem, obj, &sysreg_ops, s, TYPE_MSF2_SYSREG,\n> +                          MSF2_SYSREG_MMIO_SIZE);\n> +    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);\n> +}\n> +\n> +static const VMStateDescription vmstate_msf2_sysreg = {\n> +    .name = TYPE_MSF2_SYSREG,\n> +    .version_id = 1,\n> +    .minimum_version_id = 1,\n> +    .fields = (VMStateField[]) {\n> +        VMSTATE_UINT32_ARRAY(regs, MSF2SysregState, MSF2_SYSREG_MMIO_SIZE / 4),\n> +        VMSTATE_END_OF_LIST()\n> +    }\n> +};\n> +\n> +static Property msf2_sysreg_properties[] = {\n> +    /* default divisors in Libero GUI */\n> +    DEFINE_PROP_UINT32(\"apb0divisor\", MSF2SysregState, apb0div, 2),\n> +    DEFINE_PROP_UINT32(\"apb1divisor\", MSF2SysregState, apb1div, 2),\n\nDEFINE_PROP_UINT8() is enough for both.\n\nBeware these divisors must be power of 2, and maximum 32.\n\nThis can be checked in msf2_sysreg_realize() ...\n\n> +    DEFINE_PROP_END_OF_LIST(),\n> +};\n> +\n> +static void msf2_sysreg_class_init(ObjectClass *klass, void *data)\n> +{\n> +    DeviceClass *dc = DEVICE_CLASS(klass);\n> +\n> +    dc->vmsd = &vmstate_msf2_sysreg;\n> +    dc->reset = msf2_sysreg_reset;\n\n... which would go here:\n\n        dc->realize = msf2_sysreg_realize;\n\n> +    dc->props = msf2_sysreg_properties;\n> +}\n> +\n> +static const TypeInfo msf2_sysreg_info = {\n> +    .name  = TYPE_MSF2_SYSREG,\n> +    .parent = TYPE_SYS_BUS_DEVICE,\n> +    .class_init = msf2_sysreg_class_init,\n> +    .instance_size  = sizeof(MSF2SysregState),\n> +    .instance_init = msf2_sysreg_init,\n> +};\n> +\n> +static void msf2_sysreg_register_types(void)\n> +{\n> +    type_register_static(&msf2_sysreg_info);\n> +}\n> +\n> +type_init(msf2_sysreg_register_types)\n> diff --git a/hw/misc/trace-events b/hw/misc/trace-events\n> index 3313585..616579a 100644\n> --- a/hw/misc/trace-events\n> +++ b/hw/misc/trace-events\n> @@ -61,3 +61,8 @@ mps2_scc_reset(void) \"MPS2 SCC: reset\"\n>   mps2_scc_leds(char led7, char led6, char led5, char led4, char led3, char led2, char led1, char led0) \"MPS2 SCC LEDs: %c%c%c%c%c%c%c%c\"\n>   mps2_scc_cfg_write(unsigned function, unsigned device, uint32_t value) \"MPS2 SCC config write: function %d device %d data 0x%\" PRIx32\n>   mps2_scc_cfg_read(unsigned function, unsigned device, uint32_t value) \"MPS2 SCC config read: function %d device %d data 0x%\" PRIx32\n> +\n> +# hw/misc/msf2-sysreg.c\n> +msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev) \"msf2-sysreg write: addr 0x%08\" HWADDR_PRIx \" data 0x%\" PRIx32 \" prev 0x%\" PRIx32\n> +msf2_sysreg_read(uint64_t offset, uint32_t val) \"msf2-sysreg read: addr 0x%08\" HWADDR_PRIx \" data 0x%08\" PRIx32\n> +msf2_sysreg_write_pll_status(void) \"Invalid write to read only PLL status register\"\n> diff --git a/include/hw/misc/msf2-sysreg.h b/include/hw/misc/msf2-sysreg.h\n> new file mode 100644\n> index 0000000..231f827\n> --- /dev/null\n> +++ b/include/hw/misc/msf2-sysreg.h\n> @@ -0,0 +1,77 @@\n> +/*\n> + * Microsemi SmartFusion2 SYSREG\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_MSF2_SYSREG_H\n> +#define HW_MSF2_SYSREG_H\n> +\n> +#include \"hw/sysbus.h\"\n> +\n> +enum {\n> +    ESRAM_CR        = 0x00 / 4,\n> +    ESRAM_MAX_LAT,\n> +    DDR_CR,\n> +    ENVM_CR,\n> +    ENVM_REMAP_BASE_CR,\n> +    ENVM_REMAP_FAB_CR,\n> +    CC_CR,\n> +    CC_REGION_CR,\n> +    CC_LOCK_BASE_ADDR_CR,\n> +    CC_FLUSH_INDX_CR,\n> +    DDRB_BUF_TIMER_CR,\n> +    DDRB_NB_ADDR_CR,\n> +    DDRB_NB_SIZE_CR,\n> +    DDRB_CR,\n> +\n> +    SOFT_RESET_CR  = 0x48 / 4,\n> +    M3_CR,\n> +\n> +    GPIO_SYSRESET_SEL_CR = 0x58 / 4,\n> +\n> +    MDDR_CR = 0x60 / 4,\n> +\n> +    MSSDDR_PLL_STATUS_LOW_CR = 0x90 / 4,\n> +    MSSDDR_PLL_STATUS_HIGH_CR,\n> +    MSSDDR_FACC1_CR,\n> +    MSSDDR_FACC2_CR,\n> +\n> +    MSSDDR_PLL_STATUS = 0x150 / 4,\n> +};\n> +\n> +#define MSF2_SYSREG_MMIO_SIZE     0x300\n> +\n> +#define TYPE_MSF2_SYSREG          \"msf2-sysreg\"\n> +#define MSF2_SYSREG(obj)  OBJECT_CHECK(MSF2SysregState, (obj), TYPE_MSF2_SYSREG)\n> +\n> +typedef struct MSF2SysregState {\n> +    SysBusDevice parent_obj;\n> +\n> +    MemoryRegion iomem;\n> +\n> +    uint32_t apb0div;\n> +    uint32_t apb1div;\n\nuint8_t for both\n\n> +\n> +    uint32_t regs[MSF2_SYSREG_MMIO_SIZE / 4];\n> +} MSF2SysregState;\n> +\n> +#endif /* HW_MSF2_SYSREG_H */\n> \n\nAcked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\nTested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>","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=\"FaAKu1Ze\"; 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 3xwSRN1QgTz9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 11:02:51 +1000 (AEST)","from localhost ([::1]:34165 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 1dtkSV-0002DG-1O\n\tfor incoming@patchwork.ozlabs.org; Sun, 17 Sep 2017 21:02:47 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59255)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtkS3-0002Bm-Vs\n\tfor qemu-devel@nongnu.org; Sun, 17 Sep 2017 21:02:21 -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 1dtkS0-0006MX-Kb\n\tfor qemu-devel@nongnu.org; Sun, 17 Sep 2017 21:02:20 -0400","from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:35783)\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 1dtkRq-0006Ch-60; Sun, 17 Sep 2017 21:02:06 -0400","by mail-qt0-x243.google.com with SMTP id l25so4783227qtf.2;\n\tSun, 17 Sep 2017 18:02:01 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tj19sm4413504qtc.41.2017.09.17.18.01.58\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 17 Sep 2017 18:02:00 -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=qnGg9XWy1NuglTjz3emWU0YeXHCIx6vdVal1VWsP2b4=;\n\tb=FaAKu1ZeKmBWS+SmMlJ1aeuhpO2pBkLDkw8q1xQu+Fhj2IoHinp/lx0o+iX9Dl4yG0\n\tTzAg2GHArkyGldfLRGNBo5z15cA3ckKDG1O3Koki9uCMAnNkUQRNdDEpM+pjy21S1u9+\n\tUwHgG1y2Yo2cePJlUntYdM79XdyfSKIv8hejwxYr8SLH1DPEK8GN7ReK/rJ+8AIHiUte\n\t0DmmUuxZQF4qciYxo8GuXA1CLfHpWbdTFP/Oe0qY92g8UiJ9eGsNtcCiL4BqX7cJ6tdn\n\t5ieXv95eJQeDM1rO2srcLvjDJhmEnIQD2pKeurGmgbP/yBDMRIFbgJnZzco4aUKH0aoz\n\tNmIw==","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=qnGg9XWy1NuglTjz3emWU0YeXHCIx6vdVal1VWsP2b4=;\n\tb=O0rF/r+RxuWkGaXHHkLiWkQfGsR/pys0we0EKCAGxQOmFJCKJjb48k1BvxkDk8191y\n\tMfN/rtW33eggQ+wIjjBjUh6JcCS5PWnuSYOBR9qTyWZAPiENWhT6EQh0T5ifKX2w9Xvs\n\tAkHJRPCfZmbKD8TZAJvxGVwHHWBDVl7awNlpnsteFf4kUPCPLp3N6o/ccTRjXKPk5YYI\n\t4C8ZQV9KgJQJrc1eWTUnenMf/GCwwXnZGymofLU8vfxavu2nsETgJAo7SkU9O65GJsL4\n\txPSqC/cVvtr5NyNRq0hWgp432Cloz7+uIyunBhay6l5nks9obgp5NovyG3VR3TN+LW30\n\tFe4Q==","X-Gm-Message-State":"AHPjjUj9saeWziHgF0fsuXAXZqn2Al/CqhLwWF9jrvuY5QTfiARnmnNs\n\tPMuC34HVKrm2XQ==","X-Google-Smtp-Source":"AOwi7QDFdH+Zi7RVrNkUYeEaU23PHTigeC9au3sjhc74GziIuwqhG0lfgDN/WRS/TUpDaPDIUFW7YQ==","X-Received":"by 10.200.41.143 with SMTP id 15mr38897020qts.56.1505696520862; \n\tSun, 17 Sep 2017 18:02:00 -0700 (PDT)","To":"Subbaraya Sundeep <sundeep.lkml@gmail.com>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>","Date":"Sun, 17 Sep 2017 22:01:56 -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":"<1505494753-10837-3-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::243","Subject":"Re: [Qemu-devel] [Qemu devel v9 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, qemu-arm@nongnu.org, qemu-devel@nongnu.org,\n\talistair23@gmail.com, 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":1770055,"web_url":"http://patchwork.ozlabs.org/comment/1770055/","msgid":"<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T10:17:52","subject":"Re: [Qemu-devel] [Qemu devel v9 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 6:31 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\nwrote:\n\n> Hi Sundeep, Peter,\n>\n>\n> On 09/15/2017 01:59 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         | 168 ++++++++++++++++++++++++++++++\n>> ++++++++++++\n>>   hw/misc/trace-events          |   5 ++\n>>   include/hw/misc/msf2-sysreg.h |  77 +++++++++++++++++++\n>>   4 files changed, 251 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..dc3597b\n>> --- /dev/null\n>> +++ b/hw/misc/msf2-sysreg.c\n>> @@ -0,0 +1,168 @@\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>> +#include \"trace.h\"\n>> +\n>> +static inline int msf2_divbits(uint32_t div)\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> eh?\n>\n> +    }\n>> +\n>> +    return ret;\n>> +}\n>> +\n>> +static void msf2_sysreg_reset(DeviceState *d)\n>> +{\n>> +    MSF2SysregState *s = MSF2_SYSREG(d);\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>>\n>\n> ctz32(s->apb0div) << 5 ...\n\n\nI will modify like below:\ndiv0 = s->apb0div < 8 ? ctz32(s->apb0div) : ctz32(s->apb0div) + 1;\ndiv1 = s->apb1div < 8 ? ctz32(s->apb1div) : ctz32(s->apb1div) + 1;\ns->regs[MSSDDR_FACC1_CR] = div0 << 5 | div1 << 2;\n\n\n>\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>> +        ret = s->regs[offset];\n>> +        trace_msf2_sysreg_read(offset << 2, ret);\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>> +    offset >>= 2;\n>> +\n>> +    switch (offset) {\n>> +    case MSSDDR_PLL_STATUS:\n>> +        trace_msf2_sysreg_write_pll_status();\n>> +        break;\n>> +\n>> +    case ESRAM_CR:\n>> +    case DDR_CR:\n>> +    case ENVM_REMAP_BASE_CR:\n>> +        if (newval != s->regs[offset]) {\n>> +            qemu_log_mask(LOG_UNIMP,\n>> +                       TYPE_MSF2_SYSREG\": remapping not supported\\n\");\n>>\n>\n> I'd rather exit here than continue with inconsistent cpu, Peter what do\n> you recommend?\n>\n>\n> +        }\n>> +        break;\n>> +\n>> +    default:\n>> +        if (offset < ARRAY_SIZE(s->regs)) {\n>> +            trace_msf2_sysreg_write(offset << 2, newval,\n>> s->regs[offset]);\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>> +static const MemoryRegionOps sysreg_ops = {\n>> +    .read = msf2_sysreg_read,\n>> +    .write = msf2_sysreg_write,\n>> +    .endianness = DEVICE_NATIVE_ENDIAN,\n>> +};\n>> +\n>> +static void msf2_sysreg_init(Object *obj)\n>> +{\n>> +    MSF2SysregState *s = MSF2_SYSREG(obj);\n>> +\n>> +    memory_region_init_io(&s->iomem, obj, &sysreg_ops, s,\n>> TYPE_MSF2_SYSREG,\n>> +                          MSF2_SYSREG_MMIO_SIZE);\n>> +    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);\n>> +}\n>> +\n>> +static const VMStateDescription vmstate_msf2_sysreg = {\n>> +    .name = TYPE_MSF2_SYSREG,\n>> +    .version_id = 1,\n>> +    .minimum_version_id = 1,\n>> +    .fields = (VMStateField[]) {\n>> +        VMSTATE_UINT32_ARRAY(regs, MSF2SysregState,\n>> MSF2_SYSREG_MMIO_SIZE / 4),\n>> +        VMSTATE_END_OF_LIST()\n>> +    }\n>> +};\n>> +\n>> +static Property msf2_sysreg_properties[] = {\n>> +    /* default divisors in Libero GUI */\n>> +    DEFINE_PROP_UINT32(\"apb0divisor\", MSF2SysregState, apb0div, 2),\n>> +    DEFINE_PROP_UINT32(\"apb1divisor\", MSF2SysregState, apb1div, 2),\n>>\n>\n> DEFINE_PROP_UINT8() is enough for both.\n>\n> Beware these divisors must be power of 2, and maximum 32.\n\nThis can be checked in msf2_sysreg_realize() ...\n\n\nOk\n\n>\n>\n> +    DEFINE_PROP_END_OF_LIST(),\n>> +};\n>> +\n>> +static void msf2_sysreg_class_init(ObjectClass *klass, void *data)\n>> +{\n>> +    DeviceClass *dc = DEVICE_CLASS(klass);\n>> +\n>> +    dc->vmsd = &vmstate_msf2_sysreg;\n>> +    dc->reset = msf2_sysreg_reset;\n>>\n>\n> ... which would go here:\n>\n>        dc->realize = msf2_sysreg_realize;\n>\n> Ok.\n\n>\n> +    dc->props = msf2_sysreg_properties;\n>> +}\n>> +\n>> +static const TypeInfo msf2_sysreg_info = {\n>> +    .name  = TYPE_MSF2_SYSREG,\n>> +    .parent = TYPE_SYS_BUS_DEVICE,\n>> +    .class_init = msf2_sysreg_class_init,\n>> +    .instance_size  = sizeof(MSF2SysregState),\n>> +    .instance_init = msf2_sysreg_init,\n>> +};\n>> +\n>> +static void msf2_sysreg_register_types(void)\n>> +{\n>> +    type_register_static(&msf2_sysreg_info);\n>> +}\n>> +\n>> +type_init(msf2_sysreg_register_types)\n>> diff --git a/hw/misc/trace-events b/hw/misc/trace-events\n>> index 3313585..616579a 100644\n>> --- a/hw/misc/trace-events\n>> +++ b/hw/misc/trace-events\n>> @@ -61,3 +61,8 @@ mps2_scc_reset(void) \"MPS2 SCC: reset\"\n>>   mps2_scc_leds(char led7, char led6, char led5, char led4, char led3,\n>> char led2, char led1, char led0) \"MPS2 SCC LEDs: %c%c%c%c%c%c%c%c\"\n>>   mps2_scc_cfg_write(unsigned function, unsigned device, uint32_t value)\n>> \"MPS2 SCC config write: function %d device %d data 0x%\" PRIx32\n>>   mps2_scc_cfg_read(unsigned function, unsigned device, uint32_t value)\n>> \"MPS2 SCC config read: function %d device %d data 0x%\" PRIx32\n>> +\n>> +# hw/misc/msf2-sysreg.c\n>> +msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev)\n>> \"msf2-sysreg write: addr 0x%08\" HWADDR_PRIx \" data 0x%\" PRIx32 \" prev 0x%\"\n>> PRIx32\n>> +msf2_sysreg_read(uint64_t offset, uint32_t val) \"msf2-sysreg read: addr\n>> 0x%08\" HWADDR_PRIx \" data 0x%08\" PRIx32\n>> +msf2_sysreg_write_pll_status(void) \"Invalid write to read only PLL\n>> status register\"\n>> diff --git a/include/hw/misc/msf2-sysreg.h b/include/hw/misc/msf2-sysreg.\n>> h\n>> new file mode 100644\n>> index 0000000..231f827\n>> --- /dev/null\n>> +++ b/include/hw/misc/msf2-sysreg.h\n>> @@ -0,0 +1,77 @@\n>> +/*\n>> + * Microsemi SmartFusion2 SYSREG\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_MSF2_SYSREG_H\n>> +#define HW_MSF2_SYSREG_H\n>> +\n>> +#include \"hw/sysbus.h\"\n>> +\n>> +enum {\n>> +    ESRAM_CR        = 0x00 / 4,\n>> +    ESRAM_MAX_LAT,\n>> +    DDR_CR,\n>> +    ENVM_CR,\n>> +    ENVM_REMAP_BASE_CR,\n>> +    ENVM_REMAP_FAB_CR,\n>> +    CC_CR,\n>> +    CC_REGION_CR,\n>> +    CC_LOCK_BASE_ADDR_CR,\n>> +    CC_FLUSH_INDX_CR,\n>> +    DDRB_BUF_TIMER_CR,\n>> +    DDRB_NB_ADDR_CR,\n>> +    DDRB_NB_SIZE_CR,\n>> +    DDRB_CR,\n>> +\n>> +    SOFT_RESET_CR  = 0x48 / 4,\n>> +    M3_CR,\n>> +\n>> +    GPIO_SYSRESET_SEL_CR = 0x58 / 4,\n>> +\n>> +    MDDR_CR = 0x60 / 4,\n>> +\n>> +    MSSDDR_PLL_STATUS_LOW_CR = 0x90 / 4,\n>> +    MSSDDR_PLL_STATUS_HIGH_CR,\n>> +    MSSDDR_FACC1_CR,\n>> +    MSSDDR_FACC2_CR,\n>> +\n>> +    MSSDDR_PLL_STATUS = 0x150 / 4,\n>> +};\n>> +\n>> +#define MSF2_SYSREG_MMIO_SIZE     0x300\n>> +\n>> +#define TYPE_MSF2_SYSREG          \"msf2-sysreg\"\n>> +#define MSF2_SYSREG(obj)  OBJECT_CHECK(MSF2SysregState, (obj),\n>> TYPE_MSF2_SYSREG)\n>> +\n>> +typedef struct MSF2SysregState {\n>> +    SysBusDevice parent_obj;\n>> +\n>> +    MemoryRegion iomem;\n>> +\n>> +    uint32_t apb0div;\n>> +    uint32_t apb1div;\n>>\n>\n> uint8_t for both\n\n\nOk.\n\n>\n>\n> +\n>> +    uint32_t regs[MSF2_SYSREG_MMIO_SIZE / 4];\n>> +} MSF2SysregState;\n>> +\n>> +#endif /* HW_MSF2_SYSREG_H */\n>>\n>>\n> Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n>\n\nThank you,\nSundeep","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=\"qoSHx3rH\"; 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 3xwhqH3C8jz9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 20:20:59 +1000 (AEST)","from localhost ([::1]:35600 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 1dttAf-00085t-8i\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 06:20:57 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:42226)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtt7l-00068b-8Y\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:18:00 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtt7i-0004NT-6H\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:17:57 -0400","from mail-ua0-x233.google.com ([2607:f8b0:400c:c08::233]:50699)\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 1dtt7h-0004ND-Ts; Mon, 18 Sep 2017 06:17:54 -0400","by mail-ua0-x233.google.com with SMTP id g34so17076uah.7;\n\tMon, 18 Sep 2017 03:17:53 -0700 (PDT)","by 10.176.66.68 with HTTP; Mon, 18 Sep 2017 03:17:52 -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=8EfOjb+yEtGyj5H4/WJa7ga0yrtCPlk8L1akeAOahdo=;\n\tb=qoSHx3rH3IgqrEMEC1APxgr9h5wOtvQHuxaAU6o4zEYyDT9cxJAK0x/2BjLCwWthRl\n\tF80vPQeJR52FKpK1w1EMQfZaUXBO3xgKn3QCV0ZJH+Y7bHXGMnIrHkLcnvmreXFwJNd6\n\t+AWrAQu7qxz0IClrNb41vZOuk8W9y59CtQwwOPqB9uMKcWHRIMKVEpWC8QE5f4BDFhuO\n\t0xtyVk6a1ZvG+Osrgc/SmCiEv6AQhk0m5mmAyp+d4++yFzxqPUP+LoW/az+upLbCjJOO\n\tV0WRivJbNBkHVpk8lcmNhe6tN+OWPtZCEbPsGnX4o6w2MhUH1lFemWgFF8oxiwrwxvri\n\txykw==","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=8EfOjb+yEtGyj5H4/WJa7ga0yrtCPlk8L1akeAOahdo=;\n\tb=TykW6/mfyiQCnZDvjkdo9sCuwRg10y0APafLzQjzjC072WbDRUdT3tgxXfbYkfKSRn\n\tGrx0mbqoaotffBd/1ANmsgVskN5azqCphsjRtvuQ6jwWjrp5hxgeMCTdr+bN4aKdaqyb\n\tgyN5PbiArrf4dzAoHR8c8O8huLQ1wE6SG2Mxx6nf3o0cIzwijJ5OnafL67fekqEPUXg7\n\tQccpJHjYfS4Bi66bybUyJ5ISFa1V44JSHhaIhUiRMmxKrHlnm46etTt2dJTZa8rw9r/6\n\tARcQZNmtZhXuzO1O8OZ1W8whYgG2s6vS8Q4KW6lM5YuizYZ++r6qCep/zCpsSChchmZ0\n\tVQ2Q==","X-Gm-Message-State":"AHPjjUiGR1wmSos2/+QfV9asJ8xKS+QBlf3pIr8cvkp9Xom79POPUbL9\n\t4BlN9gFyWIdmVSHD+/GJbDd54f4/4WTLhRhK7DQ=","X-Google-Smtp-Source":"AOwi7QC2zkPnDeF2oX2ct17VrSGdjVh0zRP/dtwp5yS2sisOiyUx+Fb5O9+wXlCu5e+6RHQPh51bZPnysVx/mHlm6Co=","X-Received":"by 10.176.76.214 with SMTP id e22mr29293528uag.16.1505729873340; \n\tMon, 18 Sep 2017 03:17:53 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Mon, 18 Sep 2017 15:47:52 +0530","Message-ID":"<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@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::233","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 v9 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>, 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":1770066,"web_url":"http://patchwork.ozlabs.org/comment/1770066/","msgid":"<CAFEAcA9vydmYr81oMazziyi409S+DpQf+RGaCTHfRxXhPj-aYw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T10:35:04","subject":"Re: [Qemu-devel] [Qemu devel v9 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 18 September 2017 at 11:17, sundeep subbaraya <sundeep.lkml@gmail.com> wrote:\n> Hi Philippe,\n>\n> On Mon, Sep 18, 2017 at 6:31 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\n> wrote:\n>>\n>> Hi Sundeep, Peter,\n>>\n>>\n>> On 09/15/2017 01:59 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         | 168\n>>> ++++++++++++++++++++++++++++++++++++++++++\n>>>   hw/misc/trace-events          |   5 ++\n>>>   include/hw/misc/msf2-sysreg.h |  77 +++++++++++++++++++\n>>>   4 files changed, 251 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..dc3597b\n>>> --- /dev/null\n>>> +++ b/hw/misc/msf2-sysreg.c\n>>> @@ -0,0 +1,168 @@\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>>> +#include \"trace.h\"\n>>> +\n>>> +static inline int msf2_divbits(uint32_t div)\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>> eh?\n>>\n>>> +    }\n>>> +\n>>> +    return ret;\n>>> +}\n>>> +\n>>> +static void msf2_sysreg_reset(DeviceState *d)\n>>> +{\n>>> +    MSF2SysregState *s = MSF2_SYSREG(d);\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>>\n>>\n>> ctz32(s->apb0div) << 5 ...\n>\n>\n> I will modify like below:\n> div0 = s->apb0div < 8 ? ctz32(s->apb0div) : ctz32(s->apb0div) + 1;\n> div1 = s->apb1div < 8 ? ctz32(s->apb1div) : ctz32(s->apb1div) + 1;\n\nI think you should keep an msf2_divbits() function for that,\neven if it's only\n\nstatic inline int msf2_divbits(uint32_t div)\n{\n    int r = ctz32(div);\n\n    return (div < 8) ? r : r + 1;\n}\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=\"JACVHmFn\"; 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 3xwj8Z4C29z9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 20:35:58 +1000 (AEST)","from localhost ([::1]:35685 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 1dttPA-0002HX-Nq\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 06:35:56 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:49361)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dttOh-0002Fx-HH\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:35:28 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dttOg-0003js-7x\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:35:27 -0400","from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:53771)\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 1dttOg-0003je-0U\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:35:26 -0400","by mail-wr0-x22d.google.com with SMTP id l22so60847wrc.10\n\tfor <qemu-devel@nongnu.org>; Mon, 18 Sep 2017 03:35:25 -0700 (PDT)","by 10.223.139.215 with HTTP; Mon, 18 Sep 2017 03:35:04 -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=RMrTCaCAq2ZbQt7zuGuCU7OEbnjS/6n6+b0AkXAysn0=;\n\tb=JACVHmFnuP36HLXz2vlioPY2G2xeSVfkNuaYVuofJvOlFtb9veWPE46nJg1kKLHRgb\n\taaS986qurmFRUiqJ0tEJwm/vhjcuuec+byWcQFc9TMhOK2JNdanRlK1nbfDLCzqeMKv0\n\tH+h9gDvBMao2iuiKKEwgvviLC7+IA3P7upO70=","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=RMrTCaCAq2ZbQt7zuGuCU7OEbnjS/6n6+b0AkXAysn0=;\n\tb=OM3ujfCd4o+XR9QmXQYky64DlUTez7h5TqfvlIJuGON+BN1msbg3Mz17bTnn4FOsFg\n\tA/oyTVPa2cy4JmWUjpd9FbJFotu0wpIk4zGqpBFZoChZURIY9V/Q0YNhpxXczyNDNl7J\n\tpVkd3FGXU5V+cYkcL43IY8Z3wMY3WOvNPtwSBkNRIbXfRo480FXcYHBlPumyCTWBWLMQ\n\tdKL0yiBQPFCKnCWk1dbIWd2gkB3kgEj+Yh/OyjdSfDVLgJ5ixpw2axlE2Psa0ixUqxBw\n\tYTu5JILfPee68LQ5L3+O8ZKrrxMUyADNg+FzZtUhEU++cz8UzMr1UsAX/PMHIDyaL+J3\n\tiMvA==","X-Gm-Message-State":"AHPjjUi3o58Rwy1jysMhubDKF6lIVHn274DfkLfODKrbE3lQyK2WhEqf\n\t/Zf/+FXysZ+PMz2lJAX1OCA2c5XIUuIclXlM5RGC+w==","X-Google-Smtp-Source":"ADKCNb7x6xY6qe8iYZMPRxphtQENDY1EEAMY7Qfne0+UQ/qStEdfUJMANx2i6lC/Nv1qq3ooOu2b/2my6t6DG5bgwIc=","X-Received":"by 10.223.142.82 with SMTP id n76mr31055674wrb.272.1505730924909;\n\tMon, 18 Sep 2017 03:35:24 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Mon, 18 Sep 2017 11:35:04 +0100","Message-ID":"<CAFEAcA9vydmYr81oMazziyi409S+DpQf+RGaCTHfRxXhPj-aYw@mail.gmail.com>","To":"sundeep subbaraya <sundeep.lkml@gmail.com>","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::22d","Subject":"Re: [Qemu-devel] [Qemu devel v9 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":1770157,"web_url":"http://patchwork.ozlabs.org/comment/1770157/","msgid":"<CALHRZuoMibZoUf5BSqMDyY9zknui-6Jc507-c=EJ03XoV0fibQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T13:25:23","subject":"Re: [Qemu-devel] [Qemu devel v9 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":"H Peter,\n\nOn Mon, Sep 18, 2017 at 4:05 PM, Peter Maydell <peter.maydell@linaro.org>\nwrote:\n\n> On 18 September 2017 at 11:17, sundeep subbaraya <sundeep.lkml@gmail.com>\n> wrote:\n> > Hi Philippe,\n> >\n> > On Mon, Sep 18, 2017 at 6:31 AM, Philippe Mathieu-Daudé <f4bug@amsat.org\n> >\n> > wrote:\n> >>\n> >> Hi Sundeep, Peter,\n> >>\n> >>\n> >> On 09/15/2017 01:59 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         | 168\n> >>> ++++++++++++++++++++++++++++++++++++++++++\n> >>>   hw/misc/trace-events          |   5 ++\n> >>>   include/hw/misc/msf2-sysreg.h |  77 +++++++++++++++++++\n> >>>   4 files changed, 251 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..dc3597b\n> >>> --- /dev/null\n> >>> +++ b/hw/misc/msf2-sysreg.c\n> >>> @@ -0,0 +1,168 @@\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> >>> +#include \"trace.h\"\n> >>> +\n> >>> +static inline int msf2_divbits(uint32_t div)\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> >> eh?\n> >>\n> >>> +    }\n> >>> +\n> >>> +    return ret;\n> >>> +}\n> >>> +\n> >>> +static void msf2_sysreg_reset(DeviceState *d)\n> >>> +{\n> >>> +    MSF2SysregState *s = MSF2_SYSREG(d);\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> >>\n> >>\n> >> ctz32(s->apb0div) << 5 ...\n> >\n> >\n> > I will modify like below:\n> > div0 = s->apb0div < 8 ? ctz32(s->apb0div) : ctz32(s->apb0div) + 1;\n> > div1 = s->apb1div < 8 ? ctz32(s->apb1div) : ctz32(s->apb1div) + 1;\n>\n> I think you should keep an msf2_divbits() function for that,\n> even if it's only\n>\n> static inline int msf2_divbits(uint32_t div)\n> {\n>     int r = ctz32(div);\n>\n>     return (div < 8) ? r : r + 1;\n> }\n>\n> Ok will change like this.\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=\"n5a0vyrp\"; 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 3xwmwk5Xxcz9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 23:25:58 +1000 (AEST)","from localhost ([::1]:36628 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 1dtw3g-00052n-Rc\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 09:25:56 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:52195)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtw3C-00050w-Q3\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:25:29 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtw3A-0007B8-QO\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:25:26 -0400","from mail-vk0-x243.google.com ([2607:f8b0:400c:c05::243]:38774)\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 1dtw3A-0007A6-LY; Mon, 18 Sep 2017 09:25:24 -0400","by mail-vk0-x243.google.com with SMTP id o22so134089vke.5;\n\tMon, 18 Sep 2017 06:25:24 -0700 (PDT)","by 10.176.66.68 with HTTP; Mon, 18 Sep 2017 06:25:23 -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=NjTdmSPzoc4IQs40uhCbH2Jy+09Xl+UUf65hb10gcbo=;\n\tb=n5a0vyrpB5FcW/7ilEevaQv2ihL+v0/TrHXNFCCMljkru6s94W3mEF0d91733sbLqw\n\tWg83qREtUXN9LwZge4Kcm4aasbBFv3qF1RlRRt40UOvNd14UJ6ywJ5HHSKdMMOmiAlXd\n\tld5iUkygmyydMa5QnkyiSFSgRgiAt97bYFqQcdBmyy8lbrU6Sm4FtuxetYvYWNjvtM6Y\n\tQUQe0Dqs9pQzfGsxw5qmf+eldIHkyWCWzbVLWrf6l8yaSiyk95Pf8YcLjd5u9+oIRQTo\n\tPJeYJyB6wtRdKSWWxWo1l+NwE/bcnex+mF4ezILsW7GYJvIBlvTM8Kogar1kcS2tIANR\n\tRdUg==","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=NjTdmSPzoc4IQs40uhCbH2Jy+09Xl+UUf65hb10gcbo=;\n\tb=gt7cAH1H8HT7edFgPOnurGgHBXdyhaKo6YEFYgUV+35Yy0Olb9EchOKkLq8dK1EMnY\n\tDiAIMSt6+LCPXHR0c1XKDfwTHcJRko+8RBX/IS5DcVtYkFjH3pqmgjujLqwJ1TjuL73b\n\tR5q0XIAUeVqxyipKswY9IYbcISRoH+9DQDPEsWVstmg/vPmvWtnyzEgisJdoFivuVR9P\n\tFAIvbX84PvasoG+LpkFY94hURFej31wipn7kI+PrItX0i8F5cqOEYk5m/teLI3t4TvW7\n\tdu/lOOUh1fbBvwbLtbBwSnF3yUELdZHq8IsWccuhR/TWmbeMfpXbEGWrEr2m+VlmCrxr\n\tGs3g==","X-Gm-Message-State":"AHPjjUjFyL52ZaTmdotGQofjbYmyFhHLYEeQ8sORtbXWTrcf9WypwFgt\n\te3xv+oeuNDYlMRkQnH97ZrkkajnUeECR0jGhJFk=","X-Google-Smtp-Source":"AOwi7QCiGQz72z9r3hS3ixkKC+PJ+dh0bZSWUFcS2MGUtlJZelki3S8p47ko9/Wje25TL5/hRajIXM0fJPHQflnotIw=","X-Received":"by 10.31.160.204 with SMTP id\n\tj195mr25443635vke.172.1505741123684; \n\tMon, 18 Sep 2017 06:25:23 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAFEAcA9vydmYr81oMazziyi409S+DpQf+RGaCTHfRxXhPj-aYw@mail.gmail.com>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>\n\t<CAFEAcA9vydmYr81oMazziyi409S+DpQf+RGaCTHfRxXhPj-aYw@mail.gmail.com>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Mon, 18 Sep 2017 18:55:23 +0530","Message-ID":"<CALHRZuoMibZoUf5BSqMDyY9zknui-6Jc507-c=EJ03XoV0fibQ@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\"","Content-Transfer-Encoding":"quoted-printable","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu devel v9 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":1770159,"web_url":"http://patchwork.ozlabs.org/comment/1770159/","msgid":"<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T13:27:02","subject":"Re: [Qemu-devel] [Qemu devel v9 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 Peter,\n\nOn Mon, Sep 18, 2017 at 3:47 PM, sundeep subbaraya <sundeep.lkml@gmail.com>\nwrote:\n\n> Hi Philippe,\n>\n> On Mon, Sep 18, 2017 at 6:31 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\n> wrote:\n>\n>> Hi Sundeep, Peter,\n>>\n>>\n>> On 09/15/2017 01:59 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         | 168 ++++++++++++++++++++++++++++++\n>>> ++++++++++++\n>>>   hw/misc/trace-events          |   5 ++\n>>>   include/hw/misc/msf2-sysreg.h |  77 +++++++++++++++++++\n>>>   4 files changed, 251 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..dc3597b\n>>> --- /dev/null\n>>> +++ b/hw/misc/msf2-sysreg.c\n>>> @@ -0,0 +1,168 @@\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>>> +#include \"trace.h\"\n>>> +\n>>> +static inline int msf2_divbits(uint32_t div)\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>> eh?\n>>\n>> +    }\n>>> +\n>>> +    return ret;\n>>> +}\n>>> +\n>>> +static void msf2_sysreg_reset(DeviceState *d)\n>>> +{\n>>> +    MSF2SysregState *s = MSF2_SYSREG(d);\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>>>\n>>\n>> ctz32(s->apb0div) << 5 ...\n>\n>\n> I will modify like below:\n> div0 = s->apb0div < 8 ? ctz32(s->apb0div) : ctz32(s->apb0div) + 1;\n> div1 = s->apb1div < 8 ? ctz32(s->apb1div) : ctz32(s->apb1div) + 1;\n> s->regs[MSSDDR_FACC1_CR] = div0 << 5 | div1 << 2;\n>\n>\n>>\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>>> +        ret = s->regs[offset];\n>>> +        trace_msf2_sysreg_read(offset << 2, ret);\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>>> +    offset >>= 2;\n>>> +\n>>> +    switch (offset) {\n>>> +    case MSSDDR_PLL_STATUS:\n>>> +        trace_msf2_sysreg_write_pll_status();\n>>> +        break;\n>>> +\n>>> +    case ESRAM_CR:\n>>> +    case DDR_CR:\n>>> +    case ENVM_REMAP_BASE_CR:\n>>> +        if (newval != s->regs[offset]) {\n>>> +            qemu_log_mask(LOG_UNIMP,\n>>> +                       TYPE_MSF2_SYSREG\": remapping not supported\\n\");\n>>>\n>>\n>> I'd rather exit here than continue with inconsistent cpu, Peter what do\n>> you recommend?\n>\n>\nCould you please suggest.\n\nThanks,\nSundeep\n\n>\n>>\n>> +        }\n>>> +        break;\n>>> +\n>>> +    default:\n>>> +        if (offset < ARRAY_SIZE(s->regs)) {\n>>> +            trace_msf2_sysreg_write(offset << 2, newval,\n>>> s->regs[offset]);\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>>> +static const MemoryRegionOps sysreg_ops = {\n>>> +    .read = msf2_sysreg_read,\n>>> +    .write = msf2_sysreg_write,\n>>> +    .endianness = DEVICE_NATIVE_ENDIAN,\n>>> +};\n>>> +\n>>> +static void msf2_sysreg_init(Object *obj)\n>>> +{\n>>> +    MSF2SysregState *s = MSF2_SYSREG(obj);\n>>> +\n>>> +    memory_region_init_io(&s->iomem, obj, &sysreg_ops, s,\n>>> TYPE_MSF2_SYSREG,\n>>> +                          MSF2_SYSREG_MMIO_SIZE);\n>>> +    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);\n>>> +}\n>>> +\n>>> +static const VMStateDescription vmstate_msf2_sysreg = {\n>>> +    .name = TYPE_MSF2_SYSREG,\n>>> +    .version_id = 1,\n>>> +    .minimum_version_id = 1,\n>>> +    .fields = (VMStateField[]) {\n>>> +        VMSTATE_UINT32_ARRAY(regs, MSF2SysregState,\n>>> MSF2_SYSREG_MMIO_SIZE / 4),\n>>> +        VMSTATE_END_OF_LIST()\n>>> +    }\n>>> +};\n>>> +\n>>> +static Property msf2_sysreg_properties[] = {\n>>> +    /* default divisors in Libero GUI */\n>>> +    DEFINE_PROP_UINT32(\"apb0divisor\", MSF2SysregState, apb0div, 2),\n>>> +    DEFINE_PROP_UINT32(\"apb1divisor\", MSF2SysregState, apb1div, 2),\n>>>\n>>\n>> DEFINE_PROP_UINT8() is enough for both.\n>>\n>> Beware these divisors must be power of 2, and maximum 32.\n>\n> This can be checked in msf2_sysreg_realize() ...\n>\n>\n> Ok\n>\n>>\n>>\n>> +    DEFINE_PROP_END_OF_LIST(),\n>>> +};\n>>> +\n>>> +static void msf2_sysreg_class_init(ObjectClass *klass, void *data)\n>>> +{\n>>> +    DeviceClass *dc = DEVICE_CLASS(klass);\n>>> +\n>>> +    dc->vmsd = &vmstate_msf2_sysreg;\n>>> +    dc->reset = msf2_sysreg_reset;\n>>>\n>>\n>> ... which would go here:\n>>\n>>        dc->realize = msf2_sysreg_realize;\n>>\n>> Ok.\n>\n>>\n>> +    dc->props = msf2_sysreg_properties;\n>>> +}\n>>> +\n>>> +static const TypeInfo msf2_sysreg_info = {\n>>> +    .name  = TYPE_MSF2_SYSREG,\n>>> +    .parent = TYPE_SYS_BUS_DEVICE,\n>>> +    .class_init = msf2_sysreg_class_init,\n>>> +    .instance_size  = sizeof(MSF2SysregState),\n>>> +    .instance_init = msf2_sysreg_init,\n>>> +};\n>>> +\n>>> +static void msf2_sysreg_register_types(void)\n>>> +{\n>>> +    type_register_static(&msf2_sysreg_info);\n>>> +}\n>>> +\n>>> +type_init(msf2_sysreg_register_types)\n>>> diff --git a/hw/misc/trace-events b/hw/misc/trace-events\n>>> index 3313585..616579a 100644\n>>> --- a/hw/misc/trace-events\n>>> +++ b/hw/misc/trace-events\n>>> @@ -61,3 +61,8 @@ mps2_scc_reset(void) \"MPS2 SCC: reset\"\n>>>   mps2_scc_leds(char led7, char led6, char led5, char led4, char led3,\n>>> char led2, char led1, char led0) \"MPS2 SCC LEDs: %c%c%c%c%c%c%c%c\"\n>>>   mps2_scc_cfg_write(unsigned function, unsigned device, uint32_t value)\n>>> \"MPS2 SCC config write: function %d device %d data 0x%\" PRIx32\n>>>   mps2_scc_cfg_read(unsigned function, unsigned device, uint32_t value)\n>>> \"MPS2 SCC config read: function %d device %d data 0x%\" PRIx32\n>>> +\n>>> +# hw/misc/msf2-sysreg.c\n>>> +msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev)\n>>> \"msf2-sysreg write: addr 0x%08\" HWADDR_PRIx \" data 0x%\" PRIx32 \" prev 0x%\"\n>>> PRIx32\n>>> +msf2_sysreg_read(uint64_t offset, uint32_t val) \"msf2-sysreg read: addr\n>>> 0x%08\" HWADDR_PRIx \" data 0x%08\" PRIx32\n>>> +msf2_sysreg_write_pll_status(void) \"Invalid write to read only PLL\n>>> status register\"\n>>> diff --git a/include/hw/misc/msf2-sysreg.h\n>>> b/include/hw/misc/msf2-sysreg.h\n>>> new file mode 100644\n>>> index 0000000..231f827\n>>> --- /dev/null\n>>> +++ b/include/hw/misc/msf2-sysreg.h\n>>> @@ -0,0 +1,77 @@\n>>> +/*\n>>> + * Microsemi SmartFusion2 SYSREG\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_MSF2_SYSREG_H\n>>> +#define HW_MSF2_SYSREG_H\n>>> +\n>>> +#include \"hw/sysbus.h\"\n>>> +\n>>> +enum {\n>>> +    ESRAM_CR        = 0x00 / 4,\n>>> +    ESRAM_MAX_LAT,\n>>> +    DDR_CR,\n>>> +    ENVM_CR,\n>>> +    ENVM_REMAP_BASE_CR,\n>>> +    ENVM_REMAP_FAB_CR,\n>>> +    CC_CR,\n>>> +    CC_REGION_CR,\n>>> +    CC_LOCK_BASE_ADDR_CR,\n>>> +    CC_FLUSH_INDX_CR,\n>>> +    DDRB_BUF_TIMER_CR,\n>>> +    DDRB_NB_ADDR_CR,\n>>> +    DDRB_NB_SIZE_CR,\n>>> +    DDRB_CR,\n>>> +\n>>> +    SOFT_RESET_CR  = 0x48 / 4,\n>>> +    M3_CR,\n>>> +\n>>> +    GPIO_SYSRESET_SEL_CR = 0x58 / 4,\n>>> +\n>>> +    MDDR_CR = 0x60 / 4,\n>>> +\n>>> +    MSSDDR_PLL_STATUS_LOW_CR = 0x90 / 4,\n>>> +    MSSDDR_PLL_STATUS_HIGH_CR,\n>>> +    MSSDDR_FACC1_CR,\n>>> +    MSSDDR_FACC2_CR,\n>>> +\n>>> +    MSSDDR_PLL_STATUS = 0x150 / 4,\n>>> +};\n>>> +\n>>> +#define MSF2_SYSREG_MMIO_SIZE     0x300\n>>> +\n>>> +#define TYPE_MSF2_SYSREG          \"msf2-sysreg\"\n>>> +#define MSF2_SYSREG(obj)  OBJECT_CHECK(MSF2SysregState, (obj),\n>>> TYPE_MSF2_SYSREG)\n>>> +\n>>> +typedef struct MSF2SysregState {\n>>> +    SysBusDevice parent_obj;\n>>> +\n>>> +    MemoryRegion iomem;\n>>> +\n>>> +    uint32_t apb0div;\n>>> +    uint32_t apb1div;\n>>>\n>>\n>> uint8_t for both\n>\n>\n> Ok.\n>\n>>\n>>\n>> +\n>>> +    uint32_t regs[MSF2_SYSREG_MMIO_SIZE / 4];\n>>> +} MSF2SysregState;\n>>> +\n>>> +#endif /* HW_MSF2_SYSREG_H */\n>>>\n>>>\n>> Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n>> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n>>\n>\n> Thank you,\n> Sundeep\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=\"Lgiau+In\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (unknown [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 3xwmyx3fwVz9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 23:27:51 +1000 (AEST)","from localhost ([::1]:36637 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 1dtw5L-0006DZ-BZ\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 09:27:39 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53507)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtw4o-0006B2-R7\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:27:09 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dtw4l-00083b-TP\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:27:06 -0400","from mail-vk0-x233.google.com ([2607:f8b0:400c:c05::233]:53703)\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 1dtw4l-00083Q-LQ; Mon, 18 Sep 2017 09:27:03 -0400","by mail-vk0-x233.google.com with SMTP id m140so239981vka.10;\n\tMon, 18 Sep 2017 06:27:03 -0700 (PDT)","by 10.176.66.68 with HTTP; Mon, 18 Sep 2017 06:27: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=41ySk0/p0kWmyNkN0ndYZomOaSSS0uA2qvPl0sLOsPg=;\n\tb=Lgiau+In9hh5fx69GaW8CXcdkGxqfj3y/tQs11ARjDRMazjLxWT2YG5UUBO+ep5Pz9\n\tD1N0/kaYpXZKrPKPR+BiyIWAZH0pgojtK8ZAmgVKGxv5KjdyOeq6U0ZeUEAPlOHPI1hg\n\tclc2NYxegKO6EuBgT06xRSibn+Ht3ZLuKBzNfqYMstMamfUkw5AEucHxt60KAODVDUmK\n\tkuyc6k8PPC0ok2kLJ5hyKULmcXDpc3PL2BVEg4IimiwFteFk7VMsgR28FGP17l95P1O7\n\tUmzo8N7qox5LUnpXxK1g4f8muw7efGPmxvGui09hMR175JEQEWBqWReHgZTLSMzwCzL4\n\t5u2Q==","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=41ySk0/p0kWmyNkN0ndYZomOaSSS0uA2qvPl0sLOsPg=;\n\tb=GQwSqkA2dR9vmwxcCoEZCsvkXLjY8aroUqGFtlwHsbQaOzUlBesjyR0KfhX71nIEtS\n\tWz9yMuesipACP7UAo4JwMgSySJYEjVVJOR78eZCg3LB8XNaO1Neubm776Hi2JSkHEr9f\n\tw+pV+gE0ffgkpe2gPYEoXzzhK+GAbFoZHLq66pLD/ukACLpBV9jwZxl4xsCE5RfZ/RwT\n\tQG1WXHo7EYU1GSlv//lHphVnZtI/3sb4ZWntWamLBF7t4TrafTUOUvaEgT6yFuG7WNpt\n\tgmPTF3IXmKCdMUVCWIs4jPc5bRII5UefYHb1K6XiY3SFyXS9I1sY7IVRcLnXNtvU046S\n\tJqxg==","X-Gm-Message-State":"AHPjjUjM3PcAgEP/hQJOs94x/fsAGa1X72Fyv05Q0xuR7p2snr6ntHrD\n\tkCVYIOD6t7dGhSOeJ2ds+4AOtnE4eh8BCrDaLzE=","X-Google-Smtp-Source":"AOwi7QDiMLbpKzEgli2Q4C3n4UEq83Xgvr2fss99AihlokmBE00/nSXf6EJisoItxlKURYx32MX8mRPTqw9IBfkIYBo=","X-Received":"by 10.31.195.195 with SMTP id t186mr1050092vkf.198.1505741223040;\n\tMon, 18 Sep 2017 06:27:03 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>","From":"sundeep subbaraya <sundeep.lkml@gmail.com>","Date":"Mon, 18 Sep 2017 18:57:02 +0530","Message-ID":"<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@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::233","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 v9 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>, 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":1770164,"web_url":"http://patchwork.ozlabs.org/comment/1770164/","msgid":"<CAFEAcA-BQ=ognSsb3Kxx5ThJ5Q_GA_sFFFofpKY1=XnRS4-WTA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T13:36:23","subject":"Re: [Qemu-devel] [Qemu devel v9 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 18 September 2017 at 14:27, sundeep subbaraya <sundeep.lkml@gmail.com> wrote:\n> Hi Peter,\n>\n> On Mon, Sep 18, 2017 at 3:47 PM, sundeep subbaraya <sundeep.lkml@gmail.com>\n> wrote:\n>>\n>> Hi Philippe,\n>>\n>> On Mon, Sep 18, 2017 at 6:31 AM, Philippe Mathieu-Daudé <f4bug@amsat.org>\n>> wrote:\n>>>\n>>> Hi Sundeep, Peter,\n>>>\n>>>\n>>> On 09/15/2017 01:59 PM, Subbaraya Sundeep wrote:\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>>>> +    offset >>= 2;\n>>>> +\n>>>> +    switch (offset) {\n>>>> +    case MSSDDR_PLL_STATUS:\n>>>> +        trace_msf2_sysreg_write_pll_status();\n>>>> +        break;\n>>>> +\n>>>> +    case ESRAM_CR:\n>>>> +    case DDR_CR:\n>>>> +    case ENVM_REMAP_BASE_CR:\n>>>> +        if (newval != s->regs[offset]) {\n>>>> +            qemu_log_mask(LOG_UNIMP,\n>>>> +                       TYPE_MSF2_SYSREG\": remapping not supported\\n\");\n>>>\n>>>\n>>> I'd rather exit here than continue with inconsistent cpu, Peter what do\n>>> you recommend?\n>\n>\n> Could you please suggest.\n\nWe shouldn't exit QEMU for something the guest can provoke. If\nthe functionality isn't implemented then just LOG_UNIMP it.\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=\"kukxe3bk\"; 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 3xwn9m1z16z9s4s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 23:37:12 +1000 (AEST)","from localhost ([::1]:36692 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 1dtwEY-00012B-3L\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 09:37:10 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57835)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtwEA-00011h-36\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:36:46 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtwE9-00059W-9R\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:36:46 -0400","from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:43707)\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 1dtwE9-00058d-35\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:36:45 -0400","by mail-wm0-x22f.google.com with SMTP id a137so13238492wma.0\n\tfor <qemu-devel@nongnu.org>; Mon, 18 Sep 2017 06:36:44 -0700 (PDT)","by 10.223.139.215 with HTTP; Mon, 18 Sep 2017 06:36:23 -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=Hf5RclMcj7iqc/1sK8lpa9wH+BLwvgtHjMmeFN3O6Qs=;\n\tb=kukxe3bk5yK6c+xOl/STufZRNShu5bx1zguLdlpLoEXPQFN35PgZKfFzSXQfd6aSSH\n\tpsAxVU97wLQW0sQkl1QsUbpDpYGmODpFQDC8Jrrc9zFwuPowIgwqgZeFFLSOW9mGZ5mb\n\td8woyrqVflN9JyOGOLPiwzXXWu3ypJX7bELro=","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=Hf5RclMcj7iqc/1sK8lpa9wH+BLwvgtHjMmeFN3O6Qs=;\n\tb=pj1GwUk11GDBvcPT2IV2KGmk9HzrxgnwgOjgdJugec0Sz/SJielXQgIFq/ZekDZR9A\n\tXV5V5IGk/0nCajQCzl8rvshpropx+vskVS4+TXbMr63qRTEY5dildeT5eTAIExvZS24e\n\tkdQLZ5kqCAYKw9Pz4khzWWcs8kGZIkXYknXOAxb1wa7FX/VYYdeU2Nj8eeyZO8Zngt01\n\tbXzIjkAOmD0/3z9YX5KXwVaQhmQXBdkXZqrrEJYWGFNO8xpsMt6mfTkvpj842g42hfal\n\ttign1sbOlK2WGUxXpUSr2EjCoWWNbjbFOUvSb5eNJd+wNtLkt3OWCwQU1Lnaqn8p1JWc\n\tBR1A==","X-Gm-Message-State":"AHPjjUi3trYYZh3UIwaWBgpbmOywV1p62QTNn/dIF6q7G6P7On8tQdBo\n\tVIFk0kNusN+IzqcWskpzBIMavYzP/hgu2JZvwtgysA==","X-Google-Smtp-Source":"AOwi7QB+M46741AB33Cg3JIEK6nvYLnv+wUHsVxdnhTAt6Z0cP4/rQcDGtfiDGjmSMIanJ7hwi65uCDOs3kWUvv3Ckk=","X-Received":"by 10.28.43.129 with SMTP id r123mr8780796wmr.101.1505741804000; \n\tMon, 18 Sep 2017 06:36:44 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@mail.gmail.com>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>\n\t<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@mail.gmail.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Mon, 18 Sep 2017 14:36:23 +0100","Message-ID":"<CAFEAcA-BQ=ognSsb3Kxx5ThJ5Q_GA_sFFFofpKY1=XnRS4-WTA@mail.gmail.com>","To":"sundeep subbaraya <sundeep.lkml@gmail.com>","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::22f","Subject":"Re: [Qemu-devel] [Qemu devel v9 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":1770184,"web_url":"http://patchwork.ozlabs.org/comment/1770184/","msgid":"<6947945c-6b04-dce0-9010-b3350df0f151@amsat.org>","list_archive_url":null,"date":"2017-09-18T13:58:06","subject":"Re: [Qemu-devel] [Qemu devel v9 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 Peter,\n\nOn 09/18/2017 10:36 AM, Peter Maydell wrote:\n> On 18 September 2017 at 14:27, sundeep subbaraya <sundeep.lkml@gmail.com> wrote:\n>>>> Hi Sundeep, Peter,\n>>>>\n>>>>\n>>>> On 09/15/2017 01:59 PM, Subbaraya Sundeep wrote:\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>>>>> +    offset >>= 2;\n>>>>> +\n>>>>> +    switch (offset) {\n>>>>> +    case MSSDDR_PLL_STATUS:\n>>>>> +        trace_msf2_sysreg_write_pll_status();\n>>>>> +        break;\n>>>>> +\n>>>>> +    case ESRAM_CR:\n>>>>> +    case DDR_CR:\n>>>>> +    case ENVM_REMAP_BASE_CR:\n>>>>> +        if (newval != s->regs[offset]) {\n>>>>> +            qemu_log_mask(LOG_UNIMP,\n>>>>> +                       TYPE_MSF2_SYSREG\": remapping not supported\\n\");\n>>>>\n>>>>\n>>>> I'd rather exit here than continue with inconsistent cpu, Peter what do\n>>>> you recommend?\n>>\n>>\n>> Could you please suggest.\n> \n> We shouldn't exit QEMU for something the guest can provoke. If\n> the functionality isn't implemented then just LOG_UNIMP it.\n\nThis was commented here:\nhttp://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg02971.html\n\nGuest remapping code is like non-return function. Hardware error here \ncan not happen, so there is no more guest code after a remap request.\nContinuing running QEMU will lead to chaos, that's why I recommend \naborting instead of just LOG_UNIMP it.\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=\"t4paXiop\"; 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 3xwng12ZFqz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 23:59:09 +1000 (AEST)","from localhost ([::1]:36772 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 1dtwZn-0000rf-Fh\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 09:59:07 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37657)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtwZ3-0000ej-R9\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:58:25 -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 1dtwYy-0000Z9-12\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:58:21 -0400","from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:36027)\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 1dtwYs-0000UW-PL; Mon, 18 Sep 2017 09:58:10 -0400","by mail-qk0-x243.google.com with SMTP id i14so370321qke.3;\n\tMon, 18 Sep 2017 06:58:10 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tv78sm5699545qkg.22.2017.09.18.06.58.07\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 18 Sep 2017 06:58:09 -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=AJom85bj567jCIA+pbuotyTGpV21/lhAHbcQCP++beM=;\n\tb=t4paXiopfuJ1xgTFtEKVq3GxfeHZN0eTYDGjrkwg/Wahwr7vHyj3NAZ8J8g2sckxfX\n\t/Zabm/1i4DaGSvnnyQa8mWShZmofCRxnEfwu1OF+HYOmJcWxiwqgBZxdDyNG4pxUnoVU\n\tgVciTiPeUJG/NXInG/IgSCfhB1MsbnBbZGGLY3fmyWfyf6HJy4oyoYZkz+S3Tu9gKgyt\n\t3E7K/Nt0POd55kMt74SPjLz8AbAW8tUQ/1NC/TSgRKfdSroHnHHc5XVbPB32BA6EhfCp\n\txHiSdhVA9AskdYPZ05K3d4Tj7SHNJRj8eaX61OLWchyGoqt5iQfkDqg5do+EC7zT1UkJ\n\tdANw==","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=AJom85bj567jCIA+pbuotyTGpV21/lhAHbcQCP++beM=;\n\tb=IUGxk2KL22CJbF2g2nORXFSJy7vQKoj6aCSCC2u2c7wqUDUOBn6pNU7+94dNuYSpRC\n\tgXLr4RcU5ac9vIC5Y6DVXs8nTUJT3SFIBYZUZg5pd+v9j34ivv9G1CvzR0z1fOz93+6E\n\tG/tX7DG1rpdnxlOh381hyjYE/yXC5zdCHU2gJUhKcmwJb4yZwqUPB+gchAob3vQ3eySo\n\teHoZDyfXaeSOCvnz+iFF+uWHpk9iQp10D7gwL4EpKP9wtqjLW2IJ1qr394ItuDf3tKfz\n\tmhQgeyRxU/R7m/HBSETOnp14/QDmXqzzagUJJ/LzwCLN9/WBZtFd3ufznhRVSK1qJA7A\n\tG61w==","X-Gm-Message-State":"AHPjjUhI8uCs1K7//QqeotF0wtf380xfBILy2PeA/je/rUxIhldElwPN\n\tkEfczAtGYGKctQ==","X-Google-Smtp-Source":"AOwi7QCYjcs3YGI7cjrww6a6RmDNQOJaaF8r8RlKmRwizYI2tyNuGlZkmMypr5g6jFAiIgEstSiCng==","X-Received":"by 10.55.33.216 with SMTP id f85mr20663409qki.176.1505743090139; \n\tMon, 18 Sep 2017 06:58:10 -0700 (PDT)","To":"Peter Maydell <peter.maydell@linaro.org>,\n\tsundeep subbaraya <sundeep.lkml@gmail.com>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>\n\t<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@mail.gmail.com>\n\t<CAFEAcA-BQ=ognSsb3Kxx5ThJ5Q_GA_sFFFofpKY1=XnRS4-WTA@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<6947945c-6b04-dce0-9010-b3350df0f151@amsat.org>","Date":"Mon, 18 Sep 2017 10:58:06 -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-BQ=ognSsb3Kxx5ThJ5Q_GA_sFFFofpKY1=XnRS4-WTA@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::243","Subject":"Re: [Qemu-devel] [Qemu devel v9 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":1770188,"web_url":"http://patchwork.ozlabs.org/comment/1770188/","msgid":"<CAFEAcA8yHmZBgudTbW7S6eoObYE_O=CP3YjfL7g7GGip=wsjaA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T14:00:42","subject":"Re: [Qemu-devel] [Qemu devel v9 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 18 September 2017 at 14:58, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:\n> Hi Peter,\n>\n> On 09/18/2017 10:36 AM, Peter Maydell wrote:\n>>\n>> On 18 September 2017 at 14:27, sundeep subbaraya <sundeep.lkml@gmail.com>\n>> wrote:\n>>>>>\n>>>>> Hi Sundeep, Peter,\n>>>>>\n>>>>>\n>>>>> On 09/15/2017 01:59 PM, Subbaraya Sundeep wrote:\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>>>>>> +    offset >>= 2;\n>>>>>> +\n>>>>>> +    switch (offset) {\n>>>>>> +    case MSSDDR_PLL_STATUS:\n>>>>>> +        trace_msf2_sysreg_write_pll_status();\n>>>>>> +        break;\n>>>>>> +\n>>>>>> +    case ESRAM_CR:\n>>>>>> +    case DDR_CR:\n>>>>>> +    case ENVM_REMAP_BASE_CR:\n>>>>>> +        if (newval != s->regs[offset]) {\n>>>>>> +            qemu_log_mask(LOG_UNIMP,\n>>>>>> +                       TYPE_MSF2_SYSREG\": remapping not\n>>>>>> supported\\n\");\n>>>>>\n>>>>>\n>>>>>\n>>>>> I'd rather exit here than continue with inconsistent cpu, Peter what do\n>>>>> you recommend?\n>>>\n>>>\n>>>\n>>> Could you please suggest.\n>>\n>>\n>> We shouldn't exit QEMU for something the guest can provoke. If\n>> the functionality isn't implemented then just LOG_UNIMP it.\n>\n>\n> This was commented here:\n> http://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg02971.html\n>\n> Guest remapping code is like non-return function. Hardware error here can\n> not happen, so there is no more guest code after a remap request.\n> Continuing running QEMU will lead to chaos, that's why I recommend aborting\n> instead of just LOG_UNIMP it.\n\nThere's lots of stuff that can cause the guest to go badly\nand confusingly wrong if unimplemented. If we print a\nuseful message with LOG_UNIMP then there's an easy clue\nfor what's gone wrong. The guest shouldn't be able to\nprovoke QEMU to exit.\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=\"Fw+Zo0ec\"; 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 3xwntb0V43z9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 00:09:09 +1000 (AEST)","from localhost ([::1]:36839 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 1dtwjT-0000tx-7e\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 10:09:07 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:39235)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtwbh-0002ya-Qv\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:01:10 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtwbg-0002BN-To\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:01:05 -0400","from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:49401)\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 1dtwbg-0002B2-O2\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:01:04 -0400","by mail-wm0-x22f.google.com with SMTP id e71so2983077wmg.4\n\tfor <qemu-devel@nongnu.org>; Mon, 18 Sep 2017 07:01:04 -0700 (PDT)","by 10.223.139.215 with HTTP; Mon, 18 Sep 2017 07:00:42 -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=iCh9a/Hz2Ub6x+y/l6Y7NFlqI/vhMIBRgonfM6pCuYE=;\n\tb=Fw+Zo0ecb4rbSwYFRC25F/C0CpVPIju8RYP+doKNN3F4AwR+aM//os1R/vB+6uD14z\n\tmSRhQzldooE5jwPXW2CEne22B65j6fnECMQqTkaB8jRMdW9Ps+U7zm0euKwKSlzBtP6a\n\tCpFaUOuz+UL36oDtL2bs03jSo7SX21OXSqqBs=","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=iCh9a/Hz2Ub6x+y/l6Y7NFlqI/vhMIBRgonfM6pCuYE=;\n\tb=DTTRV6qGDwRc5mhkn98s+nXuygT9JQjPipcxiDTj8KR32BfvzNzqI0OUlBbxszUd8b\n\tS/eeU6iqS5xDSF3keowWnNm6vS9mrGfcskiARG4QmKB7CJjkyu2YQAyUXEc8GKoZv+dZ\n\tpbzKg3rwF+FkXiN2N3CyfooUyJ967yzB5moWs/929PUn9fD8uWjmOF9alW1hrn/ILG56\n\t9wJJS9sEAek46caFCUsYqO5/VZUybSoWX/I6YCeI7qEswh9KlZWt8rCyOM29gBE42dUk\n\tHYrepxv2kpw7qV/8ZBDobF40zog21fAnySJa+82DQr8GPJrMFdeRvNNeyitOCsZRrHD5\n\tMJog==","X-Gm-Message-State":"AHPjjUigFhLLohb7fnIaPByJMh3zKmY8VJklrbNUlxm/u/yXJM3e9gGc\n\tQBg918TPVCbzuQzy3S9dcV6FwWZtj/Gh1dBc2WF90Q==","X-Google-Smtp-Source":"AOwi7QD7gL6uIfcXaUiWNdjxdKWtxi0sL9oONHXRwx6t3+XjEDa/8HwzKC3mtpEQ1fk8YvoaV5aNmO+mkKfNeMZNQoE=","X-Received":"by 10.28.102.213 with SMTP id a204mr8451644wmc.151.1505743263473;\n\tMon, 18 Sep 2017 07:01:03 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<6947945c-6b04-dce0-9010-b3350df0f151@amsat.org>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>\n\t<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@mail.gmail.com>\n\t<CAFEAcA-BQ=ognSsb3Kxx5ThJ5Q_GA_sFFFofpKY1=XnRS4-WTA@mail.gmail.com>\n\t<6947945c-6b04-dce0-9010-b3350df0f151@amsat.org>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Mon, 18 Sep 2017 15:00:42 +0100","Message-ID":"<CAFEAcA8yHmZBgudTbW7S6eoObYE_O=CP3YjfL7g7GGip=wsjaA@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::22f","Subject":"Re: [Qemu-devel] [Qemu devel v9 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\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":1770198,"web_url":"http://patchwork.ozlabs.org/comment/1770198/","msgid":"<1abcfaca-3af0-efcf-d577-c3c5cb39e8fe@amsat.org>","list_archive_url":null,"date":"2017-09-18T14:22:28","subject":"Re: [Qemu-devel] [Qemu devel v9 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":"On 09/18/2017 11:00 AM, Peter Maydell wrote:\n> On 18 September 2017 at 14:58, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:\n>> Hi Peter,\n>>\n>> On 09/18/2017 10:36 AM, Peter Maydell wrote:\n>>>\n>>> On 18 September 2017 at 14:27, sundeep subbaraya <sundeep.lkml@gmail.com>\n>>> wrote:\n>>>>>>\n>>>>>> Hi Sundeep, Peter,\n>>>>>>\n>>>>>>\n>>>>>> On 09/15/2017 01:59 PM, Subbaraya Sundeep wrote:\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>>>>>>> +    offset >>= 2;\n>>>>>>> +\n>>>>>>> +    switch (offset) {\n>>>>>>> +    case MSSDDR_PLL_STATUS:\n>>>>>>> +        trace_msf2_sysreg_write_pll_status();\n>>>>>>> +        break;\n>>>>>>> +\n>>>>>>> +    case ESRAM_CR:\n>>>>>>> +    case DDR_CR:\n>>>>>>> +    case ENVM_REMAP_BASE_CR:\n>>>>>>> +        if (newval != s->regs[offset]) {\n>>>>>>> +            qemu_log_mask(LOG_UNIMP,\n>>>>>>> +                       TYPE_MSF2_SYSREG\": remapping not\n>>>>>>> supported\\n\");\n>>>>>>\n>>>>>>\n>>>>>>\n>>>>>> I'd rather exit here than continue with inconsistent cpu, Peter what do\n>>>>>> you recommend?\n>>>>\n>>>>\n>>>>\n>>>> Could you please suggest.\n>>>\n>>>\n>>> We shouldn't exit QEMU for something the guest can provoke. If\n>>> the functionality isn't implemented then just LOG_UNIMP it.\n>>\n>>\n>> This was commented here:\n>> http://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg02971.html\n>>\n>> Guest remapping code is like non-return function. Hardware error here can\n>> not happen, so there is no more guest code after a remap request.\n>> Continuing running QEMU will lead to chaos, that's why I recommend aborting\n>> instead of just LOG_UNIMP it.\n> \n> There's lots of stuff that can cause the guest to go badly\n> and confusingly wrong if unimplemented. If we print a\n> useful message with LOG_UNIMP then there's an easy clue\n> for what's gone wrong. The guest shouldn't be able to\n> provoke QEMU to exit.\n\nI understand. I'm worried about being PITA for an user to figure out \nwhat's happening here, that's why I'm wondering how this should be \nhandled. Another idea I thought about was raising a PREFETCH or BKPT \nexception, but this would also be an incorrect model behavior.\n\nAnyway I'd be happy enough if instead of using LOG_UNIMP/LOG_GUEST_ERROR \nwe use an unconditional qemu_log(\"bus remap unimplemented, unpredictable \nbehaviour!\") warning. Fair enough?\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=\"ouPYm9pb\"; 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 3xwpDR3lrbz9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 00:24:38 +1000 (AEST)","from localhost ([::1]:36960 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 1dtwyS-0005m3-9c\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 10:24:36 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:49536)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtwwi-0004fx-AC\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:22:49 -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 1dtwwd-0006Rw-AR\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:22:48 -0400","from mail-qt0-x231.google.com ([2607:f8b0:400d:c0d::231]:53852)\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 1dtwwS-0006In-Co; Mon, 18 Sep 2017 10:22:32 -0400","by mail-qt0-x231.google.com with SMTP id 47so680535qts.10;\n\tMon, 18 Sep 2017 07:22:32 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tv32sm5342007qtc.66.2017.09.18.07.22.29\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 18 Sep 2017 07:22:31 -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=+5SQ3oQokrXPQeydF3fwALTlT/r6sVFyhKoaqhYx/qU=;\n\tb=ouPYm9pbxeJV5aythEv11jXUD4afrW30d1+IaLay0SpLy7G2EdnfxfLev6Nh+Mb+Sr\n\t10OdMmam+utlzcew3QMYdRFoPhwuEtaMshp+wovvDBXHMeGwUtSNJgHiLjOUotwPm0w1\n\tP7qZTjS2nQqw4GhInYoeE1JyTvg/UBsiyicPrX0AFSCCu23shjpLlpbtxNQuiemT7Xva\n\tse0MGJZGBHiLEtYz/WRR9EDSrkooQK9FFq1L3GNdYeGE8pydJ3566ejqbzWFKGEreo3a\n\tFf54dJciS9VUaA1HdEDkkVxZCBenKj1+Psk20U3tXE2/0FLCXwBqaVZfxlS9CE2LKjAM\n\te1Tw==","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=+5SQ3oQokrXPQeydF3fwALTlT/r6sVFyhKoaqhYx/qU=;\n\tb=KV79OhMGVc210TWQurjtygek1Lxt2qOkp9m6lJwTUWGX1IxN9zuIGAaTZCcDgE+hsH\n\ts8AIlL05vEkw0wwe0X6kaB7G7XP1FufyHnxahiYIGJ6n55O6l5JUmZ+9dhndAa7AygAw\n\tAXj5Q0DELOjMCihbRxEwrPX6noikfqmJdw1/5kNRDaMF4XcK2/U96htGA5AuLrp57tYU\n\tjufVpaNP6CDzxSsnGzZRNgArDOD4qeeNO265RMgc1k/LNZTd6CicC+hsZb8AAB0ZbdHw\n\tOTpPE/mcd6DBofVy3yDzcrcPYzvClRhiu4DMkbMcwLX7xVmlqwkLthtgHD2019JVqKI0\n\txtfQ==","X-Gm-Message-State":"AHPjjUgVWlNINZWba+kE8WrtQXS/Pxu5hATueej4erwrzjcXF1/n0cOr\n\tfj9hRh8aOCAjQw==","X-Google-Smtp-Source":"AOwi7QAljWX3q+/tpanOXIJH4juWw2R+IQzy+OzBsUG+Tc1OEmKndT8VwvM2JKAKQaojxfsj07+ExA==","X-Received":"by 10.200.40.250 with SMTP id j55mr11480144qtj.169.1505744551709;\n\tMon, 18 Sep 2017 07:22:31 -0700 (PDT)","To":"Peter Maydell <peter.maydell@linaro.org>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>\n\t<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@mail.gmail.com>\n\t<CAFEAcA-BQ=ognSsb3Kxx5ThJ5Q_GA_sFFFofpKY1=XnRS4-WTA@mail.gmail.com>\n\t<6947945c-6b04-dce0-9010-b3350df0f151@amsat.org>\n\t<CAFEAcA8yHmZBgudTbW7S6eoObYE_O=CP3YjfL7g7GGip=wsjaA@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<1abcfaca-3af0-efcf-d577-c3c5cb39e8fe@amsat.org>","Date":"Mon, 18 Sep 2017 11:22:28 -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":"<CAFEAcA8yHmZBgudTbW7S6eoObYE_O=CP3YjfL7g7GGip=wsjaA@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::231","Subject":"Re: [Qemu-devel] [Qemu devel v9 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\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":1770210,"web_url":"http://patchwork.ozlabs.org/comment/1770210/","msgid":"<CAFEAcA-FqjxRpALbJqhWtdhEBN7YpvV5rG-yMdbv_RCFSoVLYQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T14:39:00","subject":"Re: [Qemu-devel] [Qemu devel v9 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 18 September 2017 at 15:22, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:\n> On 09/18/2017 11:00 AM, Peter Maydell wrote:\n>> There's lots of stuff that can cause the guest to go badly\n>> and confusingly wrong if unimplemented. If we print a\n>> useful message with LOG_UNIMP then there's an easy clue\n>> for what's gone wrong. The guest shouldn't be able to\n>> provoke QEMU to exit.\n>\n>\n> I understand. I'm worried about being PITA for an user to figure out what's\n> happening here, that's why I'm wondering how this should be handled. Another\n> idea I thought about was raising a PREFETCH or BKPT exception, but this\n> would also be an incorrect model behavior.\n>\n> Anyway I'd be happy enough if instead of using LOG_UNIMP/LOG_GUEST_ERROR we\n> use an unconditional qemu_log(\"bus remap unimplemented, unpredictable\n> behaviour!\") warning. Fair enough?\n\nI don't see any reason to handle this any differently to\nanything else.\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=\"Xc6t77Ov\"; 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 3xwpdF49mtz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 00:42:41 +1000 (AEST)","from localhost ([::1]:37043 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 1dtxFv-0007pv-Ic\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 10:42:39 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:55793)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtxCl-0005ao-Q4\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:39:27 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtxCk-0005ez-V8\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:39:23 -0400","from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:47677)\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 1dtxCk-0005eN-MD\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 10:39:22 -0400","by mail-wm0-x231.google.com with SMTP id 13so3349238wmq.2\n\tfor <qemu-devel@nongnu.org>; Mon, 18 Sep 2017 07:39:22 -0700 (PDT)","by 10.223.139.215 with HTTP; Mon, 18 Sep 2017 07:39:00 -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=IPkiTVmRXN1dU/SpKJ770xu94nKYt79TikqgdNHSevk=;\n\tb=Xc6t77Ov673sqvuyYjq4+4ixhj5bo5jIftPad+oYNHslavym41svswmrK+l7G58or9\n\tEZQfJtZcLj20NnBVvDhskATxteXatlCL3cIfWOLPzflcSFAAoxugu9NrIslF0gUQ0zvr\n\tT2G8zLnYV/2kD2n+rkaUGuhuyPtuXby/NFny0=","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=IPkiTVmRXN1dU/SpKJ770xu94nKYt79TikqgdNHSevk=;\n\tb=gK+jzPZ9H7+iY7bOla5siEZuiIA76sgKeEls7cm7sBXNvqN11y8AoZqbMbP1nHoAXt\n\tC/4uoxDE8h2oSAUIcyDKsdWnr7JyYxqqIHKQU0HD15sE5seQVr9qMqDDURfC6/0QccSW\n\tQEGqUfuCosCXw6LI4yNB+A+FPk4llJm6dHtT4lFeyHLOeDMO1fRxdt5bthQ35P8FzrjF\n\tGT9GzheoQEmmhQGRVthid+LW5mvu6dqYI5kDJxpnpSbxhtcUh7iBctVRbfA06BLV+TBl\n\tkrZQ11m773WGa+0C6aQYkxdlCL0W0a0khz3TuZ10gjGokO0CdDicbX6k+zi+9vLqwW48\n\tSHdg==","X-Gm-Message-State":"AHPjjUjGSAJekvlkvXWNUwz5lYf/iuNkDYuYSMc0sjO8YKletzLmb9Y3\n\tdLZ2tDquRiQFqRMYkD8ImPp3NZ/G5LONYPdyV5OuK/kV","X-Google-Smtp-Source":"AOwi7QDSesMYKwDQOIUVKPN77Zz4IixajFF5nB3j47qg/IRAMgnLIiZUnLdtsB5d6fJPwjWurW4R8ZOBpHgO96CBsks=","X-Received":"by 10.28.52.81 with SMTP id b78mr9140984wma.11.1505745561570;\n\tMon, 18 Sep 2017 07:39:21 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1abcfaca-3af0-efcf-d577-c3c5cb39e8fe@amsat.org>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>\n\t<1505494753-10837-3-git-send-email-sundeep.lkml@gmail.com>\n\t<2c6a4136-fb80-2000-940c-1df5e718cbf1@amsat.org>\n\t<CALHRZurRLysJCRwvm+SbJUn8YBAst_Q38RCzJkmT4z=mfnYuiQ@mail.gmail.com>\n\t<CALHRZurNLqH_6Xbh9SKtCA0fuk-CFEZeqBMwYXV=+UaZB4k1Bg@mail.gmail.com>\n\t<CAFEAcA-BQ=ognSsb3Kxx5ThJ5Q_GA_sFFFofpKY1=XnRS4-WTA@mail.gmail.com>\n\t<6947945c-6b04-dce0-9010-b3350df0f151@amsat.org>\n\t<CAFEAcA8yHmZBgudTbW7S6eoObYE_O=CP3YjfL7g7GGip=wsjaA@mail.gmail.com>\n\t<1abcfaca-3af0-efcf-d577-c3c5cb39e8fe@amsat.org>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Mon, 18 Sep 2017 15:39:00 +0100","Message-ID":"<CAFEAcA-FqjxRpALbJqhWtdhEBN7YpvV5rG-yMdbv_RCFSoVLYQ@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::231","Subject":"Re: [Qemu-devel] [Qemu devel v9 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\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>"}}]