From nobody Sat May 18 13:16:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1683226445; cv=none; d=zohomail.com; s=zohoarc; b=n/Ey6rK0rm4ryIhZJyb/R9B+SPDIl1YUlPJln9QbIej5MkqBRLvPCsuXQ1oPQihjw0b61mUsgefel+jTFuNhN4eLMJTKbKXB9B8AVz6gqWr5T1zTTCcn2NY71UOsdXpMfcB5d2KzRXhWnj07ikDyG8mvX0LKGo1r4BXB0a7HlS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683226445; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gdkUuzfDepmGDmH4qS+yCyWMFLpf3YIYFmhx/2mlh5w=; b=PvgrgotkbXjARp9hS4/fv/TkNBswroJtUuSev61uqeXSRbSnMRlBk39JfAw4pPPZZI7iuIvsVd6hSbZtjUgetCnG1NSijo41/sMKGMGNXfDWTOipvC/PJ7hfBZ9vqvlw0hV77cwdLjs7LK9j0iFjWDDd+TOQpBE+eDyghJA3N0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683226445159386.0036874954184; Thu, 4 May 2023 11:54:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pue51-0003lM-8T; Thu, 04 May 2023 14:53:27 -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 1pue4w-0003iz-AK for qemu-devel@nongnu.org; Thu, 04 May 2023 14:53:22 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pue4s-0004dV-5p for qemu-devel@nongnu.org; Thu, 04 May 2023 14:53:21 -0400 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 344IQvqY018667 for ; Thu, 4 May 2023 18:53:15 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qc50421r4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 May 2023 18:53:15 +0000 Received: from pps.filterd (NALASPPMTA02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 344IrExT024335 for ; Thu, 4 May 2023 18:53:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3q8vamfe0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 May 2023 18:53:14 +0000 Received: from NALASPPMTA02.qualcomm.com (NALASPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 344IrEIg024329 for ; Thu, 4 May 2023 18:53:14 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-mathbern-lv.qualcomm.com [10.47.235.147]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 344IrD3j024325 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 May 2023 18:53:14 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 4229910) id 8389570F3; Thu, 4 May 2023 15:53:13 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=qcppdkim1; bh=gdkUuzfDepmGDmH4qS+yCyWMFLpf3YIYFmhx/2mlh5w=; b=MvTslPRVw5TZFxBj/VOZ6gPbXX09I6IgPO4kUTAcJeyTdp73NF1Z7MywZfXH9qODcm54 bj/vwBC18tHeNfyfXeASsIYuXeFwJYWf1dV/FnnW+4Nj0toMu1W5brHRiPFEaVZyq0It +ppvb2Ucdw7u0/R7VIwj75cLVfh4MQMovjnLZ4XamoA8ZVSnYTrPafrmacFIvDhYHHeF HbcOMAx4oYXMyjtOdRMyZauPoPYEMJ8vXbtBU5bTcBXUCya6KD+tjlX93zqooxBlmTVO phTfD2Qu0spm0Oqw+u9j/hCKZPl0yxhIr4duU1HrLQ0pc6qf3NEQT28h6rSc69Eybo6I DA== From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, tsimpson@quicinc.com Subject: [PATCH 1/2] Hexagon: list available CPUs with `-cpu help` Date: Thu, 4 May 2023 15:53:11 -0300 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Y_BDlsoEZVfuSfqM-RDj6kPRCQivLesj X-Proofpoint-ORIG-GUID: Y_BDlsoEZVfuSfqM-RDj6kPRCQivLesj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-04_12,2023-05-04_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 suspectscore=0 adultscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 mlxlogscore=931 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305040150 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=mathbern@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1683226446726100001 Content-Type: text/plain; charset="utf-8" Currently, qemu-hexagon only models the v67 cpu. Nonetheless if we try to get this information with `-cpu help`, qemu just exists with an error code and no output. Let's correct that. The code is basically a copy from target/alpha/cpu.h, but we strip the "-hexagon-cpu" suffix before printing. This is to avoid confusing situations like the following: $ qemu-hexagon -cpu help Available CPUs: v67-hexagon-cpu $ qemu-hexagon -cpu v67-hexagon-cpu ./prog qemu-hexagon: unable to find CPU model 'v67-hexagon-cpu' Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Taylor Simpson Tested-by: Taylor Simpson --- target/hexagon/cpu.h | 3 +++ target/hexagon/cpu.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 81b663ecfb..d59e5bbff8 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -44,6 +44,9 @@ =20 #define TYPE_HEXAGON_CPU_V67 HEXAGON_CPU_TYPE_NAME("v67") =20 +void hexagon_cpu_list(void); +#define cpu_list hexagon_cpu_list + #define MMU_USER_IDX 0 =20 typedef struct { diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index ab40cfc283..e8c2b5e910 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -29,6 +29,26 @@ static void hexagon_v67_cpu_init(Object *obj) { } =20 +static void hexagon_cpu_list_entry(gpointer data, gpointer user_data) +{ + ObjectClass *oc =3D data; + char *name =3D g_strdup(object_class_get_name(oc)); + if (g_str_has_suffix(name, HEXAGON_CPU_TYPE_SUFFIX)) { + name[strlen(name) - strlen(HEXAGON_CPU_TYPE_SUFFIX)] =3D '\0'; + } + qemu_printf(" %s\n", name); + g_free(name); +} + +void hexagon_cpu_list(void) +{ + GSList *list; + list =3D object_class_get_list_sorted(TYPE_HEXAGON_CPU, false); + qemu_printf("Available CPUs:\n"); + g_slist_foreach(list, hexagon_cpu_list_entry, NULL); + g_slist_free(list); +} + static ObjectClass *hexagon_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; --=20 2.37.2 From nobody Sat May 18 13:16:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1683226445; cv=none; d=zohomail.com; s=zohoarc; b=WxcVeBHz7qwQsOCS5nwWCZ7M7YG18tjHtlzyhChB0fEiI6PicGvpapZNZnAj+sZzKSCsFhgew92PcvjM32+mo+e27MmzDk7tis5hB02z8IWudlt7LIVOu1nR6nzwxE1ifmDQyoblhUJ+gxjrBy+6NAH8LtMwvYSeSxTbfB6h/K8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683226445; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8AgN9QChYC2sDfZnbc+EgAUVmjmOUXkGJ6PrUIlW/Fo=; b=e/2kwSs0mX2hYP+ExAKIgq4mPDbEsSdO/SLEuQE2umCPGeiQcqo7seA828CcvJg6V4XJeEI8mVhhHzW+Nx9tcei4/Dax4fdlXWKGPxO/LitqQn6imbyKdmROeiLqg58DsO22a7ZNYYR2N+CR1BWOdqMTmDBvvd2863XBWtxO5Rk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683226445766747.569837988883; Thu, 4 May 2023 11:54:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pue5P-0003ur-UM; Thu, 04 May 2023 14:53:51 -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 1pue5M-0003tr-7D for qemu-devel@nongnu.org; Thu, 04 May 2023 14:53:48 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pue5K-0004yn-Gh for qemu-devel@nongnu.org; Thu, 04 May 2023 14:53:47 -0400 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 344FxLC6023304; Thu, 4 May 2023 18:53:45 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qc8kw9mng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 May 2023 18:53:45 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 344IrE3m021211; Thu, 4 May 2023 18:53:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3qbe38us9g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 May 2023 18:53:14 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 344IrDwr021202; Thu, 4 May 2023 18:53:14 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-mathbern-lv.qualcomm.com [10.47.235.147]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 344IrDk4021199 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 May 2023 18:53:13 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 4229910) id 9269B70F4; Thu, 4 May 2023 15:53:13 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=qcppdkim1; bh=8AgN9QChYC2sDfZnbc+EgAUVmjmOUXkGJ6PrUIlW/Fo=; b=OX0DnuqxMo5Yo5b79AtGvD26s6AbbWaZ19vtLsMc4MbObpJ8ys03jS5WeuyPDoZLnQTf se0wcZ9i6lAqaNqHqoTp2TqEpgGNm8aWCqOf+WipgrM4uZbWccgS8aqcaTIhWHYiQixP dT/kmnTP/zBih+GSGNp32H/lbyyyBBnwyFY+yDEUpR9FzhcPHAAiZPcYAYXaCnLmvjZq 8MzmA6vN/RdKQe/I+pDgKsEZV31gU1Effz3Q9pi/DQjGsA35KuKOLgAMTZdum0W4g667 sxAVaU8IPPBC2uVwnpMnABQ8DUDhOi4IzPJUvngaSO7gllztD6Igx2+XKlph9RkrVRVb XA== From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: bcain@quicinc.com, tsimpson@quicinc.com, Laurent Vivier Subject: [PATCH 2/2] Hexagon: append eflags to unknown cpu model string Date: Thu, 4 May 2023 15:53:12 -0300 Message-Id: <8a8d013cc619b94fd4fb577ae6a8df26cedb972b.1683225804.git.quic_mathbern@quicinc.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: WmT8MLhuISAnqC6eSll0oVUVPcXXJxUg X-Proofpoint-ORIG-GUID: WmT8MLhuISAnqC6eSll0oVUVPcXXJxUg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-04_13,2023-05-04_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=469 malwarescore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305040151 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=mathbern@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1683226446950100003 Content-Type: text/plain; charset="utf-8" Running qemu-hexagon with a binary that was compiled for an arch version unknown by qemu can produce a somewhat confusing message: qemu-hexagon: unable to find CPU model 'unknown' Let's give a bit more info by appending the eflags so that the message becomes: qemu-hexagon: unable to find CPU model 'unknown (0x69)' Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Taylor Simpson Tested-by: Taylor Simpson --- linux-user/hexagon/target_elf.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/linux-user/hexagon/target_elf.h b/linux-user/hexagon/target_el= f.h index b4e9f40527..f47e130537 100644 --- a/linux-user/hexagon/target_elf.h +++ b/linux-user/hexagon/target_elf.h @@ -20,6 +20,9 @@ =20 static inline const char *cpu_get_model(uint32_t eflags) { + static char buf[32]; + int err; + /* For now, treat anything newer than v5 as a v67 */ /* FIXME - Disable instructions that are newer than the specified arch= */ if (eflags =3D=3D 0x04 || /* v5 */ @@ -34,7 +37,9 @@ static inline const char *cpu_get_model(uint32_t eflags) ) { return "v67"; } - return "unknown"; + + err =3D snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags); + return err >=3D 0 && err < sizeof(buf) ? buf : "unknown"; } =20 #endif --=20 2.37.2