Skip to contentSkip to conversation

powerpc/devtree: Add support for 'ibm,drc-info' property

PATCH In review Michael Bringmann 2 participants 6 messages Dec 1, 2017 – Jan 22, 2018

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

v6 cover powerpc/devtree: Add support for 'ibm,drc-info' property

Several properties in the DRC device tree format are replaced by more compact representations to allow, for example, for the encoding of vast amounts of memory, and or reduced duplication of information in related data structures.

"ibm,drc-info": This property, when present, replaces the following four properties: "ibm,drc-indexes", "ibm,drc-names", "ibm,drc-types" and "ibm,drc-power-domains". This property is defined for all dynamically reconfigurable platform nodes. The "ibm,drc-info" elements are intended to provide a more compact representation, and reduce some search overhead.

"ibm,architecture.vec": Bidirectional communication mechanism between the host system and the front end processor indicating what features the host system supports and what features the front end processor will actually provide. In this case, we are indicating that the host system can support the new device tree structure "ibm,drc-info".

Michael Bringmann (4):
powerpc/firmware: Add definitions for new drc-info firmware feature. pseries/drc-info: Search new DRC properties for CPU indexes hotplug/drc-info: Add code to search new devtree property
powerpc: Enable support for new DRC devtree property
---
Changes in V6:
-- Simplify of_prop_next_u32 invocation
-- Remove unnecessary WARN_ON() tests
-- Fix some spacing within expressions
-- Revise drc_type/drc_name checks in rpaphp_check_drc_props_v2()

#1 lore raw

PATCH v6 1/4 powerpc/firmware: Add definitions for new drc-info firmware feature

Firmware Features: Define new bit flag representing the presence of new device tree property "ibm,drc-info". The flag is used to tell the front end processor whether the Linux kernel supports the new property, and by the front end processor to tell the Linux kernel that the new property is present in the device tree.

---
 arch/powerpc/include/asm/firmware.h       |    3 ++-
 arch/powerpc/include/asm/prom.h           |    1 +
 arch/powerpc/platforms/pseries/firmware.c |    1 +
 3 files changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/firmware.h +2 -1
index 8645897..329d537 100644
@@ -51,6 +51,7 @@
 #define FW_FEATURE_BEST_ENERGY	ASM_CONST(0x0000000080000000)
 #define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
 #define FW_FEATURE_PRRN		ASM_CONST(0x0000000200000000)
+#define FW_FEATURE_DRC_INFO	ASM_CONST(0x0000000400000000)
 
 #ifndef __ASSEMBLY__
 
@@ -67,7 +68,7 @@ enum {
 		FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO |
 		FW_FEATURE_SET_MODE | FW_FEATURE_BEST_ENERGY |
 		FW_FEATURE_TYPE1_AFFINITY | FW_FEATURE_PRRN |
-		FW_FEATURE_HPT_RESIZE,
+		FW_FEATURE_HPT_RESIZE | FW_FEATURE_DRC_INFO,
 	FW_FEATURE_PSERIES_ALWAYS = 0,
 	FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL,
 	FW_FEATURE_POWERNV_ALWAYS = 0,
arch/powerpc/include/asm/prom.h +1 -0
index 825bd59..3243455 100644
@@ -175,6 +175,7 @@ struct of_drconf_cell {
 #define OV5_HASH_GTSE		0x1940	/* Guest Translation Shoot Down Avail */
 /* Radix Table Extensions */
 #define OV5_RADIX_GTSE		0x1A40	/* Guest Translation Shoot Down Avail */
+#define OV5_DRC_INFO		0x1640	/* Redef Prop Structures: drc-info   */
 
 /* Option Vector 6: IBM PAPR hints */
 #define OV6_LINUX		0x02	/* Linux is our OS */
arch/powerpc/platforms/pseries/firmware.c +1 -0
index 63cc82a..757d757 100644
@@ -114,6 +114,7 @@ struct vec5_fw_feature {
 vec5_fw_features_table[] = {
 	{FW_FEATURE_TYPE1_AFFINITY,	OV5_TYPE1_AFFINITY},
 	{FW_FEATURE_PRRN,		OV5_PRRN},
+	{FW_FEATURE_DRC_INFO,		OV5_DRC_INFO},
 };
 
 static void __init fw_vec5_feature_init(const char *vec5, unsigned long len)
#2 lore raw

Re: [V6, 1/4] powerpc/firmware: Add definitions for new drc-info firmware feature

Quoted 7 lines · Michael Bringmann

Firmware Features: Define new bit flag representing the presence of new device tree property "ibm,drc-info". The flag is used to tell the front end processor whether the Linux kernel supports the new property, and by the front end processor to tell the Linux kernel that the new property is present in the device tree.

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/3f38000eda485f466153d37c4f9201

cheers

#3 lore raw

PATCH v6 2/4 pseries/drc-info: Search DRC properties for CPU indexes

In reply to Michael Bringmann

pseries/drc-info: Provide parallel routines to convert between drc_index and CPU numbers at runtime, using the older device-tree properties ("ibm,drc-indexes", "ibm,drc-names", "ibm,drc-types" and "ibm,drc-power-domains"), or the new property "ibm,drc-info".

---
Changes in V6:
-- Simplify of_prop_next_u32 invocation
-- Remove unnecessary WARN_ON() tests

---
 arch/powerpc/include/asm/prom.h                 |   15 +++
 arch/powerpc/platforms/pseries/of_helpers.c     |   60 +++++++++++
 arch/powerpc/platforms/pseries/pseries_energy.c |  126 ++++++++++++++++++-----
 3 files changed, 173 insertions(+), 28 deletions(-)
arch/powerpc/include/asm/prom.h +15 -0
index 3243455..0ef41b1 100644
@@ -96,6 +96,21 @@ struct of_drconf_cell {
 #define DRCONF_MEM_AI_INVALID	0x00000040
 #define DRCONF_MEM_RESERVED	0x00000080
 
+struct of_drc_info {
+	char *drc_type;
+	char *drc_name_prefix;
+	u32 drc_index_start;
+	u32 drc_name_suffix_start;
+	u32 num_sequential_elems;
+	u32 sequential_inc;
+	u32 drc_power_domain;
+	u32 last_drc_index;
+};
+
+extern int of_read_drc_info_cell(struct property **prop,
+			const __be32 **curval, struct of_drc_info *data);
+
+
 /*
  * There are two methods for telling firmware what our capabilities are.
  * Newer machines have an "ibm,client-architecture-support" method on the
arch/powerpc/platforms/pseries/of_helpers.c +60 -0

69 lines not on this page · raw message

arch/powerpc/platforms/pseries/pseries_energy.c +98 -28

164 lines not on this page · raw message

#4 lore raw

PATCH v6 3/4 hotplug/drc-info: Add code to search ibm,drc-info property

In reply to Michael Bringmann

rpadlpar_core.c: Provide parallel routines to search the older device- tree properties ("ibm,drc-indexes", "ibm,drc-names", "ibm,drc-types" and "ibm,drc-power-domains"), or the new property "ibm,drc-info".

The interface to examine the DRC information is changed from a "get" function that returns values for local verification elsewhere, to a "check" function that validates the 'name' and/or 'type' of a device node. This update hides the format of the underlying device-tree properties, and concentrates the value checks into a single function without requiring the user to verify whether a search was successful.

---
Changes in V6:
-- Simplify of_prop_next_u32 invocation
-- Fix some spacing within expressions
-- Revise drc_type/drc_name checks in rpaphp_check_drc_props_v2()

---
 drivers/pci/hotplug/rpadlpar_core.c  |   13 ++--
 drivers/pci/hotplug/rpadlpar_sysfs.c |    3 -
 drivers/pci/hotplug/rpaphp.h         |    8 ++-
 drivers/pci/hotplug/rpaphp_core.c    |  107 ++++++++++++++++++++++++++--------
 4 files changed, 94 insertions(+), 37 deletions(-)
drivers/pci/hotplug/rpadlpar_core.c +5 -8
index a3449d7..fc01d7d 100644
@@ -27,6 +27,7 @@
 #include <linux/mutex.h>
 #include <asm/rtas.h>
 #include <asm/vio.h>
+#include <linux/firmware.h>
 
 #include "../pci.h"
 #include "rpaphp.h"
@@ -44,15 +45,14 @@ static struct device_node *find_vio_slot_node(char *drc_name)
 {
 	struct device_node *parent = of_find_node_by_name(NULL, "vdevice");
 	struct device_node *dn = NULL;
-	char *name;
 	int rc;
 
 	if (!parent)
 		return NULL;
 
 	while ((dn = of_get_next_child(parent, dn))) {
-		rc = rpaphp_get_drc_props(dn, NULL, &name, NULL, NULL);
-		if ((rc == 0) && (!strcmp(drc_name, name)))
+		rc = rpaphp_check_drc_props(dn, drc_name, NULL);
+		if (rc == 0)
 			break;
 	}
 
@@ -64,15 +64,12 @@ static struct device_node *find_php_slot_pci_node(char *drc_name,
 						  char *drc_type)
 {
 	struct device_node *np = NULL;
-	char *name;
-	char *type;
 	int rc;
 
 	while ((np = of_find_node_by_name(np, "pci"))) {
-		rc = rpaphp_get_drc_props(np, NULL, &name, &type, NULL);
+		rc = rpaphp_check_drc_props(np, drc_name, drc_type);
 		if (rc == 0)
-			if (!strcmp(drc_name, name) && !strcmp(drc_type, type))
-				break;
+			break;
 	}
 
 	return np;
drivers/pci/hotplug/rpadlpar_sysfs.c +1 -2
index edb5d8a..b806314 100644
@@ -16,6 +16,7 @@
 #include <linux/string.h>
 #include <linux/pci.h>
 #include <linux/pci_hotplug.h>
+#include "rpaphp.h"
 #include "rpadlpar.h"
 #include "../pci.h"
 
@@ -27,8 +28,6 @@
 #define ADD_SLOT_ATTR_NAME    add_slot
 #define REMOVE_SLOT_ATTR_NAME remove_slot
 
-#define MAX_DRC_NAME_LEN 64
-
 static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr,
 			      const char *buf, size_t nbytes)
 {
drivers/pci/hotplug/rpaphp.h +6 -2
index 7db024e..bdb844b 100644
@@ -64,6 +64,10 @@
 #define	CONFIGURED	1
 #define	EMPTY		0
 
+/* DRC constants */
+
+#define MAX_DRC_NAME_LEN 64
+
 /*
  * struct slot - slot information for each *physical* slot
  */
@@ -91,8 +95,8 @@ struct slot {
 
 /* rpaphp_core.c */
 int rpaphp_add_slot(struct device_node *dn);
-int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,
-		char **drc_name, char **drc_type, int *drc_power_domain);
+int rpaphp_check_drc_props(struct device_node *dn, char *drc_name,
+		char *drc_type);
 
 /* rpaphp_slot.c */
 void dealloc_slot_struct(struct slot *slot);
drivers/pci/hotplug/rpaphp_core.c +82 -25

137 lines not on this page · raw message

#5 lore raw

PATCH v6 4/4 powerpc: Enable support for ibm,drc-info devtree property

In reply to Michael Bringmann

To: [email protected]

From: Michael Bringmann <[email protected]>

Cc: Michael Bringmann <[email protected]>
Cc: [email protected]
Subject: [PATCH V6 4/4] powerpc: Enable support for ibm,drc-info devtree property

prom_init.c: Enable support for new DRC device tree property "ibm,drc-info" in initial handshake between the Linux kernel and the front end processor.

---
 arch/powerpc/kernel/prom_init.c |    1 +
 1 file changed, 1 insertion(+)
arch/powerpc/kernel/prom_init.c +1 -0
index 02190e9..f962908 100644
@@ -873,6 +873,7 @@ struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = {
 		.mmu = 0,
 		.hash_ext = 0,
 		.radix_ext = 0,
+		.byte22 = OV5_FEAT(OV5_DRC_INFO),
 	},
 
 	/* option vector 6: IBM PAPR hints */