Received: by 2002:a19:ee0d:0:0:0:0:0 with SMTP id g13csp303767lfb; Tue, 27 Apr 2021 23:59:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd2TUKICn7lIiDUmqrkOQJHYJTy+IxDAAEEplTEKFdHH+cwbLkqHgJhr+i2p8nuiTOhqdI X-Received: by 2002:a05:622a:210:: with SMTP id b16mr25977676qtx.377.1619593197498; Tue, 27 Apr 2021 23:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619593197; cv=none; d=google.com; s=arc-20160816; b=S66ycugYtackpL24Yjpa2m5SmrXN6kPBwcrAlaCUD0JE7BTHVQ7LTl3Zg+wasBvQ36 YYNuLKZDbnKimi0f4nCl9YKVPbqE+7YHxY1PUEbH1KQkXxf1ar3ix0gKDENvRgiH/KX6 hASsOK8y4joqUF4RJQMQvUuOJC5dyLRUSZHUPQLdFt5JJqfVYSHGhgsYcwxN/seouqBh Zna1lIDf6+4yGBI2AytLNos6C4NvpRQTJ5pb5lG47XTVwsMV0316Kj9/8r+3zZSuroby 8i2PUitN1ScWIpLK4Ek1zzxpLyiZzC2XpBnTqIUTWcwhzLoWCP7LRXfjx1WOVmPBUSSW 3yDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=q3MEwghpFPLd7PGfPsN/iILTupKHXBTBO6uMMI5WJZw=; b=Pxapj+eXcCblFnTvSVW1UHYAsQvjVV4qhQpG6ocq4aKuR9pXaJnD6+W89Xctien+5s /TOvy5gcf4clrrRMberzx3yxSUBKzBnn7xlI2lgB1hWchV0OdEoA0cgCXCth8CQKz1M+ KulI+zZIgOgTo6D7h5vyz3teYLVeJgVWiVOaSIyY0DBspgP0WWRGk08BuQuSxVLjv+Sa rletd2eHjzsFU5I3+Mlg1OZB5pZGkSQol133MsKuURLdC62WMQXjQB+6Dyf57iAk+v1A cV82qW5NUy3BNMv6a9dc5WkYK9xmv+GoYNNf6FThivLbhc/HFj57TM3QOtoJP11h0XD1 jmfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e2si1257520qtw.102.2021.04.27.23.59.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Apr 2021 23:59:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: from localhost ([::1]:47422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbeAu-000090-RJ for alex.bennee@linaro.org; Wed, 28 Apr 2021 02:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbeAl-00008r-B2; Wed, 28 Apr 2021 02:59:47 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:2741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbeAi-0003Bo-93; Wed, 28 Apr 2021 02:59:47 -0400 Received: from dggeml751-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4FVTt10y2hz19JPc; Wed, 28 Apr 2021 14:55:37 +0800 (CST) Received: from dggpemm500023.china.huawei.com (7.185.36.83) by dggeml751-chm.china.huawei.com (10.1.199.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 28 Apr 2021 14:59:33 +0800 Received: from [10.174.187.128] (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 28 Apr 2021 14:59:32 +0800 Subject: Re: [RFC PATCH v2 4/6] hw/acpi/aml-build: Add processor hierarchy node structure To: Andrew Jones References: <20210413080745.33004-1-wangyanan55@huawei.com> <20210413080745.33004-5-wangyanan55@huawei.com> <20210427133720.xxwx6caln6dze5dm@gator.home> From: "wangyanan (Y)" Message-ID: <9f54ff13-b46a-4f5f-9780-4bec3ade60a2@huawei.com> Date: Wed, 28 Apr 2021 14:59:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20210427133720.xxwx6caln6dze5dm@gator.home> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggeme710-chm.china.huawei.com (10.1.199.106) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.255; envelope-from=wangyanan55@huawei.com; helo=szxga08-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Henglong Fan , "Michael S . Tsirkin" , wanghaibin.wang@huawei.com, qemu-devel@nongnu.org, Shannon Zhao , qemu-arm@nongnu.org, Alistair Francis , prime.zeng@hisilicon.com, yangyicong@huawei.com, yuzenghui@huawei.com, Igor Mammedov , zhukeqian1@huawei.com, Jiajie Li , David Gibson Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: v68pMSc10ohk Hi Drew, On 2021/4/27 21:37, Andrew Jones wrote: > On Tue, Apr 13, 2021 at 04:07:43PM +0800, Yanan Wang wrote: >> Add a generic API to build Processor Hierarchy Node Structure(Type 0), >> which is strictly consistent with descriptions in ACPI 6.3: 5.2.29.1. >> >> This function will be used to build ACPI PPTT table for cpu topology. >> >> Signed-off-by: Ying Fang >> Signed-off-by: Henglong Fan >> Signed-off-by: Yanan Wang >> --- >> hw/acpi/aml-build.c | 27 +++++++++++++++++++++++++++ >> include/hw/acpi/aml-build.h | 4 ++++ >> 2 files changed, 31 insertions(+) >> >> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c >> index d33ce8954a..75e01aea17 100644 >> --- a/hw/acpi/aml-build.c >> +++ b/hw/acpi/aml-build.c >> @@ -1916,6 +1916,33 @@ void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, >> table_data->len - slit_start, 1, oem_id, oem_table_id); >> } >> >> +/* >> + * ACPI 6.3: 5.2.29.1 Processor Hierarchy Node Structure (Type 0) > ^ Doesn't this table show up in 6.2 first? We should always > use the oldest specification we can. Yes, it shows up for the first time in 6.2 specification. > Also, please don't capitalize Hierarchy, Node, and Structure. Those words > are not capitalized in the spec section name and we want an exact match > here. Indeed, the exact format in spec is "5.2.29.1 Processor hierarchy node structure (Type 0)" I will fix this. >> + */ >> +void build_processor_hierarchy_node(GArray *tbl, uint32_t flags, >> + uint32_t parent, uint32_t id, >> + uint32_t *priv_rsrc, uint32_t priv_num) >> +{ >> + int i; >> + >> + build_append_byte(tbl, 0); /* Type 0 - processor */ >> + build_append_byte(tbl, 20 + priv_num * 4); /* Length */ >> + build_append_int_noprefix(tbl, 0, 2); /* Reserved */ >> + build_append_int_noprefix(tbl, flags, 4); /* Flags */ >> + build_append_int_noprefix(tbl, parent, 4); /* Parent */ >> + build_append_int_noprefix(tbl, id, 4); /* ACPI processor ID */ > ^ should be > capitalized like in the spec Right. > >> + >> + /* Number of private resources */ >> + build_append_int_noprefix(tbl, priv_num, 4); >> + >> + /* Private resources[N] */ >> + if (priv_num > 0 && priv_rsrc != NULL) { > Since we should never have priv_num > 0 and priv_rsrc == NULL, then we can > do > > if (priv_num > 0) { > assert(priv_rsrc); > ... It seems much better, will fit it. Thanks, Yanan >> + for (i = 0; i < priv_num; i++) { >> + build_append_int_noprefix(tbl, priv_rsrc[i], 4); >> + } >> + } >> +} >> + >> /* build rev1/rev3/rev5.1 FADT */ >> void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, >> const char *oem_id, const char *oem_table_id) >> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h >> index 471266d739..ea74b8f6ed 100644 >> --- a/include/hw/acpi/aml-build.h >> +++ b/include/hw/acpi/aml-build.h >> @@ -462,6 +462,10 @@ void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base, >> void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, >> const char *oem_id, const char *oem_table_id); >> >> +void build_processor_hierarchy_node(GArray *tbl, uint32_t flags, >> + uint32_t parent, uint32_t id, >> + uint32_t *priv_rsrc, uint32_t priv_num); >> + >> void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, >> const char *oem_id, const char *oem_table_id); >> >> -- >> 2.19.1 >> > Thanks, > drew > > .