From nobody Sat Jul 27 03:26:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104862+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104862+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684146277; cv=none; d=zohomail.com; s=zohoarc; b=nl1+617PC5zMx75H1t16qLFYNwusUM5xA3TixRvV53OvYPbti0ADrtW518sBRmMpcWLGvSBTSTnUxkE4MuKAEBi9K8duv8Ye2m/iBJZX51VQOtM65BOIsUn1yicL3TNGxryJ4LjXSj/6ZabSB5STsD1R7eOmKg0CMZQiEwmN34E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684146277; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=K5qr7n0h3ujupkKxrWcOJJAvX0CxTEMncCJ9LZWB+JM=; b=ZZdiFldIH40zPEgcVtqwpRwA6Pa/ODzoIgmp3RFYux08IcHDtWLkEhCiOgAZCZbGa3MxAZ6xB1bYXqPEn3Wubv2NEV0P26otTsOPBPfP1kS5Kc0NoIkPMXhfnhxb4GPlSA7RLzM1a0nHNuiVbgs/FkdvsYv4pBKIvuso2GinTas= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104862+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1684146277350280.69749908255255; Mon, 15 May 2023 03:24:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Z6dBYY1788612xYTducTvU6I; Mon, 15 May 2023 03:24:37 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web10.85269.1684146275771509098 for ; Mon, 15 May 2023 03:24:36 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 63E1C260BA8; Mon, 15 May 2023 12:24:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JChR6xm1kl4j; Mon, 15 May 2023 12:24:32 +0200 (CEST) X-Received: from applejack.lan (83.11.34.59.ipv4.supernova.orange.pl [83.11.34.59]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 1DABF260BA9; Mon, 15 May 2023 12:24:31 +0200 (CEST) From: "Marcin Juszkiewicz" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Rebecca Cran , Sami Mujawar , Marcin Juszkiewicz Subject: [edk2-devel] [PATCH 2/2] Platform/SbsaQemu: read GIC base from TF-A Date: Mon, 15 May 2023 12:24:23 +0200 Message-Id: <20230515102423.359916-3-marcin.juszkiewicz@linaro.org> In-Reply-To: <20230515102423.359916-1-marcin.juszkiewicz@linaro.org> References: <20230515102423.359916-1-marcin.juszkiewicz@linaro.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,marcin.juszkiewicz@linaro.org X-Gm-Message-State: t4aLXRkzVJTTUsz3en5hAZG1x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684146277; bh=j1WfUnq5Qaj151v71NKxD7Z+83WiSwubM+XZMBoaQg4=; h=Cc:Date:From:Reply-To:Subject:To; b=YDFMQsRGsKKAGbLBaQ0qWToqWta5OBMPivZnGyhqdan2xPr9FHj6gqglHshM4KFe/67 1HuEJ0iiOz4oLtrk9qWRX1nCwMVoXwCHPnH9Rgz43MkfTqXA4fjhC8Rb81HgcDlRDvB0z O2dO0tSQtrLPmWr9Jn1MDYsOKX1trki+pgU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684146278077100007 Content-Type: text/plain; charset="utf-8" Qemu has versioning for sbsa-ref platform. TF-A reads data from provided DeviceTree and provides as SMC. This change adds reading GIC base addresses into EDK2. Signed-off-by: Marcin Juszkiewicz --- .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 30 +++++++++++++++++++ .../SbsaQemuPlatformDxe.inf | 4 +++ 2 files changed, 34 insertions(+) diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatf= ormDxe.c index 199766c7014a..1213268519c8 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c @@ -25,6 +25,8 @@ #define SIP_FUNCTION_ID(n) (SIP_FUNCTION | (n)) =20 #define SIP_SVC_VERSION SIP_FUNCTION_ID(1) +#define SIP_SVC_GET_GICD SIP_FUNCTION_ID(2) +#define SIP_SVC_GET_GICR SIP_FUNCTION_ID(3) =20 EFI_STATUS EFIAPI @@ -78,5 +80,33 @@ InitializeSbsaQemuPlatformDxe ( =20 DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", Arg0, Arg1)); =20 + /* If we are on platform version 0.0 then there is no more data for us i= n DeviceTree */ + if ((Arg0 =3D=3D 0) & (Arg1 =3D=3D 0)) + { + return EFI_SUCCESS; + } + + Result =3D ArmCallSmc0 (SIP_SVC_GET_GICD, &Arg0, NULL, NULL); + if (Result =3D=3D SMC_ARCH_CALL_SUCCESS) + { + Result =3D PcdSet64S (PcdGicDistributorBase, Arg0); + ASSERT_EFI_ERROR (Result); + } + + Arg0 =3D PcdGet64 (PcdGicDistributorBase); + + DEBUG ((DEBUG_INFO, "GICD base: 0x%x\n", Arg0)); + + Result =3D ArmCallSmc0 (SIP_SVC_GET_GICR, &Arg0, NULL, NULL); + if (Result =3D=3D SMC_ARCH_CALL_SUCCESS) + { + Result =3D PcdSet64S (PcdGicRedistributorsBase, Arg0); + ASSERT_EFI_ERROR (Result); + } + + Arg0 =3D PcdGet64 (PcdGicRedistributorsBase); + + DEBUG ((DEBUG_INFO, "GICR base: 0x%x\n", Arg0)); + return EFI_SUCCESS; } diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPla= tformDxe.inf index 1f2c8a9dd6af..545794a8c7ff 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .inf +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .inf @@ -41,6 +41,10 @@ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor =20 + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + [Depex] TRUE =20 --=20 2.40.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104862): https://edk2.groups.io/g/devel/message/104862 Mute This Topic: https://groups.io/mt/98900381/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-