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 44D5D740034 for ; Wed, 17 Apr 2024 18:35:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=jFqQYID9rrdcK6g84EtlmvCt8r2DHX2JzEv3ReV8xA8=; 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=1713378909; v=1; b=KRqvVt6neU/7G4I0chm2LaSyzcxU0KHMCIVfyAuLmcXD7FpXeSw3Px/s4YNYQmusIdj7P8lB mnQwbUMNa9tP1RK1dHu4Nz+hfJMgBRI+EtWa+uhK56Ddopfd+e9cX1a2JoRUOZhi0kZv5Bs6fPt +Td+u7F6UTXtPs+KiNfzbdleHt8xzfIB9F8rwWHW48Y7SC231yeHUw/Sp6GwQTquAbNHPtUkDi0 ZrcRk6rocYVtwaIMWYVyho8e81CQO3jlVmtSGqlYYRWbDcfljxVAPMCUTHnzbq5t08VA4L03oUM EOm6RpWIPwof3II40kDcF212bjpLUVo742DTPd0FGquog== X-Received: by 127.0.0.2 with SMTP id WquwYY7687511xsvk6n3JSau; Wed, 17 Apr 2024 11:35:09 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by mx.groups.io with SMTP id smtpd.web10.21865.1713378909103783815 for ; Wed, 17 Apr 2024 11:35:09 -0700 X-CSE-ConnectionGUID: eG7LPnktSUe5y6xYZtCCqw== X-CSE-MsgGUID: sf9h64UsQ0yEVy7n7Bzb6g== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8765162" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8765162" X-Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 11:35:07 -0700 X-CSE-ConnectionGUID: P9+9sy/ER9qMc5ppDF+3qQ== X-CSE-MsgGUID: leTClF+HSLS4hx726wsgWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="27382837" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Apr 2024 11:35:07 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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:35:06 -0700 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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:35:06 -0700 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by edgegateway.intel.com (192.55.55.70) 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:35:06 -0700 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by CY8PR11MB7946.namprd11.prod.outlook.com (2603:10b6:930:7e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.50; Wed, 17 Apr 2024 18:35:00 +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:34:59 +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: wrmsr function available in edk2module is not working as expected Thread-Topic: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc: wrmsr function available in edk2module is not working as expected Thread-Index: AQHaiw2NDbBWg8JqxUSPsPpMqp7LnLFs1XPQ Date: Wed, 17 Apr 2024 18:34:59 +0000 Message-ID: References: <20240404094426.1636-1-n.jayaprakash@intel.com> <17C30A8D5FBBA882.4513@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_|CY8PR11MB7946:EE_ x-ms-office365-filtering-correlation-id: f0427b4b-f6ce-4ad5-0293-08dc5f0d16ae x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: AjL26jzkn2L5GSLKtDupeD6JPaB0NZuv1avbh72pSf+LmkgC4f3lll6u38kIDzv3dFpOHln8qd9DWn0fZPwIMZlgM012CoshWVgck3qrmVQXfV6WMCG5GZ9GC5m/5n0G2++fIraQt5OWMQF2ZNFRhXi9ZBZ01mt+FqE09ij7GUV2vsogvsDi0ajVjclwkndDK7lN8LWx+GLQdSYzd2xnDmMZOSekAMbaH5FcZl86ZVDGk0DRP2oyShIEIzgpvZPpPZge/6iDG6esJQJf3K8+GIZuhfBjUFp9Dgkdx0HdhGoZwU5gvwmB7dePJEyBcilRWSZlhFDmZhK2SGqybFduwLkHTrhkx763JsTLY8ZoR0IpHz5jIxl1H4v0KOmGHH4xUUQPgMNrPcwF2+jYYR7L47lLd5azP5F8jFGZrnC5j0/bN/PfnQ1aYYATr1qJalUbum6qr3lafnbHaf0diZSTICT/sEzF04pir+ZpBpiepoL18Zud3c4Ff7fDDd4hsL80hRT+eviwh1Hp5WPNL1lc5yoKRpKDuEtbp8XxJs8bxFr2A7ASL9TRAfOawmvXptss6jkbJFp3gVcsHzTdoTxC60vhtGBhaqdLcs0nZoGqK0+RJjstLmAjIxkVEy0waVpoWU5muvwEF4cQnZsTNb6gWaq4SMztfV1Vxk3qncE6CsI= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?iFlA0UAkjjbM5rNZUGByiq0UY5EbJ+z3thRfgWATlmQat8mke4WDnSVEVNQT?= =?us-ascii?Q?S+2myHwvrQTruEJOjf3C1qMlivGoe0sRfZtz063TAGDTGVWcY5D+cL1VKTY7?= =?us-ascii?Q?msdYmvQBbdAPqwf1N5NRbb2APUJ3Z+mgtYFFRS2J2bK7nurnyW65OaPDrGzU?= =?us-ascii?Q?COIhNu/3IqpjS1tdvqWeT8bzQjNW34Z8pzUYyR83yLm4WBv1jYPit5bNjpVD?= =?us-ascii?Q?Uk5mRQ9AsnoXyXWH2OELXj81w93QihjA25SfvVeGwDzBfNZo5Uum1zVDhVat?= =?us-ascii?Q?Nbq0mmWwApUYnAlC6nohCgitMaDVVMX4ldAw5GscKiNtZX565VvbrQtpbCeZ?= =?us-ascii?Q?HUPW5QmtCm2NlZoWzqLoddJN49R3ghKdSkJYpm9v5mlMY9SdPaEizPocMENE?= =?us-ascii?Q?tANmCzEzqvf1dxlmnSmjVibkn0t2jfNFVdHJbx/qCRVoGATtphxh5IkZEEbh?= =?us-ascii?Q?WdWsBjQVLp9qsjXke+uamqMEM7H5UuJXjm7D8vlzVkR0ycx/o+INywDLKmDS?= =?us-ascii?Q?f9wwMtk1S3332YwRHkLQbQd40WeVTiIq64x4i2wzX91fzvHDNz6lfC7qDY4B?= =?us-ascii?Q?tIHbBlBBJ2tH18qWsNDQ2z0fKc1Q/UKMda3RJCe/w5w+0TCQ7oqVJGi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WrO3p7z2kxc2Oc99RXldsXeXndRi9F?= =?us-ascii?Q?ENsdkBftOq7pcvWVo/FIa/7pM1ycl6UBAhGCnG0Y?= 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: f0427b4b-f6ce-4ad5-0293-08dc5f0d16ae X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2024 18:34:59.9064 (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: KzWvymP0y8IHtIS3QGFnAq5jk+W+LyPtmW63GWOasMqdJnqEqPe4nSdHUcYEn8StvOjoxmSTegoMqM6Kvi+gX2x7+epmASVTZq9jQ3wYjg0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7946 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:35:09 -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: 1K9gSBPOTY2yOXY26rjjmAzIx7686176AA= 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=KRqvVt6n; 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 > -----Original Message----- > From: Jayaprakash, N > Sent: Tuesday, April 9, 2024 11:09 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: wrmsr > function available in edk2module is not working as expected >=20 > Reviewed-by : Jayaprakash N >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of > Jayaprakash, N > Sent: Thursday, April 4, 2024 3:14 PM > To: devel@edk2.groups.io > Cc: Jayaprakash, N ; Rebecca Cran > ; Kinney, Michael D > Subject: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc: wrmsr function > available in edk2module is not working as expected >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4745 >=20 > This commit fixes the issue reported in the BZ4745. > The wrmsr function was always writing 0 to the higher 32 bits of the > msr register. This was due to a logical flaw in the code, where the > input variable of type unsigned int was left shitted by 32 bits > without explicitly converting to a 64 bit value. >=20 > Problematic statement in the function edk2_wrmsr code: > data =3D vedx << 32 | veax; > Where the vedx an unsigned int, after left shifting by 32 bits its > value will be set to 0. Because of this the higher 32 bits of the MSR > are always set to 0. This statement has been modified as below: > data =3D (((UINT64)vedx) << 32) | veax; > Verified the function by making this change and could see that the > wrmsr is working as expected. >=20 > Cc: Rebecca Cran > Cc: Michael D Kinney > Cc: Jayaprakash N > Signed-off-by: Jayaprakash N > --- > .../Python/Python-3.6.8/PyMod-3.6.8/Modules/edk2module.c | 2 > +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=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..cec4332 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 > @@ -3886,7 +3886,7 @@ edk2_wrmsr(PyObject *self, PyObject *args) > UINT64 data =3D 0; > if (!PyArg_ParseTuple(args, "III", &vecx, &veax, &vedx)) > return NULL; > - data =3D vedx << 32 | veax; > + data =3D (((UINT64)vedx) << 32) | veax; On 32-bit builds, this will use an intrinsic. Is BaseLib LShiftU64() avail= able here? > Py_BEGIN_ALLOW_THREADS > AsmWriteMsr64(vecx, data); > Py_END_ALLOW_THREADS > -- > 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 (#117929): https://edk2.groups.io/g/devel/message/117929 Mute This Topic: https://groups.io/mt/105437258/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-