From nobody Mon Feb 9 23:03:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561414159; cv=none; d=zoho.com; s=zohoarc; b=YqVBUeyNFRDFIaFypNNOLxeE6hVedlE9h1u1QF44h/8S2RWrnutimFlQEDP00AWS04QeJygowDLabcSb4i8D+6ZsE9PFLOjkE0bqYSexB5LduSRUonKpG3IvCWyco4G1BH3Q8oshBi3uUuFY3B1OBrMMR9P4L98c2QDUIaYCZog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561414159; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NSm3cZqHH/H9Xl/1qUBzg4MSsd8N7p36v5WOTsFnvFI=; b=SBUh3KllUxDDBgw4rALZGX0CTzUQ2lnyMu/BkuaLNq+PL5hRTseOaRJ93UpurnWwO3Gj/vaMOyE6/fGTKM+/bRYvqllzm1gu5w3mM5SvhBe2dmw9/JyjX68LBW2xHxSj7Euv8sm8d+P42s1SALfOvnw6gcjnL1MI6DksMZQ8ST4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561414159741816.1023577823618; Mon, 24 Jun 2019 15:09:19 -0700 (PDT) Received: from localhost ([::1]:54912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfX9I-0005O5-Qx for importer@patchew.org; Mon, 24 Jun 2019 18:09:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54931) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfX2B-0007xQ-T3 for qemu-devel@nongnu.org; Mon, 24 Jun 2019 18:01:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfX29-00048T-SD for qemu-devel@nongnu.org; Mon, 24 Jun 2019 18:01:55 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:36634) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hfX29-0003Bk-K9 for qemu-devel@nongnu.org; Mon, 24 Jun 2019 18:01:53 -0400 Received: by mail-wr1-x444.google.com with SMTP id n4so14307432wrs.3 for ; Mon, 24 Jun 2019 15:01:10 -0700 (PDT) Received: from x1.local (183.red-88-21-202.staticip.rima-tde.net. [88.21.202.183]) by smtp.gmail.com with ESMTPSA id z126sm1118612wmb.32.2019.06.24.15.01.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 24 Jun 2019 15:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NSm3cZqHH/H9Xl/1qUBzg4MSsd8N7p36v5WOTsFnvFI=; b=DpwGZqRWkKIh6RUDNi9bb/rODZnY1AeMANICf9+oudzvbUU2W7PqG9qy7rLIjGztXY ytk3eqrySw17H7OA6+467a5Ci2ymuCHMgFpavcp8WfGYDNWfNgHTxN10VMW6dP9A0413 g/WMqdXU0LmHvmM5+3I8vsko7XB428Vcnlviuo2mAMoNfb+NH22NlXXhbnS+eA0UQefz GEt/8zAZWoyV7W8jvh+g+BBAVWiTA9KWbcGxTuBX6FWghSTh15l1WF7+2Yiw3BR2Fyn0 ZuD81zIr0u3TqIpT7OwqMnALDv0ONdIqrvlTF11X0zcIpp6kura2DY8HuKFa+IHe9kPW ffzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NSm3cZqHH/H9Xl/1qUBzg4MSsd8N7p36v5WOTsFnvFI=; b=hb1W3GFhd3hFVNW7Gq1obR/lWJfjD0yJC4+SRkTPRfqqAuhw2mWHRqZCdFX7TOwwko f6v16VM6719FiJJUmtj6t4Tj1fSxiV9SSX0PHfwg4a8BBQqkJYa4XWuBbi/Nku4+6L89 zd1f103tBLAtWmvSFtlcuGUUIFaEkV7iSmSMIc8jjuyN86qqjKRQTeCLcvr6IY1N9UVd /FRSR2+8wxpnpMcQhhoIKra2y5KmWNX/N/cK1cOGecSbR4wih+DLNqcVMh6ci9twZDgv ruQKtw3dBaoBE9ewuY77Dw07O+CRcC22KoPHgbQe3Vj4APgUmntX7V+p9WfBa3wINiVp 8hrg== X-Gm-Message-State: APjAAAVxdiMVWXt+Xomua/T+cNskD5+whRv2hLEn9ws7eC2b/zArSpbN 1tss+iV06U5sBuTTJOZlBuucVYkE X-Google-Smtp-Source: APXvYqz5Wf1kOYa6V33yDPG0EK9jBkZI5wFT4Q8bCe/rBQXbcLVPbMeOdlYcxCh2CKoUD0u3L1kbbQ== X-Received: by 2002:a05:6000:124a:: with SMTP id j10mr10330123wrx.191.1561413669297; Mon, 24 Jun 2019 15:01:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Tue, 25 Jun 2019 00:00:55 +0200 Message-Id: <20190624220056.25861-9-f4bug@amsat.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190624220056.25861-1-f4bug@amsat.org> References: <20190624220056.25861-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH 8/9] hw/sparc/sun4m: Simplify the RAM creation 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: , Cc: Peter Maydell , Aleksandar Rikalo , Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Aleksandar Markovic , Artyom Tarasenko Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now than the empty_slot device can be overlapped, use it to cover the maximum memory range. We can simplify now the main RAM is created. The TYPE_SUN4M_MEMORY is not migratable, simply remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sparc/sun4m.c | 85 ++++++++---------------------------------------- 1 file changed, 13 insertions(+), 72 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 0df5a8edfc..d55753d5cb 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -767,71 +767,6 @@ static const TypeInfo prom_info =3D { .class_init =3D prom_class_init, }; =20 -#define TYPE_SUN4M_MEMORY "memory" -#define SUN4M_RAM(obj) OBJECT_CHECK(RamDevice, (obj), TYPE_SUN4M_MEMORY) - -typedef struct RamDevice { - SysBusDevice parent_obj; - - MemoryRegion ram; - uint64_t size; -} RamDevice; - -/* System RAM */ -static void ram_realize(DeviceState *dev, Error **errp) -{ - RamDevice *d =3D SUN4M_RAM(dev); - SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); - - memory_region_allocate_system_memory(&d->ram, OBJECT(d), "sun4m.ram", - d->size); - sysbus_init_mmio(sbd, &d->ram); -} - -static void ram_init(hwaddr addr, ram_addr_t RAM_size, - uint64_t max_mem) -{ - 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); -} - -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); - - dc->realize =3D ram_realize; - dc->props =3D ram_properties; -} - -static const TypeInfo ram_info =3D { - .name =3D TYPE_SUN4M_MEMORY, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(RamDevice), - .class_init =3D ram_class_init, -}; - static void cpu_devinit(const char *cpu_type, unsigned int id, uint64_t prom_addr, qemu_irq **cpu_irqs) { @@ -872,6 +807,19 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hw= def, FWCfgState *fw_cfg; DeviceState *dev; SysBusDevice *s; + MemoryRegion ram; + + if ((uint64_t)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); + } + memory_region_allocate_system_memory(&ram, OBJECT(machine), "sun4m.ram= ", + machine->ram_size); + memory_region_add_subregion(get_system_memory(), 0x00000000, &ram); + /* models without ECC don't trap when missing ram is accessed */ + empty_slot_init(0x00000000, hwdef->max_mem); =20 /* init CPUs */ for(i =3D 0; i < smp_cpus; i++) { @@ -881,13 +829,7 @@ 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 - /* 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); - } =20 prom_init(hwdef->slavio_base, bios_name); =20 @@ -1561,7 +1503,6 @@ static void sun4m_register_types(void) type_register_static(&idreg_info); type_register_static(&afx_info); type_register_static(&prom_info); - type_register_static(&ram_info); =20 type_register_static(&ss5_type); type_register_static(&ss10_type); --=20 2.19.1