From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.groups.io (mail04.groups.io [45.79.224.9]) by spool.mail.gandi.net (Postfix) with ESMTPS id 164187803D0 for ; Mon, 15 Apr 2024 05:32:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Sq7ETuSAm0geA5+tDlb/LZom0XkyEtTb/RXgwvwt36A=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1713159155; v=1; b=uyEgVbUHxSDa5kPm9ezxT1SESoysOsXNNg1lhxBGCQYSREh1WcXq6mD1662HNHGkLLmMpt84 u3sn7AsLImkU2lN0X0VPacggrquXNujCI2ucM7IET3ir+1hugQ+USX6DDdcdfjJVGmrvxuA+o28 2VEBU1pGhvzNVb4ed9UMvwXdABnPEyzuXM9ZF3CUgqKPNP6vr7zQDu2ogGweP3GSJhOWWd2h2KN ecCPtlSPOTUL7Jl64whsQfMV/3xbSWiIPTb5wyLB1/jpcyAQtx5gEKsJ04r/9VcgbGMaGVXtFXX YJlDCZq2jAzE8WDRArHY/7CyYy9xOxRQfZiP/O0v6ejBA== X-Received: by 127.0.0.2 with SMTP id T3QFYY7687511xazbcc5FQUI; Sun, 14 Apr 2024 22:32:35 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mx.groups.io with SMTP id smtpd.web11.14288.1713159154977090679 for ; Sun, 14 Apr 2024 22:32:35 -0700 X-CSE-ConnectionGUID: ZeqAVaQvQvGlw2cjAWO+Jw== X-CSE-MsgGUID: Uugq4KG/RNa1f1u7bn+x/w== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="31009678" X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="31009678" X-Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 22:32:35 -0700 X-CSE-ConnectionGUID: JcbZ2Wr9SwGSaiK9XCtuUg== X-CSE-MsgGUID: /4gH//mnSh6km3/wFQMUMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="59243018" X-Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 14 Apr 2024 22:32:34 -0700 X-Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 14 Apr 2024 22:32:34 -0700 X-Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 14 Apr 2024 22:32:33 -0700 X-Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Sun, 14 Apr 2024 22:32:33 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 14 Apr 2024 22:32:33 -0700 X-Received: from PH7PR11MB5943.namprd11.prod.outlook.com (2603:10b6:510:13f::19) by DM4PR11MB5325.namprd11.prod.outlook.com (2603:10b6:5:390::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.26; Mon, 15 Apr 2024 05:32:32 +0000 X-Received: from PH7PR11MB5943.namprd11.prod.outlook.com ([fe80::20f5:8535:1838:9d4e]) by PH7PR11MB5943.namprd11.prod.outlook.com ([fe80::20f5:8535:1838:9d4e%4]) with mapi id 15.20.7452.049; Mon, 15 Apr 2024 05:32:32 +0000 From: "Jayaprakash, N" To: "devel@edk2.groups.io" , "Jayaprakash, N" CC: Rebecca Cran , "Kinney, Michael D" Subject: Re: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc:add rdmsr_ex & wrmsr_ex functions to read/write cpu specific msrs Thread-Topic: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc:add rdmsr_ex & wrmsr_ex functions to read/write cpu specific msrs Thread-Index: AQHaiw9vOsT7KodHAE2KeTJCgUKwfbFo1mog Date: Mon, 15 Apr 2024 05:32:32 +0000 Message-ID: References: <20240410061849.984-1-n.jayaprakash@intel.com> <17C4D6CE42E68D40.16800@groups.io> In-Reply-To: <17C4D6CE42E68D40.16800@groups.io> Accept-Language: en-IN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR11MB5943:EE_|DM4PR11MB5325:EE_ x-ms-office365-filtering-correlation-id: cf88ebaa-a663-41a6-f89b-08dc5d0d72c0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: oZWidVKJWMqsfErdZsbup+WfvwHS4RpOwz+5Z4n+3+TJOobEqRgw1jm2NWH3Vpp41HbA9fC3NXUaefkKxO7gTDPdcVBb0/IiAJi0EVZVUiNV0mCBJvr/4gCF+q/SrqqhoejpNVU0xlQXTDnw3YudKBEe55z5VcdK52n1XUEFCK0LR42jQzS2FW8x+IJe/ar4zBBcdxDEoY6fPEs5TiC/ZF++kudaWslukQL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PHbYZ?= =?us-ascii?Q?Ime3HR22IgVIfN1aNItaXLRngkzMoAnN+XT3wFm9MlRC11ne7Jlv/FxdTtND?= =?us-ascii?Q?l5NLuxh3l8YVlqeENjfjSHPBHpzw9N22VrQRfIC069a8FDWyp9kn+Yza6k0p?= =?us-ascii?Q?vYt1T8Ow2/4UEWYrjz4EZlL7/rVD6NAtgf19fkeAlPYG1mkxAlVXSdnYY1Xi?= =?us-ascii?Q?McIIktkqnliAIMuQQlf7zwKR3pyZiyKt28gcGjsrYaLK/uK2e5RRpnc4vy99?= =?us-ascii?Q?6dlZzutsMoZuBEYEC1bo9yZxJqZA2WGHzMx8xAio?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5943.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf88ebaa-a663-41a6-f89b-08dc5d0d72c0 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2024 05:32:32.0704 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: p9huTn6VoiSDcJ1gzKvhd2zcgx9jFfctn3wjEfzeMvs197TPGP12vLXQ2SBfI8wbdhNlV0z1lQPKIV+9n9+TFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5325 X-OriginatorOrg: intel.com 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 Resent-Date: Sun, 14 Apr 2024 22:32:35 -0700 Resent-From: n.jayaprakash@intel.com Reply-To: devel@edk2.groups.io,n.jayaprakash@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: XDxl0KqnSziOAOuYatD4c2SLx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=uyEgVbUH; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.9 as permitted sender) smtp.mailfrom=bounce@groups.io + Rebecca and Mike, Would you be able to review this PR? Regards, JP -----Original Message----- From: devel@edk2.groups.io On Behalf Of Jayaprakash,= N Sent: Wednesday, April 10, 2024 11:49 AM To: devel@edk2.groups.io Cc: Jayaprakash, N ; Rebecca Cran ; Kinney, Michael D Subject: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc:add rdmsr_ex & wrmsr_= ex functions to read/write cpu specific msrs REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4746 The rdmsr_ex and wrmsr_ex are extension APIs to the rdmsr and wrmsr APIs su= pported in edk2 module. These extension APIs makes it possible to read / wr= ite MSRs from specific processors and fills an existing gap in this area. Cc: Rebecca Cran Cc: Michael D Kinney Cc: Jayaprakash N Signed-off-by: Jayaprakash N --- .../PyMod-3.6.8/Modules/edk2module.c | 159 +++++++++++++++++- .../Python/Python-3.6.8/Python368.inf | 3 + 2 files changed, 158 insertions(+), 4 deletions(-) diff --git a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/ed= k2module.c b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/ed= k2module.c index d6af8da..f1b13a6 100644 --- a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2modul= e.c +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2mo +++ dule.c @@ -3,7 +3,7 @@ Derived from posixmodule.c in Python 2.7.2. =20 Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2024, Intel Corporation. All rights=20 + reserved.
This program and the accompanying materials are licensed and made avai= lable under the terms and conditions of the BSD License that accompanies this dist= ribution. The full text of the license may be found at @@ -22,16 +22,23 @@ #inc= lude #include #include +#include // Needed for the definition of EFI_AP_PROC= EDURE #include #include #include #include +#include +#include =20 #ifdef __cplusplus extern "C" { #endif =20 PyTypeObject EfiGuidType; +EFI_MP_SERVICES_PROTOCOL *gpMpService =3D NULL; +UINTN gBSPProcessorNumber =3D 0; +UINTN gNumberOfProcessors =3D 0; +UINTN gNumberOfEnabledProcessors =3D 0; =20 extern void _swsmi( unsigned int smi_code_data, unsigned int rax_value, un= signed int rbx_value, unsigned int rcx_value, unsigned int rdx_value, unsig= ned int rsi_value, unsigned int rdi_value ); // -- Support routines @@ -16= 9,6 +176,35 @@ PyDoc_STRVAR(edk2__doc__, /* dummy version. _PyVerify_fd() is already defined in fileobject.h */ #d= efine _PyVerify_fd_dup2(A, B) (1) =20 +static EFI_STATUS +MpServicesWhoAmI ( + IN EFI_MP_SERVICES_PROTOCOL *pMpService, + OUT UINTN *pProcessorNumber + ) +{ + return pMpService->WhoAmI (pMpService, pProcessorNumber); } + +static EFI_STATUS +MpServicesGetNumberOfProcessors ( + IN EFI_MP_SERVICES_PROTOCOL *pMpService, + OUT UINTN *pNumberOfProcessors, + OUT UINTN *pNumberOfEnabledProcessors + + ) +{ + return pMpService->GetNumberOfProcessors (pMpService,=20 +pNumberOfProcessors, pNumberOfEnabledProcessors); } + +static EFI_STATUS +MpServicesSwitchBSP ( + IN EFI_MP_SERVICES_PROTOCOL *pMpService, + IN UINTN ProcessorNumber + ) +{ + return pMpService->SwitchBSP(pMpService, ProcessorNumber, TRUE); } + #ifndef UEFI_C_SOURCE /* Return a dictionary corresponding to the POSIX environment table */ ex= tern char **environ; @@ -3865,6 +3901,56 @@ edk2_rdmsr(PyObject *self, PyOb= ject *args) return Py_BuildValue("(II)", (unsigned long)veax, (unsigned long)vedx); = } =20 +PyDoc_STRVAR(efi_rdmsr_ex__doc__, +"rdmsr_ex(cpu, msr) -> (lower_32bits, higher_32bits)\n\ \n\ Read the=20 +given msr by switching to cpu and return the data as tuple.\n\ \n\=20 +Parameters:\n\ + cpu - The cpu number in hex or int format\n\ + msr - The msr in hex or int format\n\ \n\ Return Value:\n\ + a tuple with lower and higher 32 bit values read from the msr\n\=20 +"); + +static PyObject * +edk2_rdmsr_ex(PyObject *self, PyObject *args) { + unsigned int cpu, vecx, veax, vedx; + unsigned int bsp_switched =3D 0; + EFI_STATUS status =3D 0; + UINT64 data =3D 0; + + if (!PyArg_ParseTuple(args, "II", &cpu, &vecx)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + if (cpu !=3D gBSPProcessorNumber && cpu < gNumberOfProcessors) { + //switch the BSP to the cpu + status =3D MpServicesSwitchBSP(gpMpService, cpu); + if (!EFI_ERROR(status)) + { + bsp_switched =3D 1; + } + } + + data =3D AsmReadMsr64(vecx); + + if (bsp_switched) + { + // switch BSP to the saved BSP processor + MpServicesSwitchBSP(gpMpService, gBSPProcessorNumber); + // update the saved BSP processor + MpServicesWhoAmI(gpMpService, &gBSPProcessorNumber); + } + Py_END_ALLOW_THREADS + veax =3D (UINT32)data; + vedx =3D (UINT64)data >> 32; + return Py_BuildValue("(II)", (unsigned long)veax, (unsigned=20 +long)vedx); } + PyDoc_STRVAR(efi_wrmsr__doc__, "wrmsr(msr, lower_32bits, higher_32bits) -> None\n\ \n\ @@ -3889,6 +3975,= 58 @@ edk2_wrmsr(PyObject *self, PyObject *args) data =3D vedx << 32 | veax; Py_BEGIN_ALLOW_THREADS AsmWriteMsr64(vecx, data); + Py_END_ALLOW_THREADS + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(efi_wrmsr_ex__doc__, +"wrmsr_ex(cpu, msr, lower_32bits, higher_32bits) -> None\n\ \n\ Writes=20 +higher_32bits:lower_32bits to the given msr.\n\ \n\ Parameters:\n\ + cpu - The cpu number in hex or int format\n\ + msr - The msr in hex or int format\n\ + lower_32bits - The lower 32 bit data for the msr\n\ + higher_32bits - The higher 32 bit data for the msr\n\ \n\ Return=20 +Value:\n\ + None\n\ +"); + +static PyObject * +edk2_wrmsr_ex(PyObject *self, PyObject *args) { + unsigned int cpu, msr, veax, vedx; + unsigned int bsp_switched =3D 0; + EFI_STATUS status =3D 0; + UINT64 data =3D 0; + + if (!PyArg_ParseTuple(args, "IIII", &cpu, &msr, &veax, &vedx)) + return NULL; + data =3D (((UINT64)vedx) << 32) | veax; + + Py_BEGIN_ALLOW_THREADS + if (cpu !=3D gBSPProcessorNumber && cpu < gNumberOfProcessors) { + //switch the BSP to the cpu + status =3D MpServicesSwitchBSP(gpMpService, cpu); + if (!EFI_ERROR(status)) + { + bsp_switched =3D 1; + } + } + // write to MSR + AsmWriteMsr64(msr, data); + + if (bsp_switched) + { + // switch BSP to the saved BSP processor + MpServicesSwitchBSP(gpMpService, gBSPProcessorNumber); + // update the saved BSP processor + MpServicesWhoAmI(gpMpService, &gBSPProcessorNumber); } Py_END_ALLOW_THREADS Py_INCREF(Py_None); return Py_None; @@ -4576,7 +4714,9 @@ static PyMethodDef edk2_methods[] =3D { #endif {"abort", edk2_abort, METH_NOARGS, edk2_abort__doc= __}, {"rdmsr", edk2_rdmsr, METH_VARARGS, efi_= rdmsr__doc__}, + {"rdmsr_ex", edk2_rdmsr_ex, METH_VARARGS, efi_= rdmsr_ex__doc__}, {"wrmsr", edk2_wrmsr, METH_VARARGS, efi_= wrmsr__doc__}, + {"wrmsr_ex", edk2_wrmsr_ex, METH_VARARGS, efi_= wrmsr_ex__doc__}, {"readpci", edk2_readpci, METH_VARARGS, efi_= readpci__doc__}, {"writepci", edk2_writepci, METH_VARARGS, efi_= writepci__doc__}, {"readmem", posix_readmem, METH_VARARGS, efi= _readmem__doc__}, @@ -4813,13 +4953,24 @@ static struct PyModuleDef edk2module =3D { PyMODIN= IT_FUNC PyEdk2__Init(void) { - PyObject *m; + PyObject *m; + EFI_STATUS Status =3D 0; =20 #ifndef UEFI_C_SOURCE PyObject *v; #endif + Status =3D gBS->LocateProtocol(&gEfiMpServiceProtocolGuid, NULL, &gpMp= Service); + if (EFI_ERROR(Status)) + { + printf("Unable to locate the Protocol MpServices protocol: %r\n", = Status); + return NULL; + } + // Get the current BSP processor number + MpServicesWhoAmI(gpMpService, &gBSPProcessorNumber); + // Get the number of processors + MpServicesGetNumberOfProcessors(gpMpService, &gNumberOfProcessors,=20 + &gNumberOfEnabledProcessors); =20 - m =3D PyModule_Create(&edk2module); + m =3D PyModule_Create(&edk2module); if (m =3D=3D NULL) return m; =20 @@ -4870,7 +5021,7 @@ PyEdk2__Init(void) //PyModule_AddObject(m, "statvfs_result", // (PyObject*) &StatVFSResultType); initialized =3D 1; - return m; + return m; =20 } =20 diff --git a/AppPkg/Applications/Python/Python-3.6.8/Python368.inf b/AppPkg= /Applications/Python/Python-3.6.8/Python368.inf index 8b7f677..eca98b5 100644 --- a/AppPkg/Applications/Python/Python-3.6.8/Python368.inf +++ b/AppPkg/Applications/Python/Python-3.6.8/Python368.inf @@ -46,6 +46,9 @@ #BsdSocketLib #EfiSocketLib =20 +[Protocols] + gEfiMpServiceProtocolGuid ## CONSUMES + [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0F gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040 -- 2.40.0.windows.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 (#117752): https://edk2.groups.io/g/devel/message/117752 Mute This Topic: https://groups.io/mt/105530360/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-