Commit 5a1ea477 authored by Naveen N. Rao's avatar Naveen N. Rao Committed by Michael Ellerman

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: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent ef34e0ef
......@@ -18,6 +18,29 @@
*/
#ifndef _ASM_POWERPC_LPPACA_H
#define _ASM_POWERPC_LPPACA_H
/*
* The below VPHN macros are outside the __KERNEL__ check since these are
* used for compiling the vphn selftest in userspace
*/
/* The H_HOME_NODE_ASSOCIATIVITY h_call returns 6 64-bit registers. */
#define VPHN_REGISTER_COUNT 6
/*
* 6 64-bit registers unpacked into up to 24 be32 associativity values. To
* form the complete property we have to add the length in the first cell.
*/
#define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1)
/*
* The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags:
* 1 for retrieving associativity information for a guest cpu
* 2 for retrieving associativity information for a host/hypervisor cpu
*/
#define VPHN_FLAG_VCPU 1
#define VPHN_FLAG_PCPU 2
#ifdef __KERNEL__
/*
......@@ -179,6 +202,7 @@ extern void (*dtl_consumer)(struct dtl_entry *entry, u64 index);
extern void register_dtl_buffer(int cpu);
extern void alloc_dtl_buffers(void);
extern long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity);
#endif /* CONFIG_PPC_BOOK3S */
#endif /* __KERNEL__ */
......
......@@ -10,7 +10,6 @@ obj-$(CONFIG_PPC_NATIVE) += hash_native.o
obj-$(CONFIG_PPC_RADIX_MMU) += radix_pgtable.o radix_tlb.o
obj-$(CONFIG_PPC_4K_PAGES) += hash_4k.o
obj-$(CONFIG_PPC_64K_PAGES) += hash_64k.o
obj-$(CONFIG_PPC_SPLPAR) += vphn.o
obj-$(CONFIG_HUGETLB_PAGE) += hash_hugetlbpage.o
ifdef CONFIG_HUGETLB_PAGE
obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ARCH_POWERPC_MM_VPHN_H_
#define _ARCH_POWERPC_MM_VPHN_H_
/* The H_HOME_NODE_ASSOCIATIVITY h_call returns 6 64-bit registers. */
#define VPHN_REGISTER_COUNT 6
/*
* 6 64-bit registers unpacked into up to 24 be32 associativity values. To
* form the complete property we have to add the length in the first cell.
*/
#define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1)
/*
* The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags:
* 1 for retrieving associativity information for a guest cpu
* 2 for retrieving associativity information for a host/hypervisor cpu
*/
#define VPHN_FLAG_VCPU 1
#define VPHN_FLAG_PCPU 2
extern int vphn_unpack_associativity(const long *packed, __be32 *unpacked);
#endif
......@@ -1067,9 +1067,6 @@ u64 memory_hotplug_max(void)
/* Virtual Processor Home Node (VPHN) support */
#ifdef CONFIG_PPC_SPLPAR
#include "book3s64/vphn.h"
struct topology_update_data {
struct topology_update_data *next;
unsigned int cpu;
......@@ -1087,17 +1084,6 @@ static void reset_topology_timer(void);
static int topology_timer_secs = 1;
static int topology_inited;
static long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity)
{
long rc;
long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, cpu);
vphn_unpack_associativity(retbuf, associativity);
return rc;
}
/*
* Change polling interval for associativity changes.
*/
......
......@@ -25,6 +25,7 @@ obj-$(CONFIG_LPARCFG) += lparcfg.o
obj-$(CONFIG_IBMVIO) += vio.o
obj-$(CONFIG_IBMEBUS) += ibmebus.o
obj-$(CONFIG_PAPR_SCM) += papr_scm.o
obj-$(CONFIG_PPC_SPLPAR) += vphn.o
ifdef CONFIG_PPC_PSERIES
obj-$(CONFIG_SUSPEND) += suspend.o
......
// SPDX-License-Identifier: GPL-2.0
#include <asm/byteorder.h>
#include "vphn.h"
#include <asm/lppaca.h>
/*
* The associativity domain numbers are returned from the hypervisor as a
......@@ -22,7 +22,7 @@
*
* Convert to the sequence they would appear in the ibm,associativity property.
*/
int vphn_unpack_associativity(const long *packed, __be32 *unpacked)
static int vphn_unpack_associativity(const long *packed, __be32 *unpacked)
{
__be64 be_packed[VPHN_REGISTER_COUNT];
int i, nr_assoc_doms = 0;
......@@ -71,3 +71,19 @@ int vphn_unpack_associativity(const long *packed, __be32 *unpacked)
return nr_assoc_doms;
}
/* NOTE: This file is included by a selftest and built in userspace. */
#ifdef __KERNEL__
#include <asm/hvcall.h>
long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity)
{
long rc;
long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, cpu);
vphn_unpack_associativity(retbuf, associativity);
return rc;
}
#endif
# SPDX-License-Identifier: GPL-2.0-only
TEST_GEN_PROGS := test-vphn
CFLAGS += -m64
CFLAGS += -m64 -I$(CURDIR)
top_srcdir = ../../../../..
include ../../lib.mk
......
../../../../../../arch/powerpc/include/asm/lppaca.h
\ No newline at end of file
../../../../../arch/powerpc/mm/book3s64/vphn.c
\ No newline at end of file
../../../../../arch/powerpc/platforms/pseries/vphn.c
\ No newline at end of file
../../../../../arch/powerpc/mm/book3s64/vphn.h
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment