You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2024/10/05 15:05:19 UTC

(nuttx) branch master updated (8f9857bf8c -> 1195ec03f7)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from 8f9857bf8c fs_lock:Check the nwaiter when deleting a bucket
     new 6685fb5434 pci/ivshmem: Skip unregistering ivshmem driver
     new 2aaaa7632f rpmsg/ivshmem: Skip unregistering ivshmem driver
     new 0f918c8d4d pci/ivshmem: Check drv isn't NULL before calling remove
     new bad1627759 driver/vhost: Check driver isn't NULL before calling remove
     new 347c2dae29 driver/virtio: Check driver isn't NULL before calling remove
     new 1e823a077c driver/vhost: vhost_register_device should set priv before inovking probe
     new f914bc8ef2 driver/vhost: Check driver is NULL before calling probe
     new 1195ec03f7 driver/vhost: Call metal_init in vhost_register_drivers

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 drivers/pci/pci_ivshmem.c            |  7 ++++--
 drivers/pci/pci_uio_ivshmem.c        |  6 -----
 drivers/rpmsg/rpmsg_virtio_ivshmem.c |  7 +++---
 drivers/vhost/vhost.c                | 46 ++++++++++++++++++------------------
 drivers/virtio/virtio.c              | 10 ++++----
 5 files changed, 36 insertions(+), 40 deletions(-)


(nuttx) 05/08: driver/virtio: Check driver isn't NULL before calling remove

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 347c2dae29a38492cfa704007667166cd3d8e27c
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:37:52 2024 +0800

    driver/virtio: Check driver isn't NULL before calling remove
    
    since the device mayn't bind to the driver yet
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/virtio/virtio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 2a77dcbe43..21508db483 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -364,12 +364,12 @@ int virtio_unregister_device(FAR struct virtio_device *device)
         container_of(node, struct virtio_device_item_s, node);
       if (item->device == device)
         {
-          /* Call driver remove and mark item->driver NULL to indicate
-           * the device unmatched
-           */
+          /* Call driver remove */
 
-          item->driver->remove(device);
-          item->driver = NULL;
+          if (item->driver)
+            {
+              item->driver->remove(device);
+            }
 
           /* Remove the device from the device list and free memory */
 


(nuttx) 06/08: driver/vhost: vhost_register_device should set priv before inovking probe

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 1e823a077ce6f8eb6474a395f3cd5eb364a4e104
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:24:11 2024 +0800

    driver/vhost: vhost_register_device should set priv before inovking probe
    
    align the behavior with vhost_register_driver
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/vhost/vhost.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 1d8a0d015b..1a97b5c0f2 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -297,6 +297,7 @@ int vhost_register_device(FAR struct vhost_device *device)
                * matched.
                */
 
+              device->priv = driver;
               if (driver->probe(device) >= 0)
                 {
                   item->driver = driver;


(nuttx) 03/08: pci/ivshmem: Check drv isn't NULL before calling remove

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 0f918c8d4d0391e0048f9d37855a09e92a78880b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:14:36 2024 +0800

    pci/ivshmem: Check drv isn't NULL before calling remove
    
    since the device mayn't bind to the driver yet
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/pci/pci_ivshmem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci_ivshmem.c b/drivers/pci/pci_ivshmem.c
index e3bd75c279..46bc3bfc14 100644
--- a/drivers/pci/pci_ivshmem.c
+++ b/drivers/pci/pci_ivshmem.c
@@ -187,8 +187,11 @@ static int ivshmem_unregister_device(FAR struct ivshmem_device_s *dev)
    * the device unmatched
    */
 
-  dev->drv->remove(dev);
-  dev->drv = NULL;
+  if (dev->drv)
+    {
+      dev->drv->remove(dev);
+    }
+
   return ret;
 }
 


(nuttx) 08/08: driver/vhost: Call metal_init in vhost_register_drivers

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 1195ec03f7d95b11bf77a000170b77d5276eefb8
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:43:05 2024 +0800

    driver/vhost: Call metal_init in vhost_register_drivers
    
    since libmetal come from OpenAMP need be initialized before working
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/vhost/vhost.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 52a55f6a64..9df624f95a 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -371,13 +371,20 @@ out:
 
 void vhost_register_drivers(void)
 {
+  struct metal_init_params params = METAL_INIT_DEFAULTS;
   int ret;
 
+  ret = metal_init(&params);
+  if (ret < 0)
+    {
+      vhosterr("metal_init failed, ret=%d\n", ret);
+    }
+
 #ifdef CONFIG_DRIVERS_VHOST_RNG
   ret = vhost_register_rng_driver();
   if (ret < 0)
     {
-      vrterr("vhost_register_rng_driver failed, ret=%d\n", ret);
+      vhosterr("vhost_register_rng_driver failed, ret=%d\n", ret);
     }
 #endif
 


(nuttx) 04/08: driver/vhost: Check driver isn't NULL before calling remove

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit bad1627759decc5fafb13a5886becf3bd6a6c6a1
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:30:43 2024 +0800

    driver/vhost: Check driver isn't NULL before calling remove
    
    since the device mayn't bind to the driver yet
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/vhost/vhost.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 05470ce6e7..1d8a0d015b 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -150,25 +150,6 @@ static void vhost_defered_probe_work(FAR void *arg)
   nxmutex_unlock(&g_vhost_bus.lock);
 }
 
-/****************************************************************************
- * Name: vhost_remove_device
- ****************************************************************************/
-
-static void vhost_remove_device(FAR struct vhost_device_item_s *item)
-{
-  /* Call driver remove and mark item->driver NULL to indicate
-   * the device unmatched.
-   */
-
-  item->driver->remove(item->device);
-  item->driver = NULL;
-
-  /* Remove the device from the device list and free memory */
-
-  list_delete(&item->node);
-  kmm_free(item);
-}
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -352,7 +333,17 @@ int vhost_unregister_device(FAR struct vhost_device *device)
     {
       if (item->device == device)
         {
-          vhost_remove_device(item);
+          /* Call driver remove */
+
+          if (item->driver)
+            {
+              item->driver->remove(item->device);
+            }
+
+          /* Remove the device from the device list and free memory */
+
+          list_delete(&item->node);
+          kmm_free(item);
           goto out;
         }
     }
@@ -362,7 +353,8 @@ int vhost_unregister_device(FAR struct vhost_device *device)
     {
       if (item->device == device)
         {
-          vhost_remove_device(item);
+          list_delete(&item->node);
+          kmm_free(item);
           goto out;
         }
     }


(nuttx) 01/08: pci/ivshmem: Skip unregistering ivshmem driver

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6685fb543456a04de3b87a895e8362cc6c468c43
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:17:04 2024 +0800

    pci/ivshmem: Skip unregistering ivshmem driver
    
    since ivshmem device may insert again
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/pci/pci_uio_ivshmem.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/pci/pci_uio_ivshmem.c b/drivers/pci/pci_uio_ivshmem.c
index 06fe49a040..54355f96d9 100644
--- a/drivers/pci/pci_uio_ivshmem.c
+++ b/drivers/pci/pci_uio_ivshmem.c
@@ -483,14 +483,9 @@ static int uio_ivshmem_probe(FAR struct ivshmem_device_s *dev)
   if (ret < 0)
     {
       pcierr("ERROR: Ivshmem register_driver failed, ret=%d\n", ret);
-      goto err;
     }
 
   return ret;
-
-err:
-  ivshmem_unregister_driver(&udev->drv);
-  return ret;
 }
 
 /****************************************************************************
@@ -503,7 +498,6 @@ static void uio_ivshmem_remove(FAR struct ivshmem_device_s *dev)
 
   unregister_driver(udev->name);
   ivshmem_detach_irq(dev);
-  kmm_free(udev);
 }
 
 /****************************************************************************


(nuttx) 02/08: rpmsg/ivshmem: Skip unregistering ivshmem driver

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2aaaa7632f25a27d17f23b44ffbe1d797de223b3
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:51:22 2024 +0800

    rpmsg/ivshmem: Skip unregistering ivshmem driver
    
    since ivshmem device may insert again
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/rpmsg/rpmsg_virtio_ivshmem.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/rpmsg/rpmsg_virtio_ivshmem.c b/drivers/rpmsg/rpmsg_virtio_ivshmem.c
index 7c7d19503c..e67d658b55 100644
--- a/drivers/rpmsg/rpmsg_virtio_ivshmem.c
+++ b/drivers/rpmsg/rpmsg_virtio_ivshmem.c
@@ -289,7 +289,7 @@ static int rpmsg_virtio_ivshmem_probe(FAR struct ivshmem_device_s *ivdev)
   ret = rpmsg_virtio_initialize(&priv->dev);
   if (ret < 0)
     {
-      pcierr("Rpmsg virtio intialize failed, ret=%d\n", ret);
+      rpmsgerr("Rpmsg virtio intialize failed, ret=%d\n", ret);
       goto err;
     }
 
@@ -299,14 +299,14 @@ static int rpmsg_virtio_ivshmem_probe(FAR struct ivshmem_device_s *ivdev)
                      rpmsg_virtio_ivshmem_wdog, (wdparm_t)priv);
       if (ret < 0)
         {
-          pcierr("ERROR: wd_start failed: %d\n", ret);
+          rpmsgerr("ERROR: wd_start failed: %d\n", ret);
+          goto err;
         }
     }
 
   return ret;
 
 err:
-  ivshmem_unregister_driver(&priv->drv);
   ivshmem_control_irq(ivdev, false);
   ivshmem_detach_irq(ivdev);
   return ret;
@@ -328,7 +328,6 @@ static void rpmsg_virtio_ivshmem_remove(FAR struct ivshmem_device_s *ivdev)
 
   ivshmem_control_irq(ivdev, false);
   ivshmem_detach_irq(ivdev);
-  kmm_free(priv);
 }
 
 /****************************************************************************


(nuttx) 07/08: driver/vhost: Check driver is NULL before calling probe

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f914bc8ef2cdb9ee75494a7c18baa16b63f78cfc
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 20:05:50 2024 +0800

    driver/vhost: Check driver is NULL before calling probe
    
    to avoid the same device bind to multiple drivers at the same time
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 1a97b5c0f2..52a55f6a64 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -181,7 +181,7 @@ int vhost_register_driver(FAR struct vhost_driver *driver)
   list_for_every_entry(&g_vhost_bus.device, item, struct vhost_device_item_s,
                        node)
     {
-      if (driver->device == item->device->id.device)
+      if (item->driver == NULL && driver->device == item->device->id.device)
         {
           /* If found the device in the device list, call driver probe,
            * if probe success, assign item->driver to indicate the device