From patchwork Wed Dec 4 20:56:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 847344 Delivered-To: patch@linaro.org Received: by 2002:a5d:434d:0:b0:385:e875:8a9e with SMTP id u13csp538685wrr; Wed, 4 Dec 2024 12:56:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXDRLgLSGT3vwI2Dk7ltmvztZ8MfNEYL8eZaREAk3GomgsZLcW4THmapoSzN5esDwlnuyGEWA==@linaro.org X-Google-Smtp-Source: AGHT+IEmcF/Ma2+IkN8EfTsO4zEawRKTKABeHupZ0o6R5IVJq+bZ/HIqYXHW5dsmvpsP3tKs7eGE X-Received: by 2002:a05:620a:688e:b0:7b1:4762:8a with SMTP id af79cd13be357-7b6b414bfaemr184245885a.3.1733345802819; Wed, 04 Dec 2024 12:56:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733345802; cv=none; d=google.com; s=arc-20240605; b=VFBHzPij4h1VfJqEyzTfzAYLPWoyhYleyIkVU5wVMX4dNwSWkiFIAKvc8SN0CctoRe nucaSmBU1HnI97XX9BtkPQbHBlijp0r1q0pZCFOFKqDxyr8zUugWBwybBRLLkNMpqtZe slceHImj0MAvUn9x4qNhnQomuUvET7ana1dL95cqIQ2AybGXNwSDRm3NuhB8zXaQTPm7 hoBvkbxN7Kpl07qeSAt9saKPgAm5p8HbJxDZ0587TljKMCYg6mohH5GE3afGfAf+LuvE 28S9xf5Gbot6ZEN7w6MB31zJD2yTvSV6VvKBHsfofFWKfx9kKXXTGIiJnTuRIgqrK1LJ LkGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=4dgzrMh++g/oTounPtmoGDAI8IhHPJPYGgHVhlbL82U=; fh=J3TbDJNrja1D6B7Ww666mMDEgEfovUI3s8tVv7fxrrQ=; b=k1HWMmJ9H2LvuNK7euPIwd+Mc+PNctvyflZ7AN4uLX3TwGPCawZgQjXuhF58Cr1dxf KzDeeh1GI64cipA4P502ov/GorvSB+eoptupva37Kz2fwu0FMzX4a1jWVd33HGl4Apfk pTOyLJKZKp9lF7IZR3YNaWaMdpgY91DRHd9iNGCU/w1cIo6zt7265nQSZ2l5+9sbpZaN yJrj8MpNa4AQhEkh0TubYcAbZ+LTWJZ61KwviUDvVA4WZS5CYcOop6kWlObbZQBPk5PG mYXrUEepJI0c2EhWqw2Sf1nQhdxyIkcJQZbKJfyzDpT9GcMvY1WYXuhfp1I4wpBOfZAy qE6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VqztozFr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6849b1d34si307948485a.228.2024.12.04.12.56.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Dec 2024 12:56:42 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=VqztozFr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIwPw-0008KW-3w; Wed, 04 Dec 2024 15:56:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIwPt-0008K4-NB for qemu-devel@nongnu.org; Wed, 04 Dec 2024 15:56:13 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tIwPr-0006Q4-1J for qemu-devel@nongnu.org; Wed, 04 Dec 2024 15:56:13 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-434acf1f9abso2075845e9.2 for ; Wed, 04 Dec 2024 12:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733345769; x=1733950569; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4dgzrMh++g/oTounPtmoGDAI8IhHPJPYGgHVhlbL82U=; b=VqztozFrRBiyfaZRLN6CCfuQIDTD2iUO23fmPMLh75N/lwdGkM2CL1ezOmZwFjVt4Z bNukhs6vsJ+OKdZcKjeniH//ZKtJJLORHPhlivQibQM3c1hct+ACikoVVAEz3KdNaADY xw3QN95DZsoryD02HR2oLjczbaMPQm1uoc7mTN9fsa+kncA1TMSJVuibp70BA3V6e09q MrUrwfEF6J+De5MDCkadHB8N6fzXGSFofg7tmbFCOX57KgOCkrJ0/279CI7gEWJlHRkq bWaUht1p75LEbcnxh64SfcZrzIEiU+bUhC4ohSxyaBaozPT9bC97JtD/gc3b0rWMoAgf STvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733345769; x=1733950569; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4dgzrMh++g/oTounPtmoGDAI8IhHPJPYGgHVhlbL82U=; b=oyf61Do8N0orClTezbxgQcLPn2Q/uuMAu+yhLiVpoaHzZGkuzRRHx8HuM5pVux39tj U1OTfDRm4TFBiHWA3rV4kWpjPktLdkrTg7W0LkYa0ftYnWP7o6T029SY7aU/HXa1BABI SsY/LkCd4M/EREgdiblQhixvE71BP7DEyce3bKtzh56iCRHAk0y8HWLTXRnkTbTt9NNT ltJQYRCVthNE/kaXB1RRQyQdXADUiZch6VGC6zvOICAIVJLVmgrc3i8EDTiLgcqg3OZI CKbVb/GuD/l1L9yraG4/YXyY6tWgooLyBcEBNsZTWUHtq7M7TRDX9c5XzhcJ1UvKyE/h 8bPA== X-Gm-Message-State: AOJu0YyVBiFqTpsoV8AvQQAI94uTCHA/g3t0kieYU084fDSrkPSeF/yi k3hlcdxouRYwZ3EGQewnDEeiWaNZ7NIF5gwz6yEhvwltjnCaNZTtuyvUJ0f6CelP1R0oVYoWqB4 p X-Gm-Gg: ASbGncu+rfAdm8cxyABEEgJjfSWZTzUk/yDWaYmcXvo3QpXJaSI4kRkxnyA0feqT6td u6MIIdI5ZAh4o9HSA7c5YCGS7VOQMRU61Dk7iYOxHM9jKNEXBKC8Il110+/aVU0wsBwyQ7PIgvn bB80p/2/IW196DVeSoTwkahlXwBl06amAdaiqGKy9fI5kMXvfli33cyCsQVwXUtsfkbOO7tRprn oLe6QmAviKZG214SnEhCvWaRDBxbdMFpVz4DhH3XwjC1qeJEPC9tLcF2VmrMMwN55CPRQoVRoi8 +pAst7oO+adrXXvfP2w/0Cu91j5KjA== X-Received: by 2002:a05:600c:5121:b0:434:a386:6cf with SMTP id 5b1f17b1804b1-434d09b17c8mr69076335e9.2.1733345769180; Wed, 04 Dec 2024 12:56:09 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d527395csm36081685e9.17.2024.12.04.12.56.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Dec 2024 12:56:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mathieu Poirier , Leif Lindholm , Peter Maydell , Radoslaw Biernacki , qemu-arm@nongnu.org, Marcin Juszkiewicz , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= , Leif Lindholm Subject: [PATCH v2] hw/arm/sbsa-ref: Require at least 2 GiB of RAM when RME feature enabled Date: Wed, 4 Dec 2024 21:56:07 +0100 Message-ID: <20241204205607.62592-1-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We are working on adding RME support to SBSA Reference Platform. When RME is enabled then RMM (Realm Managment Monitor) takes 1072MB of memory for own use. Which ends with firmware panic on 1GB machine. Report an error so users directly start with more RAM in this case: $ qemu-system-aarch64 -M sbsa-ref -m 1G -cpu max,x-rme=on qemu-system-aarch64: sbsa-ref: RME feature requires at least 2GB of RAM Reported-by: Marcin Juszkiewicz Suggested-by: Leif Lindholm Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier --- v1: https://lore.kernel.org/qemu-devel/20241126084928.252067-1-marcin.juszkiewicz@linaro.org/ --- hw/arm/sbsa-ref.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index e3195d54497..66751d0806c 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -51,6 +51,7 @@ #include "qapi/qmp/qlist.h" #include "qom/object.h" #include "target/arm/cpu-qom.h" +#include "target/arm/cpu-features.h" #include "target/arm/gtimer.h" #define RAMLIMIT_GB 8192 @@ -795,6 +796,12 @@ static void sbsa_ref_init(MachineState *machine) object_unref(cpuobj); } + if (cpu_isar_feature(aa64_rme, ARM_CPU(qemu_get_cpu(0))) + && machine->ram_size < 2 * GiB) { + error_report("sbsa-ref: RME feature requires at least 2GB of RAM"); + exit(1); + } + memory_region_add_subregion(sysmem, sbsa_ref_memmap[SBSA_MEM].base, machine->ram);