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 1D7A0AC1746 for ; Wed, 17 Apr 2024 18:38:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=EsZ3sv82UQ7sWS5LtSEB8g9QWr3fb9FTLJEC1BayZQw=; 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=1713379102; v=1; b=RqK5Yjh26uFbQv8gQE6iS3d5FvT3NDQmKrrU5mv0BtgApcMoWgZjI5Qqv+Gw/6t5eUW45Sjj mDBU549ZflXhYyFF8GfrFUH2584UDimmUG6G8zGNCw5weEoNKh0KL6ccpX/9yQtfmY1/RIIqJ3J drZejW9+1dG7VqcRtHsd9DnSFEJutOU0Zu1qN7f3GA6tQjJC+R55ijaUEFMnvRBPoFxJw6RCT3G srgBD+gOcfFCF8Vdo8Htn5ca8JYm13mKlZhO7f0DkA63bUTN8w/YuDcIHDAsfBgbTolbho/obSZ oRoojLTpiFtKnRxeS7TamhFH6XcksiWfhV++WGSNkY3Gw== X-Received: by 127.0.0.2 with SMTP id PsX0YY7687511xSCnBoKBNaf; Wed, 17 Apr 2024 11:38:22 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mx.groups.io with SMTP id smtpd.web10.21936.1713379102132226436 for ; Wed, 17 Apr 2024 11:38:22 -0700 X-CSE-ConnectionGUID: D94tUQYsSxSgU9Y/QDny2A== X-CSE-MsgGUID: 3RE0QXkmS9W7HvvNVpq1/A== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8745660" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8745660" X-Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 11:38:22 -0700 X-CSE-ConnectionGUID: ELIsK/ROTLquS50YRUZvAg== X-CSE-MsgGUID: MoquY6AyTw+ZfT/thbHfQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="53919429" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Apr 2024 11:38:22 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 17 Apr 2024 11:38:21 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 17 Apr 2024 11:38:20 -0700 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 17 Apr 2024 11:38:20 -0700 X-Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 17 Apr 2024 11:38:20 -0700 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by PH7PR11MB6331.namprd11.prod.outlook.com (2603:10b6:510:1fd::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.31; Wed, 17 Apr 2024 18:38:18 +0000 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::e34e:4d18:b93e:c368]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::e34e:4d18:b93e:c368%5]) with mapi id 15.20.7472.027; Wed, 17 Apr 2024 18:38:18 +0000 From: "Michael D Kinney" To: "Jayaprakash, N" , "devel@edk2.groups.io" 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: AQHajvZRiISllRWn1UCU5p0YwvjzYrFszlFQ Date: Wed, 17 Apr 2024 18:38:18 +0000 Message-ID: References: <20240410061849.984-1-n.jayaprakash@intel.com> <17C4D6CE42E68D40.16800@groups.io> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|PH7PR11MB6331:EE_ x-ms-office365-filtering-correlation-id: 62feacb3-ab95-4fa4-7614-08dc5f0d8ccf x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: LS5zJcfPtBRLwrKt7935buaY968T/NrxMeTetHvHTh2On2+oXjyUdqSO+QEqgF5N2HvpDoqqvRUf7Rnw3b4pwrARVbxVq7gMP37pFyPHxY2GDqZwqTTs4xQMtvOW7KDTUPHMsyJ9o3anDgj4MPC8cniTgHedbsx73//hF+uEAuouoDqyUdpUVYtbip8CTdnJ2exg7IDaYPtSv1o0xxs1OpWLyi85HzWlXOaw8KhJo1fpp3qM1v0kgkh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Wb+KC0gQZmaxBwKxo7RmCQaKx7sBHQoWwJ0jkIA9qzhUwjH?= =?us-ascii?Q?kikRSwoJfUsX8ognlS8cmeS/bHftUgUuS2lRKcF1KpPGYtpzSPOwvyyKhZ5U?= =?us-ascii?Q?6orzj5zZtObztwfHHXB/jVebM0y01TSMZmrxvwpjyGOmAcKTP4t5f7/qcYFM?= =?us-ascii?Q?t9jqj8mzevCynXCTyCw2Ow1P0ax/joEbyRlvTNuT41CS20bg/dU6OfbfS4k+?= =?us-ascii?Q?wHe7/M6kPmKkahXWDiWk7S0zCT56zV85DA1bQ4vE?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62feacb3-ab95-4fa4-7614-08dc5f0d8ccf X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2024 18:38:18.0995 (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: z6zwmPtri9bufuI4WWjgL1bLWxCriHu9AtqSN4O3cKF5ovFZOEflVYKwrkKqoIfyeHMf0rEECS+7QUtbn48FF+P24L76BJrtl/I6+Z9vp2c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6331 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: Wed, 17 Apr 2024 11:38:22 -0700 Resent-From: michael.d.kinney@intel.com Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: toeQBroVYROTz3YhICXycekRx7686176AA= 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=RqK5Yjh2; 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 Hi JP, Is there a reason switch BSP is being used. That is not a common operation and is typically used if the current BSP is not stable or there is a good reason to switch the BSP for OS boot. The MP Services can be used to execute a C function on APs to execute MSR related instructions. Mike > -----Original Message----- > From: Jayaprakash, N > Sent: Sunday, April 14, 2024 10:33 PM > 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 >=20 > + Rebecca and Mike, >=20 > Would you be able to review this PR? >=20 > Regards, > JP >=20 > -----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 >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4746 >=20 > The rdmsr_ex and wrmsr_ex are extension APIs to the rdmsr and wrmsr > APIs supported in edk2 module. These extension APIs makes it possible > to read / write MSRs from specific processors and fills an existing > gap in this area. >=20 > 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(-) >=20 > diff --git a/AppPkg/Applications/Python/Python-3.6.8/PyMod- > 3.6.8/Modules/edk2module.c b/AppPkg/Applications/Python/Python- > 3.6.8/PyMod-3.6.8/Modules/edk2module.c > index d6af8da..f1b13a6 100644 > --- a/AppPkg/Applications/Python/Python-3.6.8/PyMod- > 3.6.8/Modules/edk2module.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 > + reserved.
> This program and the accompanying materials are licensed and made > available under > the terms and conditions of the BSD License that accompanies this > distribution. > The full text of the license may be found at @@ -22,16 +22,23 @@ > #include #include #include > +#include // Needed for the definition of > EFI_AP_PROCEDURE > #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, unsigned int rbx_value, unsigned int rcx_value, unsigned > int rdx_value, unsigned int rsi_value, unsigned int rdi_value ); // - > - Support routines @@ -169,6 +176,35 @@ PyDoc_STRVAR(edk2__doc__, > /* dummy version. _PyVerify_fd() is already defined in fileobject.h > */ #define _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, > +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 > */ extern char **environ; @@ -3865,6 +3901,56 @@ edk2_rdmsr(PyObject > *self, PyObject *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 > +given msr by switching to cpu and return the data as tuple.\n\ \n\ > +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\ > +"); > + > +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 > +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 > +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 > +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 { > PyMODINIT_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, > &gpMpService); > + 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, > + &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 >=20 >=20 >=20 >=20 >=20 -=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 (#117930): https://edk2.groups.io/g/devel/message/117930 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-