From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0085.outbound.protection.outlook.com [104.47.40.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F1F6221E49BA5 for ; Wed, 23 Aug 2017 05:20:30 -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=phTsufAqtqJAqJH5Yy0QHPEuG/3962+bzhtaL4v2trg=; b=n7dXO3TqSgxEN0lboVBJ2y+32Nyf2nBqaxqk1WrTFdCORNZ6PiPb3jWIwu+V7NTxs3lu8qZynmaedDQH0YtiAHnrV9g1+nPzoKOeKl3h+l76uEnSCOB4Uya0X0kqRIwcsdGwIFBzky7RYWH3nYJyRkfj2qnrr38q4dHvvrRpqAY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from brijesh-build-machine.amd.com (165.204.77.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.18; Wed, 23 Aug 2017 12:23:02 +0000 From: Brijesh Singh To: edk2-devel@lists.01.org Cc: Brijesh Singh , Ard Biesheuvel , Jordan Justen , Tom Lendacky , Laszlo Ersek Date: Wed, 23 Aug 2017 08:22:35 -0400 Message-Id: <1503490967-5559-12-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503490967-5559-1-git-send-email-brijesh.singh@amd.com> References: <1503490967-5559-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR12CA0069.namprd12.prod.outlook.com (2603:10b6:3:103::31) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce6124df-b681-445d-79ed-08d4ea21b358 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:XhDWj9LcSeVQG7gPMb/sthV5gXBwm0kTwxLtLFDyxkNW/ZgOAkVOLRvCDqt5rBOJA7KNJeikjRESijQsg+v990C3fxpkNbpCG68UJyope6OIKdOxYPUO12IhhLVtxv9bJjS6tL4krhfnrbKYnbWhN3zASZfmjoibq25XdYTC1eLhpNPenRODDZxk9pGb3n0S7n/GrRi/HpoRWF14UdiovUut9yhQnzRqU/cg74jgKqpDs7KYK9ZIEP/mfQWXyGdR; 25:I9+4sjHW/0S+ms/nVNrj1juZAz50TvH8kknYiEsjwAMhIQ/g+dHyk+VoVpjtVLEBPnjOwASlmklN9WjC8pYhGL+hpaGlfXQfKaXVqTFMknWnBIlG3R2fiQv7w1Xwsv+sj28LRWJ3lFyCfuhwyOSyCqMdrjhw1ANgnKoInKAdrYeUFxcKN45HEWqfkYefM32751Rov43vwz5/SnVAjb9pami5+/onCx+X449ObhtwCelmZre6NnfKjHfhV+YW8w4VgQIXvhc6/dTED5nfHaMBBS38WEFLoZkAjNpnrqeaDvuqY92GwZQT5+3Olt8cV5xwHe1gnZtKLUqxdXjyfLs0sw==; 31:TiVv42dp3grxkF7FKUnaasd7rEvUhYJsYrL+iZEvv5r5k9tcfOkbcB8D6wb0myC9I18kAyY3mEEHhmIl8bQjRi+SmajZVQjT8cHnvnuseAgB80vScpBshbKspcu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:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR12MB0155; X-Forefront-PRVS: 040866B734 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(189002)(199003)(305945005)(47776003)(97736004)(101416001)(110136004)(6666003)(189998001)(478600001)(7736002)(3846002)(66066001)(5003940100001)(6116002)(6486002)(48376002)(86362001)(105586002)(2950100002)(4326008)(106356001)(36756003)(6916009)(50466002)(2906002)(50226002)(42186005)(2351001)(33646002)(53416004)(25786009)(7350300001)(81156014)(76176999)(5660300001)(68736007)(54906002)(8676002)(53936002)(50986999)(81166006)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0155; 23:PcDHf8vkjQYyTlSuUT1jPI/7PKqE5zZHGsXOwSrLS?= =?us-ascii?Q?+Q+DjRob63T198SuUqhMLj+JSyDHuMMpcWRwq2ZnwMgsScRH2vcK3wRi2O6O?= =?us-ascii?Q?mkDFzB6duVcyf2KmbrZKT9GqAGAj/+n3NVcha4o+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etadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:qYlpldu4Mh1dsrNZ1vDJ6xZAJFMA1l2TgQZtCiyoiOqze5eWzrg63cDoWY2eEzWJks2BdOh42TxgVNxCFEc69Idnu6dJFeHxpz6SJo71IIdtH3twNRPBARZ5KikOV+PZjLLn7BcZd69/aN2LxseDnj1jtLBOWP2au2TL2kI39WNRkcwEzvZfYqbVJyiEaYN/3pq+QfwpmyyK4B+kjrNLhj7VVwYl/HRTtoICynfWxmVqkpBW+yv6HXkiSUIfh36o X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2017 12:23:02.7947 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 Subject: [PATCH v3 11/23] OvmfPkg/VirtioLib: change the parameter of VirtioAppendDesc() to UINT64 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: Wed, 23 Aug 2017 12:20:31 -0000 Content-Type: text/plain The patch change the "BufferPhysAddr" parameter of VirtioAppendDesc() from type UINTN to UINT64. UINTN is appropriate as long as we pass system memory references. After the introduction of this feature, that's no longer the case in general. Should we implement "real" IOMMU support at some point, UINTN could break in 32-bit builds of OVMF. Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Include/Library/VirtioLib.h | 35 +++++++++--------- OvmfPkg/Library/VirtioLib/VirtioLib.c | 38 ++++++++++---------- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/OvmfPkg/Include/Library/VirtioLib.h b/OvmfPkg/Include/Library/VirtioLib.h index c3e56ea23b89..a966311ac941 100644 --- a/OvmfPkg/Include/Library/VirtioLib.h +++ b/OvmfPkg/Include/Library/VirtioLib.h @@ -151,33 +151,34 @@ VirtioPrepare ( The caller is responsible for initializing *Indices with VirtioPrepare() first. - @param[in,out] Ring The virtio ring to append the buffer to, as a - descriptor. + @param[in,out] Ring The virtio ring to append the buffer to, + as a descriptor. - @param[in] BufferPhysAddr (Guest pseudo-physical) start address of the - transmit / receive buffer. + @param[in] BufferDeviceAddress (Bus master device)) start address of the + transmit / receive buffer. - @param[in] BufferSize Number of bytes to transmit or receive. + @param[in] BufferSize Number of bytes to transmit or receive. - @param[in] Flags A bitmask of VRING_DESC_F_* flags. The caller - computes this mask dependent on further buffers to - append and transfer direction. - VRING_DESC_F_INDIRECT is unsupported. The - VRING_DESC.Next field is always set, but the host - only interprets it dependent on VRING_DESC_F_NEXT. + @param[in] Flags A bitmask of VRING_DESC_F_* flags. The + caller computes this mask dependent on + further buffers to append and transfer + direction. VRING_DESC_F_INDIRECT is + unsupported. The VRING_DESC.Next field is + always set, but the host only interprets + it dependent on VRING_DESC_F_NEXT. - @param[in,out] Indices Indices->HeadDescIdx is not accessed. - On input, Indices->NextDescIdx identifies the next - descriptor to carry the buffer. On output, - Indices->NextDescIdx is incremented by one, modulo - 2^16. + @param[in,out] Indices Indices->HeadDescIdx is not accessed. + On input, Indices->NextDescIdx identifies + the next descriptor to carry the buffer. + On output, Indices->NextDescIdx is + incremented by one, modulo 2^16. **/ VOID EFIAPI VirtioAppendDesc ( IN OUT VRING *Ring, - IN UINTN BufferPhysAddr, + IN UINT64 BufferDeviceAddress, IN UINT32 BufferSize, IN UINT16 Flags, IN OUT DESC_INDICES *Indices diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/VirtioLib/VirtioLib.c index e5366e385f5d..fcd484fffada 100644 --- a/OvmfPkg/Library/VirtioLib/VirtioLib.c +++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c @@ -189,7 +189,6 @@ VirtioPrepare ( Indices->NextDescIdx = Indices->HeadDescIdx; } - /** Append a contiguous buffer for transmission / reception via the virtio ring. @@ -205,33 +204,34 @@ VirtioPrepare ( The caller is responsible for initializing *Indices with VirtioPrepare() first. - @param[in,out] Ring The virtio ring to append the buffer to, as a - descriptor. + @param[in,out] Ring The virtio ring to append the buffer to, + as a descriptor. - @param[in] BufferPhysAddr (Guest pseudo-physical) start address of the - transmit / receive buffer. + @param[in] BufferDeviceAddress (Bus master device)) start address of the + transmit / receive buffer. - @param[in] BufferSize Number of bytes to transmit or receive. + @param[in] BufferSize Number of bytes to transmit or receive. - @param[in] Flags A bitmask of VRING_DESC_F_* flags. The caller - computes this mask dependent on further buffers to - append and transfer direction. - VRING_DESC_F_INDIRECT is unsupported. The - VRING_DESC.Next field is always set, but the host - only interprets it dependent on VRING_DESC_F_NEXT. + @param[in] Flags A bitmask of VRING_DESC_F_* flags. The + caller computes this mask dependent on + further buffers to append and transfer + direction. VRING_DESC_F_INDIRECT is + unsupported. The VRING_DESC.Next field is + always set, but the host only interprets + it dependent on VRING_DESC_F_NEXT. - @param[in,out] Indices Indices->HeadDescIdx is not accessed. - On input, Indices->NextDescIdx identifies the next - descriptor to carry the buffer. On output, - Indices->NextDescIdx is incremented by one, modulo - 2^16. + @param[in,out] Indices Indices->HeadDescIdx is not accessed. + On input, Indices->NextDescIdx identifies + the next descriptor to carry the buffer. + On output, Indices->NextDescIdx is + incremented by one, modulo 2^16. **/ VOID EFIAPI VirtioAppendDesc ( IN OUT VRING *Ring, - IN UINTN BufferPhysAddr, + IN UINT64 BufferDeviceAddress, IN UINT32 BufferSize, IN UINT16 Flags, IN OUT DESC_INDICES *Indices @@ -240,7 +240,7 @@ VirtioAppendDesc ( volatile VRING_DESC *Desc; Desc = &Ring->Desc[Indices->NextDescIdx++ % Ring->QueueSize]; - Desc->Addr = BufferPhysAddr; + Desc->Addr = BufferDeviceAddress; Desc->Len = BufferSize; Desc->Flags = Flags; Desc->Next = Indices->NextDescIdx % Ring->QueueSize; -- 2.7.4