xen: Fix event channel interface for XenDevice-s
PATCH 1/1 xen: Fix event channel interface for XenDevice-s
Patch "xen: add event channel interface for XenDevice-s" makes use of the type xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the function xen_device_bind_event_channel assign the return value of xenevtchn_bind_interdomain to channel->local_port but check the result for error with xendev->local_port.
Fix by:
- removing local_port from struct XenDevice as it isn't use anywere.
- adding a compatibility typedef for xenevtchn_port_or_error_t for Xen 4.6 and earlier.
As extra, replace the type of XenEventChannel->local_port by evtchn_port_t.
--- hw/xen/xen-bus.c | 12 +++++++----- include/hw/xen/xen-bus.h | 1 - include/hw/xen/xen_common.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-)
hw/xen/xen-bus.c +7 -5
@@ -917,7 +917,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain, }struct XenEventChannel { -unsigned int local_port; +evtchn_port_t local_port;XenEventHandler handler;void *opaque;Notifier notifier;
@@ -939,17 +939,19 @@ XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev, void *opaque, Error **errp) { XenEventChannel *channel = g_new0(XenEventChannel, 1); +xenevtchn_port_or_error_t local_port; - channel->local_port =xenevtchn_bind_interdomain (xendev->xeh, - xendev->frontend_id, - port); -if (xendev->local_port <0 ) { + local_port =xenevtchn_bind_interdomain (xendev->xeh, + xendev->frontend_id, + port); +if (local_port <0 ) {error_setg_errno (errp, errno,"xenevtchn_bind_interdomain failed" );g_free (channel);return NULL ; } + channel->local_port = local_port; channel->handler = handler; channel->opaque = opaque; channel->notifier.notify = event_notify;
include/hw/xen/xen-bus.h +0 -1
@@ -29,7 +29,6 @@ typedef struct XenDevice {xengnttab_handle *xgth;bool feature_grant_copy;xenevtchn_handle *xeh; -xenevtchn_port_or_error_t local_port;NotifierList event_notifiers; } XenDevice;
include/hw/xen/xen_common.h +1 -0
@@ -32,6 +32,7 @@ extern xc_interface *xen_xc;typedef xc_interface xenforeignmemory_handle ;typedef xc_evtchn xenevtchn_handle ;typedef xc_gnttab xengnttab_handle ; +typedef evtchn_port_or_error_t xenevtchn_port_or_error_t ;#define xenevtchn_open (l, f) xc_evtchn_open(l, f);#define xenevtchn_close (h) xc_evtchn_close(h)
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Anthony PERARD
Patch "xen: add event channel interface for XenDevice-s" makes use of the type
xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the functionxen_device_bind_event_channelassign the return value ofxenevtchn_bind_interdomaintochannel->local_portbut check the result for error withxendev->local_port.Fix by:
- removinglocal_portfrom struct XenDevice as it isn't use anywere.
- adding a compatibility typedef forxenevtchn_port_or_error_tfor Xen 4.6 and earlier.
Quoted 4 lines
As extra, replace the type of
XenEventChannel->local_portbyevtchn_port_t.Signed-off-by Anthony PERARD <[email protected]>
Notes:
This patch fix "xen: add event channel interface for XenDevice-s" that isn't commited yet, of the patch series "Xen PV backend 'qdevification'".
Signature · 1 line
Anthony PERARD
Quoted 13 lines · Anthony PERARD
Quoted 11 lines · Anthony PERARD
Patch "xen: add event channel interface for XenDevice-s" makes use of the type
xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the functionxen_device_bind_event_channelassign the return value ofxenevtchn_bind_interdomaintochannel->local_portbut check the result for error withxendev->local_port.Fix by:
- removinglocal_portfrom struct XenDevice as it isn't use anywere.
- adding a compatibility typedef forxenevtchn_port_or_error_tfor Xen 4.6 and earlier.
Quoted 8 lines
Quoted 4 lines
As extra, replace the type of
XenEventChannel->local_portbyevtchn_port_t.Signed-off-by Anthony PERARD <[email protected]>Notes:
This patch fix "xen: add event channel interface for XenDevice-s" that isn't commited yet, of the patch series "Xen PV backend 'qdevification'".
Thanks for the fix. I assume you're going to squash it into the appropriate patch in that pullrequest ?
thanks
-- PMM
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 17 lines · Peter Maydell
Quoted 16 lines · Anthony PERARD
Quoted 14 lines · Anthony PERARD
Patch "xen: add event channel interface for XenDevice-s" makes use of the type
xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the functionxen_device_bind_event_channelassign the return value ofxenevtchn_bind_interdomaintochannel->local_portbut check the result for error withxendev->local_port.Fix by:
- removinglocal_portfrom struct XenDevice as it isn't use anywere.
- adding a compatibility typedef forxenevtchn_port_or_error_tfor Xen 4.6 and earlier.As extra, replace the type of
XenEventChannel->local_portbyevtchn_port_t.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Anthony PERARD <[email protected]>Notes:
This patch fix "xen: add event channel interface for XenDevice-s" that isn't commited yet, of the patch series "Xen PV backend 'qdevification'".Thanks for the fix. I assume you're going to squash it into the appropriate patch in that pullrequest ?
Yes, it's a good idea to squash it. I'll resubmit the pullreq shortly.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 20 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 11 January 2019 18:10
To: [email protected]
Cc: Anthony Perard <[email protected]>; Stefano Stabellini <[email protected]>; Paul Durrant <[email protected]>; open list:X86 <[email protected]>
Subject: [PATCH] xen: Fix event channel interface for XenDevice-sPatch "xen: add event channel interface for XenDevice-s" makes use of the type
xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the functionxen_device_bind_event_channelassign the return value ofxenevtchn_bind_interdomaintochannel->local_portbut check the result for error withxendev->local_port.Fix by:
- removinglocal_portfrom struct XenDevice as it isn't use anywere.
- adding a compatibility typedef forxenevtchn_port_or_error_tfor Xen 4.6 and earlier.
Quoted 4 lines
As extra, replace the type of
XenEventChannel->local_portbyevtchn_port_t.Signed-off-by Anthony PERARD <[email protected]>
Quoted 72 lines
--- hw/xen/xen-bus.c | 12 +++++++----- include/hw/xen/xen-bus.h | 1 - include/hw/xen/xen_common.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-)hw/xen/xen-bus.c +1
-1@@ -917,7 +917,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain, }struct XenEventChannel { -unsigned int local_port; +evtchn_port_t local_port;XenEventHandler handler;void *opaque;Notifier notifier;hw/xen/xen-bus.c +6
-4@@ -939,17 +939,19 @@ XenEventChannel *xen_device_bind_event_channel (XenDevice *xendev, void *opaque, Error **errp) {XenEventChannel *channel =g_new0 (XenEventChannel,1 ); +xenevtchn_port_or_error_t local_port; - channel->local_port =xenevtchn_bind_interdomain (xendev->xeh, - xendev->frontend_id, - port); -if (xendev->local_port <0 ) { + local_port =xenevtchn_bind_interdomain (xendev->xeh, + xendev->frontend_id, + port); +if (local_port <0 ) {error_setg_errno (errp, errno,"xenevtchn_bind_interdomain failed");g_free (channel);return NULL ; } + channel->local_port = local_port;channel->handler = handler; channel->opaque = opaque; channel->notifier.notify = event_notify;include/hw/xen/xen-bus.h +0
-1@@ -29,7 +29,6 @@ typedef struct XenDevice {xengnttab_handle *xgth;bool feature_grant_copy;xenevtchn_handle *xeh; -xenevtchn_port_or_error_t local_port;NotifierList event_notifiers; } XenDevice;include/hw/xen/xen_common.h +1
-1@@ -32,6 +32,7 @@ extern xc_interface *xen_xc;typedef xc_interface xenforeignmemory_handle ;typedef xc_evtchn xenevtchn_handle ;typedef xc_gnttab xengnttab_handle ; +typedef evtchn_port_or_error_t xenevtchn_port_or_error_t ;#define xenevtchn_open (l, f) xc_evtchn_open(l, f);#define xenevtchn_close (h) xc_evtchn_close(h) --
Quoted 1 line
Anthony PERARD
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 20 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 11 January 2019 18:10
To: [email protected]
Cc: Anthony Perard <[email protected]>; Stefano Stabellini <[email protected]>; Paul Durrant <[email protected]>; open list:X86 <[email protected]>
Subject: [PATCH] xen: Fix event channel interface for XenDevice-sPatch "xen: add event channel interface for XenDevice-s" makes use of the type
xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the functionxen_device_bind_event_channelassign the return value ofxenevtchn_bind_interdomaintochannel->local_portbut check the result for error withxendev->local_port.Fix by:
- removinglocal_portfrom struct XenDevice as it isn't use anywere.
- adding a compatibility typedef forxenevtchn_port_or_error_tfor Xen 4.6 and earlier.
Quoted 4 lines
As extra, replace the type of
XenEventChannel->local_portbyevtchn_port_t.Signed-off-by Anthony PERARD <[email protected]>
Quoted 73 lines
--- hw/xen/xen-bus.c | 12 +++++++----- include/hw/xen/xen-bus.h | 1 - include/hw/xen/xen_common.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-)hw/xen/xen-bus.c +1
-1@@ -917,7 +917,7 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain, }struct XenEventChannel { -unsigned int local_port; +evtchn_port_t local_port;XenEventHandler handler;void *opaque;Notifier notifier;hw/xen/xen-bus.c +6
-4@@ -939,17 +939,19 @@ XenEventChannel *xen_device_bind_event_channel (XenDevice *xendev, void *opaque, Error **errp) {XenEventChannel *channel =g_new0 (XenEventChannel,1 ); +xenevtchn_port_or_error_t local_port; - channel->local_port =xenevtchn_bind_interdomain (xendev->xeh, - xendev->frontend_id, - port); -if (xendev->local_port <0 ) { + local_port =xenevtchn_bind_interdomain (xendev->xeh, + xendev->frontend_id, + port); +if (local_port <0 ) {error_setg_errno (errp, errno,"xenevtchn_bind_interdomain failed");g_free (channel);return NULL ; } + channel->local_port = local_port;channel->handler = handler; channel->opaque = opaque; channel->notifier.notify = event_notify;include/hw/xen/xen-bus.h +0
-1@@ -29,7 +29,6 @@ typedef struct XenDevice {xengnttab_handle *xgth;bool feature_grant_copy;xenevtchn_handle *xeh; -xenevtchn_port_or_error_t local_port;NotifierList event_notifiers; } XenDevice;include/hw/xen/xen_common.h +1
-1@@ -32,6 +32,7 @@ extern xc_interface *xen_xc;typedef xc_interface xenforeignmemory_handle ;typedef xc_evtchn xenevtchn_handle ;typedef xc_gnttab xengnttab_handle ; +typedef evtchn_port_or_error_t xenevtchn_port_or_error_t ;#define xenevtchn_open (l, f) xc_evtchn_open(l, f);#define xenevtchn_close (h) xc_evtchn_close(h) --Anthony PERARD