[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] tests/vpci: fix unit tests after locking change



commit 801c4e72621d5541d249af1938a77466f0dcfe88
Author:     Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
AuthorDate: Tue Feb 27 18:02:01 2024 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Feb 27 18:02:01 2024 +0100

    tests/vpci: fix unit tests after locking change
    
    The recent vPCI locking broke the vPCI unit tests. Fix it to unblock CI.
    
    Fixes: 4f78438b45e2 ("vpci: use per-domain PCI lock to protect vpci 
structure")
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 tools/tests/vpci/emul.h | 9 ++++++++-
 tools/tests/vpci/main.c | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/tests/vpci/emul.h b/tools/tests/vpci/emul.h
index 3c2f66a18f..da446bba86 100644
--- a/tools/tests/vpci/emul.h
+++ b/tools/tests/vpci/emul.h
@@ -37,7 +37,10 @@
 
 #include "list.h"
 
+typedef bool rwlock_t;
+
 struct domain {
+    rwlock_t pci_lock;
 };
 
 struct pci_dev {
@@ -46,7 +49,7 @@ struct pci_dev {
 
 struct vcpu
 {
-    const struct domain *domain;
+    struct domain *domain;
 };
 
 extern const struct vcpu *current;
@@ -56,6 +59,10 @@ typedef bool spinlock_t;
 #define spin_lock_init(l) (*(l) = false)
 #define spin_lock(l) (*(l) = true)
 #define spin_unlock(l) (*(l) = false)
+#define read_lock(l) (*(l) = true)
+#define read_unlock(l) (*(l) = false)
+#define write_lock(l) (*(l) = true)
+#define write_unlock(l) (*(l) = false)
 
 typedef union {
     uint32_t sbdf;
diff --git a/tools/tests/vpci/main.c b/tools/tests/vpci/main.c
index 64d4552936..33223db3eb 100644
--- a/tools/tests/vpci/main.c
+++ b/tools/tests/vpci/main.c
@@ -21,7 +21,7 @@
 /* Single vcpu (current), and single domain with a single PCI device. */
 static struct vpci vpci;
 
-const static struct domain d;
+static struct domain d;
 
 const struct pci_dev test_pdev = {
     .vpci = &vpci,
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.