From nobody Fri Oct 11 18:31:39 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+104875+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+104875+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684158483; cv=none; d=zohomail.com; s=zohoarc; b=fY/vfkvfm4VA79Y+o8qwtTtItuz4yeuHAI/AymrQ2lRboj8/jfZB1a9YKSXuqIZZJoA0BwQ3/V45L65rh5hkn5NzpQUkAPY+UwApdpAODfpuBj14zohRSTh58+l3cw7tgdXocIzwZWw1aHzT5GIAlveiBvg9dzDNQGa/cB6hTAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684158483; 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=I851LIio0sLLEFcAKJFSHhiYyIYfKd4a4I84dBBtOYk=; b=VQWniqQ+4pZeVwBnBRcfGYhc+FkwYawv3hyQTQyAOOgdhthXPgva8KwhwefDq07/PWoRIwXhtQB2H82YTYhKznedWOkwLXtvGH6/cBlKSMQlboBpr/rW7bYnP4XhtPcKz5VTOspJdvUMauUrkbDcInKlr10NzqeN8HkXkdx6/Ek= 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+104875+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 1684158483726275.6235553963055; Mon, 15 May 2023 06:48:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hfNnYY1788612xT2ZaRCL24d; Mon, 15 May 2023 06:48:03 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web11.88647.1684158482338942069 for ; Mon, 15 May 2023 06:48:02 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id D4B482600A6; Mon, 15 May 2023 15:48:00 +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 O5b_fgzxlHIq; Mon, 15 May 2023 15:47:58 +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 C8239260BA8; Mon, 15 May 2023 15:47:56 +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 v5 2/2] Platform/SbsaQemu: read GIC base from TF-A Date: Mon, 15 May 2023 15:47:52 +0200 Message-Id: <20230515134752.362671-3-marcin.juszkiewicz@linaro.org> In-Reply-To: <20230515134752.362671-1-marcin.juszkiewicz@linaro.org> References: <20230515134752.362671-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: k0VgXeP2NLCRW4sp3uC59AyBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684158483; bh=Vc802GsX/OsrLSEbA7vm2IlsRF75CzYfdLDyvql3zRs=; h=Cc:Date:From:Reply-To:Subject:To; b=Tg8g9bQK1bupNItj2pHjIT9nxvbFW1LA1N2ohhiJ6vZnLPdY5q5N6QPip3nerE4hZ1b vJzrIwgnHhUpWIR7JOZfHnEwl1lEGMQtuDrQVnwDP6xwKFFn4dhtkh4LTDcp3zHX62jvU cJBazzsEQmVfuTHVApP4L6+jtlkiRzrUQk8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684158485619100009 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 39f5639d0a28..889270c76344 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 @@ -79,5 +81,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; + } + + SmcResult =3D ArmCallSmc0 (SIP_SVC_GET_GICD, &Arg0, NULL, NULL); + if (SmcResult =3D=3D SMC_ARCH_CALL_SUCCESS) + { + Result =3D PcdSet64S (PcdGicDistributorBase, Arg0); + ASSERT_RETURN_ERROR (Result); + } + + Arg0 =3D PcdGet64 (PcdGicDistributorBase); + + DEBUG ((DEBUG_INFO, "GICD base: 0x%x\n", Arg0)); + + SmcResult =3D ArmCallSmc0 (SIP_SVC_GET_GICR, &Arg0, NULL, NULL); + if (SmcResult =3D=3D SMC_ARCH_CALL_SUCCESS) + { + Result =3D PcdSet64S (PcdGicRedistributorsBase, Arg0); + ASSERT_RETURN_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 (#104875): https://edk2.groups.io/g/devel/message/104875 Mute This Topic: https://groups.io/mt/98903528/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-