From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E231C35647 for ; Fri, 21 Feb 2020 14:07:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB6C6222C4 for ; Fri, 21 Feb 2020 14:07:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wTnUuK2E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728228AbgBUOHq (ORCPT ); Fri, 21 Feb 2020 09:07:46 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:45658 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbgBUOHp (ORCPT ); Fri, 21 Feb 2020 09:07:45 -0500 Received: by mail-oi1-f193.google.com with SMTP id v19so1641181oic.12 for ; Fri, 21 Feb 2020 06:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jRrCY8ivewk2YPDDhcTANhN06ruxAxSf+AS7eQGMH4k=; b=wTnUuK2EkkmDJZpLj4tmgHEqKVPhULq+9DKBHUK9iU38rUMNmOc/I4zk9rDHhxEFuq O/1uQiBW33+L9XDt7L+lOx+RfvBiKxJteC/df5Ub/RpCDiUgBoI9htfYdyQsRX3nA0pO IhTWX3XyCBr+PFR5vOzZJT1aH96Vty28jyER/5U5p9W0xUCr9udL/jjr6F8hmNXVfnYQ +gZPfYOkd77DeI9TVzjuCqDwF7nAPjYnDNnycJM7hDII9KRT4tx9hNKZ3JvIP9DQAM4E FhCu1om59A5iQYmeHYP4ZYQVF58PY7JpQlCv+fFLWIJvQi3ObOsitNgfTf51YPOUz1XP qcjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jRrCY8ivewk2YPDDhcTANhN06ruxAxSf+AS7eQGMH4k=; b=P4bvzlcqS8bb8b9wQuSbbEOFvtHIRetZINnfyzcP332wCeBDmDYFe9guIBOto7qVs4 uo9V6dllkR+ZYetQRTKOaM97fEdCUsVxTG+AK/kXdmskpBKGnL4k6AEks5123VvMK+D0 Mjga7Tne9qEHXShh2qh+rBTXB9iZRyzCbiBZYgA7PYcaAvqED5VKBYeSZZjSfJBI5G0W zwExoQ+sLKEHOOHwioob2MTezMS2Fx9eQKnSpSM3quL8fSQ9oNNUmsw1kawqXIB1rwT6 5DYUaWW7YcH5Ie6peQvXgTJk7o++J3HabcqTabjEXJ+amQ3WAHoIACH3Q0CNUc1hGViS +6Ng== X-Gm-Message-State: APjAAAXB6SuYIDsS9JfjYrbAgqPf7Gt5mAE7srYZuUFt8+ktBOr304xS V8nfntf8pUVuRo3MNMN38V2F2ZPz/WixTPMXjAsX9w== X-Google-Smtp-Source: APXvYqwjXmjS0kIXrAdxCSwzyqX9j8aeVXh4lRUHp81kHrvWmlE7IV/sUVn+HHmyAzzQD2/6b57aeS2rRsDlIs/+2YA= X-Received: by 2002:aca:b2c5:: with SMTP id b188mr2127351oif.163.1582294064908; Fri, 21 Feb 2020 06:07:44 -0800 (PST) MIME-Version: 1.0 References: <20200217131248.28273-1-gengdongjiu@huawei.com> <20200217131248.28273-2-gengdongjiu@huawei.com> In-Reply-To: <20200217131248.28273-2-gengdongjiu@huawei.com> From: Peter Maydell Date: Fri, 21 Feb 2020 14:07:34 +0000 Message-ID: Subject: Re: [PATCH v24 01/10] acpi: nvdimm: change NVDIMM_UUID_LE to a common macro To: Dongjiu Geng Cc: "Michael S. Tsirkin" , Igor Mammedov , Xiao Guangrong , Shannon Zhao , Fam Zheng , Richard Henderson , Eduardo Habkost , Marcelo Tosatti , QEMU Developers , kvm-devel , qemu-arm , Paolo Bonzini , James Morse , Laszlo Ersek , Jonathan Cameron , Shameerali Kolothum Thodi , Zheng Xiang Content-Type: text/plain; charset="UTF-8" Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 17 Feb 2020 at 13:10, Dongjiu Geng wrote: > > The little end UUID is used in many places, so make > NVDIMM_UUID_LE to a common macro to convert the UUID > to a little end array. > > Signed-off-by: Dongjiu Geng > Reviewed-by: Xiang Zheng > --- > hw/acpi/nvdimm.c | 8 ++------ > include/qemu/uuid.h | 5 +++++ > 2 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c > index 9fdad6d..232b701 100644 > --- a/hw/acpi/nvdimm.c > +++ b/hw/acpi/nvdimm.c > @@ -27,6 +27,7 @@ > */ > > #include "qemu/osdep.h" > +#include "qemu/uuid.h" > #include "hw/acpi/acpi.h" > #include "hw/acpi/aml-build.h" > #include "hw/acpi/bios-linker-loader.h" > @@ -60,17 +61,12 @@ static GSList *nvdimm_get_device_list(void) > return list; > } > > -#define NVDIMM_UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ > - { (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ > - (b) & 0xff, ((b) >> 8) & 0xff, (c) & 0xff, ((c) >> 8) & 0xff, \ > - (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } > - > /* > * define Byte Addressable Persistent Memory (PM) Region according to > * ACPI 6.0: 5.2.25.1 System Physical Address Range Structure. > */ > static const uint8_t nvdimm_nfit_spa_uuid[] = > - NVDIMM_UUID_LE(0x66f0d379, 0xb4f3, 0x4074, 0xac, 0x43, 0x0d, 0x33, > + UUID_LE(0x66f0d379, 0xb4f3, 0x4074, 0xac, 0x43, 0x0d, 0x33, > 0x18, 0xb7, 0x8c, 0xdb); You need to fix up the indentation on this following line. > > /* > diff --git a/include/qemu/uuid.h b/include/qemu/uuid.h > index 129c45f..bd38af5 100644 > --- a/include/qemu/uuid.h > +++ b/include/qemu/uuid.h > @@ -34,6 +34,11 @@ typedef struct { > }; > } QemuUUID; > > +#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ > + { (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ > + (b) & 0xff, ((b) >> 8) & 0xff, (c) & 0xff, ((c) >> 8) & 0xff, \ > + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } > + If you want to make this a macro in a visible-to-the-rest-of-QEMU header file, can you provide a documentation comment please that describes what the macro is for? It would also be useful to give the arguments (which should be documented in the doc comment) more descriptive names than a, b, c... > #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-" \ > "%02hhx%02hhx-%02hhx%02hhx-" \ > "%02hhx%02hhx-" \ > -- > 1.8.3.1 thanks -- PMM