From patchwork Fri May 10 17:30:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10939337 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 63F77112C for ; Fri, 10 May 2019 17:47:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5089427031 for ; Fri, 10 May 2019 17:47:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44A9428CA9; Fri, 10 May 2019 17:47:46 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 99A5527031 for ; Fri, 10 May 2019 17:47:43 +0000 (UTC) Received: from localhost ([127.0.0.1]:47722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP9cV-0007Yy-09 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 May 2019 13:47:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP9MZ-0007Ur-Rs for qemu-devel@nongnu.org; Fri, 10 May 2019 13:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP9MZ-0006AW-0P for qemu-devel@nongnu.org; Fri, 10 May 2019 13:31:15 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:43225) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hP9MY-00069x-R4 for qemu-devel@nongnu.org; Fri, 10 May 2019 13:31:14 -0400 Received: by mail-pl1-x641.google.com with SMTP id n8so3133298plp.10 for ; Fri, 10 May 2019 10:31:14 -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=iRt1ekpVqMBTFPlbEkwvccpMEH6z9s1kPn0wCee76Ys=; b=ehYp3aoJk6VPXB0pVCayxMCdYclH7yxIWbfUw9HmALoWfx1ww1+x8dh8NkU3Mm61pn qp0V/jNsvuDFUBloYorQnMIpz4cu9R88FlvMwFFpm3o4ldLmwjPNM/rKhZW0qGDTbyh1 Y7ooTEjVXBiFk/MtZSBVTfBP2IcOST+JwL6JKSmGFi2S6sgWiDT539/vwYyhtd/K7aCt VLsU5v/xqpNRC0NQFevLXL121aU+vNNHn90nS0gxQ8gpZpCW5FighaCQMRZnotwFtpf5 DrlD4bwdMgpqV5O8tXZaWTr/+1H3fjb5Hrw5EN8AVjXgfc+N4hsbqZwqCiLl2brwYjTh O/9w== 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=iRt1ekpVqMBTFPlbEkwvccpMEH6z9s1kPn0wCee76Ys=; b=Tl69pUUIiPt7ioZPqnVKyKb9da6pYEpQ1ANSTRrhkdxCh0ulearsGK9z5R5REf0Puz JRXdYTiPLDAab5nskdqnKucuEiDckOgdjK6cWm5h/hTYGAq8/JWatJuCsYN6xA4PURjN CHknT+4DtXLNw6lLORj0G4zGOtUAqaGC2v2Q88EyUpSe4bP1U/shfqNduYoI3YC45Hf2 uLdZNPVfvGAbSa9fZsWiepGkHTUryw4i28zj+1+kt+L64PKkuc+H7fKRVqCrg7tXZej5 cP2AiHVl5X4dWy5lmq+MgewMH+6Rwff16mgVSS6y7FsqhD/uS9sX8jVfBpWgWGfnqd9V AkgQ== X-Gm-Message-State: APjAAAWHpOIluPQlN3IAOnxzRT3B6VWAYSKbxD4Bu8sbNnDe0DiClWt8 NMegViKlYw4Gz8P9mw1ETeScb+93Xr0= X-Google-Smtp-Source: APXvYqweTSeoSGeWy2u+a8Uawi8fIL69IWBytxQmc2d1oRx43mMP2IPWWPpwtaqm6VdroZQgQ0EtjQ== X-Received: by 2002:a17:902:446:: with SMTP id 64mr14480345ple.322.1557509473495; Fri, 10 May 2019 10:31:13 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id v64sm7936792pfv.106.2019.05.10.10.31.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 10:31:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 10:30:42 -0700 Message-Id: <20190510173049.28171-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190510173049.28171-1-richard.henderson@linaro.org> References: <20190510173049.28171-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::641 Subject: [Qemu-devel] [PATCH v6 18/25] hw/misc/nrf51_rng: Use qemu_guest_getrandom_nofail 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: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The random number is intended for use by the guest. As such, we should honor the -seed argument for reproducibility. Use the *_nofail routine instead of error_abort directly. Cc: qemu-arm@nongnu.org Reviewed-by: Laurent Vivier Reviewed-by: Joel Stanley Signed-off-by: Richard Henderson --- hw/misc/nrf51_rng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/misc/nrf51_rng.c b/hw/misc/nrf51_rng.c index d188f044f4..3400e90a9b 100644 --- a/hw/misc/nrf51_rng.c +++ b/hw/misc/nrf51_rng.c @@ -14,7 +14,7 @@ #include "qapi/error.h" #include "hw/arm/nrf51.h" #include "hw/misc/nrf51_rng.h" -#include "crypto/random.h" +#include "qemu/guest-random.h" static void update_irq(NRF51RNGState *s) { @@ -145,7 +145,7 @@ static void nrf51_rng_timer_expire(void *opaque) { NRF51RNGState *s = NRF51_RNG(opaque); - qcrypto_random_bytes(&s->value, 1, &error_abort); + qemu_guest_getrandom_nofail(&s->value, 1); s->event_valrdy = 1; qemu_set_irq(s->eep_valrdy, 1);