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 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E009AC4167D for ; Tue, 31 Oct 2023 20:40:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxvXQ-0006Xp-Ph; Tue, 31 Oct 2023 16:40:37 -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 1qxvXO-0006Jf-Tf for qemu-riscv@nongnu.org; Tue, 31 Oct 2023 16:40:34 -0400 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxvXE-0007sB-WB for qemu-riscv@nongnu.org; Tue, 31 Oct 2023 16:40:34 -0400 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-5a877e0f0d8so2257417b3.1 for ; Tue, 31 Oct 2023 13:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1698784809; x=1699389609; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pwGCY0qynbo3cP6hReMJsDHlt98HHGr0zsLvnBxeHmw=; b=DVtcK1wnMqlFZR/Zftl4CsdmPj5Gtkgc3M6TuCzl0p2QTrIIHev4JGKnI/7mNwMKRQ X+IgU3muGT0n0jXjFXRlvnWLjUE3bDBK8XBeAqiY1KdQWDzm3gI0XYy6J1J4vBDyghKg iywsd4PAfGNiSR2+cLcHiWm6W5BdEzOyyM2y2O9mto9VFaWT7ilktTJU8ISifUmmRVDO HMz6tmsCwTWBQ/g3JT7/FQBRPYG/XnKOghNU5je9R2cfwOm4+Lih03oRhkPRk032m8qx ZHSwNqASall10zhhq9Pw9ISOAmqVhk0xKvLQ1zkY9DmoN3wn0mD94FwdPqDOdLJD4X2E uq4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698784809; x=1699389609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pwGCY0qynbo3cP6hReMJsDHlt98HHGr0zsLvnBxeHmw=; b=VQm2Wd7QWSvO51xnCs7MSplnOBNszyHdjwJTEKNGmIE3SX94DB1axMGY6j6NXzlqdZ pmy+yLp+h5F6NwUlVkK6mnvzT2udR9DD/UCgvuyCLOQbYDH5gp3YW19E1RgYpy7jCuk2 c99j1F5zm/3IdDPVJ2rriACjBf7MRFQ1kr+wPFgPxamXPU7rlZsW4oyU+WWlpaJ3V9UO d84COBUxU1BWjTxnz7OWTnZP+qfJ+RPNSUr0wlc0wQ3WEjBVN0JbQSsY10qs/lbmS4fO S6RAUJZ6DuSyFNQ/OlwCaOxCy6hafoxGfomSfJ5HqXHqzNzKQqGj6mhz2WG7bcw1diYs z8BQ== X-Gm-Message-State: AOJu0Yy6lhUVEpNExZ78iPBKUr6Y/yv04agz12VpWKEBl3oA1bRYkc3b zoFXkDFY5DnKdptA7f0JnnXc0g== X-Google-Smtp-Source: AGHT+IG8AEuezmfztrgA4mv4MSs/52+J5eOxwAg4I8oIbt0FpaKAbgZB7H+IKNgrMnA1XHOcgqZwtA== X-Received: by 2002:a05:690c:15:b0:5ae:15bb:466a with SMTP id bc21-20020a05690c001500b005ae15bb466amr3969785ywb.14.1698784809068; Tue, 31 Oct 2023 13:40:09 -0700 (PDT) Received: from grind.. ([179.193.10.161]) by smtp.gmail.com with ESMTPSA id k1-20020a81ff01000000b005add997ae53sm1272802ywn.81.2023.10.31.13.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 13:40:08 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH v7 16/16] riscv-qmp-cmds.c: add profile flags in cpu-model-expansion Date: Tue, 31 Oct 2023 17:39:16 -0300 Message-ID: <20231031203916.197332-17-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231031203916.197332-1-dbarboza@ventanamicro.com> References: <20231031203916.197332-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::1133; envelope-from=dbarboza@ventanamicro.com; helo=mail-yw1-x1133.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, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@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-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Expose all profile flags for all CPUs when executing query-cpu-model-expansion. This will allow callers to quickly determine if a certain profile is implemented by a given CPU. This includes vendor CPUs - the fact that they don't have profile user flags doesn't mean that they don't implement the profile. After this change it's possible to quickly determine if our stock CPUs implement the existing rva22u64 profile. Here's a few examples: $ ./build/qemu-system-riscv64 -S -M virt -display none -qmp tcp:localhost:1234,server,wait=off $ ./scripts/qmp/qmp-shell localhost:1234 Welcome to the QMP low-level shell! Connected to QEMU 8.1.50 - As expected, the 'max' CPU implements the rva22u64 profile. (QEMU) query-cpu-model-expansion type=full model={"name":"max"} {"return": {"model": {"name": "rv64", "props": {... "rva22u64": true, ...}}}} - rv64 is missing "zba", "zbb", "zbs", "zkt" and "zfhmin": query-cpu-model-expansion type=full model={"name":"rv64"} {"return": {"model": {"name": "rv64", "props": {... "rva22u64": false, ...}}}} query-cpu-model-expansion type=full model={"name":"rv64", "props":{"zba":true,"zbb":true,"zbs":true,"zkt":true,"zfhmin":true}} {"return": {"model": {"name": "rv64", "props": {... "rva22u64": true, ...}}}} We have no vendor CPUs that supports rva22u64 (veyron-v1 is the closest - it is missing just 'zkt'). In short, aside from the 'max' CPU, we have no CPUs that supports rva22u64 by default. Signed-off-by: Daniel Henrique Barboza --- target/riscv/riscv-qmp-cmds.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c index 5ada279776..205aaabeb9 100644 --- a/target/riscv/riscv-qmp-cmds.c +++ b/target/riscv/riscv-qmp-cmds.c @@ -116,6 +116,19 @@ static void riscv_obj_add_named_feats_qdict(Object *obj, QDict *qdict_out) } } +static void riscv_obj_add_profiles_qdict(Object *obj, QDict *qdict_out) +{ + RISCVCPUProfile *profile; + QObject *value; + + for (int i = 0; riscv_profiles[i] != NULL; i++) { + profile = riscv_profiles[i]; + value = QOBJECT(qbool_from_bool(profile->enabled)); + + qdict_put_obj(qdict_out, profile->name, value); + } +} + static void riscv_cpuobj_validate_qdict_in(Object *obj, QObject *props, const QDict *qdict_in, Error **errp) @@ -220,6 +233,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, riscv_obj_add_multiext_props(obj, qdict_out, riscv_cpu_experimental_exts); riscv_obj_add_multiext_props(obj, qdict_out, riscv_cpu_vendor_exts); riscv_obj_add_named_feats_qdict(obj, qdict_out); + riscv_obj_add_profiles_qdict(obj, qdict_out); /* Add our CPU boolean options too */ riscv_obj_add_qdict_prop(obj, qdict_out, "mmu"); -- 2.41.0