For generic virtio devices, where we don't need to add compatible or other special DT properties, the type field is set to "virtio,device".
But this misses the case where the user sets the type with a valid virtio device id as well, like "virtio,device1a" for file system device. The complete list of virtio device ids is mentioned here:
https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1...
Update documentation to support that as well.
Fixes: dd54ea500be8 ("docs: add documentation for generic virtio devices") Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Reviewed-by: Oleksandr Tyshchenko oleksandr_tyshchenko@epam.com --- V2->V3: - Updated commit log and clarified / fixed doc. - Tag from Oleksandr.
docs/man/xl.cfg.5.pod.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 10f37990be57..24ac92718288 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -1608,8 +1608,11 @@ example, "type=virtio,device22" for the I2C device, whose device-tree binding is
Lhttps://www.kernel.org/doc/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml
-For generic virtio devices, where we don't need to set special or compatible -properties in the Device Tree, the type field must be set to "virtio,device". +For other generic virtio devices, where we don't need to set special or +compatible properties in the Device Tree, the type field must be set to +"virtio,device" or "virtio,device<N>", where "N" is the virtio device id in +hexadecimal format, without the "0x" prefix and all in lower case, like +"virtio,device1a" for the file system device.
=item B<transport=STRING>
The strings won't be an exact match, as we are only looking to match the prefix here, i.e. "virtio,device". This is already done properly in libxl_virtio.c file, lets do the same here too.
Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device") Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Reviewed-by: Oleksandr Tyshchenko oleksandr_tyshchenko@epam.com --- V2->V3: - Tag from Oleksandr.
tools/libs/light/libxl_arm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index ddc7b2a15975..97c80d7ed0fa 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -1033,10 +1033,14 @@ static int make_virtio_mmio_node_device(libxl__gc *gc, void *fdt, uint64_t base, } else if (!strcmp(type, VIRTIO_DEVICE_TYPE_GPIO)) { res = make_virtio_mmio_node_gpio(gc, fdt); if (res) return res; - } else if (strcmp(type, VIRTIO_DEVICE_TYPE_GENERIC)) { - /* Doesn't match generic virtio device */ - LOG(ERROR, "Invalid type for virtio device: %s", type); - return -EINVAL; + } else { + int len = sizeof(VIRTIO_DEVICE_TYPE_GENERIC) - 1; + + if (strncmp(type, VIRTIO_DEVICE_TYPE_GENERIC, len)) { + /* Doesn't match generic virtio device */ + LOG(ERROR, "Invalid type for virtio device: %s", type); + return -EINVAL; + } }
return fdt_end_node(fdt);
On Thu, Apr 06, 2023 at 02:28:18PM +0530, Viresh Kumar wrote:
The strings won't be an exact match, as we are only looking to match the prefix here, i.e. "virtio,device". This is already done properly in libxl_virtio.c file, lets do the same here too.
Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device") Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Reviewed-by: Oleksandr Tyshchenko oleksandr_tyshchenko@epam.com
Acked-by: Anthony PERARD anthony.perard@citrix.com
Thanks,
On 06.04.2023 10:58, Viresh Kumar wrote:
The strings won't be an exact match, as we are only looking to match the prefix here, i.e. "virtio,device". This is already done properly in libxl_virtio.c file, lets do the same here too.
Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device") Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Reviewed-by: Oleksandr Tyshchenko oleksandr_tyshchenko@epam.com
While I've committed the doc patch (patch 1), I don't think I should commit this one without a maintainer ack, even if it looks pretty straightforward. Anthony, Wei?
Jan
V2->V3:
- Tag from Oleksandr.
tools/libs/light/libxl_arm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index ddc7b2a15975..97c80d7ed0fa 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -1033,10 +1033,14 @@ static int make_virtio_mmio_node_device(libxl__gc *gc, void *fdt, uint64_t base, } else if (!strcmp(type, VIRTIO_DEVICE_TYPE_GPIO)) { res = make_virtio_mmio_node_gpio(gc, fdt); if (res) return res;
- } else if (strcmp(type, VIRTIO_DEVICE_TYPE_GENERIC)) {
/* Doesn't match generic virtio device */
LOG(ERROR, "Invalid type for virtio device: %s", type);
return -EINVAL;
- } else {
int len = sizeof(VIRTIO_DEVICE_TYPE_GENERIC) - 1;
if (strncmp(type, VIRTIO_DEVICE_TYPE_GENERIC, len)) {
/* Doesn't match generic virtio device */
LOG(ERROR, "Invalid type for virtio device: %s", type);
return -EINVAL;
}}
return fdt_end_node(fdt);
Hi Jan,
On 03/05/2023 12:42, Jan Beulich wrote:
On 06.04.2023 10:58, Viresh Kumar wrote:
The strings won't be an exact match, as we are only looking to match the prefix here, i.e. "virtio,device". This is already done properly in libxl_virtio.c file, lets do the same here too.
Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device") Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Reviewed-by: Oleksandr Tyshchenko oleksandr_tyshchenko@epam.com
While I've committed the doc patch (patch 1), I don't think I should commit this one without a maintainer ack, even if it looks pretty straightforward. Anthony, Wei?
AFAICT Anthony has already given his acked-by:
https://lore.kernel.org/xen-devel/5e98d465-be8f-4050-a988-2a0829a71a2e@perar...
Cheers,
On 03.05.2023 14:04, Julien Grall wrote:
On 03/05/2023 12:42, Jan Beulich wrote:
On 06.04.2023 10:58, Viresh Kumar wrote:
The strings won't be an exact match, as we are only looking to match the prefix here, i.e. "virtio,device". This is already done properly in libxl_virtio.c file, lets do the same here too.
Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device") Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Reviewed-by: Oleksandr Tyshchenko oleksandr_tyshchenko@epam.com
While I've committed the doc patch (patch 1), I don't think I should commit this one without a maintainer ack, even if it looks pretty straightforward. Anthony, Wei?
AFAICT Anthony has already given his acked-by:
https://lore.kernel.org/xen-devel/5e98d465-be8f-4050-a988-2a0829a71a2e@perar...
Oh, right you are. Thanks for pointing this out. And, Anthony: I'm sorry.
Jan
On Thu, Apr 06, 2023 at 02:28:17PM +0530, Viresh Kumar wrote:
For generic virtio devices, where we don't need to add compatible or other special DT properties, the type field is set to "virtio,device".
But this misses the case where the user sets the type with a valid virtio device id as well, like "virtio,device1a" for file system device. The complete list of virtio device ids is mentioned here:
https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1...
Update documentation to support that as well.
Fixes: dd54ea500be8 ("docs: add documentation for generic virtio devices") Signed-off-by: Viresh Kumar viresh.kumar@linaro.org Reviewed-by: Oleksandr Tyshchenko oleksandr_tyshchenko@epam.com
Acked-by: Anthony PERARD anthony.perard@citrix.com
Thanks,
stratos-dev@op-lists.linaro.org