From nobody Mon Feb 9 00:19:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1595863239; cv=none; d=zohomail.com; s=zohoarc; b=SHlBUjVzm98DsEz2DTSIs5Y37PyuDCUflhrsEHcfLAdPth6jPOObWIlC8mvcmQhasnYAXKofIlw58JnlVkcStfyYOfRDOJCw0wAcVbd7NplqdLTuNZZqzpyj0NFLoLplsnBum1YXkNCwDojGsTCInMTVYexozQnkAgIXNLMW4fU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595863239; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uOYlhryYGKuk9GHY1annootwLvGZo9Yx/GyMtSFdjtA=; b=FSwT5xV2wq+qbsAM7bKkisvEen/GmfNWIqrRKaMbiBpZeNGwMtn3O/OCSDfufS1LLVq4HSP5ok5U5Vhz+/dwTsU53aclqBM8sORqiMvG1ST8dJy495PfY2i73IR7FVPRWTzxOrpwMo38JIGifWqVZGwcZ1+k9GEiT/TWMyC39t4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595863239704625.2890482915227; Mon, 27 Jul 2020 08:20:39 -0700 (PDT) Received: from localhost ([::1]:37470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k04ve-0002ry-96 for importer@patchew.org; Mon, 27 Jul 2020 11:20:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k04uZ-0001Yw-B4 for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:31 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:41559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k04uX-0001MB-KZ for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:31 -0400 Received: by mail-wr1-x42b.google.com with SMTP id r2so10202892wrs.8 for ; Mon, 27 Jul 2020 08:19:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h199sm18744996wme.42.2020.07.27.08.19.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=uOYlhryYGKuk9GHY1annootwLvGZo9Yx/GyMtSFdjtA=; b=Kqm0/B/WozkP+XG2CKFgyPXDYDrLMQnhkh1nKqwyl9HbOmzMU0Fv4i0DcYrXGpY43h wfyf827TtCrhfJRS+d2jQd8PrU5Bjq+o+AGP4gzBUBYbM9S/u7QbEK1bQN+Ae48aMXEK ajzVXiTZuuFyCHHhK8vmqySZ7O/ip8fp3y+V8uMW4hI3JK1nHPsboNBmfUUgRL6L04UM +Mi2pFZOI2dWcXw3VknOZocy75p95BhQasd/9WoLELR0/lL1zYO4uIG5RfvHd1rfP/zO PAom2mv8lX5DTbPedvyHJSWeeLTiyZos6YTBfr+BareInztzvEQrh7/GJHhNTf74gtju U/iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uOYlhryYGKuk9GHY1annootwLvGZo9Yx/GyMtSFdjtA=; b=dRFRmw8XOf3fn6yZze6xl/lfGgo7LIzYYQLs9chBtkan8JU2pRixe7p9n6tfGaOF/s e0htcddJMagEYmCXSAAqUcTK01M00R2ghem7+Do4+YVB9qnc+XKt/IY3jnwu5fgjQYNc PpL3BhLfSju4Xuo9K8QF31OOmnggmNmCq0ifBB8gss6X+dTlEWQJpDLuzgNDASdIxeDO cWXxlGZ7AyrcY/aprSfLCH/DRIdjHVwolr8v6BfkxvyWO3Y8E3/PGwR1+O5t5G1fodya 46m9FCIS3b2O3wZtU1UCkhQNleTfGbXgrT1k6gr4o+HAb4liilv5NSmY7iXHaVfjZEwJ bIIQ== X-Gm-Message-State: AOAM5324CxWO+rDoZivbR0C0xnHiGkwR88W62ZejJZKGYbewI5thoKgk C4WmPhP50En4oPtLVgp+ih2tefo82eR2sg== X-Google-Smtp-Source: ABdhPJwQgjN6+aevGwF9RimnsJW3hna/+qpKOFjRrPYaO2mL1C9rs59/lQPk2IMPlljgvbiH3BmR2w== X-Received: by 2002:a5d:48c8:: with SMTP id p8mr20277745wrs.84.1595863164850; Mon, 27 Jul 2020 08:19:24 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 1/7] ACPI: Assert that we don't run out of the preallocated memory Date: Mon, 27 Jul 2020 16:19:14 +0100 Message-Id: <20200727151920.19150-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727151920.19150-1-peter.maydell@linaro.org> References: <20200727151920.19150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Dongjiu Geng data_length is a constant value, so we use assert instead of condition check. Signed-off-by: Dongjiu Geng Message-id: 20200622113146.33421-1-gengdongjiu@huawei.com Reviewed-by: Michael S. Tsirkin Signed-off-by: Peter Maydell --- hw/acpi/ghes.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index b363bc331d0..f0ee9f51caa 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -204,16 +204,12 @@ static int acpi_ghes_record_mem_error(uint64_t error_= block_address, =20 /* This is the length if adding a new generic error data entry*/ data_length =3D ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; - /* - * Check whether it will run out of the preallocated memory if adding = a new - * generic error data entry + * It should not run out of the preallocated memory if adding a new ge= neric + * error data entry */ - if ((data_length + ACPI_GHES_GESB_SIZE) > ACPI_GHES_MAX_RAW_DATA_LENGT= H) { - error_report("Not enough memory to record new CPER!!!"); - g_array_free(block, true); - return -1; - } + assert((data_length + ACPI_GHES_GESB_SIZE) <=3D + ACPI_GHES_MAX_RAW_DATA_LENGTH); =20 /* Build the new generic error status block header */ acpi_ghes_generic_error_status(block, ACPI_GEBS_UNCORRECTABLE, --=20 2.20.1 From nobody Mon Feb 9 00:19:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1595863331; cv=none; d=zohomail.com; s=zohoarc; b=dNiz+Ea6+aU+Ta5xHgJ/gEwLRzX4oNYvAoyJLnEA1ySXIwqQZ5gNFNHg3/1fIYE1Z5OgXpH8XhA/DxIYrU+jhW3z6iv72bT0qtu/yFh8biXVYKINVVEKMRVGnvfrn5f2mU7gFABeYsFtdoX9pwP9+UC0eqtnJGVcR09OnsPsDko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595863331; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I7vtUCKWCL7jNAPS28tV4Fp/0HKktgVJJq19XFkLoME=; b=NsFJY6sCvv/8vpIc/F/CWV0zy9HLUbdJpMpecor/asrWPDi4W63B4bkf68qFnYPIDp1TquNr5Fs7ncpeSJVa+ZNqifnpv6D7Fx/QlLw3OOX232xDYw2yAvG1S7RCsttRAianASOyoZAQJNWgzHhrZLljDZQE7Q8dM+M8WBSgTZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595863331742333.43332230740475; Mon, 27 Jul 2020 08:22:11 -0700 (PDT) Received: from localhost ([::1]:43424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k04x8-0005PY-Ak for importer@patchew.org; Mon, 27 Jul 2020 11:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k04uX-0001XH-OJ for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:29 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:37882) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k04uW-0001Ks-3p for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:29 -0400 Received: by mail-wm1-x329.google.com with SMTP id k8so4845977wma.2 for ; Mon, 27 Jul 2020 08:19:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h199sm18744996wme.42.2020.07.27.08.19.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=I7vtUCKWCL7jNAPS28tV4Fp/0HKktgVJJq19XFkLoME=; b=gk4F3WpkToQUQLoNzahhS+hadEIu8b712RU8/l31NxkR9U6oCBgt0Y5rbCd19alkvE 7vorpbqhtdMR+aL0FWEqsAFJDPV2gDV4bTmxn9doY0UvuDRqV24/GSG8Duq0B1tBXkae bL1opfmv49SFXVyZBHp9YYOLCnCadYPmpmAplP0CjdpHLkyAUc2UfcO9Cd+lqA+Bq/SL jC2OOpG8CLTTbKM8Sct7Zo9dyeuQXUOgzLeMO0X8CxZfM2jRY5Gfj1PW/i7az122FC+i SBS5Dd23w8bd3KTT8p8I68dQ69bxkM94cDkpYTfayeCgr8KinPOaZJuzQMK/osa0qd60 9X7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I7vtUCKWCL7jNAPS28tV4Fp/0HKktgVJJq19XFkLoME=; b=uAPQdrgw2Cx5tLGNinwUoYx5dox7HgZzF/a3e4yBHbweSId5TKj1n1eUe3Wibv5q5c VUIbbKxCYocH5Kn7FglMlClMxLCbvo7d/6hD1gKa0ki3FXo4qK/NJl3G4hOJ8avqjHVH 2gSCmGMyDa8vdnoBVVv050Wo3TbMb9AB8jATu6j7y7IQNfEA59DhPa5WjA/+4c8eILtM r2ik9+1v+4hrkm9H7qxL6+kFo4rrBjuSpj+gfXEf8y6maeQdrFxrVLgswrP4oSO4r6xF +NCbAOcooxSF5hGq1yKxJJbh4aY9SsKJ0JSZ7jQmf+dEozvyz3Xh8TROf9aN60czX7cl mFsw== X-Gm-Message-State: AOAM531OrdG9jhxzY0VuIxy5BFf43PWpFyC2RRMKfwBzYwwEKGI+OkW3 uo/pWG986gj7CwfN2+TSBft2jXNp1G7oxA== X-Google-Smtp-Source: ABdhPJy6quRYMErTnC/XsuFRJd5qUYgrA/S627xOIUEMcy/4Z7X1Z5HuF90TBwDthfqHUTp0VtXPyQ== X-Received: by 2002:a1c:c345:: with SMTP id t66mr12473262wmf.0.1595863166226; Mon, 27 Jul 2020 08:19:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/7] hw/misc/aspeed_sdmc: Fix incorrect memory size Date: Mon, 27 Jul 2020 16:19:15 +0100 Message-Id: <20200727151920.19150-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727151920.19150-1-peter.maydell@linaro.org> References: <20200727151920.19150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 The SDRAM Memory Controller has a 32-bit address bus, thus supports up to 4 GiB of DRAM. There is a signed to unsigned conversion error with the AST2600 maximum memory size: (uint64_t)(2048 << 20) =3D (uint64_t)(-2147483648) =3D 0xffffffff40000000 =3D 16 EiB - 2 GiB Fix by using the IEC suffixes which are usually safer, and add an assertion check to verify the memory is valid. This would have caught this bug: $ qemu-system-arm -M ast2600-evb qemu-system-arm: hw/misc/aspeed_sdmc.c:258: aspeed_sdmc_realize: Assertio= n `asc->max_ram_size < 4 * GiB' failed. Aborted (core dumped) Fixes: 1550d72679 ("aspeed/sdmc: Add AST2600 support") Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- hw/misc/aspeed_sdmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 0737d8de81d..855848b7d23 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -255,6 +255,7 @@ static void aspeed_sdmc_realize(DeviceState *dev, Error= **errp) AspeedSDMCState *s =3D ASPEED_SDMC(dev); AspeedSDMCClass *asc =3D ASPEED_SDMC_GET_CLASS(s); =20 + assert(asc->max_ram_size < 4 * GiB); /* 32-bit address bus */ s->max_ram_size =3D asc->max_ram_size; =20 memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_sdmc_ops, s, @@ -341,7 +342,7 @@ static void aspeed_2400_sdmc_class_init(ObjectClass *kl= ass, void *data) AspeedSDMCClass *asc =3D ASPEED_SDMC_CLASS(klass); =20 dc->desc =3D "ASPEED 2400 SDRAM Memory Controller"; - asc->max_ram_size =3D 512 << 20; + asc->max_ram_size =3D 512 * MiB; asc->compute_conf =3D aspeed_2400_sdmc_compute_conf; asc->write =3D aspeed_2400_sdmc_write; asc->valid_ram_sizes =3D aspeed_2400_ram_sizes; @@ -408,7 +409,7 @@ static void aspeed_2500_sdmc_class_init(ObjectClass *kl= ass, void *data) AspeedSDMCClass *asc =3D ASPEED_SDMC_CLASS(klass); =20 dc->desc =3D "ASPEED 2500 SDRAM Memory Controller"; - asc->max_ram_size =3D 1024 << 20; + asc->max_ram_size =3D 1 * GiB; asc->compute_conf =3D aspeed_2500_sdmc_compute_conf; asc->write =3D aspeed_2500_sdmc_write; asc->valid_ram_sizes =3D aspeed_2500_ram_sizes; @@ -485,7 +486,7 @@ static void aspeed_2600_sdmc_class_init(ObjectClass *kl= ass, void *data) AspeedSDMCClass *asc =3D ASPEED_SDMC_CLASS(klass); =20 dc->desc =3D "ASPEED 2600 SDRAM Memory Controller"; - asc->max_ram_size =3D 2048 << 20; + asc->max_ram_size =3D 2 * GiB; asc->compute_conf =3D aspeed_2600_sdmc_compute_conf; asc->write =3D aspeed_2600_sdmc_write; asc->valid_ram_sizes =3D aspeed_2600_ram_sizes; --=20 2.20.1 From nobody Mon Feb 9 00:19:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1595863431; cv=none; d=zohomail.com; s=zohoarc; b=TaSjcnVvNS2hH+RKhFe3IIYwRd4klvH5mJ2UfYHR16RMuA5vE+qaZtgsuyVzzeMEHo1xgoIhB2M3/wvt4iGcQ9MnO+L/Cd0dcxMcbHoxaZposm2VBJM01RqyeTSCYiQOY0/F+pYJhvN2NzT7cc9ZjjKqkb5wK4SWuqLpSnscxWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595863431; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R9nya5qllTCM3YMYSzF0QauvCLw6C0mO2StmL8/Bb3Y=; b=c8xOhBGJRLGCPHfa93TwnNexUx6lpevAtWUVFMaesfhMtqrx25aJ2Kdu978Buwh4Oa8NL2e7M/YQO6QeJ1gCVTZJ3cz2slWlL5cBCCrfSSn/HXnH7AsQ3yXblBfo8LsgcrdzSmPbsPli1SbGpt+XWzteOXZozvvEr1JBrcXhcqQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595863431655651.1347305557815; Mon, 27 Jul 2020 08:23:51 -0700 (PDT) Received: from localhost ([::1]:49008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k04yk-0007gB-Bp for importer@patchew.org; Mon, 27 Jul 2020 11:23:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k04uZ-0001Yd-3P for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:31 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:34164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k04uX-0001M6-ED for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:30 -0400 Received: by mail-wr1-x442.google.com with SMTP id f7so15311899wrw.1 for ; Mon, 27 Jul 2020 08:19:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h199sm18744996wme.42.2020.07.27.08.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=R9nya5qllTCM3YMYSzF0QauvCLw6C0mO2StmL8/Bb3Y=; b=D4JcadsbbjMe67R37gKM0i6ccbHQ/Y5Mf+30LKl2kG7E65l1GzPHTSAH61jm13hZxW jZ3lkYJqTNfsJqBVVW30gtpVbHgbL3l350QNjUK1DtHESCIetQ+bSinW1Y3EpnFEUoJD 1LJsr60/4cxe5mXajCgOy5px3QaLgr3JR0EiKJ/iq5zkyhGcbs7MFOcqB7UF3QIaU4mr JR5v5LEJ9S7MwzgKqQ7jTX3cMmxPXXf4xXpYDEOEkbzIDf2vk5HQ9Z+N0XKhl+yGqijP +nmGmULZWlHmg+yxKM8mZ9k7b3r5Cad/0lxa1/fprn7Ls4/BVIEK5BZt6oimTryzxBFq 5uWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R9nya5qllTCM3YMYSzF0QauvCLw6C0mO2StmL8/Bb3Y=; b=I68+eyrwN1/5voKWBzCulcGhTVZJRVmN6nLTwk1WplifJViSdOvYoTLlNYvEoPWayZ BhFBcKW+owQRPrGY8eGOBq5pTxJoe7xyDhS2HJzHJgrUICaF0JXL73hMWYT3vk9rsNiJ 4MogZsDgFntW79GO0SzdBs85BLMUIEAxdp0xrlqMFmM71sGyOcKDhg/ghBep8oXov+mF yQdYa0N8i1uH+vGkM324cL9K8T3NoKmqcJ3aGy6x2NH+h1y6rYVlKYFUVKT39I70g9za n+14HmcY+kGQEXqizI9q8W5Ozhyh8RcppvF/iEyPbm6bVB2APLODNjk+ppZ8BVz1Kd8H QYFg== X-Gm-Message-State: AOAM532jxgpUgPMP7yq5lpeup9OhR/Rs8O7NPMQwzx0bkdukFLrNzMwn oh/yFJSTU1easkUP7D229xBLkZB9o1EbjA== X-Google-Smtp-Source: ABdhPJz7k1KZYdY/+EBfD1qzAgwexagrf+4/T0hQ+05mZelWjRn3pA1RWAUSguBExattBgoc+0PbtA== X-Received: by 2002:adf:de09:: with SMTP id b9mr8154842wrm.409.1595863167650; Mon, 27 Jul 2020 08:19:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 3/7] target/arm: Always pass cacheattr in S1_ptw_translate Date: Mon, 27 Jul 2020 16:19:16 +0100 Message-Id: <20200727151920.19150-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727151920.19150-1-peter.maydell@linaro.org> References: <20200727151920.19150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::442; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson When we changed the interface of get_phys_addr_lpae to require the cacheattr parameter, this spot was missed. The compiler is unable to detect the use of NULL vs the nonnull attribute here. Fixes: 7e98e21c098 Reported-by: Jan Kiszka Signed-off-by: Richard Henderson Tested-by: Jan Kiszka Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index c69a2baf1d3..8ef0fb478f4 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10204,21 +10204,11 @@ static hwaddr S1_ptw_translate(CPUARMState *env, = ARMMMUIdx mmu_idx, int s2prot; int ret; ARMCacheAttrs cacheattrs =3D {}; - ARMCacheAttrs *pcacheattrs =3D NULL; - - if (env->cp15.hcr_el2 & HCR_PTW) { - /* - * PTW means we must fault if this S1 walk touches S2 Device - * memory; otherwise we don't care about the attributes and can - * save the S2 translation the effort of computing them. - */ - pcacheattrs =3D &cacheattrs; - } =20 ret =3D get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Sta= ge2, false, &s2pa, &txattrs, &s2prot, &s2size, fi, - pcacheattrs); + &cacheattrs); if (ret) { assert(fi->type !=3D ARMFault_None); fi->s2addr =3D addr; @@ -10226,8 +10216,11 @@ static hwaddr S1_ptw_translate(CPUARMState *env, A= RMMMUIdx mmu_idx, fi->s1ptw =3D true; return ~0; } - if (pcacheattrs && (pcacheattrs->attrs & 0xf0) =3D=3D 0) { - /* Access was to Device memory: generate Permission fault */ + if ((env->cp15.hcr_el2 & HCR_PTW) && (cacheattrs.attrs & 0xf0) =3D= =3D 0) { + /* + * PTW set and S1 walk touched S2 Device memory: + * generate Permission fault. + */ fi->type =3D ARMFault_Permission; fi->s2addr =3D addr; fi->stage2 =3D true; --=20 2.20.1 From nobody Mon Feb 9 00:19:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1595863240; cv=none; d=zohomail.com; s=zohoarc; b=aHDQDpS3d2nKFlHr0v78UMGYL7/VtK19A4bZf6fEvzYb7bcTMpTeJMWmtQOMBlQf4mB4FvpAoNSgttkmGI85pQ8DCvQnPtbHuUbX0ET9GazT6dNIZiqzmBbxAm9E8OZUxhw6IlIIIvxDhOZXDF4XuDPOWeDmd4vVmuMbqPGyPSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595863240; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PZFpVZfQpAAFemnJfw1bta1je15PzH0gg3ZsQFBq8iI=; b=d3cXo5B/4glCcp1tEfcQUELY+7psy9wKO70rxT43dt6qRtOnhVHP8pauH8X7o26hHt66DMz0vpM9qG1Nc5ikyPVg8xvUdByEuiQy0zPORQGmYNIW0Be84p/Y2AmFUgEWoQ+ww5DBbQpY+GfmN2oHWsshoj0NfGFHYOSJTG0UDWI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595863240804533.400323218689; Mon, 27 Jul 2020 08:20:40 -0700 (PDT) Received: from localhost ([::1]:37548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k04vf-0002tg-AK for importer@patchew.org; Mon, 27 Jul 2020 11:20:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k04ub-0001bB-1m for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:33 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:44437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k04uZ-0001MN-Fj for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:32 -0400 Received: by mail-wr1-x42c.google.com with SMTP id b6so15285254wrs.11 for ; Mon, 27 Jul 2020 08:19:30 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h199sm18744996wme.42.2020.07.27.08.19.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PZFpVZfQpAAFemnJfw1bta1je15PzH0gg3ZsQFBq8iI=; b=VIf8x036KsTgU/ng8WCiKOyytOQ5iM2vvTbq/C/FbgVZ2LqKcWg39+9GIBRxNtRoug tQ35IX60aKfQLW6LeEERtTnKWxfO4IUW3Sn7Gtk8SPSK/T5dfMRNhAjWaETKv3IR85bw y2U7zzipUR0+dXfKx1RaDDA2xfcOrA2hArMSN2SxKM11v0cn4zGnLgLND9w67Mr8IUb9 W2vGdfWIy3kuyBOyyYjUVOGmU0h8ZlSHuz1T+ACE0YlYGEsKrcoqnvqaWh38wna9YNaC AXwinQiP7mCXeMwfFR2JHoXK0zdpdkgi9zLbEUu/23jU+cD7cIqtR7N/2Fy3uy4Zm3NQ y/Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PZFpVZfQpAAFemnJfw1bta1je15PzH0gg3ZsQFBq8iI=; b=sH8ekD+oR2HCshA90OeAYqYxPPf21f++rAd4RsMn5Cck1InHL+/1YwFAnULOcO74Mn DPvyBJIO5CUNfEFiDAZOX5HrPF5SUjT3koPVM4bom/PiWupBYW0mNh2ug3YI1yU2V9MY 7TtvsKF3WlbKipbM3n0A2ybpfTZs1+JxJeuVR9cWPiilQ9EN1raCe3e680B8r5zXow+3 p+YwwHD3njUOYhPa69yUvVwUcedfwnAkqQ71daght9GVR8LsLeVNxkmRZOik+jI9tWMU dfchtN4pBaEWGXvnsOd5qqBSOQ8488b9c7Leopy1HedojeepOPbL3yUt2EnT/hQRfkxb 71lQ== X-Gm-Message-State: AOAM530sUiXkMPM8pnAf2fXRf0iBjwMO/ulY+yLCx5kCZPrgdfCBF6pC FQBqz37CL9KqKztVMz9a8gn+kAiQJ/gz0Q== X-Google-Smtp-Source: ABdhPJzVMAqNzTNYH4pOYTY4FGkkG2LqIRl6g737fGmUnRuF64v+Y93sLUWeD1uRsAgIrhe8U6ikGQ== X-Received: by 2002:adf:b7cd:: with SMTP id t13mr19989737wre.424.1595863169112; Mon, 27 Jul 2020 08:19:29 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 4/7] docs/system/arm/virt: Document 'mte' machine option Date: Mon, 27 Jul 2020 16:19:17 +0100 Message-Id: <20200727151920.19150-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727151920.19150-1-peter.maydell@linaro.org> References: <20200727151920.19150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Commit 6a0b7505f1fd6769c which added documentation of the virt board crossed in the post with commit 6f4e1405b91da0d0 which added a new 'mte' machine option. Update the docs to include the new option. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- docs/system/arm/virt.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index 6621ab7205d..32dc5eb22ee 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -79,6 +79,10 @@ virtualization Set ``on``/``off`` to enable/disable emulating a guest CPU which impleme= nts the Arm Virtualization Extensions. The default is ``off``. =20 +mte + Set ``on``/``off`` to enable/disable emulating a guest CPU which impleme= nts the + Arm Memory Tagging Extensions. The default is ``off``. + highmem Set ``on``/``off`` to enable/disable placing devices and RAM in physical address space above 32 bits. The default is ``on`` for machine types --=20 2.20.1 From nobody Mon Feb 9 00:19:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1595863338; cv=none; d=zohomail.com; s=zohoarc; b=mxsaMCxIpgP+krrP+IRqAn0aCAOF1dJftWsvChKNrEZ2N7jm3vSaTzog+MRmKoEdfV6SbWzojK2mL8FMCfyrRTCX+padJxubjEaVsFZx3xuYIBCSzopDzO1/r5/Kr8s8DsGkyXnQ+/suZlLtuVrae4Q2MTlgVXM6Dap72nrPzPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595863338; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CzXyfsRq8ddGHiV45tDKp7Cox+Mr2SFib9wJfNHDSi4=; b=gmGghb8TopPzy2Eym+Sa8zR2bZMButv9UYV7000ud+HnQSwD2dmprkQPfaxHI5nW4+4aukmKgT7rmpQyIzuhvvtsLGgAbM/EjwUvWNpCfuXtR0H3eIpsWjBx0rs8pT2HUQAxWdNoJiFKgzxUg5e+ATiVJb+Vqcy8l0A23k7WWL4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595863337971524.8245463777429; Mon, 27 Jul 2020 08:22:17 -0700 (PDT) Received: from localhost ([::1]:43906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k04xE-0005bQ-Nv for importer@patchew.org; Mon, 27 Jul 2020 11:22:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k04ub-0001cb-WE for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:34 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:52486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k04ua-0001Mf-GV for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:33 -0400 Received: by mail-wm1-x344.google.com with SMTP id x5so13952236wmi.2 for ; Mon, 27 Jul 2020 08:19:32 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h199sm18744996wme.42.2020.07.27.08.19.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CzXyfsRq8ddGHiV45tDKp7Cox+Mr2SFib9wJfNHDSi4=; b=etTSnAIcnkE58iV63GVt7f+pQvl++n4MBYszFGoo0BLUkj5ZdQSZr1UO/YbWnAP6i3 ZCGE5WKoyOw9lt+Bs7s1ioTvDmlNpUNkYm2T3GLokhk2jYBHsMc8ijFZ8o7m+Te8iK3F MA4PYJXFme4mfJlSBAHfCcmJ5yd7VVn1FbzKnEc0C+wPHMcfP1TwC1KLQvYSRPOiR9iY ElrHnLLUhzO0Pv361GKKSx30GsQM2DBanZ3LFIYiYF1ysrPXmRwgvTsGMebktdUrxLT0 yDyL5YAZ9PuXmaASp3JSatLlBR9HYe9ey6yaK8wqnGOATeDneAjHU7DTJuCtYh4P+MQC 6SFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CzXyfsRq8ddGHiV45tDKp7Cox+Mr2SFib9wJfNHDSi4=; b=dDgeFEsZ5EN5P/TTwMDRKRntv6Us6Z96o+BnH1BUjsaN+YfW+L9bP3kRIT0cpep+lY GRS+QZH0Fs/TUwo0jJhkLXt0wCme7n6LQubLonFBxcoGounYhxLZNfFXeDZslmiP3IOu 7hfSqz/Wtqybs6HDaQ9+vyWK8353r/mzGcKVOFIJtyqJg9Y1p/yFKqkXJI6rk93f6PAs OW6QAf2lTq5qK2J9l0VfrwmWbiVqsO7pIPVFbuGvzzhRoGmZlcgMR0sVFuFJsoYxRcQR cPT40l45RcuFSlmcJ0P2zb2yH7RnBhVDQkEFQ4pqZC4KTdYC3+I04HgCeO+f4+hP3h14 zdNA== X-Gm-Message-State: AOAM5309dAH5t4f489bpLBDRmLYv3DzkzSNsT9CRAEotcPwvqzfYE79/ qVq2LXXHVd9gYAMKCCkFKUd9f5265Cjecw== X-Google-Smtp-Source: ABdhPJxrG6HDh8avw0pcbkROAiuPaxggACU5cvtY7AcKtsEKh8IFmz40WNHNQAAFDPF2b8eixUjhRw== X-Received: by 2002:a1c:28a:: with SMTP id 132mr20619330wmc.109.1595863170533; Mon, 27 Jul 2020 08:19:30 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 5/7] hw/arm/boot: Fix PAUTH for EL3 direct kernel boot Date: Mon, 27 Jul 2020 16:19:18 +0100 Message-Id: <20200727151920.19150-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727151920.19150-1-peter.maydell@linaro.org> References: <20200727151920.19150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson When booting an EL3 cpu with -kernel, we set up EL3 and then drop down to EL2. We need to enable access to v8.3-PAuth keys and instructions at EL3 before doing so. Signed-off-by: Richard Henderson Message-id: 20200724163853.504655-2-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/boot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index fef4072db16..c44fd3382dd 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -736,6 +736,9 @@ static void do_cpu_reset(void *opaque) } else { env->pstate =3D PSTATE_MODE_EL1h; } + if (cpu_isar_feature(aa64_pauth, cpu)) { + env->cp15.scr_el3 |=3D SCR_API | SCR_APK; + } /* AArch64 kernels never boot in secure mode */ assert(!info->secure_boot); /* This hook is only supported for AArch32 currently: --=20 2.20.1 From nobody Mon Feb 9 00:19:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1595863435; cv=none; d=zohomail.com; s=zohoarc; b=bsU4vMP4Z46DudPcgtmM7zleorbly5+BwkKojj/mR3xMGIyrCNPSPtuC/rbA9mSILBrH5/yYiK1sikHn5wo9dk/5t5FFxudbekfwUfStXuk5huYzxvIxU6UoQCY+Friuyn2DKNBRSvj5uqa7W7M+hA12b9mJJL3ftys8Minu0mA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595863435; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AgiFp36fAcCMfqysVIITkhhp2lHAb79FkVULIdw4Y1E=; b=d+qKXh2JPG1t6xEz/9lwFZLWhN1fnmVawTyjYuj7RdE3Imrtr6hZbA6s/6srZfTAYCB3CODljU0jrZnIDh09Y7/g9anQaRlLRWmBKnFMuBdaGksE/OQOZSP73iTsrlEF6Yzz9ovBcdqRiGfP+B3VCOyF1WsVEYcMOdIw4feZTgQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595863435910987.1010297651925; Mon, 27 Jul 2020 08:23:55 -0700 (PDT) Received: from localhost ([::1]:49284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k04yo-0007mx-Ml for importer@patchew.org; Mon, 27 Jul 2020 11:23:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k04ud-0001f4-Cq for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:35 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:44451) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k04ub-0001Ml-IX for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:35 -0400 Received: by mail-wr1-x442.google.com with SMTP id b6so15285376wrs.11 for ; Mon, 27 Jul 2020 08:19:33 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h199sm18744996wme.42.2020.07.27.08.19.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=AgiFp36fAcCMfqysVIITkhhp2lHAb79FkVULIdw4Y1E=; b=DBOmFpimh2tlUmVZ1/YXoe9B2qz9EZzrBUJo1uyds+MQSJF5hIUo2f1CCGViEWniWK HZDlcHY+y3SFmPDEk6FqTUMGKFEyhyV7NDeEU1FAeSDZtfF0xqxxbB/TE/rlrQ6eB7JA rATdpZ2zUyMPhVaB5JIVb/7SlN9TGzcglZzPy4zOIPsmZ0hkyfi7G1pilHCKsAeu3HdY mMpOSZSalEVF+kH/1HjnX1fh1AWEC4+O1ZsEnKgqFwjS5yniI9WCmbo3Qq29GdHdn6SP GhgVPMFkHN/fh6uBAAn1RqkyK8KslkkiQaLk0/0EPcKCIM2NFCqwhvywrWRmDUw1MhyQ nffA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AgiFp36fAcCMfqysVIITkhhp2lHAb79FkVULIdw4Y1E=; b=GfXfWWSKSXFi5SyQI5g0WtIy5kGBApYfHo+my3QRB917Q9i0WVQ++PDfwDAhqpD56G N3bCxTM5TDsXYFhwyzQjk7Au7HumIua/cgj5JJT6l8fZRRjcrJMsJmwHGE7arrrl4XbF J7pJMYRTGVa6G5V94M1RHVPbByCqUbo3GekiimGJT9Aqj4Ya2tBpZMVmLOXtn37J2pQI rWRWoZ1F6st+WXPKQAp4vsO6+M2CoorIWELUDCYnOVU2eibY022DRmEySD2wG8VIJ5BQ gl/rHEl1zPETPbIngDSXhtr3xbrCiJZGF74nn+v8P/wJsWGR/l5Ck6kEdtmXxF1yribn V+iw== X-Gm-Message-State: AOAM531Am6V44Sm+K4uhMKLqiFDWeQw5jTlZPd0bJI/0wP+Xg1GIjwuA jDhzRZB7srHTbYvAYbhEkhyJYEaqAmyQ6A== X-Google-Smtp-Source: ABdhPJyXx6FRYOyhx/dIFSAcskaMs0q+4lFQw/eBVLWDOdt0iHL/8T8aQhJbGwmo7OYojcKzbXhPoQ== X-Received: by 2002:a5d:480b:: with SMTP id l11mr19807738wrq.85.1595863171889; Mon, 27 Jul 2020 08:19:31 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 6/7] hw/arm/boot: Fix MTE for EL3 direct kernel boot Date: Mon, 27 Jul 2020 16:19:19 +0100 Message-Id: <20200727151920.19150-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727151920.19150-1-peter.maydell@linaro.org> References: <20200727151920.19150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::442; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson When booting an EL3 cpu with -kernel, we set up EL3 and then drop down to EL2. We need to enable access to v8.5-MemTag tag allocation at EL3 before doing so. Reported-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20200724163853.504655-3-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/boot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index c44fd3382dd..3e9816af803 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -739,6 +739,9 @@ static void do_cpu_reset(void *opaque) if (cpu_isar_feature(aa64_pauth, cpu)) { env->cp15.scr_el3 |=3D SCR_API | SCR_APK; } + if (cpu_isar_feature(aa64_mte, cpu)) { + env->cp15.scr_el3 |=3D SCR_ATA; + } /* AArch64 kernels never boot in secure mode */ assert(!info->secure_boot); /* This hook is only supported for AArch32 currently: --=20 2.20.1 From nobody Mon Feb 9 00:19:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1595863337; cv=none; d=zohomail.com; s=zohoarc; b=ACfV3Hyd0C3C+C3vbNGty5C1YE8R3scDwgwO3vXCiUmuxhkEQJKhA90x7CTFC8LTc9teFj36SrtPkk+47nurfnVmgiTh68+4898n9kkHTfwJTkdY/mWdGegJEFChu4RI1AQcH/Dl8lh+i5MZa6x7dNKwryCtAorzqSi5Jvf16wQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595863337; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Df26pyr1FoUci06b9bgZLyVGVD2YeeZNhUfL4mWRueY=; b=EcQauzlAIZziZwS8+fEawNOcD26RI6UtuR8hJFlr08IrlIFJEVqbMlAldK2cjhT1p8ehpfH+TC7702N3IR3oS+dkriHhH+bHIycTnDpf0Fc/FqgT+sJZbZszWyJnAYTvDS/XsrWgOX9vpUZDTFhHmWDhexhv0Kb79Yxo5tBWwLA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1595863337091382.39835347576036; Mon, 27 Jul 2020 08:22:17 -0700 (PDT) Received: from localhost ([::1]:43874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k04xD-0005ae-Lv for importer@patchew.org; Mon, 27 Jul 2020 11:22:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k04uh-0001o5-M8 for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:39 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:34067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k04uf-0001NP-T8 for qemu-devel@nongnu.org; Mon, 27 Jul 2020 11:19:39 -0400 Received: by mail-wm1-x335.google.com with SMTP id g10so13606087wmc.1 for ; Mon, 27 Jul 2020 08:19:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h199sm18744996wme.42.2020.07.27.08.19.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Df26pyr1FoUci06b9bgZLyVGVD2YeeZNhUfL4mWRueY=; b=uL8MCJQlncq3jVP207n1hpGBN56b9iLP6py9pa1w75Ls1qKB1pJeUKfe243G3y+wjU RoODpdIT7pRaPSBz1lBLQwFmTJqjvqEZu3JZfloyGnCPuAYS5VbFgD0mvLeI8fYU4NVK /R6DByaYkt18gl/JMzms/M/YOc98hlJDr8JxklxfcQhxjk1ovkQhMTwEchCwJz77EKkE SIKp72GrCuZacC2vi/gGWLdKFO95UdDn+w1Bdy2WFajKhM2U/GDRlZFeufTyv+xz4sOu CJZOOuhmZIwZ4cPog3qZzNidSBgReATUPWqVqrFrqzqqsMMngktOBQVkLXsEshEQNNzy evaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Df26pyr1FoUci06b9bgZLyVGVD2YeeZNhUfL4mWRueY=; b=gCo43rTb2/WeYiKHUPCUojDA0+YcsrLdZp/FQlPGBjRZ/X4gEE0/ueL16binQH4sn8 GJDHtCu5vukNx0yboH5gcEhKspj1fHNJIAtBXZTLhQBj6TqWf1cEqHxY9rZp83Jxjx5b I2fzzTkkytJb7nWLlIEMiD3EOsJSZKgUBOBTvZKGoOsi6MvtV4t5HPnLpNdfmKPgJiUV evkiOIACKrxbi33EisQdA+SDeM7JheeaFXEQ/heApZEz2ObIG7Nk+VioJ/dQUkbYr/WL gR9Q290Os3yLG0oO4kYnHN8l37LdtSm4e2Gtp3kOJQ2KaiBZaEOUWCQdSTkJATfKZCIg caiw== X-Gm-Message-State: AOAM531wDlBNm10QbNnGO/m2SoOJg6Dku/+A7YToZKu6Tpd4WIgJ1VMO xZXDL+KFOsgNx61l1juD0aIlqYVsWcfwBA== X-Google-Smtp-Source: ABdhPJxHk89Hl257Ymn12N4VBpYOUxyBIKG0pVwVy2GnXlL08sIiU/1AVE6Ntwvn17ddASWQmiD4lA== X-Received: by 2002:a1c:7e02:: with SMTP id z2mr8175969wmc.138.1595863173102; Mon, 27 Jul 2020 08:19:33 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 7/7] target/arm: Improve IMPDEF algorithm for IRG Date: Mon, 27 Jul 2020 16:19:20 +0100 Message-Id: <20200727151920.19150-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727151920.19150-1-peter.maydell@linaro.org> References: <20200727151920.19150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson When GCR_EL1.RRND=3D=3D1, the choosing of the random value is IMPDEF, and the kernel is not expected to have set RGSR_EL1. Force a non-zero value into SEED, so that we do not continually return the same tag. Reported-by: Vincenzo Frascino Signed-off-by: Richard Henderson Message-id: 20200724163853.504655-4-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/mte_helper.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index 5ea57d487a4..104752041f7 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -24,6 +24,8 @@ #include "exec/ram_addr.h" #include "exec/cpu_ldst.h" #include "exec/helper-proto.h" +#include "qapi/error.h" +#include "qemu/guest-random.h" =20 =20 static int choose_nonexcluded_tag(int tag, int offset, uint16_t exclude) @@ -211,16 +213,37 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, = int ptr_mmu_idx, =20 uint64_t HELPER(irg)(CPUARMState *env, uint64_t rn, uint64_t rm) { - int rtag; - - /* - * Our IMPDEF choice for GCR_EL1.RRND=3D=3D1 is to behave as if - * GCR_EL1.RRND=3D=3D0, always producing deterministic results. - */ uint16_t exclude =3D extract32(rm | env->cp15.gcr_el1, 0, 16); + int rrnd =3D extract32(env->cp15.gcr_el1, 16, 1); int start =3D extract32(env->cp15.rgsr_el1, 0, 4); int seed =3D extract32(env->cp15.rgsr_el1, 8, 16); - int offset, i; + int offset, i, rtag; + + /* + * Our IMPDEF choice for GCR_EL1.RRND=3D=3D1 is to continue to use the + * deterministic algorithm. Except that with RRND=3D=3D1 the kernel is + * not required to have set RGSR_EL1.SEED !=3D 0, which is required for + * the deterministic algorithm to function. So we force a non-zero + * SEED for that case. + */ + if (unlikely(seed =3D=3D 0) && rrnd) { + do { + Error *err =3D NULL; + uint16_t two; + + if (qemu_guest_getrandom(&two, sizeof(two), &err) < 0) { + /* + * Failed, for unknown reasons in the crypto subsystem. + * Best we can do is log the reason and use a constant see= d. + */ + qemu_log_mask(LOG_UNIMP, "IRG: Crypto failure: %s\n", + error_get_pretty(err)); + error_free(err); + two =3D 1; + } + seed =3D two; + } while (seed =3D=3D 0); + } =20 /* RandomTag */ for (i =3D offset =3D 0; i < 4; ++i) { --=20 2.20.1