aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_sn2.c
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-07-30 01:34:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:50 -0400
commita812dcc3a298eef650c381e094e2cf41a4ecc9ad (patch)
treecb6a24a623891054789f5340742c3c8ff1fb8cde /drivers/misc/sgi-xp/xpc_sn2.c
parent261f3b4979db88d29fc86aad9f76fbc0c2c6d21a (diff)
sgi-xp: add usage of GRU driver by xpc_remote_memcpy()
Add UV support to xpc_remote_memcpy(), which involves interfacing to the GRU driver. Signed-off-by: Dean Nelson <dcn@sgi.com> Cc: Jack Steiner <steiner@sgi.com> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_sn2.c')
-rw-r--r--drivers/misc/sgi-xp/xpc_sn2.c68
1 files changed, 36 insertions, 32 deletions
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
index fde870aebcb9..1571a7cdf9d0 100644
--- a/drivers/misc/sgi-xp/xpc_sn2.c
+++ b/drivers/misc/sgi-xp/xpc_sn2.c
@@ -207,8 +207,8 @@ xpc_handle_activate_IRQ_sn2(int irq, void *dev_id)
207 * Flag the appropriate amo variable and send an IRQ to the specified node. 207 * Flag the appropriate amo variable and send an IRQ to the specified node.
208 */ 208 */
209static void 209static void
210xpc_send_activate_IRQ_sn2(u64 amos_page_pa, int from_nasid, int to_nasid, 210xpc_send_activate_IRQ_sn2(unsigned long amos_page_pa, int from_nasid,
211 int to_phys_cpuid) 211 int to_nasid, int to_phys_cpuid)
212{ 212{
213 struct amo *amos = (struct amo *)__va(amos_page_pa + 213 struct amo *amos = (struct amo *)__va(amos_page_pa +
214 (XPC_ACTIVATE_IRQ_AMOS_SN2 * 214 (XPC_ACTIVATE_IRQ_AMOS_SN2 *
@@ -404,7 +404,7 @@ xpc_send_chctl_openreply_sn2(struct xpc_channel *ch, unsigned long *irq_flags)
404 404
405 args->remote_nentries = ch->remote_nentries; 405 args->remote_nentries = ch->remote_nentries;
406 args->local_nentries = ch->local_nentries; 406 args->local_nentries = ch->local_nentries;
407 args->local_msgqueue_pa = __pa(ch->local_msgqueue); 407 args->local_msgqueue_pa = xp_pa(ch->local_msgqueue);
408 XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENREPLY, irq_flags); 408 XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENREPLY, irq_flags);
409} 409}
410 410
@@ -577,13 +577,13 @@ xpc_allow_amo_ops_shub_wars_1_1_sn2(void)
577} 577}
578 578
579static enum xp_retval 579static enum xp_retval
580xpc_get_partition_rsvd_page_pa_sn2(u64 buf, u64 *cookie, u64 *paddr, 580xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa,
581 size_t *len) 581 size_t *len)
582{ 582{
583 s64 status; 583 s64 status;
584 enum xp_retval ret; 584 enum xp_retval ret;
585 585
586 status = sn_partition_reserved_page_pa(buf, cookie, paddr, len); 586 status = sn_partition_reserved_page_pa((u64)buf, cookie, rp_pa, len);
587 if (status == SALRET_OK) 587 if (status == SALRET_OK)
588 ret = xpSuccess; 588 ret = xpSuccess;
589 else if (status == SALRET_MORE_PASSES) 589 else if (status == SALRET_MORE_PASSES)
@@ -604,7 +604,7 @@ xpc_rsvd_page_init_sn2(struct xpc_rsvd_page *rp)
604 604
605 xpc_vars_sn2 = XPC_RP_VARS(rp); 605 xpc_vars_sn2 = XPC_RP_VARS(rp);
606 606
607 rp->sn.vars_pa = __pa(xpc_vars_sn2); 607 rp->sn.vars_pa = xp_pa(xpc_vars_sn2);
608 608
609 /* vars_part array follows immediately after vars */ 609 /* vars_part array follows immediately after vars */
610 xpc_vars_part_sn2 = (struct xpc_vars_part_sn2 *)((u8 *)XPC_RP_VARS(rp) + 610 xpc_vars_part_sn2 = (struct xpc_vars_part_sn2 *)((u8 *)XPC_RP_VARS(rp) +
@@ -649,7 +649,7 @@ xpc_rsvd_page_init_sn2(struct xpc_rsvd_page *rp)
649 xpc_vars_sn2->version = XPC_V_VERSION; 649 xpc_vars_sn2->version = XPC_V_VERSION;
650 xpc_vars_sn2->activate_IRQ_nasid = cpuid_to_nasid(0); 650 xpc_vars_sn2->activate_IRQ_nasid = cpuid_to_nasid(0);
651 xpc_vars_sn2->activate_IRQ_phys_cpuid = cpu_physical_id(0); 651 xpc_vars_sn2->activate_IRQ_phys_cpuid = cpu_physical_id(0);
652 xpc_vars_sn2->vars_part_pa = __pa(xpc_vars_part_sn2); 652 xpc_vars_sn2->vars_part_pa = xp_pa(xpc_vars_part_sn2);
653 xpc_vars_sn2->amos_page_pa = ia64_tpa((u64)amos_page); 653 xpc_vars_sn2->amos_page_pa = ia64_tpa((u64)amos_page);
654 xpc_vars_sn2->amos_page = amos_page; /* save for next load of XPC */ 654 xpc_vars_sn2->amos_page = amos_page; /* save for next load of XPC */
655 655
@@ -734,8 +734,8 @@ xpc_check_remote_hb_sn2(void)
734 } 734 }
735 735
736 /* pull the remote_hb cache line */ 736 /* pull the remote_hb cache line */
737 ret = xp_remote_memcpy(remote_vars, 737 ret = xp_remote_memcpy(xp_pa(remote_vars),
738 (void *)part->sn.sn2.remote_vars_pa, 738 part->sn.sn2.remote_vars_pa,
739 XPC_RP_VARS_SIZE); 739 XPC_RP_VARS_SIZE);
740 if (ret != xpSuccess) { 740 if (ret != xpSuccess) {
741 XPC_DEACTIVATE_PARTITION(part, ret); 741 XPC_DEACTIVATE_PARTITION(part, ret);
@@ -768,7 +768,8 @@ xpc_check_remote_hb_sn2(void)
768 * assumed to be of size XPC_RP_VARS_SIZE. 768 * assumed to be of size XPC_RP_VARS_SIZE.
769 */ 769 */
770static enum xp_retval 770static enum xp_retval
771xpc_get_remote_vars_sn2(u64 remote_vars_pa, struct xpc_vars_sn2 *remote_vars) 771xpc_get_remote_vars_sn2(unsigned long remote_vars_pa,
772 struct xpc_vars_sn2 *remote_vars)
772{ 773{
773 enum xp_retval ret; 774 enum xp_retval ret;
774 775
@@ -776,7 +777,7 @@ xpc_get_remote_vars_sn2(u64 remote_vars_pa, struct xpc_vars_sn2 *remote_vars)
776 return xpVarsNotSet; 777 return xpVarsNotSet;
777 778
778 /* pull over the cross partition variables */ 779 /* pull over the cross partition variables */
779 ret = xp_remote_memcpy(remote_vars, (void *)remote_vars_pa, 780 ret = xp_remote_memcpy(xp_pa(remote_vars), remote_vars_pa,
780 XPC_RP_VARS_SIZE); 781 XPC_RP_VARS_SIZE);
781 if (ret != xpSuccess) 782 if (ret != xpSuccess)
782 return ret; 783 return ret;
@@ -791,7 +792,7 @@ xpc_get_remote_vars_sn2(u64 remote_vars_pa, struct xpc_vars_sn2 *remote_vars)
791 792
792static void 793static void
793xpc_request_partition_activation_sn2(struct xpc_rsvd_page *remote_rp, 794xpc_request_partition_activation_sn2(struct xpc_rsvd_page *remote_rp,
794 u64 remote_rp_pa, int nasid) 795 unsigned long remote_rp_pa, int nasid)
795{ 796{
796 xpc_send_local_activate_IRQ_sn2(nasid); 797 xpc_send_local_activate_IRQ_sn2(nasid);
797} 798}
@@ -883,7 +884,8 @@ xpc_partition_deactivation_requested_sn2(short partid)
883static void 884static void
884xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version, 885xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version,
885 unsigned long *remote_rp_ts_jiffies, 886 unsigned long *remote_rp_ts_jiffies,
886 u64 remote_rp_pa, u64 remote_vars_pa, 887 unsigned long remote_rp_pa,
888 unsigned long remote_vars_pa,
887 struct xpc_vars_sn2 *remote_vars) 889 struct xpc_vars_sn2 *remote_vars)
888{ 890{
889 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; 891 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
@@ -948,8 +950,8 @@ xpc_identify_activate_IRQ_req_sn2(int nasid)
948{ 950{
949 struct xpc_rsvd_page *remote_rp; 951 struct xpc_rsvd_page *remote_rp;
950 struct xpc_vars_sn2 *remote_vars; 952 struct xpc_vars_sn2 *remote_vars;
951 u64 remote_rp_pa; 953 unsigned long remote_rp_pa;
952 u64 remote_vars_pa; 954 unsigned long remote_vars_pa;
953 int remote_rp_version; 955 int remote_rp_version;
954 int reactivate = 0; 956 int reactivate = 0;
955 unsigned long remote_rp_ts_jiffies = 0; 957 unsigned long remote_rp_ts_jiffies = 0;
@@ -1291,11 +1293,11 @@ xpc_setup_infrastructure_sn2(struct xpc_partition *part)
1291 * The setting of the magic # indicates that these per partition 1293 * The setting of the magic # indicates that these per partition
1292 * specific variables are ready to be used. 1294 * specific variables are ready to be used.
1293 */ 1295 */
1294 xpc_vars_part_sn2[partid].GPs_pa = __pa(part_sn2->local_GPs); 1296 xpc_vars_part_sn2[partid].GPs_pa = xp_pa(part_sn2->local_GPs);
1295 xpc_vars_part_sn2[partid].openclose_args_pa = 1297 xpc_vars_part_sn2[partid].openclose_args_pa =
1296 __pa(part->local_openclose_args); 1298 xp_pa(part->local_openclose_args);
1297 xpc_vars_part_sn2[partid].chctl_amo_pa = 1299 xpc_vars_part_sn2[partid].chctl_amo_pa =
1298 __pa(part_sn2->local_chctl_amo_va); 1300 xp_pa(part_sn2->local_chctl_amo_va);
1299 cpuid = raw_smp_processor_id(); /* any CPU in this partition will do */ 1301 cpuid = raw_smp_processor_id(); /* any CPU in this partition will do */
1300 xpc_vars_part_sn2[partid].notify_IRQ_nasid = cpuid_to_nasid(cpuid); 1302 xpc_vars_part_sn2[partid].notify_IRQ_nasid = cpuid_to_nasid(cpuid);
1301 xpc_vars_part_sn2[partid].notify_IRQ_phys_cpuid = 1303 xpc_vars_part_sn2[partid].notify_IRQ_phys_cpuid =
@@ -1382,25 +1384,25 @@ xpc_teardown_infrastructure_sn2(struct xpc_partition *part)
1382 * Create a wrapper that hides the underlying mechanism for pulling a cacheline 1384 * Create a wrapper that hides the underlying mechanism for pulling a cacheline
1383 * (or multiple cachelines) from a remote partition. 1385 * (or multiple cachelines) from a remote partition.
1384 * 1386 *
1385 * src must be a cacheline aligned physical address on the remote partition. 1387 * src_pa must be a cacheline aligned physical address on the remote partition.
1386 * dst must be a cacheline aligned virtual address on this partition. 1388 * dst must be a cacheline aligned virtual address on this partition.
1387 * cnt must be cacheline sized 1389 * cnt must be cacheline sized
1388 */ 1390 */
1389/* ??? Replace this function by call to xp_remote_memcpy() or bte_copy()? */ 1391/* ??? Replace this function by call to xp_remote_memcpy() or bte_copy()? */
1390static enum xp_retval 1392static enum xp_retval
1391xpc_pull_remote_cachelines_sn2(struct xpc_partition *part, void *dst, 1393xpc_pull_remote_cachelines_sn2(struct xpc_partition *part, void *dst,
1392 const void *src, size_t cnt) 1394 const unsigned long src_pa, size_t cnt)
1393{ 1395{
1394 enum xp_retval ret; 1396 enum xp_retval ret;
1395 1397
1396 DBUG_ON((u64)src != L1_CACHE_ALIGN((u64)src)); 1398 DBUG_ON(src_pa != L1_CACHE_ALIGN(src_pa));
1397 DBUG_ON((u64)dst != L1_CACHE_ALIGN((u64)dst)); 1399 DBUG_ON((unsigned long)dst != L1_CACHE_ALIGN((unsigned long)dst));
1398 DBUG_ON(cnt != L1_CACHE_ALIGN(cnt)); 1400 DBUG_ON(cnt != L1_CACHE_ALIGN(cnt));
1399 1401
1400 if (part->act_state == XPC_P_DEACTIVATING) 1402 if (part->act_state == XPC_P_DEACTIVATING)
1401 return part->reason; 1403 return part->reason;
1402 1404
1403 ret = xp_remote_memcpy(dst, src, cnt); 1405 ret = xp_remote_memcpy(xp_pa(dst), src_pa, cnt);
1404 if (ret != xpSuccess) { 1406 if (ret != xpSuccess) {
1405 dev_dbg(xpc_chan, "xp_remote_memcpy() from partition %d failed," 1407 dev_dbg(xpc_chan, "xp_remote_memcpy() from partition %d failed,"
1406 " ret=%d\n", XPC_PARTID(part), ret); 1408 " ret=%d\n", XPC_PARTID(part), ret);
@@ -1420,7 +1422,8 @@ xpc_pull_remote_vars_part_sn2(struct xpc_partition *part)
1420 struct xpc_vars_part_sn2 *pulled_entry_cacheline = 1422 struct xpc_vars_part_sn2 *pulled_entry_cacheline =
1421 (struct xpc_vars_part_sn2 *)L1_CACHE_ALIGN((u64)buffer); 1423 (struct xpc_vars_part_sn2 *)L1_CACHE_ALIGN((u64)buffer);
1422 struct xpc_vars_part_sn2 *pulled_entry; 1424 struct xpc_vars_part_sn2 *pulled_entry;
1423 u64 remote_entry_cacheline_pa, remote_entry_pa; 1425 unsigned long remote_entry_cacheline_pa;
1426 unsigned long remote_entry_pa;
1424 short partid = XPC_PARTID(part); 1427 short partid = XPC_PARTID(part);
1425 enum xp_retval ret; 1428 enum xp_retval ret;
1426 1429
@@ -1440,7 +1443,7 @@ xpc_pull_remote_vars_part_sn2(struct xpc_partition *part)
1440 (L1_CACHE_BYTES - 1))); 1443 (L1_CACHE_BYTES - 1)));
1441 1444
1442 ret = xpc_pull_remote_cachelines_sn2(part, pulled_entry_cacheline, 1445 ret = xpc_pull_remote_cachelines_sn2(part, pulled_entry_cacheline,
1443 (void *)remote_entry_cacheline_pa, 1446 remote_entry_cacheline_pa,
1444 L1_CACHE_BYTES); 1447 L1_CACHE_BYTES);
1445 if (ret != xpSuccess) { 1448 if (ret != xpSuccess) {
1446 dev_dbg(xpc_chan, "failed to pull XPC vars_part from " 1449 dev_dbg(xpc_chan, "failed to pull XPC vars_part from "
@@ -1587,7 +1590,7 @@ xpc_get_chctl_all_flags_sn2(struct xpc_partition *part)
1587 if (xpc_any_openclose_chctl_flags_set(&chctl)) { 1590 if (xpc_any_openclose_chctl_flags_set(&chctl)) {
1588 ret = xpc_pull_remote_cachelines_sn2(part, part-> 1591 ret = xpc_pull_remote_cachelines_sn2(part, part->
1589 remote_openclose_args, 1592 remote_openclose_args,
1590 (void *)part_sn2-> 1593 part_sn2->
1591 remote_openclose_args_pa, 1594 remote_openclose_args_pa,
1592 XPC_OPENCLOSE_ARGS_SIZE); 1595 XPC_OPENCLOSE_ARGS_SIZE);
1593 if (ret != xpSuccess) { 1596 if (ret != xpSuccess) {
@@ -1604,7 +1607,7 @@ xpc_get_chctl_all_flags_sn2(struct xpc_partition *part)
1604 1607
1605 if (xpc_any_msg_chctl_flags_set(&chctl)) { 1608 if (xpc_any_msg_chctl_flags_set(&chctl)) {
1606 ret = xpc_pull_remote_cachelines_sn2(part, part_sn2->remote_GPs, 1609 ret = xpc_pull_remote_cachelines_sn2(part, part_sn2->remote_GPs,
1607 (void *)part_sn2->remote_GPs_pa, 1610 part_sn2->remote_GPs_pa,
1608 XPC_GP_SIZE); 1611 XPC_GP_SIZE);
1609 if (ret != xpSuccess) { 1612 if (ret != xpSuccess) {
1610 XPC_DEACTIVATE_PARTITION(part, ret); 1613 XPC_DEACTIVATE_PARTITION(part, ret);
@@ -1971,8 +1974,10 @@ xpc_pull_remote_msg_sn2(struct xpc_channel *ch, s64 get)
1971{ 1974{
1972 struct xpc_partition *part = &xpc_partitions[ch->partid]; 1975 struct xpc_partition *part = &xpc_partitions[ch->partid];
1973 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2; 1976 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1974 struct xpc_msg *remote_msg, *msg; 1977 unsigned long remote_msg_pa;
1975 u32 msg_index, nmsgs; 1978 struct xpc_msg *msg;
1979 u32 msg_index;
1980 u32 nmsgs;
1976 u64 msg_offset; 1981 u64 msg_offset;
1977 enum xp_retval ret; 1982 enum xp_retval ret;
1978 1983
@@ -1996,10 +2001,9 @@ xpc_pull_remote_msg_sn2(struct xpc_channel *ch, s64 get)
1996 2001
1997 msg_offset = msg_index * ch->msg_size; 2002 msg_offset = msg_index * ch->msg_size;
1998 msg = (struct xpc_msg *)((u64)ch->remote_msgqueue + msg_offset); 2003 msg = (struct xpc_msg *)((u64)ch->remote_msgqueue + msg_offset);
1999 remote_msg = (struct xpc_msg *)(ch->remote_msgqueue_pa + 2004 remote_msg_pa = ch->remote_msgqueue_pa + msg_offset;
2000 msg_offset);
2001 2005
2002 ret = xpc_pull_remote_cachelines_sn2(part, msg, remote_msg, 2006 ret = xpc_pull_remote_cachelines_sn2(part, msg, remote_msg_pa,
2003 nmsgs * ch->msg_size); 2007 nmsgs * ch->msg_size);
2004 if (ret != xpSuccess) { 2008 if (ret != xpSuccess) {
2005 2009