From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web11.3299.1646097993646037547 for ; Mon, 28 Feb 2022 17:26:34 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=japQrNww; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0059c8a80e=abner.chang@hpe.com) Received: from pps.filterd (m0148664.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 21SKnsNY001887; Tue, 1 Mar 2022 01:26:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : mime-version; s=pps0720; bh=yCGyQ7cMrcpp4jA5+RJGg7FPLKA148o0Y10EGhls6M0=; b=japQrNwwlalx13aCJ3juW8e/9DIMTM/4P4vKcnDjlEQkWuyrDygJM47HuVRnPKZHdSMg WG1a0nKbvQlaFWbWDZUxJ5OPG1fJvQ+7VLDp8kpeheCQCG0yxdi5HEiVALwxx0tJSjqc ENpYsbmOySFXX0MQb5k2reoUErSjYkDvRGHUfvNLP8vAMiNOcrsvBQfMrC59pRXVdbLF GTaHl0l+YnIEhAb5a2Mjs7ymUfsC/sUPQNknM3jcmcHD2cNvuccvNNjMeSZO/UjTwSQp rieV+qwstUuzUW415NmUpaII81JeWbo7TNAtU2Oc6GDPvy8V1rGisuThWmFuxeG702tA +w== Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3eh2r3uhdy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Mar 2022 01:26:25 +0000 Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id F2D3FB4; Tue, 1 Mar 2022 01:26:24 +0000 (UTC) Received: from G9W8675.americas.hpqcorp.net (16.220.49.22) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 1 Mar 2022 01:26:24 +0000 Received: from G9W9210.americas.hpqcorp.net (2002:10dc:429b::10dc:429b) by G9W8675.americas.hpqcorp.net (2002:10dc:3116::10dc:3116) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 1 Mar 2022 01:26:06 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (15.241.52.12) by G9W9210.americas.hpqcorp.net (16.220.66.155) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 1 Mar 2022 01:26:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZc/M5ooTMQ83ZBpLbMs/ld32CsYnjVo8q3EJq7cOp46kF1PfY5MAv8Jz76R2zRnxSLiXyucH3RwzgUx2/Swsld5Ad6YL70xqyHF9c0th1lY1SV1YQSVSqfGj/G2yWUqYeQanfTE5W5scZ5s4pGTIH182HEljS80tncHLU7IvGa9wIxVmKMEMNXoFCq58wWjwUmdMH4tcOFvwbfHqjPCCRtSBqmGE+SB6VZjd+EwDMMLQ8DEukTYKuGEA9d5SAFdtKHo4ApYdMdIm8oI4RDgjCUHP9a1tD0X5xxKv+GNyqgcPywV+Nuewtech0J2Ha8wrL75htGvNKxSQ/W14ChJnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XweB44FjvcUfDx7O3NXo+/xkAUKg2otA+D3x5bDKEPQ=; b=h8fV287F6DgxfsNK0uTLkSHcwsY4W8Nx+PfsAb3/cmLoB+OYX/n4eKeMXvGEYADKItKGH6lvcG2zwZvVV/S9H732fNdW0XGbI14qgl0e7sG1FxuNxtQJTEil0JxjTECb59mXJoOTzCHA0AN99RXrbCWvc1+IYD6u7EpR2z/QTPq6UsN7oLaLVtNexzC47WkWVMDVSa3Dw4rYsu8NZPwwma6XR78ynOt6oAvVd6/rzEyQAXyVnJTAeaf/VYY74QqOAxeY+HhXM5OV5IL0MDqlMpdQiBLOId3HpyutqcT2HD0mViLa8f12BMJ/3gxG0eaBYsXA/Y0AD3PrzxwdzHM1cA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from PH7PR84MB1885.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:510:154::18) by MW5PR84MB1843.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:1c5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Tue, 1 Mar 2022 01:25:43 +0000 Received: from PH7PR84MB1885.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5ce:79b4:a546:d527]) by PH7PR84MB1885.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5ce:79b4:a546:d527%3]) with mapi id 15.20.5017.026; Tue, 1 Mar 2022 01:25:43 +0000 From: "Abner Chang" To: "Kinney, Michael D" , Leif Lindholm , "devel@edk2.groups.io" , "Ni, Ray" , LiChao CC: Andrew Fish , Sami Mujawar , LiChao , "Schaefer, Daniel (ROM Janitor)" , Sunil V L Subject: RFC: UefiCpuPkg for all processor archs Thread-Topic: RFC: UefiCpuPkg for all processor archs Thread-Index: AQHYLQtESpAa1qZtgkOiyqk+FuK0eQ== Date: Tue, 1 Mar 2022 01:25:42 +0000 Message-ID: References: <20220108040753.15926-1-abner.chang@hpe.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: ebf04a5a-84c3-af13-d0d5-01c0041ac44c x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c617d674-71fa-444a-9313-08d9fb226751 x-ms-traffictypediagnostic: MW5PR84MB1843:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GyNNGjoJL476TGfkASbs1+H6HREUll2GktZmxS66SlugE7TNSjqVgXkf2+DvoWPWokIeewtDrRhVkZhzn8jy7YI7rIxnQ9hU5/g+kAAVZMWQuOXZpun1CydgyPDgW5/JIDN9H2h2LknbJ77re4rFzEnUQgkKOb3i1janveil7jSAsiqDvCVbPek8XuETdwYqT8ntep0gBbPf7B9yvhT+56qvL7IM93hnCu4dVF60GdxrSOVUa5kQ4UuW0eYXSHiWAT1zuti9jLEPhx8POvDc/v8ZzmDBHlmBmknCLFyx7gcNWjdAnd5EESZAyGcn+RTGjjgQks2yBE/Kj6E3kWMNeeCu/LDbFZb0oPXybP6+fvnWzdnZE1KHYmu7bx4ewGuypcLiN1SHLl29xi5f4GxMOMfFiVvH6KHe7A5nPn69A6TpPsb2CC+22hAf1aduGOnFWbI4pL13cTKvsWl7FLPS4jb3NK9ws43rHwJS5zupAoXdbdGUeIN5O9xCfxv7vy2EASxoRyP0snLvUp8XrsET+LhzstWW6CvS8aO0o3gR8DmXBtnSuNNN/RDh7q9qBwehI2qAmbcHr1ccjPbb8unrKErRXmUdQaK1CSVx3uHJ+N9dRp3odVj8w/ft5Cm3rs9IZbgar6bNiQQlHbIgOotF/t2wELnJAi3c9phg5VkM+lEXXaKMSCAl6pRnS6BHJdWw9NE5mucdlbprWVzySpWS4+Y4OeLQNPsGywTfiKMLJoagpGZfn9Zc/vuMTeMYdlRJgXG37SDoo9o+atXP3V6+EiVyGZTifZZuRaEjjWdISxXc2Q4cYQUiXnV8nMV/azkjprfJLHnEdtmj90jI/1px3A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR84MB1885.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(366004)(30864003)(52536014)(55016003)(2906002)(53546011)(38070700005)(9686003)(83380400001)(6506007)(5660300002)(8936002)(26005)(71200400001)(33656002)(7696005)(86362001)(91956017)(66946007)(4326008)(66556008)(76116006)(64756008)(8676002)(66476007)(66446008)(122000001)(110136005)(54906003)(966005)(166002)(19627405001)(316002)(82960400001)(38100700002)(186003)(508600001)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?xhxLDb/JOoghXLXO9kN64vGKp7RY85sfpBhU7z+Vgg6JtD4N+xRfQ3+n?= =?Windows-1252?Q?m53hf2GgX3UxnFAH5b4N2JeDuu0neaTlm1uvEANLUzGS7qTqdQhp1eCQ?= =?Windows-1252?Q?Jk9hAmmYy5D/9GJjI1hzd6+SNI/ikCUu54D+7dK81uUg7YfKz7QR4SHi?= =?Windows-1252?Q?tRGCOAavK3+TMDUqCIs3GprTZRqo1a0hi6Uq0bsl6kStn1W30Vnv4VQE?= =?Windows-1252?Q?fQaklrMhowoKM/L4FBzLNqpTSdjw0gY+FB/uRdEs7nEzWUChtrbKPrzN?= =?Windows-1252?Q?dsoKymUV+/U7V9vhjp1RNxZrvNfh9b7ragB0S/qeOOYM36q/rrPew3VR?= =?Windows-1252?Q?XdFjAoVfwiZd72T/ZexR8KMaPAEOB2RX5wuJLFcP+ajI8Ps75ZzfXp3f?= =?Windows-1252?Q?w1I+QRNcf09glfJVDSamInW1PQCZBcsV9jaQogBATxDExgIccGB9fL/O?= =?Windows-1252?Q?Cziv9CeJQzZzWIP29OuOet7oP8vzqMIBOrKDZbwltd8Ns6q2j07y2acC?= =?Windows-1252?Q?qPpSqO50rtjtCjXHP3h/LRnuUnhdj7dbdS+fpZMQxoJheW82xTaiH2vb?= =?Windows-1252?Q?fxy65CCQBDFNs/K/BFI1Je8dj3DWYJICLg7ixx74HWz11xzsmpqOne3h?= =?Windows-1252?Q?57n12RtXJiDHjx3X/mzjCSnRZmdXkAcVS+oH5L3iISJZ9dsuxRbz+RCK?= =?Windows-1252?Q?bRB0/UveX/BivnunRFM7bq9wq92UH28vFa2Pz6bARMxdCo5s+fsU1hq+?= =?Windows-1252?Q?VUrZnYOkje270wvONoMUslk4w6F3zPqji5xLmem2w+6LYp9wXk6sakGm?= =?Windows-1252?Q?JdUL/y/po8u/wwRUnT8JLIz571eQ8Jx74Of/6jiMjMgGNgyEudrK2BmV?= =?Windows-1252?Q?JuHT2ZscRd5uTOvuZzW9hP6eNDRohuRr/b7hp6qpliVhIiYIN4Mp0H5u?= =?Windows-1252?Q?u1dpDuyYhXf70j1V0fm9Pp4GeOuozhk5E+hQ5wYRf3JdgIIQdcigaHQY?= =?Windows-1252?Q?LmNXXMB3rhdjLyhmLZWzdvGcS//vmt8VRqlHWN27M9SMi1ec0WiSQuv1?= =?Windows-1252?Q?XVE8rKZP/QMWvtLOyhXB0nYiFVNYw7sYQu2adt9LCoLderGCjzPkKfHh?= =?Windows-1252?Q?Z4etvZcInqxsAN5il1HBoXDgXA8kszVXZEjebGHeFJr/vBerfNjWnDaB?= =?Windows-1252?Q?yfweoKSzIiU8EIATPvjrxTCcZO2IRFsE17rwyxygKVPWmp5/IJ1LYB/r?= =?Windows-1252?Q?S7h4Us+AWeWmtRpDHPx0wjEW3PmPhKJqcS99l0ZicGdD+fmSajjsdIUF?= =?Windows-1252?Q?pLeGMzP+fMwD0JRTFgz6swJG70n3NgWIaFBUrbXg3nmn0uV6kP8WGoS6?= =?Windows-1252?Q?mbPSO2wYJX+t6RaJW021kNAOS/S0cGct7OWewCNhl4BahbjlM/jXV9jo?= =?Windows-1252?Q?lPMskMA+s8z2UPxdP/352nGisze/qT9F9e9Eb0VlbJwQ5zNGdGGYBgLH?= =?Windows-1252?Q?+JbCf2EPZ0il3Iu0VFW8jEyRyp4FxtXdaSD/L1bVa0hLSo/CEpBBwKzV?= =?Windows-1252?Q?WyxtfsYfxa/iimMWxali7tJViEGJAlahOWY3avzyAK2uFl92icRSs2vb?= =?Windows-1252?Q?/LtH8+I2A5ePdBgLQuVYbllj+PfSho2GDjX1gIOmSRO2UJFkpcJTTRRd?= =?Windows-1252?Q?V5RwPiVDebdLxRlZ1mf7Y01bNuLNifvyOqzdYJEVBdCgaOz8mEz5PA?= =?Windows-1252?Q?=3D=3D?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR84MB1885.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: c617d674-71fa-444a-9313-08d9fb226751 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2022 01:25:42.9245 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: R356G0uxJJ/9QDwYNCDiMklAJEbiwsqnI+5QUVWkrVxEtTja6BxqgwvXRl5lu1D0K0VYjz7H5TwQ/Sn6p1/g/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR84MB1843 X-OriginatorOrg: hpe.com X-Proofpoint-ORIG-GUID: yGsYsppxb2J0QvTq7OIFuwZFsiHXwPnZ X-Proofpoint-GUID: yGsYsppxb2J0QvTq7OIFuwZFsiHXwPnZ X-Proofpoint-UnRewURL: 11 URL's were un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-02-28_10,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2203010005 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_PH7PR84MB188546E233657BE689C5F5A9FF019PH7PR84MB1885NAMP_" --_000_PH7PR84MB188546E233657BE689C5F5A9FF019PH7PR84MB1885NAMP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Mike and Ray, I just got a chance to back on this topic and below are few questions regar= ding the UefiCpuPkg for all processor archs. I change the subject and loop Chao Li from Loongsoon who is contributing Lo= ongarch64 to Uefi/edk2. He may have to handle the similar things for Loonga= rch64. I went through RISC-V modules that currently located on edk2-platforms repo= (Platform/RISC-V/PlatformPKg and Silicon/RISC-V/ProcessorPkg) and figure o= ut the modules we would move to under UefiCpuPkg and MdeModulePkg. We coul= d go through the proposal in the design meeting later, however I would like= to confirm the proposal of revising modules under /UEfiCpuPkg those were i= mplemented in X86 oriented before we get to that point. * UefiCpuPKg\SecCore * The implementation of this module is very x86 oriented. There is like= ly nothing to leverage between archs. My thought was * 1. Having RISC-V SecCore in its own folder, e.g. UefiCpuPkg/RISC-V/Se= cCore and create the individual INF for archs. * However, 2. We can also consider having the separate section in SecCore/SecCore.inf.= Move all X86 source files to under UefiCpuPkg/SecCore/X86 and have /RISC-V= folder under UefiCpuPkg/SecCore for RISC-V arch. (I prefer this way) * * UefiCpuPKg/BaseUefiCpuLib * 1. Rename BaseUefiCpuLib.c to BaseUefiCpuLibIa32X64.c * BaseUefiCpuLibRiscV64.c for RISC-V arch and assembly code under /R= ISCV64 * 2. Or move all X86 source files to under BaseUefiCpuLib/X86, BaseUefi= CpuLib/RISC-V for RISC-V arch (I prefer this way, the directory looks clean= ) * * UefiCpuPKg/CpuExceptionHandlerLib Too many X86 source files, move all X86 source files to under CpuExecptionH= ander/X86, CpuExecptionHander/RISC-V for RISC-V arch * Having abstract level under /CpuExecptionHander, e.g. INF, PeiExcepti= on.c, DxeException.c and etc. * * UefiCpuPKg\Library\CpuTimerLib * 1. Rename BaseCpuTimerLib.c to BaseCpuTimerLibIa32X64.c, BaseCpuTimer= LibRiscV64.c for RISC-V arch. * 2. Or move all X86 source files to under BaseUefiCpuLib/X86, BaseUefi= CpuLib/RISC-V for RISC-V arch (I prefer this way) * * UefiCpuPKg/CpuDxe * Revise CpuDxe.c and CpuDxe.h to be abstract for the processor archs. * Move all x86 implementations to under /X86, CpuDxe/RISC-V for RISC-V = CpuDxe implementation Let me know your thoughts, I can initiate the PoC code after we get on the = same page. Thanks Abner ________________________________ From: Chang, Abner (HPS SW/FW Technologist) Sent: Saturday, February 5, 2022 10:56 PM To: Kinney, Michael D ; Leif Lindholm ; devel@edk2.groups.io ; Ni, Ray Cc: Andrew Fish ; Sami Mujawar Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add header fi= les of RISC-V processor package Thanks Mike. The reason I asked this question is we are working on the OvmfRiscV64 as yo= u suggested. However as you know that both RISC-V processor and platform pa= ckages are currently stay in edk2-platforms. We have to make sure CI won= =92t throw errors if we use the edk2 modules in edk2-platforms. We are in r= ush to have RISC-V edk2 OVMF for RISC-V community. We will start to move RI= SC-V edk2 port to UefiCpuPkg or MdePkg once RISC-V OVMF port is upstream. Abner From: Kinney, Michael D Sent: Saturday, February 5, 2022 4:22 AM To: Chang, Abner (HPS SW/FW Technologist) ; Leif Lindh= olm ; devel@edk2.groups.io; Ni, Ray Cc: Andrew Fish ; Sami Mujawar Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add header fi= les of RISC-V processor package Abner, I do not know if this patter is being used yet, but there is great value in= it for all platforms that are intended to be synced with edk2. The idea of testing an edk2 change against all available open source platfo= rms that use edk2 would increase confidence in the edk2 change. >>From a CI agent perspective, there are no issues with pulling more repos an= d running tests and providing results that can block an edk2 change if it b= reaks a specific platform. Mike From: Chang, Abner (HPS SW/FW Technologist) > Sent: Friday, February 4, 2022 8:15 AM To: Kinney, Michael D >; Leif Lindholm >; de= vel@edk2.groups.io; Ni, Ray > Cc: Andrew Fish >; Sami Mujawar > Subject: Re: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add header fi= les of RISC-V processor package BTW Mike, Can Core CI on edk2 repo allow the modules referred in the DSC/FDF (e.g., O= vmgRiscV64.dsc) to stay in edk2-platform? Abner ________________________________ From: Kinney, Michael D > Sent: Saturday, January 22, 2022 1:37 AM To: Chang, Abner (HPS SW/FW Technologist) >; Leif Lindholm >; devel@edk2.groups.io >; Ni, Ray >; Kinney, Michael D > Cc: Andrew Fish >; Sami Mujawar > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add header fi= les of RISC-V processor package I would recommend adding the Platform DSC required to run RISC-V with QEMU = to OvmfPkg so it can be part of CI for edk2 repo so any change to edk2 that= is used by RISC-V can be verified by build and boot to shell. I would like to see the ArmVirtPkg merged into OvmfPkg too so OvmfPkg provi= dse FW build for all support CPU Archs running through QEMU to support edk2= CI that can build and boot to shell in an Azure Pipelines agent. Mike From: Chang, Abner (HPS SW/FW Technologist) > Sent: Friday, January 21, 2022 9:13 AM To: Kinney, Michael D >; Leif Lindholm >; de= vel@edk2.groups.io; Ni, Ray > Cc: Andrew Fish >; Sami Mujawar > Subject: Re: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add header fi= les of RISC-V processor package Ok Mike and Leif, Another question regarding to the location of RISC-V Virtual package for QE= MU. What is the location and package you think RISC-V or other processor ar= chitectures should stay with? Thanks Abner ________________________________ From: Kinney, Michael D > Sent: Saturday, January 15, 2022 12:21 AM To: Chang, Abner (HPS SW/FW Technologist) >; Leif Lindholm >; devel@edk2.groups.io >; Ni, Ray >; Kinney, Michael D > Cc: Andrew Fish >; Sami Mujawar > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add header fi= les of RISC-V processor package Hi Abner, We already have a package for common platform content in the edk2 repo. This is the MdeModulePkg. However, the number of common platform features added to the MdeModulePkg o= ver time has made this a very large package, and this can be measured by how co= mplex the Maintainer.txt rules are for this package. The revised approach is to create feature packages that platforms can add if their platform requires that specific feature category. Examples are NetworkPkg, SecurityPkg, FmpDevicePkg, FatPkg, RedfishPkg, SourceLevelDebug= Pkg. Instead of adding another generic package such as CommonPlatformPkg, I would prefer to see the libs/modules either added to existing packages that match the feature category, or create new feature packages if there is a new feature category. We also try to limit the edk2 repo to components that are directly related the UEFI/PI specifications and are not Si/Platform specific. Si/Platform specific features go into the edk2-platforms repo. An example of a generic feature in the edk2-platforms repo is Features/Ext4. The UEFI spec only specifies FAT for UEFI boot from file system. There are a number of other feature packages in edk2-platforms in the Features directory, so you should review those as well to see if there is natural landing zone for any of your components. Mike > -----Original Message----- > From: Chang, Abner (HPS SW/FW Technologist) > > Sent: Friday, January 14, 2022 3:15 AM > To: Kinney, Michael D >; Leif Lindholm >; = devel@edk2.groups.io; Ni, Ray > > > Cc: Andrew Fish >; Sami Mujawar <= Sami.Mujawar@arm.com> > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add header = files of RISC-V processor package > > > > > -----Original Message----- > > From: Kinney, Michael D > > > Sent: Friday, January 14, 2022 12:38 AM > > To: Chang, Abner (HPS SW/FW Technologist) >; Leif > > Lindholm >; devel@edk2.grou= ps.io; Ni, Ray > > >; Kinney, Michael D > > > Cc: Andrew Fish >; Sami Mujawar > > > > > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add heade= r > > files of RISC-V processor package > > > > Hi Abner, > > > > General recommendations included below. Of course each > > lib/modules/include needs to be reviewed and the > > best location selected. I am aware that there are components in edk2 t= hat > > do not follow these general > > recommendations. This is due to content that was added before these > > recommendations were established > > and we have work to do to get everything aligned. > > > > Mike > > > > > -----Original Message----- > > > From: Chang, Abner (HPS SW/FW Technologist) > > > > Sent: Wednesday, January 12, 2022 9:34 PM > > > To: Kinney, Michael D >; Leif Lindholm > > >; devel@edk2.groups.io; Ni, Ray > > > > > > > Cc: Andrew Fish >; Sami Mujaw= ar > > > > > > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add > > header files of RISC-V processor package > > > > > > HI Mike, > > > It is no problem to meet there. However, I am not available to join t= he > > design meeting in the next two weeks. Before we can get > > > together to discuss the best locations, do you have information regar= ding > > the rationale of driver/library location? > > > > > > What is the best location for, > > > - Processor ARCH dependent modules > > > > MdePkg for libs > > UefiCpuPkg for modules > > > > > - Common modules for all processor ARCHs > > > > Feature Packages based on the common feature. Add to existing if it fi= ts. > > Create new for completely new feature area. > > > > > - Platform module that is specific to processor ARCH? > > > > edk2-platform repository > How about Leif's suggestion? The CommonPlatformPkg on edk2? > > Abner > > > > > The only exception so far are platform modules used to support > > OvmfPkg/QEMU to support CI. > > In this case the modules are added to OvmfPkg. > > > > > - Platform module that is common to processor ARCHs? > > > > edk2-platform repository > > > > The only exception so far are platform modules used to support > > OvmfPkg/QEMU to support CI. > > In this case the modules are added to OvmfPkg. > > > > > > > > Thanks > > > Abner > > > > > > > -----Original Message----- > > > > From: Kinney, Michael D > > > > > Sent: Monday, January 10, 2022 11:58 PM > > > > To: Leif Lindholm >; de= vel@edk2.groups.io; Chang, > > Abner > > > > (HPS SW/FW Technologist) >; Kinney, Michael D > > > > >; Ni= , Ray > > > > > Cc: Andrew Fish >; Sami Muj= awar > > > > > > > > > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add > > header > > > > files of RISC-V processor package > > > > > > > > Hi Abner, > > > > > > > > I see comments from Leif as well. > > > > > > > > Do you think a discussion in the design meeting Ray Ni runs would b= e > > > > valuable > > > > to review all the modules/libs/includes and discuss options for the= best > > > > location for them to reside in the edk2 repos? > > > > > > > > Thanks, > > > > > > > > Mike > > > > > > > > > -----Original Message----- > > > > > From: Kinney, Michael D > > > > > > Sent: Monday, January 10, 2022 7:55 AM > > > > > To: Leif Lindholm >; = devel@edk2.groups.io; Chang, > > > > Abner >; Kinney, Mi= chael D > > > > > > > > > > > Cc: Andrew Fish >; Sami M= ujawar > > > > > > > > > > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add > > > > header files of RISC-V processor package > > > > > > > > > > Hi Abner, > > > > > > > > > > I would also like to see some proposals on adding the RiscV CPU s= coped > > > > content > > > > > to the existing MdePkg/UefiCpuPkg instead of adding a new top lev= el > > CPU > > > > package. > > > > > > > > > > There is already some work started to move some of the ARM specif= ic > > > > content > > > > > from ARM CPU packages into MdePkg. > > > > > > > > > > Thanks, > > > > > > > > > > Mike > > > > > > > > > > > -----Original Message----- > > > > > > From: Leif Lindholm > > > > > > > Sent: Monday, January 10, 2022 5:11 AM > > > > > > To: devel@edk2.groups.io; Chang, A= bner > > > > > > > Cc: Andrew Fish >; Kinn= ey, Michael D > > > > >; Sa= mi Mujawar > > > > > > > > > Subject: Re: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: A= dd > > > > header files of RISC-V processor package > > > > > > > > > > > > On Sat, Jan 08, 2022 at 12:07:53 +0800, Abner Chang wrote: > > > > > > > (This is migrated from edk2-platforms:Silicon/RISC-V) > > > > > > > > > > > > > > RISC-V processor package library definitions. > > > > > > > > > > > > > > IndustryStandard/RiscV.h > > > > > > > -Add RiscV.h which conform with RISC-V Privilege Spec v1.10. > > > > > > > > > > > > > > RiscVImpl.h > > > > > > > -Definition of EDK2 RISC-V implementation. > > > > > > > > > > > > > > Signed-off-by: Abner Chang > > > > > > > > Co-authored-by: Daniel Schaefer > > > > > > > > Co-authored-by: Gilbert Chen > > > > > > > > Reviewed-by: Leif Lindholm > > > > > > > > > > > > > Hmm, no. > > > > > > I gave a reviewed-by for that patch to be merged into edk2-plat= forms > > > > > > once upon a time. This is not relevant for migration to edk2. > > > > > > > > > > > > My proposal for migrating this code would be as follows: > > > > > > - Announce a hold on merging new code to RiscV portions of > > > > > > edk2-platforms. > > > > > > - Apply any and all bugfixes and CI/uncrustify fixes in place i= n > > > > > > edk2-platforms. > > > > > > - Get some level of agreement for what to do instead of > > > > > > RiscVPlatformPkg - i.e. slot into MdeModulePkg instead. > > > > > > - If that cannot be reached within a few days, create a new > > > > > > top-level directory called "CommonPlatformPkg" or somethin= g, > > > > > > with you, Daniel(/Gilbert?), Sami, me as maintainers. > > > > > > - Move all of the RiscVPlatformPkg code under there instea= d. > > > > > > - I'll follow with ArmPlatformPkg. > > > > > > - PC/AT code should move across too over time. > > > > > > - Move the rest of the code across unmodified as massive single > > > > > > patches per package (potentially more patches than that for > > > > > > RiscVPlatformPkg). > > > > > > - Drop all existing Reviewed-by/Acked-by. > > > > > > - After each "move" patch, insert a "fixup" patch to address = the > > > > > > things that need fixing due to path/name changes. > > > > > > > > > > > > / > > > > > > Leif > > > > > > > > > > > > > Cc: Leif Lindholm > > > > > > > > Cc: Gilbert Chen > > > > > > > > --- > > > > > > > .../Include/IndustryStandard/RiscV.h | 156 > > ++++++++++++++++++ > > > > > > > .../RISC-V/ProcessorPkg/Include/RiscVImpl.h | 87 ++++++++= ++ > > > > > > > 2 files changed, 243 insertions(+) > > > > > > > create mode 100644 Silicon/RISC- > > > > V/ProcessorPkg/Include/IndustryStandard/RiscV.h > > > > > > > create mode 100644 Silicon/RISC- > > V/ProcessorPkg/Include/RiscVImpl.h > > > > > > > > > > > > > > diff --git a/Silicon/RISC- > > > > V/ProcessorPkg/Include/IndustryStandard/RiscV.h b/Silicon/RISC- > > > > > > V/ProcessorPkg/Include/IndustryStandard/RiscV.h > > > > > > > new file mode 100644 > > > > > > > index 0000000000..2a992394ed > > > > > > > --- /dev/null > > > > > > > +++ b/Silicon/RISC- > > V/ProcessorPkg/Include/IndustryStandard/RiscV.h > > > > > > > @@ -0,0 +1,156 @@ > > > > > > > +/** @file > > > > > > > + RISC-V package definitions. > > > > > > > + > > > > > > > + Copyright (c) 2019, Hewlett Packard Enterprise Development= LP. > > All > > > > rights reserved.
> > > > > > > + > > > > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > > + > > > > > > > +**/ > > > > > > > + > > > > > > > +#ifndef RISCV_INDUSTRY_STANDARD_H_ > > > > > > > +#define RISCV_INDUSTRY_STANDARD_H_ > > > > > > > + > > > > > > > +#if defined (MDE_CPU_RISCV64) > > > > > > > +#define RISC_V_XLEN_BITS 64 > > > > > > > +#else > > > > > > > +#endif > > > > > > > + > > > > > > > +#define RISC_V_ISA_ATOMIC_EXTENSION (0x00000= 001 << > > 0) > > > > > > > +#define RISC_V_ISA_BIT_OPERATION_EXTENSION > > (0x00000001 > > > > << 1) > > > > > > > +#define RISC_V_ISA_COMPRESSED_EXTENSION (0x00000= 001 > > << > > > > 2) > > > > > > > +#define RISC_V_ISA_DOUBLE_PRECISION_FP_EXTENSION > > > > (0x00000001 << 3) > > > > > > > +#define RISC_V_ISA_RV32E_ISA (0x00000= 001 << 4) > > > > > > > +#define RISC_V_ISA_SINGLE_PRECISION_FP_EXTENSION > > > > (0x00000001 << 5) > > > > > > > +#define RISC_V_ISA_ADDITIONAL_STANDARD_EXTENSION > > > > (0x00000001 << 6) > > > > > > > +#define RISC_V_ISA_RESERVED_1 (0x00000= 001 << 7) > > > > > > > +#define RISC_V_ISA_INTEGER_ISA_EXTENSION (0x00000= 001 > > << > > > > 8) > > > > > > > +#define > > > > RISC_V_ISA_DYNAMICALLY_TRANSLATED_LANGUAGE_EXTENSION > > > > (0x00000001 << 9) > > > > > > > +#define RISC_V_ISA_RESERVED_2 (0x00000= 001 << 10) > > > > > > > +#define RISC_V_ISA_DECIMAL_FP_EXTENSION (0x00000= 001 > > << > > > > 11) > > > > > > > +#define RISC_V_ISA_INTEGER_MUL_DIV_EXTENSION > > (0x00000001 > > > > << 12) > > > > > > > +#define RISC_V_ISA_USER_LEVEL_INTERRUPT_SUPPORTED > > > > (0x00000001 << 13) > > > > > > > +#define RISC_V_ISA_RESERVED_3 (0x00000= 001 << 14) > > > > > > > +#define RISC_V_ISA_PACKED_SIMD_EXTENSION > > (0x00000001 << > > > > 15) > > > > > > > +#define RISC_V_ISA_QUAD_PRECISION_FP_EXTENSION > > > > (0x00000001 << 16) > > > > > > > +#define RISC_V_ISA_RESERVED_4 (0x00000= 001 << 17) > > > > > > > +#define RISC_V_ISA_SUPERVISOR_MODE_IMPLEMENTED > > > > (0x00000001 << 18) > > > > > > > +#define RISC_V_ISA_TRANSATIONAL_MEMORY_EXTENSION > > > > (0x00000001 << 19) > > > > > > > +#define RISC_V_ISA_USER_MODE_IMPLEMENTED > > (0x00000001 > > > > << 20) > > > > > > > +#define RISC_V_ISA_VECTOR_EXTENSION (0x00000= 001 << > > 21) > > > > > > > +#define RISC_V_ISA_RESERVED_5 (0x00000= 001 << 22) > > > > > > > +#define RISC_V_ISA_NON_STANDARD_EXTENSION > > (0x00000001 > > > > << 23) > > > > > > > +#define RISC_V_ISA_RESERVED_6 (0x00000= 001 << 24) > > > > > > > +#define RISC_V_ISA_RESERVED_7 (0x00000= 001 << 25) > > > > > > > + > > > > > > > +// > > > > > > > +// RISC-V CSR definitions. > > > > > > > +// > > > > > > > +// > > > > > > > +// Machine information > > > > > > > +// > > > > > > > +#define RISCV_CSR_MACHINE_MVENDORID 0xF11 > > > > > > > +#define RISCV_CSR_MACHINE_MARCHID 0xF12 > > > > > > > +#define RISCV_CSR_MACHINE_MIMPID 0xF13 > > > > > > > +#define RISCV_CSR_MACHINE_HARRID 0xF14 > > > > > > > +// > > > > > > > +// Machine Trap Setup. > > > > > > > +// > > > > > > > +#define RISCV_CSR_MACHINE_MSTATUS 0x300 > > > > > > > +#define RISCV_CSR_MACHINE_MISA 0x301 > > > > > > > +#define RISCV_CSR_MACHINE_MEDELEG 0x302 > > > > > > > +#define RISCV_CSR_MACHINE_MIDELEG 0x303 > > > > > > > +#define RISCV_CSR_MACHINE_MIE 0x304 > > > > > > > +#define RISCV_CSR_MACHINE_MTVEC 0x305 > > > > > > > + > > > > > > > +#define RISCV_TIMER_COMPARE_BITS 32 > > > > > > > +// > > > > > > > +// Machine Timer and Counter. > > > > > > > +// > > > > > > > +//#define RISCV_CSR_MACHINE_MTIME 0x701 > > > > > > > +//#define RISCV_CSR_MACHINE_MTIMEH 0x741 > > > > > > > +// > > > > > > > +// Machine Trap Handling. > > > > > > > +// > > > > > > > +#define RISCV_CSR_MACHINE_MSCRATCH 0x340 > > > > > > > +#define RISCV_CSR_MACHINE_MEPC 0x341 > > > > > > > +#define RISCV_CSR_MACHINE_MCAUSE 0x342 > > > > > > > + #define MACHINE_MCAUSE_EXCEPTION_ MASK 0x0f > > > > > > > + #define MACHINE_MCAUSE_INTERRUPT (RISC_V_XLEN_BITS - > > 1) > > > > > > > +#define RISCV_CSR_MACHINE_MBADADDR 0x343 > > > > > > > +#define RISCV_CSR_MACHINE_MIP 0x344 > > > > > > > + > > > > > > > +// > > > > > > > +// Machine Protection and Translation. > > > > > > > +// > > > > > > > +#define RISCV_CSR_MACHINE_MBASE 0x380 > > > > > > > +#define RISCV_CSR_MACHINE_MBOUND 0x381 > > > > > > > +#define RISCV_CSR_MACHINE_MIBASE 0x382 > > > > > > > +#define RISCV_CSR_MACHINE_MIBOUND 0x383 > > > > > > > +#define RISCV_CSR_MACHINE_MDBASE 0x384 > > > > > > > +#define RISCV_CSR_MACHINE_MDBOUND 0x385 > > > > > > > + > > > > > > > +// > > > > > > > +// Supervisor mode CSR. > > > > > > > +// > > > > > > > +#define RISCV_CSR_SUPERVISOR_SSTATUS 0x100 > > > > > > > + #define SSTATUS_SIE_BIT_POSITION 1 > > > > > > > + #define SSTATUS_SPP_BIT_POSITION 8 > > > > > > > +#define RISCV_CSR_SUPERVISOR_SIE 0x104 > > > > > > > +#define RISCV_CSR_SUPERVISOR_SSCRATCH 0x140 > > > > > > > +#define RISCV_CSR_SUPERVISOR_SEPC 0x141 > > > > > > > +#define RISCV_CSR_SUPERVISOR_SCAUSE 0x142 > > > > > > > + #define SCAUSE_USER_SOFTWARE_INT 0 > > > > > > > + #define SCAUSE_SUPERVISOR_SOFTWARE_INT 1 > > > > > > > + #define SCAUSE_USER_TIMER_INT 4 > > > > > > > + #define SCAUSE_SUPERVISOR_TIMER_INT 5 > > > > > > > + #define SCAUSE_USER_EXTERNAL_INT 8 > > > > > > > + #define SCAUSE_SUPERVISOR_EXTERNAL_INT 9 > > > > > > > +#define RISCV_CSR_SUPERVISOR_STVAL 0x143 > > > > > > > +#define RISCV_CSR_SUPERVISOR_SIP 0x144 > > > > > > > +#define RISCV_CSR_SUPERVISOR_SATP 0x180 > > > > > > > + > > > > > > > +#if defined (MDE_CPU_RISCV64) > > > > > > > + #define RISCV_SATP_MODE_MASK 0xF000000000000000 > > > > > > > + #define RISCV_SATP_MODE_BIT_POSITION 60 > > > > > > > +#endif > > > > > > > + #define RISCV_SATP_MODE_OFF 0 > > > > > > > + #define RISCV_SATP_MODE_SV32 1 > > > > > > > + #define RISCV_SATP_MODE_SV39 8 > > > > > > > + #define RISCV_SATP_MODE_SV48 9 > > > > > > > + #define RISCV_SATP_MODE_SV57 10 > > > > > > > + #define RISCV_SATP_MODE_SV64 11 > > > > > > > + > > > > > > > + #define SATP64_ASID_MASK 0x0FFFF00000000000 > > > > > > > + #define SATP64_PPN_MASK 0x00000FFFFFFFFFFF > > > > > > > + > > > > > > > +#define RISCV_CAUSE_MISALIGNED_FETCH 0x0 > > > > > > > +#define RISCV_CAUSE_FETCH_ACCESS 0x1 > > > > > > > +#define RISCV_CAUSE_ILLEGAL_INSTRUCTION 0x2 > > > > > > > +#define RISCV_CAUSE_BREAKPOINT 0x3 > > > > > > > +#define RISCV_CAUSE_MISALIGNED_LOAD 0x4 > > > > > > > +#define RISCV_CAUSE_LOAD_ACCESS 0x5 > > > > > > > +#define RISCV_CAUSE_MISALIGNED_STORE 0x6 > > > > > > > +#define RISCV_CAUSE_STORE_ACCESS 0x7 > > > > > > > +#define RISCV_CAUSE_USER_ECALL 0x8 > > > > > > > +#define RISCV_CAUSE_HYPERVISOR_ECALL 0x9 > > > > > > > +#define RISCV_CAUSE_SUPERVISOR_ECALL 0xa > > > > > > > +#define RISCV_CAUSE_MACHINE_ECALL 0xb > > > > > > > +#define RISCV_CAUSE_FETCH_PAGE_FAULT 0xc > > > > > > > +#define RISCV_CAUSE_LOAD_PAGE_FAULT 0xd > > > > > > > +#define RISCV_CAUSE_STORE_PAGE_FAULT 0xf > > > > > > > +#define RISCV_CAUSE_FETCH_GUEST_PAGE_FAULT 0x14 > > > > > > > +#define RISCV_CAUSE_LOAD_GUEST_PAGE_FAULT 0x15 > > > > > > > +#define RISCV_CAUSE_STORE_GUEST_PAGE_FAULT 0x17 > > > > > > > + > > > > > > > +// > > > > > > > +// Machine Read-Write Shadow of Hypervisor Read-Only Registe= rs > > > > > > > +// > > > > > > > +#define RISCV_CSR_HTIMEW 0xB01 > > > > > > > +#define RISCV_CSR_HTIMEHW 0xB81 > > > > > > > +// > > > > > > > +// Machine Host-Target Interface (Non-Standard Berkeley > > Extension) > > > > > > > +// > > > > > > > +#define RISCV_CSR_MTOHOST 0x780 > > > > > > > +#define RISCV_CSR_MFROMHOST 0x781 > > > > > > > + > > > > > > > +#endif > > > > > > > diff --git a/Silicon/RISC-V/ProcessorPkg/Include/RiscVImpl.h > > > > b/Silicon/RISC-V/ProcessorPkg/Include/RiscVImpl.h > > > > > > > new file mode 100644 > > > > > > > index 0000000000..14092df174 > > > > > > > --- /dev/null > > > > > > > +++ b/Silicon/RISC-V/ProcessorPkg/Include/RiscVImpl.h > > > > > > > @@ -0,0 +1,87 @@ > > > > > > > +/** @file > > > > > > > + RISC-V package definitions. > > > > > > > + > > > > > > > + Copyright (c) 2016 - 2019, Hewlett Packard Enterprise > > Development > > > > LP. All rights reserved.
> > > > > > > + > > > > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > > + > > > > > > > +**/ > > > > > > > + > > > > > > > +#ifndef RISCV_H_ > > > > > > > +#define RISCV_H_ > > > > > > > + > > > > > > > +#include > > > > > > > +#include > > > > > > > + > > > > > > > +#define _ASM_FUNC(Name, Section) \ > > > > > > > + .global Name ; \ > > > > > > > + .section #Section, "ax" ; \ > > > > > > > + .type Name, %function ; \ > > > > > > > + .p2align 2 ; \ > > > > > > > + Name: > > > > > > > + > > > > > > > +#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. > > ## > > > > Name) > > > > > > > + > > > > > > > +#if defined (MDE_CPU_RISCV64) > > > > > > > +typedef UINT64 RISC_V_REGS_PROTOTYPE; > > > > > > > +#else > > > > > > > +#endif > > > > > > > + > > > > > > > +// > > > > > > > +// Structure for 128-bit value > > > > > > > +// > > > > > > > +typedef struct { > > > > > > > + UINT64 Value64_L; > > > > > > > + UINT64 Value64_H; > > > > > > > +} RISCV_UINT128; > > > > > > > + > > > > > > > +#define RISCV_MACHINE_CONTEXT_SIZE 0x1000 > > > > > > > +typedef struct _RISCV_MACHINE_MODE_CONTEXT > > > > RISCV_MACHINE_MODE_CONTEXT; > > > > > > > + > > > > > > > +/// > > > > > > > +/// Exception handlers in context. > > > > > > > +/// > > > > > > > +typedef struct _EXCEPTION_HANDLER_CONTEXT { > > > > > > > + EFI_PHYSICAL_ADDRESS InstAddressMisalignedHander; > > > > > > > + EFI_PHYSICAL_ADDRESS InstAccessFaultHander; > > > > > > > + EFI_PHYSICAL_ADDRESS IllegalInstHander; > > > > > > > + EFI_PHYSICAL_ADDRESS BreakpointHander; > > > > > > > + EFI_PHYSICAL_ADDRESS LoadAddrMisalignedHander; > > > > > > > + EFI_PHYSICAL_ADDRESS LoadAccessFaultHander; > > > > > > > + EFI_PHYSICAL_ADDRESS StoreAmoAddrMisalignedHander; > > > > > > > + EFI_PHYSICAL_ADDRESS StoreAmoAccessFaultHander; > > > > > > > + EFI_PHYSICAL_ADDRESS EnvCallFromUModeHander; > > > > > > > + EFI_PHYSICAL_ADDRESS EnvCallFromSModeHander; > > > > > > > + EFI_PHYSICAL_ADDRESS EnvCallFromHModeHander; > > > > > > > + EFI_PHYSICAL_ADDRESS EnvCallFromMModeHander; > > > > > > > +} EXCEPTION_HANDLER_CONTEXT; > > > > > > > + > > > > > > > +/// > > > > > > > +/// Exception handlers in context. > > > > > > > +/// > > > > > > > +typedef struct _INTERRUPT_HANDLER_CONTEXT { > > > > > > > + EFI_PHYSICAL_ADDRESS SoftwareIntHandler; > > > > > > > + EFI_PHYSICAL_ADDRESS TimerIntHandler; > > > > > > > +} INTERRUPT_HANDLER_CONTEXT; > > > > > > > + > > > > > > > +/// > > > > > > > +/// Interrupt handlers in context. > > > > > > > +/// > > > > > > > +typedef struct _TRAP_HANDLER_CONTEXT { > > > > > > > + EXCEPTION_HANDLER_CONTEXT ExceptionHandlerContext; > > > > > > > + INTERRUPT_HANDLER_CONTEXT IntHandlerContext; > > > > > > > +} TRAP_HANDLER_CONTEXT; > > > > > > > + > > > > > > > +/// > > > > > > > +/// Machine mode context used for saveing hart-local context= . > > > > > > > +/// > > > > > > > +typedef struct _RISCV_MACHINE_MODE_CONTEXT { > > > > > > > + EFI_PHYSICAL_ADDRESS PeiService; /// PEI se= rvice. > > > > > > > + EFI_PHYSICAL_ADDRESS MachineModeTrapHandler; /// > > Machine > > > > mode trap handler. > > > > > > > + EFI_PHYSICAL_ADDRESS HypervisorModeTrapHandler; /// > > Hypervisor > > > > mode trap handler. > > > > > > > + EFI_PHYSICAL_ADDRESS SupervisorModeTrapHandler; /// > > Supervisor > > > > mode trap handler. > > > > > > > + EFI_PHYSICAL_ADDRESS UserModeTrapHandler; /// USer > > mode > > > > trap handler. > > > > > > > + TRAP_HANDLER_CONTEXT MModeHandler; /// Handle= r for > > > > machine mode. > > > > > > > +} RISCV_MACHINE_MODE_CONTEXT; > > > > > > > + > > > > > > > +#endif > > > > > > > -- > > > > > > > 2.31.1 > > > > > > > > > > > > > > > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > > --_000_PH7PR84MB188546E233657BE689C5F5A9FF019PH7PR84MB1885NAMP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
Hi Mike and Ray,
I just got a chance to back on this topic and below are few questions regar= ding the UefiCpuPkg for all processor archs.
I change the subject and loop Chao Li from Loongsoon who is contributing Lo= ongarch64 to Uefi/edk2. He may have to handle the similar things for Loonga= rch64.

I went through RISC-V modules that currently located on edk2-platforms repo= (Platform/RISC-V/PlatformPKg and Silicon/RISC-V/ProcessorPkg) and figure o= ut the modules we would move to under UefiCpuPkg and MdeModulePkg.  We= could go through the proposal in the design meeting later, however I would like to confirm the proposal of revi= sing modules under /UEfiCpuPkg those were implemented in X86 oriented befor= e we get to that point.

  • UefiCpuPKg\SecCore
  • The implementation of this module is very x86 oriented. There is = likely nothing to leverage between archs. My thought was 
  • 1. Having RISC-V SecCore in its own folder, e.g. UefiCpuP= kg/RISC-V/SecCore and create the individual INF for archs.
  • However,=  
    2. We can also consider having t= he separate section in SecCore/SecCore.inf. Move all X86 source files to un= der UefiCpuPkg/SecCore/X86 and have /RISC-V folder under UefiCpuPkg/SecCore  for RISC-V arch.= (I prefer this way)

  • UefiCpuPKg/= BaseUefiCpuLib
  • 1. Rename BaseUefiCpuLib.c to BaseUefiCpuLibIa32X64.c
  •    BaseUefiCpuLibRiscV6= 4.c for RISC-V arch and assembly code under /RISCV64
  • 2. Or move all X86 source files to unde= r BaseUefiCpuLib/X86, BaseUefiCpuLib/RISC-V for RISC-V arch (I prefer this way, the directory looks clean)
  • <= span style=3D"">
  • UefiCpuPKg/CpuExceptionHandlerLi= b
    Too many X86 source files, move all X86 source files to under CpuExecptionHander/X86= , CpuExecptionHander/RISC-V for RISC-V arch
  • Having abstract level under /CpuExecptionHander, e.g. INF, PeiException.c, DxeException= .c and etc.

  • UefiCpuPKg\Library\CpuTimerLib
  • BaseCpuTimerLibRiscV64.c for RISC-V arch.
  • 2. Or move all X86 source files to under BaseUefiCpuLib/X8= 6, BaseUefiCpuLib/RISC-V for RISC-V arch (= I prefer this way)

  • UefiCpuPKg/CpuDxe
  • Revise CpuDxe.c and CpuDxe.h to be abs= tract for the processor archs.
  • Move all x86 implementations to under = /X86, CpuDxe/RISC-V for RI= SC-V CpuDxe implementation
Let me know your thoughts, I can = initiate the PoC code after we get on the same page.
Thanks
Abner


From: Chang, Abner (HPS S= W/FW Technologist)
Sent: Saturday, February 5, 2022 10:56 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>; Leif Lindh= olm <leif@nuviainc.com>; devel@edk2.groups.io <devel@edk2.groups.i= o>; Ni, Ray <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>; Sami Mujawar <Sami.Mujaw= ar@arm.com>
Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add he= ader files of RISC-V processor package
 

Thanks Mike.

The reason I asked this question is we are working on the OvmfRiscV64 as yo= u suggested. However as you know that both RISC-V processor and platform pa= ckages are currently stay in edk2-platforms.  We have to make sure &nb= sp;CI won=92t throw errors if we use the edk2 modules in edk2-platforms. We are in rush to have RISC-V edk2 OVMF for RIS= C-V community. We will start to move RISC-V edk2 port to UefiCpuPkg or MdeP= kg once RISC-V OVMF port is upstream.

 

Abner

 

From: Kinney, Michael D <michael.d.kinney@intel.com>
Sent: Saturday, February 5, 2022 4:22 AM
To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>= ;; Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io; Ni, Ray &= lt;ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>; Sami Mujawar <Sami.Mujaw= ar@arm.com>
Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add he= ader files of RISC-V processor package

 

Abner,

 

I do not know if this patter is being used yet, but there is great value in= it for all platforms that are intended to be synced with edk2.

 

The idea of testing an edk2 change against all available open source platfo= rms that use edk2 would increase confidence in the edk2 change.

 

>>From a CI agent perspective, there are no issues with pulling more repos an= d running tests and providing results that can block an edk2 change if it b= reaks a specific platform.

 

Mike

 

From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
Sent: Friday, February 4, 2022 8:15 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io; Ni, Ray &= lt;ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.c= om>; Sami Mujawar <Sami.M= ujawar@arm.com>
Subject: Re: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add he= ader files of RISC-V processor package

 

BTW Mike,

Can Core CI on edk2 repo all= ow the modules referred in the DSC/FDF (e.g., OvmgRiscV64.dsc) to stay in e= dk2-platform?

 

Abner

 


From: Kinney, Michael D <mi= chael.d.kinney@intel.com>
Sent: Saturday, January 22, 2022 1:37 AM
To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Ni, Ray <= ;ray.ni@intel.com>; Kinney, Mich= ael D <michael.d.kinney@in= tel.com>
Cc: Andrew Fish <afish@apple.c= om>; Sami Mujawar <Sami.M= ujawar@arm.com>
Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add he= ader files of RISC-V processor package

 

I would recommend adding the Platform DSC required to run RISC-V with QEMU = to OvmfPkg so it can be part of CI for edk2 repo so any change to edk2 = that is used by RISC-V can be verified by build and boot to shell.

 

I would like to see the ArmVirtPkg merged = into OvmfPkg too so OvmfPkg providse FW build for all support CPU Arch= s running through QEMU to support edk2 CI that can build and boot to= shell in an Azure Pipelines agent.

 

Mike

 

From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
Sent: Friday, January 21, 2022 9:13 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io; Ni, Ray &= lt;ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.c= om>; Sami Mujawar <Sami.M= ujawar@arm.com>
Subject: Re: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add he= ader files of RISC-V processor package

 

Ok Mike and Leif,

Another question regarding t= o the location of RISC-V Virtual package for QEMU. What is the locatio= n and package you think RISC-V or other processor architectures should stay= with?

 

Thanks

Abner


From: Kinney, Michael D <mi= chael.d.kinney@intel.com>
Sent: Saturday, January 15, 2022 12:21 AM
To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Ni, Ray <= ;ray.ni@intel.com>; Kinney, Mich= ael D <michael.d.kinney@in= tel.com>
Cc: Andrew Fish <afish@apple.c= om>; Sami Mujawar <Sami.M= ujawar@arm.com>
Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add he= ader files of RISC-V processor package

 

Hi Abner,

We already have a package for common platform content in the edk2 repo.
This is the MdeModulePkg.

However, the number of common platform features added to the MdeModulePkg o= ver
time has made this a very large package, and this can be measured by how co= mplex the
Maintainer.txt rules are for this package.

The revised approach is to create feature packages that platforms can add if their platform requires that specific feature category.  Examples a= re
NetworkPkg, SecurityPkg, FmpDevicePkg, FatPkg, RedfishPkg, SourceLevelDebug= Pkg.

Instead of adding another generic package such as CommonPlatformPkg, I
would prefer to see the libs/modules either added to existing packages
that match the feature category, or create new feature packages if
there is a new feature category.

We also try to limit the edk2 repo to components that are directly related<= br> the UEFI/PI specifications and are not Si/Platform specific.  Si/Platf= orm
specific features go into the edk2-platforms repo.  An example of a ge= neric
feature in the edk2-platforms repo is Features/Ext4.  The UEFI spec on= ly
specifies FAT for UEFI boot from file system.

There are a number of other feature packages in edk2-platforms in the
Features directory, so you should review those as well to see if there
is natural landing zone for any of your components.

Mike


> -----Original Message-----
> From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
> Sent: Friday, January 14, 2022 3:15 AM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io; Ni, Ray > <ray.ni@intel.com>
> Cc: Andrew Fish <afish@apple.com= >; Sami Mujawar <Sami.Muj= awar@arm.com>
> Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add head= er files of RISC-V processor package
>
>
>
> > -----Original Message-----
> > From: Kinney, Michael D <michael.d.kinney@intel.com>
> > Sent: Friday, January 14, 2022 12:38 AM
> > To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>; Leif
> > Lindholm <leif@nuviainc.c= om>; devel@edk2.groups.io; Ni, Ray
> > <
ray.ni@intel.com>;= Kinney, Michael D <michae= l.d.kinney@intel.com>
> > Cc: Andrew Fish <afish@appl= e.com>; Sami Mujawar
> > <Sami.Mujawar@arm.com<= /a>>
> > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include: Add= header
> > files of RISC-V processor package
> >
> > Hi Abner,
> >
> > General recommendations included below.  Of course each
> > lib/modules/include needs to be reviewed and the
> > best location selected.  I am aware that there are component= s in edk2 that
> > do not follow these general
> > recommendations.  This is due to content that was added befo= re these
> > recommendations were established
> > and we have work to do to get everything aligned.
> >
> > Mike
> >
> > > -----Original Message-----
> > > From: Chang, Abner (HPS SW/FW Technologist) <
abner.chang@hpe.com>
> > > Sent: Wednesday, January 12, 2022 9:34 PM
> > > To: Kinney, Michael D <michael.d.kinney@intel.com>; Leif Lindholm
> > <leif@nuviainc.com>= ;; devel@edk2.groups.io; Ni, Ra= y
> > > <ray.ni@intel.com= >
> > > Cc: Andrew Fish <afish= @apple.com>; Sami Mujawar
> > <Sami.Mujawar@arm.com<= /a>>
> > > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/Include= : Add
> > header files of RISC-V processor package
> > >
> > > HI Mike,
> > > It is no problem to meet there. However, I am not available = to join the
> > design meeting in the next two weeks. Before we can get
> > > together to discuss the best locations, do you have informat= ion regarding
> > the rationale of driver/library location?
> > >
> > > What is the best location for,
> > > - Processor ARCH dependent modules
> >
> > MdePkg for libs
> > UefiCpuPkg for modules
> >
> > > - Common modules for all processor ARCHs
> >
> > Feature Packages based on the common feature.  Add to existi= ng if it fits.
> > Create new for completely new feature area.
> >
> > > - Platform module that is specific to processor ARCH?
> >
> > edk2-platform repository
> How about Leif's suggestion? The CommonPlatformPkg on edk2?
>
> Abner
>
> >
> > The only exception so far are platform modules used to support > > OvmfPkg/QEMU to support CI.
> > In this case the modules are added to OvmfPkg.
> >
> > > - Platform module that is common to processor ARCHs?
> >
> > edk2-platform repository
> >
> > The only exception so far are platform modules used to support > > OvmfPkg/QEMU to support CI.
> > In this case the modules are added to OvmfPkg.
> >
> > >
> > > Thanks
> > > Abner
> > >
> > > > -----Original Message-----
> > > > From: Kinney, Michael D <
michael.d.kinney@intel.com>
> > > > Sent: Monday, January 10, 2022 11:58 PM
> > > > To: Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io; Chang, > > Abner
> > > > (HPS SW/FW Technologist) <abner.chang@hpe.com>; Kinney, Michael D
> > > > <micha= el.d.kinney@intel.com>; Ni, Ray <ray.ni@intel.com>
> > > > Cc: Andrew Fish <= afish@apple.com>; Sami Mujawar
> > > > <Sami.Mujawa= r@arm.com>
> > > > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorPkg/In= clude: Add
> > header
> > > > files of RISC-V processor package
> > > >
> > > > Hi Abner,
> > > >
> > > > I see comments from Leif as well.
> > > >
> > > > Do you think a discussion in the design meeting Ray Ni = runs would be
> > > > valuable
> > > > to review all the modules/libs/includes and discuss opt= ions for the best
> > > > location for them to reside in the edk2 repos?
> > > >
> > > > Thanks,
> > > >
> > > > Mike
> > > >
> > > > > -----Original Message-----
> > > > > From: Kinney, Michael D <michael.d.kinney@intel.com>
> > > > > Sent: Monday, January 10, 2022 7:55 AM
> > > > > To: Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io; Chang, > > > > Abner <abner.= chang@hpe.com>; Kinney, Michael D
> > > > > <= michael.d.kinney@intel.com>
> > > > > Cc: Andrew Fish <afish@apple.com>; Sami Mujawar
> > > > <Sami.Mujawa= r@arm.com>
> > > > > Subject: RE: [edk2-devel] [PATCH 01/79] ProcessorP= kg/Include: Add
> > > > header files of RISC-V processor package
> > > > >
> > > > > Hi Abner,
> > > > >
> > > > > I would also like to see some proposals on adding = the RiscV CPU scoped
> > > > content
> > > > > to the existing MdePkg/UefiCpuPkg instead of addin= g a new top level
> > CPU
> > > > package.
> > > > >
> > > > > There is already some work started to move some of= the ARM specific
> > > > content
> > > > > from ARM CPU packages into MdePkg.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Mike
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Leif Lindholm <leif@nuviainc.com>
> > > > > > Sent: Monday, January 10, 2022 5:11 AM
> > > > > > To: d= evel@edk2.groups.io; Chang, Abner <abner.chang@hpe.com>
> > > > > > Cc: Andrew Fish <afish@apple.com>; Kinney, Michael D
> > > > <micha= el.d.kinney@intel.com>; Sami Mujawar
> > <Sami.Mujawar@arm.com<= /a>>
> > > > > > Subject: Re: [edk2-devel] [PATCH 01/79] Proce= ssorPkg/Include: Add
> > > > header files of RISC-V processor package
> > > > > >
> > > > > > On Sat, Jan 08, 2022 at 12:07:53 +0800, Abner= Chang wrote:
> > > > > > > (This is migrated from edk2-platforms:Si= licon/RISC-V)
> > > > > > >
> > > > > > > RISC-V processor package library definit= ions.
> > > > > > >
> > > > > > > IndustryStandard/RiscV.h
> > > > > > > -Add RiscV.h which conform with RISC-V P= rivilege Spec v1.10.
> > > > > > >
> > > > > > > RiscVImpl.h
> > > > > > > -Definition of EDK2 RISC-V implementatio= n.
> > > > > > >
> > > > > > > Signed-off-by: Abner Chang <
abner.chang@hpe.com>
> > > > > > > Co-authored-by: Daniel Schaefer <daniel.schaefer@hpe.com>
> > > > > > > Co-authored-by: Gilbert Chen <gilbert.chen@hpe.com>
> > > > > > > Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> > > > > >
> > > > > > Hmm, no.
> > > > > > I gave a reviewed-by for that patch to be mer= ged into edk2-platforms
> > > > > > once upon a time. This is not relevant for mi= gration to edk2.
> > > > > >
> > > > > > My proposal for migrating this code would be = as follows:
> > > > > > - Announce a hold on merging new code to Risc= V portions of
> > > > > >   edk2-platforms.
> > > > > > - Apply any and all bugfixes and CI/uncrustif= y fixes in place in
> > > > > >   edk2-platforms.
> > > > > > - Get some level of agreement for what to do = instead of
> > > > > >   RiscVPlatformPkg - i.e. slot into= MdeModulePkg instead.
> > > > > >   -  If that cannot be reached= within a few days, create a new
> > > > > >      top-level direc= tory called "CommonPlatformPkg" or something,
> > > > > >      with you, Danie= l(/Gilbert?), Sami, me as maintainers.
> > > > > >      - Move all of t= he RiscVPlatformPkg code under there instead.
> > > > > >      - I'll follow w= ith ArmPlatformPkg.
> > > > > >      - PC/AT code sh= ould move across too over time.
> > > > > > - Move the rest of the code across unmodified= as massive single
> > > > > >   patches per package (potentially = more patches than that for
> > > > > >   RiscVPlatformPkg).
> > > > > >   - Drop all existing Reviewed-by/A= cked-by.
> > > > > >   - After each "move" pat= ch, insert a "fixup" patch to address the
> > > > > >     things that need fixi= ng due to path/name changes.
> > > > > >
> > > > > > /
> > > > > >     Leif
> > > > > >
> > > > > > > Cc: Leif Lindholm <leif.lindholm@linaro.org>
> > > > > > > Cc: Gilbert Chen <gilbert.chen@hpe.com>
> > > > > > > ---
> > > > > > >  .../Include/IndustryStandard/RiscV= .h          | 156
> > ++++++++++++++++++
> > > > > > >  .../RISC-V/ProcessorPkg/Include/Ri= scVImpl.h   |  87 ++++++++++
> > > > > > >  2 files changed, 243 insertions(+)=
> > > > > > >  create mode 100644 Silicon/RISC- > > > > V/ProcessorPkg/Include/IndustryStandard/RiscV.h
> > > > > > >  create mode 100644 Silicon/RISC- > > V/ProcessorPkg/Include/RiscVImpl.h
> > > > > > >
> > > > > > > diff --git a/Silicon/RISC-
> > > > V/ProcessorPkg/Include/IndustryStandard/RiscV.h b/Silic= on/RISC-
> > > > > > V/ProcessorPkg/Include/IndustryStandard/RiscV= .h
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..2a992394ed
> > > > > > > --- /dev/null
> > > > > > > +++ b/Silicon/RISC-
> > V/ProcessorPkg/Include/IndustryStandard/RiscV.h
> > > > > > > @@ -0,0 +1,156 @@
> > > > > > > +/** @file
> > > > > > > +  RISC-V package definitions.
> > > > > > > +
> > > > > > > +  Copyright (c) 2019, Hewlett Pack= ard Enterprise Development LP.
> > All
> > > > rights reserved.<BR>
> > > > > > > +
> > > > > > > +  SPDX-License-Identifier: BSD-2-C= lause-Patent
> > > > > > > +
> > > > > > > +**/
> > > > > > > +
> > > > > > > +#ifndef RISCV_INDUSTRY_STANDARD_H_
> > > > > > > +#define RISCV_INDUSTRY_STANDARD_H_
> > > > > > > +
> > > > > > > +#if defined (MDE_CPU_RISCV64)
> > > > > > > +#define RISC_V_XLEN_BITS 64
> > > > > > > +#else
> > > > > > > +#endif
> > > > > > > +
> > > > > > > +#define RISC_V_ISA_ATOMIC_EXTENSION&nbs= p;            &= nbsp;   (0x00000001 <<
> > 0)
> > > > > > > +#define RISC_V_ISA_BIT_OPERATION_EXTENS= ION
> > (0x00000001
> > > > << 1)
> > > > > > > +#define RISC_V_ISA_COMPRESSED_EXTENSION=              (0= x00000001
> > <<
> > > > 2)
> > > > > > > +#define RISC_V_ISA_DOUBLE_PRECISION_FP_= EXTENSION
> > > > (0x00000001 << 3)
> > > > > > > +#define RISC_V_ISA_RV32E_ISA  = ;            &n= bsp;         (0x00000001 << 4= )
> > > > > > > +#define RISC_V_ISA_SINGLE_PRECISION_FP_= EXTENSION
> > > > (0x00000001 << 5)
> > > > > > > +#define RISC_V_ISA_ADDITIONAL_STANDARD_= EXTENSION
> > > > (0x00000001 << 6)
> > > > > > > +#define RISC_V_ISA_RESERVED_1 &nbs= p;            &= nbsp;        (0x00000001 << 7)
> > > > > > > +#define RISC_V_ISA_INTEGER_ISA_EXTENSIO= N            (0x0000= 0001
> > <<
> > > > 8)
> > > > > > > +#define
> > > > RISC_V_ISA_DYNAMICALLY_TRANSLATED_LANGUAGE_EXTENSION > > > > (0x00000001 << 9)
> > > > > > > +#define RISC_V_ISA_RESERVED_2 &nbs= p;            &= nbsp;        (0x00000001 << 10) > > > > > > > +#define RISC_V_ISA_DECIMAL_FP_EXTENSION=              (0= x00000001
> > <<
> > > > 11)
> > > > > > > +#define RISC_V_ISA_INTEGER_MUL_DIV_EXTE= NSION
> > (0x00000001
> > > > << 12)
> > > > > > > +#define RISC_V_ISA_USER_LEVEL_INTERRUPT= _SUPPORTED
> > > > (0x00000001 << 13)
> > > > > > > +#define RISC_V_ISA_RESERVED_3 &nbs= p;            &= nbsp;        (0x00000001 << 14) > > > > > > > +#define RISC_V_ISA_PACKED_SIMD_EXTENSIO= N
> > (0x00000001 <<
> > > > 15)
> > > > > > > +#define RISC_V_ISA_QUAD_PRECISION_FP_EX= TENSION
> > > > (0x00000001 << 16)
> > > > > > > +#define RISC_V_ISA_RESERVED_4 &nbs= p;            &= nbsp;        (0x00000001 << 17) > > > > > > > +#define RISC_V_ISA_SUPERVISOR_MODE_IMPL= EMENTED
> > > > (0x00000001 << 18)
> > > > > > > +#define RISC_V_ISA_TRANSATIONAL_MEMORY_= EXTENSION
> > > > (0x00000001 << 19)
> > > > > > > +#define RISC_V_ISA_USER_MODE_IMPLEMENTE= D
> > (0x00000001
> > > > << 20)
> > > > > > > +#define RISC_V_ISA_VECTOR_EXTENSION&nbs= p;            &= nbsp;   (0x00000001 <<
> > 21)
> > > > > > > +#define RISC_V_ISA_RESERVED_5 &nbs= p;            &= nbsp;        (0x00000001 << 22) > > > > > > > +#define RISC_V_ISA_NON_STANDARD_EXTENSI= ON
> > (0x00000001
> > > > << 23)
> > > > > > > +#define RISC_V_ISA_RESERVED_6 &nbs= p;            &= nbsp;        (0x00000001 << 24) > > > > > > > +#define RISC_V_ISA_RESERVED_7 &nbs= p;            &= nbsp;        (0x00000001 << 25) > > > > > > > +
> > > > > > > +//
> > > > > > > +// RISC-V CSR definitions.
> > > > > > > +//
> > > > > > > +//
> > > > > > > +// Machine information
> > > > > > > +//
> > > > > > > +#define RISCV_CSR_MACHINE_MVENDORID&nbs= p;    0xF11
> > > > > > > +#define RISCV_CSR_MACHINE_MARCHID =       0xF12
> > > > > > > +#define RISCV_CSR_MACHINE_MIMPID &= nbsp;      0xF13
> > > > > > > +#define RISCV_CSR_MACHINE_HARRID &= nbsp;      0xF14
> > > > > > > +//
> > > > > > > +// Machine Trap Setup.
> > > > > > > +//
> > > > > > > +#define RISCV_CSR_MACHINE_MSTATUS =       0x300
> > > > > > > +#define RISCV_CSR_MACHINE_MISA &nb= sp;        0x301
> > > > > > > +#define RISCV_CSR_MACHINE_MEDELEG =       0x302
> > > > > > > +#define RISCV_CSR_MACHINE_MIDELEG =       0x303
> > > > > > > +#define RISCV_CSR_MACHINE_MIE &nbs= p;         0x304
> > > > > > > +#define RISCV_CSR_MACHINE_MTVEC &n= bsp;       0x305
> > > > > > > +
> > > > > > > +#define RISCV_TIMER_COMPARE_BITS &= nbsp;    32
> > > > > > > +//
> > > > > > > +// Machine Timer and Counter.
> > > > > > > +//
> > > > > > > +//#define RISCV_CSR_MACHINE_MTIME =         0x701
> > > > > > > +//#define RISCV_CSR_MACHINE_MTIMEH = ;       0x741
> > > > > > > +//
> > > > > > > +// Machine Trap Handling.
> > > > > > > +//
> > > > > > > +#define RISCV_CSR_MACHINE_MSCRATCH = ;     0x340
> > > > > > > +#define RISCV_CSR_MACHINE_MEPC &nb= sp;        0x341
> > > > > > > +#define RISCV_CSR_MACHINE_MCAUSE &= nbsp;      0x342
> > > > > > > +  #define MACHINE_MCAUSE_EXCEPTION= _ MASK 0x0f
> > > > > > > +  #define MACHINE_MCAUSE_INTERRUPT=       (RISC_V_XLEN_BITS -
> > 1)
> > > > > > > +#define RISCV_CSR_MACHINE_MBADADDR = ;     0x343
> > > > > > > +#define RISCV_CSR_MACHINE_MIP &nbs= p;         0x344
> > > > > > > +
> > > > > > > +//
> > > > > > > +// Machine Protection and Translation.<= br> > > > > > > > +//
> > > > > > > +#define RISCV_CSR_MACHINE_MBASE &n= bsp;       0x380
> > > > > > > +#define RISCV_CSR_MACHINE_MBOUND &= nbsp;      0x381
> > > > > > > +#define RISCV_CSR_MACHINE_MIBASE &= nbsp;      0x382
> > > > > > > +#define RISCV_CSR_MACHINE_MIBOUND =       0x383
> > > > > > > +#define RISCV_CSR_MACHINE_MDBASE &= nbsp;      0x384
> > > > > > > +#define RISCV_CSR_MACHINE_MDBOUND =       0x385
> > > > > > > +
> > > > > > > +//
> > > > > > > +// Supervisor mode CSR.
> > > > > > > +//
> > > > > > > +#define RISCV_CSR_SUPERVISOR_SSTATUS&nb= sp;   0x100
> > > > > > > +  #define SSTATUS_SIE_BIT_POSITION=       1
> > > > > > > +  #define SSTATUS_SPP_BIT_POSITION=       8
> > > > > > > +#define RISCV_CSR_SUPERVISOR_SIE &= nbsp;      0x104
> > > > > > > +#define RISCV_CSR_SUPERVISOR_SSCRATCH&n= bsp;  0x140
> > > > > > > +#define RISCV_CSR_SUPERVISOR_SEPC =       0x141
> > > > > > > +#define RISCV_CSR_SUPERVISOR_SCAUSE&nbs= p;    0x142
> > > > > > > +  #define SCAUSE_USER_SOFTWARE_INT=         0
> > > > > > > +  #define SCAUSE_SUPERVISOR_SOFTWA= RE_INT  1
> > > > > > > +  #define SCAUSE_USER_TIMER_INT&nb= sp;          4
> > > > > > > +  #define SCAUSE_SUPERVISOR_TIMER_= INT     5
> > > > > > > +  #define SCAUSE_USER_EXTERNAL_INT=         8
> > > > > > > +  #define SCAUSE_SUPERVISOR_EXTERN= AL_INT  9
> > > > > > > +#define RISCV_CSR_SUPERVISOR_STVAL = ;     0x143
> > > > > > > +#define RISCV_CSR_SUPERVISOR_SIP &= nbsp;      0x144
> > > > > > > +#define RISCV_CSR_SUPERVISOR_SATP =       0x180
> > > > > > > +
> > > > > > > +#if defined (MDE_CPU_RISCV64)
> > > > > > > +  #define RISCV_SATP_MODE_MASK&nbs= p;         0xF000000000000000
> > > > > > > +  #define RISCV_SATP_MODE_BIT_POSI= TION  60
> > > > > > > +#endif
> > > > > > > +    #define RISCV_SATP_M= ODE_OFF         0
> > > > > > > +    #define RISCV_SATP_M= ODE_SV32        1
> > > > > > > +    #define RISCV_SATP_M= ODE_SV39        8
> > > > > > > +    #define RISCV_SATP_M= ODE_SV48        9
> > > > > > > +    #define RISCV_SATP_M= ODE_SV57        10
> > > > > > > +    #define RISCV_SATP_M= ODE_SV64        11
> > > > > > > +
> > > > > > > +  #define SATP64_ASID_MASK &n= bsp;            0x0F= FFF00000000000
> > > > > > > +  #define SATP64_PPN_MASK &nb= sp;            = 0x00000FFFFFFFFFFF
> > > > > > > +
> > > > > > > +#define RISCV_CAUSE_MISALIGNED_FETCH&nb= sp;       0x0
> > > > > > > +#define RISCV_CAUSE_FETCH_ACCESS &= nbsp;          0x1
> > > > > > > +#define RISCV_CAUSE_ILLEGAL_INSTRUCTION=      0x2
> > > > > > > +#define RISCV_CAUSE_BREAKPOINT &nb= sp;            0x3 > > > > > > > +#define RISCV_CAUSE_MISALIGNED_LOAD&nbs= p;        0x4
> > > > > > > +#define RISCV_CAUSE_LOAD_ACCESS &n= bsp;           0x5
> > > > > > > +#define RISCV_CAUSE_MISALIGNED_STORE&nb= sp;       0x6
> > > > > > > +#define RISCV_CAUSE_STORE_ACCESS &= nbsp;          0x7
> > > > > > > +#define RISCV_CAUSE_USER_ECALL &nb= sp;            0x8 > > > > > > > +#define RISCV_CAUSE_HYPERVISOR_ECALL&nb= sp;       0x9
> > > > > > > +#define RISCV_CAUSE_SUPERVISOR_ECALL&nb= sp;       0xa
> > > > > > > +#define RISCV_CAUSE_MACHINE_ECALL =           0xb
> > > > > > > +#define RISCV_CAUSE_FETCH_PAGE_FAULT&nb= sp;       0xc
> > > > > > > +#define RISCV_CAUSE_LOAD_PAGE_FAULT&nbs= p;        0xd
> > > > > > > +#define RISCV_CAUSE_STORE_PAGE_FAULT&nb= sp;       0xf
> > > > > > > +#define RISCV_CAUSE_FETCH_GUEST_PAGE_FA= ULT  0x14
> > > > > > > +#define RISCV_CAUSE_LOAD_GUEST_PAGE_FAU= LT   0x15
> > > > > > > +#define RISCV_CAUSE_STORE_GUEST_PAGE_FA= ULT  0x17
> > > > > > > +
> > > > > > > +//
> > > > > > > +// Machine Read-Write Shadow of Hypervi= sor Read-Only Registers
> > > > > > > +//
> > > > > > > +#define RISCV_CSR_HTIMEW  &nb= sp;            = 0xB01
> > > > > > > +#define RISCV_CSR_HTIMEHW  &n= bsp;            0xB8= 1
> > > > > > > +//
> > > > > > > +// Machine Host-Target Interface (Non-S= tandard Berkeley
> > Extension)
> > > > > > > +//
> > > > > > > +#define RISCV_CSR_MTOHOST  &n= bsp;            0x78= 0
> > > > > > > +#define RISCV_CSR_MFROMHOST  =            0x781
> > > > > > > +
> > > > > > > +#endif
> > > > > > > diff --git a/Silicon/RISC-V/ProcessorPkg= /Include/RiscVImpl.h
> > > > b/Silicon/RISC-V/ProcessorPkg/Include/RiscVImpl.h
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..14092df174
> > > > > > > --- /dev/null
> > > > > > > +++ b/Silicon/RISC-V/ProcessorPkg/Includ= e/RiscVImpl.h
> > > > > > > @@ -0,0 +1,87 @@
> > > > > > > +/** @file
> > > > > > > +  RISC-V package definitions.
> > > > > > > +
> > > > > > > +  Copyright (c) 2016 - 2019, Hewle= tt Packard Enterprise
> > Development
> > > > LP. All rights reserved.<BR>
> > > > > > > +
> > > > > > > +  SPDX-License-Identifier: BSD-2-C= lause-Patent
> > > > > > > +
> > > > > > > +**/
> > > > > > > +
> > > > > > > +#ifndef RISCV_H_
> > > > > > > +#define RISCV_H_
> > > > > > > +
> > > > > > > +#include <Uefi.h>
> > > > > > > +#include <IndustryStandard/RiscV.h&g= t;
> > > > > > > +
> > > > > > > +#define _ASM_FUNC(Name, Section) &= nbsp;  \
> > > > > > > +  .global   Name &n= bsp;            = ;    ; \
> > > > > > > +  .section  #Section, "a= x"        ; \
> > > > > > > +  .type     Na= me, %function       ; \
> > > > > > > +  .p2align  2  &nbs= p;            &= nbsp;     ; \
> > > > > > > +  Name:
> > > > > > > +
> > > > > > > +#define ASM_FUNC(Name) _ASM_FUNC(ASM_PF= X(Name), .text.
> > ##
> > > > Name)
> > > > > > > +
> > > > > > > +#if defined (MDE_CPU_RISCV64)
> > > > > > > +typedef UINT64 RISC_V_REGS_PROTOTYPE; > > > > > > > +#else
> > > > > > > +#endif
> > > > > > > +
> > > > > > > +//
> > > > > > > +// Structure for 128-bit value
> > > > > > > +//
> > > > > > > +typedef struct {
> > > > > > > +  UINT64    &n= bsp;       Value64_L;
> > > > > > > +  UINT64    &n= bsp;       Value64_H;
> > > > > > > +} RISCV_UINT128;
> > > > > > > +
> > > > > > > +#define RISCV_MACHINE_CONTEXT_SIZE = ; 0x1000
> > > > > > > +typedef struct _RISCV_MACHINE_MODE_CONT= EXT
> > > > RISCV_MACHINE_MODE_CONTEXT;
> > > > > > > +
> > > > > > > +///
> > > > > > > +/// Exception handlers in context.
> > > > > > > +///
> > > > > > > +typedef struct _EXCEPTION_HANDLER_CONTE= XT {
> > > > > > > +  EFI_PHYSICAL_ADDRESS InstAddress= MisalignedHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS InstAccessF= aultHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS IllegalInst= Hander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS BreakpointH= ander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS LoadAddrMis= alignedHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS LoadAccessF= aultHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS StoreAmoAdd= rMisalignedHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS StoreAmoAcc= essFaultHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS EnvCallFrom= UModeHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS EnvCallFrom= SModeHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS EnvCallFrom= HModeHander;
> > > > > > > +  EFI_PHYSICAL_ADDRESS EnvCallFrom= MModeHander;
> > > > > > > +} EXCEPTION_HANDLER_CONTEXT;
> > > > > > > +
> > > > > > > +///
> > > > > > > +/// Exception handlers in context.
> > > > > > > +///
> > > > > > > +typedef struct _INTERRUPT_HANDLER_CONTE= XT {
> > > > > > > +  EFI_PHYSICAL_ADDRESS SoftwareInt= Handler;
> > > > > > > +  EFI_PHYSICAL_ADDRESS TimerIntHan= dler;
> > > > > > > +} INTERRUPT_HANDLER_CONTEXT;
> > > > > > > +
> > > > > > > +///
> > > > > > > +/// Interrupt handlers in context.
> > > > > > > +///
> > > > > > > +typedef struct _TRAP_HANDLER_CONTEXT {<= br> > > > > > > > +  EXCEPTION_HANDLER_CONTEXT Except= ionHandlerContext;
> > > > > > > +  INTERRUPT_HANDLER_CONTEXT IntHan= dlerContext;
> > > > > > > +} TRAP_HANDLER_CONTEXT;
> > > > > > > +
> > > > > > > +///
> > > > > > > +/// Machine mode context used for savei= ng hart-local context.
> > > > > > > +///
> > > > > > > +typedef struct _RISCV_MACHINE_MODE_CONT= EXT {
> > > > > > > +  EFI_PHYSICAL_ADDRESS PeiService;=             &nb= sp;   /// PEI service.
> > > > > > > +  EFI_PHYSICAL_ADDRESS MachineMode= TrapHandler;    ///
> > Machine
> > > > mode trap handler.
> > > > > > > +  EFI_PHYSICAL_ADDRESS HypervisorM= odeTrapHandler; ///
> > Hypervisor
> > > > mode trap handler.
> > > > > > > +  EFI_PHYSICAL_ADDRESS SupervisorM= odeTrapHandler; ///
> > Supervisor
> > > > mode trap handler.
> > > > > > > +  EFI_PHYSICAL_ADDRESS UserModeTra= pHandler;       /// USer
> > mode
> > > > trap handler.
> > > > > > > +  TRAP_HANDLER_CONTEXT MModeHandle= r;            &= nbsp; /// Handler for
> > > > machine mode.
> > > > > > > +} RISCV_MACHINE_MODE_CONTEXT;
> > > > > > > +
> > > > > > > +#endif
> > > > > > > --
> > > > > > > 2.31.1
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
>

--_000_PH7PR84MB188546E233657BE689C5F5A9FF019PH7PR84MB1885NAMP_--