Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/xive: Improve error reporting of OPAL calls

Introduce a vp_err() macro to standardize error reporting.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201210171450.1933725-13-clg@kaod.org

authored by

Cédric Le Goater and committed by
Michael Ellerman
07efbca1 614546d5

+16 -12
+16 -12
arch/powerpc/sysdev/xive/native.c
··· 122 122 return rc == 0 ? 0 : -ENXIO; 123 123 } 124 124 125 + #define vp_err(vp, fmt, ...) pr_err("VP[0x%x]: " fmt, vp, ##__VA_ARGS__) 126 + 125 127 /* This can be called multiple time to change a queue configuration */ 126 128 int xive_native_configure_queue(u32 vp_id, struct xive_q *q, u8 prio, 127 129 __be32 *qpage, u32 order, bool can_escalate) ··· 151 149 &esc_irq_be, 152 150 NULL); 153 151 if (rc) { 154 - pr_err("Error %lld getting queue info prio %d\n", rc, prio); 152 + vp_err(vp_id, "Failed to get queue %d info : %lld\n", prio, rc); 155 153 rc = -EIO; 156 154 goto fail; 157 155 } ··· 174 172 msleep(OPAL_BUSY_DELAY_MS); 175 173 } 176 174 if (rc) { 177 - pr_err("Error %lld setting queue for prio %d\n", rc, prio); 175 + vp_err(vp_id, "Failed to set queue %d info: %lld\n", prio, rc); 178 176 rc = -EIO; 179 177 } else { 180 178 /* ··· 201 199 msleep(OPAL_BUSY_DELAY_MS); 202 200 } 203 201 if (rc) 204 - pr_err("Error %lld disabling queue for prio %d\n", rc, prio); 202 + vp_err(vp_id, "Failed to disable queue %d : %lld\n", prio, rc); 205 203 } 206 204 207 205 void xive_native_disable_queue(u32 vp_id, struct xive_q *q, u8 prio) ··· 700 698 break; 701 699 msleep(OPAL_BUSY_DELAY_MS); 702 700 } 701 + if (rc) 702 + vp_err(vp_id, "Failed to enable VP : %lld\n", rc); 703 703 return rc ? -EIO : 0; 704 704 } 705 705 EXPORT_SYMBOL_GPL(xive_native_enable_vp); ··· 716 712 break; 717 713 msleep(OPAL_BUSY_DELAY_MS); 718 714 } 715 + if (rc) 716 + vp_err(vp_id, "Failed to disable VP : %lld\n", rc); 719 717 return rc ? -EIO : 0; 720 718 } 721 719 EXPORT_SYMBOL_GPL(xive_native_disable_vp); ··· 729 723 s64 rc; 730 724 731 725 rc = opal_xive_get_vp_info(vp_id, NULL, &vp_cam_be, NULL, &vp_chip_id_be); 732 - if (rc) 726 + if (rc) { 727 + vp_err(vp_id, "Failed to get VP info : %lld\n", rc); 733 728 return -EIO; 729 + } 734 730 *out_cam_id = be64_to_cpu(vp_cam_be) & 0xffffffffu; 735 731 *out_chip_id = be32_to_cpu(vp_chip_id_be); 736 732 ··· 763 755 rc = opal_xive_get_queue_info(vp_id, prio, &qpage, &qsize, 764 756 &qeoi_page, &escalate_irq, &qflags); 765 757 if (rc) { 766 - pr_err("OPAL failed to get queue info for VCPU %d/%d : %lld\n", 767 - vp_id, prio, rc); 758 + vp_err(vp_id, "failed to get queue %d info : %lld\n", prio, rc); 768 759 return -EIO; 769 760 } 770 761 ··· 791 784 rc = opal_xive_get_queue_state(vp_id, prio, &opal_qtoggle, 792 785 &opal_qindex); 793 786 if (rc) { 794 - pr_err("OPAL failed to get queue state for VCPU %d/%d : %lld\n", 795 - vp_id, prio, rc); 787 + vp_err(vp_id, "failed to get queue %d state : %lld\n", prio, rc); 796 788 return -EIO; 797 789 } 798 790 ··· 810 804 811 805 rc = opal_xive_set_queue_state(vp_id, prio, qtoggle, qindex); 812 806 if (rc) { 813 - pr_err("OPAL failed to set queue state for VCPU %d/%d : %lld\n", 814 - vp_id, prio, rc); 807 + vp_err(vp_id, "failed to set queue %d state : %lld\n", prio, rc); 815 808 return -EIO; 816 809 } 817 810 ··· 832 827 833 828 rc = opal_xive_get_vp_state(vp_id, &state); 834 829 if (rc) { 835 - pr_err("OPAL failed to get vp state for VCPU %d : %lld\n", 836 - vp_id, rc); 830 + vp_err(vp_id, "failed to get vp state : %lld\n", rc); 837 831 return -EIO; 838 832 } 839 833