From patchwork Thu Oct 21 15:25:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516061 Delivered-To: patch@linaro.org Received: by 2002:ac0:bf50:0:0:0:0:0 with SMTP id o16csp30880imj; Thu, 21 Oct 2021 08:46:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5PKpVk9eZEKh8k5EQDfTI2ywTbAwaX+eGeIGXSTheks4k+U2iMWDxXOUw3gz3FkFkTz9Z X-Received: by 2002:a05:6808:1898:: with SMTP id bi24mr4957279oib.3.1634831183043; Thu, 21 Oct 2021 08:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634831183; cv=none; d=google.com; s=arc-20160816; b=tX7UpbMh0TEGGkksOwa504+JUWMv6wAnElJJ4fmwrdzqaX0f4XzGk8AQLwf6X4JhWz w9Xe5DTFInkBy59P4NpPZMAV7J7I4OYHA7PAHGx4yiizTN/sIB1Pd88C/OVvASxcF0Hv kC0CLQ5j1sLFjptT0pZvPn5NYfcCNJIpHO7bxicGdWxw4gEY5rnsJEnz9uekfcOoyR63 YtnG5ugBJqC/E+Ee1NSGORJszT3bmn5rbrorJdwxOWd1UliOxGR8ikNTmCz+8RDuyPUS 6SXuNKQ9E4NDD1nGlomwL1n0tfivMYGJze1CjuREuo46g4uQlHLmkUrw89Fsu1LapJTE n0XQ== 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-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ntlLu6jx+KTwzSkrUsKE+JzLZz72IPGPPdjKz27oBkU=; b=f1l7EbXohDKSIhJUX0UKGpBchcJGztAt4AaEikLh36QP+tRoa7DnysS1CP44vzUhFc csQWIvnluubLjZjSslUng9abPh4l9pYAOQBVVAVPPAwz5TlPqcK7jcUlXdES2UmtwnG/ 1FZCcoEv3dfYTgCeeLSD48fe/7lR3izqoKUDUAuolrJYMTg6utbCX86m6gKqptSRS371 ktwKS3Wguqb1RhA9kJcRDwDkMoDY4cv2KOQ0ZuUWImYimAkhFEZ8ohu4A0jnx7nRdvfx TIvt0H+oEXjqOCSiHBFi3ZAeEENKuZnrS+6lpTYiUHz3shcm7HLiQ5I5NpmaXHwIDR1F fG6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M51voO5g; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 80si6715407otu.317.2021.10.21.08.46.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Oct 2021 08:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M51voO5g; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdaGs-0003XH-6r for patch@linaro.org; Thu, 21 Oct 2021 11:46:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdZx7-0000NQ-Fa for qemu-devel@nongnu.org; Thu, 21 Oct 2021 11:25:57 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:45647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdZx4-0002fN-VW for qemu-devel@nongnu.org; Thu, 21 Oct 2021 11:25:57 -0400 Received: by mail-pl1-x636.google.com with SMTP id s1so636940plg.12 for ; Thu, 21 Oct 2021 08:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ntlLu6jx+KTwzSkrUsKE+JzLZz72IPGPPdjKz27oBkU=; b=M51voO5g0DxYMDP8IZDRWYKV/4ohiXkkArbpQxnk60pJptHhMCD6xBA0pmdgDVZKd5 Cj6AMF8DmdfCOUfSAE701EfmGCzppuCVA22O8JpKlWrmXBKcXRzx/AaSk7xBhf/yncGW sSRQYYMUxPx79D8Ib6FpL709a6du/oAuqLWTzU0rdYOcavuvhbxtef/fYcDMfViTiX8A /Drt/QODiE5QN5VgjK0v7URpZw6Fsy8SDLZhbEdZAhyOcxtzej25Rh2V54j165rCo83h PevOFQ0FOrwz0/9GQcli+VeC/UFC8nURJEgb2jh37Q6OT+K6s/MctunmyN4wkNKaLpLr I4bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ntlLu6jx+KTwzSkrUsKE+JzLZz72IPGPPdjKz27oBkU=; b=TbOnEXCtNRp4GsOjbi4U9ZwJGDpc4Wi6QaCgWMYqqCxfY30oH7WMOBMUb78zJz0LbM ko45ksiRTQh5IHcyKV87K/NB9loPxzXdFYkcNE7lzEYIJnt5KijR/snRRmy+v7zqi9dP 3lmT6+jsyK0TvgC7OE6ZqU1v+Ly5k9juysBid/ASjgDsRl2JagrYjqvtvN9Qz2VvDyYN jLy9RwtXGrSFbatDg6eKs4yI4/gjmLCuyTdGbcZQih31anjsNZJEW+hi9RerHT7V4IED ST81WeNhr2OVr6h2A9BwswEggBo3E5NPAbXojaVmdZAGX5J9ZuJSrAA2zfQwDTEZCwVI cByg== X-Gm-Message-State: AOAM530bH2mlKOFhw3xMFJ+dsgmcFA5rL6gdxADods/lb+9hN6iVf03S e+9tUY5yTanp/bihjhKoUzUhCNida3p0dg== X-Received: by 2002:a17:902:f551:b0:13f:2b8:aff7 with SMTP id h17-20020a170902f55100b0013f02b8aff7mr5798229plf.89.1634829953621; Thu, 21 Oct 2021 08:25:53 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id y3sm5676257pge.44.2021.10.21.08.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 08:25:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 15/19] hw/acpi/aml-build: Add Processor hierarchy node structure Date: Thu, 21 Oct 2021 08:25:37 -0700 Message-Id: <20211021152541.781175-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021152541.781175-1-richard.henderson@linaro.org> References: <20211021152541.781175-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , "Michael S . Tsirkin" , Yanan Wang , Eric Auger , Henglong Fan , Ying Fang Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Yanan Wang 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. Co-developed-by: Ying Fang Co-developed-by: Henglong Fan Co-developed-by: Yanan Wang Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones Reviewed-by: Michael S. Tsirkin Reviewed-by: Eric Auger Message-Id: <20211020142125.7516-5-wangyanan55@huawei.com> Signed-off-by: Richard Henderson --- hw/acpi/aml-build.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- 2.25.1 diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 76af0ebaf9..5195324585 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1964,6 +1964,36 @@ void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, acpi_table_end(linker, &table); } +/* + * ACPI spec, Revision 6.3 + * 5.2.29.1 Processor hierarchy node structure (Type 0) + */ +static 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 */ + + /* Number of private resources */ + build_append_int_noprefix(tbl, priv_num, 4); + + /* Private resources[N] */ + if (priv_num > 0) { + assert(priv_rsrc); + 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)