All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stewart Hildebrand <stewart.hildebrand@amd.com>
To: <xen-devel@lists.xenproject.org>
Cc: "Stewart Hildebrand" <stewart.hildebrand@amd.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"Anthony PERARD" <anthony.perard@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>
Subject: [PATCH] tests/vpci: fix unit tests after locking change
Date: Tue, 27 Feb 2024 09:57:43 -0500	[thread overview]
Message-ID: <20240227145745.1114780-1-stewart.hildebrand@amd.com> (raw)

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@citrix.com>
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
---
 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 3c2f66a18f13..da446bba86b4 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 64d4552936c7..33223db3eb77 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,

base-commit: 576528a2a742069af203e90c613c5c93e23c9755
-- 
2.43.2



             reply	other threads:[~2024-02-27 14:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 14:57 Stewart Hildebrand [this message]
2024-02-27 16:24 ` [PATCH] tests/vpci: fix unit tests after locking change Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240227145745.1114780-1-stewart.hildebrand@amd.com \
    --to=stewart.hildebrand@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.