Skip to contentSkip to conversation

Zynq-7000 EPP platform model

PATCH Superseded Peter A. G. Crosthwaite 2 participants 7 messages Feb 11, 2012 – Feb 12, 2012

Subsystems (2)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v3 cover Zynq-7000 EPP platform model

This is 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.

Tree is available from:
git://developer.petalogix.com/private/peterc/qemu.git

---
changed from v2:
fixed timer prescision issue (2/4)
fixed compile warnings in zynq_arm_sysctl (4/4)
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     |  435 ++++++++++++++++++
 hw/cadence_uart.c    |  561 +++++++++++++++++++++++
 hw/xilinx_zynq.c     |  178 ++++++++
 hw/zynq_arm_sysctl.c |  526 +++++++++++++++++++++
 7 files changed, 2938 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

PATCH v3 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 29fde6e..411a4bf 100644
@@ -343,6 +343,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

PATCH v3 2/4 cadence_ttc: initial version of device model

In reply to Peter A. G. Crosthwaite

Implemented cadence Triple Timer Counter (TCC)

---
changed from v2
changed ptimer to QEMUTimer (Fixed skew/drift issue in timer delays) changes from v1
refactored event driven code
marked vmsd as unmigratable

 Makefile.target  |    1 +
 hw/cadence_ttc.c |  435 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 436 insertions(+), 0 deletions(-)
 create mode 100644 hw/cadence_ttc.c
Makefile.target +1 -0
index 411a4bf..1e8afe6 100644
@@ -344,6 +344,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 +435 -0

435 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#6 lore raw

PATCH v3 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 v2:
removed 2 compile warnings from zynq_arm_sysctl.c
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 84b559c..40fd1b2 100644
@@ -346,6 +346,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
#5 lore raw

PATCH v3 3/4 cadence_gem: initial version of device model

In reply to Peter A. G. Crosthwaite

Device model for cadence gem ethernet controller.

---
changes from v1:
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 1e8afe6..84b559c 100644
@@ -345,6 +345,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
#3 lore raw

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

In reply to Peter A. G. Crosthwaite

hw/cadence_ttc.c line 198

Quoted 11 lines
hw/cadence_ttc.c new file +4 -0
+static void cadence_timer_sync(CadenceTimerState *s)
+{
...
+    r = (int64_t)cadence_timer_get_steps(s, s->cpu_time - old_time);
+    x = (int64_t)s->reg_value + ((s->reg_count & COUNTER_CTRL_DEC) ? -r :

r); +

hw/cadence_ttc.c new file +5 -0
+    for (i = 0; i < 3; ++i) {
+        if (is_between((int64_t)s->reg_match[i] << 16, s->reg_value, x)) {
+            s->reg_intr |= (2 << i);
+        }
+    }

By my reading this will miss events if they happen after the timer wraps. e.g. for a count-up timer with reg_match==1 and the tick callback happens to get delayed by 4 cycles, the timer may wrap straight to reg_value = 3.

Paul

#4 lore raw

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

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

Quoted 14 lines

hw/cadence_ttc.c

Quoted 5 lines
hw/cadence_ttc.c new file +4 -0
+static void cadence_timer_sync(CadenceTimerState *s)
+{
...
+    r = (int64_t)cadence_timer_get_steps(s, s->cpu_time - old_time);
+    x = (int64_t)s->reg_value + ((s->reg_count & COUNTER_CTRL_DEC) ? -r

:

Review

Quoted 3 lines

r); +

(quoted diff) +2 -0
+    for (i = 0; i < 3; ++i) {
+        if (is_between((int64_t)s->reg_match[i] << 16, s->reg_value,

x)) {

hw/cadence_ttc.c line 198

Quoted 3 lines
hw/cadence_ttc.c new file +3 -0
+            s->reg_intr |= (2 << i);
+        }
+    }
Quoted 7 lines

By my reading this will miss events if they happen after the timer wraps. e.g. for a count-up timer with reg_match==1 and the tick callback happens to
get delayed by 4 cycles, the timer may wrap straight to reg_value = 3.

Paul

Yeh, good catch. Will change to something like this on the next revision:

    for (i = 0; i < 3; ++i) {
             int64_t m =  (int64_t)s->reg_match[i] << 16;
             if (is_between(m, s->reg_value, x) ||
                is_between(m+interval, s->reg_value, x) ||
                is_between(m-interval, s->reg_value, x)
             ) {
                  s->reg_intr |= (2 << i);
             }
    }

Any other thoughts or comments on this series?