CINXE.COM

LKML: Robert Walsh: Re: [PATCH 01/13] [RFC] ipath basic headers

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Robert Walsh: Re: [PATCH 01/13] [RFC] ipath basic headers</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Robert Walsh" href="/groupie.php?aid=5237" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2005"> [2005]</a> 聽 <a class="nb" href="/lkml/2005/12"> [Dec]</a> 聽 <a class="nb" href="/lkml/2005/12/17"> [17]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2005/12/17/98" onclick="this.href='/lkml/headers'+'/2005/12/17/98';">[headers]</a>聽 <a href="/lkml/bounce/2005/12/17/98">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2005/12/16/290">First message in thread</a></li><li><a href="/lkml/2005/12/16/293">Roland Dreier</a><ul><li><a href="/lkml/2005/12/16/289">Roland Dreier</a><ul><li><a href="/lkml/2005/12/16/291">Roland Dreier</a><ul><li><a href="/lkml/2005/12/16/303">Roland Dreier</a><ul><li><a href="/lkml/2005/12/16/301">Roland Dreier</a></li><li><a href="/lkml/2005/12/17/72">Andrew Morton</a></li></ul></li><li><a href="/lkml/2005/12/17/25">Pekka Enberg</a><ul><li><a href="/lkml/2005/12/17/92">Robert Walsh</a></li></ul></li><li><a href="/lkml/2005/12/17/31">Christoph Hellwig</a></li><li><a href="/lkml/2005/12/17/78">Andrew Morton</a><ul><li><a href="/lkml/2005/12/17/103">Robert Walsh</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/12/17/23">Pekka Enberg</a><ul><li><a href="/lkml/2005/12/17/97">Robert Walsh</a></li></ul></li><li><a href="/lkml/2005/12/17/29">Christoph Hellwig</a><ul><li><a href="/lkml/2005/12/17/96">(Eric W. Biederman)</a><ul><li><a href="/lkml/2005/12/17/129">Andi Kleen</a><ul><li><a href="/lkml/2005/12/18/34">(Eric W. Biederman)</a></li></ul></li></ul></li><li class="origin"><a href="/lkml/2005/12/17/100">Robert Walsh</a><ul><li><a href="/lkml/2005/12/17/100">Arjan van de Ven</a><ul><li><a href="/lkml/2005/12/17/104">Robert Walsh</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/12/17/77">Andrew Morton</a><ul><li><a href="/lkml/2005/12/17/102">Robert Walsh</a><ul><li><a href="/lkml/2005/12/17/126">Andrew Morton</a></li></ul></li><li><a href="/lkml/2005/12/19/207">Robert Walsh</a></li></ul></li></ul></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">Subject</td><td class="rp" itemprop="name">Re: [PATCH 01/13] [RFC] ipath basic headers</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Robert Walsh &lt;&gt;</td></tr><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Sat, 17 Dec 2005 14:19:13 -0800</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">&gt; &gt; + * $Id: ipath_common.h 4491 2005-12-15 22:20:31Z rjwalsh $<br />&gt; <br />&gt; please remove RCSIDs everywhere.<br /><br />These are everywhere in the OpenIB code. I was actually asked by one of<br />the OpenIB developers to include them. I'm happy to remove them again,<br />but what do the OpenIB folks think?<br /><br />&gt; &gt; +#define yield() sched_yield()<br />&gt; <br />&gt; Please push this out. It's fine if they reuse kernel-code in userspace<br />&gt; this way, but please move the compat wrappers to a separate file that's<br />&gt; not in the kernel tree. <br /><br />I will do this.<br /><br />&gt; &gt; +typedef uint8_t ipath_type;<br />&gt; <br />&gt; totally meaningless typedef<br /><br />In what way?<br /><br />&gt; &gt; +#ifndef _BITS_PER_BYTE<br />&gt; &gt; +#define _BITS_PER_BYTE 8<br />&gt; &gt; +#endif<br />&gt; <br />&gt; WTF?<br /><br />Hmm. That is odd. I'll ask the folks here if we can remove this.<br /><br />&gt; in kernel land we __inline__ includes always_inline. Also no need for<br />&gt; a separate prototype for a just following inline function.<br /><br />Fine.<br /><br />&gt; &gt; +{<br />&gt; &gt; + void *ssv, *dsv;<br />&gt; &gt; + uint32_t csv;<br />&gt; &gt; + __asm__ __volatile__("cld\n\trep\n\tmovsb":"=&amp;c"(csv), "=&amp;D"(dsv),<br />&gt; &gt; + "=&amp;S"(ssv)<br />&gt; &gt; + :"0"(cnt), "1"(dest), "2"(src)<br />&gt; &gt; + :"memory");<br />&gt; &gt; +}<br />&gt; <br />&gt; No way we're gonna put assembler code into such a driver.<br /><br />Why not? The chip (and therefore the driver) only works with Opterons.<br />It's tied to the HT bus, but PCI or anything like that.<br /><br />&gt; &gt; +struct ipath_int_vec {<br />&gt; &gt; + int long long addr;<br />&gt; &gt; + uint32_t info;<br />&gt; &gt; +};<br />&gt; <br />&gt; <br />&gt; please always used fixes-size types for user communication.<br /><br />OK.<br /><br />&gt; also please<br />&gt; avoid ioctls like the rest of the IB codebase.<br /><br />More complex, but I'll look into it.<br /><br />&gt; &gt; +/* Similarly, this is the kernel version going back to the user. It's slightly<br />&gt; &gt; + * different, in that we want to tell if the driver was built as part of a<br />&gt; &gt; + * PathScale release, or from the driver from the OpenIB, kernel.org, or a<br />&gt; &gt; + * standard distribution, for support reasons. The high bit is 0 for<br />&gt; &gt; + * non-PathScale, and 1 for PathScale-built/supplied. That bit is defined<br />&gt; &gt; + * in Makefiles, rather than this file.<br />&gt; &gt; + *<br />&gt; &gt; + * It's returned by the driver to the user code during initialization<br />&gt; &gt; + * in the spi_sw_version field of ipath_base_info, so the user code can<br />&gt; &gt; + * in turn check for compatibility with the kernel.<br />&gt; &gt; +*/<br />&gt; &gt; +#define IPATH_KERN_SWVERSION ((IPATH_KERN_TYPE&lt;&lt;31) | IPATH_USER_SWVERSION)<br />&gt; <br />&gt; NACK, there's no way we're gonna put in a way to identify an "official"<br />&gt; version. The official version is the last one in mainline always.<br /><br />Why make this hard for vendors? You may only care about the latest<br />mainline, but if we want to sell chips, we have to support this all the<br />way back to 2.6.9 (RHEL).<br /><br />&gt; &gt; +#ifndef PCI_VENDOR_ID_PATHSCALE /* not in pci.ids yet */<br />&gt; &gt; +#define PCI_VENDOR_ID_PATHSCALE 0x1fc1<br />&gt; &gt; +#define PCI_DEVICE_ID_PATHSCALE_INFINIPATH1 0xa<br />&gt; &gt; +#define PCI_DEVICE_ID_PATHSCALE_INFINIPATH2 0xd<br />&gt; &gt; +#endif<br />&gt; <br />&gt; so move it there?<br /><br />Sounds like a good idea. I'll submit a separate patch.<br /><br />&gt; &gt; +typedef struct _ipath_portdata {<br />&gt; <br />&gt; please avoid typedefs for struct types.<br /><br />I thought I had, but I must have missed this one.<br /><br />&gt; &gt; +/*<br />&gt; &gt; + * these should be somewhat dynamic someday, although they are fixed<br />&gt; &gt; + * for all users of the device on any given load.<br />&gt; &gt; + *<br />&gt; &gt; + * NOTE: There is a VM bug in the 2.4 Kernels similar to the one Dave<br />&gt; &gt; + * fixed in the 2.6 Kernel. When using large or discontinuous memory,<br />&gt; &gt; + * we get random kernel oops. So, in 2.4, we are just going to stick<br />&gt; &gt; + * with 4k chunks instead of 64k chunks.<br />&gt; &gt; + */<br />&gt; <br />&gt; No one cares about 2.4 kernels here.<br /><br />Fine.<br /><br />&gt; &gt; + * these function similarly to the mlock/munlock system calls.<br />&gt; &gt; + * ipath_mlock() is used to pin an address range (if not already pinned),<br />&gt; &gt; + * and optionally return the list of physical addresses<br />&gt; &gt; + * ipath_munlock() does the obvious, and ipath_mlock() cleans up all <br />&gt; &gt; + * private memory, used at driver unload.<br />&gt; &gt; + * ipath_mlock_nocopy() is similar to mlock, but only one page, and marks<br />&gt; &gt; + * the vm so the page isn't taken away on a fork.<br />&gt; &gt; + */<br />&gt; &gt; +int ipath_mlock(unsigned long, size_t, struct page **);<br />&gt; &gt; +int ipath_mlock_nocopy(unsigned long, struct page **);<br />&gt; <br />&gt; this kind of thing definitly doesn't belong into an LLDD. or maybe<br />&gt; it's just stale prototypes?<br /><br />No - they're used. Why do you say they don't belong?<br /><br />&gt; &gt; +#ifdef IPATH_COSIM<br />&gt; &gt; +extern __u32 sim_readl(const volatile void __iomem * addr);<br />&gt; &gt; +extern __u64 sim_readq(const volatile void __iomem * addr);<br />&gt; &gt; +extern void sim_writel(__u32 val, volatile void __iomem * addr);<br />&gt; &gt; +extern void sim_writeq(__u64 val, volatile void __iomem * addr);<br />&gt; &gt; +#define ipath_readl(addr) sim_readl(addr)<br />&gt; &gt; +#define ipath_readq(addr) sim_readq(addr)<br />&gt; &gt; +#define ipath_writel(val, addr) sim_writel(val, addr)<br />&gt; &gt; +#define ipath_writeq(val, addr) sim_writeq(val, addr)<br />&gt; &gt; +#else<br />&gt; &gt; +#define ipath_readl(addr) readl(addr)<br />&gt; &gt; +#define ipath_readq(addr) readq(addr)<br />&gt; &gt; +#define ipath_writel(val, addr) writel(val, addr)<br />&gt; &gt; +#define ipath_writeq(val, addr) writeq(val, addr)<br />&gt; &gt; +#endif<br />&gt; <br />&gt; Please use the proper functions directly. Your simulator can override<br />&gt; them if nessecary.<br /><br />Fine.<br /><br />&gt; &gt; +static __inline__ uint32_t ipath_kget_kreg32(const ipath_type stype,<br />&gt; &gt; + ipath_kreg regno)<br />&gt; &gt; +{<br />&gt; &gt; + volatile uint32_t *kreg32;<br />&gt; &gt; +<br />&gt; &gt; + if (!devdata[stype].ipath_kregbase)<br />&gt; &gt; + return ~0;<br />&gt; &gt; +<br />&gt; &gt; + kreg32 = (volatile uint32_t *)&amp;devdata[stype].ipath_kregbase[regno];<br />&gt; <br />&gt; volatile use is probably always wrong. but this whole functions looks like<br />&gt; a very odd wrapper anyway?<br /><br />The volatile is there so the compiler doesn't optimize away the read.<br />This is important, because reads of our hardware have side-effects and<br />cannot be optimized out.<br /><br />Regards,<br /> Robert.<br /><br />-- <br />Robert Walsh Email: rjwalsh&#64;pathscale.com<br />PathScale, Inc. Phone: +1 650 934 8117<br />2071 Stierlin Court, Suite 200 Fax: +1 650 428 1969<br />Mountain View, CA 94043.<br /><br /><br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo&#64;vger.kernel.org<br />More majordomo info at <a href="http://vger.kernel.org/majordomo-info.html">http://vger.kernel.org/majordomo-info.html</a><br />Please read the FAQ at <a href="http://www.tux.org/lkml/">http://www.tux.org/lkml/</a><br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2005-12-17 23:24 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10