From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web12.14172.1589985897862864954 for ; Wed, 20 May 2020 07:44:57 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0409d44702=daniel.schaefer@hpe.com) Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04KEivbh025360; Wed, 20 May 2020 14:44:57 GMT Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0a-002e3701.pphosted.com with ESMTP id 314qjje3vy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 May 2020 14:44:57 +0000 Received: from G9W8454.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.4]) (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 AAA0BAC; Wed, 20 May 2020 14:44:47 +0000 (UTC) Received: from G1W8107.americas.hpqcorp.net (2002:10c1:483b::10c1:483b) by G9W8454.americas.hpqcorp.net (2002:10d8:a104::10d8:a104) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 20 May 2020 14:44:46 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (15.241.52.13) by G1W8107.americas.hpqcorp.net (16.193.72.59) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 20 May 2020 14:44:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YBeYGT5dA6clq5sZU2dakSjFtivIQnVwZSnDgvlJzN0gsQx/xQAniPmRyNMbeFRzfFdXlkyulHw784wDVCuj1DSGJAmfLhJsDajQP+cPE8O163xSoX+KlYeNUnvF7lgn4OahcOR8+c0pZAtY0j1/oTXBKNIRmop2Oy/5YTnRzCe8i8Qdy967baz3a/eieSFaFS5NYOgcrZK4YL7PM8/Rzyc+wf3Zpiq8bAvEcFZIX9Oi7bEKxKtzA+1VEmStnhi9Sfow01HLh1ndbknKG7RLMjPLlpjI110ZnC1yk3uqwbCFENlKWX9Os6y6X+nidWqHYKB1ccUVZwmniMxlU1pRcA== 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-SenderADCheck; bh=E7e9cQuPQazmF4UwIuaqpzHgvmpmw6nS1dmaqao0r3o=; b=RVMbNXpDrS6hxd7GEu5yf4Rg1FEz5+tGawOjV8CIgHAd8PuTVCvje3HcKvVZJElewX39clqcxzT/Gf+MK7y8e6+uI8Ha97nxqdvRZhAfpXMZw3IQ//W0RD962aHVmuTM79JZMHAjrBVtPY3OoByZP+kVImyIHoFQuBBT8rFb87Ds7eTwWgw/yxKunEy/zJtNN8CBZQEXgaLSAhUIkbzosGCU227qQ+8qivHtgrXgTKEbwl0IsABeUp1rM+WiY9dmopTHdvWzhbWUIkXl7rVxV8PBAglR1HgCBeV02ZqDtpBb67d2mxSY4BsnPG/4aHKLTMjaKL1x++/3m4Bo7xZu3Q== 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 Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hpe.com; Received: from CS1PR8401MB0726.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:750c::23) by CS1PR8401MB0325.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7515::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Wed, 20 May 2020 14:44:46 +0000 Received: from CS1PR8401MB0726.NAMPRD84.PROD.OUTLOOK.COM ([fe80::6d01:dcc0:65e:ef77]) by CS1PR8401MB0726.NAMPRD84.PROD.OUTLOOK.COM ([fe80::6d01:dcc0:65e:ef77%7]) with mapi id 15.20.3000.034; Wed, 20 May 2020 14:44:45 +0000 Subject: Re: [PATCH v2 2/3] ProcessorPkg/Library: Add RiscVOpensbiLib To: Leif Lindholm CC: , Gilbert Chen , Leif Lindholm , Abner Chang , Michael D Kinney References: <20200515133937.29909-1-daniel.schaefer@hpe.com> <20200515133937.29909-3-daniel.schaefer@hpe.com> <20200520120042.GM1923@vanye> From: "Daniel Schaefer" Message-ID: <89fdccad-9dc9-398a-738c-31552ca90dad@hpe.com> Date: Wed, 20 May 2020 16:44:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 In-Reply-To: <20200520120042.GM1923@vanye> X-ClientProxiedBy: AM0PR04CA0041.eurprd04.prod.outlook.com (2603:10a6:208:1::18) To CS1PR8401MB0726.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:750c::23) X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.178.165] (93.215.202.37) by AM0PR04CA0041.eurprd04.prod.outlook.com (2603:10a6:208:1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Wed, 20 May 2020 14:44:44 +0000 X-Originating-IP: [93.215.202.37] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9dc74590-f885-4e8d-ba3c-08d7fccc56e1 X-MS-TrafficTypeDiagnostic: CS1PR8401MB0325: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-Forefront-PRVS: 04097B7F7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A0X1xget/tSTm+lj/IZV2dSBT6fmosH2HDfFklth6VNDJZPDLGVW5K+Xv0vFypTR8x6Xa2b3wWAFS4fC96GmDuCJIir+J37N+fNa0rY+wQjcjpLy1QD61wb37R5LL+ZQm67blbTJg288SDPVG7y85qra0zQBQKMuZ03gKq5SWvFbZj608NBKjs+USBWwWbCS8K934b/p53v3+p3NrkmnowThTj9/1Ov1HzDOzSnFKFU/BFoAgBLWRQk8o78Kb2yFREjo4yEZ4TDIpW8VYe5TWziX84VCdziDvtpihgDCoM/c1L1epT+6+/btvPOR8spvAnz7WeaMctrFb4WOECjefuQdXrf2taHbHx+vYd+UZKvrgLcnOQ7+etUurZRjUxm0ofcN4NDxs8SXCZNjpZJM1ZYNYxLHk4eUuCL8fGak5mUOwWQ4RqDhQRzyj20lnoNfUyBBLi1j8iCXDGXcSl4T0Gc1qI1Lf3VEoBSlEdFg6lk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CS1PR8401MB0726.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFTY:;SFS:(376002)(396003)(136003)(39860400002)(366004)(346002)(54906003)(6486002)(16576012)(316002)(66946007)(66476007)(8676002)(66556008)(2906002)(8936002)(36756003)(31686004)(966005)(478600001)(5660300002)(31696002)(53546011)(956004)(26005)(86362001)(44832011)(6666004)(2616005)(52116002)(16526019)(4326008)(6916009)(186003)(145603002)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: KpNB85OiBdFIClBJ3Fw4OPcBt4b6x3AhRSlufndGLWDN25cBDrsrc2oMSZHMe9XhbNkQZ6fJmUVMgjvHY+4l1L+QWe3e1nSsS/skEr/3zM+5cSwsbVvqYNMqqWrSgw7t99H1iPBbfDERMmDSqqEMl727WEDsBbS7CIAXSLn9wLFXHPmK2Rei4wlyZrbxlEaSuJ7cYMISU1QRMxec6kbG6iZhqI0MLPiBHCYXrhp61HU4OB/mwaTwZi+RSBq3CAGNbYpW7n3iZDS9QUEAdszfBYCEqbgl+qlS1r1JJpFnjQVLnM6mpRdIn50YqhYbpJWDWDwhbSic06dOu41PHEElfo3RRKkpa+tOmSiipeiBQ8gROGOt9eF5fXdhVA8ZK0YINrX/bluSmmyVo2EJkW4rfJXElwEml5pePNY+2H4AjD0Xfwowm8awIenU6gMZuDCHv5En8UGuJpEeE3gp/BERdv/B49OFOeVswts0BtkZXg4= X-MS-Exchange-CrossTenant-Network-Message-Id: 9dc74590-f885-4e8d-ba3c-08d7fccc56e1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2020 14:44:45.8865 (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: /gz7Ddv57eyzSBaS05VtiOSV2GVM70gZVBNAf3Z3wSIX47K4g6MbT000QslJi5C1rJ5bV1ne7FxAn3DXp0BBZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0325 X-OriginatorOrg: hpe.com X-Proofpoint-UnRewURL: 1 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.676 definitions=2020-05-20_10:2020-05-20,2020-05-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 adultscore=0 cotscore=-2147483648 phishscore=0 spamscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005200121 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 5/20/20 2:00 PM, Leif Lindholm wrote: > (Fixing Mike's email in reply) > > On Fri, May 15, 2020 at 15:39:36 +0200, Daniel Schaefer wrote: >> From: Abner Chang >> >> EDK2 RISC-V OpenSBI library which pull in external source files under >> RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi to the build process. >> >> Signed-off-by: Abner Chang >> Co-authored-by: Daniel Schaefer > > These two fields have flipped contents since v1 (without being > mentioned in either cover letter or below --- of this one). > > The v1 form was correct - only the contributor can certify the > adherence of the contribution to https://developercertificate.org/ . > Meaning if the commit says Signed-off-by: Abner, I can't send it to the list? >> Co-authored-by: Gilbert Chen >> Reviewed-by: Leif Lindholm >> >> Cc: Abner Chang >> Cc: Gilbert Chen >> Cc: Michael D Kinney >> Cc: Leif Lindholm >> --- >> Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf | 60 +++++++++++++++ >> Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h | 79 ++++++++++++++++++++ >> Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h | 73 ++++++++++++++++++ >> 3 files changed, 212 insertions(+) >> >> diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf >> new file mode 100644 >> index 000000000000..59dbd67d8e03 >> --- /dev/null >> +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf >> @@ -0,0 +1,60 @@ >> +## @file >> +# RISC-V Opensbi Library Instance. >> +# >> +# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.
>> +# >> +# SPDX-License-Identifier: BSD-2-Clause-Patent >> +# >> +## >> + >> +[Defines] >> + INF_VERSION = 0x0001001b >> + BASE_NAME = RiscVOpensbiLib >> + FILE_GUID = 6EF0C812-66F6-11E9-93CE-3F5D5F0DF0A7 >> + MODULE_TYPE = BASE >> + VERSION_STRING = 1.0 >> + LIBRARY_CLASS = RiscVOpensbiLib >> + >> +[Sources] >> + opensbi/lib/sbi/riscv_asm.c >> + opensbi/lib/sbi/riscv_atomic.c >> + opensbi/lib/sbi/riscv_hardfp.S >> + opensbi/lib/sbi/riscv_locks.c >> + opensbi/lib/sbi/sbi_console.c >> + opensbi/lib/sbi/sbi_ecall.c >> + opensbi/lib/sbi/sbi_ecall_vendor.c >> + opensbi/lib/sbi/sbi_ecall_replace.c >> + opensbi/lib/sbi/sbi_ecall_legacy.c >> + opensbi/lib/sbi/sbi_ecall_base.c >> + opensbi/lib/sbi/sbi_emulate_csr.c >> + opensbi/lib/sbi/sbi_fifo.c >> + opensbi/lib/sbi/sbi_hart.c >> + opensbi/lib/sbi/sbi_hfence.S >> + opensbi/lib/sbi/sbi_illegal_insn.c >> + opensbi/lib/sbi/sbi_init.c >> + opensbi/lib/sbi/sbi_ipi.c >> + opensbi/lib/sbi/sbi_misaligned_ldst.c >> + opensbi/lib/sbi/sbi_scratch.c >> + opensbi/lib/sbi/sbi_string.c >> + opensbi/lib/sbi/sbi_system.c >> + opensbi/lib/sbi/sbi_timer.c >> + opensbi/lib/sbi/sbi_tlb.c >> + opensbi/lib/sbi/sbi_trap.c >> + opensbi/lib/sbi/sbi_unpriv.c >> + opensbi/lib/utils/sys/clint.c >> + opensbi/lib/utils/irqchip/plic.c >> + opensbi/lib/utils/serial/sifive-uart.c >> + opensbi/lib/utils/serial/uart8250.c >> + >> +[Packages] >> + EmbeddedPkg/EmbeddedPkg.dec # For libfdt. >> + MdePkg/MdePkg.dec >> + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec >> + >> +[LibraryClasses] >> + BaseLib >> + PcdLib >> + RiscVCpuLib >> + I talked to Abner about this and we're going to remove this LibraryClasses section. It's not needed. >> + >> + >> diff --git a/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h b/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h >> new file mode 100644 >> index 000000000000..c5c0bd6d9b01 >> --- /dev/null >> +++ b/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h >> @@ -0,0 +1,79 @@ >> +/** @file >> + SBI inline function calls. >> + >> + Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.
>> + >> + SPDX-License-Identifier: BSD-2-Clause-Patent >> + >> +**/ >> + >> +#ifndef EDK2_SBI_H_ >> +#define EDK2_SBI_H_ >> + >> +#include // Reference to header file in opensbi >> +#include >> +#include // Reference to header file wrapper >> + >> +#define SBI_SUCCESS 0 >> +#define SBI_ERR_FAILED -1 >> +#define SBI_ERR_NOT_SUPPORTED -2 >> +#define SBI_ERR_INVALID_PARAM -3 >> +#define SBI_ERR_DENIED -4 >> +#define SBI_ERR_INVALID_ADDRESS -5 >> +#define SBI_ERR_ALREADY_AVAILABLE -6 > > Did the cover-letter changelog not suggest these had been changed from > local definitions to redefining the existing ones from Opensbi? > If this was "not possible" (the exception stated in cover letter), I > would have expected a comment above (below ---) on why. Or a reply to > my feedback on v1. Oh, I squashed it into the other commit: ProcessorPkg/Library: Add RiscVEdk2SbiLib > >> + >> +#define SBI_BASE_EXT 0x10 >> +#define SBI_HSM_EXT 0x48534D >> +#define SBI_TIME_EXT 0x54494D45 >> +#define SBI_IPI_EXT 0x735049 >> +#define SBI_RFNC_EXT 0x52464E43 >> + >> +// >> +// Below two definitions should be defined in OpenSBI. >> +// >> +#define SBI_EXT_FIRMWARE_CODE_BASE_START 0x0A000000 >> +#define SBI_EXT_FIRMWARE_CODE_BASE_END 0x0AFFFFFF >> + >> +#define SBI_GET_SPEC_VERSION_FUNC 0 >> +#define SBI_GET_IMPL_ID_FUNC 1 >> +#define SBI_GET_IMPL_VERSION_FUNC 2 >> +#define SBI_PROBE_EXTENSION_FUNC 3 >> +#define SBI_GET_MVENDORID_FUNC 4 >> +#define SBI_GET_MARCHID_FUNC 5 >> +#define SBI_GET_MIMPID_FUNC 6 >> + >> +#define SBI_HART_START_FUNC 0 >> +#define SBI_HART_STOP_FUNC 1 >> +#define SBI_HART_GET_STATUS_FUNC 2 >> + >> +#define RISC_V_MAX_HART_SUPPORTED 16 >> + >> +typedef >> +VOID >> +(EFIAPI *RISCV_HART_SWITCH_MODE)( >> + IN UINTN FuncArg0, >> + IN UINTN FuncArg1, >> + IN UINTN NextAddr, >> + IN UINTN NextMode, >> + IN BOOLEAN NextVirt >> + ); >> + >> +// >> +// Keep the structure member in 64-bit alignment. >> +// >> +typedef struct { >> + UINT64 IsaExtensionSupported; // The ISA extension this core supported. >> + RISCV_UINT128 MachineVendorId; // Machine vendor ID >> + RISCV_UINT128 MachineArchId; // Machine Architecture ID >> + RISCV_UINT128 MachineImplId; // Machine Implementation ID >> + RISCV_HART_SWITCH_MODE HartSwitchMode; // OpenSBI's function to switch the mode of a hart >> +} EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC; >> +#define FIRMWARE_CONTEXT_HART_SPECIFIC_SIZE (64 * 8) // This is the size of EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC >> + // structure. Referred by both C code and assembly code. >> + >> +typedef struct { >> + VOID *PeiServiceTable; // PEI Service table >> + EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *HartSpecific[RISC_V_MAX_HART_SUPPORTED]; >> +} EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT; >> + >> +#endif >> diff --git a/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h b/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h >> new file mode 100644 >> index 000000000000..5f3278e8461f >> --- /dev/null >> +++ b/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h >> @@ -0,0 +1,73 @@ >> +/** @file >> + RISC-V OpesbSBI header file reference. >> + >> + Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.
>> + >> + SPDX-License-Identifier: BSD-2-Clause-Patent >> + >> +**/ >> +#ifndef EDK2_SBI_TYPES_H_ >> +#define EDK2_SBI_TYPES_H_ >> + >> +#include >> + >> +typedef INT8 s8; >> +typedef UINT8 u8; >> +typedef UINT8 uint8_t; >> + >> +typedef INT16 s16; >> +typedef UINT16 u16; >> +typedef INT16 int16_t; >> +typedef UINT16 uint16_t; >> + >> +typedef INT32 s32; >> +typedef UINT32 u32; >> +typedef INT32 int32_t; >> +typedef UINT32 uint32_t; >> + >> +typedef INT64 s64; >> +typedef UINT64 u64; >> +typedef INT64 int64_t; >> +typedef UINT64 uint64_t; >> + >> +#define PRILX "016lx" > > Feedback on PRILX not addressed, or commented on.> / > Leif > In addition to the cover letter, I also responded to your previous review, see: https://edk2.groups.io/g/devel/message/59681 TLDR; we need to keep it.