From patchwork Wed Jun 14 01:19:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 692564 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp701917wru; Tue, 13 Jun 2023 18:22:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7kPwYRyNerSspuRKYVRP81vGcK6hkuFAOSDfZWBotEs4VdUoZFrs6kfIKGrDgYkJq3vuRh X-Received: by 2002:a05:6214:e83:b0:62d:fc19:b1c3 with SMTP id hf3-20020a0562140e8300b0062dfc19b1c3mr3089918qvb.50.1686705750374; Tue, 13 Jun 2023 18:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686705750; cv=none; d=google.com; s=arc-20160816; b=zFpV4SFnBzIKoJebWzmZFgAwK5Hwtqy7G1ZUUIojIf8nNeyUqwTHFJqsnNz5UQF4qh kkiVGrJoOIuNZR4C2w0JI2R/mEr6AbpIxmYe9b/mV+WUm2R0Sy+v+VIhcV8edXod/poO 2SJaJ8H4+T4FzSmnBZXh+T9T8muIbvO1EqtW71gsKeBAd1aq+uLSnuT14Xg6fYUWR7gu 9YjWC2MNA3qNcQkzaIfVunsrLQWKo8S5ugwnINVfbZxH/WFKrZ1LxQ+Z11wD25sC5cM8 3XlRnAr0nQYDWy4hdGqUtVpcKhV7lefouvJ3DKsQymoRgMNvC9qV9MrIecQL6q1z+jXY cwaA== 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=cLwr+LJIpNpThygdPeDchVbcP/+PrMQXZxiXlfAtnPU=; b=pM3g71xzAGI0WvYbVpjaio7M1o4/NsNxMWoxzqyLerVkpDiY7Z0+AO7vX9FrNhDqff N67I7hOqLJm6MyzqZ9GGr8/uxtf0Q/RrIVq//nOl0VJtNxniQZv+895M7T+/eWrNEIdc x84KjYwKJumHkVdj2IFyUIHdxruqBjfEYact9TCzM5Z3lANJA+H9MI1plykV1bRnoO8F PmgYrVLh0OqAJXk7TBIm2F0Cm7Ey7PmtBRclcG+RGN/bADSPmKwgasvUt3NUovcdUCJt 1YpEzgADo3tWNDw8w8CfqijxxL5Qmy3c4MtaVoXYkTgzpEEKR8iYP3vmdYg122W+qjX4 iLsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=LJwFNwIa; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 5-20020a0562140cc500b00626009daf30si8649115qvx.537.2023.06.13.18.22.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Jun 2023 18:22:30 -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=@gmail.com header.s=20221208 header.b=LJwFNwIa; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9FDJ-00081A-UA; Tue, 13 Jun 2023 21:22:21 -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 1q9FDI-0007vG-U3 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:20 -0400 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9FDH-0004kF-5U for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:20 -0400 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-75d4dd6f012so152621085a.2 for ; Tue, 13 Jun 2023 18:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686705738; x=1689297738; 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=cLwr+LJIpNpThygdPeDchVbcP/+PrMQXZxiXlfAtnPU=; b=LJwFNwIaGha7Wz/Ovjg0nmjIc2jtDAZmrblC0hWKGFUHGMjkmCH1F8+z/MVbjrh2LD /AQbUjwd+Be+VvSqJLWWPmo58PfUWeRsb0XN+pTtomxiSUR0B5H4EqaM7r1xmrYU9eXC 2cJap0xsAqXgDxk+WRSyOGKuBnRXjzHu/9gS1vquFTM4Nkbi5S9gSLIALUtCXIRoaF4C uAqK9rf6iRPZpeEyvvNyufpWPR7QBzQaZdjjHrPicctkzT3Noakr9OZiCeuEnHXY56ev H4n0V5uduLDNruId8BNOgBDIKMTW2Uwizva1HNmjN/6pPPIT0lPb4IfA3CuWl20SIJbG ZNMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686705738; x=1689297738; 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=cLwr+LJIpNpThygdPeDchVbcP/+PrMQXZxiXlfAtnPU=; b=bHkjGXQe2Cu5CCjX5Hm1QowM3EOiRjyBV38Ci1PypBoNkX+bvCwvs1LKtfHz11Tgbq ekala1ws1f8YBy6IfcnwimAxPRSP4RH2bLI4CznsmD6RwkOYtMxwP7GwWNfWEdJf++lp JajfX06btxb1BJ6YESfe9+MPExGIH8WkRKm5tSbFJVbohAgGqxnMhDdHG4mSm22cSIcV fE1xXMi0gEBRj+0Wq7XNXh1sroyMXwCyjwy7N8/ilE3gj23VVF9zcLIIESPHUEL96OD/ TPEj6lhj3GKIwXCiawy4qjAM4M0+xLDESoJs3jV+cTdqrfF/zmIAjjwNyHEFEioiapL2 blwA== X-Gm-Message-State: AC+VfDxtnf2pTGGoEJ0NvNXVH/xwu4PJtjHYICFNQ7zEAY82WpcNF+Fh d4Tu4lotP59AHZCRqy1PC/SmSlrx6xEJCg== X-Received: by 2002:a05:620a:63c9:b0:75e:c32a:5758 with SMTP id pw9-20020a05620a63c900b0075ec32a5758mr14569076qkn.51.1686705737839; Tue, 13 Jun 2023 18:22:17 -0700 (PDT) Received: from toolbox.wdc.com (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id u1-20020aa78381000000b0064f7c56d8b7sm9112238pfm.219.2023.06.13.18.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 18:22:17 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 26/60] hw/riscv/opentitan: Rename machine_[class]_init() functions Date: Wed, 14 Jun 2023 11:19:43 +1000 Message-Id: <20230614012017.3100663-27-alistair.francis@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230614012017.3100663-1-alistair.francis@wdc.com> References: <20230614012017.3100663-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=alistair23@gmail.com; helo=mail-qk1-x736.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 From: Philippe Mathieu-Daudé 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: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-Id: <20230520054510.68822-2-philmd@linaro.org> Signed-off-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 Wed Jun 14 01:19:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 692568 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp704251wru; Tue, 13 Jun 2023 18:31:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ORqviLFFZRgYQAVhDds9NNrYs7JUG7cnRyVIyi/kF1jPaWvBmskNuMjBa8PFxukenyvxf X-Received: by 2002:ad4:5ca9:0:b0:626:29d4:9a26 with SMTP id q9-20020ad45ca9000000b0062629d49a26mr17720160qvh.37.1686706300037; Tue, 13 Jun 2023 18:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686706299; cv=none; d=google.com; s=arc-20160816; b=mlybISt3h/UzYQYa9c3cvft3Y5S0B4RW/nm3+47L+LhWzQekugMVpJI1IVKUMvFOET Exd7acy/iw1p6uNKS3Qc6bxz0nNBYjhTnhGtel1UeVvG/qzEiYxWXkWuudXa+N2osaYM SWomy8HowdETfyvmyfR2jPTB47RwvywF0+3GTqJLrDecslQyG9JJqIN3BcrKUyBKSPlD gJg/7TZE+AEYtlySljRKgUQoW4/q7+kOL3r4OuIRrudwXIweKAj6n6JeW6NU7X1fSDXM MRvBAS9bi1CfIHclC/vjNctaee9v3AN2msqCfPf0LzHX8YPJX1OVgmW+BMojSGqF7y4Q 9Whw== 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=4v3yawg0uOjmzzDcZNfQbha9k+Ps1ceIjWHX0t+xz98=; b=U3uTTXIQAghE9lB5bMby11d6bkhyDBcbUuDypxDahdgLl6ZJF1nqPvyC2jdV+c1EpS wmPrp7SOnhYSFn0Fw8Y5ojr/pIP0BNomWLjp3Dmzw3BoJF1JDAcM/tQnINY9Lgc30KKH /bJq+ACVKalWHxZEFg1Te4gNyXdqVtFUfwZBLa2R8hXj4QF1B/fqoMLn+72oTuHf80kU UEYBLMWLWHsukMFkgeTw2tykad4FIvuygKNcbh20u31S8VuzB1yr5BHoTlcUxFRSWDQG r8Us6N7xJ+KTb3H39CHQiwSSoBKogA8mJIPazfl62/ogvmUTuTyx0bcBWnurrMLpXxHD 23+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=a3ImHG+J; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q19-20020a05622a04d300b003f5619a8922si8274052qtx.519.2023.06.13.18.31.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Jun 2023 18:31:39 -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=@gmail.com header.s=20221208 header.b=a3ImHG+J; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9FDO-0000AS-Aw; Tue, 13 Jun 2023 21:22:26 -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 1q9FDM-0008Lt-Gw for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:24 -0400 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9FDK-0004kX-Mm for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:24 -0400 Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-75d4dd6f012so152624785a.2 for ; Tue, 13 Jun 2023 18:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686705741; x=1689297741; 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=4v3yawg0uOjmzzDcZNfQbha9k+Ps1ceIjWHX0t+xz98=; b=a3ImHG+JWK2MUgp7u5wSkq8l2rPaEG8K9GzBFo5ZC5NXe8qgK5fkLBiyTvI2B+0R1m 3TB89aVn9mfFqJH1G/7fop7S1+KT5oNFoDVmmsBz6MBpRdnKAFbilKepsF6FmAXxOBOU aM/wRnKKzTOIXmJ+MvXU2CpnNNICfYCzjJp96/4NlVObrE8mMVQDJOWwwTkO4EP9zFMg vRa+CChLKO98ckhJPDg4aHU6/a4iurnH0U3FsIriyWZGaEKZlDTnJjaFutxCfjvcx8fF nx1vo2E0ZmjPS1gNVC5Zg3JCELQnh7sWTp+QmRr9D3BJJXrVIHzq4X4GzlZV/tCZ8ixd 9Drg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686705741; x=1689297741; 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=4v3yawg0uOjmzzDcZNfQbha9k+Ps1ceIjWHX0t+xz98=; b=dKj9B7TeAWGNw9pL9a1MjICaPaMjtLk65KKcR3yFYbmz9p7kYjIC6Ow42ooDcGt+3L WnTfl3Iygxeor9zmZFCWTH681QxoRz7gz5ZdwVYniG0J8/J0pFdcg5lBTV3oZu5rytxa /xMpylG6O3McyuHy+MzZ7sktLl81VP++cbDaHWQbgPnOON0v138EegeulN8bAWnhCL3D jQr9s0Rw+UxDOiGgAls9pe6V+BYcmwDT4wSa/n0J/SVhbkvkIbKESGFvRngHmALp2N8z bcSS1VjHYrdtsLJLoCTzZTIyET0iuBGOUKidAEd3gaGT80bh2arGBp8E1o+T5QKdkBg5 VP3g== X-Gm-Message-State: AC+VfDzS6MnAKv3g8PgSlvBwnSLnNT32S/tebUwbqQaQrsmr1SvNj5j+ f8eQc60aqMsuttj2Iyf/mwtoacDmXA24Pw== X-Received: by 2002:a05:620a:278d:b0:75e:c496:dea1 with SMTP id g13-20020a05620a278d00b0075ec496dea1mr15313312qkp.78.1686705741554; Tue, 13 Jun 2023 18:22:21 -0700 (PDT) Received: from toolbox.wdc.com (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id u1-20020aa78381000000b0064f7c56d8b7sm9112238pfm.219.2023.06.13.18.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 18:22:21 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 27/60] hw/riscv/opentitan: Declare QOM types using DEFINE_TYPES() macro Date: Wed, 14 Jun 2023 11:19:44 +1000 Message-Id: <20230614012017.3100663-28-alistair.francis@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230614012017.3100663-1-alistair.francis@wdc.com> References: <20230614012017.3100663-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72a; envelope-from=alistair23@gmail.com; helo=mail-qk1-x72a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 From: Philippe Mathieu-Daudé 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: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-Id: <20230520054510.68822-3-philmd@linaro.org> Signed-off-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 Wed Jun 14 01:19:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 692566 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp702722wru; Tue, 13 Jun 2023 18:25:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5f+TeW8vUupUMruchlQUU0SIYdR1Sw+lRnbv/TbhwrS/FvTIAbruU6rLnXcSUwSlJmQlae X-Received: by 2002:ac8:58c3:0:b0:3f9:c9d7:389a with SMTP id u3-20020ac858c3000000b003f9c9d7389amr559475qta.57.1686705948522; Tue, 13 Jun 2023 18:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686705948; cv=none; d=google.com; s=arc-20160816; b=aM1bYLZY3f/EocVSXiIVzx7JE52Q3fMIB9X3RR1rBZpfMomESVPRMycQ4M67cohMu2 gOX3JXdP4R0omSvnrPWL+0Adw3x6+IO3NkeJdWPaWNjSQwbwxn6EK+txeuJSmhJ00VJU eMMs9AzSUUYPLyaGk99wLdbxm21vKGvGbTqY0iVioSz7cUoQ2MF+d/TsqpOJhaBkSMVn ndFcY9h7qgOm/VZZkrl9vw6a/CcoySF9KohyO0iJpFZyA4AYXpCZ9uxWLFaKxRZYKw3H 3KCPt4YgJFw3JI4qXAMoM1tQ0usJqojVd4zMGDSNCQE6w67cz5gCITWTq5fyIF1aL6x0 mgSg== 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=6I95LaG/FtIFLD5F+dP8UUbDdhOhOSJBukNQ5EzT+SA=; b=KJ5yM8Mj2F/jvsaHjmj4Nc9opgJLIacKFL4uwMMsxt6+Nd4t5eBzoOBggZNT6KqunO 87+ByIFeRxmmqJgSQexjaravPQEZ/IGDyL5BKI9bz6avHsBx0/JR8HHJKGEPDNe7xdA3 XFHq5m8R0GKBryK5h2vvL9ZsU4oBGxDXL7WpUApcvD32XCh9Qfo3WDNIbK3m6+QhMRn0 uivhb4Cie0DH8aOVuWcyawggTlXPfQZANzct09Kii2MKqtjgrLpcaGTDcb49NPErQP/O Ski+9zLL2xOUxrBUNf9MF3OIroRrayEK5fYsdqAeZjTOO9wfCkhPbTYUNgTfCvRKMQMn poIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=TMVENRoN; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v11-20020a05622a014b00b003f9b2143e46si8477466qtw.41.2023.06.13.18.25.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Jun 2023 18:25:48 -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=@gmail.com header.s=20221208 header.b=TMVENRoN; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9FDS-0000RH-F8; Tue, 13 Jun 2023 21:22:30 -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 1q9FDQ-0000Li-Ce for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:28 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9FDO-0004l6-Pu for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:28 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6664a9f0b10so91310b3a.0 for ; Tue, 13 Jun 2023 18:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686705745; x=1689297745; 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=6I95LaG/FtIFLD5F+dP8UUbDdhOhOSJBukNQ5EzT+SA=; b=TMVENRoNJ9anUq780SqzGF4zBUaDbxUZhS3/6i9Tp6kGkNsPXuzvELAEs6bfj2kTRx XG4P9RRthQGrQXzl7tUY139PtDdR6RTe1ABrwsKJpgOjXljL2KYt8Ie4h6t8sK5j9Bt3 rV30nFiOgLxWc5/CTiRNGha+APALVdwI+9FFTAsryoju982KWWJkQbANIA87jzTmKmOM q9iwzXdNgaSdyLcO2772q3IfOEZj1d8pmVW5a/w6fqqCx0wtNNVZqtEW04M9/8bw06L6 1tYar5mM/8IE8ykqdaztx7mqS5WxLyeEdhapxFZyFS8dkShKNGF+mFeJk9b4xgvPNyNi YRbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686705745; x=1689297745; 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=6I95LaG/FtIFLD5F+dP8UUbDdhOhOSJBukNQ5EzT+SA=; b=de2Nqp/2sJQUOitPt4hb3TUecZ0/31P1jwCU1DKa3RXQK4Py40DY+X5uBt0FzOI3r+ CqFTlPQcq3l41/fI1zJaATinR1EZLljur+pG7bMaRJkU9Pv45OMt1EE2wezbKZFJ5pJ1 0N9yNgUUgAdPG8O5cM5jBvuDflN4pEws5MvzCjWciuu64wQiJ0Joep4SUQwPyRbY0m2r bTPOQDOKUdZ3/SvVMxWF3J+V6rlb1SaZ19075CdOFj/DIFxxTTOdzKClB2C0+d8TvJGJ 687LXaKpE/JUkfqy5sO28+rXX6FT8DltQ81DBFL9Qvvw9HVPE88qgL0iy/HZqAjH31tr 8uvw== X-Gm-Message-State: AC+VfDybo5qIOFaSZqNd38MZWk1ZtrOKr1omTSw8TuxhiVtGavlLc03T NStAQiUqnVkalolZa44otqQIBhD467jTag== X-Received: by 2002:a05:6a00:2382:b0:64c:9b56:6215 with SMTP id f2-20020a056a00238200b0064c9b566215mr508374pfc.25.1686705745288; Tue, 13 Jun 2023 18:22:25 -0700 (PDT) Received: from toolbox.wdc.com (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id u1-20020aa78381000000b0064f7c56d8b7sm9112238pfm.219.2023.06.13.18.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 18:22:24 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 28/60] hw/riscv/opentitan: Add TYPE_OPENTITAN_MACHINE definition Date: Wed, 14 Jun 2023 11:19:45 +1000 Message-Id: <20230614012017.3100663-29-alistair.francis@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230614012017.3100663-1-alistair.francis@wdc.com> References: <20230614012017.3100663-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 From: Philippe Mathieu-Daudé QOM type names are usually defined as TYPE_FOO. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-Id: <20230520054510.68822-4-philmd@linaro.org> Signed-off-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 Wed Jun 14 01:19:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 692567 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp704116wru; Tue, 13 Jun 2023 18:31:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ys4epTOG0GzZhDW+gUCl+2T9t9mGYUBWiuARYlWO/H0//FL5Mb+pUPx8aeZo6G2uuebfe X-Received: by 2002:a05:6214:5009:b0:62d:e4b9:8479 with SMTP id jo9-20020a056214500900b0062de4b98479mr10691457qvb.26.1686706275022; Tue, 13 Jun 2023 18:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686706275; cv=none; d=google.com; s=arc-20160816; b=YZOPJF6//94Wkf8jEY+x8W1dRUUiZ1JLU8w9SE5Gq+Cq4x3PO8HmfwR4MSUEkKN6HI wTC5C3k5bCftIXED5ccfa94RS4XXpnEWygBoS8b18fstkInDuFOflT03feV07GVHsnA8 0En6ArFAW58dnOFczZiK2aNPvf0VdBqOEoATdBhLzRbfcaEzMiEN2Wgj9wegG+uLfLun hcmkxXF/0Gw3ix5Z6RE5+B1ZAZh/aYM1KLs1dgJrZJTw5LLIj44PT6o3QWhqm2FeLhD1 DMk9MJBcY3ODRQBnFhNMF+YVWXHnE1GE7v3pSrLvQDLd+oVUNB5SCch1NvHqxe1ObfMt bn1g== 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=EfQyD+rPmcrJBu3nsXartEhZoHzh8XKUvycvXdnVSVw=; b=R9rmAIWsYq1Q+zEhGXoAHCB1ScrNe/8OWtQq2lCOktpDTaaCaMmJMvFmbgTunC4rim NcMKZKWK5vsfagZhlWLQjGR0SQqO+Mw1J11tkor7Xhh8JXCBZ4Kq1toqThZ/KkRrI9RL a2uXWRu877x3fB2u8s/Lgif90T4d5nzg/yQSjjewjJTQE3Th6RxdF6tDnCpuNLGROdq2 U+R10d5X/vA8/dzrxzmwwf3MQiRDu4aNA+dVN6pf/a7UtUhJJHC0pKs87Njzl+kBheWM FS1CN+cOgAI8O3Vgv/QCLbSQ623ioc/GrwFUGv9Ka9K1cUbVtrDT2lvt0lOOebohIHsf 3LdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=O55YgoRl; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p14-20020ad45f4e000000b0062b767181e0si3397923qvg.310.2023.06.13.18.31.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Jun 2023 18:31:15 -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=@gmail.com header.s=20221208 header.b=O55YgoRl; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9FDV-0000WY-5n; Tue, 13 Jun 2023 21:22:33 -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 1q9FDU-0000W7-Ft for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:32 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9FDS-0004lR-Qo for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:32 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-66619138c1eso451554b3a.3 for ; Tue, 13 Jun 2023 18:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686705749; x=1689297749; 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=EfQyD+rPmcrJBu3nsXartEhZoHzh8XKUvycvXdnVSVw=; b=O55YgoRl18RvKIOg+qd6Md00n3lW6+RqQSzYVYdEChmyY/OGvjB+6g8U/kI3fTOn1F uiHHv7jgDWM0zXxMKrZtcXBzAqXMJxGXGAQhvtseNqOEWXv4InpCvB7AjyfNsvHWlSsJ 3fNWd3BzBsbuwQCTTK6mMZi6dlJj3s5ZPqHeRspdtLV+a3NR33bTjfag1fFqxqhQ7Rnb er3vJRLUmkRRP66N4aUVxzVZXBVfrehN/SS9NEVJJUNpkABGG5K9v1WncePJm0VtXtWj EZXGKECJ+WH+J8tQxHWHuoeHiQW181GclyFmlTJ6iRNWKu83mnu53iwldBp4scze36M8 VWYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686705749; x=1689297749; 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=EfQyD+rPmcrJBu3nsXartEhZoHzh8XKUvycvXdnVSVw=; b=Th4vSBGmEUFqQ8xRXRjmuC8251QNelvixd9A38q8RBtzVNp/0x8aYgMiEjaxGMWfgz EMb6xKYlcKjyUakPrb2Vy/RHnLfycTJyJR0767DLc9bGMYXPz8oln1OC7wHLfgSJJCFY zZCiCleg3nACos75Tdkpq5eu/XNQMQGnPijolHaRLuE46/JXxvfCtBhbIRiBTGnOdJ3R /o6qs5sCIo0AeeWNXD6psOSqIleDJgPJ12bgyfriAfqS31WteqKukkjIUu/dFOPTOYeS t8flMi08h2zzpz+5bNnNF2AWHdTD5o5Gf4JDRJaLZl0KCXg1Lw2GCinBMi6/6y5vORBH cV3Q== X-Gm-Message-State: AC+VfDx6RvfFu98+BN+4JiWEeNPs4UOyX8ZjhvPny5KtIw+7Bphu2ldc Et17BT69lwVCX15SW7lLCyZFizCRkY+GmA== X-Received: by 2002:a05:6a20:2587:b0:106:5dff:5dc6 with SMTP id k7-20020a056a20258700b001065dff5dc6mr552266pzd.16.1686705749369; Tue, 13 Jun 2023 18:22:29 -0700 (PDT) Received: from toolbox.wdc.com (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id u1-20020aa78381000000b0064f7c56d8b7sm9112238pfm.219.2023.06.13.18.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 18:22:28 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 29/60] hw/riscv/opentitan: Explicit machine type definition Date: Wed, 14 Jun 2023 11:19:46 +1000 Message-Id: <20230614012017.3100663-30-alistair.francis@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230614012017.3100663-1-alistair.francis@wdc.com> References: <20230614012017.3100663-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=alistair23@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 From: Philippe Mathieu-Daudé Expand the DEFINE_MACHINE() macro, converting the class_init() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-Id: <20230520054510.68822-5-philmd@linaro.org> Signed-off-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 Wed Jun 14 01:19:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 692565 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp702671wru; Tue, 13 Jun 2023 18:25:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4M2nM1652ANiChDVFO8BdCaAi4vqW3K0gO9MlcqZ+BGC45ekwxD+Bk9xVFQTuppilzcWL0 X-Received: by 2002:a05:620a:6594:b0:75b:23a1:3617 with SMTP id qd20-20020a05620a659400b0075b23a13617mr15151313qkn.40.1686705935480; Tue, 13 Jun 2023 18:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686705935; cv=none; d=google.com; s=arc-20160816; b=090r6vuzcxTUdw3fMHWo5+6H//EuryQ0wGWgT49lvfLuFYtJLxZNvKy3FJ3iCNryd/ m5g61hSrH1PqMOu5icNrl6UQiLNL96jWYmLlNxN6aADrn97m2YzSe1TP0TOURxbVB7sC NDPBs+AmjoYFb/F/LUo49Vf0kZMlQ5tt5U1YHZb3SuMZCJjHle+eVwOvMldhezlpJxbU 7uotYo5Ui3hJAvM+DglUgqN4StdnVEoqVhCN0zuloj+9TzEDc0Pw+PNrBgpc5jxLqB+L oZyD6hVYqEVf0xs51IUpPKZ16XNZUxkG+QNUVVkbMvlt0v7dlOfqdXlWaUJgd9m0gAO1 HDow== 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=XgMtz3Q2G9A+pnSEdvZ3mrFvxASf1BgbkfbwhuUXAMM=; b=BORRmvsLqztAJ90XBODpp9+o4wzMkwtQ8gZRFGFLSiFl2z7YSvnbLIp79tSZ1fWoAE gBgwrqQ17rv5lDgl06CKgIckzVcz6HGd0DBHiz+MxNbyjGuS989exNzqDQ5p0xAa3MWk XKjknf78fkwvYYMOqEzVMJaL/eKhHfApvPBv93R/wjI56Zi67dmu+Ys/Xxz//cPIJmRO 6IhEfq82887phrFYm2y5/kgxu8O1TRDYml+jWL1lB6pureMs8YIHXt5AblFSImHbZWwG T11gagl01SBwehZdCI2XAMjbD3B1QcigzZQlakULkwitu5DiRVZiC9TudrzqJScLZ1fb 5G9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qa+DrqjB; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j2-20020a05620a000200b0075ec88528dfsi355567qki.533.2023.06.13.18.25.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Jun 2023 18:25:35 -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=@gmail.com header.s=20221208 header.b=qa+DrqjB; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9FDa-0000yj-S1; Tue, 13 Jun 2023 21:22: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 1q9FDY-0000hf-J4 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:36 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9FDW-0004nH-RP for qemu-devel@nongnu.org; Tue, 13 Jun 2023 21:22:36 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-652426346bbso4824275b3a.3 for ; Tue, 13 Jun 2023 18:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686705753; x=1689297753; 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=XgMtz3Q2G9A+pnSEdvZ3mrFvxASf1BgbkfbwhuUXAMM=; b=qa+DrqjBT8g9Gu/HFIzkT2FAgzwgoLzLP96uFR1j2aU50ko7rlWLY5LQGv7KMY6Rex cIPMoHUTzb9/exq9bK2JpTSR2nSiO9SPHebMXsDXp619W+grp9FUvvBClPbNg0Jit4sD mfs1pvKKs92K9nhm+4Ve1sRFf2wISJ0PwpeH9vgH8gtwlOQXI7DEQQVMjo87LvHijpcm AZ+C3G9TWCZ4io1MuYEXbLXeEYsgCzTX8ZaLq9IUGkH5vS24nZcwlCPSyyf3ghvfqgvf tBxiP0GotC/KEZ1HzCQpuVSPZAz3uNOG0Xuf3IZcfS/PJuZKy33N5MN85PaBNHgbQFlV ixJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686705753; x=1689297753; 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=XgMtz3Q2G9A+pnSEdvZ3mrFvxASf1BgbkfbwhuUXAMM=; b=WcrLxwI93cXw6HiCDjZpUFupZeYuVEiIGWRks3xSta5ut8jB6lHrB7irefurlgLRIB m3ticfHtzvlW+kMeejzwcazmkFIavvTZQkfimaRgWJ3AcI40jKuMa7cp+W0FcwNUsRxg v7IQNx+t+Uz4k2rp5DRfXtoUCnntvqcIQthiq4CwkdsUt8tr1w8/Cxflrl4WW+sKVhFI kZpDHUVNtKfq2SqjRJbm1uVoCenRkjQhOtPu0yIihJOfTicRePb1xSGs+QW9TXyA9sql bH3wCf24bbN73iRfwJ4ilE/a2dfOmWN4WByvzxJ7do7hVHYMjDwoqXJREn+lZFVRsPbi wSKQ== X-Gm-Message-State: AC+VfDwl88bwPH3ZBOAlr8ovAxRWqGDBqhOeqQIlIE9OuuLBYulUFzt2 3cCF6J59yFlmbPS0deP33IxIRy9YRFEltA== X-Received: by 2002:a05:6a00:1744:b0:65d:4a3:a9d1 with SMTP id j4-20020a056a00174400b0065d04a3a9d1mr442969pfc.33.1686705753167; Tue, 13 Jun 2023 18:22:33 -0700 (PDT) Received: from toolbox.wdc.com (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id u1-20020aa78381000000b0064f7c56d8b7sm9112238pfm.219.2023.06.13.18.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 18:22:32 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Daniel Henrique Barboza Subject: [PULL 30/60] hw/riscv/opentitan: Correct OpenTitanState parent type/size Date: Wed, 14 Jun 2023 11:19:47 +1000 Message-Id: <20230614012017.3100663-31-alistair.francis@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230614012017.3100663-1-alistair.francis@wdc.com> References: <20230614012017.3100663-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 From: Philippe Mathieu-Daudé 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: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-Id: <20230520054510.68822-6-philmd@linaro.org> Signed-off-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, } };