Skip to contentSkip to conversation

arm: Add PL031 test

PATCH New Alexander Graf 1 participant 1 message Jul 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 arm: Add PL031 test

This patch adds a unit test for the PL031 RTC that is used in the virt machine. It just pokes basic functionality. I've mostly written it to familiarize myself with the device, but I suppose having the test around does not hurt, as it also exercises the GIC SPI interrupt path.

---

v1 -> v2:

- Use FDT to find base, irq and existence
- Put isb after timer read
- Use dist_base for gicv3

v2 -> v3

- Enable compilation on 32bit ARM target
- Use ioremap

v3 -> v4:

- Use dt_pbus_translate_node()
- Make irq_triggered volatile

v4 -> v5:

- Make assert() call stand alone so it can be compiled out

---
 arm/Makefile.common |   1 +
 arm/pl031.c         | 262 ++++++++++++++++++++++++++++++++++++++++++++
 lib/arm/asm/gic.h   |   1 +
 3 files changed, 264 insertions(+)
 create mode 100644 arm/pl031.c
arm/Makefile.common +1 -0
index f0c4b5d..b8988f2 100644
@@ -11,6 +11,7 @@ tests-common += $(TEST_DIR)/pmu.flat
 tests-common += $(TEST_DIR)/gic.flat
 tests-common += $(TEST_DIR)/psci.flat
 tests-common += $(TEST_DIR)/sieve.flat
+tests-common += $(TEST_DIR)/pl031.flat
 
 tests-all = $(tests-common) $(tests)
 all: directories $(tests-all)
arm/pl031.c new file +262 -0

262 lines not on this page · raw message

lib/arm/asm/gic.h +1 -0
index f6dfb90..1fc10a0 100644
@@ -41,6 +41,7 @@
 #include <asm/gic-v3.h>
 
 #define PPI(irq)			((irq) + 16)
+#define SPI(irq)			((irq) + GIC_FIRST_SPI)
 
 #ifndef __ASSEMBLY__
 #include <asm/cpumask.h>
Signature · 1 line
2.17.1