Message ID | alpine.DEB.2.00.1007211441300.22235@kaball-desktop |
---|---|
State | New |
Headers | show |
Any comments? On Wed, 21 Jul 2010, Stefano Stabellini wrote: > From: John Haxby <john.haxby@oracle.com> > > Introduce a new 'connected' xendev op called when Connected. > > Rename the existing xendev 'connect' op to 'initialised' and introduce > a new 'connected' op. This new op, if defined, is called when the > backend is connected. Note that since there is no state transition this > may be called more than once. > > Signed-off-by: John Haxby <john.haxby@oracle.com> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > > diff --git a/hw/xen_backend.c b/hw/xen_backend.c > index a2e408f..b99055a 100644 > --- a/hw/xen_backend.c > +++ b/hw/xen_backend.c > @@ -400,13 +400,13 @@ static int xen_be_try_init(struct XenDevice *xendev) > } > > /* > - * Try to connect xendev. Depends on the frontend being ready > + * Try to initialise xendev. Depends on the frontend being ready > * for it (shared ring and evtchn info in xenstore, state being > * Initialised or Connected). > * > * Goes to Connected on success. > */ > -static int xen_be_try_connect(struct XenDevice *xendev) > +static int xen_be_try_initialise(struct XenDevice *xendev) > { > int rc = 0; > > @@ -420,10 +420,10 @@ static int xen_be_try_connect(struct XenDevice *xendev) > } > } > > - if (xendev->ops->connect) > - rc = xendev->ops->connect(xendev); > + if (xendev->ops->initialise) > + rc = xendev->ops->initialise(xendev); > if (rc != 0) { > - xen_be_printf(xendev, 0, "connect() failed\n"); > + xen_be_printf(xendev, 0, "initialise() failed\n"); > return rc; > } > > @@ -432,6 +432,28 @@ static int xen_be_try_connect(struct XenDevice *xendev) > } > > /* > + * Try to let xendev know that it is connected. Depends on the > + * frontend being Connected. Note that this may be called more > + * than once since the backend state is not modified. > + */ > +static void xen_be_try_connected(struct XenDevice *xendev) > +{ > + if (!xendev->ops->connected) > + return; > + > + if (xendev->fe_state != XenbusStateConnected) { > + if (xendev->ops->flags & DEVOPS_FLAG_IGNORE_STATE) { > + xen_be_printf(xendev, 2, "frontend not ready, ignoring\n"); > + } else { > + xen_be_printf(xendev, 2, "frontend not ready (yet)\n"); > + return; > + } > + } > + > + xendev->ops->connected(xendev); > +} > + > +/* > * Teardown connection. > * > * Goes to Closed when done. > @@ -483,7 +505,12 @@ void xen_be_check_state(struct XenDevice *xendev) > rc = xen_be_try_init(xendev); > break; > case XenbusStateInitWait: > - rc = xen_be_try_connect(xendev); > + rc = xen_be_try_initialise(xendev); > + break; > + case XenbusStateConnected: > + /* xendev->be_state doesn't change */ > + xen_be_try_connected(xendev); > + rc = -1; > break; > case XenbusStateClosed: > rc = xen_be_try_reset(xendev); > diff --git a/hw/xen_backend.h b/hw/xen_backend.h > index cc25f9d..154922a 100644 > --- a/hw/xen_backend.h > +++ b/hw/xen_backend.h > @@ -23,7 +23,8 @@ struct XenDevOps { > uint32_t flags; > void (*alloc)(struct XenDevice *xendev); > int (*init)(struct XenDevice *xendev); > - int (*connect)(struct XenDevice *xendev); > + int (*initialise)(struct XenDevice *xendev); > + void (*connected)(struct XenDevice *xendev); > void (*event)(struct XenDevice *xendev); > void (*disconnect)(struct XenDevice *xendev); > int (*free)(struct XenDevice *xendev); > diff --git a/hw/xen_console.c b/hw/xen_console.c > index d2261f4..258c003 100644 > --- a/hw/xen_console.c > +++ b/hw/xen_console.c > @@ -202,7 +202,7 @@ static int con_init(struct XenDevice *xendev) > return 0; > } > > -static int con_connect(struct XenDevice *xendev) > +static int con_initialise(struct XenDevice *xendev) > { > struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); > int limit; > @@ -263,7 +263,7 @@ struct XenDevOps xen_console_ops = { > .size = sizeof(struct XenConsole), > .flags = DEVOPS_FLAG_IGNORE_STATE, > .init = con_init, > - .connect = con_connect, > + .initialise = con_initialise, > .event = con_event, > .disconnect = con_disconnect, > }; > diff --git a/hw/xenfb.c b/hw/xenfb.c > index da5297b..b535d8c 100644 > --- a/hw/xenfb.c > +++ b/hw/xenfb.c > @@ -359,7 +359,7 @@ static int input_init(struct XenDevice *xendev) > return 0; > } > > -static int input_connect(struct XenDevice *xendev) > +static int input_initialise(struct XenDevice *xendev) > { > struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); > int rc; > @@ -861,7 +861,7 @@ static int fb_init(struct XenDevice *xendev) > return 0; > } > > -static int fb_connect(struct XenDevice *xendev) > +static int fb_initialise(struct XenDevice *xendev) > { > struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev); > struct xenfb_page *fb_page; > @@ -955,7 +955,7 @@ static void fb_event(struct XenDevice *xendev) > struct XenDevOps xen_kbdmouse_ops = { > .size = sizeof(struct XenInput), > .init = input_init, > - .connect = input_connect, > + .initialise = input_initialise, > .disconnect = input_disconnect, > .event = input_event, > }; > @@ -963,7 +963,7 @@ struct XenDevOps xen_kbdmouse_ops = { > struct XenDevOps xen_framebuffer_ops = { > .size = sizeof(struct XenFB), > .init = fb_init, > - .connect = fb_connect, > + .initialise = fb_initialise, > .disconnect = fb_disconnect, > .event = fb_event, > .frontend_changed = fb_frontend_changed, >
Any reason why this (and its sister patch) were never picked up? jch On 27/07/10 15:54, Stefano Stabellini wrote: > Any comments? > > On Wed, 21 Jul 2010, Stefano Stabellini wrote: >> From: John Haxby<john.haxby@oracle.com> >> >> Introduce a new 'connected' xendev op called when Connected. >> >> Rename the existing xendev 'connect' op to 'initialised' and introduce >> a new 'connected' op. This new op, if defined, is called when the >> backend is connected. Note that since there is no state transition this >> may be called more than once. >> >> Signed-off-by: John Haxby<john.haxby@oracle.com> >> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com> >> >> >> diff --git a/hw/xen_backend.c b/hw/xen_backend.c >> index a2e408f..b99055a 100644 >> --- a/hw/xen_backend.c >> +++ b/hw/xen_backend.c >> @@ -400,13 +400,13 @@ static int xen_be_try_init(struct XenDevice *xendev) >> } >> >> /* >> - * Try to connect xendev. Depends on the frontend being ready >> + * Try to initialise xendev. Depends on the frontend being ready >> * for it (shared ring and evtchn info in xenstore, state being >> * Initialised or Connected). >> * >> * Goes to Connected on success. >> */ >> -static int xen_be_try_connect(struct XenDevice *xendev) >> +static int xen_be_try_initialise(struct XenDevice *xendev) >> { >> int rc = 0; >> >> @@ -420,10 +420,10 @@ static int xen_be_try_connect(struct XenDevice *xendev) >> } >> } >> >> - if (xendev->ops->connect) >> - rc = xendev->ops->connect(xendev); >> + if (xendev->ops->initialise) >> + rc = xendev->ops->initialise(xendev); >> if (rc != 0) { >> - xen_be_printf(xendev, 0, "connect() failed\n"); >> + xen_be_printf(xendev, 0, "initialise() failed\n"); >> return rc; >> } >> >> @@ -432,6 +432,28 @@ static int xen_be_try_connect(struct XenDevice *xendev) >> } >> >> /* >> + * Try to let xendev know that it is connected. Depends on the >> + * frontend being Connected. Note that this may be called more >> + * than once since the backend state is not modified. >> + */ >> +static void xen_be_try_connected(struct XenDevice *xendev) >> +{ >> + if (!xendev->ops->connected) >> + return; >> + >> + if (xendev->fe_state != XenbusStateConnected) { >> + if (xendev->ops->flags& DEVOPS_FLAG_IGNORE_STATE) { >> + xen_be_printf(xendev, 2, "frontend not ready, ignoring\n"); >> + } else { >> + xen_be_printf(xendev, 2, "frontend not ready (yet)\n"); >> + return; >> + } >> + } >> + >> + xendev->ops->connected(xendev); >> +} >> + >> +/* >> * Teardown connection. >> * >> * Goes to Closed when done. >> @@ -483,7 +505,12 @@ void xen_be_check_state(struct XenDevice *xendev) >> rc = xen_be_try_init(xendev); >> break; >> case XenbusStateInitWait: >> - rc = xen_be_try_connect(xendev); >> + rc = xen_be_try_initialise(xendev); >> + break; >> + case XenbusStateConnected: >> + /* xendev->be_state doesn't change */ >> + xen_be_try_connected(xendev); >> + rc = -1; >> break; >> case XenbusStateClosed: >> rc = xen_be_try_reset(xendev); >> diff --git a/hw/xen_backend.h b/hw/xen_backend.h >> index cc25f9d..154922a 100644 >> --- a/hw/xen_backend.h >> +++ b/hw/xen_backend.h >> @@ -23,7 +23,8 @@ struct XenDevOps { >> uint32_t flags; >> void (*alloc)(struct XenDevice *xendev); >> int (*init)(struct XenDevice *xendev); >> - int (*connect)(struct XenDevice *xendev); >> + int (*initialise)(struct XenDevice *xendev); >> + void (*connected)(struct XenDevice *xendev); >> void (*event)(struct XenDevice *xendev); >> void (*disconnect)(struct XenDevice *xendev); >> int (*free)(struct XenDevice *xendev); >> diff --git a/hw/xen_console.c b/hw/xen_console.c >> index d2261f4..258c003 100644 >> --- a/hw/xen_console.c >> +++ b/hw/xen_console.c >> @@ -202,7 +202,7 @@ static int con_init(struct XenDevice *xendev) >> return 0; >> } >> >> -static int con_connect(struct XenDevice *xendev) >> +static int con_initialise(struct XenDevice *xendev) >> { >> struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); >> int limit; >> @@ -263,7 +263,7 @@ struct XenDevOps xen_console_ops = { >> .size = sizeof(struct XenConsole), >> .flags = DEVOPS_FLAG_IGNORE_STATE, >> .init = con_init, >> - .connect = con_connect, >> + .initialise = con_initialise, >> .event = con_event, >> .disconnect = con_disconnect, >> }; >> diff --git a/hw/xenfb.c b/hw/xenfb.c >> index da5297b..b535d8c 100644 >> --- a/hw/xenfb.c >> +++ b/hw/xenfb.c >> @@ -359,7 +359,7 @@ static int input_init(struct XenDevice *xendev) >> return 0; >> } >> >> -static int input_connect(struct XenDevice *xendev) >> +static int input_initialise(struct XenDevice *xendev) >> { >> struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); >> int rc; >> @@ -861,7 +861,7 @@ static int fb_init(struct XenDevice *xendev) >> return 0; >> } >> >> -static int fb_connect(struct XenDevice *xendev) >> +static int fb_initialise(struct XenDevice *xendev) >> { >> struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev); >> struct xenfb_page *fb_page; >> @@ -955,7 +955,7 @@ static void fb_event(struct XenDevice *xendev) >> struct XenDevOps xen_kbdmouse_ops = { >> .size = sizeof(struct XenInput), >> .init = input_init, >> - .connect = input_connect, >> + .initialise = input_initialise, >> .disconnect = input_disconnect, >> .event = input_event, >> }; >> @@ -963,7 +963,7 @@ struct XenDevOps xen_kbdmouse_ops = { >> struct XenDevOps xen_framebuffer_ops = { >> .size = sizeof(struct XenFB), >> .init = fb_init, >> - .connect = fb_connect, >> + .initialise = fb_initialise, >> .disconnect = fb_disconnect, >> .event = fb_event, >> .frontend_changed = fb_frontend_changed, >>
On 08/23/2010 05:21 AM, John Haxby wrote: > Any reason why this (and its sister patch) were never picked up? > > jch It was likely missed originally because there wasn't a [PATCH] in the subject. Can you resubmit? It's not obvious to me what it's sister patch is so I'd suggest resubmitting that too. Regards, Anthony Liguori > > On 27/07/10 15:54, Stefano Stabellini wrote: >> Any comments? >> >> On Wed, 21 Jul 2010, Stefano Stabellini wrote: >>> From: John Haxby<john.haxby@oracle.com> >>> >>> Introduce a new 'connected' xendev op called when Connected. >>> >>> Rename the existing xendev 'connect' op to 'initialised' and introduce >>> a new 'connected' op. This new op, if defined, is called when the >>> backend is connected. Note that since there is no state transition >>> this >>> may be called more than once. >>> >>> Signed-off-by: John Haxby<john.haxby@oracle.com> >>> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com> >>> >>> >>> diff --git a/hw/xen_backend.c b/hw/xen_backend.c >>> index a2e408f..b99055a 100644 >>> --- a/hw/xen_backend.c >>> +++ b/hw/xen_backend.c >>> @@ -400,13 +400,13 @@ static int xen_be_try_init(struct XenDevice >>> *xendev) >>> } >>> >>> /* >>> - * Try to connect xendev. Depends on the frontend being ready >>> + * Try to initialise xendev. Depends on the frontend being ready >>> * for it (shared ring and evtchn info in xenstore, state being >>> * Initialised or Connected). >>> * >>> * Goes to Connected on success. >>> */ >>> -static int xen_be_try_connect(struct XenDevice *xendev) >>> +static int xen_be_try_initialise(struct XenDevice *xendev) >>> { >>> int rc = 0; >>> >>> @@ -420,10 +420,10 @@ static int xen_be_try_connect(struct XenDevice >>> *xendev) >>> } >>> } >>> >>> - if (xendev->ops->connect) >>> - rc = xendev->ops->connect(xendev); >>> + if (xendev->ops->initialise) >>> + rc = xendev->ops->initialise(xendev); >>> if (rc != 0) { >>> - xen_be_printf(xendev, 0, "connect() failed\n"); >>> + xen_be_printf(xendev, 0, "initialise() failed\n"); >>> return rc; >>> } >>> >>> @@ -432,6 +432,28 @@ static int xen_be_try_connect(struct XenDevice >>> *xendev) >>> } >>> >>> /* >>> + * Try to let xendev know that it is connected. Depends on the >>> + * frontend being Connected. Note that this may be called more >>> + * than once since the backend state is not modified. >>> + */ >>> +static void xen_be_try_connected(struct XenDevice *xendev) >>> +{ >>> + if (!xendev->ops->connected) >>> + return; >>> + >>> + if (xendev->fe_state != XenbusStateConnected) { >>> + if (xendev->ops->flags& DEVOPS_FLAG_IGNORE_STATE) { >>> + xen_be_printf(xendev, 2, "frontend not ready, ignoring\n"); >>> + } else { >>> + xen_be_printf(xendev, 2, "frontend not ready (yet)\n"); >>> + return; >>> + } >>> + } >>> + >>> + xendev->ops->connected(xendev); >>> +} >>> + >>> +/* >>> * Teardown connection. >>> * >>> * Goes to Closed when done. >>> @@ -483,7 +505,12 @@ void xen_be_check_state(struct XenDevice *xendev) >>> rc = xen_be_try_init(xendev); >>> break; >>> case XenbusStateInitWait: >>> - rc = xen_be_try_connect(xendev); >>> + rc = xen_be_try_initialise(xendev); >>> + break; >>> + case XenbusStateConnected: >>> + /* xendev->be_state doesn't change */ >>> + xen_be_try_connected(xendev); >>> + rc = -1; >>> break; >>> case XenbusStateClosed: >>> rc = xen_be_try_reset(xendev); >>> diff --git a/hw/xen_backend.h b/hw/xen_backend.h >>> index cc25f9d..154922a 100644 >>> --- a/hw/xen_backend.h >>> +++ b/hw/xen_backend.h >>> @@ -23,7 +23,8 @@ struct XenDevOps { >>> uint32_t flags; >>> void (*alloc)(struct XenDevice *xendev); >>> int (*init)(struct XenDevice *xendev); >>> - int (*connect)(struct XenDevice *xendev); >>> + int (*initialise)(struct XenDevice *xendev); >>> + void (*connected)(struct XenDevice *xendev); >>> void (*event)(struct XenDevice *xendev); >>> void (*disconnect)(struct XenDevice *xendev); >>> int (*free)(struct XenDevice *xendev); >>> diff --git a/hw/xen_console.c b/hw/xen_console.c >>> index d2261f4..258c003 100644 >>> --- a/hw/xen_console.c >>> +++ b/hw/xen_console.c >>> @@ -202,7 +202,7 @@ static int con_init(struct XenDevice *xendev) >>> return 0; >>> } >>> >>> -static int con_connect(struct XenDevice *xendev) >>> +static int con_initialise(struct XenDevice *xendev) >>> { >>> struct XenConsole *con = container_of(xendev, struct >>> XenConsole, xendev); >>> int limit; >>> @@ -263,7 +263,7 @@ struct XenDevOps xen_console_ops = { >>> .size = sizeof(struct XenConsole), >>> .flags = DEVOPS_FLAG_IGNORE_STATE, >>> .init = con_init, >>> - .connect = con_connect, >>> + .initialise = con_initialise, >>> .event = con_event, >>> .disconnect = con_disconnect, >>> }; >>> diff --git a/hw/xenfb.c b/hw/xenfb.c >>> index da5297b..b535d8c 100644 >>> --- a/hw/xenfb.c >>> +++ b/hw/xenfb.c >>> @@ -359,7 +359,7 @@ static int input_init(struct XenDevice *xendev) >>> return 0; >>> } >>> >>> -static int input_connect(struct XenDevice *xendev) >>> +static int input_initialise(struct XenDevice *xendev) >>> { >>> struct XenInput *in = container_of(xendev, struct XenInput, >>> c.xendev); >>> int rc; >>> @@ -861,7 +861,7 @@ static int fb_init(struct XenDevice *xendev) >>> return 0; >>> } >>> >>> -static int fb_connect(struct XenDevice *xendev) >>> +static int fb_initialise(struct XenDevice *xendev) >>> { >>> struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev); >>> struct xenfb_page *fb_page; >>> @@ -955,7 +955,7 @@ static void fb_event(struct XenDevice *xendev) >>> struct XenDevOps xen_kbdmouse_ops = { >>> .size = sizeof(struct XenInput), >>> .init = input_init, >>> - .connect = input_connect, >>> + .initialise = input_initialise, >>> .disconnect = input_disconnect, >>> .event = input_event, >>> }; >>> @@ -963,7 +963,7 @@ struct XenDevOps xen_kbdmouse_ops = { >>> struct XenDevOps xen_framebuffer_ops = { >>> .size = sizeof(struct XenFB), >>> .init = fb_init, >>> - .connect = fb_connect, >>> + .initialise = fb_initialise, >>> .disconnect = fb_disconnect, >>> .event = fb_event, >>> .frontend_changed = fb_frontend_changed, >>> > >
On Mon, 23 Aug 2010, Anthony Liguori wrote: > On 08/23/2010 05:21 AM, John Haxby wrote: > > Any reason why this (and its sister patch) were never picked up? > > > > jch > > It was likely missed originally because there wasn't a [PATCH] in the > subject. Can you resubmit? It's not obvious to me what it's sister > patch is so I'd suggest resubmitting that too. > done, thanks
I think I must be missing something. On 27th August, Stefano posted two messages whose subjects were [PATCH 1 of 2] Introduce a new 'connected' xendev op called when Connected. and [PATCH 2 of 2] Move the xenfb pointer handler to the connected method and I still don't see them. Are they one some branch other than master or staging? Or am I simply looking on the wrong place? (ie somewhere other than git://git.sv.gnu.org/qemu.git) jch On 23/08/10 13:23, Anthony Liguori wrote: > On 08/23/2010 05:21 AM, John Haxby wrote: >> Any reason why this (and its sister patch) were never picked up? >> >> jch > > It was likely missed originally because there wasn't a [PATCH] in the > subject. Can you resubmit? It's not obvious to me what it's sister > patch is so I'd suggest resubmitting that too. > > Regards, > > Anthony Liguori > >> >> On 27/07/10 15:54, Stefano Stabellini wrote: >>> Any comments? >>> >>> On Wed, 21 Jul 2010, Stefano Stabellini wrote: >>>> From: John Haxby<john.haxby@oracle.com> >>>> >>>> Introduce a new 'connected' xendev op called when Connected. >>>> >>>> Rename the existing xendev 'connect' op to 'initialised' and introduce >>>> a new 'connected' op. This new op, if defined, is called when the >>>> backend is connected. Note that since there is no state transition >>>> this >>>> may be called more than once. >>>> >>>> Signed-off-by: John Haxby<john.haxby@oracle.com> >>>> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com> >>>> >>>> >>>> diff --git a/hw/xen_backend.c b/hw/xen_backend.c >>>> index a2e408f..b99055a 100644 >>>> --- a/hw/xen_backend.c >>>> +++ b/hw/xen_backend.c >>>> @@ -400,13 +400,13 @@ static int xen_be_try_init(struct XenDevice >>>> *xendev) >>>> } >>>> >>>> /* >>>> - * Try to connect xendev. Depends on the frontend being ready >>>> + * Try to initialise xendev. Depends on the frontend being ready >>>> * for it (shared ring and evtchn info in xenstore, state being >>>> * Initialised or Connected). >>>> * >>>> * Goes to Connected on success. >>>> */ >>>> -static int xen_be_try_connect(struct XenDevice *xendev) >>>> +static int xen_be_try_initialise(struct XenDevice *xendev) >>>> { >>>> int rc = 0; >>>> >>>> @@ -420,10 +420,10 @@ static int xen_be_try_connect(struct >>>> XenDevice *xendev) >>>> } >>>> } >>>> >>>> - if (xendev->ops->connect) >>>> - rc = xendev->ops->connect(xendev); >>>> + if (xendev->ops->initialise) >>>> + rc = xendev->ops->initialise(xendev); >>>> if (rc != 0) { >>>> - xen_be_printf(xendev, 0, "connect() failed\n"); >>>> + xen_be_printf(xendev, 0, "initialise() failed\n"); >>>> return rc; >>>> } >>>> >>>> @@ -432,6 +432,28 @@ static int xen_be_try_connect(struct XenDevice >>>> *xendev) >>>> } >>>> >>>> /* >>>> + * Try to let xendev know that it is connected. Depends on the >>>> + * frontend being Connected. Note that this may be called more >>>> + * than once since the backend state is not modified. >>>> + */ >>>> +static void xen_be_try_connected(struct XenDevice *xendev) >>>> +{ >>>> + if (!xendev->ops->connected) >>>> + return; >>>> + >>>> + if (xendev->fe_state != XenbusStateConnected) { >>>> + if (xendev->ops->flags& DEVOPS_FLAG_IGNORE_STATE) { >>>> + xen_be_printf(xendev, 2, "frontend not ready, ignoring\n"); >>>> + } else { >>>> + xen_be_printf(xendev, 2, "frontend not ready (yet)\n"); >>>> + return; >>>> + } >>>> + } >>>> + >>>> + xendev->ops->connected(xendev); >>>> +} >>>> + >>>> +/* >>>> * Teardown connection. >>>> * >>>> * Goes to Closed when done. >>>> @@ -483,7 +505,12 @@ void xen_be_check_state(struct XenDevice *xendev) >>>> rc = xen_be_try_init(xendev); >>>> break; >>>> case XenbusStateInitWait: >>>> - rc = xen_be_try_connect(xendev); >>>> + rc = xen_be_try_initialise(xendev); >>>> + break; >>>> + case XenbusStateConnected: >>>> + /* xendev->be_state doesn't change */ >>>> + xen_be_try_connected(xendev); >>>> + rc = -1; >>>> break; >>>> case XenbusStateClosed: >>>> rc = xen_be_try_reset(xendev); >>>> diff --git a/hw/xen_backend.h b/hw/xen_backend.h >>>> index cc25f9d..154922a 100644 >>>> --- a/hw/xen_backend.h >>>> +++ b/hw/xen_backend.h >>>> @@ -23,7 +23,8 @@ struct XenDevOps { >>>> uint32_t flags; >>>> void (*alloc)(struct XenDevice *xendev); >>>> int (*init)(struct XenDevice *xendev); >>>> - int (*connect)(struct XenDevice *xendev); >>>> + int (*initialise)(struct XenDevice *xendev); >>>> + void (*connected)(struct XenDevice *xendev); >>>> void (*event)(struct XenDevice *xendev); >>>> void (*disconnect)(struct XenDevice *xendev); >>>> int (*free)(struct XenDevice *xendev); >>>> diff --git a/hw/xen_console.c b/hw/xen_console.c >>>> index d2261f4..258c003 100644 >>>> --- a/hw/xen_console.c >>>> +++ b/hw/xen_console.c >>>> @@ -202,7 +202,7 @@ static int con_init(struct XenDevice *xendev) >>>> return 0; >>>> } >>>> >>>> -static int con_connect(struct XenDevice *xendev) >>>> +static int con_initialise(struct XenDevice *xendev) >>>> { >>>> struct XenConsole *con = container_of(xendev, struct >>>> XenConsole, xendev); >>>> int limit; >>>> @@ -263,7 +263,7 @@ struct XenDevOps xen_console_ops = { >>>> .size = sizeof(struct XenConsole), >>>> .flags = DEVOPS_FLAG_IGNORE_STATE, >>>> .init = con_init, >>>> - .connect = con_connect, >>>> + .initialise = con_initialise, >>>> .event = con_event, >>>> .disconnect = con_disconnect, >>>> }; >>>> diff --git a/hw/xenfb.c b/hw/xenfb.c >>>> index da5297b..b535d8c 100644 >>>> --- a/hw/xenfb.c >>>> +++ b/hw/xenfb.c >>>> @@ -359,7 +359,7 @@ static int input_init(struct XenDevice *xendev) >>>> return 0; >>>> } >>>> >>>> -static int input_connect(struct XenDevice *xendev) >>>> +static int input_initialise(struct XenDevice *xendev) >>>> { >>>> struct XenInput *in = container_of(xendev, struct XenInput, >>>> c.xendev); >>>> int rc; >>>> @@ -861,7 +861,7 @@ static int fb_init(struct XenDevice *xendev) >>>> return 0; >>>> } >>>> >>>> -static int fb_connect(struct XenDevice *xendev) >>>> +static int fb_initialise(struct XenDevice *xendev) >>>> { >>>> struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev); >>>> struct xenfb_page *fb_page; >>>> @@ -955,7 +955,7 @@ static void fb_event(struct XenDevice *xendev) >>>> struct XenDevOps xen_kbdmouse_ops = { >>>> .size = sizeof(struct XenInput), >>>> .init = input_init, >>>> - .connect = input_connect, >>>> + .initialise = input_initialise, >>>> .disconnect = input_disconnect, >>>> .event = input_event, >>>> }; >>>> @@ -963,7 +963,7 @@ struct XenDevOps xen_kbdmouse_ops = { >>>> struct XenDevOps xen_framebuffer_ops = { >>>> .size = sizeof(struct XenFB), >>>> .init = fb_init, >>>> - .connect = fb_connect, >>>> + .initialise = fb_initialise, >>>> .disconnect = fb_disconnect, >>>> .event = fb_event, >>>> .frontend_changed = fb_frontend_changed, >>>> >> >> >
[The first time I sent this I didn't get a copy on qemu-devel which I was expecting. Sorry if this is actually a duplicate. I think I must be missing something. On 27th August, Stefano posted two messages whose subjects were [PATCH 1 of 2] Introduce a new 'connected' xendev op called when Connected. and [PATCH 2 of 2] Move the xenfb pointer handler to the connected method and I still don't see them. Are they one some branch other than master or staging? Or am I simply looking on the wrong place? (ie somewhere other than git://git.sv.gnu.org/qemu.git) jch On 23/08/10 13:23, Anthony Liguori wrote: > On 08/23/2010 05:21 AM, John Haxby wrote: >> Any reason why this (and its sister patch) were never picked up? >> >> jch > > It was likely missed originally because there wasn't a [PATCH] in the > subject. Can you resubmit? It's not obvious to me what it's sister > patch is so I'd suggest resubmitting that too. > > Regards, > > Anthony Liguori > >> >> On 27/07/10 15:54, Stefano Stabellini wrote: >>> Any comments? >>> >>> On Wed, 21 Jul 2010, Stefano Stabellini wrote: >>>> From: John Haxby<john.haxby@oracle.com> >>>> >>>> Introduce a new 'connected' xendev op called when Connected. >>>> >>>> Rename the existing xendev 'connect' op to 'initialised' and introduce >>>> a new 'connected' op. This new op, if defined, is called when the >>>> backend is connected. Note that since there is no state transition >>>> this >>>> may be called more than once. >>>> >>>> Signed-off-by: John Haxby<john.haxby@oracle.com> >>>> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com> >>>> >>>> >>>> diff --git a/hw/xen_backend.c b/hw/xen_backend.c >>>> index a2e408f..b99055a 100644 >>>> --- a/hw/xen_backend.c >>>> +++ b/hw/xen_backend.c >>>> @@ -400,13 +400,13 @@ static int xen_be_try_init(struct XenDevice >>>> *xendev) >>>> } >>>> >>>> /* >>>> - * Try to connect xendev. Depends on the frontend being ready >>>> + * Try to initialise xendev. Depends on the frontend being ready >>>> * for it (shared ring and evtchn info in xenstore, state being >>>> * Initialised or Connected). >>>> * >>>> * Goes to Connected on success. >>>> */ >>>> -static int xen_be_try_connect(struct XenDevice *xendev) >>>> +static int xen_be_try_initialise(struct XenDevice *xendev) >>>> { >>>> int rc = 0; >>>> >>>> @@ -420,10 +420,10 @@ static int xen_be_try_connect(struct >>>> XenDevice *xendev) >>>> } >>>> } >>>> >>>> - if (xendev->ops->connect) >>>> - rc = xendev->ops->connect(xendev); >>>> + if (xendev->ops->initialise) >>>> + rc = xendev->ops->initialise(xendev); >>>> if (rc != 0) { >>>> - xen_be_printf(xendev, 0, "connect() failed\n"); >>>> + xen_be_printf(xendev, 0, "initialise() failed\n"); >>>> return rc; >>>> } >>>> >>>> @@ -432,6 +432,28 @@ static int xen_be_try_connect(struct XenDevice >>>> *xendev) >>>> } >>>> >>>> /* >>>> + * Try to let xendev know that it is connected. Depends on the >>>> + * frontend being Connected. Note that this may be called more >>>> + * than once since the backend state is not modified. >>>> + */ >>>> +static void xen_be_try_connected(struct XenDevice *xendev) >>>> +{ >>>> + if (!xendev->ops->connected) >>>> + return; >>>> + >>>> + if (xendev->fe_state != XenbusStateConnected) { >>>> + if (xendev->ops->flags& DEVOPS_FLAG_IGNORE_STATE) { >>>> + xen_be_printf(xendev, 2, "frontend not ready, ignoring\n"); >>>> + } else { >>>> + xen_be_printf(xendev, 2, "frontend not ready (yet)\n"); >>>> + return; >>>> + } >>>> + } >>>> + >>>> + xendev->ops->connected(xendev); >>>> +} >>>> + >>>> +/* >>>> * Teardown connection. >>>> * >>>> * Goes to Closed when done. >>>> @@ -483,7 +505,12 @@ void xen_be_check_state(struct XenDevice *xendev) >>>> rc = xen_be_try_init(xendev); >>>> break; >>>> case XenbusStateInitWait: >>>> - rc = xen_be_try_connect(xendev); >>>> + rc = xen_be_try_initialise(xendev); >>>> + break; >>>> + case XenbusStateConnected: >>>> + /* xendev->be_state doesn't change */ >>>> + xen_be_try_connected(xendev); >>>> + rc = -1; >>>> break; >>>> case XenbusStateClosed: >>>> rc = xen_be_try_reset(xendev); >>>> diff --git a/hw/xen_backend.h b/hw/xen_backend.h >>>> index cc25f9d..154922a 100644 >>>> --- a/hw/xen_backend.h >>>> +++ b/hw/xen_backend.h >>>> @@ -23,7 +23,8 @@ struct XenDevOps { >>>> uint32_t flags; >>>> void (*alloc)(struct XenDevice *xendev); >>>> int (*init)(struct XenDevice *xendev); >>>> - int (*connect)(struct XenDevice *xendev); >>>> + int (*initialise)(struct XenDevice *xendev); >>>> + void (*connected)(struct XenDevice *xendev); >>>> void (*event)(struct XenDevice *xendev); >>>> void (*disconnect)(struct XenDevice *xendev); >>>> int (*free)(struct XenDevice *xendev); >>>> diff --git a/hw/xen_console.c b/hw/xen_console.c >>>> index d2261f4..258c003 100644 >>>> --- a/hw/xen_console.c >>>> +++ b/hw/xen_console.c >>>> @@ -202,7 +202,7 @@ static int con_init(struct XenDevice *xendev) >>>> return 0; >>>> } >>>> >>>> -static int con_connect(struct XenDevice *xendev) >>>> +static int con_initialise(struct XenDevice *xendev) >>>> { >>>> struct XenConsole *con = container_of(xendev, struct >>>> XenConsole, xendev); >>>> int limit; >>>> @@ -263,7 +263,7 @@ struct XenDevOps xen_console_ops = { >>>> .size = sizeof(struct XenConsole), >>>> .flags = DEVOPS_FLAG_IGNORE_STATE, >>>> .init = con_init, >>>> - .connect = con_connect, >>>> + .initialise = con_initialise, >>>> .event = con_event, >>>> .disconnect = con_disconnect, >>>> }; >>>> diff --git a/hw/xenfb.c b/hw/xenfb.c >>>> index da5297b..b535d8c 100644 >>>> --- a/hw/xenfb.c >>>> +++ b/hw/xenfb.c >>>> @@ -359,7 +359,7 @@ static int input_init(struct XenDevice *xendev) >>>> return 0; >>>> } >>>> >>>> -static int input_connect(struct XenDevice *xendev) >>>> +static int input_initialise(struct XenDevice *xendev) >>>> { >>>> struct XenInput *in = container_of(xendev, struct XenInput, >>>> c.xendev); >>>> int rc; >>>> @@ -861,7 +861,7 @@ static int fb_init(struct XenDevice *xendev) >>>> return 0; >>>> } >>>> >>>> -static int fb_connect(struct XenDevice *xendev) >>>> +static int fb_initialise(struct XenDevice *xendev) >>>> { >>>> struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev); >>>> struct xenfb_page *fb_page; >>>> @@ -955,7 +955,7 @@ static void fb_event(struct XenDevice *xendev) >>>> struct XenDevOps xen_kbdmouse_ops = { >>>> .size = sizeof(struct XenInput), >>>> .init = input_init, >>>> - .connect = input_connect, >>>> + .initialise = input_initialise, >>>> .disconnect = input_disconnect, >>>> .event = input_event, >>>> }; >>>> @@ -963,7 +963,7 @@ struct XenDevOps xen_kbdmouse_ops = { >>>> struct XenDevOps xen_framebuffer_ops = { >>>> .size = sizeof(struct XenFB), >>>> .init = fb_init, >>>> - .connect = fb_connect, >>>> + .initialise = fb_initialise, >>>> .disconnect = fb_disconnect, >>>> .event = fb_event, >>>> .frontend_changed = fb_frontend_changed, >>>> >> >> >
diff --git a/hw/xen_backend.c b/hw/xen_backend.c index a2e408f..b99055a 100644 --- a/hw/xen_backend.c +++ b/hw/xen_backend.c @@ -400,13 +400,13 @@ static int xen_be_try_init(struct XenDevice *xendev) } /* - * Try to connect xendev. Depends on the frontend being ready + * Try to initialise xendev. Depends on the frontend being ready * for it (shared ring and evtchn info in xenstore, state being * Initialised or Connected). * * Goes to Connected on success. */ -static int xen_be_try_connect(struct XenDevice *xendev) +static int xen_be_try_initialise(struct XenDevice *xendev) { int rc = 0; @@ -420,10 +420,10 @@ static int xen_be_try_connect(struct XenDevice *xendev) } } - if (xendev->ops->connect) - rc = xendev->ops->connect(xendev); + if (xendev->ops->initialise) + rc = xendev->ops->initialise(xendev); if (rc != 0) { - xen_be_printf(xendev, 0, "connect() failed\n"); + xen_be_printf(xendev, 0, "initialise() failed\n"); return rc; } @@ -432,6 +432,28 @@ static int xen_be_try_connect(struct XenDevice *xendev) } /* + * Try to let xendev know that it is connected. Depends on the + * frontend being Connected. Note that this may be called more + * than once since the backend state is not modified. + */ +static void xen_be_try_connected(struct XenDevice *xendev) +{ + if (!xendev->ops->connected) + return; + + if (xendev->fe_state != XenbusStateConnected) { + if (xendev->ops->flags & DEVOPS_FLAG_IGNORE_STATE) { + xen_be_printf(xendev, 2, "frontend not ready, ignoring\n"); + } else { + xen_be_printf(xendev, 2, "frontend not ready (yet)\n"); + return; + } + } + + xendev->ops->connected(xendev); +} + +/* * Teardown connection. * * Goes to Closed when done. @@ -483,7 +505,12 @@ void xen_be_check_state(struct XenDevice *xendev) rc = xen_be_try_init(xendev); break; case XenbusStateInitWait: - rc = xen_be_try_connect(xendev); + rc = xen_be_try_initialise(xendev); + break; + case XenbusStateConnected: + /* xendev->be_state doesn't change */ + xen_be_try_connected(xendev); + rc = -1; break; case XenbusStateClosed: rc = xen_be_try_reset(xendev); diff --git a/hw/xen_backend.h b/hw/xen_backend.h index cc25f9d..154922a 100644 --- a/hw/xen_backend.h +++ b/hw/xen_backend.h @@ -23,7 +23,8 @@ struct XenDevOps { uint32_t flags; void (*alloc)(struct XenDevice *xendev); int (*init)(struct XenDevice *xendev); - int (*connect)(struct XenDevice *xendev); + int (*initialise)(struct XenDevice *xendev); + void (*connected)(struct XenDevice *xendev); void (*event)(struct XenDevice *xendev); void (*disconnect)(struct XenDevice *xendev); int (*free)(struct XenDevice *xendev); diff --git a/hw/xen_console.c b/hw/xen_console.c index d2261f4..258c003 100644 --- a/hw/xen_console.c +++ b/hw/xen_console.c @@ -202,7 +202,7 @@ static int con_init(struct XenDevice *xendev) return 0; } -static int con_connect(struct XenDevice *xendev) +static int con_initialise(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); int limit; @@ -263,7 +263,7 @@ struct XenDevOps xen_console_ops = { .size = sizeof(struct XenConsole), .flags = DEVOPS_FLAG_IGNORE_STATE, .init = con_init, - .connect = con_connect, + .initialise = con_initialise, .event = con_event, .disconnect = con_disconnect, }; diff --git a/hw/xenfb.c b/hw/xenfb.c index da5297b..b535d8c 100644 --- a/hw/xenfb.c +++ b/hw/xenfb.c @@ -359,7 +359,7 @@ static int input_init(struct XenDevice *xendev) return 0; } -static int input_connect(struct XenDevice *xendev) +static int input_initialise(struct XenDevice *xendev) { struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); int rc; @@ -861,7 +861,7 @@ static int fb_init(struct XenDevice *xendev) return 0; } -static int fb_connect(struct XenDevice *xendev) +static int fb_initialise(struct XenDevice *xendev) { struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev); struct xenfb_page *fb_page; @@ -955,7 +955,7 @@ static void fb_event(struct XenDevice *xendev) struct XenDevOps xen_kbdmouse_ops = { .size = sizeof(struct XenInput), .init = input_init, - .connect = input_connect, + .initialise = input_initialise, .disconnect = input_disconnect, .event = input_event, }; @@ -963,7 +963,7 @@ struct XenDevOps xen_kbdmouse_ops = { struct XenDevOps xen_framebuffer_ops = { .size = sizeof(struct XenFB), .init = fb_init, - .connect = fb_connect, + .initialise = fb_initialise, .disconnect = fb_disconnect, .event = fb_event, .frontend_changed = fb_frontend_changed,