[Qemu-devel] [PATCH 00/17] Initial i.MX7 support

Andrey Smirnov posted 17 patches 8 years, 1 month ago
Failed in applying to current master (apply log)
Test checkpatch failed
Test docker passed
Test s390x passed
There is a newer version of this series
default-configs/arm-softmmu.mak |   1 +
hw/arm/Makefile.objs            |   2 +
hw/arm/fsl-imx6.c               |   1 +
hw/arm/fsl-imx7.c               | 327 ++++++++++++++++++++++++++++++++++++++++
hw/arm/mcimx7d-sabre.c          | 100 ++++++++++++
hw/misc/Makefile.objs           |   3 +
hw/misc/imx2_wdt.c              | 117 ++++++++++++++
hw/misc/imx7_ccm.c              | 201 ++++++++++++++++++++++++
hw/misc/imx7_snvs.c             |  84 +++++++++++
hw/net/imx_fec.c                | 153 ++++++++++++++-----
hw/sd/sdhci-internal.h          |  15 ++
hw/sd/sdhci.c                   | 126 +++++++++++++++-
include/hw/arm/fsl-imx7.h       | 114 ++++++++++++++
include/hw/misc/imx2_wdt.h      |  36 +++++
include/hw/misc/imx7_ccm.h      |  76 ++++++++++
include/hw/misc/imx7_snvs.h     |  35 +++++
include/hw/net/imx_fec.h        |  26 +++-
include/hw/sd/sdhci.h           |   8 +
include/qemu/sizes.h            |  47 ++++++
19 files changed, 1433 insertions(+), 39 deletions(-)
create mode 100644 hw/arm/fsl-imx7.c
create mode 100644 hw/arm/mcimx7d-sabre.c
create mode 100644 hw/misc/imx2_wdt.c
create mode 100644 hw/misc/imx7_ccm.c
create mode 100644 hw/misc/imx7_snvs.c
create mode 100644 include/hw/arm/fsl-imx7.h
create mode 100644 include/hw/misc/imx2_wdt.h
create mode 100644 include/hw/misc/imx7_ccm.h
create mode 100644 include/hw/misc/imx7_snvs.h
create mode 100644 include/qemu/sizes.h
[Qemu-devel] [PATCH 00/17] Initial i.MX7 support
Posted by Andrey Smirnov 8 years, 1 month ago
Hi everyone,

This patch series contains the work that I've done in order to enable
support for i.MX7 emulation in QEMU. Majority of the set are just odd
fixes and small features implementation that I had to do to already
exisitng code but last 5 commits contain new emulation code.

As the one before last commit in the series states the supported i.MX7
features are:

    * up to 2 Cortex A9 cores (SMP works with PSCI)
    * A7 MPCORE (identical to A15 MPCORE)
    * 7 i.MX UARTs
    * 1 CCM device
    * 2 Ethernet controllers (FEC)
    * 3 SD controllers (USDHC)
    * 1 SNVS device
    * 1 WDT device

I also have a follow up series that implements bit needes for PCIe
emulation support (DesignWare IP emulation + supporting code) which
I'll be submitting after this series is accepted.

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey Smirnov (17):
  imx_fec: Do not link to netdev
  imx_fec: Do not calculate FEC
  imx_fec: Refactor imx_eth_enable_rx()
  imx_fec: Change queue flushing heuristics
  imx_fec: Use ENET_FTRL to determine truncation length
  imx_fec: Use MIN instead of explicit ternary operator
  imx_fec: Emulate SHIFT16 in ENETx_RACC
  imx_fec: Add support for multiple Tx DMA rings
  imx_fec: Use correct length for packet size
  sdhci: Add i.MX specific subtype of SDHCI
  sdhci: Implement write method of ACMD12ERRSTS register
  i.MX: Add i.MX7 CCM, PMU and ANALOG device
  i.MX: Add code to emulate i.MX2 watchdog IP block
  i.MX7: Add code to emulate SNVS IP-block
  include/qemu: Add sizes.h from Linux
  i.MX: Add i.MX7 SOC implementation.
  Implement support for i.MX7 Sabre board

 default-configs/arm-softmmu.mak |   1 +
 hw/arm/Makefile.objs            |   2 +
 hw/arm/fsl-imx6.c               |   1 +
 hw/arm/fsl-imx7.c               | 327 ++++++++++++++++++++++++++++++++++++++++
 hw/arm/mcimx7d-sabre.c          | 100 ++++++++++++
 hw/misc/Makefile.objs           |   3 +
 hw/misc/imx2_wdt.c              | 117 ++++++++++++++
 hw/misc/imx7_ccm.c              | 201 ++++++++++++++++++++++++
 hw/misc/imx7_snvs.c             |  84 +++++++++++
 hw/net/imx_fec.c                | 153 ++++++++++++++-----
 hw/sd/sdhci-internal.h          |  15 ++
 hw/sd/sdhci.c                   | 126 +++++++++++++++-
 include/hw/arm/fsl-imx7.h       | 114 ++++++++++++++
 include/hw/misc/imx2_wdt.h      |  36 +++++
 include/hw/misc/imx7_ccm.h      |  76 ++++++++++
 include/hw/misc/imx7_snvs.h     |  35 +++++
 include/hw/net/imx_fec.h        |  26 +++-
 include/hw/sd/sdhci.h           |   8 +
 include/qemu/sizes.h            |  47 ++++++
 19 files changed, 1433 insertions(+), 39 deletions(-)
 create mode 100644 hw/arm/fsl-imx7.c
 create mode 100644 hw/arm/mcimx7d-sabre.c
 create mode 100644 hw/misc/imx2_wdt.c
 create mode 100644 hw/misc/imx7_ccm.c
 create mode 100644 hw/misc/imx7_snvs.c
 create mode 100644 include/hw/arm/fsl-imx7.h
 create mode 100644 include/hw/misc/imx2_wdt.h
 create mode 100644 include/hw/misc/imx7_ccm.h
 create mode 100644 include/hw/misc/imx7_snvs.h
 create mode 100644 include/qemu/sizes.h

-- 
2.13.5


Re: [Qemu-devel] [PATCH 00/17] Initial i.MX7 support
Posted by no-reply@patchew.org 8 years, 1 month ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH 00/17] Initial i.MX7 support
Message-id: 20170918195100.17593-1-andrew.smirnov@gmail.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20170918202529.28379-1-el13635@mail.ntua.gr -> patchew/20170918202529.28379-1-el13635@mail.ntua.gr
Switched to a new branch 'test'
274d7165b1 Implement support for i.MX7 Sabre board
d24ef9c251 i.MX: Add i.MX7 SOC implementation.
74a0b2d896 include/qemu: Add sizes.h from Linux
920e37dac2 i.MX7: Add code to emulate SNVS IP-block
0d876ce354 i.MX: Add code to emulate i.MX2 watchdog IP block
e21f310ca0 i.MX: Add i.MX7 CCM, PMU and ANALOG device
e5d8486d8c sdhci: Implement write method of ACMD12ERRSTS register
c00331bbb7 sdhci: Add i.MX specific subtype of SDHCI
9b01e35230 imx_fec: Use correct length for packet size
47351ad73c imx_fec: Add support for multiple Tx DMA rings
f23e9656f5 imx_fec: Emulate SHIFT16 in ENETx_RACC
abc29e9048 imx_fec: Use MIN instead of explicit ternary operator
456a2681ea imx_fec: Use ENET_FTRL to determine truncation length
f756d1961b imx_fec: Change queue flushing heuristics
e3f400de53 imx_fec: Refactor imx_eth_enable_rx()
38f4f4a46c imx_fec: Do not calculate FEC
e07552c97b imx_fec: Do not link to netdev

=== OUTPUT BEGIN ===
Checking PATCH 1/17: imx_fec: Do not link to netdev...
Checking PATCH 2/17: imx_fec: Do not calculate FEC...
Checking PATCH 3/17: imx_fec: Refactor imx_eth_enable_rx()...
Checking PATCH 4/17: imx_fec: Change queue flushing heuristics...
Checking PATCH 5/17: imx_fec: Use ENET_FTRL to determine truncation length...
Checking PATCH 6/17: imx_fec: Use MIN instead of explicit ternary operator...
Checking PATCH 7/17: imx_fec: Emulate SHIFT16 in ENETx_RACC...
ERROR: code indent should never use tabs
#73: FILE: include/hw/net/imx_fec.h:172:
+#define ENET_RACC_SHIFT16^IBIT(7)$

total: 1 errors, 0 warnings, 49 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 8/17: imx_fec: Add support for multiple Tx DMA rings...
WARNING: line over 80 characters
#249: FILE: include/hw/net/imx_fec.h:123:
+                                ENET_INT_TS_AVAIL | ENET_INT_TXF1 | ENET_INT_TXB1 |\

total: 0 errors, 1 warnings, 241 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 9/17: imx_fec: Use correct length for packet size...
Checking PATCH 10/17: sdhci: Add i.MX specific subtype of SDHCI...
ERROR: code indent should never use tabs
#37: FILE: hw/sd/sdhci-internal.h:235:
+#define ESDHC_MIX_CTRL^I^I^I0x48$

ERROR: code indent should never use tabs
#38: FILE: hw/sd/sdhci-internal.h:236:
+#define ESDHC_VENDOR_SPEC^I^I0xc0$

ERROR: code indent should never use tabs
#39: FILE: hw/sd/sdhci-internal.h:237:
+#define ESDHC_DLL_CTRL^I^I^I0x60$

ERROR: code indent should never use tabs
#41: FILE: hw/sd/sdhci-internal.h:239:
+#define ESDHC_TUNING_CTRL^I^I0xcc$

ERROR: code indent should never use tabs
#42: FILE: hw/sd/sdhci-internal.h:240:
+#define ESDHC_TUNE_CTRL_STATUS^I^I0x68$

ERROR: code indent should never use tabs
#43: FILE: hw/sd/sdhci-internal.h:241:
+#define ESDHC_WTMK_LVL^I^I^I0x44$

ERROR: code indent should never use tabs
#45: FILE: hw/sd/sdhci-internal.h:243:
+#define ESDHC_CTRL_4BITBUS^I^I(0x1 << 1)$

ERROR: code indent should never use tabs
#46: FILE: hw/sd/sdhci-internal.h:244:
+#define ESDHC_CTRL_8BITBUS^I^I(0x2 << 1)$

ERROR: braces {} are necessary for all arms of this statement
#99: FILE: hw/sd/sdhci.c:1405:
+        if (s->hostctl & SDHC_CTRL_8BITBUS)
[...]

ERROR: braces {} are necessary for all arms of this statement
#102: FILE: hw/sd/sdhci.c:1408:
+        if (s->hostctl & SDHC_CTRL_4BITBUS)
[...]

ERROR: braces {} are necessary for all arms of this statement
#141: FILE: hw/sd/sdhci.c:1447:
+        if (value & ESDHC_CTRL_8BITBUS)
[...]

ERROR: braces {} are necessary for all arms of this statement
#144: FILE: hw/sd/sdhci.c:1450:
+        if (value & ESDHC_CTRL_4BITBUS)
[...]

ERROR: code indent should never use tabs
#231: FILE: include/hw/sd/sdhci.h:92:
+#define SDHCI_QUIRK_NO_BUSY_IRQ^I^I^I^I(1<<14)$

ERROR: spaces required around that '<<' (ctx:VxV)
#231: FILE: include/hw/sd/sdhci.h:92:
+#define SDHCI_QUIRK_NO_BUSY_IRQ				(1<<14)
                                				  ^

total: 14 errors, 0 warnings, 203 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 11/17: sdhci: Implement write method of ACMD12ERRSTS register...
Checking PATCH 12/17: i.MX: Add i.MX7 CCM, PMU and ANALOG device...
ERROR: trailing whitespace
#71: FILE: hw/misc/imx7_ccm.c:41:
+    s->analog[CCM_ANALOG_PLL_480]         = 0x00002000;    $

ERROR: code indent should never use tabs
#97: FILE: hw/misc/imx7_ccm.c:67:
+#define CCM_INDEX(offset)^I(((offset) & ~(hwaddr)0xF) / sizeof(uint32_t))$

ERROR: code indent should never use tabs
#98: FILE: hw/misc/imx7_ccm.c:68:
+#define CCM_BITOP(offset)^I((offset) & (hwaddr)0xF)$

ERROR: trailing whitespace
#182: FILE: hw/misc/imx7_ccm.c:152:
+    $

ERROR: Macros with complex values should be enclosed in parenthesis
#255: FILE: include/hw/misc/imx7_ccm.h:18:
+#define REG_SET_CLR_TOG(name)  name, name##_SET, name##_CLR, name##_TOG

total: 5 errors, 0 warnings, 284 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 13/17: i.MX: Add code to emulate i.MX2 watchdog IP block...
ERROR: code indent should never use tabs
#62: FILE: hw/misc/imx2_wdt.c:29:
+#define IMX2_WDT_WCR_WDA^IBIT(5)^I^I/* -> External Reset WDOG_B */$

ERROR: code indent should never use tabs
#63: FILE: hw/misc/imx2_wdt.c:30:
+#define IMX2_WDT_WCR_SRS^IBIT(4)^I^I/* -> Software Reset Signal */$

ERROR: braces {} are necessary for all arms of this statement
#71: FILE: hw/misc/imx2_wdt.c:38:
+    if (index < ARRAY_SIZE(s->reg))
[...]
+    else
[...]

ERROR: braces {} are necessary for all arms of this statement
#89: FILE: hw/misc/imx2_wdt.c:56:
+        if (value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS))
[...]

total: 4 errors, 0 warnings, 160 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 14/17: i.MX7: Add code to emulate SNVS IP-block...
Checking PATCH 15/17: include/qemu: Add sizes.h from Linux...
ERROR: code indent should never use tabs
#32: FILE: include/qemu/sizes.h:11:
+#define SZ_1^I^I^I^I0x00000001$

ERROR: code indent should never use tabs
#33: FILE: include/qemu/sizes.h:12:
+#define SZ_2^I^I^I^I0x00000002$

ERROR: code indent should never use tabs
#34: FILE: include/qemu/sizes.h:13:
+#define SZ_4^I^I^I^I0x00000004$

ERROR: code indent should never use tabs
#35: FILE: include/qemu/sizes.h:14:
+#define SZ_8^I^I^I^I0x00000008$

ERROR: code indent should never use tabs
#36: FILE: include/qemu/sizes.h:15:
+#define SZ_16^I^I^I^I0x00000010$

ERROR: code indent should never use tabs
#37: FILE: include/qemu/sizes.h:16:
+#define SZ_32^I^I^I^I0x00000020$

ERROR: code indent should never use tabs
#38: FILE: include/qemu/sizes.h:17:
+#define SZ_64^I^I^I^I0x00000040$

ERROR: code indent should never use tabs
#39: FILE: include/qemu/sizes.h:18:
+#define SZ_128^I^I^I^I0x00000080$

ERROR: code indent should never use tabs
#40: FILE: include/qemu/sizes.h:19:
+#define SZ_256^I^I^I^I0x00000100$

ERROR: code indent should never use tabs
#41: FILE: include/qemu/sizes.h:20:
+#define SZ_512^I^I^I^I0x00000200$

ERROR: code indent should never use tabs
#43: FILE: include/qemu/sizes.h:22:
+#define SZ_1K^I^I^I^I0x00000400$

ERROR: code indent should never use tabs
#44: FILE: include/qemu/sizes.h:23:
+#define SZ_2K^I^I^I^I0x00000800$

ERROR: code indent should never use tabs
#45: FILE: include/qemu/sizes.h:24:
+#define SZ_4K^I^I^I^I0x00001000$

ERROR: code indent should never use tabs
#46: FILE: include/qemu/sizes.h:25:
+#define SZ_8K^I^I^I^I0x00002000$

ERROR: code indent should never use tabs
#47: FILE: include/qemu/sizes.h:26:
+#define SZ_16K^I^I^I^I0x00004000$

ERROR: code indent should never use tabs
#48: FILE: include/qemu/sizes.h:27:
+#define SZ_32K^I^I^I^I0x00008000$

ERROR: code indent should never use tabs
#49: FILE: include/qemu/sizes.h:28:
+#define SZ_64K^I^I^I^I0x00010000$

ERROR: code indent should never use tabs
#50: FILE: include/qemu/sizes.h:29:
+#define SZ_128K^I^I^I^I0x00020000$

ERROR: code indent should never use tabs
#51: FILE: include/qemu/sizes.h:30:
+#define SZ_256K^I^I^I^I0x00040000$

ERROR: code indent should never use tabs
#52: FILE: include/qemu/sizes.h:31:
+#define SZ_512K^I^I^I^I0x00080000$

ERROR: code indent should never use tabs
#54: FILE: include/qemu/sizes.h:33:
+#define SZ_1M^I^I^I^I0x00100000$

ERROR: code indent should never use tabs
#55: FILE: include/qemu/sizes.h:34:
+#define SZ_2M^I^I^I^I0x00200000$

ERROR: code indent should never use tabs
#56: FILE: include/qemu/sizes.h:35:
+#define SZ_4M^I^I^I^I0x00400000$

ERROR: code indent should never use tabs
#57: FILE: include/qemu/sizes.h:36:
+#define SZ_8M^I^I^I^I0x00800000$

ERROR: code indent should never use tabs
#58: FILE: include/qemu/sizes.h:37:
+#define SZ_16M^I^I^I^I0x01000000$

ERROR: code indent should never use tabs
#59: FILE: include/qemu/sizes.h:38:
+#define SZ_32M^I^I^I^I0x02000000$

ERROR: code indent should never use tabs
#60: FILE: include/qemu/sizes.h:39:
+#define SZ_64M^I^I^I^I0x04000000$

ERROR: code indent should never use tabs
#61: FILE: include/qemu/sizes.h:40:
+#define SZ_128M^I^I^I^I0x08000000$

ERROR: code indent should never use tabs
#62: FILE: include/qemu/sizes.h:41:
+#define SZ_256M^I^I^I^I0x10000000$

ERROR: code indent should never use tabs
#63: FILE: include/qemu/sizes.h:42:
+#define SZ_512M^I^I^I^I0x20000000$

ERROR: code indent should never use tabs
#65: FILE: include/qemu/sizes.h:44:
+#define SZ_1G^I^I^I^I0x40000000$

ERROR: code indent should never use tabs
#66: FILE: include/qemu/sizes.h:45:
+#define SZ_2G^I^I^I^I0x80000000$

total: 32 errors, 0 warnings, 47 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 16/17: i.MX: Add i.MX7 SOC implementation....
ERROR: code indent should never use tabs
#178: FILE: hw/arm/fsl-imx7.c:128:
+^Io = OBJECT(&s->cpu[i]);$

ERROR: code indent should never use tabs
#458: FILE: include/hw/arm/fsl-imx7.h:75:
+    FSL_IMX7_SNVS_ADDR^I    = 0x30370000,$

total: 2 errors, 0 warnings, 453 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 17/17: Implement support for i.MX7 Sabre board...
WARNING: line over 80 characters
#60: FILE: hw/arm/mcimx7d-sabre.c:31:
+static void mcimx7d_add_psci_node(const struct arm_boot_info *boot_info, void *fdt)

WARNING: line over 80 characters
#114: FILE: hw/arm/mcimx7d-sabre.c:85:
+        object_property_set_bool(OBJECT(carddev), true, "realized", &error_fatal);

total: 0 errors, 2 warnings, 106 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Re: [Qemu-devel] [PATCH 00/17] Initial i.MX7 support
Posted by Peter Maydell 8 years ago
On 18 September 2017 at 20:50, Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
> Hi everyone,
>
> This patch series contains the work that I've done in order to enable
> support for i.MX7 emulation in QEMU. Majority of the set are just odd
> fixes and small features implementation that I had to do to already
> exisitng code but last 5 commits contain new emulation code.
>
> As the one before last commit in the series states the supported i.MX7
> features are:
>
>     * up to 2 Cortex A9 cores (SMP works with PSCI)
>     * A7 MPCORE (identical to A15 MPCORE)
>     * 7 i.MX UARTs
>     * 1 CCM device
>     * 2 Ethernet controllers (FEC)
>     * 3 SD controllers (USDHC)
>     * 1 SNVS device
>     * 1 WDT device
>
> I also have a follow up series that implements bit needes for PCIe
> emulation support (DesignWare IP emulation + supporting code) which
> I'll be submitting after this series is accepted.

Hi; thanks for these patches. I've now reviewed most of them. Hopefully
somebody else can get to the sdhci patches, as sdhci is not an
area I know much about and I don't think I have the specs.

Please also run your patches through scripts/checkpatch.pl and fix
those issues as necessary (the script does occasionally have false
positives so you need not follow it blindly if it suggests something
ridiculous).

thanks
-- PMM