All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: qemu-arm <qemu-arm@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Andrey Yurovsky <yurovsky@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 17/17] Implement support for i.MX7 Sabre board
Date: Fri, 6 Oct 2017 15:42:56 +0100	[thread overview]
Message-ID: <CAFEAcA-wjuFzQuxOGz2UbjL6qSO7H75WzKHPVrqhT40QMaLLog@mail.gmail.com> (raw)
In-Reply-To: <20170918195100.17593-18-andrew.smirnov@gmail.com>

On 18 September 2017 at 20:51, Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-devel@nongnu.org
> Cc: qemu-arm@nongnu.org
> Cc: yurovsky@gmail.com
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  hw/arm/Makefile.objs   |   2 +-
>  hw/arm/mcimx7d-sabre.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 101 insertions(+), 1 deletion(-)
>  create mode 100644 hw/arm/mcimx7d-sabre.c
>
> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
> index 33f6051ae3..fc4a963de8 100644
> --- a/hw/arm/Makefile.objs
> +++ b/hw/arm/Makefile.objs
> @@ -19,5 +19,5 @@ obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o
>  obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o
>  obj-$(CONFIG_ASPEED_SOC) += aspeed_soc.o aspeed.o
>  obj-$(CONFIG_MPS2) += mps2.o
> -obj-$(CONFIG_FSL_IMX7) += fsl-imx7.o
> +obj-$(CONFIG_FSL_IMX7) += fsl-imx7.o mcimx7d-sabre.o
>
> diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c
> new file mode 100644
> index 0000000000..34e3933db8
> --- /dev/null
> +++ b/hw/arm/mcimx7d-sabre.c
> @@ -0,0 +1,100 @@
> +/*
> + * Copyright (c) 2017, Impinj, Inc.
> + *
> + * MCIMX7D_SABRE Board System emulation.
> + *
> + * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
> + *
> + * This code is licensed under the GPL, version 2 or later.
> + * See the file `COPYING' in the top level directory.
> + *
> + * It (partially) emulates a mcimx7d_sabre board, with a Freescale
> + * i.MX7 SoC
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qapi/error.h"
> +#include "qemu-common.h"
> +#include "hw/arm/fsl-imx7.h"
> +#include "hw/boards.h"
> +#include "sysemu/sysemu.h"
> +#include "sysemu/device_tree.h"
> +#include "qemu/error-report.h"
> +#include "sysemu/qtest.h"
> +#include "net/net.h"
> +
> +typedef struct {
> +    FslIMX7State soc;
> +    MemoryRegion ram;
> +} MCIMX7Sabre;
> +
> +static void mcimx7d_add_psci_node(const struct arm_boot_info *boot_info, void *fdt)
> +{
> +    const char comp[] = "arm,psci-0.2\0arm,psci";
> +
> +    qemu_fdt_add_subnode(fdt, "/psci");
> +    qemu_fdt_setprop(fdt, "/psci", "compatible", comp, sizeof(comp));
> +    qemu_fdt_setprop_string(fdt, "/psci", "method", "smc");
> +}

You shouldn't need this -- we should just be able to work with whatever
the real hardware's device tree is. ("virt" is a special case because
we create our own device tree there.)

> +
> +static void mcimx7d_sabre_init(MachineState *machine)
> +{
> +    static struct arm_boot_info boot_info;
> +    MCIMX7Sabre *s = g_new0(MCIMX7Sabre, 1);
> +    Object *soc;
> +    int i;
> +
> +    if (machine->ram_size > FSL_IMX7_MMDC_SIZE) {
> +        error_report("RAM size " RAM_ADDR_FMT " above max supported (%08x)",
> +                     machine->ram_size, FSL_IMX7_MMDC_SIZE);
> +        exit(1);
> +    }
> +
> +    boot_info = (struct arm_boot_info) {
> +        .loader_start = FSL_IMX7_MMDC_ADDR,
> +        .board_id = -1,
> +        .ram_size = machine->ram_size,
> +        .kernel_filename = machine->kernel_filename,
> +        .kernel_cmdline = machine->kernel_cmdline,
> +        .initrd_filename = machine->initrd_filename,
> +        .nb_cpus = smp_cpus,
> +        .modify_dtb = mcimx7d_add_psci_node,
> +    };
> +
> +    object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX7);
> +    soc = OBJECT(&s->soc);
> +    object_property_add_child(OBJECT(machine), "soc", soc, &error_fatal);
> +    object_property_set_bool(soc, true, "realized", &error_fatal);
> +
> +    memory_region_allocate_system_memory(&s->ram, NULL, "mcimx7d-sabre.ram",
> +                                         machine->ram_size);
> +    memory_region_add_subregion(get_system_memory(),
> +                                FSL_IMX7_MMDC_ADDR, &s->ram);
> +
> +    for (i = 0; i < FSL_IMX7_NUM_USDHCS; i++) {
> +        BusState *bus;
> +        DeviceState *carddev;
> +        DriveInfo *di;
> +        BlockBackend *blk;
> +
> +        di = drive_get_next(IF_SD);
> +        blk = di ? blk_by_legacy_dinfo(di) : NULL;
> +        bus = qdev_get_child_bus(DEVICE(&s->soc.usdhc[i]), "sd-bus");
> +        carddev = qdev_create(bus, TYPE_SD_CARD);
> +        qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
> +        object_property_set_bool(OBJECT(carddev), true, "realized", &error_fatal);
> +    }
> +
> +    if (!qtest_enabled()) {
> +        arm_load_kernel(&s->soc.cpu[0], &boot_info);
> +    }
> +}
> +
> +static void mcimx7d_sabre_machine_init(MachineClass *mc)
> +{
> +    mc->desc = "Freescale i.MX7 DUAL SABRE (Cortex A7)";
> +    mc->init = mcimx7d_sabre_init;
> +    mc->max_cpus = FSL_IMX7_NUM_CPUS;
> +    mc->ignore_memory_transaction_failures = true;

Please don't set this flag on new board models -- it is only
for legacy existing board models (where we don't know what
running guest code might be broken by turning bad accesses
into guest aborts. For a new board model, you should leave
the flag unset and instead stub out any devices that you
need to using create_unimplemented_device() so that your
guest code boots.

thanks
-- PMM

  reply	other threads:[~2017-10-06 14:43 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 19:50 [Qemu-devel] [PATCH 00/17] Initial i.MX7 support Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 01/17] imx_fec: Do not link to netdev Andrey Smirnov
2017-10-06 13:46   ` Peter Maydell
2017-09-18 19:50 ` [Qemu-devel] [PATCH 02/17] imx_fec: Do not calculate FEC Andrey Smirnov
2017-10-06 13:48   ` Peter Maydell
2017-10-09 14:47     ` Andrey Smirnov
2017-10-09 17:03       ` Peter Maydell
2017-09-18 19:50 ` [Qemu-devel] [PATCH 03/17] imx_fec: Refactor imx_eth_enable_rx() Andrey Smirnov
2017-10-06 13:49   ` Peter Maydell
2017-09-18 19:50 ` [Qemu-devel] [PATCH 04/17] imx_fec: Change queue flushing heuristics Andrey Smirnov
2017-09-22  7:27   ` Jason Wang
2017-09-25 18:10     ` Andrey Smirnov
2017-10-06 13:56   ` Peter Maydell
2017-10-09 14:57     ` Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 05/17] imx_fec: Use ENET_FTRL to determine truncation length Andrey Smirnov
2017-09-30  0:17   ` Philippe Mathieu-Daudé
2017-10-06 14:00     ` Peter Maydell
2017-10-09 15:19       ` Andrey Smirnov
2017-10-06 14:03   ` Peter Maydell
2017-09-18 19:50 ` [Qemu-devel] [PATCH 06/17] imx_fec: Use MIN instead of explicit ternary operator Andrey Smirnov
2017-09-30  0:19   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-09-18 19:50 ` [Qemu-devel] [PATCH 07/17] imx_fec: Emulate SHIFT16 in ENETx_RACC Andrey Smirnov
2017-10-06 14:02   ` Peter Maydell
2017-10-09 15:22     ` Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 08/17] imx_fec: Add support for multiple Tx DMA rings Andrey Smirnov
2017-09-22  7:33   ` Jason Wang
2017-09-25 18:23     ` Andrey Smirnov
2017-10-06 14:10   ` Peter Maydell
2017-10-09 15:38     ` Andrey Smirnov
2017-10-09 17:06       ` Peter Maydell
2017-09-18 19:50 ` [Qemu-devel] [PATCH 09/17] imx_fec: Use correct length for packet size Andrey Smirnov
2017-10-06 14:12   ` Peter Maydell
2017-09-18 19:50 ` [Qemu-devel] [PATCH 10/17] sdhci: Add i.MX specific subtype of SDHCI Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 11/17] sdhci: Implement write method of ACMD12ERRSTS register Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 12/17] i.MX: Add i.MX7 CCM, PMU and ANALOG device Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 13/17] i.MX: Add code to emulate i.MX2 watchdog IP block Andrey Smirnov
2017-10-06 14:22   ` Peter Maydell
2017-10-09 15:54     ` Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 14/17] i.MX7: Add code to emulate SNVS IP-block Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 15/17] include/qemu: Add sizes.h from Linux Andrey Smirnov
2017-10-06 14:13   ` Peter Maydell
2017-10-09 15:55     ` Andrey Smirnov
2017-09-18 19:50 ` [Qemu-devel] [PATCH 16/17] i.MX: Add i.MX7 SOC implementation Andrey Smirnov
2017-10-06 14:38   ` Peter Maydell
2017-10-09 16:18     ` Andrey Smirnov
2017-10-09 17:09       ` Peter Maydell
2017-09-18 19:51 ` [Qemu-devel] [PATCH 17/17] Implement support for i.MX7 Sabre board Andrey Smirnov
2017-10-06 14:42   ` Peter Maydell [this message]
2017-10-09 16:30     ` Andrey Smirnov
2017-09-18 21:00 ` [Qemu-devel] [PATCH 00/17] Initial i.MX7 support no-reply
2017-10-06 14:46 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA-wjuFzQuxOGz2UbjL6qSO7H75WzKHPVrqhT40QMaLLog@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=andrew.smirnov@gmail.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yurovsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.