From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 6B95E9416E7 for ; Thu, 16 Nov 2023 11:21:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ddbbMkpfjqBBdWBCAjNhbcjn7SBRyjyNlyP3gyPAAzs=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:CC:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1700133713; v=1; b=tFu5TtcWigsQpKlkw7R0HqvtqfdFrIbvJNG0yFlGxtoBjsFKSfMkWG5NiLbhNrHruRJ8t7TB fU1icxqjL0DnEj+76+Sfe500uQ6M2Dbppx9tndTGeVerAwF/5RtU2e2H7HwcnS/6lm3nXUq0EHZ 3sFjriG+HPbAPE6sWBbuG+20= X-Received: by 127.0.0.2 with SMTP id syu2YY7687511xipl9FmBbtY; Thu, 16 Nov 2023 03:21:53 -0800 X-Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.web11.4633.1700133712272734172 for ; Thu, 16 Nov 2023 03:21:52 -0800 X-Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AG4v22I032059; Thu, 16 Nov 2023 11:21:48 GMT X-Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ud6echdaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 11:21:48 +0000 X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AGBLXKp009160 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 11:21:33 GMT X-Received: from [10.111.130.96] (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.1118.39; Thu, 16 Nov 2023 03:21:31 -0800 Message-ID: Date: Thu, 16 Nov 2023 11:21:29 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v2 15/30] EmbeddedPkg: Add PcdPrePiCpuIoSize width for LOONGARCH64 To: , CC: , Ard Biesheuvel , Abner Chang , Daniel Schaefer References: <20231106032521.2251143-1-lichao@loongson.cn> <20231106032901.2285407-1-lichao@loongson.cn> <94637080-fb4d-44a1-9399-2b67525e4f6f@quicinc.com> From: "Leif Lindholm" In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-GUID: hMJsDAsE78o5yImZG_yEXNn2H0WOXIla X-Proofpoint-ORIG-GUID: hMJsDAsE78o5yImZG_yEXNn2H0WOXIla Precedence: Bulk 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,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: sMm7U0x1yNfEpfz1X3VLRmh7x7686176AA= Content-Language: en-GB Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=tFu5TtcW; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2023-11-16 08:15, Pedro Falcato wrote: > Leif, >=20 > Can you clarify the meaning of PcdPrePiCpuIoSize? Not out of memory, so let's go exploring. > I was thinking it's > supposed to be the size of the port-mapped IO for the > architecture/platform (as hinted by in X64 =3D IA32 =3D 16, and ARM=3D0)= , > but from a quick git grep I can tell that > 1) most platforms define it to something else (ArmVirt defines it to > 16, real platforms have a plethora of other values) > 2) gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize has no internal consumer > in EmbeddedPkg, but only in ArmPlatformPkg and LoongArchQemuPkg (and > BeagleBoardPkg's PrePi) ArmVirtPkg reads this Pcd in https://github.com/tianocore/edk2/blob/master/ArmVirtPkg/PrePi/PrePi.c#L87 which is in a call to BuildCpuHob, in https://github.com/tianocore/edk2/blob/master/EmbeddedPkg/Library/PrePiHobL= ib/Hob.c#L644 which uses the argument to initialize the SizeOfIoSpace in EFI_HOB_CPU (defined in PI spec). This eventually gets dug up in https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Gcd/Gcd= .c#L2559 where it is used to set up the GCD I/O Space Map. This is also the only way to find out it describes a power of 2. Neither=20 the spec nor any of the comment headers in the codebase describe what=20 the size means. Tsk, tsk. Ultimately, this ends up being used in https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Pci/PciHostB= ridgeDxe/PciHostBridge.c#L175 during InitializePciHostBridge (). So I'm guessing, and I think it rings a bell, that this is needed to=20 enable PCIe I/O resources to be assigned, which *can* be supported on=20 Arm and probably Loongson systems through magic memory regions trapping=20 accesses in the PCIe IP. > 3) Platform/Loongson/LoongArchQemuPkg/Loongson.dec: > gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|0|UINT8|0x00010001 <-- ?? Yeah, it's not great that we don't seem to have a way to trap when Pcd's=20 get redefined outside of their own namespace. That happens way too=20 frequently. That's certainly a bug. > and FWIW, LoongArch does not seem to have port-mapped IO at all. So I guess the setting comes down to whether that is considered to be=20 the expected behaviour on Loongson platforms or not. About which I have=20 no idea and am happy to trust the author on :) / Leif -=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 (#111307): https://edk2.groups.io/g/devel/message/111307 Mute This Topic: https://groups.io/mt/102413876/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-