Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pseries: Move mm/book3s64/vphn.c under platforms/pseries/

hcall_vphn() is specific to pseries and will be used in a subsequent
patch. So, move it to a more appropriate place under
arch/powerpc/platforms/pseries. Also merge vphn.h into lppaca.h
and update vphn selftest to use the new files.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Naveen N. Rao and committed by
Michael Ellerman
5a1ea477 ef34e0ef

+44 -42
+24
arch/powerpc/include/asm/lppaca.h
··· 18 18 */ 19 19 #ifndef _ASM_POWERPC_LPPACA_H 20 20 #define _ASM_POWERPC_LPPACA_H 21 + 22 + /* 23 + * The below VPHN macros are outside the __KERNEL__ check since these are 24 + * used for compiling the vphn selftest in userspace 25 + */ 26 + 27 + /* The H_HOME_NODE_ASSOCIATIVITY h_call returns 6 64-bit registers. */ 28 + #define VPHN_REGISTER_COUNT 6 29 + 30 + /* 31 + * 6 64-bit registers unpacked into up to 24 be32 associativity values. To 32 + * form the complete property we have to add the length in the first cell. 33 + */ 34 + #define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1) 35 + 36 + /* 37 + * The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags: 38 + * 1 for retrieving associativity information for a guest cpu 39 + * 2 for retrieving associativity information for a host/hypervisor cpu 40 + */ 41 + #define VPHN_FLAG_VCPU 1 42 + #define VPHN_FLAG_PCPU 2 43 + 21 44 #ifdef __KERNEL__ 22 45 23 46 /* ··· 202 179 203 180 extern void register_dtl_buffer(int cpu); 204 181 extern void alloc_dtl_buffers(void); 182 + extern long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity); 205 183 206 184 #endif /* CONFIG_PPC_BOOK3S */ 207 185 #endif /* __KERNEL__ */
-1
arch/powerpc/mm/book3s64/Makefile
··· 10 10 obj-$(CONFIG_PPC_RADIX_MMU) += radix_pgtable.o radix_tlb.o 11 11 obj-$(CONFIG_PPC_4K_PAGES) += hash_4k.o 12 12 obj-$(CONFIG_PPC_64K_PAGES) += hash_64k.o 13 - obj-$(CONFIG_PPC_SPLPAR) += vphn.o 14 13 obj-$(CONFIG_HUGETLB_PAGE) += hash_hugetlbpage.o 15 14 ifdef CONFIG_HUGETLB_PAGE 16 15 obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o
+18 -2
arch/powerpc/mm/book3s64/vphn.c arch/powerpc/platforms/pseries/vphn.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <asm/byteorder.h> 3 - #include "vphn.h" 3 + #include <asm/lppaca.h> 4 4 5 5 /* 6 6 * The associativity domain numbers are returned from the hypervisor as a ··· 22 22 * 23 23 * Convert to the sequence they would appear in the ibm,associativity property. 24 24 */ 25 - int vphn_unpack_associativity(const long *packed, __be32 *unpacked) 25 + static int vphn_unpack_associativity(const long *packed, __be32 *unpacked) 26 26 { 27 27 __be64 be_packed[VPHN_REGISTER_COUNT]; 28 28 int i, nr_assoc_doms = 0; ··· 71 71 72 72 return nr_assoc_doms; 73 73 } 74 + 75 + /* NOTE: This file is included by a selftest and built in userspace. */ 76 + #ifdef __KERNEL__ 77 + #include <asm/hvcall.h> 78 + 79 + long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity) 80 + { 81 + long rc; 82 + long retbuf[PLPAR_HCALL9_BUFSIZE] = {0}; 83 + 84 + rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, cpu); 85 + vphn_unpack_associativity(retbuf, associativity); 86 + 87 + return rc; 88 + } 89 + #endif
-24
arch/powerpc/mm/book3s64/vphn.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ARCH_POWERPC_MM_VPHN_H_ 3 - #define _ARCH_POWERPC_MM_VPHN_H_ 4 - 5 - /* The H_HOME_NODE_ASSOCIATIVITY h_call returns 6 64-bit registers. */ 6 - #define VPHN_REGISTER_COUNT 6 7 - 8 - /* 9 - * 6 64-bit registers unpacked into up to 24 be32 associativity values. To 10 - * form the complete property we have to add the length in the first cell. 11 - */ 12 - #define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1) 13 - 14 - /* 15 - * The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags: 16 - * 1 for retrieving associativity information for a guest cpu 17 - * 2 for retrieving associativity information for a host/hypervisor cpu 18 - */ 19 - #define VPHN_FLAG_VCPU 1 20 - #define VPHN_FLAG_PCPU 2 21 - 22 - extern int vphn_unpack_associativity(const long *packed, __be32 *unpacked); 23 - 24 - #endif
-14
arch/powerpc/mm/numa.c
··· 1067 1067 1068 1068 /* Virtual Processor Home Node (VPHN) support */ 1069 1069 #ifdef CONFIG_PPC_SPLPAR 1070 - 1071 - #include "book3s64/vphn.h" 1072 - 1073 1070 struct topology_update_data { 1074 1071 struct topology_update_data *next; 1075 1072 unsigned int cpu; ··· 1083 1086 static void reset_topology_timer(void); 1084 1087 static int topology_timer_secs = 1; 1085 1088 static int topology_inited; 1086 - 1087 - static long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity) 1088 - { 1089 - long rc; 1090 - long retbuf[PLPAR_HCALL9_BUFSIZE] = {0}; 1091 - 1092 - rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, cpu); 1093 - vphn_unpack_associativity(retbuf, associativity); 1094 - 1095 - return rc; 1096 - } 1097 1089 1098 1090 /* 1099 1091 * Change polling interval for associativity changes.
+1
arch/powerpc/platforms/pseries/Makefile
··· 25 25 obj-$(CONFIG_IBMVIO) += vio.o 26 26 obj-$(CONFIG_IBMEBUS) += ibmebus.o 27 27 obj-$(CONFIG_PAPR_SCM) += papr_scm.o 28 + obj-$(CONFIG_PPC_SPLPAR) += vphn.o 28 29 29 30 ifdef CONFIG_PPC_PSERIES 30 31 obj-$(CONFIG_SUSPEND) += suspend.o
+1 -1
tools/testing/selftests/powerpc/vphn/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 TEST_GEN_PROGS := test-vphn 3 3 4 - CFLAGS += -m64 4 + CFLAGS += -m64 -I$(CURDIR) 5 5 6 6 top_srcdir = ../../../../.. 7 7 include ../../lib.mk