From patchwork Thu Feb 16 14:23:38 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: 654040 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp381711wrr; Thu, 16 Feb 2023 06:25:59 -0800 (PST) X-Google-Smtp-Source: AK7set+W5jpFHbtqdI44OQ84oa1R0ZJWhhtUoyyDuHmCCUCvIBbCh8u1k3Lez2wIfjZw9zFMIRGh X-Received: by 2002:a05:6214:c8b:b0:56e:a07b:f4db with SMTP id r11-20020a0562140c8b00b0056ea07bf4dbmr11044904qvr.24.1676557558870; Thu, 16 Feb 2023 06:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676557558; cv=none; d=google.com; s=arc-20160816; b=XzWG9BlpGFvJvPZODmNn4kETKSTMMXqZQl0/1nlf4wGNwScLmakQRoWNBv3lbwOyUA BYVB5DUye4UR/Ad+Q5Xk0/LqHzPDCHsPhizzBfoPRwZhMU52NaqzAw1OjBR7TUKNpha0 XOECJ9DdwOjbn816nJheFzJDp7+TXA8fxmnDEtmjoYqhJdeBPWwMt7IWQkamQ/AttTpw Vi9UoYcqVpxlOrTMGNIR+jB8moG8dRnDEXXh8weF1xHCbUFRl5QY/k/mHRJgXK6Qjwwh p48DZavd/WuJiSiW3UGE5v2kKTtc1Uux735JF54WrJKf4MRlKoi1gQqf/tZbkEtMSroH 8ucA== 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=AgNv7jvYIv3Rzz9yuX+hevsRvmOvV3oj8SZGxY0IVW0=; b=nB0B6KYwQwCa2ubb53Ty/1zMqVS2MeXzjD1LRL9lDfmO8pCVc8f8fi1xqz2E3ep2HP fyldMvTjFnvhpLYEwcZd6fBkZUCKxo24eOkPgyYG7Lkuh9UA6FgjxykmEuZWa3++PmtW 0Nb6WXW06co0dyIixG5dFLwsKmRHOHYEO/++FcVc99bIutc+iqWARusV7WNTn/VE5d9u lZulwVpAgOzqrzywWldRKU6TtZJBoHdc/txb3fSqdpFIEgIziXhUnrvaUedmwiLmVma2 dcnW0CL/zKsWz0WDYt39KPhorSIacSvDm8FYADYeIs3pUxRt1hNR1SyKNoJY5hffdMlZ 35hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l+8FD4H3; 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 bl4-20020a05620a1a8400b0072431b662d9si1559632qkb.31.2023.02.16.06.25.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Feb 2023 06:25:58 -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=l+8FD4H3; 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 1pSfBR-00063W-H9; Thu, 16 Feb 2023 09:24:25 -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 1pSfBE-0005ll-KN for qemu-devel@nongnu.org; Thu, 16 Feb 2023 09:24:16 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSfBC-0007BX-7g for qemu-devel@nongnu.org; Thu, 16 Feb 2023 09:24:11 -0500 Received: by mail-wm1-x329.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso4372643wms.0 for ; Thu, 16 Feb 2023 06:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=AgNv7jvYIv3Rzz9yuX+hevsRvmOvV3oj8SZGxY0IVW0=; b=l+8FD4H3zVooq0SzPC/ib6S6JI3vQSFaDYPJYAWNN0G+qHz7Jf5NpxUWs1mf+Vgdmq pomqy0+Uj9oETTzlrdROIrXgwM9MjfW/lBzRRmVHfc1YBuyoiZ3TP/yFOsCpp2scjQii YntcrG6Lr09VS/vtBKjYh0GpV/ZLKyidKdXCvYURsiNdPAXL55vXMQ6Drq4cD2PUoYIy 7aWBBzM9fej+amgrmRIDGjjI+ejfs3jaYbuEMNctFL7vkgwrCtzUrQmcAIoH+DPrX4OL 7tAJCuzH5ZKYfdZi3yGO6rB53deKCLJmiktbTijzDwYb/l/C5dLrCzLNS12iZidBxcl4 8UoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=AgNv7jvYIv3Rzz9yuX+hevsRvmOvV3oj8SZGxY0IVW0=; b=cR+3X4NfKMicmIGDNetvrCRF7H53DJOIJdmgcNqFLFgr3GRjIEcVG8VtiYYoNroVpQ QVTqQ1Zjs6/aQTuiRcv4exU/uNjbDrxuD9yNA3zKXVFAOmh51jtnJ5h0yKswhTpRqwbO tODWr71audqNerDcAzWUDeXBtXB9f1EQjuwF6RyWpmWocVU3jSHOT5Zw4ffwsntuIcKu 2CvMKWlaudt7vjTcnd5/po4zA/+Ud+q2+6kvG8H+sXfEg1Zo25x7LXnU92b3J9LGe+zH 2c5lYeSozYCftWUnS1kS7WXb/ctxuK9L1C2g4aekqyRRWkN5sIWgbPFr0neuHcUHkwhj 0yRQ== X-Gm-Message-State: AO0yUKWNGKCPFT33bEbZeyYzGUAp3FC63BZ4p7rRwmIs+f7tf0ww2jge UlZhVrtGzTAIN3nqWjI9CHVW4MAAHqj0qzbt X-Received: by 2002:a05:600c:4f52:b0:3df:d431:cf64 with SMTP id m18-20020a05600c4f5200b003dfd431cf64mr4667921wmq.39.1676557449269; Thu, 16 Feb 2023 06:24:09 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id bd27-20020a05600c1f1b00b003e20cf0408esm1908939wmb.40.2023.02.16.06.24.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 16 Feb 2023 06:24:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Dapeng Mi , Sean Christopherson , Bin Meng , Zhuocheng Ding , =?utf-8?q?Alex_Benn=C3=A9e?= , Zhenyu Wang , qemu-riscv@nongnu.org, Alistair Francis , Zhao Liu , "Edgar E. Iglesias" , Paolo Bonzini , Marcel Apfelbaum , Robert Hoo , Yanan Wang , qemu-arm@nongnu.org, Peter Maydell , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Like Xu , Alistair Francis , Zhao Liu , Eduardo Habkost Subject: [PATCH 5/5] hw/riscv: Restrict CPU clusters to the expected type Date: Thu, 16 Feb 2023 15:23:38 +0100 Message-Id: <20230216142338.82982-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230216142338.82982-1-philmd@linaro.org> References: <20230216142338.82982-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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 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 Microchip PolarFire SoC expects U51/U54 cores, the SiFive Freedom board: the E31/E51 and U34/U54. Do not allow any other CPU type by setting the cluster 'cpu-type' property. Signed-off-by: Philippe Mathieu-Daudé --- hw/riscv/microchip_pfsoc.c | 4 ++++ hw/riscv/sifive_u.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c index 2b91e49561..658307fdfb 100644 --- a/hw/riscv/microchip_pfsoc.c +++ b/hw/riscv/microchip_pfsoc.c @@ -150,6 +150,8 @@ static void microchip_pfsoc_soc_instance_init(Object *obj) object_initialize_child(obj, "e-cluster", &s->e_cluster, TYPE_CPU_CLUSTER); qdev_prop_set_uint32(DEVICE(&s->e_cluster), "cluster-id", 0); + qdev_prop_set_string(DEVICE(&s->e_cluster), "cpu-type", + TYPE_RISCV_CPU_SIFIVE_E51); object_initialize_child(OBJECT(&s->e_cluster), "e-cpus", &s->e_cpus, TYPE_RISCV_HART_ARRAY); @@ -161,6 +163,8 @@ static void microchip_pfsoc_soc_instance_init(Object *obj) object_initialize_child(obj, "u-cluster", &s->u_cluster, TYPE_CPU_CLUSTER); qdev_prop_set_uint32(DEVICE(&s->u_cluster), "cluster-id", 1); + qdev_prop_set_string(DEVICE(&s->e_cluster), "cpu-type", + TYPE_RISCV_CPU_SIFIVE_U54); object_initialize_child(OBJECT(&s->u_cluster), "u-cpus", &s->u_cpus, TYPE_RISCV_HART_ARRAY); diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index d3ab7a9cda..d0535746ca 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -763,6 +763,7 @@ static void sifive_u_soc_instance_init(Object *obj) object_initialize_child(obj, "e-cluster", &s->e_cluster, TYPE_CPU_CLUSTER); qdev_prop_set_uint32(DEVICE(&s->e_cluster), "cluster-id", 0); + qdev_prop_set_string(DEVICE(&s->e_cluster), "cpu-type", SIFIVE_E_CPU); object_initialize_child(OBJECT(&s->e_cluster), "e-cpus", &s->e_cpus, TYPE_RISCV_HART_ARRAY); @@ -813,6 +814,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) * CPU must exist and have been parented into the cluster before the * cluster is realized. */ + qdev_prop_set_string(DEVICE(&s->u_cluster), "cpu-type", s->cpu_type); qdev_realize(DEVICE(&s->e_cluster), NULL, &error_abort); qdev_realize(DEVICE(&s->u_cluster), NULL, &error_abort);