From patchwork Fri Jan 5 15:42:25 2024 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: 760173 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105521wru; Fri, 5 Jan 2024 07:48:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPQ2PP3Ww26j5gypbvARZhdniclTxkxa7O8JV6W3x1W0CiWdrh8vsfQoe1JCV5gbGOgxgN X-Received: by 2002:a05:620a:640f:b0:783:518:360c with SMTP id pz15-20020a05620a640f00b007830518360cmr2284773qkn.8.1704469730098; Fri, 05 Jan 2024 07:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469730; cv=none; d=google.com; s=arc-20160816; b=YjEQrQWkbTAQwtLoqY/dof1p8U6QMZUWTvarfVCuPEBdv93rZJI5Wgoe5h0EXl9dLE y8V1VlqYwSxoeKGBZ51DSFYLmgtZaU14fsuRaopyHRt38AvjZUCzLgJq9i54y6/bc5VS LENIdfORRvAxKWK55vOlcDOkc1SIvD2iufktUwRolos8PvkDVpcOXsdgJKXflAD6kYP4 fd0qdFvuY9qiF0MMsaibeoEaFI2Kk6grgbgjMUTO1lG7d6QDiznlDeOuaPrAV/ggfUCD Y/4wYe5K5Tqg4znnK9879SZxIdF9cKMZqrzDK4qh/90FyIqstAq/kbWtengIw5U/MH81 pJAA== 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=H4P3qee4jFL51Nbb/746jQf4mN+fePYfOB7VeiIaJ9s=; fh=5Ta8+zkVYsUaAj/mRnVEpKYttBANBvhDfDKAxLPIHLM=; b=F8IIwNVKauyrKY5ku9uYp5pTnn0qRn3eSMFl0EY+cDZUiQ88N1qL9TYO5Yh3NWSjyl /RY7j9Cov49ZYdghIvZh7PHoc6JVBdknxGXxYQvVkWKQgNJS3uOg4B2xVqbaEzwNthKo Of2Rh634LFxDptpz395NeHDOt8w+pCVJluYtfwflhE2eSfdR91c8yQ7O0AB6z6ZDG/Lc TQpqXubSwlSHLI7AzmrvzVbp5QkGVxb6XR098q2uRTfdlD4vjB1wijgK49xTi7SWNv73 eTg3J2kJ6+0Rpx3iwM4zRnqtFGrxqWeNwKsvSfBkQWHGjsXM2eG1TCYBC9DsDunLQ523 W5nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kkwah4b1; 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 m2-20020a05620a24c200b00781d1750407si2007222qkn.637.2024.01.05.07.48.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:48:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kkwah4b1; 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 1rLmQQ-00084E-1Z; Fri, 05 Jan 2024 10:47:59 -0500 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 1rLmPQ-0004L1-V9 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:58 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmPJ-0003yA-CP for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:56 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3368b1e056eso1398869f8f.3 for ; Fri, 05 Jan 2024 07:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469608; x=1705074408; darn=nongnu.org; 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=H4P3qee4jFL51Nbb/746jQf4mN+fePYfOB7VeiIaJ9s=; b=Kkwah4b1tougeMRIpTCAQAwZ9p+kwT5uP9F0d1TekDZxKNFruCjHlyyMhiRX/Eaq5Y 620c6kZHtKSeyiKEdKRLGJpUM+wRdzTLIY1sAWXrDEbW9OnKXBKyPrVdxXOGm5aIiCEV EThdXcWqHbRbHXDHBIXJ/REptiyqGo5hX5F+fFLoCxiIC6puZ/cTTiP9sdNeBeuBGtWe EYROdmlU8GkXnBy1y0PhRsD9TiIIMQsRoqLeqGFXFc/x8sYh/Aew/MXHLuAi8H7WhNwz gRT3HYkCGkE3vheDOhyo7w8g+XACjxGXEIa0DMGezH5n5CPlcoVZQGPTX6CNyAzXrRGe wZRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469608; x=1705074408; 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=H4P3qee4jFL51Nbb/746jQf4mN+fePYfOB7VeiIaJ9s=; b=PrvcXaMqpBDm1nAvhYA3or4JcmGwS1Qa8uNoG0N02145MnGQN3fT2b83e7vudXgbHh TQ6zzolm+sLyA4anD+y93OVsI+yN7uV1eRyXOD52jiKSeB+7j502Deia/aICsdaj9zMP /jjj4ZuL91vFKRvrn1NFj1bV3zYK5v/Dafme6LBedbHcx9TCHBohgkrZZ3jxLDtaPUSq k7AdmHnhaGUu2Slw+krvsYvchKsGTqwIUc2MdUQf50CLmbAR/Rv8PtEt/bBlnO0jQH5M WRaJdRVXiTvsoAPIUIcUDaSfsGNRh89w6xz6tgRS9uUULKioQ6TqOXNftP55RIEWFM46 iWIg== X-Gm-Message-State: AOJu0YxSmjRw/ez7ih31zUHpncZphCDQSM8hswjXkSQ5WQ0zrhCyCZCi NxkeCi1RIF+GLM0sUNfX5WpRYpLFWWZ/Nt48uXc+KSGy63A= X-Received: by 2002:a05:6000:1972:b0:337:4221:5525 with SMTP id da18-20020a056000197200b0033742215525mr1273664wrb.46.1704469607760; Fri, 05 Jan 2024 07:46:47 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id d18-20020adff2d2000000b003374d8306cesm1606073wrp.86.2024.01.05.07.46.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Vijai Kumar K , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PULL 32/71] hw/riscv/shakti_c: Check CPU type in machine_run_board_init() Date: Fri, 5 Jan 2024 16:42:25 +0100 Message-ID: <20240105154307.21385-33-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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 From: Gavin Shan Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231204004726.483558-10-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/riscv/shakti_c.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/riscv/shakti_c.c b/hw/riscv/shakti_c.c index 12ea74b032..3888034c2b 100644 --- a/hw/riscv/shakti_c.c +++ b/hw/riscv/shakti_c.c @@ -28,7 +28,6 @@ #include "exec/address-spaces.h" #include "hw/riscv/boot.h" - static const struct MemmapEntry { hwaddr base; hwaddr size; @@ -47,12 +46,6 @@ static void shakti_c_machine_state_init(MachineState *mstate) ShaktiCMachineState *sms = RISCV_SHAKTI_MACHINE(mstate); MemoryRegion *system_memory = get_system_memory(); - /* Allow only Shakti C CPU for this platform */ - if (strcmp(mstate->cpu_type, TYPE_RISCV_CPU_SHAKTI_C) != 0) { - error_report("This board can only be used with Shakti C CPU"); - exit(1); - } - /* Initialize SoC */ object_initialize_child(OBJECT(mstate), "soc", &sms->soc, TYPE_RISCV_SHAKTI_SOC); @@ -82,9 +75,15 @@ static void shakti_c_machine_instance_init(Object *obj) static void shakti_c_machine_class_init(ObjectClass *klass, void *data) { MachineClass *mc = MACHINE_CLASS(klass); + static const char * const valid_cpu_types[] = { + RISCV_CPU_TYPE_NAME("shakti-c"), + NULL + }; + mc->desc = "RISC-V Board compatible with Shakti SDK"; mc->init = shakti_c_machine_state_init; mc->default_cpu_type = TYPE_RISCV_CPU_SHAKTI_C; + mc->valid_cpu_types = valid_cpu_types; mc->default_ram_id = "riscv.shakti.c.ram"; }