All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: peter.maydell@linaro.org, wuquanming@huawei.com, famz@redhat.com,
	qemu-devel@nongnu.org, gengdongjiu <gengdongjiu@huawei.com>,
	Gaozhihui <zhihui.gao@huawei.com>,
	qemu-arm@nongnu.org, james.morse@arm.com, huangshaoyu@huawei.com,
	zhaoshenglong@huawei.com, imammedo@redhat.com,
	zhengqiang10@huawei.com
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH v5 1/3] ACPI: Add new ACPI structures and macros
Date: Thu, 13 Jul 2017 20:13:28 +0300	[thread overview]
Message-ID: <20170713201112-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <ca0eaafd-21b7-9cf8-91aa-8c4e2c5d95e3@redhat.com>

On Thu, Jul 13, 2017 at 05:33:30PM +0200, Laszlo Ersek wrote:
> On 07/13/17 14:00, gengdongjiu wrote:
> > Laszlo,
> >   Thank you for your review and comments.
> > 
> > 
> > On 2017/7/13 18:33, Laszlo Ersek wrote:
> >> On 07/12/17 04:08, Dongjiu Geng wrote:
> 
> [snip]
> 
> >>> --- a/include/qemu/uuid.h
> >>> +++ b/include/qemu/uuid.h
> >>> @@ -44,6 +44,17 @@ typedef struct {
> >>>  
> >>>  #define UUID_NONE "00000000-0000-0000-0000-000000000000"
> >>>  
> >>> +#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)        \
> >>> +{{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
> >>> +   ((b) >> 8) & 0xff, (b) & 0xff,                   \
> >>> +    ((c) >> 8) & 0xff, (c) & 0xff,                    \
> >>> +    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } } }
> >>> +
> >>> +/* Platform Memory, this is from UEFI 2.6 N.2.2 Section Descriptor */
> >>> +#define UEFI_CPER_SEC_PLATFORM_MEM                   \
> >>> +    UUID_BE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \
> >>> +    0xED, 0x7C, 0x83, 0xB1)
> >>> +
> >>>  void qemu_uuid_generate(QemuUUID *out);
> >>>  
> >>>  int qemu_uuid_is_null(const QemuUUID *uu);
> >>>
> >>
> >> (e) I think the addition of UUID_BE should be split out to a separate
> >> patch; it adds a general facility. It should likely be the very first
> >> patch in the series.
> >   Ok.
> > 
> >>
> >> (f) While I think it is justified to have UUID_BE() in "qemu/uuid.h", I
> >> think UEFI_CPER_SEC_PLATFORM_MEM is too specific to have here.
> >>
> >> If UEFI_CPER_SEC_PLATFORM_MEM were *not* a standardized UUID, I would
> >> suggest moving it to the implementation ("include/hw/acpi/hest_ghes.h"
> >> -- which in turn should be moved to patch #2, see my remark (d)), *plus*
> >> I would suggest eliminating the new #include from "acpi-defs.h", see my
> >> remark (b).
> >   understand your idea.
> > 
> >>
> >> However, given that this UUID *is* standard, I suggest keeping the (b)
> >> #include as you currently propose, and to move the definition of
> >> UEFI_CPER_SEC_PLATFORM_MEM to "acpi-defs.h".
> >   I agree with you.
> > 
> >>
> >> I vaguely recall that Michael commented on this previously, but I don't
> >> remember what he said. Michael, are you OK with my suggestion?
> >    Laszlo, I pasted Michael's comments here, as shown below. Michael said the definition
> > should use build_append_int_noprefix to add data. but I think it may not good, becuase
> > the section "UEFI_CPER_SEC_PLATFORM_MEM" is runtime recorded as CPER, not a ACPI/HEST
> > table member, so it is not generated when system boot up.
> 
> I agree: the UUID in question is not placed into the ACPI payload /
> fw_cfg blobs, it is written into guest memory at runtime, into the
> firmware-allocated area, if and when there is a hardware error to report.
> 
> Thanks
> Laszlo

The main point is that wrapping it up in a macro with an
unreadable name is not really helpful when it's only
used in a single place.


> > On the other hand,UEFI_CPER_SEC_PLATFORM_MEM
> > definition is from UEFI spec 2.6, N.2.2 Section Descriptor: {0xA5BC1114, 0x6F64, 0x4EDE, {0xB8, 0x63, 0x3E, 0x83, 0xED, 0x7C, 0x83, 0xB1}}.
> > if use  build_append_int_noprefix to add, may confuse others.
> > 
> > -----------------------------------------------------------------
> > -----------------------------------------------------------------
> > There's no reason to define these messy one-time use macros.
> > They just make it hard to look things up in the spec.
> > 
> > 
> > You can use build_append_int_noprefix to add data of
> > any length in LE format.
> > -----------------------------------------------------------------
> > -----------------------------------------------------------------
> > 
> > Hi  Michael,
> >   what is your suggestion about it? do you agree with Laszlo?

My main point is that the macros do not seem helpful.



WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: gengdongjiu <gengdongjiu@huawei.com>,
	imammedo@redhat.com, famz@redhat.com, qemu-devel@nongnu.org,
	zhaoshenglong@huawei.com, peter.maydell@linaro.org,
	qemu-arm@nongnu.org, james.morse@arm.com,
	zhengqiang10@huawei.com, huangshaoyu@huawei.com,
	wuquanming@huawei.com, Gaozhihui <zhihui.gao@huawei.com>
Subject: Re: [Qemu-devel] [PATCH v5 1/3] ACPI: Add new ACPI structures and macros
Date: Thu, 13 Jul 2017 20:13:28 +0300	[thread overview]
Message-ID: <20170713201112-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <ca0eaafd-21b7-9cf8-91aa-8c4e2c5d95e3@redhat.com>

On Thu, Jul 13, 2017 at 05:33:30PM +0200, Laszlo Ersek wrote:
> On 07/13/17 14:00, gengdongjiu wrote:
> > Laszlo,
> >   Thank you for your review and comments.
> > 
> > 
> > On 2017/7/13 18:33, Laszlo Ersek wrote:
> >> On 07/12/17 04:08, Dongjiu Geng wrote:
> 
> [snip]
> 
> >>> --- a/include/qemu/uuid.h
> >>> +++ b/include/qemu/uuid.h
> >>> @@ -44,6 +44,17 @@ typedef struct {
> >>>  
> >>>  #define UUID_NONE "00000000-0000-0000-0000-000000000000"
> >>>  
> >>> +#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)        \
> >>> +{{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
> >>> +   ((b) >> 8) & 0xff, (b) & 0xff,                   \
> >>> +    ((c) >> 8) & 0xff, (c) & 0xff,                    \
> >>> +    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } } }
> >>> +
> >>> +/* Platform Memory, this is from UEFI 2.6 N.2.2 Section Descriptor */
> >>> +#define UEFI_CPER_SEC_PLATFORM_MEM                   \
> >>> +    UUID_BE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \
> >>> +    0xED, 0x7C, 0x83, 0xB1)
> >>> +
> >>>  void qemu_uuid_generate(QemuUUID *out);
> >>>  
> >>>  int qemu_uuid_is_null(const QemuUUID *uu);
> >>>
> >>
> >> (e) I think the addition of UUID_BE should be split out to a separate
> >> patch; it adds a general facility. It should likely be the very first
> >> patch in the series.
> >   Ok.
> > 
> >>
> >> (f) While I think it is justified to have UUID_BE() in "qemu/uuid.h", I
> >> think UEFI_CPER_SEC_PLATFORM_MEM is too specific to have here.
> >>
> >> If UEFI_CPER_SEC_PLATFORM_MEM were *not* a standardized UUID, I would
> >> suggest moving it to the implementation ("include/hw/acpi/hest_ghes.h"
> >> -- which in turn should be moved to patch #2, see my remark (d)), *plus*
> >> I would suggest eliminating the new #include from "acpi-defs.h", see my
> >> remark (b).
> >   understand your idea.
> > 
> >>
> >> However, given that this UUID *is* standard, I suggest keeping the (b)
> >> #include as you currently propose, and to move the definition of
> >> UEFI_CPER_SEC_PLATFORM_MEM to "acpi-defs.h".
> >   I agree with you.
> > 
> >>
> >> I vaguely recall that Michael commented on this previously, but I don't
> >> remember what he said. Michael, are you OK with my suggestion?
> >    Laszlo, I pasted Michael's comments here, as shown below. Michael said the definition
> > should use build_append_int_noprefix to add data. but I think it may not good, becuase
> > the section "UEFI_CPER_SEC_PLATFORM_MEM" is runtime recorded as CPER, not a ACPI/HEST
> > table member, so it is not generated when system boot up.
> 
> I agree: the UUID in question is not placed into the ACPI payload /
> fw_cfg blobs, it is written into guest memory at runtime, into the
> firmware-allocated area, if and when there is a hardware error to report.
> 
> Thanks
> Laszlo

The main point is that wrapping it up in a macro with an
unreadable name is not really helpful when it's only
used in a single place.


> > On the other hand,UEFI_CPER_SEC_PLATFORM_MEM
> > definition is from UEFI spec 2.6, N.2.2 Section Descriptor: {0xA5BC1114, 0x6F64, 0x4EDE, {0xB8, 0x63, 0x3E, 0x83, 0xED, 0x7C, 0x83, 0xB1}}.
> > if use  build_append_int_noprefix to add, may confuse others.
> > 
> > -----------------------------------------------------------------
> > -----------------------------------------------------------------
> > There's no reason to define these messy one-time use macros.
> > They just make it hard to look things up in the spec.
> > 
> > 
> > You can use build_append_int_noprefix to add data of
> > any length in LE format.
> > -----------------------------------------------------------------
> > -----------------------------------------------------------------
> > 
> > Hi  Michael,
> >   what is your suggestion about it? do you agree with Laszlo?

My main point is that the macros do not seem helpful.

  reply	other threads:[~2017-07-13 17:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12  2:08 [Qemu-arm] [PATCH v5 0/3] Generate APEI GHES table and dynamically record CPER Dongjiu Geng
2017-07-12  2:08 ` [Qemu-devel] " Dongjiu Geng
2017-07-12  2:08 ` [Qemu-devel] [PATCH v5 1/3] ACPI: Add new ACPI structures and macros Dongjiu Geng
2017-07-12  2:08   ` Dongjiu Geng
2017-07-13 10:33   ` [Qemu-arm] " Laszlo Ersek
2017-07-13 10:33     ` Laszlo Ersek
2017-07-13 12:00     ` [Qemu-arm] " gengdongjiu
2017-07-13 12:00       ` gengdongjiu
2017-07-13 15:33       ` [Qemu-arm] " Laszlo Ersek
2017-07-13 15:33         ` Laszlo Ersek
2017-07-13 17:13         ` Michael S. Tsirkin [this message]
2017-07-13 17:13           ` Michael S. Tsirkin
2017-07-14  8:25           ` [Qemu-arm] " gengdongjiu
2017-07-14  8:25             ` gengdongjiu
2017-07-13 17:35       ` [Qemu-arm] " Michael S. Tsirkin
2017-07-13 17:35         ` Michael S. Tsirkin
2017-07-13 17:01   ` [Qemu-arm] " Michael S. Tsirkin
2017-07-13 17:01     ` [Qemu-devel] " Michael S. Tsirkin
2017-07-14  5:51     ` [Qemu-arm] " gengdongjiu
2017-07-14  5:51       ` [Qemu-devel] " gengdongjiu
2017-07-13 17:11   ` [Qemu-arm] " Michael S. Tsirkin
2017-07-13 17:11     ` [Qemu-devel] " Michael S. Tsirkin
2017-07-14  8:22     ` [Qemu-arm] " gengdongjiu
2017-07-14  8:22       ` [Qemu-devel] " gengdongjiu
2017-07-12  2:08 ` [Qemu-arm] [PATCH v5 2/3] ACPI: Add APEI GHES Table Generation support Dongjiu Geng
2017-07-12  2:08   ` [Qemu-devel] " Dongjiu Geng
2017-07-13 17:32   ` [Qemu-arm] " Michael S. Tsirkin
2017-07-13 17:32     ` [Qemu-devel] " Michael S. Tsirkin
2017-07-13 19:41     ` [Qemu-arm] " Laszlo Ersek
2017-07-13 19:41       ` [Qemu-devel] " Laszlo Ersek
2017-07-13 22:31       ` [Qemu-arm] " Michael S. Tsirkin
2017-07-13 22:31         ` [Qemu-devel] " Michael S. Tsirkin
2017-07-17  4:43       ` [Qemu-arm] " gengdongjiu
2017-07-17  4:43         ` [Qemu-devel] " gengdongjiu
2017-07-12  2:08 ` [Qemu-devel] [PATCH v5 3/3] ACPI: build and enable APEI GHES in the Makefile and configuration Dongjiu Geng
2017-07-12  2:08   ` Dongjiu Geng
2017-07-13 17:36 ` [Qemu-arm] [PATCH v5 0/3] Generate APEI GHES table and dynamically record CPER Michael S. Tsirkin
2017-07-13 17:36   ` [Qemu-devel] " Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2017-07-15  0:14 [Qemu-arm] [Qemu-devel] [PATCH v5 1/3] ACPI: Add new ACPI structures and macros gengdongjiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170713201112-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=famz@redhat.com \
    --cc=gengdongjiu@huawei.com \
    --cc=huangshaoyu@huawei.com \
    --cc=imammedo@redhat.com \
    --cc=james.morse@arm.com \
    --cc=lersek@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wuquanming@huawei.com \
    --cc=zhaoshenglong@huawei.com \
    --cc=zhengqiang10@huawei.com \
    --cc=zhihui.gao@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.