xive-internal.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2016,2017 IBM Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #ifndef __XIVE_INTERNAL_H
  10. #define __XIVE_INTERNAL_H
  11. /* Each CPU carry one of these with various per-CPU state */
  12. struct xive_cpu {
  13. #ifdef CONFIG_SMP
  14. /* HW irq number and data of IPI */
  15. u32 hw_ipi;
  16. struct xive_irq_data ipi_data;
  17. #endif /* CONFIG_SMP */
  18. int chip_id;
  19. /* Queue datas. Only one is populated */
  20. #define XIVE_MAX_QUEUES 8
  21. struct xive_q queue[XIVE_MAX_QUEUES];
  22. /*
  23. * Pending mask. Each bit corresponds to a priority that
  24. * potentially has pending interrupts.
  25. */
  26. u8 pending_prio;
  27. /* Cache of HW CPPR */
  28. u8 cppr;
  29. };
  30. /* Backend ops */
  31. struct xive_ops {
  32. int (*populate_irq_data)(u32 hw_irq, struct xive_irq_data *data);
  33. int (*configure_irq)(u32 hw_irq, u32 target, u8 prio, u32 sw_irq);
  34. int (*setup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio);
  35. void (*cleanup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio);
  36. void (*setup_cpu)(unsigned int cpu, struct xive_cpu *xc);
  37. void (*teardown_cpu)(unsigned int cpu, struct xive_cpu *xc);
  38. bool (*match)(struct device_node *np);
  39. void (*shutdown)(void);
  40. void (*update_pending)(struct xive_cpu *xc);
  41. void (*eoi)(u32 hw_irq);
  42. void (*sync_source)(u32 hw_irq);
  43. u64 (*esb_rw)(u32 hw_irq, u32 offset, u64 data, bool write);
  44. #ifdef CONFIG_SMP
  45. int (*get_ipi)(unsigned int cpu, struct xive_cpu *xc);
  46. void (*put_ipi)(unsigned int cpu, struct xive_cpu *xc);
  47. #endif
  48. const char *name;
  49. };
  50. bool xive_core_init(const struct xive_ops *ops, void __iomem *area, u32 offset,
  51. u8 max_prio);
  52. __be32 *xive_queue_page_alloc(unsigned int cpu, u32 queue_shift);
  53. static inline u32 xive_alloc_order(u32 queue_shift)
  54. {
  55. return (queue_shift > PAGE_SHIFT) ? (queue_shift - PAGE_SHIFT) : 0;
  56. }
  57. extern bool xive_cmdline_disabled;
  58. #endif /* __XIVE_INTERNAL_H */