From nobody Sun May 19 12:45:58 2024 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684561647; cv=none; d=zohomail.com; s=zohoarc; b=R8VDPoxlQGPpfQ6e9bYXB/Sva/MqRPabC3xVnjWRCYG3fo/g4He9QP0uXZiYZMxUb+IjFBNAPX2Nu9qOGgZmzgzpdXKW3m8gN04jDg8Qw9qQHiz2C1vuqxJ+DEoRqlelCAWzqK1npNRoiE6Oyo4wMhVgOs+9FKzsrOLMdJZSdAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684561647; 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; bh=QoiLKMEOX41tFLy0qcfFWPV2O7S+2JSUpMk1QMM25jk=; b=evHY8icl9JbqlpkU1l2tuA3XJcZ+iLw64Tk46M283T3KdTbVg0lupzEyIWpdF/qQ62TaVacpISwauNWbJdew6nIbn3Hrfxx0zWike1eCTCb6n5YmJUL/TOS0qTgqrcV8tORZQ1/p4sn5+IagAI5oQu08P0354nW7m6ZnwYXL6jQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684561647561977.3067539194914; Fri, 19 May 2023 22:47:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0FPO-0007Lj-FW; Sat, 20 May 2023 01:45:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0FP8-0007DZ-Kl for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:24 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0FP6-0007c1-Nn for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:22 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f423521b10so26269125e9.0 for ; Fri, 19 May 2023 22:45:19 -0700 (PDT) Received: from localhost.localdomain (mau49-h01-176-184-41-228.dsl.sta.abo.bbox.fr. [176.184.41.228]) by smtp.gmail.com with ESMTPSA id 4-20020a05600c020400b003f19b3d89e9sm4304862wmi.33.2023.05.19.22.45.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 May 2023 22:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684561518; x=1687153518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QoiLKMEOX41tFLy0qcfFWPV2O7S+2JSUpMk1QMM25jk=; b=V76Eq+YECNX7VaDfDoQ/AsLC3xPuSpCb7UZocxiXVHsnBJkZ5N5WqVSdD1YGA0TMiU J7MPqWxTwZx2HkF0Uoy4+IoYKcmL2LSnSG895WdDUj9bx/QGTXyyfkv7QHVyRpcL5aI3 Gfzf+CFn4Njd8KjaT8nl4H+pFX644qN8ZnBjogR39sf+IXWMudIf+ur0W/4ayLw6NpCN Px2dmXOKp1b3KJUgBdAslLx0ID8GW+Mx0nxvk5Dc4WgKNbC4p8iQtj3x0DH4KkpmwM8n 2UC1009K7PTAyb0njdpUFh1TFC6qK6YnenNuTkukHL5mR/FJwUcbk6tNg2nnPVNKvqDs UE6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684561518; x=1687153518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QoiLKMEOX41tFLy0qcfFWPV2O7S+2JSUpMk1QMM25jk=; b=HL0HWAEpViRWAubiEOghOuNtdSn7ngtqB8OIjs1LHQReQCsAX6PwX6AYDsAg4uMUR/ SJhkDjgznmqBaLUAMpzUgShsXCKTYhYjYyvpClRh3U8R0zy6XsdrbrowNfEYSw21q6ja sXJApZAX7Mb4iI1pJKu3QnZ0LMIhg4W2lh7UfypqhaZxg2e6cBkWjtUOIz6fxuEiyN2E fsz+ACOC3snWkc9wo4zulsqitzXmmQwfffNaf1OtVfJ+PbcnBC3Ne42GjE2Bw1ENKNF8 NMPyAuRGPqKnW+foxchOlGROPJ83RLM3LG4vl77PNlJZxsemI4aq2OMZ/UT2bGPJ6nbp JnVA== X-Gm-Message-State: AC+VfDxvGLryA6fS6OxC8leN8Lx9YK4xda0kA5DQ5o0cyT3EW0vl39p0 2CZf3Uyo6AyHxUXCBGXEAIkO/DX2lxd2D7klaLo= X-Google-Smtp-Source: ACHHUZ4csgNyyT/psF7HgptwDPAqaL5PythaxSAos8jHh6FNFfYt6y9UmPWol2OiVVQ6gEzfs4yH4A== X-Received: by 2002:a05:600c:ac6:b0:3f1:8c5f:dfc5 with SMTP id c6-20020a05600c0ac600b003f18c5fdfc5mr2749103wmr.39.1684561518473; Fri, 19 May 2023 22:45:18 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Liu Zhiwei , Palmer Dabbelt , Weiwei Li , Bin Meng , Alistair Francis , qemu-riscv@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/5] hw/riscv/opentitan: Rename machine_[class]_init() functions Date: Sat, 20 May 2023 07:45:06 +0200 Message-Id: <20230520054510.68822-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230520054510.68822-1-philmd@linaro.org> References: <20230520054510.68822-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1684561649278100001 Follow QOM style which declares FOO_init() as instance initializer and FOO_class_init() as class initializer: rename the OpenTitan machine class/instance init() accordingly. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- hw/riscv/opentitan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index bc678766e7..2d21ee39c5 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -75,7 +75,7 @@ static const MemMapEntry ibex_memmap[] =3D { [IBEX_DEV_FLASH_VIRTUAL] =3D { 0x80000000, 0x80000 }, }; =20 -static void opentitan_board_init(MachineState *machine) +static void opentitan_machine_init(MachineState *machine) { MachineClass *mc =3D MACHINE_GET_CLASS(machine); const MemMapEntry *memmap =3D ibex_memmap; @@ -108,17 +108,17 @@ static void opentitan_board_init(MachineState *machin= e) } } =20 -static void opentitan_machine_init(MachineClass *mc) +static void opentitan_machine_class_init(MachineClass *mc) { mc->desc =3D "RISC-V Board compatible with OpenTitan"; - mc->init =3D opentitan_board_init; + mc->init =3D opentitan_machine_init; mc->max_cpus =3D 1; mc->default_cpu_type =3D TYPE_RISCV_CPU_IBEX; mc->default_ram_id =3D "riscv.lowrisc.ibex.ram"; mc->default_ram_size =3D ibex_memmap[IBEX_DEV_RAM].size; } =20 -DEFINE_MACHINE("opentitan", opentitan_machine_init) +DEFINE_MACHINE("opentitan", opentitan_machine_class_init) =20 static void lowrisc_ibex_soc_init(Object *obj) { --=20 2.38.1 From nobody Sun May 19 12:45:58 2024 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684561610; cv=none; d=zohomail.com; s=zohoarc; b=TwtuevorOf3FkYJnmyz/8TRrZ4POvXVWSMYOvMdPw8ro/7Sfpf6X7wOUmm6kc36jyTUOkltGPrm6f79jP7p/CHAN2TG9XdJ4v7bq2fGMaJvGdf2vnuDgxPX+xUprWovULgvL6LBefhngcqwc9Z9mI8a8PFs4FQ2kBI8ZeENLHgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684561610; 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; bh=hTAW6cK3XhyHe2DSiXzz9dWc3zDAXzPHwYcm030hYyk=; b=ZXRQZZS9ka3SeRotMYCFZ2kvHYueFUpPtv1eY8/2qvX4VKQldzMBHG9Gb7aMAK7GZDlwY6HX9vzm3w0nTKJ7zI8VfDFN7k6d1pBw1rq2dWtMAiChOS0zXTU6roRY6arawAwvC1BxiaExP+FGZl6IQwkSfMkxzWTfzCWaS52XP8o= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684561610549749.5933859064029; Fri, 19 May 2023 22:46:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0FPL-0007Hn-Eo; Sat, 20 May 2023 01:45:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0FPC-0007Du-Tz for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:30 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0FPB-0007cT-FE for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:26 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f41d087b24so27222745e9.1 for ; Fri, 19 May 2023 22:45:25 -0700 (PDT) Received: from localhost.localdomain (mau49-h01-176-184-41-228.dsl.sta.abo.bbox.fr. [176.184.41.228]) by smtp.gmail.com with ESMTPSA id z12-20020a5d640c000000b00307c8d6b4a0sm905259wru.26.2023.05.19.22.45.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 May 2023 22:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684561524; x=1687153524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hTAW6cK3XhyHe2DSiXzz9dWc3zDAXzPHwYcm030hYyk=; b=pW+WiwCo5lSt4d/R7h1EzOwqgt2veIicK34eOeQmtyBV/1P7xSikI7OYscaUpCoHlO 8UPHOQcdYfgJcRwDMxr+E8obGdG8RrJ3PiT8z4DR43Mu4FTKUvoiwkrQMIXy2pRtQ8iH B14/qJK4CH7ZbogzWfqK+s6+LSe0Y6okbyKt5h2fGNq2+2ESGiW9Vi2uqK8snox/x3vD yZeiOdXw22QXPH4tqE9iF7p5R718nxExJ7QNwvYkF0MThY7ro6xgQkywlgb/XccZTGbi YdZoBOvH2WdGqmZ5G3U27LDGvReQc5mOid5NzZBFpf5Li50x08c0vMgpAB79GzZm7RF/ FANQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684561524; x=1687153524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hTAW6cK3XhyHe2DSiXzz9dWc3zDAXzPHwYcm030hYyk=; b=ISBIGJQYOcQ9y3k+Z8ybSioTiOh9NQU4hbgzIHhE4+53TSJ8WdewgvEf2WZqGOR6Tq uhHYneUPoR7Q+1NareatwlF9ihAZr/0l2wIuOpsAPZrOOPGZb5yw+WWcpgIHEorIjPrA vTHrhB1B3Mag9+tXaAkU5goxWy568lVk/DMqRqoMxdueJzrVJUzHIu44Dp74V7rlvHJ6 bjtPAna9x4KlRZ65E4VJ+xiV01ruyXy3G44d71kz4ZKObCzHSRvT3q8IYhksIN/QqzH9 rIJTbLLjiVBG4ONV4TVhTVZ/Ti9p8VyBKyT/rGbmSEgEcLUKxPCRkijezSm/JDDS8gdN zjVw== X-Gm-Message-State: AC+VfDxXrp0waoT/0ZiSJFzVvI08eqBi9LPuQKUqj+1/DedPuYk9F7vJ q/OGuwYMWyK1hKyJ24Zi4gRZkxmqK0NsHadQx5Q= X-Google-Smtp-Source: ACHHUZ4FC3MChAhppSmAQjd0r86vrx342dJt6bw0lmbKUiXRki7lTY3HDSZKRDvlIFvx9fusHmNKUQ== X-Received: by 2002:adf:ee91:0:b0:309:509f:a7f0 with SMTP id b17-20020adfee91000000b00309509fa7f0mr3056463wro.44.1684561523946; Fri, 19 May 2023 22:45:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Liu Zhiwei , Palmer Dabbelt , Weiwei Li , Bin Meng , Alistair Francis , qemu-riscv@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/5] hw/riscv/opentitan: Declare QOM types using DEFINE_TYPES() macro Date: Sat, 20 May 2023 07:45:07 +0200 Message-Id: <20230520054510.68822-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230520054510.68822-1-philmd@linaro.org> References: <20230520054510.68822-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1684561611129100003 When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. Replace the type_init() / type_register_static() combination. This is in preparation of adding the OpenTitan machine type to this array in a pair of commits. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- hw/riscv/opentitan.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 2d21ee39c5..294955eeea 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -320,17 +320,14 @@ static void lowrisc_ibex_soc_class_init(ObjectClass *= oc, void *data) dc->user_creatable =3D false; } =20 -static const TypeInfo lowrisc_ibex_soc_type_info =3D { - .name =3D TYPE_RISCV_IBEX_SOC, - .parent =3D TYPE_DEVICE, - .instance_size =3D sizeof(LowRISCIbexSoCState), - .instance_init =3D lowrisc_ibex_soc_init, - .class_init =3D lowrisc_ibex_soc_class_init, +static const TypeInfo open_titan_types[] =3D { + { + .name =3D TYPE_RISCV_IBEX_SOC, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(LowRISCIbexSoCState), + .instance_init =3D lowrisc_ibex_soc_init, + .class_init =3D lowrisc_ibex_soc_class_init, + } }; =20 -static void lowrisc_ibex_soc_register_types(void) -{ - type_register_static(&lowrisc_ibex_soc_type_info); -} - -type_init(lowrisc_ibex_soc_register_types) +DEFINE_TYPES(open_titan_types) --=20 2.38.1 From nobody Sun May 19 12:45:58 2024 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684561593; cv=none; d=zohomail.com; s=zohoarc; b=Wpepe22JaoDZz36QTVetonEM8dYUapKRy3k5oodM9XjYLuP6CNJUpy2ps13Rp+pgR0dDwaf+FYAfPFrDiUbo5examCzltjkyTQAM/Ua3cb0l+y4KMndAeS9iQ3rT5GN2MJMQpZng3UapXl4XFDcnaniTMKByeD3v52iGRJgMJG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684561593; 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; bh=x9CmwAgDvj3Ddgy+Sh+yZXxS5mPQZ+cjq5z84zBdlHE=; b=YeEjlI4HqMOBt9HjBbI14RlT6XxSMZlR9iacUFN8JtEV+vj1S3cgbwLNMPHIRjrBB08GlmNI+etk6jUkenZBMjnIw+73+6oXgBGiv8hMEiKkTyyin8rKLuwJK+OyaUJzGduCqmVMvhRIzYtvRZaukFMZ55n0isciNmyOyjETyd4= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684561593123974.9440508568734; Fri, 19 May 2023 22:46:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0FPR-0007NV-Qa; Sat, 20 May 2023 01:45:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0FPH-0007GC-Ua for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:32 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0FPG-0007c1-Cq for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:31 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f423521b10so26269575e9.0 for ; Fri, 19 May 2023 22:45:29 -0700 (PDT) Received: from localhost.localdomain (mau49-h01-176-184-41-228.dsl.sta.abo.bbox.fr. [176.184.41.228]) by smtp.gmail.com with ESMTPSA id q10-20020a1cf30a000000b003f423508c6bsm1086791wmq.44.2023.05.19.22.45.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 May 2023 22:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684561529; x=1687153529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x9CmwAgDvj3Ddgy+Sh+yZXxS5mPQZ+cjq5z84zBdlHE=; b=Hw6L/nZYiuaevh/ccfzTW0UM+ugEhuzW7l/8EVTF2v/L0rh+hpP6WUx8O6ExRzY6IM yy/HUuoJyf6J9FvbgwT2Il9iw6JkOz2NSe2ExEWZ8qMfUZN9WOF6ZrSOZRg3572v6Ocw T2z+MPrBd7uB8eRI04DymxOMiagvresxopXyVjDebib5JxZ17fEP82/e4dosyRXjh+IX whK3cjQ8x4vXMvLcncTxaBN1/7yUfBkOulYJajfltfl/IOLuVcht91E5wGeqTjp+BpHT oJ8GdLbi4vq8+AnL0J0tXGJSF21z3sfiyvKinCEAZhgiAfTAy/bqur46vH3RMsRJ5ORH vlbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684561529; x=1687153529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x9CmwAgDvj3Ddgy+Sh+yZXxS5mPQZ+cjq5z84zBdlHE=; b=OExJe7mIDzDlajxUjq1AA3BOHlr32hD3vN3PBN943sRAi8Onwj9StNyvu2vzeEq6ec ub/xzXx4Ytu4omJ18MRIJC0xfYAzu759qQY2jrjZ9KoZzAI/rlWEMJFmpXKpXvRZhQQJ oPVpaYg8jdKWfrMKbw+l3p5rPwnFfKRxhTxYF7Tk7HX140mrF6dUYN9wYzGpqAxyyOts P3SSXPP5gZJAMg7bEe8RWmHWPTKMYeiO3A8dOJaH/bL/qmR+t3wMGLyzn45qXzZoNF/q a/wSr37YvmO8JEtT0X8Q+QVJx9oQEfs2B6/zApkiUlKkLMrhdb+tOLL7Nnf5ZpYrG7ZN rq8w== X-Gm-Message-State: AC+VfDyrPfTRw/ahI0r7JEhgR3pZPLT9GefoD4RgGE9eQnJg1KyXh9NJ oN4Jxcg2tNKUHZ5KVxsiB+fNmsi+LbmdNs+EvAA= X-Google-Smtp-Source: ACHHUZ7lHds296hhh4Usq+CAkKRaqx0UI/ko25lo0dw8dtC2tL7bmEfp1MM0TLDzRPo1XNAHhMam5w== X-Received: by 2002:a7b:ca45:0:b0:3f5:d70:440f with SMTP id m5-20020a7bca45000000b003f50d70440fmr2929027wml.19.1684561529545; Fri, 19 May 2023 22:45:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Liu Zhiwei , Palmer Dabbelt , Weiwei Li , Bin Meng , Alistair Francis , qemu-riscv@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/5] hw/riscv/opentitan: Add TYPE_OPENTITAN_MACHINE definition Date: Sat, 20 May 2023 07:45:08 +0200 Message-Id: <20230520054510.68822-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230520054510.68822-1-philmd@linaro.org> References: <20230520054510.68822-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1684561595338100003 QOM type names are usually defined as TYPE_FOO. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- include/hw/riscv/opentitan.h | 2 ++ hw/riscv/opentitan.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h index c40b05052a..fd70226ed8 100644 --- a/include/hw/riscv/opentitan.h +++ b/include/hw/riscv/opentitan.h @@ -53,6 +53,8 @@ struct LowRISCIbexSoCState { MemoryRegion flash_alias; }; =20 +#define TYPE_OPENTITAN_MACHINE "opentitan" + typedef struct OpenTitanState { /*< private >*/ SysBusDevice parent_obj; diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 294955eeea..7d7159ea30 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -118,7 +118,7 @@ static void opentitan_machine_class_init(MachineClass *= mc) mc->default_ram_size =3D ibex_memmap[IBEX_DEV_RAM].size; } =20 -DEFINE_MACHINE("opentitan", opentitan_machine_class_init) +DEFINE_MACHINE(TYPE_OPENTITAN_MACHINE, opentitan_machine_class_init) =20 static void lowrisc_ibex_soc_init(Object *obj) { --=20 2.38.1 From nobody Sun May 19 12:45:58 2024 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684561632; cv=none; d=zohomail.com; s=zohoarc; b=eWyKT/Shs7QkUPPEhpazOa/Scah5Q3gKHyx3Wa0joivMr3nCXGHhTmTM5wTEXRjTozjC/p2iZE/UOY2XYdT1DI8XLUrpmvRVNGzSx7XOcPVczGBBXvkiLbpRM8JOW/OMypLBFU0Hw30pEWMNOoRsTG2Bdyg6KEXeGD9VDyggYic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684561632; 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; bh=9RyvUr1lBMxRBlxutUWdrrmWw/Nx1e27AsLVC25y0F4=; b=mm1hd9tYHEaozXb5Ep9XMYNfKH97h2xmAyfc+qD4hMJcu1IfAywrVp631B+e82BN/u79G4wnymvC5pGf2/kheqonMPH1TlY0aW6Bn+p44ICFGscrBxfuCmPrfsVMjlnMxpscq15eZy94jYPrOpKRzrtZZftJHwNi0WB/ETM51Gw= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168456163202285.27936497321741; Fri, 19 May 2023 22:47:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0FPQ-0007NC-D0; Sat, 20 May 2023 01:45:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0FPO-0007Lk-B1 for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:38 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0FPM-0007dO-I3 for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:37 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f4271185daso39042495e9.2 for ; Fri, 19 May 2023 22:45:36 -0700 (PDT) Received: from localhost.localdomain (mau49-h01-176-184-41-228.dsl.sta.abo.bbox.fr. [176.184.41.228]) by smtp.gmail.com with ESMTPSA id t1-20020a7bc3c1000000b003f42158288dsm4377319wmj.20.2023.05.19.22.45.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 May 2023 22:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684561535; x=1687153535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9RyvUr1lBMxRBlxutUWdrrmWw/Nx1e27AsLVC25y0F4=; b=PKELuvhix3C+uVNxCIR8DvVIH2Yt+Ib+Vzmkog7WpfbrdAojUOlmjgCbrklPZ2y4Fe vZ4M1Bmhj3NE0JgJnPEbhQb4rmV9wPevKq20o8wHnaajeW3kJv224xJiTdQHs/6egrsl VoNumvN/q8EyZekG29cbMjPCkI5uaKO7UkbzxsoSSls3edKdMTYWt9yH0MhEnqOMxXxk xpFQ5qMi4Bbc1T3KlfTL5Dcc5CUgGIBteypjqR4zllWwuO2CtIuCgYSgL1gVfno5AQCi irnDNunFBORvfSku4lo8wv0XPepcGx6zj+1+12DCdopoDcHlXIA5cgBVL/vC9E8o7rPE UMBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684561535; x=1687153535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9RyvUr1lBMxRBlxutUWdrrmWw/Nx1e27AsLVC25y0F4=; b=UhiiRlFnyViAJ17+1EdLzx5wpVCc10C3mZ1en1pEi87r5MQVXIcF7gp2zjLGrGnorL kn8Gca3DOmj/SWrNz+PQg55U5eiWToociAPfv22tRLkOrrKHq2pZmEijiYMhzn1JFOP9 iBjFhkQqArC4+RBuqQu4vreTAHojvuz/LtfIStSh85ITlSeeX56uhguenGQpzdU08mtf bmd+DJX4+NRGGiV7WeSqR2jvhzo9EBpQcJHq7pvbAWpnQJtDOh68A6I4OJTWGgSphDXI 7tdDEwwjwaehb5sRKq2zenBcgHj/wdD7hDVtcEdKiTfAJG7kshPOd8cgHcH8DhqgLCMF KoWQ== X-Gm-Message-State: AC+VfDzUC5pejhwuWU+6fctdq9q7pejv+KXaRXCspiYnNRyhvAo58vsh 4ijbRN0cSFigOlaaegFpkPHeL9H+rxxj7AXOfrw= X-Google-Smtp-Source: ACHHUZ5indZZtlhR4htSlNxfXZ69jjfj5/lLARRLYmoUQWRVX6L9s0yNgpxOZSMEpp/OXlDFMspxyQ== X-Received: by 2002:a7b:cc11:0:b0:3f0:9564:f4f6 with SMTP id f17-20020a7bcc11000000b003f09564f4f6mr2980027wmh.1.1684561534942; Fri, 19 May 2023 22:45:34 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Liu Zhiwei , Palmer Dabbelt , Weiwei Li , Bin Meng , Alistair Francis , qemu-riscv@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 4/5] hw/riscv/opentitan: Explicit machine type definition Date: Sat, 20 May 2023 07:45:09 +0200 Message-Id: <20230520054510.68822-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230520054510.68822-1-philmd@linaro.org> References: <20230520054510.68822-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1684561633189100001 Expand the DEFINE_MACHINE() macro, converting the class_init() handler. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- include/hw/riscv/opentitan.h | 3 ++- hw/riscv/opentitan.c | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h index fd70226ed8..806ff73528 100644 --- a/include/hw/riscv/opentitan.h +++ b/include/hw/riscv/opentitan.h @@ -24,6 +24,7 @@ #include "hw/char/ibex_uart.h" #include "hw/timer/ibex_timer.h" #include "hw/ssi/ibex_spi_host.h" +#include "hw/boards.h" #include "qom/object.h" =20 #define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc" @@ -53,7 +54,7 @@ struct LowRISCIbexSoCState { MemoryRegion flash_alias; }; =20 -#define TYPE_OPENTITAN_MACHINE "opentitan" +#define TYPE_OPENTITAN_MACHINE MACHINE_TYPE_NAME("opentitan") =20 typedef struct OpenTitanState { /*< private >*/ diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 7d7159ea30..9535308197 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -108,8 +108,10 @@ static void opentitan_machine_init(MachineState *machi= ne) } } =20 -static void opentitan_machine_class_init(MachineClass *mc) +static void opentitan_machine_class_init(ObjectClass *oc, void *data) { + MachineClass *mc =3D MACHINE_CLASS(oc); + mc->desc =3D "RISC-V Board compatible with OpenTitan"; mc->init =3D opentitan_machine_init; mc->max_cpus =3D 1; @@ -118,8 +120,6 @@ static void opentitan_machine_class_init(MachineClass *= mc) mc->default_ram_size =3D ibex_memmap[IBEX_DEV_RAM].size; } =20 -DEFINE_MACHINE(TYPE_OPENTITAN_MACHINE, opentitan_machine_class_init) - static void lowrisc_ibex_soc_init(Object *obj) { LowRISCIbexSoCState *s =3D RISCV_IBEX_SOC(obj); @@ -327,6 +327,10 @@ static const TypeInfo open_titan_types[] =3D { .instance_size =3D sizeof(LowRISCIbexSoCState), .instance_init =3D lowrisc_ibex_soc_init, .class_init =3D lowrisc_ibex_soc_class_init, + }, { + .name =3D TYPE_OPENTITAN_MACHINE, + .parent =3D TYPE_MACHINE, + .class_init =3D opentitan_machine_class_init, } }; =20 --=20 2.38.1 From nobody Sun May 19 12:45:58 2024 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684561604; cv=none; d=zohomail.com; s=zohoarc; b=IiTbI9J/P9iuJI69mY4onfC7fFtJUTxeQFG2Cq2Wzl3c4/VZdItey4OvA82ZBO7nNKgs603b4w1X1+5NW0ctCZmNJCxqOQyMQWhONez8t2hZR8tO4X/T4q2hU5mIiqB2VQAfAaubYazpGSNa6UHo6o50TFD8btExFJk6RQ/YQrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684561604; 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; bh=kXcukaWbFF62HN09sQV7LoFKa7B0fHLkBZtjDa1RbSE=; b=jXeM0F58Ffb6VciBnW7YuH2kkrwgvS2uROMCuX72vP6IefEyj6F7qgBj6DnkNGKxtanN6Ta+5kzASUjCZzhznuiVdMCTzFaoYxErZPd5q7VGrZqJuVFLBUM7SNJAi7XP15bPKc7fVHPHM2dHfkxkAL8JEaQDr60GtXc7DF0Hdjo= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684561604275504.0864291091435; Fri, 19 May 2023 22:46:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0FPX-0007P2-6a; Sat, 20 May 2023 01:45:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0FPU-0007O0-2t for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:44 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0FPS-0007dr-AZ for qemu-devel@nongnu.org; Sat, 20 May 2023 01:45:43 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3f42c865535so40477675e9.1 for ; Fri, 19 May 2023 22:45:41 -0700 (PDT) Received: from localhost.localdomain (mau49-h01-176-184-41-228.dsl.sta.abo.bbox.fr. [176.184.41.228]) by smtp.gmail.com with ESMTPSA id s2-20020a7bc382000000b003f4fbd9cdb3sm1128093wmj.34.2023.05.19.22.45.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 May 2023 22:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684561540; x=1687153540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kXcukaWbFF62HN09sQV7LoFKa7B0fHLkBZtjDa1RbSE=; b=m9jcuZXBdHByEjfauE4oKJQyaTyU49whZMe6zRjeCmP6kYfk25son0cLoeaUkRgAIY 85BVBBBbzyyXc0iZwJMp3ktSIxr6L7VhnaIUStq+24FOxKR8sq6ncfhXGqV32imvGDAN pFSZk0AeoAdepbG9VRNSxlx6S9ai/ELGpe7AvFLXchxpPKWndCnjnNo/5Sb7Pt8h46iI pZoU+VRR+0cTC+nyqNUBWUHw5lOZMM5vnuiblhABeQIf7LB+N2Ac1+S6ZGvHhRugS7oK aQhFWvDPfLV0IjB6jkRDoQk+5CfttA8uaCFY2enPHARU0t1R/YTDSNIml3IJlCj2LQzs jNdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684561540; x=1687153540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kXcukaWbFF62HN09sQV7LoFKa7B0fHLkBZtjDa1RbSE=; b=lszRFrBoYnhT41fk4s5YUL+zMWAmcAmI16nIj67yuT9uR0b7T06FWQ1yLurv3gmjSL XOwfAE31zZfl8NXKCtR9vLfT2AHUG70NGDr0OcNmlQQVIWydeL0/DY4f7wqzqjYXHvcb 5Z23q2camuu9WldILygCelo1cxeT0yJIGBlRyixqDR1IraFuzIdJewpq1Fs+WBwSVIPK MRhbiE01wN4Chgolfk7fe3taHUuiUA574N6TPWWRRiHBCiVu8coXh5vAYdX8S3y9UWnX DbtIvWnpip+UrX5Me+mGTfVvItSCvp6aMQrWJZJuoe9oyd161cXFPvjhTDQf/CX5fov3 KNKQ== X-Gm-Message-State: AC+VfDzkqleINqun28n2DluegXBE2zM14Rpzj7E51ii/GTw1uogfrGNX PM6zDCYx96zwsq3LwcVawcSNJTBH+tq/IdDuLh4= X-Google-Smtp-Source: ACHHUZ6bgex7spNwvcTdQoTXcKLQYC5SZZosop6yrNb7653pVrNKU1MeyJaENsWTX6+Gj8OSb9ALjw== X-Received: by 2002:a7b:cc88:0:b0:3f1:8223:6683 with SMTP id p8-20020a7bcc88000000b003f182236683mr2396819wma.40.1684561540264; Fri, 19 May 2023 22:45:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Liu Zhiwei , Palmer Dabbelt , Weiwei Li , Bin Meng , Alistair Francis , qemu-riscv@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 5/5] hw/riscv/opentitan: Correct OpenTitanState parent type/size Date: Sat, 20 May 2023 07:45:10 +0200 Message-Id: <20230520054510.68822-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230520054510.68822-1-philmd@linaro.org> References: <20230520054510.68822-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1684561604605100001 OpenTitanState is the 'machine' (or 'board') state: it isn't a SysBus device, but inherits from the MachineState type. Correct the instance size. Doing so we avoid leaking an OpenTitanState pointer in opentitan_machine_init(). Fixes: fe0fe4735e ("riscv: Initial commit of OpenTitan machine") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- include/hw/riscv/opentitan.h | 3 ++- hw/riscv/opentitan.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h index 806ff73528..609473d07b 100644 --- a/include/hw/riscv/opentitan.h +++ b/include/hw/riscv/opentitan.h @@ -55,10 +55,11 @@ struct LowRISCIbexSoCState { }; =20 #define TYPE_OPENTITAN_MACHINE MACHINE_TYPE_NAME("opentitan") +OBJECT_DECLARE_SIMPLE_TYPE(OpenTitanState, OPENTITAN_MACHINE) =20 typedef struct OpenTitanState { /*< private >*/ - SysBusDevice parent_obj; + MachineState parent_obj; =20 /*< public >*/ LowRISCIbexSoCState soc; diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 9535308197..6a2fcc4ade 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -78,8 +78,8 @@ static const MemMapEntry ibex_memmap[] =3D { static void opentitan_machine_init(MachineState *machine) { MachineClass *mc =3D MACHINE_GET_CLASS(machine); + OpenTitanState *s =3D OPENTITAN_MACHINE(machine); const MemMapEntry *memmap =3D ibex_memmap; - OpenTitanState *s =3D g_new0(OpenTitanState, 1); MemoryRegion *sys_mem =3D get_system_memory(); =20 if (machine->ram_size !=3D mc->default_ram_size) { @@ -330,6 +330,7 @@ static const TypeInfo open_titan_types[] =3D { }, { .name =3D TYPE_OPENTITAN_MACHINE, .parent =3D TYPE_MACHINE, + .instance_size =3D sizeof(OpenTitanState), .class_init =3D opentitan_machine_class_init, } }; --=20 2.38.1