From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0089.outbound.protection.outlook.com [104.47.40.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 86ED321D1825A for ; Mon, 14 Aug 2017 04:34:57 -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=ZdmHGGaJFdaOtdPYVJs7dYEJhly6MVrJZ6W8OkXEdWQ=; b=RvA3QZHkkdnyRQfG64sh4ah2/eKBWU7eYBKgghvZgELtjEX9JhnfkJ6FA1JVgP7KbbK9niC/OglVGaJi2HL5+p2KgrxbOTBniD69XjqCRI0eiK3npzskjDaONcQP7pbOnUB9RKBi0OapfMAGk5e/i21z/K9590BQyBGA70TiDvE= 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 BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:19 +0000 From: Brijesh Singh To: edk2-devel@lists.01.org Cc: Brijesh Singh , Ard Biesheuvel , Jordan Justen , Tom Lendacky , Laszlo Ersek Date: Mon, 14 Aug 2017 07:36:36 -0400 Message-Id: <1502710605-8058-15-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03968a26-f3a0-4755-5f16-08d4e308d297 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:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:h7yVshdiPiY1yNzLmHn7iQFKcEgraUqvBHnGHISwnbT8q20+o/MuRUK0DvnYOD/V99IU1mJUBhU9EWstARs0UkaB7mFcLIKYkI0U0x5y7vkIk5HNMr+kflEhRdjrAzlOcpN8+alCQBb8SliNNqFAy3ZfOSCMGAjOlsZJC/BnvF5Bsl1QdfcA3u8wBEsAvcptJC0oDiy0bO428r87zi8QmqZCLACBKRCzcX6Kheu6W7N9fJZcaMJA7g0SH4SOfrt6; 25:xxrREy54qGFIDx2sTNaslQkuz3hFoEmgdutkWGLCA3zX82xYgYEDsOJHpQirhIfmR+0Iwq4JC2TZdRkU4tv0GRrJioYZzNHWTzDwYXnqUlpuqS1EDjUWmBY4eDQzxugi+4VPdU0aGlYFbs/RnaiCM449XvxNhhdnSiXrWtYXEe46K/gdwLSRekknVHr69eMwI+m2xpCit8NYPfr/SLZCfYg1judvcU4SyU0Q4B3r1+4oc3eYzhUqG85TbRUi1ew5erbvrAmEQRSe0/UiEdIgqbhVIWl1gIZ3LrdjGipC4+ll6GC3wO8V5Fw5n+u6i2uotKKFlaK4BrwFwWykL9dqIA==; 31:j4UKveDJckZfxPhaOE1H1KRvWd07DI1DrDh7iMdZbEAR9VBuXuH+1axhopBqlGjx1lKKkXQMe5h6OjFueoZrI2cdh2iKQ8lXa76V4xdb6VDcL5DdeA1qGjzd9xS7sttYjXZ+yUHcd5IDIVLHNePvzdopEKQJvVgfkAJmh5KsgYKV8Q25z3A3+borPkdOUbTQ9kAf57wAtEceBcC0ScdJdqMaMayw2zEj8kKBB1qpDtU= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:JK5VnfJTlVRNw2QJRKq5RDIGs5/+iNkYtjcOjR1XTQQxKR1k4h1sDiYep+jkfPYuAwlw6YQadHdEb2Eqq/weV30sCel+pG/fu5TbaOdekY6h+R7yQEqeeUOCcKnsivYGE0aPNegzAvh4fONQD0pJWgQZAN9LR4NVF58zMP9wym7OiMvgcwbTI3BQZkermMW0FCFyDKKWp5Q3tQlSAxJXULACDLJFQouidmQX0h+hk0rivd4EZOnjf2PT7hmVhEyx/7wVXOqLCqXONw92gG/3odUkl7nOKM9TW2gIQAwQSFJofa+jK9edmCFK8Dfd8uXwGH26zDbYIpi7RyXL87wUYMMlH/Vl7l1qMOnSUoWLmgTLjbgjlNnW/eSSKnSmAGGd/uhAyaeiEld2cpAB9W1fAbzbqk2YyHlmRMlU1JJHdGas8nyjPSUHS7jwv12iQ6/yPj7oOHZnicbipZ3Gznts3tA5+d8DjKZGzgmr6VlAJi+hCYnUn/595cqLhP8G6uMo; 4:AIX2Ujt21UJRYUfFW+Laqubv2i6q/lk52FQ8a2HXdb8/6rzkjI+AcXIiiqwiUglBM69i3OOa0z0XRmEKev4noW+xEFTEp5+ax+Ly1UMpDJ9lYkjOQJTyVkVBq3SYp4ZQCOerM40Nu9helrACHEiBYZbpZ1U90r5tJ4SgcdnD7x4Iipd4rg5Ng1k574psImsEvlbWi4CVFH+yTJNRIVy0TLbqVkO3KNjGyzhAbqXwM78gubN8j9Hwq6pIup2CkWFz/NUfaItc/KF0pyezT0oM5JGY002zBipJPWhUXigTmsiob1nelZFlTs6Xi8V0MkQYgdrrzH9NaB3KeoT5DNHFwQ== 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)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; 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: =?us-ascii?Q?1; BY2PR12MB0145; 23:/Ucht6NEsP2j3+5exSXVGekUjLbNfrRfF/B3De4L9?= =?us-ascii?Q?x4rNpqS1Uzzos0UZ2tEwU7R1Ww8DSdlwAjh+4vhU+CkkCVupPaJ4PKGPDJyi?= =?us-ascii?Q?hgJPyyFndl1Ij4kUPMuejg8RIlBJ3KZUzD6VK23Z/rgsphfi+qQpky3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v1PK+BPsC2BoECPKwd/lkFhv+9WF5ZHlQFA/ClEqy28aO0s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:62LJmR1j+JIL2N4UbstTSF/heNzwHf98DL+dfQJEoPtEa8C/WafIEl6cmtBo7P6mOk54Isi0UbjjlaXVC+vkiedpaBgJCJSZRwYquyLSg7FoNm/P0uovRI5G1X4fFQljfs0wS1gvud8nQXi9fTpC+7Fbv+xrAfHdrDsF2c9fXTCHfARKDaZTacyqTB8MbGz5foW3XW9/wKHpgY5+tnI19FkSoz0hX/lt70NikQhuhMDV/KUu7ZZIeH0SPZ5qXy6T X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:19.2524 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [PATCH v2 14/23] OvmfPkg/Virtio10Dxe: add the RingBaseShift offset 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: Mon, 14 Aug 2017 11:34:57 -0000 Content-Type: text/plain virtio drivers uses VirtioRingMap() to map the ring buffer host address to a device address. If an IOMMU is present then RingBaseShift contains the offset from the host address. 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/Virtio10Dxe/Virtio10.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c index d102e1fd8551..e9041dec91a4 100644 --- a/OvmfPkg/Virtio10Dxe/Virtio10.c +++ b/OvmfPkg/Virtio10Dxe/Virtio10.c @@ -498,11 +498,10 @@ Virtio10SetQueueAddress ( UINT64 Address; UINT16 Enable; - ASSERT (RingBaseShift == 0); - Dev = VIRTIO_1_0_FROM_VIRTIO_DEVICE (This); Address = (UINTN)Ring->Desc; + Address += RingBaseShift; Status = Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE, OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueDesc), sizeof Address, &Address); @@ -511,6 +510,7 @@ Virtio10SetQueueAddress ( } Address = (UINTN)Ring->Avail.Flags; + Address += RingBaseShift; Status = Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE, OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueAvail), sizeof Address, &Address); @@ -519,6 +519,7 @@ Virtio10SetQueueAddress ( } Address = (UINTN)Ring->Used.Flags; + Address += RingBaseShift; Status = Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE, OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueUsed), sizeof Address, &Address); -- 2.7.4