From patchwork Thu Mar 17 05:05:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 552252 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp896697mag; Wed, 16 Mar 2022 22:58:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzDWqbbe8hvIei/Q10gL8dHdJ0WROsEfAA/AB6UDpDBM7dlIcNYPVLh1BH9MYDolFAk5RP X-Received: by 2002:ac8:5743:0:b0:2e1:cee6:f15 with SMTP id 3-20020ac85743000000b002e1cee60f15mr2463510qtx.634.1647496735771; Wed, 16 Mar 2022 22:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647496735; cv=none; d=google.com; s=arc-20160816; b=RlxiPPWjorcDXSTG4kHuLrBwmZUXCxkfaGlGcQXZn/RPO/dCb9aTMqpCk+LLrNsp8X lbiGwz/MbCU7niPk+D+DmV8/GAH9ZsdR3c/6Hd6NwxOIA83rfE6M3q8YsVK8z8nX8KuO 1kz84XWAyOcspdJgczAmESZJASaBbZARS6xQJXCj3WvA0XMyXgcuM3nOW7uhbnAGI4yC H0gbyMPwomm2xyBHAyRk8X0H1/x/k6II19ofV4fFGKmeVjcjudU0ZhyE61xg5Y9dY+TJ tZBJ7KNxhQQhNQtssNILx+IOggqYeI5ZHBXL1gqoYyVRdXLVDHZ8XS1OEGLFZAXjPYWq kJCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=k4ozRW6iziM8OJ2TKPPCOH7wy/AQ7zg7VeU+iBKaQYA=; b=ZXZeg2tzD+J1Gg1N/BpfplnmhiTTqPS5mLRMLtFZoJjIIEmmHLHiZV4MG6bCga//e3 KzmfZrJ9fxW8Ol8rUZAiVO6ffk2wf5bVTigsTLFSEyCCxoN9uzssMiXdbF2B97xNxP7V kFXMIYiOY5sHqjbzlPFG5ePEvI6XNOe6FxHjafJm/mPoZZfD2dWdTBPjbgCEHJ9OhHMF hJfZPS6Jn6EknmKRxdY80PU7IcBTYlw0KLzO1DEnc9w906t8rETVf+J9FgulRTdEDz8e AMW6b4Zj2ZLQ6yYbCdgth73Pph//p8/vdDxdu7RCLt54oDcqqD9wVuvIqgIFiOQYfr9X Fqwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NnwZotdG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g6-20020a05620a40c600b0067df2ee255bsi1045354qko.334.2022.03.16.22.58.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Mar 2022 22:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NnwZotdG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUj9z-0005KK-DU for patch@linaro.org; Thu, 17 Mar 2022 01:58:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUiOM-0005tj-VR for qemu-devel@nongnu.org; Thu, 17 Mar 2022 01:09:43 -0400 Received: from [2607:f8b0:4864:20::62f] (port=33486 helo=mail-pl1-x62f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUiO8-0002er-Os for qemu-devel@nongnu.org; Thu, 17 Mar 2022 01:09:31 -0400 Received: by mail-pl1-x62f.google.com with SMTP id t22so3598428plo.0 for ; Wed, 16 Mar 2022 22:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k4ozRW6iziM8OJ2TKPPCOH7wy/AQ7zg7VeU+iBKaQYA=; b=NnwZotdGoUpFCuwRS3GBLhhCyxU/RJLZq9MoP2ihDSMhhMI9kQiQw/QjmgIUYhLlcH BP90d6mN+j08L/XSDXiDx5IqMb9esUZhgZm7/pARO0JEE8xvEDYr6ETFzL7RsSHCXcfI zJSGVgoMy/CCwZBU4OkWB0bRssKK0I93VFO+7hnUxbUrfKHTrKNlr5UHDsSqs9LdQvKq T9L913hS+/XcJe9tGYtuHcEAv8NOn0gKxWvo17qPV3uWzE+C1inCMA/rS3hEHsswYwmQ JbXNixYjegXkWhsYiSYtbBBMLDanQnIXl/ozVeBI8tXa3wguuXL8YCoRrnpKgFGT0iV/ Fhig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k4ozRW6iziM8OJ2TKPPCOH7wy/AQ7zg7VeU+iBKaQYA=; b=b+/k24nqRADAjSMKDbtOAYr5wd26UXlDyJFU7KXxzBxtVtqR4dRz8oALmxYgtnQrfr dqTeUq/f3nnsSUkw9lS3ZIsCXFSY1N9qtPXctEl/LNv/yUKNR34jTxi9h0AKcGfY0/Fn 1SLA65xgBdmHR/u3xUHPf1Ypdcos5Bbp59GTciG1CVJFrgjePNaD1ib5W6l1Q7FDKB0n tucpteqJp/5Ia3yobkrhvZPnaEj5wlfiJmYDhns2Xc6WGmNcih47rQjwAfqEPwzC3bT3 0S89FR91ItiEB1Q2tSUjDrIKWfqbJZ/SP4bTruP20qWBWcqlNIfCSg1gFg4B1PE+wWgT lJ0w== X-Gm-Message-State: AOAM530ygLLT5wNSaaIQEb2KKXGd+nvLLl+osmVQBzRqL5edh5Yp1F78 h2hb6kZdv8sUpgF6BiOakE7hfHYoGgac8Q== X-Received: by 2002:a17:90b:4b4b:b0:1be:fd9a:c279 with SMTP id mi11-20020a17090b4b4b00b001befd9ac279mr13873307pjb.83.1647493765507; Wed, 16 Mar 2022 22:09:25 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id d10-20020a63360a000000b0037947abe4bbsm4217493pga.34.2022.03.16.22.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:09:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-7.1 v6 47/51] hw/nios2: Move memory regions into Nios2Machine Date: Wed, 16 Mar 2022 22:05:34 -0700 Message-Id: <20220317050538.924111-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220317050538.924111-1-richard.henderson@linaro.org> References: <20220317050538.924111-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::62f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, amir.gonnen@neuroblade.ai, Mark Cave-Ayland Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert to contiguous allocation, as much as possible so far. The two timer objects are not exposed for subobject allocation. Reviewed-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- hw/nios2/10m50_devboard.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c index bdc3ffd50d..dda4ab2bf5 100644 --- a/hw/nios2/10m50_devboard.c +++ b/hw/nios2/10m50_devboard.c @@ -38,6 +38,11 @@ struct Nios2MachineState { MachineState parent_obj; + + MemoryRegion phys_tcm; + MemoryRegion phys_tcm_alias; + MemoryRegion phys_ram; + MemoryRegion phys_ram_alias; }; #define TYPE_NIOS2_MACHINE MACHINE_TYPE_NAME("10m50-ghrd") @@ -47,13 +52,10 @@ OBJECT_DECLARE_TYPE(Nios2MachineState, MachineClass, NIOS2_MACHINE) static void nios2_10m50_ghrd_init(MachineState *machine) { + Nios2MachineState *nms = NIOS2_MACHINE(machine); Nios2CPU *cpu; DeviceState *dev; MemoryRegion *address_space_mem = get_system_memory(); - MemoryRegion *phys_tcm = g_new(MemoryRegion, 1); - MemoryRegion *phys_tcm_alias = g_new(MemoryRegion, 1); - MemoryRegion *phys_ram = g_new(MemoryRegion, 1); - MemoryRegion *phys_ram_alias = g_new(MemoryRegion, 1); ram_addr_t tcm_base = 0x0; ram_addr_t tcm_size = 0x1000; /* 1 kiB, but QEMU limit is 4 kiB */ ram_addr_t ram_base = 0x08000000; @@ -62,22 +64,22 @@ static void nios2_10m50_ghrd_init(MachineState *machine) int i; /* Physical TCM (tb_ram_1k) with alias at 0xc0000000 */ - memory_region_init_ram(phys_tcm, NULL, "nios2.tcm", tcm_size, + memory_region_init_ram(&nms->phys_tcm, NULL, "nios2.tcm", tcm_size, &error_abort); - memory_region_init_alias(phys_tcm_alias, NULL, "nios2.tcm.alias", - phys_tcm, 0, tcm_size); - memory_region_add_subregion(address_space_mem, tcm_base, phys_tcm); + memory_region_init_alias(&nms->phys_tcm_alias, NULL, "nios2.tcm.alias", + &nms->phys_tcm, 0, tcm_size); + memory_region_add_subregion(address_space_mem, tcm_base, &nms->phys_tcm); memory_region_add_subregion(address_space_mem, 0xc0000000 + tcm_base, - phys_tcm_alias); + &nms->phys_tcm_alias); /* Physical DRAM with alias at 0xc0000000 */ - memory_region_init_ram(phys_ram, NULL, "nios2.ram", ram_size, + memory_region_init_ram(&nms->phys_ram, NULL, "nios2.ram", ram_size, &error_abort); - memory_region_init_alias(phys_ram_alias, NULL, "nios2.ram.alias", - phys_ram, 0, ram_size); - memory_region_add_subregion(address_space_mem, ram_base, phys_ram); + memory_region_init_alias(&nms->phys_ram_alias, NULL, "nios2.ram.alias", + &nms->phys_ram, 0, ram_size); + memory_region_add_subregion(address_space_mem, ram_base, &nms->phys_ram); memory_region_add_subregion(address_space_mem, 0xc0000000 + ram_base, - phys_ram_alias); + &nms->phys_ram_alias); /* Create CPU -- FIXME */ cpu = NIOS2_CPU(cpu_create(TYPE_NIOS2_CPU));