From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0053.outbound.protection.outlook.com [104.47.40.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3B6C521EA35CC for ; Tue, 5 Sep 2017 07:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=m5EfpcBJi0gTQpWH0YjYBWC0ybQGNNQlf6Lb1gOB+Y0=; b=jh7VnSIcsNjJQjswOLiZdua13obWPQYBNUxZi3XMWu/bVTaL2ZKtuVqpiVpr9Iy4R7f7eauXmeCrR18NqYB9SJraMj8Ie6No5ywVr8XdjD46A34+pVlG3NcTiMTtd2r+XULUtvemNROKOoCMHpwbDYoEl2iNeFPX0yv7PEWJAXg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [10.236.136.62] (165.204.77.1) by CY1PR12MB0149.namprd12.prod.outlook.com (10.161.173.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Tue, 5 Sep 2017 14:32:25 +0000 Cc: brijesh.singh@amd.com, Jordan Justen , Liming Gao , Michael D Kinney To: Laszlo Ersek , edk2-devel-01 References: <20170904155717.31591-1-lersek@redhat.com> <20170904155717.31591-2-lersek@redhat.com> From: Brijesh Singh Message-ID: <7d26a5ee-5ec7-a9fa-de65-60a47cc626d3@amd.com> Date: Tue, 5 Sep 2017 09:32:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170904155717.31591-2-lersek@redhat.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR03CA0012.namprd03.prod.outlook.com (10.168.230.150) To CY1PR12MB0149.namprd12.prod.outlook.com (10.161.173.19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb90c4f7-79c1-4224-96ef-08d4f46aedc4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY1PR12MB0149; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 3:qUvdFklbD1m6flENxc6snlCEC0cjgArWZh9Tq0azi5fA4ap/iVvbwe8N6HG/Cj+5Np5rA/aV7v+I9eEqHACtPNeKZ8gBjnu2tfWNHmsTMAijjI/h+7KnjtfNSt8rZLGjv2tOXBC/ktJw0Gwtl/VSY5n1bWkfIP/fVN6ePSrxQpjNf3dZxGIpjyTNeELi2tD29WdiuQ8FjRf6WoNenIWYR0MVCF5IpxpfcdbXI8kj+OijKNLKCa1FCGf7HMOWRNIH; 25:kBI9ZDXMsDmQQ2wNO7PwBoDmSpoL1xInNRiFYNF1GyZn6Iv+Ujc61MT1ymqEpry217BM1fV4vDL5Ozh4emJDCfqeAmGLHtBE5qw+VsB6qd5werT8aGjJj4Jw/C/jYLU5TBYo8lZhBcazlWILvC4ltYCJ+0Pou155OT8X4PJdtrA0Mmf00YzwRW5nzwCTj2vjV+6GzvDJnIW211ibT/HEl3fjn5tnnD/ds0FlLEDSj1GNJYh40C3BtE7AjdKyzmG4cUxlPDbTj1Wkeoa4ciH6+6zrwAdkEsD6TERboWWpIRhFpF9FzbooTvcG1PXijWA3YXOfVerRzWxNNgyNWSl9Qg==; 31:JzOWzLF5+MJpRSnIfCUrarNWVFttsqMHahQmrf62PfnZe5RcbazeVSqC7BbKBut/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ZtbB3e5z5EaIZ2nDcYIGispJBmxcijQ== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR12MB0149; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR12MB0149; X-Forefront-PRVS: 0421BF7135 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6029001)(6009001)(39860400002)(199003)(377424004)(189002)(24454002)(377454003)(42186005)(31696002)(54356999)(478600001)(68736007)(189998001)(101416001)(50986999)(76176999)(86362001)(575784001)(53546010)(105586002)(23676002)(65956001)(66066001)(65806001)(31686004)(54906002)(4001350100001)(53936002)(33646002)(47776003)(25786009)(64126003)(81156014)(81166006)(8676002)(106356001)(305945005)(7736002)(97736004)(8936002)(6666003)(50466002)(65826007)(5660300001)(2950100002)(83506001)(90366009)(230700001)(4326008)(6246003)(77096006)(2906002)(6116002)(3846002)(229853002)(6486002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0149; H:[10.236.136.62]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjEyTUIwMTQ5OzIzOkwxazhiMEJVd3BLRzB2WU5UaE96YUVUampS?= =?utf-8?B?REpubDJ2RV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rOEFTN3FnY2lnSE1pdENi?= =?utf-8?Q?M+2vqxQ8UUK76Lco/CDlQK6u+efvcvj7?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 6:axxugEBzXwFaAkrTVzecsqCQ06sklarSCD/6WVk7Tab669b88TA50zmqesYQp9R4LoQiRuB7Zm5TiZkWF33yK7Xx6eXDvkvQh2YcOmr0xMLv2ntOCowyMqfOFPxEMf8fWkv0sCXrwDeKhZXqe5tfZDgKPGqD6ivwZTc/YehJukxsi3bFeQ153DuMqoDAVqNAwQ4UMEj2JTonYKKR16F1Ptm2DV0/EOlikDBIZIdlH4U/CoR8FBHqaIFW4va3c+9cpkrOFm20Yt6z/gYSB9WQDDkcXA3/wI+6cZcbqFeZkPQ3hc14NCq5kyWM5fneMpMPy0yDnjDg2xJ2MsJKfVtsxQ==; 5:FpvR7zKXfi54B6/+RC9/O3WM5S9ogU0NgiOTyxESgpq6jXhFDtXt6e3J2Tczs/rD+AL8zItsli6p+bUob1i/z4anoNxXuNuuk4hNH+Yw4+56ixFTsnslfFUW8oOdGEnELmHMaZjvuSuSCXTcYLXHs/hDfJX4xPq81mIbNr/1xUc=; 24:zQ61nq0TunqWYC4QEgM8MOAXL5foEcKbKvIIDY7PEeJpIFgD49+4dNreyKEUzpsDSPh6F852GX6TuqsxEEwbPmr3tj+iQTwDGTwF/08lSWs=; 7:CCoK3wV4otlB7gbjKkrV2L+9VcFULqFevnVPOY3jaxM/E1xXyqL1gN7DbYDwbBdRV2AjyCbwquLwwORpAMr42z0k0Myj0HKVXqQo3HcyHZDiKFRBZPp9nlKX12zlX3QrL9r4QB8cO2XiT2sPG866fJLZbOv1kdFhApi/zvF2LrCro2jNurLqEVEodx0dkG0BHFGT1ckDFSQXnxVMR4vnHNu3vMk+TGWR9KO5SMlwXQQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 20:HdtkD2DXJB+xB8Um/E4geoPquLWxwWpmFl0fY9YdEi13PMokDGX2EFTHQgyL5HKFStZiel8uSt2BI6sVVt04pwF4JmURZM+Zv99gAYU9TmGp5t8b/B/NVnLmE2WXFl8fUYWEhfoK2Fk4J8YaRoz/ouIXaW1LydbW0fsQsKABA1iXkMWXLT9FEwpnPhJ6mCww3ET7hF/8BfCPp0cvJi0rde7oCIe9JGnAg6e/HESxNjO3mG5p/jLguJVJdw7rBfaZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2017 14:32:25.0752 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0149 Subject: Re: [PATCH 1/2] MdePkg/BaseIoLibIntrinsic: fix SEV (=unrolled) variants of IoWriteFifoXX() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2017 14:29:44 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/04/2017 10:57 AM, Laszlo Ersek wrote: > In commit b6d11d7c4678 ("MdePkg: BaseIoLibIntrinsic (IoLib class) > library", 2017-04-12), the MOV instructions in the write loops were > probably copied from the read loops. However, the operand order was not > adjusted. > > As a result, the IoWriteFifoXX() routines, when invoked in SEV guests, now > overwrite the source buffer with value 0x01 / 0x0001 / 0x00000001 -- the > SevNoRepIo() function returns value 1 in EAX, in SEV guests --, and write > the same value to the target IO port. > > Fix this by putting the target operand (AL / AX / EAX) first, and the > source operand (BYTE / WORD / DWORD [ESI/RSI]) second. > > Cc: Brijesh Singh > Cc: Jordan Justen > Cc: Liming Gao > Cc: Michael D Kinney > Fixes: b6d11d7c467810ea7f2e2eda46ef0bdc57bf1475 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Laszlo Ersek Reviewed-by: Brijesh Singh