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

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

commit 2e60fb6648c039defbbe04c33ada076172e4bf73
Author: Bowen Wang <[email protected]>
AuthorDate: Thu Nov 6 16:49:17 2025 +0800

    drivers/virtio/virtio-pci: keep the PCI driver per CPU in BMP mode
    
    With the PCI core per CPU in BMP mode, each CPU registers its own copy
    of the virtio-pci driver, whose list node must not be shared.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/virtio/virtio-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio-pci.c b/drivers/virtio/virtio-pci.c
index 38a4d593f89..92c8896345d 100644
--- a/drivers/virtio/virtio-pci.c
+++ b/drivers/virtio/virtio-pci.c
@@ -33,6 +33,7 @@
 
 #include <nuttx/clock.h>
 #include <nuttx/kmalloc.h>
+#include <nuttx/percpu.h>
 #include <nuttx/virtio/virtio-pci.h>
 
 #include "virtio-pci.h"
@@ -70,12 +71,13 @@ static const struct pci_device_id_s g_virtio_pci_id_table[] 
=
   { 0, }
 };
 
-static struct pci_driver_s g_virtio_pci_drv =
+static DEFINE_PER_CPU_BMP(struct pci_driver_s, g_virtio_pci_drv) =
 {
   g_virtio_pci_id_table,
   virtio_pci_probe,
   virtio_pci_remove
 };
+#define g_virtio_pci_drv this_cpu_var_bmp(g_virtio_pci_drv)
 
 static const struct virtio_memory_ops g_virtio_pci_mmops =
 {

Reply via email to