Re: [PATCH v3 7/7] of: Add KUnit test to confirm DTB is loaded

2024-02-02 Thread David Gow
On Sat, 3 Feb 2024 at 03:59, Stephen Boyd wrote: > > Add a KUnit test that confirms a DTB has been loaded, i.e. there is a > root node, and that the of_have_populated_dt() API works properly. > > Cc: Rob Herring > Cc: Frank Rowand > Cc: David Gow > Cc: Brendan Higgins > Signed-off-by: Stephen

[PATCH] um: Makefile: use bash from the environment

2024-02-02 Thread Yueh-Shun Li
Set Makefile SHELL to bash instead of /bin/bash for better portability. Some systems do not install binaries to /bin, and therefore do not provide /bin/bash. OS distributions such as NixOS and Guix System intentionally avoid implementing the Filesystem Hierarchy Standard (FHS). The recipies insid

[PATCH v3 6/7] of: unittest: treat missing of_root as error instead of fixing up

2024-02-02 Thread Stephen Boyd
From: Frank Rowand unflatten_device_tree() now ensures that the 'of_root' node is populated with the root of a default empty devicetree. Remove the unittest code that created 'of_root' if it was missing. Verify that 'of_root' is valid before attempting to attach the testcase-data subtree. Remove

[PATCH v3 7/7] of: Add KUnit test to confirm DTB is loaded

2024-02-02 Thread Stephen Boyd
Add a KUnit test that confirms a DTB has been loaded, i.e. there is a root node, and that the of_have_populated_dt() API works properly. Cc: Rob Herring Cc: Frank Rowand Cc: David Gow Cc: Brendan Higgins Signed-off-by: Stephen Boyd --- drivers/of/.kunitconfig | 3 +++ drivers/of/Kconfig

[PATCH v3 3/7] um: Unconditionally call unflatten_device_tree()

2024-02-02 Thread Stephen Boyd
Call this function unconditionally so that we can populate an empty DTB on platforms that don't boot with a command line provided DTB. There's no harm in calling unflatten_device_tree() unconditionally. If there isn't a valid initial_boot_params dtb then unflatten_device_tree() returns early. Cc:

[PATCH v3 2/7] of: Create of_root if no dtb provided by firmware

2024-02-02 Thread Stephen Boyd
From: Frank Rowand When enabling CONFIG_OF on a platform where 'of_root' is not populated by firmware, we end up without a root node. In order to apply overlays and create subnodes of the root node, we need one. Create this root node by unflattening an empty builtin dtb. If firmware provides a f

[PATCH v3 5/7] arm64: Unconditionally call unflatten_device_tree()

2024-02-02 Thread Stephen Boyd
Call this function unconditionally so that we can populate an empty DTB on platforms that don't boot with a firmware provided or builtin DTB. When ACPI is in use, unflatten_device_tree() ignores the 'initial_boot_params' pointer so the live DT on those systems won't be whatever that's pointing to.

[PATCH v3 1/7] of: Always unflatten in unflatten_and_copy_device_tree()

2024-02-02 Thread Stephen Boyd
We want to populate an empty DT whenever CONFIG_OF is enabled so that overlays can be applied and the DT unit tests can be run. Make unflatten_and_copy_device_tree() stop printing a warning if the 'initial_boot_params' pointer is NULL. Instead, simply copy the dtb if there is one and then unflatten

[PATCH v3 4/7] x86/of: Unconditionally call unflatten_and_copy_device_tree()

2024-02-02 Thread Stephen Boyd
Call this function unconditionally so that we can populate an empty DTB on platforms that don't boot with a firmware provided or builtin DTB. There's no harm in calling unflatten_device_tree() unconditionally here. If there isn't a non-NULL 'initial_boot_params' pointer then unflatten_device_tree()

[PATCH v3 0/7] of: populate of_root node if bootloader doesn't

2024-02-02 Thread Stephen Boyd
Arch maintainers, please ack/review patches. This is a resend of a series from Frank last year[1]. I worked in Rob's review comments to unconditionally call unflatten_device_tree() and fixup/audit calls to of_have_populated_dt() so that behavior doesn't change. I need this series so I can add DT

Re: [PATCH v2 1/7] arm64: Unconditionally call unflatten_device_tree()

2024-02-02 Thread Rob Herring
On Wed, Jan 31, 2024 at 02:59:53PM -0800, Stephen Boyd wrote: > Quoting Rob Herring (2024-01-31 12:54:05) > > On Mon, Jan 29, 2024 at 04:45:00PM -0800, Stephen Boyd wrote: > > > Call this function unconditionally so that we can populate an empty DTB > > > on platforms that don't boot with a firmwar

Re: [PATCH vhost 07/17] virtio: find_vqs: pass struct instead of multi parameters

2024-02-02 Thread kernel test robot
Hi Xuan, kernel test robot noticed the following build errors: [auto build test ERROR on v6.7] [also build test ERROR on next-20240202] [cannot apply to remoteproc/rproc-next uml/next s390/features linus/master uml/fixes v6.8-rc2 v6.8-rc1] [If your patch is applied to the wrong git tree, kindly

[PATCH vhost v1 19/19] virtio_net: sq support premapped mode

2024-02-02 Thread Xuan Zhuo
If the xsk is enabling, the xsk tx will share the send queue. But the xsk requires that the send queue use the premapped mode. So the send queue must support premapped mode. cmd: sh samples/pktgen/pktgen_sample01_simple.sh -i eth0 \ -s 16 -d 10.0.0.128 -m 00:16:3e:2c:c8:2e -n 0 -p 100

[PATCH vhost v1 18/19] virtio_net: rename free_old_xmit_skbs to free_old_xmit

2024-02-02 Thread Xuan Zhuo
Since free_old_xmit_skbs not only deals with skb, but also xdp frame and subsequent added xsk, so change the name of this function to free_old_xmit. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff

[PATCH vhost v1 17/19] virtio_net: unify the code for recycling the xmit ptr

2024-02-02 Thread Xuan Zhuo
There are two completely similar and independent implementations. This is inconvenient for the subsequent addition of new types. So extract a function from this piece of code and call this function uniformly to recover old xmit ptr. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/

[PATCH vhost v1 16/19] virtio_ring: introduce virtqueue_dma_map_sg_attrs

2024-02-02 Thread Xuan Zhuo
Introduce a helper to do dma map for scatterlist. That can be used by other drivers. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 32 include/linux/virtio.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/drivers/virtio/virtio_ring.

[PATCH vhost v1 15/19] virtio_ring: introduce dma map api for page

2024-02-02 Thread Xuan Zhuo
The virtio-net sq will use these APIs to map the scatterlist. For scatterlist, the page dma APIs are more appropriate. dma_addr_t virtqueue_dma_map_page_attrs(struct virtqueue *_vq, struct page *page, size_t offset, size_t size,

[PATCH vhost v1 09/19] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-02-02 Thread Xuan Zhuo
Just like find_vqs(), it is time to refactor the vring_new_virtqueue(). We pass the similar struct to vring_new_virtqueue. Signed-off-by: Xuan Zhuo --- drivers/platform/mellanox/mlxbf-tmfifo.c | 13 +--- drivers/remoteproc/remoteproc_virtio.c | 11 --- drivers/virtio/virtio_ring.c

[PATCH vhost v1 11/19] virtio: find_vqs: add new parameter premapped

2024-02-02 Thread Xuan Zhuo
If the premapped mode is enabled, the dma array(struct vring_desc_dma) of virtio core will not be allocated. That is judged when find_vqs() is called. To avoid allocating dma array in find_vqs() and releasing it immediately by virtqueue_set_dma_premapped(). This patch introduces a new parameter to

[PATCH vhost v1 14/19] virtio_ring: remove api of setting vq premapped

2024-02-02 Thread Xuan Zhuo
The virtio-net sets the premapped mode by find_vqs(). So the below API is not used by anyone, we remove it. int virtqueue_set_dma_premapped(struct virtqueue *_vq); Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 56 include/linux/virtio.h

[PATCH vhost v1 13/19] virtio_net: set premapped mode by find_vqs()

2024-02-02 Thread Xuan Zhuo
Now, the virtio core can set the premapped mode by find_vqs(). If the premapped can be enabled, the dma array will not be allocated. So virtio-net use the api of find_vqs to enable the premapped. Judge the premapped mode by the vq->premapped instead of saving local variable. Signed-off-by: Xuan Z

[PATCH vhost v1 12/19] virtio_ring: export premapped to driver by struct virtqueue

2024-02-02 Thread Xuan Zhuo
Export the premapped to drivers, then drivers can check the vq premapped mode after the find_vqs(). Because the find_vqs() just try to enable the vq premapped mode, the driver must check that after find_vqs(). Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 13 + include/

[PATCH vhost v1 10/19] virtio_ring: reuse the parameter struct of find_vqs()

2024-02-02 Thread Xuan Zhuo
As the refactor of find_vqs()/vring_new_virtqueue(), the cfg/tp_cfg are passed to vring. This patch refactors the vring by this structure. This can simplify the code. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 157 +++ 1 file changed, 50 insertio

[PATCH vhost v1 07/19] virtio: find_vqs: pass struct instead of multi parameters

2024-02-02 Thread Xuan Zhuo
Now, we pass multi parameters to find_vqs. These parameters may work for transport or work for vring. And find_vqs has multi implements in many places: But every time, arch/um/drivers/virtio_uml.c drivers/platform/mellanox/mlxbf-tmfifo.c drivers/remoteproc/remoteproc_virtio.c drivers/s390/vir

[PATCH vhost v1 08/19] virtio: vring_create_virtqueue: pass struct instead of multi parameters

2024-02-02 Thread Xuan Zhuo
Now, we pass multi parameters to vring_create_virtqueue. These parameters may from transport or from driver. vring_create_virtqueue is called by many places. Every time, we try to add a new parameter, that is difficult. If parameters from the driver, that should directly be passed to vring. Then

[PATCH vhost v1 05/19] virtio_ring: split: structure the indirect desc table

2024-02-02 Thread Xuan Zhuo
This commit structure the indirect desc table. Then we can get the desc num directly when doing unmap. And save the dma info to the struct, then the indirect will not use the dma fields of the desc_extra. The subsequent commits will make the dma fields are optional. But for the indirect case, we m

[PATCH vhost v1 01/19] virtio_ring: introduce vring_need_unmap_buffer

2024-02-02 Thread Xuan Zhuo
To make the code readable, introduce vring_need_unmap_buffer() to replace do_unmap. use_dma_api premapped -> vring_need_unmap_buffer() 1. false falsefalse 2. truefalsetrue 3. truetrue false Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drive

[PATCH vhost v1 03/19] virtio_ring: packed: structure the indirect desc table

2024-02-02 Thread Xuan Zhuo
This commit structure the indirect desc table. Then we can get the desc num directly when doing unmap. And save the dma info to the struct, then the indirect will not use the dma fields of the desc_extra. The subsequent commits will make the dma fields are optional. But for the indirect case, we m

[PATCH vhost v1 06/19] virtio_ring: no store dma info when unmap is not needed

2024-02-02 Thread Xuan Zhuo
As discussed: http://lore.kernel.org/all/CACGkMEug-=C+VQhkMYSgUKMC==04m7-uem_yc21bggkkzh8...@mail.gmail.com When the vq is premapped mode, the driver manages the dma info is a good way. So this commit make the virtio core not to store the dma info and release the memory which is used to store the

[PATCH vhost v1 04/19] virtio_ring: split: remove double check of the unmap ops

2024-02-02 Thread Xuan Zhuo
In the functions vring_unmap_one_split and vring_unmap_one_split_indirect, multiple checks are made whether unmap is performed and whether it is INDIRECT. These two functions are usually called in a loop, and we should put the check outside the loop. And we unmap the descs with VRING_DESC_F_INDIR

[PATCH vhost v1 02/19] virtio_ring: packed: remove double check of the unmap ops

2024-02-02 Thread Xuan Zhuo
In the functions vring_unmap_extra_packed and vring_unmap_desc_packed, multiple checks are made whether unmap is performed and whether it is INDIRECT. These two functions are usually called in a loop, and we should put the check outside the loop. And we unmap the descs with VRING_DESC_F_INDIRECT

[PATCH vhost v1 00/19] virtio: drivers maintain dma info for premapped vq

2024-02-02 Thread Xuan Zhuo
As discussed: http://lore.kernel.org/all/cacgkmevq0no8qgc46u4mgsmtud44fd_cflcpavmj3rhyqrz...@mail.gmail.com If the virtio is premapped mode, the driver should manage the dma info by self. So the virtio core should not store the dma info. So we can release the memory used to store the dma info. Bu