git: 40ad9aaa880c - main - xen/intr: stop passing shared_info_t to xen_intr_active_ports()

From: Roger Pau Monné <royger_at_FreeBSD.org>
Date: Wed, 29 Mar 2023 07:52:32 UTC
The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/src/commit/?id=40ad9aaa880c7eefa3c16786beb19320afdc8903

commit 40ad9aaa880c7eefa3c16786beb19320afdc8903
Author:     Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2022-02-23 16:47:18 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2023-03-29 07:51:43 +0000

    xen/intr: stop passing shared_info_t to xen_intr_active_ports()
    
    There is only a single global HYPERVISOR_shared_info pointer, so
    directly use the global pointer.
    
    Reviewed by: royger
    MFC after: 1 week
---
 sys/x86/xen/xen_intr.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c
index 8d5562e21018..129252044da9 100644
--- a/sys/x86/xen/xen_intr.c
+++ b/sys/x86/xen/xen_intr.c
@@ -485,9 +485,10 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port,
  *           events.
  */
 static inline u_long
-xen_intr_active_ports(struct xen_intr_pcpu_data *pcpu, shared_info_t *sh,
-    u_int idx)
+xen_intr_active_ports(const struct xen_intr_pcpu_data *const pcpu,
+    const u_int idx)
 {
+	volatile const shared_info_t *const sh = HYPERVISOR_shared_info;
 
 	CTASSERT(sizeof(sh->evtchn_mask[0]) == sizeof(sh->evtchn_pending[0]));
 	CTASSERT(sizeof(sh->evtchn_mask[0]) == sizeof(pcpu->evtchn_enabled[0]));
@@ -509,7 +510,6 @@ xen_intr_handle_upcall(struct trapframe *trap_frame)
 	u_int l1i, l2i, port, cpu __diagused;
 	u_long masked_l1, masked_l2;
 	struct xenisrc *isrc;
-	shared_info_t *s;
 	vcpu_info_t *v;
 	struct xen_intr_pcpu_data *pc;
 	u_long l1, l2;
@@ -522,7 +522,6 @@ xen_intr_handle_upcall(struct trapframe *trap_frame)
 
 	cpu = PCPU_GET(cpuid);
 	pc  = DPCPU_PTR(xen_intr_pcpu);
-	s   = HYPERVISOR_shared_info;
 	v   = DPCPU_GET(vcpu_info);
 
 	if (!xen_has_percpu_evtchn()) {
@@ -560,7 +559,7 @@ xen_intr_handle_upcall(struct trapframe *trap_frame)
 		l1i = ffsl(masked_l1) - 1;
 
 		do {
-			l2 = xen_intr_active_ports(pc, s, l1i);
+			l2 = xen_intr_active_ports(pc, l1i);
 
 			l2i = (l2i + 1) % LONG_BIT;
 			masked_l2 = l2 & ((~0UL) << l2i);
@@ -596,7 +595,7 @@ xen_intr_handle_upcall(struct trapframe *trap_frame)
 
 		} while (l2i != LONG_BIT - 1);
 
-		l2 = xen_intr_active_ports(pc, s, l1i);
+		l2 = xen_intr_active_ports(pc, l1i);
 		if (l2 == 0) {
 			/*
 			 * We handled all ports, so we can clear the