Skip to contentSkip to conversation

xen/arm: Blacklist the memory mapped timer (armv7-timer-mem)

PATCH Superseded Julien Grall 2 participants 4 messages Jan 13, 2015 – Jan 14, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Blacklist the memory mapped timer (armv7-timer-mem)

Some platform (such as the VFP Base AEMv8 model) has a memory mapped timer. We don't want DOM0 use this timer rather than the generic ARM timer. So blacklist it for all platforms.

---
This patch is candidate to backport for Xen 4.5 and Xen 4.4.

It may not apply correctly for Xen 4.4.

---
 xen/arch/arm/domain_build.c | 1 +
 1 file changed, 1 insertion(+)
xen/arch/arm/domain_build.c +1 -0
index bf8dc78..16ce248 100644
@@ -1047,6 +1047,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
         DT_MATCH_COMPATIBLE("arm,psci"),
         DT_MATCH_PATH("/cpus"),
         DT_MATCH_TYPE("memory"),
+        DT_MATCH_COMPATIBLE("arm,armv7-timer-mem"),
         { /* sentinel */ },
     };
     static const struct dt_device_match gic_matches[] __initconst =
Signature · 1 line
2.1.4
#1 lore raw
Quoted 3 lines · Julien Grall

Some platform (such as the VFP Base AEMv8 model) has a memory mapped timer. We don't want DOM0 use this timer rather than the generic ARM timer. So blacklist it for all platforms.

It seems that these registers contain things like the ability to stop the counter or change its frequency. So we certainly don't want dom0 getting at those!

It's not clear to me if accesses to these registers are trapped according to the controls available for the CP registers, or if we would have to resort to trapping the entire MMIO page if we wanted to support access to these registers (I don't think we would want to anyway).

Quoted 15 lines

---
This patch is candidate to backport for Xen 4.5 and Xen 4.4.

It may not apply correctly for Xen 4.4.

---
 xen/arch/arm/domain_build.c | 1 +
 1 file changed, 1 insertion(+)
xen/arch/arm/domain_build.c +0 -0
index bf8dc78..16ce248 100644

xen/arch/arm/domain_build.c static int handle_node(struct domain *d, struct kernel_info *kinfo, · line 1050

Quoted 4 lines
xen/arch/arm/domain_build.c +1 -0
@@ -1047,6 +1047,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
         DT_MATCH_COMPATIBLE("arm,psci"),
         DT_MATCH_PATH("/cpus"),
         DT_MATCH_TYPE("memory"),
+        DT_MATCH_COMPATIBLE("arm,armv7-timer-mem"),

This is a bit less obvious that the other things in this list. Could you perhaps add a comment?

Quoted 3 lines
xen/arch/arm/domain_build.c +0 -0
         { /* sentinel */ },
     };
     static const struct dt_device_match gic_matches[] __initconst =
#2 lore raw

Hi Ian,

Quoted 5 lines · Ian Campbell
Quoted 3 lines · Julien Grall

Some platform (such as the VFP Base AEMv8 model) has a memory mapped timer. We don't want DOM0 use this timer rather than the generic ARM timer. So blacklist it for all platforms.

Quoted 8 lines

It seems that these registers contain things like the ability to stop the counter or change its frequency. So we certainly don't want dom0 getting at those!

It's not clear to me if accesses to these registers are trapped according to the controls available for the CP registers, or if we would have to resort to trapping the entire MMIO page if we wanted to support access to these registers (I don't think we would want to anyway).

I didn't find any spec for the memory mapped timer. But looking to the driver, it looks like they also have the concept of physical/virtual. So we may not need to trap.

Anyway, before implementing anything I'd like to find the corresponding spec.

Quoted 10 lines
Quoted 10 lines

---
This patch is candidate to backport for Xen 4.5 and Xen 4.4.

It may not apply correctly for Xen 4.4.

---
 xen/arch/arm/domain_build.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

xen/arch/arm/domain_build.c static int handle_node(struct domain *d, struct kernel_info *kinfo, · line 1050

Quoted 9 lines
xen/arch/arm/domain_build.c +1 -0
index bf8dc78..16ce248 100644
@@ -1047,6 +1047,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
         DT_MATCH_COMPATIBLE("arm,psci"),
         DT_MATCH_PATH("/cpus"),
         DT_MATCH_TYPE("memory"),
+        DT_MATCH_COMPATIBLE("arm,armv7-timer-mem"),

This is a bit less obvious that the other things in this list. Could you perhaps add a comment?

Sure. I will send a new version.

Regards,

Signature · 1 line
Julien Grall
#3 lore raw
Quoted 17 lines · Julien Grall

Hi Ian,

Quoted 5 lines · Ian Campbell
Quoted 3 lines · Julien Grall

Some platform (such as the VFP Base AEMv8 model) has a memory mapped timer. We don't want DOM0 use this timer rather than the generic ARM timer. So blacklist it for all platforms.

Quoted 8 lines

It seems that these registers contain things like the ability to stop the counter or change its frequency. So we certainly don't want dom0 getting at those!

It's not clear to me if accesses to these registers are trapped according to the controls available for the CP registers, or if we would have to resort to trapping the entire MMIO page if we wanted to support access to these registers (I don't think we would want to anyway).

Quoted 6 lines

I didn't find any spec for the memory mapped timer. But looking to the driver, it looks like they also have the concept of physical/virtual. So we may not need to trap.

Anyway, before implementing anything I'd like to find the corresponding spec.

It's in the ARM ARM, Appendix E of v7, plus references from Chapter B8.

I'd imagine it was in the v8 ARM ARM too, but I've not looked.

Ian.