From patchwork Tue May 14 19:16:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164240 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3008006ili; Tue, 14 May 2019 12:26:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9aRoRDfgZymNZZ7Hw2AlVeiVDbqWDt82eviEJjKN179wU0PSIxSvzK1bC9Ha1yygbI+4A X-Received: by 2002:a05:6402:180b:: with SMTP id g11mr38716396edy.268.1557861974251; Tue, 14 May 2019 12:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557861974; cv=none; d=google.com; s=arc-20160816; b=asTiLbvdFslR2sU49UJXRMn7+vZsOXo7u8fII0jf1e9xiB68iWGE5PEzwjUzGlWa8A m1De1xyPlBqRH8xWFu4tCZN2nCDjBoCH8YeZ2lQ4k2M3IkxIhSL8m3ABdnPpDH9WKmLT flj2xRoOPYiXjwZuq5TpGK7F8ep1CWMEj5p0jeosaqR7jkve67ZsqptTJNfXCF5zzwFD umGzjIg3IBrzikrjEt766qwy9P74YA1VStqAK5KW6j7CElXhs/RtSDKrrSd+GpXkJG37 xCc11hVc5VMMAd+iI+P8bSPzN0U9+V2gxgOqT5H9vnhV5/SD1x1EdidCfaSPoU1Npk+B oI7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=jubgcMuTGNSY5TtGEwh0c6OxeP3qp5DidyhAq6jVSSw=; b=E4RqOtrfBi4dwDBvglV3MWdUYBLFf4p2IDsZQTBnsLvcZQnbkZw/RxUExydw2Q013L 2UMwuDPzd26e+r2EUVYelCnA/oE7IMVwDhjvO3ConsNo7p1U6MHANUnOq03ccauKpUS/ zUfwdY9yteWxPXtbXsiyXZGnUHbcmJ9e1dANSrgP8GWSF24agEzDFoeNAdGFqKa/PebS Yz80bvuTjg0rZHFZ/S42p2tlP7Z8q+QWmnkCoHl4Eok9e9TktqAOWhSS1xCzC5P+1jSN 6u305URgpczeL9RvrbfVjtp1tzO75ECCPXfoM3ScG/vyRjZT8gEG4zXym+u86KnkNCtq x7Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=USq6jzxM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w15si2627086edv.270.2019.05.14.12.26.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 14 May 2019 12:26:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=USq6jzxM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQd41-000273-4I for patch@linaro.org; Tue, 14 May 2019 15:26:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQcvd-0002o8-1y for qemu-devel@nongnu.org; Tue, 14 May 2019 15:17:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQcvZ-0007D5-AD for qemu-devel@nongnu.org; Tue, 14 May 2019 15:17:31 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:45597) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQcvX-0007A2-CC for qemu-devel@nongnu.org; Tue, 14 May 2019 15:17:28 -0400 Received: by mail-pf1-x443.google.com with SMTP id s11so9613058pfm.12 for ; Tue, 14 May 2019 12:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jubgcMuTGNSY5TtGEwh0c6OxeP3qp5DidyhAq6jVSSw=; b=USq6jzxMgaDUaG3WM5mv/86HAk8ydS51FPFNqcritjxxEKAosVlp5suwP9i/dIjTav g3btabJUyGGeeUvdNCD2n006RMXNCr8HJhUowRVkirYEJYCPKg9lQ6o4cngo6OfoIX4v MT7Re2niSRdtLT1amhr69tPvfXiDoIUR0uPMDi/lK8ct3Vt82XMHRyaBCSkVHLb/deF4 e/j4j/qLRCHr011Kwqi9WQI7UJuNQ+CpBx19x8Wxum7R+BRTWJashGP4hr+8/fzKityc Q/ZJVDSyAo8B5Gc+6BO30SzXT6Bb9PFKi2dyPOIHU8YVho64enIFGigrCDePbVICpiej xFeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jubgcMuTGNSY5TtGEwh0c6OxeP3qp5DidyhAq6jVSSw=; b=AgmFE9o9fkqVZ2cgrp1acYf60mAfhAFXXw/HDQvzawl7bLVzQIpEj/hbJVawZz8odU slrGFrIYuGsK73BB1I3HvHhsQPsFtK+Ga91GRyH7a0R5yjy3vlEIB/h5NKveEbYX4pD3 RGeLCBcW9Q2GKWdUZvHn3GH4yVm++2niC81pjyh9IQ9uZK/jkjw7zRH+JscfBlba/ykG AcscsychIByBnQZbBIQzXwoZCIS2AXalFo738TlGdNO0Cc6BAmhpdp2EERLSI9QiIcBg OjgLH4gNwEXld3AKBwiy4VfpmUkYvr8+T2n747felCFvt5UQu9QAGIqI0D/DDysgWFbv XxdQ== X-Gm-Message-State: APjAAAUY+//co7YGcBLJkAzvAXf7B3/Q12aKNJwPNzd3lkY3SqXaZ8js q/5eT2pP7iGJQ9QC9bxejAYgTmSHSKQ= X-Received: by 2002:a62:2687:: with SMTP id m129mr43682012pfm.204.1557861445759; Tue, 14 May 2019 12:17:25 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id o6sm18682982pfa.88.2019.05.14.12.17.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 12:17:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 12:16:52 -0700 Message-Id: <20190514191653.31488-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190514191653.31488-1-richard.henderson@linaro.org> References: <20190514191653.31488-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v7 23/24] target/ppc: Use gen_io_start/end around DARN 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: lvivier@redhat.com, berrange@redhat.com, armbru@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Generating a random number counts as I/O, as it cannot be replayed and produce the same results. Acked-by: David Gibson Reviewed-by: Laurent Vivier Suggested-by: Peter Maydell Signed-off-by: Richard Henderson --- target/ppc/translate.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index b5217f632f..4a5de28036 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1847,13 +1847,22 @@ static void gen_darn(DisasContext *ctx) { int l = L(ctx->opcode); - if (l == 0) { - gen_helper_darn32(cpu_gpr[rD(ctx->opcode)]); - } else if (l <= 2) { - /* Return 64-bit random for both CRN and RRN */ - gen_helper_darn64(cpu_gpr[rD(ctx->opcode)]); - } else { + if (l > 2) { tcg_gen_movi_i64(cpu_gpr[rD(ctx->opcode)], -1); + } else { + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } + if (l == 0) { + gen_helper_darn32(cpu_gpr[rD(ctx->opcode)]); + } else { + /* Return 64-bit random for both CRN and RRN */ + gen_helper_darn64(cpu_gpr[rD(ctx->opcode)]); + } + if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { + gen_io_end(); + gen_stop_exception(ctx); + } } } #endif