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

[xen master] xen/evtchn: fully restrict concept of pIRQ for arches with pIRQ support only



commit 341f271cf86fd6f0e8db0e87c5e798a2ad57870f
Author:     Grygorii Strashko <grygorii_strashko@xxxxxxxx>
AuthorDate: Thu Jul 31 13:45:37 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jul 31 14:44:02 2025 +0200

    xen/evtchn: fully restrict concept of pIRQ for arches with pIRQ support only
    
    On platforms without PIRQ support evtchn_move_pirqs()/send_guest_pirq()
    functions are unreachable (Misra rule 2.1).
    
    Move these function under CONFIG_HAS_PIRQ ifdefs to fix Misra rule 2.1
    violation and resolve call of evtchn_move_pirqs() from common /sched/core.c
    vcpu_move_irqs() code by moving evtchn_move_pirqs() into x86
    arch_move_irqs() callback (which is converted to define).
    
    Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Juergen Gross <jgross@xxxxxxxx> # xen/sched
---
 xen/arch/x86/include/asm/irq.h | 2 +-
 xen/common/event_channel.c     | 6 ++++--
 xen/common/sched/core.c        | 1 -
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 3c73073b71..8c81f66434 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -224,7 +224,7 @@ void cleanup_domain_irq_mapping(struct domain *d);
 
 bool cpu_has_pending_apic_eoi(void);
 
-static inline void arch_move_irqs(struct vcpu *v) { }
+#define arch_move_irqs(v) evtchn_move_pirqs(v)
 
 struct msi_info;
 int allocate_and_map_gsi_pirq(struct domain *d, int index, int *pirq_p);
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c8c1bfa615..67700b050a 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -970,6 +970,7 @@ void send_guest_domain_virq(struct domain *d, uint32_t virq)
     read_unlock_irqrestore(&v->virq_lock, flags);
 }
 
+#ifdef CONFIG_HAS_PIRQ
 void send_guest_pirq(struct domain *d, const struct pirq *pirq)
 {
     int port;
@@ -994,6 +995,7 @@ void send_guest_pirq(struct domain *d, const struct pirq 
*pirq)
         evtchn_read_unlock(chn);
     }
 }
+#endif /* CONFIG_HAS_PIRQ */
 
 static DEFINE_SPINLOCK(global_virq_handlers_lock);
 
@@ -1706,7 +1708,7 @@ void evtchn_destroy_final(struct domain *d)
 #endif
 }
 
-
+#ifdef CONFIG_HAS_PIRQ
 void evtchn_move_pirqs(struct vcpu *v)
 {
     struct domain *d = v->domain;
@@ -1722,7 +1724,7 @@ void evtchn_move_pirqs(struct vcpu *v)
     }
     read_unlock(&d->event_lock);
 }
-
+#endif /* CONFIG_HAS_PIRQ */
 
 static void domain_dump_evtchn_info(struct domain *d)
 {
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index ea95dea65a..f5a1099ba9 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -642,7 +642,6 @@ int sched_init_vcpu(struct vcpu *v)
 static void vcpu_move_irqs(struct vcpu *v)
 {
     arch_move_irqs(v);
-    evtchn_move_pirqs(v);
 }
 
 static void sched_move_irqs(const struct sched_unit *unit)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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