xp_uv.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. enum xp_retval
  39. xp_init_uv(void)
  40. {
  41. BUG_ON(!is_uv());
  42. xp_max_npartitions = XP_MAX_NPARTITIONS_UV;
  43. xp_pa = xp_pa_uv;
  44. xp_remote_memcpy = xp_remote_memcpy_uv;
  45. return xpSuccess;
  46. }
  47. void
  48. xp_exit_uv(void)
  49. {
  50. BUG_ON(!is_uv());
  51. }