From patchwork Thu Mar 10 11:27:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 550106 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp916120mag; Thu, 10 Mar 2022 03:52:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMPzTk2dtNLuSKmKlnuXQj0luDjH1A5+/Jm6AM1eMRvmsF1HsFL14lDVtDIqxqjo8mNwr+ X-Received: by 2002:a25:3857:0:b0:628:9c0d:442f with SMTP id f84-20020a253857000000b006289c0d442fmr3310188yba.461.1646913168557; Thu, 10 Mar 2022 03:52:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646913168; cv=none; d=google.com; s=arc-20160816; b=g6rm5VnSXb9k3AG5vzN6PwNj1XiRFJHhga1bVk83V1tn8m+18pHf/pYvImDDKF1S9K m3tLzJ6RTbeJKmgwlxPq6tCIKIpmBfXIVPMrsYMJoC5TtDGWeYWsFa3Zl+XNPDOMEAws mFKip9D8QM4oZVwnhUg3YkTKgV4BGKqYTV++KIOeBZj1flzVsZ+1SDSmSOL1bEBEYl4Y lh3FmtnuhL3DwYL/FTAgu0x7bePfD06B3uIuEoIcxXbHz7qPbbhoOEyKu4h6+sBQ7jbj wHeYPQaS6RUnYFTfPR5cfMw5eNJLoqoB38RPGd4RHFJ8IIzIdngyknE/j7+H5xG+Y8qb XIYA== 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=w1PwMlTiS9ON9o3b5MpUtoAPtGEDFUWkDts/JBt0t20jbBZYcmHHcOUAJ/KSeo8Ze1 k2YMvRCCI9fKCiMlQ0R4XDlKM7UChxS5yqH5oh1F0lgeBFiGuauZCqUqrbB9Ni4PGhoN 2IRo+zBH4VfEVXnFnMktbG9uxVDzXOVq7SNXrsm8rxJz6jPcctty+Q+HQEiQpZJy9tLE TYxL1QolnuCCgrFpJk8D/Dr3TKs5jxl7Jt4s5m33NfJeslYpkM3vw2bXbHjltby4N28G xZjEgae3iMr/8077sPL2V2meGUMNc0Z8Cd+wPG8RFuQ7vrmL1i5QrYib9zF8GSEF3gMA Iknw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=j4lwk9V1; 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 m8-20020a814048000000b002d6dd8cf807si2792667ywn.282.2022.03.10.03.52.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Mar 2022 03:52:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=j4lwk9V1; 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]:55300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nSHLc-0000GK-0G for patch@linaro.org; Thu, 10 Mar 2022 06:52:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSH0u-0002Y2-9p for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:31:25 -0500 Received: from [2607:f8b0:4864:20::533] (port=42570 helo=mail-pg1-x533.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nSH0s-0008U2-Hs for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:31:23 -0500 Received: by mail-pg1-x533.google.com with SMTP id o8so4487759pgf.9 for ; Thu, 10 Mar 2022 03:31:22 -0800 (PST) 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=j4lwk9V1TdTmTDoAFxfTNgp6AGeLFbXKuUZn5R82+4y+UIvpqL8WKEhFQIFWVF2a3v z281tf0lirswi4TUjXIuaIcRbFAGMzAFZBfIz216ffOtl9GfLFkgRWqpEupCapbWtPWZ +hWZQN95ZDYQQO0jG6/Cc7p3RaGt0G7887ylQxiKIQg9zFCrLrv0NvDh0D56/CPo/tYO jPORA0m5XmtK7a/FRLSoFssWQ0eEvJEwWlycIMbYbkbG/Bk40VloOpHjvPnVo8xYBt1n edIo4xlUxPOc8OLZs7c9506TWnFn5vEIFYAqB7uCK5j/vPrMmZ+VZjWTulBqQ0jm5LCj 1xqQ== 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=WbW9u729+EoNojWIYx+e57D7sSR1/tWGayxr0bPEGLR2RKfKaAaVSdHtReMF4aCAKI 7NX8HHCicHV+0vhjC+uLQ4oKuPGopzUo+3bJuxgiNLGes034crPZKxOA7T0p8VaRTP+9 2dJpEDxFx26sS1fELPB9vckf0DGkureqR1PO/tRAUVDSo6K/yScVetsCWnuTzdBf/Pcs UwtV+jGEh13QM7r+STnVMQs/zubIYr63m7hyL4XHUHdjn/DRaVGjJhO+E/TGb+87hyP4 v+oc2AJ48CNSxOwropL34LL3z1nqT/edfP/IHz4OTLVlGf4jmAmHnPaGWemOo0c2Vws4 LddA== X-Gm-Message-State: AOAM530CIBGtNT+8iUbJ3H0vJg61NS/OjXAo5Ql5dTfZZeBTlN2yqM9G Hlxp7IP5vrTDf1FxesB5ocO6RAJx2sbiBw== X-Received: by 2002:a62:30c4:0:b0:4f7:2b29:984 with SMTP id w187-20020a6230c4000000b004f72b290984mr4597010pfw.11.1646911881286; Thu, 10 Mar 2022 03:31:21 -0800 (PST) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020a056a001a8e00b004f75cf1ab6csm6011246pfv.206.2022.03.10.03.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 03:31:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 47/48] hw/nios2: Move memory regions into Nios2Machine Date: Thu, 10 Mar 2022 03:27:24 -0800 Message-Id: <20220310112725.570053-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310112725.570053-1-richard.henderson@linaro.org> References: <20220310112725.570053-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::533 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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, peter.maydell@linaro.org, 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));