blob: 44f2c2b58c2fae30f9b147bfcd4a310f766cde55 [file] [log] [blame]
Dean Nelsonbc63d382008-07-29 22:34:04 -07001/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9/*
10 * Cross Partition (XP) uv-based functions.
11 *
12 * Architecture specific implementation of common functions.
13 *
14 */
15
Dean Nelsona812dcc2008-07-29 22:34:16 -070016#include <linux/device.h>
17#include <asm/uv/uv_hub.h>
18#include "../sgi-gru/grukservices.h"
Dean Nelsonbc63d382008-07-29 22:34:04 -070019#include "xp.h"
20
Dean Nelsona812dcc2008-07-29 22:34:16 -070021/*
22 * Convert a virtual memory address to a physical memory address.
23 */
24static unsigned long
25xp_pa_uv(void *addr)
Dean Nelson908787d2008-07-29 22:34:05 -070026{
Dean Nelsona812dcc2008-07-29 22:34:16 -070027 return uv_gpa(addr);
28}
29
30static enum xp_retval
31xp_remote_memcpy_uv(unsigned long dst_gpa, const unsigned long src_gpa,
32 size_t len)
33{
34 int ret;
35
36 ret = gru_copy_gpa(dst_gpa, src_gpa, len);
37 if (ret == 0)
38 return xpSuccess;
39
40 dev_err(xp, "gru_copy_gpa() failed, dst_gpa=0x%016lx src_gpa=0x%016lx "
41 "len=%ld\n", dst_gpa, src_gpa, len);
42 return xpGruCopyError;
Dean Nelson908787d2008-07-29 22:34:05 -070043}
44
Dean Nelsonbc63d382008-07-29 22:34:04 -070045enum xp_retval
46xp_init_uv(void)
47{
48 BUG_ON(!is_uv());
49
50 xp_max_npartitions = XP_MAX_NPARTITIONS_UV;
Dean Nelson908787d2008-07-29 22:34:05 -070051
Dean Nelsona812dcc2008-07-29 22:34:16 -070052 xp_pa = xp_pa_uv;
Dean Nelson908787d2008-07-29 22:34:05 -070053 xp_remote_memcpy = xp_remote_memcpy_uv;
54
55 return xpSuccess;
Dean Nelsonbc63d382008-07-29 22:34:04 -070056}
57
58void
59xp_exit_uv(void)
60{
61 BUG_ON(!is_uv());
62}