Skip to contentSkip to conversation

Zynq-7000 EPP platform model

RFC PATCH Superseded Peter A. G. Crosthwaite 2 participants 13 messages Feb 7, 2012 – Feb 8, 2012

Subsystems (2)

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v2 cover Zynq-7000 EPP platform model

This is an RFC for a suite of Device models and a machine model for the Xilinx Zynq-7000 Extensible Processing Platform:

http://www.xilinx.com/products/silicon-devices/epp/zynq-7000/index.htm

This is an ARM based platform featuring embedded SoC peripherals. This patch series includes a minimal set of device models and a a machine model capable of emulating zynq platforms booting linux.

This first 3 patches in this series are device models for IP provided by cadence for the Zynq platform. The final patch is the initial revision of the zynq machine model.

Most of this work was originally authored by Xilinx, as indicated by (c) notices in added files.

---
changes from v1:
formatting and style fixes
updated for QOM
removed former patch 3 (cadence WDT device model) - not required
removed former patch 5 (dtb argument) - this is currently under discussion in other patch series' removed former patch 6 (initrd parameterisation) - not required for minimal boot

Peter A. G. Crosthwaite (4):
cadence_uart: initial version of device model
cadence_ttc: initial version of device model
cadence_gem: initial version of device model
xilinx_zynq: machine model initial version

 MAINTAINERS          |    5 +
 Makefile.target      |    4 +
 hw/cadence_gem.c     | 1229 ++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/cadence_ttc.c     |  399 ++++++++++++++++
 hw/cadence_uart.c    |  561 +++++++++++++++++++++++
 hw/xilinx_zynq.c     |  178 ++++++++
 hw/zynq_arm_sysctl.c |  526 +++++++++++++++++++++
 7 files changed, 2902 insertions(+), 0 deletions(-)
 create mode 100644 hw/cadence_gem.c
 create mode 100644 hw/cadence_ttc.c
 create mode 100644 hw/cadence_uart.c
 create mode 100644 hw/xilinx_zynq.c
 create mode 100644 hw/zynq_arm_sysctl.c
Signature · 1 line
1.7.3.2
#1 lore raw

RFC PATCH v2 1/4 cadence_uart: initial version of device model

Implemented cadence UART serial controller

---
changes from v1:
converted register file to array
added vmsd state save/load support
removed read side effects from CISR register

 Makefile.target   |    1 +
 hw/cadence_uart.c |  561 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 562 insertions(+), 0 deletions(-)
 create mode 100644 hw/cadence_uart.c
Makefile.target +1 -0
index 68481a3..620a91d 100644
@@ -337,6 +337,7 @@ endif
 obj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o
 obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
 obj-arm-y += versatile_pci.o
+obj-arm-y += cadence_uart.o
 obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
 obj-arm-y += arm_l2x0.o
 obj-arm-y += arm_mptimer.o
hw/cadence_uart.c new file +561 -0

561 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#2 lore raw

RFC PATCH v2 2/4 cadence_ttc: initial version of device model

In reply to Peter A. G. Crosthwaite

Implemented cadence Triple Timer Counter (TCC)

---
changes from v1
refactored event driven code
marked vmsd as unmigratable

 Makefile.target  |    1 +
 hw/cadence_ttc.c |  399 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 400 insertions(+), 0 deletions(-)
 create mode 100644 hw/cadence_ttc.c
Makefile.target +1 -0
index 620a91d..feefafa 100644
@@ -338,6 +338,7 @@ obj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o
 obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
 obj-arm-y += versatile_pci.o
 obj-arm-y += cadence_uart.o
+obj-arm-y += cadence_ttc.o
 obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
 obj-arm-y += arm_l2x0.o
 obj-arm-y += arm_mptimer.o
hw/cadence_ttc.c new file +399 -0

399 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#9 lore raw

RFC PATCH v2 3/4 cadence_gem: initial version of device model

In reply to Peter A. G. Crosthwaite

Device model for cadence gem ethernet controller.

---
removed global init function
marked vmsd as unmigratable
cleaned up debug messages

 Makefile.target  |    1 +
 hw/cadence_gem.c | 1229 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1230 insertions(+), 0 deletions(-)
 create mode 100644 hw/cadence_gem.c
Makefile.target +1 -0
index feefafa..e02a56b 100644
@@ -339,6 +339,7 @@ obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
 obj-arm-y += versatile_pci.o
 obj-arm-y += cadence_uart.o
 obj-arm-y += cadence_ttc.o
+obj-arm-y += cadence_gem.o
 obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
 obj-arm-y += arm_l2x0.o
 obj-arm-y += arm_mptimer.o
hw/cadence_gem.c new file +1229 -0

1,229 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#10 lore raw

RFC PATCH v2 4/4 xilinx_zynq: machine model initial version

In reply to Peter A. G. Crosthwaite

Xilinx zynq-7000 machine model. Also includes device model for the zynq-specific system level control register (SLCR) module.

---
changes since v1:
Added gem init function
remowed WDT instantiation
Added maintainers information
removed dead sys_id and proc_id variables

 MAINTAINERS          |    5 +
 Makefile.target      |    1 +
 hw/xilinx_zynq.c     |  178 +++++++++++++++++
 hw/zynq_arm_sysctl.c |  526 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 710 insertions(+), 0 deletions(-)
 create mode 100644 hw/xilinx_zynq.c
 create mode 100644 hw/zynq_arm_sysctl.c
MAINTAINERS +5 -0
index 173e893..9246bfa 100644
@@ -237,6 +237,11 @@ M: Peter Maydell <[email protected]>
 S: Maintained
 F: hw/versatilepb.c
 
+Xilinx Zynq
+M: Peter Crosthwaite <[email protected]>
+S: Maintained
+F: hw/xilinx_zynq.c
+
 CRIS Machines
 -------------
 Axis Dev88
Makefile.target +1 -0
index e02a56b..87a8662 100644
@@ -340,6 +340,7 @@ obj-arm-y += versatile_pci.o
 obj-arm-y += cadence_uart.o
 obj-arm-y += cadence_ttc.o
 obj-arm-y += cadence_gem.o
+obj-arm-y += xilinx_zynq.o zynq_arm_sysctl.o
 obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
 obj-arm-y += arm_l2x0.o
 obj-arm-y += arm_mptimer.o
hw/xilinx_zynq.c new file +178 -0

178 lines not on this page · raw message

hw/zynq_arm_sysctl.c new file +526 -0

526 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#3 lore raw

Re: [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: initial version of device model

In reply to Peter A. G. Crosthwaite
Quoted 1 line

Implemented cadence Triple Timer Counter (TCC)

It looks like you're implementing a periodic timer as sequence of chained oneshot timers. This is a bad idea. In qemu interrupt latency may be high, so you're likely to suffer from significant time skew.

Paul

#4 lore raw

Re: [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: initial version of device model

2012/2/7 Paul Brook <[email protected]>

Quoted 8 lines
Quoted 1 line

Implemented cadence Triple Timer Counter (TCC)

It looks like you're implementing a periodic timer as sequence of chained oneshot timers. This is a bad idea. In qemu interrupt latency may be high,
so you're likely to suffer from significant time skew.

Ok, I could implemented the wraparound event as a periodic timer and the

match events are kicked off as seperate one-shot timers when the wrap around occurs? There would still be a small delay on match events, but it would get rid of the integration effect of lots of little delays (over many wrap arounds) add up to a significant skew.

Quoted 2 lines

Paul

#12 lore raw
In reply to Paul Brook

2012/2/7 Paul Brook <[email protected]>

Quoted 11 lines
Quoted 4 lines

This is an RFC for a suite of Device models and a machine model for the Xilinx Zynq-7000 Extensible Processing Platform:

http://www.xilinx.com/products/silicon-devices/epp/zynq-7000/index.htm

I don't see any documentation on that page. Are technical docs available? It's much easier to review (and maintain) this sort of thing if we can cross-
reference with the programming manuals.

The TRM for the platform is yet to be disclosed - this series was

developed off a pre-release version of the TRM. We will request disclosure for the purposes of this review.

Quoted 2 lines

Paul

Peter

#5 lore raw

Re: [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: initial version of device model

In reply to Peter Crosthwaite
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Implemented cadence Triple Timer Counter (TCC)

It looks like you're implementing a periodic timer as sequence of chained oneshot timers. This is a bad idea. In qemu interrupt latency may be high,
so you're likely to suffer from significant time skew.

Quoted 5 lines

Ok, I could implemented the wraparound event as a periodic timer and the match events are kicked off as seperate one-shot timers when the wrap around occurs? There would still be a small delay on match events, but it would get rid of the integration effect of lots of little delays (over many wrap arounds) add up to a significant skew.

I'm not sure why you need the oneshot timers at all. But then again I'm not really sure what the desired semantics are either :-)

It would help me if you could describe how these timers operate. In particular:

- Are they free running. i.e. keep counting until explicitly stopped by the user, or stop when an event occurs.
- When are interrupts raised. You mention a user specified match value. Do we also get an interrupt on wraparound?
- What happens when the timer hits the limit (zero if count-down, match value if count-up)? Does it wrap? or load a fixed value?

If you've got independent wrap and match events then I guess yes, a periodic wrap plus a oneshot match event is probably appropriate.

If wrapping does not generate an interrupt, or wrap and match are effectively the same thing then you just need to transpose the counter onto a single periodic timer.

If the timers can be configured in both periodic and oneshot modes, then you may want to have different implementations based on that.

Paul

#6 lore raw

Re: [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: initial version of device model

2012/2/8 Paul Brook <[email protected]>

Quoted 12 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Implemented cadence Triple Timer Counter (TCC)

It looks like you're implementing a periodic timer as sequence of

chained

Quoted 8 lines
Quoted 4 lines

oneshot timers. This is a bad idea. In qemu interrupt latency may be high,
so you're likely to suffer from significant time skew.

Ok, I could implemented the wraparound event as a periodic timer and the match events are kicked off as seperate one-shot timers when the wrap around occurs? There would still be a small delay on match events, but it would get rid of the integration effect of lots of little delays (over

Quoted 6 lines

many

Quoted 1 line

wrap arounds) add up to a significant skew.

I'm not sure why you need the oneshot timers at all. But then again I'm not really sure what the desired semantics are either :-)

It would help me if you could describe how these timers operate.

Quoted 6 lines

In particular:

- Are they free running. i.e. keep counting until explicitly stopped by the
user, or stop when an event occurs.

Free running

Quoted 4 lines

- When are interrupts raised. You mention a user specified match value. Do
we also get an interrupt on wraparound?

Yes, an interrupts occur on wrap around of the 16 bit timer value. There are three match registers which correspond to three more
(separately maskable) interrupts which are risen when the timer crosses
that value. My implementation will figure out which of the three events (or the wraparound) will occur next, and one shot the corresponding period of time. Note that a match can occur an raise an interrupt without a wrap or reset occuring. E.G. i could set my timer counting up from 0 and when the value hits BEEF, i get an interrupt, but the timer still counts all the way to FFFF before wrapping.

Quoted 5 lines

- What happens when the timer hits the limit (zero if count-down, match value
if count-up)? Does it wrap? or load a fixed value?

Either wrap or load a fixed value, there is a control bit to determine

which.

Quoted 5 lines

If you've got independent wrap and match events then I guess yes, a periodic
wrap plus a oneshot match event is probably appropriate.

Yes this is the case. I will look into making it happen.

Quoted 7 lines

If wrapping does not generate an interrupt, or wrap and match are effectively
the same thing then you just need to transpose the counter onto a single periodic timer.

Quoted 5 lines

If the timers can be configured in both periodic and oneshot modes, then you
may want to have different implementations based on that.

I dont think this will be needed, the match mechanism detail above is more of an issue and is the underlying reason for the one shot chaining implementation.

Quoted 2 lines

Paul

Peter

#7 lore raw

Re: [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: initial version of device model

Quoted 12 lines
Quoted 2 lines

- When are interrupts raised. You mention a user specified match value. Do we also get an interrupt on wraparound?

Yes, an interrupts occur on wrap around of the 16 bit timer value. There are three match registers which correspond to three more
(separately maskable) interrupts which are risen when the timer crosses
that value. My implementation will figure out which of the three events (or the wraparound) will occur next, and one shot the corresponding period of time. Note that a match can occur an raise an interrupt without a wrap or reset occuring. E.G. i could set my timer counting up from 0 and when the value hits BEEF, i get an interrupt, but the timer still counts all the way to FFFF before wrapping.

Ok. I'd missed that there are 3 matches per timer.

Quoted 5 lines
Quoted 3 lines

If you've got independent wrap and match events then I guess yes, a periodic
wrap plus a oneshot match event is probably appropriate.

Yes this is the case. I will look into making it happen.

It's probably not worth using ptimer at all.

Instead use QEMUTimer/qemu_mod_timer directly. The trick is to call qemu_get_clock_ns when the timer is started and calculate all deadlines incrementally from that, not from the time when the last timeout happened to fire. See ptimer.c:ptimer_reload/tick or stellaris.c:gptm_reload/tick for examples.

ptimer.c provides a common implementation of a simple periodic timer. Previously we had a dozen different implementations, most of which were broken in one way or annother. For more complicated devices you need to know what you're doing anyway :-)

Paul

#8 lore raw

Re: [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: initial version of device model

2012/2/8 Paul Brook <[email protected]>

Quoted 33 lines
Quoted 1 line
Quoted 1 line

- When are interrupts raised. You mention a user specified match

value.

Quoted 6 lines
Quoted 1 line

Do we also get an interrupt on wraparound?

Yes, an interrupts occur on wrap around of the 16 bit timer value. There are three match registers which correspond to three more
(separately maskable) interrupts which are risen when the timer crosses
that value. My implementation will figure out which of the three events

(or

Quoted 4 lines

the wraparound) will occur next, and one shot the corresponding period of time. Note that a match can occur an raise an interrupt without a wrap or reset occuring. E.G. i could set my timer counting up from 0 and when the value hits BEEF, i get an interrupt, but the timer still counts all the

way

Quoted 1 line

to FFFF before wrapping.

Ok. I'd missed that there are 3 matches per timer.

Quoted 5 lines
Quoted 3 lines

If you've got independent wrap and match events then I guess yes, a periodic
wrap plus a oneshot match event is probably appropriate.

Yes this is the case. I will look into making it happen.

It's probably not worth using ptimer at all.

Instead use QEMUTimer/qemu_mod_timer directly. The trick is to call qemu_get_clock_ns when the timer is started and calculate all deadlines incrementally from that, not from the time when the last timeout happened to
fire. See ptimer.c:ptimer_reload/tick or stellaris.c:gptm_reload/tick for examples.

Quoted 7 lines

ptimer.c provides a common implementation of a simple periodic timer. Previously we had a dozen different implementations, most of which were broken
in one way or annother. For more complicated devices you need to know what you're doing anyway :-)

Ok, this would lead to a more minimal change then :). Just replace ptimer with QEMUTimer and stick with the incremental deadlines approach which is pretty much the code is as it stands.

Quoted 2 lines

Paul

Peter