xp_uv.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  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. * Cross Partition (XP) uv-based functions.
  10. *
  11. * Architecture specific implementation of common functions.
  12. *
  13. */
  14. #include <linux/device.h>
  15. #include <asm/uv/uv_hub.h>
  16. #include "../sgi-gru/grukservices.h"
  17. #include "xp.h"
  18. /*
  19. * Convert a virtual memory address to a physical memory address.
  20. */
  21. static unsigned long
  22. xp_pa_uv(void *addr)
  23. {
  24. return uv_gpa(addr);
  25. }
  26. static enum xp_retval
  27. xp_remote_memcpy_uv(unsigned long dst_gpa, const unsigned long src_gpa,
  28. size_t len)
  29. {
  30. int ret;
  31. ret = gru_copy_gpa(dst_gpa, src_gpa, len);
  32. if (ret == 0)
  33. return xpSuccess;
  34. dev_err(xp, "gru_copy_gpa() failed, dst_gpa=0x%016lx src_gpa=0x%016lx "
  35. "len=%ld\n", dst_gpa, src_gpa, len);
  36. return xpGruCopyError;
  37. }
  38. static int
  39. xp_cpu_to_nasid_uv(int cpuid)
  40. {
  41. /* ??? Is this same as sn2 nasid in mach/part bitmaps set up by SAL? */
  42. return UV_PNODE_TO_NASID(uv_cpu_to_pnode(cpuid));
  43. }
  44. enum xp_retval
  45. xp_init_uv(void)
  46. {
  47. BUG_ON(!is_uv());
  48. xp_max_npartitions = XP_MAX_NPARTITIONS_UV;
  49. xp_partition_id = 0; /* !!! not correct value */
  50. xp_region_size = 0; /* !!! not correct value */
  51. xp_pa = xp_pa_uv;
  52. xp_remote_memcpy = xp_remote_memcpy_uv;
  53. xp_cpu_to_nasid = xp_cpu_to_nasid_uv;
  54. return xpSuccess;
  55. }
  56. void
  57. xp_exit_uv(void)
  58. {
  59. BUG_ON(!is_uv());
  60. }