<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/fpga, branch v6.6.39</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.39</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.39'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-06-12T09:12:23+00:00</updated>
<entry>
<title>fpga: region: add owner module and take its refcount</title>
<updated>2024-06-12T09:12:23+00:00</updated>
<author>
<name>Marco Pagani</name>
<email>marpagan@redhat.com</email>
</author>
<published>2024-04-19T08:35:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4d7d12b643c00e7eea51b49a60a2ead182633ec8'/>
<id>urn:sha1:4d7d12b643c00e7eea51b49a60a2ead182633ec8</id>
<content type='text'>
[ Upstream commit b7c0e1ecee403a43abc89eb3e75672b01ff2ece9 ]

The current implementation of the fpga region assumes that the low-level
module registers a driver for the parent device and uses its owner pointer
to take the module's refcount. This approach is problematic since it can
lead to a null pointer dereference while attempting to get the region
during programming if the parent device does not have a driver.

To address this problem, add a module owner pointer to the fpga_region
struct and use it to take the module's refcount. Modify the functions for
registering a region to take an additional owner module parameter and
rename them to avoid conflicts. Use the old function names for helper
macros that automatically set the module that registers the region as the
owner. This ensures compatibility with existing low-level control modules
and reduces the chances of registering a region without setting the owner.

Also, update the documentation to keep it consistent with the new interface
for registering an fpga region.

Fixes: 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA")
Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Suggested-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Reviewed-by: Russ Weight &lt;russ.weight@linux.dev&gt;
Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20240419083601.77403-1-marpagan@redhat.com
Signed-off-by: Xu Yilun &lt;yilun.xu@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>fpga: bridge: add owner module and take its refcount</title>
<updated>2024-06-12T09:12:14+00:00</updated>
<author>
<name>Marco Pagani</name>
<email>marpagan@redhat.com</email>
</author>
<published>2024-03-22T17:18:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d7c4081c54a1d4068de9440957303a76f9e5c95b'/>
<id>urn:sha1:d7c4081c54a1d4068de9440957303a76f9e5c95b</id>
<content type='text'>
[ Upstream commit 1da11f822042eb6ef4b6064dc048f157a7852529 ]

The current implementation of the fpga bridge assumes that the low-level
module registers a driver for the parent device and uses its owner pointer
to take the module's refcount. This approach is problematic since it can
lead to a null pointer dereference while attempting to get the bridge if
the parent device does not have a driver.

To address this problem, add a module owner pointer to the fpga_bridge
struct and use it to take the module's refcount. Modify the function for
registering a bridge to take an additional owner module parameter and
rename it to avoid conflicts. Use the old function name for a helper macro
that automatically sets the module that registers the bridge as the owner.
This ensures compatibility with existing low-level control modules and
reduces the chances of registering a bridge without setting the owner.

Also, update the documentation to keep it consistent with the new interface
for registering an fpga bridge.

Other changes: opportunistically move put_device() from __fpga_bridge_get()
to fpga_bridge_get() and of_fpga_bridge_get() to improve code clarity since
the bridge device is taken in these functions.

Fixes: 21aeda950c5f ("fpga: add fpga bridge framework")
Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Suggested-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Reviewed-by: Russ Weight &lt;russ.weight@linux.dev&gt;
Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20240322171839.233864-1-marpagan@redhat.com
Signed-off-by: Xu Yilun &lt;yilun.xu@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>fpga: manager: add owner module and take its refcount</title>
<updated>2024-06-12T09:12:14+00:00</updated>
<author>
<name>Marco Pagani</name>
<email>marpagan@redhat.com</email>
</author>
<published>2024-03-05T19:29:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2da62a139a6221a345db4eb9f4f1c4b0937c89ad'/>
<id>urn:sha1:2da62a139a6221a345db4eb9f4f1c4b0937c89ad</id>
<content type='text'>
[ Upstream commit 4d4d2d4346857bf778fafaa97d6f76bb1663e3c9 ]

The current implementation of the fpga manager assumes that the low-level
module registers a driver for the parent device and uses its owner pointer
to take the module's refcount. This approach is problematic since it can
lead to a null pointer dereference while attempting to get the manager if
the parent device does not have a driver.

To address this problem, add a module owner pointer to the fpga_manager
struct and use it to take the module's refcount. Modify the functions for
registering the manager to take an additional owner module parameter and
rename them to avoid conflicts. Use the old function names for helper
macros that automatically set the module that registers the manager as the
owner. This ensures compatibility with existing low-level control modules
and reduces the chances of registering a manager without setting the owner.

Also, update the documentation to keep it consistent with the new interface
for registering an fpga manager.

Other changes: opportunistically move put_device() from __fpga_mgr_get() to
fpga_mgr_get() and of_fpga_mgr_get() to improve code clarity since the
manager device is taken in these functions.

Fixes: 654ba4cc0f3e ("fpga manager: ensure lifetime with of_fpga_mgr_get")
Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Suggested-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20240305192926.84886-1-marpagan@redhat.com
Signed-off-by: Xu Yilun &lt;yilun.xu@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>fpga: dfl-pci: add PCI subdevice ID for Intel D5005 card</title>
<updated>2024-06-12T09:11:27+00:00</updated>
<author>
<name>Peter Colberg</name>
<email>peter.colberg@intel.com</email>
</author>
<published>2024-04-22T23:02:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=37c275727aef3c4a491e8e60b1a9063e1125d4b9'/>
<id>urn:sha1:37c275727aef3c4a491e8e60b1a9063e1125d4b9</id>
<content type='text'>
[ Upstream commit bb1dbeceb1c20cfd81271e1bd69892ebd1ee38e0 ]

Add PCI subdevice ID for the Intel D5005 Stratix 10 FPGA card as
used with the Open FPGA Stack (OFS) FPGA Interface Manager (FIM).

Unlike the Intel D5005 PAC FIM which exposed a separate PCI device ID,
the OFS FIM reuses the same device ID for all DFL-based FPGA cards
and differentiates on the subdevice ID. The subdevice ID values were
chosen as the numeric part of the FPGA card names in hexadecimal.

Signed-off-by: Peter Colberg &lt;peter.colberg@intel.com&gt;
Reviewed-by: Matthew Gerlach &lt;matthew.gerlach@linux.intel.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20240422230257.1959-1-peter.colberg@intel.com
Signed-off-by: Xu Yilun &lt;yilun.xu@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>fpga: Fix memory leak for fpga_region_test_class_find()</title>
<updated>2023-10-24T17:32:39+00:00</updated>
<author>
<name>Jinjie Ruan</name>
<email>ruanjinjie@huawei.com</email>
</author>
<published>2023-10-23T03:28:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=28926daf731f72d0537767fdbab2a3e06e31190a'/>
<id>urn:sha1:28926daf731f72d0537767fdbab2a3e06e31190a</id>
<content type='text'>
fpga_region_class_find() in fpga_region_test_class_find() will call
get_device() if the data is matched, which will increment refcount for
dev-&gt;kobj, so it should call put_device() to decrement refcount for
dev-&gt;kobj to free the region, because fpga_region_unregister() will call
fpga_region_dev_release() only when the refcount for dev-&gt;kobj is zero
but fpga_region_test_init() call device_register() in
fpga_region_register_full(), which also increment refcount.

So call put_device() after calling fpga_region_class_find() in
fpga_region_test_class_find(). After applying this patch, the following
memory leak is never detected.

unreferenced object 0xffff88810c8ef000 (size 1024):
  comm "kunit_try_catch", pid 1875, jiffies 4294715298 (age 836.836s)
  hex dump (first 32 bytes):
    b8 d1 fb 05 81 88 ff ff 08 f0 8e 0c 81 88 ff ff  ................
    08 f0 8e 0c 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff817ebad7&gt;] kmalloc_trace+0x27/0xa0
    [&lt;ffffffffa02385e1&gt;] fpga_region_register_full+0x51/0x430 [fpga_region]
    [&lt;ffffffffa0228e47&gt;] 0xffffffffa0228e47
    [&lt;ffffffff829c479d&gt;] kunit_try_run_case+0xdd/0x250
    [&lt;ffffffff829c9f2a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81238b85&gt;] kthread+0x2b5/0x380
    [&lt;ffffffff81097ded&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff810034d1&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff888105fbd1b8 (size 8):
  comm "kunit_try_catch", pid 1875, jiffies 4294715298 (age 836.836s)
  hex dump (first 8 bytes):
    72 65 67 69 6f 6e 30 00                          region0.
  backtrace:
    [&lt;ffffffff817ec023&gt;] __kmalloc_node_track_caller+0x53/0x150
    [&lt;ffffffff82995590&gt;] kvasprintf+0xb0/0x130
    [&lt;ffffffff83f713b1&gt;] kobject_set_name_vargs+0x41/0x110
    [&lt;ffffffff8304ac1b&gt;] dev_set_name+0xab/0xe0
    [&lt;ffffffffa02388a2&gt;] fpga_region_register_full+0x312/0x430 [fpga_region]
    [&lt;ffffffffa0228e47&gt;] 0xffffffffa0228e47
    [&lt;ffffffff829c479d&gt;] kunit_try_run_case+0xdd/0x250
    [&lt;ffffffff829c9f2a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81238b85&gt;] kthread+0x2b5/0x380
    [&lt;ffffffff81097ded&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff810034d1&gt;] ret_from_fork_asm+0x11/0x20
unreferenced object 0xffff88810b3b8a00 (size 256):
  comm "kunit_try_catch", pid 1875, jiffies 4294715298 (age 836.836s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 08 8a 3b 0b 81 88 ff ff  ..........;.....
    08 8a 3b 0b 81 88 ff ff e0 ac 04 83 ff ff ff ff  ..;.............
  backtrace:
    [&lt;ffffffff817ebad7&gt;] kmalloc_trace+0x27/0xa0
    [&lt;ffffffff83056d7a&gt;] device_add+0xa2a/0x15e0
    [&lt;ffffffffa02388b1&gt;] fpga_region_register_full+0x321/0x430 [fpga_region]
    [&lt;ffffffffa0228e47&gt;] 0xffffffffa0228e47
    [&lt;ffffffff829c479d&gt;] kunit_try_run_case+0xdd/0x250
    [&lt;ffffffff829c9f2a&gt;] kunit_generic_run_threadfn_adapter+0x4a/0x90
    [&lt;ffffffff81238b85&gt;] kthread+0x2b5/0x380
    [&lt;ffffffff81097ded&gt;] ret_from_fork+0x2d/0x70
    [&lt;ffffffff810034d1&gt;] ret_from_fork_asm+0x11/0x20

Fixes: 64a5f972c93d ("fpga: add an initial KUnit suite for the FPGA Region")
Signed-off-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Reviewed-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20231007094321.3447084-1-ruanjinjie@huawei.com
[yilun.xu@intel.com: slightly changes the commit message]
Signed-off-by: Xu Yilun &lt;yilun.xu@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20231023032857.902699-3-yilun.xu@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>fpga: disable KUnit test suites when module support is enabled</title>
<updated>2023-10-21T10:31:25+00:00</updated>
<author>
<name>Marco Pagani</name>
<email>marpagan@redhat.com</email>
</author>
<published>2023-10-18T16:38:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a3fad2e92c76587fe262a1a4a122045b29885354'/>
<id>urn:sha1:a3fad2e92c76587fe262a1a4a122045b29885354</id>
<content type='text'>
The fpga core currently assumes that all manager, bridge, and region
devices have a parent device associated with a driver that can be used
to take the module's refcount. This behavior causes the fpga test suites
to crash with a null-ptr-deref since parent fake devices do not have a
driver. This patch disables all fpga KUnit test suites when loadable
module support is enabled until the fpga core is fixed. Test suites
can still be run using the KUnit default UML kernel.

Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Fixes: ccbc1c302115 ("fpga: add an initial KUnit suite for the FPGA Manager")
Link: https://lore.kernel.org/r/20231018163814.100803-1-marpagan@redhat.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>fpga: region: make fpga_region_class a static const structure</title>
<updated>2023-08-11T15:04:21+00:00</updated>
<author>
<name>Ivan Orlov</name>
<email>ivan.orlov0322@gmail.com</email>
</author>
<published>2023-08-11T07:30:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1a22ec09a2c1d367a43cb7f837c7a8719e7fe975'/>
<id>urn:sha1:1a22ec09a2c1d367a43cb7f837c7a8719e7fe975</id>
<content type='text'>
Now that the driver core allows for struct class to be in read-only
memory, move the fpga_region_class structure to be declared at build
time placing it into read-only memory, instead of having to be
dynamically allocated at boot time.

Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20230811073043.52808-3-ivan.orlov0322@gmail.com
Signed-off-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
</content>
</entry>
<entry>
<title>fpga: fpga-mgr: make fpga_mgr_class a static const structure</title>
<updated>2023-08-11T15:04:03+00:00</updated>
<author>
<name>Ivan Orlov</name>
<email>ivan.orlov0322@gmail.com</email>
</author>
<published>2023-08-11T07:30:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=909960e2e29d9ebda8ef303e338e43c03b3d1faf'/>
<id>urn:sha1:909960e2e29d9ebda8ef303e338e43c03b3d1faf</id>
<content type='text'>
Now that the driver core allows for struct class to be in read-only
memory, move the fpga_mgr_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time.

Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20230811073043.52808-2-ivan.orlov0322@gmail.com
Signed-off-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
</content>
</entry>
<entry>
<title>fpga: bridge: make fpga_bridge_class a static const structure</title>
<updated>2023-08-11T15:03:37+00:00</updated>
<author>
<name>Ivan Orlov</name>
<email>ivan.orlov0322@gmail.com</email>
</author>
<published>2023-08-11T07:30:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7bb2d2190d43264eea34d71de7627117db79f9c1'/>
<id>urn:sha1:7bb2d2190d43264eea34d71de7627117db79f9c1</id>
<content type='text'>
Now that the driver core allows for struct class to be in read-only
memory, move the fpga_bridge_class structure to be declared at build
time placing it into read-only memory, instead of having to be
dynamically allocated at boot time.

Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20230811073043.52808-1-ivan.orlov0322@gmail.com
Signed-off-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
</content>
</entry>
<entry>
<title>fpga: dfl-pci: Use pci_find_vsec_capability() to simplify the code</title>
<updated>2023-08-07T10:21:40+00:00</updated>
<author>
<name>Xiongfeng Wang</name>
<email>wangxiongfeng2@huawei.com</email>
</author>
<published>2023-08-02T08:07:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8607d9c1bd57da0a2d5f8ab2ec32b6ef7d85e66a'/>
<id>urn:sha1:8607d9c1bd57da0a2d5f8ab2ec32b6ef7d85e66a</id>
<content type='text'>
PCI core add pci_find_vsec_capability() to query VSEC. We can use that
core API to simplify the code.

Signed-off-by: Xiongfeng Wang &lt;wangxiongfeng2@huawei.com&gt;
Acked-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
Link: https://lore.kernel.org/r/20230802080726.178194-1-wangxiongfeng2@huawei.com
Signed-off-by: Xu Yilun &lt;yilun.xu@intel.com&gt;
</content>
</entry>
</feed>
