public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM
@ 2017-08-25 10:37 Brijesh Singh
  2017-08-25 10:37 ` [PATCH 1/2] OvmfPkg/Virtio10: define VIRTIO_F_IOMMU_PLATFORM feature bit Brijesh Singh
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Brijesh Singh @ 2017-08-25 10:37 UTC (permalink / raw)
  To: edk2-devel

The series adds support to neogtiate iommu_platform feature bit. The feature
bit available for morden-only device

Qemu cli:

# $QEMU \
  ... \
  -device virtio-rng-pci,disable-legacy=on,iommu_platform=true
  ... 

Repo: https://github.com/codomania/edk2
Branch: virtio-rng-1

Brijesh Singh (2):
  OvmfPkg/Virtio10: define VIRTIO_F_IOMMU_PLATFORM feature bit
  OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM

 OvmfPkg/Include/IndustryStandard/Virtio10.h | 4 +++-
 OvmfPkg/VirtioRngDxe/VirtioRng.c            | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] OvmfPkg/Virtio10: define VIRTIO_F_IOMMU_PLATFORM feature bit
  2017-08-25 10:37 [PATCH 0/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM Brijesh Singh
@ 2017-08-25 10:37 ` Brijesh Singh
  2017-08-25 10:37 ` [PATCH 2/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM Brijesh Singh
  2017-08-25 14:22 ` [PATCH 0/2] " Laszlo Ersek
  2 siblings, 0 replies; 4+ messages in thread
From: Brijesh Singh @ 2017-08-25 10:37 UTC (permalink / raw)
  To: edk2-devel
  Cc: Brijesh Singh, Ard Biesheuvel, Jordan Justen, Tom Lendacky,
	Laszlo Ersek

This feature indicates that the device is behind an IOMMU that translates
bus addresses from the device into physical addresses in memory.  If this
feature bit is set to 0, then the device emits physical addresses which
are not translated further, even though an IOMMU may be present.
see [1] for more infromation

[1] https://lists.oasis-open.org/archives/virtio-dev/201610/msg00121.html

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 OvmfPkg/Include/IndustryStandard/Virtio10.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/IndustryStandard/Virtio10.h
index 4c9b62a3cf59..c5efb5cfcb8a 100644
--- a/OvmfPkg/Include/IndustryStandard/Virtio10.h
+++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h
@@ -2,6 +2,7 @@
   Definitions from the VirtIo 1.0 specification (csprd05).
 
   Copyright (C) 2016, Red Hat, Inc.
+  Copyright (C) 2017, AMD, Inc.
 
   This program and the accompanying materials are licensed and made available
   under the terms and conditions of the BSD License which accompanies this
@@ -81,6 +82,7 @@ typedef struct {
 //
 // VirtIo 1.0 reserved (device-independent) feature bits
 //
-#define VIRTIO_F_VERSION_1 BIT32
+#define VIRTIO_F_VERSION_1      BIT32
+#define VIRTIO_F_IOMMU_PLATFORM BIT33
 
 #endif // _VIRTIO_1_0_H_
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM
  2017-08-25 10:37 [PATCH 0/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM Brijesh Singh
  2017-08-25 10:37 ` [PATCH 1/2] OvmfPkg/Virtio10: define VIRTIO_F_IOMMU_PLATFORM feature bit Brijesh Singh
@ 2017-08-25 10:37 ` Brijesh Singh
  2017-08-25 14:22 ` [PATCH 0/2] " Laszlo Ersek
  2 siblings, 0 replies; 4+ messages in thread
From: Brijesh Singh @ 2017-08-25 10:37 UTC (permalink / raw)
  To: edk2-devel
  Cc: Brijesh Singh, Ard Biesheuvel, Jordan Justen, Tom Lendacky,
	Laszlo Ersek

VirtioRngDxe driver has been updated to use IOMMU-like member functions
from VIRTIO_DEVICE_PROTOCOL to translate the system physical address to
device address. We do not need to do anything special when
VIRTIO_F_IOMMU_PLATFORM bit is present hence treat it in parallel with
VIRTIO_F_VERSION_1.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 OvmfPkg/VirtioRngDxe/VirtioRng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/VirtioRng.c
index 4e6799788105..80380bcdf8bf 100644
--- a/OvmfPkg/VirtioRngDxe/VirtioRng.c
+++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c
@@ -279,7 +279,7 @@ VirtioRngInit (
     goto Failed;
   }
 
-  Features &= VIRTIO_F_VERSION_1;
+  Features &= VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM;
 
   //
   // In virtio-1.0, feature negotiation is expected to complete before queue
@@ -360,7 +360,7 @@ VirtioRngInit (
   // step 5 -- Report understood features and guest-tuneables.
   //
   if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {
-    Features &= ~(UINT64)VIRTIO_F_VERSION_1;
+    Features &= ~(UINT64)(VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM);
     Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
     if (EFI_ERROR (Status)) {
       goto UnmapQueue;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM
  2017-08-25 10:37 [PATCH 0/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM Brijesh Singh
  2017-08-25 10:37 ` [PATCH 1/2] OvmfPkg/Virtio10: define VIRTIO_F_IOMMU_PLATFORM feature bit Brijesh Singh
  2017-08-25 10:37 ` [PATCH 2/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM Brijesh Singh
@ 2017-08-25 14:22 ` Laszlo Ersek
  2 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2017-08-25 14:22 UTC (permalink / raw)
  To: Brijesh Singh, edk2-devel

On 08/25/17 12:37, Brijesh Singh wrote:
> The series adds support to neogtiate iommu_platform feature bit. The feature
> bit available for morden-only device
> 
> Qemu cli:
> 
> # $QEMU \
>   ... \
>   -device virtio-rng-pci,disable-legacy=on,iommu_platform=true
>   ... 
> 
> Repo: https://github.com/codomania/edk2
> Branch: virtio-rng-1
> 
> Brijesh Singh (2):
>   OvmfPkg/Virtio10: define VIRTIO_F_IOMMU_PLATFORM feature bit
>   OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM
> 
>  OvmfPkg/Include/IndustryStandard/Virtio10.h | 4 +++-
>  OvmfPkg/VirtioRngDxe/VirtioRng.c            | 4 ++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>

Commit range 0b9c0c654002..4bef13da0022.

Thanks,
Laszlo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-25 14:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25 10:37 [PATCH 0/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM Brijesh Singh
2017-08-25 10:37 ` [PATCH 1/2] OvmfPkg/Virtio10: define VIRTIO_F_IOMMU_PLATFORM feature bit Brijesh Singh
2017-08-25 10:37 ` [PATCH 2/2] OvmfPkg/VirtioRngDxe: negotiate VIRTIO_F_IOMMU_PLATFORM Brijesh Singh
2017-08-25 14:22 ` [PATCH 0/2] " Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox