Date: Sun, 3 Nov 2013 22:58:00 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r257596 - in projects/altix2/sys/ia64: ia64 include Message-ID: <201311032258.rA3Mw08k081316@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sun Nov 3 22:57:59 2013 New Revision: 257596 URL: http://svnweb.freebsd.org/changeset/base/257596 Log: Make IPIs work on the Altix 450. We kluged support by hardcoding specifics of the SHub1 in ipi_send(). Improve the kluge a bit by saving the IPI register address of the SHub in the PCPU structure and initialize it when we create the PCPU. There we can ask the firmware about the SHub and handle the difference between SHub1 and SHub2. This makes SMP work. Sponsored by: HOB GmbH & Co. KG Modified: projects/altix2/sys/ia64/ia64/machdep.c projects/altix2/sys/ia64/ia64/mp_machdep.c projects/altix2/sys/ia64/include/pcpu.h Modified: projects/altix2/sys/ia64/ia64/machdep.c ============================================================================== --- projects/altix2/sys/ia64/ia64/machdep.c Sun Nov 3 22:55:33 2013 (r257595) +++ projects/altix2/sys/ia64/ia64/machdep.c Sun Nov 3 22:57:59 2013 (r257596) @@ -529,16 +529,25 @@ void cpu_pcpu_setup(struct pcpu *pc, u_int acpi_id, u_int sapic_id) { struct ia64_sal_result r; + uint64_t mmr; + u_int shft, shub; pc->pc_acpi_id = acpi_id; pc->pc_md.lid = IA64_LID_SET_SAPIC_ID(sapic_id); r = ia64_sal_entry(SAL_SGISN_SAPIC_INFO, sapic_id, 0, 0, 0, 0, 0, 0); - if (r.sal_status == 0) { - pc->pc_md.sgisn_nasid = r.sal_result[0]; - pc->pc_md.sgisn_subnode = r.sal_result[1]; - pc->pc_md.sgisn_slice = r.sal_result[2]; - } + if (r.sal_status != 0) + return; + pc->pc_md.sgisn_nasid = r.sal_result[0]; + + r = ia64_sal_entry(SAL_SGISN_SN_INFO, 0, 0, 0, 0, 0, 0, 0); + if (r.sal_status != 0) + return; + shub = r.sal_result[0] & 0xff; + shft = (r.sal_result[1] >> 16) & 0xff; + mmr = ((u_long)pc->pc_md.sgisn_nasid << shft) | + (((shub == 0) ? 9UL : 3UL) << 32); + pc->pc_md.sgisn_ipip = IA64_PHYS_TO_RR6(mmr + 0x10000380UL); } void Modified: projects/altix2/sys/ia64/ia64/mp_machdep.c ============================================================================== --- projects/altix2/sys/ia64/ia64/mp_machdep.c Sun Nov 3 22:55:33 2013 (r257595) +++ projects/altix2/sys/ia64/ia64/mp_machdep.c Sun Nov 3 22:57:59 2013 (r257596) @@ -526,7 +526,9 @@ ipi_send(struct pcpu *cpu, int xiv) uint64_t ipi; u_int sapic_id; - KASSERT(xiv != 0, ("ipi_send")); + KASSERT(xiv != 0, ("%s: xiv==0", __func__)); + + critical_enter(); sapic_id = IA64_LID_GET_SAPIC_ID(cpu->pc_md.lid); @@ -534,14 +536,17 @@ ipi_send(struct pcpu *cpu, int xiv) ipip = &(ia64_pib->ib_ipi[sapic_id][0]); ipi = xiv; } else { - ipip = (void *)(IA64_PHYS_TO_RR6(0x800000000UL) | - ((u_long)cpu->pc_md.sgisn_nasid << 38) | 0x110000380UL); + ipip = (uint64_t *)(cpu->pc_md.sgisn_ipip); ipi = 0x80000001fdc00000UL | ((u_long)xiv << 52) | (sapic_id << 4); } + KASSERT(ipip != NULL, ("%s: ipip==NULL", __func__)); ia64_mf(); ia64_st8(ipip, ipi); ia64_mf_a(); + CTR3(KTR_SMP, "ipi_send(%p, %d): cpuid=%d", cpu, xiv, PCPU_GET(cpuid)); + + critical_exit(); } Modified: projects/altix2/sys/ia64/include/pcpu.h ============================================================================== --- projects/altix2/sys/ia64/include/pcpu.h Sun Nov 3 22:55:33 2013 (r257595) +++ projects/altix2/sys/ia64/include/pcpu.h Sun Nov 3 22:57:59 2013 (r257596) @@ -55,8 +55,7 @@ struct pcpu_md { uint64_t clock_load; /* Clock reload value. */ uint32_t clock_mode; /* Clock ET mode */ uint32_t sgisn_nasid; - uint32_t sgisn_subnode; - uint32_t sgisn_slice; + uint64_t sgisn_ipip; uint32_t awake:1; /* CPU is awake? */ struct pcpu_stats stats; /* Interrupt stats. */ #ifdef _KERNEL
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311032258.rA3Mw08k081316>