aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/xive/native.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/xive/native.c')
-rw-r--r--arch/powerpc/sysdev/xive/native.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index 1ca127d052a6..0c037e933e55 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -437,6 +437,12 @@ void xive_native_sync_source(u32 hw_irq)
437} 437}
438EXPORT_SYMBOL_GPL(xive_native_sync_source); 438EXPORT_SYMBOL_GPL(xive_native_sync_source);
439 439
440void xive_native_sync_queue(u32 hw_irq)
441{
442 opal_xive_sync(XIVE_SYNC_QUEUE, hw_irq);
443}
444EXPORT_SYMBOL_GPL(xive_native_sync_queue);
445
440static const struct xive_ops xive_native_ops = { 446static const struct xive_ops xive_native_ops = {
441 .populate_irq_data = xive_native_populate_irq_data, 447 .populate_irq_data = xive_native_populate_irq_data,
442 .configure_irq = xive_native_configure_irq, 448 .configure_irq = xive_native_configure_irq,
@@ -711,3 +717,96 @@ bool xive_native_has_single_escalation(void)
711 return xive_has_single_esc; 717 return xive_has_single_esc;
712} 718}
713EXPORT_SYMBOL_GPL(xive_native_has_single_escalation); 719EXPORT_SYMBOL_GPL(xive_native_has_single_escalation);
720
721int xive_native_get_queue_info(u32 vp_id, u32 prio,
722 u64 *out_qpage,
723 u64 *out_qsize,
724 u64 *out_qeoi_page,
725 u32 *out_escalate_irq,
726 u64 *out_qflags)
727{
728 __be64 qpage;
729 __be64 qsize;
730 __be64 qeoi_page;
731 __be32 escalate_irq;
732 __be64 qflags;
733 s64 rc;
734
735 rc = opal_xive_get_queue_info(vp_id, prio, &qpage, &qsize,
736 &qeoi_page, &escalate_irq, &qflags);
737 if (rc) {
738 pr_err("OPAL failed to get queue info for VCPU %d/%d : %lld\n",
739 vp_id, prio, rc);
740 return -EIO;
741 }
742
743 if (out_qpage)
744 *out_qpage = be64_to_cpu(qpage);
745 if (out_qsize)
746 *out_qsize = be32_to_cpu(qsize);
747 if (out_qeoi_page)
748 *out_qeoi_page = be64_to_cpu(qeoi_page);
749 if (out_escalate_irq)
750 *out_escalate_irq = be32_to_cpu(escalate_irq);
751 if (out_qflags)
752 *out_qflags = be64_to_cpu(qflags);
753
754 return 0;
755}
756EXPORT_SYMBOL_GPL(xive_native_get_queue_info);
757
758int xive_native_get_queue_state(u32 vp_id, u32 prio, u32 *qtoggle, u32 *qindex)
759{
760 __be32 opal_qtoggle;
761 __be32 opal_qindex;
762 s64 rc;
763
764 rc = opal_xive_get_queue_state(vp_id, prio, &opal_qtoggle,
765 &opal_qindex);
766 if (rc) {
767 pr_err("OPAL failed to get queue state for VCPU %d/%d : %lld\n",
768 vp_id, prio, rc);
769 return -EIO;
770 }
771
772 if (qtoggle)
773 *qtoggle = be32_to_cpu(opal_qtoggle);
774 if (qindex)
775 *qindex = be32_to_cpu(opal_qindex);
776
777 return 0;
778}
779EXPORT_SYMBOL_GPL(xive_native_get_queue_state);
780
781int xive_native_set_queue_state(u32 vp_id, u32 prio, u32 qtoggle, u32 qindex)
782{
783 s64 rc;
784
785 rc = opal_xive_set_queue_state(vp_id, prio, qtoggle, qindex);
786 if (rc) {
787 pr_err("OPAL failed to set queue state for VCPU %d/%d : %lld\n",
788 vp_id, prio, rc);
789 return -EIO;
790 }
791
792 return 0;
793}
794EXPORT_SYMBOL_GPL(xive_native_set_queue_state);
795
796int xive_native_get_vp_state(u32 vp_id, u64 *out_state)
797{
798 __be64 state;
799 s64 rc;
800
801 rc = opal_xive_get_vp_state(vp_id, &state);
802 if (rc) {
803 pr_err("OPAL failed to get vp state for VCPU %d : %lld\n",
804 vp_id, rc);
805 return -EIO;
806 }
807
808 if (out_state)
809 *out_state = be64_to_cpu(state);
810 return 0;
811}
812EXPORT_SYMBOL_GPL(xive_native_get_vp_state);