<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/ntb/test/ntb_tool.c, branch linux-6.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-08-09T15:54:41+00:00</updated>
<entry>
<title>NTB: ntb_tool: uninitialized heap data in tool_fn_write()</title>
<updated>2022-08-09T15:54:41+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2022-07-20T18:28:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=45e1058b77feade4e36402828bfe3e0d3363177b'/>
<id>urn:sha1:45e1058b77feade4e36402828bfe3e0d3363177b</id>
<content type='text'>
The call to:

	ret = simple_write_to_buffer(buf, size, offp, ubuf, size);

will return success if it is able to write even one byte to "buf".
The value of "*offp" controls which byte.  This could result in
reading uninitialized data when we do the sscanf() on the next line.

This code is not really desigined to handle partial writes where
*offp is non-zero and the "buf" is preserved and re-used between writes.
Just ban partial writes and replace the simple_write_to_buffer() with
copy_from_user().

Fixes: 578b881ba9c4 ("NTB: Add tool test client")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>NTB: ntb_tool: reading the link file should not end in a NULL byte</title>
<updated>2020-06-06T00:02:08+00:00</updated>
<author>
<name>Logan Gunthorpe</name>
<email>logang@deltatee.com</email>
</author>
<published>2019-01-09T19:22:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=912e12813dd03c602e4922fc34709ec4d4380cf0'/>
<id>urn:sha1:912e12813dd03c602e4922fc34709ec4d4380cf0</id>
<content type='text'>
When running ntb_test this warning is issued:

./ntb_test.sh: line 200: warning: command substitution: ignored null
byte in input

This is caused by the kernel returning one more byte than is necessary
when reading the link file.

Reduce the number of bytes read back to 2 as it was before the
commit that regressed this.

Fixes: 7f46c8b3a552 ("NTB: ntb_tool: Add full multi-port NTB API support")
Signed-off-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
Acked-by: Allen Hubbe &lt;allenbh@gmail.com&gt;
Tested-by: Alexander Fomichev &lt;fomichev.ru@gmail.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>ntb_tool: pass correct struct device to dma_alloc_coherent</title>
<updated>2020-06-06T00:02:08+00:00</updated>
<author>
<name>Sanjay R Mehta</name>
<email>sanju.mehta@amd.com</email>
</author>
<published>2020-05-06T04:21:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=433efe720674efd9fdbcef78be75793393cf05db'/>
<id>urn:sha1:433efe720674efd9fdbcef78be75793393cf05db</id>
<content type='text'>
Currently, ntb-&gt;dev is passed to dma_alloc_coherent
and dma_free_coherent calls. The returned dma_addr_t
is the CPU physical address. This works fine as long
as IOMMU is disabled. But when IOMMU is enabled, we
need to make sure that IOVA is returned for dma_addr_t.
So the correct way to achieve this is by changing the
first parameter of dma_alloc_coherent() as ntb-&gt;pdev-&gt;dev
instead.

Fixes: 5648e56d03fa ("NTB: ntb_perf: Add full multi-port NTB API support")
Signed-off-by: Sanjay R Mehta &lt;sanju.mehta@amd.com&gt;
Signed-off-by: Arindam Nath &lt;arindam.nath@amd.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>ntb_tool: Fix printk format</title>
<updated>2020-03-13T14:03:49+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2020-01-14T19:22:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2ef97a6c181eba48f14c9ed98ce4398d21164683'/>
<id>urn:sha1:2ef97a6c181eba48f14c9ed98ce4398d21164683</id>
<content type='text'>
The correct printk format is %pa or %pap, but not %pa[p].

Fixes: 7f46c8b3a5523 ("NTB: ntb_tool: Add full multi-port NTB API support")
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>NTB: ntb_tool: fix memory leak on 'buf' on error exit path</title>
<updated>2018-01-29T03:17:24+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2018-01-22T09:38:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2e2bc5a9a300261853303c006b7c29faafc64221'/>
<id>urn:sha1:2e2bc5a9a300261853303c006b7c29faafc64221</id>
<content type='text'>
Currently there is a memory leak on buf when the call to ntb_mw_get_align
fails.  Add an exit err label and jump to this so that kfree on buf frees
the memory.

Detected by CoverityScan, CID#1464286 ("Resource leak")

Fixes: d637628ce00c ("NTB: ntb_tool: Add full multi-port NTB API support")
Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Acked-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>NTB: ntb_tool: Add full multi-port NTB API support</title>
<updated>2018-01-29T03:17:24+00:00</updated>
<author>
<name>Serge Semin</name>
<email>fancer.lancer@gmail.com</email>
</author>
<published>2017-12-06T14:31:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7f46c8b3a5523a28cb81c2c12bc3dcc76ed52d59'/>
<id>urn:sha1:7f46c8b3a5523a28cb81c2c12bc3dcc76ed52d59</id>
<content type='text'>
Former NTB Debugging tool driver supported only the limited
functionality of the recently updated NTB API, which is now available
to work with the truly NTB multi-port devices and devices, which
got NTB Message registers instead of Scratchpads. This patch
fully rewrites the driver so one would fully expose all the new
NTB API interfaces. Particularly it concerns the Message registers,
peer ports API, NTB link settings. Additional cleanups are also added
here.

Signed-off-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>ntb: remove unneeded DRIVER_LICENSE #defines</title>
<updated>2018-01-29T03:17:23+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2017-11-17T14:20:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0ed08f829b10531c35887fd781d80ef3bfbb1cd9'/>
<id>urn:sha1:0ed08f829b10531c35887fd781d80ef3bfbb1cd9</id>
<content type='text'>
There is no need to #define the license of the driver, just put it in
the MODULE_LICENSE() line directly as a text string.

This allows tools that check that the module license matches the source
code license to work properly, as there is no need to unwind the
unneeded dereference, especially when the string is defined just a few
lines above the usage of it.

Reported-and-reviewed-by: Philippe Ombredanne &lt;pombredanne@nexb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Dave Jiang &lt;dave.jiang@intel.com&gt;
Cc: Allen Hubbe &lt;Allen.Hubbe@emc.com&gt;
Cc: Gary R Hook &lt;gary.hook@amd.com&gt;
Cc: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>NTB: Ensure ntb_mw_get_align() is only called when the link is up</title>
<updated>2017-11-19T01:37:11+00:00</updated>
<author>
<name>Logan Gunthorpe</name>
<email>logang@deltatee.com</email>
</author>
<published>2017-08-03T18:19:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=980c41c86b37b6086ad758566b437cb1a469b4bc'/>
<id>urn:sha1:980c41c86b37b6086ad758566b437cb1a469b4bc</id>
<content type='text'>
With Switchtec hardware it's impossible to get the alignment parameters
for a peer's memory window until the peer's driver has configured its
windows. Strictly speaking, the link doesn't have to be up for this,
but the link being up is the only way the client can tell that
the other side has been configured.

This patch converts ntb_transport and ntb_perf to use this function after
the link goes up. This simplifies these clients slightly because they
no longer have to store the alignment parameters. It also tweaks
ntb_tool so that peer_mw_trans will print zero if it is run before
the link goes up.

Signed-off-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
Acked-by: Allen Hubbe &lt;Allen.Hubbe@dell.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>ntb: use correct mw_count function in ntb_tool and ntb_transport</title>
<updated>2017-07-17T16:56:15+00:00</updated>
<author>
<name>Logan Gunthorpe</name>
<email>logang@deltatee.com</email>
</author>
<published>2017-06-26T19:50:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bc240eec4b074f5dc2753f295e980e66b72c90fb'/>
<id>urn:sha1:bc240eec4b074f5dc2753f295e980e66b72c90fb</id>
<content type='text'>
After converting to the new API, both ntb_tool and ntb_transport are
using ntb_mw_count to iterate through ntb_peer_get_addr when they
should be using ntb_peer_mw_count.

This probably isn't an issue with the Intel and AMD drivers but
this will matter for any future driver with asymetric memory window
counts.

Signed-off-by: Logan Gunthorpe &lt;logang@deltatee.com&gt;
Acked-by: Allen Hubbe &lt;Allen.Hubbe@emc.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
Fixes: 443b9a14ecbe ("NTB: Alter MW API to support multi-ports devices")
</content>
</entry>
<entry>
<title>NTB: Alter Scratchpads API to support multi-ports devices</title>
<updated>2017-07-06T15:30:07+00:00</updated>
<author>
<name>Serge Semin</name>
<email>fancer.lancer@gmail.com</email>
</author>
<published>2017-01-11T00:13:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d67288a39584daad11edee9b03d53264ba147453'/>
<id>urn:sha1:d67288a39584daad11edee9b03d53264ba147453</id>
<content type='text'>
Even though there is no any real NTB hardware, which would have both more
than two ports and Scratchpad registers, it is logically correct to have
Scratchpad API accepting a peer port index as well. Intel/AMD drivers utilize
Primary and Secondary topology to split Scratchpad between connected root
devices. Since port-index API introduced, Intel/AMD NTB hardware drivers can
use device port to determine which Scratchpad registers actually belong to
local and peer devices. The same approach can be used if some potential
hardware in future will be multi-port and have some set of Scratchpads.
Here are the brief of changes in the API:
 ntb_spad_count() - return number of Scratchpads per each port
 ntb_peer_spad_addr(pidx, sidx) - address of Scratchpad register of the
peer device with pidx-index
 ntb_peer_spad_read(pidx, sidx) - read specified Scratchpad register of the
peer with pidx-index
 ntb_peer_spad_write(pidx, sidx) - write data to Scratchpad register of the
peer with pidx-index

Since there is hardware which doesn't support Scratchpad registers, the
corresponding API methods are now made optional.

Signed-off-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Acked-by: Allen Hubbe &lt;Allen.Hubbe@dell.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
</feed>
