Skip to contentSkip to conversation

dt: add /cpus/ibm, powerpc-cpu-features device tree bindings

PATCH Applied Nicholas Piggin 2 participants 2 messages Feb 16, 2018 – Feb 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dt: add /cpus/ibm, powerpc-cpu-features device tree bindings

This is a new CPU feature advertising interface that is fine-grained, extensible, aware of privilege levels, and gives control of features to all levels of the stack (firmware, hypervisor, and OS).

The design and binding specification is described in detail in doc/.

---
Since v1:

- Fold branch-v3 into fixed-point-v3, as pointed out by Segher they are all fixed point facilities.

- Fixed typo (Segher)

 core/Makefile.inc                                  |   2 +-
 core/cpufeatures.c                                 | 921 +++++++++++++++++++++
 core/device.c                                      |   7 +
 core/init.c                                        |   1 +
 .../ibm,powerpc-cpu-features/binding.txt           | 245 ++++++
 .../ibm,powerpc-cpu-features/design.txt            | 157 ++++
 include/device.h                                   |   1 +
 include/skiboot.h                                  |   5 +
 8 files changed, 1338 insertions(+), 1 deletion(-)
 create mode 100644 core/cpufeatures.c
 create mode 100644 doc/device-tree/ibm,powerpc-cpu-features/binding.txt
 create mode 100644 doc/device-tree/ibm,powerpc-cpu-features/design.txt
core/Makefile.inc +1 -1
index d6a7269f..5c120564 100644
@@ -9,7 +9,7 @@ CORE_OBJS += vpd.o hostservices.o platform.o nvram.o nvram-format.o hmi.o
 CORE_OBJS += console-log.o ipmi.o time-utils.o pel.o pool.o errorlog.o
 CORE_OBJS += timer.o i2c.o rtc.o flash.o sensor.o ipmi-opal.o
 CORE_OBJS += flash-subpartition.o bitmap.o buddy.o pci-quirk.o powercap.o psr.o
-CORE_OBJS += pci-dt-slot.o direct-controls.o
+CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o
 
 ifeq ($(SKIBOOT_GCOV),1)
 CORE_OBJS += gcov-profiling.o
core/cpufeatures.c new file +921 -0

921 lines not on this page · raw message

core/device.c +7 -0
index 50fbb186..38dbdfc0 100644
@@ -598,6 +598,13 @@ u32 dt_property_get_cell(const struct dt_property *prop, u32 index)
 	return fdt32_to_cpu(((const u32 *)prop->prop)[index]);
 }
 
+void dt_property_set_cell(struct dt_property *prop, u32 index, u32 val)
+{
+	assert(prop->len >= (index+1)*sizeof(u32));
+	/* Always aligned, so this works. */
+	((u32 *)prop->prop)[index] = cpu_to_fdt32(val);
+}
+
 /* First child of this node. */
 struct dt_node *dt_first(const struct dt_node *root)
 {
core/init.c +1 -0
index 5736d330..e8c84a95 100644
@@ -876,6 +876,7 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
 	} else {
 		dt_expand(fdt);
 	}
+	dt_add_cpufeatures(dt_root);
 
 	/* Now that we have a full devicetree, verify that we aren't on fire. */
 	per_thread_sanity_checks();
doc/device-tree/ibm,powerpc-cpu-features/binding.txt new file +245 -0

245 lines not on this page · raw message

doc/device-tree/ibm,powerpc-cpu-features/design.txt new file +157 -0

157 lines not on this page · raw message

include/device.h +1 -0
index 1e5875dc..fd66df11 100644
@@ -141,6 +141,7 @@ void dt_check_del_prop(struct dt_node *node, const char *name);
 /* Warning: moves *prop! */
 void dt_resize_property(struct dt_property **prop, size_t len);
 
+void dt_property_set_cell(struct dt_property *prop, u32 index, u32 val);
 u32 dt_property_get_cell(const struct dt_property *prop, u32 index);
 
 /* First child of this node. */
include/skiboot.h +5 -0
index d1de10a4..2f81a058 100644
@@ -195,6 +195,11 @@ extern void start_kernel_secondary(uint64_t entry) __noreturn;
 /* Get description of machine from HDAT and create device-tree */
 extern int parse_hdat(bool is_opal);
 
+struct dt_node;
+
+/* Add /cpus/features node for boot environment that passes an fdt */
+extern void dt_add_cpufeatures(struct dt_node *root);
+
 /* Root of device tree. */
 extern struct dt_node *dt_root;
 
Signature · 1 line
2.16.1
#1 lore raw
Quoted 27 lines · Nicholas Piggin

This is a new CPU feature advertising interface that is fine-grained, extensible, aware of privilege levels, and gives control of features to all levels of the stack (firmware, hypervisor, and OS).

The design and binding specification is described in detail in doc/.

---
Since v1:

- Fold branch-v3 into fixed-point-v3, as pointed out by Segher they are all fixed point facilities.

- Fixed typo (Segher)

 core/Makefile.inc                                  |   2 +-
 core/cpufeatures.c                                 | 921 +++++++++++++++++++++
 core/device.c                                      |   7 +
 core/init.c                                        |   1 +
 .../ibm,powerpc-cpu-features/binding.txt           | 245 ++++++
 .../ibm,powerpc-cpu-features/design.txt            | 157 ++++
 include/device.h                                   |   1 +
 include/skiboot.h                                  |   5 +
 8 files changed, 1338 insertions(+), 1 deletion(-)
 create mode 100644 core/cpufeatures.c
 create mode 100644 doc/device-tree/ibm,powerpc-cpu-features/binding.txt
 create mode 100644
Quoted 1 line

doc/device-tree/ibm,powerpc-cpu-features/design.txt

Merged to master as of 7f4c8e8ce0b78ca046643d7f4f63d81f4fd11746 and has made it into -rc4

Signature · 2 lines
Stewart Smith
OPAL Architect, IBM.