From patchwork Mon Feb 4 04:18:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandipan Das X-Patchwork-Id: 1035680 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43tDyK4zZyz9s3x for ; Mon, 4 Feb 2019 15:20:09 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43tDyK3mBJzDqH1 for ; Mon, 4 Feb 2019 15:20:09 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=sandipan@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43tDwt6cRCzDqDC for ; Mon, 4 Feb 2019 15:18:51 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x14494qK129391 for ; Sun, 3 Feb 2019 23:18:48 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qe99g8cmh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 03 Feb 2019 23:18:48 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Feb 2019 04:18:47 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 4 Feb 2019 04:18:45 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x144Ihjs8323422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Feb 2019 04:18:43 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B81AA405F; Mon, 4 Feb 2019 04:18:43 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3E98A405B; Mon, 4 Feb 2019 04:18:41 +0000 (GMT) Received: from localhost.localdomain (unknown [9.195.22.129]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 4 Feb 2019 04:18:41 +0000 (GMT) From: Sandipan Das To: mpe@ellerman.id.au Subject: [RFC PATCH 0/5] powerpc: sstep: Emulation test infrastructure Date: Mon, 4 Feb 2019 09:48:34 +0530 X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19020404-4275-0000-0000-0000030A16C6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19020404-4276-0000-0000-0000381816F2 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=855 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902040033 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: naveen.n.rao@linux.ibm.com, paulus@samba.org, linuxppc-dev@lists.ozlabs.org, ravi.bangoria@linux.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This aims to add a test infrastructure for the in-kernel instruction emulation code. This is currently limited to testing only the basic integer operations and supports verification of the GPRs, LR, XER and CR. There can be multiple test cases for each instruction. Each test case has to be provided with the initial register state (in the form of a struct pt_regs) and the 32-bit instruction to test. Apart from verifying the end result, problems with the behaviour of certain instructions for things like setting certain bits in CR or XER (which can also be processor dependent) can be identified. For example, the newly introduced CA32 bit in XER, exclusive to P9 CPUs as of now, was not being set when expected for some of the arithmetic and shift instructions. With this infrastructure, it will be easier to identify such problems and rectify them. The test cases for the addc[.] instruction demonstrate this for different scenarios where the CA and CA32 bits of XER should be set. Sandipan Das (5): powerpc: Add bitmasks for D-form instruction fields powerpc: Add bitmask for Rc instruction field powerpc: sstep: Add instruction emulation selftests powerpc: sstep: Add selftests for add[.] instruction powerpc: sstep: Add selftests for addc[.] instruction arch/powerpc/Kconfig.debug | 5 + arch/powerpc/include/asm/ppc-opcode.h | 5 + arch/powerpc/lib/Makefile | 1 + arch/powerpc/lib/exec_test_instr.S | 150 +++++++ arch/powerpc/lib/sstep_tests.c | 564 ++++++++++++++++++++++++++ 5 files changed, 725 insertions(+) create mode 100644 arch/powerpc/lib/exec_test_instr.S create mode 100644 arch/powerpc/lib/sstep_tests.c