qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX
@ 2016-09-21 18:09 Nathan Rossi
  2016-09-21 20:40 ` Alistair Francis
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Rossi @ 2016-09-21 18:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: Nathan Rossi, Alistair Francis, Edgar E. Iglesias

Whilst according to the Zynq TRM this device covers a register region of
0x000 - 0x120. The register region is also shared with XADCIF prefix
registers at 0x100 and above. Due to how the devcfg and the xadc devices
are implemented in QEMU these are separate models with individual mmio
regions. As such the region registered by the devcfg overlaps with the
xadc when initialized in a machine model (e.g. xilinx-zynq-a9).

This patch fixes up the incorrect region size, where
XLNX_ZYNQ_DEVCFG_R_MAX is missing its '/ 4' causing it to be 0x460 in
size. As well as setting the region size to the 0x0 - 0x100 region so
that an xadc device instance can be registered in the correct region to
pair with the devcfg device instance.

Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x118:
  dev: xlnx.ps7-dev-cfg, id ""
    mmio 00000000f8007000/0000000000000460
  dev: xlnx,zynq-xadc, id ""
    mmio 00000000f8007100/0000000000000020

Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x100 / 4:
  dev: xlnx.ps7-dev-cfg, id ""
    mmio 00000000f8007000/0000000000000100
  dev: xlnx,zynq-xadc, id ""
    mmio 00000000f8007100/0000000000000020

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
---
 include/hw/dma/xlnx-zynq-devcfg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-devcfg.h
index d40e5c8df6..9f5119a89a 100644
--- a/include/hw/dma/xlnx-zynq-devcfg.h
+++ b/include/hw/dma/xlnx-zynq-devcfg.h
@@ -34,7 +34,7 @@
 #define XLNX_ZYNQ_DEVCFG(obj) \
     OBJECT_CHECK(XlnxZynqDevcfg, (obj), TYPE_XLNX_ZYNQ_DEVCFG)
 
-#define XLNX_ZYNQ_DEVCFG_R_MAX 0x118
+#define XLNX_ZYNQ_DEVCFG_R_MAX (0x100 / 4)
 
 #define XLNX_ZYNQ_DEVCFG_DMA_CMD_FIFO_LEN 10
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX
  2016-09-21 18:09 [Qemu-devel] [PATCH] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX Nathan Rossi
@ 2016-09-21 20:40 ` Alistair Francis
  2016-09-22 12:19   ` Nathan Rossi
  2016-09-22 13:39   ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Alistair Francis @ 2016-09-21 20:40 UTC (permalink / raw)
  To: Nathan Rossi, Peter Maydell
  Cc: qemu-devel@nongnu.org Developers, Edgar E. Iglesias,
	Alistair Francis

On Wed, Sep 21, 2016 at 11:09 AM, Nathan Rossi <nathan@nathanrossi.com> wrote:
> Whilst according to the Zynq TRM this device covers a register region of
> 0x000 - 0x120. The register region is also shared with XADCIF prefix
> registers at 0x100 and above. Due to how the devcfg and the xadc devices
> are implemented in QEMU these are separate models with individual mmio
> regions. As such the region registered by the devcfg overlaps with the
> xadc when initialized in a machine model (e.g. xilinx-zynq-a9).
>
> This patch fixes up the incorrect region size, where
> XLNX_ZYNQ_DEVCFG_R_MAX is missing its '/ 4' causing it to be 0x460 in
> size. As well as setting the region size to the 0x0 - 0x100 region so
> that an xadc device instance can be registered in the correct region to
> pair with the devcfg device instance.
>
> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x118:
>   dev: xlnx.ps7-dev-cfg, id ""
>     mmio 00000000f8007000/0000000000000460
>   dev: xlnx,zynq-xadc, id ""
>     mmio 00000000f8007100/0000000000000020
>
> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x100 / 4:
>   dev: xlnx.ps7-dev-cfg, id ""
>     mmio 00000000f8007000/0000000000000100
>   dev: xlnx,zynq-xadc, id ""
>     mmio 00000000f8007100/0000000000000020
>
> Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>

Good catch. What came up that caused you to find this?

Can this go via the target-arm queue Peter?

Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>

Thanks,

Alistair

> ---
>  include/hw/dma/xlnx-zynq-devcfg.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-devcfg.h
> index d40e5c8df6..9f5119a89a 100644
> --- a/include/hw/dma/xlnx-zynq-devcfg.h
> +++ b/include/hw/dma/xlnx-zynq-devcfg.h
> @@ -34,7 +34,7 @@
>  #define XLNX_ZYNQ_DEVCFG(obj) \
>      OBJECT_CHECK(XlnxZynqDevcfg, (obj), TYPE_XLNX_ZYNQ_DEVCFG)
>
> -#define XLNX_ZYNQ_DEVCFG_R_MAX 0x118
> +#define XLNX_ZYNQ_DEVCFG_R_MAX (0x100 / 4)
>
>  #define XLNX_ZYNQ_DEVCFG_DMA_CMD_FIFO_LEN 10
>
> --
> 2.9.3
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX
  2016-09-21 20:40 ` Alistair Francis
@ 2016-09-22 12:19   ` Nathan Rossi
  2016-09-22 17:04     ` Alistair Francis
  2016-09-22 13:39   ` Peter Maydell
  1 sibling, 1 reply; 5+ messages in thread
From: Nathan Rossi @ 2016-09-22 12:19 UTC (permalink / raw)
  To: Alistair Francis
  Cc: Peter Maydell, qemu-devel@nongnu.org Developers,
	Edgar E. Iglesias

On Thu, Sep 22, 2016 at 6:40 AM, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> On Wed, Sep 21, 2016 at 11:09 AM, Nathan Rossi <nathan@nathanrossi.com> wrote:
>> Whilst according to the Zynq TRM this device covers a register region of
>> 0x000 - 0x120. The register region is also shared with XADCIF prefix
>> registers at 0x100 and above. Due to how the devcfg and the xadc devices
>> are implemented in QEMU these are separate models with individual mmio
>> regions. As such the region registered by the devcfg overlaps with the
>> xadc when initialized in a machine model (e.g. xilinx-zynq-a9).
>>
>> This patch fixes up the incorrect region size, where
>> XLNX_ZYNQ_DEVCFG_R_MAX is missing its '/ 4' causing it to be 0x460 in
>> size. As well as setting the region size to the 0x0 - 0x100 region so
>> that an xadc device instance can be registered in the correct region to
>> pair with the devcfg device instance.
>>
>> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x118:
>>   dev: xlnx.ps7-dev-cfg, id ""
>>     mmio 00000000f8007000/0000000000000460
>>   dev: xlnx,zynq-xadc, id ""
>>     mmio 00000000f8007100/0000000000000020
>>
>> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x100 / 4:
>>   dev: xlnx.ps7-dev-cfg, id ""
>>     mmio 00000000f8007000/0000000000000100
>>   dev: xlnx,zynq-xadc, id ""
>>     mmio 00000000f8007100/0000000000000020
>>
>> Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
>
> Good catch. What came up that caused you to find this?

It appeared as a regression on the xilinx-zynq-a9 machine when booting
a Linux kernel/device-tree that made use of the xadc. It hangs during
kernel boot when it attempts to access the xadc registers.

Regards,
Nathan

>
> Can this go via the target-arm queue Peter?
>
> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
>
> Thanks,
>
> Alistair
>
>> ---
>>  include/hw/dma/xlnx-zynq-devcfg.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-devcfg.h
>> index d40e5c8df6..9f5119a89a 100644
>> --- a/include/hw/dma/xlnx-zynq-devcfg.h
>> +++ b/include/hw/dma/xlnx-zynq-devcfg.h
>> @@ -34,7 +34,7 @@
>>  #define XLNX_ZYNQ_DEVCFG(obj) \
>>      OBJECT_CHECK(XlnxZynqDevcfg, (obj), TYPE_XLNX_ZYNQ_DEVCFG)
>>
>> -#define XLNX_ZYNQ_DEVCFG_R_MAX 0x118
>> +#define XLNX_ZYNQ_DEVCFG_R_MAX (0x100 / 4)
>>
>>  #define XLNX_ZYNQ_DEVCFG_DMA_CMD_FIFO_LEN 10
>>
>> --
>> 2.9.3
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX
  2016-09-21 20:40 ` Alistair Francis
  2016-09-22 12:19   ` Nathan Rossi
@ 2016-09-22 13:39   ` Peter Maydell
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2016-09-22 13:39 UTC (permalink / raw)
  To: Alistair Francis
  Cc: Nathan Rossi, qemu-devel@nongnu.org Developers, Edgar E. Iglesias

On 21 September 2016 at 21:40, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> On Wed, Sep 21, 2016 at 11:09 AM, Nathan Rossi <nathan@nathanrossi.com> wrote:
>> Whilst according to the Zynq TRM this device covers a register region of
>> 0x000 - 0x120. The register region is also shared with XADCIF prefix
>> registers at 0x100 and above. Due to how the devcfg and the xadc devices
>> are implemented in QEMU these are separate models with individual mmio
>> regions. As such the region registered by the devcfg overlaps with the
>> xadc when initialized in a machine model (e.g. xilinx-zynq-a9).
>>
>> This patch fixes up the incorrect region size, where
>> XLNX_ZYNQ_DEVCFG_R_MAX is missing its '/ 4' causing it to be 0x460 in
>> size. As well as setting the region size to the 0x0 - 0x100 region so
>> that an xadc device instance can be registered in the correct region to
>> pair with the devcfg device instance.
>>
>> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x118:
>>   dev: xlnx.ps7-dev-cfg, id ""
>>     mmio 00000000f8007000/0000000000000460
>>   dev: xlnx,zynq-xadc, id ""
>>     mmio 00000000f8007100/0000000000000020
>>
>> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x100 / 4:
>>   dev: xlnx.ps7-dev-cfg, id ""
>>     mmio 00000000f8007000/0000000000000100
>>   dev: xlnx,zynq-xadc, id ""
>>     mmio 00000000f8007100/0000000000000020
>>
>> Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
>
> Good catch. What came up that caused you to find this?
>
> Can this go via the target-arm queue Peter?
>
> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>

Sure; applied to target-arm.next.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX
  2016-09-22 12:19   ` Nathan Rossi
@ 2016-09-22 17:04     ` Alistair Francis
  0 siblings, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2016-09-22 17:04 UTC (permalink / raw)
  To: Nathan Rossi
  Cc: Alistair Francis, Peter Maydell, qemu-devel@nongnu.org Developers,
	Edgar E. Iglesias

On Thu, Sep 22, 2016 at 5:19 AM, Nathan Rossi <nathan@nathanrossi.com> wrote:
> On Thu, Sep 22, 2016 at 6:40 AM, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> On Wed, Sep 21, 2016 at 11:09 AM, Nathan Rossi <nathan@nathanrossi.com> wrote:
>>> Whilst according to the Zynq TRM this device covers a register region of
>>> 0x000 - 0x120. The register region is also shared with XADCIF prefix
>>> registers at 0x100 and above. Due to how the devcfg and the xadc devices
>>> are implemented in QEMU these are separate models with individual mmio
>>> regions. As such the region registered by the devcfg overlaps with the
>>> xadc when initialized in a machine model (e.g. xilinx-zynq-a9).
>>>
>>> This patch fixes up the incorrect region size, where
>>> XLNX_ZYNQ_DEVCFG_R_MAX is missing its '/ 4' causing it to be 0x460 in
>>> size. As well as setting the region size to the 0x0 - 0x100 region so
>>> that an xadc device instance can be registered in the correct region to
>>> pair with the devcfg device instance.
>>>
>>> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x118:
>>>   dev: xlnx.ps7-dev-cfg, id ""
>>>     mmio 00000000f8007000/0000000000000460
>>>   dev: xlnx,zynq-xadc, id ""
>>>     mmio 00000000f8007100/0000000000000020
>>>
>>> Mapping with XLNX_ZYNQ_DEVCFG_R_MAX = 0x100 / 4:
>>>   dev: xlnx.ps7-dev-cfg, id ""
>>>     mmio 00000000f8007000/0000000000000100
>>>   dev: xlnx,zynq-xadc, id ""
>>>     mmio 00000000f8007100/0000000000000020
>>>
>>> Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
>>
>> Good catch. What came up that caused you to find this?
>
> It appeared as a regression on the xilinx-zynq-a9 machine when booting
> a Linux kernel/device-tree that made use of the xadc. It hangs during
> kernel boot when it attempts to access the xadc registers.

Good catch, thanks for fixing this.

Thanks,

Alistair

>
> Regards,
> Nathan
>
>>
>> Can this go via the target-arm queue Peter?
>>
>> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
>>
>> Thanks,
>>
>> Alistair
>>
>>> ---
>>>  include/hw/dma/xlnx-zynq-devcfg.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-devcfg.h
>>> index d40e5c8df6..9f5119a89a 100644
>>> --- a/include/hw/dma/xlnx-zynq-devcfg.h
>>> +++ b/include/hw/dma/xlnx-zynq-devcfg.h
>>> @@ -34,7 +34,7 @@
>>>  #define XLNX_ZYNQ_DEVCFG(obj) \
>>>      OBJECT_CHECK(XlnxZynqDevcfg, (obj), TYPE_XLNX_ZYNQ_DEVCFG)
>>>
>>> -#define XLNX_ZYNQ_DEVCFG_R_MAX 0x118
>>> +#define XLNX_ZYNQ_DEVCFG_R_MAX (0x100 / 4)
>>>
>>>  #define XLNX_ZYNQ_DEVCFG_DMA_CMD_FIFO_LEN 10
>>>
>>> --
>>> 2.9.3
>>>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-22 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-21 18:09 [Qemu-devel] [PATCH] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX Nathan Rossi
2016-09-21 20:40 ` Alistair Francis
2016-09-22 12:19   ` Nathan Rossi
2016-09-22 17:04     ` Alistair Francis
2016-09-22 13:39   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).