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 <></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">> > + * $Id: ipath_common.h 4491 2005-12-15 22:20:31Z rjwalsh $<br />> <br />> 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 />> > +#define yield() sched_yield()<br />> <br />> Please push this out. It's fine if they reuse kernel-code in userspace<br />> this way, but please move the compat wrappers to a separate file that's<br />> not in the kernel tree. <br /><br />I will do this.<br /><br />> > +typedef uint8_t ipath_type;<br />> <br />> totally meaningless typedef<br /><br />In what way?<br /><br />> > +#ifndef _BITS_PER_BYTE<br />> > +#define _BITS_PER_BYTE 8<br />> > +#endif<br />> <br />> WTF?<br /><br />Hmm. That is odd. I'll ask the folks here if we can remove this.<br /><br />> in kernel land we __inline__ includes always_inline. Also no need for<br />> a separate prototype for a just following inline function.<br /><br />Fine.<br /><br />> > +{<br />> > + void *ssv, *dsv;<br />> > + uint32_t csv;<br />> > + __asm__ __volatile__("cld\n\trep\n\tmovsb":"=&c"(csv), "=&D"(dsv),<br />> > + "=&S"(ssv)<br />> > + :"0"(cnt), "1"(dest), "2"(src)<br />> > + :"memory");<br />> > +}<br />> <br />> 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 />> > +struct ipath_int_vec {<br />> > + int long long addr;<br />> > + uint32_t info;<br />> > +};<br />> <br />> <br />> please always used fixes-size types for user communication.<br /><br />OK.<br /><br />> also please<br />> avoid ioctls like the rest of the IB codebase.<br /><br />More complex, but I'll look into it.<br /><br />> > +/* Similarly, this is the kernel version going back to the user. It's slightly<br />> > + * different, in that we want to tell if the driver was built as part of a<br />> > + * PathScale release, or from the driver from the OpenIB, kernel.org, or a<br />> > + * standard distribution, for support reasons. The high bit is 0 for<br />> > + * non-PathScale, and 1 for PathScale-built/supplied. That bit is defined<br />> > + * in Makefiles, rather than this file.<br />> > + *<br />> > + * It's returned by the driver to the user code during initialization<br />> > + * in the spi_sw_version field of ipath_base_info, so the user code can<br />> > + * in turn check for compatibility with the kernel.<br />> > +*/<br />> > +#define IPATH_KERN_SWVERSION ((IPATH_KERN_TYPE<<31) | IPATH_USER_SWVERSION)<br />> <br />> NACK, there's no way we're gonna put in a way to identify an "official"<br />> 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 />> > +#ifndef PCI_VENDOR_ID_PATHSCALE /* not in pci.ids yet */<br />> > +#define PCI_VENDOR_ID_PATHSCALE 0x1fc1<br />> > +#define PCI_DEVICE_ID_PATHSCALE_INFINIPATH1 0xa<br />> > +#define PCI_DEVICE_ID_PATHSCALE_INFINIPATH2 0xd<br />> > +#endif<br />> <br />> so move it there?<br /><br />Sounds like a good idea. I'll submit a separate patch.<br /><br />> > +typedef struct _ipath_portdata {<br />> <br />> please avoid typedefs for struct types.<br /><br />I thought I had, but I must have missed this one.<br /><br />> > +/*<br />> > + * these should be somewhat dynamic someday, although they are fixed<br />> > + * for all users of the device on any given load.<br />> > + *<br />> > + * NOTE: There is a VM bug in the 2.4 Kernels similar to the one Dave<br />> > + * fixed in the 2.6 Kernel. When using large or discontinuous memory,<br />> > + * we get random kernel oops. So, in 2.4, we are just going to stick<br />> > + * with 4k chunks instead of 64k chunks.<br />> > + */<br />> <br />> No one cares about 2.4 kernels here.<br /><br />Fine.<br /><br />> > + * these function similarly to the mlock/munlock system calls.<br />> > + * ipath_mlock() is used to pin an address range (if not already pinned),<br />> > + * and optionally return the list of physical addresses<br />> > + * ipath_munlock() does the obvious, and ipath_mlock() cleans up all <br />> > + * private memory, used at driver unload.<br />> > + * ipath_mlock_nocopy() is similar to mlock, but only one page, and marks<br />> > + * the vm so the page isn't taken away on a fork.<br />> > + */<br />> > +int ipath_mlock(unsigned long, size_t, struct page **);<br />> > +int ipath_mlock_nocopy(unsigned long, struct page **);<br />> <br />> this kind of thing definitly doesn't belong into an LLDD. or maybe<br />> it's just stale prototypes?<br /><br />No - they're used. Why do you say they don't belong?<br /><br />> > +#ifdef IPATH_COSIM<br />> > +extern __u32 sim_readl(const volatile void __iomem * addr);<br />> > +extern __u64 sim_readq(const volatile void __iomem * addr);<br />> > +extern void sim_writel(__u32 val, volatile void __iomem * addr);<br />> > +extern void sim_writeq(__u64 val, volatile void __iomem * addr);<br />> > +#define ipath_readl(addr) sim_readl(addr)<br />> > +#define ipath_readq(addr) sim_readq(addr)<br />> > +#define ipath_writel(val, addr) sim_writel(val, addr)<br />> > +#define ipath_writeq(val, addr) sim_writeq(val, addr)<br />> > +#else<br />> > +#define ipath_readl(addr) readl(addr)<br />> > +#define ipath_readq(addr) readq(addr)<br />> > +#define ipath_writel(val, addr) writel(val, addr)<br />> > +#define ipath_writeq(val, addr) writeq(val, addr)<br />> > +#endif<br />> <br />> Please use the proper functions directly. Your simulator can override<br />> them if nessecary.<br /><br />Fine.<br /><br />> > +static __inline__ uint32_t ipath_kget_kreg32(const ipath_type stype,<br />> > + ipath_kreg regno)<br />> > +{<br />> > + volatile uint32_t *kreg32;<br />> > +<br />> > + if (!devdata[stype].ipath_kregbase)<br />> > + return ~0;<br />> > +<br />> > + kreg32 = (volatile uint32_t *)&devdata[stype].ipath_kregbase[regno];<br />> <br />> volatile use is probably always wrong. but this whole functions looks like<br />> 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@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@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>