From nobody Fri May 17 18:38:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1597109355; cv=none; d=zohomail.com; s=zohoarc; b=Szd9CXrWOOcNnIUXx6co1aZWIvDE42uB6espPxduoM4rfzSim2iD0kjA5Wpbu/c/V8ExohYS8yySilymuqOkWj51Kb06Ev2zXf9fDLyJEbbedJbOEPFUhw6L6UgFIlkPg0lGAFW3vs1Vzwg1WL8cUoq8yp3aPvZxa5hdQpr6hWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597109355; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=Vxm0RiVv51ZuiCM8yFgdPjjN2k3rQruO24Fic+XZZts=; b=W85gFcWsBe0DhV82HTCMhF8fadly4RIU+aXkGL84Bv7sp+tS+Pzk3wK40OCCCeKvfjssXAkVVp/jiLhmEq2CXhmliYnMslt7UB2fVmwkQtMgf1yAiJA2j/StWUBvYSyhYnJdpYYaHsZvA4F5uk5+pBbIZfAQ9mFgWT37buhdR0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597109355945231.45104056075195; Mon, 10 Aug 2020 18:29:15 -0700 (PDT) Received: from localhost ([::1]:33674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5J6I-0006TZ-PJ for importer@patchew.org; Mon, 10 Aug 2020 21:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5J5a-0005vA-8B; Mon, 10 Aug 2020 21:28:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5J5X-0000hz-UM; Mon, 10 Aug 2020 21:28:29 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07B13LGe039988; Mon, 10 Aug 2020 21:28:10 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 32u4g2628h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Aug 2020 21:28:10 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07B1Otlk009436; Tue, 11 Aug 2020 01:28:09 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma04dal.us.ibm.com with ESMTP id 32skp8u8yf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Aug 2020 01:28:09 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07B1S8u811993510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Aug 2020 01:28:08 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F08ABC605A; Tue, 11 Aug 2020 01:28:07 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6F44C6057; Tue, 11 Aug 2020 01:28:04 +0000 (GMT) Received: from pub.ltc.br.ibm.com (unknown [9.80.200.46]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 11 Aug 2020 01:28:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id; s=pp1; bh=Vxm0RiVv51ZuiCM8yFgdPjjN2k3rQruO24Fic+XZZts=; b=WFX3KwM0M/fX5X6uyqdGBZMhdRbXaCYxgR8766m3KmHoGMaaIQtUeKANuAOnVph48cYJ gW+bR0Cl0dUu1Hdtf84TMHy+QFIJij5T9NkVI6pQPuV1fz6TzzqGVic7nfQ69i/0x2C+ ck0adHG9Gopa5SQntxk3HBrPxod7dw0LSKK5udLhV0tVAk8hs1k/2TvnRDT1tN5o7Jmb AZlC0NPCvqaFuCdogn0ZbVklsoX44UYGqJER6WLVscbopXkXA3b9ol6uyAWHF1K50naT 77vbJDx2kFUw2TcVk29gXHplDj4XBXftWJsH9jbbRDU3rcRySNSWRnc9WmKbxYlYJnSN nQ== From: Gustavo Romero To: qemu-ppc@nongnu.org Subject: [PATCH] target/ppc: Integrate icount to purr, vtb, and tbu40 Date: Mon, 10 Aug 2020 22:27:59 -0300 Message-Id: <20200811012759.16329-1-gromero@linux.ibm.com> X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-10_22:2020-08-06, 2020-08-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 phishscore=0 mlxlogscore=792 impostorscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 suspectscore=1 bulkscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008110005 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=148.163.156.1; envelope-from=gromero@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/10 21:28:24 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: clg@kaod.org, david@gibson.dropbear.id.au, qemu-devel@nongnu.org, gromero@linux.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently if option '-icount auto' is passed to the QEMU TCG to enable counting instructions the VM crashes with the following error report when Linux runs on it: qemu-system-ppc64: Bad icount read This happens because read/write access to the SPRs PURR, VTB, and TBU40 is not integrated to the icount framework. This commit fixes that issue by making the read/write access of these SPRs aware of icount framework, adding the proper gen_io_start/end() calls before/after calling the helpers to load/store these SPRs in TCG. Signed-off-by: Gustavo Romero Reviewed-by: Peter Maydell --- target/ppc/translate_init.inc.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index 7e66822b5d..6bf5795c69 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -284,12 +284,26 @@ static void spr_write_atbu(DisasContext *ctx, int spr= n, int gprn) ATTRIBUTE_UNUSED static void spr_read_purr(DisasContext *ctx, int gprn, int sprn) { + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } gen_helper_load_purr(cpu_gpr[gprn], cpu_env); + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_end(); + gen_stop_exception(ctx); + } } =20 static void spr_write_purr(DisasContext *ctx, int sprn, int gprn) { + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } gen_helper_store_purr(cpu_env, cpu_gpr[gprn]); + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_end(); + gen_stop_exception(ctx); + } } =20 /* HDECR */ @@ -319,17 +333,38 @@ static void spr_write_hdecr(DisasContext *ctx, int sp= rn, int gprn) =20 static void spr_read_vtb(DisasContext *ctx, int gprn, int sprn) { + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } gen_helper_load_vtb(cpu_gpr[gprn], cpu_env); + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_end(); + gen_stop_exception(ctx); + } } =20 static void spr_write_vtb(DisasContext *ctx, int sprn, int gprn) { + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } gen_helper_store_vtb(cpu_env, cpu_gpr[gprn]); + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_end(); + gen_stop_exception(ctx); + } } =20 static void spr_write_tbu40(DisasContext *ctx, int sprn, int gprn) { + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } gen_helper_store_tbu40(cpu_env, cpu_gpr[gprn]); + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_end(); + gen_stop_exception(ctx); + } } =20 #endif --=20 2.17.1