From nobody Sat Sep 26 20:01:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1789667140; cv=none; d=zohomail.com; s=zohoarc; b=Y05IbBV1m2i2KJqAd6KDRRC7LhqjIc2W7k/rKU4GemSioj5Q+U1SaJpOVuJATL0rnvd1dh6zC2EdWnDdt/zK+lUvA/ksZRAsc3KVPUqYNkQVvmTUixzryQoNjgX2v/owMKj6DVOA3wJ0EDpA06NQw4LNq/6lhgFPKAPVc1RbBoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789667140; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YMwRPIQjBc9B0H7Gcd70sCpPVswh2gpmygYWKfnkzJw=; b=e1F6tN2WH86thtBp1i75hFgSzUVmkDoC+wmf7OqiM4apeqO1Qc6SgTq0Nx+Fae8T8zXtuOCCoQF3mGZyps+Rxq24P/VsGYa13/c27Xv2OKVFUOS6oRArGtSA6sytZ7rtOwYRLzW1MmrxwQ1S8/OIPJEWNOV9V2Cj+ZyCY548drI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178966714076356.98129756800813; Thu, 17 Sep 2026 10:45:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7G9w-0002Y8-DS; Thu, 17 Sep 2026 13:44:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9p-0002Sz-NB for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:26 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9g-0001ao-4T for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:20 -0400 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHhqj71683050 for ; Thu, 17 Sep 2026 17:44:14 GMT Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4grmv5g02v-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 17:44:13 +0000 (GMT) Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-91051512080so18732916d6.3 for ; Thu, 17 Sep 2026 10:44:13 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([189.110.107.170]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91252c56d73sm3118136d6.13.2026.09.17.10.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 10:44:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=YMwRPIQjBc9 B0H7Gcd70sCpPVswh2gpmygYWKfnkzJw=; b=Msw3FWtyOlpDV+9NMKlljUjfrst ZHcR39EfoBLzbSa8BFCsJVvh5r/cy0ZY+Ips1R7Lf1nV8hPcBL9qxaDfb0FnnNyb 81Q+bz2hmTuSi8OucusCraRKBK4yrB9ceWsl1wA1YLknvoiFLvj6MT6Lsx/U05Kg GsyuIbEaroblhpWcdg4BGaDWnd/YdZ9ZBZt9lzPDz4OQNxTP/WxO7Sp2cRa1GuP9 yq3rfr2BbCG6/lz04RfV4ERmEvMjQTSMGYTFlf18ihXtqj2+JTsgRi5eAbTsde4v dnODO59ggDqdQFxbAc540nOZA0PIRice/lWEtMTRpoZceXOCctUwcsUigtg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789667053; x=1790271853; 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:content-type; bh=YMwRPIQjBc9B0H7Gcd70sCpPVswh2gpmygYWKfnkzJw=; b=bypIvyiV+xv0Goh8GdaHg1BfUL9A8/udnZkK87yY/wUBqfa3BokbbKPDpv+b8rhJGr K1BPwXgpiUd8qjQ/4FVPEUEF4d42fE8NeYhQcqCfWW8aTGFpRGORLnNkAucMFQ5s6SkK iVRIgqNDfkdifST1ITRuLKsAebGDd+IxLjfiOAGLL5g7G8dvEFblcFR64A370ESyEpy/ UdgPny4+lBfM3hf9CWsLhI1BVfsX4L1fS1cv2oZ0Ajiz3ov70MQMX5YVNfKvqO+FcQU7 JX+al7LQk4eZWaz85y3L/Lij0WbpHbx2WGj0iazK9vyhv/yLrBgJTLCXh74mW4RrTPhK 9aBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789667053; x=1790271853; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=YMwRPIQjBc9B0H7Gcd70sCpPVswh2gpmygYWKfnkzJw=; b=EUJA/70bNpwZ7DmIST6jEPr97rLk0S/5AaeyTSyGa4EUAIp7d3DEeE3cOD6D+0ZkOn 2FIrIYfZ13p99b/Iq5OtZwxeppC7aJajb+9uzj+uGjpCm7IGesb6XmtfCWpAGZ3puJWL O6uKGkPXxzNpb1rNYGnXSZZkoBccUJnNoGhiHQjp3iWQK9iY3DYu6cePKCZ1EMurk8o5 X9XjG+1VQlxuMEfTyBiUWNTAFFdAPbNXRnvvz+dmatzejfyQCdnU/+7Esb4pCt/TiWEH Xp52mKL2xJ3puqwzQrKX8vs8HNivJelvZHCzGXy0EQqo2te6BRqmXoTYj5oxjSYxAqe0 FPCQ== X-Gm-Message-State: AFuF++nVcHNlgKYZnQwRXrsZDFblEZxS0Ni8+6ZWn10X1rb1I+OQ+q/q KPYifIl6dvcCYfp48ZtBm+aj6cyLEfcuvfecpnwaFv208k0RRNY2QlcdMQ99R+KHqyuE+ZdBIPM afApQ8K4bd1BcsgKCOGVtJ6+aCtcp3ae4K9qL8ErPdN+b+uC6rvtYpGZSyTrach9E9g== X-Gm-Gg: AYBFou3h3hqKwe6koPCl10l6ofxOHTNiiHCdmcjtU1bzrWVZZPYpla9/TnjNa2jgLey pKCvnyHcvwyI1Y9hLi0ro7iMb1dl6A6m8rVDw4oXk8Fut2q4W/FJa+ZMSSw4YJOSjTfpdvz6HdW ieFpXzKOC8TC9MljeN12rYKDS3qGhPqGFnYaf+NHjfmyPRbp4ksySHjzyZCq00+N61prJhFwDau eX4VwLuYKNeh3rrHUx4vHBw62I9JPbvoXS5HAnqx14KA13FTsSS9M8dpRBIfVfpxubB96vJ0Auc SHFAoXnvuLGk7GILk5rIIcE0IwGOnMYX4dsscU99ZWg/kTFs4+5uX8YRaYg6Fkho+bY52njNeiE Aa9xQmvheuoSD6yAwIAyyovlMBsS3k3fP54kAnMc= X-Received: by 2002:a05:6214:19eb:b0:90c:d6fc:e284 with SMTP id 6a1803df08f44-9123d79d2e2mr157563256d6.17.1789667052729; Thu, 17 Sep 2026 10:44:12 -0700 (PDT) X-Received: by 2002:a05:6214:19eb:b0:90c:d6fc:e284 with SMTP id 6a1803df08f44-9123d79d2e2mr157562616d6.17.1789667052300; Thu, 17 Sep 2026 10:44:12 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, andrew.jones@oss.qualcomm.com, leif.lindholm@oss.qualcomm.com, Daniel Henrique Barboza , Sunil V L , Palmer Dabbelt Subject: [PATCH v12 1/5] target/riscv/cpu.c: remove 'bare' condition for .profile Date: Thu, 17 Sep 2026 14:44:00 -0300 Message-ID: <20260917174405.3471736-2-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> References: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI1MiBTYWx0ZWRfX5B4vDtZgTxui L4O5H+JSPomPcjRi1Kci7qD3fJ8kmIKVB7w2zp67wlHwr+et+kSuAvlHg/W9lxzipXQLhIOxPlb zhWllt1KUj2tzNbkmWeVQhGTwZiDuQ2RLVerJzl7xO4L36Za7fhz3IVokN5ANAmzpCy9y92/TkZ aHSZmxQ7nYl6uo0gUKeKFRaFP2tdezEeI2zr2KaI+AtE2lgXBo+CNi0czCQqiU7+CCytFn0hVtw bCixdOjbYyKXjN0At+Bk89Q4mnqaUYwvmunhPk9vIdPprvZb+qYfwk0i7hQQTd/epLof6ivS/dW YaOATIQ3Y2zlfGjUSlR872l0ZQSTib4NaiyZT8sQPSEMNRL7z6SbRbegBmDH5lIrVg3Kw1GESI2 6qA2oOLaX+TpqKoMwQII+cf7a5X1cRlAzMM+RVB6k9MGka7muqRb5bOr+gdC8buaYLH49cjUzc/ aHweM9J0vc3ud5BnTCg== X-Authority-Analysis: v=2.4 cv=E+5YNqdl c=1 sm=1 tr=0 ts=6aac26ed cx=c_pps a=wEM5vcRIz55oU/E2lInRtA==:117 a=arNgJ3JLhM/z8Vk/iMOFgQ==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=JF9118EUAAAA:8 a=FRSEYCzRAAAA:8 a=GhL2bEVCvcqOW28JNKkA:9 a=OIgjcC2v60KrkQgK7BGD:22 a=xVlTc564ipvMDusKsbsT:22 a=H4N_Y-AU75W7NKDNhZlT:22 X-Proofpoint-ORIG-GUID: yM0zvkNamPWj4Lx17CUmgM9MftuyGc_h X-Proofpoint-GUID: yM0zvkNamPWj4Lx17CUmgM9MftuyGc_h X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI1MiBTYWx0ZWRfX23VOTgLpbXgg eMdZTGgaRaDLpddAf4d4S7hzS6O1AZ7EQdCnz0nX0aCOUEyu23I7/YM5b4etwD0RAlSAWMJLOYV ehUsMfwDeOHejUoRzLEqBLmxNp+2MUM= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 impostorscore=0 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170252 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=daniel.barboza@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1789667142011158500 Content-Type: text/plain; charset="utf-8" We want to configure other CPU types to use profiles as an alternative to adding every profile extension explicitly, i.e. a profile is nothing more than an extension bundle. This means that a vendor CPU can set .profile=3Drva23s64 while having the same handling as any other vendor CPU. Same thing with all other CPU types. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis Reviewed-by: Chao Liu Reviewed-by: Sunil V L --- target/riscv/cpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 0fe9762022..41e52431ed 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -3104,7 +3104,6 @@ static void riscv_cpu_class_base_init(ObjectClass *c,= const void *data) mcc->def->bare |=3D def->bare; if (def->profile) { assert(profile_extends(def->profile, mcc->def->profile)); - assert(mcc->def->bare); mcc->def->profile =3D def->profile; } if (def->misa_mxl_max) { --=20 2.43.0 From nobody Sat Sep 26 20:01:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1789667135; cv=none; d=zohomail.com; s=zohoarc; b=HNn7whxuuL8tB8G591S1cAll0eTeI5aEqKQvWeVeJUKnVBOnuosyUtULJh5sMeJNknRariiLMlPg+qLF/UaNOjLMCPFql97Nm2uwlSbHh707jEpG+J/Tstu3p+X0YQ6BaesAics0eluw3aWB+cOjQBG04IIBulPuduZ0wV5n9gM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789667135; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GkCRYrqoeka52Y8rKYAZUDFWuolJT/VyJY3a3J+f6c4=; b=nBco0+nCH4A1e4eIJK/ooJmNdBUm41jz5e9iY+3wNjbHmxVp3BkqwtM+x22sFMW2PQAVI0vQR0kV2W4jwyGGX3/gY052ICLWW1w15pz6fpbTdU6voRMJBBfZcGGzp1112+A/w5eQOUXNOBlWz/92bl87bNZEQn1uZC90/rRzqf8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17896671353492.4223111690085943; Thu, 17 Sep 2026 10:45:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7G9x-0002a6-4o; Thu, 17 Sep 2026 13:44:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9u-0002VX-0Z for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:30 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9k-0001bE-2P for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:27 -0400 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH5fDg2170994 for ; Thu, 17 Sep 2026 17:44:18 GMT Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4grk97rj7m-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 17:44:17 +0000 (GMT) Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-912351b220bso25470636d6.1 for ; Thu, 17 Sep 2026 10:44:17 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([189.110.107.170]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91252c56d73sm3118136d6.13.2026.09.17.10.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 10:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=GkCRYrqoeka 52Y8rKYAZUDFWuolJT/VyJY3a3J+f6c4=; b=VI7HoPEvdCqZzjKU5SYHrJEU+pU anozfCOpdiUnJF9I0113LvCMnOj1UeUkw6dmMFdDVuqCiBc97gX+7fIzO0Wlnr4t /39cs88Jvv21eXb+7UFAuHjq+bEjDhjkT82h9pGmx4XDKqXvTkDTgtaNHqb3ca/4 BgCUHQzLwmJtni4bSgayNpOIcmEv7/BdQlf2g+UKO6W59Tx8tsgh6zsfx2lsjBYY EgLzlQ/eS/cfVR5KmhXMsNdlplCGmBybuFh43FPYoHk5j5X4kNVi9Koh6NY//uj9 u7jpApD7XHgXoHGuNyMpGnorWegQrZhDPS+QsFQsBRyI1jZLCxpaOi75iZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789667056; x=1790271856; 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:content-type; bh=GkCRYrqoeka52Y8rKYAZUDFWuolJT/VyJY3a3J+f6c4=; b=A+AyS3/buGoPOdvC+rCPQN/neZYXX92B9hv5Y/eDB/iCDc5N6j8zy1v8r2ZKV+duTD e0Ue0ienwqejsvxjhXLy2giB55lgGn155jfL93Wi1vPkDSHYj5hyRWbrwkXtE0+3RJ/M ZDWeRnpM3lT+VJD8iHoLwzoMKxE0k/+UwUex7dmPNuZyiwQGli/1+WPS+jD74F/lGDj2 jq+2COZx4TYWA2EHKfAos9H7gQPGZ5x1Pw5uDcLhXsSxjwQE4DTH3mozyhr+sr6dhhYu euFlGm+f6Ucp8QeZNqKnzUjCy3b3hSP87b/We3dwycwJs9IFD5YsbV4tW0sVflBuzmXE sDTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789667056; x=1790271856; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=GkCRYrqoeka52Y8rKYAZUDFWuolJT/VyJY3a3J+f6c4=; b=PHc+2W+TuZLxdTadDumt1+KJW/SGbFAIa06QGcEb+CygjtNMu2Q66z5qr5AXuhO/QO waurFHWTUmbp+hDWCF0YrmUAJC7Uo6H6dyn9N2dsPovX0rkybqSrw7EeuPpottrcIeJ1 oUMKz+rSk38SA5ogQ4Djq2HY4gMvq/rCeSyGNSqhlVHTcTXN4woI0wFlc1Ie+ctBmL6K 4CRmSLAKoD1XnUJ4Zp37iNEEtYlQyPOnf1s1Mw3mvsblLzNF9/JaGLHt/9x0pz2akV4G z5piCnsZU4gBDQVflDhiNhT1Mq1RBS4VguHvlIKEXxhDranDFsu2tCPqMnGXIV5q7F7N mbLQ== X-Gm-Message-State: AFuF++nJnJFWwtj1Zfaa9qfqNyEa96KRTlXzW9I80O/kvk2Dx1O0f9/w lpAm3I1wujQf1/qmUKmSLpuLYcShpnBoBT1NpvKkAZZ5S4BLESkl+ao0gZcwdHV69+f9fqccM09 kj7yqzRVKEYoPMDwqTW4TQkbkdyiFuqSgmjxU4nsRs4XPuOZCaifj4amwBb/r1vrc8A== X-Gm-Gg: AYBFou1SY7sMhdK8owYmm1DoleCzWWBnmiVvO9iO/vSRhVCuiehrCefVy360kk/dr+O AJgvjD19qrG30tVv0eL4A+IcYnsR9AilIiyNPPFhoem0hmEH2UsiSlxxqhSrhh+OdagfPJU1S76 ej9hoUAZe1x0Xar0ktHtZ81ZCiAphfu/xcBGPWyv8Oq/0iNpXbB00mByfdoggLr2sjSKo32E60A QxQf8nOa5K0Har/+O4paiDlCLUEVVnVHFdoYObaiTElagV75gZ/sfpfHIoq4vzEXcmpzhPA6QYP xiXEvWlKci7J61YK0OV2DWCvy1agZVUu+NZlTAjuATPd2M5A/4f6RZum7xFlcx8DsuKVK3s0hof jcapLpcxJrXmyvpVStVqiWeLadlTXy8cgIu6iosY= X-Received: by 2002:a05:6214:20e1:b0:910:3923:cc73 with SMTP id 6a1803df08f44-9125240c2dfmr11076216d6.28.1789667055873; Thu, 17 Sep 2026 10:44:15 -0700 (PDT) X-Received: by 2002:a05:6214:20e1:b0:910:3923:cc73 with SMTP id 6a1803df08f44-9125240c2dfmr11075886d6.28.1789667055452; Thu, 17 Sep 2026 10:44:15 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, andrew.jones@oss.qualcomm.com, leif.lindholm@oss.qualcomm.com, Daniel Henrique Barboza , Icenowy Zheng , Matheus Ferst , Sunil V L , Palmer Dabbelt Subject: [PATCH v12 2/5] target/riscv: add riscv-server-ref CPU Date: Thu, 17 Sep 2026 14:44:01 -0300 Message-ID: <20260917174405.3471736-3-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> References: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=LOzz05W9 c=1 sm=1 tr=0 ts=6aac26f1 cx=c_pps a=wEM5vcRIz55oU/E2lInRtA==:117 a=arNgJ3JLhM/z8Vk/iMOFgQ==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=V1jnuoLLAAAA:20 a=EUspDBNiAAAA:8 a=JF9118EUAAAA:8 a=PXcuKL70AAAA:8 a=FRSEYCzRAAAA:8 a=zLUtPzHEVTZWnbMtJKMA:9 a=OIgjcC2v60KrkQgK7BGD:22 a=xVlTc564ipvMDusKsbsT:22 a=1qLaeP4TCVy2vqIEy19U:22 a=H4N_Y-AU75W7NKDNhZlT:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfX9buwyi0TNMs2 wDh41DSaBKDG+PfpslGGEuZ2za1G1S/M33HrKAwnd+Eo+DUIv6K5U3SvYHzrFk7BFq1bfLeXRm+ rp/hwQRCu9wPsvqxds4nS86zsphy3Wws1uZQuSA9mFm6e6FDaZsqUZtfiIBaVedo7H0xtiRp3qp 8RCyICKjpXCygS9lSWgsbcPe7gnR8EwGYj7VUSNlP08knFJC6wt7ZV3geN6uo3vifsYi7Te65uf ucFeGFOvtAISN3vN6JJfxtO5b/EGtwC9IXDcp7G4O3OKu7jWGBful80Mc9NiOJOgEZy8KltGZ2Z uAT2BbYRydKG/YbIc39rRqFa099RqpdFLMVmPcZ6O7oxHJhrG1K7FBTyELL7PI1XmJGzR1XnrTv EuKdO0kP5kRxZkSQYbExmEJg6sA5hvjTeYlaiqridXtot8P0ALDlMOfFBXXFx4Sk+Vx1lpsQXw/ ouMHUJX9At+ja92kUqA== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfX8Gf97UZYzrJO yM6GsoCzXnQhDGwOcbT/IrGcFofLQn9QSUlcv9wV52hLw0Z5ivF4CqKQAEZqTm+pNOWcqh6M/Hz xkFdgMM7lu9F0ATAUUHCwOpLIJ6QIWA= X-Proofpoint-ORIG-GUID: 3H6wFkGvIT45iaJlBuVDGgpxW5ZxYa-Q X-Proofpoint-GUID: 3H6wFkGvIT45iaJlBuVDGgpxW5ZxYa-Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 spamscore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170253 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=daniel.barboza@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1789667136000158500 Content-Type: text/plain; charset="utf-8" The harts requirements of RISC-V server platform [1] require RVA23 ISA profile support and others. We're going for a profile-based implementation, instead of a regular CPU that can inherit RVA23, to allow future CPUs to use it internally as a starting base for their own extension sets. There's also a new 'rvserver-ref-1.0' flag that can be used to set the extensions in the command line for other CPUs, which can be used for testing/debugging purposes. Note that for all intents and purposes "riscv-server-ref" is a regular CPU and no, we're not trying to set a precedent of calling the riscv server platform spec a profile. [1] defines in rule SEE_020 that we must support at least 11 debug triggers (4 for insn address, 4 for insn load/store, 1 for icount, one for int, one for excp). We're going for the minimum. If more triggers are needed users can set any trigger amount (N <=3D 1024) with: -cpu riscv-server-ref,num-triggers=3DN [1] https://github.com/riscv-non-isa/riscv-server-platform/blob/main/server= _platform_requirements.adoc Suggested-by: Icenowy Zheng Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Matheus Ferst Reviewed-by: Chao Liu Reviewed-by: Sunil V L --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h index 1a28f1369c..61234842e3 100644 --- a/target/riscv/cpu-qom.h +++ b/target/riscv/cpu-qom.h @@ -42,6 +42,7 @@ #define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64") #define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") #define TYPE_RISCV_CPU_RVA23S64 RISCV_CPU_TYPE_NAME("rva23s64") +#define TYPE_RISCV_CPU_RVSERVER_REF RISCV_CPU_TYPE_NAME("riscv-server-= ref") #define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex") #define TYPE_RISCV_CPU_SHAKTI_C RISCV_CPU_TYPE_NAME("shakti-c") #define TYPE_RISCV_CPU_SIFIVE_E RISCV_CPU_TYPE_NAME("sifive-e") diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 41e52431ed..336f596915 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2425,11 +2425,37 @@ static RISCVCPUProfile RVA23S64 =3D { } }; =20 +/* + * This riscv-server-ref entry isn't a profile per se but its + * CPU definition can be modelled as a profile that extends + * RVA23, with additional things on top of it, and allowing + * future CPUs to derive from it via + * ".profile =3D &RVServerRef1_0;". + */ +static RISCVCPUProfile RVServerRef1_0 =3D { + .s_parent =3D &RVA23S64, + .name =3D "riscv-server-ref-1.0", + .satp_mode =3D VM_1_10_SV48, + .priv_spec =3D PRIV_VERSION_1_13_0, + .ext_offsets =3D { + CPU_CFG_OFFSET(ext_zkr), + CPU_CFG_OFFSET(ext_sdext), + CPU_CFG_OFFSET(ext_sdtrig), + CPU_CFG_OFFSET(ext_ssaia), + CPU_CFG_OFFSET(ext_ssccfg), + /* ssstrict is always enabled for PRIV_VER_1_12+ */ + + RISCV_PROFILE_EXT_LIST_END + } +}; + + RISCVCPUProfile *riscv_profiles[] =3D { &RVA22U64, &RVA22S64, &RVA23U64, &RVA23S64, + &RVServerRef1_0, NULL, }; =20 @@ -3767,6 +3793,14 @@ static const TypeInfo riscv_cpu_type_infos[] =3D { #endif ), =20 + DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSERVER_REF, TYPE_RISCV_BARE_CPU, + .profile =3D &RVServerRef1_0, + .misa_mxl_max =3D MXL_RV64, + .cfg.max_satp_mode =3D VM_1_10_SV57, + .cfg.pmu_mask =3D MAKE_64BIT_MASK(3, 6), + .num_triggers =3D 11, + ), + #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU, .cfg.max_satp_mode =3D VM_1_10_SV57, --=20 2.43.0 From nobody Sat Sep 26 20:01:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1789667109; cv=none; d=zohomail.com; s=zohoarc; b=DWLVA9tFB2zZZYuh1W55/AsucLkNQ9VDIoAXkjUKHyAQcD9F06V/DYEArXklphVfhAPdPg5sddZqDvAbsCYxNYAljia1EBIPsxhHUPGjIyw1aecFzNIOx7abQZudMQRdfS2gP5vwXqne3tQogLj2p7uEHgaW1XOinlXOxdAA+Jg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789667109; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hS8AbmtIjwXLkODItNLYaD5JQF6gHMO0UgSsykSVbGs=; b=Z8+k/ke9osMzXw9bf/lkDBZoEJ95WLoQ+G5ZEioP2xTxG4NY6AoLLNcMAcPhILXQYzqKZRTT3muGwU4hhzbenvIh1cefqzBk42ENGgZGVsMFKhQ7xaNdZnj0DFklya/NeFrHEK/bjswu5QZ4GAJzdaP/BD07nVIA+aBdVQS8LXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789667109741324.0579086197944; Thu, 17 Sep 2026 10:45:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7G9x-0002aU-G8; Thu, 17 Sep 2026 13:44:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9v-0002Wo-E8 for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:31 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9p-0001bl-IF for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:31 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH5WCM1766003 for ; Thu, 17 Sep 2026 17:44:22 GMT Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4grcraajte-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 17:44:21 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-93a2d361e1aso273163285a.1 for ; Thu, 17 Sep 2026 10:44:21 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([189.110.107.170]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91252c56d73sm3118136d6.13.2026.09.17.10.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 10:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=hS8AbmtIjwX LkODItNLYaD5JQF6gHMO0UgSsykSVbGs=; b=TPiGeXMmmxrbNoSwP1y1OpVjYkX mvMIY/KVq3ApKK+79xe4VovZEKkybmErsP3jCQrl4L16gIu/DLLFZ6xgE0ml97u8 m1JKPWeECCOLN2miYfoI6XuZqzmMT+pT5XRP+jBa26Eafr60bUKalt8K2FD0DgQB BnlIIbKjrjIZpvyXpzd9gVcniWn8DIks6srvxtWKBQOMYo+S3YSXp9zrd+M5O1DM igVASNNa2//2+r/IF2DKg2xz8dBAZV3PDxQKg2ctIEeX9PHtPeAoF2xU3C9oJ2VH qZJqnT23MyHe5x0obu/GlkJh6NVMbgpNdFOlUR7fmlJ7In9nIiD1ECNYHeg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789667060; x=1790271860; 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:content-type; bh=hS8AbmtIjwXLkODItNLYaD5JQF6gHMO0UgSsykSVbGs=; b=YCNQ/0Ep8MHNgGlCBYThnQhhpn5+UBN00cnW6aZhuGBq5gxfh47f9iGb6LgLzt1QPx MUlntC1C/1kDyzclfnqKV6X62oSVBD9IxEEfzN5EblJEz1c1MGlnN5vxcqxrAHJrSJjk RhDwQuUXSYY8UFtEbL+0psbKEaNLBxy2Yje5IoLokjjzUtQRrxRwZPPINxS5WbhuY6su RmrLiDBm8BZknuFKUiHavBP+9RuuobVGUw9OUY2XRFB+Cb03Wa2E3xU7kpg2/gcqIs5Y Qgb4YHcl7Gf1uz1kSCLysQaJMcvE98Uw7j+giZqnN4oGezvZVbB5GyKjei5FWAdltU2x C/Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789667060; x=1790271860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=hS8AbmtIjwXLkODItNLYaD5JQF6gHMO0UgSsykSVbGs=; b=pDvY+0CeMAtTC56igpoDh+SgFm5+95JPjV2rh7CLZrQGCV69h2BAaLzc5D9KLvleR2 UG42ffhsQ7WF9Y5nL+nCXWdOHpNsNRbMaPNXhhhoT8lTM3UrHP6kv5Tptl6WdGCIOQZ/ g89SLVFUA0YXInquTqRdrdIP1Xo9EN8M593cVWL1ZjeouCaJVcZVRf79A3n6ETAL67Ws l1jexfWhrFeYX0C6iTmZVG/klpM1a1h4zlJ0ZzOgkgLFVTP958yS/tKQQ6jJPead1bQZ aVeVq40yl93p2YtTXLXpXRcQyQycgB4n+nRGpZ5LY7K6irM3RkvCYNOcEuRngPgA/2sS DC7A== X-Gm-Message-State: AFuF++nXU9S0qE+l6xvn/ob/DTFyZxJ8fh/Moh7KggJMFSU0xhBdbZMg vM/V1WggJwPbblN5o/ztBNplxhkkLEeNSGb6sy7jXS+6O7cGvc0DrotV7+o1Na7xSAS/PBbtd7X Fm/Mk/oxDLQJad6v38p93IwCItCQiNJlC8E1imMZBJPe8917KgiUuyMqgHRqnCFUJPA== X-Gm-Gg: AYBFou12MF491oaJ5515qA0t4q8Z4hhrgEwTJwShNnnoRBv9LBJxvx1beWW62+Svro3 2DY34SwWeZxJfgl/h03QyV+lqzM2hF5RS9va7lJVxt2093/X7Ohq75g2aSYxfIlmz79DEGfu5Fn 0pIIHrw3S2SkSUnFddPVFFmKNIrlAn5+APN7gnLKmS9WrEjmT5ITzzuBKkc6Fb/mD8uLlJpBeFt JYVfKnMufFqRfKJyq3/otrdCiizlTZUmXkvBJqBJyeHkHtrkJqSHHE0B/3t1Ae/mr4aEKrwaDmA qS9t2HqB01cFoqDaABo/hVqMr82kysX+EfdxmUfE/zc906CahqUUMs4UySLCUmDr/POYhdY5p3A zVOdxqM0+kJN+kWOb0Fo5M0MLc+af/+iVgOsp2/I= X-Received: by 2002:a05:6214:5bc1:b0:910:3453:d4a9 with SMTP id 6a1803df08f44-9123d7e90f5mr142571256d6.35.1789667060044; Thu, 17 Sep 2026 10:44:20 -0700 (PDT) X-Received: by 2002:a05:6214:5bc1:b0:910:3453:d4a9 with SMTP id 6a1803df08f44-9123d7e90f5mr142570506d6.35.1789667059286; Thu, 17 Sep 2026 10:44:19 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, andrew.jones@oss.qualcomm.com, leif.lindholm@oss.qualcomm.com, Daniel Henrique Barboza , Nutty Liu , Sunil V L , Paolo Bonzini , Palmer Dabbelt Subject: [PATCH v12 3/5] hw/riscv: server platform reference machine Date: Thu, 17 Sep 2026 14:44:02 -0300 Message-ID: <20260917174405.3471736-4-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> References: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfX55dCCuzxyPut DG5e35vhxMFRbsOlGB8cG1nXVwYCiGpSGdrvJrLy+RwQ3FfcHnXKM0/ppCU74qRk/rsFtvsO8W1 SnvUdLOT2NXHcViQ0TrCEvzGpn1JgC8= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfXyDqaWyl4nS5h 5xqgnc05U2ZADdMFz+0W+/MnnVyUKIUQAxKUQp4cbpjIoq7Fd6iCaTAHq5c61JeIKn3H+Of+0HQ cgbG4NE/e2T9jH/eeCHzZcKxJCN8+eMoDQEm/i9Nz5U20nUPUWk6cHuRzXH4S07Y6jYztVuhoDK TlmDfilXMKjmxs4m+nkzOn7GnD5Ogfy/HK7/sMUyrsMT92PS4NanfxQsFhSwD1cFQBeajwI4//F ZyNzy/jFLEu4s/dJIkEqe1vIO0iJ51biCOcDzqmM3O8X2PXtoZn9aVuYkst+tZF8lkfeFiZ+Y2Z lDGupMx3JpXWT+eyOTSMYIpB6dmdrG01zyC1Ittbxg5N78VyzlBctbpr6NCjQpR/rfV97MtCrcN o+WbfguMMeERwAr25tHkm+rzo2VJ/HGZDVhqxFUv2TEJcZgVAWr/bYwnyq7BIc7TveZBNZntw5t UVWIGp9FCo8cAPe0zPA== X-Authority-Analysis: v=2.4 cv=WL/qzXsR c=1 sm=1 tr=0 ts=6aac26f6 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=arNgJ3JLhM/z8Vk/iMOFgQ==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=NEAV23lmAAAA:8 a=NLiCwHATAAAA:8 a=EUspDBNiAAAA:8 a=69EAbJreAAAA:8 a=FRSEYCzRAAAA:8 a=9kP_nYF4JKOc7euzSxIA:9 a=dH7DIRxtVxPtt5gB:21 a=PEH46H7Ffwr30OY-TuGO:22 a=F9tHCgz3TLBaZgltkx5D:22 a=H4N_Y-AU75W7NKDNhZlT:22 X-Proofpoint-GUID: ovJ41P5mzstaYCNDGhS2kB5br7DES74Q X-Proofpoint-ORIG-GUID: ovJ41P5mzstaYCNDGhS2kB5br7DES74Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 bulkscore=0 phishscore=0 priorityscore=1501 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170253 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=daniel.barboza@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1789667112207158500 Content-Type: text/plain; charset="utf-8" The RISC-V Server Platform specification [1] defines a standardized set of hardware and software capabilities, that portable system software, such as OS and hypervisors can rely on being present in a RISC-V server platform. The main features included in this emulation are: - Based on riscv virt machine type; - A new memory map as close as virt machine as possible; - An always present IOMMU platform device (riscv-iommu-sys) that uses IRQs 36 to 39, one IRQ for queue, similar to the 'virt' board; - AIA; - No default AHCI (can be added via command line); - No default NIC (can be added via command line); - No virtio device; - No fw_cfg device; - No ACPI table provided; - Only minimal device tree nodes; - a platform bus for TPM support. A note about TPM support: TPM devices in QEMU comes usually in two flavors - emulated or passthrough. A passthrough device requires a host TPM device that the QEMU process can borrow and it's usually coupled with KVM acceleration. To use the TPM emulator we'll need help from an external TPM emulator called swtpm. More info can be found in [2]. For our purposes this is a process that, if running Ubuntu, can be installed via 'swtpm' package. We'll go back to it shortly. For now, adding support for the emulated TPM device 'tpm-tis' (other TPM flavors might work as well, 'tpm-tis' is the one tested with this work) requires a platform bus. Adding a platform bus will open the door for more devices to be added in the board. This is ok - a reference board isn't a restricted board and users are free to add devices at their leisure. Here's how to use tpm-tis with the riscv-server-ref board: - in a separated shell/term run 'swtpm' (--log is optional): $ mkdir /tmp/mytpm1 $ swtpm socket --tpmstate dir=3D/tmp/mytpm1 \ --ctrl type=3Dunixio,path=3D/tmp/mytpm1/swtpm-sock \ --tpm2 \ --log level=3D20 Then start QEMU with: $ qemu-system-riscv64 -M riscv-server-ref (...) \ -chardev socket,id=3Dchrtpm,path=3D/tmp/mytpm1/swtpm-sock \ -tpmdev emulator,id=3Dtpm0,chardev=3Dchrtpm\ -device tpm-tis-device,tpmdev=3Dtpm0 [1] https://github.com/riscv-non-isa/riscv-server-platform [2] https://qemu-project.gitlab.io/qemu/specs/tpm.html Signed-off-by: Daniel Henrique Barboza Reviewed-by: Nutty Liu Reviewed-by: Chao Liu Reviewed-by: Sunil V L --- configs/devices/riscv64-softmmu/default.mak | 1 + hw/riscv/Kconfig | 17 + hw/riscv/meson.build | 1 + hw/riscv/server_platform_ref.c | 776 ++++++++++++++++++++ 4 files changed, 795 insertions(+) create mode 100644 hw/riscv/server_platform_ref.c diff --git a/configs/devices/riscv64-softmmu/default.mak b/configs/devices/= riscv64-softmmu/default.mak index a8e4d0ab33..ae3f62e2d4 100644 --- a/configs/devices/riscv64-softmmu/default.mak +++ b/configs/devices/riscv64-softmmu/default.mak @@ -9,6 +9,7 @@ # CONFIG_SIFIVE_E=3Dn # CONFIG_SIFIVE_U=3Dn # CONFIG_RISCV_VIRT=3Dn +# CONFIG_RISCV_SERVER_PLATFORM_REF=3Dn # CONFIG_MICROCHIP_PFSOC=3Dn # CONFIG_SHAKTI_C=3Dn # CONFIG_XIANGSHAN_KUNMINGHU=3Dn diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig index d06ac26648..35b92dc395 100644 --- a/hw/riscv/Kconfig +++ b/hw/riscv/Kconfig @@ -69,6 +69,23 @@ config RISCV_VIRT select ACPI select ACPI_PCI =20 +config RISCV_SERVER_PLATFORM_REF + bool + default y + depends on RISCV64 + imply TPM_TIS_SYSBUS + select GOLDFISH_RTC + select PCI_EXPRESS_GENERIC_BRIDGE + select PCIE_DEVICES + select PFLASH_CFI01 + select PLATFORM_BUS + select RISCV_ACLINT + select RISCV_APLIC + select RISCV_IMSIC + select RISCV_IOMMU + select RISCV_NUMA + select SERIAL_MM + config SHAKTI_C bool default y diff --git a/hw/riscv/meson.build b/hw/riscv/meson.build index 7aa3c1578d..cc5a019f7c 100644 --- a/hw/riscv/meson.build +++ b/hw/riscv/meson.build @@ -7,6 +7,7 @@ riscv_ss.add(when: 'CONFIG_RISCV_NUMA', if_true: files('num= a.c')) riscv_ss.add(files('riscv_hart.c')) riscv_ss.add(when: 'CONFIG_OPENTITAN', if_true: files('opentitan.c')) riscv_ss.add(when: 'CONFIG_RISCV_VIRT', if_true: files('virt.c')) +riscv_ss.add(when: 'CONFIG_RISCV_SERVER_PLATFORM_REF', if_true: files('ser= ver_platform_ref.c')) riscv_ss.add(when: 'CONFIG_SHAKTI_C', if_true: files('shakti_c.c')) riscv_ss.add(when: 'CONFIG_SIFIVE_E', if_true: files('sifive_e.c')) riscv_ss.add(when: 'CONFIG_SIFIVE_U', if_true: files('sifive_u.c')) diff --git a/hw/riscv/server_platform_ref.c b/hw/riscv/server_platform_ref.c new file mode 100644 index 0000000000..5f485b1c79 --- /dev/null +++ b/hw/riscv/server_platform_ref.c @@ -0,0 +1,776 @@ +/* + * QEMU RISC-V Server Platform Reference Board (riscv-server-ref) + * + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "qemu/error-report.h" +#include "qemu/guest-random.h" +#include "qapi/error.h" +#include "qapi/qapi-visit-common.h" +#include "hw/core/boards.h" +#include "hw/core/platform-bus.h" +#include "hw/core/loader.h" +#include "hw/core/sysbus.h" +#include "hw/core/qdev-properties.h" +#include "hw/char/serial.h" +#include "hw/block/flash.h" +#include "hw/ide/pci.h" +#include "hw/ide/ahci-pci.h" +#include "hw/pci/pci.h" +#include "hw/pci-host/gpex.h" +#include "hw/core/sysbus-fdt.h" +#include "hw/riscv/riscv_hart.h" +#include "hw/riscv/boot.h" +#include "hw/riscv/device-common.h" +#include "hw/riscv/fdt-common.h" +#include "hw/riscv/numa.h" +#include "hw/riscv/iommu.h" +#include "hw/riscv/riscv-iommu.h" +#include "hw/riscv/riscv-iommu-bits.h" +#include "hw/intc/riscv_aclint.h" +#include "hw/intc/riscv_aplic.h" +#include "hw/intc/riscv_imsic.h" +#include "chardev/char.h" +#include "hw/char/serial-mm.h" +#include "system/device_tree.h" +#include "system/runstate.h" +#include "system/system.h" +#include "system/kvm.h" +#include "system/qtest.h" +#include "system/tcg.h" +#include "kvm/kvm_riscv.h" +#include "system/tpm.h" +#include "target/riscv/cpu.h" +#include "net/net.h" + +#include "aia.h" + +#define RVSERVER_ACLINT_TIMEBASE_FREQ 1000000000 /* 1Ghz */ +#define RVSERVER_CPUS_MAX_BITS 9 +#define RVSERVER_CPUS_MAX (1 << RVSERVER_CPUS_MAX_BIT= S) +#define RVSERVER_IRQCHIP_NUM_MSIS 255 +#define RVSERVER_IRQCHIP_NUM_SOURCES 96 +#define RVSERVER_IRQCHIP_NUM_PRIO_BITS 3 +#define RVSERVER_IRQCHIP_DEFAULT_AIA_GUESTS 5 +#define RVSERVER_IRQCHIP_MAX_GUESTS_BITS 3 +#define RVSERVER_IRQCHIP_MAX_GUESTS \ + ((1U << RVSERVER_IRQCHIP_MAX_GUESTS_BITS) - 1U) +#define RVSERVER_SOCKETS_MAX_BITS 2 +#define RVSERVER_SOCKETS_MAX (1 << RVSERVER_SOCKETS_MAX_= BITS) + +#define SYSCON_RESET 0x1 +#define SYSCON_POWEROFF 0x2 + +#define RVSERVER_PLATFORM_BUS_NUM_IRQS 8 + +#define TYPE_RISCV_SERVER_REF_MACHINE MACHINE_TYPE_NAME("riscv-server-ref") +OBJECT_DECLARE_SIMPLE_TYPE(RISCVServerRefMachineState, RISCV_SERVER_REF_MA= CHINE) + +struct RISCVServerRefMachineState { + /*< private >*/ + MachineState parent; + + /*< public >*/ + Notifier machine_done; + RISCVHartArrayState soc[RVSERVER_SOCKETS_MAX]; + DeviceState *irqchip[RVSERVER_SOCKETS_MAX]; + PFlashCFI01 *flash[2]; + + int fdt_size; + int aia_guests; + const MemMapEntry *memmap; + + DeviceState *platform_bus_dev; +}; + +enum { + RVSERVER_MROM, + RVSERVER_RESET_SYSCON, + RVSERVER_RTC, + RVSERVER_IOMMU_SYS, + RVSERVER_ACLINT, + RVSERVER_APLIC_M, + RVSERVER_APLIC_S, + RVSERVER_UART0, + RVSERVER_IMSIC_M, + RVSERVER_IMSIC_S, + RVSERVER_FLASH, + RVSERVER_DRAM, + RVSERVER_PCIE_MMIO, + RVSERVER_PCIE_PIO, + RVSERVER_PLATFORM_BUS, + RVSERVER_PCIE_ECAM, + RVSERVER_PCIE_MMIO_HIGH +}; + +enum { + RVSERVER_UART0_IRQ =3D 10, + RVSERVER_RTC_IRQ =3D 11, + RVSERVER_PCIE_IRQ =3D 32, /* 32 to 35 */ + IOMMU_SYS_IRQ =3D 36, /* 36 to 39 */ + RVSERVER_PLATFORM_BUS_IRQ =3D 40, /* 40 to 47 */ +}; + +/* + * The server soc reference machine physical address space used by some of= the + * devices namely ACLINT, APLIC and IMSIC depend on number of Sockets, num= ber + * of CPUs, and number of IMSIC guest files. + * + * Various limits defined by RVSERVER_SOCKETS_MAX_BITS, RVSERVER_CPUS_MAX_= BITS, + * and RVSERVER_IRQCHIP_MAX_GUESTS_BITS are tuned for maximum utilization = of + * server reference machine physical address space. + */ + +#define RVSERVER_IMSIC_GROUP_MAX_SIZE (1U << IMSIC_MMIO_GROUP_MIN_SHI= FT) +#if RVSERVER_IMSIC_GROUP_MAX_SIZE < \ + IMSIC_GROUP_SIZE(RVSERVER_CPUS_MAX_BITS, RVSERVER_IRQCHIP_MAX_GUESTS_B= ITS) +#error "Can't accommodate single IMSIC group in address space" +#endif + +#define RVSERVER_IMSIC_MAX_SIZE \ + (RVSERVER_SOCKETS_MAX * RVSERVER_IMSIC_GROUP_MAX_SIZE) +#if 0x4000000 < RVSERVER_IMSIC_MAX_SIZE +#error "Can't accommodate all IMSIC groups in address space" +#endif + +static const MemMapEntry rvserver_ref_memmap[] =3D { + [RVSERVER_MROM] =3D { 0x1000, 0xf000 }, + [RVSERVER_RESET_SYSCON] =3D { 0x100000, 0x1000 }, + [RVSERVER_RTC] =3D { 0x101000, 0x1000 }, + [RVSERVER_IOMMU_SYS] =3D { 0x102000, 0x1000 }, + [RVSERVER_ACLINT] =3D { 0x2000000, 0x10000 }, + [RVSERVER_PCIE_PIO] =3D { 0x3000000, 0x10000 }, + [RVSERVER_PLATFORM_BUS] =3D { 0x4000000, 0x2000000 }, + [RVSERVER_APLIC_M] =3D { 0xc000000, APLIC_SIZE(RVSERVER_CPUS_M= AX) }, + [RVSERVER_APLIC_S] =3D { 0xd000000, APLIC_SIZE(RVSERVER_CPUS_M= AX) }, + [RVSERVER_UART0] =3D { 0x10000000, 0x100 }, + [RVSERVER_FLASH] =3D { 0x20000000, 0x4000000 }, + [RVSERVER_IMSIC_M] =3D { 0x24000000, RVSERVER_IMSIC_MAX_SIZE }, + [RVSERVER_IMSIC_S] =3D { 0x28000000, RVSERVER_IMSIC_MAX_SIZE }, + [RVSERVER_PCIE_ECAM] =3D { 0x30000000, 0x10000000 }, + [RVSERVER_PCIE_MMIO] =3D { 0x40000000, 0x40000000 }, + [RVSERVER_DRAM] =3D { 0x80000000, 0xff80000000ull }, + [RVSERVER_PCIE_MMIO_HIGH] =3D { 0x10000000000ull, 0x10000000000ull }, +}; + +#define RVSERVER_FLASH_SECTOR_SIZE (256 * KiB) + +static void rvserver_flash_maps(RISCVServerRefMachineState *s, + MemoryRegion *sysmem) +{ + hwaddr flashsize =3D rvserver_ref_memmap[RVSERVER_FLASH].size / 2; + hwaddr flashbase =3D rvserver_ref_memmap[RVSERVER_FLASH].base; + + riscv_init_flash_map(s->flash[0], flashbase, flashsize, + sysmem, RVSERVER_FLASH_SECTOR_SIZE); + riscv_init_flash_map(s->flash[1], flashbase + flashsize, flashsize, + sysmem, RVSERVER_FLASH_SECTOR_SIZE); +} + +static void create_fdt_pmu(RISCVServerRefMachineState *s) +{ + g_autofree char *pmu_name =3D g_strdup_printf("/pmu"); + MachineState *ms =3D MACHINE(s); + RISCVCPU *hart =3D &s->soc[0].harts[0]; + + qemu_fdt_add_subnode(ms->fdt, pmu_name); + qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu"); + riscv_pmu_generate_fdt_node(ms->fdt, hart->pmu_avail_ctrs, pmu_name); +} + +static void create_fdt_sockets(RISCVServerRefMachineState *s, + const MemMapEntry *memmap, + uint32_t *phandle, + uint32_t *irq_mmio_phandle, + uint32_t *irq_pcie_phandle, + uint32_t *msi_pcie_phandle) +{ + int socket, phandle_pos; + MachineState *ms =3D MACHINE(s); + uint32_t msi_m_phandle =3D 0, msi_s_phandle =3D 0; + uint32_t xplic_phandles[MAX_NODES]; + g_autofree uint32_t *intc_phandles =3D NULL; + int socket_count =3D riscv_socket_count(ms); + bool numa_enabled =3D riscv_numa_enabled(ms); + bool is_32_bit =3D riscv_is_32bit(&s->soc[0]); + IMSICFdtProps imsic_fdt_props; + APLICFdtProps aplic_fdt_props; + ACLINTFdtProps aclint_props; + + riscv_fdt_create_cpu_socket_subnode(ms->fdt, + kvm_enabled() ? kvm_riscv_get_timebase_frequency(&s->soc->harts[0]) + : RVSERVER_ACLINT_TIMEBASE_FREQ); + + intc_phandles =3D g_new0(uint32_t, ms->smp.cpus); + + aclint_props.clint =3D &memmap[RVSERVER_ACLINT]; + aclint_props.aia_type =3D AIA_TYPE_APLIC_IMSIC; + aclint_props.numa_enabled =3D numa_enabled; + + phandle_pos =3D ms->smp.cpus; + for (socket =3D (socket_count - 1); socket >=3D 0; socket--) { + hwaddr memaddr =3D s->memmap[RVSERVER_DRAM].base + + riscv_socket_mem_offset(ms, socket); + uint64_t memsize =3D riscv_socket_mem_size(ms, socket); + + phandle_pos -=3D s->soc[socket].num_harts; + + riscv_create_fdt_socket_cpus(ms->fdt, (&s->soc[socket])->harts, so= cket, + s->soc[socket].num_harts, + s->soc[socket].hartid_base, + phandle, &intc_phandles[phandle_pos], + numa_enabled, is_32_bit); + + riscv_create_fdt_socket_memory(ms->fdt, memaddr, memsize, + socket, riscv_numa_enabled(ms)); + + aclint_props.socket =3D socket; + aclint_props.num_harts =3D s->soc[socket].num_harts; + riscv_create_fdt_socket_aclint(ms->fdt, &aclint_props, + &intc_phandles[phandle_pos]); + } + + imsic_fdt_props.soc =3D &s->soc; + imsic_fdt_props.socket_count =3D socket_count; + imsic_fdt_props.smp_cpus =3D ms->smp.cpus; + imsic_fdt_props.imsic_m_base =3D memmap[RVSERVER_IMSIC_M].base; + imsic_fdt_props.imsic_s_base =3D memmap[RVSERVER_IMSIC_S].base; + imsic_fdt_props.imsic_group_max_size =3D RVSERVER_IMSIC_GROUP_MAX_SIZE; + imsic_fdt_props.irqchip_num_msis =3D RVSERVER_IRQCHIP_NUM_MSIS; + imsic_fdt_props.aia_guests =3D s->aia_guests; + + riscv_create_fdt_imsic(ms->fdt, &imsic_fdt_props, phandle, intc_phandl= es, + &msi_m_phandle, &msi_s_phandle); + *msi_pcie_phandle =3D msi_s_phandle; + + aplic_fdt_props.aplic_m =3D !kvm_enabled() + ? &memmap[RVSERVER_APLIC_M] : NULL; + aplic_fdt_props.aplic_s =3D &memmap[RVSERVER_APLIC_S]; + aplic_fdt_props.platform_bus =3D &memmap[RVSERVER_PLATFORM_BUS]; + aplic_fdt_props.platform_bus_irq =3D RVSERVER_PLATFORM_BUS_IRQ; + aplic_fdt_props.num_harts =3D ms->smp.cpus; + aplic_fdt_props.numa_enabled =3D numa_enabled; + aplic_fdt_props.irqchip_num_sources =3D RVSERVER_IRQCHIP_NUM_SOURCES; + aplic_fdt_props.aia_type =3D AIA_TYPE_APLIC_IMSIC; + + phandle_pos =3D ms->smp.cpus; + for (socket =3D (socket_count - 1); socket >=3D 0; socket--) { + phandle_pos -=3D s->soc[socket].num_harts; + + aplic_fdt_props.socket =3D socket; + aplic_fdt_props.num_harts =3D s->soc[socket].num_harts; + riscv_create_fdt_socket_aplic(ms->fdt, &aplic_fdt_props, + msi_m_phandle, msi_s_phandle, phandl= e, + &intc_phandles[phandle_pos], + xplic_phandles); + } + + for (socket =3D 0; socket < socket_count; socket++) { + if (socket =3D=3D 0) { + *irq_mmio_phandle =3D xplic_phandles[socket]; + *irq_pcie_phandle =3D xplic_phandles[socket]; + } + if (socket =3D=3D 1) { + *irq_pcie_phandle =3D xplic_phandles[socket]; + } + } + + riscv_socket_fdt_write_distance_matrix(ms); +} + +static void finalize_fdt(RISCVServerRefMachineState *s) +{ + uint32_t phandle =3D 1, irq_mmio_phandle =3D 1, msi_pcie_phandle =3D 1; + uint32_t irq_pcie_phandle =3D 1, iommu_sys_phandle; + g_autofree char *name =3D NULL; + MachineState *ms =3D MACHINE(s); + + create_fdt_sockets(s, rvserver_ref_memmap, &phandle, &irq_mmio_phandle, + &irq_pcie_phandle, &msi_pcie_phandle); + + iommu_sys_phandle =3D riscv_create_fdt_riscv_iommu_sys(ms->fdt, + s->memmap[RVSERVER_IOMMU_SYS].bas= e, + s->memmap[RVSERVER_IOMMU_SYS].siz= e, + &phandle, irq_mmio_phandle, + msi_pcie_phandle, IOMMU_SYS_IRQ); + + riscv_create_fdt_pcie(ms->fdt, AIA_TYPE_APLIC_IMSIC, true, + &s->memmap[RVSERVER_PCIE_ECAM], + &s->memmap[RVSERVER_PCIE_PIO], + &s->memmap[RVSERVER_PCIE_MMIO], + &s->memmap[RVSERVER_PCIE_MMIO_HIGH], + irq_pcie_phandle, msi_pcie_phandle, + iommu_sys_phandle, RVSERVER_PCIE_IRQ); + + riscv_create_fdt_syscon(ms->fdt, &phandle, + rvserver_ref_memmap[RVSERVER_RESET_SYSCON].bas= e, + rvserver_ref_memmap[RVSERVER_RESET_SYSCON].siz= e, + SYSCON_RESET, SYSCON_POWEROFF, false); + + riscv_create_fdt_uart(ms->fdt, &rvserver_ref_memmap[RVSERVER_UART0], + RVSERVER_UART0_IRQ, AIA_TYPE_APLIC_IMSIC, + irq_mmio_phandle); + name =3D riscv_fdt_get_uart_nodename(rvserver_ref_memmap[RVSERVER_UART= 0].base); + qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", name); + qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", name); + + riscv_create_fdt_rtc(ms->fdt, &rvserver_ref_memmap[RVSERVER_RTC], + RVSERVER_RTC_IRQ, AIA_TYPE_APLIC_IMSIC, + irq_mmio_phandle); +} + +static void create_fdt(RISCVServerRefMachineState *s, + const MemMapEntry *memmap) +{ + MachineState *ms =3D MACHINE(s); + uint8_t rng_seed[32]; + g_autofree char *name =3D NULL; + + ms->fdt =3D riscv_create_board_device_tree(MACHINE_GET_CLASS(s)->desc, + "qemu,riscv-server-ref", + &s->fdt_size); + + /* + * This versioning scheme is for informing platform fw only. It is nei= ther: + * - A QEMU versioned machine type; a given version of QEMU will emula= te + * a given version of the platform. + * - A reflection of level of server platform support provided. + * + * machine-version-major: updated when changes breaking fw compatibili= ty + * are introduced. + * machine-version-minor: updated when features are added that don't b= reak + * fw compatibility. + * + * It's the same as the scheme in arm sbsa-ref. + */ + qemu_fdt_setprop_cell(ms->fdt, "/", "machine-version-major", 0); + qemu_fdt_setprop_cell(ms->fdt, "/", "machine-version-minor", 0); + + /* + * The "/soc/pci@..." node is needed for PCIE hotplugs + * that might happen before finalize_fdt(). + */ + name =3D g_strdup_printf("/soc/pci@%"HWADDR_PRIx, + s->memmap[RVSERVER_PCIE_ECAM].base); + qemu_fdt_add_subnode(ms->fdt, name); + + qemu_fdt_add_subnode(ms->fdt, "/chosen"); + qemu_fdt_add_subnode(ms->fdt, "/aliases"); + + /* Pass seed to RNG */ + qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed)); + qemu_fdt_setprop(ms->fdt, "/chosen", "rng-seed", + rng_seed, sizeof(rng_seed)); + + riscv_create_fdt_flash(ms->fdt, rvserver_ref_memmap[RVSERVER_FLASH].ba= se, + rvserver_ref_memmap[RVSERVER_FLASH].size / 2); + create_fdt_pmu(s); + +} + +static uint64_t rvserver_reset_syscon_read(void *opaque, hwaddr addr, + unsigned size) +{ + return 0; +} + +static void rvserver_reset_syscon_write(void *opaque, hwaddr addr, + uint64_t val64, unsigned int size) +{ + switch (val64) { + case SYSCON_POWEROFF: + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); + return; + case SYSCON_RESET: + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + return; + default: + break; + } +} + +static const MemoryRegionOps rvserver_reset_syscon_ops =3D { + .read =3D rvserver_reset_syscon_read, + .write =3D rvserver_reset_syscon_write, + .endianness =3D DEVICE_LITTLE_ENDIAN +}; + +static void rvserver_ref_machine_done(Notifier *notifier, void *data) +{ + RISCVServerRefMachineState *s =3D container_of( + notifier, RISCVServerRefMachineState, machine_done); + const MemMapEntry *memmap =3D rvserver_ref_memmap; + MachineState *machine =3D MACHINE(s); + hwaddr start_addr =3D memmap[RVSERVER_DRAM].base; + target_ulong firmware_end_addr, kernel_start_addr; + const char *firmware_name =3D riscv_default_firmware_name(&s->soc[0]); + uint64_t fdt_load_addr; + uint64_t kernel_entry =3D 0; + BlockBackend *pflash_blk0; + RISCVBootInfo boot_info; + + /* + * An user provided dtb must include everything, including + * dynamic sysbus devices. Our FDT needs to be finalized. + */ + if (machine->dtb =3D=3D NULL) { + finalize_fdt(s); + } + + riscv_boot_info_init(&boot_info, &s->soc[0]); + + firmware_end_addr =3D riscv_find_and_load_firmware(machine, &boot_info, + firmware_name, + &start_addr, NULL); + + pflash_blk0 =3D pflash_cfi01_get_blk(s->flash[0]); + if (pflash_blk0) { + if (machine->firmware && !strcmp(machine->firmware, "none")) { + /* + * Pflash was supplied but bios is none and not KVM guest, + * let's overwrite the address we jump to after reset to + * the base of the flash. + */ + start_addr =3D rvserver_ref_memmap[RVSERVER_FLASH].base; + } else { + /* + * Pflash was supplied but either KVM guest or bios is not non= e. + * In this case, base of the flash would contain S-mode payloa= d. + */ + riscv_setup_firmware_boot(machine); + kernel_entry =3D rvserver_ref_memmap[RVSERVER_FLASH].base; + } + } + + if (machine->kernel_filename && !kernel_entry) { + kernel_start_addr =3D riscv_calc_kernel_start_addr(&boot_info, + firmware_end_addr= ); + riscv_load_kernel(machine, &boot_info, kernel_start_addr, true, NU= LL); + kernel_entry =3D boot_info.image_low_addr; + } + + fdt_load_addr =3D riscv_compute_fdt_addr(memmap[RVSERVER_DRAM].base, + memmap[RVSERVER_DRAM].size, + machine, &boot_info); + + riscv_load_fdt(fdt_load_addr, machine->fdt); + + /* load the reset vector */ + riscv_setup_rom_reset_vec(machine, &s->soc[0], start_addr, + rvserver_ref_memmap[RVSERVER_MROM].base, + rvserver_ref_memmap[RVSERVER_MROM].size, + kernel_entry, + fdt_load_addr); +} + +static bool rvserver_aclint_allowed(void) +{ + return tcg_enabled() || qtest_enabled(); +} + +static void rvserver_ref_machine_init(MachineState *machine) +{ + const MemMapEntry *memmap =3D rvserver_ref_memmap; + RISCVServerRefMachineState *s =3D RISCV_SERVER_REF_MACHINE(machine); + MemoryRegion *system_memory =3D get_system_memory(); + MemoryRegion *mask_rom =3D g_new(MemoryRegion, 1); + MemoryRegion *reset_syscon_io =3D g_new(MemoryRegion, 1); + DeviceState *mmio_irqchip, *pcie_irqchip; + int i, base_hartid, hart_count; + int socket_count =3D riscv_socket_count(machine); + int imsic_bits; + + /* Check socket count limit */ + if (RVSERVER_SOCKETS_MAX < socket_count) { + error_report("number of sockets/nodes should be less than %d", + RVSERVER_SOCKETS_MAX); + exit(1); + } + + if (!rvserver_aclint_allowed()) { + error_report("'aclint' is only available with TCG acceleration"); + exit(1); + } + + s->memmap =3D rvserver_ref_memmap; + + /* + * We can't set aia_guests with 'qtest' because it'll skip the + * TCG exclusive init code, setting a blank CPU without RVH + * (among other things). If aia_guests is not zero we'll + * enter riscv_imsic_reset_enter(), which will reset its + * external irqs via qemu_irq_lower(), and qtest will hit an + * assert in riscv_cpu_set_irq() because we don't have RVH + * for handling guest local interrupts. + * + * qtest just want to inspect realized devices using QOM and + * HMP, so do not set aia_guests in that case. + */ + if (qtest_enabled()) { + s->aia_guests =3D 0; + } + + imsic_bits =3D imsic_num_bits(s->aia_guests + 1); + + /* Initialize sockets */ + mmio_irqchip =3D pcie_irqchip =3D NULL; + for (i =3D 0; i < socket_count; i++) { + g_autofree char *soc_name =3D g_strdup_printf("soc%d", i); + + if (!riscv_socket_check_hartids(machine, i)) { + error_report("discontinuous hartids in socket%d", i); + exit(1); + } + + base_hartid =3D riscv_socket_first_hartid(machine, i); + if (base_hartid < 0) { + error_report("can't find hartid base for socket%d", i); + exit(1); + } + + hart_count =3D riscv_socket_hart_count(machine, i); + if (hart_count < 0) { + error_report("can't find hart count for socket%d", i); + exit(1); + } + + object_initialize_child(OBJECT(machine), soc_name, &s->soc[i], + TYPE_RISCV_HART_ARRAY); + object_property_set_str(OBJECT(&s->soc[i]), "cpu-type", + machine->cpu_type, &error_abort); + object_property_set_int(OBJECT(&s->soc[i]), "hartid-base", + base_hartid, &error_abort); + object_property_set_int(OBJECT(&s->soc[i]), "num-harts", + hart_count, &error_abort); + sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal); + + /* Per-socket ACLINT MTIMER */ + riscv_aclint_mtimer_create(system_memory, + memmap[RVSERVER_ACLINT].base + i * RISCV_ACLINT_DEFAULT_MT= IMER_SIZE, + RISCV_ACLINT_DEFAULT_MTIMER_SIZE, + base_hartid, hart_count, + RISCV_ACLINT_DEFAULT_MTIMECMP, + RISCV_ACLINT_DEFAULT_MTIME, + RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true); + + /* Per-socket interrupt controller */ + s->irqchip[i] =3D riscv_create_aia(system_memory, true, s->aia_gue= sts, + IMSIC_HART_SIZE(0), + IMSIC_HART_SIZE(imsic_bits), + RVSERVER_IRQCHIP_NUM_SOURCES, + &s->memmap[RVSERVER_APLIC_M], + &s->memmap[RVSERVER_APLIC_S], + &s->memmap[RVSERVER_IMSIC_M], + &s->memmap[RVSERVER_IMSIC_S], + i, base_hartid, hart_count, + RVSERVER_IRQCHIP_NUM_MSIS, + RVSERVER_IRQCHIP_NUM_PRIO_BITS); + + /* Try to use different IRQCHIP instance based device type */ + if (i =3D=3D 0) { + mmio_irqchip =3D s->irqchip[i]; + pcie_irqchip =3D s->irqchip[i]; + } + if (i =3D=3D 1) { + pcie_irqchip =3D s->irqchip[i]; + } + } + + /* register system main memory (actual RAM) */ + memory_region_add_subregion(system_memory, memmap[RVSERVER_DRAM].base, + machine->ram); + + /* boot rom */ + memory_region_init_rom(mask_rom, NULL, "riscv_rvserver_ref_board.mrom", + memmap[RVSERVER_MROM].size, &error_fatal); + memory_region_add_subregion(system_memory, memmap[RVSERVER_MROM].base, + mask_rom); + + memory_region_init_io(reset_syscon_io, NULL, &rvserver_reset_syscon_op= s, + NULL, "reset_syscon_io", + memmap[RVSERVER_RESET_SYSCON].size); + memory_region_add_subregion(system_memory, + memmap[RVSERVER_RESET_SYSCON].base, + reset_syscon_io); + + riscv_gpex_pcie_init(system_memory, pcie_irqchip, + &rvserver_ref_memmap[RVSERVER_PCIE_ECAM], + &rvserver_ref_memmap[RVSERVER_PCIE_MMIO], + &rvserver_ref_memmap[RVSERVER_PCIE_MMIO_HIGH], + &rvserver_ref_memmap[RVSERVER_PCIE_PIO], + RVSERVER_PCIE_IRQ); + + s->platform_bus_dev =3D riscv_create_platform_bus(mmio_irqchip, + &s->memmap[RVSERVER_PL= ATFORM_BUS], + RVSERVER_PLATFORM_BUS_= IRQ, + RVSERVER_PLATFORM_BUS_= NUM_IRQS); + + serial_mm_init(system_memory, memmap[RVSERVER_UART0].base, + 0, qdev_get_gpio_in(mmio_irqchip, RVSERVER_UART0_IRQ), 399193, + serial_hd(0), DEVICE_LITTLE_ENDIAN); + + sysbus_create_simple("goldfish_rtc", memmap[RVSERVER_RTC].base, + qdev_get_gpio_in(mmio_irqchip, RVSERVER_RTC_IRQ)); + + for (i =3D 0; i < ARRAY_SIZE(s->flash); i++) { + /* Map legacy -drive if=3Dpflash to machine properties */ + pflash_cfi01_legacy_drive(s->flash[i], + drive_get(IF_PFLASH, 0, i)); + } + rvserver_flash_maps(s, system_memory); + + /* load/create device tree */ + if (machine->dtb) { + machine->fdt =3D load_device_tree(machine->dtb, &s->fdt_size); + if (!machine->fdt) { + error_report("load_device_tree() failed"); + exit(1); + } + } else { + create_fdt(s, memmap); + } + + riscv_create_iommu_sys(mmio_irqchip, s->memmap[RVSERVER_IOMMU_SYS].bas= e, + IOMMU_SYS_IRQ, false); + + s->machine_done.notify =3D rvserver_ref_machine_done; + qemu_add_machine_init_done_notifier(&s->machine_done); +} + +static void rvserver_ref_machine_instance_init(Object *obj) +{ + RISCVServerRefMachineState *s =3D RISCV_SERVER_REF_MACHINE(obj); + + s->flash[0] =3D riscv_flash_create(OBJECT(s), "riscv-server-ref.flash0= ", + "pflash0", RVSERVER_FLASH_SECTOR_SIZE= ); + s->flash[1] =3D riscv_flash_create(OBJECT(s), "riscv-server-ref.flash1= ", + "pflash1", RVSERVER_FLASH_SECTOR_SIZE= ); + + s->aia_guests =3D RVSERVER_IRQCHIP_DEFAULT_AIA_GUESTS; +} + +static void rvserver_ref_machine_instance_finalize(Object *obj) +{ + RISCVServerRefMachineState *s =3D RISCV_SERVER_REF_MACHINE(obj); + + for (int i =3D 0; i < ARRAY_SIZE(s->flash); i++) { + if (s->flash[i] && !qdev_is_realized(DEVICE(s->flash[i]))) { + object_unref(OBJECT(s->flash[i])); + } + } +} + +static char *rvserver_ref_get_aia_guests(Object *obj, Error **errp) +{ + RISCVServerRefMachineState *s =3D RISCV_SERVER_REF_MACHINE(obj); + char val[32]; + + sprintf(val, "%d", s->aia_guests); + return g_strdup(val); +} + +static void rvserver_ref_set_aia_guests(Object *obj, const char *val, + Error **errp) +{ + RISCVServerRefMachineState *s =3D RISCV_SERVER_REF_MACHINE(obj); + + s->aia_guests =3D atoi(val); + if (s->aia_guests < 0 || s->aia_guests > RVSERVER_IRQCHIP_MAX_GUESTS) { + error_setg(errp, "Invalid number of AIA IMSIC guests"); + error_append_hint(errp, "Valid values be between 0 and %d.\n", + RVSERVER_IRQCHIP_MAX_GUESTS); + } +} + +static const HotplugHandler * +rvserver_machine_get_hotplug_handler(MachineState *ms, DeviceState *dev) +{ + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + + if (device_is_dynamic_sysbus(mc, dev)) { + return HOTPLUG_HANDLER(ms); + } + + return NULL; +} + +static void rvserver_machine_device_plug_cb(const HotplugHandler *hotplug_= dev, + DeviceState *dev, Error **errp) +{ + RISCVServerRefMachineState *s =3D RISCV_SERVER_REF_MACHINE(hotplug_dev= ); + + if (s->platform_bus_dev) { + MachineClass *mc =3D MACHINE_GET_CLASS(s); + + if (device_is_dynamic_sysbus(mc, dev)) { + platform_bus_link_device(PLATFORM_BUS_DEVICE(s->platform_bus_d= ev), + SYS_BUS_DEVICE(dev)); + } + } +} + +static void rvserver_ref_machine_class_init(ObjectClass *oc, const void *d= ata) +{ + char str[128]; + MachineClass *mc =3D MACHINE_CLASS(oc); + HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); + static const char * const valid_cpu_types[] =3D { + TYPE_RISCV_CPU_RVSERVER_REF, + NULL + }; + + /* Note: this is used as /model in the FDT. */ + mc->desc =3D "RISC-V Server Platform Reference Board v1.0"; + mc->init =3D rvserver_ref_machine_init; + mc->max_cpus =3D RVSERVER_CPUS_MAX; + mc->default_cpu_type =3D TYPE_RISCV_CPU_RVSERVER_REF; + mc->valid_cpu_types =3D valid_cpu_types; + mc->pci_allow_0_address =3D true; + mc->default_nic =3D "e1000e"; + mc->possible_cpu_arch_ids =3D riscv_numa_possible_cpu_arch_ids; + mc->cpu_index_to_instance_props =3D riscv_numa_cpu_index_to_props; + mc->get_default_cpu_node_id =3D riscv_numa_get_default_cpu_node_id; + mc->numa_mem_supported =3D true; + /* platform instead of architectural choice */ + mc->cpu_cluster_has_numa_boundary =3D true; + mc->default_ram_id =3D "riscv_rvserver_ref_board.ram"; + + object_class_property_add_str(oc, "aia-guests", + rvserver_ref_get_aia_guests, + rvserver_ref_set_aia_guests); + sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid valu= e " + "should be between 0 and %d.", RVSERVER_IRQCHIP_MAX_GUEST= S); + object_class_property_set_description(oc, "aia-guests", str); + + assert(!mc->get_hotplug_handler); + mc->get_hotplug_handler =3D rvserver_machine_get_hotplug_handler; + hc->plug =3D rvserver_machine_device_plug_cb; +#ifdef CONFIG_TPM + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); +#endif +} + +static const TypeInfo rvserver_ref_typeinfo =3D { + .name =3D TYPE_RISCV_SERVER_REF_MACHINE, + .parent =3D TYPE_MACHINE, + .class_init =3D rvserver_ref_machine_class_init, + .instance_init =3D rvserver_ref_machine_instance_init, + .instance_finalize =3D rvserver_ref_machine_instance_finalize, + .instance_size =3D sizeof(RISCVServerRefMachineState), + .interfaces =3D (const InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + }, +}; + +static void rvserver_ref_init_register_types(void) +{ + type_register_static(&rvserver_ref_typeinfo); +} + +type_init(rvserver_ref_init_register_types) --=20 2.43.0 From nobody Sat Sep 26 20:01:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1789667154; cv=none; d=zohomail.com; s=zohoarc; b=f4e4+tMYBga8lM6CmLOOVBBU/Zo+IGwTC/8kPIr5Esr6oYQinivZxb4cCGVJM8YV5g3nYRawzo/RHzDAgliOalvdxesANNBcP3wa8pFDu1VZNUnM5yKtZ/t8idSp6J0lZGaQNmZV/K4adaJUsya7Kn7ZhrXnqojVGYs9GpOmQds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789667154; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qVPDT80RNxahzZkfl9aXFi7EzawTflhGPhX2B9euNrY=; b=oLnNn6YR+so2exbVbz8yy+Xe2Cr8iFdxbvIGyUwZo7mfZa6VSaDCwSucNZ2pOFwZwwREdZx7PR+bbufNaYJrnuZ+0ernqjwvUPelqyLbIgwooq7ajTxYSpV6szUHkhKACK5bZ9/Nn12OpyB1Ds4Nbe7fGKTfd4F2Z1XE6Ekq/rw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789667154883681.8477701439493; Thu, 17 Sep 2026 10:45:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7GA3-0002jN-LW; Thu, 17 Sep 2026 13:44:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9t-0002VW-Vw for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:30 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9q-0001bw-Ge for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:29 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH5W0l1765990 for ; Thu, 17 Sep 2026 17:44:24 GMT Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4grcraajtn-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 17:44:24 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-9124b265371so19426186d6.0 for ; Thu, 17 Sep 2026 10:44:23 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([189.110.107.170]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91252c56d73sm3118136d6.13.2026.09.17.10.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 10:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=qVPDT80RNxa hzZkfl9aXFi7EzawTflhGPhX2B9euNrY=; b=E2JQUmIUr0/Bq7zcjgpcCNgj/X7 UGqzEDn01gAv2mbWt2svpkulb2IpAj2zZ6Eyt+xwOU9hx4OVZZU0SxW8dPrsVu8q HrLp60PeUc0uV+bCTHS8FTA/9mYBKa0GFwDhOCerav/jn2IsB6QZgGmRw8cIE69x vl6ji6zr2yih42zHw2trbRaJi+gWAQBUvhe2/9FTcU+v3wqlDRzpjSHabrqgD/Zw nIKVTGKKoxMIr9vGVaa2adqo1gV/JUjjYe18ZdQ3ZZcjGDRD2g8BSlwHY3ZcbcH7 1MZbetOSgALJQFnuV0RUGeYhO1YQZfXNQ48r2vqRqF2+Xtk8HcClS780t7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789667063; x=1790271863; 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:content-type; bh=qVPDT80RNxahzZkfl9aXFi7EzawTflhGPhX2B9euNrY=; b=fkKuCVi25bY0nRCxRMW5ANBMwKvDA1RyECWlV2Jof494pvQS1CT/LKCzCsQrns7bDg 7U5JEImNa3HQZRUsox1m876h8oMmXpVoSVd8nobet84WZSgjRGJEIZ6G22Nq/OkAmVuS TVAWE2u6aHSgH3Ro6t937FzrehREa2xdEHtnZr4SkvKJIedEoqzK9xGea/osPm3Ya5kT V9emC4gW+38I7rl2L92YSWQ4eC8zzn95omLGnd/xgcOouy1drhOsJcl/aPqdVuyKJUqW 9QgkyuHlbgwNdnVDY+elPRr+rXbdJG0hba/FuNHCbHRQdvdlQluuBRc6eIBCzegoCcxp 9pUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789667063; x=1790271863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=qVPDT80RNxahzZkfl9aXFi7EzawTflhGPhX2B9euNrY=; b=1DCXEh2TXZ6SpLWQZt4VvvvTwIRDFf1DRNhWseD//jAdMofOcHdm2snOlZ+Qs4WYRE btG+SPvZGRfxvbk9SvgKG23n+Jy2w+1VSpNEg6j2wHSX8OoNZRJbRupsQC5kmLMYjRFw 1oALqskAEjgQlgG3kx43ObOB4uw3u7ZjDx83iWS8LOZezCtiWXa/KsZ8+6eBVf2H3QoH jSF/9GCdic4A1ThnfvgAoodOLPFdWmIWfkP16IITpLRo5CrXS3Nmv92qKbBlcoYW3zvn saCYODU+l4/I2ovSea1KB8+4emADS+fITVvp0qq/Au2QsIygVayV2kHrtlTUXZhyDylO kmvg== X-Gm-Message-State: AFuF++lzqLUj8oHzQZ08/UXFdIk9VD2p5uRIH9mLyI0F3m458iUGZB/I k8MS0mX5dvbrJdlJxTj6O1MPIfcsScXEURr30tPutP7aNv4OILRZ5RCSuzSrpPFyqumixIZ5wpY iu76NDOiDs93XZltzNRj2fM1XrhMH2Gva+UN4z2Wk3i/MyDqP5JDAkLeNpU7jQqi4UQ== X-Gm-Gg: AYBFou3ejm/lYHIlakl3K5ECfmQxaZw2AcWux7LDGzu/+dsI0KQ+LRnYFRhCTt8glwa 80arjRnYUNNi1aEwIfG5eXYBSTxMLKYiHV+pEaXqgdf9Is5hxUUu+GZllu7Nx4oqWFsgT1VQrxn UrHTPIQOx4hAzOcTjyKtutVk5PH7qb0H4Z8UpJPWlStBHNbL7+SOPvCgv2gq8Tt0iiCwFtPh+xI V3K29OedVxV5yR4mZgI+BnpBacHl9/mEdAUf9aaRXsCqDgBt532GLT144dBgPQNjQtOFbtjNWhh zQkfM2bMg6AQBBBXbj7d5gdJeuxUJVfK3p6A2mZZAHbJnEpWF/VoMQrT5rNUo2HTxC3mxd2bMN1 hf4x9JjwTh2ZYRIwHNfe9U/0JHGZ7NCmKKgzORYM= X-Received: by 2002:a05:6214:248f:b0:90e:939f:70bf with SMTP id 6a1803df08f44-9123d7314bamr134563306d6.15.1789667063013; Thu, 17 Sep 2026 10:44:23 -0700 (PDT) X-Received: by 2002:a05:6214:248f:b0:90e:939f:70bf with SMTP id 6a1803df08f44-9123d7314bamr134562736d6.15.1789667062470; Thu, 17 Sep 2026 10:44:22 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, andrew.jones@oss.qualcomm.com, leif.lindholm@oss.qualcomm.com, Daniel Henrique Barboza , Chao Liu , Nutty Liu , Sunil V L , Palmer Dabbelt Subject: [PATCH v12 4/5] tests/functional/riscv64: add riscv-server-ref tests Date: Thu, 17 Sep 2026 14:44:03 -0300 Message-ID: <20260917174405.3471736-5-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> References: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfX94SpmeYRbtbs eZsy94kKlgLD/jRbAlBZ6aL/nKDASQ1qfcYVduxGZutDJEQ26gUzNi+I+934W3PX8U2SBDAZPvz cyBjXb49a2bBTEsTy1SAwBxaGoy1OVc= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfX0FatoLBlGrEe +HW09bkWSUQMPzbTE9Q5Slb8oqBa1Apz2n4dzWCHDNQHBe26ztfWjZ7c36g24oUU3UPchYsn7AB 31VF6ghGn4cLvZ5zdkIMJhgbJkp+aQwpXAm7vOd7q0r8F+EftB13kvFwqZXsLgJNjedSgo9v8mu 5ZW4Vsi/Bus7bj/lgmCHG2MSjEHmpAGxQ5W4sWas/XJ5uP5hfJS9b4cXWE/hDm1Mqp0RHBExL9y FeAbMIC1VLkM/HwY5ny0PIsZyP9FYpB2k6YBKxMDtTOMUAMHXFxcTN5s7GZdJaluvHZf6XmlXs/ 8SZEmTIOEootPWlirVm7qzi6s7UDtUrY4PmR8kTc6hBkxVADxNCmDzWF0R0FB1dasu/gA/pWfFZ g0QdiXCGncMJ+t55BH2acoAg7JEDTk3VEHwOyNof+S5gU9G86tWt6k/naB9Q5NqTMxIUAOKqzjD SoiBe60ABEmWd7nqdvA== X-Authority-Analysis: v=2.4 cv=WL/qzXsR c=1 sm=1 tr=0 ts=6aac26f8 cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=arNgJ3JLhM/z8Vk/iMOFgQ==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=NEAV23lmAAAA:8 a=EUspDBNiAAAA:8 a=pGLkceISAAAA:8 a=69EAbJreAAAA:8 a=JF9118EUAAAA:8 a=QOu4sXKRH9_VvCpQA3IA:9 a=pJ04lnu7RYOZP9TFuWaZ:22 a=xVlTc564ipvMDusKsbsT:22 X-Proofpoint-GUID: ApNymGpkt1igIjJUK7pNHdmZySjrFAFy X-Proofpoint-ORIG-GUID: ApNymGpkt1igIjJUK7pNHdmZySjrFAFy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 bulkscore=0 phishscore=0 priorityscore=1501 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170253 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=daniel.barboza@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1789667156126158500 Content-Type: text/plain; charset="utf-8" Add tests for the recently added riscv-server-ref machine: - a new test_opensbi.py test. The idea is to have a quick test that can catch trivial regressions that would prevent OpenSBI to finish; - a new Linux boot "thorough" test that will boot the machine up to the buildroot prompt. - a TPM specific selftest for the riscv-server-ref board. The test will be skipped if there's no 'swtpm' in the host. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Chao Liu Reviewed-by: Nutty Liu Reviewed-by: Alistair Francis Reviewed-by: Sunil V L --- tests/functional/riscv64/meson.build | 2 + tests/functional/riscv64/test_opensbi.py | 4 + tests/functional/riscv64/test_server_ref.py | 90 +++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100755 tests/functional/riscv64/test_server_ref.py diff --git a/tests/functional/riscv64/meson.build b/tests/functional/riscv6= 4/meson.build index d1a3e6c2bf..2d22e49efd 100644 --- a/tests/functional/riscv64/meson.build +++ b/tests/functional/riscv64/meson.build @@ -3,6 +3,7 @@ test_riscv64_timeouts =3D { 'boston' : 120, 'k230' : 120, + 'server_ref' : 120, 'tuxrun' : 120, } =20 @@ -15,6 +16,7 @@ tests_riscv64_system_thorough =3D [ 'endianness', 'boston', 'k230', + 'server_ref', 'sifive_u', 'tt_atlantis', 'tuxrun', diff --git a/tests/functional/riscv64/test_opensbi.py b/tests/functional/ri= scv64/test_opensbi.py index 0f8beb7e7a..367e131164 100755 --- a/tests/functional/riscv64/test_opensbi.py +++ b/tests/functional/riscv64/test_opensbi.py @@ -36,5 +36,9 @@ def test_riscv_virt(self): self.set_machine('virt') self.boot_opensbi() =20 + def test_riscv_server_ref(self): + self.set_machine('riscv-server-ref') + self.boot_opensbi() + if __name__ =3D=3D '__main__': QemuSystemTest.main() diff --git a/tests/functional/riscv64/test_server_ref.py b/tests/functional= /riscv64/test_server_ref.py new file mode 100755 index 0000000000..ad29094dbe --- /dev/null +++ b/tests/functional/riscv64/test_server_ref.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +# +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +""" +riscv-server-ref board test +""" + +import os +import tempfile +import subprocess + +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test import skipIfMissingCommands + +class RiscvServerRefTest(QemuSystemTest): + """ + Test the riscv-server-ref board + """ + + ASSET_KERNEL =3D Asset( + ('https://github.com/danielhb/qemu-machine-boot/raw/refs/heads/' + 'master/riscv/images/virt64/buildroot/Image'), + '6bacc876c769c1bb6057d2bf549eba67fbe83916e8223f9fe21c8e8fff665a36') + + ASSET_ROOTFS =3D Asset( + ('https://github.com/danielhb/qemu-machine-boot/raw/refs/heads/' + 'master/riscv/images/virt64/buildroot/rootfs.ext2'), + 'f00bb88749f945d80675540a1338bd1ccb226574685a5b6c65ab44027d0411a8') + + def do_test_boot_linux_test(self, tpmstate_dir=3DNone): + self.set_machine('riscv-server-ref') + kernel_path =3D self.ASSET_KERNEL.fetch() + rootfs_path =3D self.ASSET_ROOTFS.fetch() + + self.vm.add_args('-kernel', kernel_path) + self.vm.add_args('-append', 'rw rootwait root=3D/dev/sda') + self.vm.add_args('-drive', + f'file=3D{rootfs_path},format=3Draw,id=3Dhd0,snapshot=3Don,if= =3Dnone') + self.vm.add_args('-device', 'ich9-ahci,id=3Dahci0') + self.vm.add_args('-device', 'ide-hd,drive=3Dhd0,bus=3Dahci0.0') + self.vm.add_args('-netdev', 'user,id=3Dnet0') + self.vm.add_args('-device', 'e1000e,netdev=3Dnet0') + + if tpmstate_dir is not None: + # Note: code taken verbatim from + # tests/functional/arm/test_aspeed_ast2600_buildroot_tpm.py + + # We must put the TPM state dir in /tmp/, not the build dir, + # because some distros use AppArmor to lock down swtpm and + # restrict the set of locations it can access files in. + socket =3D os.path.join(tpmstate_dir, 'swtpm-socket') + subprocess.run(['swtpm', 'socket', '-d', '--tpm2', + '--tpmstate', f'dir=3D{tpmstate_dir}', + '--ctrl', f'type=3Dunixio,path=3D{socket}'], + check=3DTrue) + self.vm.add_args('-chardev', f'socket,id=3Dchrtpm,path=3D{sock= et}') + self.vm.add_args('-tpmdev', 'emulator,id=3Dtpm0,chardev=3Dchrt= pm') + self.vm.add_args('-device', 'tpm-tis-device,tpmdev=3Dtpm0') + + self.vm.set_console() + self.vm.launch() + + # Wait for OpenSBI + wait_for_console_pattern(self, 'OpenSBI') + + # Wait for Linux kernel boot + wait_for_console_pattern(self, 'Linux version') + wait_for_console_pattern(self, 'Machine model: RISC-V Server Platf= orm') + + # Test e1000e network card functionality + wait_for_console_pattern(self, 'e1000e') + wait_for_console_pattern(self, 'Network Connection') + + # Wait for boot to complete - system reaches login prompt + wait_for_console_pattern(self, 'Run /sbin/init as init process') + + def test_boot_linux_test(self): + self.do_test_boot_linux_test() + + @skipIfMissingCommands('swtpm') + def test_boot_linux_test_tpm(self): + with tempfile.TemporaryDirectory(prefix=3D"qemu_") as tpmstate_dir: + self.do_test_boot_linux_test(tpmstate_dir) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.43.0 From nobody Sat Sep 26 20:01:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1789667109; cv=none; d=zohomail.com; s=zohoarc; b=POOTl+FQ3ADdcEQH21nz4V/9+WOz/3brULnXR3BAndvPaBEZxLPJ1JjSUPMc4Ur5XF8Kr0VDKWg5m2OcUwhpt3lDduCsi8KtwjxytJHmxnXBbpIBY0gh5fJJiIxZ0wO7Fn5pl0h2wT+XcE/pRagxrvUbhLfVQba0qQqK3aDynZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789667109; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5eqYTfBKOirTS9eXS4TiUYrdpCM/GvUswkHwyrvqV4k=; b=VCdyFqnq8ywD+X/jFGQw904eqGBI890He3FH4y5Fho/boveIl7DoB3/OzmLXC/2fEiwF0iVae4HAcTI0kG30XmTaC93xQDabl+y7ZJk3XDWQnQdjepkNj6nyfPo45iDabI6yuhAKkpW6u8oL5izDKLFFXcJ70kn4TGSGIiY8m1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789667109672869.8144507877169; Thu, 17 Sep 2026 10:45:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7G9z-0002es-Nn; Thu, 17 Sep 2026 13:44:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9x-0002aL-3B for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:33 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7G9u-0001cz-PE for qemu-devel@nongnu.org; Thu, 17 Sep 2026 13:44:32 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH5eM62413176 for ; Thu, 17 Sep 2026 17:44:29 GMT Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4grgu5hckr-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 17:44:28 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-9104ba8bf51so30214986d6.3 for ; Thu, 17 Sep 2026 10:44:28 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([189.110.107.170]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91252c56d73sm3118136d6.13.2026.09.17.10.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 10:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=5eqYTfBKOir TS9eXS4TiUYrdpCM/GvUswkHwyrvqV4k=; b=B9KJMARl6igARaBlYVLdMoXhr6W 2mNKzYmiH4GAuOc+yDx2usJh2EhTb2+yn7LxBOkWRzPpekSWhE8gWNqUHZMVAjk/ zULZOcXZpASL14jdDocVdsuTUn9Q25BzEGx6MWr6CfJ21qCWUMLd3lR4TYm/qg90 9HYttGlghRnSXiUx88DYJSGbG6XIATO7zU0leXVNBRd6K1nVe9Ry2vu+knIibJ5A JiRPUSw2lP49vlp/6+1sEGzknMATJmoEtQ0WvT7tsI8/1K745dmanqyBSTf+Atnt 2R18tYgnKn8ainZAuq6CQtixBBRXbHkJBjPUid8w4UtmFWdCmM6a0HjwShw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789667066; x=1790271866; 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:content-type; bh=5eqYTfBKOirTS9eXS4TiUYrdpCM/GvUswkHwyrvqV4k=; b=b9hzT0GMvtjL1PQSD8uWRCTdf90l94GvjUptL4SzQtL990uUuo4vwzH4dq1G2+8y9X iY76CSAFJST+oy9Oo0cWg4F1RlonDGDpC8eMFpCw5PU7f6tiosJKUOzWztFzxDmhLDzR Js1jf9LtOwFhXQoSiH4CxKruy3Gxe9bifr+PGNbJZQCloBe48dyGsyQUu/KoLYEYgevS 1wR2hy6kBQvqI02HVIvWly2KpL7H/i+vCgJxPATIqoTa//nD4lDi31sODmzE3CPQi+ma qW8LHRFaleaFP7it+UepX56IYBH+Kah7Os2YNMpopN3dbO5yWjgHIyvs5EXLzRjntmpH YHZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789667066; x=1790271866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=5eqYTfBKOirTS9eXS4TiUYrdpCM/GvUswkHwyrvqV4k=; b=ixyLQVYARFInisMPHe/gQ9O3ZxsoNbuV7ngRI03HottUfIDrlzT67XFw5J990+WnOl pNFZvXEKxTfLhglnAq0M2BRT1v0iPK+Qv+FYuwwDfvaweVr2SXTjyMMco02GIuTWKQjH zmGtsKb3Z/ydoPxQL7q/eOkJ37bqOi0zYE4QLncSoRtGoX6v3njKGbZe+U14MyUEW2X4 55AiI4te1qOOsjU+4F5TRY3UI7yRGdfiZvhtkUpJ1wt6qdIO13bNCEY/KbY6A+0SaYNt jUVONTfNlVF5rtpVCbEDPHANxcL3nxtf8i/D15YjcAbf+R8y+YHxV7QomzE2J5V4W3tc HBbg== X-Gm-Message-State: AFuF++nFVaXKfGav+QPzyRh4oGBmGVYO4aVp9VAd6MtkfgzHgQ0exFeX JCPm5sUeMjR05HGHRQH7NBrJbw9+JUB+OMKL8eKsuDMh6nnE6XPO7XgRhb3OxYnc4ukTxYkSi+Q foUYI9e+5bORq5afBVwRtco1RyT7DL83oV1wIO+smgjjBT2mCzxQoKIaJ1Vixawu3yw== X-Gm-Gg: AYBFou03LbzK915bWsTxSF5QMYdAV7LHqkhDuO3dZ2rQpRyPAHKEocHZuI0kuEeOfpO 7EWB2BZjzx7HXAtUECzXYQcdmLbqUluL8Q/17uaWv+binYT088mmL2CXgE7xOeM1kCyDLZildxF u2QWQ96iBPkZpgAh+DA661dDkoXAThoaWWQD3X3RQQ0kTYVMA1z/twZIOqYbTA1OaKxlWWVI6WF OYxZfQaUSkE2nmYZa1GEfbDMCwxhNed6OZzkNzT3bC69tjyk0lTPTB+I/xvb0hSURn1qFHdq4u2 WF3VjHeD/7+D+EAm0U8mx5YMjJoGbfVMa4PU38KlnDIVKLlyHyJFbw8MyxepAz4gb3T4Jt4FYZK 7ipLIQDKV81/NbpB+EMPUuSipSW3mYZAWloXONa8= X-Received: by 2002:a05:6214:1249:b0:912:517b:847 with SMTP id 6a1803df08f44-912517b0b18mr27603326d6.43.1789667066045; Thu, 17 Sep 2026 10:44:26 -0700 (PDT) X-Received: by 2002:a05:6214:1249:b0:912:517b:847 with SMTP id 6a1803df08f44-912517b0b18mr27602696d6.43.1789667065497; Thu, 17 Sep 2026 10:44:25 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, andrew.jones@oss.qualcomm.com, leif.lindholm@oss.qualcomm.com, Daniel Henrique Barboza , Sunil V L , Pierrick Bouvier , Palmer Dabbelt Subject: [PATCH v12 5/5] docs: add riscv-server-ref.rst Date: Thu, 17 Sep 2026 14:44:04 -0300 Message-ID: <20260917174405.3471736-6-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> References: <20260917174405.3471736-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfX6fpsV1bWjYiX mm6BI+NWCPC10HwtGdQDckFEquftwdtjaSjdgI0kP7PEDPpo19YJimFMXWQFP0CP2PzQivBUmna zgo8Eb3hY+n7KLB7Z59cvfHDXpRJ99g= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI1MyBTYWx0ZWRfX/tckxxNeUKUV VAbT+629mEhIwn6fWXfWz4+BKv6zqLyb83eKvi1bk0o3USNrvlJdBPhVlUuHTCevFz9VW87v1pz teXBZl6oz5cuLB+iEv6nSjJoFM4lFD1tBpllc4qm0/MmCb6k+MIpX46xdjn+Dk3IAmBdkyjIpV3 wN7Ce8axrxOcoWPXABalsXCFFpJz4ofxRu2crNjUVuJ/h7Rl8rdrp3JDR5LTERrv4RwPA5CErsB 5z1ckUL+zXxiDNBLK9Dg4YlDGeIbPjc2MuGIJ644lDs19agPvXS+P0dDsfMJaSBtOiMFflODEIz AddEsl2a9oHXChR38bzbul8Y0L9rklD0nLtTqvB/xciP8fxtOOcDSZC0Aiq05MxA/rc1BZ3kJP7 pGgIq98t9YUfSRtPXfGhR2+G+TtEkHDtJRPeClrZGf3HWQpzf5K2g6qlJAX8TYYxvuu4Epa0BN0 aNgM/PIpc9MPhYBi/qw== X-Proofpoint-GUID: oGQOvsDNw-7on7F4mlZLx7JRvcreMxH6 X-Authority-Analysis: v=2.4 cv=GvbXaU1C c=1 sm=1 tr=0 ts=6aac26fd cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=arNgJ3JLhM/z8Vk/iMOFgQ==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=NEAV23lmAAAA:8 a=NLiCwHATAAAA:8 a=EUspDBNiAAAA:8 a=JF9118EUAAAA:8 a=FRSEYCzRAAAA:8 a=vlmih187C6Ts2ntwv5oA:9 a=pJ04lnu7RYOZP9TFuWaZ:22 a=F9tHCgz3TLBaZgltkx5D:22 a=xVlTc564ipvMDusKsbsT:22 a=H4N_Y-AU75W7NKDNhZlT:22 X-Proofpoint-ORIG-GUID: oGQOvsDNw-7on7F4mlZLx7JRvcreMxH6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 spamscore=0 impostorscore=0 bulkscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170253 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=daniel.barboza@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1789667112081158500 Content-Type: text/plain; charset="utf-8" Add documentation for the new riscv-server-ref board. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Chao Liu Reviewed-by: Sunil V L --- docs/system/riscv/riscv-server-ref.rst | 64 ++++++++++++++++++++++++++ docs/system/target-riscv.rst | 1 + 2 files changed, 65 insertions(+) create mode 100644 docs/system/riscv/riscv-server-ref.rst diff --git a/docs/system/riscv/riscv-server-ref.rst b/docs/system/riscv/ris= cv-server-ref.rst new file mode 100644 index 0000000000..5b23122f19 --- /dev/null +++ b/docs/system/riscv/riscv-server-ref.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +RISC-V Server Platform Reference board (``riscv-server-ref``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The RISC-V Server Platform specification `spec`_ defines a standardized +set of hardware and software capabilities that portable system software, +such as OS and hypervisors, can rely on being present in a RISC-V server +platform. This machine aims to emulate this specification, providing +an environment for firmware/OS development and testing. + +`spec`_ is version 1.0 at the introduction of this board. For each new +supported spec version a new versioned board will be added, keeping +"riscv-server-ref" as an alias for the newest version supported. E.g. +for spec version 2.0: + +* riscv-server-ref-1.0 - board that complies with spec version 1.0 +* riscv-server-ref-2.0 - board that complies with spec version 2.0 +* riscv-server-ref - alias for riscv-server-ref-2.0 + +The main features included in the riscv-server-ref board are: + +* IOMMU platform device (riscv-iommu-sys) +* AIA +* No AHCI (can be added via command line) +* No NIC (can be added via command line) +* No virtio mmio bus +* No fw_cfg device +* No ACPI table +* Minimal device tree nodes + +There are multiple ways of using this reference board. The spec compliant= way +is using an EDK2 image and a TPM device. The board was tested with the TPM +device ``tpm-tis`` that uses the external ``swtpm`` emulator. More info o= n how +to use this device can be found in `tpm`_. + +To use this board coupled with the tpm-tis device, first start the ``swtpm= `` +process in a shell (the ``log`` parameter is optional): + +.. code-block:: bash + + $ mkdir /tmp/mytpm1 + $ swtpm socket --tpmstate dir=3D/tmp/mytpm1 \ + --ctrl type=3Dunixio,path=3D/tmp/mytpm1/swtpm-sock \ + --tpm2 \ + --log level=3D20 + +And then start QEMU with: + +.. code-block:: bash + + qemu-system-riscv64 -M riscv-server-ref \ + -bios fw_dynamic.bin \ + -kernel EDK2.fd \ + -drive file=3Dnvme_disk.ext2,format=3Draw,id=3Dhd0,if=3Dnone \ + -device nvme,drive=3Dhd0,serial=3Dddaaddaa \ + -chardev socket,id=3Dchrtpm,path=3D/tmp/mytpm1/swtpm-sock \ + -tpmdev emulator,id=3Dtpm0,chardev=3Dchrtpm \ + -device tpm-tis-device,tpmdev=3Dtpm0 \ + -nographic + + +.. _spec: https://github.com/riscv-non-isa/riscv-server-platform +.. _tpm: https://qemu-project.gitlab.io/qemu/specs/tpm.html diff --git a/docs/system/target-riscv.rst b/docs/system/target-riscv.rst index 2639866a3e..74e23fa64c 100644 --- a/docs/system/target-riscv.rst +++ b/docs/system/target-riscv.rst @@ -70,6 +70,7 @@ undocumented; you can get a complete list by running riscv/microblaze-v-generic riscv/microchip-icicle-kit riscv/mips + riscv/riscv-server-ref riscv/shakti-c riscv/sifive_u riscv/tt_atlantis --=20 2.43.0