From 4d6081e790b308629e7ebec000b7d44a46f05959 Mon Sep 17 00:00:00 2001 From: Miguel Silva Date: Wed, 24 Jul 2024 14:31:37 +0100 Subject: [PATCH] fix(inline): Fix inline functions Both MISRA and clang compiler force inline functions to be static. Functions that are used in multiple sources stop being inline because they cannot be static. The other inline functions become static and their prototype is removed from the header Signed-off-by: Miguel Silva --- src/arch/armv8/armv8-a/inc/arch/smmuv2.h | 4 ---- src/arch/armv8/armv8-a/iommu.c | 2 +- src/arch/armv8/armv8-a/smmuv2.c | 8 ++++---- src/arch/armv8/interrupts.c | 2 +- src/arch/armv8/vgic.c | 2 +- src/arch/riscv/interrupts.c | 2 +- src/arch/riscv/iommu.c | 2 +- src/core/interrupts.c | 10 +++++----- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/arch/armv8/armv8-a/inc/arch/smmuv2.h b/src/arch/armv8/armv8-a/inc/arch/smmuv2.h index 6f158a002..cf96bb595 100644 --- a/src/arch/armv8/armv8-a/inc/arch/smmuv2.h +++ b/src/arch/armv8/armv8-a/inc/arch/smmuv2.h @@ -380,10 +380,6 @@ ssize_t smmu_alloc_sme(void); void smmu_write_ctxbnk(size_t ctx_id, paddr_t root_pt, asid_t vm_id); void smmu_write_sme(size_t sme, streamid_t mask, streamid_t id, bool group); void smmu_write_s2c(size_t sme, size_t ctx_id); -size_t smmu_sme_get_ctx(size_t sme); -streamid_t smmu_sme_get_id(size_t sme); -streamid_t smmu_sme_get_mask(size_t sme); -bool smmu_sme_is_group(size_t sme); bool smmu_compatible_sme_exists(streamid_t mask, streamid_t id, size_t ctx, bool group); #endif diff --git a/src/arch/armv8/armv8-a/iommu.c b/src/arch/armv8/armv8-a/iommu.c index 5c89fdc07..f92732239 100644 --- a/src/arch/armv8/armv8-a/iommu.c +++ b/src/arch/armv8/armv8-a/iommu.c @@ -64,7 +64,7 @@ static bool iommu_vm_arch_add(struct vm* vm, streamid_t mask, streamid_t id) return true; } -inline bool iommu_arch_vm_add_device(struct vm* vm, streamid_t id) +bool iommu_arch_vm_add_device(struct vm* vm, streamid_t id) { return iommu_vm_arch_add(vm, 0, id); } diff --git a/src/arch/armv8/armv8-a/smmuv2.c b/src/arch/armv8/armv8-a/smmuv2.c index e942577f8..9e6734d6c 100644 --- a/src/arch/armv8/armv8-a/smmuv2.c +++ b/src/arch/armv8/armv8-a/smmuv2.c @@ -52,22 +52,22 @@ struct smmu_priv smmu; /** * Accessors inline functions. */ -inline bool smmu_sme_is_group(size_t sme) +static inline bool smmu_sme_is_group(size_t sme) { return bitmap_get(smmu.grp_bitmap, sme); } -inline size_t smmu_sme_get_ctx(size_t sme) +static inline size_t smmu_sme_get_ctx(size_t sme) { return S2CR_CBNDX(smmu.hw.glbl_rs0->S2CR[sme]); } -inline streamid_t smmu_sme_get_id(size_t sme) +static inline streamid_t smmu_sme_get_id(size_t sme) { return SMMU_SMR_ID(smmu.hw.glbl_rs0->SMR[sme]); } -inline streamid_t smmu_sme_get_mask(size_t sme) +static inline streamid_t smmu_sme_get_mask(size_t sme) { return SMMU_SMR_MASK(smmu.hw.glbl_rs0->SMR[sme]); } diff --git a/src/arch/armv8/interrupts.c b/src/arch/armv8/interrupts.c index 049e741f0..9d332e321 100644 --- a/src/arch/armv8/interrupts.c +++ b/src/arch/armv8/interrupts.c @@ -46,7 +46,7 @@ bool interrupts_arch_check(irqid_t int_id) return gic_get_pend(int_id); } -inline bool interrupts_arch_conflict(bitmap_t* interrupt_bitmap, irqid_t int_id) +bool interrupts_arch_conflict(bitmap_t* interrupt_bitmap, irqid_t int_id) { return (bitmap_get(interrupt_bitmap, int_id) && int_id > GIC_CPU_PRIV); } diff --git a/src/arch/armv8/vgic.c b/src/arch/armv8/vgic.c index 3f362da1a..deeb97da8 100644 --- a/src/arch/armv8/vgic.c +++ b/src/arch/armv8/vgic.c @@ -44,7 +44,7 @@ extern volatile const size_t VGIC_IPI_ID; void vgic_ipi_handler(uint32_t event, uint64_t data); CPU_MSG_HANDLER(vgic_ipi_handler, VGIC_IPI_ID) -inline struct vgic_int* vgic_get_int(struct vcpu* vcpu, irqid_t int_id, vcpuid_t vgicr_id) +struct vgic_int* vgic_get_int(struct vcpu* vcpu, irqid_t int_id, vcpuid_t vgicr_id) { if (int_id < GIC_CPU_PRIV) { struct vcpu* target_vcpu = vgicr_id == vcpu->id ? vcpu : vm_get_vcpu(vcpu->vm, vgicr_id); diff --git a/src/arch/riscv/interrupts.c b/src/arch/riscv/interrupts.c index 05bab96d8..05bf7ad30 100644 --- a/src/arch/riscv/interrupts.c +++ b/src/arch/riscv/interrupts.c @@ -119,7 +119,7 @@ void interrupts_arch_clear(irqid_t int_id) } } -inline bool interrupts_arch_conflict(bitmap_t* interrupt_bitmap, irqid_t int_id) +bool interrupts_arch_conflict(bitmap_t* interrupt_bitmap, irqid_t int_id) { return bitmap_get(interrupt_bitmap, int_id); } diff --git a/src/arch/riscv/iommu.c b/src/arch/riscv/iommu.c index 65b62f600..2b77d93dc 100644 --- a/src/arch/riscv/iommu.c +++ b/src/arch/riscv/iommu.c @@ -426,7 +426,7 @@ static bool iommu_vm_arch_add(struct vm* vm, deviceid_t dev_id) * * @returns true on success, false on error. */ -inline bool iommu_arch_vm_add_device(struct vm* vm, deviceid_t dev_id) +bool iommu_arch_vm_add_device(struct vm* vm, deviceid_t dev_id) { return iommu_vm_arch_add(vm, dev_id); } diff --git a/src/core/interrupts.c b/src/core/interrupts.c index 336cacc27..3ee9e972b 100644 --- a/src/core/interrupts.c +++ b/src/core/interrupts.c @@ -16,27 +16,27 @@ spinlock_t irq_reserve_lock = SPINLOCK_INITVAL; irq_handler_t interrupt_handlers[MAX_INTERRUPTS]; -inline void interrupts_cpu_sendipi(cpuid_t target_cpu, irqid_t ipi_id) +void interrupts_cpu_sendipi(cpuid_t target_cpu, irqid_t ipi_id) { interrupts_arch_ipi_send(target_cpu, ipi_id); } -inline void interrupts_cpu_enable(irqid_t int_id, bool en) +void interrupts_cpu_enable(irqid_t int_id, bool en) { interrupts_arch_enable(int_id, en); } -inline bool interrupts_check(irqid_t int_id) +bool interrupts_check(irqid_t int_id) { return interrupts_arch_check(int_id); } -inline void interrupts_clear(irqid_t int_id) +void interrupts_clear(irqid_t int_id) { interrupts_arch_clear(int_id); } -inline void interrupts_init(void) +void interrupts_init(void) { interrupts_arch_init();