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, } };