2014-04-01 10:26:35

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [RFC PATCH] powerpc/le: enable RTAS events support

On Mon, Mar 31, 2014 at 5:02 PM, Nathan Fontenot
<[email protected]> wrote:
> struct rtas_error_log {
> - unsigned long version:8; /* Architectural version */
> - unsigned long severity:3; /* Severity level of error */
> - unsigned long disposition:2; /* Degree of recovery */
> - unsigned long extended:1; /* extended log present? */
> - unsigned long /* reserved */ :2; /* Reserved for future use */
> - unsigned long initiator:4; /* Initiator of event */
> - unsigned long target:4; /* Target of failed operation */
> - unsigned long type:8; /* General event or error*/
> - unsigned long extended_log_length:32; /* length in bytes */
> - unsigned char buffer[1]; /* Start of extended log */
> + /* Byte 0 */
> + uint8_t version; /* Architectural version */
> +
> + /* Byte 1 */
> + uint8_t severity;
> + /* XXXXXXXX
> + * XXX 3: Severity level of error
> + * XX 2: Degree of recovery
> + * X 1: Extended log present?
> + * XX 2: Reserved
> + */
> +
> + /* Byte 2 */
> + uint8_t :8;
> + /* XXXXXXXX
> + * XXXX 4: Initiator of event
> + * XXXX 4: Target of failed operation
> + */
> + uint8_t type; /* General event or error*/
> + uint32_t extended_log_length; /* length in bytes */

Now the bitfields are gone, things like the above can become __be32,
so we get extra type checking from sparse ("make C=1").

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2014-04-02 15:57:09

by Gerg Kurz

[permalink] [raw]
Subject: Re: [RFC PATCH] powerpc/le: enable RTAS events support

On Tue, 1 Apr 2014 12:26:32 +0200
Geert Uytterhoeven <[email protected]> wrote:

> On Mon, Mar 31, 2014 at 5:02 PM, Nathan Fontenot
> <[email protected]> wrote:
> > struct rtas_error_log {
> > - unsigned long version:8; /* Architectural version */
> > - unsigned long severity:3; /* Severity level of error */
> > - unsigned long disposition:2; /* Degree of recovery */
> > - unsigned long extended:1; /* extended log present? */
> > - unsigned long /* reserved */ :2; /* Reserved for future use */
> > - unsigned long initiator:4; /* Initiator of event */
> > - unsigned long target:4; /* Target of failed operation */
> > - unsigned long type:8; /* General event or error*/
> > - unsigned long extended_log_length:32; /* length in bytes */
> > - unsigned char buffer[1]; /* Start of extended log */
> > + /* Byte 0 */
> > + uint8_t version; /* Architectural version */
> > +
> > + /* Byte 1 */
> > + uint8_t severity;
> > + /* XXXXXXXX
> > + * XXX 3: Severity level of error
> > + * XX 2: Degree of recovery
> > + * X 1: Extended log present?
> > + * XX 2: Reserved
> > + */
> > +
> > + /* Byte 2 */
> > + uint8_t :8;
> > + /* XXXXXXXX
> > + * XXXX 4: Initiator of event
> > + * XXXX 4: Target of failed operation
> > + */
> > + uint8_t type; /* General event or error*/
> > + uint32_t extended_log_length; /* length in bytes */
>
> Now the bitfields are gone, things like the above can become __be32,
> so we get extra type checking from sparse ("make C=1").
>
> Gr{oetje,eeting}s,
>
> Geert
>

I am reworking a patch in this direction.

Thanks.

--
Greg

> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
> _______________________________________________
> Linuxppc-dev mailing list
> [email protected]
> https://lists.ozlabs.org/listinfo/linuxppc-dev


--
Gregory Kurz [email protected]
[email protected]
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)562 165 496

"Anarchy is about taking complete responsibility for yourself."
Alan Moore.