Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Peter Maydell
On 11 June 2012 14:12, Anthony Liguori wrote: > I really don't see the overwhelming need to keep structures private.  Being > able to directly reference public members is extremely handy. It keeps people honest. Last time I looked at your pin series it had some changes which were using private in

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Anthony Liguori
On 06/11/2012 02:20 AM, Paolo Bonzini wrote: Il 11/06/2012 09:13, Andreas Färber ha scritto: +The first step is to move your device struct definition to a header file. This +header file should only contain the struct definition and any preprocessor +declarations you need to define the structure

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Peter Maydell
On 11 June 2012 08:13, Andreas Färber wrote: > Am 05.06.2012 12:00, schrieb Peter Maydell: >> I don't think this is a fantastic idea -- the device struct should be >> private to the device, and having it in a standalone header file is >> asking for users of the device to illicitly include it and a

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Andreas Färber
Am 11.06.2012 09:59, schrieb Paolo Bonzini: > Il 11/06/2012 09:56, Andreas Färber ha scritto: I thought that was just a convenience choice, not a necessity. The children objects could just as well be heap-allocated. >> In that case we'd need to change the instance_init signature. As far

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Andreas Färber
Am 11.06.2012 09:56, schrieb Andreas Färber: > Am 11.06.2012 09:20, schrieb Paolo Bonzini: >> Il 11/06/2012 09:13, Andreas Färber ha scritto: >>> +The first step is to move your device struct definition to a header >>> file. This >>> +header file should only contain the struct definit

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Paolo Bonzini
Il 11/06/2012 09:56, Andreas Färber ha scritto: >> > I thought that was just a convenience choice, not a necessity. The >> > children objects could just as well be heap-allocated. > In that case we'd need to change the instance_init signature. As far as > I've understood from our discussions with

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Andreas Färber
Am 11.06.2012 09:20, schrieb Paolo Bonzini: > Il 11/06/2012 09:13, Andreas Färber ha scritto: >> +The first step is to move your device struct definition to a header >> file. This >> +header file should only contain the struct definition and any >> preprocessor >> +declaratio

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Paolo Bonzini
Il 11/06/2012 09:13, Andreas Färber ha scritto: >>> >> +The first step is to move your device struct definition to a header >>> >> file. This >>> >> +header file should only contain the struct definition and any >>> >> preprocessor >>> >> +declarations you need to define the structure. This hea

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-11 Thread Andreas Färber
Am 05.06.2012 12:00, schrieb Peter Maydell: > On 5 June 2012 02:00, Michael Roth wrote: >> +The first step is to move your device struct definition to a header file. >> This >> +header file should only contain the struct definition and any preprocessor >> +declarations you need to define the str

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-07 Thread Avi Kivity
On 06/07/2012 12:36 AM, Michael Roth wrote: > It would need to be something fairly ubiquitous though, and pygments is > the more well-used library yet still isn't available on RHEL5 and > probably a few other distros we need to support. If someone wants to build qemu from source on RHEL5, they can

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Anthony Liguori
On 06/05/2012 06:06 PM, Avi Kivity wrote: On 06/05/2012 04:00 AM, Michael Roth wrote: This is an import of Anthony's qidl compiler, with some changes squashed in to add support for doing the visitor generation via QEMU's qapi code generators rather than directly. Documentation has been imported

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Michael Roth
On Wed, Jun 06, 2012 at 10:31:56AM +0300, Avi Kivity wrote: > On 06/06/2012 12:11 AM, Michael Roth wrote: > >> > >> Is is possible to let the compiler process the .c file, with the IDL > >> delimited by some marker? I like how device models are self contained > >> in one file now. > > > > It's p

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Avi Kivity
On 06/06/2012 02:12 PM, Anthony Liguori wrote: > On 06/06/2012 05:58 PM, Avi Kivity wrote: >> On 06/06/2012 12:17 PM, Anthony Liguori wrote: So, is it reasonable to say uint32_t * _immutable irrp; // Interrupt Request Register and allocate it on the heap during in

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Anthony Liguori
On 06/06/2012 05:58 PM, Avi Kivity wrote: On 06/06/2012 12:17 PM, Anthony Liguori wrote: So, is it reasonable to say uint32_t * _immutable irrp; // Interrupt Request Register and allocate it on the heap during initialization? No, this would be wrong. '_immutable' means that the *state

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Avi Kivity
On 06/06/2012 12:17 PM, Anthony Liguori wrote: >> >> So, is it reasonable to say >> >>uint32_t * _immutable irrp; // Interrupt Request Register >> >> and allocate it on the heap during initialization? > > No, this would be wrong. > > '_immutable' means that the *state* is immutable from the

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Anthony Liguori
On 06/06/2012 04:59 PM, Avi Kivity wrote: On 06/06/2012 11:45 AM, Anthony Liguori wrote: Ok. But then the backend pointer is not 'const Backend * const', it's 'Backend * const' (if we don't allow retargeting). So we can't say it's _immutable (and it isn't). It's _host. 'Backend * const' is

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Avi Kivity
On 06/06/2012 11:45 AM, Anthony Liguori wrote: >> Ok. But then the backend pointer is not 'const Backend * const', it's >> 'Backend * const' (if we don't allow retargeting). So we can't say it's >> _immutable (and it isn't). It's _host. > > 'Backend * const' is immutable > > That is, the *poin

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Anthony Liguori
On 06/06/2012 04:37 PM, Avi Kivity wrote: On 06/06/2012 11:27 AM, Anthony Liguori wrote: On 06/06/2012 03:45 PM, Avi Kivity wrote: I think you meant to add a const in there, but yeah, I know. Maybe also a _stupid. How can one get a one line example wrong by omitting the important word out of

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Avi Kivity
On 06/06/2012 11:27 AM, Anthony Liguori wrote: > On 06/06/2012 03:45 PM, Avi Kivity wrote: >> On 06/06/2012 02:51 AM, Anthony Liguori wrote: > +during device construction and never changes. This means we can > add an > +**_immutable** marker to it: Even if it does change (sup

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Anthony Liguori
On 06/06/2012 03:45 PM, Avi Kivity wrote: On 06/06/2012 02:51 AM, Anthony Liguori wrote: +during device construction and never changes. This means we can add an +**_immutable** marker to it: Even if it does change (suppose we add a monitor command to retarget a the serial device's chardev), i

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Avi Kivity
On 06/06/2012 02:51 AM, Anthony Liguori wrote: >>> +during device construction and never changes. This means we can add an >>> +**_immutable** marker to it: >> >> Even if it does change (suppose we add a monitor command to retarget a >> the serial device's chardev), it need not be migrated since i

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Avi Kivity
On 06/06/2012 12:11 AM, Michael Roth wrote: >> >> Is is possible to let the compiler process the .c file, with the IDL >> delimited by some marker? I like how device models are self contained >> in one file now. > > It's possible, but only if we inject the generated visitor code into the > devic

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Kevin Wolf
Am 05.06.2012 18:21, schrieb Michael Roth: > On Tue, Jun 05, 2012 at 11:25:01AM +0200, Kevin Wolf wrote: >> Am 05.06.2012 03:00, schrieb Michael Roth: >>> This is an import of Anthony's qidl compiler, with some changes squashed >>> in to add support for doing the visitor generation via QEMU's qapi

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-06 Thread Avi Kivity
On 06/05/2012 03:19 PM, Gerd Hoffmann wrote: > Hi, > >> >> >> Suggestion: add a _guest marker for ordinary state. Fail the build on >> unmarked fields. This ensures that some thought is given to each field, >> instead of having a default that may be correct most of the time, but >> not alway

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Anthony Liguori
On 06/06/2012 01:12 PM, Paolo Bonzini wrote: Il 06/06/2012 01:40, Anthony Liguori ha scritto: The only way I can think of getting around this is to do nasty things like adding an #include "qapi-generated/mc146818rtc-qapi-visit.c"; in hw/mc146818rtc.c. It doesn't look that ugly, though perh

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Paolo Bonzini
Il 06/06/2012 01:40, Anthony Liguori ha scritto: >> >>> The only way I can think of getting around this is to do nasty things >>> like adding an >>> >>> #include "qapi-generated/mc146818rtc-qapi-visit.c"; >>> >>> in hw/mc146818rtc.c. >> >> It doesn't look that ugly, though perhaps I'm biased becaus

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Peter Maydell
On 6 June 2012 00:51, Anthony Liguori wrote: > In the case of a CharDriverState, the reference is always immutable.  If we > supported changing char backends dynamically, it would not happen by > changing the reference, but almost certainly by having the ability to reopen > the char driver in plac

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Anthony Liguori
On 06/05/2012 06:06 PM, Avi Kivity wrote: On 06/05/2012 04:00 AM, Michael Roth wrote: In addition, QC can decide at run time whether to +suppress a field by assigning it a **default** value. + +## Immutable Fields + +If a field is only set during device construction, based on parameters passed

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Anthony Liguori
On 06/06/2012 03:56 AM, Paolo Bonzini wrote: Il 05/06/2012 18:21, Michael Roth ha scritto: The only way I can think of getting around this is to do nasty things like adding an #include "qapi-generated/mc146818rtc-qapi-visit.c"; in hw/mc146818rtc.c. It doesn't look that ugly, though perhaps I

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Anthony Liguori
On 06/05/2012 08:19 PM, Gerd Hoffmann wrote: Hi, Suggestion: add a _guest marker for ordinary state. Fail the build on unmarked fields. This ensures that some thought is given to each field, instead of having a default that may be correct most of the time, but not always. Suggestion: ad

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Michael Roth
On Tue, Jun 05, 2012 at 01:06:10PM +0300, Avi Kivity wrote: > On 06/05/2012 04:00 AM, Michael Roth wrote: > > This is an import of Anthony's qidl compiler, with some changes squashed > > in to add support for doing the visitor generation via QEMU's qapi code > > generators rather than directly. > >

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Paolo Bonzini
Il 05/06/2012 18:21, Michael Roth ha scritto: > The only way I can think of getting around this is to do nasty things > like adding an > > #include "qapi-generated/mc146818rtc-qapi-visit.c"; > > in hw/mc146818rtc.c. It doesn't look that ugly, though perhaps I'm biased because that's again exactl

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Michael Roth
On Tue, Jun 05, 2012 at 11:25:01AM +0200, Kevin Wolf wrote: > Am 05.06.2012 03:00, schrieb Michael Roth: > > This is an import of Anthony's qidl compiler, with some changes squashed > > in to add support for doing the visitor generation via QEMU's qapi code > > generators rather than directly. > >

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Gerd Hoffmann
Hi, > > > Suggestion: add a _guest marker for ordinary state. Fail the build on > unmarked fields. This ensures that some thought is given to each field, > instead of having a default that may be correct most of the time, but > not always. > > Suggestion: add a mandatory position hint (_gue

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Kevin Wolf
Am 05.06.2012 11:47, schrieb Anthony Liguori: > On 06/05/2012 05:25 PM, Kevin Wolf wrote: >> Am 05.06.2012 03:00, schrieb Michael Roth: >>> This is an import of Anthony's qidl compiler, with some changes squashed >>> in to add support for doing the visitor generation via QEMU's qapi code >>> genera

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Anthony Liguori
On 06/05/2012 06:00 PM, Peter Maydell wrote: On 5 June 2012 02:00, Michael Roth wrote: +The first step is to move your device struct definition to a header file. This +header file should only contain the struct definition and any preprocessor +declarations you need to define the structure. Th

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Avi Kivity
On 06/05/2012 04:00 AM, Michael Roth wrote: > This is an import of Anthony's qidl compiler, with some changes squashed > in to add support for doing the visitor generation via QEMU's qapi code > generators rather than directly. > > Documentation has been imported as well, as is also viewable at: >

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Peter Maydell
On 5 June 2012 02:00, Michael Roth wrote: > +The first step is to move your device struct definition to a header file.   > This > +header file should only contain the struct definition and any preprocessor > +declarations you need to define the structure.  This header file will act as > +the sourc

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Anthony Liguori
On 06/05/2012 05:25 PM, Kevin Wolf wrote: Am 05.06.2012 03:00, schrieb Michael Roth: This is an import of Anthony's qidl compiler, with some changes squashed in to add support for doing the visitor generation via QEMU's qapi code generators rather than directly. Documentation has been imported

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-05 Thread Kevin Wolf
Am 05.06.2012 03:00, schrieb Michael Roth: > This is an import of Anthony's qidl compiler, with some changes squashed > in to add support for doing the visitor generation via QEMU's qapi code > generators rather than directly. > > Documentation has been imported as well, as is also viewable at: >

[Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-04 Thread Michael Roth
This is an import of Anthony's qidl compiler, with some changes squashed in to add support for doing the visitor generation via QEMU's qapi code generators rather than directly. Documentation has been imported as well, as is also viewable at: https://github.com/aliguori/qidl/blob/master/qc.md Th

Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor

2012-06-04 Thread Anthony Liguori
Hi, Thanks for sending this Mike. If you're on CC, please do read the qc.md at least. There is a good bit of theory here about how to rigorously approach serialization of device state. I think the approach is sound and could solve a lot of the problems we face today but it could use review.