From patchwork Sat May 20 05:45:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 684295 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp232451wrt; Fri, 19 May 2023 22:47:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5OMbrGtVPsICvRWEWr9by2Uulp8KdnE4XokSJCYtHHURn8Jr7G2RQv/7xB/eT9T7VU1LE6 X-Received: by 2002:a05:6214:1251:b0:5f1:6892:7437 with SMTP id r17-20020a056214125100b005f168927437mr7631877qvv.26.1684561647185; Fri, 19 May 2023 22:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684561647; cv=none; d=google.com; s=arc-20160816; b=xTZjNrErNJeU4EB0Lc/faRUedrC0u7Y2rxiDemKMWEqki6/fzEtkpYiqHOsTIq8t2N 90q2GpCD7LpXlfkj5EuQ6Rr8NcSv+6j0uIAHI8wM9CHgbXZ7r7vmF9kMv+scRHmmB5mu qwAzYEw+6tSWUlqIONdErE3ckrj0IoZJUcaC1wWylj1BEPDWwPt/Wdjy8XThaLEPERgi wi6l6T9n/D8NxR6znsLxLWPoP95+CAEBIfYV1vwLfVZ/FfSj3o9yZpM3q9vv3tcnwLvB FEZtmELYhJFMuvZs/pTkN+Bp40gguL/ozebt1hjtlO5xBSoyvJQ/1mXJz7K0lUsmgq21 YcLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=QoiLKMEOX41tFLy0qcfFWPV2O7S+2JSUpMk1QMM25jk=; b=h5A1FPVsat+NvWe+hlSaDvK4Sytgw3ViC2MGfZKc9iEC+RRAZ41Xx+nH8DOQJ1qJCl pCEW7+SYqjSp7o5MPQrszJhIVKTPVdCvq6SfChxNmDYAwn8HJ8J9fzySdrYo7fXf+aTS NHJ1hw99YwJ6RDLFQu9X4It6Pz+DOukebUh70p0cIucvyRtrCwO4SDVGDDp/IslQiDmL U47ehCBAwu2LRhzkKRHzWbTQQLB3j/j4U/g5cksESlDI8n+9PwJFVEGA/UQBjT1iBs9L SgQlAOA2mEES1dVrvT2g7mjgbJ1Fde7/OwsCEdjUO/NSM+NJSDiuWPoGMzEpL3q4UIIs BLdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V76Eq+YE; 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=pass (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 f7-20020a056214076700b0061ada7f42dfsi626391qvz.182.2023.05.19.22.47.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 May 2023 22:47:27 -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=pass header.i=@linaro.org header.s=google header.b=V76Eq+YE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mat?= =?utf-8?q?hieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- 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[] = { [IBEX_DEV_FLASH_VIRTUAL] = { 0x80000000, 0x80000 }, }; -static void opentitan_board_init(MachineState *machine) +static void opentitan_machine_init(MachineState *machine) { MachineClass *mc = MACHINE_GET_CLASS(machine); const MemMapEntry *memmap = ibex_memmap; @@ -108,17 +108,17 @@ static void opentitan_board_init(MachineState *machine) } } -static void opentitan_machine_init(MachineClass *mc) +static void opentitan_machine_class_init(MachineClass *mc) { mc->desc = "RISC-V Board compatible with OpenTitan"; - mc->init = opentitan_board_init; + mc->init = opentitan_machine_init; mc->max_cpus = 1; mc->default_cpu_type = TYPE_RISCV_CPU_IBEX; mc->default_ram_id = "riscv.lowrisc.ibex.ram"; mc->default_ram_size = ibex_memmap[IBEX_DEV_RAM].size; } -DEFINE_MACHINE("opentitan", opentitan_machine_init) +DEFINE_MACHINE("opentitan", opentitan_machine_class_init) static void lowrisc_ibex_soc_init(Object *obj) { From patchwork Sat May 20 05:45:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 684292 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp232327wrt; Fri, 19 May 2023 22:46:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7yDirXYZ1ad+Vo5TXOxdP6PR5E48BCSOM/hV4Y6ytarKwIe9beueIQo0dsj+R49RR++MQE X-Received: by 2002:ac8:5acd:0:b0:3f5:c257:9f09 with SMTP id d13-20020ac85acd000000b003f5c2579f09mr7761448qtd.14.1684561610119; Fri, 19 May 2023 22:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684561610; cv=none; d=google.com; s=arc-20160816; b=aPTnrb/5HDsuQW6gC9vRkjmDhuM5bKNnRCqsOFn6ziz8ZBm3TdMbhzNR/H7CK+C1oZ oagQFuJ/d3/hhIUei3UPzI+1Q6CkPRQ4FjpXX6MKTw2yM4o3d2/cQBjdc0lHjU01AkK4 eX25gaoIbAwMmwgEYIsM2PIVsN79+DybwxvrLw/yiDcsIH6b4PF7U8QjVP477rtaQatR HgIEAAAAhwHjJs35rfU+MiHmhECYSQHHOJbt+Sn4fE9DqQlNp2Oa6IhPxfnnc6IYxhzB RSV/loMw+8kTyiP3N++nbqzS/seMTccONN2Kn0E/1nBTWu9MxVRoPSKTMSTaYBvUEz06 hnKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=hTAW6cK3XhyHe2DSiXzz9dWc3zDAXzPHwYcm030hYyk=; b=pQLgj2lF+rHJ+5x7uyU5esS29Pjgg8cXfd3tl1J3zeQigO9fGGT7MgeB4lWOj2iXUP /tWhrvkQW6upzftfyVFTgicS9xrpEDAq+7pJp4URJFgwEVQh0Nc5laZIlHRzb3Z+hNC2 qPV2Pqvplzto+bypWFQDAesp3xgu0aLYWHZE5qNjdpZC0DIvebXb7PgLLYwMOyxZoVc8 brj/NSa6Ch8UqAOQNXfRaEV5DXOHWf4ZxRktkNTbLomtGgxbGLJkEAmUJ1C6Vc3jne1g Q+L2N8q5J4F9dqOFL3EYZ16RG9W6270L0w5AHOrUFLj/UcifGSCoayLV/1EF0OmLdU01 sh4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pW+WiwCo; 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=pass (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 i3-20020a37c203000000b007596781c021si405452qkm.647.2023.05.19.22.46.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 May 2023 22:46:50 -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=pass header.i=@linaro.org header.s=google header.b=pW+WiwCo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mat?= =?utf-8?q?hieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- 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 = false; } -static const TypeInfo lowrisc_ibex_soc_type_info = { - .name = TYPE_RISCV_IBEX_SOC, - .parent = TYPE_DEVICE, - .instance_size = sizeof(LowRISCIbexSoCState), - .instance_init = lowrisc_ibex_soc_init, - .class_init = lowrisc_ibex_soc_class_init, +static const TypeInfo open_titan_types[] = { + { + .name = TYPE_RISCV_IBEX_SOC, + .parent = TYPE_DEVICE, + .instance_size = sizeof(LowRISCIbexSoCState), + .instance_init = lowrisc_ibex_soc_init, + .class_init = lowrisc_ibex_soc_class_init, + } }; -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) From patchwork Sat May 20 05:45:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 684290 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp232266wrt; Fri, 19 May 2023 22:46:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mzgnjkjVuupa8DXfjcsEM32B/lC5F7JOTj9i4RPK8uRIcQsr5WO/qEzyrpDyOilRONoZQ X-Received: by 2002:a05:622a:1cd:b0:3f5:3b0d:b41e with SMTP id t13-20020a05622a01cd00b003f53b0db41emr7641633qtw.16.1684561592786; Fri, 19 May 2023 22:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684561592; cv=none; d=google.com; s=arc-20160816; b=dzljWN2ms6JWrtF+S9orkygRvIvHdWRlbTfJw8JVAncPnqjYUoJQq6RLUuHECRVor6 cvtacXY28FHegLAqNzJCPgwS8yTKs4l+JQJw5l3awZ8mkesCTgAvlPD/XoWOpWeKKkzE UFZ1Jvcuc/k2T7mcEDJMOMCYlWdoyq1LJJD52GqKGIvXa84fMGNNrXXvsJvoPiXAtSmC uhjt3hRWam+qqHbhnfirX2oCuD2dunoSwJpOGTq8L2IVMPEyXNjRxQgDdElOWVWksxoq qtt3tibbACYpuQdlUevIbvNtTeXo0MRSZUPPpio2/tIsn50vERF4kAnlMtbY2IRGOFw0 GKLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=x9CmwAgDvj3Ddgy+Sh+yZXxS5mPQZ+cjq5z84zBdlHE=; b=r2DePGrqH8DkjUadiwbTShk56+NZ32bwSojUXPxG+jF+HtCdqS8tk88QsCat8opcu8 WXJmvnyCh/BndtMkRPoqyMFZI/h7Qdyx8PkT+eqq0PnvGnl7MLdnHR6HPOsJwG9HbBBZ zSED6YZNOZl/yYXztukdNhcar/hFpUsYLusbsYxLv3siT3W9iPXQtolz+2LYPwUMjWDm zG2B/PwBudXWmb8yeM7OrZ07qqZEXDNY8Y5db3CGurZOHLVBXDlqgPMaTGeVY40ve7N4 6bZ9ylGtKdgqH+0+BU2ygvj1TDj7Xl5Sc/qnP8v1subdCcp0yHFGgKVrFmpQxBZ36Umw CHhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Hw6L/nZY"; 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=pass (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 x25-20020a05620a14b900b007590571f3c5si420164qkj.663.2023.05.19.22.46.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 May 2023 22:46:32 -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=pass header.i=@linaro.org header.s=google header.b="Hw6L/nZY"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mat?= =?utf-8?q?hieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org QOM type names are usually defined as TYPE_FOO. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- 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; }; +#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 = ibex_memmap[IBEX_DEV_RAM].size; } -DEFINE_MACHINE("opentitan", opentitan_machine_class_init) +DEFINE_MACHINE(TYPE_OPENTITAN_MACHINE, opentitan_machine_class_init) static void lowrisc_ibex_soc_init(Object *obj) { From patchwork Sat May 20 05:45:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 684294 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp232391wrt; Fri, 19 May 2023 22:47:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5rHh3LB7dZpMH/H3sxp0hJySYZO56PPeyogcAIJWrdIGBSnV70cljQvegoXyUjl9ZAiIwx X-Received: by 2002:a05:6214:21aa:b0:623:8519:87af with SMTP id t10-20020a05621421aa00b00623851987afmr7126282qvc.15.1684561631614; Fri, 19 May 2023 22:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684561631; cv=none; d=google.com; s=arc-20160816; b=I+wVVlpz9lpMqDdzu7pfu1qus8yy7vA3JiSX7VBhJ8f/7iIXew3Yy7edahJXVU0Klk 6YpWuQqORUA2+7NoSiUonATGICtCQgXSjfDCEHl9M0cEvuQsxmGUd+PvgUIW3kbcsYCd f1Zlq6u9msibVrDhQ9RvwNIn7+FCRMe02VSRO3BIyZCDqOnRVXJDLSF7DepJJNTyUmS3 uInrxMWyk6Gi2EZjAYVUZ5xy656QdvLC6t92TGTulW6odNzv3A2tuUX5uCA9viAiOq3N w58/wgk/GDgTqCyYHd8rlKLuIInWNRx3Cp7VzYgPDZohPy7XIg0xQ3PddkdT5aaHDIhc NaZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=9RyvUr1lBMxRBlxutUWdrrmWw/Nx1e27AsLVC25y0F4=; b=vtihFzsioH7Ed3yNmLvig8GeEQZ44EWgW82IUo8THsZFOrRt63iAqRckEvX5dZeA3F 4P/LXprA+nVWJ+rvdMwyoyoiip62oG1JCaWI2dzxBXRgD3tHDcCPvDUl7uGhZbU2vJHV kOA/d9Gf7OXvyyRAVLD9ohfpDBnIfInK5jCqYPb4TN7FU08JX1FtaHlT+Zo2ltmrDklt Vyk/6K4nm3cgPG+JLXfh/L8KF5DXMS/FtUJ/plGdQaHNiuS6s0nabRxFSiq99JiLHn7+ Y/UJax/hAh04q5UQhFLuTWeIODVSzOTnGl0fVYWqDHEA8v7bzXwK+ZqC9PFD9vXrnlp9 BhXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PKELuvhi; 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=pass (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 jv8-20020a05621429e800b00619adf1d381si558086qvb.569.2023.05.19.22.47.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 May 2023 22:47:11 -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=pass header.i=@linaro.org header.s=google header.b=PKELuvhi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mat?= =?utf-8?q?hieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Expand the DEFINE_MACHINE() macro, converting the class_init() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- 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" #define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc" @@ -53,7 +54,7 @@ struct LowRISCIbexSoCState { MemoryRegion flash_alias; }; -#define TYPE_OPENTITAN_MACHINE "opentitan" +#define TYPE_OPENTITAN_MACHINE MACHINE_TYPE_NAME("opentitan") 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 *machine) } } -static void opentitan_machine_class_init(MachineClass *mc) +static void opentitan_machine_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "RISC-V Board compatible with OpenTitan"; mc->init = opentitan_machine_init; mc->max_cpus = 1; @@ -118,8 +120,6 @@ static void opentitan_machine_class_init(MachineClass *mc) mc->default_ram_size = ibex_memmap[IBEX_DEV_RAM].size; } -DEFINE_MACHINE(TYPE_OPENTITAN_MACHINE, opentitan_machine_class_init) - static void lowrisc_ibex_soc_init(Object *obj) { LowRISCIbexSoCState *s = RISCV_IBEX_SOC(obj); @@ -327,6 +327,10 @@ static const TypeInfo open_titan_types[] = { .instance_size = sizeof(LowRISCIbexSoCState), .instance_init = lowrisc_ibex_soc_init, .class_init = lowrisc_ibex_soc_class_init, + }, { + .name = TYPE_OPENTITAN_MACHINE, + .parent = TYPE_MACHINE, + .class_init = opentitan_machine_class_init, } }; From patchwork Sat May 20 05:45:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 684291 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp232315wrt; Fri, 19 May 2023 22:46:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7p17bshsuT5+wg/v/LvOkuATER/gSHGBoLnlwolGLWl3niSyBMPMaGX3nxpZvZME+gs65J X-Received: by 2002:a05:6214:2308:b0:5cc:277c:b5e with SMTP id gc8-20020a056214230800b005cc277c0b5emr9295649qvb.33.1684561603947; Fri, 19 May 2023 22:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684561603; cv=none; d=google.com; s=arc-20160816; b=HU7MSE1H/MiMz2g5lABvaFvHgQzjv5Kau8TVaMG5Rmq6aet+OjLffE5YX9ME0ERLus 5+LDheCXbF5JS57No7O8i2kXlZ9GwVRI9sO5dV4hdTU3LZYZkpVRhFp8D+H3Sk/mWWm5 ItPqRP97pbBIvMxE4W9LZf9ALI+AXkIkh7RnTDJI9HPbLk6Ayl5tMcp7CA5ZYC0dSd/f nn03LbH1VxbkakWiokauWhQgacnGylm/03cjC9/w1s3G6rjeLg1HDyXgUvzdozfm90tx RosuSjnhPeiJR3yUq/HLqSj0/l87TjlxWhoDvEcaS8nODnMWgCQBvGJnEqZ4pBA4F98n 0cbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=kXcukaWbFF62HN09sQV7LoFKa7B0fHLkBZtjDa1RbSE=; b=FC+dTViejZNG+Jp9U3toXFSb6kMJU4mPua1VYme8d+dMigc/hrHqurwUJ3qRYrYDpI 8TumIwZJtQJkr9YzSNsBaKdWzX2GdTwuq83zqxuHEXLrLgKDoInsbDOLFyl/UXY70mRE ZUvlTngdaCjJGtNxoFZkDM8Snnu/O8u36V7lqpry7SDdP5dMO8H3nv/VPjQyicokhNEe FCaU6zzHNvSBP3fBd2pYA+4jRvJTykJa9/L1h1yusRVn2ZU3hRYiqcmZvrJoSP+NL0kJ vthXYU57HvXPDCYgaCLB5TLC77IYPar0rbgiyrGLHv/f/I6IMDpvP4czNuju3Rc/VGmx W2pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m9jcuZXB; 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=pass (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 v17-20020a05622a131100b003ef3204c65csi667966qtk.804.2023.05.19.22.46.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 May 2023 22:46:43 -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=pass header.i=@linaro.org header.s=google header.b=m9jcuZXB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mat?= =?utf-8?q?hieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- 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 { }; #define TYPE_OPENTITAN_MACHINE MACHINE_TYPE_NAME("opentitan") +OBJECT_DECLARE_SIMPLE_TYPE(OpenTitanState, OPENTITAN_MACHINE) typedef struct OpenTitanState { /*< private >*/ - SysBusDevice parent_obj; + MachineState parent_obj; /*< 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[] = { static void opentitan_machine_init(MachineState *machine) { MachineClass *mc = MACHINE_GET_CLASS(machine); + OpenTitanState *s = OPENTITAN_MACHINE(machine); const MemMapEntry *memmap = ibex_memmap; - OpenTitanState *s = g_new0(OpenTitanState, 1); MemoryRegion *sys_mem = get_system_memory(); if (machine->ram_size != mc->default_ram_size) { @@ -330,6 +330,7 @@ static const TypeInfo open_titan_types[] = { }, { .name = TYPE_OPENTITAN_MACHINE, .parent = TYPE_MACHINE, + .instance_size = sizeof(OpenTitanState), .class_init = opentitan_machine_class_init, } };