From patchwork Tue Mar 8 07:20:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 549260 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2394830mag; Mon, 7 Mar 2022 23:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgYIS1sgnUEkOwj/klh51qWQxprlfv6ejrKrKrHIvGcUMgfuqyIAgYzO/Hp6TkNJBKVIeH X-Received: by 2002:a05:622a:48f:b0:2dd:b41a:e206 with SMTP id p15-20020a05622a048f00b002ddb41ae206mr12155363qtx.274.1646725492672; Mon, 07 Mar 2022 23:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646725492; cv=none; d=google.com; s=arc-20160816; b=h1w5KQ9owr/Hwvs2Did5JDyr9J63dssh+9yP7awiJ+AayBxY/Fq6iKjm2bFBLHKwnf A5NytA0bGuL8TR+ENDhUIBJgDq3frFi0AzFhGwtw+WeHWETDnaUbRi3UlPYv8785yOsr thnJq4kPZKvDrz3NVQpA0W7fbcpFq2IEeRwYQtBY3+pV+aWpnwgO05gk+EVFPYDfbNKS MBZChX8oFa3y+lTMtlMuJxavVrRiKeUIn+qlF8EzwgTA4d9Qm8d6dD7yyrOicF5q+hii MA+5JhA7BfzbAJLwjISzikJkCPQaSZOMvyuzNDTFh/NqPLm9oAmJZK0gSrFSe0iIpHCN g5Bg== 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=h+jQs21jGzokf3Yfc7d46eGEeMlYc/6pCsyk7NVMPxQ=; b=cwCyQvzul1qX1HCbUoSXrjpSBulKwtPhgS/JaH+RpN7U4/djHWfzc0vyfSnLwt0MqG sZpMyEjj2XRCP+gCrztQn0bPebBWWPyUxkPIFPa7NQnDK9zIpoQwMQhimmDNvKUiiCZN pK1VM694WxJZL2ynnUn4gOGSps7zIGF6gIt58SmY+i6/krLVRsjAXPPgbSurMeCUBL0N 4hv/zOzYU1wCOM+cW3Iqgt7xkD/KVJIqXpDbBCf3BpoOA0y18lWNuMleATcYOEJiPkI8 I2ziy3DTj7sxC3F8DhNV2gunEjVXwnTb9lWP7H6EupfLAFnzCr1C0+HIaA54SDYotvYh iJGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=p9onNzxD; 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 i17-20020ac85c11000000b002de06b9bda2si6956667qti.626.2022.03.07.23.44.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Mar 2022 23:44:52 -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=p9onNzxD; 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]:47138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRUWa-0006jg-7P for patch@linaro.org; Tue, 08 Mar 2022 02:44:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRU9V-0005mn-Bj for qemu-devel@nongnu.org; Tue, 08 Mar 2022 02:21:01 -0500 Received: from [2607:f8b0:4864:20::102e] (port=42779 helo=mail-pj1-x102e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRU9T-0006XL-P5 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 02:21:01 -0500 Received: by mail-pj1-x102e.google.com with SMTP id c16-20020a17090aa61000b001befad2bfaaso1596695pjq.1 for ; Mon, 07 Mar 2022 23:20:59 -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=h+jQs21jGzokf3Yfc7d46eGEeMlYc/6pCsyk7NVMPxQ=; b=p9onNzxDSMZrCprXu6px+Rn8Tg7bSaGSL5bWJw93JwBcQuXtWsnZ0AfJ+uaL2PSifU xNHl539ufNvGh74yPFYrbtKbI1NzzK3W0N5AgOBL6IcXQxR8/cF8/pDNDDZUS5F8l4IQ el9vv1oWQEp7gfYgmwKCDkuxfm6ZwY0sfXYOQ5pFmK5WFXv6r2vFVYWSfMcawITZFQN/ ySt8Pn+nbAr4eF1Dqr7hWn///KXj6pQ/Mrs5bOviyAdMXkxl7omFdd/R7StU9OVsGR56 TI0aHklEZpP/bW3MqeIj/R41CGKuBHeXBUSAo+DDryWRM23uKrSaMSyqJKa4qheoimAX EPKg== 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=h+jQs21jGzokf3Yfc7d46eGEeMlYc/6pCsyk7NVMPxQ=; b=UjjlPZG1POqCamKuxt7JPPKeiDv1XpsK4k2N2jgfTwyKW3kTBG/QgdjAFQbZHYUgGP lwtoI6td8i8iwLRQbeUIJGU0HnJ2cSVZZjzJGb/0Lk7K2o4xYHf0lTz4JPSJyqcdBClQ a+H0yMLkaWt8lkWlu3jqGPEvIxHToIHTIG05RbMYPLNzJsn+GdEncZPRY5qG5sYYIWjr YaccXmLy19BU7XEdemsUOPKVc3i3Ng6DepO3PqMYvyfSZxfAweb/Cp134flEKyUELmNt u0qJ70cSgLbenaoldsON1DorvXSFvRP0YwTWaKoKgsCxa8XUjuAJZK2plTA7m9QlmxZv MJ3A== X-Gm-Message-State: AOAM531iWY23Oi7opWFhFSpRWDpmZRLjPRcjSB7gGJP+AmcvUVyX1c/8 2tjevO3MA9kie+cT/pMfVSCn2SQHiCfgTg== X-Received: by 2002:a17:90a:a594:b0:1bc:5def:a652 with SMTP id b20-20020a17090aa59400b001bc5defa652mr3187541pjq.167.1646724058484; Mon, 07 Mar 2022 23:20:58 -0800 (PST) Received: from localhost.localdomain (cpe-50-113-46-110.hawaii.res.rr.com. [50.113.46.110]) by smtp.gmail.com with ESMTPSA id p125-20020a622983000000b004f6c5d58225sm13790899pfp.90.2022.03.07.23.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 23:20:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 31/33] hw/nios2: Introduce Nios2MachineState Date: Mon, 7 Mar 2022 21:20:03 -1000 Message-Id: <20220308072005.307955-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308072005.307955-1-richard.henderson@linaro.org> References: <20220308072005.307955-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We want to move data from the heap into Nios2MachineState, which is not possible with DEFINE_MACHINE. Signed-off-by: Richard Henderson --- hw/nios2/10m50_devboard.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c index 3d1205b8bd..f245e0baa8 100644 --- a/hw/nios2/10m50_devboard.c +++ b/hw/nios2/10m50_devboard.c @@ -36,10 +36,18 @@ #include "boot.h" +struct Nios2MachineState { + MachineState parent_obj; +}; + +#define TYPE_NIOS2_MACHINE MACHINE_TYPE_NAME("10m50-ghrd") +OBJECT_DECLARE_TYPE(Nios2MachineState, MachineClass, NIOS2_MACHINE) + #define BINARY_DEVICE_TREE_FILE "10m50-devboard.dtb" static void nios2_10m50_ghrd_init(MachineState *machine) { + Nios2MachineState *nms = NIOS2_MACHINE(machine); Nios2CPU *cpu; DeviceState *dev; MemoryRegion *address_space_mem = get_system_memory(); @@ -101,15 +109,29 @@ static void nios2_10m50_ghrd_init(MachineState *machine) cpu->exception_addr = 0xc8000120; cpu->fast_tlb_miss_addr = 0xc0000100; - nios2_load_kernel(cpu, ram_base, ram_size, machine->initrd_filename, + nios2_load_kernel(cpu, ram_base, ram_size, nms->parent_obj.initrd_filename, BINARY_DEVICE_TREE_FILE, NULL); } -static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc) +static void nios2_10m50_ghrd_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "Altera 10M50 GHRD Nios II design"; mc->init = nios2_10m50_ghrd_init; mc->is_default = true; } -DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init); +static const TypeInfo nios2_10m50_ghrd_type_info = { + .name = TYPE_NIOS2_MACHINE, + .parent = TYPE_MACHINE, + .instance_size = sizeof(Nios2MachineState), + .class_size = sizeof(MachineClass), + .class_init = nios2_10m50_ghrd_class_init, +}; + +static void nios2_10m50_ghrd_type_init(void) +{ + type_register_static(&nios2_10m50_ghrd_type_info); +} +type_init(nios2_10m50_ghrd_type_init);