public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: linux-ia64@vger.kernel.org
Subject: RE: [patch 5/5] fix sn rw_mmr.h to use intrinsic
Date: Fri, 27 Jan 2006 03:57:57 +0000	[thread overview]
Message-ID: <200601270357.k0R3vwg22742@unix-os.sc.intel.com> (raw)
In-Reply-To: <200601270137.k0R1big21236@unix-os.sc.intel.com>

Use ia64 intrinsic for functions in sn/rw_mmr.h.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>

---
Shhh.  Before anyone noticed, here is a new version that replaces
the original patch [5/5]

By the way, for my learning purpose, why does pio_atomic_phys_write_mmrs()
need to turn off psr.ic bit?


diff -Nurp linus-2.6.git/include/asm-ia64/sn/rw_mmr.h linus-2.6.git.new/include/asm-ia64/sn/rw_mmr.h
--- linus-2.6.git/include/asm-ia64/sn/rw_mmr.h	2006-01-25 16:39:25.000000000 -0800
+++ linus-2.6.git.new/include/asm-ia64/sn/rw_mmr.h	2006-01-26 20:51:14.424330324 -0800
@@ -25,50 +25,43 @@
 extern inline long
 pio_phys_read_mmr(volatile long *mmr) 
 {
-	long val;
-        asm volatile
-            ("mov r2=psr;;"
-             "rsm psr.i | psr.dt;;"
-             "srlz.i;;"
-             "ld8.acq %0=[%1];;"
-             "mov psr.l=r2;;"
-             "srlz.i;;"
-             : "=r"(val)
-             : "r"(mmr)
-	     : "r2");
-        return val;
-}
-
+	long val, flags;
 
+	flags = ia64_getreg(_IA64_REG_PSR);
+	ia64_rsm(IA64_PSR_I | IA64_PSR_DT);
+	ia64_srlz_d();
+	val = *mmr;
+	ia64_setreg(_IA64_REG_PSR, flags);
+	ia64_srlz_d();
+	return val;
+}
 
 extern inline void
 pio_phys_write_mmr(volatile long *mmr, long val) 
 {
-        asm volatile
-            ("mov r2=psr;;"
-             "rsm psr.i | psr.dt;;"
-             "srlz.i;;"
-             "st8.rel [%0]=%1;;"
-             "mov psr.l=r2;;"
-             "srlz.i;;"
-	     :: "r"(mmr), "r"(val)
-             : "r2", "memory");
-}            
+	unsigned long flags;
+
+	flags = ia64_getreg(_IA64_REG_PSR);
+	ia64_rsm(IA64_PSR_I | IA64_PSR_DT);
+	ia64_srlz_d();
+	*mmr = val;
+	ia64_setreg(_IA64_REG_PSR, flags);
+ 	ia64_srlz_d();
+}
 
 extern inline void
 pio_atomic_phys_write_mmrs(volatile long *mmr1, long val1, volatile long *mmr2, long val2) 
 {
-        asm volatile
-            ("mov r2=psr;;"
-             "rsm psr.i | psr.dt | psr.ic;;"
-	     "cmp.ne p9,p0=%2,r0;"
-             "srlz.i;;"
-             "st8.rel [%0]=%1;"
-             "(p9) st8.rel [%2]=%3;;"
-             "mov psr.l=r2;;"
-             "srlz.i;;"
-	     :: "r"(mmr1), "r"(val1), "r"(mmr2), "r"(val2)
-             : "p9", "r2", "memory");
-}            
+	unsigned long flags;
+
+	flags = ia64_getreg(_IA64_REG_PSR);
+	ia64_rsm(IA64_PSR_DT | IA64_PSR_I | IA64_PSR_IC);
+	ia64_srlz_i();
+	*mmr1 = val1;
+	if (mmr2)
+		*mmr2 = val2;
+	ia64_setreg(_IA64_REG_PSR, flags);
+ 	ia64_srlz_i();
+}
 
 #endif /* _ASM_IA64_SN_RW_MMR_H */



  reply	other threads:[~2006-01-27  3:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-27  1:37 [patch 5/5] fix sn rw_mmr.h to use intrinsic Chen, Kenneth W
2006-01-27  3:57 ` Chen, Kenneth W [this message]
2006-01-27  9:57 ` Jes Sorensen
2006-01-27 23:35 ` Chen, Kenneth W
2006-01-31 10:57 ` Jes Sorensen
2006-01-31 11:19 ` Christoph Hellwig
2006-01-31 18:08 ` Luck, Tony
2006-02-02  9:39 ` Jes Sorensen
2006-02-02 14:18 ` Jack Steiner
2006-02-02 18:54 ` Luck, Tony
2006-02-02 21:01 ` Jes Sorensen
2006-02-03 23:40 ` Gerald Pfeifer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601270357.k0R3vwg22742@unix-os.sc.intel.com \
    --to=kenneth.w.chen@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox