vfio_ccw_cp.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * channel program interfaces
  4. *
  5. * Copyright IBM Corp. 2017
  6. *
  7. * Author(s): Dong Jia Shi <[email protected]>
  8. * Xiao Feng Ren <[email protected]>
  9. */
  10. #ifndef _VFIO_CCW_CP_H_
  11. #define _VFIO_CCW_CP_H_
  12. #include <asm/cio.h>
  13. #include <asm/scsw.h>
  14. #include "orb.h"
  15. #include "vfio_ccw_trace.h"
  16. /*
  17. * Max length for ccw chain.
  18. * XXX: Limit to 256, need to check more?
  19. */
  20. #define CCWCHAIN_LEN_MAX 256
  21. /**
  22. * struct channel_program - manage information for channel program
  23. * @ccwchain_list: list head of ccwchains
  24. * @orb: orb for the currently processed ssch request
  25. * @mdev: the mediated device to perform page pinning/unpinning
  26. * @initialized: whether this instance is actually initialized
  27. *
  28. * @ccwchain_list is the head of a ccwchain list, that contents the
  29. * translated result of the guest channel program that pointed out by
  30. * the iova parameter when calling cp_init.
  31. */
  32. struct channel_program {
  33. struct list_head ccwchain_list;
  34. union orb orb;
  35. bool initialized;
  36. struct ccw1 *guest_cp;
  37. };
  38. int cp_init(struct channel_program *cp, union orb *orb);
  39. void cp_free(struct channel_program *cp);
  40. int cp_prefetch(struct channel_program *cp);
  41. union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm);
  42. void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
  43. bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length);
  44. #endif