From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id E566B740045 for ; Fri, 19 Apr 2024 09:04:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=NjRflvyhQ6uuGFWv7JGIrtlRgoJKcYo0oTNA09a+d+U=; 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=1713517462; v=1; b=fk41COQ7BhU9ATfLkbpjJ3gQ7uOfbnbkS3nw14CGXG/M7gnLIgsriNtBvFnNQRmeXflwM3gG UFZoqUXlhAvi/MMEyatb7gnrgVRLDZnj+l23XsfK32/Av8w2BeeMrPRoxCSFJdx+lm+9CvJKxKD qRvqx38+tCwsUc5wS5ybUxia1mc+LbBrjz+TFLqPuP3pBdI8zvZRI1s3tF2Ejx5y66p348eChEg OHSK0krHCsYMm/fST4A4iPxhZRSvD+AxRw7DuCVoUoY6fahm2ASDSJmxON0DOudD4i+fwMU2boQ n28RRvg2tzV6jjL+cuRlQb1C2m+ryZN4TiArDz9HgNR8Q== X-Received: by 127.0.0.2 with SMTP id 9WKnYY7687511x57CtRydE2J; Fri, 19 Apr 2024 02:04:22 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mx.groups.io with SMTP id smtpd.web10.15962.1713517461877369691 for ; Fri, 19 Apr 2024 02:04:21 -0700 X-CSE-ConnectionGUID: jBmFEAfTTmmLjcebEyn0fw== X-CSE-MsgGUID: 0biHlvuRQu6yVBYGM7XYiA== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19719239" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="19719239" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2024 02:04:21 -0700 X-CSE-ConnectionGUID: 7IlY9/wcTW2NOsWtbMeJ7Q== X-CSE-MsgGUID: mqsPqTcSRHmH/v/ZXjGMPQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="54195671" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 19 Apr 2024 02:04:22 -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; Fri, 19 Apr 2024 02:04:20 -0700 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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; Fri, 19 Apr 2024 02:04:20 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) 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; Fri, 19 Apr 2024 02:04:20 -0700 X-Received: from PH7PR11MB5943.namprd11.prod.outlook.com (2603:10b6:510:13f::19) by MW3PR11MB4553.namprd11.prod.outlook.com (2603:10b6:303:2c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.43; Fri, 19 Apr 2024 09:04:13 +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.050; Fri, 19 Apr 2024 09:04:13 +0000 From: "Jayaprakash, N" To: "Kinney, Michael D" , "devel@edk2.groups.io" CC: Rebecca Cran Subject: Re: [edk2-devel] [edk2-libc Patch 2 1/1] ek2-libc: wrmsr function available in edk2module is not working as expected Thread-Topic: [edk2-libc Patch 2 1/1] ek2-libc: wrmsr function available in edk2module is not working as expected Thread-Index: AQHakZDutAruZIS/TkORH8NDJg552LFuhQeAgADI0HA= Date: Fri, 19 Apr 2024 09:04:13 +0000 Message-ID: References: <20240418130317.1149-1-n.jayaprakash@intel.com> <20240418130317.1149-2-n.jayaprakash@intel.com> In-Reply-To: Accept-Language: en-IN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR11MB5943:EE_|MW3PR11MB4553:EE_ x-ms-office365-filtering-correlation-id: 2cf8e199-0e96-4b16-ce52-08dc604faed4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?VyUpB/lOJaFacbDPK9NXhyCbOdtgvw1IbReSgousvulPwl4ZcYTLk/TIFf59?= =?us-ascii?Q?12T43DFphVjL6imvb/HX15xgbI9uLVu9G4Oa0i/e4jers0ttiUowdYwLQUtS?= =?us-ascii?Q?BqZaT0dAV9cTNC9PtEYYonJCuNADCcEFRxJ/22dClxL6NTzBR+IoKwuL80we?= =?us-ascii?Q?vnaqsOtAyIeBrhKhFeYtdNrt9ao7WlbG1q+v/7E473HIHbjICOGeGGNwSWYc?= =?us-ascii?Q?fDlbNVTCKCSqz5xYh2sDCmnPC9u2OIwBw0gyY53EAjPvbd62ygxRDX03ud4a?= =?us-ascii?Q?Wiul6dnKtRjAth2qJrNWk4I68Dd+uleiD1tG1/5YWOo3Q+MT5ZvCUM7W8XSt?= =?us-ascii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bQ9jLC8Y3XIccNIrFy/73?= =?us-ascii?Q?AS7JUJ74xu/YL+Bvtl9GM1PklaB/YXpRn2+zcPW51A=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1yH9R9ib/PwQFZReApS5EqYiIKQXVog8fEbtVdxqOpOn3+47+mb8JnMlciAC?= =?us-ascii?Q?3g7QR9VoJZl0wDNvRsHS0VKcw8EfEtRvq+u0u1lgfx1TIvTzpi0mEdLO9+sA?= =?us-ascii?Q?BG2/dKVpTcfCMQS+r4DdIZ9gotUrozSwK0LJS1/wAHgr4ikUSjZ0ipDVvx7f?= =?us-ascii?Q?CRoN7N6aUcSeZZeUnJR2G3HLneT6OaFII5VsWEN0zXc6bMjLjMtmcIC6z1kX?= =?us-ascii?Q?W5y5X0PJExDIxRtfOaRFVvkNFUpUufXsxBghYCzPWJPh5VhwERxCptexIVKm?= =?us-ascii?Q?tJ5OIG9EHqb3BsyBTThxX8rcsYccfrBJUC+98h/J5hStqB/d7Tf95ectr1OP?= =?us-ascii?Q?w9SUCvJMs/Kk5v7Luq4P0fP1JUUyeqFBy8shfrtSNcpZb48C4m5Nq6CApLga?= =?us-ascii?Q?nUqfIglg6ijtnXEOgnNxYj5u3glGnHtEtTeO7h46IKovaksDoJyrw+7T11hk?= =?us-ascii?Q?wBle0p82rYDovJ5RVYsd9QFePFXTPT+YwQh13w8QFvfXdl9wfSNPR4sZsAAJ?= =?us-ascii?Q?5emAFSv1kuVILqNUDYVRO78SKsMdRSJqaswtuVuEG9GykjZqluN4a06w2gg7?= =?us-ascii?Q?ayY3hoQ5ebAOREYsVG0mlkj9qXSazJWuASc8fwvzv2AI/SIk6nomXHXtC902?= =?us-ascii?Q?gJAduW/KLddADDTG1Orjo66Mal/gwvHn3LQYcF8bv9m6WxrJzSBNw9iNNJZD?= =?us-ascii?Q?v80ex4YT53qXBuFNq8WjjgPzH4HCSt1yZupQPn4GBfhYKXbsHxpkeKRPZT0V?= =?us-ascii?Q?RVHV/t/Q6EBwVIcw2rKJ5hSXoACYva5SAYbUpNkGHfmGNliyYUt1EWOf16H8?= =?us-ascii?Q?f1WHKSG1vx1jFiHRHSLUpC8V/6EHo62ppzUe9qqqZe7yn4VyUQ1G875Z894B?= =?us-ascii?Q?C1MxMwBSLf+ORE0VybI5eXp32u4bUpnoxXH4I6hymtO5s089QJy9J198NWyL?= =?us-ascii?Q?A4fHQLtpIDtLyv2zt4/tTVyOa/KPgtng1kocyQezgDOmmzARpAbJ4WwoKLFX?= =?us-ascii?Q?063PVXXXyq8EbMxwIJG0xlL1/gHfkGxapDzbeosaI57rP9ICyU7BMWKXDn1W?= =?us-ascii?Q?Hlcs6lplMmZ7Az6eff2ORGLjmmXDXVi8wMYegKr6wOCO2gtyhOybiIhCOrbj?= =?us-ascii?Q?VIc7bcATZqrXZTFvROuXy7WkS+AB5QyRCLuRq+iFz9qtrsdAO0UL7nR/fM2F?= =?us-ascii?Q?zhux8Qi00kgLo3zdtFyiVgOVP+kGLLNnmEoEIotwamwfcRyQZ/JAm7e4BrIr?= =?us-ascii?Q?+ufAbyH2D7sVzDacbiskCk/TFCWxQfqWZ0ZQByoxmrRZkCK80nSZxUeKma2m?= =?us-ascii?Q?3Wof9I7a8ZkJAOlPLJlQ048Ds4WZkJMYZlceRvIcj2oI4MghGqKTd+4J+NM7?= =?us-ascii?Q?b0IVeD4COgkgC4CDyKJs5AFpglrZ9Gks9GFxfEPq++UYEdHRqrQJzsoHEC0Z?= =?us-ascii?Q?uqahYyLIpGHD9RpuZretk2WRXbYCaRjbXwPYesNPHSDH2SSiNJ8R8a7fdNdE?= =?us-ascii?Q?nBxXMjrgWpMD64R3EJ97YiZ5SL/qhogsexIXtwnqaISj8hi4crosUu6IXiW/?= =?us-ascii?Q?alzsgDrYVLPX4zV6oluPkOTK5zrBuSJH3BTKl/tV?= 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: 2cf8e199-0e96-4b16-ce52-08dc604faed4 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2024 09:04:13.1126 (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: 0WkIjOVYAsoGQu7BPmSkTZ8+F0djJfwyCA1tQdt29BQqgiLTJSW5Jc9Sttmqtoi+8KkDFxZUThlX0MrtzidjcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4553 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: Fri, 19 Apr 2024 02:04:21 -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: c62HRJK1I1oabxNXWCrTdSfvx7686176AA= 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=fk41COQ7; 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.7 as permitted sender) smtp.mailfrom=bounce@groups.io Thanks Mike as suggested made the logic simpler. Sent the updated v3 patch for review. Regards, JP -----Original Message----- From: Kinney, Michael D =20 Sent: Friday, April 19, 2024 2:35 AM To: Jayaprakash, N ; devel@edk2.groups.io Cc: Rebecca Cran ; Kinney, Michael D Subject: RE: [edk2-libc Patch 2 1/1] ek2-libc: wrmsr function available in = edk2module is not working as expected The use of BitFieldOr64() is really only required when updating a portion o= f a 32-bit or 64-bit value that are not aligned on a 32-bit boundary and do= not have a 32-bit aligned width. Since this use case is setting the lower= 32-bits, simpler logic should be used. data =3D LShiftU64(vedx, 32) | veax; Mike > -----Original Message----- > From: Jayaprakash, N > Sent: Thursday, April 18, 2024 5:55 AM > To: devel@edk2.groups.io > Cc: Jayaprakash, N ; Rebecca Cran=20 > ; Kinney, Michael D > Subject: [edk2-libc Patch 2 1/1] ek2-libc: wrmsr function available in=20 > 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 was always writing 0 to the higher 32 bits of the msr=20 > register. > This was due to a logical flaw in the code, where the input variable=20 > of type unsigned int was left shitted by 32 bits without explicitly=20 > converting it to a 64 bit value. >=20 > The issue is with the below statement. > data =3D vedx << 32 | veax; > Where the vedx which is an unsigned int, after left shifting by 32=20 > bits its value will be set to 0. Because of this the higher 32 bits of=20 > the MSR are always set to 0. This has been fixed by this commit. >=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 | 3 > ++- > 1 file changed, 2 insertions(+), 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 8786df8..06bcf82 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/edk2module.c > @@ -3886,7 +3886,8 @@ 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 LShiftU64(vedx, 32); > + data =3D BitFieldOr64(data, 0, 31, veax); > Py_BEGIN_ALLOW_THREADS > AsmWriteMsr64(vecx, data); > Py_END_ALLOW_THREADS > -- > 2.44.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 (#118013): https://edk2.groups.io/g/devel/message/118013 Mute This Topic: https://groups.io/mt/105597214/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-