Refactor common part of xen backend and frontend
v3 cover Refactor common part of xen backend and frontend
This patch series was splitted from QEMU:Xen stubdom vTPM for HVM virtual machine
http://markmail.org/message/fkix7g3a5zdj7lvr
It contains a reorganization of xen backend and frontend functions together with code style fixes.
Common functions shared by backends and frontends are moved to xen_pvdev file.
---
Changes in v3:
* align second line with first parameter
Changes in v2:
* fixed parameter alignment when spliting long lines
* removed patches for creating xen_frontend
Emil Condrea (13):
xen: Fix coding style errors
xen: Fix coding style warnings
xen: Create a new file xen_pvdev.c
xen: Move xenstore_update to xen_pvdev.c
xen: Move evtchn functions to xen_pvdev.c
xen: Prepare xendev qtail to be shared with frontends
xen: Move xenstore cleanup and mkdir functions
xen: Rename xen_be_printf to xen_pv_printf
xen: Rename xen_be_unbind_evtchn
xen: Rename xen_be_send_notify
xen: Rename xen_be_evtchn_event
xen: Rename xen_be_find_xendev
xen: Rename xen_be_del_xendev
hw/block/xen_disk.c | 65 ++++---- hw/char/xen_console.c | 30 ++-- hw/display/xenfb.c | 127 ++++++++-------- hw/net/xen_nic.c | 36 +++-- hw/usb/xen-usb.c | 46 +++--- hw/xen/Makefile.objs | 2 +- hw/xen/xen_backend.c | 348 +++++-------------------------------------- hw/xen/xen_devconfig.c | 4 +- hw/xen/xen_pvdev.c | 316 +++++++++++++++++++++++++++++++++++++++ include/hw/xen/xen_backend.h | 72 +-------- include/hw/xen/xen_pvdev.h | 78 ++++++++++ xen-common.c | 4 +- 12 files changed, 603 insertions(+), 525 deletions(-) create mode 100644 hw/xen/xen_pvdev.c create mode 100644 include/hw/xen/xen_pvdev.h
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 1/13 xen: Fix coding style errors
Fixes the following errors:
* ERROR: line over 90 characters
* ERROR: code indent should never use tabs
* ERROR: space prohibited after that open square bracket '['
* ERROR: do not initialise statics to 0 or NULL
* ERROR: "(foo*)" should be "(foo *)"
--- hw/char/xen_console.c | 21 ++++++------ hw/display/xenfb.c | 91 ++++++++++++++++++++++++++++----------------------- hw/net/xen_nic.c | 8 +++-- hw/xen/xen_backend.c | 20 +++++------ 4 files changed, 76 insertions(+), 64 deletions(-)
hw/char/xen_console.c +11 -10
@@ -158,16 +158,17 @@ static void xencons_send(struct XenConsole *con) len = size; }if (len <1 ) { -if (!con->backlog) { - con->backlog =1 ; -xen_be_printf (&con->xendev,1 ,"backlog piling up, nobody listening?\n" ); - } +if (!con->backlog) { + con->backlog =1 ; +xen_be_printf (&con->xendev,1 , +"backlog piling up, nobody listening?\n" ); + } }else { -buffer_advance (&con->buffer, len); -if (con->backlog && len == size) { - con->backlog =0 ; -xen_be_printf (&con->xendev,1 ,"backlog is gone\n" ); - } +buffer_advance (&con->buffer, len); +if (con->backlog && len == size) { + con->backlog =0 ; +xen_be_printf (&con->xendev,1 ,"backlog is gone\n" ); + } } }
@@ -191,7 +192,7 @@ static int con_init(struct XenDevice *xendev) type =xenstore_read_str (con->console,"type" );if (!type ||strcmp (type,"ioemu" ) !=0 ) { -xen_be_printf (xendev,1 ,"not for me (type=%s)\n" , type); +xen_be_printf (xendev,1 ,"not for me (type=%s)\n" , type); ret =-1 ; goto out; }
hw/display/xenfb.c +50 -41
153 lines not on this page · raw message
hw/net/xen_nic.c +5 -3
@@ -151,7 +151,8 @@ static void net_tx_packets(struct XenNetDev *netdev)continue ; } - xen_be_printf(&netdev->xendev, 3, "tx packet ref %d, off %d, len %d, flags 0x%x%s%s%s%s\n", + xen_be_printf(&netdev->xendev, 3, + "tx packet ref %d, off %d, len %d, flags 0x%x%s%s%s%s\n", txreq.gref, txreq.offset, txreq.size, txreq.flags, (txreq.flags & NETTXF_csum_blank) ? " csum_blank" : "", (txreq.flags & NETTXF_data_validated) ? " data_validated" : "",
@@ -162,8 +163,9 @@ static void net_tx_packets(struct XenNetDev *netdev) netdev->xendev.dom, txreq.gref, PROT_READ);if (page ==NULL ) { -xen_be_printf (&netdev->xendev,0 ,"error: tx gref dereference failed (%d)\n" , - txreq.gref); +xen_be_printf (&netdev->xendev,0 , +"error: tx gref dereference failed (%d)\n" , + txreq.gref);net_tx_error (netdev, &txreq, rc);continue ; }
hw/xen/xen_backend.c +10 -10
@@ -54,7 +54,7 @@ static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =QTAILQ_HEAD_INITIALIZER (xs_cleanup); static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs); -static int debug =0 ; +static int debug;/* ------------------------------------------------------------- */
@@ -215,13 +215,13 @@ int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node, uint64_tconst char *xenbus_strstate (enum xenbus_state state) {static const char *const name[] = { - [ XenbusStateUnknown ] ="Unknown" , - [ XenbusStateInitialising ] ="Initialising" , - [ XenbusStateInitWait ] ="InitWait" , - [ XenbusStateInitialised ] ="Initialised" , - [ XenbusStateConnected ] ="Connected" , - [ XenbusStateClosing ] ="Closing" , - [ XenbusStateClosed ] ="Closed" , + [XenbusStateUnknown] ="Unknown" , + [XenbusStateInitialising] ="Initialising" , + [XenbusStateInitWait] ="InitWait" , + [XenbusStateInitialised] ="Initialised" , + [XenbusStateConnected] ="Connected" , + [XenbusStateClosing] ="Closing" , + [XenbusStateClosed] ="Closed" , };return (state <ARRAY_SIZE (name)) ? name[state] :"INVALID" ; }
@@ -702,10 +702,10 @@ static void xenstore_update(void *unused)if (sscanf (vec[XS_WATCH_TOKEN ],"be:%" PRIxPTR":%d:%" PRIxPTR, &type, &dom, &ops) ==3 ) { -xenstore_update_be (vec[XS_WATCH_PATH ], (void *)type, dom, (void *)ops); +xenstore_update_be (vec[XS_WATCH_PATH ], (void *)type, dom, (void *)ops); }if (sscanf (vec[XS_WATCH_TOKEN ],"fe:%" PRIxPTR, &ptr) ==1 ) { -xenstore_update_fe (vec[XS_WATCH_PATH ], (void *)ptr); +xenstore_update_fe (vec[XS_WATCH_PATH ], (void *)ptr); } cleanup:
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 2/13 xen: Fix coding style warnings
In reply to Emil CondreaFixes:
* WARNING: line over 80 characters
--- hw/block/xen_disk.c | 3 ++- hw/char/xen_console.c | 3 ++- hw/display/xenfb.c | 6 ++++-- hw/net/xen_nic.c | 12 ++++++++---- hw/xen/xen_backend.c | 15 ++++++++++----- include/hw/xen/xen_backend.h | 8 +++++--- 6 files changed, 31 insertions(+), 16 deletions(-)
hw/block/xen_disk.c +2 -1
@@ -1068,7 +1068,8 @@ static int blk_connect(struct XenDevice *xendev)blk_set_enable_write_cache (blkdev->blk, !writethrough); }else {/* setup via qemu cmdline -> already setup for us */ -xen_be_printf (&blkdev->xendev,2 ,"get configured bdrv (cmdline setup)\n" ); +xen_be_printf (&blkdev->xendev,2 , +"get configured bdrv (cmdline setup)\n" ); blkdev->blk =blk_by_legacy_dinfo (blkdev->dinfo);if (blk_is_read_only (blkdev->blk) && !readonly) {xen_be_printf (&blkdev->xendev,0 ,"Unexpected read-only drive" );
hw/char/xen_console.c +2 -1
@@ -248,7 +248,8 @@ static int con_initialise(struct XenDevice *xendev)qemu_chr_fe_set_handlers (&con->chr, xencons_can_receive, xencons_receive,NULL , con,NULL , true); - xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", + xen_be_printf(xendev, 1, + "ring mfn %d, remote port %d, local port %d, limit %zd\n", con->ring_ref, con->xendev.remote_port, con->xendev.local_port,
hw/display/xenfb.c +4 -2
@@ -561,7 +561,8 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim, xenfb->offset = offset; xenfb->up_fullscreen =1 ; xenfb->do_resize =1 ; -xen_be_printf (&xenfb->c.xendev,1 ,"framebuffer %dx%dx%d offset %d stride %d\n" , +xen_be_printf (&xenfb->c.xendev,1 , +"framebuffer %dx%dx%d offset %d stride %d\n" , width, height, depth, offset, row_stride);return 0 ; }
@@ -729,7 +730,8 @@ static void xenfb_update(void *opaque)break ; }dpy_gfx_replace_surface (xenfb->c.con, surface); -xen_be_printf (&xenfb->c.xendev,1 ,"update: resizing: %dx%d @ %d bpp%s\n" , +xen_be_printf (&xenfb->c.xendev,1 , +"update: resizing: %dx%d @ %d bpp%s\n" , xenfb->width, xenfb->height, xenfb->depth,is_buffer_shared (surface) ?" (shared)" :"" ); xenfb->up_fullscreen =1 ;
hw/net/xen_nic.c +8 -4
@@ -140,7 +140,8 @@ static void net_tx_packets(struct XenNetDev *netdev)#endif if (txreq.size <14 ) { -xen_be_printf (&netdev->xendev,0 ,"bad packet size: %d\n" , txreq.size); +xen_be_printf (&netdev->xendev,0 ,"bad packet size: %d\n" , + txreq.size);net_tx_error (netdev, &txreq, rc);continue ; }
@@ -213,7 +214,8 @@ static void net_rx_response(struct XenNetDev *netdev, resp->status = (int16_t )st; } -xen_be_printf (&netdev->xendev,3 ,"rx response: idx %d, status %d, flags 0x%x\n" , +xen_be_printf (&netdev->xendev,3 , +"rx response: idx %d, status %d, flags 0x%x\n" , i, resp->status, resp->flags); netdev->rx_ring.rsp_prod_pvt = ++i;
@@ -256,7 +258,8 @@ static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size netdev->xendev.dom, rxreq.gref, PROT_WRITE);if (page ==NULL ) { -xen_be_printf (&netdev->xendev,0 ,"error: rx gref dereference failed (%d)\n" , +xen_be_printf (&netdev->xendev,0 , +"error: rx gref dereference failed (%d)\n" , rxreq.gref);net_rx_response (netdev, &rxreq,NETIF_RSP_ERROR ,0 ,0 ,0 );return -1 ;
@@ -330,7 +333,8 @@ static int net_connect(struct XenDevice *xendev) rx_copy =0 ; }if (rx_copy ==0 ) { -xen_be_printf (&netdev->xendev,0 ,"frontend doesn't support rx-copy.\n" ); +xen_be_printf (&netdev->xendev,0 , +"frontend doesn't support rx-copy.\n" );return -1 ; }
hw/xen/xen_backend.c +10 -5
@@ -53,7 +53,8 @@ struct xs_dirs { static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =QTAILQ_HEAD_INITIALIZER (xs_cleanup); -static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs); +static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = +QTAILQ_HEAD_INITIALIZER (xendevs);static int debug;/* ------------------------------------------------------------- */
@@ -205,7 +206,8 @@ int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival)return xenstore_read_int (xendev->fe, node, ival); } -int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node,uint64_t *uval) +int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node, +uint64_t *uval) {return xenstore_read_uint64 (xendev->fe, node, uval); }
@@ -385,7 +387,8 @@ static void xen_be_frontend_changed(struct XenDevice *xendev, const char *node)g_free (xendev->protocol); xendev->protocol =xenstore_read_fe_str (xendev,"protocol" );if (xendev->protocol) { -xen_be_printf (xendev,1 ,"frontend protocol: %s\n" , xendev->protocol); +xen_be_printf (xendev,1 ,"frontend protocol: %s\n" , + xendev->protocol); } }
@@ -617,7 +620,8 @@ static int xenstore_scan(const char *type, int dom, struct XenDevOps *ops)snprintf (token,sizeof (token),"be:%p:%d:%p" , type, dom, ops);snprintf (path,sizeof (path),"backend/%s/%d" , type, dom);if (!xs_watch (xenstore, path, token)) { -xen_be_printf (NULL ,0 ,"xen be: watching backend path (%s) failed\n" , path); +xen_be_printf (NULL ,0 ,"xen be: watching backend path (%s) failed\n" , + path);return -1 ; }
@@ -830,7 +834,8 @@ int xen_be_send_notify(struct XenDevice *xendev)* 2 == noisy debug messages (logfile only). * 3 == will flood your log (logfile only). */ -void xen_be_printf (struct XenDevice *xendev,int msg_level,const char *fmt, ...) +void xen_be_printf (struct XenDevice *xendev,int msg_level, +const char *fmt, ...) {va_list args;
include/hw/xen/xen_backend.h +5 -3
@@ -79,7 +79,8 @@ int xenstore_read_be_int(struct XenDevice *xendev, const char *node, int *ival);char *xenstore_read_fe_str (struct XenDevice *xendev,const char *node);int xenstore_read_fe_int (struct XenDevice *xendev,const char *node,int *ival);int xenstore_read_uint64 (const char *base,const char *node,uint64_t *uval); -int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node,uint64_t *uval); +int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node, +uint64_t *uval);const char *xenbus_strstate (enum xenbus_state state);struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev);
@@ -93,8 +94,9 @@ int xen_be_set_state(struct XenDevice *xendev, enum xenbus_state state);int xen_be_bind_evtchn (struct XenDevice *xendev);void xen_be_unbind_evtchn (struct XenDevice *xendev);int xen_be_send_notify (struct XenDevice *xendev); -void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ...) - GCC_FMT_ATTR(3, 4); +void xen_be_printf(struct XenDevice *xendev, int msg_level, + const char *fmt, ...) GCC_FMT_ATTR(3, 4); +/* actual backend drivers */ extern struct XenDevOps xen_console_ops;/* xen_console.c */
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 2/13 xen: Fix coding style warnings
In reply to Emil CondreaFixes:
* WARNING: line over 80 characters
--- hw/block/xen_disk.c | 3 ++- hw/char/xen_console.c | 3 ++- hw/display/xenfb.c | 6 ++++-- hw/net/xen_nic.c | 12 ++++++++---- hw/xen/xen_backend.c | 15 ++++++++++----- include/hw/xen/xen_backend.h | 8 +++++--- 6 files changed, 31 insertions(+), 16 deletions(-)
hw/block/xen_disk.c +2 -1
@@ -1068,7 +1068,8 @@ static int blk_connect(struct XenDevice *xendev)blk_set_enable_write_cache (blkdev->blk, !writethrough); }else {/* setup via qemu cmdline -> already setup for us */ -xen_be_printf (&blkdev->xendev,2 ,"get configured bdrv (cmdline setup)\n" ); +xen_be_printf (&blkdev->xendev,2 , +"get configured bdrv (cmdline setup)\n" ); blkdev->blk =blk_by_legacy_dinfo (blkdev->dinfo);if (blk_is_read_only (blkdev->blk) && !readonly) {xen_be_printf (&blkdev->xendev,0 ,"Unexpected read-only drive" );
hw/char/xen_console.c +2 -1
@@ -248,7 +248,8 @@ static int con_initialise(struct XenDevice *xendev)qemu_chr_fe_set_handlers (&con->chr, xencons_can_receive, xencons_receive,NULL , con,NULL , true); - xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", + xen_be_printf(xendev, 1, + "ring mfn %d, remote port %d, local port %d, limit %zd\n", con->ring_ref, con->xendev.remote_port, con->xendev.local_port,
hw/display/xenfb.c +4 -2
@@ -561,7 +561,8 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim, xenfb->offset = offset; xenfb->up_fullscreen =1 ; xenfb->do_resize =1 ; -xen_be_printf (&xenfb->c.xendev,1 ,"framebuffer %dx%dx%d offset %d stride %d\n" , +xen_be_printf (&xenfb->c.xendev,1 , +"framebuffer %dx%dx%d offset %d stride %d\n" , width, height, depth, offset, row_stride);return 0 ; }
@@ -729,7 +730,8 @@ static void xenfb_update(void *opaque)break ; }dpy_gfx_replace_surface (xenfb->c.con, surface); -xen_be_printf (&xenfb->c.xendev,1 ,"update: resizing: %dx%d @ %d bpp%s\n" , +xen_be_printf (&xenfb->c.xendev,1 , +"update: resizing: %dx%d @ %d bpp%s\n" , xenfb->width, xenfb->height, xenfb->depth,is_buffer_shared (surface) ?" (shared)" :"" ); xenfb->up_fullscreen =1 ;
hw/net/xen_nic.c +8 -4
@@ -140,7 +140,8 @@ static void net_tx_packets(struct XenNetDev *netdev)#endif if (txreq.size <14 ) { -xen_be_printf (&netdev->xendev,0 ,"bad packet size: %d\n" , txreq.size); +xen_be_printf (&netdev->xendev,0 ,"bad packet size: %d\n" , + txreq.size);net_tx_error (netdev, &txreq, rc);continue ; }
@@ -213,7 +214,8 @@ static void net_rx_response(struct XenNetDev *netdev, resp->status = (int16_t )st; } -xen_be_printf (&netdev->xendev,3 ,"rx response: idx %d, status %d, flags 0x%x\n" , +xen_be_printf (&netdev->xendev,3 , +"rx response: idx %d, status %d, flags 0x%x\n" , i, resp->status, resp->flags); netdev->rx_ring.rsp_prod_pvt = ++i;
@@ -256,7 +258,8 @@ static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size netdev->xendev.dom, rxreq.gref, PROT_WRITE);if (page ==NULL ) { -xen_be_printf (&netdev->xendev,0 ,"error: rx gref dereference failed (%d)\n" , +xen_be_printf (&netdev->xendev,0 , +"error: rx gref dereference failed (%d)\n" , rxreq.gref);net_rx_response (netdev, &rxreq,NETIF_RSP_ERROR ,0 ,0 ,0 );return -1 ;
@@ -330,7 +333,8 @@ static int net_connect(struct XenDevice *xendev) rx_copy =0 ; }if (rx_copy ==0 ) { -xen_be_printf (&netdev->xendev,0 ,"frontend doesn't support rx-copy.\n" ); +xen_be_printf (&netdev->xendev,0 , +"frontend doesn't support rx-copy.\n" );return -1 ; }
hw/xen/xen_backend.c +10 -5
@@ -53,7 +53,8 @@ struct xs_dirs { static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =QTAILQ_HEAD_INITIALIZER (xs_cleanup); -static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs); +static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = +QTAILQ_HEAD_INITIALIZER (xendevs);static int debug;/* ------------------------------------------------------------- */
@@ -205,7 +206,8 @@ int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival)return xenstore_read_int (xendev->fe, node, ival); } -int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node,uint64_t *uval) +int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node, +uint64_t *uval) {return xenstore_read_uint64 (xendev->fe, node, uval); }
@@ -385,7 +387,8 @@ static void xen_be_frontend_changed(struct XenDevice *xendev, const char *node)g_free (xendev->protocol); xendev->protocol =xenstore_read_fe_str (xendev,"protocol" );if (xendev->protocol) { -xen_be_printf (xendev,1 ,"frontend protocol: %s\n" , xendev->protocol); +xen_be_printf (xendev,1 ,"frontend protocol: %s\n" , + xendev->protocol); } }
@@ -617,7 +620,8 @@ static int xenstore_scan(const char *type, int dom, struct XenDevOps *ops)snprintf (token,sizeof (token),"be:%p:%d:%p" , type, dom, ops);snprintf (path,sizeof (path),"backend/%s/%d" , type, dom);if (!xs_watch (xenstore, path, token)) { -xen_be_printf (NULL ,0 ,"xen be: watching backend path (%s) failed\n" , path); +xen_be_printf (NULL ,0 ,"xen be: watching backend path (%s) failed\n" , + path);return -1 ; }
@@ -830,7 +834,8 @@ int xen_be_send_notify(struct XenDevice *xendev)* 2 == noisy debug messages (logfile only). * 3 == will flood your log (logfile only). */ -void xen_be_printf (struct XenDevice *xendev,int msg_level,const char *fmt, ...) +void xen_be_printf (struct XenDevice *xendev,int msg_level, +const char *fmt, ...) {va_list args;
include/hw/xen/xen_backend.h +5 -3
@@ -79,7 +79,8 @@ int xenstore_read_be_int(struct XenDevice *xendev, const char *node, int *ival);char *xenstore_read_fe_str (struct XenDevice *xendev,const char *node);int xenstore_read_fe_int (struct XenDevice *xendev,const char *node,int *ival);int xenstore_read_uint64 (const char *base,const char *node,uint64_t *uval); -int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node,uint64_t *uval); +int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node, +uint64_t *uval);const char *xenbus_strstate (enum xenbus_state state);struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev);
@@ -93,8 +94,9 @@ int xen_be_set_state(struct XenDevice *xendev, enum xenbus_state state);int xen_be_bind_evtchn (struct XenDevice *xendev);void xen_be_unbind_evtchn (struct XenDevice *xendev);int xen_be_send_notify (struct XenDevice *xendev); -void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ...) - GCC_FMT_ATTR(3, 4); +void xen_be_printf(struct XenDevice *xendev, int msg_level, + const char *fmt, ...) GCC_FMT_ATTR(3, 4); +/* actual backend drivers */ extern struct XenDevOps xen_console_ops;/* xen_console.c */
Signature · 1 line
1.9.1
PATCH v3 3/13 xen: Create a new file xen_pvdev.c
In reply to Emil CondreaThe purpose of the new file is to store generic functions shared by frontend and backends such as xenstore operations, xendevs.
--- hw/xen/Makefile.objs | 2 +- hw/xen/xen_backend.c | 126 +----------------------------------- hw/xen/xen_pvdev.c | 150 +++++++++++++++++++++++++++++++++++++++++++ include/hw/xen/xen_backend.h | 64 +----------------- include/hw/xen/xen_pvdev.h | 69 ++++++++++++++++++++ 5 files changed, 222 insertions(+), 189 deletions(-) create mode 100644 hw/xen/xen_pvdev.c create mode 100644 include/hw/xen/xen_pvdev.h
hw/xen/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ # xen backend driver support -common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o +common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o xen_pvdev.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
hw/xen/xen_backend.c +1 -125
162 lines not on this page · raw message
hw/xen/xen_pvdev.c new file +150 -0
150 lines not on this page · raw message
include/hw/xen/xen_backend.h +1 -63
95 lines not on this page · raw message
include/hw/xen/xen_pvdev.h new file +69 -0
69 lines not on this page · raw message
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 3/13 xen: Create a new file xen_pvdev.c
In reply to Emil CondreaThe purpose of the new file is to store generic functions shared by frontend and backends such as xenstore operations, xendevs.
--- hw/xen/Makefile.objs | 2 +- hw/xen/xen_backend.c | 126 +----------------------------------- hw/xen/xen_pvdev.c | 150 +++++++++++++++++++++++++++++++++++++++++++ include/hw/xen/xen_backend.h | 64 +----------------- include/hw/xen/xen_pvdev.h | 69 ++++++++++++++++++++ 5 files changed, 222 insertions(+), 189 deletions(-) create mode 100644 hw/xen/xen_pvdev.c create mode 100644 include/hw/xen/xen_pvdev.h
hw/xen/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ # xen backend driver support -common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o +common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o xen_pvdev.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
hw/xen/xen_backend.c +1 -125
162 lines not on this page · raw message
hw/xen/xen_pvdev.c new file +150 -0
150 lines not on this page · raw message
include/hw/xen/xen_backend.h +1 -63
95 lines not on this page · raw message
include/hw/xen/xen_pvdev.h new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 4/13 xen: Move xenstore_update to xen_pvdev.c
In reply to Emil Condrea * xenstore_update -> xen_pvdev.c
--- hw/xen/xen_backend.c | 30 +++--------------------------- hw/xen/xen_pvdev.c | 23 +++++++++++++++++++++++ include/hw/xen/xen_backend.h | 3 +++ include/hw/xen/xen_pvdev.h | 1 + 4 files changed, 30 insertions(+), 27 deletions(-)
hw/xen/xen_backend.c +3 -27
@@ -556,8 +556,8 @@ static int xenstore_scan(const char *type, int dom, struct XenDevOps *ops)return 0 ; } -static void xenstore_update_be (char *watch,char *type,int dom, -struct XenDevOps *ops) +void xenstore_update_be (char *watch,char *type,int dom, +struct XenDevOps *ops) {struct XenDevice *xendev;char path[XEN_BUFSIZE ], *bepath;
@@ -590,7 +590,7 @@ static void xenstore_update_be(char *watch, char *type, int dom, } } -static void xenstore_update_fe (char *watch,struct XenDevice *xendev) +void xenstore_update_fe (char *watch,struct XenDevice *xendev) {char *node;unsigned int len;
@@ -607,30 +607,6 @@ static void xenstore_update_fe(char *watch, struct XenDevice *xendev)xen_be_frontend_changed (xendev, node);xen_be_check_state (xendev); } - -static void xenstore_update (void *unused) -{ -char **vec =NULL ; -intptr_t type, ops, ptr; -unsigned int dom, count; - - vec =xs_read_watch (xenstore, &count); -if (vec ==NULL ) { - goto cleanup; - } - -if (sscanf (vec[XS_WATCH_TOKEN ],"be:%" PRIxPTR":%d:%" PRIxPTR, - &type, &dom, &ops) ==3 ) { -xenstore_update_be (vec[XS_WATCH_PATH ], (void *)type, dom, (void *)ops); - } -if (sscanf (vec[XS_WATCH_TOKEN ],"fe:%" PRIxPTR, &ptr) ==1 ) { -xenstore_update_fe (vec[XS_WATCH_PATH ], (void *)ptr); - } - -cleanup: -free (vec); -} -static void xen_be_evtchn_event (void *opaque) {struct XenDevice *xendev = opaque;
hw/xen/xen_pvdev.c +23 -0
@@ -95,6 +95,29 @@ int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval)return rc; } +void xenstore_update (void *unused) +{ +char **vec =NULL ; +intptr_t type, ops, ptr; +unsigned int dom, count; + + vec =xs_read_watch (xenstore, &count); +if (vec ==NULL ) { + goto cleanup; + } + +if (sscanf (vec[XS_WATCH_TOKEN ],"be:%" PRIxPTR":%d:%" PRIxPTR, + &type, &dom, &ops) ==3 ) { +xenstore_update_be (vec[XS_WATCH_PATH ], (void *)type, dom, (void *)ops); + } +if (sscanf (vec[XS_WATCH_TOKEN ],"fe:%" PRIxPTR, &ptr) ==1 ) { +xenstore_update_fe (vec[XS_WATCH_PATH ], (void *)ptr); + } + +cleanup: +free (vec); +} +const char *xenbus_strstate (enum xenbus_state state) {static const char *const name[] = {
include/hw/xen/xen_backend.h +3 -0
@@ -19,6 +19,9 @@ int xenstore_write_be_int(struct XenDevice *xendev, const char *node, int ival);int xenstore_write_be_int64 (struct XenDevice *xendev,const char *node,int64_t ival);char *xenstore_read_be_str (struct XenDevice *xendev,const char *node);int xenstore_read_be_int (struct XenDevice *xendev,const char *node,int *ival); +void xenstore_update_fe (char *watch,struct XenDevice *xendev); +void xenstore_update_be (char *watch,char *type,int dom, +struct XenDevOps *ops);char *xenstore_read_fe_str (struct XenDevice *xendev,const char *node);int xenstore_read_fe_int (struct XenDevice *xendev,const char *node,int *ival); int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node,
include/hw/xen/xen_pvdev.h +1 -0
@@ -60,6 +60,7 @@ int xenstore_write_int64(const char *base, const char *node, int64_t ival);char *xenstore_read_str (const char *base,const char *node);int xenstore_read_int (const char *base,const char *node,int *ival);int xenstore_read_uint64 (const char *base,const char *node,uint64_t *uval); +void xenstore_update (void *unused);const char *xenbus_strstate (enum xenbus_state state);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 5/13 xen: Move evtchn functions to xen_pvdev.c
In reply to Emil CondreaThe name of the functions moved:
* xen_be_evtchn_event
* xen_be_unbind_evtchn
* xen_be_send_notify
--- hw/xen/xen_backend.c | 35 ----------------------------------- hw/xen/xen_pvdev.c | 35 +++++++++++++++++++++++++++++++++++ include/hw/xen/xen_backend.h | 2 -- include/hw/xen/xen_pvdev.h | 4 ++++ 4 files changed, 39 insertions(+), 37 deletions(-)
hw/xen/xen_backend.c +0 -35
@@ -607,25 +607,6 @@ void xenstore_update_fe(char *watch, struct XenDevice *xendev)xen_be_frontend_changed (xendev, node);xen_be_check_state (xendev); } -static void xen_be_evtchn_event (void *opaque) -{ -struct XenDevice *xendev = opaque; -evtchn_port_t port; - - port =xenevtchn_pending (xendev->evtchndev); -if (port != xendev->local_port) { -xen_be_printf (xendev,0 , -"xenevtchn_pending returned %d (expected %d)\n" , - port, xendev->local_port); -return ; - } -xenevtchn_unmask (xendev->evtchndev, port); - -if (xendev->ops->event) { - xendev->ops->event (xendev); - } -} -/* -------------------------------------------------------------------- */ int xen_be_init (void )
@@ -702,22 +683,6 @@ int xen_be_bind_evtchn(struct XenDevice *xendev)return 0 ; } -void xen_be_unbind_evtchn (struct XenDevice *xendev) -{ -if (xendev->local_port ==-1 ) { -return ; - } -qemu_set_fd_handler (xenevtchn_fd (xendev->evtchndev),NULL ,NULL ,NULL ); -xenevtchn_unbind (xendev->evtchndev, xendev->local_port); -xen_be_printf (xendev,2 ,"unbind evtchn port %d\n" , xendev->local_port); - xendev->local_port =-1 ; -} - -int xen_be_send_notify (struct XenDevice *xendev) -{ -return xenevtchn_notify (xendev->evtchndev, xendev->local_port); -} -static int xen_sysdev_init (SysBusDevice *dev) {
hw/xen/xen_pvdev.c +35 -0
@@ -171,3 +171,38 @@ void xen_be_printf(struct XenDevice *xendev, int msg_level, }qemu_log_flush (); } + +void xen_be_evtchn_event (void *opaque) +{ +struct XenDevice *xendev = opaque; +evtchn_port_t port; + + port =xenevtchn_pending (xendev->evtchndev); +if (port != xendev->local_port) { +xen_be_printf (xendev,0 , +"xenevtchn_pending returned %d (expected %d)\n" , + port, xendev->local_port); +return ; + } +xenevtchn_unmask (xendev->evtchndev, port); + +if (xendev->ops->event) { + xendev->ops->event (xendev); + } +} + +void xen_be_unbind_evtchn (struct XenDevice *xendev) +{ +if (xendev->local_port ==-1 ) { +return ; + } +qemu_set_fd_handler (xenevtchn_fd (xendev->evtchndev),NULL ,NULL ,NULL ); +xenevtchn_unbind (xendev->evtchndev, xendev->local_port); +xen_be_printf (xendev,2 ,"unbind evtchn port %d\n" , xendev->local_port); + xendev->local_port =-1 ; +} + +int xen_be_send_notify (struct XenDevice *xendev) +{ +return xenevtchn_notify (xendev->evtchndev, xendev->local_port); +}
include/hw/xen/xen_backend.h +0 -2
@@ -36,8 +36,6 @@ void xen_be_register_common(void);int xen_be_register (const char *type,struct XenDevOps *ops);int xen_be_set_state (struct XenDevice *xendev,enum xenbus_state state);int xen_be_bind_evtchn (struct XenDevice *xendev); -void xen_be_unbind_evtchn (struct XenDevice *xendev); -int xen_be_send_notify (struct XenDevice *xendev);/* actual backend drivers */ extern struct XenDevOps xen_console_ops;/* xen_console.c */
include/hw/xen/xen_pvdev.h +4 -0
@@ -64,6 +64,10 @@ void xenstore_update(void *unused);const char *xenbus_strstate (enum xenbus_state state); +void xen_be_evtchn_event (void *opaque); +void xen_be_unbind_evtchn (struct XenDevice *xendev); +int xen_be_send_notify (struct XenDevice *xendev); + void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ...) GCC_FMT_ATTR(3, 4);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 6/13 xen: Prepare xendev qtail to be shared with frontends
In reply to Emil Condrea * move xendevs qtail to xen_pvdev.c
* change xen_be_get_xendev to use a new function: xen_pv_insert_xendev
--- hw/xen/xen_backend.c | 51 +-------------------------------------- hw/xen/xen_pvdev.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/xen/xen_backend.h | 1 - include/hw/xen/xen_pvdev.h | 4 ++++ 4 files changed, 62 insertions(+), 51 deletions(-)
hw/xen/xen_backend.c +1 -50
@@ -54,8 +54,6 @@ struct xs_dirs { static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =QTAILQ_HEAD_INITIALIZER (xs_cleanup); -static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = -QTAILQ_HEAD_INITIALIZER (xendevs);static int debug;static void xenstore_cleanup_dir (char *dir)
@@ -157,27 +155,6 @@ int xen_be_set_state(struct XenDevice *xendev, enum xenbus_state state)return 0 ; } -/* ------------------------------------------------------------- */ - -struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev) -{ -struct XenDevice *xendev; - - QTAILQ_FOREACH(xendev, &xendevs, next) { -if (xendev->dom != dom) { -continue ; - } -if (xendev->dev != dev) { -continue ; - } -if (strcmp (xendev->type, type) !=0 ) { -continue ; - } -return xendev; - } -return NULL ; -} -/* * get xen backend device, allocate a new one if it doesn't exist. */
@@ -226,7 +203,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev, xendev->gnttabdev =NULL ; } -QTAILQ_INSERT_TAIL (&xendevs, xendev, next); +xen_pv_insert_xendev (xendev);if (xendev->ops->alloc) { xendev->ops->alloc (xendev);
@@ -235,32 +212,6 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,return xendev; } -/* -* release xen backend device. -*/ -static void xen_be_del_xendev (struct XenDevice *xendev) -{ -if (xendev->ops->free) { - xendev->ops->free (xendev); - } - -if (xendev->fe) { -char token[XEN_BUFSIZE ]; -snprintf (token,sizeof (token),"fe:%p" , xendev); -xs_unwatch (xenstore, xendev->fe, token); -g_free (xendev->fe); - } - -if (xendev->evtchndev !=NULL ) { -xenevtchn_close (xendev->evtchndev); - } -if (xendev->gnttabdev !=NULL ) { -xengnttab_close (xendev->gnttabdev); - } - -QTAILQ_REMOVE (&xendevs, xendev, next); -g_free (xendev); -}/* * Sync internal data structures on xenstore updates.
hw/xen/xen_pvdev.c +57 -0
67 lines not on this page · raw message
include/hw/xen/xen_backend.h +0 -1
@@ -27,7 +27,6 @@ int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival);int xenstore_read_fe_uint64 (struct XenDevice *xendev,const char *node,uint64_t *uval); -struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev);void xen_be_check_state (struct XenDevice *xendev);/* xen backend driver bits */
include/hw/xen/xen_pvdev.h +4 -0
@@ -65,6 +65,10 @@ void xenstore_update(void *unused);const char *xenbus_strstate (enum xenbus_state state);void xen_be_evtchn_event (void *opaque); +void xen_pv_insert_xendev (struct XenDevice *xendev); +void xen_be_del_xendev (struct XenDevice *xendev); +struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev); +void xen_be_unbind_evtchn (struct XenDevice *xendev);int xen_be_send_notify (struct XenDevice *xendev);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 7/13 xen: Move xenstore cleanup and mkdir functions
In reply to Emil CondreaThe name of the functions moved to xen_pvdev.c:
* xenstore_cleanup_dir
* xen_config_cleanup
* xenstore_mkdir
--- hw/xen/xen_backend.c | 49 ------------------------------------------------- hw/xen/xen_pvdev.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 49 deletions(-)
hw/xen/xen_backend.c +0 -49
@@ -47,57 +47,8 @@ struct xs_handle *xenstore = NULL;const char *xen_protocol;/* private */ -struct xs_dirs { -char *xs_dir; -QTAILQ_ENTRY (xs_dirs) list; -}; -static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup = -QTAILQ_HEAD_INITIALIZER (xs_cleanup); -static int debug; -static void xenstore_cleanup_dir (char *dir) -{ -struct xs_dirs *d; - - d =g_malloc (sizeof (*d)); - d->xs_dir = dir; -QTAILQ_INSERT_TAIL (&xs_cleanup, d, list); -} - -void xen_config_cleanup (void ) -{ -struct xs_dirs *d; - - QTAILQ_FOREACH(d, &xs_cleanup, list) { -xs_rm (xenstore,0 , d->xs_dir); - } -} - -int xenstore_mkdir (char *path,int p) -{ -struct xs_permissions perms[2 ] = { - { - .id =0 ,/* set owner: dom0 */ - }, { - .id = xen_domid, - .perms = p, - } - }; - -if (!xs_mkdir (xenstore,0 , path)) { -xen_be_printf (NULL ,0 ,"xs_mkdir %s: failed\n" , path); -return -1 ; - } -xenstore_cleanup_dir (g_strdup (path)); - -if (!xs_set_permissions (xenstore,0 , path, perms,2 )) { -xen_be_printf (NULL ,0 ,"xs_set_permissions %s: failed\n" , path); -return -1 ; - } -return 0 ; -} -int xenstore_write_be_str (struct XenDevice *xendev,const char *node,const char *val) {return xenstore_write_str (xendev->be, node, val);
hw/xen/xen_pvdev.c +51 -0
62 lines not on this page · raw message
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 8/13 xen: Rename xen_be_printf to xen_pv_printf
In reply to Emil CondreaPrepare xen_be_printf to be used by both backend and frontends:
* xen_be_printf -> xen_pv_printf
--- hw/block/xen_disk.c | 58 +++++++++++++++++++++++----------------------- hw/char/xen_console.c | 8 +++---- hw/display/xenfb.c | 42 ++++++++++++++++----------------- hw/net/xen_nic.c | 22 +++++++++--------- hw/usb/xen-usb.c | 38 +++++++++++++++--------------- hw/xen/xen_backend.c | 46 ++++++++++++++++++------------------ hw/xen/xen_devconfig.c | 4 ++-- hw/xen/xen_pvdev.c | 10 ++++---- include/hw/xen/xen_pvdev.h | 2 +- xen-common.c | 4 ++-- 10 files changed, 117 insertions(+), 117 deletions(-)
hw/block/xen_disk.c +29 -29
@@ -167,12 +167,12 @@ static void destroy_grant(gpointer pgnt)xengnttab_handle *gnt = grant->blkdev->xendev.gnttabdev;if (xengnttab_unmap (gnt, grant->page,1 ) !=0 ) { -xen_be_printf (&grant->blkdev->xendev,0 , +xen_pv_printf (&grant->blkdev->xendev,0 ,"xengnttab_unmap failed: %s\n" ,strerror (errno)); } grant->blkdev->persistent_gnt_count--; -xen_be_printf (&grant->blkdev->xendev,3 , +xen_pv_printf (&grant->blkdev->xendev,3 ,"unmapped grant %p\n" , grant->page);g_free (grant); }
@@ -184,11 +184,11 @@ static void remove_persistent_region(gpointer data, gpointer dev)xengnttab_handle *gnt = blkdev->xendev.gnttabdev;if (xengnttab_unmap (gnt, region->addr, region->num) !=0 ) { -xen_be_printf (&blkdev->xendev,0 , +xen_pv_printf (&blkdev->xendev,0 ,"xengnttab_unmap region %p failed: %s\n" , region->addr,strerror (errno)); } -xen_be_printf (&blkdev->xendev,3 , +xen_pv_printf (&blkdev->xendev,3 ,"unmapped grant region %p with %d pages\n" , region->addr, region->num);g_free (region);
@@ -255,7 +255,7 @@ static int ioreq_parse(struct ioreq *ioreq)size_t len;int i; -xen_be_printf (&blkdev->xendev,3 , +xen_pv_printf (&blkdev->xendev,3 ,"op %d, nr %d, handle %d, id %" PRId64", sector %" PRId64"\n" , ioreq->req.operation, ioreq->req.nr_segments, ioreq->req.handle, ioreq->req.id, ioreq->req.sector_number);
@@ -275,28 +275,28 @@ static int ioreq_parse(struct ioreq *ioreq)case BLKIF_OP_DISCARD :return 0 ;default : -xen_be_printf (&blkdev->xendev,0 ,"error: unknown operation (%d)\n" , +xen_pv_printf (&blkdev->xendev,0 ,"error: unknown operation (%d)\n" , ioreq->req.operation); goto err; };if (ioreq->req.operation !=BLKIF_OP_READ && blkdev->mode[0 ] !='w' ) { -xen_be_printf (&blkdev->xendev,0 ,"error: write req for ro device\n" ); +xen_pv_printf (&blkdev->xendev,0 ,"error: write req for ro device\n" ); goto err; } ioreq->start = ioreq->req.sector_number * blkdev->file_blk;for (i =0 ; i < ioreq->req.nr_segments; i++) {if (i ==BLKIF_MAX_SEGMENTS_PER_REQUEST ) { -xen_be_printf (&blkdev->xendev,0 ,"error: nr_segments too big\n" ); +xen_pv_printf (&blkdev->xendev,0 ,"error: nr_segments too big\n" ); goto err; }if (ioreq->req.seg[i].first_sect > ioreq->req.seg[i].last_sect) { -xen_be_printf (&blkdev->xendev,0 ,"error: first > last sector\n" ); +xen_pv_printf (&blkdev->xendev,0 ,"error: first > last sector\n" ); goto err; }if (ioreq->req.seg[i].last_sect *BLOCK_SIZE >=XC_PAGE_SIZE ) { -xen_be_printf (&blkdev->xendev,0 ,"error: page crossing\n" ); +xen_pv_printf (&blkdev->xendev,0 ,"error: page crossing\n" ); goto err; }
@@ -308,7 +308,7 @@ static int ioreq_parse(struct ioreq *ioreq)qemu_iovec_add (&ioreq->v, (void *)mem, len); }if (ioreq->start + ioreq->v.size > blkdev->file_size) { -xen_be_printf (&blkdev->xendev,0 ,"error: access beyond end of file\n" ); +xen_pv_printf (&blkdev->xendev,0 ,"error: access beyond end of file\n" ); goto err; }return 0 ;
@@ -331,7 +331,7 @@ static void ioreq_unmap(struct ioreq *ioreq)return ; }if (xengnttab_unmap (gnt, ioreq->pages, ioreq->num_unmap) !=0 ) { -xen_be_printf (&ioreq->blkdev->xendev,0 , +xen_pv_printf (&ioreq->blkdev->xendev,0 ,"xengnttab_unmap failed: %s\n" ,strerror (errno)); }
@@ -343,7 +343,7 @@ static void ioreq_unmap(struct ioreq *ioreq)continue ; }if (xengnttab_unmap (gnt, ioreq->page[i],1 ) !=0 ) { -xen_be_printf (&ioreq->blkdev->xendev,0 , +xen_pv_printf (&ioreq->blkdev->xendev,0 ,"xengnttab_unmap failed: %s\n" ,strerror (errno)); }
@@ -381,7 +381,7 @@ static int ioreq_map(struct ioreq *ioreq)if (grant !=NULL ) { page[i] = grant->page; -xen_be_printf (&ioreq->blkdev->xendev,3 , +xen_pv_printf (&ioreq->blkdev->xendev,3 ,"using persistent-grant %" PRIu32"\n" , ioreq->refs[i]); }else {
@@ -410,7 +410,7 @@ static int ioreq_map(struct ioreq *ioreq) ioreq->pages =xengnttab_map_grant_refs (gnt, new_maps, domids, refs, ioreq->prot);if (ioreq->pages ==NULL ) { -xen_be_printf (&ioreq->blkdev->xendev,0 , +xen_pv_printf (&ioreq->blkdev->xendev,0 ,"can't map %d grant refs (%s, %d maps)\n" , new_maps,strerror (errno), ioreq->blkdev->cnt_map);return -1 ;
@@ -426,7 +426,7 @@ static int ioreq_map(struct ioreq *ioreq) ioreq->page[i] =xengnttab_map_grant_ref (gnt, domids[i], refs[i], ioreq->prot);if (ioreq->page[i] ==NULL ) { -xen_be_printf (&ioreq->blkdev->xendev,0 , +xen_pv_printf (&ioreq->blkdev->xendev,0 ,"can't map grant ref %d (%s, %d maps)\n" , refs[i],strerror (errno), ioreq->blkdev->cnt_map); ioreq->mapped =1 ;
@@ -474,7 +474,7 @@ static int ioreq_map(struct ioreq *ioreq) grant->page = ioreq->page[new_maps]; } grant->blkdev = ioreq->blkdev; -xen_be_printf (&ioreq->blkdev->xendev,3 , +xen_pv_printf (&ioreq->blkdev->xendev,3 ,"adding grant %" PRIu32" page: %p\n" , refs[new_maps], grant->page); g_tree_insert(ioreq->blkdev->persistent_gnts,
@@ -557,7 +557,7 @@ static int ioreq_grant_copy(struct ioreq *ioreq) rc =xengnttab_grant_copy (gnt, count, segs);if (rc) { -xen_be_printf (&ioreq->blkdev->xendev,0 , +xen_pv_printf (&ioreq->blkdev->xendev,0 ,"failed to copy data %d\n" , rc); ioreq->aio_errors++;return -1 ;
@@ -565,7 +565,7 @@ static int ioreq_grant_copy(struct ioreq *ioreq)for (i =0 ; i < count; i++) {if (segs[i].status != GNTST_okay) { -xen_be_printf (&ioreq->blkdev->xendev,3 , +xen_pv_printf (&ioreq->blkdev->xendev,3 ,"failed to copy data %d for gref %d, domid %d\n" , segs[i].status, ioreq->refs[i], ioreq->domids[i]); ioreq->aio_errors++;
@@ -599,7 +599,7 @@ static void qemu_aio_complete(void *opaque, int ret)struct ioreq *ioreq = opaque;if (ret !=0 ) { -xen_be_printf (&ioreq->blkdev->xendev,0 ,"%s I/O error\n" , +xen_pv_printf (&ioreq->blkdev->xendev,0 ,"%s I/O error\n" , ioreq->req.operation ==BLKIF_OP_READ ?"read" :"write" ); ioreq->aio_errors++; }
@@ -910,7 +910,7 @@ static void blk_alloc(struct XenDevice *xendev) }if (xengnttab_set_max_grants (xendev->gnttabdev,MAX_GRANTS (max_requests,BLKIF_MAX_SEGMENTS_PER_REQUEST )) <0 ) { -xen_be_printf (xendev,0 ,"xengnttab_set_max_grants failed: %s\n" , +xen_pv_printf (xendev,0 ,"xengnttab_set_max_grants failed: %s\n" ,strerror (errno)); } }
@@ -1056,11 +1056,11 @@ static int blk_connect(struct XenDevice *xendev) }/* setup via xenbus -> create new block driver instance */ -xen_be_printf (&blkdev->xendev,2 ,"create new bdrv (xenbus setup)\n" ); +xen_pv_printf (&blkdev->xendev,2 ,"create new bdrv (xenbus setup)\n" ); blkdev->blk =blk_new_open (blkdev->filename,NULL , options, qflags, &local_err);if (!blkdev->blk) { -xen_be_printf (&blkdev->xendev,0 ,"error: %s\n" , +xen_pv_printf (&blkdev->xendev,0 ,"error: %s\n" ,error_get_pretty (local_err));error_free (local_err);return -1 ;
@@ -1068,11 +1068,11 @@ static int blk_connect(struct XenDevice *xendev)blk_set_enable_write_cache (blkdev->blk, !writethrough); }else {/* setup via qemu cmdline -> already setup for us */ -xen_be_printf (&blkdev->xendev,2 , +xen_pv_printf (&blkdev->xendev,2 ,"get configured bdrv (cmdline setup)\n" ); blkdev->blk =blk_by_legacy_dinfo (blkdev->dinfo);if (blk_is_read_only (blkdev->blk) && !readonly) { -xen_be_printf (&blkdev->xendev,0 ,"Unexpected read-only drive" ); +xen_pv_printf (&blkdev->xendev,0 ,"Unexpected read-only drive" ); blkdev->blk =NULL ;return -1 ; }
@@ -1085,13 +1085,13 @@ static int blk_connect(struct XenDevice *xendev)if (blkdev->file_size <0 ) {BlockDriverState *bs =blk_bs (blkdev->blk);const char *drv_name = bs ?bdrv_get_format_name (bs) :NULL ; -xen_be_printf (&blkdev->xendev,1 ,"blk_getlength: %d (%s) | drv %s\n" , +xen_pv_printf (&blkdev->xendev,1 ,"blk_getlength: %d (%s) | drv %s\n" , (int )blkdev->file_size,strerror (-blkdev->file_size), drv_name ?:"-" ); blkdev->file_size =0 ; } -xen_be_printf (xendev,1 ,"type \"%s\", fileproto \"%s\", filename \"%s\"," +xen_pv_printf (xendev,1 ,"type \"%s\", fileproto \"%s\", filename \"%s\"," " size %" PRId64" (%" PRId64" MB)\n" , blkdev->type, blkdev->fileproto, blkdev->filename, blkdev->file_size, blkdev->file_size >>20 );
@@ -1175,10 +1175,10 @@ static int blk_connect(struct XenDevice *xendev) blkdev->feature_grant_copy = (xengnttab_grant_copy (blkdev->xendev.gnttabdev,0 ,NULL ) ==0 ); -xen_be_printf (&blkdev->xendev,3 ,"grant copy operation %s\n" , +xen_pv_printf (&blkdev->xendev,3 ,"grant copy operation %s\n" , blkdev->feature_grant_copy ?"enabled" :"disabled" ); -xen_be_printf (&blkdev->xendev,1 ,"ok: proto %s, ring-ref %d, " +xen_pv_printf (&blkdev->xendev,1 ,"ok: proto %s, ring-ref %d, " "remote port %d, local port %d\n" , blkdev->xendev.protocol, blkdev->ring_ref, blkdev->xendev.remote_port, blkdev->xendev.local_port);
hw/char/xen_console.c +4 -4
@@ -160,14 +160,14 @@ static void xencons_send(struct XenConsole *con)if (len <1 ) {if (!con->backlog) { con->backlog =1 ; -xen_be_printf (&con->xendev,1 , +xen_pv_printf (&con->xendev,1 ,"backlog piling up, nobody listening?\n" ); } }else {buffer_advance (&con->buffer, len);if (con->backlog && len == size) { con->backlog =0 ; -xen_be_printf (&con->xendev,1 ,"backlog is gone\n" ); +xen_pv_printf (&con->xendev,1 ,"backlog is gone\n" ); } } }
@@ -192,7 +192,7 @@ static int con_init(struct XenDevice *xendev) type =xenstore_read_str (con->console,"type" );if (!type ||strcmp (type,"ioemu" ) !=0 ) { -xen_be_printf (xendev,1 ,"not for me (type=%s)\n" , type); +xen_pv_printf (xendev,1 ,"not for me (type=%s)\n" , type); ret =-1 ; goto out; }
@@ -248,7 +248,7 @@ static int con_initialise(struct XenDevice *xendev)qemu_chr_fe_set_handlers (&con->chr, xencons_can_receive, xencons_receive,NULL , con,NULL , true); - xen_be_printf(xendev, 1, + xen_pv_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", con->ring_ref, con->xendev.remote_port,
hw/display/xenfb.c +21 -21
159 lines not on this page · raw message
hw/net/xen_nic.c +11 -11
@@ -128,31 +128,31 @@ static void net_tx_packets(struct XenNetDev *netdev)/* should not happen in theory, we don't announce the * * feature-{sg,gso,whatelse} flags in xenstore (yet?) */ if (txreq.flags & NETTXF_extra_info) { -xen_be_printf (&netdev->xendev,0 ,"FIXME: extra info flag\n" ); +xen_pv_printf (&netdev->xendev,0 ,"FIXME: extra info flag\n" );net_tx_error (netdev, &txreq, rc);continue ; }if (txreq.flags & NETTXF_more_data) { -xen_be_printf (&netdev->xendev,0 ,"FIXME: more data flag\n" ); +xen_pv_printf (&netdev->xendev,0 ,"FIXME: more data flag\n" );net_tx_error (netdev, &txreq, rc);continue ; }#endif if (txreq.size <14 ) { -xen_be_printf (&netdev->xendev,0 ,"bad packet size: %d\n" , +xen_pv_printf (&netdev->xendev,0 ,"bad packet size: %d\n" , txreq.size);net_tx_error (netdev, &txreq, rc);continue ; }if ((txreq.offset + txreq.size) >XC_PAGE_SIZE ) { -xen_be_printf (&netdev->xendev,0 ,"error: page crossing\n" ); +xen_pv_printf (&netdev->xendev,0 ,"error: page crossing\n" );net_tx_error (netdev, &txreq, rc);continue ; } - xen_be_printf(&netdev->xendev, 3, + xen_pv_printf(&netdev->xendev, 3, "tx packet ref %d, off %d, len %d, flags 0x%x%s%s%s%s\n", txreq.gref, txreq.offset, txreq.size, txreq.flags, (txreq.flags & NETTXF_csum_blank) ? " csum_blank" : "",
@@ -164,7 +164,7 @@ static void net_tx_packets(struct XenNetDev *netdev) netdev->xendev.dom, txreq.gref, PROT_READ);if (page ==NULL ) { -xen_be_printf (&netdev->xendev,0 , +xen_pv_printf (&netdev->xendev,0 ,"error: tx gref dereference failed (%d)\n" , txreq.gref);net_tx_error (netdev, &txreq, rc);
@@ -214,7 +214,7 @@ static void net_rx_response(struct XenNetDev *netdev, resp->status = (int16_t )st; } -xen_be_printf (&netdev->xendev,3 , +xen_pv_printf (&netdev->xendev,3 ,"rx response: idx %d, status %d, flags 0x%x\n" , i, resp->status, resp->flags);
@@ -246,7 +246,7 @@ static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t sizereturn 0 ; }if (size >XC_PAGE_SIZE -NET_IP_ALIGN ) { -xen_be_printf (&netdev->xendev,0 ,"packet too big (%lu > %ld)" , +xen_pv_printf (&netdev->xendev,0 ,"packet too big (%lu > %ld)" , (unsigned long )size,XC_PAGE_SIZE -NET_IP_ALIGN );return -1 ; }
@@ -258,7 +258,7 @@ static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size netdev->xendev.dom, rxreq.gref, PROT_WRITE);if (page ==NULL ) { -xen_be_printf (&netdev->xendev,0 , +xen_pv_printf (&netdev->xendev,0 ,"error: rx gref dereference failed (%d)\n" , rxreq.gref);net_rx_response (netdev, &rxreq,NETIF_RSP_ERROR ,0 ,0 ,0 );
@@ -333,7 +333,7 @@ static int net_connect(struct XenDevice *xendev) rx_copy =0 ; }if (rx_copy ==0 ) { -xen_be_printf (&netdev->xendev,0 , +xen_pv_printf (&netdev->xendev,0 ,"frontend doesn't support rx-copy.\n" );return -1 ; }
@@ -359,7 +359,7 @@ static int net_connect(struct XenDevice *xendev)xen_be_bind_evtchn (&netdev->xendev); -xen_be_printf (&netdev->xendev,1 ,"ok: tx-ring-ref %d, rx-ring-ref %d, " +xen_pv_printf (&netdev->xendev,1 ,"ok: tx-ring-ref %d, rx-ring-ref %d, " "remote port %d, local port %d\n" , netdev->tx_ring_ref, netdev->rx_ring_ref, netdev->xendev.remote_port, netdev->xendev.local_port);
hw/usb/xen-usb.c +19 -19
@@ -47,7 +47,7 @@struct timeval tv; \ \gettimeofday (&tv,NULL ); \ -xen_be_printf (xendev, lvl,"%8ld.%06ld xen-usb(%s):" fmt, \ +xen_pv_printf (xendev, lvl,"%8ld.%06ld xen-usb(%s):" fmt, \ tv.tv_sec, tv.tv_usec, __func__, ##args); \ } #define TR_BUS(xendev, fmt, args...) TR(xendev, 2, fmt, ##args)
@@ -153,7 +153,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req) }if (nr_segs >USBIF_MAX_SEGMENTS_PER_REQUEST ) { -xen_be_printf (xendev,0 ,"bad number of segments in request (%d)\n" , +xen_pv_printf (xendev,0 ,"bad number of segments in request (%d)\n" , nr_segs);return -EINVAL ; }
@@ -161,7 +161,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req)for (i =0 ; i < nr_segs; i++) {if ((unsigned )usbback_req->req.seg[i].offset + (unsigned )usbback_req->req.seg[i].length >XC_PAGE_SIZE ) { -xen_be_printf (xendev,0 ,"segment crosses page boundary\n" ); +xen_pv_printf (xendev,0 ,"segment crosses page boundary\n" );return -EINVAL ; } }
@@ -199,7 +199,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req)*/ if (!usbback_req->nr_extra_segs) { -xen_be_printf (xendev,0 ,"iso request without descriptor segments\n" ); +xen_pv_printf (xendev,0 ,"iso request without descriptor segments\n" );return -EINVAL ; }
@@ -551,14 +551,14 @@ static void usbback_dispatch(struct usbback_req *usbback_req) ret =usbback_init_packet (usbback_req);if (ret) { -xen_be_printf (&usbif->xendev,0 ,"invalid request\n" ); +xen_pv_printf (&usbif->xendev,0 ,"invalid request\n" ); ret = -ESHUTDOWN ; goto fail_free_urb; } ret =usbback_gnttab_map (usbback_req);if (ret) { -xen_be_printf (&usbif->xendev,0 ,"invalid buffer, ret=%d\n" , ret); +xen_pv_printf (&usbif->xendev,0 ,"invalid buffer, ret=%d\n" , ret); ret = -ESHUTDOWN ; goto fail_free_urb; }
@@ -646,7 +646,7 @@ static void usbback_bh(void *opaque)if (RING_REQUEST_PROD_OVERFLOW (urb_ring, rp)) { rc = urb_ring->rsp_prod_pvt; -xen_be_printf (&usbif->xendev,0 ,"domU provided bogus ring requests " +xen_pv_printf (&usbif->xendev,0 ,"domU provided bogus ring requests " "(%#x - %#x = %u). Halting ring processing.\n" , rp, rc, rp - rc); usbif->ring_error = true;
@@ -744,7 +744,7 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port, portname =strchr (busid,'-' );if (!portname) { -xen_be_printf (&usbif->xendev,0 ,"device %s illegal specification\n" , +xen_pv_printf (&usbif->xendev,0 ,"device %s illegal specification\n" , busid);return ; }
@@ -783,7 +783,7 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port,break ; }if (speed ==USBIF_SPEED_NONE ) { -xen_be_printf (&usbif->xendev,0 ,"device %s wrong speed\n" , busid); +xen_pv_printf (&usbif->xendev,0 ,"device %s wrong speed\n" , busid);object_unparent (OBJECT (usbif->ports[port -1 ].dev)); usbif->ports[port -1 ].dev =NULL ;return ;
@@ -800,7 +800,7 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port, err:QDECREF (qdict);snprintf (p->path,sizeof (p->path),"%d" ,99 ); -xen_be_printf (&usbif->xendev,0 ,"device %s could not be opened\n" , busid); +xen_pv_printf (&usbif->xendev,0 ,"device %s could not be opened\n" , busid); }static void usbback_process_port (struct usbback_info *usbif,unsigned port)
@@ -811,7 +811,7 @@ static void usbback_process_port(struct usbback_info *usbif, unsigned port)snprintf (node,sizeof (node),"port/%d" , port); busid =xenstore_read_be_str (&usbif->xendev, node);if (busid ==NULL ) { -xen_be_printf (&usbif->xendev,0 ,"xenstore_read %s failed\n" , node); +xen_pv_printf (&usbif->xendev,0 ,"xenstore_read %s failed\n" , node);return ; }
@@ -868,15 +868,15 @@ static int usbback_connect(struct XenDevice *xendev) usbif = container_of(xendev, struct usbback_info, xendev);if (xenstore_read_fe_int (xendev,"urb-ring-ref" , &urb_ring_ref)) { -xen_be_printf (xendev,0 ,"error reading urb-ring-ref\n" ); +xen_pv_printf (xendev,0 ,"error reading urb-ring-ref\n" );return -1 ; }if (xenstore_read_fe_int (xendev,"conn-ring-ref" , &conn_ring_ref)) { -xen_be_printf (xendev,0 ,"error reading conn-ring-ref\n" ); +xen_pv_printf (xendev,0 ,"error reading conn-ring-ref\n" );return -1 ; }if (xenstore_read_fe_int (xendev,"event-channel" , &xendev->remote_port)) { -xen_be_printf (xendev,0 ,"error reading event-channel\n" ); +xen_pv_printf (xendev,0 ,"error reading event-channel\n" );return -1 ; }
@@ -887,7 +887,7 @@ static int usbback_connect(struct XenDevice *xendev) conn_ring_ref, PROT_READ | PROT_WRITE);if (!usbif->urb_sring || !usbif->conn_sring) { -xen_be_printf (xendev,0 ,"error mapping rings\n" ); +xen_pv_printf (xendev,0 ,"error mapping rings\n" );usbback_disconnect (xendev);return -1 ; }
@@ -899,7 +899,7 @@ static int usbback_connect(struct XenDevice *xendev)xen_be_bind_evtchn (xendev); -xen_be_printf (xendev,1 ,"urb-ring-ref %d, conn-ring-ref %d, " +xen_pv_printf (xendev,1 ,"urb-ring-ref %d, conn-ring-ref %d, " "remote port %d, local port %d\n" , urb_ring_ref, conn_ring_ref, xendev->remote_port, xendev->local_port);
@@ -935,12 +935,12 @@ static int usbback_init(struct XenDevice *xendev)if (xenstore_read_be_int (xendev,"num-ports" , &usbif->num_ports) || usbif->num_ports <1 || usbif->num_ports >USBBACK_MAXPORTS ) { -xen_be_printf (xendev,0 ,"num-ports not readable or out of bounds\n" ); +xen_pv_printf (xendev,0 ,"num-ports not readable or out of bounds\n" );return -1 ; }if (xenstore_read_be_int (xendev,"usb-ver" , &usbif->usb_ver) || (usbif->usb_ver !=USB_VER_USB11 && usbif->usb_ver !=USB_VER_USB20 )) { -xen_be_printf (xendev,0 ,"usb-ver not readable or out of bounds\n" ); +xen_pv_printf (xendev,0 ,"usb-ver not readable or out of bounds\n" );return -1 ; }
@@ -1028,7 +1028,7 @@ static void usbback_alloc(struct XenDevice *xendev)/* max_grants: for each request and for the rings (request and connect). */ max_grants =USBIF_MAX_SEGMENTS_PER_REQUEST *USB_URB_RING_SIZE +2 ;if (xengnttab_set_max_grants (xendev->gnttabdev, max_grants) <0 ) { -xen_be_printf (xendev,0 ,"xengnttab_set_max_grants failed: %s\n" , +xen_pv_printf (xendev,0 ,"xengnttab_set_max_grants failed: %s\n" ,strerror (errno)); } }
hw/xen/xen_backend.c +23 -23
167 lines not on this page · raw message
hw/xen/xen_devconfig.c +2 -2
@@ -55,7 +55,7 @@ int xen_config_dev_blk(DriveInfo *disk)const char *filename =qemu_opt_get (disk->opts,"file" );snprintf (device_name,sizeof (device_name),"xvd%c" ,'a' + disk->unit); -xen_be_printf (NULL ,1 ,"config disk %d [%s]: %s\n" , +xen_pv_printf (NULL ,1 ,"config disk %d [%s]: %s\n" , disk->unit, device_name, filename);xen_config_dev_dirs ("vbd" ,"qdisk" , vdev, fe, be,sizeof (fe));
@@ -83,7 +83,7 @@ int xen_config_dev_nic(NICInfo *nic)snprintf (mac,sizeof (mac),"%02x:%02x:%02x:%02x:%02x:%02x" , nic->macaddr.a[0 ], nic->macaddr.a[1 ], nic->macaddr.a[2 ], nic->macaddr.a[3 ], nic->macaddr.a[4 ], nic->macaddr.a[5 ]); -xen_be_printf (NULL ,1 ,"config nic %d: mac=\"%s\"\n" , vlan_id, mac); +xen_pv_printf (NULL ,1 ,"config nic %d: mac=\"%s\"\n" , vlan_id, mac);xen_config_dev_dirs ("vif" ,"qnic" , vlan_id, fe, be,sizeof (fe));/* frontend */
hw/xen/xen_pvdev.c +5 -5
@@ -68,13 +68,13 @@ int xenstore_mkdir(char *path, int p) };if (!xs_mkdir (xenstore,0 , path)) { -xen_be_printf (NULL ,0 ,"xs_mkdir %s: failed\n" , path); +xen_pv_printf (NULL ,0 ,"xs_mkdir %s: failed\n" , path);return -1 ; }xenstore_cleanup_dir (g_strdup (path));if (!xs_set_permissions (xenstore,0 , path, perms,2 )) { -xen_be_printf (NULL ,0 ,"xs_set_permissions %s: failed\n" , path); +xen_pv_printf (NULL ,0 ,"xs_set_permissions %s: failed\n" , path);return -1 ; }return 0 ;
@@ -194,7 +194,7 @@ const char *xenbus_strstate(enum xenbus_state state)* 2 == noisy debug messages (logfile only). * 3 == will flood your log (logfile only). */ -void xen_be_printf (struct XenDevice *xendev,int msg_level, +void xen_pv_printf (struct XenDevice *xendev,int msg_level,const char *fmt, ...) {va_list args;
@@ -234,7 +234,7 @@ void xen_be_evtchn_event(void *opaque) port =xenevtchn_pending (xendev->evtchndev);if (port != xendev->local_port) { -xen_be_printf (xendev,0 , +xen_pv_printf (xendev,0 ,"xenevtchn_pending returned %d (expected %d)\n" , port, xendev->local_port);return ;
@@ -253,7 +253,7 @@ void xen_be_unbind_evtchn(struct XenDevice *xendev) }qemu_set_fd_handler (xenevtchn_fd (xendev->evtchndev),NULL ,NULL ,NULL );xenevtchn_unbind (xendev->evtchndev, xendev->local_port); -xen_be_printf (xendev,2 ,"unbind evtchn port %d\n" , xendev->local_port); +xen_pv_printf (xendev,2 ,"unbind evtchn port %d\n" , xendev->local_port); xendev->local_port =-1 ; }
include/hw/xen/xen_pvdev.h +1 -1
@@ -72,7 +72,7 @@ struct XenDevice *xen_be_find_xendev(const char *type, int dom, int dev);void xen_be_unbind_evtchn (struct XenDevice *xendev);int xen_be_send_notify (struct XenDevice *xendev); -void xen_be_printf(struct XenDevice *xendev, int msg_level, +void xen_pv_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ...) GCC_FMT_ATTR(3, 4);#endif /* QEMU_HW_XEN_PVDEV_H */
xen-common.c +2 -2
@@ -116,12 +116,12 @@ static int xen_init(MachineState *ms) { xen_xc =xc_interface_open (0 ,0 ,0 );if (xen_xc ==NULL ) { -xen_be_printf (NULL ,0 ,"can't open xen interface\n" ); +xen_pv_printf (NULL ,0 ,"can't open xen interface\n" );return -1 ; } xen_fmem =xenforeignmemory_open (0 ,0 );if (xen_fmem ==NULL ) { -xen_be_printf (NULL ,0 ,"can't open xen fmem interface\n" ); +xen_pv_printf (NULL ,0 ,"can't open xen fmem interface\n" );xc_interface_close (xen_xc);return -1 ; }
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 9/13 xen: Rename xen_be_unbind_evtchn
In reply to Emil CondreaPrepare xen_be_unbind_evtchn to be shared with frontends:
* xen_be_unbind_evtchn -> xen_pv_unbind_evtchn
--- hw/block/xen_disk.c | 2 +- hw/char/xen_console.c | 2 +- hw/display/xenfb.c | 2 +- hw/net/xen_nic.c | 2 +- hw/usb/xen-usb.c | 2 +- hw/xen/xen_pvdev.c | 2 +- include/hw/xen/xen_pvdev.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-)
hw/block/xen_disk.c +1 -1
@@ -1194,7 +1194,7 @@ static void blk_disconnect(struct XenDevice *xendev)blk_unref (blkdev->blk); blkdev->blk =NULL ; } -xen_be_unbind_evtchn (&blkdev->xendev); +xen_pv_unbind_evtchn (&blkdev->xendev);if (blkdev->sring) {xengnttab_unmap (blkdev->xendev.gnttabdev, blkdev->sring,1 );
hw/char/xen_console.c +1 -1
@@ -262,7 +262,7 @@ static void con_disconnect(struct XenDevice *xendev) struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);qemu_chr_fe_deinit (&con->chr); -xen_be_unbind_evtchn (&con->xendev); +xen_pv_unbind_evtchn (&con->xendev);if (con->sring) {if (!xendev->dev) {
hw/display/xenfb.c +1 -1
@@ -112,7 +112,7 @@ static int common_bind(struct common *c)static void common_unbind (struct common *c) { -xen_be_unbind_evtchn (&c->xendev); +xen_pv_unbind_evtchn (&c->xendev);if (c->page) {xenforeignmemory_unmap (xen_fmem, c->page,1 ); c->page =NULL ;
hw/net/xen_nic.c +1 -1
@@ -372,7 +372,7 @@ static void net_disconnect(struct XenDevice *xendev) { struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev); -xen_be_unbind_evtchn (&netdev->xendev); +xen_pv_unbind_evtchn (&netdev->xendev);if (netdev->txs) {xengnttab_unmap (netdev->xendev.gnttabdev, netdev->txs,1 );
hw/usb/xen-usb.c +1 -1
@@ -834,7 +834,7 @@ static void usbback_disconnect(struct XenDevice *xendev) usbif = container_of(xendev, struct usbback_info, xendev); -xen_be_unbind_evtchn (xendev); +xen_pv_unbind_evtchn (xendev);if (usbif->urb_sring) {xengnttab_unmap (xendev->gnttabdev, usbif->urb_sring,1 );
hw/xen/xen_pvdev.c +1 -1
@@ -246,7 +246,7 @@ void xen_be_evtchn_event(void *opaque) } } -void xen_be_unbind_evtchn (struct XenDevice *xendev) +void xen_pv_unbind_evtchn (struct XenDevice *xendev) {if (xendev->local_port ==-1 ) {return ;
include/hw/xen/xen_pvdev.h +1 -1
@@ -69,7 +69,7 @@ void xen_pv_insert_xendev(struct XenDevice *xendev);void xen_be_del_xendev (struct XenDevice *xendev);struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev); -void xen_be_unbind_evtchn (struct XenDevice *xendev); +void xen_pv_unbind_evtchn (struct XenDevice *xendev);int xen_be_send_notify (struct XenDevice *xendev); void xen_pv_printf(struct XenDevice *xendev, int msg_level,
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 10/13 xen: Rename xen_be_send_notify
In reply to Emil CondreaPrepare xen_be_send_notify to be shared with frontends:
* xen_be_send_notify -> xen_pv_send_notify
--- hw/block/xen_disk.c | 4 ++-- hw/char/xen_console.c | 4 ++-- hw/display/xenfb.c | 8 ++++---- hw/net/xen_nic.c | 4 ++-- hw/usb/xen-usb.c | 6 +++--- hw/xen/xen_pvdev.c | 2 +- include/hw/xen/xen_pvdev.h | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-)
hw/block/xen_disk.c +2 -2
@@ -796,7 +796,7 @@ static void blk_send_response_all(struct XenBlkDev *blkdev)ioreq_release (ioreq, true); }if (send_notify) { -xen_be_send_notify (&blkdev->xendev); +xen_pv_send_notify (&blkdev->xendev); } }
@@ -866,7 +866,7 @@ static void blk_handle_requests(struct XenBlkDev *blkdev) };if (blk_send_response_one (ioreq)) { -xen_be_send_notify (&blkdev->xendev); +xen_pv_send_notify (&blkdev->xendev); }ioreq_release (ioreq, false);continue ;
hw/char/xen_console.c +2 -2
@@ -74,7 +74,7 @@ static void buffer_append(struct XenConsole *con)xen_mb (); intf->out_cons = cons; -xen_be_send_notify (&con->xendev); +xen_pv_send_notify (&con->xendev);if (buffer->max_capacity && buffer->size > buffer->max_capacity) {
@@ -142,7 +142,7 @@ static void xencons_receive(void *opaque, const uint8_t *buf, int len) }xen_wmb (); intf->in_prod = prod; -xen_be_send_notify (&con->xendev); +xen_pv_send_notify (&con->xendev); }static void xencons_send (struct XenConsole *con)
hw/display/xenfb.c +4 -4
@@ -215,7 +215,7 @@ static int xenfb_kbd_event(struct XenInput *xenfb,XENKBD_IN_RING_REF (page, prod) = *event;xen_wmb ();/* ensure ring contents visible */ page->in_prod = prod +1 ; -return xen_be_send_notify (&xenfb->c.xendev); +return xen_pv_send_notify (&xenfb->c.xendev); }/* Send a keyboard (or mouse button) event */
@@ -397,7 +397,7 @@ static void input_event(struct XenDevice *xendev)if (page->out_prod == page->out_cons)return ; page->out_cons = page->out_prod; -xen_be_send_notify (&xenfb->c.xendev); +xen_pv_send_notify (&xenfb->c.xendev); }/* -------------------------------------------------------------------- */
@@ -672,7 +672,7 @@ static void xenfb_send_event(struct XenFB *xenfb, union xenfb_in_event *event)xen_wmb ();/* ensure ring contents visible */ page->in_prod = prod +1 ; -xen_be_send_notify (&xenfb->c.xendev); +xen_pv_send_notify (&xenfb->c.xendev); }static void xenfb_send_refresh_period (struct XenFB *xenfb,int period)
@@ -945,7 +945,7 @@ static void fb_event(struct XenDevice *xendev) struct XenFB *xenfb = container_of(xendev, struct XenFB, c.xendev);xenfb_handle_events (xenfb); -xen_be_send_notify (&xenfb->c.xendev); +xen_pv_send_notify (&xenfb->c.xendev); }/* -------------------------------------------------------------------- */
hw/net/xen_nic.c +2 -2
@@ -69,7 +69,7 @@ static void net_tx_response(struct XenNetDev *netdev, netif_tx_request_t *txp, i netdev->tx_ring.rsp_prod_pvt = ++i;RING_PUSH_RESPONSES_AND_CHECK_NOTIFY (&netdev->tx_ring, notify);if (notify) { -xen_be_send_notify (&netdev->xendev); +xen_pv_send_notify (&netdev->xendev); }if (i == netdev->tx_ring.req_cons) {
@@ -221,7 +221,7 @@ static void net_rx_response(struct XenNetDev *netdev, netdev->rx_ring.rsp_prod_pvt = ++i;RING_PUSH_RESPONSES_AND_CHECK_NOTIFY (&netdev->rx_ring, notify);if (notify) { -xen_be_send_notify (&netdev->xendev); +xen_pv_send_notify (&netdev->xendev); } }
hw/usb/xen-usb.c +3 -3
@@ -314,7 +314,7 @@ static void usbback_do_response(struct usbback_req *usbback_req, int32_t status,RING_PUSH_RESPONSES_AND_CHECK_NOTIFY (&usbif->urb_ring, notify);if (notify) { -xen_be_send_notify (xendev); +xen_pv_send_notify (xendev); } }
@@ -590,7 +590,7 @@ static void usbback_hotplug_notify(struct usbback_info *usbif)/* Check for full ring. */ if ((RING_SIZE (ring) - ring->rsp_prod_pvt - ring->req_cons) ==0 ) { -xen_be_send_notify (&usbif->xendev); +xen_pv_send_notify (&usbif->xendev);return ; }
@@ -609,7 +609,7 @@ static void usbback_hotplug_notify(struct usbback_info *usbif)RING_PUSH_RESPONSES_AND_CHECK_NOTIFY (ring, notify);if (notify) { -xen_be_send_notify (&usbif->xendev); +xen_pv_send_notify (&usbif->xendev); } TR_BUS(&usbif->xendev, "hotplug port %d speed %d\n", usb_hp->port,
hw/xen/xen_pvdev.c +1 -1
@@ -257,7 +257,7 @@ void xen_pv_unbind_evtchn(struct XenDevice *xendev) xendev->local_port =-1 ; } -int xen_be_send_notify (struct XenDevice *xendev) +int xen_pv_send_notify (struct XenDevice *xendev) {return xenevtchn_notify (xendev->evtchndev, xendev->local_port); }
include/hw/xen/xen_pvdev.h +1 -1
@@ -70,7 +70,7 @@ void xen_be_del_xendev(struct XenDevice *xendev);struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev);void xen_pv_unbind_evtchn (struct XenDevice *xendev); -int xen_be_send_notify (struct XenDevice *xendev); +int xen_pv_send_notify (struct XenDevice *xendev); void xen_pv_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ...) GCC_FMT_ATTR(3, 4);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 11/13 xen: Rename xen_be_evtchn_event
In reply to Emil CondreaPrepare xen_be_evtchn_event to be shared with frontends:
* xen_be_evtchn_event -> xen_pv_evtchn_event
--- hw/xen/xen_backend.c | 2 +- hw/xen/xen_pvdev.c | 2 +- include/hw/xen/xen_pvdev.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
hw/xen/xen_backend.c +1 -1
@@ -581,7 +581,7 @@ int xen_be_bind_evtchn(struct XenDevice *xendev) }xen_pv_printf (xendev,2 ,"bind evtchn port %d\n" , xendev->local_port);qemu_set_fd_handler (xenevtchn_fd (xendev->evtchndev), - xen_be_evtchn_event,NULL , xendev); + xen_pv_evtchn_event,NULL , xendev);return 0 ; }
hw/xen/xen_pvdev.c +1 -1
@@ -227,7 +227,7 @@ void xen_pv_printf(struct XenDevice *xendev, int msg_level,qemu_log_flush (); } -void xen_be_evtchn_event (void *opaque) +void xen_pv_evtchn_event (void *opaque) {struct XenDevice *xendev = opaque;evtchn_port_t port;
include/hw/xen/xen_pvdev.h +1 -1
@@ -64,7 +64,7 @@ void xenstore_update(void *unused);const char *xenbus_strstate (enum xenbus_state state); -void xen_be_evtchn_event (void *opaque); +void xen_pv_evtchn_event (void *opaque);void xen_pv_insert_xendev (struct XenDevice *xendev);void xen_be_del_xendev (struct XenDevice *xendev);struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 12/13 xen: Rename xen_be_find_xendev
In reply to Emil CondreaPrepare xen_be_find_xendev to be shared with frontends:
* xen_be_find_xendev -> xen_pv_find_xendev
--- hw/display/xenfb.c | 4 ++-- hw/xen/xen_backend.c | 2 +- hw/xen/xen_pvdev.c | 2 +- include/hw/xen/xen_pvdev.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
hw/display/xenfb.c +2 -2
@@ -988,8 +988,8 @@ void xen_init_display(int domid) wait_more: i++;main_loop_wait (true); - xfb =xen_be_find_xendev ("vfb" , domid,0 ); - xin =xen_be_find_xendev ("vkbd" , domid,0 ); + xfb =xen_pv_find_xendev ("vfb" , domid,0 ); + xin =xen_pv_find_xendev ("vkbd" , domid,0 );if (!xfb || !xin) {if (i <256 ) {usleep (10000 );
hw/xen/xen_backend.c +1 -1
@@ -114,7 +114,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev, {struct XenDevice *xendev; - xendev =xen_be_find_xendev (type, dom, dev); + xendev =xen_pv_find_xendev (type, dom, dev);if (xendev) {return xendev; }
hw/xen/xen_pvdev.c +1 -1
@@ -264,7 +264,7 @@ int xen_pv_send_notify(struct XenDevice *xendev)/* ------------------------------------------------------------- */ -struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev) +struct XenDevice *xen_pv_find_xendev (const char *type,int dom,int dev) {struct XenDevice *xendev;
include/hw/xen/xen_pvdev.h +1 -1
@@ -67,7 +67,7 @@ const char *xenbus_strstate(enum xenbus_state state);void xen_pv_evtchn_event (void *opaque);void xen_pv_insert_xendev (struct XenDevice *xendev);void xen_be_del_xendev (struct XenDevice *xendev); -struct XenDevice *xen_be_find_xendev (const char *type,int dom,int dev); +struct XenDevice *xen_pv_find_xendev (const char *type,int dom,int dev);void xen_pv_unbind_evtchn (struct XenDevice *xendev);int xen_pv_send_notify (struct XenDevice *xendev);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 13/13 xen: Rename xen_be_del_xendev
In reply to Emil CondreaPrepare xen_be_del_xendev to be shared with frontends:
* xen_be_del_xendev -> xen_pv_del_xendev
--- hw/xen/xen_backend.c | 2 +- hw/xen/xen_pvdev.c | 2 +- include/hw/xen/xen_pvdev.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
hw/xen/xen_backend.c +1 -1
@@ -483,7 +483,7 @@ void xenstore_update_be(char *watch, char *type, int dom,if (xendev !=NULL ) { bepath =xs_read (xenstore,0 , xendev->be, &len);if (bepath ==NULL ) { -xen_be_del_xendev (xendev); +xen_pv_del_xendev (xendev); }else {free (bepath);xen_be_backend_changed (xendev, path);
hw/xen/xen_pvdev.c +1 -1
@@ -286,7 +286,7 @@ struct XenDevice *xen_pv_find_xendev(const char *type, int dom, int dev)/* * release xen backend device. */ -void xen_be_del_xendev (struct XenDevice *xendev) +void xen_pv_del_xendev (struct XenDevice *xendev) {if (xendev->ops->free) { xendev->ops->free (xendev);
include/hw/xen/xen_pvdev.h +1 -1
@@ -66,7 +66,7 @@ const char *xenbus_strstate(enum xenbus_state state);void xen_pv_evtchn_event (void *opaque);void xen_pv_insert_xendev (struct XenDevice *xendev); -void xen_be_del_xendev (struct XenDevice *xendev); +void xen_pv_del_xendev (struct XenDevice *xendev);struct XenDevice *xen_pv_find_xendev (const char *type,int dom,int dev);void xen_pv_unbind_evtchn (struct XenDevice *xendev);
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 6 lines · Emil Condrea
This patch series was splitted from QEMU:Xen stubdom vTPM for HVM virtual machine
http://markmail.org/message/fkix7g3a5zdj7lvrIt contains a reorganization of xen backend and frontend functions together with code style fixes.
Common functions shared by backends and frontends are moved toxen_pvdevfile.
For the all series:
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 6 lines · Emil Condrea
This patch series was splitted from QEMU:Xen stubdom vTPM for HVM virtual machine
http://markmail.org/message/fkix7g3a5zdj7lvrIt contains a reorganization of xen backend and frontend functions together with code style fixes.
Common functions shared by backends and frontends are moved toxen_pvdevfile.
For the all series:
Thanks,
Signature · 1 line
Anthony PERARD