diff mbox series

[4/8] xen/evtchn: modify evtchn_bind_interdomain to pass domain as argument

Message ID 037b30aa5186cff516f8acf17a3a465663a8194a.1655903088.git.rahul.singh@arm.com (mailing list archive)
State Superseded
Headers show
Series xen/evtchn: implement static event channel signaling | expand

Commit Message

Rahul Singh June 22, 2022, 2:38 p.m. UTC
evtchn_bind_interdomain() finds the local domain from "current->domain"
pointer.

evtchn_bind_interdomain() will be called from the XEN to support static
event channel during domain creation. "current" pointer is not valid at
that time, therefore modify the evtchn_bind_interdomain() to pass
domain as an argument.

Signed-off-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/common/event_channel.c | 6 +++---
 xen/include/xen/event.h    | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Jan Beulich July 5, 2022, 3:13 p.m. UTC | #1
On 22.06.2022 16:38, Rahul Singh wrote:
> evtchn_bind_interdomain() finds the local domain from "current->domain"
> pointer.
> 
> evtchn_bind_interdomain() will be called from the XEN to support static
> event channel during domain creation. "current" pointer is not valid at
> that time, therefore modify the evtchn_bind_interdomain() to pass
> domain as an argument.
> 
> Signed-off-by: Rahul Singh <rahul.singh@arm.com>

I think this wants folding with the previous patch.

Jan
Rahul Singh July 6, 2022, 11:54 a.m. UTC | #2
Hi Jan,

> On 5 Jul 2022, at 4:13 pm, Jan Beulich <jbeulich@suse.com> wrote:
> 
> On 22.06.2022 16:38, Rahul Singh wrote:
>> evtchn_bind_interdomain() finds the local domain from "current->domain"
>> pointer.
>> 
>> evtchn_bind_interdomain() will be called from the XEN to support static
>> event channel during domain creation. "current" pointer is not valid at
>> that time, therefore modify the evtchn_bind_interdomain() to pass
>> domain as an argument.
>> 
>> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
> 
> I think this wants folding with the previous patch.

Ack.

Regards,
Rahul
diff mbox series

Patch

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index bf5dc2c8ad..84f0055a5a 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -367,11 +367,11 @@  static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn)
  * If lport is zero get the next free port and allocate. If port is non-zero
  * allocate the specified lport.
  */
-int evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind,
+int evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind, struct domain *ld,
                             evtchn_port_t lport)
 {
     struct evtchn *lchn, *rchn;
-    struct domain *ld = current->domain, *rd;
+    struct domain *rd;
     int            rc;
     evtchn_port_t  rport = bind->remote_port;
     domid_t        rdom = bind->remote_dom;
@@ -1248,7 +1248,7 @@  long cf_check do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         struct evtchn_bind_interdomain bind_interdomain;
         if ( copy_from_guest(&bind_interdomain, arg, 1) != 0 )
             return -EFAULT;
-        rc = evtchn_bind_interdomain(&bind_interdomain, 0);
+        rc = evtchn_bind_interdomain(&bind_interdomain, current->domain, 0);
         if ( !rc && __copy_to_guest(arg, &bind_interdomain, 1) )
             rc = -EFAULT; /* Cleaning up here would be a mess! */
         break;
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 6e26879793..8eae9984a9 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -77,6 +77,7 @@  int __must_check evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc,
 
 /* Bind an event channel port to interdomain */
 int __must_check evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind,
+                                         struct domain *ld,
                                          evtchn_port_t port);
 
 /* Unmask a local event-channel port. */