Received: by 2002:a17:906:1917:b0:98d:b2f5:1316 with SMTP id a23csp6619044eje; Tue, 18 Jul 2023 13:10:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlGd6Wehzz3as8L1G3e0iihvcdUgoyk8uUnBjBJb9tmjv4Kk8X1895rWGM9+pQ7C4JSqNyc3 X-Received: by 2002:a05:620a:151:b0:768:1e8d:67fb with SMTP id e17-20020a05620a015100b007681e8d67fbmr7121966qkn.74.1689711053434; Tue, 18 Jul 2023 13:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689711053; cv=none; d=google.com; s=arc-20160816; b=G+ZV4FCp+8xaRFd6njEIldRiA8eyf9FBIOOrvBfYe8DUWSbTCdhOZKjI1UZr55S6bs oENM7wXMZ8QG9IonKVn0Q8/iSnZuV5H+w77koevpnOrSSxKN0AtdgUvNKJmxbENyEcOc JTbo0jcVXeYF14PjJ7s3H6byOEnyparFJL2roOAXRk/eDVTJkhIibbazGhz3jd+uQKwX +pbMB3ozy54Sy4+E6LRUh1FITFzNfseThVTBOkzcLRLZiNZFYojMMmEWg+OIAr784SwD w0YPgr0tqwwdSNBe5MvEKY4I4FyxgqOIJIEW6L8J17rVx0fK+sqvst6nJEaugIjAWGhX y2Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=5Tnz5kqiL1ZRSW95lNiC/BBvhuIGx+7W79TYL6uBWUA=; fh=NddmdC0H7Yvd15BYzKWOWZBS0FBdcJ9zE0BWGJ3GxJc=; b=u0DpueaydP1feMfFEPxX1jStIsJxNHzbsHJN0C0lVSzHfoIfpszyeGHudTkjtPGtUW tZYb7HKBAgXaajRPtBM7QZ0gqffY/Oj8cCG5jijes14NVQmucpJV7AYpvgIUwM0Cpr0V hYHwazV0ubzCBAkpsUQHqL0bjkxlUhAdsOG4CctHhaSJarLKEY7xRUkTFZ//rsymJqVU CPThv0bAMMWeW080NGuQiEnmT9Ve1zxBOCTocraYkkGTyBNCGPghQW6oKoMUFwubbIbw siunKCU8Y/NxkirbcFbe68RCpulYvJ0uE6fvS2yWkv7sGcwodMJCQevL3Wc4LV7VrHzv L9EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=RG6RQcse; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q12-20020ae9e40c000000b007670139e5e4si1543756qkc.559.2023.07.18.13.10.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jul 2023 13:10:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-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; dkim=pass header.i=@ventanamicro.com header.s=google header.b=RG6RQcse; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLr1i-0005Nq-Q0; Tue, 18 Jul 2023 16:10:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qLr1f-0005M1-Pv for qemu-devel@nongnu.org; Tue, 18 Jul 2023 16:10:27 -0400 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLr1d-0006yu-QO for qemu-devel@nongnu.org; Tue, 18 Jul 2023 16:10:27 -0400 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-1b049163c93so3660012fac.3 for ; Tue, 18 Jul 2023 13:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689711024; x=1692303024; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5Tnz5kqiL1ZRSW95lNiC/BBvhuIGx+7W79TYL6uBWUA=; b=RG6RQcseFG0r+nEi35zw4DgVGAgunTUwF02b/9/1P6rWnxBCVgAowLjLlBlJbmdKm8 epLp8rM9LT5dWpqT1miJegXUN8pRQz/Q8m0QQwkXjgh4wR/bIG7U42zR5zpgcbMOOVlU sZ9vvdmvz4BJHKf0rpyRzO1jey2Ez8/L/9I7hzJLnEpISJFv70omDtR3EgqqQN0kS8Cs nalDCGzH8/WYnQiXWdtXf1kfKq/9pvaJiZODCuyJ665GrVlDi5j0oPymB0bXIu9s7Aru ppPvKyGqJcQ6YH+UNEUR/eoCBKUrAwEL933CbCHAEtN2mHnxYY2FxB6Y7ZyBpoT6Oyjs dKjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689711024; x=1692303024; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5Tnz5kqiL1ZRSW95lNiC/BBvhuIGx+7W79TYL6uBWUA=; b=RNKnSeHUo4VhTzeWF7MVU1OCMR9KAxtEiZ3zyB35yxbCfFanByO9klX/nQdq2HuCzw xJcUt4K4s77XN5K4ktsHV2SH92wIVoFFQoGF/tLYMzUuV0j2OTbfLCq7U+y4KPsz5YGi HLzP5v4wI/CBm/8UvFISmaTR1ukdC2MXCL7FkmU/g0AdJT1SbWeBYpypikqFICvgK4uw mLoF/tF8oVbKTV/7pcAzOB8dEFIXmKM6nDt6KGwPZ2NnWUElVuWXQ3nItwOxI0yjL6g6 RuxLQ4DMzoGvsd81TgAttqap/JP+UJkfijLCevTEJHeqleLchX3jjlqO5j2bzZSmEvYQ CQ4g== X-Gm-Message-State: ABy/qLaL0FO8r4Cf2d/qNfXQ9b+atkhXY9oook6BWJAJpzDyxQItFCKa nGdghtb7BJ7QS4Lr5qQPUE0vPh9fnpQjohIv+IMBsw== X-Received: by 2002:a05:6870:d791:b0:1ba:8307:9a1a with SMTP id bd17-20020a056870d79100b001ba83079a1amr5629359oab.10.1689711024140; Tue, 18 Jul 2023 13:10:24 -0700 (PDT) Received: from [192.168.68.108] (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id u21-20020a4a9e95000000b00563155bd360sm1166369ook.17.2023.07.18.13.10.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Jul 2023 13:10:23 -0700 (PDT) Message-ID: <4db048ea-cb1d-ee55-49f4-15e18a71a01f@ventanamicro.com> Date: Tue, 18 Jul 2023 17:10:18 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 08/10] hw/riscv/virt-acpi-build.c: Add CMO information in RHCT Content-Language: en-US To: Sunil V L , qemu-devel@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org Cc: "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Peter Maydell , Shannon Zhao , Paolo Bonzini , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , Andrew Jones , Anup Patel References: <20230712163943.98994-1-sunilvl@ventanamicro.com> <20230712163943.98994-9-sunilvl@ventanamicro.com> From: Daniel Henrique Barboza In-Reply-To: <20230712163943.98994-9-sunilvl@ventanamicro.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2001:4860:4864:20::2b; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x2b.google.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 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, NICE_REPLY_A=-0.095, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: exMuLNlJZs1v On 7/12/23 13:39, Sunil V L wrote: > When CMO related extensions like Zicboz, Zicbom and Zicbop > are enabled, the block size for those extensions need to be > communicated via CMO node in RHCT. Add CMO node in RHCT if > any of those CMO extensions are detected. > > Signed-off-by: Sunil V L > --- Reviewed-by: Daniel Henrique Barboza > hw/riscv/virt-acpi-build.c | 64 +++++++++++++++++++++++++++++++++----- > 1 file changed, 56 insertions(+), 8 deletions(-) > > diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c > index 9f2d0c92b0..2d2bd3b970 100644 > --- a/hw/riscv/virt-acpi-build.c > +++ b/hw/riscv/virt-acpi-build.c > @@ -146,6 +146,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, RISCVVirtState *s) > * 5.2.36 RISC-V Hart Capabilities Table (RHCT) > * REF: https://github.com/riscv-non-isa/riscv-acpi/issues/16 > * https://drive.google.com/file/d/1nP3nFiH4jkPMp6COOxP6123DCZKR-tia/view > + * https://drive.google.com/file/d/1sKbOa8m1UZw1JkquZYe3F1zQBN1xXsaf/view > */ > static void build_rhct(GArray *table_data, > BIOSLinker *linker, > @@ -155,8 +156,8 @@ static void build_rhct(GArray *table_data, > MachineState *ms = MACHINE(s); > const CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(ms); > size_t len, aligned_len; > - uint32_t isa_offset, num_rhct_nodes; > - RISCVCPU *cpu; > + uint32_t isa_offset, num_rhct_nodes, cmo_offset = 0; > + RISCVCPU *cpu = &s->soc[0].harts[0]; > char *isa; > > AcpiTable table = { .sig = "RHCT", .rev = 1, .oem_id = s->oem_id, > @@ -172,6 +173,9 @@ static void build_rhct(GArray *table_data, > > /* ISA + N hart info */ > num_rhct_nodes = 1 + ms->smp.cpus; > + if (cpu->cfg.ext_icbom || cpu->cfg.ext_icboz) { > + num_rhct_nodes++; > + } > > /* Number of RHCT nodes*/ > build_append_int_noprefix(table_data, num_rhct_nodes, 4); > @@ -183,7 +187,6 @@ static void build_rhct(GArray *table_data, > isa_offset = table_data->len - table.table_offset; > build_append_int_noprefix(table_data, 0, 2); /* Type 0 */ > > - cpu = &s->soc[0].harts[0]; > isa = riscv_isa_string(cpu); > len = 8 + strlen(isa) + 1; > aligned_len = (len % 2) ? (len + 1) : len; > @@ -199,14 +202,59 @@ static void build_rhct(GArray *table_data, > build_append_int_noprefix(table_data, 0x0, 1); /* Optional Padding */ > } > > + /* CMO node */ > + if (cpu->cfg.ext_icbom || cpu->cfg.ext_icboz) { > + cmo_offset = table_data->len - table.table_offset; > + build_append_int_noprefix(table_data, 1, 2); /* Type */ > + build_append_int_noprefix(table_data, 10, 2); /* Total Length */ > + build_append_int_noprefix(table_data, 0x1, 2); /* Revision */ > + build_append_int_noprefix(table_data, 0, 1); /* Reserved */ > + > + /* CBOM block size */ > + if (cpu->cfg.cbom_blocksize) { > + build_append_int_noprefix(table_data, > + __builtin_ctz(cpu->cfg.cbom_blocksize), > + 1); > + } else { > + build_append_int_noprefix(table_data, 0, 1); > + } > + > + /* CBOP block size */ > + build_append_int_noprefix(table_data, 0, 1); > + > + /* CBOZ block size */ > + if (cpu->cfg.cboz_blocksize) { > + build_append_int_noprefix(table_data, > + __builtin_ctz(cpu->cfg.cboz_blocksize), > + 1); > + } else { > + build_append_int_noprefix(table_data, 0, 1); > + } > + } > + > /* Hart Info Node */ > for (int i = 0; i < arch_ids->len; i++) { > + len = 16; > + int num_offsets = 1; > build_append_int_noprefix(table_data, 0xFFFF, 2); /* Type */ > - build_append_int_noprefix(table_data, 16, 2); /* Length */ > - build_append_int_noprefix(table_data, 0x1, 2); /* Revision */ > - build_append_int_noprefix(table_data, 1, 2); /* Number of offsets */ > - build_append_int_noprefix(table_data, i, 4); /* ACPI Processor UID */ > - build_append_int_noprefix(table_data, isa_offset, 4); /* Offsets[0] */ > + > + /* Length */ > + if (cmo_offset) { > + len += 4; > + num_offsets++; > + } > + > + build_append_int_noprefix(table_data, len, 2); > + build_append_int_noprefix(table_data, 0x1, 2); /* Revision */ > + /* Number of offsets */ > + build_append_int_noprefix(table_data, num_offsets, 2); > + build_append_int_noprefix(table_data, i, 4); /* ACPI Processor UID */ > + > + /* Offsets */ > + build_append_int_noprefix(table_data, isa_offset, 4); > + if (cmo_offset) { > + build_append_int_noprefix(table_data, cmo_offset, 4); > + } > } > > acpi_table_end(linker, &table);