From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web12.4565.1652774339890611493 for ; Tue, 17 May 2022 00:59:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=MWdEXlJb; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652774339; x=1684310339; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=oxQMaAPmkui4GG5sXDo6s2g4Spen+5q8BpYMjldylow=; b=MWdEXlJb/xsUgcKNiKuFycDVoUvKxcKf6d/4YwoBZCwiKtmu6AacJFl/ /BVzDuf+uTBEQYZ+0+dm9WDeuHHdX/Crf7/7KlPrex92bu6H3zznXYYEq qigrixzvCarAiVTK1QU5kF3Oh29oB90I0vWwl4LUlzvkg8ZZScMj3A3sb kZMHaAG1jTZNDhGLFI9hwA5xQj19rmrFtfoUQzNet4fHYZBqtOjMQeJll ofderqU/l17+mKpKqlRaaAEfZLzdIs3Up6uVfFfjmuIolIiAXUPiD+XyG cOJ3iYMMEv/W+n3foI+64+0NGS0cFZXq+WQX1TbN1rTjoKtrSD6f1Q/yP w==; X-IronPort-AV: E=McAfee;i="6400,9594,10349"; a="334147297" X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="334147297" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 00:58:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="544787171" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga006.jf.intel.com with ESMTP; 17 May 2022 00:58:58 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) 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.2308.27; Tue, 17 May 2022 00:58:58 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.2308.27 via Frontend Transport; Tue, 17 May 2022 00:58:58 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.103) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Tue, 17 May 2022 00:58:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ITTQ12oAK6edNX6+yPpGdGUZslVg0nfhMM/NcBPi6gz+vFPOxJHmQD2Bvr8kYjwMkwOcTI+Z18Nluf8AquE7VTJHrepauu9pTj6p1d9kGLfcCtMmBHPy5W+M+unMdKJG5DQfxO9/1pWrQFmX+3uOMxldwT0LnqpBb9KSZc0gY1LYgVU+TVn6eRLJOqaQbCxt+HKuxtLURa3v2Wcz0rTwFbKAGrBq0S9bZb74LRoEa7GXDMmvMS3ITMN+HnuxQNLkFABhPysoZHg9MjlNblY//g7UdgWeekrUtqHWiI3AARzir09oSphB3lWUUOnzmHS3MNZCgqL+z3bj7zpYsH7FgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KUjYesCYYB+IfPn+wl1XayzRFRFlajDf8m2tsVkhVJ0=; b=ljJVfSBmYmHP+ixXLTxVh5EPrN5LeDurP4Dgf0A7pV37HYGuvlu4AdhdaCuipDEWMK6ZB8A/NsbmcOJksP+q1hoLbqup6aIIWbw+23g9nnL3MEvtrJyTL56MtCO6cbnmlCNOnI9h0aabak19M0OVHibSkW0Ncrhz8jVTB4EKqXzoaI7gfs5spdhyVlMHxnHZn3+lhl6XXuY45dl1StuudFTz4SyHaNL/dseT5DmVVAJgv5C8uFJQ213my2anyjOrJs6YBWx6+lx2ouGbvoEW1V0CW9S41yb1X4JLxOZX8CMXGMZdMaqaPk+5GmyNGHIBFgl2SEqzVJNR1Uiwrv5U8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by DM4PR11MB6066.namprd11.prod.outlook.com (2603:10b6:8:62::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 07:58:43 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::1844:3fca:639e:7c56]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::1844:3fca:639e:7c56%8]) with mapi id 15.20.5273.013; Tue, 17 May 2022 07:58:43 +0000 From: "Min Xu" To: dann frazier , "devel@edk2.groups.io" , "Xu, Min M" CC: "Kinney, Michael D" , "Gao, Liming" , "Liu, Zhiguang" , "James Bottomley" , James Bottomley , "Yao, Jiewen" , Gerd Hoffmann Subject: Re: [edk2-devel] [PATCH V2 5/6] MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev Thread-Topic: [edk2-devel] [PATCH V2 5/6] MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev Thread-Index: AQHYUFza5t5pBkj0w0aKSr8aEqyqGq0iRg0AgAAlKOCAAFe5AA== Date: Tue, 17 May 2022 07:58:42 +0000 Message-ID: References: <7af1cd76cb8b4684bbff0de2ab2dafa9b43d5d9f.1649980548.git.min.m.xu@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.401.20 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 73112ff4-fe4d-495f-25af-08da37db0fd0 x-ms-traffictypediagnostic: DM4PR11MB6066:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MNH4xEJOiUECD0t3OHnwcf5kynvRrhMzQLDgO+53x+IyS6Y5UTDe5ShhCrtNMcKiARFu31Faf+HJV19aoGgi67gWzAmu5QPbetI1EnUaQrZWhu77F+H83J5YwHcJc6gV87nG8gM2Jc8tj8xcmG3kHtmt5gEDxmGNMdfaSyu2D655iB5B9neJ57J1JWYdbTsanWd7im5Zq/1b7Kli3fUPIjUZDo1u6XFsIFN3NuSQL/OnKEwvSJct+FqFHg4VcRljlPvD03cPcSi22tda9ofMQO8jZQwW51jQDJwoGGyE46X+fNzp/4Ha+0hPr/+MWEcjr8yo8c8rw7jYJepdaVatqUfTKkgSnv4wdJInai+/XXepoZx/Jk3r73hcrXkiT3tFO4b4moJ/K6m/1kLK8vZ5XYT0fh6r5vVo/9/P/S9XUipUXh+ulk9rzbb9AK+bHCJOlXlWe/ubAbIwcTia9Pgh2HhzKnDVKQuh6RUYi9YAvgDc3aY4WgM98TMBwfocipSN1Y6GUn/toXWrfPKQTi8UZPGVHh9sfPuDVTieGAMiYW/KeQjNpmNba3Krat6WI7EDdUj+Uj/YMYL9848nn9SesCtOog54aKaWfIeRexZBEbp+3+PFITuFQmfP6IwU6LTBmjxeMm/QJUuhf4Ov6vM5+ywkHUKnokfH/YRLEggcSOHf31l5OoBVf3Ws6e04Gor+5yhOQeX/D16f4pqr+7qCNA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(6029001)(366004)(64756008)(76116006)(66946007)(66446008)(8676002)(4326008)(66556008)(66476007)(33656002)(122000001)(7696005)(316002)(38070700005)(38100700002)(86362001)(83380400001)(8936002)(5660300002)(53546011)(82960400001)(186003)(71200400001)(6506007)(2940100002)(26005)(9686003)(2906002)(55016003)(508600001)(52536014)(110136005)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?et7644jTIaQLY+7YZrWEglVPo8tArRtt3awzlq4/cjnZkdDrGmCrus+yftZm?= =?us-ascii?Q?kdWmI6G40lF/sOObnhmd9fiUOmjdQy/XEeuVpSK0KUPOrn/Tl2yp3Imb3XLa?= =?us-ascii?Q?rJK7YB6/F+DQqLXgyCkrsRMp/XXjUJngoOfKoh/odRbK0z8aiTAiP7xY8R8m?= =?us-ascii?Q?DwbgFBze8WeCrqjG3dlTR8GotGqnsmHQ2LA9lX1ZQ5QLETHgxQzi9LVLbRqC?= =?us-ascii?Q?zIeZaH9FHcCmTtF4Ycmr1LYdf04WARea8cFsdukMvm6CcN3B5HSEwdD6skDI?= =?us-ascii?Q?XlbUUv8e5Gah6/8UkUL5vL/sgcoaJ7jwfLdp+T5kP++HfAKVM9AGqos1WTg7?= =?us-ascii?Q?NFgp/vLs8rYqq51GwCuSW+yT3MZkZkvfhyWCrYSPftHPyWl2OxBfRqHu0ZF9?= =?us-ascii?Q?+yPJHMeiaoMKwhGO0UwMQ0wrtN8LLDXDSrE61f7O5kLLohhRmXy4m3642QF/?= =?us-ascii?Q?AZz+q0lYDOuGMGYFGZ2hA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?ulztBSg/LZ79z1kpShctpwbPvitFrTJx4OwEZaFWwmW1u9Zo6t212AYPo6Nk?= =?us-ascii?Q?ovnQz5g/KyRGXlYPy3iiCgAkVSQgdGmW+XdKvIsmyBmTPnwlQ1XMSaPkcYaP?= =?us-ascii?Q?JMbMBiyj7H26Ay+R8+PbeuvCf1QDQJEIgo9m0XXZVnIgxEhdN3AxKb3VqO/B?= =?us-ascii?Q?MSB0Zp5Y8CSQ1keSdBUYTuEFe9/m5QOIYTHEnJSkXXiKQ6/SH9G2MaBoaHY0?= =?us-ascii?Q?0M9P04G9UCVd8U4+ARuE0eIoFnuoNVsNyXBSlrW5knZrqjwtb1M5WASxo8xH?= =?us-ascii?Q?iqUYvtE7GwT0UG9jNc+HaVSgh/xbr3SE0Md9ZqKep0vd/JQeCb4kb+vckHH+?= =?us-ascii?Q?PFHDxDWupw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73112ff4-fe4d-495f-25af-08da37db0fd0 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 May 2022 07:58:42.8542 (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: pZ2Kyfq9bmOUvZA1BA814/TmBxe0XrNLPTHF6LltKm+UhHn+SVJ1vLDgQIwaS476LagBSnsxvtMQv3RaaTsUoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6066 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On May 17, 2022 9:15 AM, Xu Min wrote: > On May 17, 2022 6:22 AM, dann frazier wrote: > > I ran through our tests on stable-202205-rc1, and I'm finding that all > > of the tests using 2M FD_SIZE & SMM_REQUIRE=3DTRUE are failing with > QEMU > > hanging w/o output. Equivalent tests w/ 4M FD_SIZE are working fine. I > > bisected it down to this commit, and also confirmed that reverting > > this commit on top of 202205-rc1 also avoids the problem. > > > > I might have a chance to debug more tomorrow, but for now I just > > wanted to flag it. > This patch calls CcProbe () to get the Confidential Computing guest type. > There are 2 versions of CcProbeLib, one is to get the Cc guest type from > PcdOvmfWorkArea, the other is a null instance and it always return > CcGuestTypeNonEncrypted (which means it is a legacy vm guest). Only > OvmfPkgX64.dsc and IntelTdxX64.dsc include the first one (which probe the > PcdOvmfWorkArea). >=20 > If this patch is reverted, it means it is to check the guest type by call= ing CPUID, > not reading the PcdOvmfWorkArea. >=20 More investigation shows that the root cause is the wrong memory access in = SMM driver (PiSmmCpuDxeSmm.inf). This issue can be triggered when SMM_REQUI= RE is TRUE. IoLib is used in PiSmmCpuDxeSmm.inf. In OvmfPkgX64 BaseIoLibIntrinsicSev.in= f is included and it probes if the working guest is td guest by CcProbe(). = CcProbe reads PcdOvmfWorkArea (0x80B000) to get the guest type. It works in= Non-SMM mode. But in SMM mode it is illegal. So reverting the patch makes = the probe to call CPUID (0x21) instead of reading PcdOvmfWorkArea. It does = work. I am thinking how to fix this issue and then send out the patch-set for rev= iew. Thanks Min