[PATCH] hw/arm/fsl-imx7: Instantiate apbh_dma and ocotp as unimplemented devices

Guenter Roeck posted 1 patch 4 years, 1 month ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200313161506.8834-1-linux@roeck-us.net
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Andrey Smirnov <andrew.smirnov@gmail.com>
hw/arm/fsl-imx7.c         | 11 +++++++++++
include/hw/arm/fsl-imx7.h |  6 ++++++
2 files changed, 17 insertions(+)
[PATCH] hw/arm/fsl-imx7: Instantiate apbh_dma and ocotp as unimplemented devices
Posted by Guenter Roeck 4 years, 1 month ago
Instantiating apbh_dma and ocotp as unimplemented devices prevents crashes
when booting Linux.

apbh_dma:

[   14.046518] Unhandled fault: external abort on non-linefetch (0x808) at 0xd0852008
[   14.047287] pgd = (ptrval)
[   14.047607] [d0852008] *pgd=8b028811, *pte=33000653, *ppte=33000453
[   14.050074] Internal error: : 808 [#1] SMP ARM
...
[   14.077029] [<c0856530>] (stmp_clear_poll_bit) from [<c0856580>] (stmp_reset_block+0x10/0xb8)
[   14.077642] [<c0856580>] (stmp_reset_block) from [<c1a9655c>] (mxs_dma_probe+0x1f4/0x370)
[   14.078158] [<c1a9655c>] (mxs_dma_probe) from [<c0b6a7e8>] (platform_drv_probe+0x48/0x98)
[   14.078641] [<c0b6a7e8>] (platform_drv_probe) from [<c0b685c4>] (really_probe+0x228/0x2d0)

ocotp:

[   71.286109] Unhandled fault: external abort on non-linefetch (0x008) at 0xd0ff0000
[   71.287891] pgd = (ptrval)
[   71.288449] [d0ff0000] *pgd=8b497811, *pte=30350653, *ppte=30350453
[   71.291389] Internal error: : 8 [#1] SMP ARM
[   71.292302] Modules linked in:
[   71.293583] CPU: 0 PID: 112 Comm: kworker/0:3 Not tainted 5.0.0-10153-g065b6c4c913d-dirty #2
[   71.294148] Hardware name: Freescale i.MX7 Dual (Device Tree)
[   71.296728] Workqueue: events deferred_probe_work_func
[   71.297740] PC is at imx_ocotp_read+0x68/0x180
[   71.298154] LR is at mark_held_locks+0x48/0x74

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/arm/fsl-imx7.c         | 11 +++++++++++
 include/hw/arm/fsl-imx7.h |  6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
index 119b281a50..a17136f83c 100644
--- a/hw/arm/fsl-imx7.c
+++ b/hw/arm/fsl-imx7.c
@@ -459,6 +459,17 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
      */
     create_unimplemented_device("sdma", FSL_IMX7_SDMA_ADDR, FSL_IMX7_SDMA_SIZE);
 
+    /*
+     * OCOTP
+     */
+    create_unimplemented_device("octop", FSL_IMX7_OCOTP_ADDR,
+                                FSL_IMX7_OCOTP_SIZE);
+
+    /*
+     * APBH_DMA
+     */
+    create_unimplemented_device("apbh_dma", FSL_IMX7_APBH_DMA_ADDR,
+                                FSL_IMX7_APBH_DMA_SIZE);
 
     object_property_set_bool(OBJECT(&s->gpr), true, "realized",
                              &error_abort);
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
index 706aef2e7e..f9faa16515 100644
--- a/include/hw/arm/fsl-imx7.h
+++ b/include/hw/arm/fsl-imx7.h
@@ -113,6 +113,9 @@ enum FslIMX7MemoryMap {
     FSL_IMX7_IOMUXC_GPR_ADDR      = 0x30340000,
     FSL_IMX7_IOMUXCn_SIZE         = 0x1000,
 
+    FSL_IMX7_OCOTP_ADDR           = 0x30350000,
+    FSL_IMX7_OCOTP_SIZE           = 0x10000,
+
     FSL_IMX7_ANALOG_ADDR          = 0x30360000,
     FSL_IMX7_SNVS_ADDR            = 0x30370000,
     FSL_IMX7_CCM_ADDR             = 0x30380000,
@@ -177,6 +180,9 @@ enum FslIMX7MemoryMap {
     FSL_IMX7_A7MPCORE_ADDR        = 0x31000000,
     FSL_IMX7_A7MPCORE_DAP_ADDR    = 0x30000000,
 
+    FSL_IMX7_APBH_DMA_ADDR        = 0x33000000,
+    FSL_IMX7_APBH_DMA_SIZE        = 0x2000,
+
     FSL_IMX7_PCIE_REG_ADDR        = 0x33800000,
     FSL_IMX7_PCIE_REG_SIZE        = 16 * 1024,
 
-- 
2.17.1


Re: [PATCH] hw/arm/fsl-imx7: Instantiate apbh_dma and ocotp as unimplemented devices
Posted by Peter Maydell 4 years, 1 month ago
On Fri, 13 Mar 2020 at 16:15, Guenter Roeck <linux@roeck-us.net> wrote:
>
> Instantiating apbh_dma and ocotp as unimplemented devices prevents crashes
> when booting Linux.
>
> apbh_dma:
>
> [   14.046518] Unhandled fault: external abort on non-linefetch (0x808) at 0xd0852008
> [   14.047287] pgd = (ptrval)
> [   14.047607] [d0852008] *pgd=8b028811, *pte=33000653, *ppte=33000453
> [   14.050074] Internal error: : 808 [#1] SMP ARM
> ...
> [   14.077029] [<c0856530>] (stmp_clear_poll_bit) from [<c0856580>] (stmp_reset_block+0x10/0xb8)
> [   14.077642] [<c0856580>] (stmp_reset_block) from [<c1a9655c>] (mxs_dma_probe+0x1f4/0x370)
> [   14.078158] [<c1a9655c>] (mxs_dma_probe) from [<c0b6a7e8>] (platform_drv_probe+0x48/0x98)
> [   14.078641] [<c0b6a7e8>] (platform_drv_probe) from [<c0b685c4>] (really_probe+0x228/0x2d0)
>
> ocotp:
>
> [   71.286109] Unhandled fault: external abort on non-linefetch (0x008) at 0xd0ff0000
> [   71.287891] pgd = (ptrval)
> [   71.288449] [d0ff0000] *pgd=8b497811, *pte=30350653, *ppte=30350453
> [   71.291389] Internal error: : 8 [#1] SMP ARM
> [   71.292302] Modules linked in:
> [   71.293583] CPU: 0 PID: 112 Comm: kworker/0:3 Not tainted 5.0.0-10153-g065b6c4c913d-dirty #2
> [   71.294148] Hardware name: Freescale i.MX7 Dual (Device Tree)
> [   71.296728] Workqueue: events deferred_probe_work_func
> [   71.297740] PC is at imx_ocotp_read+0x68/0x180
> [   71.298154] LR is at mark_held_locks+0x48/0x74
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  hw/arm/fsl-imx7.c         | 11 +++++++++++
>  include/hw/arm/fsl-imx7.h |  6 ++++++
>  2 files changed, 17 insertions(+)
>
> diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
> index 119b281a50..a17136f83c 100644
> --- a/hw/arm/fsl-imx7.c
> +++ b/hw/arm/fsl-imx7.c
> @@ -459,6 +459,17 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
>       */
>      create_unimplemented_device("sdma", FSL_IMX7_SDMA_ADDR, FSL_IMX7_SDMA_SIZE);
>
> +    /*
> +     * OCOTP
> +     */
> +    create_unimplemented_device("octop", FSL_IMX7_OCOTP_ADDR,
> +                                FSL_IMX7_OCOTP_SIZE);

"octop" or "ocotp" ?


thanks
-- PMM

Re: [PATCH] hw/arm/fsl-imx7: Instantiate apbh_dma and ocotp as unimplemented devices
Posted by Guenter Roeck 4 years, 1 month ago
On 3/16/20 8:39 AM, Peter Maydell wrote:
> On Fri, 13 Mar 2020 at 16:15, Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> Instantiating apbh_dma and ocotp as unimplemented devices prevents crashes
>> when booting Linux.
>>
>> apbh_dma:
>>
>> [   14.046518] Unhandled fault: external abort on non-linefetch (0x808) at 0xd0852008
>> [   14.047287] pgd = (ptrval)
>> [   14.047607] [d0852008] *pgd=8b028811, *pte=33000653, *ppte=33000453
>> [   14.050074] Internal error: : 808 [#1] SMP ARM
>> ...
>> [   14.077029] [<c0856530>] (stmp_clear_poll_bit) from [<c0856580>] (stmp_reset_block+0x10/0xb8)
>> [   14.077642] [<c0856580>] (stmp_reset_block) from [<c1a9655c>] (mxs_dma_probe+0x1f4/0x370)
>> [   14.078158] [<c1a9655c>] (mxs_dma_probe) from [<c0b6a7e8>] (platform_drv_probe+0x48/0x98)
>> [   14.078641] [<c0b6a7e8>] (platform_drv_probe) from [<c0b685c4>] (really_probe+0x228/0x2d0)
>>
>> ocotp:
>>
>> [   71.286109] Unhandled fault: external abort on non-linefetch (0x008) at 0xd0ff0000
>> [   71.287891] pgd = (ptrval)
>> [   71.288449] [d0ff0000] *pgd=8b497811, *pte=30350653, *ppte=30350453
>> [   71.291389] Internal error: : 8 [#1] SMP ARM
>> [   71.292302] Modules linked in:
>> [   71.293583] CPU: 0 PID: 112 Comm: kworker/0:3 Not tainted 5.0.0-10153-g065b6c4c913d-dirty #2
>> [   71.294148] Hardware name: Freescale i.MX7 Dual (Device Tree)
>> [   71.296728] Workqueue: events deferred_probe_work_func
>> [   71.297740] PC is at imx_ocotp_read+0x68/0x180
>> [   71.298154] LR is at mark_held_locks+0x48/0x74
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>  hw/arm/fsl-imx7.c         | 11 +++++++++++
>>  include/hw/arm/fsl-imx7.h |  6 ++++++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
>> index 119b281a50..a17136f83c 100644
>> --- a/hw/arm/fsl-imx7.c
>> +++ b/hw/arm/fsl-imx7.c
>> @@ -459,6 +459,17 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
>>       */
>>      create_unimplemented_device("sdma", FSL_IMX7_SDMA_ADDR, FSL_IMX7_SDMA_SIZE);
>>
>> +    /*
>> +     * OCOTP
>> +     */
>> +    create_unimplemented_device("octop", FSL_IMX7_OCOTP_ADDR,
>> +                                FSL_IMX7_OCOTP_SIZE);
> 
> "octop" or "ocotp" ?
> 

Oops. Well, "octop" sounds way better, don't you think ?

Anyway, I later folded this patch into "hw/arm/fsl-imx7: Instantiate various
unimplemented devices" (https://patchwork.kernel.org/patch/11438371/) after
it turned out that ocotp alone was insufficient, and that apbh_dma had already
been added with another patch.

Thanks,
Guenter