<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/drivers/virtio, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>virtio: fix return value check</title>
<updated>2026-05-12T18:38:49+00:00</updated>
<author>
<name>Christian Pötzsch</name>
<email>christian.poetzsch@kernkonzept.com</email>
</author>
<published>2026-05-12T08:39:49+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=36d4c653580824b16574560b21d4401614d8b68e'/>
<id>36d4c653580824b16574560b21d4401614d8b68e</id>
<content type='text'>
The virtio_blk_do_single_req function returns ulong, which normally is
the processed size, but in an error case can be the actual error. Use
the special IS_ERR_VALUE macro to test for error.

Addresses-Coverity-ID: CID 645833 (DEADCODE) &amp; CID 645834 (NO_EFFECT)
Signed-off-by: Christian Pötzsch &lt;christian.poetzsch@kernkonzept.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The virtio_blk_do_single_req function returns ulong, which normally is
the processed size, but in an error case can be the actual error. Use
the special IS_ERR_VALUE macro to test for error.

Addresses-Coverity-ID: CID 645833 (DEADCODE) &amp; CID 645834 (NO_EFFECT)
Signed-off-by: Christian Pötzsch &lt;christian.poetzsch@kernkonzept.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: fix boot device hunting in qemu with virtio</title>
<updated>2026-05-08T21:49:27+00:00</updated>
<author>
<name>Ludwig Nussel</name>
<email>ludwig.nussel@siemens.com</email>
</author>
<published>2026-05-04T07:10:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=18806dae0e6fa9e0912a258e15f61b1b346dfdbc'/>
<id>18806dae0e6fa9e0912a258e15f61b1b346dfdbc</id>
<content type='text'>
Commit 70101c3217ae ("virtio: mmio: Return error codes on probe
failures") returns -ENODEV where it would return 0 before. That path is
apparently hit in qemu and breaks boot device discovery
(virtio_bootdev_hunt() expects only ENOENT). So return -ENOENT in
that path instead.
The remaining two error returns in the function are untouched as I
don't know where they play a role.

Signed-off-by: Ludwig Nussel &lt;ludwig.nussel@siemens.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
Acked-by: Kuan-Wei Chiu &lt;visitorckw@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 70101c3217ae ("virtio: mmio: Return error codes on probe
failures") returns -ENODEV where it would return 0 before. That path is
apparently hit in qemu and breaks boot device discovery
(virtio_bootdev_hunt() expects only ENOENT). So return -ENOENT in
that path instead.
The remaining two error returns in the function are untouched as I
don't know where they play a role.

Signed-off-by: Ludwig Nussel &lt;ludwig.nussel@siemens.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
Acked-by: Kuan-Wei Chiu &lt;visitorckw@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: add support for SIZE_MAX &amp; SEG_MAX features</title>
<updated>2026-04-27T17:11:54+00:00</updated>
<author>
<name>Christian Pötzsch</name>
<email>christian.poetzsch@kernkonzept.com</email>
</author>
<published>2026-04-17T12:03:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=bb4142af7ed8c94b3df3e75ca9ab3ef450e80885'/>
<id>bb4142af7ed8c94b3df3e75ca9ab3ef450e80885</id>
<content type='text'>
Some virtio implementations may forward the virtio requests directly to
the underlying hw. The hw may have some restrictions in how many and how
big the requests can be. Therefore, the corresponding virtio device will
announce this limitations with the SIZE_MAX &amp; SEG_MAX feature.

Add support for those features. Split an io request into multiple virtio
requests if more than seg_max segments would be used. Also split a
single buffer request into multiple segments if the buffer is bigger
then size_max.

Signed-off-by: Christian Pötzsch &lt;christian.poetzsch@kernkonzept.com&gt;
Signed-off-by: Adam Lackorzynski &lt;adam@l4re.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some virtio implementations may forward the virtio requests directly to
the underlying hw. The hw may have some restrictions in how many and how
big the requests can be. Therefore, the corresponding virtio device will
announce this limitations with the SIZE_MAX &amp; SEG_MAX feature.

Add support for those features. Split an io request into multiple virtio
requests if more than seg_max segments would be used. Also split a
single buffer request into multiple segments if the buffer is bigger
then size_max.

Signed-off-by: Christian Pötzsch &lt;christian.poetzsch@kernkonzept.com&gt;
Signed-off-by: Adam Lackorzynski &lt;adam@l4re.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: mmio: Return error codes on probe failures</title>
<updated>2026-04-22T17:07:55+00:00</updated>
<author>
<name>Kuan-Wei Chiu</name>
<email>visitorckw@gmail.com</email>
</author>
<published>2026-04-07T09:49:00+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=70101c3217aec849d509040554ef0cf7c0f1ef56'/>
<id>70101c3217aec849d509040554ef0cf7c0f1ef56</id>
<content type='text'>
Currently, virtio_mmio_probe() returns 0 when it encounters an invalid
magic value, an unsupported version, or a dummy device (ID 0). In
U-Boot's driver model, returning 0 indicates a successful probe. This
causes the system to incorrectly register and activate invalid or
placeholder devices, potentially leading to undefined behavior or
crashes later on.

Update the probe function to return appropriate error codes (-ENODEV
for invalid magic values and dummy devices, and -ENXIO for unsupported
versions). This fix correctly instructs the DM to abort the binding
process.

Fixes: fdc4aca89ecb ("virtio: Add virtio over mmio transport driver")
Signed-off-by: Kuan-Wei Chiu &lt;visitorckw@gmail.com&gt;
Acked-by: Daniel Palmer &lt;daniel@thingy.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, virtio_mmio_probe() returns 0 when it encounters an invalid
magic value, an unsupported version, or a dummy device (ID 0). In
U-Boot's driver model, returning 0 indicates a successful probe. This
causes the system to incorrectly register and activate invalid or
placeholder devices, potentially leading to undefined behavior or
crashes later on.

Update the probe function to return appropriate error codes (-ENODEV
for invalid magic values and dummy devices, and -ENXIO for unsupported
versions). This fix correctly instructs the DM to abort the binding
process.

Fixes: fdc4aca89ecb ("virtio: Add virtio over mmio transport driver")
Signed-off-by: Kuan-Wei Chiu &lt;visitorckw@gmail.com&gt;
Acked-by: Daniel Palmer &lt;daniel@thingy.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: Fix virtio initialization sequence</title>
<updated>2026-03-25T20:33:00+00:00</updated>
<author>
<name>Christian Pötzsch</name>
<email>christian.poetzsch@kernkonzept.com</email>
</author>
<published>2026-03-10T14:16:42+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=30e1733297ac7d9703bd0950bd237648dcb41850'/>
<id>30e1733297ac7d9703bd0950bd237648dcb41850</id>
<content type='text'>
The virtio spec clearly states in "3.1.1 Driver Requirements: Device
Initialization" the sequence a client has to follow after device reset.
Because u-boot resets here again, it also needs to set the "acknowledge"
bit again even if this was done in virtio_uclass_child_post_bind already
once before.

Signed-off-by: Christian Pötzsch &lt;christian.poetzsch@kernkonzept.com&gt;
Signed-off-by: Adam Lackorzynski &lt;adam@l4re.org&gt;
[trini: Add VIRTIO_CONFIG_S_ACKNOWLEDGE flag check to the test]
Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The virtio spec clearly states in "3.1.1 Driver Requirements: Device
Initialization" the sequence a client has to follow after device reset.
Because u-boot resets here again, it also needs to set the "acknowledge"
bit again even if this was done in virtio_uclass_child_post_bind already
once before.

Signed-off-by: Christian Pötzsch &lt;christian.poetzsch@kernkonzept.com&gt;
Signed-off-by: Adam Lackorzynski &lt;adam@l4re.org&gt;
[trini: Add VIRTIO_CONFIG_S_ACKNOWLEDGE flag check to the test]
Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: rng: Handle oversized return buffers</title>
<updated>2026-03-25T20:32:38+00:00</updated>
<author>
<name>Kavin Gunasekara</name>
<email>kavin.gunasekara@arm.com</email>
</author>
<published>2026-03-09T16:55:05+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=e0eef12a1f46bf946e24050a1da0f067c3952b89'/>
<id>e0eef12a1f46bf946e24050a1da0f067c3952b89</id>
<content type='text'>
If extra random bytes are returned, truncate and use the requested number
instead of returning an error.

Signed-off-by: Kavin Gunasekara &lt;kavin.gunasekara@arm.com&gt;
Signed-off-by: Meet Patel &lt;meet.patel2@arm.com&gt;
Reviewed-by: Andre Przywara &lt;andre.przywara@arm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If extra random bytes are returned, truncate and use the requested number
instead of returning an error.

Signed-off-by: Kavin Gunasekara &lt;kavin.gunasekara@arm.com&gt;
Signed-off-by: Meet Patel &lt;meet.patel2@arm.com&gt;
Reviewed-by: Andre Przywara &lt;andre.przywara@arm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: typo 'private date'</title>
<updated>2025-11-07T21:34:22+00:00</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2025-11-04T23:42:31+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=6978d6ae5964c79bd25e0754a65141906e823cca'/>
<id>6978d6ae5964c79bd25e0754a65141906e823cca</id>
<content type='text'>
%s/private date/private data/

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
%s/private date/private data/

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: typo complaint</title>
<updated>2025-11-07T21:34:22+00:00</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2025-11-04T23:39:15+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=b9af2d08094cbe785dd5d0018c30912ccd6af23e'/>
<id>b9af2d08094cbe785dd5d0018c30912ccd6af23e</id>
<content type='text'>
%s/v1.0 complaint/v1.0 compliant/

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
%s/v1.0 complaint/v1.0 compliant/

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virito: blk: fix logic to determine block sizes</title>
<updated>2025-10-17T00:01:42+00:00</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2025-10-09T16:44:35+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=7e65d29b6618603a51053d5fa9f4ef585e5b8959'/>
<id>7e65d29b6618603a51053d5fa9f4ef585e5b8959</id>
<content type='text'>
With commit c85b8071e7d3 ("virtio: blk: support block sizes exceeding 512
bytes") logic was added to detect the VIRTIO_BLK_F_BLK_SIZE capability and
to copy the block size reported by QEMU to the block device descriptor.

The logical block size can be set when invoking QEMU:

    -drive if=none,file=4096.img,format=raw,id=vda \
    -device virtio-blk-device,drive=vda,physical_block_size=4096,logical_block_size=4096

In U-Boot the logical block size is shown by command `virtio info`:

    =&gt; virtio info
    Device 0: QEMU VirtIO Block Device
                Type: Hard Disk
                Capacity: 1024.0 MB = 1.0 GB (262144 x 4096)

There where two flaws which together hid that the logic was incorrect:

* VIRTIO_BLK_F_BLK_SIZE was missing in the driver capabilities and the bit
  was filtered out.
* The result of the call to virtio_has_feature() was negated.

The problem became apparent when using ARM FVP as emulator which does not set
VIRTIO_BLK_F_BLK_SIZE.

Fixes: c85b8071e7d3 ("virtio: blk: support block sizes exceeding 512 bytes")
Reported-by: Debbie Horsfall &lt;debbie.horsfall@arm.com&gt;
Tested-by: Andre Przywara &lt;andre.przywara@arm.com&gt;
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With commit c85b8071e7d3 ("virtio: blk: support block sizes exceeding 512
bytes") logic was added to detect the VIRTIO_BLK_F_BLK_SIZE capability and
to copy the block size reported by QEMU to the block device descriptor.

The logical block size can be set when invoking QEMU:

    -drive if=none,file=4096.img,format=raw,id=vda \
    -device virtio-blk-device,drive=vda,physical_block_size=4096,logical_block_size=4096

In U-Boot the logical block size is shown by command `virtio info`:

    =&gt; virtio info
    Device 0: QEMU VirtIO Block Device
                Type: Hard Disk
                Capacity: 1024.0 MB = 1.0 GB (262144 x 4096)

There where two flaws which together hid that the logic was incorrect:

* VIRTIO_BLK_F_BLK_SIZE was missing in the driver capabilities and the bit
  was filtered out.
* The result of the call to virtio_has_feature() was negated.

The problem became apparent when using ARM FVP as emulator which does not set
VIRTIO_BLK_F_BLK_SIZE.

Fixes: c85b8071e7d3 ("virtio: blk: support block sizes exceeding 512 bytes")
Reported-by: Debbie Horsfall &lt;debbie.horsfall@arm.com&gt;
Tested-by: Andre Przywara &lt;andre.przywara@arm.com&gt;
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virtio: blk: support block sizes exceeding 512 bytes</title>
<updated>2025-09-10T17:02:23+00:00</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2025-08-30T20:39:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c85b8071e7d3fd333f8a2fdd28083cb5ec3a0645'/>
<id>c85b8071e7d3fd333f8a2fdd28083cb5ec3a0645</id>
<content type='text'>
QEMU allows to specify the logical block size via parameter
logical_block_size of a virtio-blk-device.

The communication channel via virtqueues remains based on 512 byte blocks
even if the logical_block_size is larger.

Consider the logical block size in the block device driver.

Reported-by: Emil Renner Berthing &lt;emil.renner.berthing@canonical.com&gt;
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Tested-by: Emil Renner Berthing &lt;emil.renner.berthing@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
QEMU allows to specify the logical block size via parameter
logical_block_size of a virtio-blk-device.

The communication channel via virtqueues remains based on 512 byte blocks
even if the logical_block_size is larger.

Consider the logical block size in the block device driver.

Reported-by: Emil Renner Berthing &lt;emil.renner.berthing@canonical.com&gt;
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Tested-by: Emil Renner Berthing &lt;emil.renner.berthing@canonical.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
