From: Jan Kiszka <[email protected]>

It's highly unlikely that we will meet an arch that needs a non-zero
init value for its spinlocks or has any other use case for this
abstraction. So remove it.

Signed-off-by: Jan Kiszka <[email protected]>
---
 Documentation/Doxyfile                       | 1 -
 hypervisor/arch/arm-common/irqchip.c         | 2 +-
 hypervisor/arch/arm/include/asm/spinlock.h   | 1 -
 hypervisor/arch/arm/mmu_hyp.c                | 2 +-
 hypervisor/arch/arm64/include/asm/spinlock.h | 1 -
 hypervisor/arch/x86/include/asm/spinlock.h   | 2 --
 hypervisor/arch/x86/pci.c                    | 2 +-
 hypervisor/arch/x86/vtd.c                    | 2 +-
 hypervisor/control.c                         | 2 +-
 hypervisor/printk.c                          | 2 +-
 hypervisor/setup.c                           | 2 +-
 11 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/Documentation/Doxyfile b/Documentation/Doxyfile
index 7398fb9f..d7e76859 100644
--- a/Documentation/Doxyfile
+++ b/Documentation/Doxyfile
@@ -264,7 +264,6 @@ INCLUDE_FILE_PATTERNS  =
 PREDEFINED             = \
        DOXYGEN_CPP \
        __attribute__(x)= \
-       DEFINE_SPINLOCK(s)="spinlock_t s" \
        DEFINE_MMIO_READ(s)="static inline u##s mmio_read##s(void *address);" \
        DEFINE_MMIO_WRITE(s)="static inline void mmio_write##s(void *address, 
u##s value);"
 EXPAND_AS_DEFINED      = COMM_REGION_GENERIC_HEADER
diff --git a/hypervisor/arch/arm-common/irqchip.c 
b/hypervisor/arch/arm-common/irqchip.c
index d0bd50c6..6b6f7332 100644
--- a/hypervisor/arch/arm-common/irqchip.c
+++ b/hypervisor/arch/arm-common/irqchip.c
@@ -29,7 +29,7 @@
             (counter) < (config)->num_irqchips;                        \
             (chip)++, (counter)++)

-DEFINE_SPINLOCK(dist_lock);
+spinlock_t dist_lock;

 void *gicd_base;

diff --git a/hypervisor/arch/arm/include/asm/spinlock.h 
b/hypervisor/arch/arm/include/asm/spinlock.h
index a1e9a271..7fe841d0 100644
--- a/hypervisor/arch/arm/include/asm/spinlock.h
+++ b/hypervisor/arch/arm/include/asm/spinlock.h
@@ -18,7 +18,6 @@

 #ifndef __ASSEMBLY__

-#define DEFINE_SPINLOCK(name)  spinlock_t (name)
 #define TICKET_SHIFT           16

 typedef struct {
diff --git a/hypervisor/arch/arm/mmu_hyp.c b/hypervisor/arch/arm/mmu_hyp.c
index 16f9b5ae..1fcebef5 100644
--- a/hypervisor/arch/arm/mmu_hyp.c
+++ b/hypervisor/arch/arm/mmu_hyp.c
@@ -330,7 +330,7 @@ int switch_exception_level(struct per_cpu *cpu_data)

 void __attribute__((noreturn)) arch_shutdown_mmu(struct per_cpu *cpu_data)
 {
-       static DEFINE_SPINLOCK(map_lock);
+       static spinlock_t map_lock;

        virt2phys_t virt2phys = paging_hvirt2phys;
        unsigned long stack_phys = virt2phys(cpu_data->stack);
diff --git a/hypervisor/arch/arm64/include/asm/spinlock.h 
b/hypervisor/arch/arm64/include/asm/spinlock.h
index ac7063b7..1d05174b 100644
--- a/hypervisor/arch/arm64/include/asm/spinlock.h
+++ b/hypervisor/arch/arm64/include/asm/spinlock.h
@@ -21,7 +21,6 @@

 #include <jailhouse/types.h>

-#define DEFINE_SPINLOCK(name)  spinlock_t (name)
 #define TICKET_SHIFT   16

 /* TODO: fix this if we add support for BE */
diff --git a/hypervisor/arch/x86/include/asm/spinlock.h 
b/hypervisor/arch/x86/include/asm/spinlock.h
index 8ca5638f..ef884246 100644
--- a/hypervisor/arch/x86/include/asm/spinlock.h
+++ b/hypervisor/arch/x86/include/asm/spinlock.h
@@ -23,8 +23,6 @@ typedef struct {
        u16 owner, next;
 } spinlock_t;

-#define DEFINE_SPINLOCK(name)  spinlock_t (name)
-
 static inline void spin_lock(spinlock_t *lock)
 {
        register spinlock_t inc = { .next = 1 };
diff --git a/hypervisor/arch/x86/pci.c b/hypervisor/arch/x86/pci.c
index fdd27d19..f03e6a1b 100644
--- a/hypervisor/arch/x86/pci.c
+++ b/hypervisor/arch/x86/pci.c
@@ -23,7 +23,7 @@
 #include <asm/processor.h>

 /** Protects the root bridge's PIO interface to the PCI config space. */
-static DEFINE_SPINLOCK(pci_lock);
+static spinlock_t pci_lock;

 u32 arch_pci_read_config(u16 bdf, u16 address, unsigned int size)
 {
diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c
index c845fa94..d33d429e 100644
--- a/hypervisor/arch/x86/vtd.c
+++ b/hypervisor/arch/x86/vtd.c
@@ -201,7 +201,7 @@ static void *unit_inv_queue;
 static unsigned int dmar_units;
 static unsigned int dmar_pt_levels;
 static unsigned int dmar_num_did = ~0U;
-static DEFINE_SPINLOCK(inv_queue_lock);
+static spinlock_t inv_queue_lock;
 static struct vtd_emulation root_cell_units[JAILHOUSE_MAX_IOMMU_UNITS];
 static bool dmar_units_initialized;

diff --git a/hypervisor/control.c b/hypervisor/control.c
index 2ab6beac..c1a4edff 100644
--- a/hypervisor/control.c
+++ b/hypervisor/control.c
@@ -32,7 +32,7 @@ struct jailhouse_system *system_config;
 /** State structure of the root cell. @ingroup Control */
 struct cell root_cell;

-static DEFINE_SPINLOCK(shutdown_lock);
+static spinlock_t shutdown_lock;
 static unsigned int num_cells = 1;

 volatile unsigned long panic_in_progress;
diff --git a/hypervisor/printk.c b/hypervisor/printk.c
index c3241777..4b001970 100644
--- a/hypervisor/printk.c
+++ b/hypervisor/printk.c
@@ -22,7 +22,7 @@ bool virtual_console = false;
 volatile struct jailhouse_virt_console console
        __attribute__((section(".console")));

-static DEFINE_SPINLOCK(printk_lock);
+static spinlock_t printk_lock;

 static void console_write(const char *msg)
 {
diff --git a/hypervisor/setup.c b/hypervisor/setup.c
index e761415a..9f651aec 100644
--- a/hypervisor/setup.c
+++ b/hypervisor/setup.c
@@ -26,7 +26,7 @@ extern u8 __text_start[], __page_pool[];

 static const __attribute__((aligned(PAGE_SIZE))) u8 empty_page[PAGE_SIZE];

-static DEFINE_SPINLOCK(init_lock);
+static spinlock_t init_lock;
 static unsigned int master_cpu_id = -1;
 static volatile unsigned int entered_cpus, initialized_cpus;
 static volatile int error;
--
2.16.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/fb099cc16bdc03fc20a0b7f41bb88d998f63745b.1581770164.git.jan.kiszka%40web.de.

Reply via email to