From nobody Sat Sep 26 20:51:01 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=1788460331; cv=none; d=zohomail.com; s=zohoarc; b=WhwgaQcnYf8NNiAS8dDEP36K3lcqfXWa+uFy5GqIihFjarr2rOp39yGoeHDgszD09DcwjpEkRh6nHjsOjoKQkZYssRXnULZk+A9l5vYLS3/SrXQBSCf4g4+8sJ3XPvIXfGMdOhfoR2vXlNp6e/oBRvojPPdVlbEn2zB1x5jkovI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788460331; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g6MdE8Fv+0cxX31f8S+L77/tz/VyjdABs3T9U3TiJqk=; b=mm+uSwFSs/NpVi+svMW0iUnwkYwWx/Ll4gjKlsIq0FzXPiLjZiJPrxlRf2v6i5H57xO4yhVLg/PGx9JhyzVwK4FnKPvtRngilHTBXFbt/wum4l/qwMO0WbAbWC8/TbrfKIfqz0IZdP/dVLrt6JwI16X8zmMsP/XrLkDS6nnms5E= 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 1788460331460861.2355202406416; Thu, 3 Sep 2026 11:32:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x2CDr-00016q-Vp; Thu, 03 Sep 2026 14:31:40 -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 1x2CDq-00016E-Dy for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:38 -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 1x2CDo-0001aZ-00 for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:38 -0400 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 683G3ZC01091216 for ; Thu, 3 Sep 2026 18:31:35 GMT Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gf4ekjxq3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Sep 2026 18:31:34 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-52d33c89a29so6957511cf.1 for ; Thu, 03 Sep 2026 11:31:34 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([177.18.66.131]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91040693aaasm603596d6.34.2026.09.03.11.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 11:31:32 -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=g6MdE8Fv+0c xX31f8S+L77/tz/VyjdABs3T9U3TiJqk=; b=bGpD8OymvbueUPUMAojeWgNI+cW rj2HwQ8f0dUhi1ZlzzSUDSO93xVZi+uj+255PBeCnxninIufAJuUpsdehf5iqoBn 5vE+Cr75gSsm4tZ5h6Lx7nRFXY/SILnRR3+JO9WhRQmsDS90S8G9/+rkG4enS+NL HcUEamp+khZw8dzcX/+2B2iJLh2nI37MeSf5pORd338J6YG1nwrg/7Bnb83rW7cf bkJY6/p8zEfTkX9Q/9MnWZnjQhM43AxdiigtCu0RWWH7/BwXFQ2+SVjUnCzvkPg/ TQOdQkrx1Toet/CMC7ORuLkohKPLvWXVF89aR7QevdPOIjmNjW9Ctb4JiOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788460294; x=1789065094; 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=g6MdE8Fv+0cxX31f8S+L77/tz/VyjdABs3T9U3TiJqk=; b=cidSvdgjsqhQt7H1U3LWeCRhZ92oOm7iaQR3RRbYvpQ+6qRrw8JtqbX2Ab0t+22UpC mdjncJmC67zi0eCZ78CyZ9n8dJmzznbE8OHFX4HT+bqwl8m6tj7IvYWmSR9J3BGK5xx6 kkF2pvq7X84n5or7U5GaPXvSyTULCzhp16RZI3d1uoMB2PI2dtXX8VVD8Cm0WIYH1HKI PxuAb3nm8PPTPLLPc3k/JSwiCmFl/grJrpz5RTmpXducZVBNvYp/GgLkAUyuH4EkGGOj OaCBH2xfsGvVeQDyXVf7K6WwZJmF2V0x+deOMunxjMMExzW+nVIj2cosQ5BC0T6yAJXT ypnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788460294; x=1789065094; 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=g6MdE8Fv+0cxX31f8S+L77/tz/VyjdABs3T9U3TiJqk=; b=iuB/7HIMmj8zQOPsj371V5VXEgqcOlDkfXyqpaWZZJZFL2IaQBkONmqoyOT5tIMTzp k9/gX/cEytwaChYl6k1AcrSaAncQQPr1EabNkVB9eONblaGqEVn5Bbo/02ZpGmobCRmu c5HpiycMKlXU3HxqaQIAYniEmTq2nS/TY9q7Vm2Ymnoi1hMyDhWAei2dGFml9lgu0X8N ZR8fK5gZBhXw6q3B5rapm/yjNcggOmPz79doulEpQPxckgNBNDoOlrtFneD6VA2DqIXw P8s2iNv6Rs6ceDxsvkjs3DuMFmpkTDfUASloSrTPsKXKfVsOiUwGyrdWUAMDfVPN3W1A hiAg== X-Gm-Message-State: AFuF++mxAJ+jfoE3oRUpB0pY08jpKkccIu+S4yFYeYUAPstphAPgfXkb t9HQIM+dOFDIGkcq+ZFxhWnoCgrMRRPVSme8wK5voS8WWUxYF2ER7rVQFwdU/TTYYBY4cgf7Imw 7faLJDLZivKx2GLSFBBsBLrkXb898wLPY7PVGT6NvWmGI7HUWQMnooNFjcPxJCruAkA== X-Gm-Gg: AYBFou3cdMaLmeSQtPC4l2RGyaALwyZEHkhRN0J9PjKFtuL6G+sjam8xiiIFM1tJ4WA VYEecohMDBa0yVkMeKB1JnV150XmC3H4LNkx1/mCdYDIgjC+RwwlOpKtjsL1q7fD3RGLs8zBs9x Gt7qBPFUXoTkkTals6GaWG22+uMf9NoXIT99BGf1umUo9Wo2643NQeQUHJ6Szu8XunDyM8ohrsY LYlXXrCCBJlNctAbv2KoP17Qn9KV+TTKfT4MYEiXmZXFzqcboTeeLdfluyWkS4fiD+ygBh7eZDI xUpuCx3jXVkWHXUX6PL83O53HTfqpSg4cweES3L0GvnqoBQeVvGCnacE3NXdgYQXT/dUTw3EmNO YQytfqqPDAUEUGYwwuN/Ce5ebMFIRd0RkWcFS X-Received: by 2002:a05:6214:8013:b0:8cc:d29:9f73 with SMTP id 6a1803df08f44-9103eff962cmr13988296d6.21.1788460293888; Thu, 03 Sep 2026 11:31:33 -0700 (PDT) X-Received: by 2002:a05:6214:8013:b0:8cc:d29:9f73 with SMTP id 6a1803df08f44-9103eff962cmr13987246d6.21.1788460293248; Thu, 03 Sep 2026 11:31:33 -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 , Palmer Dabbelt Subject: [PATCH v9 1/5] target/riscv/cpu.c: remove 'bare' condition for .profile Date: Thu, 3 Sep 2026 15:31:21 -0300 Message-ID: <20260903183125.682865-2-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> References: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: ktnPnKZLwPIiYSb_IQQIUjw0hfPbJmBs X-Proofpoint-GUID: ktnPnKZLwPIiYSb_IQQIUjw0hfPbJmBs X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfX5JfH1NwEzXID Ujcgt7nf0F8I+tjAapdvgDA+6bVwsmHk3/e9bm6jC7KhD8PwAQ2mAdFLbfMr5N7BJjOaq4Da8aS fD3vLOwx2HdL+RWy2hwJPcQC1UfcNVh2f2DettTmQ/cko40vHWBxuWwrmstSXZFuyT0+alSBHVQ DPdwCjtDYnoMAta+gP26n+Y6hkycOtUov8R7+LXeckJ9FqQRLaDhh8iFfvviAk+IY7CKBct3R7+ j3pMnv08mrPXtmA/hBW0D6bd+n58lU4U8cJrMrYv7xCELB1NpFtk6EKNzc4+XbZpxr3rMVZDXls eMf8hu3SuzbJG2IALMzQU6RyXM/mDDhkqirGj88djcIQSldOfxbluLdSdaNtmwiTNMW7f5LL9I8 uQ6eXJ1lLGn29L9y6Qm56qsdff1R8/dH6UfDfCpD+9N/PufgguUyNSx3E1eXSVVtOxYPvyeRokx 2Qmy+XmY2TDzqKa7IjQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfXxzrNaIAsAxwn ZENlAWKauC7a8oB+nYIUl7to53yyusC3DUBE9QzwkRe7bmfe9Kj5wlGd7TGR8AXFHIoOWtSX1zE 5WF0aMf07OqoAmGS1sYEkzxl/dSUlM0= X-Authority-Analysis: v=2.4 cv=PKc/P/qC c=1 sm=1 tr=0 ts=6a99bd06 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=CQQxcbsX5Byh3TlVSSGwig==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=JF9118EUAAAA:8 a=GhL2bEVCvcqOW28JNKkA:9 a=a_PwQJl-kcHnX1M80qC6:22 a=xVlTc564ipvMDusKsbsT:22 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-03_05,2026-09-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 bulkscore=0 clxscore=1015 phishscore=0 suspectscore=0 priorityscore=1501 spamscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609030162 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=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: 1788460332594158500 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 --- target/riscv/cpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 61109672d6..4cc73de793 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -3096,7 +3096,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:51:01 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=1788460331; cv=none; d=zohomail.com; s=zohoarc; b=noI0GBMNaYdeKNKWfxMMv2g1DIfF+Pty6u9YASeXxXMj7kIECC968k/R1B2n143r3Awy5iw3ChHUC6cmjJ/QvzJpLD/yjz44RT7n+yh7Xiz8CUbtmgs8SAWEvU5ikxaUkgZ0MSznUBRJeiICRxY1sbRy7TTOY9o7mAvScmhpXMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788460331; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mKHlv7O60QFkPN7XH622NOuqoTsgivr4tr+IWmeazZc=; b=eNUw5RH6PZm1FnxMGOzz2Nsktc8WGb3/l9qQUChTeKDq5foh1JRLSutsDClAiu+Ff4L2W+u3KmiOuehJTpVWh/TNeF8CgL3RQW7jQHqxoXI6Erpb0IeqjGFsKt23lbjD2JHqH7ahcSaETbfw2KdaVfsG2VBjsz4Kzri8TpMLUIc= 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 1788460331628278.13046129980694; Thu, 3 Sep 2026 11:32:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x2CDw-00018Q-E0; Thu, 03 Sep 2026 14:31:44 -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 1x2CDt-00017N-Bt for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:42 -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 1x2CDr-0001bN-Hm for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:41 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 683G3Zv31430806 for ; Thu, 3 Sep 2026 18:31:38 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 4gf1j4kg2c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Sep 2026 18:31:38 +0000 (GMT) Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-90e8472ee1eso3578586d6.0 for ; Thu, 03 Sep 2026 11:31:38 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([177.18.66.131]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91040693aaasm603596d6.34.2026.09.03.11.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 11:31:35 -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=mKHlv7O60QF kPN7XH622NOuqoTsgivr4tr+IWmeazZc=; b=prDNF1oWOQIIcwl1CIkzYvXKE42 nqEeFhxyqzl7Ig8QtB7duz+iWo8+IazMZhDTaYBGXv8Z2t/lwZRu19F4e5UwNNMp yWL4dRD9K4kbn1lkEPVDpmVu7f6tuSdgw8jdbZ5cqz+UKnK93wWg44Jf+VeDWdHr UE4HaQ5gkn6L76T50Od4blEILYM2jgyXCtsjus+6UcVek2qNETvkhplwqvYPOJbJ HtBc4Om5e0imyOb4V8XA8Fw3VxRk/twPSCg6JbvdwED2lF+YwG2LNgcu/KV57tIM JZQYoool94vWiOT3+FAZQe9FjgYRKunkUnaEdMihS0Rf1r79glOZSiXaMaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788460297; x=1789065097; 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=mKHlv7O60QFkPN7XH622NOuqoTsgivr4tr+IWmeazZc=; b=LTA3gLIcxXCypU8Uo9PiqRvBaB3rQMGVriE818Gsot8RzF5aq8WZlhqUub3kSb4Oju ezWOjqZ7P/JvQtflbEsAJ5Q+pVNAKOgoAGtSm3//jR7hLFTICUsBMjAFg6Sui57AkgU+ SIo9/52Dmd6bT4dlDEzDXNu09QIUC0VEQJxZ2gvWMhHijT4ccLbg51QmXOTMcYLXvVdi ijCsCE+A5Mrgs1BsxpUvPxAvrswcJm5UfZKe8d/XVgsYu5jkiFnepQ9Dg8BNrcrZhkzP eqXal/vNAo2iRF4i813IrgOKYZ9X6FqS49sAlI8SqyZAuXOx6V2dWa/gHMORqAPa8R/+ s3Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788460297; x=1789065097; 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=mKHlv7O60QFkPN7XH622NOuqoTsgivr4tr+IWmeazZc=; b=QG+Ev1mbekRGP09PupsT1PlCtrOplCLlq2mhyXfN0iYTec8MnED7RPirlERBmbsFN4 0LGwNMkY8sbPM0uVGQ6qA4LZw3wss8XNLfJlYHYTG+FUfNbZmqjIPR43yu832x38a7lh 7VSDfMCAbHTYwwDSihSWVq7IOeMyMvgRr1Z0r58KbaQR2NlMprUF1ciCvwGEnpaozook k0TAR4B8xtz6zRMHwoESIP1JBciS4QU7KGiWxAbfz+3oijYt4rFDz5D07JJBF0WHmo5o csxs2gai5q4NLH4JTYdhjdTi3daJHS9zb3Sx/2eb2RPJGkSWwOglvH3iQyaNBbGMtlFB U47g== X-Gm-Message-State: AFuF++n+Q/qcC7UJzqutiVgt/2tyVdKh/7CLBPpHjq6Ent8arbofb1wu RuDm/kdT/nRyA1vND0UvOJBtv30BJqE505TKwsPvy+KtEKZAzJwaupN4IlBOneZx6rZHXHxoup9 6x/yvk0Ah5WJebZsfr8HrkAbpx//l212OVnWZYsN4I1xM+U909RbdB8y8lFkzI1BK/w== X-Gm-Gg: AYBFou2abHwWbYEW/24nzQgpsKN5XaVB/1sp+978rulbfLG37lWFchpWLOrEVnfb+q8 PH3v4za4zrSG4DzFQA6CVR/gxj0BZ4JikpexSuVZQPnXtb966BZlXIQEefLVFHSX5/xzi2cLN7Z J9zPeEUzCXLvczMTmpqTTQxnQVFVclv0gtrWceHfDoypOY+wYv/D/B7Xvzfib1m9RiZFamHmnSd yfU/2dBlNFwNs/aHAZmIhaDOkMshmTdKy3ljJ/OERhW870oeIlxde+cuiLx/zvKJM91OShxCdD1 WF3FAAt9pTLnuMamwAokg/33cmhrLyQdxJGpV+sVgQoEPWkkt8U1DMGgVc9w92oCr2J4c0gCJW6 Er1clY9APe6t9kWkSirfvnOHLTedGzp1oZO9M X-Received: by 2002:ad4:5dcd:0:b0:910:4080:dc4f with SMTP id 6a1803df08f44-9104080f964mr209856d6.4.1788460297180; Thu, 03 Sep 2026 11:31:37 -0700 (PDT) X-Received: by 2002:ad4:5dcd:0:b0:910:4080:dc4f with SMTP id 6a1803df08f44-9104080f964mr208646d6.4.1788460296396; Thu, 03 Sep 2026 11:31:36 -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 , Palmer Dabbelt Subject: [PATCH v9 2/5] target/riscv: add riscv-server-ref CPU Date: Thu, 3 Sep 2026 15:31:22 -0300 Message-ID: <20260903183125.682865-3-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> References: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=dufrzVg4 c=1 sm=1 tr=0 ts=6a99bd0a cx=c_pps a=wEM5vcRIz55oU/E2lInRtA==:117 a=CQQxcbsX5Byh3TlVSSGwig==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=V1jnuoLLAAAA:20 a=EUspDBNiAAAA:8 a=JF9118EUAAAA:8 a=PXcuKL70AAAA:8 a=zLUtPzHEVTZWnbMtJKMA:9 a=OIgjcC2v60KrkQgK7BGD:22 a=xVlTc564ipvMDusKsbsT:22 a=1qLaeP4TCVy2vqIEy19U:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-GUID: 2a0-EPqZSPHGrsjltCsRG3wAbTS2747B X-Proofpoint-ORIG-GUID: 2a0-EPqZSPHGrsjltCsRG3wAbTS2747B X-Proofpoint-Spam-Info: AW1haW4tMjYwOTAzMDE2MSBTYWx0ZWRfX7ho31umHqkSO Wtg8yukfJ5k6PIGuFXwLrYC3ajxJNe+YeSEuFpR9O9R2RB0RU170ufp1frHjkuTzWBEKSjd53if 7umGiMr3WDRl2J/+jn/Ov87Oy74etJ0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTAzMDE2MSBTYWx0ZWRfXwJQS9ovlK1C+ i2Xl9GyriRQs4O6chCCh1HIk8bwsFPuYpEO+MAEvdJshkEcDvs4SeiI2MgaKux7/A/Igb8CpMj1 9Mqpiy45GZXTUJVwJ1ka+smCgR0SuSZA38IfA3lfxM6fN9vMqoS+ZaVTA+l8Tfhv8MXTde/O3ea XDHlrOCUBnIIwBaBTYJ7Qt4V9kAB8MydR8vAnUg7/R1haTm78AjBrDFSZwtNwhGkYUbQYka3e09 Y0s5cXl4J1At7ZmqbE06+J2gb9G0k12PRrowjv8wYpJJa4QySw3VsVEA84swidxDz4tRkb5wTCd OcinRHPQ0RXGdnDBIqWZup017JAr4YGsjqZ4AMwgR+WMym4/kw/+dnvb7ajm3eHwu3tKtzWEdnL ya5DM95KVrfIwLZoHuCcDTt2a0zuXDlSrSNfYq9+3mmD0CiikICoKsiZKBOroverzWLq3dBAlQw hFFK3mlbBtMfWrbaI1w== 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-03_05,2026-09-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609030161 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: 1788460332719158500 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 with: -cpu riscv-server-ref,trigger-count=3DN Note that N must be <=3D 128. [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 --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 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 4cc73de793..086bc945ba 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2417,11 +2417,35 @@ static RISCVCPUProfile RVA23S64 =3D { } }; =20 +/* + * The riscv-server-ref spec 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 "rvserver-ref-1.0", + .satp_mode =3D VM_1_10_SV48, + .ext_offsets =3D { + CPU_CFG_OFFSET(ext_zkr), + 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 @@ -3757,6 +3781,13 @@ 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, + .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:51:01 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=1788460364; cv=none; d=zohomail.com; s=zohoarc; b=Qs2NuybuQqSBgGLhCSAhnEzXnTEHxwC8jR86ZB+6EZv4EOU0gvxbQfkQFOStQ4LDMlN4YrXbpsf1FeJ5rL5uhKl3UNm8Wu8xJzqpN0ESIiZ3GN/n7WJSAeLKhXJ/0x1S5vwRchbrWLLkNQ2B35oaGMlXL0dh6q9bwduKMTCmccQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788460364; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=i/8SRDIYabT8jxNGCTZuWeqqh6zYOWJd2k67Ce19eSo=; b=IuiPFqBN3DYd1dWDzS349MUi0BJ0L4cLoKiQLNQfqDMeLhrrMzaui6NkB56y3JMgAi0IOcJgKbd5otYfdDhS3q06kjeoLA95rKTzPQdtCRtig4z2BbwK0nP48PlTDsa7MZHSu17IdE1mDkzVHJ+pXCtpgIGnolzKvMZe7dn5LU4= 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 1788460364603754.1452260158067; Thu, 3 Sep 2026 11:32:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x2CE0-00018i-1C; Thu, 03 Sep 2026 14:31:48 -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 1x2CDz-00018Z-1t for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:47 -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 1x2CDv-0001c0-Bg for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:46 -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 683G3cXE820113 for ; Thu, 3 Sep 2026 18:31:42 GMT Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gf82k9yq9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Sep 2026 18:31:41 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-52fb2a46cb5so6955501cf.3 for ; Thu, 03 Sep 2026 11:31:41 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([177.18.66.131]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91040693aaasm603596d6.34.2026.09.03.11.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 11:31:39 -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=i/8SRDIYabT 8jxNGCTZuWeqqh6zYOWJd2k67Ce19eSo=; b=F7A+Q97ccYKSBW+9ji/J9YDph9l fBcEFNrJa8m7fXzz47U3n75hxzpvFgZ2NN7u8yOq2RMIA3iKnRRTHT15yfEBNi0K 5/fhDX6lmS2xxw7oJftAjiyfl41GhTBCCh+hqFp0o9LN08C30S5voJblnCLKkHtU pjOVXGrfR+CRhC0pVLzjDjVg/yat4ksJFihfqNeMXBlYgT8+4PtXpnxOkeN7ICcN ZxM0czM1n0JSkFn6WUHxFw8yJUflBrS050bwW3mac3QReEqOOxgLbhluWczBoTXr S5IUUUzi41dhP/AR+eFDGFKTlj716gRDJVspJP8UrQuiL7QquJmvAVLQSoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788460301; x=1789065101; 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=i/8SRDIYabT8jxNGCTZuWeqqh6zYOWJd2k67Ce19eSo=; b=kBa0mwROQUs8AzmXWLnPgljUJmk4bfJ0G1tMmmTAYnYXUqXncQqVmoI7epsGYbvRlq 1L1e+vxYAppvlXpdOYGjXb8x07eXo1BGPAagB+t6kkKOmAb3FxuEwaMc12JOG5sbd87Q 1hRATTU/FXq6yA2nsKadHvVua0SMp82J4KWwS0IFeL6yNhlpcN8QXJuHt0Utr1zh9/WY KRmgGCaN3dZu6BdIhy1JzSeLn5Pn7feCGYQMOW9R7VRH7UbxUVByMsm/Dya1xxXhJBkW 4D8q7wi2+TBJAGfj5zlP7xJOx4y6y61n6AuyLKSaefG0Mdgc5jEunzVYh6bKr9mPphbv Lvyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788460301; x=1789065101; 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=i/8SRDIYabT8jxNGCTZuWeqqh6zYOWJd2k67Ce19eSo=; b=JPY1jHQ764SY8Wecs9dTG0Li1+bHYao8ab7JHx1yTXygxEGaHWPW8s5pfv+3dQ5+n5 mEIwi4k4nYWXq/UUU1OCiegK/WS4bXIuwPtM0fBpz7UE/Erote6nzDiPKbREQQZpfZk3 tLCkNa5FOagTPVOa+8xgSliu1TVQYmowV8+CMqLodDd/coC81U9WC/Fo6koCJLIejDel txHri3EKBAgzyDjta9j3WGGQ76PLg83IT3lnRRyqrsiHZe2T9iFcFiU5MSi033KOps9I l1t8qNXk9dkYZHWECm1vIFoZJnaiYu7JwoDoe1awJwwSDB1CMBlyEky2jfPh/SOLCFRK Za5A== X-Gm-Message-State: AFuF++nZtKd39tAdrngJvQYZ4+Kz44lNjsWs/b+DbgYc2cOBqekIY6Ib nzcXbhrgBOo0c4hCA/xxolzX+ZfQo1EZtjWC5vaoGJjksPrgI8/QueTTIp4vCzxsBgzjAQsxPcK AlGbpscBEbPmsiguTsYNH6jjfUgHgM9gC0TjU0u4xZKOSql1qjXggt7bSfKnZLhi2Wg== X-Gm-Gg: AYBFou357OkgkjNheA+Cn/MDlRPae59VBu2hsZqhGxtkuVlzaJPEBbfv5arQsGIjeIw 3KcaIC1qinxoBGn1liypJpI7TENIEtjN2DbZ5hMHF8k83Gug33TVDqwjKq4ls0dxecyXbP4ZH8O jQ4DcQIaSuG5zVLVJPpXAtFFkNuUoLWxHq6g1H0hGMgAjV7YMN4kBQSUSUIE8xDW1D9qbhgQEJo Vl69WmUCBznpKW+4Bc4uvs8Jo+elJ2B8rfYfVUxxipXKSy9Me40UkIO5qnHzLSthJE/m1EPS1hB abHR8zogsa5JDMUL4ZiyWWCXL6NsFstPaABTK1cwLNUzIVkX8nG2hTuOYUXc91peZq1lYUo0vX4 m8/v2JDQEipTFs/iVo9lxLvOlSGffWlZdkdLV X-Received: by 2002:a05:6214:3303:b0:90c:87e7:e2b6 with SMTP id 6a1803df08f44-9103ef75449mr14536406d6.5.1788460300587; Thu, 03 Sep 2026 11:31:40 -0700 (PDT) X-Received: by 2002:a05:6214:3303:b0:90c:87e7:e2b6 with SMTP id 6a1803df08f44-9103ef75449mr14535196d6.5.1788460299608; Thu, 03 Sep 2026 11:31:39 -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 , Paolo Bonzini , Palmer Dabbelt Subject: [PATCH v9 3/5] hw/riscv: server platform reference machine Date: Thu, 3 Sep 2026 15:31:23 -0300 Message-ID: <20260903183125.682865-4-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> References: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: xzFt8AG7gsmmKbrlFbGPYgowozxmifml X-Proofpoint-ORIG-GUID: xzFt8AG7gsmmKbrlFbGPYgowozxmifml X-Authority-Analysis: v=2.4 cv=OuJ/DS/t c=1 sm=1 tr=0 ts=6a99bd0e cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=CQQxcbsX5Byh3TlVSSGwig==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=NEAV23lmAAAA:8 a=NLiCwHATAAAA:8 a=EUspDBNiAAAA:8 a=69EAbJreAAAA:8 a=C_ql9cbwDrEbyVCwxTEA:9 a=2KoRbIiLB8rUyhBb:21 a=dawVfQjAaf238kedN5IG:22 a=F9tHCgz3TLBaZgltkx5D:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfXzKFJ8k6rlqt5 dQO1Jec53BUS8P68FSUGkPDCGh9syr9A0lKR474RbNGENsGaIUTY5QMWoy3vvwJkTOwhIjdBHYe 67N0xiMnp4YDARHxgcpOmHOQ1zblXGwcjkPdyAAAqqA2mFDi/vco7n41WnDgKiLWMUlckOP8rAT YxHJI6P7Rqw8ZJIQssFK+4fOg24Tbb4aIPYY1WxKt2augl735+BQA7TVluSgVbJ7QdoWg6CHIH3 9qLaR8Xi2/TZUOOffGsVjcHJ2JMct0WmbU5a6N12q2lyCnkuxtonyymFapoUg3u/17VB2ttKoMH 6QLlaancHkxskumLg0SdoMIm37R0kxUh4p4KELZ8n5ELnQMWGWV9Zl7qMAsHlrZOWkhS7DSdXSw eYZ9CLdyapLtrw56T9To/Pjo+PLXAdiEqMWIrOPlSPgnASt92KMavNMRUTbgPLZ4upfy81knj5Z w6B5N1Vtccnduddck4Q== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfX97/tZDhol7bQ JbFGLt4fhI8B1fKkx9FmT52ehZDp8bxJVwAncW7N4SE3adAffDJvsltNMvyDt9ZINt/bXm45Pdr RgBT+bZEzprgB08PQCtgz2k9Zkt1WlY= 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-03_05,2026-09-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 spamscore=0 adultscore=0 bulkscore=0 malwarescore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609030162 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: 1788460366636158500 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; - PCIe AHCI; - PCIe NIC; - 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 --- configs/devices/riscv64-softmmu/default.mak | 1 + hw/riscv/Kconfig | 16 + hw/riscv/meson.build | 1 + hw/riscv/server_platform_ref.c | 771 ++++++++++++++++++++ 4 files changed, 789 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..da59eb2155 100644 --- a/hw/riscv/Kconfig +++ b/hw/riscv/Kconfig @@ -69,6 +69,22 @@ 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 RISCV_NUMA + select GOLDFISH_RTC + select PCI + select PCI_EXPRESS_GENERIC_BRIDGE + select PFLASH_CFI01 + select SERIAL + select RISCV_ACLINT + select RISCV_APLIC + select RISCV_IMSIC + select RISCV_IOMMU + 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..e6b83baa8d --- /dev/null +++ b/hw/riscv/server_platform_ref.c @@ -0,0 +1,771 @@ +/* + * 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/machines-qom.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/tcg.h" +#include "kvm/kvm_riscv.h" +#include "system/tpm.h" +#include "system/qtest.h" +#include "target/riscv/cpu.h" +#include "net/net.h" + +#include "aia.h" + +#define RVSERVER_CPUS_MAX_BITS 9 +#define RVSERVER_CPUS_MAX (1 << RVSERVER_CPUS_MAX_BITS) +#define RVSERVER_SOCKETS_MAX_BITS 2 +#define RVSERVER_SOCKETS_MAX (1 << RVSERVER_SOCKETS_MAX_BITS) + +#define RVSERVER_IRQCHIP_NUM_MSIS 255 +#define RVSERVER_IRQCHIP_NUM_SOURCES 96 +#define RVSERVER_IRQCHIP_NUM_PRIO_BITS 3 +#define RVSERVER_IRQCHIP_MAX_GUESTS_BITS 3 +#define RVSERVER_IRQCHIP_MAX_GUESTS \ + ((1U << RVSERVER_IRQCHIP_MAX_GUESTS_BITS) - 1U) + +#define NUM_SATA_PORTS 6 + +#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_DEBUG, + 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 48 */ +}; + +/* + * 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 accomodate 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 accomodate all IMSIC groups in address space" +#endif + +static const MemMapEntry rvserver_ref_memmap[] =3D { + [RVSERVER_DEBUG] =3D { 0x0, 0x100 }, + [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]) + : RISCV_ACLINT_DEFAULT_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 void rvserver_init_pci_devices(RISCVServerRefMachineState *s, + DeviceState *gpex_host) +{ + MachineClass *mc =3D MACHINE_GET_CLASS(s); + PCIHostState *pci =3D PCI_HOST_BRIDGE(gpex_host); + PCIDevice *pdev_ahci; + AHCIPCIState *ich9; + DriveInfo *hd[NUM_SATA_PORTS]; + + pci_init_nic_devices(pci->bus, mc->default_nic); + + /* IDE disk setup. */ + pdev_ahci =3D pci_create_simple(pci->bus, -1, TYPE_ICH9_AHCI); + ich9 =3D ICH9_AHCI(pdev_ahci); + g_assert(ARRAY_SIZE(hd) =3D=3D ich9->ahci.ports); + ide_drive_get(hd, ich9->ahci.ports); + ahci_ide_create_devs(&ich9->ahci, hd); +} + +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, *gpex_host; + int i, base_hartid, hart_count; + int socket_count =3D riscv_socket_count(machine); + int imsic_bits =3D imsic_num_bits(s->aia_guests + 1); + + /* 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; + + /* 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(memmap[RVSERVER_ACLINT].base + + i * RISCV_ACLINT_DEFAULT_MTIMER_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(true, s->aia_guests, + 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); + + gpex_host =3D riscv_gpex_pcie_init(system_memory, pcie_irqchip, + &rvserver_ref_memmap[RVSERVER_PCIE_EC= AM], + &rvserver_ref_memmap[RVSERVER_PCIE_MM= IO], + &rvserver_ref_memmap[RVSERVER_PCIE_MM= IO_HIGH], + &rvserver_ref_memmap[RVSERVER_PCIE_PI= O], + RVSERVER_PCIE_IRQ); + + /* Init nic devices and ICH9 AHCI */ + rvserver_init_pci_devices(s, gpex_host); + + 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_S= IZE); + s->flash[1] =3D riscv_flash_create(OBJECT(s), "riscv-server-ref.flash1= ", + "pflash1", RVSERVER_FLASH_SECTOR_S= IZE); +} + +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 HotplugHandler *rvserver_machine_get_hotplug_handler(MachineState *= ms, + DeviceState *d= ev) +{ + 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(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, + }; + + /* 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_size =3D sizeof(RISCVServerRefMachineState), + .interfaces =3D (const InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { TYPE_TARGET_RISCV64_MACHINE }, + { } + }, +}; + +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:51:01 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=1788460378; cv=none; d=zohomail.com; s=zohoarc; b=Up1HtAZ3GE8FvsLC35sNDUwa5vc+eHTaKECZ0o4P6gYgZcCCjKEljB7617BpTdMwjSM+zQpXdU4/1P/7rS47NIeJ8FkoCWypZa5NZLKRCcnbjLWuXaKVqIa6Gamj1aZ5p5CGWahX2R8ryfrI5qC20dT8krsA16uWCbIp8J6p5ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788460378; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BS+RfMy0mOE+ZYz8zK17/pgZkLuA1Nzqm1+TnjWCQR0=; b=akH8+JQw2+u81QfZO2UTIM4GbH3LnZpn/YqnZdFKTwHnT8y+ZdB6Nn7myxnu+Ms6xmXS8HGXe/LV3NxRWGa/WZFxrD5U+XfwPzkb4gydcsuwGvFXs6nufKY6/J16UZrdN9zODM73AdT+BYyfPUVKpLhBl0++ufMgdKxLp3YG9IY= 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 1788460378709327.92266701506173; Thu, 3 Sep 2026 11:32:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x2CE1-00019d-G6; Thu, 03 Sep 2026 14:31:49 -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 1x2CE0-000194-I1 for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:48 -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 1x2CDx-0001cH-Jv for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:48 -0400 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 683G2rlm1698730 for ; Thu, 3 Sep 2026 18:31:44 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 4gfbyvguf1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Sep 2026 18:31:44 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-90c8da50f4fso2783326d6.0 for ; Thu, 03 Sep 2026 11:31:44 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([177.18.66.131]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91040693aaasm603596d6.34.2026.09.03.11.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 11:31:41 -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=BS+RfMy0mOE +ZYz8zK17/pgZkLuA1Nzqm1+TnjWCQR0=; b=GIfCd4oXoM9M/VHjh+hjxkJf1Pf wWKaNB6cMDyX8b059R94G640Fl2xrcJ6tCPwZb7Wlrl1fW68Z5c+U5pGR+vrpYca /FE9QAvWIsf+/E7h2JLx/RDR45CXcZFO/RPmg2WD4+cRMmAGhAuTxY0IPYpqdDwp n3PvCOEHiMBhiuL4lXJPbrjpPLf/TTuiGc90BGmpKclxq8N5kCqU9z07CI9Up0dU uY/Yue8jSBXXcNQpdMAZO7nph+nNHnQUyAao7nQFky3qMiC6Lz2CB20gZuSCgbR7 0WZFvXexT9M6EH8OoasZSCYdTEGXbrUEo7jj2DLdV9cIYydrriTvSR5LdMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788460303; x=1789065103; 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=BS+RfMy0mOE+ZYz8zK17/pgZkLuA1Nzqm1+TnjWCQR0=; b=L5RUyazVyKS4uc9/JUZ21aYUoZN5O5AXZAWu7YqQi7jDz58kaZoqcIwgJoaaM/hVJE /Q1GgcJHL3n/CiELrELvfU8s8pZJstRiUQoUi/gUfyOns3wO5dkP9vie33F8zjh++W1s 5HidPDENF6OCEIzaDBF65mS077e16Hq6Z25RVRXbC1gNo4r2r9Gld/7yPthoBfEXbJW4 Jv5p6vhEERP1njfyjjsND7ctbDbbQbMij0Oml5a4Ij8RMHoHXwnetYFUleB1OUVVGtC6 EyKvvTdgehbe+3Eh0J5mbCwrLitI24LjuLq943QdeVMgdxDKzeRRnROd2S/DxAYxmuDU CIwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788460303; x=1789065103; 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=BS+RfMy0mOE+ZYz8zK17/pgZkLuA1Nzqm1+TnjWCQR0=; b=sxv5lsC9VeWwi/e8sdROIHFj6iRa0X9WYNMqYUpk+dvki9q5xlEyEDc5fz2MrxA+sz RKAHedQf+aWk9HOvmHOhgImBucJVJV64sRBR1ufJXORwEX0PAU+L/Huv7xk6TRMz7W26 w5a2HXWvVf03kdFU8tjcxR4w8wYF+SIqF3TpYlU4PAwIYgd9sKKsQUeT9Ua8ilYs9sdf e4VwUtEujuwDV4d3J00w8RPXD5MYdZ7SnddF5LlOc0TJ8kNjFjQmeN7VmFKqvzs+GzEc SkiGMgY2QrCo72pMdU9GiV7gXt/wpZrvGf+3Fyh6dhuYWTpIYKqDvL+J/8mJEIu5WpKB kuMg== X-Gm-Message-State: AFuF++kpTQnrv3/7tClAnDoW2ex0m20qqCEUjS1O0+V34IeR2A+rwH5l i/TPMohPYUfo//4MBpZAWP/At0xR/BuMxHlZpuxTjcnrfzixHQjxwLQb/YRu3fuZRXs8Qc17mQ4 rCjCOk1GJmZ8XiU2vo2kwkoFdRouwc95sDy1Nwd5vPKobUN+lXvg2dLE2g7H+5iDlAA== X-Gm-Gg: AYBFou0SH5VtWFvjyclVM1ienI3hBTAemRJW/HcQwZGMjkKoYYaDjRu1QGApHYzSL8+ 3pjiiPGDmCr2oFpP87Cu5J0PxH59K1839ZcUb8W4FNjmP9ZP7bZ3SSvDG1rsJhzAhl8Ugn6Z3l7 N1rG9GkyyeadAzLY++o6Eg8goEOWYRQMqOjTih2hFIH7jmSkYpYAp74I4u3gOe6iOQnnnzjFnnT WlPRnnKgxGvzwebzbF4o+8JQhmG1fG6RsgYX+UEnCsVrJ3lwivsPXQ89v4rxZIEs3eec7MIWx/R KOmEuVqJRmbwxv6DRMjkJYzbfBubGv3gYNP/b2gYz41nYoeKz0/wBIXPo36mMhH8WVagP7fdjmd QgOAjYj6szBsDPXHvtoiC9+I0WzVUwRlyeRL5 X-Received: by 2002:a05:6214:459e:b0:910:3453:66e with SMTP id 6a1803df08f44-9103f0df285mr11661446d6.32.1788460303057; Thu, 03 Sep 2026 11:31:43 -0700 (PDT) X-Received: by 2002:a05:6214:459e:b0:910:3453:66e with SMTP id 6a1803df08f44-9103f0df285mr11660326d6.32.1788460302380; Thu, 03 Sep 2026 11:31:42 -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 , Palmer Dabbelt Subject: [PATCH v9 4/5] tests/functional/riscv64: add riscv-server-ref tests Date: Thu, 3 Sep 2026 15:31:24 -0300 Message-ID: <20260903183125.682865-5-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> References: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: qw5B2IZYZTU88DJh8uDGHXclPcXcL4bq X-Proofpoint-GUID: qw5B2IZYZTU88DJh8uDGHXclPcXcL4bq X-Authority-Analysis: v=2.4 cv=C8vZDwP+ c=1 sm=1 tr=0 ts=6a99bd10 cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=CQQxcbsX5Byh3TlVSSGwig==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS: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-Spam-Details-Enc: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfXxBf3fDXr0Ay1 11GmU+unzCKqkaTwVKY4hkGPsgu7K9+JlsADoZoX0RdEms5/mFIhL1Hej/uzfjrpRBb9nM7p+CX wpEmTCElDnu8mRmyJ0LN6ts0n3vyMh4kEeCHokFYHMpqqOfe8XbnrsWEH06fpRdgsZeZM89KHN3 jC/XnAKvZGvHYAjnPAFBs26Tn8euEgrZZ3qdp2iM6EUS84VPMBGI+xqygBXk66bdH/A/NPuPR8O ImqF4HIqkL+FzUyZG4Qxs9GRnclnJ6omyREPdKoJ3hiKr03QfGRvEPxy+FHvPblQ5b2RGQOaSX6 POS6Rqe365aMStnuzAFnP+E2yym+Mzd/jlSY5ioSHDn+xJglxKXTBYbIa+kv0k6Jbi71YN4wm8U GadvJlMSWflKBPBRb6PjoSnHRCC7Ppx7fIsIIHg09bd33toLP4MoCcpfdvejhWt+nKmYElsN8QE qzWXpkS4hIgJnvZaArw== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfXzBa3JP4q6mgM qwT8jV5ANbB0Um7OCpOkr0GBt72PzuvHfxpTWXX+ghUEWgFNrdmqNp8dGmWmvCpNd5mWzqnzT3I fVo5bboxz08/cx657Fus65/ugklVmP4= 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-03_05,2026-09-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609030162 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: 1788460380721158500 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 --- tests/functional/riscv64/meson.build | 2 + tests/functional/riscv64/test_opensbi.py | 4 + tests/functional/riscv64/test_server_ref.py | 88 +++++++++++++++++++++ 3 files changed, 94 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..db3371fafd --- /dev/null +++ b/tests/functional/riscv64/test_server_ref.py @@ -0,0 +1,88 @@ +#!/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', 'ahci,id=3Dahci') + self.vm.add_args('-device', 'ide-hd,drive=3Dhd0,bus=3Dahci.0') + + 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:51:01 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=1788460331; cv=none; d=zohomail.com; s=zohoarc; b=j04LyLaEUPxg9Q+ZAF8gUrrFSfVoSsEvPiH68IoJxnHIewkIx+NV3/yqIc1c540gLK9+L/o33F1G/GFiVs4ORWTSQA/QzYBtzqACQZOdQrK1nSuYxEW7VgpkZcZ5IH8A6g+mhlSATXG298FQndFM0q7Ex/H/ehxtJ/V38p9efO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788460331; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SMd74W35OwxlEVCWTBA0XddWMjlMOj1/Eg7By52iCgc=; b=a0L5gCzn+fhMKk+dYerMhNbGJX3ckItAm1EMsxp7zmfvR3fi1YXI0itlqbZ6mH/9zAzU8f3qpgYz3Nbei74pLLI4fbjWyZkkCBGBby9prwqudTgsjdJ8aalzDfHr7BqQy9IeabzL+pNDzi16gBfkoc1AtOOYKg4EZu2ARxpa9W0= 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 178846033166434.022246606298836; Thu, 3 Sep 2026 11:32:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x2CE3-0001B5-Eu; Thu, 03 Sep 2026 14:31:51 -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 1x2CE1-0001AB-VM for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:49 -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 1x2CE0-0001cr-7g for qemu-devel@nongnu.org; Thu, 03 Sep 2026 14:31:49 -0400 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 683G3962346135 for ; Thu, 3 Sep 2026 18:31:47 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 4gf5pdtm3c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Sep 2026 18:31:47 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-90ce21f2cc9so4185526d6.2 for ; Thu, 03 Sep 2026 11:31:47 -0700 (PDT) Received: from QCOM-UWl2o8bcGT.qualcomm.com ([177.18.66.131]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91040693aaasm603596d6.34.2026.09.03.11.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 11:31:44 -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=SMd74W35Owx lEVCWTBA0XddWMjlMOj1/Eg7By52iCgc=; b=fWZA3SImZo7IvCJKpfJR8m3hvh7 umWfxuFUaEDDdeQMLkcwb9EI21BAJhbxfiNV4JnJ+rCm/UeqAngomQQSvc6A8kwQ ix1TG/sSzsRKxkBqGjLPIddeR5pk3gPFcb9c9UJOglwr6LKSAuPAc98Kv5zaz4fy A2PSGEvzaOtVr0bLs7n3sCHhQKrSvPSclsoXJH2N6OK9d4mh2eDkue0JsXjR6axd nBVP1sxTepUvjIezVCUdyuMCrZFQ0wwMWPWdxEwn7pGll+V0yXx+LSUvXQF5N4IT KndCnzWGkOPnzxDG4vALXfuFj++eDxLhQYJuvBG8FwpxrvFCdi977YwjJCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788460307; x=1789065107; 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=SMd74W35OwxlEVCWTBA0XddWMjlMOj1/Eg7By52iCgc=; b=U1+e+2KDOoy0JHfIpLXZGu5r1spfWIaB/ya4aUtj4eeetZ7ZQBuUqceRcgmKZFvHzu pSCk4bSlvY66qKzBTDXuOQhH6lM1ZzgK7Hq+Ojq89KT3jTVOrz7d+mhnV8ldepuHj0+B N9j895RIQvfgntNoImkHPb1gHPK4O62SThvyg9GYUp+MVgGly6TFu0x4YfPqadV4tUWK oZsL+vHCAbZY4yMQ2HE8+/2AR7niglcazLej8lw77NHcVWw1FCeeXcjKOnglGIQi9wih 8/I6fm/Tq5R49WMGBT9f40qFG6JrhHYagWT3Y8pPwFzMs30SHRrbGQXirKEwQHSyVbxI wkSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788460307; x=1789065107; 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=SMd74W35OwxlEVCWTBA0XddWMjlMOj1/Eg7By52iCgc=; b=iLmma/LQiX3wdMxy5XmWKk8bYFNU3DKtHYLp08Oea1xMxg0nLJrYXwynW3nKiJMR05 Cdrl+SfoU7qM0jEmV+Mvp6PuoG4lNquPtA4fr9MRI769N1gzFEop7aC/F/4IVKTopBxb mRXIbW0DhzpiwhnKUmEBoj9mOGvg7YQcWVHi6NPc3poNE6Zmw+0+rL7N7tYoHH661foa +hHCv2l7mrtDkid9SCPENxNusIKMrJnKC3NTT8b5gnjuUPAa/9cPQWypQQiKE83AvfqA ZjOuXLbPATbrNudbP7ySReJx1kzG/DkdYV2Cyy+zT4a8zlO7rXnc13p1W8gTveGD+O1A 0s6w== X-Gm-Message-State: AFuF++nMwAF//jOD8O+FEz+6PSAcLNDHi0BCCOac1pDECgX3LBijlxYD HPvUrd64lJreWb+io2rfZTVrmrbX5JdzLtZjNcrHBuRP9PIWKxg586ZpyMA64QHbWMf44n6eXg2 pyES5V8vUoRxDz9NUx36+DNDDqF0EyFgcc31u7o/CDwoidOsetoW9++cIFy0S+lngyQ== X-Gm-Gg: AYBFou3Evzv2iKw2auA+YXab9Z4hXYytWp62qY5YrfEjz/Srmw9zXqeCuTuaM53iwAn 4CShpTBNiDp87OyZ4Y8a6yKICTZu6kQ6eYYFr05QhyD6x7oFUeAw/3QGPiwjID3kFIIqerRvJHJ CvGkh1Gy+ltvyvkWnair9Mx/nPdynr9SKApiYcnUn2pSQTdv/2xiUdSCyaSTBcqnocutGWc1PBp mZcQaGRZ5enWL52AfC0vIKi+0FRjt/BNMKeaBL9UbnqOyf0ylLiuYZ4Az4fy2YzcUEuDwAkDB47 e0tEO6ZFgtcB7/XT0P1Vy7HIj2OVT3kwVeIi998ZHTK8SHIklo4dOB3GIN4j1RdJGIKrso93ZRb HuZ7sGC4x8U9DdPKUrN7LqC1XebQ8qbbW9fYL X-Received: by 2002:a05:6214:4e82:b0:90c:4422:84d1 with SMTP id 6a1803df08f44-9103f043439mr13041846d6.30.1788460306285; Thu, 03 Sep 2026 11:31:46 -0700 (PDT) X-Received: by 2002:a05:6214:4e82:b0:90c:4422:84d1 with SMTP id 6a1803df08f44-9103f043439mr13040296d6.30.1788460305114; Thu, 03 Sep 2026 11:31:45 -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 , Pierrick Bouvier , Palmer Dabbelt Subject: [PATCH v9 5/5] docs: add riscv-server-ref.rst Date: Thu, 3 Sep 2026 15:31:25 -0300 Message-ID: <20260903183125.682865-6-daniel.barboza@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> References: <20260903183125.682865-1-daniel.barboza@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfX5yHgS+WFksdz hqTE+R+vKzfft2o5pfluH5tz6aAJlDBaY+h3XbpCfGHEnDQsD6JlADhHszFEV2ET2PAqoeqwUVj +qFCKbpxi3IvLo9MMMBXjhK9becCXgU= X-Proofpoint-ORIG-GUID: J4uxbeRtz71aDZyrE2HWoqeuQyMGKZuD X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTAzMDE2MiBTYWx0ZWRfXyd7nLeqHJiBX Bba00MmYdXGODjwh7/sJ81/tgLZu69/FWwr0z1uZ8j7B3d2KlIOBmFwIpMmhozDkdxaSRGicQTP agZGrIoJnmQzsnRNJTptr8hYvX+tO1bpKAtlyV4wjhy3qInhAVgkaNTAWMwhUfIXEqh/SGDbivQ 7Lg0P1LwYUEUVwnqdwJDKGRMI7JfETehHDiw06r2JiiykXcGaC0AuVzNgPZrVLCBHnFnt0A0ne1 Qr1ORWGXuXWx5d8R0Tap7nht4rssp6mZIkAHblNsuI28ad/hxhWvazRS05T4t+DutlFjsY9NdB+ NoMPoZJstMDGHEjkmUIKDfiTw94rYgxgam/I64epzkPcu1yooNokAfkLTDput74AUwcipEsqzwB qFUZxIE89LUVZ+24Yv/dbSEpM2mIkm1Z8FIFCn3uPfcaZsDCyNavddVCWY0eLC+kxuQWgbx10BT m+MtTLzPyXael2WLIOA== X-Authority-Analysis: v=2.4 cv=RsL16imK c=1 sm=1 tr=0 ts=6a99bd13 cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=CQQxcbsX5Byh3TlVSSGwig==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=NEAV23lmAAAA:8 a=NLiCwHATAAAA:8 a=EUspDBNiAAAA:8 a=JF9118EUAAAA:8 a=vlmih187C6Ts2ntwv5oA:9 a=pJ04lnu7RYOZP9TFuWaZ:22 a=F9tHCgz3TLBaZgltkx5D:22 a=xVlTc564ipvMDusKsbsT:22 X-Proofpoint-GUID: J4uxbeRtz71aDZyrE2HWoqeuQyMGKZuD 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-03_05,2026-09-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 bulkscore=0 malwarescore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609030162 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: 1788460334399158500 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 --- docs/system/riscv/riscv-server-ref.rst | 62 ++++++++++++++++++++++++++ docs/system/target-riscv.rst | 1 + 2 files changed, 63 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..0573b4e07c --- /dev/null +++ b/docs/system/riscv/riscv-server-ref.rst @@ -0,0 +1,62 @@ +.. 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. New spec versio= ns +might trigger a revision of the emulation itself, which will strive to alw= ays +match the latest version available. In case the emulation changes aren't +backwards compatible we'll introduce a versioning scheme, probably via +a machine property, to allow older SW to run with older spec versions. + +The main features included in the riscv-server-ref board are: + +* IOMMU platform device (riscv-iommu-sys) +* AIA +* PCIe AHCI +* PCIe NIC +* 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 ahci,id=3Dahci \ + -device ide-hd,drive=3Dhd0,bus=3Dahci.0 \ + -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