From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.web10.27813.1685617148498395438 for ; Thu, 01 Jun 2023 03:59:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=nlNCnPNY; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: quicinc.com, ip: 205.220.180.131, mailfrom: quic_llindhol@quicinc.com) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35157WVk000745; Thu, 1 Jun 2023 10:59:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=qcppdkim1; bh=9BAGPrcXJENXMRrpNkXrftvsfQKn8KdE+WiPR9BHukw=; b=nlNCnPNY42ir5zwCd9EDSw7GGDPSN4snrEhkh9ZLUEzO32Ilh5ZQ3MSGfcZGJwUKifuL BNd495Gx3krmLDcftPFC2hjNoYQnmlXf+MFzZeU0k1kdfmcFWObQQc80quoDCSPTBLAu PVo9P/WOToP/rsArmhADhO2ukbC9l2w6t4dIKePmGKLuYOQ4UnNjeiEgCv3yStodL2qw ivXoM+niOgg5Z0pvGJPRuY2ODTNeJIFIGFQ+kbi8tfVPgqXudFSHBflYhMhxEmCGd1zJ Yj0QnpTXznBY6N86Y2U8IGM794Mb2Oi1zETdJ+AVzDhB3GD0fahEpElyc0dFuC0zcJcN Xg== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qxkbu0ww8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Jun 2023 10:59:03 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 351Ax2VB018404 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 1 Jun 2023 10:59:02 GMT Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 1 Jun 2023 03:59:01 -0700 Date: Thu, 1 Jun 2023 11:58:58 +0100 From: "Leif Lindholm" To: Marcin Juszkiewicz CC: , Ard Biesheuvel , Rebecca Cran , Sami Mujawar Subject: Re: [PATCH 1/2] Platform/SbsaQemu: read platform version Message-ID: References: <20230515102423.359916-1-marcin.juszkiewicz@linaro.org> <20230515102423.359916-2-marcin.juszkiewicz@linaro.org> MIME-Version: 1.0 In-Reply-To: <20230515102423.359916-2-marcin.juszkiewicz@linaro.org> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: kq0t3d91fP8iz0IVoBxSx5uqSO54v89T X-Proofpoint-GUID: kq0t3d91fP8iz0IVoBxSx5uqSO54v89T X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-01_07,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 phishscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 impostorscore=0 mlxlogscore=790 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010097 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Mon, May 15, 2023 at 12:24:22 +0200, Marcin Juszkiewicz wrote: > Qemu has versioning for sbsa-ref platform. TF-A reads it from provided > DeviceTree and provides as SMC. > > This change adds reading platform version into EDK2. > > Signed-off-by: Marcin Juszkiewicz > --- > Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 3 +++ > .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 27 +++++++++++++++++++ > .../SbsaQemuPlatformDxe.inf | 5 ++++ > Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 3 +++ > 4 files changed, 38 insertions(+) > > diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > index 0bd0df4f0239..b88729ad8ad6 100644 > --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc > @@ -558,6 +558,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE = FALSE > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT0000" > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK0000" > > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0 > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0 > + > ################################################################################ > # > # Components Section - list of all EDK II Modules needed by this Platform > diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c > index b7270a07abbd..199766c7014a 100644 > --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c > +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c > @@ -7,15 +7,25 @@ > * > **/ > > +#include > #include > #include > #include > #include > #include > #include > +#include > > #include > > +/* those probably should go into IndustryStandard/ArmStdSmc.h */ > +#define SMC_FASTCALL 0x80000000 > +#define SMC64_FUNCTION (SMC_FASTCALL | 0x40000000) > +#define SIP_FUNCTION (SMC64_FUNCTION | 0x02000000) > +#define SIP_FUNCTION_ID(n) (SIP_FUNCTION | (n)) Can you break this out into a separate patch for ArmStdSmc.h? We're out of the freeze, so can merge without delay. But please add SMC_ prefix on the last two macros for that. > + > +#define SIP_SVC_VERSION SIP_FUNCTION_ID(1) Could you break this out into a separate include file? I'd suggest Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuSmc.h (we'll be adding more calls there later). / Leif > + > EFI_STATUS > EFIAPI > InitializeSbsaQemuPlatformDxe ( > @@ -26,6 +36,9 @@ InitializeSbsaQemuPlatformDxe ( > EFI_STATUS Status; > UINTN Size; > VOID* Base; > + UINTN Arg0; > + UINTN Arg1; > + UINTN Result; > > DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", __FUNCTION__)); > > @@ -51,5 +64,19 @@ InitializeSbsaQemuPlatformDxe ( > return Status; > } > > + Result = ArmCallSmc0 (SIP_SVC_VERSION, &Arg0, &Arg1, NULL); > + if (Result == SMC_ARCH_CALL_SUCCESS) > + { > + Result = PcdSet32S (PcdPlatformVersionMajor, Arg0); > + ASSERT_EFI_ERROR (Result); > + Result = PcdSet32S (PcdPlatformVersionMinor, Arg1); > + ASSERT_EFI_ERROR (Result); > + } > + > + Arg0 = PcdGet32 (PcdPlatformVersionMajor); > + Arg1 = PcdGet32 (PcdPlatformVersionMinor); > + > + DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", Arg0, Arg1)); > + > return EFI_SUCCESS; > } > diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf > index 21d2135f6d17..1f2c8a9dd6af 100644 > --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf > +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf > @@ -20,6 +20,7 @@ > SbsaQemuPlatformDxe.c > > [Packages] > + ArmPkg/ArmPkg.dec > ArmVirtPkg/ArmVirtPkg.dec > EmbeddedPkg/EmbeddedPkg.dec > MdeModulePkg/MdeModulePkg.dec > @@ -27,6 +28,7 @@ > Silicon/Qemu/SbsaQemu/SbsaQemu.dec > > [LibraryClasses] > + ArmSmcLib > PcdLib > DebugLib > NonDiscoverableDeviceRegistrationLib > @@ -36,6 +38,9 @@ > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize > > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor > + > [Depex] > TRUE > > diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec > index 9448852967b6..5182978cf56d 100644 > --- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec > +++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec > @@ -67,3 +67,6 @@ > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|0x0000011B > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x0000011C > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x0000011D > + > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT32|0x0000011E > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT32|0x0000011F > -- > 2.40.1 >