From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797721; cv=none; d=zohomail.com; s=zohoarc; b=YyvCT6xHgeR3YFX0lGgwPSmDuxIDZbi10f2UxyXD805yopKdi15zRZedmxqm0Hc8/BLNAMwjrD+6QaovLA0DD4sinEt0zDAdewKsnz/DCX0o82v6P/VV//kGlquOQcdLoB1btIBRSezxkbgbRLz1tKomnVZx+co1vq/NrSed4C8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797721; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=FrjE1tHkUdeVBDEqGDQEZVm2xdo3dGvaav4RUFhEjDc=; b=oJ+I4Rc3JEOiEiW+oCiwYa1sc3P/yXLKZxuh1LhO8XSU4H4JrvII9o6DVM0tNzDx2eTYe3Gh/9xkCa7Jqd87FIlEHnPZ3d9OQ4r9BnYd9WuqFrh7pwaJzU65huWeeqk7hvT7DbPpbBvZYlltU96E1Bpwg1V7iMCArE+WNcWuaTs= 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 1577797721475133.05661201213957; Tue, 31 Dec 2019 05:08:41 -0800 (PST) Received: from localhost ([::1]:42246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHGI-0002J4-2C for importer@patchew.org; Tue, 31 Dec 2019 08:08:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54303) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBl-00051A-Jf for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBj-0001uU-50 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:56 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:33484 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBi-0001qi-U6 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-87u07QnUOcCwwWLegVd6Ug-1; Tue, 31 Dec 2019 08:03:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F9EA800D50 for ; Tue, 31 Dec 2019 13:03:51 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id A76D2620A6 for ; Tue, 31 Dec 2019 13:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FrjE1tHkUdeVBDEqGDQEZVm2xdo3dGvaav4RUFhEjDc=; b=DK8xvQ6RLh0VSMCkaPNmli8PCTEsuObtvkyB3X/XZ9ATco/7sPmSmdgRh4mCKoEtv7A8lV kwzQwuBB7E3RzLyIBLMzbHSydlkoOByEmJczDKTI3XbdzcdDogcNJDaQLYAZLWtjUyVqek C+H2KS2EtcMfZ6ZPsbYtW5GBf/PoShE= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 01/86] numa: remove not needed check Date: Tue, 31 Dec 2019 14:02:45 +0100 Message-Id: <1577797450-88458-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 87u07QnUOcCwwWLegVd6Ug-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently parse_numa_node() is always called from already numa enabled context. Drop unnecessary check if numa is supported. Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- hw/core/numa.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/core/numa.c b/hw/core/numa.c index e3332a9..19f082d 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -83,10 +83,6 @@ static void parse_numa_node(MachineState *ms, NumaNodeOp= tions *node, return; } =20 - if (!mc->cpu_index_to_instance_props || !mc->get_default_cpu_node_id) { - error_setg(errp, "NUMA is not supported by this machine-type"); - return; - } for (cpus =3D node->cpus; cpus; cpus =3D cpus->next) { CpuInstanceProperties props; if (cpus->value >=3D max_cpus) { @@ -178,9 +174,8 @@ void parse_numa_distance(MachineState *ms, NumaDistOpti= ons *dist, Error **errp) void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp) { Error *err =3D NULL; - MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 - if (!mc->numa_mem_supported) { + if (!ms->numa_state) { error_setg(errp, "NUMA is not supported by this machine-type"); goto end; } --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797575; cv=none; d=zohomail.com; s=zohoarc; b=BEFTWWPIa80mK4K+XwEt7r436KWLbuIn9Euz9cK75AjTcidaYPFjKqwXLeYaosSEtN3j+n/IIgnNbpkBeBo5QqkCXlSyGNfDhHXNH0LqM9TbfiKT4h/8TioMHK+Y9wZB1tY6omlaROnnKFtxzf/ELyGju3divIMPvyHLiCEwmmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797575; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ZRqSlxyEb2ZTaTC9B8OpQelTn+FwE72xQVBk3qgcRFo=; b=goP7IjDRz9v3ngglhKbCm6qz16pf1RxBpV3AcIvbB/bwUzp5AOuZi6jO2kSGLILFimpfKFUvtMtMVjyrEHURJz9qqxwl+Tsb/nATLBFT9DX2S+puL9sXmljvWMzQ67DluX6PrRpTTwOAcUYPjj+3L/JGdz7aaJIQCo0IlR3NgBQ= 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 1577797575311565.5967198102251; Tue, 31 Dec 2019 05:06:15 -0800 (PST) Received: from localhost ([::1]:42216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHDw-0007BI-7w for importer@patchew.org; Tue, 31 Dec 2019 08:06:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54342) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBl-00051B-Hg for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBj-0001wE-Gt for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:56 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28171 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBj-0001tT-Ba for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-qkivLEI3MlayGS6PLGGlLA-1; Tue, 31 Dec 2019 08:03:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F126E1005502 for ; Tue, 31 Dec 2019 13:03:51 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7679D78E96 for ; Tue, 31 Dec 2019 13:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZRqSlxyEb2ZTaTC9B8OpQelTn+FwE72xQVBk3qgcRFo=; b=bTuElouaTE1sXn3eI/EPBscD7RWDMqKFbN3erJIauwnhQvxYCisJo7ajgTxg8pkgLwMYPZ A7kbmEdTgus4WgaF7iAkGOZyewrufUWDcYvxDuqFg+5Jf2dPUbYLPXrWbzk2dmYaZ4VQUd 8mIFJrTdAqTusKXCoEhNkG7nVaPzwcQ= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 02/86] numa: properly check if numa is supported Date: Tue, 31 Dec 2019 14:02:46 +0100 Message-Id: <1577797450-88458-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: qkivLEI3MlayGS6PLGGlLA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit aa57020774b, by mistake used MachineClass::numa_mem_supported to check if NUMA is supported by machine and also as unrelated change set it to true for sbsa-ref board. Luckily change didn't break machines that support NUMA, as the field is set to true for them. But the field is not intended for checking if NUMA is supported and will be flipped to false within this release for new machine types. Fix it: - by using previously used condition !mc->cpu_index_to_instance_props || !mc->get_default_cpu_node_id the first time and then use MachineState::numa_state down the road to check if NUMA is supported - dropping stray sbsa-ref chunk Fixes: aa57020774b690a22be72453b8e91c9b5a68c516 Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- hw/arm/sbsa-ref.c | 1 - hw/core/machine.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 5853bde..9b5bcb5 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -789,7 +789,6 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *= data) mc->possible_cpu_arch_ids =3D sbsa_ref_possible_cpu_arch_ids; mc->cpu_index_to_instance_props =3D sbsa_ref_cpu_index_to_props; mc->get_default_cpu_node_id =3D sbsa_ref_get_default_cpu_node_id; - mc->numa_mem_supported =3D true; } =20 static const TypeInfo sbsa_ref_info =3D { diff --git a/hw/core/machine.c b/hw/core/machine.c index 56137e9..73bf1f8 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -843,7 +843,7 @@ static void machine_initfn(Object *obj) NULL); } =20 - if (mc->numa_mem_supported) { + if (mc->cpu_index_to_instance_props && mc->get_default_cpu_node_id) { ms->numa_state =3D g_new0(NumaState, 1); } =20 @@ -966,7 +966,7 @@ void machine_run_board_init(MachineState *machine) { MachineClass *machine_class =3D MACHINE_GET_CLASS(machine); =20 - if (machine_class->numa_mem_supported) { + if (machine->numa_state) { numa_complete_configuration(machine); if (machine->numa_state->num_nodes) { machine_numa_finish_cpu_init(machine); --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797711; cv=none; d=zohomail.com; s=zohoarc; b=liI44cOsmXTRKJCgP5r4aEsAVHrzTSExmJ/HhkZpk9lpN9CcOeAChUVL0R/3fekjBB2cmZURuIN56Lf1jUNegEFlGe2AVZ7UkwTMBVIiHyCgWdyZwLxueB9CorlhNhjaEI+cuIsuWRsILM3ClTimwuTrKBnXTbvHImc1GI1sBO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797711; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=TqoGRCSaLI1ADt4dMWxHvCfOa+hKB+lisksBfd/Id4Q=; b=D5tpVgJ5ozwAL3B6JsgSapjp0SkcJ1BS50sO8rxBNvpmauufTSyLmGwcd1Klw9ERNcW+RN2WUpCScnSo4nfDRMtdm3UBYnLLt6hTPTVQt14x8piQnupvoL5ggX9UEAUNJ3viu3qFTC2xyvesDTq23UZ4bImPlRa2U6E1q67vZHY= 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 1577797711270547.6823683653471; Tue, 31 Dec 2019 05:08:31 -0800 (PST) Received: from localhost ([::1]:42244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHG9-00026R-Hg for importer@patchew.org; Tue, 31 Dec 2019 08:08:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54392) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBl-00051H-HW for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBk-0001z7-6s for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:57 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:38488 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBk-0001xE-2b for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-342-TVmv7oACPiun_v3cdqPGUg-1; Tue, 31 Dec 2019 08:03:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD064800D5A for ; Tue, 31 Dec 2019 13:03:52 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 451D3620A6 for ; Tue, 31 Dec 2019 13:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TqoGRCSaLI1ADt4dMWxHvCfOa+hKB+lisksBfd/Id4Q=; b=Ev8AZEgH+OO4bpOhXYiYznk+Dy96pcYuwR1Aoq2xo57I9rOeWx2jk416QbHYAFqC2ASWv6 Kv7Mvss1ErE7KGTZGdC0NGdhSj1WNEuTIUs8jrBM/HThOk1wXQR58Cm7rLawymksp5td6C t/2HmQmV0UKQDE3R8uqsOWX6IXANMQE= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 03/86] numa: remove deprecated -mem-path fallback to anonymous RAM Date: Tue, 31 Dec 2019 14:02:47 +0100 Message-Id: <1577797450-88458-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: TVmv7oACPiun_v3cdqPGUg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it was deprecated since 4.0 by commit cb79224b7 (deprecate -mem-path fallback to anonymous RAM) Deprecation period ran ont and it's time to remove it so it won't get in a way of switching to using hostmem backend for RAM. Signed-off-by: Igor Mammedov --- hw/core/numa.c | 18 +----------------- qemu-deprecated.texi | 9 --------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/hw/core/numa.c b/hw/core/numa.c index 19f082d..e0c6a69 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -487,24 +487,8 @@ static void allocate_system_memory_nonnuma(MemoryRegio= n *mr, Object *owner, { if (mem_path) { #ifdef __linux__ - Error *err =3D NULL; memory_region_init_ram_from_file(mr, owner, name, ram_size, 0, 0, - mem_path, &err); - if (err) { - error_report_err(err); - if (mem_prealloc) { - exit(1); - } - warn_report("falling back to regular RAM allocation"); - error_printf("This is deprecated. Make sure that -mem-path " - " specified path has sufficient resources to allo= cate" - " -m specified RAM amount\n"); - /* Legacy behavior: if allocation failed, fall back to - * regular RAM allocation. - */ - mem_path =3D NULL; - memory_region_init_ram_nomigrate(mr, owner, name, ram_size, &e= rror_fatal); - } + mem_path, &error_fatal); #else fprintf(stderr, "-mem-path not supported on this host\n"); exit(1); diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 97ba3cb..5178905 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -113,15 +113,6 @@ QEMU using implicit generic or board specific splittin= g rule. Use @option{memdev} with @var{memory-backend-ram} backend or @option{mem} = (if it's supported by used machine type) to define mapping explictly instead. =20 -@subsection -mem-path fallback to RAM (since 4.1) -Currently if guest RAM allocation from file pointed by @option{mem-path} -fails, QEMU falls back to allocating from RAM, which might result -in unpredictable behavior since the backing file specified by the user -is ignored. In the future, users will be responsible for making sure -the backing storage specified with @option{-mem-path} can actually provide -the guest RAM configured with @option{-m} and QEMU will fail to start up if -RAM allocation is unsuccessful. - @subsection RISC-V -bios (since 4.1) =20 QEMU 4.1 introduced support for the -bios option in QEMU for RISC-V for the --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797700; cv=none; d=zohomail.com; s=zohoarc; b=bVCQaARsKhGpT9kqb+HqFPN8ZbP/LxeUrU6osNSRd5q3prFLnexh4aQRtmUdXVZxD0ZnUcGCLg8l7mfQ9SZXzINUgjG3S+7vTNo1qneLj6X8y+47twKAqTHBMJELZG41RMqG4RMAV1Bi97Z8dfc8bNleTv2Li1zAX2GxTYPA4mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797700; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hGqdvn7buDB8RghzPlzajbceMCPjK2kLFsrPx6rAyXU=; b=LmECFLpf13UdYK4m0qUiFBChHo+ga3biU/FOopdhIb2VwtSJF+BzERX1dNYiXzhyee3UXhrgBAOv8Nydzrk/x2CkyqoU6uK5KG/B4PPANUv9WsHjX9DjFwNX2G6en9ww6UkxrDrmqrssMdTYay1dhIfACfDq5svx+NeU0Es+dOw= 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 1577797700570609.0130961649803; Tue, 31 Dec 2019 05:08:20 -0800 (PST) Received: from localhost ([::1]:42242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHFy-0001uC-Sh for importer@patchew.org; Tue, 31 Dec 2019 08:08:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54413) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBl-00051Y-Ns for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBk-00021B-J3 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:57 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:52249 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBk-0001yc-DZ for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-26-5cI-dhUGOGCyfWeoRCpxyA-1; Tue, 31 Dec 2019 08:03:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8DAAEDB64 for ; Tue, 31 Dec 2019 13:03:53 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12DEC620A6 for ; Tue, 31 Dec 2019 13:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hGqdvn7buDB8RghzPlzajbceMCPjK2kLFsrPx6rAyXU=; b=LIUmWShyEjWPk9/b5+H0sn0vO3vjbVS9mSyasE0gc9aAS8Zq8ZpAybRhKbNFIRT4f3ZfaL wR+cooDNFAAPUusxtBZMVKyUVJ/WkVyX+UtC4pWR/sQZGn/k9BP9VK+eo8cN0kDe5SNVN9 9kYYRRGHTVeQ+rqwNFHvkW7CnUeT1sU= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 04/86] machine: introduce ram-memdev property Date: Tue, 31 Dec 2019 14:02:48 +0100 Message-Id: <1577797450-88458-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 5cI-dhUGOGCyfWeoRCpxyA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Property will contain link to memory backend that will be used for backing initial RAM. Follow up commit will alias -mem-path and -mem-prealloc CLI options into memory backend options to make memory handling consistent (using only hostmem backend family for guest RAM allocation). Signed-off-by: Igor Mammedov --- include/hw/boards.h | 2 ++ hw/core/machine.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/hw/boards.h b/include/hw/boards.h index 61f8bb8..8e2bf2b 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -4,6 +4,7 @@ #define HW_BOARDS_H =20 #include "exec/memory.h" +#include "sysemu/hostmem.h" #include "sysemu/blockdev.h" #include "sysemu/accel.h" #include "qapi/qapi-types-machine.h" @@ -288,6 +289,7 @@ struct MachineState { bool enforce_config_section; bool enable_graphics; char *memory_encryption; + HostMemoryBackend *ram_memdev; DeviceMemoryState *device_memory; =20 ram_addr_t ram_size; diff --git a/hw/core/machine.c b/hw/core/machine.c index 73bf1f8..4a5cd0d 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -847,6 +847,15 @@ static void machine_initfn(Object *obj) ms->numa_state =3D g_new0(NumaState, 1); } =20 + object_property_add_link(obj, "ram-memdev", TYPE_MEMORY_BACKEND, + (Object **)&ms->ram_memdev, + object_property_allow_set_link, + OBJ_PROP_LINK_STRONG, &error_abort); + object_property_set_description(obj, "ram-memdev", + "Set RAM backend" + "Valid value is ID of hostmem based ba= ckend", + &error_abort); + /* Register notifier when init is done for sysbus sanity checks */ ms->sysbus_notifier.notify =3D machine_init_notify; qemu_add_machine_init_done_notifier(&ms->sysbus_notifier); --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797585; cv=none; d=zohomail.com; s=zohoarc; b=DsFcxxwi/0wOnj05TgoMC/BPlWklQoL0RLAAmlKy8+LyWACJyGpx5VWPNkNmvfQSs294Y4ZUlZXJ439GiaFlwzIJblZkXMkbHA5LcB2lfbS0mpz+YF7tVc2Mv7RTgvDgREZBXddx5keXPr242x8A7Hr2wD4ng+HI3Jb8vsA/+aU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797585; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=QzcwaPZHyt0Olrz+OYhK/xmXwI3ck+Uk5u7aUJ3rYaQ=; b=Mitlp4fdJJNrgiYQxsasohwEURS5Tsk3UJsX10RDEsgkBQcP2KuOIpmq+rwEit01uL4C7kLAW1pEoelSnNtf3VAU6sF+gMtJszHU1B4VdlLlAL5U4+hLqJAggcPZq1YM1s4sVmBidSvy+w0gILtiS1ORjJcYuyXTFIIf/PsI/iE= 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 15777975851753.8558235519061554; Tue, 31 Dec 2019 05:06:25 -0800 (PST) Received: from localhost ([::1]:42222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHE7-0007MQ-ES for importer@patchew.org; Tue, 31 Dec 2019 08:06:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54572) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBn-000541-Mn for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBm-00027c-0h for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:59 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32690 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBl-00023t-O7 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:57 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-315-6ZyGQTlsMnie8WS7VC5fDw-1; Tue, 31 Dec 2019 08:03:55 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5EC1A107ACC4 for ; Tue, 31 Dec 2019 13:03:54 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6376620A6 for ; Tue, 31 Dec 2019 13:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QzcwaPZHyt0Olrz+OYhK/xmXwI3ck+Uk5u7aUJ3rYaQ=; b=ieB0zcoPYlZfQvydJKromN8TM7UzH8ZpvkakxOHn5v+GKECWPfX6bhZZ7SLRwadao4mdfh pBePyu64TGseY1JqaN9Nvix9xdtPoXSbnga21QZNTopX3UA/fsQPT/oaxOn5fjodoPQvuS iMsh9aXjj6Ls9lJyneZR9j4dVf9GtXk= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 05/86] machine: alias -mem-path and -mem-prealloc into memory-foo backend Date: Tue, 31 Dec 2019 14:02:49 +0100 Message-Id: <1577797450-88458-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 6ZyGQTlsMnie8WS7VC5fDw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Allow a machine to opt in for hostmem backend based initial RAM even if user used old -mem-path/prealloc options by providing MachineClass::default_ram_id Follow up patches will incrementally convert machines to new API, by dropping memory_region_allocate_system_memory() and setting default_ram_id that board used to use before conversion to keep migration stream the same. Signed-off-by: Igor Mammedov --- include/hw/boards.h | 5 +++++ include/sysemu/hostmem.h | 16 ++++++++++++++++ backends/hostmem-file.c | 7 ------- backends/hostmem-ram.c | 2 -- vl.c | 25 +++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 8e2bf2b..65da7f0 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -170,6 +170,10 @@ typedef struct { * false is returned, an error must be set to show the reason of * the rejection. If the hook is not provided, all hotplug will be * allowed. + * @default_ram_id: + * Specifies inital RAM MemoryRegion name to be used for default backend + * creation if user explicitly hasn't specified backend with "ram-memde= v" + * property. */ struct MachineClass { /*< private >*/ @@ -226,6 +230,7 @@ struct MachineClass { bool nvdimm_supported; bool numa_mem_supported; bool auto_enable_numa; + const char *default_ram_id; =20 HotplugHandler *(*get_hotplug_handler)(MachineState *machine, DeviceState *dev); diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 4dbdadd..5db0d66 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -27,6 +27,22 @@ #define MEMORY_BACKEND_CLASS(klass) \ OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEN= D) =20 +/* hostmem-ram.c */ +/** + * @TYPE_MEMORY_BACKEND_RAM: + * name of backend that uses mmap on the anonymous RAM + */ + +#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram" + +/* hostmem-file.c */ +/** + * @TYPE_MEMORY_BACKEND_FILE: + * name of backend that uses mmap on a file descriptor + */ +#define TYPE_MEMORY_BACKEND_FILE "memory-backend-file" + +typedef struct HostMemoryBackend HostMemoryBackend; typedef struct HostMemoryBackendClass HostMemoryBackendClass; =20 /** diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index be64020..cb319a9 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -18,13 +18,6 @@ #include "sysemu/sysemu.h" #include "qom/object_interfaces.h" =20 -/* hostmem-file.c */ -/** - * @TYPE_MEMORY_BACKEND_FILE: - * name of backend that uses mmap on a file descriptor - */ -#define TYPE_MEMORY_BACKEND_FILE "memory-backend-file" - #define MEMORY_BACKEND_FILE(obj) \ OBJECT_CHECK(HostMemoryBackendFile, (obj), TYPE_MEMORY_BACKEND_FILE) =20 diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index 6aab8d3..5cc53e7 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -16,8 +16,6 @@ #include "qemu/module.h" #include "qom/object_interfaces.h" =20 -#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram" - static void ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { diff --git a/vl.c b/vl.c index 86474a5..579ae44 100644 --- a/vl.c +++ b/vl.c @@ -75,6 +75,7 @@ int main(int argc, char **argv) #include "ui/input.h" #include "sysemu/sysemu.h" #include "sysemu/numa.h" +#include "sysemu/hostmem.h" #include "exec/gdbstub.h" #include "qemu/timer.h" #include "chardev/char.h" @@ -2814,6 +2815,25 @@ static void configure_accelerators(const char *progn= ame) } } =20 +static void create_default_memdev(MachineState *ms, const char *path, + bool prealloc) +{ + Object *obj; + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + + obj =3D object_new(path ? TYPE_MEMORY_BACKEND_FILE : TYPE_MEMORY_BACKE= ND_RAM); + if (path) { + object_property_set_str(obj, path, "mem-path", &error_fatal); + } + object_property_set_bool(obj, prealloc, "prealloc", &error_fatal); + object_property_set_int(obj, ms->ram_size, "size", &error_fatal); + object_property_add_child(object_get_objects_root(), mc->default_ram_i= d, + obj, &error_fatal); + user_creatable_complete(USER_CREATABLE(obj), &error_fatal); + object_unref(obj); + object_property_set_link(OBJECT(ms), obj, "ram-memdev", &error_fatal); +} + int main(int argc, char **argv, char **envp) { int i; @@ -4274,6 +4294,11 @@ int main(int argc, char **argv, char **envp) } parse_numa_opts(current_machine); =20 + if (!current_machine->ram_memdev && + machine_class->default_ram_size && + machine_class->default_ram_id) { + create_default_memdev(current_machine, mem_path, mem_prealloc); + } /* do monitor/qmp handling at preconfig state if requested */ main_loop(); =20 --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797859; cv=none; d=zohomail.com; s=zohoarc; b=bh71wpG9tAsu222DHO45kPSHbCk6RWj+JrZ5+XWNU5N2hIByaibRGF+L0aLcPeLrPW9wrD5XbvXonwviMKcui7ladCiuQluihGXEcDQcZBr7vUvVKFvMyXv0cS24o0KxjdVlQRbGiPjsyLcGkTbzrukXgGThOeGo6Fb9d2brIcA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797859; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=CvQmX9TtRsW2ZDQR4ftwakYAXnfi8zri8FLICoD7kqw=; b=YryXhL4lqPa9qg3TKbUIl370XcZMBn+A6OKttjdUFHhRawk+HIKNptk+WsO0jlnfMuf2TS6fYUzJhLVXvSVU/o0mYhlCmKNrV0hBKDAexEZrVy3CITQ5bVd0fRPRGNwyMcsOce+32bnz8KZEXBuFaWonkHLf8wanDQd8aoIeu8U= 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 157779785936720.427978866169042; Tue, 31 Dec 2019 05:10:59 -0800 (PST) Received: from localhost ([::1]:42272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHIX-0005e5-P2 for importer@patchew.org; Tue, 31 Dec 2019 08:10:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54658) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBo-00055h-Mk for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBn-0002D8-4E for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49888 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBm-0002AW-VF for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-TZ0EcxrmMA64nCqRLRmc3Q-1; Tue, 31 Dec 2019 08:03:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29498800D50 for ; Tue, 31 Dec 2019 13:03:55 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id A420E78E96 for ; Tue, 31 Dec 2019 13:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CvQmX9TtRsW2ZDQR4ftwakYAXnfi8zri8FLICoD7kqw=; b=iLDfxE7KnyA+tSG/AL2gSbE45qx9jxWrKKpo9V+IybQC5o2FD4ng4xn9ciuDTcFWhlaj5O ifTItj4qYzxTupwVenFiX0CVnuR+rKfqZcN03Y3UO3n+6u9mAEbbXCfejqpFl5wwZCEZcL hwT6gzZKrBFfixO5YR8bsZNL1B7snGA= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 06/86] machine: introduce convenience MachineState::ram Date: Tue, 31 Dec 2019 14:02:50 +0100 Message-Id: <1577797450-88458-7-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: TZ0EcxrmMA64nCqRLRmc3Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" the new field will be used by boards to get access to main RAM memory region and will help to save boiler plate in boards which often add a field or variable just for this purpose. Memory region will be equivalent to what currently used memory_region_allocate_system_memory() is returning apart from that it will come from hostmem backend. Followup patches will incrementally switch boards to using RAM from MachineState::ram. Patch takes care of non-NUMA case and follow up patch will initialize MachineState::ram for NUMA case. Signed-off-by: Igor Mammedov --- include/hw/boards.h | 9 ++++++++- hw/core/machine.c | 21 +++++++++++++++++++++ hw/core/numa.c | 14 +------------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 65da7f0..70491c1 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -73,7 +73,12 @@ void machine_set_cpu_numa_node(MachineState *machine, Error **errp); =20 void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *= type); - +/* + * Checks that backend isn't used, preps it for exclusive usage and + * returns migratable MemoryRegion provided by backend. + */ +MemoryRegion *machine_consume_memdev(MachineState *machine, + HostMemoryBackend *backend); =20 /** * CPUArchId: @@ -295,6 +300,8 @@ struct MachineState { bool enable_graphics; char *memory_encryption; HostMemoryBackend *ram_memdev; + /* convenience alias to ram_memdev memory region or numa container */ + MemoryRegion *ram; DeviceMemoryState *device_memory; =20 ram_addr_t ram_size; diff --git a/hw/core/machine.c b/hw/core/machine.c index 4a5cd0d..080ce57 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -26,6 +26,7 @@ #include "sysemu/qtest.h" #include "hw/pci/pci.h" #include "hw/mem/nvdimm.h" +#include "migration/vmstate.h" =20 GlobalProperty hw_compat_4_2[] =3D { { "virtio-blk-device", "x-enable-wce-if-config-wce", "off" }, @@ -971,10 +972,30 @@ static void machine_numa_finish_cpu_init(MachineState= *machine) g_string_free(s, true); } =20 +MemoryRegion *machine_consume_memdev(MachineState *machine, + HostMemoryBackend *backend) +{ + MemoryRegion *ret =3D host_memory_backend_get_memory(backend); + + if (memory_region_is_mapped(ret)) { + char *path =3D object_get_canonical_path_component(OBJECT(backend)= ); + error_report("memory backend %s can't be used multiple times.", pa= th); + g_free(path); + exit(EXIT_FAILURE); + } + host_memory_backend_set_mapped(backend, true); + vmstate_register_ram_global(ret); + return ret; +} + void machine_run_board_init(MachineState *machine) { MachineClass *machine_class =3D MACHINE_GET_CLASS(machine); =20 + if (machine->ram_memdev) { + machine->ram =3D machine_consume_memdev(machine, machine->ram_memd= ev); + } + if (machine->numa_state) { numa_complete_configuration(machine); if (machine->numa_state->num_nodes) { diff --git a/hw/core/numa.c b/hw/core/numa.c index e0c6a69..ee655b0 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -520,20 +520,8 @@ void memory_region_allocate_system_memory(MemoryRegion= *mr, Object *owner, if (!backend) { continue; } - MemoryRegion *seg =3D host_memory_backend_get_memory(backend); - - if (memory_region_is_mapped(seg)) { - char *path =3D object_get_canonical_path_component(OBJECT(back= end)); - error_report("memory backend %s is used multiple times. Each " - "-numa option must use a different memdev value.", - path); - g_free(path); - exit(1); - } - - host_memory_backend_set_mapped(backend, true); + MemoryRegion *seg =3D machine_consume_memdev(ms, backend); memory_region_add_subregion(mr, addr, seg); - vmstate_register_ram_global(seg); addr +=3D size; } } --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797727; cv=none; d=zohomail.com; s=zohoarc; b=T/SqcNqoctYlLlUib275ZrB9iv7BKHD/TivQVw6+zfEkIW8OJJKyaWHspoI5W1a87gKT9phiKaJjUrWAOHk2f1AohvBllzWfNv8Oi+nos26uaHKwpnf2A9RVEPWNJ9gSoUk0geAkDTToReGm2JTMFOERWpvnbjDunLpPnnMRsHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797727; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Pi4qg6e+0D+hKsCGU9ukhXFZ4DCZR/K9HAcGfwOP+qE=; b=g6uS1JIxM4t+AtwBiDZ1v/ADmAM0QXnOhep7DoZ5NP9kBc/laYIYjJIdbgkk8KXzvdoIztzMBkHv7YJlhM5hbQsgEFAGwHEc31CvP1jV/Ld9+Kd4DVcuxDgi1GVnfvesKsmPCxMZGssEEXto/aP9nEtYr3f73+RatMxiafIweDA= 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 1577797727048848.6766951262022; Tue, 31 Dec 2019 05:08:47 -0800 (PST) Received: from localhost ([::1]:42248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHGP-0002TA-JA for importer@patchew.org; Tue, 31 Dec 2019 08:08:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54712) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBp-00057G-Eq for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBn-0002Gt-TM for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:01 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:24622 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBn-0002EO-NR for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:03:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-y6SarP2_OgixfPyw4afeAQ-1; Tue, 31 Dec 2019 08:03:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EDE65107ACE5 for ; Tue, 31 Dec 2019 13:03:55 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72374620A6 for ; Tue, 31 Dec 2019 13:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pi4qg6e+0D+hKsCGU9ukhXFZ4DCZR/K9HAcGfwOP+qE=; b=QTQ3N0uPVH3FjRm6gsrQbWFcR2C72SfqMskiJOlAghp1vaURqCkR7EFRapplYCTHj9c/tM Y0X/c4Q350D3VyZRhVOv0M6/DXxHYt9VN317TlqwcxSYwhVnfTAiHpPehnd9GS9Uhjx8KR Tcev09lM7XvsW3Syo/9SKw0gBFywLqQ= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 07/86] initialize MachineState::ram in NUMA case Date: Tue, 31 Dec 2019 14:02:51 +0100 Message-Id: <1577797450-88458-8-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: y6SarP2_OgixfPyw4afeAQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In case of NUMA there are 2 cases to consider: 1. '-numa node,memdev', the only one that will be available for 5.0 and newer machine types. In this case reuse current behavior, with only difference memdevs are put into MachineState::ram container + a temporary glue to keep memory_region_allocate_system_memory() working until all boards converted. 2. fake NUMA ("-numa node mem" and default RAM splitting) the later has been deprecated and will be removed but the former is going to stay available for compat reasons for 4.2 and older machine types (libvirt was heavy user of this) it takes allocate_system_memory_nonnuma() path, like non-NUMA case and falls under conversion to memdev. So extend non-NUMA MachineState::ram initialization introduced in previous patch to take care of fake NUMA case. Signed-off-by: Igor Mammedov --- include/sysemu/numa.h | 1 + hw/core/numa.c | 43 ++++++++++++++++++++++++++++++------------- vl.c | 7 ++++--- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index ae9c41d..21f6a5a 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -49,5 +49,6 @@ void numa_default_auto_assign_ram(MachineClass *mc, NodeI= nfo *nodes, int nb_nodes, ram_addr_t size); void numa_cpu_pre_plug(const struct CPUArchId *slot, DeviceState *dev, Error **errp); +bool numa_uses_legacy_mem(void); =20 #endif diff --git a/hw/core/numa.c b/hw/core/numa.c index ee655b0..a752866 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -51,6 +51,11 @@ QemuOptsList qemu_numa_opts =3D { }; =20 static int have_memdevs; +bool numa_uses_legacy_mem(void) +{ + return !have_memdevs; +} + static int have_mem; static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one. * For all nodes, nodeid < max_numa_nodeid @@ -355,6 +360,23 @@ void numa_default_auto_assign_ram(MachineClass *mc, No= deInfo *nodes, nodes[i].node_mem =3D size - usedmem; } =20 +static void numa_init_memdev_container(MachineState *ms, MemoryRegion *ram) +{ + int i; + uint64_t addr =3D 0; + + for (i =3D 0; i < ms->numa_state->num_nodes; i++) { + uint64_t size =3D ms->numa_state->nodes[i].node_mem; + HostMemoryBackend *backend =3D ms->numa_state->nodes[i].node_memde= v; + if (!backend) { + continue; + } + MemoryRegion *seg =3D machine_consume_memdev(ms, backend); + memory_region_add_subregion(ram, addr, seg); + addr +=3D size; + } +} + void numa_complete_configuration(MachineState *ms) { int i; @@ -437,6 +459,12 @@ void numa_complete_configuration(MachineState *ms) exit(1); } =20 + if (!numa_uses_legacy_mem() && mc->default_ram_id) { + ms->ram =3D g_new(MemoryRegion, 1); + memory_region_init(ms->ram, OBJECT(ms), mc->default_ram_id, + ram_size); + numa_init_memdev_container(ms, ms->ram); + } /* QEMU needs at least all unique node pair distances to build * the whole NUMA distance table. QEMU treats the distance table * as symmetric by default, i.e. distance A->B =3D=3D distance B->= A. @@ -503,27 +531,16 @@ void memory_region_allocate_system_memory(MemoryRegio= n *mr, Object *owner, const char *name, uint64_t ram_size) { - uint64_t addr =3D 0; - int i; MachineState *ms =3D MACHINE(qdev_get_machine()); =20 if (ms->numa_state =3D=3D NULL || - ms->numa_state->num_nodes =3D=3D 0 || !have_memdevs) { + ms->numa_state->num_nodes =3D=3D 0 || numa_uses_legacy_mem()) { allocate_system_memory_nonnuma(mr, owner, name, ram_size); return; } =20 memory_region_init(mr, owner, name, ram_size); - for (i =3D 0; i < ms->numa_state->num_nodes; i++) { - uint64_t size =3D ms->numa_state->nodes[i].node_mem; - HostMemoryBackend *backend =3D ms->numa_state->nodes[i].node_memde= v; - if (!backend) { - continue; - } - MemoryRegion *seg =3D machine_consume_memdev(ms, backend); - memory_region_add_subregion(mr, addr, seg); - addr +=3D size; - } + numa_init_memdev_container(ms, mr); } =20 static void numa_stat_memory_devices(NumaNodeMem node_mem[]) diff --git a/vl.c b/vl.c index 579ae44..b89e76c 100644 --- a/vl.c +++ b/vl.c @@ -4294,9 +4294,10 @@ int main(int argc, char **argv, char **envp) } parse_numa_opts(current_machine); =20 - if (!current_machine->ram_memdev && - machine_class->default_ram_size && - machine_class->default_ram_id) { + if (numa_uses_legacy_mem() && + machine_class->default_ram_size && + machine_class->default_ram_id && + !current_machine->ram_memdev) { create_default_memdev(current_machine, mem_path, mem_prealloc); } /* do monitor/qmp handling at preconfig state if requested */ --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797996; cv=none; d=zohomail.com; s=zohoarc; b=O5jnDkdLv0+7qqdHphAOBlz7ExfdJZs2MQK/WIk/AVDgFwE1YXSlWemMf0lD1Yq7ZIuzLDXWngCsB0/XCyBPNcooHwr438uJq/tjIW6YNRitzX8N/GrDFA3PZvqZ+cAWVlHsovieqgGRDIgbX80uUUVX7p0RpGngGgWBaVFSKcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797996; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=lZEgKo+57ODct3JCURUjhK20v4l31l3e6Fp67VhEK3Q=; b=Z6Iu1J2dJzhWNBpV5xPnRf9160LyLTyp6lzDXpVWXJAP8x+haaQv5F3Xuge6ak+XbJFS2yU/+5W8Oth/OpQMvY4tG0N2KpME/Zae8S5ISAnqmwN8cquGO41rHb/n9otHnbe42Ha+JGzDY9WslInpgOAtHt/oYyZJLDMoeDOFrtk= 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 1577797996790279.59146981757124; Tue, 31 Dec 2019 05:13:16 -0800 (PST) Received: from localhost ([::1]:42302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHKl-0000UZ-49 for importer@patchew.org; Tue, 31 Dec 2019 08:13:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54901) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBr-0005B8-Iu for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBq-0002Rt-77 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:03 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:54657 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBq-0002PQ-1O for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-345-Btu_qz3HN2-XfesHWTKwyA-1; Tue, 31 Dec 2019 08:03:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA144100551B for ; Tue, 31 Dec 2019 13:03:56 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4007F620A6 for ; Tue, 31 Dec 2019 13:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lZEgKo+57ODct3JCURUjhK20v4l31l3e6Fp67VhEK3Q=; b=Q2sugjy0LFrZ1GEZ3v6zG0TQH2hW4wo/Cg7OvyLlm7OVCB5vGfQ0bhL2wa+n+SdssePzTG kFsupm8RfbyNVBjriJ5sgHyrnzUlbweALVr/Edi9islD6eSABtjfiKVnFPH5xy1V4600Yl g2B7VYBH19hcp8UKqH6STxVSgQNjmmc= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 08/86] alpha:dp264: use memdev for RAM Date: Tue, 31 Dec 2019 14:02:52 +0100 Message-Id: <1577797450-88458-9-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Btu_qz3HN2-XfesHWTKwyA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Acked-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/alpha/alpha_sys.h | 2 +- hw/alpha/dp264.c | 3 ++- hw/alpha/typhoon.c | 8 ++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h index 95033d7..bc0a286 100644 --- a/hw/alpha/alpha_sys.h +++ b/hw/alpha/alpha_sys.h @@ -11,7 +11,7 @@ #include "hw/intc/i8259.h" =20 =20 -PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, AlphaCPU *[4], +PCIBus *typhoon_init(MemoryRegion *, ISABus **, qemu_irq *, AlphaCPU *[4], pci_map_irq_fn); =20 /* alpha_pci.c. */ diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index f2026fd..29439c7 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -75,7 +75,7 @@ static void clipper_init(MachineState *machine) cpus[0]->env.trap_arg2 =3D smp_cpus; =20 /* Init the chipset. */ - pci_bus =3D typhoon_init(ram_size, &isa_bus, &rtc_irq, cpus, + pci_bus =3D typhoon_init(machine->ram, &isa_bus, &rtc_irq, cpus, clipper_pci_map_irq); =20 /* Since we have an SRM-compatible PALcode, use the SRM epoch. */ @@ -183,6 +183,7 @@ static void clipper_machine_init(MachineClass *mc) mc->max_cpus =3D 4; mc->is_default =3D 1; mc->default_cpu_type =3D ALPHA_CPU_TYPE_NAME("ev67"); + mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("clipper", clipper_machine_init) diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index 179e1f7..1795e2f 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -58,7 +58,6 @@ typedef struct TyphoonState { TyphoonCchip cchip; TyphoonPchip pchip; MemoryRegion dchip_region; - MemoryRegion ram_region; } TyphoonState; =20 /* Called when one of DRIR or DIM changes. */ @@ -817,8 +816,7 @@ static void typhoon_alarm_timer(void *opaque) cpu_interrupt(CPU(s->cchip.cpu[cpu]), CPU_INTERRUPT_TIMER); } =20 -PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, - qemu_irq *p_rtc_irq, +PCIBus *typhoon_init(MemoryRegion *ram, ISABus **isa_bus, qemu_irq *p_rtc_= irq, AlphaCPU *cpus[4], pci_map_irq_fn sys_map_irq) { MemoryRegion *addr_space =3D get_system_memory(); @@ -851,9 +849,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_= bus, =20 /* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ - memory_region_allocate_system_memory(&s->ram_region, OBJECT(s), "ram", - ram_size); - memory_region_add_subregion(addr_space, 0, &s->ram_region); + memory_region_add_subregion(addr_space, 0, ram); =20 /* TIGbus, 0x801.0000.0000, 1GB. */ /* ??? The TIGbus is used for delivering interrupts, and access to --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797880; cv=none; d=zohomail.com; s=zohoarc; b=V87GkP2apsQtuvTi9G1dHmgDBvhsroz7Cbb9tvn8cQUS2iWRx9zRmiNTKiutkYIt+K4ev3fXbCsxd3dhEHfw+tymFXrNaVYpnr1wDIe2RJZvGJMVZ3pq6nJKwY2AKUpdCmq5wwxsP6w9Wmd1KbyLPBbrj7IlQmdPHGAUlXTOfbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797880; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=2A0sz/3RlF1o0iEKZLVw9QhSVU121d+d0YysvQISzxs=; b=ecubgzoQp9J4PoN59euzj7pTmDTFA/hZGirErF5dzEskJNlm31fmyFjW1/ac/PASbb2jR60fwrvbkR7oMwfpyb+Jt5QEop1HHc2grfsCuTLs4MFZPf0gOZ+HrpoqKjvRncw+y39x4jOT8FlGhx1c7X13SgOPPEwupOReEfae2Xg= 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 1577797880452362.00153262753247; Tue, 31 Dec 2019 05:11:20 -0800 (PST) Received: from localhost ([::1]:42284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHIs-00067Z-Tt for importer@patchew.org; Tue, 31 Dec 2019 08:11:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54869) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBr-0005AR-7S for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBp-0002OP-HV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:03 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:42898 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBp-0002LD-Ba for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:01 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-J6l0JsPkNGuKJzhxwUXefA-1; Tue, 31 Dec 2019 08:03:58 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8976C477 for ; Tue, 31 Dec 2019 13:03:57 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E16578E96 for ; Tue, 31 Dec 2019 13:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2A0sz/3RlF1o0iEKZLVw9QhSVU121d+d0YysvQISzxs=; b=G4i9HqrXOm7JAK/J78R29NEo4jMd/WWWw2iyHAvtNEaZq4UNJu78G34eT+7vpWhnWbm9fy M/zqlyTW4zK86pAttW0ekxVEhLKajaHi+3XyR2TxpuRudFORWha6OgnfvYce93pfAWm069 T7fkjdbKI3OLi6Y0xEUV7aO22C3zaQo= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 09/86] arm:aspeed: convert valid RAM sizes to data Date: Tue, 31 Dec 2019 14:02:53 +0100 Message-Id: <1577797450-88458-10-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: J6l0JsPkNGuKJzhxwUXefA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" various foo_rambits() hardcode mapping of RAM sizes to RAM feature bits, which is hard to reuse and repeats over and over. Convert maps into GLib's hash tables and perform mapping using common mapping function. Follow up patch will reuse tables for actually checking ram-size property. Signed-off-by: Igor Mammedov --- include/hw/misc/aspeed_sdmc.h | 2 + hw/misc/aspeed_sdmc.c | 116 ++++++++++++++++----------------------= ---- 2 files changed, 47 insertions(+), 71 deletions(-) diff --git a/include/hw/misc/aspeed_sdmc.h b/include/hw/misc/aspeed_sdmc.h index 5dbde59..de1501f 100644 --- a/include/hw/misc/aspeed_sdmc.h +++ b/include/hw/misc/aspeed_sdmc.h @@ -39,6 +39,8 @@ typedef struct AspeedSDMCState { typedef struct AspeedSDMCClass { SysBusDeviceClass parent_class; =20 + GHashTable *ram2feat; + int fallback_ram_size; uint64_t max_ram_size; uint32_t (*compute_conf)(AspeedSDMCState *s, uint32_t data); void (*write)(AspeedSDMCState *s, uint32_t reg, uint32_t data); diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 2df3244..3fc80f0 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -148,72 +148,6 @@ static const MemoryRegionOps aspeed_sdmc_ops =3D { .valid.max_access_size =3D 4, }; =20 -static int ast2400_rambits(AspeedSDMCState *s) -{ - switch (s->ram_size >> 20) { - case 64: - return ASPEED_SDMC_DRAM_64MB; - case 128: - return ASPEED_SDMC_DRAM_128MB; - case 256: - return ASPEED_SDMC_DRAM_256MB; - case 512: - return ASPEED_SDMC_DRAM_512MB; - default: - break; - } - - /* use a common default */ - warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 256M", - s->ram_size); - s->ram_size =3D 256 << 20; - return ASPEED_SDMC_DRAM_256MB; -} - -static int ast2500_rambits(AspeedSDMCState *s) -{ - switch (s->ram_size >> 20) { - case 128: - return ASPEED_SDMC_AST2500_128MB; - case 256: - return ASPEED_SDMC_AST2500_256MB; - case 512: - return ASPEED_SDMC_AST2500_512MB; - case 1024: - return ASPEED_SDMC_AST2500_1024MB; - default: - break; - } - - /* use a common default */ - warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 512M", - s->ram_size); - s->ram_size =3D 512 << 20; - return ASPEED_SDMC_AST2500_512MB; -} - -static int ast2600_rambits(AspeedSDMCState *s) -{ - switch (s->ram_size >> 20) { - case 256: - return ASPEED_SDMC_AST2600_256MB; - case 512: - return ASPEED_SDMC_AST2600_512MB; - case 1024: - return ASPEED_SDMC_AST2600_1024MB; - case 2048: - return ASPEED_SDMC_AST2600_2048MB; - default: - break; - } - - /* use a common default */ - warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 1024M", - s->ram_size); - s->ram_size =3D 1024 << 20; - return ASPEED_SDMC_AST2600_1024MB; -} - static void aspeed_sdmc_reset(DeviceState *dev) { AspeedSDMCState *s =3D ASPEED_SDMC(dev); @@ -257,11 +191,14 @@ static Property aspeed_sdmc_properties[] =3D { static void aspeed_sdmc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSDMCClass *asc =3D ASPEED_SDMC_CLASS(klass); + dc->realize =3D aspeed_sdmc_realize; dc->reset =3D aspeed_sdmc_reset; dc->desc =3D "ASPEED SDRAM Memory Controller"; dc->vmsd =3D &vmstate_aspeed_sdmc; dc->props =3D aspeed_sdmc_properties; + asc->ram2feat =3D g_hash_table_new(g_direct_hash, g_direct_equal); } =20 static const TypeInfo aspeed_sdmc_info =3D { @@ -273,10 +210,28 @@ static const TypeInfo aspeed_sdmc_info =3D { .abstract =3D true, }; =20 +static int aspeed_get_ram_feat(AspeedSDMCState *s) +{ + AspeedSDMCClass *asc =3D ASPEED_SDMC_GET_CLASS(s); + int ram_mb =3D s->ram_size >> 20; + gpointer val; + + if (g_hash_table_contains(asc->ram2feat, GINT_TO_POINTER(ram_mb))) { + val =3D g_hash_table_lookup(asc->ram2feat, GINT_TO_POINTER(ram_mb)= ); + return GPOINTER_TO_INT(val); + } + + warn_report("Invalid RAM size 0x%" PRIx64 ". Using default %dM", + s->ram_size, asc->fallback_ram_size); + s->ram_size =3D asc->fallback_ram_size << 20; + val =3D g_hash_table_lookup(asc->ram2feat, &asc->fallback_ram_size); + return GPOINTER_TO_INT(val); +} + static uint32_t aspeed_2400_sdmc_compute_conf(AspeedSDMCState *s, uint32_t= data) { - uint32_t fixed_conf =3D ASPEED_SDMC_VGA_COMPAT | - ASPEED_SDMC_DRAM_SIZE(ast2400_rambits(s)); + int ram_f =3D aspeed_get_ram_feat(s); + uint32_t fixed_conf =3D ASPEED_SDMC_VGA_COMPAT | ASPEED_SDMC_DRAM_SIZE= (ram_f); =20 /* Make sure readonly bits are kept */ data &=3D ~ASPEED_SDMC_READONLY_MASK; @@ -298,6 +253,9 @@ static void aspeed_2400_sdmc_write(AspeedSDMCState *s, = uint32_t reg, s->regs[reg] =3D data; } =20 +#define REGISTER_RAM_SIZE(h, k, v) \ + g_hash_table_insert(h->ram2feat, GINT_TO_POINTER(k), GINT_TO_POINTER(v= )) + static void aspeed_2400_sdmc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -307,6 +265,11 @@ static void aspeed_2400_sdmc_class_init(ObjectClass *k= lass, void *data) asc->max_ram_size =3D 512 << 20; asc->compute_conf =3D aspeed_2400_sdmc_compute_conf; asc->write =3D aspeed_2400_sdmc_write; + asc->fallback_ram_size =3D 256; + REGISTER_RAM_SIZE(asc, 64, ASPEED_SDMC_DRAM_64MB); + REGISTER_RAM_SIZE(asc, 128, ASPEED_SDMC_DRAM_128MB); + REGISTER_RAM_SIZE(asc, 256, ASPEED_SDMC_DRAM_256MB); + REGISTER_RAM_SIZE(asc, 512, ASPEED_SDMC_DRAM_512MB); } =20 static const TypeInfo aspeed_2400_sdmc_info =3D { @@ -317,10 +280,10 @@ static const TypeInfo aspeed_2400_sdmc_info =3D { =20 static uint32_t aspeed_2500_sdmc_compute_conf(AspeedSDMCState *s, uint32_t= data) { + int ram_f =3D aspeed_get_ram_feat(s); uint32_t fixed_conf =3D ASPEED_SDMC_HW_VERSION(1) | ASPEED_SDMC_VGA_APERTURE(ASPEED_SDMC_VGA_64MB) | - ASPEED_SDMC_CACHE_INITIAL_DONE | - ASPEED_SDMC_DRAM_SIZE(ast2500_rambits(s)); + ASPEED_SDMC_CACHE_INITIAL_DONE | ASPEED_SDMC_DRAM_SIZE(ram_f); =20 /* Make sure readonly bits are kept */ data &=3D ~ASPEED_SDMC_AST2500_READONLY_MASK; @@ -360,6 +323,11 @@ static void aspeed_2500_sdmc_class_init(ObjectClass *k= lass, void *data) asc->max_ram_size =3D 1024 << 20; asc->compute_conf =3D aspeed_2500_sdmc_compute_conf; asc->write =3D aspeed_2500_sdmc_write; + asc->fallback_ram_size =3D 512; + REGISTER_RAM_SIZE(asc, 128, ASPEED_SDMC_AST2500_128MB); + REGISTER_RAM_SIZE(asc, 256, ASPEED_SDMC_AST2500_256MB); + REGISTER_RAM_SIZE(asc, 512, ASPEED_SDMC_AST2500_512MB); + REGISTER_RAM_SIZE(asc, 1024, ASPEED_SDMC_AST2500_1024MB); } =20 static const TypeInfo aspeed_2500_sdmc_info =3D { @@ -370,9 +338,10 @@ static const TypeInfo aspeed_2500_sdmc_info =3D { =20 static uint32_t aspeed_2600_sdmc_compute_conf(AspeedSDMCState *s, uint32_t= data) { + int ram_f =3D aspeed_get_ram_feat(s); uint32_t fixed_conf =3D ASPEED_SDMC_HW_VERSION(3) | ASPEED_SDMC_VGA_APERTURE(ASPEED_SDMC_VGA_64MB) | - ASPEED_SDMC_DRAM_SIZE(ast2600_rambits(s)); + ASPEED_SDMC_DRAM_SIZE(ram_f); =20 /* Make sure readonly bits are kept (use ast2500 mask) */ data &=3D ~ASPEED_SDMC_AST2500_READONLY_MASK; @@ -413,6 +382,11 @@ static void aspeed_2600_sdmc_class_init(ObjectClass *k= lass, void *data) asc->max_ram_size =3D 2048 << 20; asc->compute_conf =3D aspeed_2600_sdmc_compute_conf; asc->write =3D aspeed_2600_sdmc_write; + asc->fallback_ram_size =3D 512; + REGISTER_RAM_SIZE(asc, 256, ASPEED_SDMC_AST2600_256MB); + REGISTER_RAM_SIZE(asc, 512, ASPEED_SDMC_AST2600_512MB); + REGISTER_RAM_SIZE(asc, 1024, ASPEED_SDMC_AST2600_1024MB); + REGISTER_RAM_SIZE(asc, 2048, ASPEED_SDMC_AST2600_2048MB); } =20 static const TypeInfo aspeed_2600_sdmc_info =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797867; cv=none; d=zohomail.com; s=zohoarc; b=YTZE+nB1xcmh82LgRiFus84kiHUTHHUPNM2KHc+AkqK8VVGTEvqsU5bTpwC8HMRm2ZM3eJ7STClJVTHY0Qf3A1L8gXmBzxxPksLG+zyE6fimlvitAcNRcgOVjIOflnLVgN200qjbUG5GFHa5UvIUnbOcOwIkHbkEHbslU8Wo+BI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797867; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=AmZVTB7dAUFXmt9nBsUuXJIwbbOeYxCoxcT6SlrnKy8=; b=itn+5wPAP31hO4vgP2dpbrYbBM2ErIiHjXR4Yuq6QJBXfvepJMHq2+TkNk7Ij/ORxsNclxQQNU+lyxNtJZOr+92kFSv2I5eZCLID1/3Ie9ITph8V+XyvgftWbnbHVTOW02EuQiFw5q2FSjq804xxJFKIQsvI+Gt8NCY+3ogx3GQ= 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 1577797867383958.6478994001126; Tue, 31 Dec 2019 05:11:07 -0800 (PST) Received: from localhost ([::1]:42282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHIg-0005uA-7W for importer@patchew.org; Tue, 31 Dec 2019 08:11:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54900) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBr-0005B7-Jr for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBq-0002SM-Ae for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:03 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38159 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBq-0002Q2-4H for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-97-lq6hQalWPluE7D4a7GYV0A-1; Tue, 31 Dec 2019 08:03:59 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 554F918031CD for ; Tue, 31 Dec 2019 13:03:58 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFB54620A6 for ; Tue, 31 Dec 2019 13:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AmZVTB7dAUFXmt9nBsUuXJIwbbOeYxCoxcT6SlrnKy8=; b=ZCqC5ciE4C1wmF+7yr/CAuxjonAXxM6hhUMly9553mJfXnLIYTMNI6Pw7IpBjve5hAzR7f UzhtwwygbIgwjMEK326iYmJ0CvApdo8PB+HFjR6U9oY6QxFZ/OIsg7noP9sK5bCsfBGtHT T9/QAJK/pvr3DkZWICi2cmMtXNRsLgo= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 10/86] arm:aspeed: actually check RAM size Date: Tue, 31 Dec 2019 14:02:54 +0100 Message-Id: <1577797450-88458-11-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: lq6hQalWPluE7D4a7GYV0A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It's supposed that SOC will check if "-m" provided RAM size is valid by setting "ram-size" property and then board would read back valid (possibly corrected value) to allocate/map RAM MemoryRegion with valid size. Well it isn't doing so, since check is called too late indirectly from aspeed_sdmc_reset()->asc->compute_conf() or much later when guest writes to configuration register. So depending on "-m" value QEMU end-ups with a warning and an invalid MemoryRegion size allocated and mapped. (examples: -M ast2500-evb -m 1M 0000000080000000-000000017ffffffe (prio 0, i/o): aspeed-ram-container 0000000080000000-00000000800fffff (prio 0, ram): ram 0000000080100000-00000000bfffffff (prio 0, i/o): max_ram -M ast2500-evb -m 3G 0000000080000000-000000017ffffffe (prio 0, i/o): aspeed-ram-container 0000000080000000-000000013fffffff (prio 0, ram): ram [DETECTED OVERFLOW!] 0000000140000000-00000000bfffffff (prio 0, i/o):= max_ram ) On top of that sdmc falls back and reports to guest "default" size, it thinks machine should have. For CLI side machine should honor whatever user configured or error out to make user fix CLI. This patch makes ram-size check actually work and changes behavior from a warning later on during machine reset to error_fatal at the moment SOC is realized so user will have to fix RAM size on CLI to start machine. It also gets out of the way mutable ram-size logic, so we could consolidate RAM allocation logic around pre-allocated hostmem backend (supplied by user or auto created by generic machine code depending on supplied -m/mem-path/mem-prealloc options. Signed-off-by: Igor Mammedov --- hw/arm/aspeed.c | 9 +-------- hw/misc/aspeed_sdmc.c | 5 +++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index cc06af4..525c547 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -213,14 +213,7 @@ static void aspeed_machine_init(MachineState *machine) "hw-prot-key", &error_abort); } object_property_set_bool(OBJECT(&bmc->soc), true, "realized", - &error_abort); - - /* - * Allocate RAM after the memory controller has checked the size - * was valid. If not, a default value is used. - */ - ram_size =3D object_property_get_uint(OBJECT(&bmc->soc), "ram-size", - &error_abort); + &error_fatal); =20 memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size); memory_region_add_subregion(&bmc->ram_container, 0, &bmc->ram); diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 3fc80f0..b398e36 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -165,6 +165,11 @@ static void aspeed_sdmc_realize(DeviceState *dev, Erro= r **errp) AspeedSDMCState *s =3D ASPEED_SDMC(dev); AspeedSDMCClass *asc =3D ASPEED_SDMC_GET_CLASS(s); =20 + if (!g_hash_table_contains(asc->ram2feat, + GINT_TO_POINTER(s->ram_size >> 20))) { + error_setg(errp, "Invalid RAM size 0x%" PRIx64, s->ram_size); + return; + } s->max_ram_size =3D asc->max_ram_size; =20 memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_sdmc_ops, s, --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577797849; cv=none; d=zohomail.com; s=zohoarc; b=IhWM/GqUY3psuvOvx7OuM1jrQqcqyKspP1gARkeGpe5oZjWKYNgBLFAEpd/7BPBJMwBpN37P7o5JV5UpaBDb4K0Pkm+Ak0c7ISWYG+E3xwK8PNDxesGQ6Soon4atYflRfrB3Y+9UpKXo81AFjlE9Mp7o7z8s9NI05HtvNRqn3mk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577797849; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=pZCfJe+G58JPj5ymxdgpn70J6sn4tllCO7EP5Gvx81s=; b=E/fXVvX7843BuCt/BU8a1fAZ2TPfEJMAPghcUfYLaM/rAmb6j4F/YW+3r2HhN/1Jixub9WTmFdebOLrnDwGugNcS/7dwu91aAn6MFGDXTgOE2k1xrzcC+9lsLsA2+ToLOh/kBpIgwVj52JoIofDY39L2Fpu+TlITQ0uw7aXAo4o= 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 1577797849950450.65671398019333; Tue, 31 Dec 2019 05:10:49 -0800 (PST) Received: from localhost ([::1]:42266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHIO-0005KL-4M for importer@patchew.org; Tue, 31 Dec 2019 08:10:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54888) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBr-0005Ao-Dh for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBq-0002SS-B4 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:03 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46393 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBq-0002P3-35 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-2MZ2jbVRO72pPqWQ-9qQiQ-1; Tue, 31 Dec 2019 08:04:00 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2223218031D0 for ; Tue, 31 Dec 2019 13:03:59 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DE77620A6 for ; Tue, 31 Dec 2019 13:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pZCfJe+G58JPj5ymxdgpn70J6sn4tllCO7EP5Gvx81s=; b=OiQO0K6wB1+1hFOfMqdCp5THYnOE1AskesSrUNdQw62gO31tmGkcd6KbYJR7BuE5q/HiMc 2mcjZmz3o3N6p6iGFHBY6OHkHldRdlTtAq1zYT1kDnxHOlctaQIvVAy9zY8Qy1xwmEBOFc 7Brv8vBYAOla1aT5cfeXLTrPd6U9cls= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 11/86] hw:aspeed: drop warning and bogus ram_size fixup Date: Tue, 31 Dec 2019 14:02:55 +0100 Message-Id: <1577797450-88458-12-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 2MZ2jbVRO72pPqWQ-9qQiQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It was useless to try fixup ram_size and print warning on guest access to config register to begin with. Now previous patch made sure that SDMC can not be realized with invalid RAM size, so there is no case where warning and not used ram_size fixup could be triggered. So remove now dead code. Signed-off-by: Igor Mammedov --- hw/misc/aspeed_sdmc.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index b398e36..942b27a 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -219,17 +219,8 @@ static int aspeed_get_ram_feat(AspeedSDMCState *s) { AspeedSDMCClass *asc =3D ASPEED_SDMC_GET_CLASS(s); int ram_mb =3D s->ram_size >> 20; - gpointer val; + gpointer val =3D g_hash_table_lookup(asc->ram2feat, GINT_TO_POINTER(ra= m_mb)); =20 - if (g_hash_table_contains(asc->ram2feat, GINT_TO_POINTER(ram_mb))) { - val =3D g_hash_table_lookup(asc->ram2feat, GINT_TO_POINTER(ram_mb)= ); - return GPOINTER_TO_INT(val); - } - - warn_report("Invalid RAM size 0x%" PRIx64 ". Using default %dM", - s->ram_size, asc->fallback_ram_size); - s->ram_size =3D asc->fallback_ram_size << 20; - val =3D g_hash_table_lookup(asc->ram2feat, &asc->fallback_ram_size); return GPOINTER_TO_INT(val); } =20 --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798030; cv=none; d=zohomail.com; s=zohoarc; b=ZCWNDCOH17hcsnCnJW0bb6yMZbXRhWiLQlXVRkn4VP7qgKS6qBxMvFF9KSTMZNA0rdDBvIrvZUTLvZA2sn46B8MKXzR9HEMQkNUp/U5lijFcNzy+qdduYnpl7z8xoBDkyqnOd7U31m69Q+E4lVHoqg8SCvqrcUWBFrnHJ8FeShM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798030; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=TuhqGloe2JFox7+RnDN/Ndkz744NAvXh5x2+C2XCQcE=; b=XSH5dDBq1DG/uUMNmWDOogK71Q3a5atPrzj6wrQTulpgYy0kU8MaSj2D+BDhhz5rYZex2dwkAMfEfFS2uGHzzJAeszY6raYe7XIMv7dzNEIl2tlvos4LIam0A7PFcfAAppRYJ0jPL9rB+GKnBot/KKojMRAafD8c8j9XtNCuaw0= 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 1577798030337368.4990293762903; Tue, 31 Dec 2019 05:13:50 -0800 (PST) Received: from localhost ([::1]:42308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHLI-00019H-Tw for importer@patchew.org; Tue, 31 Dec 2019 08:13:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54973) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBs-0005CS-Bt for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBr-0002Vx-1c for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:04 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:51813 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBq-0002Tc-TD for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-OTAxBLfPPMStBvWuwNrbog-1; Tue, 31 Dec 2019 08:04:00 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4887800EB8 for ; Tue, 31 Dec 2019 13:03:59 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BA6178E96 for ; Tue, 31 Dec 2019 13:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TuhqGloe2JFox7+RnDN/Ndkz744NAvXh5x2+C2XCQcE=; b=K0X4UCswJODAvyYqEuTfiAtKKJ7ceUjU3aJjoUUx6EN+lquk8puYD8sN3aOLeOK+ksUVmq K6Lh9sTqchL8pGh0UACemjImiR0b/fanAOgOfb/ueiOdoebeehGD8BQW/CeQwzsSF9a/Kw UimUgwW5ioNUxa8htapSxbepJWvOk2A= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 12/86] arm:aspeed: use memdev for RAM Date: Tue, 31 Dec 2019 14:02:56 +0100 Message-Id: <1577797450-88458-13-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: OTAxBLfPPMStBvWuwNrbog-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/aspeed.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 525c547..330254b 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -35,7 +35,6 @@ static struct arm_boot_info aspeed_board_binfo =3D { struct AspeedBoardState { AspeedSoCState soc; MemoryRegion ram_container; - MemoryRegion ram; MemoryRegion max_ram; }; =20 @@ -184,6 +183,7 @@ static void aspeed_machine_init(MachineState *machine) =20 memory_region_init(&bmc->ram_container, NULL, "aspeed-ram-container", UINT32_MAX); + memory_region_add_subregion(&bmc->ram_container, 0, machine->ram); =20 object_initialize_child(OBJECT(machine), "soc", &bmc->soc, (sizeof(bmc->soc)), amc->soc_name, &error_abor= t, @@ -215,8 +215,6 @@ static void aspeed_machine_init(MachineState *machine) object_property_set_bool(OBJECT(&bmc->soc), true, "realized", &error_fatal); =20 - memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size); - memory_region_add_subregion(&bmc->ram_container, 0, &bmc->ram); memory_region_add_subregion(get_system_memory(), sc->memmap[ASPEED_SDRAM], &bmc->ram_container); @@ -393,6 +391,7 @@ static void aspeed_machine_class_init(ObjectClass *oc, = void *data) mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->no_parallel =3D 1; + mc->default_ram_id =3D "ram"; } =20 static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798903; cv=none; d=zohomail.com; s=zohoarc; b=CE2JfN4XILZfnQ2mK0CmuDzUl/YkFXVzNJ4KcLvjtE9iiAPyaGbQqgYkZGALVCMxQuswl11FU+Afw0veqW1E2Ae2z0f/ennz+C8tk0qbZCQbG8HVQCI16NNSyai0rue8fWKt++3r7UvUGP3zHCPfDcj4VViYPhBxQUuLGFxfFiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798903; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=26+KW75Tite2RSmCVDD1qthDMDM37VCYU0I3PJV8Dvs=; b=VahVV277lIgYUiZN8/sedfeXqYBj5rI3+8Dc/x/SCOmA61qZs05uM0x/GuylGVgSG7if47/TCraCfDeCbjoCaJZ3ZOF2v41T1WYKC0EzSdFH4lEE8sK0I/rGRTJeL6LCQTq4hsW/Wm/BS0d25Y9B/pGJsJwphTCiWzEzrYHWf8U= 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 1577798903000382.7649348672527; Tue, 31 Dec 2019 05:28:23 -0800 (PST) Received: from localhost ([::1]:42486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHZN-0001zp-8k for importer@patchew.org; Tue, 31 Dec 2019 08:28:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55853) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC7-0005Wf-L1 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC6-0003Nb-CR for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:19 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39802 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC6-0003LS-7a for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-117-rMCV9W8nOAqXaXvVJ2BK6g-1; Tue, 31 Dec 2019 08:04:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B30C9801E66 for ; Tue, 31 Dec 2019 13:04:00 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3948E620A6 for ; Tue, 31 Dec 2019 13:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=26+KW75Tite2RSmCVDD1qthDMDM37VCYU0I3PJV8Dvs=; b=Z7Hi3Qeq+c7YWqMLSTw4TUx1DSlU9ybO9zcZh1oOnGyarM7PG0PdjNyBMYudREfT2OIh+J 0Qd/hDx/eAAGlA1B6HQv04d+WpXk/z07ek8DLeeUC7KXwRnDgRbC9dOMqzzzLZk6hXe8qW jpjQqElhG3qt5ZTn0EDtVgJn0agyPLY= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 13/86] arm:collie: use memdev for RAM Date: Tue, 31 Dec 2019 14:02:57 +0100 Message-Id: <1577797450-88458-14-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: rMCV9W8nOAqXaXvVJ2BK6g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/collie.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/arm/collie.c b/hw/arm/collie.c index 970a440..a67bb1f 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -20,20 +20,23 @@ =20 static struct arm_boot_info collie_binfo =3D { .loader_start =3D SA_SDCS0, - .ram_size =3D 0x20000000, }; =20 static void collie_init(MachineState *machine) { StrongARMState *s; DriveInfo *dinfo; - MemoryRegion *sdram =3D g_new(MemoryRegion, 1); + MachineClass *mc =3D MACHINE_GET_CLASS(machine); + + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } =20 s =3D sa1110_init(machine->cpu_type); =20 - memory_region_allocate_system_memory(sdram, NULL, "strongarm.sdram", - collie_binfo.ram_size); - memory_region_add_subregion(get_system_memory(), SA_SDCS0, sdram); + memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ra= m); =20 dinfo =3D drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000, @@ -57,6 +60,8 @@ static void collie_machine_init(MachineClass *mc) mc->init =3D collie_init; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("sa1110"); + mc->default_ram_size =3D 0x20000000; + mc->default_ram_id =3D "strongarm.sdram"; } =20 DEFINE_MACHINE("collie", collie_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798417; cv=none; d=zohomail.com; s=zohoarc; b=Fp/7xLtsLW6c2tYDUClRrQAkF8cAhbhJMhJCL2DGmjose3A7JxYY9gDw52ylM8Gp3Kz3EyKCYyzCfqLIkfJuiixdOCZ3Lju5RCrH0jMCYGCBnZJLEkMJ+uSxgnD7O37W6UbRwmJjJCF4kcMiisk6SKl3Ur25vC96klCb97AQiXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798417; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=NQJQNB7IKBT5eWKM383E/sposSAYFdJfovr78aWm4kM=; b=P3b9JY7ekas312YnrvZkvzbkIHDDc8mJyLoqVSS8BrU2Ke4nLTGJlshgIaQNVNB/b5EzM1nUSqjD0X5oeepi1IgWniNwxIdO3D/8+S/Ja48vHMpICzZUBFzbScxBXY/BTD+9ZLche6HMwCOmbdGGYW1AgwAOrSRrvve2ZTMgUJI= 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 1577798417817626.388743290917; Tue, 31 Dec 2019 05:20:17 -0800 (PST) Received: from localhost ([::1]:42372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHRX-00088E-SG for importer@patchew.org; Tue, 31 Dec 2019 08:20:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55463) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC2-0005O0-Qn for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC1-0002zJ-7W for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57424 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC1-0002wR-2s for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-83-jmnqITxlPJmoyq4t4WKpUA-1; Tue, 31 Dec 2019 08:04:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8086F1005502 for ; Tue, 31 Dec 2019 13:04:01 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 070FD620A6 for ; Tue, 31 Dec 2019 13:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NQJQNB7IKBT5eWKM383E/sposSAYFdJfovr78aWm4kM=; b=Gf+uV0Ezne0HE89ks+kylZSPKYytuw2gxv++LfC70nkySLDzewx4ZMnYsR/2/ZnZPCgn4i WrHiRX9Yd2rqZUKE7sJygSQS98svGhhQqCzQsbCYk1mMMtf2t9a94XYppeXWN5DwjPXAqX mj/jrGc8lqy1uy6f4SruN0v0lpILPug= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 14/86] arm:cubieboard: use memdev for RAM Date: Tue, 31 Dec 2019 14:02:58 +0100 Message-Id: <1577797450-88458-15-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: jmnqITxlPJmoyq4t4WKpUA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: While at it, get rid of no longer needed CubieBoardState wrapper. Signed-off-by: Igor Mammedov --- hw/arm/cubieboard.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index 6dc2f1d..089f9a3 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -28,52 +28,42 @@ static struct arm_boot_info cubieboard_binfo =3D { .board_id =3D 0x1008, }; =20 -typedef struct CubieBoardState { - AwA10State *a10; - MemoryRegion sdram; -} CubieBoardState; - static void cubieboard_init(MachineState *machine) { - CubieBoardState *s =3D g_new(CubieBoardState, 1); + AwA10State *a10 =3D AW_A10(object_new(TYPE_AW_A10)); Error *err =3D NULL; =20 - s->a10 =3D AW_A10(object_new(TYPE_AW_A10)); - - object_property_set_int(OBJECT(&s->a10->emac), 1, "phy-addr", &err); + object_property_set_int(OBJECT(&a10->emac), 1, "phy-addr", &err); if (err !=3D NULL) { error_reportf_err(err, "Couldn't set phy address: "); exit(1); } =20 - object_property_set_int(OBJECT(&s->a10->timer), 32768, "clk0-freq", &e= rr); + object_property_set_int(OBJECT(&a10->timer), 32768, "clk0-freq", &err); if (err !=3D NULL) { error_reportf_err(err, "Couldn't set clk0 frequency: "); exit(1); } =20 - object_property_set_int(OBJECT(&s->a10->timer), 24000000, "clk1-freq", - &err); + object_property_set_int(OBJECT(&a10->timer), 24000000, "clk1-freq", &e= rr); if (err !=3D NULL) { error_reportf_err(err, "Couldn't set clk1 frequency: "); exit(1); } =20 - object_property_set_bool(OBJECT(s->a10), true, "realized", &err); + object_property_set_bool(OBJECT(a10), true, "realized", &err); if (err !=3D NULL) { error_reportf_err(err, "Couldn't realize Allwinner A10: "); exit(1); } =20 - memory_region_allocate_system_memory(&s->sdram, NULL, "cubieboard.ram", - machine->ram_size); memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE, - &s->sdram); + machine->ram); =20 /* TODO create and connect IDE devices for ide_drive_get() */ =20 cubieboard_binfo.ram_size =3D machine->ram_size; - arm_load_kernel(&s->a10->cpu, machine, &cubieboard_binfo); + arm_load_kernel(&a10->cpu, machine, &cubieboard_binfo); } =20 static void cubieboard_machine_init(MachineClass *mc) @@ -84,6 +74,7 @@ static void cubieboard_machine_init(MachineClass *mc) mc->block_default_type =3D IF_IDE; mc->units_per_default_bus =3D 1; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_id =3D "cubieboard.ram"; } =20 DEFINE_MACHINE("cubieboard", cubieboard_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798176; cv=none; d=zohomail.com; s=zohoarc; b=ZLrfNYaZnygJNIr3Wf3K/nSdkLYAjRnd3ml87oY8lpdM7GxfQ93DbA9QKOJJrAbUJg8pHTC9YVZu/DSt6vzrg5GGvddMtzYna6fgSxgAMacUbyLR/1pwCzYaCMCjVKBa+zvzOA/zx+M/uyOLFxT+UsdkjuPQzkfU6xEsbaKsPFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798176; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=nJwVSDzMFDGag/uCE0jxRsayf/4QIe4mdAv846SG7ds=; b=YacG/lhdefSZDYJ+FesEvbzWQymPsD386WOGhvpcCTuXmg66l8gWyI5zxCrfx7MDWRHFIGHVKrrj28mGIVgDpJu278+BwDG5RHdYSlJjEwhdFF3z9JdDiXGXioZXzFr1UjArtFcxuF+Vh+as+5Rio7YY+Lt/hhDesnm1ZFm2gH4= 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 1577798176205677.6409414063666; Tue, 31 Dec 2019 05:16:16 -0800 (PST) Received: from localhost ([::1]:42334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHNe-00041A-TQ for importer@patchew.org; Tue, 31 Dec 2019 08:16:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55139) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBu-0005GN-Nq for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBt-0002gU-9l for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:06 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53450 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBt-0002eG-3s for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:05 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-328-WZtTUDvEO3uPfymoQN9Jdw-1; Tue, 31 Dec 2019 08:04:03 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F30A10054E3 for ; Tue, 31 Dec 2019 13:04:02 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8AF1620A6 for ; Tue, 31 Dec 2019 13:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nJwVSDzMFDGag/uCE0jxRsayf/4QIe4mdAv846SG7ds=; b=iMdJqU1tSqutb1wykYyN60yTtTC7a/1UP24bheNbrJzwlCrRz0cJAu2kFjWPl2Y2qM6BeJ GD1pdi6B/EUY8sGnj1jsCTpmoPZs+4LJKT52NN1qoxc3/crzWZMPn7zvuh2M8VTgqqDOH+ I8WRnb60g3SJYby5I3+Tf7InhBO/nFI= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 15/86] arm:digic_boards: use memdev for RAM Date: Tue, 31 Dec 2019 14:02:59 +0100 Message-Id: <1577797450-88458-16-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: WZtTUDvEO3uPfymoQN9Jdw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: remove no longer needed DigicBoardState PS2: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/digic_boards.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c index ef3fc2b..c3bc5cb 100644 --- a/hw/arm/digic_boards.c +++ b/hw/arm/digic_boards.c @@ -35,39 +35,38 @@ #include "hw/loader.h" #include "sysemu/sysemu.h" #include "sysemu/qtest.h" +#include "qemu/units.h" =20 #define DIGIC4_ROM0_BASE 0xf0000000 #define DIGIC4_ROM1_BASE 0xf8000000 #define DIGIC4_ROM_MAX_SIZE 0x08000000 =20 -typedef struct DigicBoardState { - DigicState *digic; - MemoryRegion ram; -} DigicBoardState; - typedef struct DigicBoard { - hwaddr ram_size; - void (*add_rom0)(DigicBoardState *, hwaddr, const char *); + void (*add_rom0)(DigicState *, hwaddr, const char *); const char *rom0_def_filename; - void (*add_rom1)(DigicBoardState *, hwaddr, const char *); + void (*add_rom1)(DigicState *, hwaddr, const char *); const char *rom1_def_filename; } DigicBoard; =20 -static void digic4_board_init(DigicBoard *board) +static void digic4_board_init(MachineState *machine, DigicBoard *board) { Error *err =3D NULL; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); =20 - DigicBoardState *s =3D g_new(DigicBoardState, 1); + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } =20 - s->digic =3D DIGIC(object_new(TYPE_DIGIC)); - object_property_set_bool(OBJECT(s->digic), true, "realized", &err); + DigicState *s =3D DIGIC(object_new(TYPE_DIGIC)); + object_property_set_bool(OBJECT(s), true, "realized", &err); if (err !=3D NULL) { error_reportf_err(err, "Couldn't realize DIGIC SoC: "); exit(1); } =20 - memory_region_allocate_system_memory(&s->ram, NULL, "ram", board->ram_= size); - memory_region_add_subregion(get_system_memory(), 0, &s->ram); + memory_region_add_subregion(get_system_memory(), 0, machine->ram); =20 if (board->add_rom0) { board->add_rom0(s, DIGIC4_ROM0_BASE, board->rom0_def_filename); @@ -78,7 +77,7 @@ static void digic4_board_init(DigicBoard *board) } } =20 -static void digic_load_rom(DigicBoardState *s, hwaddr addr, +static void digic_load_rom(DigicState *s, hwaddr addr, hwaddr max_size, const char *def_filename) { target_long rom_size; @@ -118,7 +117,7 @@ static void digic_load_rom(DigicBoardState *s, hwaddr a= ddr, * Samsung K8P3215UQB * 64M Bit (4Mx16) Page Mode / Multi-Bank NOR Flash Memory */ -static void digic4_add_k8p3215uqb_rom(DigicBoardState *s, hwaddr addr, +static void digic4_add_k8p3215uqb_rom(DigicState *s, hwaddr addr, const char *def_filename) { #define FLASH_K8P3215UQB_SIZE (4 * 1024 * 1024) @@ -135,14 +134,13 @@ static void digic4_add_k8p3215uqb_rom(DigicBoardState= *s, hwaddr addr, } =20 static DigicBoard digic4_board_canon_a1100 =3D { - .ram_size =3D 64 * 1024 * 1024, .add_rom1 =3D digic4_add_k8p3215uqb_rom, .rom1_def_filename =3D "canon-a1100-rom1.bin", }; =20 static void canon_a1100_init(MachineState *machine) { - digic4_board_init(&digic4_board_canon_a1100); + digic4_board_init(machine, &digic4_board_canon_a1100); } =20 static void canon_a1100_machine_init(MachineClass *mc) @@ -150,6 +148,8 @@ static void canon_a1100_machine_init(MachineClass *mc) mc->desc =3D "Canon PowerShot A1100 IS"; mc->init =3D &canon_a1100_init; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_size =3D 64 * MiB; + mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("canon-a1100", canon_a1100_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798394; cv=none; d=zohomail.com; s=zohoarc; b=hF3Z7bfuBX/XvnkwdDgKuLXIz9s62ysa17HAIgwCYxvxrrfvrmOcS83LE1hLEiJeZ5gEoPoSaSY1+vh4i9SUyK+w1PUsUyGFW09D9HdiAhDGZiv19kzXmEo43gBHncoUqdRGurt+Koi6NAEnjGs2/9BVq55Xuheus6xWXwVb6bI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798394; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=MVEXNd4S6ttq+EKbUodUue5MkTAw/xeqZaBHAzbSjIE=; b=cmJxlolhv1jkXiL/X6dsWimFxnbQLz1aHqVrBDq7lWGRVCY4vPx8Qx+Nw6AGNbQT4JpvoHjeZkTjfPoGwfpIekwg5a1+Sm/GIaqyMqs48syZYneG3f7scBp4Z7wpmHLsc3rSJDwOupzvmUOzKJrVH6HsarRhdNqWPB1up6f6yqY= 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 1577798394057779.306957213806; Tue, 31 Dec 2019 05:19:54 -0800 (PST) Received: from localhost ([::1]:42370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHRA-0007hW-FO for importer@patchew.org; Tue, 31 Dec 2019 08:19:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55208) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHBv-0005Hf-G6 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBu-0002lU-Af for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:07 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:58811 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBu-0002iz-5z for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:06 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-344-ACyh4GmjP_iSzu8VIAxmLA-1; Tue, 31 Dec 2019 08:04:04 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D97C107ACC7 for ; Tue, 31 Dec 2019 13:04:03 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 981CC620A6 for ; Tue, 31 Dec 2019 13:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MVEXNd4S6ttq+EKbUodUue5MkTAw/xeqZaBHAzbSjIE=; b=RS8+PtRgBnAuqmqIKQEbqGkEJEJ3UTmZVT//nv19+DbbdC/SwETuHxy3VddGvDZK/xORlr n66skMrloGkAzsbVquBQlaHxzhxJvu5VR+JBwWCCvIOhtvrYdAyrMbMU0KG6CO0aYafN6p rTSsVQXp/MPfXr8R44hOsaiy061fRz4= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 16/86] arm:highbank: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:00 +0100 Message-Id: <1577797450-88458-17-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: ACyh4GmjP_iSzu8VIAxmLA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/highbank.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index 518d935..ac9de94 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -236,7 +236,6 @@ enum cxmachines { */ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) { - ram_addr_t ram_size =3D machine->ram_size; DeviceState *dev =3D NULL; SysBusDevice *busdev; qemu_irq pic[128]; @@ -247,7 +246,6 @@ static void calxeda_init(MachineState *machine, enum cx= machines machine_id) qemu_irq cpu_virq[4]; qemu_irq cpu_vfiq[4]; MemoryRegion *sysram; - MemoryRegion *dram; MemoryRegion *sysmem; char *sysboot_filename; =20 @@ -290,10 +288,8 @@ static void calxeda_init(MachineState *machine, enum c= xmachines machine_id) } =20 sysmem =3D get_system_memory(); - dram =3D g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(dram, NULL, "highbank.dram", ram_= size); /* SDRAM at address zero. */ - memory_region_add_subregion(sysmem, 0, dram); + memory_region_add_subregion(sysmem, 0, machine->ram); =20 sysram =3D g_new(MemoryRegion, 1); memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000, @@ -387,7 +383,7 @@ static void calxeda_init(MachineState *machine, enum cx= machines machine_id) =20 /* TODO create and connect IDE devices for ide_drive_get() */ =20 - highbank_binfo.ram_size =3D ram_size; + highbank_binfo.ram_size =3D machine->ram_size; /* highbank requires a dtb in order to boot, and the dtb will override * the board ID. The following value is ignored, so set it to -1 to be * clear that the value is meaningless. @@ -430,6 +426,7 @@ static void highbank_class_init(ObjectClass *oc, void *= data) mc->units_per_default_bus =3D 1; mc->max_cpus =3D 4; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_id =3D "highbank.dram"; } =20 static const TypeInfo highbank_type =3D { @@ -448,6 +445,7 @@ static void midway_class_init(ObjectClass *oc, void *da= ta) mc->units_per_default_bus =3D 1; mc->max_cpus =3D 4; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_id =3D "highbank.dram"; } =20 static const TypeInfo midway_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577801481; cv=none; d=zohomail.com; s=zohoarc; b=oJBIDWaftSB8ZeV0aBZidnVSpm3skGg390ATxjqfRTUjx4XXXHH1cz7C4s44kxjTONNJVnZTqdBQuOb2h1zHzOi8illuva/UvGhhXjY2y5FG0zlLco7SrMn5NSgWeg4zqr2KOSuc4RfbJ4H8GHKE+SlP2AhNYy8W4ZQDvTpLaSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577801481; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=PK4Hrep86/i5wWbS3IonWFA589uNq1IRonSG0SBGCV8=; b=b5nRItf8bC7vsUyaSi/8Ck4stORXPw4GvXe8n6Yb0YX/AvMHGzVWZGDer3E+HzS/uEBfQDQJ6vVV4JRk+X24c3g/b1/RDotJCVtFxppJO2DXXk+M8fVecnyAVgaYjrNKRgqBkdm0GS4FNxUib3y6RuBC2g3Q/MkeBxbQ7oFhsSc= 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 1577801481636225.1830650149558; Tue, 31 Dec 2019 06:11:21 -0800 (PST) Received: from localhost ([::1]:43126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imIEy-0006oB-Dl for importer@patchew.org; Tue, 31 Dec 2019 09:11:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58927) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHDD-0006po-N9 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHDC-0007Bg-IY for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:27 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:36483 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHDC-00079f-Cy for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:26 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-287-pU9_mKeWPCCZdSuT9ZIBKQ-1; Tue, 31 Dec 2019 08:04:04 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E178F18031CD for ; Tue, 31 Dec 2019 13:04:03 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6785E620A6 for ; Tue, 31 Dec 2019 13:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PK4Hrep86/i5wWbS3IonWFA589uNq1IRonSG0SBGCV8=; b=BhZZeGsiif3YsteRK1kXbJkJYKSPnS5PzMDuFMYz0lORH7vRJ/dqyYkOPKv71jqchjcOEg HuatjR5t+NFpSuQONqIlCnRJ/Et6xr75DKVJX9QDx20QlgudYnKLFMBVXSQjk7+1aP2PFK w2/HNA5lYeZzKTMK0m58we5ke25wJ5Y= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 17/86] arm:imx25_pdk: drop RAM size fixup Date: Tue, 31 Dec 2019 14:03:01 +0100 Message-Id: <1577797450-88458-18-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: pU9_mKeWPCCZdSuT9ZIBKQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will complain and continue running with max RAM size supported. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix things up for user. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. Signed-off-by: Igor Mammedov --- hw/arm/imx25_pdk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c index c76fc2b..a2b7b35 100644 --- a/hw/arm/imx25_pdk.c +++ b/hw/arm/imx25_pdk.c @@ -78,10 +78,10 @@ static void imx25_pdk_init(MachineState *machine) =20 /* We need to initialize our memory */ if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE= )) { - warn_report("RAM size " RAM_ADDR_FMT " above max supported, " + error_report("RAM size " RAM_ADDR_FMT " above max supported, " "reduced to %x", machine->ram_size, FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE); - machine->ram_size =3D FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZ= E; + exit(EXIT_FAILURE); } =20 memory_region_allocate_system_memory(&s->ram, NULL, "imx25.ram", --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798232; cv=none; d=zohomail.com; s=zohoarc; b=XWj9ftrmsq1hNVkwIPRzG5uevR+X/BjO+RQC+socws6ukTcpBdLmyjKP3vJPS39NNr3kxfX3FoToEu0bSZWpkxGPLNaPx9kdka2AF0t+CSbLCJ06+SBHNVXLVJBstHXZXb0bwlVcn1PIduF34SrGOg7mQ+Bg3Tpl2rQmqX9i8bY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798232; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=AgsgEz3bPReN2HNetzEt+ok3xDpMnyxvVHdEtWZO7U8=; b=Pa5oA0xqK0x8ker9EEC5g9CP3noDx5+x5kTVjrlUGIYBKC1skxJDyLmS6te8/4o1JS/lRu97sfSNmPd8iqQSfgU+kAscZc1deL35Mat3Kk7piTHEuT8DkMjFtuj/JE5ZSHeoQKEKs+G+WwhZY8lDbULVhoGWEVd/c2wUWibPyTs= 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 1577798232824374.6592755889751; Tue, 31 Dec 2019 05:17:12 -0800 (PST) Received: from localhost ([::1]:42350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHOZ-0004nH-2v for importer@patchew.org; Tue, 31 Dec 2019 08:17:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55322) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC0-0005L0-Uu for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHBv-0002sH-Tz for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:12 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20428 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHBv-0002q8-PV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-bQGZrOECObOVDm8nuvOWwA-1; Tue, 31 Dec 2019 08:04:05 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B143F800D48 for ; Tue, 31 Dec 2019 13:04:04 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37638620A6 for ; Tue, 31 Dec 2019 13:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AgsgEz3bPReN2HNetzEt+ok3xDpMnyxvVHdEtWZO7U8=; b=O0VDVrFqP0Wk1wlwFD67hdR5nLoBSSyr2KvKU5JA3/Nh43spH1hLYwWgiLC9qslCVb1i5D teoDvjIezc5GWKVD1VmROitI2gPq2VfE5yZ54P05NQiya3RAgYgtZ6Fjco6lSKLqDkoFfu 1SeoC8H41T9dQwnF4azVKHJ4FpyufCc= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 18/86] arm:imx25_pdk: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:02 +0100 Message-Id: <1577797450-88458-19-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: bQGZrOECObOVDm8nuvOWwA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/imx25_pdk.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c index a2b7b35..9087fcb 100644 --- a/hw/arm/imx25_pdk.c +++ b/hw/arm/imx25_pdk.c @@ -58,7 +58,6 @@ =20 typedef struct IMX25PDK { FslIMX25State soc; - MemoryRegion ram; MemoryRegion ram_alias; } IMX25PDK; =20 @@ -84,10 +83,8 @@ static void imx25_pdk_init(MachineState *machine) exit(EXIT_FAILURE); } =20 - memory_region_allocate_system_memory(&s->ram, NULL, "imx25.ram", - machine->ram_size); memory_region_add_subregion(get_system_memory(), FSL_IMX25_SDRAM0_ADDR, - &s->ram); + machine->ram); =20 /* initialize the alias memory if any */ for (i =3D 0, ram_size =3D machine->ram_size, alias_offset =3D 0; @@ -107,7 +104,8 @@ static void imx25_pdk_init(MachineState *machine) =20 if (size < ram[i].size) { memory_region_init_alias(&s->ram_alias, NULL, "ram.alias", - &s->ram, alias_offset, ram[i].size - = size); + machine->ram, + alias_offset, ram[i].size - size); memory_region_add_subregion(get_system_memory(), ram[i].addr + size, &s->ram_alias); } @@ -135,6 +133,7 @@ static void imx25_pdk_machine_init(MachineClass *mc) mc->desc =3D "ARM i.MX25 PDK board (ARM926)"; mc->init =3D imx25_pdk_init; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_id =3D "imx25.ram"; } =20 DEFINE_MACHINE("imx25-pdk", imx25_pdk_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798019; cv=none; d=zohomail.com; s=zohoarc; b=DsALP/NjSg6hh3aADGKlagMWl9CaiVfo7lM+XNoMFKl17ePM9Jv1RrUeC7EX2vO1VwASx1uVkCkkGvD7ImbjCb7stO6VeYPSQK0odo7CwGbujPUvV7jlsItRltCGn3tQO+FGi+nHYwZZEPAlsMhe6corfH+Rj1nZ4uPx44gBpUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798019; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=HyTKwA4Wkb/h7kAywWXHEfgKyqdOimKTlNFdR26iw7c=; b=Ipp4cW2Mr7Rq5CY5H3GajazFW2IcKXO3oobc3HyR5oh3rbr/iTVW7O619ESxrWvQmqWBADvAGndww16b7A17Gx4yDz4pKTAJgPa/nCj9Gf2KHlGQnIMChmZDuaixwyn0YdOLfHFaGsQ3k5eN2UBPVVgC6sHzwny0LQkpJz7M8Js= 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 1577798019856237.01390135427243; Tue, 31 Dec 2019 05:13:39 -0800 (PST) Received: from localhost ([::1]:42306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHL8-0000vX-7q for importer@patchew.org; Tue, 31 Dec 2019 08:13:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55450) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC2-0005NZ-IH for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC1-0002ya-5v for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:45691 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC0-0002wj-U6 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-6X_K3DZSPHKA7EFa24Sf-Q-1; Tue, 31 Dec 2019 08:04:06 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81AEC10054E3 for ; Tue, 31 Dec 2019 13:04:05 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05B2A620A6 for ; Tue, 31 Dec 2019 13:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HyTKwA4Wkb/h7kAywWXHEfgKyqdOimKTlNFdR26iw7c=; b=c/xxiQ4UNPGjizN0wfuIlkYIlhiqQYx74o/qoyiKriydrWqoqhY3UG6SaCejaT7UIYXD5A KuZOtE6o6GLVpnu3bQZm2AyXV8KWV02OaaBrhsT8eAiRpGJCM7cvb/IBJBTeM/qOs4XJHE cwOok5sWaDsh1zGYR59+xfVh1cdA8lk= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 19/86] arm:integratorcp: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:03 +0100 Message-Id: <1577797450-88458-20-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 6X_K3DZSPHKA7EFa24Sf-Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/integratorcp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 5249708..89c223b 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -585,7 +585,6 @@ static void integratorcp_init(MachineState *machine) Object *cpuobj; ARMCPU *cpu; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *ram_alias =3D g_new(MemoryRegion, 1); qemu_irq pic[32]; DeviceState *dev, *sic, *icp; @@ -605,14 +604,13 @@ static void integratorcp_init(MachineState *machine) =20 cpu =3D ARM_CPU(cpuobj); =20 - memory_region_allocate_system_memory(ram, NULL, "integrator.ram", - ram_size); /* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash= . */ /* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero*/ - memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); /* And again at address 0x80000000 */ - memory_region_init_alias(ram_alias, NULL, "ram.alias", ram, 0, ram_siz= e); + memory_region_init_alias(ram_alias, NULL, "ram.alias", machine->ram, + 0, ram_size); memory_region_add_subregion(address_space_mem, 0x80000000, ram_alias); =20 dev =3D qdev_create(NULL, TYPE_INTEGRATOR_CM); @@ -660,6 +658,7 @@ static void integratorcp_machine_init(MachineClass *mc) mc->init =3D integratorcp_init; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("arm926"); + mc->default_ram_id =3D "integrator.ram"; } =20 DEFINE_MACHINE("integratorcp", integratorcp_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798220; cv=none; d=zohomail.com; s=zohoarc; b=LpGIFp1708+9Se/6sf4IghzynG6FyUrsRHb4BGKxn7uEnGL8s2BwtGKjtnX5z0RnDTt2eQ1yv+Z3Tg5pAsidK3nEZ8PASp6GYTO/iDsXWnuXQP/OoaKQovyIFwyDnbaIwYJfNrilQT4UyM8l0sLk7OjoYBbhrkYCZIxbSX3/5m0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798220; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=7jcVwbEhgrgHbK4aM2dypXWYco2qHNNsu717m0k/0vU=; b=AFMhUvZGY92kW/sMKQ7Lr3M0ogpK3VojksugNOhovR40rNnpywomByNXVNSk24mLgRdpwYcZQHT/wvQxxZReYumo7eDS3Qo+etNtJZtKKL0XjhZQY1qEUkMVOf6uWL82/bO3NgRaQkMNGT1RcSkrxqMNA++s6XPStTkmnQgPh9A= 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 1577798220510613.4623607472329; Tue, 31 Dec 2019 05:17:00 -0800 (PST) Received: from localhost ([::1]:42348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHOM-0004X0-Ng for importer@patchew.org; Tue, 31 Dec 2019 08:16:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55449) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC2-0005NY-I4 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC1-0002zC-95 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49416 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC1-0002wE-0l for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-112-oTREZMhMOlOIAk58ONX1aA-1; Tue, 31 Dec 2019 08:04:07 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51693800EBF for ; Tue, 31 Dec 2019 13:04:06 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9177620A6 for ; Tue, 31 Dec 2019 13:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7jcVwbEhgrgHbK4aM2dypXWYco2qHNNsu717m0k/0vU=; b=CkUsMYeHXT77vTTNogHHwLDIeTMhrkMtAcei5WrGMilORcf3UiXt2FKua7a1nP2cNK6BMt BMku5635Pc50jdISK3WZG6MG/4L1Nol55EczdF/AnV+Ye5vSALDEYEbijHAisFHZx2lwTm rwjOh2gy9q3yUuLNX9vU2L5YYwGIMd4= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 20/86] arm:kzm: drop RAM size fixup Date: Tue, 31 Dec 2019 14:03:04 +0100 Message-Id: <1577797450-88458-21-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: oTREZMhMOlOIAk58ONX1aA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will complain and continue running with max RAM size supported. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix things up for user. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. Signed-off-by: Igor Mammedov --- hw/arm/kzm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c index 1d5ef28..27800c5 100644 --- a/hw/arm/kzm.c +++ b/hw/arm/kzm.c @@ -78,10 +78,10 @@ static void kzm_init(MachineState *machine) =20 /* Check the amount of memory is compatible with the SOC */ if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE= )) { - warn_report("RAM size " RAM_ADDR_FMT " above max supported, " + error_report("RAM size " RAM_ADDR_FMT " above max supported, " "reduced to %x", machine->ram_size, FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE); - machine->ram_size =3D FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZ= E; + exit(EXIT_FAILURE); } =20 memory_region_allocate_system_memory(&s->ram, NULL, "kzm.ram", --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798007; cv=none; d=zohomail.com; s=zohoarc; b=ITqyDaIgz4U4zCOmRcNhEF/1Fa0IEQ7IBODcCL0hZfwGpFyKG/TGOebZkHodpZmT7n6AHJWa2sTP2Tc2W+ikOVyXFhycnF6fOZlp0ezNDznJPJQRPHKyDoqOpUP8KdGTIpkChEOCl3U7yaVNuQQzm6h6ECPp5LNqmQiXmXKfdcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798007; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=EA/fwOAxYcC2WHTyH0qlJjpswYl4o4MaYKMyRzH3SgQ=; b=BO2uOf69aqVWw873zeCaL1QojnaA9mlBCTVCQMTtV+KhQBgitthH+44abBoFkM6Joij9TC20y8uR68y6ZU/Zgf7xmpHkDG8GT6EpPNyK7T/TCty6zpSyfIzIRH6cZPs3QmVTusNv0vjYq/+XXbt3l5NEq4rmxIFUkdVsKEpGZnI= 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 1577798007326127.93807217550045; Tue, 31 Dec 2019 05:13:27 -0800 (PST) Received: from localhost ([::1]:42304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHKv-0000hG-SO for importer@patchew.org; Tue, 31 Dec 2019 08:13:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55451) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC2-0005Nj-Jc for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC1-0002zQ-9v for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:45670 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC1-0002wh-0Y for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-Lo-KH5zePBKpQ2M2FRZRpQ-1; Tue, 31 Dec 2019 08:04:07 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D3F7800D41 for ; Tue, 31 Dec 2019 13:04:07 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98BD678E96 for ; Tue, 31 Dec 2019 13:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EA/fwOAxYcC2WHTyH0qlJjpswYl4o4MaYKMyRzH3SgQ=; b=DGCBRVe5CsflFiJaLNqYptLG1D5mZhYbzXcylRr1oURVxjvddQ4QyRMe+q32hhXd9Ce2f1 Ng0Onw6Mt5gntr6KJVECyWa8mvueKEfEkTN28tkTfTZBWPnEAqsygARdrE7RYjP0XLEU3M gCa0CLj/AmglSCrx02NqgrFZEmPg3XM= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 21/86] arm:kzm: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:05 +0100 Message-Id: <1577797450-88458-22-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Lo-KH5zePBKpQ2M2FRZRpQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/kzm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c index 27800c5..f63902e 100644 --- a/hw/arm/kzm.c +++ b/hw/arm/kzm.c @@ -51,7 +51,6 @@ =20 typedef struct IMX31KZM { FslIMX31State soc; - MemoryRegion ram; MemoryRegion ram_alias; } IMX31KZM; =20 @@ -84,10 +83,8 @@ static void kzm_init(MachineState *machine) exit(EXIT_FAILURE); } =20 - memory_region_allocate_system_memory(&s->ram, NULL, "kzm.ram", - machine->ram_size); memory_region_add_subregion(get_system_memory(), FSL_IMX31_SDRAM0_ADDR, - &s->ram); + machine->ram); =20 /* initialize the alias memory if any */ for (i =3D 0, ram_size =3D machine->ram_size, alias_offset =3D 0; @@ -107,7 +104,8 @@ static void kzm_init(MachineState *machine) =20 if (size < ram[i].size) { memory_region_init_alias(&s->ram_alias, NULL, "ram.alias", - &s->ram, alias_offset, ram[i].size - = size); + machine->ram, + alias_offset, ram[i].size - size); memory_region_add_subregion(get_system_memory(), ram[i].addr + size, &s->ram_alias); } @@ -139,6 +137,7 @@ static void kzm_machine_init(MachineClass *mc) mc->desc =3D "ARM KZM Emulation Baseboard (ARM1136)"; mc->init =3D kzm_init; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_id =3D "kzm.ram"; } =20 DEFINE_MACHINE("kzm", kzm_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798268; cv=none; d=zohomail.com; s=zohoarc; b=dj5xWkxy7ibid6zr+wIcBbJIhEXTXLN81YhzL9fCQiAMZrDxKHaCKqZrGMWX5hdCDjSLGofl+APYiEkWAaHLCmTARNgwTgOZnRkG9yd99c+K9oS9qCYROr3hCQDBBXs/3BrHXJAsmiXZLVftuND2A2UVdeMaxLD+juTxGtFSPKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798268; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=bX1iE3IP5V5Kv6foRv/GtNz+jpzuyWFnTjvRpveGZWo=; b=hGFsCG/v/5szZRBsrXR/8h8VUhizxSM1eUVzk62yS3zWpOdvKnGcuM9N+uvulLQLi/agurA5o6Pxe3pxAfiVS17z2v8WcybI2FIbR8Z3z8/UbrmtCbbylX8z3PmJ2goi/B8klhDpEp3nNHE04COVDjP7Eej0JSqawfXep24oaC8= 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 1577798268682668.5255141634464; Tue, 31 Dec 2019 05:17:48 -0800 (PST) Received: from localhost ([::1]:42352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHP9-0005Uk-1I for importer@patchew.org; Tue, 31 Dec 2019 08:17:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55460) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC2-0005Nx-Np for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC1-0002zY-AN for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46806 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC1-0002wv-0k for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-YmCMuXXvPbWL7E4C5nZVDQ-1; Tue, 31 Dec 2019 08:04:08 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E1798477 for ; Tue, 31 Dec 2019 13:04:07 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6720E620A6 for ; Tue, 31 Dec 2019 13:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bX1iE3IP5V5Kv6foRv/GtNz+jpzuyWFnTjvRpveGZWo=; b=O29t0djxP/VA8c2VTAjezuYGGcUpw8KVkIMFT7gdv7RKmdJw16VsPVUEULmtMfsKIq0qFa S48WWq4hgIFE2oMGfaynFsk3HD3lUeNbQLTpuHaDegZ29wDia26Wxl24YqzyJYaato16eh 2XdmMT8r2NsvFEXPI6eiaVAv9CiqKN4= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 22/86] arm:mcimx6ul-evk: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:06 +0100 Message-Id: <1577797450-88458-23-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: YmCMuXXvPbWL7E4C5nZVDQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: remove no longer needed MCIMX6ULEVK Signed-off-by: Igor Mammedov --- hw/arm/mcimx6ul-evk.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c index e90b393..23a71ed 100644 --- a/hw/arm/mcimx6ul-evk.c +++ b/hw/arm/mcimx6ul-evk.c @@ -19,15 +19,10 @@ #include "qemu/error-report.h" #include "sysemu/qtest.h" =20 -typedef struct { - FslIMX6ULState soc; - MemoryRegion ram; -} MCIMX6ULEVK; - static void mcimx6ul_evk_init(MachineState *machine) { static struct arm_boot_info boot_info; - MCIMX6ULEVK *s =3D g_new0(MCIMX6ULEVK, 1); + FslIMX6ULState *s; int i; =20 if (machine->ram_size > FSL_IMX6UL_MMDC_SIZE) { @@ -43,15 +38,12 @@ static void mcimx6ul_evk_init(MachineState *machine) .nb_cpus =3D machine->smp.cpus, }; =20 - object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->so= c), - TYPE_FSL_IMX6UL, &error_fatal, NULL); - - object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fat= al); + s =3D FSL_IMX6UL(object_new(TYPE_FSL_IMX6UL)); + object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fa= tal); + object_property_set_bool(OBJECT(s), true, "realized", &error_fatal); =20 - memory_region_allocate_system_memory(&s->ram, NULL, "mcimx6ul-evk.ram", - machine->ram_size); - memory_region_add_subregion(get_system_memory(), - FSL_IMX6UL_MMDC_ADDR, &s->ram); + memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_MMDC_ADDR, + machine->ram); =20 for (i =3D 0; i < FSL_IMX6UL_NUM_USDHCS; i++) { BusState *bus; @@ -61,7 +53,7 @@ static void mcimx6ul_evk_init(MachineState *machine) =20 di =3D drive_get_next(IF_SD); blk =3D di ? blk_by_legacy_dinfo(di) : NULL; - bus =3D qdev_get_child_bus(DEVICE(&s->soc.usdhc[i]), "sd-bus"); + bus =3D qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus"); carddev =3D qdev_create(bus, TYPE_SD_CARD); qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); object_property_set_bool(OBJECT(carddev), true, @@ -69,7 +61,7 @@ static void mcimx6ul_evk_init(MachineState *machine) } =20 if (!qtest_enabled()) { - arm_load_kernel(&s->soc.cpu, machine, &boot_info); + arm_load_kernel(&s->cpu, machine, &boot_info); } } =20 @@ -78,5 +70,6 @@ static void mcimx6ul_evk_machine_init(MachineClass *mc) mc->desc =3D "Freescale i.MX6UL Evaluation Kit (Cortex A7)"; mc->init =3D mcimx6ul_evk_init; mc->max_cpus =3D FSL_IMX6UL_NUM_CPUS; + mc->default_ram_id =3D "mcimx6ul-evk.ram"; } DEFINE_MACHINE("mcimx6ul-evk", mcimx6ul_evk_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798621; cv=none; d=zohomail.com; s=zohoarc; b=K5zBuFdQVs6+LQhKeEdV7eBdVOKSWBbaye7LlXd7o6+qmYeFWBOjJBvc8Ne7YNZTuhG8klrEVpupwNVIcQsaCM9HJPUYjsIvPYrSs1EMHRFowk9Pc/MzSuQOja64scB3K372tzfPLOacWJoBOFHo9XCsKuLH+3Kl0brDJCOI5vM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798621; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=/jqgnA5+T9FFDJPObgtt6mzGOQfLsBDRBNj8Dp4fv1o=; b=PeX30iT59iHaEp9iEU56/gaJV0NXwQuSe3Dss0JJM55AyaCUXezSMdm4sbnZylFi08PuHe1Yj6zQdcFNd1Lk5u9U86xcdN4YaqUKbOEbNykk7uH1EvQAC0UjUJ2EC5d9lClJdZpiwEeyg6taWiHouy3GO88Pm8JRKlIXKQaEbRg= 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 1577798621226733.1326532214819; Tue, 31 Dec 2019 05:23:41 -0800 (PST) Received: from localhost ([::1]:42430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHUp-0004AI-P6 for importer@patchew.org; Tue, 31 Dec 2019 08:23:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55621) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC4-0005R7-NU for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC2-000365-LH for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:57538 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC2-00032f-ED for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-46-42gZM8XGNz6Jj4a5L-aflA-1; Tue, 31 Dec 2019 08:04:09 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF89018031CD for ; Tue, 31 Dec 2019 13:04:08 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35D81620A6 for ; Tue, 31 Dec 2019 13:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/jqgnA5+T9FFDJPObgtt6mzGOQfLsBDRBNj8Dp4fv1o=; b=WF2bGOKoIi1yLCppTDRLbn9rLLZ0QZ6CaAHCDx7FpV9TB6h4J4qaqmX1Ilh3BGZzUMhUdk dgDdXkvQM3AzHi7H3Zv5XyZLWT1uExrr5antqeyFKWQHT5ayl2Dl5+hFQOAr0DFoG0c9NO 75YKMAZo4Bi2wxNPcJkCO7J7G/5zYgc= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 23/86] arm:mcimx7d-sabre: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:07 +0100 Message-Id: <1577797450-88458-24-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 42gZM8XGNz6Jj4a5L-aflA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: remove no longer needed MCIMX7Sabre Signed-off-by: Igor Mammedov --- hw/arm/mcimx7d-sabre.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c index 0d1f62d..de1e264 100644 --- a/hw/arm/mcimx7d-sabre.c +++ b/hw/arm/mcimx7d-sabre.c @@ -21,15 +21,10 @@ #include "qemu/error-report.h" #include "sysemu/qtest.h" =20 -typedef struct { - FslIMX7State soc; - MemoryRegion ram; -} MCIMX7Sabre; - static void mcimx7d_sabre_init(MachineState *machine) { static struct arm_boot_info boot_info; - MCIMX7Sabre *s =3D g_new0(MCIMX7Sabre, 1); + FslIMX7State *s; int i; =20 if (machine->ram_size > FSL_IMX7_MMDC_SIZE) { @@ -45,15 +40,12 @@ static void mcimx7d_sabre_init(MachineState *machine) .nb_cpus =3D machine->smp.cpus, }; =20 - object_initialize_child(OBJECT(machine), "soc", - &s->soc, sizeof(s->soc), - TYPE_FSL_IMX7, &error_fatal, NULL); - object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fat= al); + s =3D FSL_IMX7(object_new(TYPE_FSL_IMX7)); + object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fa= tal); + object_property_set_bool(OBJECT(s), true, "realized", &error_fatal); =20 - memory_region_allocate_system_memory(&s->ram, NULL, "mcimx7d-sabre.ram= ", - machine->ram_size); - memory_region_add_subregion(get_system_memory(), - FSL_IMX7_MMDC_ADDR, &s->ram); + memory_region_add_subregion(get_system_memory(), FSL_IMX7_MMDC_ADDR, + machine->ram); =20 for (i =3D 0; i < FSL_IMX7_NUM_USDHCS; i++) { BusState *bus; @@ -63,7 +55,7 @@ static void mcimx7d_sabre_init(MachineState *machine) =20 di =3D drive_get_next(IF_SD); blk =3D di ? blk_by_legacy_dinfo(di) : NULL; - bus =3D qdev_get_child_bus(DEVICE(&s->soc.usdhc[i]), "sd-bus"); + bus =3D qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus"); carddev =3D qdev_create(bus, TYPE_SD_CARD); qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); object_property_set_bool(OBJECT(carddev), true, @@ -71,7 +63,7 @@ static void mcimx7d_sabre_init(MachineState *machine) } =20 if (!qtest_enabled()) { - arm_load_kernel(&s->soc.cpu[0], machine, &boot_info); + arm_load_kernel(&s->cpu[0], machine, &boot_info); } } =20 @@ -80,5 +72,6 @@ static void mcimx7d_sabre_machine_init(MachineClass *mc) mc->desc =3D "Freescale i.MX7 DUAL SABRE (Cortex A7)"; mc->init =3D mcimx7d_sabre_init; mc->max_cpus =3D FSL_IMX7_NUM_CPUS; + mc->default_ram_id =3D "mcimx7d-sabre.ram"; } DEFINE_MACHINE("mcimx7d-sabre", mcimx7d_sabre_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798569; cv=none; d=zohomail.com; s=zohoarc; b=m6ueYeIad5YDu/Btr95N3B1llSzWsotSyUsEpF/RFKynIfkcQ23d+Ik2C94oaafIAEGwvvt55op1ZAuh6mMJmqBSahvZuwopIP6EfBXEov7i0fH7vf/M/J+Get0pSsLp9W20RAAJaX6dipjz+8Q9AVhn40H3JKBNIeSaK6LxBVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798569; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=wvRyJli7hp1f30uHVafflGyOJoCIa+WJ2N/FqGnUCtQ=; b=YrQr3tzzuPdveg3RtnOViOJYHgexURQHycNWtsr4coktnRdFlvbE0q27mV9LXMrebePG7CmkODjns40YVbDeqis4weoJJqZAfadXKdQ/2Tr4KEzgWJgmvigNgLAELkBV47l5+NpM0CC5/n8wRrj0V3nGyVhESxB3Jpkc34F4a6w= 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 1577798569730199.19304131768683; Tue, 31 Dec 2019 05:22:49 -0800 (PST) Received: from localhost ([::1]:42422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHU0-0002rO-1R for importer@patchew.org; Tue, 31 Dec 2019 08:22:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55458) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC2-0005Nt-Mj for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC1-0002zf-AN for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:36328 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC1-0002x8-2n for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-218-FvWpwhk5OrWH5CYQCyY3Ag-1; Tue, 31 Dec 2019 08:04:10 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7EB17DB60 for ; Tue, 31 Dec 2019 13:04:09 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05775620A6 for ; Tue, 31 Dec 2019 13:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wvRyJli7hp1f30uHVafflGyOJoCIa+WJ2N/FqGnUCtQ=; b=b3MC4kjb5hbUomjjAK6VznXlXv5yAdlUqwoIGN28o41xKo16CJoDVlWfzqw4YO8WLNa3YX Hd+iA9SD4TRGcKtbctPjEg9ZUfHeXR58Ed5VReo2wh3jJV6+cP18m3mCqaSCs9j6+EQZVG tuQwqF62nrR0CxCPkez3cfmjB42IwAs= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 24/86] arm:mps2-tz: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:08 +0100 Message-Id: <1577797450-88458-25-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: FvWpwhk5OrWH5CYQCyY3Ag-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/mps2-tz.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index f8b620b..8e2ba59 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -79,7 +79,6 @@ typedef struct { MachineState parent; =20 ARMSSE iotkit; - MemoryRegion psram; MemoryRegion ssram[3]; MemoryRegion ssram1_m; MPS2SCC scc; @@ -388,6 +387,12 @@ static void mps2tz_common_init(MachineState *machine) exit(1); } =20 + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit, sizeof(mms->iotkit), mmc->armsse_type); iotkitdev =3D DEVICE(&mms->iotkit); @@ -458,9 +463,7 @@ static void mps2tz_common_init(MachineState *machine) * tradeoffs. For QEMU they're all just RAM, though. We arbitrarily * call the 16MB our "system memory", as it's the largest lump. */ - memory_region_allocate_system_memory(&mms->psram, - NULL, "mps.ram", 16 * MiB); - memory_region_add_subregion(system_memory, 0x80000000, &mms->psram); + memory_region_add_subregion(system_memory, 0x80000000, machine->ram); =20 /* The overflow IRQs for all UARTs are ORed together. * Tx, Rx and "combined" IRQs are sent to the NVIC separately. @@ -642,6 +645,7 @@ static void mps2tz_class_init(ObjectClass *oc, void *da= ta) =20 mc->init =3D mps2tz_common_init; iic->check =3D mps2_tz_idau_check; + mc->default_ram_id =3D "mps.ram"; } =20 static void mps2tz_an505_class_init(ObjectClass *oc, void *data) @@ -657,6 +661,7 @@ static void mps2tz_an505_class_init(ObjectClass *oc, vo= id *data) mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-m33"); mmc->scc_id =3D 0x41045050; mmc->armsse_type =3D TYPE_IOTKIT; + mc->default_ram_size =3D 16 * MiB; } =20 static void mps2tz_an521_class_init(ObjectClass *oc, void *data) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798454; cv=none; d=zohomail.com; s=zohoarc; b=PvAO2DBT22Fu28oJfA+t2YE75F9dXCjt2i27nbEB6jF/71RzvxyZAR++GlzQKG/aGNP7pf6hJruZRU20rtOIoiuVfFqbbMXsVQQruCl16wiallV3fGg9xL/qyEtLKzPvZ+PxvpboS1/6p6LBjRHIxAkqUV43B55owVCOwsy0fHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798454; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=D6dKx2tmc0F5/ADsZ61KIwjXwMVRPeQJ0LUttbF8Psc=; b=N6l8aV+O02Tk6Hgofl6FiU+0skhNssP1eI0BR16+8AzMhaACbQ1c3WnD5XlZRX80oRx2h5gpKa04ESt2DgQ/d6KQcWeMwrM/UWUwDe1LlXDPy3+2Utp/EA79sBnWmoQ9GaqM3OXnCsnkS0owacU5KWhogc/hdPnzdCdZBNJX9P4= 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 1577798454912226.99909652162955; Tue, 31 Dec 2019 05:20:54 -0800 (PST) Received: from localhost ([::1]:42376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHS9-0000Ym-Aa for importer@patchew.org; Tue, 31 Dec 2019 08:20:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55486) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC3-0005OT-25 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC1-00031m-PQ for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:14 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:47572) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC1-0002yK-Hl for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-688ZpDg5OI-VylyLDIBzSw-1; Tue, 31 Dec 2019 08:04:11 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 50A6410054E3 for ; Tue, 31 Dec 2019 13:04:10 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7F6F78E96 for ; Tue, 31 Dec 2019 13:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D6dKx2tmc0F5/ADsZ61KIwjXwMVRPeQJ0LUttbF8Psc=; b=HP7xtaCTZ4HA96B0iWzi1QugmkIrN2NwYyr+4t2DgpPovgdUq12ip+DTfxHD7nsbpuejm4 MleDOqciJMNive/YolxAYJ+6xFmHwI0lPZd3/4+eE0B/HPZFy7DGieRIHdXAaCdVI5hrCu Vg7lMF/SFfS+yKaIujvVpuNXuzqZoaQ= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 25/86] arm:mps2: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:09 +0100 Message-Id: <1577797450-88458-26-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 688ZpDg5OI-VylyLDIBzSw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/mps2.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index d002b12..930124d 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -55,7 +55,6 @@ typedef struct { MachineState parent; =20 ARMv7MState armv7m; - MemoryRegion psram; MemoryRegion ssram1; MemoryRegion ssram1_m; MemoryRegion ssram23; @@ -118,6 +117,12 @@ static void mps2_common_init(MachineState *machine) exit(1); } =20 + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + /* The FPGA images have an odd combination of different RAMs, * because in hardware they are different implementations and * connected to different buses, giving varying performance/size @@ -146,9 +151,7 @@ static void mps2_common_init(MachineState *machine) * This is of no use for QEMU so we don't implement it (as if * zbt_boot_ctrl is always zero). */ - memory_region_allocate_system_memory(&mms->psram, - NULL, "mps.ram", 16 * MiB); - memory_region_add_subregion(system_memory, 0x21000000, &mms->psram); + memory_region_add_subregion(system_memory, 0x21000000, machine->ram); =20 switch (mmc->fpga_type) { case FPGA_AN385: @@ -338,6 +341,8 @@ static void mps2_class_init(ObjectClass *oc, void *data) =20 mc->init =3D mps2_common_init; mc->max_cpus =3D 1; + mc->default_ram_size =3D 16 * MiB; + mc->default_ram_id =3D "mps.ram"; } =20 static void mps2_an385_class_init(ObjectClass *oc, void *data) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798717; cv=none; d=zohomail.com; s=zohoarc; b=Au+5QDh9rJTGU6JoK4MsuQHVE6Mg8GTvtZSlZ8vTv4KkMzxUjkzGXNo6N/VrlzvTB3Sm3OzRt3p5dq8v4zvHJqU+gn7yJAjfH74c7jwe46z/49Q1VS+KbwdgUTkJEcMSc0wkcJXNugb0vmd0+91U7tvVAbaD92WHYks9KIPykwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798717; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=UVKMODe+MpjYLQreYlBXiezNgqlaIQPtM6juxP85AtM=; b=LIDKQlp0svx+rUyqljuSo1ZRjw/iGDE5BD7kgVlKDWlL1XFFsfkMr0APWV3OSynEbPNLg/eqA/nrFd4xNDPkEs8NUCeXxiWMs1SQ/+hOcHvg3bCNYlnEJvXe2Q+9pA85GQeTqphFmOLYPLnTL9SwpL7I1aSk7H5/6fh0aM2PyVg= 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 1577798717098959.1387822080994; Tue, 31 Dec 2019 05:25:17 -0800 (PST) Received: from localhost ([::1]:42448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHWN-0006PP-F9 for importer@patchew.org; Tue, 31 Dec 2019 08:25:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55507) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC3-0005Oq-9A for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC2-00032t-0a for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:15 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:44435 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC1-00030I-R9 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-176-RoNMO_k1M2-lJby3bpMILQ-1; Tue, 31 Dec 2019 08:04:11 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CB09800D41 for ; Tue, 31 Dec 2019 13:04:11 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9637F620A6 for ; Tue, 31 Dec 2019 13:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UVKMODe+MpjYLQreYlBXiezNgqlaIQPtM6juxP85AtM=; b=a4dxSzcWW3x+tEX8bPYeo5rI0f0HvOVqsVr8GcyoVYw/D5en0FlyxtDxf4WvD6tI5G9w2i iMnNOAbpiFFwsshNnouLgAD8Jj0080ZQl4qWDKbh4WFASAaVSI5Ndf8wIpMGRDc+OPfdRK hXl4clGSl4Tl6veW5H7ca6+ctvzlP18= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 26/86] arm:musicpal: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:10 +0100 Message-Id: <1577797450-88458-27-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: RoNMO_k1M2-lJby3bpMILQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/musicpal.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index f68a399..5bcb144 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -1589,16 +1589,20 @@ static void musicpal_init(MachineState *machine) int i; unsigned long flash_size; DriveInfo *dinfo; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 + /* For now we use a fixed - the original - RAM size */ + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + cpu =3D ARM_CPU(cpu_create(machine->cpu_type)); =20 - /* For now we use a fixed - the original - RAM size */ - memory_region_allocate_system_memory(ram, NULL, "musicpal.ram", - MP_RAM_DEFAULT_SIZE); - memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); =20 memory_region_init_ram(sram, NULL, "musicpal.sram", MP_SRAM_SIZE, &error_fatal); @@ -1714,6 +1718,8 @@ static void musicpal_machine_init(MachineClass *mc) mc->init =3D musicpal_init; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("arm926"); + mc->default_ram_size =3D MP_RAM_DEFAULT_SIZE; + mc->default_ram_id =3D "musicpal.ram"; } =20 DEFINE_MACHINE("musicpal", musicpal_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798768; cv=none; d=zohomail.com; s=zohoarc; b=CVSyF0aRRWnM+EIM3hU4IIpX6pWAMrE94Juv3/ke4vwA9SKRKNOFSiexyso/cCO646O1HHzFMM84NLxeMSeI03PKFSTgfgAWH/lh/6U1mnBc8ofYq2bwIsajEtKgvJ48bPD5KBzjFcVI+KgvTdXk10JmA3cED4pTY4nefIV1WVc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798768; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=79eURPN1sQsi2h5uxNhyVtBz8N1xgtm8YMcGzpAfDa0=; b=bH8eVNaEMrnp1Dj9ckDLfHNmdzWLd6zhrGeF3i/KPd/uf8YB5z8Aycc4umOvNtnurIIxo6qklW1zCIJmOEYA+nLLo6+/YY4K9/Mj4shl0qznn42ntIVVkBAmfWWARKBE+RirsWZTeASEURvgP4XfT7XGyrZpsIov7SdSpKTXTs8= 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 1577798768365417.87477448828565; Tue, 31 Dec 2019 05:26:08 -0800 (PST) Received: from localhost ([::1]:42466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHXC-0007dQ-PH for importer@patchew.org; Tue, 31 Dec 2019 08:26:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55750) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC6-0005Uk-EI for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC5-0003H1-1C for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:18 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:51363 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC4-0003EP-SA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-jZnq5mP-Mxmcv_c-w8BZGA-1; Tue, 31 Dec 2019 08:04:12 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDFF3DB60 for ; Tue, 31 Dec 2019 13:04:11 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66097620A6 for ; Tue, 31 Dec 2019 13:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=79eURPN1sQsi2h5uxNhyVtBz8N1xgtm8YMcGzpAfDa0=; b=eS51uzmupVHRFq5ekPYiCYMP7S5NnUdolWfi64aFwLUmzyVImBxGkzDEo6zFEFrp4zUOlg e2DGbxKS+fWoJbJup/LHEzt5OSt0mkE84jMwan/D7opTN9BqUdTc+HLll8glpEq2LtRBec CdhNEQo+w9KsaKaEIy/GPHo6rCeZmwU= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 27/86] arm:nseries: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:11 +0100 Message-Id: <1577797450-88458-28-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: jZnq5mP-Mxmcv_c-w8BZGA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/nseries.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 3fd196f..89e4627 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -47,7 +47,6 @@ =20 /* Nokia N8x0 support */ struct n800_s { - MemoryRegion sdram; struct omap_mpu_state_s *mpu; =20 struct rfbi_chip_s blizzard; @@ -1311,13 +1310,18 @@ static void n8x0_init(MachineState *machine, struct arm_boot_info *binfo, int model) { struct n800_s *s =3D (struct n800_s *) g_malloc0(sizeof(*s)); - uint64_t sdram_size =3D binfo->ram_size; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); =20 - memory_region_allocate_system_memory(&s->sdram, NULL, "omap2.dram", - sdram_size); - memory_region_add_subregion(get_system_memory(), OMAP2_Q2_BASE, &s->sd= ram); + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + + memory_region_add_subregion(get_system_memory(), OMAP2_Q2_BASE, + machine->ram); =20 - s->mpu =3D omap2420_mpu_init(&s->sdram, machine->cpu_type); + s->mpu =3D omap2420_mpu_init(machine->ram, machine->cpu_type); =20 /* Setup peripherals * @@ -1383,9 +1387,8 @@ static void n8x0_init(MachineState *machine, * * The code above is for loading the `zImage' file from Nokia * images. */ - load_image_targphys(option_rom[0].name, - OMAP2_Q2_BASE + 0x400000, - sdram_size - 0x400000); + load_image_targphys(option_rom[0].name, OMAP2_Q2_BASE + 0x400000, + machine->ram_size - 0x400000); =20 n800_setup_nolo_tags(nolo_tags); cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000); @@ -1395,16 +1398,12 @@ static void n8x0_init(MachineState *machine, =20 static struct arm_boot_info n800_binfo =3D { .loader_start =3D OMAP2_Q2_BASE, - /* Actually two chips of 0x4000000 bytes each */ - .ram_size =3D 0x08000000, .board_id =3D 0x4f7, .atag_board =3D n800_atag_setup, }; =20 static struct arm_boot_info n810_binfo =3D { .loader_start =3D OMAP2_Q2_BASE, - /* Actually two chips of 0x4000000 bytes each */ - .ram_size =3D 0x08000000, /* 0x60c and 0x6bf (WiMAX Edition) have been assigned but are not * used by some older versions of the bootloader and 5555 is used * instead (including versions that shipped with many devices). */ @@ -1431,6 +1430,9 @@ static void n800_class_init(ObjectClass *oc, void *da= ta) mc->default_boot_order =3D ""; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("arm1136-r2"); + /* Actually two chips of 0x4000000 bytes each */ + mc->default_ram_size =3D 0x08000000; + mc->default_ram_id =3D "omap2.dram"; } =20 static const TypeInfo n800_type =3D { @@ -1448,6 +1450,9 @@ static void n810_class_init(ObjectClass *oc, void *da= ta) mc->default_boot_order =3D ""; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("arm1136-r2"); + /* Actually two chips of 0x4000000 bytes each */ + mc->default_ram_size =3D 0x08000000; + mc->default_ram_id =3D "omap2.dram"; } =20 static const TypeInfo n810_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798587; cv=none; d=zohomail.com; s=zohoarc; b=WzzFDmjiDoV1Dq3ljicQByvb5qQ3CY+K+5n7OfriK/k/+dzAnsuNaETKHNn7h5H5NAH6fgrunqG++EycU2mxkcQOTvIyF1k9c0rI3931yB2GJScIHQHTpCJMNK6Q/CVHsG4RFhYByeM2iM1a9MBsfL+UJxX6WAdGcoomZYMpn6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798587; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=9NINb3qqHpUKlaeWZXAEysQmGsJb0pPbQbVeQlNejfA=; b=eHiy3/n7SSiXpv/zxkYck7WlKZgvYuxMSz1xodz1XOVX8aH+TguUwMMz5sxQhCfjnwO0g8uqk9xDmdDyvuPpXw4kHOoQDpKp7udBq8SDg4bfC9ZGKjNHlM8qqqfPeQEO0Pd3uq7y5N1kkIJm910o/NDhJJ1l40OlYCqsiJulkUg= 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 1577798587909760.3549622123838; Tue, 31 Dec 2019 05:23:07 -0800 (PST) Received: from localhost ([::1]:42424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHUI-0003IP-7L for importer@patchew.org; Tue, 31 Dec 2019 08:23:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55778) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC6-0005VL-OA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC5-0003J7-ER for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46293 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC5-0003GV-9d for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:17 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-268-6jRG2kF1OQqKN6URyKBWKA-1; Tue, 31 Dec 2019 08:04:13 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC38F107ACC5 for ; Tue, 31 Dec 2019 13:04:12 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3394878E96 for ; Tue, 31 Dec 2019 13:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9NINb3qqHpUKlaeWZXAEysQmGsJb0pPbQbVeQlNejfA=; b=fk+6Hii1Av1dNZcAOatTcNvwGq19lsniZIBARFLc/+OaTq2VI0AWcOHSEdASdUQwI/fHKC rx/rT6n+KZ+PKM/FnFcv9lnkf8qGYhuRI47Lu9IS/1CM6TE2l6aKUJ1yxW1p7hJmslDec/ jZBv3qUz2cuX5rlBC+hRlRiijAVS3F0= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 28/86] arm:omap_sx1: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:12 +0100 Message-Id: <1577797450-88458-29-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 6jRG2kF1OQqKN6URyKBWKA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/omap_sx1.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index be24571..d97225b 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -102,8 +102,8 @@ static struct arm_boot_info sx1_binfo =3D { static void sx1_init(MachineState *machine, const int version) { struct omap_mpu_state_s *mpu; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); MemoryRegion *address_space =3D get_system_memory(); - MemoryRegion *dram =3D g_new(MemoryRegion, 1); MemoryRegion *flash =3D g_new(MemoryRegion, 1); MemoryRegion *cs =3D g_new(MemoryRegion, 4); static uint32_t cs0val =3D 0x00213090; @@ -115,15 +115,19 @@ static void sx1_init(MachineState *machine, const int= version) uint32_t flash_size =3D flash0_size; int be; =20 + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + if (version =3D=3D 2) { flash_size =3D flash2_size; } =20 - memory_region_allocate_system_memory(dram, NULL, "omap1.dram", - sx1_binfo.ram_size); - memory_region_add_subregion(address_space, OMAP_EMIFF_BASE, dram); + memory_region_add_subregion(address_space, OMAP_EMIFF_BASE, machine->r= am); =20 - mpu =3D omap310_mpu_init(dram, machine->cpu_type); + mpu =3D omap310_mpu_init(machine->ram, machine->cpu_type); =20 /* External Flash (EMIFS) */ memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size, @@ -223,6 +227,8 @@ static void sx1_machine_v2_class_init(ObjectClass *oc, = void *data) mc->init =3D sx1_init_v2; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("ti925t"); + mc->default_ram_size =3D sdram_size; + mc->default_ram_id =3D "omap1.dram"; } =20 static const TypeInfo sx1_machine_v2_type =3D { @@ -239,6 +245,8 @@ static void sx1_machine_v1_class_init(ObjectClass *oc, = void *data) mc->init =3D sx1_init_v1; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("ti925t"); + mc->default_ram_size =3D sdram_size; + mc->default_ram_id =3D "omap1.dram"; } =20 static const TypeInfo sx1_machine_v1_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798883; cv=none; d=zohomail.com; s=zohoarc; b=iaB2j0aFFVZAHpT6y8A0tblyyVGCews9CrECizm7/lrJFF2aq/GvCmw0qeZaikwSwHgPZmo0FHfDMDAJiC5wfQaL53fk4eEHs7UJhBPjUAS8WdJ3u5iU14Frd9mvJACrBpyU+YDDsPT41XaVtFjqIA0En+HIsLQaSG8gx4cteQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798883; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=L53mFXwRanysL3Utd4Mm2Z2NgsqJaJzGM5C72DlmakA=; b=BwSeHGgIK+4YeykTCp/UsOSq/do/XWoBoHvMnFq+yGp77O3YumDQE8IDCILnhfJhvueinN5CMBroCpEpoAFbuqVHYRmiSkWQA6vViUCqTzQ1Jvpx94SJCXS8r6lWqAj8NPy7oS4dlf1aXJ+Fi+JJTymzFZs/g1W2c+R2IGciLGc= 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 1577798883014316.04653442846643; Tue, 31 Dec 2019 05:28:03 -0800 (PST) Received: from localhost ([::1]:42484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHZ2-0001X8-7S for importer@patchew.org; Tue, 31 Dec 2019 08:28:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55714) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC5-0005Ta-Vl for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC4-0003FC-KC for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:17 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:33038 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC4-0003CT-F2 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:16 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-252-gDC6NVIRND-FyUYjK9HVig-1; Tue, 31 Dec 2019 08:04:14 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7A5AE107ACC7 for ; Tue, 31 Dec 2019 13:04:13 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00D72620A6 for ; Tue, 31 Dec 2019 13:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L53mFXwRanysL3Utd4Mm2Z2NgsqJaJzGM5C72DlmakA=; b=Owtz4ggYds3L9KQiBFxcRx0ief9B9PTGN9vRmneZJEESmVs2vdn10nC8VG47KZEr9sunNK f/iWIhC0+kRAVKfivNpxPVaGUhnvmeAu8A5lquCkIYF9U6HFXRRWFY7pznlLTW15oaGXl0 gUGMFhQyeKV3r4kn6g01Vy8rQ2OsKhk= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 29/86] arm:palm: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:13 +0100 Message-Id: <1577797450-88458-30-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: gDC6NVIRND-FyUYjK9HVig-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/arm/palm.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 72eca8c..56c6e67 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -181,7 +181,6 @@ static void palmte_gpio_setup(struct omap_mpu_state_s *= cpu) =20 static struct arm_boot_info palmte_binfo =3D { .loader_start =3D OMAP_EMIFF_BASE, - .ram_size =3D 0x02000000, .board_id =3D 0x331, }; =20 @@ -195,15 +194,20 @@ static void palmte_init(MachineState *machine) static uint32_t cs2val =3D 0x0000e1a0; static uint32_t cs3val =3D 0xe1a0e1a0; int rom_size, rom_loaded =3D 0; - MemoryRegion *dram =3D g_new(MemoryRegion, 1); + MachineClass *mc =3D MACHINE_GET_CLASS(machine); MemoryRegion *flash =3D g_new(MemoryRegion, 1); MemoryRegion *cs =3D g_new(MemoryRegion, 4); =20 - memory_region_allocate_system_memory(dram, NULL, "omap1.dram", - palmte_binfo.ram_size); - memory_region_add_subregion(address_space_mem, OMAP_EMIFF_BASE, dram); + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + + memory_region_add_subregion(address_space_mem, OMAP_EMIFF_BASE, + machine->ram); =20 - mpu =3D omap310_mpu_init(dram, machine->cpu_type); + mpu =3D omap310_mpu_init(machine->ram, machine->cpu_type); =20 /* External Flash (EMIFS) */ memory_region_init_ram(flash, NULL, "palmte.flash", flash_size, @@ -265,6 +269,8 @@ static void palmte_machine_init(MachineClass *mc) mc->init =3D palmte_init; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("ti925t"); + mc->default_ram_size =3D 0x02000000; + mc->default_ram_id =3D "omap1.dram"; } =20 DEFINE_MACHINE("cheetah", palmte_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798736; cv=none; d=zohomail.com; s=zohoarc; b=EhfUw04ZrNNS0H+SLSsuIrnjIxp3O7/CmCPfPDiydgwgNyr9lBetawnhrz9sHxgRJhZnyPbo8ioFkVqe6dI7MeFKCamibaVsCIiAX7ojhcCnoyxLleko6vPjtWXJfwst+nAc5ZgFMeFiqO2qyUgV77PHoHNFwrrfY6Oj0z5zBJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798736; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=pNT9rUS3ODM08KqZ7EJF4TqTiHE+uGic/50HJmk5w9g=; b=GBrfVSiRJ6WwwlMAQjzcXfQkk6oL371y5eZ959fyFEethcM9No38LYJMojcS4/1MzVZxevYcH1FpNI8iVaE7IE+ffvKmh3tLYKffwGpuLiGFRuChBCggn4Q1AvrLs/qdyTaShOibqYJ5Ff/ZvFOpHNMtj8upIntJfOhw4UHYR0A= 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 1577798736583219.63723753058866; Tue, 31 Dec 2019 05:25:36 -0800 (PST) Received: from localhost ([::1]:42450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHWg-0006no-Oq for importer@patchew.org; Tue, 31 Dec 2019 08:25:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55812) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC7-0005Vx-5m for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC5-0003Je-J9 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:51386 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC5-0003HN-Co for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:17 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-Ai9e_DbdPHyFYMkEp5mhNw-1; Tue, 31 Dec 2019 08:04:15 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49746107ACC9 for ; Tue, 31 Dec 2019 13:04:14 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C27E2620A6 for ; Tue, 31 Dec 2019 13:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pNT9rUS3ODM08KqZ7EJF4TqTiHE+uGic/50HJmk5w9g=; b=AfgV9dr0ckdKms0x1EBOegaX6sjC5sDtxwNbHJila1XvO7ASZPtlay81z+tJZtRezVwDU7 nNhQ/zmutmCa7wICtY7cFrok4goyKDyhWTEnMM8tdtmW2TOBUZsan06wtte/8SSOQZOJyV R5ypM6N8oFSGw7tO78rTiehQo1h/XS0= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 30/86] arm:raspi: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:14 +0100 Message-Id: <1577797450-88458-31-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Ai9e_DbdPHyFYMkEp5mhNw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: remove no longer needed RasPiState Signed-off-by: Igor Mammedov --- hw/arm/raspi.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 6a510aa..33ace66 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -32,11 +32,6 @@ /* Table of Linux board IDs for different Pi versions */ static const int raspi_boardid[] =3D {[1] =3D 0xc42, [2] =3D 0xc43, [3] = =3D 0xc44}; =20 -typedef struct RasPiState { - BCM283XState soc; - MemoryRegion ram; -} RasPiState; - static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) { static const uint32_t smpboot[] =3D { @@ -166,7 +161,7 @@ static void setup_boot(MachineState *machine, int versi= on, size_t ram_size) =20 static void raspi_init(MachineState *machine, int version) { - RasPiState *s =3D g_new0(RasPiState, 1); + Object *soc; uint32_t vcram_size; DriveInfo *di; BlockBackend *blk; @@ -179,30 +174,26 @@ static void raspi_init(MachineState *machine, int ver= sion) exit(1); } =20 - object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc= ), - version =3D=3D 3 ? TYPE_BCM2837 : TYPE_BCM2836, - &error_abort, NULL); + soc =3D object_new(version =3D=3D 3 ? TYPE_BCM2837 : TYPE_BCM2836); + object_property_add_child(OBJECT(machine), "soc", soc, &error_fatal); =20 - /* Allocate and map RAM */ - memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram", - machine->ram_size); /* FIXME: Remove when we have custom CPU address space support */ - memory_region_add_subregion_overlap(get_system_memory(), 0, &s->ram, 0= ); + memory_region_add_subregion_overlap(get_system_memory(), 0, + machine->ram, 0); =20 /* Setup the SOC */ - object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), + object_property_add_const_link(soc, "ram", OBJECT(machine->ram), &error_abort); - object_property_set_int(OBJECT(&s->soc), machine->smp.cpus, "enabled-c= pus", + object_property_set_int(soc, machine->smp.cpus, "enabled-cpus", &error_abort); int board_rev =3D version =3D=3D 3 ? 0xa02082 : 0xa21041; - object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev", - &error_abort); - object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abo= rt); + object_property_set_int(soc, board_rev, "board-rev", &error_abort); + object_property_set_bool(soc, true, "realized", &error_abort); =20 /* Create and plug in the SD cards */ di =3D drive_get_next(IF_SD); blk =3D di ? blk_by_legacy_dinfo(di) : NULL; - bus =3D qdev_get_child_bus(DEVICE(&s->soc), "sd-bus"); + bus =3D qdev_get_child_bus(DEVICE(soc), "sd-bus"); if (bus =3D=3D NULL) { error_report("No SD bus found in SOC object"); exit(1); @@ -211,8 +202,7 @@ static void raspi_init(MachineState *machine, int versi= on) qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); object_property_set_bool(OBJECT(carddev), true, "realized", &error_fat= al); =20 - vcram_size =3D object_property_get_uint(OBJECT(&s->soc), "vcram-size", - &error_abort); + vcram_size =3D object_property_get_uint(soc, "vcram-size", &error_abor= t); setup_boot(machine, version, machine->ram_size - vcram_size); } =20 @@ -233,6 +223,7 @@ static void raspi2_machine_init(MachineClass *mc) mc->min_cpus =3D BCM283X_NCPUS; mc->default_cpus =3D BCM283X_NCPUS; mc->default_ram_size =3D 1 * GiB; + mc->default_ram_id =3D "ram"; mc->ignore_memory_transaction_failures =3D true; }; DEFINE_MACHINE("raspi2", raspi2_machine_init) @@ -255,6 +246,7 @@ static void raspi3_machine_init(MachineClass *mc) mc->min_cpus =3D BCM283X_NCPUS; mc->default_cpus =3D BCM283X_NCPUS; mc->default_ram_size =3D 1 * GiB; + mc->default_ram_id =3D "ram"; } DEFINE_MACHINE("raspi3", raspi3_machine_init) #endif --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799261; cv=none; d=zohomail.com; s=zohoarc; b=gFn+hIuiFNmu1jxIgfRXWzUT1kNGmt2c6oS/jTVMAEhVGFF5z0zlwsPWeoUmyhNCSejXbPzA2PMdUEIH8NeKAP4GO2OyFDSj36Okdo/xjNPZL+vXuVq3DuJ1zXg9doQ1xTNtTTjrZiK0yEp6uBXEW/3Bg0y5ef2nB6EfWD0NvFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799261; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hxyCrdRVG0QvRGArtkKQlZEV6GW4AMxyzBj5Ko2oEY4=; b=jJ6QWuqzMwVu/f8GExK3f80daj/frlpygxZb9ra+zrcELnd+j3AoUhDLw9zFjKYHYlpFNPFvBsrONdmORZLdHUaErDodFmdAGoyFS1wEi3CmBl22SWxXnohbG54DNBZgq/EeVnec9AMu0u79K1NxYLXK4PNUG6V+FovHbNa3h4Y= 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 157779926134824.334589091317525; Tue, 31 Dec 2019 05:34:21 -0800 (PST) Received: from localhost ([::1]:42558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHf8-0000d3-EQ for importer@patchew.org; Tue, 31 Dec 2019 08:34:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55895) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC8-0005Xd-8s for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC6-0003P3-Mm for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:19 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:51193 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC6-0003MW-Gy for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-Lz_VPp7dMaGMGxNbqDt-4Q-1; Tue, 31 Dec 2019 08:04:16 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17F17800D41 for ; Tue, 31 Dec 2019 13:04:15 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92C3F620A6 for ; Tue, 31 Dec 2019 13:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hxyCrdRVG0QvRGArtkKQlZEV6GW4AMxyzBj5Ko2oEY4=; b=JXg1btmmZI6te1xlVeZD++bvIGEgsXU/6wJ8zr1i7mecM8zYGbi3zeNo1lR56aPh0TX9zW LifzPFRVMt2aqo2NmfqkZeHQgpD178vWea2D9mvaWFrcwaTr6W4uLx/Kf/VQBSfN+vMCk9 UbVzVua2QkEEFbVpaZxn+ddepJGBB2c= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 31/86] arm:sabrelite: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:15 +0100 Message-Id: <1577797450-88458-32-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Lz_VPp7dMaGMGxNbqDt-4Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: remove no longer needed IMX6Sabrelite Signed-off-by: Igor Mammedov --- hw/arm/sabrelite.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c index 96cc455..e31694b 100644 --- a/hw/arm/sabrelite.c +++ b/hw/arm/sabrelite.c @@ -19,11 +19,6 @@ #include "qemu/error-report.h" #include "sysemu/qtest.h" =20 -typedef struct IMX6Sabrelite { - FslIMX6State soc; - MemoryRegion ram; -} IMX6Sabrelite; - static struct arm_boot_info sabrelite_binfo =3D { /* DDR memory start */ .loader_start =3D FSL_IMX6_MMDC_ADDR, @@ -45,7 +40,7 @@ static void sabrelite_reset_secondary(ARMCPU *cpu, =20 static void sabrelite_init(MachineState *machine) { - IMX6Sabrelite *s =3D g_new0(IMX6Sabrelite, 1); + FslIMX6State *s; Error *err =3D NULL; =20 /* Check the amount of memory is compatible with the SOC */ @@ -55,19 +50,16 @@ static void sabrelite_init(MachineState *machine) exit(1); } =20 - object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc= ), - TYPE_FSL_IMX6, &error_abort, NULL); - - object_property_set_bool(OBJECT(&s->soc), true, "realized", &err); + s =3D FSL_IMX6(object_new(TYPE_FSL_IMX6)); + object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fa= tal); + object_property_set_bool(OBJECT(s), true, "realized", &err); if (err !=3D NULL) { error_report("%s", error_get_pretty(err)); exit(1); } =20 - memory_region_allocate_system_memory(&s->ram, NULL, "sabrelite.ram", - machine->ram_size); memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR, - &s->ram); + machine->ram); =20 { /* @@ -78,7 +70,7 @@ static void sabrelite_init(MachineState *machine) /* Add the sst25vf016b NOR FLASH memory to first SPI */ Object *spi_dev; =20 - spi_dev =3D object_resolve_path_component(OBJECT(&s->soc), "spi1"); + spi_dev =3D object_resolve_path_component(OBJECT(s), "spi1"); if (spi_dev) { SSIBus *spi_bus; =20 @@ -109,7 +101,7 @@ static void sabrelite_init(MachineState *machine) sabrelite_binfo.secondary_cpu_reset_hook =3D sabrelite_reset_secondary; =20 if (!qtest_enabled()) { - arm_load_kernel(&s->soc.cpu[0], machine, &sabrelite_binfo); + arm_load_kernel(&s->cpu[0], machine, &sabrelite_binfo); } } =20 @@ -119,6 +111,7 @@ static void sabrelite_machine_init(MachineClass *mc) mc->init =3D sabrelite_init; mc->max_cpus =3D FSL_IMX6_NUM_CPUS; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_id =3D "sabrelite.ram"; } =20 DEFINE_MACHINE("sabrelite", sabrelite_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799083; cv=none; d=zohomail.com; s=zohoarc; b=Ic3xVGKSb0DCsPFIJuYZbzpTMmdgQRExxIxgx/yHF5WAX4LPpDfipvJkj9+sFlKzj5MBYjsJzobRGayq0D0GLV+nZhkj/kNWD4cezeaYwoPTDwINuNOpN22zebxsTBKYwpKhEhxwHPZZVgzTHfJ083+PlmXI+o7ZZjzr3lR/LiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799083; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dm2jc2sIJHxPwAtppSY4dT+dJfTLSsh48EJZSPbEh08=; b=gYzZWZRi1PzpMgpPIw+jXCVLXPD9VcHahxYSWoNU7rGgeYmKCTWnAGoPpmlfkPGPsk6E7JULuQQYhzOWVkBpLR0OrOaIl3a74oB9eqmOinfgLgMrF3mHUGKRtAulDan+w8XVP/j7xXUpRCRbTqAVOt3358VjD/uzyBxBCfmwdzM= 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 1577799083130700.8947277649537; Tue, 31 Dec 2019 05:31:23 -0800 (PST) Received: from localhost ([::1]:42529 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHcH-0005Zl-MA for importer@patchew.org; Tue, 31 Dec 2019 08:31:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55900) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHC8-0005Xh-8F for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC6-0003QD-VT for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:20 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49352 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC6-0003Nv-Pa for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-XUhegzoHPDi6LHkjcx-rEw-1; Tue, 31 Dec 2019 08:04:16 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD5B4800EB8 for ; Tue, 31 Dec 2019 13:04:15 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61311620A6 for ; Tue, 31 Dec 2019 13:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dm2jc2sIJHxPwAtppSY4dT+dJfTLSsh48EJZSPbEh08=; b=JKIoUWsfmFIR2nBmTS4mez3uUBroDHwdUxHNhTT4oUo2iulpdl35OoFUGdspQyE3Zp+XNJ 5rsqlPIeQZ6fYixEP48gXgN6P1/sz0viN7DqsdlGEJJtH3leWDijOM5vrsNtCRvOxGvPrn 83H3AepHpSkzCNWm/pvhJnL5CjrrTkI= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 32/86] arm:sbsa-ref: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:16 +0100 Message-Id: <1577797450-88458-33-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: XUhegzoHPDi6LHkjcx-rEw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/sbsa-ref.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 9b5bcb5..1cba9fc 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -593,7 +593,6 @@ static void sbsa_ref_init(MachineState *machine) MachineClass *mc =3D MACHINE_GET_CLASS(machine); MemoryRegion *sysmem =3D get_system_memory(); MemoryRegion *secure_sysmem =3D g_new(MemoryRegion, 1); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); bool firmware_loaded; const CPUArchIdList *possible_cpus; int n, sbsa_max_cpus; @@ -685,9 +684,8 @@ static void sbsa_ref_init(MachineState *machine) object_unref(cpuobj); } =20 - memory_region_allocate_system_memory(ram, NULL, "sbsa-ref.ram", - machine->ram_size); - memory_region_add_subregion(sysmem, sbsa_ref_memmap[SBSA_MEM].base, ra= m); + memory_region_add_subregion(sysmem, sbsa_ref_memmap[SBSA_MEM].base, + machine->ram); =20 create_fdt(sms); =20 @@ -785,6 +783,7 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *= data) mc->block_default_type =3D IF_IDE; mc->no_cdrom =3D 1; mc->default_ram_size =3D 1 * GiB; + mc->default_ram_id =3D "sbsa-ref.ram"; mc->default_cpus =3D 4; mc->possible_cpu_arch_ids =3D sbsa_ref_possible_cpu_arch_ids; mc->cpu_index_to_instance_props =3D sbsa_ref_cpu_index_to_props; --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798426; cv=none; d=zohomail.com; s=zohoarc; b=PH8FW5YTHQeqv+DkotnhdL8uvLUfBlA/V7apExCn4CMzGArJkR6LJ7Vvtc4Gk811ACN0Rm3eKQUqBATyBkeBTXQQY8ICWn5VXfmEpaOpgnfeL8bQFMwVHjzEvkYDtrjb8oOd6Z+VXV10R6tp8W37pRPcI04ImsED6XpesaPaDS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798426; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=87VpN3EqpvI+rlxdwzPnHBP3SLPbPyMldba+XN6e6Bs=; b=K5EpIQkcqNTsEdHlnKMroUD7ywXsqrY0D6YlzNLTKK4+1RSBG8c2mQNyLUDQu5eozMEDLjcAbJzUYztsIB6tftpEXC2iOd6bdxoAoBuZul/e1QuH7QCtJlKiIMlfAAOUiV7QYvuCLMY3PmJ9yAYJQosAg/kEFNnNVz4k4KHuc08= 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 1577798426941287.19689223609043; Tue, 31 Dec 2019 05:20:26 -0800 (PST) Received: from localhost ([::1]:42374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHRh-0008L8-A3 for importer@patchew.org; Tue, 31 Dec 2019 08:20:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55999) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCA-0005a7-46 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC7-0003UF-Sf for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:21 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:54566 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC7-0003Rt-N0 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:19 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-326-7NtWFZvqOoGXurRH0IRqGw-1; Tue, 31 Dec 2019 08:04:17 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7DC9801E66 for ; Tue, 31 Dec 2019 13:04:16 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EB1B620A6 for ; Tue, 31 Dec 2019 13:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=87VpN3EqpvI+rlxdwzPnHBP3SLPbPyMldba+XN6e6Bs=; b=KYHcPecj0kSR3KX8y4Ub0D8EN4V3GbgwuZpd4qGDZzRwuJ+929dL5UkWo9ALAdcc5tigdI rVVX4EKWnKDQlUO+aC3yhN3K3QxTgXR1pG6XtesOeAWsCbb0DAZWmbwNJ9ztpxX/fOibXT XEoTpPGXNe0ukj0+BDdjxz0qzDnS+3U= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 33/86] arm:versatilepb: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:17 +0100 Message-Id: <1577797450-88458-34-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 7NtWFZvqOoGXurRH0IRqGw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/versatilepb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index e86af01..f3c4a50 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -184,7 +184,6 @@ static void versatile_init(MachineState *machine, int b= oard_id) Object *cpuobj; ARMCPU *cpu; MemoryRegion *sysmem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); qemu_irq pic[32]; qemu_irq sic[32]; DeviceState *dev, *sysctl; @@ -220,11 +219,9 @@ static void versatile_init(MachineState *machine, int = board_id) =20 cpu =3D ARM_CPU(cpuobj); =20 - memory_region_allocate_system_memory(ram, NULL, "versatile.ram", - machine->ram_size); /* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero. */ - memory_region_add_subregion(sysmem, 0, ram); + memory_region_add_subregion(sysmem, 0, machine->ram); =20 sysctl =3D qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(sysctl, "sys_id", 0x41007004); @@ -398,6 +395,7 @@ static void versatilepb_class_init(ObjectClass *oc, voi= d *data) mc->block_default_type =3D IF_SCSI; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("arm926"); + mc->default_ram_id =3D "versatile.ram"; } =20 static const TypeInfo versatilepb_type =3D { @@ -415,6 +413,7 @@ static void versatileab_class_init(ObjectClass *oc, voi= d *data) mc->block_default_type =3D IF_SCSI; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("arm926"); + mc->default_ram_id =3D "versatile.ram"; } =20 static const TypeInfo versatileab_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798930; cv=none; d=zohomail.com; s=zohoarc; b=SmQ+u+pKM3rMmFQNrGanGZa3iqhsPMzqTl6Z77igOBV5f9ESSS3A7vc7is5gEUHgaDN9Y9LhoALyIrIYUAbxDNXiBUIMQXrpm0pR82eOirPH7rLV8n25ufEUk7OvJeJkRgVT0yV6jOMdUCQgNng4wC9mUOH25SJy+zPuF/IusNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798930; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=bMaB5P1HWTWZX9QKm2IEa5DZE5rnqMQANJg4MUCks/A=; b=OjHl4k7kOCJgAyBuwdSuws9XKkS4vbLnv12eij4HDhYKmtqafF//lTY7ZRG8qXl0tLAcZUKWAZQ2WJsSxhAzjiULJ5/6snHzhAeH259w35BlcfTLv81m5z+mpCVN+YOAg2pcIOfwuAi+afORwhScIn/Ua9JGgtIRTtSwCp/tSlY= 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 1577798930308127.28331909469159; Tue, 31 Dec 2019 05:28:50 -0800 (PST) Received: from localhost ([::1]:42490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHZo-0002hV-NG for importer@patchew.org; Tue, 31 Dec 2019 08:28:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56050) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCA-0005bN-R6 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHC9-0003Yy-EV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:22 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:50673 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHC9-0003Uk-9J for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:21 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-S-zPFiSwNdStVYImvbt_Qg-1; Tue, 31 Dec 2019 08:04:18 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74C77800D41 for ; Tue, 31 Dec 2019 13:04:17 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFE6B620A6 for ; Tue, 31 Dec 2019 13:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bMaB5P1HWTWZX9QKm2IEa5DZE5rnqMQANJg4MUCks/A=; b=PX67JfAlvHPi8skaX3woGRF5KH4fI59jh8Z2NNPfiuui/Vl4hGWesCZo3ny1MgReFzDda+ KcUaqZGF+HmKQk8wu5VUHkctnnSZBgKg27Z/y94tLU9bA90zhWysl3wx1Nt8U8POuweS2T u0g8MA7CFiM9a4m5DjCsuRHV34X2Z3c= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 34/86] arm:vexpress: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:18 +0100 Message-Id: <1577797450-88458-35-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: S-zPFiSwNdStVYImvbt_Qg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/vexpress.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 4673a88..ed683ee 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -273,7 +273,6 @@ static void a9_daughterboard_init(const VexpressMachine= State *vms, { MachineState *machine =3D MACHINE(vms); MemoryRegion *sysmem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *lowram =3D g_new(MemoryRegion, 1); ram_addr_t low_ram_size; =20 @@ -283,8 +282,6 @@ static void a9_daughterboard_init(const VexpressMachine= State *vms, exit(1); } =20 - memory_region_allocate_system_memory(ram, NULL, "vexpress.highmem", - ram_size); low_ram_size =3D ram_size; if (low_ram_size > 0x4000000) { low_ram_size =3D 0x4000000; @@ -293,9 +290,10 @@ static void a9_daughterboard_init(const VexpressMachin= eState *vms, * address space should in theory be remappable to various * things including ROM or RAM; we always map the RAM there. */ - memory_region_init_alias(lowram, NULL, "vexpress.lowmem", ram, 0, low_= ram_size); + memory_region_init_alias(lowram, NULL, "vexpress.lowmem", machine->ram, + 0, low_ram_size); memory_region_add_subregion(sysmem, 0x0, lowram); - memory_region_add_subregion(sysmem, 0x60000000, ram); + memory_region_add_subregion(sysmem, 0x60000000, machine->ram); =20 /* 0x1e000000 A9MPCore (SCU) private memory region */ init_cpus(machine, cpu_type, TYPE_A9MPCORE_PRIV, 0x1e000000, pic, @@ -360,7 +358,6 @@ static void a15_daughterboard_init(const VexpressMachin= eState *vms, { MachineState *machine =3D MACHINE(vms); MemoryRegion *sysmem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 { @@ -375,10 +372,8 @@ static void a15_daughterboard_init(const VexpressMachi= neState *vms, } } =20 - memory_region_allocate_system_memory(ram, NULL, "vexpress.highmem", - ram_size); /* RAM is from 0x80000000 upwards; there is no low-memory alias for it= . */ - memory_region_add_subregion(sysmem, 0x80000000, ram); + memory_region_add_subregion(sysmem, 0x80000000, machine->ram); =20 /* 0x2c000000 A15MPCore private memory region (GIC) */ init_cpus(machine, cpu_type, TYPE_A15MPCORE_PRIV, @@ -795,6 +790,7 @@ static void vexpress_class_init(ObjectClass *oc, void *= data) mc->init =3D vexpress_common_init; mc->max_cpus =3D 4; mc->ignore_memory_transaction_failures =3D true; + mc->default_ram_id =3D "vexpress.highmem"; } =20 static void vexpress_a9_class_init(ObjectClass *oc, void *data) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798905; cv=none; d=zohomail.com; s=zohoarc; b=aU4JKoqp7KrrKRTHn2My0Kn2vT3ujsGlZhmvzqTswiZqfWIzlrsao4fiIv/L8kO4PrDQkay6a8DWKxvySEOMleuJR1ClHEADMWMfVgCCbjU+cA0RMFq4YfOwBBC+FSFFFtj7iZ4oB+ttITLTdAKgkkGjntYFf7zpUadgMTj/Z0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798905; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=J+/F5MFll7h1BejUr/Qw1LJ5J2Y8NYnLvrSS6TTi6Bs=; b=J5ZmnB0T/tzSXP0CNUqcLZTkaLJblXKibh5uDuecx6ibpmmQJpFJcTyaggp4yNLECFQh3DQ1e0n7o/FxFxmhY/CN2itwALMQfGUIYO08Rmpb38mufMV1qhD6I/otxo3kUi06OwhmoOR0CmjoI1L4DwCMfmNeBPndpcQm/CVWKFo= 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 1577798905841876.6927593067502; Tue, 31 Dec 2019 05:28:25 -0800 (PST) Received: from localhost ([::1]:42488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHZQ-00022A-5s for importer@patchew.org; Tue, 31 Dec 2019 08:28:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56297) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCE-0005hT-Tx for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCD-0003sf-Gm for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:26 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:41646 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCD-0003q4-By for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:25 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-wcucoobAOXC4eS7I5HFsNg-1; Tue, 31 Dec 2019 08:04:19 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 439961005502 for ; Tue, 31 Dec 2019 13:04:18 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE1B1620A6 for ; Tue, 31 Dec 2019 13:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J+/F5MFll7h1BejUr/Qw1LJ5J2Y8NYnLvrSS6TTi6Bs=; b=CDt5I627N5DNE5pY8VxuRDfgtLXPr112YJJ4+l3mk9DHINeF2jjtdigaWJhmdAPEt1knEJ rRI/7tywWSa6JcL8iPstbant6hR3IaQO6VgVvK6OVIz8MwhLT9NJoVxLwdmJWSYg0Gk6r5 b4EyZ4GjtqEY60lqv2bJSJfJNdS4/YU= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 35/86] arm:virt: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:19 +0100 Message-Id: <1577797450-88458-36-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: wcucoobAOXC4eS7I5HFsNg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and then map memory region provided by MachineState::ram_memdev Signed-off-by: Igor Mammedov --- hw/arm/virt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 39ab5f4..e2fbca3 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1512,7 +1512,6 @@ static void machvirt_init(MachineState *machine) MemoryRegion *sysmem =3D get_system_memory(); MemoryRegion *secure_sysmem =3D NULL; int n, virt_max_cpus; - MemoryRegion *ram =3D g_new(MemoryRegion, 1); bool firmware_loaded; bool aarch64 =3D true; bool has_ged =3D !vmc->no_ged; @@ -1701,9 +1700,8 @@ static void machvirt_init(MachineState *machine) } } =20 - memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram", - machine->ram_size); - memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram); + memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, + machine->ram); if (machine->device_memory) { memory_region_add_subregion(sysmem, machine->device_memory->base, &machine->device_memory->mr); @@ -2053,6 +2051,7 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) hc->unplug_request =3D virt_machine_device_unplug_request_cb; mc->numa_mem_supported =3D true; mc->auto_enable_numa_with_memhp =3D true; + mc->default_ram_id =3D "mach-virt.ram"; } =20 static void virt_instance_init(Object *obj) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799137; cv=none; d=zohomail.com; s=zohoarc; b=nYtzWn/ILQs4FTrW5n5Ci/Pj23Y5WiMeVn0Hpx3LWhB5CNk8vLEsJknhsK+HAV6aQbMQYcDztMhxmMlYSVLanMaNGx/57KYPm9VpUAzcyDhP8AXVtyDCNU73rJ8QCtddHiLKxEi+G1bmDSn02/KJ9Nw3erH3XHMKoOPZKOkZaf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799137; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=XZPENb3IA4781YhXeUdbz8xAW6P7ZdXSd6KqR2HW9fg=; b=GjSDCdaT/k7abyI4eeMWNfYQUD3gNQhkfVLKMXOdbTlHj27DS/VWjQeU36E8pOePuZ6MhVbkpWOw+o2gAQJkOGghCoYmLpJ8l/VOb5QL9Z9/L0N1UKL/HpqfsUhlkUJdtc40rs4ZQMuREXm3iDcCY9z/dgnGTg8uuHva3MGK5YI= 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 1577799137401241.10893651827996; Tue, 31 Dec 2019 05:32:17 -0800 (PST) Received: from localhost ([::1]:42532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHdA-0006O3-0y for importer@patchew.org; Tue, 31 Dec 2019 08:32:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56232) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCE-0005gD-2Q for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCC-0003oW-OV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:25 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:36541 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCC-0003m8-He for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:24 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-ScSUb4NHMaq_Uk3YK4ZA9Q-1; Tue, 31 Dec 2019 08:04:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 116C5107ACC5 for ; Tue, 31 Dec 2019 13:04:19 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C749620A6 for ; Tue, 31 Dec 2019 13:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XZPENb3IA4781YhXeUdbz8xAW6P7ZdXSd6KqR2HW9fg=; b=XmmkgwZQ/cHYFrrxeDU3utAebZY/RkkA39qyW/qeAlLTE1+z3iqAyMZATjqlF/3iuXS4NY AxsPr2urNCKvg01l1oNVWkFLBE74ngM+bCpLtXfwLXfR20icvQr34619WdYyIYAe1EQ6go 8GnbRNPLjwEraUNq4ATec9wsXA8bfbo= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 36/86] arm:xilinx_zynq: drop RAM size fixup Date: Tue, 31 Dec 2019 14:03:20 +0100 Message-Id: <1577797450-88458-37-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: ScSUb4NHMaq_Uk3YK4ZA9Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will complain and continue running with max RAM size supported. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix things up for user. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. Signed-off-by: Igor Mammedov --- hw/arm/xilinx_zynq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 3a0fa5b..df950fc 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -158,7 +158,6 @@ static inline void zynq_init_spi_flashes(uint32_t base_= addr, qemu_irq irq, =20 static void zynq_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; ARMCPU *cpu; MemoryRegion *address_space_mem =3D get_system_memory(); MemoryRegion *ext_ram =3D g_new(MemoryRegion, 1); @@ -168,6 +167,12 @@ static void zynq_init(MachineState *machine) qemu_irq pic[64]; int n; =20 + /* max 2GB ram */ + if (machine->ram_size > 0x80000000) { + error_report("RAM size more than %d is not supported", 0x80000000); + exit(EXIT_FAILURE); + } + cpu =3D ARM_CPU(object_new(machine->cpu_type)); =20 /* By default A9 CPUs have EL3 enabled. This board does not @@ -184,14 +189,9 @@ static void zynq_init(MachineState *machine) &error_fatal); object_property_set_bool(OBJECT(cpu), true, "realized", &error_fatal); =20 - /* max 2GB ram */ - if (ram_size > 0x80000000) { - ram_size =3D 0x80000000; - } - /* DDR remapped to address zero. */ memory_region_allocate_system_memory(ext_ram, NULL, "zynq.ext_ram", - ram_size); + machine->ram_size); memory_region_add_subregion(address_space_mem, 0, ext_ram); =20 /* 256K of on-chip memory */ @@ -300,7 +300,7 @@ static void zynq_init(MachineState *machine) sysbus_connect_irq(busdev, 0, pic[40 - IRQ_OFFSET]); sysbus_mmio_map(busdev, 0, 0xF8007000); =20 - zynq_binfo.ram_size =3D ram_size; + zynq_binfo.ram_size =3D machine->ram_size; zynq_binfo.nb_cpus =3D 1; zynq_binfo.board_id =3D 0xd32; zynq_binfo.loader_start =3D 0; --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798590; cv=none; d=zohomail.com; s=zohoarc; b=E/UOHMBbDM4BDhukDiPyKQlV+5bCi5QcNrjmuoNVczzkw+TvAqUkJhbpL0qDK4mJtKiPNuVsjJWrw7p4dGUK/NbY09fim8bVJKOIAaqpaosPuNJh58X/jI2RDshNNTKDE2Lw4VCMnL7sv6SfvTzxa9O5uV/74Byl1Rwr//G0UXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798590; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=m19fOxX7h2bliNC0m68qr2ip1wTDRq6lTo+RgGFC5Y0=; b=JkqU7QFUNoemGnZqjz6qE1HrqsYJC1+Ra8EXxWOh6EFsD1HWlsGi3M+N4OFJF4qpApQdGlDw2rEjKWE1BOOEInp37A/UTMsl9a6FChREUxs9YtVprYW9OsIx7ZN9tJIxqtAHYbgv0mTD11386r5VSZUvZ5r/6UxUv8ZySDHqcmc= 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 1577798590766139.34314496805393; Tue, 31 Dec 2019 05:23:10 -0800 (PST) Received: from localhost ([::1]:42426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHUL-0003Rv-9g for importer@patchew.org; Tue, 31 Dec 2019 08:23:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56151) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCC-0005eP-RK for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCB-0003j3-Fq for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:24 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:45675 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCB-0003h1-AN for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:23 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-114-73HpvNgRMkmp3M0Xa--Bzw-1; Tue, 31 Dec 2019 08:04:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D486518031CD for ; Tue, 31 Dec 2019 13:04:19 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AF65620A6 for ; Tue, 31 Dec 2019 13:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m19fOxX7h2bliNC0m68qr2ip1wTDRq6lTo+RgGFC5Y0=; b=MjadgHUBFooUYlj1bj2yD52R2uehy2ofjW9VqlmPaO4dwTydzF/SyXl1R8HC2IlS1xBXQo 8L+oGQFFA63Sd8y42HchTye/xMkFJjrPicK0ypg1J9dYX7G0nfgpYfYJa+hMY0TZF2rGWN J1Qx1qHx+qK5ijqDKk0FEXgDQZGeedA= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 37/86] arm:xilinx_zynq: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:21 +0100 Message-Id: <1577797450-88458-38-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 73HpvNgRMkmp3M0Xa--Bzw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/xilinx_zynq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index df950fc..0ef9688 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -160,7 +160,6 @@ static void zynq_init(MachineState *machine) { ARMCPU *cpu; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ext_ram =3D g_new(MemoryRegion, 1); MemoryRegion *ocm_ram =3D g_new(MemoryRegion, 1); DeviceState *dev; SysBusDevice *busdev; @@ -190,9 +189,7 @@ static void zynq_init(MachineState *machine) object_property_set_bool(OBJECT(cpu), true, "realized", &error_fatal); =20 /* DDR remapped to address zero. */ - memory_region_allocate_system_memory(ext_ram, NULL, "zynq.ext_ram", - machine->ram_size); - memory_region_add_subregion(address_space_mem, 0, ext_ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); =20 /* 256K of on-chip memory */ memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 * KiB, @@ -318,6 +315,7 @@ static void zynq_machine_init(MachineClass *mc) mc->no_sdcard =3D 1; mc->ignore_memory_transaction_failures =3D true; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a9"); + mc->default_ram_id =3D "zynq.ext_ram"; } =20 DEFINE_MACHINE("xilinx-zynq-a9", zynq_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800896; cv=none; d=zohomail.com; s=zohoarc; b=TZAEfgGIvuOUOmeWAQ+CFqC6yNaFRv2Jv5nmWEqOJ6LrlKLnJd29zZo6b4EmYHFw0ZkRFniAZokarCNyAFD6BCw91w3katNWrdRZRfcyz/i7mQB7Vj6Noo46ccaVM+X8SlsbbSl4RxHGpBFBtM/xlcwFM4UKytNCcyv57/grMqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800896; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=FANJD+5O4UtPM6nUPkooKYVn0mU+oVUjwVgBDtEwUVc=; b=ja4IJ007sdKx+8UpnLrtGlyo6YBKRx89BX4W22IHAbDENEccx/oxSeLp3II1z8KZY5AiADFvQ+U7rqyKrZyF4Z2e8OE2sZ85CBS6TzRHZ/jkTcWpQm1FZKfIk8ij0JnrMasSGS/B+camg5EmoeYBXUi6YrNIj1LhQudX51BR0AQ= 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 1577800896580334.50997975605344; Tue, 31 Dec 2019 06:01:36 -0800 (PST) Received: from localhost ([::1]:42912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI5W-0003h6-IC for importer@patchew.org; Tue, 31 Dec 2019 09:01:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60179) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHDV-0007GW-9s for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHDU-00004q-1D for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:45 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40920 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHDT-0008UL-RB for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:43 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-253-CTG8crcdNZW5Yo6i0MO31g-1; Tue, 31 Dec 2019 08:04:21 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1ADE801E66 for ; Tue, 31 Dec 2019 13:04:20 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28DC7620A6 for ; Tue, 31 Dec 2019 13:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FANJD+5O4UtPM6nUPkooKYVn0mU+oVUjwVgBDtEwUVc=; b=CAJpjh6CS2ltTiwYJCDxnYvA/nQIxfUP2yB1+2UyVzHPFOLpV7aWFeDwG8g2Rw8LItOKzr +uEfk1anE/xoGX19jgdLynVPlD/+l0ZVi5dWc4FRacJyTFPUis9e/ltcKstev7iSQEQYaN HjY2eEdkcS5OsNKRGhsoeVvGh4H0yYg= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 38/86] arm:xlnx-versal-virt: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:22 +0100 Message-Id: <1577797450-88458-39-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: CTG8crcdNZW5Yo6i0MO31g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/xlnx-versal-virt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 462493c..c137ff4 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -30,7 +30,6 @@ typedef struct VersalVirt { MachineState parent_obj; =20 Versal soc; - MemoryRegion mr_ddr; =20 void *fdt; int fdt_size; @@ -414,12 +413,9 @@ static void versal_virt_init(MachineState *machine) psci_conduit =3D QEMU_PSCI_CONDUIT_SMC; } =20 - memory_region_allocate_system_memory(&s->mr_ddr, NULL, "ddr", - machine->ram_size); - sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc, sizeof(s->soc), TYPE_XLNX_VERSAL); - object_property_set_link(OBJECT(&s->soc), OBJECT(&s->mr_ddr), + object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram), "ddr", &error_abort); object_property_set_int(OBJECT(&s->soc), psci_conduit, "psci-conduit", &error_abort); @@ -473,6 +469,7 @@ static void versal_virt_machine_class_init(ObjectClass = *oc, void *data) mc->max_cpus =3D XLNX_VERSAL_NR_ACPUS; mc->default_cpus =3D XLNX_VERSAL_NR_ACPUS; mc->no_cdrom =3D true; + mc->default_ram_id =3D "ddr"; } =20 static const TypeInfo versal_virt_machine_init_typeinfo =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577798740; cv=none; d=zohomail.com; s=zohoarc; b=cNEV4wPZjAcyJvsMD8VRrkjdCL/pwLbWR2KOQYh82YYPHfoHznLFKJMFek6JCq5Fd8R76rTWWHZh/RiYTHz3QvTL041qtx5wyfaPneOmOjIvcGqBz4RwLCwoYu2FnjefgTuDF8snP6ZE3kXnYKbF9SJDE0thM1Wm7qjhxNnrTWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577798740; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=+ZKgmU1TMZJTYv++FRog4sBWhFmevXlgLx2sqgYEh5E=; b=Xz6qqmpn6rwJFI4BmunfreINolTMzxLnxXb530jX0rngGAkaT7HKl+HbZGRTMY/8XvLqOmLsZA+vvtoC87BGKTFgSfZFNUj2m5VxT4CGefin15DzvWyTUcWGHJ8R+grLxT+RDAlI6KQL80VRIz952zvCxn/hLG+xHvNNuFR7E20= 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 157779874005242.53648397555503; Tue, 31 Dec 2019 05:25:40 -0800 (PST) Received: from localhost ([::1]:42452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHWj-0006qt-La for importer@patchew.org; Tue, 31 Dec 2019 08:25:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56229) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCD-0005g5-Vz for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCC-0003oe-Oh for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:25 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:32879 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCC-0003mQ-IN for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:24 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-Yo8BOmqpOyOJ_nj-EFMimA-1; Tue, 31 Dec 2019 08:04:22 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74275DB60 for ; Tue, 31 Dec 2019 13:04:21 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB1E3620A6 for ; Tue, 31 Dec 2019 13:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+ZKgmU1TMZJTYv++FRog4sBWhFmevXlgLx2sqgYEh5E=; b=b116QOuIz5CklNJcXn3TJCj77MxuGhBF+CcQtpCf5NChMGs65qh9KtIY3j7OZqdePq9UYs BJFtLwiYsJM1i1ok/sBRdz8B7QZ85hrVxSCEJkSoIur5D1rrCdFk8CGaGAkYmQAFfKtAt2 Pk9u3m93ZLk3vV3roKgiCHY+VQTxd9g= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 39/86] arm:xlnx-zcu102: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:23 +0100 Message-Id: <1577797450-88458-40-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Yo8BOmqpOyOJ_nj-EFMimA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/arm/xlnx-zcu102.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 53cfe7c..bd645ad 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -28,7 +28,6 @@ typedef struct XlnxZCU102 { MachineState parent_obj; =20 XlnxZynqMPState soc; - MemoryRegion ddr_ram; =20 bool secure; bool virt; @@ -87,13 +86,10 @@ static void xlnx_zcu102_init(MachineState *machine) ram_size); } =20 - memory_region_allocate_system_memory(&s->ddr_ram, NULL, "ddr-ram", - ram_size); - object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc= ), TYPE_XLNX_ZYNQMP, &error_abort, NULL); =20 - object_property_set_link(OBJECT(&s->soc), OBJECT(&s->ddr_ram), + object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram), "ddr-ram", &error_abort); object_property_set_bool(OBJECT(&s->soc), s->secure, "secure", &error_fatal); @@ -211,6 +207,7 @@ static void xlnx_zcu102_machine_class_init(ObjectClass = *oc, void *data) mc->ignore_memory_transaction_failures =3D true; mc->max_cpus =3D XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS; mc->default_cpus =3D XLNX_ZYNQMP_NUM_APU_CPUS; + mc->default_ram_id =3D "ddr-ram"; } =20 static const TypeInfo xlnx_zcu102_machine_init_typeinfo =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799303; cv=none; d=zohomail.com; s=zohoarc; b=Td8mY1cQFkI4u21LUr3cP1M/I4RrNVyFNe7S0XIRSuRcdnXKnYEBSjQj6JPx4Fyg001uJDVEnMaGHZvJqjjEqaWn1E+WZN4DXVjymfmE0pRAOH15KryYIt75DmV4FckHbF1mFDXLIZtAPKfN7NcQK+js16g75fmyrMEsnJzJbWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799303; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=QthNdiSaB3zyJQ7GDULbAQ5mvEHYwqQPwBVC+cEqJr8=; b=fAXlVJzJlZSlATDMQ3Xl4YVf7f4z8T7Mv0B8TJbiKQbHW8DBiLdBxmsFzOO5ZzXYPSfc7sFwjSWFfnAGaETXmgBS3QxIV7l4wPJRSz46YJWIYn8sDnXlOeGj3pNAKXsiNcY8xx84kB3WS7s/ZQw1xCkuf9QgxffnUGQY6HdA5ik= 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 1577799303500134.6378866402389; Tue, 31 Dec 2019 05:35:03 -0800 (PST) Received: from localhost ([::1]:42562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHfq-0001VC-1p for importer@patchew.org; Tue, 31 Dec 2019 08:35:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56275) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCE-0005hA-Jm for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCD-0003ru-Ab for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:26 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:54319 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCD-0003pc-64 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:25 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-h4eq0nnzO-CYOP0IpjE_uQ-1; Tue, 31 Dec 2019 08:04:23 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DE1EDB61 for ; Tue, 31 Dec 2019 13:04:22 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9C54620A6 for ; Tue, 31 Dec 2019 13:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QthNdiSaB3zyJQ7GDULbAQ5mvEHYwqQPwBVC+cEqJr8=; b=B/q6+U1knB9Rk+E0dW8eeNrmJYmFaWJxeKiUwAs704ewZpajoVYnAE1Yqus/H7f0KvoOJa FcH/jV25hUYb+m7Q+f32GAiXNHEQQUUfmQ7eiKJ9ApbWmPx6NiNSPu9dRUpQaMaPeHhO8r OkXS44MLEP8ocKrE+5H7c2HD9jA+XSc= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 40/86] s390x:s390-virtio-ccw: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:24 +0100 Message-Id: <1577797450-88458-41-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: h4eq0nnzO-CYOP0IpjE_uQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/s390x/s390-virtio-ccw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e0e2813..cbdd4ba 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -154,14 +154,12 @@ static void virtio_ccw_register_hcalls(void) virtio_ccw_hcall_early_printk); } =20 -static void s390_memory_init(ram_addr_t mem_size) +static void s390_memory_init(MemoryRegion *ram) { MemoryRegion *sysmem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); Error *local_err =3D NULL; =20 /* allocate RAM for core */ - memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size); memory_region_add_subregion(sysmem, 0, ram); =20 /* @@ -245,7 +243,7 @@ static void ccw_init(MachineState *machine) =20 s390_sclp_init(); /* init memory + setup max page size. Required for the CPU model */ - s390_memory_init(machine->ram_size); + s390_memory_init(machine->ram); =20 /* init CPUs (incl. CPU model) early so s390_has_feature() works */ s390_init_cpus(machine); @@ -471,6 +469,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) hc->plug =3D s390_machine_device_plug; hc->unplug_request =3D s390_machine_device_unplug_request; nc->nmi_monitor_handler =3D s390_nmi; + mc->default_ram_id =3D "s390.ram"; } =20 static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799090; cv=none; d=zohomail.com; s=zohoarc; b=At+B+zIwosClGyOefkNkqo5CMof9oOyTikBcGbKnlyt2Xj31LK870dMJA8MWpxRwI2SzNryBidrg8FzplKWEZY0vbJx8oZhlOq5v7ZCFmYAgyvmSyryTwvdeYKMbMHnNAJ+sEOx+H+VMj8qhQLWCvxdAdpc66tJ/ag8pc5HhMjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799090; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=a5TnTa37FilzRnyys0uiR8ZvaBdqR1XutaJ/wmt6Rr0=; b=jGVUEx52dl0ztIRZvU8c+IrtgoGgpb9au7kI71ReFnZMButx+PRlY0QnpT21Av8VxN3u1na1+qX795d995Ggza26FqX8nzTgU+2KpSDhl/0X8lkOWyOeaFR9ZGjbm+C61EbHKg5q2TAFgcgLgxh6QkLqHajIqmAQIGA7+2TFfGQ= 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 1577799090949815.5893368234779; Tue, 31 Dec 2019 05:31:30 -0800 (PST) Received: from localhost ([::1]:42530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHcP-0005fF-OR for importer@patchew.org; Tue, 31 Dec 2019 08:31:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56342) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCF-0005iO-DQ for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCE-0003wL-7A for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:27 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40636 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCE-0003tY-0f for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:26 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-sD1kknxUOLO4ew2YfsCfoQ-1; Tue, 31 Dec 2019 08:04:24 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0ACBE100550E for ; Tue, 31 Dec 2019 13:04:23 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 870BF620A6 for ; Tue, 31 Dec 2019 13:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a5TnTa37FilzRnyys0uiR8ZvaBdqR1XutaJ/wmt6Rr0=; b=L4bsOfB9zdPQgv+nKGGV9vbaNCBrM5uUoMnJ5sX/NK8Vk/yLr4d2cUizmzMnoehP1cyblk bF2im8CMdeieT1jME4M1e2kAJXh2OkxQUCLmvvPkUQ+gbCHuc+54RdvFu9R7iuKDgRVkWX HfYVFu6H95i5T14pORdYywFvf4+oyD8= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 41/86] null-machine: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:25 +0100 Message-Id: <1577797450-88458-42-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: sD1kknxUOLO4ew2YfsCfoQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/null-machine.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c index 1aa0a9a..cb47d9d 100644 --- a/hw/core/null-machine.c +++ b/hw/core/null-machine.c @@ -32,11 +32,8 @@ static void machine_none_init(MachineState *mch) } =20 /* RAM at address zero */ - if (mch->ram_size) { - MemoryRegion *ram =3D g_new(MemoryRegion, 1); - - memory_region_allocate_system_memory(ram, NULL, "ram", mch->ram_si= ze); - memory_region_add_subregion(get_system_memory(), 0, ram); + if (mch->ram) { + memory_region_add_subregion(get_system_memory(), 0, mch->ram); } =20 if (mch->kernel_filename) { @@ -52,6 +49,7 @@ static void machine_none_machine_init(MachineClass *mc) mc->init =3D machine_none_init; mc->max_cpus =3D 1; mc->default_ram_size =3D 0; + mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("none", machine_none_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799443; cv=none; d=zohomail.com; s=zohoarc; b=na2jS6Nc8ISak6iEs99lqAnTIFwMxTbOgC5IGH+nnIoc0decpE8VcZH25xxFvTfdPGMkA4NvSSXPiKo8vUo5X73u8hr2fsYeXJ6A66uJO4TOjCNJeqS2rQ5HrgoIlSAjyhmpnemZfIcI1qSfvN+AGeHUKxR6B5iDXN7KNlxMDZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799443; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=B1bQJCYl+M/Ne+UhybFCL4M7d/tlSaEX26IlcWHZjhc=; b=BdmyYw+YM4rBSItldoaEXPLMCYCYUdzIRF3gl7Ct2Xt9UX0M75fEgdp3Go3udyJZ8FvEcK1KzvjQzIBqCbAHsUxWa1RQMuwrsRkUcX8GRpCinxhmvZ4sJoJtitdzrfGFamjLJQQ0PL2EjAYse5Ay+ptnfsG7yK7DZkFDFk2998k= 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 15777994430651017.6189541426135; Tue, 31 Dec 2019 05:37:23 -0800 (PST) Received: from localhost ([::1]:42598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHi5-0004zn-Bd for importer@patchew.org; Tue, 31 Dec 2019 08:37:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56416) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCJ-0005jc-V6 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCE-0003z9-PQ for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:31 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:55311 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCE-0003wV-IY for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:26 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-7ZOfKySzO0m9RU6IgG9EKg-1; Tue, 31 Dec 2019 08:04:24 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CDAAA1005510 for ; Tue, 31 Dec 2019 13:04:23 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54C25620A6 for ; Tue, 31 Dec 2019 13:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B1bQJCYl+M/Ne+UhybFCL4M7d/tlSaEX26IlcWHZjhc=; b=XNShPplMH8BzuvW/Ae6GKWzpQZPNCTC3AO/GeU5Mdox/nSBVu5S4dMjFr0rbJOuPPdgMaF fIP+XVpSfBHWdiuL5onO0xULchMBKP1U0ZvtbUfGkth1HH+t58Zxq7bxuqC5BUXue64C0j rLa0k3byK/hUtpfOqbuLhA9usyy6wZc= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 42/86] cris:axis_dev88: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:26 +0100 Message-Id: <1577797450-88458-43-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 7ZOfKySzO0m9RU6IgG9EKg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/cris/axis_dev88.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index 940c7dd..82e9bcb 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -249,7 +249,6 @@ static struct cris_load_info li; static void axisdev88_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; CRISCPU *cpu; @@ -262,17 +261,13 @@ void axisdev88_init(MachineState *machine) struct etraxfs_dma_client *dma_eth; int i; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *phys_ram =3D g_new(MemoryRegion, 1); MemoryRegion *phys_intmem =3D g_new(MemoryRegion, 1); =20 /* init CPUs */ cpu =3D CRIS_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 - /* allocate RAM */ - memory_region_allocate_system_memory(phys_ram, NULL, "axisdev88.ram", - ram_size); - memory_region_add_subregion(address_space_mem, 0x40000000, phys_ram); + memory_region_add_subregion(address_space_mem, 0x40000000, machine->ra= m); =20 /* The ETRAX-FS has 128Kb on chip ram, the docs refer to it as the=20 internal memory. */ @@ -355,6 +350,7 @@ static void axisdev88_machine_init(MachineClass *mc) mc->init =3D axisdev88_init; mc->is_default =3D 1; mc->default_cpu_type =3D CRIS_CPU_TYPE_NAME("crisv32"); + mc->default_ram_id =3D "axisdev88.ram"; } =20 DEFINE_MACHINE("axis-dev88", axisdev88_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799412; cv=none; d=zohomail.com; s=zohoarc; b=QJDdHMm0oBJqm7noTP4FmK0ZfKLOsRd1770pJQhath1orJfZWtM1BC6nHIdvf3GXfrhysOJcSY5fnGj5RjbR7fJXVX0W3IdEhC1ncPq+z8pat9VfB+v+4Hg2xesgotcCMY2QuESaujQVfUMMEdm6Cwm9W9IVsR6xXAijl9xfWXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799412; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=unhl2yJWR3g42FM63L7ZF7mfGiwmbadt23TRRx75gVE=; b=QuZn8U5X/8WyuMyfadQtZ1f5OLjuAHsiiXYaCSJUz1rcbvHfN9/fwHPrO1VNjVxuKcRa3/Bs4DNCp9eV0RNqXGCOPTspgOGxeurBvxG/b76IhbVBrBsU9NLnWOHHVOqLhn2kF6e8+mniar7e2yZqTvWvr0OCg84fVT0giGiOg1A= 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 1577799412904918.1778138596269; Tue, 31 Dec 2019 05:36:52 -0800 (PST) Received: from localhost ([::1]:42594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHhb-0004Cc-Cl for importer@patchew.org; Tue, 31 Dec 2019 08:36:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56431) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCL-0005je-4N for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCF-00043R-JA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:31 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:53375 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCF-00040r-De for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:27 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-413-zJmU-9x9Ou-5Q3Baf8NYGA-1; Tue, 31 Dec 2019 08:04:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9A81B8024D4 for ; Tue, 31 Dec 2019 13:04:24 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2282F78E96 for ; Tue, 31 Dec 2019 13:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=unhl2yJWR3g42FM63L7ZF7mfGiwmbadt23TRRx75gVE=; b=B4MgzEdYyKecSPOLb4dLtjXgQxTpi1XQw29sV0A0peR2vqAg39ym1ySTb46i04xcU2pCOd p5WpR2c0e2AV42LaCZTgjbejAYWhPhi5HAy2VatLWvvJESpqxY7zgp5aq8IpoaY9nfk1jO yK5VrESAyI5s+Fpq6mRJVkcHzho57GM= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 43/86] hppa: drop RAM size fixup Date: Tue, 31 Dec 2019 14:03:27 +0100 Message-Id: <1577797450-88458-44-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: zJmU-9x9Ou-5Q3Baf8NYGA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will complain and continue running with max RAM size supported. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix things up for user. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/hppa/machine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 5d0de26..25f5afc 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -92,7 +92,8 @@ static void machine_hppa_init(MachineState *machine) =20 /* Limit main memory. */ if (ram_size > FIRMWARE_START) { - machine->ram_size =3D ram_size =3D FIRMWARE_START; + error_report("RAM size more than %d is not supported", FIRMWARE_ST= ART); + exit(EXIT_FAILURE); } =20 /* Main memory region. */ --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799896; cv=none; d=zohomail.com; s=zohoarc; b=KsclxgSDW7dsHGAI1CmUFlPbacsFTgO9YAAqa+5y0fudyEo03IdDmrup20GZktTd/x0R2qAZhhmJJZeShFitEflaHwRZv8Jx31Y6zKbO8ofa939wByfgduokjKyLl9xqdNLoxwEiacQSFc6i6oVeQqLcimNfK+8TLHlx+OdLDwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799896; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=O2eelqXaC3pUz3GeVceDZ8mL4XweDBc6wJNeqRDorwA=; b=KbtIcDp2SXXmW134gNtZqu6nHqWZswxzDZKPEKe53KeBCBodA1C4rkEvI4uL0X4Lytwzl6VF5xI/M4G9bzmsNUIXL6JcbV7sa/nc7fDthWG4ATx4FpJp5bCwntL2luVEZOfy6sbYRf3DnKHG4rjVvd3mmtj9k5ETCJOCBKn1PPI= 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 1577799896550662.0218013643005; Tue, 31 Dec 2019 05:44:56 -0800 (PST) Received: from localhost ([::1]:42694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHpP-0007Ve-2F for importer@patchew.org; Tue, 31 Dec 2019 08:44:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56615) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005pH-3l for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCM-00048Q-PY for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:59063 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCL-00044S-0E for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:33 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-KRUOG5qPOJKMERconQhozQ-1; Tue, 31 Dec 2019 08:04:26 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 684B618031DE for ; Tue, 31 Dec 2019 13:04:25 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3897620A6 for ; Tue, 31 Dec 2019 13:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O2eelqXaC3pUz3GeVceDZ8mL4XweDBc6wJNeqRDorwA=; b=Ws/Yn6FcJEZ6JsrDEWtpo2VqQM1deC7DiuYvX1YgX/L6WIFQMyoWffXCRULWA/qi+tFv1q 87Y0kjHfUUp4Yd4Mjxygc7yekQJe0IS69YZG+Pi0TLkXN61FDFU+YTfn6U8zfFk/lZM5oM +fBMGQAbRp4ER4HZUPkplzNszflQ9+Y= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 44/86] hppa: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:28 +0100 Message-Id: <1577797450-88458-45-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: KRUOG5qPOJKMERconQhozQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/hppa/machine.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 25f5afc..b2f7bc5 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -70,7 +70,6 @@ static void machine_hppa_init(MachineState *machine) uint64_t kernel_entry =3D 0, kernel_low, kernel_high; MemoryRegion *addr_space =3D get_system_memory(); MemoryRegion *rom_region; - MemoryRegion *ram_region; MemoryRegion *cpu_region; long i; unsigned int smp_cpus =3D machine->smp.cpus; @@ -96,11 +95,7 @@ static void machine_hppa_init(MachineState *machine) exit(EXIT_FAILURE); } =20 - /* Main memory region. */ - ram_region =3D g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ram_region, OBJECT(machine), - "ram", ram_size); - memory_region_add_subregion(addr_space, 0, ram_region); + memory_region_add_subregion(addr_space, 0, machine->ram); =20 /* Init Dino (PCI host bus chip). */ pci_bus =3D dino_init(addr_space, &rtc_irq, &serial_irq); @@ -284,6 +279,7 @@ static void machine_hppa_machine_init(MachineClass *mc) mc->is_default =3D 1; mc->default_ram_size =3D 512 * MiB; mc->default_boot_order =3D "cd"; + mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("hppa", machine_hppa_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799552; cv=none; d=zohomail.com; s=zohoarc; b=b07l1Ui7W8h86F1iwZ8RqoY+2F6aDKlgJcRQ6KEJWxHPyP3tu9lNgZrVCSC2mSZsMJv8hmNaladivFFm5tIm6pJsewGLkO7+k3MvADji+nnIC0pxOMsdnNNwRKJF/NIMUBSxCskWzqxYiXQfc81RQZGRnmCM2Mze8H8g9eDOyHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799552; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=opfuIjZlqCmZtDhrvVieAWJiLAyIbXCEzRSkjE80HNU=; b=TiBsNu2VO+5ADGhYAxFUAcaylN3L3W+vb8SnNEnZrePKwo/ipy4Ri4FWe8Yv6ltyC4ZDh+x8n+1GbsZ1/CMxG6NmJpSo4cXCx0m1+/1aT4c9dLnE1Evgnp/OitKrQwiJZWVgsdjDvOyx9rhjq5g52zJxB2YFXcRxaXwD6MXeThY= 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 1577799552181752.7923960433523; Tue, 31 Dec 2019 05:39:12 -0800 (PST) Received: from localhost ([::1]:42624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHjq-0007qu-Bs for importer@patchew.org; Tue, 31 Dec 2019 08:39:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56616) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005pJ-6Q for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCN-00049j-16 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:32535 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCM-00044y-Nh for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-aVoRrxbgOD23vRId6BqBjg-1; Tue, 31 Dec 2019 08:04:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35842477 for ; Tue, 31 Dec 2019 13:04:26 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B10D7620A6 for ; Tue, 31 Dec 2019 13:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=opfuIjZlqCmZtDhrvVieAWJiLAyIbXCEzRSkjE80HNU=; b=QvFwzcVU5a8j+UTix8cSgUAazyweDFuHDU8RX7B8p4jLHQs+XDUL0ycGgADXqJHszf+VVl szDS55pCaD0gctguWfDCRRNpwrEZ9CCUOp6BRnlQG3qWmwxNowbQhMKy+UqJV1HK8UKC8v xubu1k/R4DgwK0Z+C29CvtRXXSJh2bI= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 45/86] x86:microvm: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:29 +0100 Message-Id: <1577797450-88458-46-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: aVoRrxbgOD23vRId6BqBjg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/i386/microvm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 827ce29..7d78b99 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -167,7 +167,7 @@ static void microvm_memory_init(MicrovmMachineState *mm= s) { MachineState *machine =3D MACHINE(mms); X86MachineState *x86ms =3D X86_MACHINE(mms); - MemoryRegion *ram, *ram_below_4g, *ram_above_4g; + MemoryRegion *ram_below_4g, *ram_above_4g; MemoryRegion *system_memory =3D get_system_memory(); FWCfgState *fw_cfg; ram_addr_t lowmem; @@ -214,12 +214,8 @@ static void microvm_memory_init(MicrovmMachineState *m= ms) x86ms->below_4g_mem_size =3D machine->ram_size; } =20 - ram =3D g_malloc(sizeof(*ram)); - memory_region_allocate_system_memory(ram, NULL, "microvm.ram", - machine->ram_size); - ram_below_4g =3D g_malloc(sizeof(*ram_below_4g)); - memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram, + memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", machine->= ram, 0, x86ms->below_4g_mem_size); memory_region_add_subregion(system_memory, 0, ram_below_4g); =20 @@ -227,7 +223,8 @@ static void microvm_memory_init(MicrovmMachineState *mm= s) =20 if (x86ms->above_4g_mem_size > 0) { ram_above_4g =3D g_malloc(sizeof(*ram_above_4g)); - memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", ram, + memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", + machine->ram, x86ms->below_4g_mem_size, x86ms->above_4g_mem_size); memory_region_add_subregion(system_memory, 0x100000000ULL, @@ -502,6 +499,7 @@ static void microvm_class_init(ObjectClass *oc, void *d= ata) mc->auto_enable_numa_with_memhp =3D false; mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; mc->nvdimm_supported =3D false; + mc->default_ram_id =3D "microvm.ram"; =20 /* Avoid relying too much on kernel components */ mc->default_kernel_irqchip_split =3D true; --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799266; cv=none; d=zohomail.com; s=zohoarc; b=GsRHZE6u7h5gjVi+JtG3QM0kpODPO7RU+Usa3CyDVnWNnUohiKGDiQPuyHwHGAc7mamqQtESkShprV45S3ioYC8EecS5tt1VEK/KmXOGYyTurOyX8Zh1ZUwoFrvYzKFY9CdryWj/BEmVaz4/a+MdE0tEtMwkm2jf774KCNk9HUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799266; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=28UayHgN+n+bvnj6lYVtrYqru20kTF+ZD4V5VbbMohM=; b=M2QYasGY4RutwFjUgSZKkRZSktnXUNPLKQhIdH159vtL3vhK19Zuxd7lejwiyMi1owC8ZXrlfovSUq3ydkrVbSM5Q/JRn9UFM5jPIIrsOdljlKqBOtIh3eG7jue21XsZzslsjgY0tLfv0eXVN5+MhwZwgvXaZNQsjPjXC4cjdXA= 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 1577799266685969.9217496380982; Tue, 31 Dec 2019 05:34:26 -0800 (PST) Received: from localhost ([::1]:42560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHfF-0000nj-7s for importer@patchew.org; Tue, 31 Dec 2019 08:34:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56606) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005p0-3x for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCM-00048x-Sg for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44581 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCL-000452-TC for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-C1pZP0H7OEm5Uns6t2T9nw-1; Tue, 31 Dec 2019 08:04:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03A2F800D41 for ; Tue, 31 Dec 2019 13:04:27 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F165620A6 for ; Tue, 31 Dec 2019 13:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=28UayHgN+n+bvnj6lYVtrYqru20kTF+ZD4V5VbbMohM=; b=SJLv4YPNyEvBDp+8kzmlzWRS5Wy+2/P2jEXjOz6OBQaysVeocHvJO2Dvh+IkJ0b043B5Tq FgyTAalLltNsFFpGBlceJJXwjCJNbO3n00lkOcaCmZ5sgztjQiNuKT2TGoGyaVzgVLj8+v 8x+mljZErxFjVuxers1s1GNliOOklso= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 46/86] x86:pc: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:30 +0100 Message-Id: <1577797450-88458-47-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: C1pZP0H7OEm5Uns6t2T9nw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/i386/pc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 42014b0..aa956aa 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -935,7 +935,7 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion **ram_memory) { int linux_boot, i; - MemoryRegion *ram, *option_rom_mr; + MemoryRegion *option_rom_mr; MemoryRegion *ram_below_4g, *ram_above_4g; FWCfgState *fw_cfg; MachineState *machine =3D MACHINE(pcms); @@ -948,22 +948,20 @@ void pc_memory_init(PCMachineState *pcms, =20 linux_boot =3D (machine->kernel_filename !=3D NULL); =20 - /* Allocate RAM. We allocate it as a single memory region and use - * aliases to address portions of it, mostly for backwards compatibili= ty - * with older qemus that used qemu_ram_alloc(). + /* + * Split single memory region and use aliases to address portions of i= t, + * done for backwards compatibility with older qemus. */ - ram =3D g_malloc(sizeof(*ram)); - memory_region_allocate_system_memory(ram, NULL, "pc.ram", - machine->ram_size); - *ram_memory =3D ram; + *ram_memory =3D machine->ram; ram_below_4g =3D g_malloc(sizeof(*ram_below_4g)); - memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram, + memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", machine->= ram, 0, x86ms->below_4g_mem_size); memory_region_add_subregion(system_memory, 0, ram_below_4g); e820_add_entry(0, x86ms->below_4g_mem_size, E820_RAM); if (x86ms->above_4g_mem_size > 0) { ram_above_4g =3D g_malloc(sizeof(*ram_above_4g)); - memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", ram, + memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", + machine->ram, x86ms->below_4g_mem_size, x86ms->above_4g_mem_size); memory_region_add_subregion(system_memory, 0x100000000ULL, @@ -1951,6 +1949,7 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; mc->nvdimm_supported =3D true; mc->numa_mem_supported =3D true; + mc->default_ram_id =3D "pc.ram"; =20 object_class_property_add(oc, PC_MACHINE_DEVMEM_REGION_SIZE, "int", pc_machine_get_device_memory_region_size, NULL, --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799752; cv=none; d=zohomail.com; s=zohoarc; b=ksPzYg8zrIs+9PUV/zb5vUlbe033YA4j+QIkcl5pdN7Hfy7lnU35NwajCqa0gxwnl06M4GzvbKN3WFqGvFi7vQS/cI3k3iyB2vPwNS9sKPreAo3tw0QczO80CGHKnn4ITixV3BnBkTIXkRl8aRIOOfqpl1lvHKhw9zux4EoLeIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799752; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Os8S5mWzKZZEK83G6W/iBkxGcYC8BSaNwcUNdu16YRM=; b=cW5dxg2pYi6cFbG/eBmDtaztV3qNl1/s1Elj1ujBaqST/WHBmisOCcH5bAZEkIYBi/SfVnC6xWCWrjTrdpiiAUrOSvcGjwpTjU3rNUyHSn8Kc3g/ySz7v3a1Mh2lpf9HdBj8HDtQ8v9PNyDIARGyaNEY5hsykc44RJd6uwkE3Mo= 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 1577799752829819.5923324154719; Tue, 31 Dec 2019 05:42:32 -0800 (PST) Received: from localhost ([::1]:42666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHn5-0003ws-6Q for importer@patchew.org; Tue, 31 Dec 2019 08:42:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56579) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCQ-0005oN-Pz for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCM-00049E-TI for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:37 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53603 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCL-00045M-TL for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-238-efqOnJlwOf6ZB4LDwdkmOA-1; Tue, 31 Dec 2019 08:04:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7A5B10054E3 for ; Tue, 31 Dec 2019 13:04:27 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CDCD620A6 for ; Tue, 31 Dec 2019 13:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Os8S5mWzKZZEK83G6W/iBkxGcYC8BSaNwcUNdu16YRM=; b=TA1PZ/VBWiJHzFXuQBvvuam/ldBHmYHexd/9K/NpWIJvVo3ozhGfq6O/vEQzMcUgsgxlgQ sVdMB5E27FHA+JWgUWjOeire3nS3yE33kmb6GMEmqD+4wp30Davx2AZVrIU1c/5Wy/O6BC SGdths/zkElZ3TyoC7fvp4LeceQznVk= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 47/86] lm32:lm32_boards: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:31 +0100 Message-Id: <1577797450-88458-48-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: efqOnJlwOf6ZB4LDwdkmOA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/lm32/lm32_boards.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index 5ae308b..0d3771b 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -75,22 +75,27 @@ static void main_cpu_reset(void *opaque) =20 static void lm32_evr_init(MachineState *machine) { + MachineClass *mc =3D MACHINE_GET_CLASS(machine); const char *kernel_filename =3D machine->kernel_filename; LM32CPU *cpu; CPULM32State *env; DriveInfo *dinfo; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *phys_ram =3D g_new(MemoryRegion, 1); qemu_irq irq[32]; ResetInfo *reset_info; int i; =20 + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + /* memory map */ hwaddr flash_base =3D 0x04000000; size_t flash_sector_size =3D 256 * KiB; size_t flash_size =3D 32 * MiB; hwaddr ram_base =3D 0x08000000; - size_t ram_size =3D 64 * MiB; hwaddr timer0_base =3D 0x80002000; hwaddr uart0_base =3D 0x80006000; hwaddr timer1_base =3D 0x8000a000; @@ -107,9 +112,7 @@ static void lm32_evr_init(MachineState *machine) =20 reset_info->flash_base =3D flash_base; =20 - memory_region_allocate_system_memory(phys_ram, NULL, "lm32_evr.sdram", - ram_size); - memory_region_add_subregion(address_space_mem, ram_base, phys_ram); + memory_region_add_subregion(address_space_mem, ram_base, machine->ram); =20 dinfo =3D drive_get(IF_PFLASH, 0, 0); /* Spansion S29NS128P */ @@ -144,7 +147,7 @@ static void lm32_evr_init(MachineState *machine) =20 if (kernel_size < 0) { kernel_size =3D load_image_targphys(kernel_filename, ram_base, - ram_size); + machine->ram_size); reset_info->bootstrap_pc =3D ram_base; } =20 @@ -159,6 +162,7 @@ static void lm32_evr_init(MachineState *machine) =20 static void lm32_uclinux_init(MachineState *machine) { + MachineClass *mc =3D MACHINE_GET_CLASS(machine); const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -166,18 +170,22 @@ static void lm32_uclinux_init(MachineState *machine) CPULM32State *env; DriveInfo *dinfo; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *phys_ram =3D g_new(MemoryRegion, 1); qemu_irq irq[32]; HWSetup *hw; ResetInfo *reset_info; int i; =20 + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + /* memory map */ hwaddr flash_base =3D 0x04000000; size_t flash_sector_size =3D 256 * KiB; size_t flash_size =3D 32 * MiB; hwaddr ram_base =3D 0x08000000; - size_t ram_size =3D 64 * MiB; hwaddr uart0_base =3D 0x80000000; hwaddr timer0_base =3D 0x80002000; hwaddr timer1_base =3D 0x80010000; @@ -200,9 +208,7 @@ static void lm32_uclinux_init(MachineState *machine) =20 reset_info->flash_base =3D flash_base; =20 - memory_region_allocate_system_memory(phys_ram, NULL, - "lm32_uclinux.sdram", ram_size); - memory_region_add_subregion(address_space_mem, ram_base, phys_ram); + memory_region_add_subregion(address_space_mem, ram_base, machine->ram); =20 dinfo =3D drive_get(IF_PFLASH, 0, 0); /* Spansion S29NS128P */ @@ -238,7 +244,7 @@ static void lm32_uclinux_init(MachineState *machine) =20 if (kernel_size < 0) { kernel_size =3D load_image_targphys(kernel_filename, ram_base, - ram_size); + machine->ram_size); reset_info->bootstrap_pc =3D ram_base; } =20 @@ -252,7 +258,7 @@ static void lm32_uclinux_init(MachineState *machine) hw =3D hwsetup_init(); hwsetup_add_cpu(hw, "LM32", 75000000); hwsetup_add_flash(hw, "flash", flash_base, flash_size); - hwsetup_add_ddr_sdram(hw, "ddr_sdram", ram_base, ram_size); + hwsetup_add_ddr_sdram(hw, "ddr_sdram", ram_base, machine->ram_size); hwsetup_add_timer(hw, "timer0", timer0_base, timer0_irq); hwsetup_add_timer(hw, "timer1_dev_only", timer1_base, timer1_irq); hwsetup_add_timer(hw, "timer2_dev_only", timer2_base, timer2_irq); @@ -288,6 +294,8 @@ static void lm32_evr_class_init(ObjectClass *oc, void *= data) mc->init =3D lm32_evr_init; mc->is_default =3D 1; mc->default_cpu_type =3D LM32_CPU_TYPE_NAME("lm32-full"); + mc->default_ram_size =3D 64 * MiB; + mc->default_ram_id =3D "lm32_evr.sdram"; } =20 static const TypeInfo lm32_evr_type =3D { @@ -304,6 +312,8 @@ static void lm32_uclinux_class_init(ObjectClass *oc, vo= id *data) mc->init =3D lm32_uclinux_init; mc->is_default =3D 0; mc->default_cpu_type =3D LM32_CPU_TYPE_NAME("lm32-full"); + mc->default_ram_size =3D 64 * MiB; + mc->default_ram_id =3D "lm32_uclinux.sdram"; } =20 static const TypeInfo lm32_uclinux_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799733; cv=none; d=zohomail.com; s=zohoarc; b=jU/OAEIHqlxnQWmDS0CcaLTNSpi1QeNIPSFuMB1UCfbjqlyufLdFIWoyZuEV+3LX9BBrZwgbBKJmq/lucBjfGGp4bwyGZaTu43aTUAGxHiYfFuIeWeThh0hZMVZsYXmvjjUaSyxEh/ZREUnliHjiWn9cDn8oiLg7Sx22q5vYKxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799733; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=wrL8I1SkCsSDFF30iuDDx8C/6wBz5QBq+/mFshQ7As4=; b=S9128LxnGnNuMsPrUV+kXIWhKIWx4Q6rIiViHwAU1ykMno5oLo/oCzgm5kZwELXGf9+AsqUNRLP4i8PlHawpBwnL7By/yKbUluV60NVytQ4Hls0YTlGsspPHshlARgcbtKwSCVWvYHjydoCYqfVXRwHTqmP5f4pM6Kgx00jzHjs= 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 1577799733940262.42588900531837; Tue, 31 Dec 2019 05:42:13 -0800 (PST) Received: from localhost ([::1]:42664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHmm-0003TI-Ad for importer@patchew.org; Tue, 31 Dec 2019 08:42:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56613) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005pG-4R for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCM-00048D-OY for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:60722 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCL-00045T-0p for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-oVfP028pP12WOQa0u1ZnLA-1; Tue, 31 Dec 2019 08:04:29 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 944F41005502 for ; Tue, 31 Dec 2019 13:04:28 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B48F620A6 for ; Tue, 31 Dec 2019 13:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wrL8I1SkCsSDFF30iuDDx8C/6wBz5QBq+/mFshQ7As4=; b=eHtDv2lLHEF5eTN+xb9t8Pccse8cr6haPxmsYJAHRDoUj6ZKGJcQ/NZjlFls+MHrRd17i3 dzdeLePR8U6CbexPUq6TD9GV4I7/YceV7Yx9Unl1/gnE0OQf68lpbdrnjIke7DAln4KKlw YBM8SMyBE1f0wVSMHiyR1jQDRJd9sVA= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 48/86] lm32:milkymist: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:32 +0100 Message-Id: <1577797450-88458-49-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: oVfP028pP12WOQa0u1ZnLA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: while at it add check for user supplied RAM size and error out if it mismatches board expected value. Signed-off-by: Igor Mammedov --- hw/lm32/milkymist.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 460d322..cc9db7d 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -82,6 +82,7 @@ static void main_cpu_reset(void *opaque) static void milkymist_init(MachineState *machine) { + MachineClass *mc =3D MACHINE_GET_CLASS(machine); const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -90,22 +91,26 @@ milkymist_init(MachineState *machine) int kernel_size; DriveInfo *dinfo; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *phys_sdram =3D g_new(MemoryRegion, 1); qemu_irq irq[32]; int i; char *bios_filename; ResetInfo *reset_info; =20 + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + /* memory map */ hwaddr flash_base =3D 0x00000000; size_t flash_sector_size =3D 128 * KiB; size_t flash_size =3D 32 * MiB; hwaddr sdram_base =3D 0x40000000; - size_t sdram_size =3D 128 * MiB; =20 hwaddr initrd_base =3D sdram_base + 0x1002000; hwaddr cmdline_base =3D sdram_base + 0x1000000; - size_t initrd_max =3D sdram_size - 0x1002000; + size_t initrd_max =3D machine->ram_size - 0x1002000; =20 reset_info =3D g_malloc0(sizeof(ResetInfo)); =20 @@ -116,9 +121,7 @@ milkymist_init(MachineState *machine) =20 cpu_lm32_set_phys_msb_ignore(env, 1); =20 - memory_region_allocate_system_memory(phys_sdram, NULL, "milkymist.sdra= m", - sdram_size); - memory_region_add_subregion(address_space_mem, sdram_base, phys_sdram); + memory_region_add_subregion(address_space_mem, sdram_base, machine->ra= m); =20 dinfo =3D drive_get(IF_PFLASH, 0, 0); /* Numonyx JS28F256J3F105 */ @@ -183,7 +186,7 @@ milkymist_init(MachineState *machine) =20 if (kernel_size < 0) { kernel_size =3D load_image_targphys(kernel_filename, sdram_bas= e, - sdram_size); + machine->ram_size); reset_info->bootstrap_pc =3D sdram_base; } =20 @@ -216,6 +219,8 @@ static void milkymist_machine_init(MachineClass *mc) mc->init =3D milkymist_init; mc->is_default =3D 0; mc->default_cpu_type =3D LM32_CPU_TYPE_NAME("lm32-full"); + mc->default_ram_size =3D 128 * MiB; + mc->default_ram_id =3D "milkymist.sdram"; } =20 DEFINE_MACHINE("milkymist", milkymist_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800094; cv=none; d=zohomail.com; s=zohoarc; b=Uv6ptZ5gOvwNHhihOQ9TS/uoQ5VDdoRlB6VpOA2V+KNP5gU6LZH2gYPiQq/dsN8jegc+hm/Xn4kstFB3LEIXGO08nzbmltM+1lctRZxItlOLVeZ3DnLTusHLzri/73Ydu+Q8QzrYz9HcELNXYYtOMG+zkv8Ajyak4baKH3n5hfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800094; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=BI4pinw1p7gPRQ0IGAc6W6nku+/QIr9y6WzftwWi0DA=; b=P5ERDpDGHJBXSQb2pYmec+eNQ1KIuV1Kp91ruk8HLWmYu6qUcRX4+oKIlVhPrFD5KidkYFZvrqIMkKjHBm0Abx/0KublTBUiJi5QfeyatAICz88hWwrZzZX2xdEbbFZCU+fElvozAEDAfmqrdz2ssK5ug7cKwl1Avt+8GkkbeRw= 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 1577800094904739.1531159446878; Tue, 31 Dec 2019 05:48:14 -0800 (PST) Received: from localhost ([::1]:42736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHsb-0002hM-4R for importer@patchew.org; Tue, 31 Dec 2019 08:48:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56611) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005pF-4t for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCM-00047q-NK for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:30496 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCK-00045a-42 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:32 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-268-WGomNvZoPVaHH3FHPg73Qw-1; Tue, 31 Dec 2019 08:04:30 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61501800D41 for ; Tue, 31 Dec 2019 13:04:29 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD0C1620A6 for ; Tue, 31 Dec 2019 13:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BI4pinw1p7gPRQ0IGAc6W6nku+/QIr9y6WzftwWi0DA=; b=AMmN1Ci2HkSfQmWD6QyDP1VdgQ/196i+QubxnWQ6lte4oVYUNeD2LWCBVIWev2xKwRgejm SO4dcu/+Mafe8gxy+k6PbUKwBmx4hG61B/ETuiUtiawmSoJtdt31Qw1I/+BSPrE7end1vc C8Tisf7H9eQVOp6wK+WbsR4a9M8OZcY= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 49/86] m68k:an5206: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:33 +0100 Message-Id: <1577797450-88458-50-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: WGomNvZoPVaHH3FHPg73Qw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Acked-by: Thomas Huth --- hw/m68k/an5206.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index 54ccbe1..69a8ffa 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -33,7 +33,6 @@ static void an5206_init(MachineState *machine) uint64_t elf_entry; hwaddr entry; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 cpu =3D M68K_CPU(cpu_create(machine->cpu_type)); @@ -46,8 +45,7 @@ static void an5206_init(MachineState *machine) env->rambar0 =3D AN5206_RAMBAR_ADDR | 1; =20 /* DRAM at address zero */ - memory_region_allocate_system_memory(ram, NULL, "an5206.ram", ram_size= ); - memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); =20 /* Internal SRAM. */ memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal); @@ -89,6 +87,7 @@ static void an5206_machine_init(MachineClass *mc) mc->desc =3D "Arnewsh 5206"; mc->init =3D an5206_init; mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m5206"); + mc->default_ram_id =3D "an5206.ram"; } =20 DEFINE_MACHINE("an5206", an5206_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799573; cv=none; d=zohomail.com; s=zohoarc; b=bW8fERonlfrLF6mT+17kqsGTgOOSxgnwcFp1QPm7uHHd+ZOdbA8zKo473V5e62H7gMg96O5egD5mjWFGiLGjnK9v6zeFxH0dr4MtSyDBCMwyuKxLiW6yG0krZo8pjjaDQ8ZYfnZZ11LGxmjn5Msbxfe57Okut6I7I3yfvVjMSRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799573; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=xv1RPkuSm6t0Srcj+G3GqWiLB3MVoukuWQ9Luti8Zqc=; b=PBMvh3/RdWOJHXKIVHyTwwiKjE81U59arDuvsabwPcxMdjzOsOG2EvhDqTCfLsXGaY4uKR0FoWLUkBy5T9eZwu/zBH9XtrnxcjSjlvo24yYn7cE0cNP0Bxto4RZsJ1cn/f6/XtSF+8ve242E1E111y4RksKOpfXExbtvWeByywc= 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 1577799573763861.0024626730564; Tue, 31 Dec 2019 05:39:33 -0800 (PST) Received: from localhost ([::1]:42626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHkB-0008T0-Os for importer@patchew.org; Tue, 31 Dec 2019 08:39:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56610) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005pE-5M for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCN-00049Z-1y for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49161 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCM-00046P-NA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-240-IRi_YhoDNbmNVxBDDsf0iQ-1; Tue, 31 Dec 2019 08:04:31 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30F67477 for ; Tue, 31 Dec 2019 13:04:30 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAEFC620A6 for ; Tue, 31 Dec 2019 13:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797472; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xv1RPkuSm6t0Srcj+G3GqWiLB3MVoukuWQ9Luti8Zqc=; b=cVxboxOQlosUNBbdYyoxhiBdoUtmBe1Mi1M8QrS3IjRQZH6SAZ4M2aWTa0IXmvLHJrPfKO qEKOQzbi8l3aGt9/XTaQB05mQc/5/mVUjS04ALTjEXwuAHrr4FKBxr7AkIoSzvd1JJF1/5 hH4WkBRqdN+rIwMOlXGeQlOgfzZ9K2o= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 50/86] m68k:mcf5208: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:34 +0100 Message-Id: <1577797450-88458-51-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: IRi_YhoDNbmNVxBDDsf0iQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Acked-by: Thomas Huth --- hw/m68k/mcf5208.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index 158c5e4..d050cb7 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -234,7 +234,6 @@ static void mcf5208evb_init(MachineState *machine) qemu_irq *pic; MemoryRegion *address_space_mem =3D get_system_memory(); MemoryRegion *rom =3D g_new(MemoryRegion, 1); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 cpu =3D M68K_CPU(cpu_create(machine->cpu_type)); @@ -249,8 +248,7 @@ static void mcf5208evb_init(MachineState *machine) memory_region_add_subregion(address_space_mem, 0x00000000, rom); =20 /* DRAM at 0x40000000 */ - memory_region_allocate_system_memory(ram, NULL, "mcf5208.ram", ram_siz= e); - memory_region_add_subregion(address_space_mem, 0x40000000, ram); + memory_region_add_subregion(address_space_mem, 0x40000000, machine->ra= m); =20 /* Internal SRAM. */ memory_region_init_ram(sram, NULL, "mcf5208.sram", 16 * KiB, &error_fa= tal); @@ -354,6 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc) mc->init =3D mcf5208evb_init; mc->is_default =3D 1; mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m5208"); + mc->default_ram_id =3D "mcf5208.ram"; } =20 DEFINE_MACHINE("mcf5208evb", mcf5208evb_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799400; cv=none; d=zohomail.com; s=zohoarc; b=e8hX+bj8OiUxQI7wqTSBao3pzhpnpuxEraAL4BGUOvFPEMYGYyd3Im6Vri0SwBHKWxriHRCAEbt9aQcjmof/vIwQawZvVjvrfkm9UpW8HS+U3uPb77B0fhoxzBzOzprPYY8ydVDU1nh/9xcRCbKVhMKxroRhvNmriZLIdLwmlOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799400; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dbYTAgijA83otGOy/65k9Eb1JKTkbpEyZTmzhbwFtuM=; b=ftcc2lbCsgzRBLWA0gniVuUlzX5RzFloj1Gq27sYv42sXKp61v1J8JAs1pVcYCkGhHC2jdQmMCq9Xd+V5nEZIPzJz958BSlw5R2m+nA6vtp3TZXu0mxGzG/Kkev8PukMHRLYULEVLUW1bqJeC8ypYkEO1ZSGWRT68mjSHtlaE9I= 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 1577799400072806.0171418946578; Tue, 31 Dec 2019 05:36:40 -0800 (PST) Received: from localhost ([::1]:42592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHhN-0003pI-KE for importer@patchew.org; Tue, 31 Dec 2019 08:36:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56602) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCR-0005oo-Ui for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCO-0004CK-Qk for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:38 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:40671 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCO-00049z-I8 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-267-vp7lG3bUMYiSHem5FHPk3w-1; Tue, 31 Dec 2019 08:04:31 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2AF810054E3 for ; Tue, 31 Dec 2019 13:04:30 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7954678E96 for ; Tue, 31 Dec 2019 13:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dbYTAgijA83otGOy/65k9Eb1JKTkbpEyZTmzhbwFtuM=; b=BKNyulty99Y69xMeQMFpVa7MkQQ5JynuRy+Z1QaGG9GjxqhtfPwESMr8/Lxs8prye2/p+J LxWP2HAej7DNOkGtozgqNfSMyFZ1PPuHe5GkiNtZJcn3QuvRqmweZRP46BgV/+XZEoknX8 B/OlvgvfrZxlG7slli2MJPqOemG+PmA= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 51/86] m68k:next-cube: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:35 +0100 Message-Id: <1577797450-88458-52-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: vp7lG3bUMYiSHem5FHPk3w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Acked-by: Thomas Huth --- hw/m68k/next-cube.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index e534334..cd93d9e 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -860,7 +860,6 @@ static void next_cube_init(MachineState *machine) { M68kCPU *cpu; CPUM68KState *env; - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *rom =3D g_new(MemoryRegion, 1); MemoryRegion *mmiomem =3D g_new(MemoryRegion, 1); MemoryRegion *scrmem =3D g_new(MemoryRegion, 1); @@ -893,8 +892,7 @@ static void next_cube_init(MachineState *machine) memcpy(ns->rtc.ram, rtc_ram2, 32); =20 /* 64MB RAM starting at 0x04000000 */ - memory_region_allocate_system_memory(ram, NULL, "next.ram", ram_size); - memory_region_add_subregion(sysmem, 0x04000000, ram); + memory_region_add_subregion(sysmem, 0x04000000, machine->ram); =20 /* Framebuffer */ dev =3D qdev_create(NULL, TYPE_NEXTFB); @@ -967,6 +965,7 @@ static void next_machine_class_init(ObjectClass *oc, vo= id *data) mc->desc =3D "NeXT Cube"; mc->init =3D next_cube_init; mc->default_ram_size =3D RAM_SIZE; + mc->default_ram_id =3D "next.ram"; mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m68040"); } =20 --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799239; cv=none; d=zohomail.com; s=zohoarc; b=BFiu4LeBGTY5Azc7OsiNk/IKvnIx9c+U4nniBjzRtHX9BpklXcaYVfLVdyy0ij3VAT/0gU9qC43H+1xoADxmGpPH6Rlhaxd3ePh8HgVaqNtvDIF3c7XJaOBbOb4EQdwc0mZCX6vbbS/6XaiM2an1jww1wjpOwvyiXbO9t6/t6Bg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799239; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=KZsBA2hvcoYROt3tWDIWCuQieyiS5NVMiy7DIHg/k2Y=; b=fRY47TiE5KryMUEAQWxipYKNAC4OnmC5w9gMXeWq51jUOKs+VtJb6owBEwk0GB0IfSZqSgzm2dH6qkk5TGgJyKsTeWGgqmQ1nSt4lve/n2C1ccQku/Or2CWQ6kaAQp2mOYtToeTuHTu7rlBnfQli9GnOqxr/BxlP9hxRQ7WDTmY= 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 1577799239375520.2130017688183; Tue, 31 Dec 2019 05:33:59 -0800 (PST) Received: from localhost ([::1]:42556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHen-0000As-TJ for importer@patchew.org; Tue, 31 Dec 2019 08:33:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56609) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005pD-5N for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCO-0004D0-TZ for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:59990 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCO-0004Ar-Mj for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-FKpLwin6M5aa_VeNQjvtGQ-1; Tue, 31 Dec 2019 08:04:32 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C0B0F477 for ; Tue, 31 Dec 2019 13:04:31 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 489DB620A6 for ; Tue, 31 Dec 2019 13:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KZsBA2hvcoYROt3tWDIWCuQieyiS5NVMiy7DIHg/k2Y=; b=fjreu+UoH5RS4iV9qy1Q6LKa1gcVUwxfeQ6M3CsQx4qNXuQiIEFEZiN82gc0F50OpMz/XR JGCM0gqHqXTTDi78fvw69ibWMzcQvUorqwGloDI01AbcNR49Rllw6KCtnNqFrdmO00Rm5H VDieE+9r3xRCnDKGeWUlI13ePzfs9CE= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 52/86] mips:boston-cube: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:36 +0100 Message-Id: <1577797450-88458-53-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: FKpLwin6M5aa_VeNQjvtGQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/boston.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index ca7d813..466054e 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -427,7 +427,7 @@ static void boston_mach_init(MachineState *machine) DeviceState *dev; BostonState *s; Error *err =3D NULL; - MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg; + MemoryRegion *flash, *ddr_low_alias, *lcd, *platreg; MemoryRegion *sys_mem =3D get_system_memory(); XilinxPCIEHost *pcie2; PCIDevice *ahci; @@ -473,14 +473,12 @@ static void boston_mach_init(MachineState *machine) memory_region_init_rom(flash, NULL, "boston.flash", 128 * MiB, &err); memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0); =20 - ddr =3D g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ddr, NULL, "boston.ddr", - machine->ram_size); - memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0); + memory_region_add_subregion_overlap(sys_mem, 0x80000000, machine->ram,= 0); =20 ddr_low_alias =3D g_new(MemoryRegion, 1); memory_region_init_alias(ddr_low_alias, NULL, "boston_low.ddr", - ddr, 0, MIN(machine->ram_size, (256 * MiB))); + machine->ram, 0, + MIN(machine->ram_size, (256 * MiB))); memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0); =20 xilinx_pcie_init(sys_mem, 0, @@ -552,6 +550,7 @@ static void boston_mach_class_init(MachineClass *mc) mc->init =3D boston_mach_init; mc->block_default_type =3D IF_IDE; mc->default_ram_size =3D 1 * GiB; + mc->default_ram_id =3D "boston.ddr"; mc->max_cpus =3D 16; mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("I6400"); } --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799051; cv=none; d=zohomail.com; s=zohoarc; b=nk/R7tqzshQqL7sSsyEZHbTDGYzCCwlolQsO+xkcLpVukmZaXWB+o83pAftlUcNADm8fQOWi5Zuathu3DNoz4cpl+uXMBEKwiSaM1kezuW6TOaDF2g2xjgnWHQoRuia3D5leTJLIoxlGUT30K0kxFQuoB+FnHe7QEmaOwDJ3rLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799051; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=PkR54bRF0Y4P5S77rtDXG4SvH1PMud2iwLmYVb8C1hw=; b=Om602zYQznjlMa3ehoYOR+maGWKjqf/ZLb4yrJVnpobUKBfiv1xcDP3qhoKIqPG1M7Fres6eVxC17eW1sxvqNtVEh0iEZ2FbmzkE8Lsp7bxayjFgyedY7xhn3cYRuFTvkrZ7rxv1kivqD21JaO10mn4nRh5QAkK6Ta6ISIQA2+o= 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 157779905156470.91719403555817; Tue, 31 Dec 2019 05:30:51 -0800 (PST) Received: from localhost ([::1]:42508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHbl-0004x1-Uj for importer@patchew.org; Tue, 31 Dec 2019 08:30:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56580) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCQ-0005oO-Po for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCO-0004CC-Qv for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23849 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCO-0004Ab-IY for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-CzxTF7ENPS69lc_Hxat9Ew-1; Tue, 31 Dec 2019 08:04:33 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FDC118031CD for ; Tue, 31 Dec 2019 13:04:32 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16BEE620A6 for ; Tue, 31 Dec 2019 13:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PkR54bRF0Y4P5S77rtDXG4SvH1PMud2iwLmYVb8C1hw=; b=MNn1crcvIFV/7Px45zDilO+Y8JumV8Pk/SJAmvYcqXyBFqHskwu9iMjs1fWLtGu2FB0xal zzzSDVFIKCnj6cgD2J8T0+0r6ymQHwrarLVbry07t1mJ06eDWpvcJDWRzQkZNTvoXlQLXR wD+6A2fg8vHALx2auC29zAxZCM/kQOE= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 53/86] mips:mips_fulong2e: drop RAM size fixup Date: Tue, 31 Dec 2019 14:03:37 +0100 Message-Id: <1577797450-88458-54-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: CzxTF7ENPS69lc_Hxat9Ew-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will complain and continue running with max RAM size supported. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix things up for user. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. Signed-off-by: Igor Mammedov --- hw/mips/mips_fulong2e.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 9eaa6e2..4a5e5b4 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -296,7 +296,6 @@ static void mips_fulong2e_init(MachineState *machine) MemoryRegion *address_space_mem =3D get_system_memory(); MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); - ram_addr_t ram_size =3D machine->ram_size; long bios_size; uint8_t *spd_data; Error *err =3D NULL; @@ -315,10 +314,14 @@ static void mips_fulong2e_init(MachineState *machine) qemu_register_reset(main_cpu_reset, cpu); =20 /* TODO: support more than 256M RAM as highmem */ - ram_size =3D 256 * MiB; + if (machine->ram_size !=3D 256 * MiB) { + error_report("Invalid RAM size, should be %ld", 256 * MiB); + exit(EXIT_FAILURE); + } =20 /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_si= ze); + memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", + machine->ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); @@ -332,7 +335,7 @@ static void mips_fulong2e_init(MachineState *machine) */ =20 if (kernel_filename) { - loaderparams.ram_size =3D ram_size; + loaderparams.ram_size =3D machine->ram_size; loaderparams.kernel_filename =3D kernel_filename; loaderparams.kernel_cmdline =3D kernel_cmdline; loaderparams.initrd_filename =3D initrd_filename; @@ -378,7 +381,7 @@ static void mips_fulong2e_init(MachineState *machine) } =20 /* Populate SPD eeprom data */ - spd_data =3D spd_data_generate(DDR, ram_size, &err); + spd_data =3D spd_data_generate(DDR, machine->ram_size, &err); if (err) { warn_report_err(err); } --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799545; cv=none; d=zohomail.com; s=zohoarc; b=eNlFMMghuFmLtZbnMntq5T7DTa3KNU10bzMKqBk3kOS3TeKrRcPr6alBxMYfCkNlWkYiL0DK9YQVTuRWwt3FAidbiT0rkMKUeUs1jruWyh7DKxIvgdNKGCMMFPYvSQlBVmvbEbV4heMhTFXtI1MWonfeGbnEnppjYPep5aMjflA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799545; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=7xCibiO0DuQ8HOOkneszn2NvPyD91S4PuKX+VpAoqqA=; b=au0UEJnEAZTDLpnMUuPiSwvMSK3qmRFiPeCtj3eeO4saFO5YC8nyKHE+ILBapECshumHUlajvSiY+KCYAQ+TnoxPg+neuTZmrQdyLIkqZOlSnlkPNAwkRyRDIF7FJRXYI5PVzbBxi/YSZ6Rdo3uxWS00fdV9olPZtyj3nqBiG0E= 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 1577799545511955.3362391018161; Tue, 31 Dec 2019 05:39:05 -0800 (PST) Received: from localhost ([::1]:42622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHji-0007g6-Ns for importer@patchew.org; Tue, 31 Dec 2019 08:39:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56581) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCQ-0005oQ-Pq for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCO-0004Cg-Sr for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39818 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCO-0004AT-KA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-ZwP9VxEnN-Gt9e9sKCyQlg-1; Tue, 31 Dec 2019 08:04:34 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5BD9818031D0 for ; Tue, 31 Dec 2019 13:04:33 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D89AE620A6 for ; Tue, 31 Dec 2019 13:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7xCibiO0DuQ8HOOkneszn2NvPyD91S4PuKX+VpAoqqA=; b=fVz/3nSy+ahOWEwGG96dGDiJozSmFTyUZsUHJMNRCHomxOYQr2CMjZ2Hhzfyo+CNEMMa8z LD4GuqZO+WIGHIF17pgjieNb/lpmH/qUouFO+djHy4Ste3NnlYSGLq5Pgz9Fh2HSqgCtxR ncnBA6vwreuKkpDRb10r09n+yubkX5w= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 54/86] mips:mips_fulong2e: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:38 +0100 Message-Id: <1577797450-88458-55-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: ZwP9VxEnN-Gt9e9sKCyQlg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/mips/mips_fulong2e.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 4a5e5b4..f3fe68a 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -294,7 +294,6 @@ static void mips_fulong2e_init(MachineState *machine) const char *initrd_filename =3D machine->initrd_filename; char *filename; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); long bios_size; uint8_t *spd_data; @@ -320,13 +319,11 @@ static void mips_fulong2e_init(MachineState *machine) } =20 /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", - machine->ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); =20 - memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); =20 /* @@ -402,6 +399,7 @@ static void mips_fulong2e_machine_init(MachineClass *mc) mc->block_default_type =3D IF_IDE; mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("Loongson-2E"); mc->default_ram_size =3D 256 * MiB; + mc->default_ram_id =3D "fulong2e.ram"; } =20 DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799420; cv=none; d=zohomail.com; s=zohoarc; b=BbVFFuMvFro6v8Yn1wLFxE92sU4AUTk/5UfNPCuRZgE67i9QNxVvCoOOrEz15UCSDoh/3+ijIWg042IDTOBBDBgnW7pTyrTMUKhXJlOxDrhTK9D3JsI4wjSnNycJp/4iph2VraQQMgIMZk/okVMcRXmsj2y1N8mZwC3s4j5u8UU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799420; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=z5eKLvoSmxNeslknNBjj/cRkuMOv81tM9Z0CDkmqRCw=; b=VCXgqfMaVf/0Ct5DlAPscxbZ3y7ccEyXseiQ10jH8+w0wM3D4WkDaeHv4QN9v2OwYyT050DZx1dvd2JB30xggNppF8BGwzXARelajlshoiomZ3FuTXq063HkoOvMFZvyCQEEu5/gCNvEcc/tL2Hibm6SgNpDmXFHr1lrJsW//oY= 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 1577799420294365.36618748944113; Tue, 31 Dec 2019 05:37:00 -0800 (PST) Received: from localhost ([::1]:42596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHhi-0004NT-Ev for importer@patchew.org; Tue, 31 Dec 2019 08:36:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56607) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCS-0005p7-2N for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCQ-0004FX-N2 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:23149 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCP-0004DN-EG for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-xfYUi-qRObafNpvguZhlQQ-1; Tue, 31 Dec 2019 08:04:35 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C99D800EB8 for ; Tue, 31 Dec 2019 13:04:34 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5D7678E96 for ; Tue, 31 Dec 2019 13:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z5eKLvoSmxNeslknNBjj/cRkuMOv81tM9Z0CDkmqRCw=; b=BHjuRyq1a99wxSyoJJ8eUjR//QS9hkhbOizu8L1VVDh8AeBIn80HcYv7ZjDsRtKmL+tpJd NbzJ5I3PehLjITdufkvy2LCJq3+/B111TIm6e9NxiqiClSjvGEi4L3h0xgjhQZKxXXGZWI ETA/brIJyMmgBORl/dew9IGawvUdqWw= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 55/86] mips:mips_jazz: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:39 +0100 Message-Id: <1577797450-88458-56-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: xfYUi-qRObafNpvguZhlQQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_jazz.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 291fd6c..5136388 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -159,7 +159,6 @@ static void mips_jazz_init(MachineState *machine, ISABus *isa_bus; ISADevice *pit; DriveInfo *fds[MAX_FD]; - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); MemoryRegion *bios2 =3D g_new(MemoryRegion, 1); SysBusESPState *sysbus_esp; @@ -191,9 +190,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed =3D mips_jazz_do_transaction_failed; =20 /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "mips_jazz.ram", - machine->ram_size); - memory_region_add_subregion(address_space, 0, ram); + memory_region_add_subregion(address_space, 0, machine->ram); =20 memory_region_init_ram(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE, &error_fatal); @@ -392,6 +389,7 @@ static void mips_magnum_class_init(ObjectClass *oc, voi= d *data) mc->init =3D mips_magnum_init; mc->block_default_type =3D IF_SCSI; mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("R4000"); + mc->default_ram_id =3D "mips_jazz.ram"; } =20 static const TypeInfo mips_magnum_type =3D { @@ -408,6 +406,7 @@ static void mips_pica61_class_init(ObjectClass *oc, voi= d *data) mc->init =3D mips_pica61_init; mc->block_default_type =3D IF_SCSI; mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("R4000"); + mc->default_ram_id =3D "mips_jazz.ram"; } =20 static const TypeInfo mips_pica61_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799531; cv=none; d=zohomail.com; s=zohoarc; b=IcdEEVf6A+B1wn/6sHapKwGQeHLwiwTWXy8nfdjVS1qSCqZSqcjyZEs5Xk8HkDtvym5Hm9QRiD2dhcwQj6DhlNTQZ0ZoNraEJsth4cRPUtIMRRfb3k8y+803csZHBoPx7RnzgeVmlRumJdrjSkIfTcFbOU4c5ii8VR6pc39rjmI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799531; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=wLuo5naVQqI5MzQmvnq/Z/TlQR0qIfPl9fITLLXC2GQ=; b=RQqqLegKGMMBka4Jo/yb6RrtVSeNRJhDnaHrL9SFyYr7PEUakoekmaqCVi3oJRZ7/empA4Xx/8bAbIEA5wP0OE742KXdHMo8dq/s3CBzsO8M8PKjmFoSE8kmFi8dCSeHuGscWzmccrtgTh2xxIwQByaC3POiceWDRIVQOeSBuNY= 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 1577799531730985.2164740883472; Tue, 31 Dec 2019 05:38:51 -0800 (PST) Received: from localhost ([::1]:42620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHjW-0007JN-65 for importer@patchew.org; Tue, 31 Dec 2019 08:38:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56719) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCX-0005rd-2y for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCS-0004HL-12 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49010 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCQ-0004F1-Ma for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-_Lbi_ZlrO0CLtSn0Ma6-og-1; Tue, 31 Dec 2019 08:04:35 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB84718031DA for ; Tue, 31 Dec 2019 13:04:34 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72D94620A6 for ; Tue, 31 Dec 2019 13:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wLuo5naVQqI5MzQmvnq/Z/TlQR0qIfPl9fITLLXC2GQ=; b=H+cHaJII6TSR4Ow1UtgXfQOL8qX6aVOgdunmO7kNPrC6rpZjoGoLLFqtSYhtvcsSmQSI6N UslfFnOXM2IlbWW6k6H0W6OHcdSxZ/bMED5j6NRuqIMucC5Z88PNe4aRWiWQnNVTAX4laX zj/GwjzIepAMZ4YKcgPymfHRmeyGQcs= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 56/86] mips:mips_malta: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:40 +0100 Message-Id: <1577797450-88458-57-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: _Lbi_ZlrO0CLtSn0Ma6-og-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_malta.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 783cd99..adffa3a 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1223,7 +1223,6 @@ void mips_malta_init(MachineState *machine) char *filename; PFlashCFI01 *fl; MemoryRegion *system_memory =3D get_system_memory(); - MemoryRegion *ram_high =3D g_new(MemoryRegion, 1); MemoryRegion *ram_low_preio =3D g_new(MemoryRegion, 1); MemoryRegion *ram_low_postio; MemoryRegion *bios, *bios_copy =3D g_new(MemoryRegion, 1); @@ -1261,13 +1260,11 @@ void mips_malta_init(MachineState *machine) } =20 /* register RAM at high address where it is undisturbed by IO */ - memory_region_allocate_system_memory(ram_high, NULL, "mips_malta.ram", - ram_size); - memory_region_add_subregion(system_memory, 0x80000000, ram_high); + memory_region_add_subregion(system_memory, 0x80000000, machine->ram); =20 /* alias for pre IO hole access */ memory_region_init_alias(ram_low_preio, NULL, "mips_malta_low_preio.ra= m", - ram_high, 0, MIN(ram_size, 256 * MiB)); + machine->ram, 0, MIN(ram_size, 256 * MiB)); memory_region_add_subregion(system_memory, 0, ram_low_preio); =20 /* alias for post IO hole access, if there is enough RAM */ @@ -1275,7 +1272,7 @@ void mips_malta_init(MachineState *machine) ram_low_postio =3D g_new(MemoryRegion, 1); memory_region_init_alias(ram_low_postio, NULL, "mips_malta_low_postio.ram", - ram_high, 512 * MiB, + machine->ram, 512 * MiB, ram_size - 512 * MiB); memory_region_add_subregion(system_memory, 512 * MiB, ram_low_postio); @@ -1447,6 +1444,7 @@ static void mips_malta_machine_init(MachineClass *mc) #else mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("24Kf"); #endif + mc->default_ram_id =3D "mips_malta.ram"; } =20 DEFINE_MACHINE("malta", mips_malta_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799874; cv=none; d=zohomail.com; s=zohoarc; b=iOpUO2RSei8Tt2/leEYZmUCZvdU0XP9BcKu9yyZNYywGFsIqwyP/xeXmvB671yG/TW8+jdBlTLDBXr29+9LakXbdxhVwuN1MiIZpeQGbd/fkZqiryk+MQfnPMBAyxqPtFbzDHN4RogbrB3YnCOZwQbLLDsZk87iom5jzH9+ph6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799874; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=MDNwLJ044g+O+8GeTRaa6og2q+g/2cxff7E/mWFvIGU=; b=mjqfrpQ16KDIQHfy64EKbJPUySVRYr93rTk5nppeB6cH5/SSFuKVsAq9f4o99QwsfuhM2j0hx/CvZsEnScJjHTTisXpZgC9YOveZn+BZ6a5GP2mo2gQf0SHLxPS050H4behWorjXbbnN2nCa1S19Zphz/YNTxxFP860xUMxO5s8= 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 1577799874433144.90680004996193; Tue, 31 Dec 2019 05:44:34 -0800 (PST) Received: from localhost ([::1]:42690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHp2-0006yf-Ih for importer@patchew.org; Tue, 31 Dec 2019 08:44:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56723) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCX-0005rf-2G for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCS-0004IZ-IV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:31573 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCR-0004GE-Vx for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-277-odexrSEtP1awIlLN7cg4Ew-1; Tue, 31 Dec 2019 08:04:36 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BAB4C107ACC4 for ; Tue, 31 Dec 2019 13:04:35 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40D09620A6 for ; Tue, 31 Dec 2019 13:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MDNwLJ044g+O+8GeTRaa6og2q+g/2cxff7E/mWFvIGU=; b=DB6wOWC7P0ssFRyC4vylG4MRIHiGP9B/QUlowjeML+5ZqldHGTyovCFj546Nh9SBsvCAQU QqQqXTs6Vn8VJdUBYo4Bt5W/IQSSMpGvfKsuNbv2nOIDW49VTdECj21vIgd0OOxQ1oWnG0 e8Mm0S1+Qd6BJIC4AbARx3u+yF1aElY= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 57/86] mips:mips_mipssim: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:41 +0100 Message-Id: <1577797450-88458-58-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: odexrSEtP1awIlLN7cg4Ew-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_mipssim.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 282bbec..be3972f 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -142,14 +142,12 @@ static void mipsnet_init(int base, qemu_irq irq, NICI= nfo *nd) static void mips_mipssim_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; char *filename; MemoryRegion *address_space_mem =3D get_system_memory(); MemoryRegion *isa =3D g_new(MemoryRegion, 1); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); MIPSCPU *cpu; CPUMIPSState *env; @@ -166,13 +164,11 @@ mips_mipssim_init(MachineState *machine) qemu_register_reset(main_cpu_reset, reset_info); =20 /* Allocate RAM. */ - memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram", - ram_size); memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); =20 - memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); =20 /* Map the BIOS / boot exception handler. */ memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); @@ -199,7 +195,7 @@ mips_mipssim_init(MachineState *machine) } =20 if (kernel_filename) { - loaderparams.ram_size =3D ram_size; + loaderparams.ram_size =3D machine->ram_size; loaderparams.kernel_filename =3D kernel_filename; loaderparams.kernel_cmdline =3D kernel_cmdline; loaderparams.initrd_filename =3D initrd_filename; @@ -237,6 +233,7 @@ static void mips_mipssim_machine_init(MachineClass *mc) #else mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("24Kf"); #endif + mc->default_ram_id =3D "mips_mipssim.ram"; } =20 DEFINE_MACHINE("mipssim", mips_mipssim_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799698; cv=none; d=zohomail.com; s=zohoarc; b=gsxyCMJe6xXY4/5zYeiNIEvxdQ8FI7o5QHi/eMf5B09WN8uMqhisyg5Vfr1zyecDEZOZv9VecQaJPeaWqKpAmeuBwFz0eZwZRPswA2aglayIA4K6KsgvOhCokbzweeJRX88tE4yJpzryX+FAHequI4JD+Ld4LPWjHfBvI3nmNFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799698; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hFQ4xBmnEBht7XvkseDuNIY2IDkul95ZAGH47gI0iJY=; b=XtcOOzNVzS6OR54wCG1HqAFYDd4ay5tbgXh0boiMIyKSdfSV7AV9vKk7DBXQDn4jCjtNNvekSFk2oxJHo9YoCMThFINicHDs56ar0lmcpmrafYJ4yZksyct53xpF5QKeN1jBsKnrMiBZNxzQFS89Q7nOV6/ZAE2KziZ6WZ7o3FQ= 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 1577799698009697.4896668222204; Tue, 31 Dec 2019 05:41:38 -0800 (PST) Received: from localhost ([::1]:42662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHmC-0002vT-BE for importer@patchew.org; Tue, 31 Dec 2019 08:41:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56721) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCX-0005re-1Y for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCS-0004Ie-Id for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27841 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCR-0004GC-Uo for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-D9nzNTQpOJuPqEwSUUVERg-1; Tue, 31 Dec 2019 08:04:37 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87C66477 for ; Tue, 31 Dec 2019 13:04:36 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F844620A6 for ; Tue, 31 Dec 2019 13:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hFQ4xBmnEBht7XvkseDuNIY2IDkul95ZAGH47gI0iJY=; b=gLnWHUB5xO9jLG+hBvCm3AulfW3M/Bx+0CpLxdQybfecSoS65200X8La4TCFYmSo3irIbM JH1w6FL532L2755zgpbyhSlUKh5H2532aV4ImYA0Jn/Tl2rzXsNWokp13Jw0iWm6fvksub e4FgTWOQZXBuhetlcXn9rwR5JYJ8fyU= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 58/86] mips:mips_r4k: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:42 +0100 Message-Id: <1577797450-88458-59-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: D9nzNTQpOJuPqEwSUUVERg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_r4k.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index fd926a3..69b6549 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -171,13 +171,11 @@ static const int sector_len =3D 32 * KiB; static void mips_r4k_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; char *filename; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios; MemoryRegion *iomem =3D g_new(MemoryRegion, 1); MemoryRegion *isa_io =3D g_new(MemoryRegion, 1); @@ -203,14 +201,12 @@ void mips_r4k_init(MachineState *machine) qemu_register_reset(main_cpu_reset, reset_info); =20 /* allocate RAM */ - if (ram_size > 256 * MiB) { + if (machine->ram_size > 256 * MiB) { error_report("Too much memory for this machine: %" PRId64 "MB," " maximum 256MB", ram_size / MiB); exit(1); } - memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_si= ze); - - memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); =20 memory_region_init_io(iomem, NULL, &mips_qemu_ops, NULL, "mips-qemu", 0x10000); @@ -261,7 +257,7 @@ void mips_r4k_init(MachineState *machine) g_free(filename); =20 if (kernel_filename) { - loaderparams.ram_size =3D ram_size; + loaderparams.ram_size =3D machine->ram_size; loaderparams.kernel_filename =3D kernel_filename; loaderparams.kernel_cmdline =3D kernel_cmdline; loaderparams.initrd_filename =3D initrd_filename; @@ -316,7 +312,7 @@ static void mips_machine_init(MachineClass *mc) #else mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("24Kf"); #endif - + mc->default_ram_id =3D "mips_r4k.ram"; } =20 DEFINE_MACHINE("mips", mips_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799855; cv=none; d=zohomail.com; s=zohoarc; b=h2ut95MDNNI33qGgwVAwpIlpIv/u1itoVP+B2afJa9TmnvJTlqivCAFE3ekdqzTp3uuOANbcH5DHy0PA1N+epJ81BExR4rs+G7FcZisfn6W0HeuJplMFQ2tCTxmS5luBFcsZGpM8B+bNgryc2quJyz6sJYHfU5Ii508MguF/wGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799855; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=jF8uPId+5fqxcR5sLbjqM5UR26DFj2imdkGk9o4x/9c=; b=e0+qRIut7SiHGmei7mtGsnSyGkTVwk1SjbQOfXKuZokfKBgJYjcdKIdTT26IyNup2Upz/khnnLwfIzo3AkfWSeLip8r020gsmYlta+SGKl/ZyxXFG1Bsl0k1Eo4SRRTGVi13nzIGTUV8jOe+2/d4XsBMjFB9+agA6LZ34AmznFI= 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 1577799855153463.23558220649863; Tue, 31 Dec 2019 05:44:15 -0800 (PST) Received: from localhost ([::1]:42688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHoj-0006VK-6U for importer@patchew.org; Tue, 31 Dec 2019 08:44:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56716) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCW-0005ra-VE for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCT-0004KY-0y for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:28344 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCS-0004Hw-LV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-szK-C8QMPrGykTn4E63slg-1; Tue, 31 Dec 2019 08:04:38 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5607D107ACC5 for ; Tue, 31 Dec 2019 13:04:37 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D15C978E96 for ; Tue, 31 Dec 2019 13:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jF8uPId+5fqxcR5sLbjqM5UR26DFj2imdkGk9o4x/9c=; b=L8B6FhpeO8gEAkPHVzq1JZtnnwntAtTNlAV8qmreXQok9dfEsEvJKNQhuReRfJMpXSNomi w4Q+8mLgSLdlU10BF27wzClyrb00QFXNqhQ9oVG8h/67x0CaMZd5C0kMkgpX0uL1t7XpY1 TAyjymFVQpJZ/01WjWvk+Bk4LW/w2tg= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 59/86] ppc:e500: drop RAM size fixup Date: Tue, 31 Dec 2019 14:03:43 +0100 Message-Id: <1577797450-88458-60-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: szK-C8QMPrGykTn4E63slg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will complain and continue running with max RAM size supported. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix things up for user. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. While at it, replace usage of global ram_size with machine->ram_size Signed-off-by: Igor Mammedov --- hw/ppc/e500.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 12b6a5b..aac4aba 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -906,12 +906,14 @@ void ppce500_init(MachineState *machine) =20 env =3D firstenv; =20 - /* Fixup Memory size on a alignment boundary */ - ram_size &=3D ~(RAM_SIZES_ALIGN - 1); - machine->ram_size =3D ram_size; + if (!QEMU_IS_ALIGNED(machine->ram_size, RAM_SIZES_ALIGN)) { + error_report("RAM size must be multiple of %ld", RAM_SIZES_ALIGN); + exit(EXIT_FAILURE); + } =20 /* Register Memory */ - memory_region_allocate_system_memory(ram, NULL, "mpc8544ds.ram", ram_s= ize); + memory_region_allocate_system_memory(ram, NULL, "mpc8544ds.ram", + machine->ram_size); memory_region_add_subregion(address_space_mem, 0, ram); =20 dev =3D qdev_create(NULL, "e500-ccsr"); @@ -1083,7 +1085,7 @@ void ppce500_init(MachineState *machine) kernel_base =3D cur_base; kernel_size =3D load_image_targphys(machine->kernel_filename, cur_base, - ram_size - cur_base); + machine->ram_size - cur_base); if (kernel_size < 0) { error_report("could not load kernel '%s'", machine->kernel_filename); @@ -1097,7 +1099,7 @@ void ppce500_init(MachineState *machine) if (machine->initrd_filename) { initrd_base =3D (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK; initrd_size =3D load_image_targphys(machine->initrd_filename, init= rd_base, - ram_size - initrd_base); + machine->ram_size - initrd_base); =20 if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", @@ -1115,7 +1117,7 @@ void ppce500_init(MachineState *machine) * ensures enough space between kernel and initrd. */ dt_base =3D (loadaddr + payload_size + DTC_LOAD_PAD) & ~DTC_PAD_MASK; - if (dt_base + DTB_MAX_SIZE > ram_size) { + if (dt_base + DTB_MAX_SIZE > machine->ram_size) { error_report("not enough memory for device tree"); exit(1); } --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800414; cv=none; d=zohomail.com; s=zohoarc; b=XQIVOl1r7qvAmFpU8r3xTzmZvXf/WUdsLCBtjYIaqWOV59ogvZiFj0qfJyr0bmMoPrShb1WpqRqWcg0sFjWWiEH27DibaXRbaEBm25KV2dI49dUq10ADsiddUTxpMjr+PwGobQoMikv+UsFxkQFgOlq6xlkVNq22MOhwQYWJdUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800414; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=0rPyxsxw4L/BL8Pc/K3RbccNznP/nFrVbW3SQyCuA1s=; b=J8qcbbBWlFl81kyw9M5tZZ9BgtMjNjaAxGMAMTfQ3kuOU/gxJMtt7/Nq3/PP3Ed6e/g97Pc+uKv6UCj/OJjbhzK+cXj6dIHcIiyu6LBT4vyPD/fI6pH+qNvFs6R8ego3PbEI/vvQ3o4P+qhOESv54dB1UZbdjy5Qto5eMcSfet4= 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 1577800414878668.5751562976602; Tue, 31 Dec 2019 05:53:34 -0800 (PST) Received: from localhost ([::1]:42804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHxl-0001OM-8r for importer@patchew.org; Tue, 31 Dec 2019 08:53:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56832) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCY-0005uE-KS for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCX-0004OI-0v for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:50632 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCW-0004Iu-Qr for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:44 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-322-1usKveYcO8SpU4rDz5wyHg-1; Tue, 31 Dec 2019 08:04:38 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23B8610054E3 for ; Tue, 31 Dec 2019 13:04:38 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F1D2620A6 for ; Tue, 31 Dec 2019 13:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0rPyxsxw4L/BL8Pc/K3RbccNznP/nFrVbW3SQyCuA1s=; b=SxwgivcIX10Y6bXffTyCr/W93Plr8sjRKith6y1pk1Nf0885RlxFOu9wB7yF3Q2dcUK8S4 cld0B8BCDcfeqbzUozadl/1Xi8c2IFkWZyeKaiC6QiYeaLcJkzDOHAlCBt6qe1XlpuxMuJ /O7zagvzkL38b3gppTKKvmQuiTTJRQI= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 60/86] ppc:e500: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:44 +0100 Message-Id: <1577797450-88458-61-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 1usKveYcO8SpU4rDz5wyHg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/ppc/e500.c | 5 +---- hw/ppc/e500plat.c | 1 + hw/ppc/mpc8544ds.c | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index aac4aba..432feae 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -831,7 +831,6 @@ static void ppce500_power_off(void *opaque, int line, i= nt on) void ppce500_init(MachineState *machine) { MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); PPCE500MachineState *pms =3D PPCE500_MACHINE(machine); const PPCE500MachineClass *pmc =3D PPCE500_MACHINE_GET_CLASS(machine); PCIBus *pci_bus; @@ -912,9 +911,7 @@ void ppce500_init(MachineState *machine) } =20 /* Register Memory */ - memory_region_allocate_system_memory(ram, NULL, "mpc8544ds.ram", - machine->ram_size); - memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0, machine->ram); =20 dev =3D qdev_create(NULL, "e500-ccsr"); object_property_add_child(qdev_get_machine(), "e500-ccsr", diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c index 7078386..bddd5e7 100644 --- a/hw/ppc/e500plat.c +++ b/hw/ppc/e500plat.c @@ -97,6 +97,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, = void *data) mc->init =3D e500plat_init; mc->max_cpus =3D 32; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("e500v2_v30"); + mc->default_ram_id =3D "mpc8544ds.ram"; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ETSEC_COMMON); } =20 diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c index c2c5e11..8117750 100644 --- a/hw/ppc/mpc8544ds.c +++ b/hw/ppc/mpc8544ds.c @@ -55,6 +55,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, = void *data) mc->init =3D mpc8544ds_init; mc->max_cpus =3D 15; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("e500v2_v30"); + mc->default_ram_id =3D "mpc8544ds.ram"; } =20 #define TYPE_MPC8544DS_MACHINE MACHINE_TYPE_NAME("mpc8544ds") --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800258; cv=none; d=zohomail.com; s=zohoarc; b=FPLgFsPdPOWWsNQPgGmUVRpzJyXnQkgds0vS1/XkBCdsIEISSPQN54zxeg0vjcpEoTi6/574Cbr/tBqoc8GeXEaI8lNCAPilLWzLObRKcU9yWQ5v6RtAIRgDGCP2EQNKmI/6lAIxSj3sWOvGKRv3YKgH5qBklCxyfplFaf83R/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800258; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ftZsxWWoC3jF8Pnyp4c7z2ZCTmO7Y8MdikK7IW1jqpc=; b=BqU8WfkZicU4jan7dUeZ6dcFItAh4GNXHf4+rLAcsY/0RosuxNlQ0OwXHltJOaKG51Q2RKKL8Dbr/SLHWctCj13H4jiWvmnCY16auuhwHPXS9yUXu2dfwP6XoYlyKpV+rzTiwOTJZHLgBcCtWLb0rPhyj7U6URNvX1ASQYSaSgI= 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 1577800258215744.3883116867041; Tue, 31 Dec 2019 05:50:58 -0800 (PST) Received: from localhost ([::1]:42776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHvE-0006GK-QI for importer@patchew.org; Tue, 31 Dec 2019 08:50:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56847) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCY-0005ul-Qg for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCX-0004PO-87 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:49703 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCW-0004Mu-VA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-71-rDl2nDVrOLKlTsD93OciVw-1; Tue, 31 Dec 2019 08:04:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4C6C800D41 for ; Tue, 31 Dec 2019 13:04:38 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CB13620A6 for ; Tue, 31 Dec 2019 13:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ftZsxWWoC3jF8Pnyp4c7z2ZCTmO7Y8MdikK7IW1jqpc=; b=BHQKsFfWhwewS7orMlgrww7YRmj3fl1IEWWDlrNKrqCGnqXd8SzZQwlFFv47E6dJciP8CD FjLfVb61h689McOTLgqgL6ceNbpq0XORlD9ojOX/qggGaekrY5wzM7nEPhMJIJVRuOlmH6 G0+G6e1mcd+Syj+0cRG8tqkxczTAdAw= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 61/86] ppc:mac_newworld: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:45 +0100 Message-Id: <1577797450-88458-62-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: rDl2nDVrOLKlTsD93OciVw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/ppc/mac_newworld.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 3594517..2546d33 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -118,7 +118,7 @@ static void ppc_core99_init(MachineState *machine) char *filename; IrqLines *openpic_irqs; int linux_boot, i, j, k; - MemoryRegion *ram =3D g_new(MemoryRegion, 1), *bios =3D g_new(MemoryRe= gion, 1); + MemoryRegion *bios =3D g_new(MemoryRegion, 1); hwaddr kernel_base, initrd_base, cmdline_base =3D 0; long kernel_size, initrd_size; UNINHostState *uninorth_pci; @@ -152,8 +152,7 @@ static void ppc_core99_init(MachineState *machine) } =20 /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "ppc_core99.ram", ram_= size); - memory_region_add_subregion(get_system_memory(), 0, ram); + memory_region_add_subregion(get_system_memory(), 0, machine->ram); =20 /* allocate and load BIOS */ memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE, @@ -586,6 +585,7 @@ static void core99_machine_class_init(ObjectClass *oc, = void *data) #else mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("7400_v2.9"); #endif + mc->default_ram_id =3D "ppc_core99.ram"; mc->ignore_boot_device_suffixes =3D true; fwc->get_dev_path =3D core99_fw_dev_path; } --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799673; cv=none; d=zohomail.com; s=zohoarc; b=RcjWPME1mObqH25Uk8iUacm9umtBz82jtO0rT1mZoPRfNNu4+Vj/Apnl0lUJjzOMtTjphaP2v//TnKkdZH57SpKVCAXg9JDgEs1OCvE2WVrTpd3/II6mGUxMubzGP7vo9FoJqf1mZPEYBWiXvMqQ6Q+faowmmQKMwhqtWzprw2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799673; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=1qbUUGrqrGf28pUJFUGCnmxEZcyCOFuqIRng9Iri2ww=; b=mlfJHj6w0aOl63Qz7/TlJskfV3tPpO4KbDqYtq32f5CkTWnUtLb9ibx5KcZxUC6cTEsqzYB7W1VWdRDF3/Q+2ikOkzCli/RqvOlbDe0FmoemsabQLxBCeo/0yMLstLSIwB6urTakd8yCq6as8lbRmOdqYXKVdZWgqMTDqtaTvSg= 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 1577799673978401.7501540760112; Tue, 31 Dec 2019 05:41:13 -0800 (PST) Received: from localhost ([::1]:42660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHlo-0002QR-Nl for importer@patchew.org; Tue, 31 Dec 2019 08:41:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56828) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCY-0005uC-JV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCX-0004PI-Ak for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:53182 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCW-0004Mx-VV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-155-6h69OPjVNOSISKhzSAWC7Q-1; Tue, 31 Dec 2019 08:04:40 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B49C5100550E for ; Tue, 31 Dec 2019 13:04:39 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A036620A6 for ; Tue, 31 Dec 2019 13:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1qbUUGrqrGf28pUJFUGCnmxEZcyCOFuqIRng9Iri2ww=; b=JNGywn22fsZfO1gJDlNgudyhd93LxZj0R12Y+b47txOW7bGtvBay1R7/Qwc1qmk+OvpTRi 6kLA08vXs+yZXdeQhTlUvGWipzTDsZlQbUhWOtfJIaw+DnjG4oR7P/gHcs7gQ7ZXb/K8+g lcoVb8QABq0KYodxRoUNQgT489+3DFY= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 62/86] ppc:mac_oldworld: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:46 +0100 Message-Id: <1577797450-88458-63-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 6h69OPjVNOSISKhzSAWC7Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/ppc/mac_oldworld.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 0fa680b..2be0602 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -91,7 +91,6 @@ static void ppc_heathrow_init(MachineState *machine) CPUPPCState *env =3D NULL; char *filename; int linux_boot, i; - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base, cmdline_base =3D 0; int32_t kernel_size, initrd_size; @@ -127,9 +126,7 @@ static void ppc_heathrow_init(MachineState *machine) exit(1); } =20 - memory_region_allocate_system_memory(ram, NULL, "ppc_heathrow.ram", - ram_size); - memory_region_add_subregion(sysmem, 0, ram); + memory_region_add_subregion(sysmem, 0, machine->ram); =20 /* allocate and load BIOS */ memory_region_init_ram(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE, @@ -446,6 +443,7 @@ static void heathrow_class_init(ObjectClass *oc, void *= data) mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("750_v3.1"); mc->default_display =3D "std"; mc->ignore_boot_device_suffixes =3D true; + mc->default_ram_id =3D "ppc_heathrow.ram"; fwc->get_dev_path =3D heathrow_fw_dev_path; } =20 --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800555; cv=none; d=zohomail.com; s=zohoarc; b=AVzSFzCZgtXPXP8E/2dsygTQTtvXL3snD7/wmGDjApkW2NY37NzxPFsCcfw+dI1tWV4gXoNluoJ/T4MfbM8d4M9x5TiI8XZ1m5j19/LOFecLWZYB3xvpBIommOrBJLm50kAnZxEsOtSDEWhte0c58AEgsX9O9eoDRYbPQiV8XY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800555; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ExbM5OGtJdj+rUFSl6KHm5sc5tKjnopsn7zA/zbbJZA=; b=VVjeSbHSZHsYH7PvvAbKvIQdQ2H8HI16wCW2wHYPiEQV+1hvOnZJWx/fvmUFlff2+2QhXGa4h41sBtRkz+OtJjGj33AsZRz6orBHfNJFdTaT0mMqy72Q5RuycGgab+6mFsTBJPr19c5sJYH2cVAOKbm3UmFEJ29UpIPxhJSaXOk= 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 1577800555206795.3673433426399; Tue, 31 Dec 2019 05:55:55 -0800 (PST) Received: from localhost ([::1]:42828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI01-00053V-Hj for importer@patchew.org; Tue, 31 Dec 2019 08:55:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56846) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCY-0005uj-ST for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCX-0004PW-AV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:46 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20478 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCW-0004N8-Ui for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-140-Dy2dS16ONh6xgaSXeGKUwA-1; Tue, 31 Dec 2019 08:04:41 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80FCB800D4E for ; Tue, 31 Dec 2019 13:04:40 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08572620A6 for ; Tue, 31 Dec 2019 13:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ExbM5OGtJdj+rUFSl6KHm5sc5tKjnopsn7zA/zbbJZA=; b=KRRpDDD9gzdTQ+qmg32zZihZjpnpX2vODwavPgAAaOYUsSKVcN/JzfzyC4SdLGwS7Zxt+j xJNwU88EWXNodlgpIGj2VJ0+bhDXSX1bf6KAeRuVTz+TixtEktUl57ccCeVtMb34Vx03OV yqs09afC2PksDsa3MXkFMn8dut9xE5s= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 63/86] ppc:pnv: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:47 +0100 Message-Id: <1577797450-88458-64-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Dy2dS16ONh6xgaSXeGKUwA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/ppc/pnv.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index f77e7ca..8eaa7de 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -676,7 +676,6 @@ static void pnv_init(MachineState *machine) { PnvMachineState *pnv =3D PNV_MACHINE(machine); MachineClass *mc =3D MACHINE_GET_CLASS(machine); - MemoryRegion *ram; char *fw_filename; long fw_size; int i; @@ -688,11 +687,7 @@ static void pnv_init(MachineState *machine) if (machine->ram_size < (1 * GiB)) { warn_report("skiboot may not work with < 1GB of RAM"); } - - ram =3D g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ram, NULL, "pnv.ram", - machine->ram_size); - memory_region_add_subregion(get_system_memory(), 0, ram); + memory_region_add_subregion(get_system_memory(), 0, machine->ram); =20 /* * Create our simple PNOR device @@ -1811,6 +1806,7 @@ static void pnv_machine_class_init(ObjectClass *oc, v= oid *data) * enough to fit the maximum initrd size at it's load address */ mc->default_ram_size =3D INITRD_LOAD_ADDR + INITRD_MAX_SIZE; + mc->default_ram_id =3D "pnv.ram"; ispc->print_info =3D pnv_pic_print_info; =20 pnv_machine_class_props_init(oc); --=20 2.7.4 From nobody Sun Feb 8 12:42:59 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800212; cv=none; d=zohomail.com; s=zohoarc; b=YPWJv0zvX6hKFdJ8lapAqbFRBbnK2F+O+hngGXHdLnVpedA1dsp3azyov6lSrg5Gek3qSjjDgPryLFbp1mo4o6UupfElGYzTjDY81AplmDslONalxcZBbFyZOk0L2wD/yx+tovkr9p2XncvrI02A8Ez/FdDGs6u5wupuZV99R98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800212; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=pZBavH5WV/00qROhH5w4eqiIIPNBMGIB2TbRu8PLVoI=; b=AocSVruxk7dEjj08yzvNBh+g3UfKNWwOnhFf9iXo12gA8vvzl42CZPwj1/1F5qooCKg29YTqxgKAjHkZdYR34kbiF9QBDIfGQsQ1VTQylqVP+Iei4++6ILDLZhppPRwn4sMj3Gt4zdrPowWBbBqZx85U/H+GWeKwlC4k1h3zONU= 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 1577800212946704.5445330225261; Tue, 31 Dec 2019 05:50:12 -0800 (PST) Received: from localhost ([::1]:42762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHuU-0005Dc-JU for importer@patchew.org; Tue, 31 Dec 2019 08:50:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57152) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCc-00062x-S2 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCb-0004ie-A0 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:50 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:20190 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCb-0004fq-3o for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-iyd-EJ-VPK2qNlH54HkvNw-1; Tue, 31 Dec 2019 08:04:42 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F3B3477 for ; Tue, 31 Dec 2019 13:04:41 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9A7E620A6 for ; Tue, 31 Dec 2019 13:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pZBavH5WV/00qROhH5w4eqiIIPNBMGIB2TbRu8PLVoI=; b=TiYeLu/BKdbJ2LeomwTxeg54xgbsJ2kMoL9/ibCNtBsWSpSidZtoYOyikTkf0ZSAHhSayB +MGKrGtg6wN5rG4sL6GORTZptkaQIpDbvRfFiMQnmUDaAsesQkoLKm2M9b403Epq5PgoVn OpJjH8YqzwQVrCXqMkokmENSiBlPN8U= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 64/86] ppc:ppc405_boards: add RAM size checks Date: Tue, 31 Dec 2019 14:03:48 +0100 Message-Id: <1577797450-88458-65-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: iyd-EJ-VPK2qNlH54HkvNw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will ignore it and continue running with fixed RAM size. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix CLI. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. PS: move fixed RAM size into mc->default_ram_size, so that generic code will know how much to allocate. Signed-off-by: Igor Mammedov --- hw/ppc/ppc405_boards.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 1f721fe..41aebbc 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -137,7 +137,7 @@ static void ref405ep_fpga_init(MemoryRegion *sysmem, ui= nt32_t base) =20 static void ref405ep_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -161,15 +161,20 @@ static void ref405ep_init(MachineState *machine) DriveInfo *dinfo; MemoryRegion *sysmem =3D get_system_memory(); =20 + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } + /* XXX: fix this */ memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.= ram", - 0x08000000); + machine->ram_size); ram_bases[0] =3D 0; - ram_sizes[0] =3D 0x08000000; + ram_sizes[0] =3D machine->ram_size; memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0); ram_bases[1] =3D 0x00000000; ram_sizes[1] =3D 0x00000000; - ram_size =3D 128 * MiB; env =3D ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, kernel_filename =3D=3D NULL ? 0 : = 1); /* allocate SRAM */ @@ -227,7 +232,7 @@ static void ref405ep_init(MachineState *machine) if (linux_boot) { memset(&bd, 0, sizeof(bd)); bd.bi_memstart =3D 0x00000000; - bd.bi_memsize =3D ram_size; + bd.bi_memsize =3D machine->ram_size; bd.bi_flashstart =3D -bios_size; bd.bi_flashsize =3D -bios_size; bd.bi_flashoffset =3D 0; @@ -255,7 +260,7 @@ static void ref405ep_init(MachineState *machine) kernel_base =3D KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size =3D load_image_targphys(kernel_filename, kernel_base, - ram_size - kernel_base); + machine->ram_size - kernel_base); if (kernel_size < 0) { error_report("could not load kernel '%s'", kernel_filename); exit(1); @@ -266,7 +271,7 @@ static void ref405ep_init(MachineState *machine) if (initrd_filename) { initrd_base =3D INITRD_LOAD_ADDR; initrd_size =3D load_image_targphys(initrd_filename, initrd_ba= se, - ram_size - initrd_base); + machine->ram_size - initrd_b= ase); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); @@ -304,6 +309,7 @@ static void ref405ep_class_init(ObjectClass *oc, void *= data) =20 mc->desc =3D "ref405ep"; mc->init =3D ref405ep_init; + mc->default_ram_size =3D 0x08000000; } =20 static const TypeInfo ref405ep_type =3D { @@ -408,7 +414,7 @@ static void taihu_cpld_init(MemoryRegion *sysmem, uint3= 2_t base) =20 static void taihu_405ep_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); const char *kernel_filename =3D machine->kernel_filename; const char *initrd_filename =3D machine->initrd_filename; char *filename; @@ -425,10 +431,13 @@ static void taihu_405ep_init(MachineState *machine) int fl_idx; DriveInfo *dinfo; =20 - /* RAM is soldered to the board so the size cannot be changed */ - ram_size =3D 0x08000000; + if (machine->ram_size !=3D mc->default_ram_size) { + error_report("Invalid RAM size, should be %" PRIi64 " Bytes", + mc->default_ram_size); + exit(EXIT_FAILURE); + } memory_region_allocate_system_memory(ram, NULL, "taihu_405ep.ram", - ram_size); + machine->ram_size); =20 ram_bases[0] =3D 0; ram_sizes[0] =3D 0x04000000; @@ -500,7 +509,7 @@ static void taihu_405ep_init(MachineState *machine) kernel_base =3D KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size =3D load_image_targphys(kernel_filename, kernel_base, - ram_size - kernel_base); + machine->ram_size - kernel_base); if (kernel_size < 0) { error_report("could not load kernel '%s'", kernel_filename); exit(1); @@ -509,7 +518,7 @@ static void taihu_405ep_init(MachineState *machine) if (initrd_filename) { initrd_base =3D INITRD_LOAD_ADDR; initrd_size =3D load_image_targphys(initrd_filename, initrd_ba= se, - ram_size - initrd_base); + machine->ram_size - initrd_b= ase); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); @@ -533,6 +542,7 @@ static void taihu_class_init(ObjectClass *oc, void *dat= a) =20 mc->desc =3D "taihu"; mc->init =3D taihu_405ep_init; + mc->default_ram_size =3D 0x08000000; } =20 static const TypeInfo taihu_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800065; cv=none; d=zohomail.com; s=zohoarc; b=CD6eEpHgD8sf8ohWIm3k7CVBc8c/H3rb5apeYZmcuswPp1ZNjQKy1ipEEFI3pdzRTXeRZCe1oA8zBK5+tdzR/sWEzWP6ZyXmsBmKhsGYj72Goc2393T54x5wsgydMJXq274CvhxNR7pmdQXe5Hb/1rEbPPxe7CuFG6y1Bl8uraM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800065; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=qrzVMdlM1QiNim6brAvxHk6aNkJY9OrR9Aq/9umM1zw=; b=dJ2FlXP0ZAKJ4fCfhKLlxhinzdKMifJAqgbJ6WddaKRseuUEHVoPPJ1/K0YtPcNC5qwtAXDdWvdKyXd2SOVM5at7ncZUwOYS7q5W0FLBfglReD5RZBWlwKET+fnZxXYkYmCzhppzlLX++YsToHE9zfM0t+KZEN4En/u/5/eWmd0= 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 1577800065708146.32916064152755; Tue, 31 Dec 2019 05:47:45 -0800 (PST) Received: from localhost ([::1]:42732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHs8-00026Z-1Z for importer@patchew.org; Tue, 31 Dec 2019 08:47:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56932) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCa-0005xl-5G for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCX-0004Ri-SQ for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24947 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCX-0004OU-Jf for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-167-mNU11IF5O9OLZIUwpYKTOQ-1; Tue, 31 Dec 2019 08:04:43 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D0AEDB61 for ; Tue, 31 Dec 2019 13:04:42 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9813678E96 for ; Tue, 31 Dec 2019 13:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qrzVMdlM1QiNim6brAvxHk6aNkJY9OrR9Aq/9umM1zw=; b=GAH5t7J98Qon0ML6v0tbsV5LeJCa1pZj0dgeD/URfF1ixX+lM6p/I+LAsid4gqjE2hNlZ8 9n9wrp1dXiEwlkbleRNdHpcuc6/28g7QMSZCYH5/x3vSlPWRCtYy9C0lDhN6gRu6cFjzB+ uSsg+0+koGGXXOP9idVlGHGf1pwRCHM= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 65/86] ppc:ppc405_boards: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:49 +0100 Message-Id: <1577797450-88458-66-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: mNU11IF5O9OLZIUwpYKTOQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: in ref405ep alias RAM into ram_memories[] to avoid re-factoring its user ppc405ep_init(), which would be invasive and out of scope this patch. Signed-off-by: Igor Mammedov --- hw/ppc/ppc405_boards.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 41aebbc..dd5a61f 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -168,8 +168,8 @@ static void ref405ep_init(MachineState *machine) } =20 /* XXX: fix this */ - memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.= ram", - machine->ram_size); + memory_region_init_alias(&ram_memories[0], NULL, "ef405ep.ram.alias", + machine->ram, 0, machine->ram_size); ram_bases[0] =3D 0; ram_sizes[0] =3D machine->ram_size; memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0); @@ -310,6 +310,7 @@ static void ref405ep_class_init(ObjectClass *oc, void *= data) mc->desc =3D "ref405ep"; mc->init =3D ref405ep_init; mc->default_ram_size =3D 0x08000000; + mc->default_ram_id =3D "ef405ep.ram"; } =20 static const TypeInfo ref405ep_type =3D { @@ -422,7 +423,6 @@ static void taihu_405ep_init(MachineState *machine) MemoryRegion *sysmem =3D get_system_memory(); MemoryRegion *bios; MemoryRegion *ram_memories =3D g_new(MemoryRegion, 2); - MemoryRegion *ram =3D g_malloc0(sizeof(*ram)); hwaddr ram_bases[2], ram_sizes[2]; long bios_size; target_ulong kernel_base, initrd_base; @@ -436,18 +436,16 @@ static void taihu_405ep_init(MachineState *machine) mc->default_ram_size); exit(EXIT_FAILURE); } - memory_region_allocate_system_memory(ram, NULL, "taihu_405ep.ram", - machine->ram_size); =20 ram_bases[0] =3D 0; ram_sizes[0] =3D 0x04000000; memory_region_init_alias(&ram_memories[0], NULL, - "taihu_405ep.ram-0", ram, ram_bases[0], + "taihu_405ep.ram-0", machine->ram, ram_bases[= 0], ram_sizes[0]); ram_bases[1] =3D 0x04000000; ram_sizes[1] =3D 0x04000000; memory_region_init_alias(&ram_memories[1], NULL, - "taihu_405ep.ram-1", ram, ram_bases[1], + "taihu_405ep.ram-1", machine->ram, ram_bases[= 1], ram_sizes[1]); ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, kernel_filename =3D=3D NULL ? 0 : 1); @@ -543,6 +541,7 @@ static void taihu_class_init(ObjectClass *oc, void *dat= a) mc->desc =3D "taihu"; mc->init =3D taihu_405ep_init; mc->default_ram_size =3D 0x08000000; + mc->default_ram_id =3D "ef405ep.ram"; } =20 static const TypeInfo taihu_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577801127; cv=none; d=zohomail.com; s=zohoarc; b=XD6PkU/kHHc1CIms3NF5yfdJYbVESjryfOJLcI6o2cunsDIi06g9GL12L6Q7xFaeOogR8iWZzHZV9RWqiEhNktbohPKp9JaqvgkqQflh15HawdBRn2/GucPtPVYk8w11GMeoWfsH66K5CNKs7I1U4QiANjqGoUS+7TmB5057ozs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577801127; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=J0A2mz5UYFmaLRsSSfn2Dx/kjyL1tRnOEZsBJXdeXIo=; b=MI1HFYVQ8FZb3icGXYD7B7JXuU3LlY1XjieFlhNYVtEiOD/8KG0nf3LLm+xL8KQ2BcE2pgCsvDF2+RWFqVq2YSqqI75hIVtKGUeT6yMKSwxuKFgdJFxS+f5wnl5562MJ5aE+jb0LtBR6X4G2F7eXu15cdxTEhY2fKpz8AM/cWKs= 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 1577801127484164.18780409065107; Tue, 31 Dec 2019 06:05:27 -0800 (PST) Received: from localhost ([::1]:42968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI9F-0007t1-Mb for importer@patchew.org; Tue, 31 Dec 2019 09:05:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57278) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCe-00065g-IA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCc-0004ov-Jp for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:36890 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCc-0004ke-6e for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:50 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-429-BR6PyMxVPkmNTfkmX5TkMQ-1; Tue, 31 Dec 2019 08:04:44 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DEF8010054E3 for ; Tue, 31 Dec 2019 13:04:42 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65EDB78E96 for ; Tue, 31 Dec 2019 13:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J0A2mz5UYFmaLRsSSfn2Dx/kjyL1tRnOEZsBJXdeXIo=; b=WPucoMhmmbZwO7BrRupv+GVmcDRWHRgHwCFb6DpR05Pvk3QnogQrS2rghA+MMSJJ8xWDdy eyPnzov/6G57Mxptw+dRW7WINDpES2BXF7FG0bITwqP5wIZdOmxplsxieXlbcGzOFT+KoC 3Sydis26o8Fu9ZBGTTu9sZTX0AexiaY= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 66/86] ppc:ppc440_bamboo/sam460ex: drop RAM size fixup Date: Tue, 31 Dec 2019 14:03:50 +0100 Message-Id: <1577797450-88458-67-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: BR6PyMxVPkmNTfkmX5TkMQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If user provided non-sense RAM size, board will complain and continue running with max RAM size supported. Also RAM is going to be allocated by generic code, so it won't be possible for board to fix things up for user. Make it error message and exit to force user fix CLI, instead of accepting non-sense CLI values. Signed-off-by: Igor Mammedov --- include/hw/ppc/ppc4xx.h | 9 ++++----- hw/ppc/ppc440_bamboo.c | 11 ++++------- hw/ppc/ppc4xx_devs.c | 26 ++++++++++++++++---------- hw/ppc/sam460ex.c | 5 ++--- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/include/hw/ppc/ppc4xx.h b/include/hw/ppc/ppc4xx.h index 7d82259..1a28127 100644 --- a/include/hw/ppc/ppc4xx.h +++ b/include/hw/ppc/ppc4xx.h @@ -42,11 +42,10 @@ enum { qemu_irq *ppcuic_init (CPUPPCState *env, qemu_irq *irqs, uint32_t dcr_base, int has_ssr, int has_vr); =20 -ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, - MemoryRegion ram_memories[], - hwaddr ram_bases[], - hwaddr ram_sizes[], - const ram_addr_t sdram_bank_sizes[]); +void ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, + MemoryRegion ram_memories[], + hwaddr ram_bases[], hwaddr ram_sizes[], + const ram_addr_t sdram_bank_sizes[]); =20 void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks, MemoryRegion ram_memories[], diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 4d95c0f..66dee89 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -162,7 +162,6 @@ static void main_cpu_reset(void *opaque) =20 static void bamboo_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -207,10 +206,8 @@ static void bamboo_init(MachineState *machine) /* SDRAM controller */ memset(ram_bases, 0, sizeof(ram_bases)); memset(ram_sizes, 0, sizeof(ram_sizes)); - ram_size =3D ppc4xx_sdram_adjust(ram_size, PPC440EP_SDRAM_NR_BANKS, - ram_memories, - ram_bases, ram_sizes, - ppc440ep_sdram_bank_sizes); + ppc4xx_sdram_adjust(ram_size, PPC440EP_SDRAM_NR_BANKS, ram_memories, + ram_bases, ram_sizes, ppc440ep_sdram_bank_sizes); /* XXX 440EP's ECC interrupts are on UIC1, but we've only created UIC0= . */ ppc4xx_sdram_init(env, pic[14], PPC440EP_SDRAM_NR_BANKS, ram_memories, ram_bases, ram_sizes, 1); @@ -272,7 +269,7 @@ static void bamboo_init(MachineState *machine) /* Load initrd. */ if (initrd_filename) { initrd_size =3D load_image_targphys(initrd_filename, RAMDISK_ADDR, - ram_size - RAMDISK_ADDR); + machine->ram_size - RAMDISK_ADDR= ); =20 if (initrd_size < 0) { error_report("could not load ram disk '%s' at %x", @@ -283,7 +280,7 @@ static void bamboo_init(MachineState *machine) =20 /* If we're loading a kernel directly, we must load the device tree to= o. */ if (kernel_filename) { - if (bamboo_load_device_tree(FDT_ADDR, ram_size, RAMDISK_ADDR, + if (bamboo_load_device_tree(FDT_ADDR, machine->ram_size, RAMDISK_A= DDR, initrd_size, kernel_cmdline) < 0) { error_report("couldn't load device tree"); exit(1); diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c index c2e5013..54af296 100644 --- a/hw/ppc/ppc4xx_devs.c +++ b/hw/ppc/ppc4xx_devs.c @@ -673,11 +673,10 @@ void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq ir= q, int nbanks, * The 4xx SDRAM controller supports a small number of banks, and each bank * must be one of a small set of sizes. The number of banks and the suppor= ted * sizes varies by SoC. */ -ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, - MemoryRegion ram_memories[], - hwaddr ram_bases[], - hwaddr ram_sizes[], - const ram_addr_t sdram_bank_sizes[]) +void ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, + MemoryRegion ram_memories[], + hwaddr ram_bases[], hwaddr ram_sizes[], + const ram_addr_t sdram_bank_sizes[]) { MemoryRegion *ram =3D g_malloc0(sizeof(*ram)); ram_addr_t size_left =3D ram_size; @@ -699,10 +698,19 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, i= nt nr_banks, } } =20 - ram_size -=3D size_left; if (size_left) { - error_report("Truncating memory to %" PRId64 " MiB to fit SDRAM" - " controller limits", ram_size / MiB); + char *s =3D g_strdup(""); + for (i =3D 0; sdram_bank_sizes[i]; i++) { + char *t =3D g_strdup_printf("%s%" PRIi64 "%s", s, sdram_bank_s= izes[i], + sdram_bank_sizes[i + 1] ? " ," : ""); + g_free(s); + s =3D t; + } + error_report("Invalid RAM size, unable to fit all RAM into RAM ban= ks" + " (unassigned RAM: %" PRIi64 ")", size_left); + error_report("Supported: %d banks and sizes/bank: %s", nr_banks, s= ); + g_free(s); + exit(EXIT_FAILURE); } =20 memory_region_allocate_system_memory(ram, NULL, "ppc4xx.sdram", ram_si= ze); @@ -725,8 +733,6 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int= nr_banks, } } } - - return ram_size; } =20 /*************************************************************************= ****/ diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 437e214..f592816 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -324,9 +324,8 @@ static void sam460ex_init(MachineState *machine) /* SDRAM controller */ /* put all RAM on first bank because board has one slot * and firmware only checks that */ - machine->ram_size =3D ppc4xx_sdram_adjust(machine->ram_size, 1, - ram_memories, ram_bases, ram_sizes, - ppc460ex_sdram_bank_sizes); + ppc4xx_sdram_adjust(machine->ram_size, 1, ram_memories, ram_bases, + ram_sizes, ppc460ex_sdram_bank_sizes); =20 /* FIXME: does 460EX have ECC interrupts? */ ppc440_sdram_init(env, SDRAM_NR_BANKS, ram_memories, --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800042; cv=none; d=zohomail.com; s=zohoarc; b=bK3LrBwL6c9fNnX4esq4EBIpTMKvEo+bKw5qYeT6gISmsCVnqilUcsgsEuBjf41KpFWcvoXk0iAFqbTxrpTZ+86/Z71r58DFI9380+vmznYwGQV1xfFB9Y4+OfNbD8+Bxm+Dwbj0d+BtAcVIp3KPNoF1023Igx3Ap81lE8E8AKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800042; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=g+h+u9gYsFlLicKSN4chMEr82/G6v49q6m4/6FD8tfI=; b=iv0KzETztRKDoF8QkKSvH6Q4zt+EgYvxbFx8xqIlroDT6TumEM3HtKEgzztxLjatg3rof0/Hs7IiMKJlBvrchp6p3HDl15V/PulP0NVtny8g0GcZhKTD28Ul1or7PzkMIig69DPJTJC9yyg4uyt6Tjb4Pa1wb7zxtDrbM2cNP+8= 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 1577800042393646.0983356082146; Tue, 31 Dec 2019 05:47:22 -0800 (PST) Received: from localhost ([::1]:42730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHrk-0001hY-Om for importer@patchew.org; Tue, 31 Dec 2019 08:47:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57023) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCb-0005zX-2c for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCZ-0004Z0-8S for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:48 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47044 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCY-0004Vd-VP for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:47 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-245-NbmfB515PSarxNM-E3RmmA-1; Tue, 31 Dec 2019 08:04:44 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ADDC4DB62 for ; Tue, 31 Dec 2019 13:04:43 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3382C78E99 for ; Tue, 31 Dec 2019 13:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g+h+u9gYsFlLicKSN4chMEr82/G6v49q6m4/6FD8tfI=; b=bUroSu09AYP9+eWsOxiYFHZAEscg7p3/o0FmKaiZG42r/CXrS2OfSrCxE80M4/Tdx3BtkW zGrSqnoOqaqN3umu+nrlCtugOefOoHzg8v3CsyxZ4JOMNPSYEIAgJQktPLiQg1Ke50Nwsb HSkEgZqTKLDFWuaH5RlUXxBYkyipG50= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 67/86] ppc:ppc440_bamboo/sam460ex: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:51 +0100 Message-Id: <1577797450-88458-68-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: NbmfB515PSarxNM-E3RmmA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- include/hw/ppc/ppc4xx.h | 2 +- hw/ppc/ppc440_bamboo.c | 3 ++- hw/ppc/ppc4xx_devs.c | 6 ++---- hw/ppc/sam460ex.c | 3 ++- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/hw/ppc/ppc4xx.h b/include/hw/ppc/ppc4xx.h index 1a28127..896b1b1 100644 --- a/include/hw/ppc/ppc4xx.h +++ b/include/hw/ppc/ppc4xx.h @@ -42,7 +42,7 @@ enum { qemu_irq *ppcuic_init (CPUPPCState *env, qemu_irq *irqs, uint32_t dcr_base, int has_ssr, int has_vr); =20 -void ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, +void ppc4xx_sdram_adjust(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[], const ram_addr_t sdram_bank_sizes[]); diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 66dee89..73e5b23 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -206,7 +206,7 @@ static void bamboo_init(MachineState *machine) /* SDRAM controller */ memset(ram_bases, 0, sizeof(ram_bases)); memset(ram_sizes, 0, sizeof(ram_sizes)); - ppc4xx_sdram_adjust(ram_size, PPC440EP_SDRAM_NR_BANKS, ram_memories, + ppc4xx_sdram_adjust(machine->ram, PPC440EP_SDRAM_NR_BANKS, ram_memorie= s, ram_bases, ram_sizes, ppc440ep_sdram_bank_sizes); /* XXX 440EP's ECC interrupts are on UIC1, but we've only created UIC0= . */ ppc4xx_sdram_init(env, pic[14], PPC440EP_SDRAM_NR_BANKS, ram_memories, @@ -293,6 +293,7 @@ static void bamboo_machine_init(MachineClass *mc) mc->desc =3D "bamboo"; mc->init =3D bamboo_init; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("440epb"); + mc->default_ram_id =3D "ppc4xx.sdram"; } =20 DEFINE_MACHINE("bamboo", bamboo_machine_init) diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c index 54af296..515e462 100644 --- a/hw/ppc/ppc4xx_devs.c +++ b/hw/ppc/ppc4xx_devs.c @@ -673,12 +673,12 @@ void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq ir= q, int nbanks, * The 4xx SDRAM controller supports a small number of banks, and each bank * must be one of a small set of sizes. The number of banks and the suppor= ted * sizes varies by SoC. */ -void ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, +void ppc4xx_sdram_adjust(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[], const ram_addr_t sdram_bank_sizes[]) { - MemoryRegion *ram =3D g_malloc0(sizeof(*ram)); + ram_addr_t ram_size =3D memory_region_size(ram); ram_addr_t size_left =3D ram_size; ram_addr_t base =3D 0; ram_addr_t bank_size; @@ -713,8 +713,6 @@ void ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_ba= nks, exit(EXIT_FAILURE); } =20 - memory_region_allocate_system_memory(ram, NULL, "ppc4xx.sdram", ram_si= ze); - size_left =3D ram_size; for (i =3D 0; i < nr_banks && size_left; i++) { for (j =3D 0; sdram_bank_sizes[j] !=3D 0; j++) { diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index f592816..2d75719 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -324,7 +324,7 @@ static void sam460ex_init(MachineState *machine) /* SDRAM controller */ /* put all RAM on first bank because board has one slot * and firmware only checks that */ - ppc4xx_sdram_adjust(machine->ram_size, 1, ram_memories, ram_bases, + ppc4xx_sdram_adjust(machine->ram, 1, ram_memories, ram_bases, ram_sizes, ppc460ex_sdram_bank_sizes); =20 /* FIXME: does 460EX have ECC interrupts? */ @@ -483,6 +483,7 @@ static void sam460ex_machine_init(MachineClass *mc) mc->init =3D sam460ex_init; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("460exb"); mc->default_ram_size =3D 512 * MiB; + mc->default_ram_id =3D "ppc4xx.sdram"; } =20 DEFINE_MACHINE("sam460ex", sam460ex_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800722; cv=none; d=zohomail.com; s=zohoarc; b=Jp6RPZAJB5rFL0AsSF+IPW90HxQ4wbp2ewsAuCAB466xuu8MG+S6Hac4KnqOXM4JqSoBtnKhNbhHCvgC8SMeAjjY6ovCVi60yHiyUxA92ygMDDZgFDirdxc7Uiji7vXl6laQ1FzPEeWR1GapjvqVLgAPNKrU2RueGHCTmwnBdWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800722; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=y36GOOziW3KBFzmoZVsmxjEOEN/lfK2edypTjSxTb64=; b=k+fQAfwC7WHXLodkVNFDDQ5BNj6nlCU5pfPka9FO8XjXG72SUBbTmfVPNsfD25BOOaSDZu1Nygt8dyNG+YR/8XysK4gAAGG6GnMeMmecu42Ol5d/376q/gMzEyxWLpGcqnE96pcDeiHwl7qagadeplfdohZDihbdwooXorXe9SM= 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 1577800722342393.5088434950578; Tue, 31 Dec 2019 05:58:42 -0800 (PST) Received: from localhost ([::1]:42868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI2h-0008WA-Pe for importer@patchew.org; Tue, 31 Dec 2019 08:58:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57013) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCb-0005zK-Vx for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCZ-0004Zw-HM for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:48 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43477 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCZ-0004W7-4o for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:47 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-AZr385b6ORmKbSyyI7H1nA-1; Tue, 31 Dec 2019 08:04:45 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E4AB18031CD for ; Tue, 31 Dec 2019 13:04:44 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 025FC78E75 for ; Tue, 31 Dec 2019 13:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y36GOOziW3KBFzmoZVsmxjEOEN/lfK2edypTjSxTb64=; b=ScSKN4ZxhLVTJQEAxecwjrHoHfapCYA7f9rkqdFGA4NK4FOrv1Qn4x8m0OshACGlJKFvdb hvBVo5S1iZpgcLZPAE7xeUWkLkNC9/9F0qUwgP/IeBd/0ld7kBjAvVT9NRKqqH4neH+no+ iBNKL2/h7r16dkpFTkmCxIW++2Rcd8Y= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 68/86] ppc:prep: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:52 +0100 Message-Id: <1577797450-88458-69-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: AZr385b6ORmKbSyyI7H1nA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/ppc/prep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 862345c..bf75dde 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -400,7 +400,6 @@ static int PPC_NVRAM_set_params (Nvram *nvram, uint16_t= NVRAM_size, /* PowerPC PREP hardware initialisation */ static void ppc_prep_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -413,7 +412,6 @@ static void ppc_prep_init(MachineState *machine) MemoryRegion *xcsr =3D g_new(MemoryRegion, 1); #endif int linux_boot, i, nb_nics1; - MemoryRegion *ram =3D g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base; long kernel_size, initrd_size; DeviceState *dev; @@ -444,15 +442,14 @@ static void ppc_prep_init(MachineState *machine) qemu_register_reset(ppc_prep_reset, cpu); } =20 - /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "ppc_prep.ram", ram_si= ze); - memory_region_add_subregion(sysmem, 0, ram); + /* map RAM */ + memory_region_add_subregion(sysmem, 0, machine->ram); =20 if (linux_boot) { kernel_base =3D KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size =3D load_image_targphys(kernel_filename, kernel_base, - ram_size - kernel_base); + machine->ram_size - kernel_base); if (kernel_size < 0) { error_report("could not load kernel '%s'", kernel_filename); exit(1); @@ -461,7 +458,7 @@ static void ppc_prep_init(MachineState *machine) if (initrd_filename) { initrd_base =3D INITRD_LOAD_ADDR; initrd_size =3D load_image_targphys(initrd_filename, initrd_ba= se, - ram_size - initrd_base); + machine->ram_size - initrd_b= ase); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); @@ -576,7 +573,7 @@ static void ppc_prep_init(MachineState *machine) sysctrl->nvram =3D m48t59; =20 /* Initialise NVRAM */ - PPC_NVRAM_set_params(m48t59, NVRAM_SIZE, "PREP", ram_size, + PPC_NVRAM_set_params(m48t59, NVRAM_SIZE, "PREP", machine->ram_size, ppc_boot_device, kernel_base, kernel_size, kernel_cmdline, @@ -596,6 +593,7 @@ static void prep_machine_init(MachineClass *mc) mc->default_boot_order =3D "cad"; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("602"); mc->default_display =3D "std"; + mc->default_ram_id =3D "ppc_prep.ram"; } =20 static int prep_set_cmos_checksum(DeviceState *dev, void *opaque) @@ -814,6 +812,7 @@ static void ibm_40p_machine_init(MachineClass *mc) mc->init =3D ibm_40p_init; mc->max_cpus =3D 1; mc->default_ram_size =3D 128 * MiB; + mc->default_ram_id =3D "ppc_prep.ram"; mc->block_default_type =3D IF_SCSI; mc->default_boot_order =3D "c"; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("604"); --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577799880; cv=none; d=zohomail.com; s=zohoarc; b=FV8clqTPXqwRbIxs/y9vb6Vn4t+FvKxW9jfMCpSW28dpI/6FOEFqdGIdcmu10xlIJQjKGApKQVJy/NtfdXMI4BQXYzp9/UWyuyADI7bQ6pA371bUBi1F3kmxtU/Nj/ntyVvmWxHkdoXSUgV3LfoBW4/R6RQHhceGWEMigmJ1PEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577799880; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=odk3qC7kLFgbYVy/6Z/797ZvStkki/1lFZ6fgpzdYI0=; b=AGeiAir/dJs+5cMtHCqRC03OO/Bes1/qWJifWr+MDMRjHeaiCxuFuLgLWXzDhVEWwMVw/We9guvwx6RSo3qPjbeAcjjN54ims4rz/3BMQpzoiJjVAxP7gWGiYP6anH4IyEG788XVU9AdSln+mpN9BvnY1U56UhQIj3Jeg/vcduE= 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 1577799880681917.6783253028826; Tue, 31 Dec 2019 05:44:40 -0800 (PST) Received: from localhost ([::1]:42692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHp9-00076K-3p for importer@patchew.org; Tue, 31 Dec 2019 08:44:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57141) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCc-00062j-QY for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCa-0004ea-G5 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:50 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33129 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCa-0004bR-AW for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:48 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-273-4oTzhUpFNtiW_sNY6Tc_fw-1; Tue, 31 Dec 2019 08:04:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49B1E107ACC7 for ; Tue, 31 Dec 2019 13:04:45 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4B53620A6 for ; Tue, 31 Dec 2019 13:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=odk3qC7kLFgbYVy/6Z/797ZvStkki/1lFZ6fgpzdYI0=; b=aUN0GdoSyNub4pNjdjK9JxoekEfNmlTNTThj5NKr32BHF8T1O5K2wYvxrdCmQIBAFOksJy U/uj+tRNhy8wHHBmjony7Jt4SwcGrKW+PcqjY/dmY20Qr5NdeCpsyw0+WQGk5xSF0olsR0 YG12EBdcfA/tkVY5vz+R3kX3gF8X+EA= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 69/86] ppc:spapr: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:53 +0100 Message-Id: <1577797450-88458-70-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 4oTzhUpFNtiW_sNY6Tc_fw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/ppc/spapr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index f11422f..915e36a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2589,7 +2589,6 @@ static void spapr_machine_init(MachineState *machine) PCIHostState *phb; int i; MemoryRegion *sysmem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); hwaddr node0_size =3D spapr_node0_size(machine); long load_limit, fw_size; char *filename; @@ -2768,10 +2767,8 @@ static void spapr_machine_init(MachineState *machine) kvmppc_enable_h_page_init(); } =20 - /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram", - machine->ram_size); - memory_region_add_subregion(sysmem, 0, ram); + /* map RAM */ + memory_region_add_subregion(sysmem, 0, machine->ram); =20 /* always allocate the device memory information */ machine->device_memory =3D g_malloc0(sizeof(*machine->device_memory)); @@ -4346,6 +4343,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) mc->no_parallel =3D 1; mc->default_boot_order =3D ""; mc->default_ram_size =3D 512 * MiB; + mc->default_ram_id =3D "ppc_spapr.ram"; mc->default_display =3D "std"; mc->kvm_type =3D spapr_kvm_type; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SPAPR_PCI_HOST_BRIDGE); --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800915; cv=none; d=zohomail.com; s=zohoarc; b=kMmss3yNUnCtg/bAhpsiqfFH48GF92qqHjAUPooEprFs/D9l4uhDBip7BtkuQf9o+0l+DC4m5pSM2Ou9KKn8qseCS9UMPa5RxM/GPcfC9U/V4QiUEr8u38QveI7UzuQ+d1KYMpyV5F8hjZjXcsOHMFX2hmtL7JPMlL8EJDV/gGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800915; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=1IMz3vSK2QPdKSvb5rz27DYRqvQCEnPgI1KwjPhFPAM=; b=a0JpEmP9uZw7nD8uEFolqaqhzbmr59LGQO0zzS8UrYPfgPtJ5YQhxT5zLSmUSim1oruWPNHqmXCt59dSxf8vAJkDKmGhrxcHdhnowNvhbbpGhdJVczYw91TqB946yKHbR4XFq03UvEBf2W1YJMXVMGLWFWe4JjVnXgZkRndAfRg= 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 1577800915601447.58521470024175; Tue, 31 Dec 2019 06:01:55 -0800 (PST) Received: from localhost ([::1]:42916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI5q-00043h-3J for importer@patchew.org; Tue, 31 Dec 2019 09:01:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57148) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCc-00062r-Tk for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCb-0004kT-NN for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:50 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37809 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCb-0004hk-Fn for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-KJMH7vAHM22IO2-vCiHbhA-1; Tue, 31 Dec 2019 08:04:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19BA7DB60 for ; Tue, 31 Dec 2019 13:04:46 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 926E1620A6 for ; Tue, 31 Dec 2019 13:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1IMz3vSK2QPdKSvb5rz27DYRqvQCEnPgI1KwjPhFPAM=; b=i9WlZcB97o6naFFi7q0bNetJbfwB+VGmtX38Zo82FdNz6f0qdY3SsVeqMcyEphfQjGpdeh lOqdwz84j5XXkVg4G87oaSMen0ZGqS9Ns31TnXbPDDSjhL3mB9v+2cVXRl087C6u8TejtX S/igVUJiBACdl2WDa7YJVgMpZaT9WPE= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 70/86] ppc:virtex_ml507: remove unused arguments Date: Tue, 31 Dec 2019 14:03:54 +0100 Message-Id: <1577797450-88458-71-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: KJMH7vAHM22IO2-vCiHbhA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- hw/ppc/virtex_ml507.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 6862552..651d8db 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -89,10 +89,7 @@ static void mmubooke_create_initial_mapping(CPUPPCState = *env, tlb->PID =3D 0; } =20 -static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size, - int do_init, - const char *cpu_type, - uint32_t sysclk) +static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t syscl= k) { PowerPCCPU *cpu; CPUPPCState *env; @@ -213,7 +210,7 @@ static void virtex_init(MachineState *machine) int i; =20 /* init CPUs */ - cpu =3D ppc440_init_xilinx(&ram_size, 1, machine->cpu_type, 400000000); + cpu =3D ppc440_init_xilinx(machine->cpu_type, 400000000); env =3D &cpu->env; =20 if (env->mmu_model !=3D POWERPC_MMU_BOOKE) { --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800227; cv=none; d=zohomail.com; s=zohoarc; b=Dn19XpxGThHjEgrHd7tqeYwVpZy0td0FqfZIKQxR/ZsZTDoEwtHVHKZzKi3lSRGXxKeoSnMjx11eMvGmM/MneifXckkehF3dNmIMqNa0ZzpF+3VPR06pcggSq2qt5BOVqzMSdUPRg1XBmbQ1yO64MZcsP/ZyX8Iozp7JaMvfaWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800227; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=RIXg3gtxgKYpM9gfSOJZn7379xm7KeZ2nseujTyVB/U=; b=Mk6IPR4mb0dRMTsO5hgrdn4Qk+loBZAdCZzFYrpv6V8+sBlrQBvRM3DYEdRZlKI+BxIbaTgFp3ewCfG0hiJvwXL/DmNqwxiqogFwRqBLW+0eYGrY//EooxennZId8e9oHdtGFwX9cNwT5dPo8sf99bS17ln4/tZo7pH43D1XBvA= 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 1577800227176224.95309438245; Tue, 31 Dec 2019 05:50:27 -0800 (PST) Received: from localhost ([::1]:42764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHuj-0005WV-7F for importer@patchew.org; Tue, 31 Dec 2019 08:50:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57197) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCd-00064E-Jd for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCc-0004mA-0Q for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:51 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:42148 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCb-0004iE-Nf for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-kA90dABRPMeLAuWtsyd71Q-1; Tue, 31 Dec 2019 08:04:47 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D9DBC800D48 for ; Tue, 31 Dec 2019 13:04:46 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60747620A6 for ; Tue, 31 Dec 2019 13:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RIXg3gtxgKYpM9gfSOJZn7379xm7KeZ2nseujTyVB/U=; b=dS6IK9PlKj70tHa1jemJwJMjfNrHL6igMHGI8zgVoCA7t1o6ZOz7eL5bngVC21VEEBn9nq 9DZ8wPFBSni2NeFlh8Ejs5lSsN7d9748YDZRlkVoJSwFITfxrvsCt57gjJ6vQ2te6csAMy 2j0pVK9NsLzjZuTlW0A/hJMyJ79FYmA= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 71/86] ppc:virtex_ml507: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:55 +0100 Message-Id: <1577797450-88458-72-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: kA90dABRPMeLAuWtsyd71Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov --- hw/ppc/virtex_ml507.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 651d8db..b74a269 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -193,7 +193,6 @@ static int xilinx_load_device_tree(hwaddr addr, =20 static void virtex_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; hwaddr initrd_base =3D 0; @@ -204,7 +203,6 @@ static void virtex_init(MachineState *machine) CPUPPCState *env; hwaddr ram_base =3D 0; DriveInfo *dinfo; - MemoryRegion *phys_ram =3D g_new(MemoryRegion, 1); qemu_irq irq[32], *cpu_irq; int kernel_size; int i; @@ -221,8 +219,7 @@ static void virtex_init(MachineState *machine) =20 qemu_register_reset(main_cpu_reset, cpu); =20 - memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size); - memory_region_add_subregion(address_space_mem, ram_base, phys_ram); + memory_region_add_subregion(address_space_mem, ram_base, machine->ram); =20 dinfo =3D drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(PFLASH_BASEADDR, "virtex.flash", FLASH_SIZE, @@ -265,7 +262,7 @@ static void virtex_init(MachineState *machine) /* If we failed loading ELF's try a raw image. */ kernel_size =3D load_image_targphys(kernel_filename, boot_offset, - ram_size); + machine->ram_size); boot_info.bootstrap_pc =3D boot_offset; high =3D boot_info.bootstrap_pc + kernel_size + 8192; } @@ -276,7 +273,7 @@ static void virtex_init(MachineState *machine) if (machine->initrd_filename) { initrd_base =3D high =3D ROUND_UP(high, 4); initrd_size =3D load_image_targphys(machine->initrd_filename, - high, ram_size - high); + high, machine->ram_size - hi= gh); =20 if (initrd_size < 0) { error_report("couldn't load ram disk '%s'", @@ -290,7 +287,7 @@ static void virtex_init(MachineState *machine) boot_info.fdt =3D high + (8192 * 2); boot_info.fdt &=3D ~8191; =20 - xilinx_load_device_tree(boot_info.fdt, ram_size, + xilinx_load_device_tree(boot_info.fdt, machine->ram_size, initrd_base, initrd_size, kernel_cmdline); } @@ -302,6 +299,7 @@ static void virtex_machine_init(MachineClass *mc) mc->desc =3D "Xilinx Virtex ML507 reference design"; mc->init =3D virtex_init; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("440-xilinx"); + mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("virtex-ml507", virtex_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800372; cv=none; d=zohomail.com; s=zohoarc; b=ZouEsPaufL4S1mPaTKzi2bvMXrXXbIiYswsfb4AGKj0VgW6aSrcQOx358gCwGbJAgDhfDm8t5CeS7t6CQulXAvXr5H1JmIHA+lI++PxbRHCwR9wBdp9Lljf6Ml67ObDydGipF3LDyHwsbYGVsgBlu5z93O1EvLZJkJSSPVDsAWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800372; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hSr1npakF22zV6oJnTvdC1T4WSzePj+YqcCKL2XUvvE=; b=a9IZZ36WYy0AHoGpnAN6RePwigDbfIbThRM/tIxQ+JnnEgVz9W1JgF6FcssQ/X6+rlwCP3ob9RXiUQuax/6lDkqvJNCTAIXBQfiLNblHuq/G84ozu+VheocPUzA/oUxOLF5Z787iN3mTMyUSi0oIe4r1K8m2eMd/uq1TM8ucDG0= 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 1577800372081863.765234905055; Tue, 31 Dec 2019 05:52:52 -0800 (PST) Received: from localhost ([::1]:42800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHx4-0000YO-IP for importer@patchew.org; Tue, 31 Dec 2019 08:52:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57282) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCe-00065s-Ie for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCd-0004qu-4R for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:26185 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCc-0004o8-Qb for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:50 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-xv0EwYkhOVWflUfsCpZH9w-1; Tue, 31 Dec 2019 08:04:48 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A71C8DB64 for ; Tue, 31 Dec 2019 13:04:47 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E14A620A6 for ; Tue, 31 Dec 2019 13:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hSr1npakF22zV6oJnTvdC1T4WSzePj+YqcCKL2XUvvE=; b=bXVc1wcDWYe/s0zBQmyBthun4lgla+yHSYFarqGpkPk8a6EkuRTBjPrbccp6Ccao9rhgl3 fbciwPBTAo1yUV1nbPIXZNW0xUPRi0ko7nr9H1VVNqyg2sk6tRoprzogg0qLPiBKeqDkEc a6d2M4uloGqPAmbgBQbiOFUC7I6CO08= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 72/86] sparc:leon3: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:56 +0100 Message-Id: <1577797450-88458-73-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: xv0EwYkhOVWflUfsCpZH9w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/sparc/leon3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index c5f1b1e..19927d1 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -184,7 +184,6 @@ static void leon3_generic_hw_init(MachineState *machine) SPARCCPU *cpu; CPUSPARCState *env; MemoryRegion *address_space_mem =3D get_system_memory(); - MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *prom =3D g_new(MemoryRegion, 1); int ret; char *filename; @@ -244,8 +243,8 @@ static void leon3_generic_hw_init(MachineState *machine) exit(1); } =20 - memory_region_allocate_system_memory(ram, NULL, "leon3.ram", ram_size); - memory_region_add_subregion(address_space_mem, LEON3_RAM_OFFSET, ram); + memory_region_add_subregion(address_space_mem, LEON3_RAM_OFFSET, + machine->ram); =20 /* Allocate BIOS */ prom_size =3D 8 * MiB; @@ -351,6 +350,7 @@ static void leon3_generic_machine_init(MachineClass *mc) mc->desc =3D "Leon-3 generic"; mc->init =3D leon3_generic_hw_init; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("LEON3"); + mc->default_ram_id =3D "leon3.ram"; } =20 DEFINE_MACHINE("leon3_generic", leon3_generic_machine_init) --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800076; cv=none; d=zohomail.com; s=zohoarc; b=OrX2Ep5BCynf7bJtkVRPWFqu+aqMzejQot+4XZjW3NXcou7/YkHuclmkjawhuzgescLz7zONimvmuKAWl2XWl4jH2mtM/X1CLt161FzGBkvKL3yuCXuleDSyDVZ7refTckfK6PTR+dH6rAiEuXD2ahcuy871SEVAShiiLhSQ/t8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800076; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=jACZtpMkHhr4dAm9PZDneEJIxP5KZuqB9HWqqcnlLmc=; b=k+Ttu7c0AtWddz1gGPI9P0cEECr2LYRCQGHMhNaMi0lwu947jpVOvYKSWsXCv+iohZ9K2fgmSjGaIRQqr+IHo4rnw5M8aQnXoXMMNcV72GQ2ry9PZpC1Y3kTlSrBs/WQtloF8KbzESBizHj3cvC3M5/cLoiIbjt4GJYv+bQkv5Y= 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 1577800076562604.5768138033002; Tue, 31 Dec 2019 05:47:56 -0800 (PST) Received: from localhost ([::1]:42734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHsI-0002KG-Kp for importer@patchew.org; Tue, 31 Dec 2019 08:47:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57390) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCg-00068F-2t for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCe-0004w2-7P for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:53 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:49677 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCd-0004rf-Ty for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-318-OanbalCYMSWK25kOr_QcDw-1; Tue, 31 Dec 2019 08:04:49 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74830477 for ; Tue, 31 Dec 2019 13:04:48 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id F034378E96 for ; Tue, 31 Dec 2019 13:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jACZtpMkHhr4dAm9PZDneEJIxP5KZuqB9HWqqcnlLmc=; b=HhzcWGsFVRjwiIOZ0wQhpFof1fhrsrtrgsKHlUqbNV5s01areF8qOeOL0Z1AmAqiP1lhVY AzCFGDZYM1Y0Op82KsKfHCxXd1mSpdLB2sns0oBwTjdeiXh89thDkSPIryw5S3wYSgU0BO KvBS4GW8Amc1CfmfypDfVymC6hRtylw= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 73/86] sparc:sun4m: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:57 +0100 Message-Id: <1577797450-88458-74-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: OanbalCYMSWK25kOr_QcDw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Patch moves ram size check into sun4m_hw_init() and drops ram_init() moving remainder to sun4m_hw_init() as well, as it was the only place that called it. Also it rewrites impl. of RamDevice a little bit, which could serve as an example of frontend device for RAM backend. (Caveats are: 1. it doesn't check for memdev backend being mapped since it's been usurped by generic machine to handle majority of machines which don't have RAM frontend device 2. it still lacks 'addr' property and still has hardcoded sysbus_mmio_map() in board init. If done right, board should set 'addr' property and bus/machine plug handler should map it during device realize time. ) Further improvements were left as exercise for the future, since frontends are out scope of RAM conversion to memdev. Signed-off-by: Igor Mammedov --- hw/sparc/sun4m.c | 73 ++++++++++++++++++++++++++++------------------------= ---- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 2aaa5bf..834ad2a 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -777,63 +777,42 @@ static const TypeInfo prom_info =3D { =20 typedef struct RamDevice { SysBusDevice parent_obj; - - MemoryRegion ram; - uint64_t size; + HostMemoryBackend *memdev; } RamDevice; =20 /* System RAM */ static void ram_realize(DeviceState *dev, Error **errp) { RamDevice *d =3D SUN4M_RAM(dev); - SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + MemoryRegion *ram =3D host_memory_backend_get_memory(d->memdev); =20 - memory_region_allocate_system_memory(&d->ram, OBJECT(d), "sun4m.ram", - d->size); - sysbus_init_mmio(sbd, &d->ram); + sysbus_init_mmio(SYS_BUS_DEVICE(dev), ram); } =20 -static void ram_init(hwaddr addr, ram_addr_t RAM_size, - uint64_t max_mem) +static void ram_initfn(Object *obj) { - DeviceState *dev; - SysBusDevice *s; - RamDevice *d; - - /* allocate RAM */ - if ((uint64_t)RAM_size > max_mem) { - error_report("Too much memory for this machine: %" PRId64 "," - " maximum %" PRId64, - RAM_size / MiB, max_mem / MiB); - exit(1); - } - dev =3D qdev_create(NULL, "memory"); - s =3D SYS_BUS_DEVICE(dev); - - d =3D SUN4M_RAM(dev); - d->size =3D RAM_size; - qdev_init_nofail(dev); - - sysbus_mmio_map(s, 0, addr); + RamDevice *d =3D SUN4M_RAM(obj); + object_property_add_link(obj, "memdev", TYPE_MEMORY_BACKEND, + (Object **)&d->memdev, + object_property_allow_set_link, + OBJ_PROP_LINK_STRONG, &error_abort); + object_property_set_description(obj, "memdev", "Set RAM backend" + "Valid value is ID of a hostmem backen= d", + &error_abort); } =20 -static Property ram_properties[] =3D { - DEFINE_PROP_UINT64("size", RamDevice, size, 0), - DEFINE_PROP_END_OF_LIST(), -}; - static void ram_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->realize =3D ram_realize; - dc->props =3D ram_properties; } =20 static const TypeInfo ram_info =3D { .name =3D TYPE_SUN4M_MEMORY, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(RamDevice), + .instance_init =3D ram_initfn, .class_init =3D ram_class_init, }; =20 @@ -880,6 +859,13 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hw= def, unsigned int smp_cpus =3D machine->smp.cpus; unsigned int max_cpus =3D machine->smp.max_cpus; =20 + if (machine->ram_size > hwdef->max_mem) { + error_report("Too much memory for this machine: %" PRId64 "," + " maximum %" PRId64, + machine->ram_size / MiB, hwdef->max_mem / MiB); + exit(1); + } + /* init CPUs */ for(i =3D 0; i < smp_cpus; i++) { cpu_devinit(machine->cpu_type, i, hwdef->slavio_base, &cpu_irqs[i]= ); @@ -888,9 +874,13 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hw= def, for (i =3D smp_cpus; i < MAX_CPUS; i++) cpu_irqs[i] =3D qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PI= LS); =20 + /* Create and map RAM frontend */ + dev =3D qdev_create(NULL, "memory"); + object_property_set_link(OBJECT(dev), OBJECT(machine->ram_memdev), + "memdev", &error_fatal); + qdev_init_nofail(dev); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0); =20 - /* set up devices */ - ram_init(0, machine->ram_size, hwdef->max_mem); /* models without ECC don't trap when missing ram is accessed */ if (!hwdef->ecc_base) { empty_slot_init(machine->ram_size, hwdef->max_mem - machine->ram_s= ize); @@ -1078,7 +1068,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *h= wdef, =20 fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); - fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); + fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth); fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_WIDTH, graphic_width); @@ -1415,6 +1405,7 @@ static void ss5_class_init(ObjectClass *oc, void *dat= a) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Fujitsu-MB86904"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo ss5_type =3D { @@ -1434,6 +1425,7 @@ static void ss10_class_init(ObjectClass *oc, void *da= ta) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-SuperSparc-II"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo ss10_type =3D { @@ -1453,6 +1445,7 @@ static void ss600mp_class_init(ObjectClass *oc, void = *data) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-SuperSparc-II"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo ss600mp_type =3D { @@ -1472,6 +1465,7 @@ static void ss20_class_init(ObjectClass *oc, void *da= ta) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-SuperSparc-II"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo ss20_type =3D { @@ -1490,6 +1484,7 @@ static void voyager_class_init(ObjectClass *oc, void = *data) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Fujitsu-MB86904"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo voyager_type =3D { @@ -1508,6 +1503,7 @@ static void ss_lx_class_init(ObjectClass *oc, void *d= ata) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-MicroSparc-I"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo ss_lx_type =3D { @@ -1526,6 +1522,7 @@ static void ss4_class_init(ObjectClass *oc, void *dat= a) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Fujitsu-MB86904"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo ss4_type =3D { @@ -1544,6 +1541,7 @@ static void scls_class_init(ObjectClass *oc, void *da= ta) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-MicroSparc-I"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo scls_type =3D { @@ -1562,6 +1560,7 @@ static void sbook_class_init(ObjectClass *oc, void *d= ata) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-MicroSparc-I"); mc->default_display =3D "tcx"; + mc->default_ram_id =3D "sun4m.ram"; } =20 static const TypeInfo sbook_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800360; cv=none; d=zohomail.com; s=zohoarc; b=aXTQULbSN9kaEA8VqHfBBL+bZbyYLUa33VZqE9lZr8UPklW4+RhgZ9FmRsNsfAw8ZgPhJwRHhbnrnBqhUDbcK7b7NZ1bNhw4rCXMUWosUp6ktChvG+Mm81cBkuhlTaWmRzA/PsfAyDKIXfXqDutg4tFfDeHMqsoeirn7qVtNc68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800360; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=uQXiMawicfvYJvvySbAjj44ZFJrLq15U9RH3R6J2BQ0=; b=bebmUIY5BSwamFx7S2bAIkGRUJT0HaFtYAbPRlMkz+CeCdhRPskU7Et2Y9BYV2+sKkth03GDfT0jQcAIhCzDNhJ0aqE0sLFY+DBYXAsygOX+wX9ZPfODox4tZkFmz29xhYyFb7n2+a2EpZKQCmw9ZwC9VgkMPdH1yi0FF/RHk6Y= 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 1577800360987535.2005839512715; Tue, 31 Dec 2019 05:52:40 -0800 (PST) Received: from localhost ([::1]:42798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHwt-0000Hc-N3 for importer@patchew.org; Tue, 31 Dec 2019 08:52:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57391) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCg-00068H-4a for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCe-0004zd-SO for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:53 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:51294 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCe-0004wC-LR for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:52 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-99-FJP86F50N-mLb5BjbnVO4Q-1; Tue, 31 Dec 2019 08:04:50 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 434D1107ACC4 for ; Tue, 31 Dec 2019 13:04:49 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDF16620A6 for ; Tue, 31 Dec 2019 13:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797492; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uQXiMawicfvYJvvySbAjj44ZFJrLq15U9RH3R6J2BQ0=; b=ck7WIIbnPg9VvGYYRq6qRm7mg8ywaJko5UQWKRJmvFKf3rMUGMCOFW0EGbnNJifE79gCt8 RXoReUUKfoyYU0LrYFaeWYzErOOKKNf503m2QlXNs/wvY1Uw5IImnbNEcNCU62NFbi8TI8 BQmUFupb/vVRuw3tzeVyk1ohWUJq//8= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 74/86] sparc:niagara: use memdev for RAM Date: Tue, 31 Dec 2019 14:03:58 +0100 Message-Id: <1577797450-88458-75-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: FJP86F50N-mLb5BjbnVO4Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/sparc64/niagara.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index 5eb2d09..ab5ef8c 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -40,7 +40,6 @@ =20 typedef struct NiagaraBoardState { MemoryRegion hv_ram; - MemoryRegion partition_ram; MemoryRegion nvram; MemoryRegion md_rom; MemoryRegion hv_rom; @@ -111,11 +110,8 @@ static void niagara_init(MachineState *machine) NIAGARA_HV_RAM_SIZE, &error_fatal); memory_region_add_subregion(sysmem, NIAGARA_HV_RAM_BASE, &s->hv_ram); =20 - memory_region_allocate_system_memory(&s->partition_ram, NULL, - "sun4v-partition.ram", - machine->ram_size); memory_region_add_subregion(sysmem, NIAGARA_PARTITION_RAM_BASE, - &s->partition_ram); + machine->ram); =20 memory_region_init_ram(&s->nvram, NULL, "sun4v.nvram", NIAGARA_NVRAM_S= IZE, &error_fatal); @@ -173,6 +169,7 @@ static void niagara_class_init(ObjectClass *oc, void *d= ata) mc->max_cpus =3D 1; /* XXX for now */ mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Sun-UltraSparc-T1"); + mc->default_ram_id =3D "sun4v-partition.ram"; } =20 static const TypeInfo niagara_type =3D { --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800521; cv=none; d=zohomail.com; s=zohoarc; b=Rv6HJyf5JVJTsmSRunXfOZKxI8t57JoOBofVdFaxn8mz5KxK0Rzmm3qXpZ4qldlRY0GYfk/ix4RmkqGnq1tBsx5PUZ4zH+W8Uhgg4aBEM2iDzqHRtWyuz5PxEjgTsAFi+j+gTDV2ad0s5BhS9uMYOfF00y6GeIhTE8eSeyVIBwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800521; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=xspjIcab32QvP0zLCFA9IMZkGJhuqVSXKSb0amoRnYA=; b=P9NLYQ5ACTJvqOmzINe/WrxrjF67V2CFzMyTS+aCD6yhxFy8+IjAEqCwZ+zstV2uG2nU/XeX1B+W4D9HcbRh7ZWY6toAxmKypxJfw/9O3z10mg9rrl8+nv++BW4ddQLqkBmR01mupOOVn6CxoNWk5zfDxwEllpLV/CpXswOXjBo= 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 1577800521500940.7160003473467; Tue, 31 Dec 2019 05:55:21 -0800 (PST) Received: from localhost ([::1]:42824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHzT-0004DE-Pt for importer@patchew.org; Tue, 31 Dec 2019 08:55:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57431) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCg-00069I-Ke for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCf-00051r-8z for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:54 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:50584 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCf-0004zV-4A for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-G1t79d29PYarx10cym9wDA-1; Tue, 31 Dec 2019 08:04:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0FCF4800D41 for ; Tue, 31 Dec 2019 13:04:50 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B8F9620A6 for ; Tue, 31 Dec 2019 13:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797492; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xspjIcab32QvP0zLCFA9IMZkGJhuqVSXKSb0amoRnYA=; b=dCJOxc9fAqFbcp9VhFfYrgDw7J3ueGyXT0j0MLicnLwDI6CWJu4hBCpRw2CCCTRLgwhlOY YXnIAew9n4OaELSHwbO8qeuH1zvnFCOIKuvBpghjM5d3rGBLBsfaKczRu+UnmcxqVqmzxR RbdeTPb83ByqCZqjk/bcEHXnf8gKuB0= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 75/86] remove no longer used memory_region_allocate_system_memory() Date: Tue, 31 Dec 2019 14:03:59 +0100 Message-Id: <1577797450-88458-76-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: G1t79d29PYarx10cym9wDA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" all boards were switched to using memdev backend for main RAM, so we can drop no longer used memory_region_allocate_system_memory() Signed-off-by: Igor Mammedov --- include/hw/boards.h | 32 -------------------------------- hw/core/numa.c | 34 ---------------------------------- 2 files changed, 66 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 70491c1..9f69883 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -12,38 +12,6 @@ #include "qom/object.h" #include "hw/core/cpu.h" =20 -/** - * memory_region_allocate_system_memory - Allocate a board's main memory - * @mr: the #MemoryRegion to be initialized - * @owner: the object that tracks the region's reference count - * @name: name of the memory region - * @ram_size: size of the region in bytes - * - * This function allocates the main memory for a board model, and - * initializes @mr appropriately. It also arranges for the memory - * to be migrated (by calling vmstate_register_ram_global()). - * - * Memory allocated via this function will be backed with the memory - * backend the user provided using "-mem-path" or "-numa node,memdev=3D..." - * if appropriate; this is typically used to cause host huge pages to be - * used. This function should therefore be called by a board exactly once, - * for the primary or largest RAM area it implements. - * - * For boards where the major RAM is split into two parts in the memory - * map, you can deal with this by calling memory_region_allocate_system_me= mory() - * once to get a MemoryRegion with enough RAM for both parts, and then - * creating alias MemoryRegions via memory_region_init_alias() which - * alias into different parts of the RAM MemoryRegion and can be mapped - * into the memory map in the appropriate places. - * - * Smaller pieces of memory (display RAM, static RAMs, etc) don't need - * to be backed via the -mem-path memory backend and can simply - * be created via memory_region_init_ram(). - */ -void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, - const char *name, - uint64_t ram_size); - #define TYPE_MACHINE_SUFFIX "-machine" =20 /* Machine class name that needs to be used for class-name-based machine diff --git a/hw/core/numa.c b/hw/core/numa.c index a752866..623b307 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -509,40 +509,6 @@ void numa_cpu_pre_plug(const CPUArchId *slot, DeviceSt= ate *dev, Error **errp) } } =20 -static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner, - const char *name, - uint64_t ram_size) -{ - if (mem_path) { -#ifdef __linux__ - memory_region_init_ram_from_file(mr, owner, name, ram_size, 0, 0, - mem_path, &error_fatal); -#else - fprintf(stderr, "-mem-path not supported on this host\n"); - exit(1); -#endif - } else { - memory_region_init_ram_nomigrate(mr, owner, name, ram_size, &error= _fatal); - } - vmstate_register_ram_global(mr); -} - -void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, - const char *name, - uint64_t ram_size) -{ - MachineState *ms =3D MACHINE(qdev_get_machine()); - - if (ms->numa_state =3D=3D NULL || - ms->numa_state->num_nodes =3D=3D 0 || numa_uses_legacy_mem()) { - allocate_system_memory_nonnuma(mr, owner, name, ram_size); - return; - } - - memory_region_init(mr, owner, name, ram_size); - numa_init_memdev_container(ms, mr); -} - static void numa_stat_memory_devices(NumaNodeMem node_mem[]) { MemoryDeviceInfoList *info_list =3D qmp_memory_device_list(); --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800242; cv=none; d=zohomail.com; s=zohoarc; b=cLlRG/QcauvWaQHin6UM+m6uWyCFpwBOQ3yA0T12wpGdNgXkcDs4AUj/eZ5d2BZwhD/D565Onosb1O+tXa19werruFcLEkP9+cnExx8S9l5cPWflcc3YSQfZTn0BnaN9Oo1w3RtAwv1S+BA7mvSksk7kyeXJqp5+hh9tfx59vlI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800242; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Bqxe3/LncuS1EZbtoURcBkIZeQhXsx9IG0m/GfFxDT8=; b=D8Lj883nYV//kDdh2SCCNHg1knxhnd8ERWk+MZ4NFz5U2tRaP2ibObZ79dozoXdWUWQ6hpXfZlYzldr30mTY2hM7WtmLXPmPuhYRMmrjleT3w4AzHYi9yaJ5Zm/MhpTSVxtFXV6LNXYgUeFu4GXoCXNFk6OUPJ0hchmd7S5XnjU= 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 1577800242164294.18723099231795; Tue, 31 Dec 2019 05:50:42 -0800 (PST) Received: from localhost ([::1]:42766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHuy-0005nb-PT for importer@patchew.org; Tue, 31 Dec 2019 08:50:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57476) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCh-0006AP-BY for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCf-00054R-Oy for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:55 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59249 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCf-00051e-IV for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-aYGrW5XXPM2alDrmosd2Sg-1; Tue, 31 Dec 2019 08:04:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D157918031CD for ; Tue, 31 Dec 2019 13:04:50 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 597D8620A6 for ; Tue, 31 Dec 2019 13:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bqxe3/LncuS1EZbtoURcBkIZeQhXsx9IG0m/GfFxDT8=; b=PB8GrB7hqkIBFdzMqIUzR3M/h41sRFGV8VQ2ZnF2PYFyetp7CdjAKI6JR973ERbjz8q1Dx E+H3pgore4iQQt8O/ieM4vy3GnkOEl9eP9++1Xt+EuRfrTdwbl7PtblCS5CbYmeKt5oOqN jlZqrJ5lQ/6UdbDZ6mKFvgwg2R5gVkI= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 76/86] post conversion default_ram_id cleanup Date: Tue, 31 Dec 2019 14:04:00 +0100 Message-Id: <1577797450-88458-77-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: aYGrW5XXPM2alDrmosd2Sg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With default_ram_id is always defined, simplify 'if' conditions in vl.c and numa.c while at it set MachineClass::default_ram_id =3D "ram" and clean up several boards that use "ram" id Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/alpha/dp264.c | 1 - hw/arm/aspeed.c | 1 - hw/arm/digic_boards.c | 1 - hw/arm/raspi.c | 2 -- hw/core/machine.c | 1 + hw/core/null-machine.c | 1 - hw/core/numa.c | 2 +- hw/hppa/machine.c | 1 - hw/ppc/virtex_ml507.c | 1 - vl.c | 1 - 10 files changed, 2 insertions(+), 10 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 29439c7..f6b9e50 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -183,7 +183,6 @@ static void clipper_machine_init(MachineClass *mc) mc->max_cpus =3D 4; mc->is_default =3D 1; mc->default_cpu_type =3D ALPHA_CPU_TYPE_NAME("ev67"); - mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("clipper", clipper_machine_init) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 330254b..188d42f 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -391,7 +391,6 @@ static void aspeed_machine_class_init(ObjectClass *oc, = void *data) mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->no_parallel =3D 1; - mc->default_ram_id =3D "ram"; } =20 static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data) diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c index c3bc5cb..c3cffb3 100644 --- a/hw/arm/digic_boards.c +++ b/hw/arm/digic_boards.c @@ -149,7 +149,6 @@ static void canon_a1100_machine_init(MachineClass *mc) mc->init =3D &canon_a1100_init; mc->ignore_memory_transaction_failures =3D true; mc->default_ram_size =3D 64 * MiB; - mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("canon-a1100", canon_a1100_machine_init) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 33ace66..3d49dcc 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -223,7 +223,6 @@ static void raspi2_machine_init(MachineClass *mc) mc->min_cpus =3D BCM283X_NCPUS; mc->default_cpus =3D BCM283X_NCPUS; mc->default_ram_size =3D 1 * GiB; - mc->default_ram_id =3D "ram"; mc->ignore_memory_transaction_failures =3D true; }; DEFINE_MACHINE("raspi2", raspi2_machine_init) @@ -246,7 +245,6 @@ static void raspi3_machine_init(MachineClass *mc) mc->min_cpus =3D BCM283X_NCPUS; mc->default_cpus =3D BCM283X_NCPUS; mc->default_ram_size =3D 1 * GiB; - mc->default_ram_id =3D "ram"; } DEFINE_MACHINE("raspi3", raspi3_machine_init) #endif diff --git a/hw/core/machine.c b/hw/core/machine.c index 080ce57..a938052 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -711,6 +711,7 @@ static void machine_class_init(ObjectClass *oc, void *d= ata) =20 /* Default 128 MB as guest ram size */ mc->default_ram_size =3D 128 * MiB; + mc->default_ram_id =3D "ram"; mc->rom_file_has_mr =3D true; mc->smp_parse =3D smp_parse; =20 diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c index cb47d9d..08c6109 100644 --- a/hw/core/null-machine.c +++ b/hw/core/null-machine.c @@ -49,7 +49,6 @@ static void machine_none_machine_init(MachineClass *mc) mc->init =3D machine_none_init; mc->max_cpus =3D 1; mc->default_ram_size =3D 0; - mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("none", machine_none_machine_init) diff --git a/hw/core/numa.c b/hw/core/numa.c index 623b307..6a1711d 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -459,7 +459,7 @@ void numa_complete_configuration(MachineState *ms) exit(1); } =20 - if (!numa_uses_legacy_mem() && mc->default_ram_id) { + if (!numa_uses_legacy_mem()) { ms->ram =3D g_new(MemoryRegion, 1); memory_region_init(ms->ram, OBJECT(ms), mc->default_ram_id, ram_size); diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index b2f7bc5..ebbf44f 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -279,7 +279,6 @@ static void machine_hppa_machine_init(MachineClass *mc) mc->is_default =3D 1; mc->default_ram_size =3D 512 * MiB; mc->default_boot_order =3D "cd"; - mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("hppa", machine_hppa_machine_init) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index b74a269..b31f1cf 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -299,7 +299,6 @@ static void virtex_machine_init(MachineClass *mc) mc->desc =3D "Xilinx Virtex ML507 reference design"; mc->init =3D virtex_init; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("440-xilinx"); - mc->default_ram_id =3D "ram"; } =20 DEFINE_MACHINE("virtex-ml507", virtex_machine_init) diff --git a/vl.c b/vl.c index b89e76c..60dffb4 100644 --- a/vl.c +++ b/vl.c @@ -4296,7 +4296,6 @@ int main(int argc, char **argv, char **envp) =20 if (numa_uses_legacy_mem() && machine_class->default_ram_size && - machine_class->default_ram_id && !current_machine->ram_memdev) { create_default_memdev(current_machine, mem_path, mem_prealloc); } --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800511; cv=none; d=zohomail.com; s=zohoarc; b=KfBiOyJwgmM/9ndV3IeR24+ch1ocvCv7sc8usvlZGEuJQU4BGZ7zr+HfNkQuBXOO9FqnOYO3n5l/fhcw6k4UYfp6GQhnHAK3lPmIvGlJZKj4b0d8tPEiFh0LfWNuarkSXkYJbO531mTPA0phZjHSU4G6VJG4rjpBz3V+D9dS4lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800511; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ogW+EFqqnnwiHLDYruVGlKO6poTQH/msccHNIijYD9M=; b=dtgimufWpMFQM3KEu8ve26wVbEZO7Ljw1uUft8lk7GqX2LRg4SyI3zLOdpZknUHYWsu1YmJPhOOxhZhHBJxt9kw6rxVOnvr4x4o+EhmywB8SXHTfupkF9ruGuw7s4sbmQU7hvF5M69RjhqDURUwtciC9IQyXchl3mSLP6tGvSUo= 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 1577800511510621.3848866230661; Tue, 31 Dec 2019 05:55:11 -0800 (PST) Received: from localhost ([::1]:42822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHzJ-0003uB-T8 for importer@patchew.org; Tue, 31 Dec 2019 08:55:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57530) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCi-0006BO-0K for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCg-00058h-Lb for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:55 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:29573 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCg-00056e-H3 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:54 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-8Y2o6AmlOF--_7NJ72Qamg-1; Tue, 31 Dec 2019 08:04:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6E99800EB8 for ; Tue, 31 Dec 2019 13:04:51 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 291BC78E96 for ; Tue, 31 Dec 2019 13:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ogW+EFqqnnwiHLDYruVGlKO6poTQH/msccHNIijYD9M=; b=I3LOPfekT1IhT0lwRDQhx6xVYVuvF1DTD40F1gUaoJ1O2kBVBjjN0hw0JeMt/yu6We4IDi yJC9O1dFD4mzU/hj74k2U7DNFWHT0Zbl0XqqfkaGUhzI8rD1BnY/1brvgIih5RF69NT3sN sb9BFyywlbj9ekuQckV9dnoJ2qKL6Xk= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 77/86] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize() Date: Tue, 31 Dec 2019 14:04:01 +0100 Message-Id: <1577797450-88458-78-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 8Y2o6AmlOF--_7NJ72Qamg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since all RAM is backed by hostmem backends, drop global -mem-path invariant and simplify code. Signed-off-by: Igor Mammedov --- exec.c | 51 +++++---------------------------------------------- 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/exec.c b/exec.c index d4b769d..7b6e376 100644 --- a/exec.c +++ b/exec.c @@ -1667,60 +1667,19 @@ static int find_max_backend_pagesize(Object *obj, v= oid *opaque) */ long qemu_minrampagesize(void) { - long hpsize =3D LONG_MAX; - long mainrampagesize; - Object *memdev_root; - MachineState *ms =3D MACHINE(qdev_get_machine()); - - mainrampagesize =3D qemu_mempath_getpagesize(mem_path); - - /* it's possible we have memory-backend objects with - * hugepage-backed RAM. these may get mapped into system - * address space via -numa parameters or memory hotplug - * hooks. we want to take these into account, but we - * also want to make sure these supported hugepage - * sizes are applicable across the entire range of memory - * we may boot from, so we take the min across all - * backends, and assume normal pages in cases where a - * backend isn't backed by hugepages. - */ - memdev_root =3D object_resolve_path("/objects", NULL); - if (memdev_root) { - object_child_foreach(memdev_root, find_min_backend_pagesize, &hpsi= ze); - } - if (hpsize =3D=3D LONG_MAX) { - /* No additional memory regions found =3D=3D> Report main RAM page= size */ - return mainrampagesize; - } - - /* If NUMA is disabled or the NUMA nodes are not backed with a - * memory-backend, then there is at least one node using "normal" RAM, - * so if its page size is smaller we have got to report that size inst= ead. - */ - if (hpsize > mainrampagesize && - (ms->numa_state =3D=3D NULL || - ms->numa_state->num_nodes =3D=3D 0 || - ms->numa_state->nodes[0].node_memdev =3D=3D NULL)) { - static bool warned; - if (!warned) { - error_report("Huge page support disabled (n/a for main memory)= ."); - warned =3D true; - } - return mainrampagesize; - } + long hpsize; + Object *memdev_root =3D object_resolve_path("/objects", NULL); =20 + object_child_foreach(memdev_root, find_min_backend_pagesize, &hpsize); return hpsize; } =20 long qemu_maxrampagesize(void) { - long pagesize =3D qemu_mempath_getpagesize(mem_path); + long pagesize; Object *memdev_root =3D object_resolve_path("/objects", NULL); =20 - if (memdev_root) { - object_child_foreach(memdev_root, find_max_backend_pagesize, - &pagesize); - } + object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize= ); return pagesize; } #else --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800387; cv=none; d=zohomail.com; s=zohoarc; b=NUaLTfadxBsAQ6XIV5IfyFhDxsNklui1mCEYqzlG1bOJSDajBHolXqjTnY25D0AtteGQUQPsTGTvl3FoUhDURPmoqtSMSWWEpMNIg0atXF8vImKIaQmmuOOlasjPJwWA3SFLEcA31iu/6afjBqkiwQZtAoHSWxJ9gupghp6MAD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800387; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=LMGc6OlKEr8+jw0USTCrPjZRkgbS/AJVOPVE5QUjHm8=; b=mIMFPsFj5bWZKbsAzcUpPOQTcs4EgyGC/TwmrCwjjtLa79BVfFFcDra2HgfUcJO5h5Hi9uRDRIMH3XxWY6Mt11k2tStF6xBxtW9gdLUWfHZaQxL75UL8tJX7ZcQq7UUsAQmNjznNYbTv8PlPZdaqvUbXwGjFUWeq++hTu2EksN8= 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 1577800387784116.36665993546137; Tue, 31 Dec 2019 05:53:07 -0800 (PST) Received: from localhost ([::1]:42802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHxJ-0000vK-Ul for importer@patchew.org; Tue, 31 Dec 2019 08:53:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57549) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCi-0006C6-De for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCh-0005BK-4q for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:56 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:22475 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCg-00058w-Vt for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-saGAYsgvPAufW0g84ggx_Q-1; Tue, 31 Dec 2019 08:04:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6EDC6801E66 for ; Tue, 31 Dec 2019 13:04:52 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAFD3620A6 for ; Tue, 31 Dec 2019 13:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LMGc6OlKEr8+jw0USTCrPjZRkgbS/AJVOPVE5QUjHm8=; b=OSzuKu/NqhSJF5cMnh5LyuQB5De8vvCgKyd86IZEDBWifgOhcdpHh70WPU2O/RmNoavCQm z9lINvBg3lCdoI/dlJP3qmrFWlmSYR8H/jWydjmHzcQbv5oqQGVwaUCgDbHCshC7dp85Qe +RmybfCBem5tWrtB+GZb5HwNeRfWNmg= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 78/86] exec: drop bogus mem_path from qemu_ram_alloc_from_fd() Date: Tue, 31 Dec 2019 14:04:02 +0100 Message-Id: <1577797450-88458-79-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: saGAYsgvPAufW0g84ggx_Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Function will report error that will mention global mem_path, which was valid the only if legacy -mem-path was used and only in case of main RAM. However it doesn't work with hostmem backends (for example: " qemu: -object memory-backend-file,id=3Dram0,size=3D128M,mem-path=3Dfoo: backing store (null) size 0x200000 does not match 'size' option 0x80000= 00 ") and couldn't possibly work in general FD case the function is supposed to handle. Taking in account that main RAM was converted into memory-backend-foo object, there is no point in printing file name (from inappropriate place) as failing path is a part of backend's error message. Hence drop bogus mem_path usage from qemu_ram_alloc_from_fd(), it's a job of its user to add file name to error message if applicable. Signed-off-by: Igor Mammedov --- exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 7b6e376..d0a7e7e 100644 --- a/exec.c +++ b/exec.c @@ -2308,9 +2308,9 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, Mem= oryRegion *mr, size =3D HOST_PAGE_ALIGN(size); file_size =3D get_file_size(fd); if (file_size > 0 && file_size < size) { - error_setg(errp, "backing store %s size 0x%" PRIx64 + error_setg(errp, "backing store size 0x%" PRIx64 " does not match 'size' option 0x" RAM_ADDR_FMT, - mem_path, file_size, size); + file_size, size); return NULL; } =20 --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800660; cv=none; d=zohomail.com; s=zohoarc; b=bZ9xhKKar9G59V+AVy+kA+MjZVlk9ZNgsECxYHIyAbtameK4FFFSsXG3ZL2TmZng+MXoL8Z/OgPId6X27x6HV/ttxf0NptOFeNR0gwQQ2Gjm5cCC6eYDCStMYTeAXWmIVXEPzPM51a/9X7TYKiMoABWvxF3J0rLwXpHn/JO2u4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800660; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=L4FIU7l8aHF+JOoUTi8oH5RPAOXgLNMJ1yy3YOAblVo=; b=DvOyWHBBUCU9fKbphSTF7la9W9HosV0JNOi6TiDF1uxLV7+wfT0SfIPqt5P9tiroRDHzKP6VYgSpfx5GoIOGiB6ymLMGQC0bbACXTPMJ9Nip+1NXs/E/1DWBXJax4AkVob3f9bsxjluZJH4Sq8CUFQ9K02GDK6t/y3DuyXsRTus= 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 1577800660256416.64436731144326; Tue, 31 Dec 2019 05:57:40 -0800 (PST) Received: from localhost ([::1]:42862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI1i-0007Xd-TC for importer@patchew.org; Tue, 31 Dec 2019 08:57:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57615) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCj-0006Dz-CN for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCi-0005GK-2d for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:57 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:50010 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCh-0005Dl-Tf for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-1yzh4JCjPxCLd0GBoDYIGg-1; Tue, 31 Dec 2019 08:04:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D54D800D4E for ; Tue, 31 Dec 2019 13:04:53 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8962620A6 for ; Tue, 31 Dec 2019 13:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L4FIU7l8aHF+JOoUTi8oH5RPAOXgLNMJ1yy3YOAblVo=; b=QnPdRT8l4G7Em+HCl+IQtl+w/LvIAU+kC1hVZtLiptVcp+S/ZqILJL5D9WFbX/P/qEzmm8 K/sQNhsTUPXQ90anauBEZS6VspwAl7Kg5SfRBxdiscmznlNK2dwO156eML9UckF+vKxwnh CcPBG5M4f443GhgMvZQsJLQWTagAZgU= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 79/86] make mem_path local variable Date: Tue, 31 Dec 2019 14:04:03 +0100 Message-Id: <1577797450-88458-80-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 1yzh4JCjPxCLd0GBoDYIGg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It's no longer used anywhere beside main(), so make it local variable that is used for CLI compat purposes to keep -mem-path option working. Under hood QEMU will use it to create memory-backend-file,mem-path=3D... backend and use its MemoryRegion as main RAM. Signed-off-by: Igor Mammedov --- include/sysemu/sysemu.h | 1 - vl.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 80c57fd..8de9065 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -53,7 +53,6 @@ extern uint8_t *boot_splash_filedata; extern bool enable_mlock; extern bool enable_cpu_pm; extern QEMUClockType rtc_clock; -extern const char *mem_path; extern int mem_prealloc; =20 #define MAX_OPTION_ROMS 16 diff --git a/vl.c b/vl.c index 60dffb4..4ee14f6 100644 --- a/vl.c +++ b/vl.c @@ -140,7 +140,6 @@ enum vga_retrace_method vga_retrace_method =3D VGA_RETR= ACE_DUMB; int display_opengl; const char* keyboard_layout =3D NULL; ram_addr_t ram_size; -const char *mem_path =3D NULL; int mem_prealloc =3D 0; /* force preallocation of physical target memory */ bool enable_mlock =3D false; bool enable_cpu_pm =3D false; @@ -2868,6 +2867,7 @@ int main(int argc, char **argv, char **envp) Error *err =3D NULL; bool list_data_dirs =3D false; char *dir, **dirs; + const char *mem_path =3D NULL; BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); =20 --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800540; cv=none; d=zohomail.com; s=zohoarc; b=h1d+GoX30kR1sXXoODD6MEnIXWrX//fGf8wqx/7kT2AckH/uJutZ1F+uttE/GSShieOx4/T+e8LvNOhsRm1p/1BcRH5Z2O+KTUVJuaobWCEWN5ShGe61P74Ebfhhytng/s5rOjn36IYAfn/KBfD03QsQ6PJDWzQdCuSMiDwpLQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800540; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=tjcOu+2wSxSGfmZV6LKpFE/mxol9cpFHwwpY9/5NU+c=; b=hBX99Z3nzZ8mx9a/FLrvNlhkpPKojn8DP5we7l84mwu/gUHEYa5AHyldeSJDJbpTf7sc9yA9rFrgeoaxnv4yiID/S8p919nP2R2zMWwHqBNrh1S745hpK4K2w6aXKRnSbTSlGSOL8GWUkdYEV6DKTwhtJfuBMQYNzjQhHEYOBC4= 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 1577800540956913.1497000532595; Tue, 31 Dec 2019 05:55:40 -0800 (PST) Received: from localhost ([::1]:42826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHzk-0004ec-Q0 for importer@patchew.org; Tue, 31 Dec 2019 08:55:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57698) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCk-0006GD-PA for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCj-0005LL-0M for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:60700 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCi-0005Io-Qh for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-338-r2mBroj7MVySxdojLlLGoQ-1; Tue, 31 Dec 2019 08:04:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BFA118031D0 for ; Tue, 31 Dec 2019 13:04:54 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87E86620A6 for ; Tue, 31 Dec 2019 13:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tjcOu+2wSxSGfmZV6LKpFE/mxol9cpFHwwpY9/5NU+c=; b=AKl7Ze93eNbQBq4FRCB9bIZ54cZP0SsAPB41iMMKjxX1+yZazjfezIU+22A8bVcx74HQTq 4W9YizmWuBSHyh7z9W9SHkAb1A/xeO4Uar1wl3WEp0tiSysEXl9aq4z9CP4+8yAyTNHzlP i6K62iQrbJANA6uDYNEc/ujpo3tZUAU= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 80/86] hostmem: introduce "prealloc-threads" property Date: Tue, 31 Dec 2019 14:04:04 +0100 Message-Id: <1577797450-88458-81-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: r2mBroj7MVySxdojLlLGoQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" the property will allow user to specify number of threads to use in pre-allocation stage. It also will allow to reduce implicit hostmem dependency on current_machine. On object creation it will default to 1, but via machine compat property it will be updated to MachineState::smp::cpus to keep current behavior for hostmem and main RAM (which is now also hostmem based). Signed-off-by: Igor Mammedov --- include/sysemu/hostmem.h | 2 ++ backends/hostmem.c | 43 +++++++++++++++++++++++++++++++++++++++---- vl.c | 15 +++++++++++---- 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 5db0d66..bdf8666 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -61,6 +61,7 @@ struct HostMemoryBackendClass { * @parent: opaque parent object container * @size: amount of memory backend provides * @mr: MemoryRegion representing host memory belonging to backend + * @prealloc_threads: number of threads to be used for preallocatining RAM */ struct HostMemoryBackend { /* private */ @@ -70,6 +71,7 @@ struct HostMemoryBackend { uint64_t size; bool merge, dump, use_canonical_path; bool prealloc, force_prealloc, is_mapped, share; + uint32_t prealloc_threads; DECLARE_BITMAP(host_nodes, MAX_NODES + 1); HostMemPolicy policy; =20 diff --git a/backends/hostmem.c b/backends/hostmem.c index e773bdf..4c23c77 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -223,7 +223,6 @@ static void host_memory_backend_set_prealloc(Object *ob= j, bool value, { Error *local_err =3D NULL; HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); - MachineState *ms =3D MACHINE(qdev_get_machine()); =20 if (backend->force_prealloc) { if (value) { @@ -243,7 +242,7 @@ static void host_memory_backend_set_prealloc(Object *ob= j, bool value, void *ptr =3D memory_region_get_ram_ptr(&backend->mr); uint64_t sz =3D memory_region_size(&backend->mr); =20 - os_mem_prealloc(fd, ptr, sz, ms->smp.cpus, &local_err); + os_mem_prealloc(fd, ptr, sz, backend->prealloc_threads, &local_err= ); if (local_err) { error_propagate(errp, local_err); return; @@ -252,14 +251,45 @@ static void host_memory_backend_set_prealloc(Object *= obj, bool value, } } =20 +static void host_memory_backend_get_prealloc_threads(Object *obj, Visitor = *v, + const char *name, void *opaque, Error **errp) +{ + HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); + visit_type_uint32(v, name, &backend->prealloc_threads, errp); +} + +static void host_memory_backend_set_prealloc_threads(Object *obj, Visitor = *v, + const char *name, void *opaque, Error **errp) +{ + HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); + Error *local_err =3D NULL; + uint32_t value; + + visit_type_uint32(v, name, &value, &local_err); + if (local_err) { + goto out; + } + if (value <=3D 0) { + error_setg(&local_err, + "property '%s' of %s doesn't take value '%d'", + name, object_get_typename(obj), value); + goto out; + } + backend->prealloc_threads =3D value; +out: + error_propagate(errp, local_err); +} + static void host_memory_backend_init(Object *obj) { HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); MachineState *machine =3D MACHINE(qdev_get_machine()); =20 + /* TODO: convert this compat properties */ backend->merge =3D machine_mem_merge(machine); backend->dump =3D machine_dump_guest_core(machine); backend->prealloc =3D mem_prealloc; + backend->prealloc_threads =3D 1; } =20 static void host_memory_backend_post_init(Object *obj) @@ -313,7 +343,6 @@ host_memory_backend_memory_complete(UserCreatable *uc, = Error **errp) { HostMemoryBackend *backend =3D MEMORY_BACKEND(uc); HostMemoryBackendClass *bc =3D MEMORY_BACKEND_GET_CLASS(uc); - MachineState *ms =3D MACHINE(qdev_get_machine()); Error *local_err =3D NULL; void *ptr; uint64_t sz; @@ -378,7 +407,7 @@ host_memory_backend_memory_complete(UserCreatable *uc, = Error **errp) */ if (backend->prealloc) { os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz, - ms->smp.cpus, &local_err); + backend->prealloc_threads, &local_err); if (local_err) { goto out; } @@ -456,6 +485,12 @@ host_memory_backend_class_init(ObjectClass *oc, void *= data) host_memory_backend_set_prealloc, &error_abort); object_class_property_set_description(oc, "prealloc", "Preallocate memory", &error_abort); + object_class_property_add(oc, "prealloc-threads", "int", + host_memory_backend_get_prealloc_threads, + host_memory_backend_set_prealloc_threads, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, "prealloc-threads", + "Number of CPU threads to use for prealloc", &error_abort); object_class_property_add(oc, "size", "int", host_memory_backend_get_size, host_memory_backend_set_size, diff --git a/vl.c b/vl.c index 4ee14f6..61501cc 100644 --- a/vl.c +++ b/vl.c @@ -2814,8 +2814,7 @@ static void configure_accelerators(const char *progna= me) } } =20 -static void create_default_memdev(MachineState *ms, const char *path, - bool prealloc) +static void create_default_memdev(MachineState *ms, const char *path) { Object *obj; MachineClass *mc =3D MACHINE_GET_CLASS(ms); @@ -2824,7 +2823,6 @@ static void create_default_memdev(MachineState *ms, c= onst char *path, if (path) { object_property_set_str(obj, path, "mem-path", &error_fatal); } - object_property_set_bool(obj, prealloc, "prealloc", &error_fatal); object_property_set_int(obj, ms->ram_size, "size", &error_fatal); object_property_add_child(object_get_objects_root(), mc->default_ram_i= d, obj, &error_fatal); @@ -3967,6 +3965,15 @@ int main(int argc, char **argv, char **envp) exit(1); } =20 + if (mem_prealloc) { + static GlobalProperty p[] =3D { + {"memory-backend", "prealloc-threads", NULL}, + }; + + p[0].value =3D g_strdup_printf("%d", current_machine->smp.cpus); + compat_props_add(machine_class->compat_props, p, G_N_ELEMENTS(p)); + } + /* * Get the default machine options from the machine if it is not alrea= dy * specified either by the configuration file or by the command line. @@ -4297,7 +4304,7 @@ int main(int argc, char **argv, char **envp) if (numa_uses_legacy_mem() && machine_class->default_ram_size && !current_machine->ram_memdev) { - create_default_memdev(current_machine, mem_path, mem_prealloc); + create_default_memdev(current_machine, mem_path); } /* do monitor/qmp handling at preconfig state if requested */ main_loop(); --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800703; cv=none; d=zohomail.com; s=zohoarc; b=NftJJZilqAmA8aKo7RcZBn2TVGT7GesKaFDJiQgVOkrypqc5CGvFDDB+q5CE+d4JfKGZGjasEk/SaC8lhE7v6RDbE0QeEy/EYUjjb5RSH5A7UJhzb9Hkc69Fy6z6Z73fdYevhYfDA48zBjUW0mIERV65diWNvis4Xgjwz4TqV2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800703; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Xs8LnIRA2zAde8kFfiq4bXuPMiGndHHSXAMiLjjJMKY=; b=THJPbfGloAfhcTRSFpaPjtKm2D+8XAfeZKdqZ0xY6all8mZHsOQsD1T7i968fN+u2jel12ooGzELKPDq8HWbgikL6Up7EkqhzC125E1mJ2yrYF/hmeWeZP1FixKMEt4z+frX+GKjKaBhFjMaHw4hkpDb4NmXTV0eLparDsHUZ08= 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 1577800703028672.9702668829775; Tue, 31 Dec 2019 05:58:23 -0800 (PST) Received: from localhost ([::1]:42866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI2P-00089s-Fs for importer@patchew.org; Tue, 31 Dec 2019 08:58:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57760) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCl-0006I6-Py for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCj-0005QB-W7 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:59 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:33980 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCj-0005Nm-Qg for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:57 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-340-gjlngfIsOVel5on-7ngsoA-1; Tue, 31 Dec 2019 08:04:55 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CDF71800EB8 for ; Tue, 31 Dec 2019 13:04:54 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 558F678E96 for ; Tue, 31 Dec 2019 13:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xs8LnIRA2zAde8kFfiq4bXuPMiGndHHSXAMiLjjJMKY=; b=FmeXAg/lgN7YqDelYuFX8foAiOS90+cjH5U/nNDY4a5meJcQ3mM69UrRYthYEwGeexwhae BYBMYeIUHakApPRfj+ib20M6f4Kdm8CXflQVRU+9a9vjihQSdaCPd1XDJpaYyuiq094Es7 PCihgL4XLpo/EjK/pcOqZwjBR6391RY= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 81/86] hostmem: fix strict bind policy Date: Tue, 31 Dec 2019 14:04:05 +0100 Message-Id: <1577797450-88458-82-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: gjlngfIsOVel5on-7ngsoA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When option -mem-prealloc is used with one or more memory-backend objects, created backends may not obey configured bind policy or creation may fail after kernel attempts to move pages according to bind policy. Reason is in file_ram_alloc(), which will pre-allocate any descriptor based RAM if global mem_prealloc !=3D 0 and that happens way before bind policy is applied to memory range. One way to fix it would be to extend memory_region_foo() API and add more invariants that could broken later due implicit dependencies that's hard to track. Another approach is to drop adhoc main RAM allocation and consolidate it around memory-backend. That allows to have single place that allocates guest RAM (main and memdev) in the same way and then global mem_prealloc could be replaced by backend's property[s] that will affect created memory-backend objects but only in correct order this time. With main RAM now converted to hostmem backends, there is no point in keeping global mem_prealloc around, so alias -mem-prealloc to "memory-backend.prealloc=3Don" machine compat[*] property and make mem_prealloc a local variable to only stir registration of compat property. *) currently user accessible -global works only with DEVICE based objects and extra work is needed to make it work with hostmem backends. But that is convenience option and out of scope of this already huge refactoring. Hence machine compat properties were used. Signed-off-by: Igor Mammedov --- include/sysemu/hostmem.h | 2 +- include/sysemu/sysemu.h | 1 - backends/hostmem-file.c | 1 - backends/hostmem-memfd.c | 1 - backends/hostmem.c | 12 +----------- exec.c | 11 ----------- vl.c | 3 ++- 7 files changed, 4 insertions(+), 27 deletions(-) diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index bdf8666..8276e53 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -70,7 +70,7 @@ struct HostMemoryBackend { /* protected */ uint64_t size; bool merge, dump, use_canonical_path; - bool prealloc, force_prealloc, is_mapped, share; + bool prealloc, is_mapped, share; uint32_t prealloc_threads; DECLARE_BITMAP(host_nodes, MAX_NODES + 1); HostMemPolicy policy; diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 8de9065..b72c773 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -53,7 +53,6 @@ extern uint8_t *boot_splash_filedata; extern bool enable_mlock; extern bool enable_cpu_pm; extern QEMUClockType rtc_clock; -extern int mem_prealloc; =20 #define MAX_OPTION_ROMS 16 typedef struct QEMUOptionRom { diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index cb319a9..c8c355f 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -51,7 +51,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Err= or **errp) return; } =20 - backend->force_prealloc =3D mem_prealloc; name =3D host_memory_backend_get_name(backend); memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), name, diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 26070b4..74ba987 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -45,7 +45,6 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Er= ror **errp) return; } =20 - backend->force_prealloc =3D mem_prealloc; fd =3D qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size, m->hugetlb, m->hugetlbsize, m->seal ? F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL : 0, diff --git a/backends/hostmem.c b/backends/hostmem.c index 4c23c77..1f09ade 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -215,7 +215,7 @@ static bool host_memory_backend_get_prealloc(Object *ob= j, Error **errp) { HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); =20 - return backend->prealloc || backend->force_prealloc; + return backend->prealloc; } =20 static void host_memory_backend_set_prealloc(Object *obj, bool value, @@ -224,14 +224,6 @@ static void host_memory_backend_set_prealloc(Object *o= bj, bool value, Error *local_err =3D NULL; HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); =20 - if (backend->force_prealloc) { - if (value) { - error_setg(errp, - "remove -mem-prealloc to use the prealloc property"= ); - return; - } - } - if (!host_memory_backend_mr_inited(backend)) { backend->prealloc =3D value; return; @@ -288,8 +280,6 @@ static void host_memory_backend_init(Object *obj) /* TODO: convert this compat properties */ backend->merge =3D machine_mem_merge(machine); backend->dump =3D machine_dump_guest_core(machine); - backend->prealloc =3D mem_prealloc; - backend->prealloc_threads =3D 1; } =20 static void host_memory_backend_post_init(Object *obj) diff --git a/exec.c b/exec.c index d0a7e7e..cbe5bc5 100644 --- a/exec.c +++ b/exec.c @@ -1802,8 +1802,6 @@ static void *file_ram_alloc(RAMBlock *block, bool truncate, Error **errp) { - Error *err =3D NULL; - MachineState *ms =3D MACHINE(qdev_get_machine()); void *area; =20 block->page_size =3D qemu_fd_getpagesize(fd); @@ -1859,15 +1857,6 @@ static void *file_ram_alloc(RAMBlock *block, return NULL; } =20 - if (mem_prealloc) { - os_mem_prealloc(fd, area, memory, ms->smp.cpus, &err); - if (err) { - error_propagate(errp, err); - qemu_ram_munmap(fd, area, memory); - return NULL; - } - } - block->fd =3D fd; return area; } diff --git a/vl.c b/vl.c index 61501cc..e0ec743 100644 --- a/vl.c +++ b/vl.c @@ -140,7 +140,6 @@ enum vga_retrace_method vga_retrace_method =3D VGA_RETR= ACE_DUMB; int display_opengl; const char* keyboard_layout =3D NULL; ram_addr_t ram_size; -int mem_prealloc =3D 0; /* force preallocation of physical target memory */ bool enable_mlock =3D false; bool enable_cpu_pm =3D false; int nb_nics; @@ -2868,6 +2867,7 @@ int main(int argc, char **argv, char **envp) const char *mem_path =3D NULL; BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); + int mem_prealloc =3D 0; /* force preallocation of physical target memo= ry */ =20 os_set_line_buffering(); =20 @@ -3968,6 +3968,7 @@ int main(int argc, char **argv, char **envp) if (mem_prealloc) { static GlobalProperty p[] =3D { {"memory-backend", "prealloc-threads", NULL}, + {"memory-backend", "prealloc", "on"}, }; =20 p[0].value =3D g_strdup_printf("%d", current_machine->smp.cpus); --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800680; cv=none; d=zohomail.com; s=zohoarc; b=LUA8W5iGF2cIfV1rpYVEK3kcaBGk7Qb0+tm7EiUQgC6j3kcHBqbfr+abkiIx2rSue4jhK9TZ9gHyvqY4a9++WFukIyn9ps0yz+IuYsJ9Y8tHBYHe0wIi1c6UpddTJ0X0HHo8o8DyIVVvUTXzmfgu7aBeN1BvZgv6PGjmk/I5Ju4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800680; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=n1suDpFeY6Hi1dUDzgVZwOH4QcZiAqwE3RCLWXdwmKM=; b=PzeFJz2Nfw+azJpqI+1FySE103gK26ObIf49EA7O0Q/GrpH0i1K2TlE74CnkC2ksT7lGkgH/S5SujmAC3CK0jKmTo5fcfjiy1zbJiyk4lMkPVpJpTWaPczULhf8phABYkpFRxJdtk69Q3EX94Epw8sF1Xa02sz7k1i7GIPKUUd8= 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 1577800680714654.3113819198232; Tue, 31 Dec 2019 05:58:00 -0800 (PST) Received: from localhost ([::1]:42864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI22-0007lv-Uf for importer@patchew.org; Tue, 31 Dec 2019 08:57:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57803) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCm-0006JD-Cb for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCk-0005T9-JI for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:00 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:33521 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCk-0005Qn-Ed for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:58 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-421-Q4SM4k9sOPaPQBx0CoFfbw-1; Tue, 31 Dec 2019 08:04:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C3A318031CD for ; Tue, 31 Dec 2019 13:04:55 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23EEC78E96 for ; Tue, 31 Dec 2019 13:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n1suDpFeY6Hi1dUDzgVZwOH4QcZiAqwE3RCLWXdwmKM=; b=XXPviWHX+g5UtybICDtJdk9JsKRU7VoTcCR6SB/R1JNiPgszuy8wDwp9RFtGGu6FIhNIRc FLAI/rZllfxMuwmpqVqDgDc5QLnSk557/psxnLPHuRzaYBuNYYxsIMkFhdkOU9uYBdPjGj LSsXOoUELslRdNn9IvX6Fxt7CCkZbvM= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 82/86] numa: forbid '-numa node, mem' for 5.0 and newer machine types Date: Tue, 31 Dec 2019 14:04:06 +0100 Message-Id: <1577797450-88458-83-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Q4SM4k9sOPaPQBx0CoFfbw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Deprecation period is ran out and it's a time to flip the switch introduced by cd5ff8333a. Disable legacy option for new machine types and amend documentation. Signed-off-by: Igor Mammedov --- hw/arm/virt.c | 2 +- hw/core/numa.c | 6 ++++++ hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + hw/ppc/spapr.c | 2 +- qemu-deprecated.texi | 16 ---------------- qemu-options.hx | 8 ++++---- 8 files changed, 14 insertions(+), 23 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e2fbca3..49de0d8 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2049,7 +2049,6 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) hc->pre_plug =3D virt_machine_device_pre_plug_cb; hc->plug =3D virt_machine_device_plug_cb; hc->unplug_request =3D virt_machine_device_unplug_request_cb; - mc->numa_mem_supported =3D true; mc->auto_enable_numa_with_memhp =3D true; mc->default_ram_id =3D "mach-virt.ram"; } @@ -2153,6 +2152,7 @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 0) static void virt_machine_4_2_options(MachineClass *mc) { compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); + mc->numa_mem_supported =3D true; } DEFINE_VIRT_MACHINE(4, 2) =20 diff --git a/hw/core/numa.c b/hw/core/numa.c index 6a1711d..beb6d2e 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -116,6 +116,12 @@ static void parse_numa_node(MachineState *ms, NumaNode= Options *node, } =20 if (node->has_mem) { + if (!mc->numa_mem_supported) { + error_setg(errp, "Parameter -numa node,mem is not supported by= this" + " machine type. Use -numa node,memdev instead"); + return; + } + numa_info[nodenr].node_mem =3D node->mem; if (!qtest_enabled()) { warn_report("Parameter -numa node,mem is deprecated," diff --git a/hw/i386/pc.c b/hw/i386/pc.c index aa956aa..80cd971 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1948,7 +1948,6 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) hc->unplug =3D pc_machine_device_unplug_cb; mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; mc->nvdimm_supported =3D true; - mc->numa_mem_supported =3D true; mc->default_ram_id =3D "pc.ram"; =20 object_class_property_add(oc, PC_MACHINE_DEVMEM_REGION_SIZE, "int", diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 721c7aa..b2805fe 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -436,6 +436,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass = *m) pc_i440fx_5_0_machine_options(m); m->alias =3D NULL; m->is_default =3D 0; + m->numa_mem_supported =3D true; compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len); compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 52f4573..f15711b 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -364,6 +364,7 @@ static void pc_q35_4_2_machine_options(MachineClass *m) { pc_q35_5_0_machine_options(m); m->alias =3D NULL; + m->numa_mem_supported =3D true; compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len); compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len); } diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 915e36a..6527962 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4385,7 +4385,6 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) * in which LMBs are represented and hot-added */ mc->numa_mem_align_shift =3D 28; - mc->numa_mem_supported =3D true; mc->auto_enable_numa =3D true; =20 smc->default_caps.caps[SPAPR_CAP_HTM] =3D SPAPR_CAP_OFF; @@ -4467,6 +4466,7 @@ static void spapr_machine_4_2_class_options(MachineCl= ass *mc) { spapr_machine_5_0_class_options(mc); compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); + mc->numa_mem_supported =3D true; } =20 DEFINE_SPAPR_MACHINE(4_2, "4.2", false); diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 5178905..d9b07ba 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -89,22 +89,6 @@ error in the future. The @code{-realtime mlock=3Don|off} argument has been replaced by the @code{-overcommit mem-lock=3Don|off} argument. =20 -@subsection -numa node,mem=3D@var{size} (since 4.1) - -The parameter @option{mem} of @option{-numa node} is used to assign a part= of -guest RAM to a NUMA node. But when using it, it's impossible to manage spe= cified -RAM chunk on the host side (like bind it to a host node, setting bind poli= cy, ...), -so guest end-ups with the fake NUMA configuration with suboptiomal perform= ance. -However since 2014 there is an alternative way to assign RAM to a NUMA node -using parameter @option{memdev}, which does the same as @option{mem} and a= dds -means to actualy manage node RAM on the host side. Use parameter @option{m= emdev} -with @var{memory-backend-ram} backend as an replacement for parameter @opt= ion{mem} -to achieve the same fake NUMA effect or a properly configured -@var{memory-backend-file} backend to actually benefit from NUMA configurat= ion. -In future new machine versions will not accept the option but it will still -work with old machine types. User can check QAPI schema to see if the lega= cy -option is supported by looking at MachineInfo::numa-mem-supported property. - @subsection -numa node (without memory specified) (since 4.1) =20 Splitting RAM by default between NUMA nodes has the same issues as @option= {mem} diff --git a/qemu-options.hx b/qemu-options.hx index e9d6231..088dd32 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -214,10 +214,10 @@ For example: -numa cpu,node-id=3D0,socket-id=3D0 -numa cpu,node-id=3D1,socket-id=3D1 @end example =20 -@samp{mem} assigns a given RAM amount to a node. @samp{memdev} -assigns RAM from a given memory backend device to a node. If -@samp{mem} and @samp{memdev} are omitted in all nodes, RAM is -split equally between them. +Legacy @samp{mem} assigns a given RAM amount to a node (not supported for = 5.0 +and newer machine types). @samp{memdev} assigns RAM from a given memory ba= ckend +device to a node. If @samp{mem} and @samp{memdev} are omitted in all nodes= , RAM +is split equally between them. =20 @samp{mem} and @samp{memdev} are mutually exclusive. Furthermore, if one node uses @samp{memdev}, all of them have to use it. --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577800876; cv=none; d=zohomail.com; s=zohoarc; b=Utc4VRYR3O92BfSqt79Mrn4fMnS8N+JAAEkKnCjCkMNi/vJ0xEBB1ct/9EifmNMWf9IBAYApGIgewUjNX7wFu7D3lFhTspe7lVVU8h1MDvvgis0cUAdzRn4ivkoQ0WdgFDt/SPteEhZ0gxlIMJs82ZJe7uJw2RHuZAcCf8yTZm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577800876; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=I4pcG404aVmF4+tOZ0zCGklA5LQSbnhcQJhf9sSNVD8=; b=DiTI2tByCcb7Wk5kYuxbsgIBmr1f3lGUUl0uPSyCqCV3v1qKaeSiPVNt/I1O6ESHK3om9szWU8LbS5oObW6qA8I5cHXWq0HGIuSibIzKwoZaS/DzYy8yLunbDQNUB4mqcvCLEYzswER/gYn+/tGdCZ8YyDAveYn/dQtZGXYXj4M= 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 1577800876804301.37244199212057; Tue, 31 Dec 2019 06:01:16 -0800 (PST) Received: from localhost ([::1]:42910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI5C-0003FK-RA for importer@patchew.org; Tue, 31 Dec 2019 09:01:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57826) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCm-0006Jq-Ni for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCl-0005XE-CF for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40146 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCl-0005Uh-5A for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:04:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-263-GQqzUtd3N3aeAXiuTWT6nQ-1; Tue, 31 Dec 2019 08:04:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B48918031D0 for ; Tue, 31 Dec 2019 13:04:56 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id E589178E96 for ; Tue, 31 Dec 2019 13:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I4pcG404aVmF4+tOZ0zCGklA5LQSbnhcQJhf9sSNVD8=; b=bWu190UiI4iMsehOOJp9QpVUnzHf+bW8tmJhvc7sUStoAjEGUTuXcNejUq0y84mudZ4dns JgAF2CPiTUd3Hr6FCW6/IWPWRvgAfbnxQVOSXgYNuKBtNgK+W24sdAZLVx+3BGYTTPREFA 4iQjjwx8RBm59Cx0rjIi8t/WrfYh16w= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 83/86] tests:numa-test: make top level args dynamic and g_autofree(cli) cleanups Date: Tue, 31 Dec 2019 14:04:07 +0100 Message-Id: <1577797450-88458-84-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: GQqzUtd3N3aeAXiuTWT6nQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use GString to pass argument to make_cli() so that it would be easy to dynamically change test case arguments from main(). The follow up patch will use it to change RAM size options depending on target. While at it cleanup 'cli' freeing, using g_autofree annotation. Signed-off-by: Igor Mammedov --- PS: make as separate patch so it won't clutter follow up testcase changes. --- tests/numa-test.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/tests/numa-test.c b/tests/numa-test.c index 8de8581..6f7aab9 100644 --- a/tests/numa-test.c +++ b/tests/numa-test.c @@ -14,16 +14,16 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" =20 -static char *make_cli(const char *generic_cli, const char *test_cli) +static char *make_cli(const GString *generic_cli, const char *test_cli) { - return g_strdup_printf("%s %s", generic_cli ? generic_cli : "", test_c= li); + return g_strdup_printf("%s %s", generic_cli->str, test_cli); } =20 static void test_mon_explicit(const void *data) { - char *s; - char *cli; QTestState *qts; + g_autofree char *s =3D NULL; + g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 8 " "-numa node,nodeid=3D0,cpus=3D0-3 " @@ -33,17 +33,15 @@ static void test_mon_explicit(const void *data) s =3D qtest_hmp(qts, "info numa"); g_assert(strstr(s, "node 0 cpus: 0 1 2 3")); g_assert(strstr(s, "node 1 cpus: 4 5 6 7")); - g_free(s); =20 qtest_quit(qts); - g_free(cli); } =20 static void test_mon_default(const void *data) { - char *s; - char *cli; QTestState *qts; + g_autofree char *s =3D NULL; + g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 8 -numa node -numa node"); qts =3D qtest_init(cli); @@ -51,17 +49,15 @@ static void test_mon_default(const void *data) s =3D qtest_hmp(qts, "info numa"); g_assert(strstr(s, "node 0 cpus: 0 2 4 6")); g_assert(strstr(s, "node 1 cpus: 1 3 5 7")); - g_free(s); =20 qtest_quit(qts); - g_free(cli); } =20 static void test_mon_partial(const void *data) { - char *s; - char *cli; QTestState *qts; + g_autofree char *s =3D NULL; + g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 8 " "-numa node,nodeid=3D0,cpus=3D0-1 " @@ -71,10 +67,8 @@ static void test_mon_partial(const void *data) s =3D qtest_hmp(qts, "info numa"); g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7")); g_assert(strstr(s, "node 1 cpus: 4 5")); - g_free(s); =20 qtest_quit(qts); - g_free(cli); } =20 static QList *get_cpus(QTestState *qts, QDict **resp) @@ -87,11 +81,11 @@ static QList *get_cpus(QTestState *qts, QDict **resp) =20 static void test_query_cpus(const void *data) { - char *cli; QDict *resp; QList *cpus; QObject *e; QTestState *qts; + g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 8 -numa node,cpus=3D0-3 -numa node,cpus= =3D4-7"); qts =3D qtest_init(cli); @@ -120,16 +114,15 @@ static void test_query_cpus(const void *data) =20 qobject_unref(resp); qtest_quit(qts); - g_free(cli); } =20 static void pc_numa_cpu(const void *data) { - char *cli; QDict *resp; QList *cpus; QObject *e; QTestState *qts; + g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-cpu pentium -smp 8,sockets=3D2,cores=3D2,thre= ads=3D2 " "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " @@ -174,16 +167,15 @@ static void pc_numa_cpu(const void *data) =20 qobject_unref(resp); qtest_quit(qts); - g_free(cli); } =20 static void spapr_numa_cpu(const void *data) { - char *cli; QDict *resp; QList *cpus; QObject *e; QTestState *qts; + g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 4,cores=3D4 " "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " @@ -220,16 +212,15 @@ static void spapr_numa_cpu(const void *data) =20 qobject_unref(resp); qtest_quit(qts); - g_free(cli); } =20 static void aarch64_numa_cpu(const void *data) { - char *cli; QDict *resp; QList *cpus; QObject *e; QTestState *qts; + g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 2 " "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " @@ -264,7 +255,6 @@ static void aarch64_numa_cpu(const void *data) =20 qobject_unref(resp); qtest_quit(qts); - g_free(cli); } =20 static void pc_dynamic_cpu_cfg(const void *data) @@ -329,11 +319,11 @@ static void pc_dynamic_cpu_cfg(const void *data) =20 int main(int argc, char **argv) { - const char *args =3D NULL; + g_autoptr(GString) args =3D g_string_new(""); const char *arch =3D qtest_get_arch(); =20 if (strcmp(arch, "aarch64") =3D=3D 0) { - args =3D "-machine virt"; + g_string_append(args, " -machine virt"); } =20 g_test_init(&argc, &argv, NULL); --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577801296; cv=none; d=zohomail.com; s=zohoarc; b=lNrhgcJ7e+w4ryvWHQIMGJH2pqChJxaulC3YEO/oXZFaSEEwfYVqMlX6a1DsgDQcmWmBAp5P3TxqWIVgG9kZvBrN1AXVUEtoeIHOoR8yMldEepz5qTDLqPqs8F6Msgl4mtlorv/G02OudQDOKIHLzZXNmCOch0EIdHwpYBDgEx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577801296; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=2Ni0xGBUhNILEbnzZX6suH7qxyEqdMvdJf/IW4fnvZE=; b=elY1NHOfwcotWbK6jsXD5uN8Fe03eBuXF0OClsO4M5Gklv4D2DTFhiptUSVJju5kVws+pcWBzlTEYjRj8BCdSfe9X0Zaz2v4SN5B6EAMAO32T7pq3vxT17tgLZ8x6g1cFtGV2tT9qpEIe0hGGI2BvkM0f2ne+EYA8UZOyJeS0ng= 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 1577801296991949.6290092228384; Tue, 31 Dec 2019 06:08:16 -0800 (PST) Received: from localhost ([::1]:43016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imIBy-0002zS-Dc for importer@patchew.org; Tue, 31 Dec 2019 09:08:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57860) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCq-0006Km-UX for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCm-0005cE-9e for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:04 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:51111 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCm-0005Zk-3J for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-71-sXpRrWwTOCqLj3I6u9kllg-1; Tue, 31 Dec 2019 08:04:58 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 396328024D2 for ; Tue, 31 Dec 2019 13:04:57 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3C3378E96 for ; Tue, 31 Dec 2019 13:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2Ni0xGBUhNILEbnzZX6suH7qxyEqdMvdJf/IW4fnvZE=; b=VGBJwds50gUW8vidVB5OtahSUerSuF/3bQZfw+UePIidzmp4vto3ZHN4lovqztgGe9XeMn P9D//buSzJkFCxCMNU3r9Rvjcc9aGI9YM5M5BUshuT5G0A+11Dy/A2wMWrOU5RhTsjlLrf tYuau0nvELOYHRZGDQx/xhab6OuJBfE= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 84/86] tests:numa-test: use explicit memdev to specify node RAM Date: Tue, 31 Dec 2019 14:04:08 +0100 Message-Id: <1577797450-88458-85-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: sXpRrWwTOCqLj3I6u9kllg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Follow up patches will remove automatic RAM distribution between nodes and will make default machine types require "memdev" option instead of legacy "mem" option. Make tests to follow new rules and add an additional test for legacy "mem" option on old machine type, to make sure it won't regress in the future. Signed-off-by: Igor Mammedov --- tests/numa-test.c | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/tests/numa-test.c b/tests/numa-test.c index 6f7aab9..4d27220 100644 --- a/tests/numa-test.c +++ b/tests/numa-test.c @@ -25,9 +25,8 @@ static void test_mon_explicit(const void *data) g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; =20 - cli =3D make_cli(data, "-smp 8 " - "-numa node,nodeid=3D0,cpus=3D0-3 " - "-numa node,nodeid=3D1,cpus=3D4-7 "); + cli =3D make_cli(data, "-smp 8 -numa node,nodeid=3D0,memdev=3Dram,cpus= =3D0-3 " + "-numa node,nodeid=3D1,cpus=3D4-7"); qts =3D qtest_init(cli); =20 s =3D qtest_hmp(qts, "info numa"); @@ -37,13 +36,13 @@ static void test_mon_explicit(const void *data) qtest_quit(qts); } =20 -static void test_mon_default(const void *data) +static void test_def_cpu_split(const void *data) { QTestState *qts; g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; =20 - cli =3D make_cli(data, "-smp 8 -numa node -numa node"); + cli =3D make_cli(data, "-smp 8 -numa node,memdev=3Dram -numa node"); qts =3D qtest_init(cli); =20 s =3D qtest_hmp(qts, "info numa"); @@ -53,6 +52,23 @@ static void test_mon_default(const void *data) qtest_quit(qts); } =20 +static void test_pc_legacy_mem(const void *data) +{ + QTestState *qts; + g_autofree char *s =3D NULL; + g_autofree char *cli =3D NULL; + + cli =3D make_cli(data, "-M pc-i440fx-4.2 -smp 8 " + "-numa node,mem=3D64M -numa node,mem=3D64M"); + qts =3D qtest_init(cli); + + s =3D qtest_hmp(qts, "info numa"); + g_assert(strstr(s, "node 0 size: 64 MB")); + g_assert(strstr(s, "node 1 size: 64 MB")); + + qtest_quit(qts); +} + static void test_mon_partial(const void *data) { QTestState *qts; @@ -60,7 +76,7 @@ static void test_mon_partial(const void *data) g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 8 " - "-numa node,nodeid=3D0,cpus=3D0-1 " + "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-1 " "-numa node,nodeid=3D1,cpus=3D4-5 "); qts =3D qtest_init(cli); =20 @@ -87,7 +103,8 @@ static void test_query_cpus(const void *data) QTestState *qts; g_autofree char *cli =3D NULL; =20 - cli =3D make_cli(data, "-smp 8 -numa node,cpus=3D0-3 -numa node,cpus= =3D4-7"); + cli =3D make_cli(data, "-smp 8 -numa node,memdev=3Dram,cpus=3D0-3 " + "-numa node,cpus=3D4-7"); qts =3D qtest_init(cli); cpus =3D get_cpus(qts, &resp); g_assert(cpus); @@ -125,7 +142,7 @@ static void pc_numa_cpu(const void *data) g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-cpu pentium -smp 8,sockets=3D2,cores=3D2,thre= ads=3D2 " - "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " + "-numa node,nodeid=3D0,memdev=3Dram -numa node,nodeid=3D1 " "-numa cpu,node-id=3D1,socket-id=3D0 " "-numa cpu,node-id=3D0,socket-id=3D1,core-id=3D0 " "-numa cpu,node-id=3D0,socket-id=3D1,core-id=3D1,thread-id=3D0 " @@ -178,7 +195,7 @@ static void spapr_numa_cpu(const void *data) g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 4,cores=3D4 " - "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " + "-numa node,nodeid=3D0,memdev=3Dram -numa node,nodeid=3D1 " "-numa cpu,node-id=3D0,core-id=3D0 " "-numa cpu,node-id=3D0,core-id=3D1 " "-numa cpu,node-id=3D0,core-id=3D2 " @@ -223,7 +240,7 @@ static void aarch64_numa_cpu(const void *data) g_autofree char *cli =3D NULL; =20 cli =3D make_cli(data, "-smp 2 " - "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " + "-numa node,nodeid=3D0,memdev=3Dram -numa node,nodeid=3D1 " "-numa cpu,node-id=3D1,thread-id=3D0 " "-numa cpu,node-id=3D0,thread-id=3D1"); qts =3D qtest_init(cli); @@ -263,13 +280,14 @@ static void pc_dynamic_cpu_cfg(const void *data) QDict *resp; QList *cpus; QTestState *qs; + g_autofree char *cli =3D NULL; =20 - qs =3D qtest_initf("%s -nodefaults --preconfig -smp 2", - data ? (char *)data : ""); + cli =3D make_cli(data, "-nodefaults --preconfig -smp 2"); + qs =3D qtest_init(cli); =20 /* create 2 numa nodes */ g_assert(!qmp_rsp_is_err(qtest_qmp(qs, "{ 'execute': 'set-numa-node'," - " 'arguments': { 'type': 'node', 'nodeid': 0 } }"))); + " 'arguments': { 'type': 'node', 'nodeid': 0, 'memdev': 'ram' } }"= ))); g_assert(!qmp_rsp_is_err(qtest_qmp(qs, "{ 'execute': 'set-numa-node'," " 'arguments': { 'type': 'node', 'nodeid': 1 } }"))); =20 @@ -325,10 +343,15 @@ int main(int argc, char **argv) if (strcmp(arch, "aarch64") =3D=3D 0) { g_string_append(args, " -machine virt"); } + if (!strcmp(arch, "ppc64")) { + g_string_append(args, " -object memory-backend-ram,id=3Dram,size= =3D512M"); + } else { + g_string_append(args, " -object memory-backend-ram,id=3Dram,size= =3D128M"); + } =20 g_test_init(&argc, &argv, NULL); =20 - qtest_add_data_func("/numa/mon/default", args, test_mon_default); + qtest_add_data_func("/numa/mon/cpus/default", args, test_def_cpu_split= ); qtest_add_data_func("/numa/mon/cpus/explicit", args, test_mon_explicit= ); qtest_add_data_func("/numa/mon/cpus/partial", args, test_mon_partial); qtest_add_data_func("/numa/qmp/cpus/query-cpus", args, test_query_cpus= ); @@ -336,6 +359,7 @@ int main(int argc, char **argv) if (!strcmp(arch, "i386") || !strcmp(arch, "x86_64")) { qtest_add_data_func("/numa/pc/cpu/explicit", args, pc_numa_cpu); qtest_add_data_func("/numa/pc/dynamic/cpu", args, pc_dynamic_cpu_c= fg); + qtest_add_data_func("/numa/pc/legacy/mem", args, test_pc_legacy_me= m); } =20 if (!strcmp(arch, "ppc64")) { --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577801065; cv=none; d=zohomail.com; s=zohoarc; b=FZ8YuPazmBVCMzVxS7gP1ea3NI4iKgT+lPJPPvb1oUCL8SQ27tM9YGlNPWTpyeOIfHBr2WoQwZotJ2WfuPMSQqT5KvaBJl11J+s/ugGXCm47TO1bP9CM646pDhs74xMAJ4+yrQ6TU9gWq/nljMkXas9wGIA4/vTVHytCFUfyAfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577801065; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=MVkKlRH3RCq8RkLAivZKk7H3y7MvONdSXCX3tNEU9SU=; b=ZWxlpTVxPOtl7za23Apv0i+QJjSi5pjh38ulDzq/8NcU+NU3tiUYHW/bPl3YVe+fs0jezJ7E4Ix4xrH2lcfSIW5jY8cXC+2hjD1LeyRncA2l+8v0Qq3LSkyuNLEZyn587Qo2vGz2EWN2cBzr9FBmCcK7wLysBPEuEC4EbqoxdvU= 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 1577801065939293.4049069117317; Tue, 31 Dec 2019 06:04:25 -0800 (PST) Received: from localhost ([::1]:42956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imI8F-0006mB-Ny for importer@patchew.org; Tue, 31 Dec 2019 09:04:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57931) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCs-0006Mx-7v for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCr-0005hr-41 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:06 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20800 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCq-0005dj-VI for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:05 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402-zf-ngDGgP3m_YsO9XgcyGQ-1; Tue, 31 Dec 2019 08:04:58 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06B1D800EBF for ; Tue, 31 Dec 2019 13:04:58 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82AAB620A6 for ; Tue, 31 Dec 2019 13:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MVkKlRH3RCq8RkLAivZKk7H3y7MvONdSXCX3tNEU9SU=; b=hN9BOPmzOXEuiavdvBsRVRfS1nJvQ67/NfwHMH/RvyJxsCKnD7kkm7QGutAkzv+MZ1EkBp qoG5zunQlMzFYd8242yt0LzMytI1hMYoJ1ado8OdWK4IEMy/z3fTgWBJTOpZpMhOzkaMQI 1trEn7plDKZguXWJHfiOk8QKQ3/LGZY= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 85/86] numa: make exit() usage consistent Date: Tue, 31 Dec 2019 14:04:09 +0100 Message-Id: <1577797450-88458-86-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: zf-ngDGgP3m_YsO9XgcyGQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- hw/core/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/core/numa.c b/hw/core/numa.c index beb6d2e..96776ff 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -421,7 +421,7 @@ void numa_complete_configuration(MachineState *ms) /* Report large node IDs first, to make mistakes easier to spot */ if (!numa_info[i].present) { error_report("numa: Node ID missing: %d", i); - exit(1); + exit(EXIT_FAILURE); } } =20 @@ -462,7 +462,7 @@ void numa_complete_configuration(MachineState *ms) error_report("total memory for NUMA nodes (0x%" PRIx64 ")" " should equal RAM size (0x" RAM_ADDR_FMT ")", numa_total, ram_size); - exit(1); + exit(EXIT_FAILURE); } =20 if (!numa_uses_legacy_mem()) { --=20 2.7.4 From nobody Sun Feb 8 12:43:00 2026 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577801248; cv=none; d=zohomail.com; s=zohoarc; b=G75ejo4hir80srhEz7JRXnUGOXIdMk5WLDQaEkyiSneWIR1UZtAsKd6IRNH5ovPc5Uzft/KLu0mY/FQAtYftbotgMlSzrJ42vmIjODUrn+D2hbWBIMQawQ+UcfMe59TiASQF9MCEYguU1M4hKilhAewYkFJmFFUGDTFEOfV0MRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577801248; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=qI2saWSvHRrQAnnEAcsLYuH7nBnNpOoycj1p6rhDCNY=; b=GqA5vOU/XzQyHfp9mruXMpBXFVjzaNcFBwnP8HEeyA05pFXyXUIg5umXEj9wIP/xmD6i1dp7ta77+qyS3ePrr5zZh9q0FKoK8n/aoZ69V1wWfJ3hxq+W2tUuNuCAlBKmvGd7oUcfoXawzoRKT9bqwk7f83x1Q5c5Nak3LgLc2YE= 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 1577801248472316.2187705305314; Tue, 31 Dec 2019 06:07:28 -0800 (PST) Received: from localhost ([::1]:42994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imIBC-0001xS-J1 for importer@patchew.org; Tue, 31 Dec 2019 09:07:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58002) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imHCt-0006Ow-Cx for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imHCr-0005ig-9R for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:07 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:43629 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imHCr-0005fm-29 for qemu-devel@nongnu.org; Tue, 31 Dec 2019 08:05:05 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-TODSoRqVP9CKDUWd4PH-6g-1; Tue, 31 Dec 2019 08:04:59 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB4DE107ACC4 for ; Tue, 31 Dec 2019 13:04:58 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FFCE620A6 for ; Tue, 31 Dec 2019 13:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577797501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qI2saWSvHRrQAnnEAcsLYuH7nBnNpOoycj1p6rhDCNY=; b=cHbPbx7/rFJudsOYFxLM+CxR0gU73LY5pyvkximzAeGDnBk1/5W9d5Npfu6HyrCOk7KCKT 5T4xg0lqvTH280P9NiFH/XXkShTMQH4zB+HH+1jqwqSxe4/jLBPJN44PuM3MYTBNvgB8aT kmZn6SY9KMarVUDDQYgWKtIaxaoibeo= From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 86/86] numa: remove deprecated implicit RAM distribution between nodes Date: Tue, 31 Dec 2019 14:04:10 +0100 Message-Id: <1577797450-88458-87-git-send-email-imammedo@redhat.com> In-Reply-To: <1577797450-88458-1-git-send-email-imammedo@redhat.com> References: <1577797450-88458-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: TODSoRqVP9CKDUWd4PH-6g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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 @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Feature has been deprecated since 4.1 (4bb4a273), remove it. As result if RAM distribution wasn't specified explicitly, the machine won't start and CLI should be changed to explicitly assign RAM to nodes using options: -node node,memdev (5.0 and newer machine types) -node node,mem (4.2 and older machine types) It's recommended to use "memdev" variant for new virtual machines and use "mem" only when it's necessary to migrate already existing virtual machine started with implicit RAM distribution. Signed-off-by: Igor Mammedov --- include/hw/boards.h | 3 --- include/sysemu/numa.h | 4 ---- hw/core/machine.c | 6 ----- hw/core/numa.c | 61 +++++------------------------------------------= ---- hw/i386/pc_piix.c | 1 - hw/i386/pc_q35.c | 1 - hw/ppc/spapr.c | 7 ------ qemu-deprecated.texi | 8 ------- qemu-options.hx | 16 +++++++------- 9 files changed, 13 insertions(+), 94 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 9f69883..aadc9af 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -192,12 +192,9 @@ struct MachineClass { int minimum_page_bits; bool has_hotpluggable_cpus; bool ignore_memory_transaction_failures; - int numa_mem_align_shift; const char **valid_cpu_types; strList *allowed_dynamic_sysbus_devices; bool auto_enable_numa_with_memhp; - void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes, - int nb_nodes, ram_addr_t size); bool ignore_boot_device_suffixes; bool smbus_no_migration_support; bool nvdimm_supported; diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 21f6a5a..5470238 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -43,10 +43,6 @@ void parse_numa_opts(MachineState *ms); void numa_complete_configuration(MachineState *ms); void query_numa_node_mem(NumaNodeMem node_mem[], MachineState *ms); extern QemuOptsList qemu_numa_opts; -void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, - int nb_nodes, ram_addr_t size); -void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, - int nb_nodes, ram_addr_t size); void numa_cpu_pre_plug(const struct CPUArchId *slot, DeviceState *dev, Error **errp); bool numa_uses_legacy_mem(void); diff --git a/hw/core/machine.c b/hw/core/machine.c index a938052..b1ce8c5 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -715,12 +715,6 @@ static void machine_class_init(ObjectClass *oc, void *= data) mc->rom_file_has_mr =3D true; mc->smp_parse =3D smp_parse; =20 - /* numa node memory size aligned on 8MB by default. - * On Linux, each node's border has to be 8MB aligned - */ - mc->numa_mem_align_shift =3D 23; - mc->numa_auto_assign_ram =3D numa_default_auto_assign_ram; - object_class_property_add_str(oc, "kernel", machine_get_kernel, machine_set_kernel, &error_abort); object_class_property_set_description(oc, "kernel", diff --git a/hw/core/numa.c b/hw/core/numa.c index 96776ff..522e689 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -330,42 +330,6 @@ static void complete_init_numa_distance(MachineState *= ms) } } =20 -void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, - int nb_nodes, ram_addr_t size) -{ - int i; - uint64_t usedmem =3D 0; - - /* Align each node according to the alignment - * requirements of the machine class - */ - - for (i =3D 0; i < nb_nodes - 1; i++) { - nodes[i].node_mem =3D (size / nb_nodes) & - ~((1 << mc->numa_mem_align_shift) - 1); - usedmem +=3D nodes[i].node_mem; - } - nodes[i].node_mem =3D size - usedmem; -} - -void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, - int nb_nodes, ram_addr_t size) -{ - int i; - uint64_t usedmem =3D 0, node_mem; - uint64_t granularity =3D size / nb_nodes; - uint64_t propagate =3D 0; - - for (i =3D 0; i < nb_nodes - 1; i++) { - node_mem =3D (granularity + propagate) & - ~((1 << mc->numa_mem_align_shift) - 1); - propagate =3D granularity + propagate - node_mem; - nodes[i].node_mem =3D node_mem; - usedmem +=3D node_mem; - } - nodes[i].node_mem =3D size - usedmem; -} - static void numa_init_memdev_container(MachineState *ms, MemoryRegion *ram) { int i; @@ -435,30 +399,15 @@ void numa_complete_configuration(MachineState *ms) ms->numa_state->num_nodes =3D MAX_NODES; } =20 - /* If no memory size is given for any node, assume the default case - * and distribute the available memory equally across all nodes - */ - for (i =3D 0; i < ms->numa_state->num_nodes; i++) { - if (numa_info[i].node_mem !=3D 0) { - break; - } - } - if (i =3D=3D ms->numa_state->num_nodes) { - assert(mc->numa_auto_assign_ram); - mc->numa_auto_assign_ram(mc, numa_info, - ms->numa_state->num_nodes, ram_size); - if (!qtest_enabled()) { - warn_report("Default splitting of RAM between nodes is dep= recated," - " Use '-numa node,memdev' to explictly define = RAM" - " allocation per node"); - } - } - numa_total =3D 0; for (i =3D 0; i < ms->numa_state->num_nodes; i++) { numa_total +=3D numa_info[i].node_mem; } - if (numa_total !=3D ram_size) { + if (numa_total =3D=3D 0) { + error_report(" Use '-numa node,memdev' to explictly assign RAM" + " to node"); + exit(EXIT_FAILURE); + } else if (numa_total !=3D ram_size) { error_report("total memory for NUMA nodes (0x%" PRIx64 ")" " should equal RAM size (0x" RAM_ADDR_FMT ")", numa_total, ram_size); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b2805fe..3a1edba 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -533,7 +533,6 @@ static void pc_i440fx_2_9_machine_options(MachineClass = *m) pc_i440fx_2_10_machine_options(m); compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len); compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len); - m->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; } =20 DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index f15711b..ed6c7be 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -467,7 +467,6 @@ static void pc_q35_2_10_machine_options(MachineClass *m) pc_q35_2_11_machine_options(m); compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len); compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len); - m->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; m->auto_enable_numa_with_memhp =3D false; } =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6527962..1cc7407 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4380,11 +4380,6 @@ static void spapr_machine_class_init(ObjectClass *oc= , void *data) xic->ics_resend =3D spapr_ics_resend; xic->icp_get =3D spapr_icp_get; ispc->print_info =3D spapr_pic_print_info; - /* Force NUMA node memory size to be a multiple of - * SPAPR_MEMORY_BLOCK_SIZE (256M) since that's the granularity - * in which LMBs are represented and hot-added - */ - mc->numa_mem_align_shift =3D 28; mc->auto_enable_numa =3D true; =20 smc->default_caps.caps[SPAPR_CAP_HTM] =3D SPAPR_CAP_OFF; @@ -4637,7 +4632,6 @@ static void spapr_machine_2_9_class_options(MachineCl= ass *mc) spapr_machine_2_10_class_options(mc); compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len); compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); - mc->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; smc->pre_2_10_has_unused_icps =3D true; smc->resize_hpt_default =3D SPAPR_RESIZE_HPT_DISABLED; } @@ -4657,7 +4651,6 @@ static void spapr_machine_2_8_class_options(MachineCl= ass *mc) spapr_machine_2_9_class_options(mc); compat_props_add(mc->compat_props, hw_compat_2_8, hw_compat_2_8_len); compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); - mc->numa_mem_align_shift =3D 23; } =20 DEFINE_SPAPR_MACHINE(2_8, "2.8", false); diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index d9b07ba..05e6082 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -89,14 +89,6 @@ error in the future. The @code{-realtime mlock=3Don|off} argument has been replaced by the @code{-overcommit mem-lock=3Don|off} argument. =20 -@subsection -numa node (without memory specified) (since 4.1) - -Splitting RAM by default between NUMA nodes has the same issues as @option= {mem} -parameter described above with the difference that the role of the user pl= ays -QEMU using implicit generic or board specific splitting rule. -Use @option{memdev} with @var{memory-backend-ram} backend or @option{mem} = (if -it's supported by used machine type) to define mapping explictly instead. - @subsection RISC-V -bios (since 4.1) =20 QEMU 4.1 introduced support for the -bios option in QEMU for RISC-V for the diff --git a/qemu-options.hx b/qemu-options.hx index 088dd32..4872f11 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -168,14 +168,14 @@ If any on the three values is given, the total number= of CPUs @var{n} can be omi ETEXI =20 DEF("numa", HAS_ARG, QEMU_OPTION_numa, - "-numa node[,mem=3Dsize][,cpus=3Dfirstcpu[-lastcpu]][,nodeid=3Dnode]\n" - "-numa node[,memdev=3Did][,cpus=3Dfirstcpu[-lastcpu]][,nodeid=3Dnode]\= n" + "-numa node,mem=3Dsize[,cpus=3Dfirstcpu[-lastcpu]][,nodeid=3Dnode]\n" + "-numa node,memdev=3Did[,cpus=3Dfirstcpu[-lastcpu]][,nodeid=3Dnode]\n" "-numa dist,src=3Dsource,dst=3Ddestination,val=3Ddistance\n" "-numa cpu,node-id=3Dnode[,socket-id=3Dx][,core-id=3Dy][,thread-id=3Dz= ]\n", QEMU_ARCH_ALL) STEXI -@item -numa node[,mem=3D@var{size}][,cpus=3D@var{firstcpu}[-@var{lastcpu}]= ][,nodeid=3D@var{node}] -@itemx -numa node[,memdev=3D@var{id}][,cpus=3D@var{firstcpu}[-@var{lastcpu= }]][,nodeid=3D@var{node}] +@item -numa node,mem=3D@var{size}[,cpus=3D@var{firstcpu}[-@var{lastcpu}]][= ,nodeid=3D@var{node}] +@itemx -numa node,memdev=3D@var{id}[,cpus=3D@var{firstcpu}[-@var{lastcpu}]= ][,nodeid=3D@var{node}] @itemx -numa dist,src=3D@var{source},dst=3D@var{destination},val=3D@var{di= stance} @itemx -numa cpu,node-id=3D@var{node}[,socket-id=3D@var{x}][,core-id=3D@va= r{y}][,thread-id=3D@var{z}] @findex -numa @@ -193,7 +193,7 @@ split between them. For example, the following option assigns VCPUs 0, 1, 2 and 5 to a NUMA node: @example --numa node,cpus=3D0-2,cpus=3D5 +-numa node,cpus=3D0-2,cpus=3D5,memdev=3Dram-backend-id @end example =20 @samp{cpu} option is a new alternative to @samp{cpus} option @@ -210,14 +210,14 @@ For example: @example -M pc \ -smp 1,sockets=3D2,maxcpus=3D2 \ --numa node,nodeid=3D0 -numa node,nodeid=3D1 \ +-m 512M -object memory-backend-ram,id=3Dmem,size=3D512M \ +-numa node,nodeid=3D0,memdev=3Dmem -numa node,nodeid=3D1 \ -numa cpu,node-id=3D0,socket-id=3D0 -numa cpu,node-id=3D1,socket-id=3D1 @end example =20 Legacy @samp{mem} assigns a given RAM amount to a node (not supported for = 5.0 and newer machine types). @samp{memdev} assigns RAM from a given memory ba= ckend -device to a node. If @samp{mem} and @samp{memdev} are omitted in all nodes= , RAM -is split equally between them. +device to a node. =20 @samp{mem} and @samp{memdev} are mutually exclusive. Furthermore, if one node uses @samp{memdev}, all of them have to use it. --=20 2.7.4