aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Travis <mike.travis@hpe.com>2018-01-08 14:40:03 -0500
committerIngo Molnar <mingo@kernel.org>2018-01-15 21:58:37 -0500
commit09c3ae12b2bf6dc2837d89c1017bf151af610a1f (patch)
treef4113bd0f420cf645fd4ba1f48b7f575833413ee
parentecce47e0bde6faa3256740280754bfd06a1a4efa (diff)
x86/platform/UV: Fix GAM MMR references in the UV x2apic code
Along with the fixes in UV4A (rev2) MMRs, the code to access those MMRs also was modified by the fixes. UV3, UV4, and UV4A no longer have compatible setups for Global Address Memory (GAM). Correct the new mistakes. Signed-off-by: Mike Travis <mike.travis@hpe.com> Acked-by: Andrew Banman <abanman@hpe.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Dimitri Sivanich <sivanich@hpe.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russ Anderson <rja@hpe.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1515440405-20880-6-git-send-email-mike.travis@hpe.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c83
1 files changed, 37 insertions, 46 deletions
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 2ddc140c23fe..46b675aaf20b 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -794,70 +794,61 @@ static __init void map_mmr_high(int max_pnode)
794 pr_info("UV: MMR disabled\n"); 794 pr_info("UV: MMR disabled\n");
795} 795}
796 796
797/* 797/* UV3/4 have identical MMIOH overlay configs, UV4A is slightly different */
798 * This commonality works because both 0 & 1 versions of the MMIOH OVERLAY 798static __init void map_mmioh_high_uv34(int index, int min_pnode, int max_pnode)
799 * and REDIRECT MMR regs are exactly the same on UV3.
800 */
801struct mmioh_config {
802 unsigned long overlay;
803 unsigned long redirect;
804 char *id;
805};
806
807static __initdata struct mmioh_config mmiohs[] = {
808 {
809 UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR,
810 UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_MMR,
811 "MMIOH0"
812 },
813 {
814 UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG1_MMR,
815 UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_MMR,
816 "MMIOH1"
817 },
818};
819
820/* UV3 & UV4 have identical MMIOH overlay configs */
821static __init void map_mmioh_high_uv3(int index, int min_pnode, int max_pnode)
822{ 799{
823 union uvh_rh_gam_mmioh_overlay_config0_mmr_u overlay; 800 unsigned long overlay;
824 unsigned long mmr; 801 unsigned long mmr;
825 unsigned long base; 802 unsigned long base;
803 unsigned long nasid_mask;
826 unsigned long m_overlay; 804 unsigned long m_overlay;
827 int i, n, shift, m_io, max_io; 805 int i, n, shift, m_io, max_io;
828 int nasid, lnasid, fi, li; 806 int nasid, lnasid, fi, li;
829 char *id; 807 char *id;
830 808
831 id = mmiohs[index].id; 809 if (index == 0) {
832 overlay.v = uv_read_local_mmr(mmiohs[index].overlay); 810 id = "MMIOH0";
833 m_overlay = mmiohs[index].overlay; 811 m_overlay = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR;
834 812 overlay = uv_read_local_mmr(m_overlay);
835 pr_info("UV: %s overlay 0x%lx(@0x%lx) base:0x%x m_io:%d\n", 813 base = overlay & UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR_BASE_MASK;
836 id, overlay.v, m_overlay, overlay.s3.base, overlay.s3.m_io); 814 mmr = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_MMR;
837 if (!overlay.s3.enable) { 815 m_io = (overlay & UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR_M_IO_MASK)
816 >> UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR_M_IO_SHFT;
817 shift = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR_M_IO_SHFT;
818 n = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_MMR_DEPTH;
819 nasid_mask = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_MMR_NASID_MASK;
820 } else {
821 id = "MMIOH1";
822 m_overlay = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_MMR;
823 overlay = uv_read_local_mmr(m_overlay);
824 base = overlay & UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_MMR_BASE_MASK;
825 mmr = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1_MMR;
826 m_io = (overlay & UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_MMR_M_IO_MASK)
827 >> UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_MMR_M_IO_SHFT;
828 shift = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG1_MMR_M_IO_SHFT;
829 n = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1_MMR_DEPTH;
830 nasid_mask = UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1_MMR_NASID_MASK;
831 }
832 pr_info("UV: %s overlay 0x%lx base:0x%lx m_io:%d\n", id, overlay, base, m_io);
833 if (!(overlay & UVH_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR_ENABLE_MASK)) {
838 pr_info("UV: %s disabled\n", id); 834 pr_info("UV: %s disabled\n", id);
839 return; 835 return;
840 } 836 }
841 837
842 shift = UV3H_RH_GAM_MMIOH_OVERLAY_CONFIG0_MMR_BASE_SHFT;
843 base = (unsigned long)overlay.s3.base;
844 m_io = overlay.s3.m_io;
845 mmr = mmiohs[index].redirect;
846 n = UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_MMR_DEPTH;
847 /* Convert to NASID: */ 838 /* Convert to NASID: */
848 min_pnode *= 2; 839 min_pnode *= 2;
849 max_pnode *= 2; 840 max_pnode *= 2;
850 max_io = lnasid = fi = li = -1; 841 max_io = lnasid = fi = li = -1;
851 842
852 for (i = 0; i < n; i++) { 843 for (i = 0; i < n; i++) {
853 union uvh_rh_gam_mmioh_redirect_config0_mmr_u redirect;
854 unsigned long m_redirect = mmr + i * 8; 844 unsigned long m_redirect = mmr + i * 8;
845 unsigned long redirect = uv_read_local_mmr(m_redirect);
846
847 nasid = redirect & nasid_mask;
848 if (i == 0)
849 pr_info("UV: %s redirect base 0x%lx(@0x%lx) 0x%04x\n",
850 id, redirect, m_redirect, nasid);
855 851
856 redirect.v = uv_read_local_mmr(mmr + i * 8);
857 nasid = redirect.s3.nasid;
858 printk_once(KERN_INFO
859 "UV: %s redirect 0x%lx(@0x%lx) 0x%04x\n",
860 id, redirect.v, m_redirect, nasid);
861 /* Invalid NASID: */ 852 /* Invalid NASID: */
862 if (nasid < min_pnode || max_pnode < nasid) 853 if (nasid < min_pnode || max_pnode < nasid)
863 nasid = -1; 854 nasid = -1;
@@ -905,8 +896,8 @@ static __init void map_mmioh_high(int min_pnode, int max_pnode)
905 896
906 if (is_uv3_hub() || is_uv4_hub()) { 897 if (is_uv3_hub() || is_uv4_hub()) {
907 /* Map both MMIOH regions: */ 898 /* Map both MMIOH regions: */
908 map_mmioh_high_uv3(0, min_pnode, max_pnode); 899 map_mmioh_high_uv34(0, min_pnode, max_pnode);
909 map_mmioh_high_uv3(1, min_pnode, max_pnode); 900 map_mmioh_high_uv34(1, min_pnode, max_pnode);
910 return; 901 return;
911 } 902 }
912 903