From patchwork Wed Feb 6 16:51:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabiano Rosas X-Patchwork-Id: 10799629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 279851390 for ; Wed, 6 Feb 2019 16:53:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D00BC2CD4D for ; Wed, 6 Feb 2019 16:53:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2E522CE5B; Wed, 6 Feb 2019 16:53:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58FFA2CD4D for ; Wed, 6 Feb 2019 16:53:32 +0000 (UTC) Received: from localhost ([127.0.0.1]:53804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grQS3-0000nq-5o for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Feb 2019 11:53:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grQQW-0007ra-Pw for qemu-devel@nongnu.org; Wed, 06 Feb 2019 11:51:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grQQN-0001EV-Pg for qemu-devel@nongnu.org; Wed, 06 Feb 2019 11:51:53 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55834 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1grQQK-0001CB-Re for qemu-devel@nongnu.org; Wed, 06 Feb 2019 11:51:47 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x16GpAds065716 for ; Wed, 6 Feb 2019 11:51:42 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qg23pdkfb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 06 Feb 2019 11:51:40 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Feb 2019 16:51:39 -0000 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 6 Feb 2019 16:51:36 -0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x16GpZu619267716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 6 Feb 2019 16:51:35 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BE05DC6057; Wed, 6 Feb 2019 16:51:35 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9ED40C6055; Wed, 6 Feb 2019 16:51:34 +0000 (GMT) Received: from farosas.linux.ibm.com.br.ibm.com (unknown [9.18.235.171]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 6 Feb 2019 16:51:34 +0000 (GMT) From: Fabiano Rosas To: qemu-devel@nongnu.org Date: Wed, 6 Feb 2019 14:51:32 -0200 X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 x-cbid: 19020616-0012-0000-0000-0000170610D7 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010548; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000279; SDB=6.01157200; UDB=6.00603701; IPR=6.00937729; MB=3.00025466; MTD=3.00000008; XFM=3.00000015; UTC=2019-02-06 16:51:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19020616-0013-0000-0000-0000561A8D5A Message-Id: <20190206165133.12246-1-farosas@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-06_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902060129 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v5 0/1] ppc/gdbstub: Expose SPRs to GDB X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This series implements the reading and writing of Special Purpose Registers in PPC's gdbstub. How it works generally [1]: GDB asks for the target.xml file which contains the target description along with the list of available feature XMLs. GDB then asks for each of the XML files in sequence. The XML files contain a list of registers descriptions: When the user tries to access a register, GDB reads the XML file in sequence and sends QEMU the number of the register. This number is sequential across all feature files. The index provided by GDB must be converted by QEMU to match QEMU's internal representation. A set of callbacks are implemented to read/write the register. Note about endianness: GDB remote protocol defines that registers should be sent in target (guest) byte order. It will store the value in memory without regard to endianness and later use what it thinks is the target endianness to choose a byte order for printing. This means that the `show endian` option in GDB should match the guest's current endianness for the values to display properly. Notice that GDB and QEMU could be running in machines of opposite endianness. https://sourceware.org/gdb/current/onlinedocs/gdb/Target-Descriptions.html v1 -> v2: - patch 1: explicitly store the gdb_id and add comment explaining why we need it - patch 2: use gdb_id to find the correct env->spr array's index https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg00648.html v2 -> v3: - patch 2: move gdb_register_coprocessor call from patch 3 so that all patches build independently https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg02939.html v3 -> v4: - patch 1: move gdb_spr_xml into PowerPCCPUClass so that it is generated only once for all CPUs http://lists.nongnu.org/archive/html/qemu-ppc/2019-01/msg00357.html v4 -> v5: - squash all 3 patches - use g_string_append() instead of g_string_append_printf() where possible - free the g_ascii_strdown() string - fix uninitialized variable - use POWERPC_CPU_GET_CLASS with CPUState Regarding the endianness discussion, continue providing the registers in the target endianness as GBD currently requires this. http://lists.nongnu.org/archive/html/qemu-ppc/2019-01/msg00498.html Fabiano Rosas (1): target/ppc: Enable reporting of SPRs to GDB target/ppc/cpu-qom.h | 4 +++ target/ppc/cpu.h | 5 +++ target/ppc/gdbstub.c | 61 ++++++++++++++++++++++++++++++++ target/ppc/translate_init.inc.c | 62 +++++++++++++++++++++++++++++++-- 4 files changed, 130 insertions(+), 2 deletions(-) --- 2.17.1