]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/pseries: Rename TYPE1_AFFINITY to FORM1_AFFINITY
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Thu, 12 Aug 2021 13:22:20 +0000 (18:52 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 13 Aug 2021 12:04:26 +0000 (22:04 +1000)
Also make related code cleanup that will allow adding FORM2_AFFINITY in
later patches. No functional change in this patch.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210812132223.225214-3-aneesh.kumar@linux.ibm.com
arch/powerpc/include/asm/firmware.h
arch/powerpc/include/asm/prom.h
arch/powerpc/kernel/prom_init.c
arch/powerpc/mm/numa.c
arch/powerpc/platforms/pseries/firmware.c

index 7604673787d6792018d1b31c5d0c5e72ae754b83..60b6311613604e024cfc3feb18d8233d77938677 100644 (file)
@@ -44,7 +44,7 @@
 #define FW_FEATURE_OPAL                ASM_CONST(0x0000000010000000)
 #define FW_FEATURE_SET_MODE    ASM_CONST(0x0000000040000000)
 #define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000)
-#define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
+#define FW_FEATURE_FORM1_AFFINITY ASM_CONST(0x0000000100000000)
 #define FW_FEATURE_PRRN                ASM_CONST(0x0000000200000000)
 #define FW_FEATURE_DRMEM_V2    ASM_CONST(0x0000000400000000)
 #define FW_FEATURE_DRC_INFO    ASM_CONST(0x0000000800000000)
@@ -69,7 +69,7 @@ enum {
                FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
                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_FORM1_AFFINITY | FW_FEATURE_PRRN |
                FW_FEATURE_HPT_RESIZE | FW_FEATURE_DRMEM_V2 |
                FW_FEATURE_DRC_INFO | FW_FEATURE_BLOCK_REMOVE |
                FW_FEATURE_PAPR_SCM | FW_FEATURE_ULTRAVISOR |
index 324a13351749ae185e840c50ba5de4e6d44bbd10..df9fec9d232cb4c832f653952ed4d5bed692202e 100644 (file)
@@ -147,7 +147,7 @@ extern int of_read_drc_info_cell(struct property **prop,
 #define OV5_MSI                        0x0201  /* PCIe/MSI support */
 #define OV5_CMO                        0x0480  /* Cooperative Memory Overcommitment */
 #define OV5_XCMO               0x0440  /* Page Coalescing */
-#define OV5_TYPE1_AFFINITY     0x0580  /* Type 1 NUMA affinity */
+#define OV5_FORM1_AFFINITY     0x0580  /* FORM1 NUMA affinity */
 #define OV5_PRRN               0x0540  /* Platform Resource Reassignment */
 #define OV5_HP_EVT             0x0604  /* Hot Plug Event support */
 #define OV5_RESIZE_HPT         0x0601  /* Hash Page Table resizing */
index a5bf355ce1d632f032b855ff4089365d1d5b3ee1..57db605ad33aef33e761338c7a2b7bc793a276fa 100644 (file)
@@ -1096,7 +1096,7 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = {
 #else
                0,
 #endif
-               .associativity = OV5_FEAT(OV5_TYPE1_AFFINITY) | OV5_FEAT(OV5_PRRN),
+               .associativity = OV5_FEAT(OV5_FORM1_AFFINITY) | OV5_FEAT(OV5_PRRN),
                .bin_opts = OV5_FEAT(OV5_RESIZE_HPT) | OV5_FEAT(OV5_HP_EVT),
                .micro_checkpoint = 0,
                .reserved0 = 0,
index 79132744b728ed9830f802b014b341d545623faf..0bad11b3e929417c4b27728945a1a7e691362582 100644 (file)
@@ -53,7 +53,10 @@ EXPORT_SYMBOL(node_data);
 
 static int primary_domain_index;
 static int n_mem_addr_cells, n_mem_size_cells;
-static int form1_affinity;
+
+#define FORM0_AFFINITY 0
+#define FORM1_AFFINITY 1
+static int affinity_form;
 
 #define MAX_DISTANCE_REF_POINTS 4
 static int distance_ref_points_depth;
@@ -190,7 +193,7 @@ int __node_distance(int a, int b)
        int i;
        int distance = LOCAL_DISTANCE;
 
-       if (!form1_affinity)
+       if (affinity_form == FORM0_AFFINITY)
                return ((a == b) ? LOCAL_DISTANCE : REMOTE_DISTANCE);
 
        for (i = 0; i < distance_ref_points_depth; i++) {
@@ -210,7 +213,7 @@ static void initialize_distance_lookup_table(int nid,
 {
        int i;
 
-       if (!form1_affinity)
+       if (affinity_form != FORM1_AFFINITY)
                return;
 
        for (i = 0; i < distance_ref_points_depth; i++) {
@@ -289,6 +292,17 @@ static int __init find_primary_domain_index(void)
        int index;
        struct device_node *root;
 
+       /*
+        * Check for which form of affinity.
+        */
+       if (firmware_has_feature(FW_FEATURE_OPAL)) {
+               affinity_form = FORM1_AFFINITY;
+       } else if (firmware_has_feature(FW_FEATURE_FORM1_AFFINITY)) {
+               dbg("Using form 1 affinity\n");
+               affinity_form = FORM1_AFFINITY;
+       } else
+               affinity_form = FORM0_AFFINITY;
+
        if (firmware_has_feature(FW_FEATURE_OPAL))
                root = of_find_node_by_path("/ibm,opal");
        else
@@ -318,23 +332,16 @@ static int __init find_primary_domain_index(void)
        }
 
        distance_ref_points_depth /= sizeof(int);
-
-       if (firmware_has_feature(FW_FEATURE_OPAL) ||
-           firmware_has_feature(FW_FEATURE_TYPE1_AFFINITY)) {
-               dbg("Using form 1 affinity\n");
-               form1_affinity = 1;
-       }
-
-       if (form1_affinity) {
-               index = of_read_number(distance_ref_points, 1);
-       } else {
+       if (affinity_form == FORM0_AFFINITY) {
                if (distance_ref_points_depth < 2) {
                        printk(KERN_WARNING "NUMA: "
-                               "short ibm,associativity-reference-points\n");
+                              "short ibm,associativity-reference-points\n");
                        goto err;
                }
 
                index = of_read_number(&distance_ref_points[1], 1);
+       } else {
+               index = of_read_number(distance_ref_points, 1);
        }
 
        /*
index 4c7b7f5a2ebca4d5e5464f4bc581433efee2f336..5d4c2bc20bbab0889c123c5c80e8af88a1e403b4 100644 (file)
@@ -119,7 +119,7 @@ struct vec5_fw_feature {
 
 static __initdata struct vec5_fw_feature
 vec5_fw_features_table[] = {
-       {FW_FEATURE_TYPE1_AFFINITY,     OV5_TYPE1_AFFINITY},
+       {FW_FEATURE_FORM1_AFFINITY,     OV5_FORM1_AFFINITY},
        {FW_FEATURE_PRRN,               OV5_PRRN},
        {FW_FEATURE_DRMEM_V2,           OV5_DRMEM_V2},
        {FW_FEATURE_DRC_INFO,           OV5_DRC_INFO},