From: Laszlo Ersek <lersek@redhat.com>
To: Brijesh Singh <brijesh.singh@amd.com>, edk2-devel@lists.01.org
Cc: Jordan Justen <jordan.l.justen@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH v2 23/23] OvmfPkg/Virtio: define VIRITO_F_IOMMU_PLATFORM feature bit
Date: Mon, 21 Aug 2017 17:40:46 +0200 [thread overview]
Message-ID: <82cb5dda-f02d-9e38-c47e-3723184dea08@redhat.com> (raw)
In-Reply-To: <1502710605-8058-24-git-send-email-brijesh.singh@amd.com>
On 08/14/17 13:36, Brijesh Singh wrote:
> 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
>
> In previous patches, we have implemented IOMMU-like member functions in
> VIRTIO_DEVICE_PROTOCOL to translate the physical address to bus address
> and virtio drivers are updated to use those member functions. 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.
>
> Suggested-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 | 5 +++++
> OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 3 ++-
> OvmfPkg/VirtioNetDxe/SnpInitialize.c | 3 ++-
> OvmfPkg/VirtioRngDxe/VirtioRng.c | 2 +-
> OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 3 ++-
> 5 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/IndustryStandard/Virtio10.h
> index 4c9b62a3cf59..c62429d94432 100644
> --- a/OvmfPkg/Include/IndustryStandard/Virtio10.h
> +++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h
> @@ -83,4 +83,9 @@ typedef struct {
> //
> #define VIRTIO_F_VERSION_1 BIT32
>
> +//
> +// VirtIo 1.0 reserved iommu platform feature bits
> +//
> +#define VIRTIO_F_IOMMU_PLATFORM BIT33
> +
> #endif // _VIRTIO_1_0_H_
(1) The comment is not necessary. Namely, the comment that you see just
above the VIRTIO_F_VERSION_1 macro:
//
// VirtIo 1.0 reserved (device-independent) feature bits
//
is meant as the introduction for the *full set* of such bits.
Given that VIRTIO_F_IOMMU_PLATFORM is just another bit in that set,
please just add it right below VIRTIO_F_VERSION_1.
(2) Please update the whitespace for VIRTIO_F_VERSION_1 as well, so that
the replacement texts (BIT32, BIT33) line up nicely.
(3) Please split this change out to a separate patch.
> diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> index 57baceb20a19..a78ec0df9c7b 100644
> --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> @@ -773,7 +773,8 @@ VirtioBlkInit (
> }
>
> Features &= VIRTIO_BLK_F_BLK_SIZE | VIRTIO_BLK_F_TOPOLOGY | VIRTIO_BLK_F_RO |
> - VIRTIO_BLK_F_FLUSH | VIRTIO_F_VERSION_1;
> + VIRTIO_BLK_F_FLUSH | VIRTIO_F_VERSION_1 |
> + VIRTIO_F_IOMMU_PLATFORM;
>
> //
> // In virtio-1.0, feature negotiation is expected to complete before queue
(4) The modifications for this file (VirtioBlk.c) are incomplete.
Namely, in message
<http://mid.mail-archive.com/841bec5f-6f6e-8b1f-25ba-0fd37a915b72@redhat.com>,
points (3) and (5.3), I requested that
> [...] VIRTIO_F_IOMMU_PLATFORM should be treated in OVMF *precisely* in
> parallel with VIRTIO_F_VERSION_1.
Therefore please locate *all* occurrences of VIRTIO_F_VERSION_1, and act
accordingly. In particular, in addition to the above location, we also have:
//
// step 5 -- Report understood features.
//
if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {
Features &= ~(UINT64)VIRTIO_F_VERSION_1;
Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
if (EFI_ERROR (Status)) {
goto ReleaseQueue;
}
}
which should now be changed to:
Features &= ~(UINT64)(VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM);
Same for all the other drivers.
(5) Please split each VIRTIO_F_IOMMU_PLATFORM change to a separate
patch. (That is, one patch per driver.)
- OvmfPkg/Virtio10: define VIRITO_F_IOMMU_PLATFORM feature bit
- OvmfPkg/VirtioBlkDxe: negotiate VIRITO_F_IOMMU_PLATFORM
- OvmfPkg/VirtioNetDxe: negotiate VIRITO_F_IOMMU_PLATFORM
- ...
Thanks,
Laszlo
> diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/SnpInitialize.c
> index 9bac19f8e3d1..b389f6243661 100644
> --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c
> +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c
> @@ -536,7 +536,8 @@ VirtioNetInitialize (
> ASSERT (Dev->Snm.MediaPresentSupported ==
> !!(Features & VIRTIO_NET_F_STATUS));
>
> - Features &= VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | VIRTIO_F_VERSION_1;
> + Features &= VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | VIRTIO_F_VERSION_1 |
> + VIRTIO_F_IOMMU_PLATFORM;
>
> //
> // In virtio-1.0, feature negotiation is expected to complete before queue
> diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/VirtioRng.c
> index b19d90901430..81d8c7facc10 100644
> --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c
> +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c
> @@ -273,7 +273,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
> diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
> index 65e9bda0827a..286b005c994c 100644
> --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
> +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
> @@ -903,7 +903,8 @@ VirtioScsiInit (
> goto Failed;
> }
>
> - Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1;
> + Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1 |
> + VIRTIO_F_IOMMU_PLATFORM;
>
> //
> // In virtio-1.0, feature negotiation is expected to complete before queue
>
prev parent reply other threads:[~2017-08-21 15:38 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 11:36 [PATCH v2 00/21] OvmfPkg/Virtio: introduce IOMMU-like member functions Brijesh Singh
2017-08-14 11:36 ` [PATCH v2 01/23] OvmfPkg/VirtioPciDeviceDxe: supply missing BUS_MASTER attribute Brijesh Singh
2017-08-16 0:34 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 02/23] OvmfPkg/Virtio10Dxe: " Brijesh Singh
2017-08-16 0:36 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 03/23] OvmfPkg/VirtioPciDeviceDxe: add missing IN and OUT decoration Brijesh Singh
2017-08-16 0:36 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 04/23] OvmfPkg/VirtioMmioDeviceLib: " Brijesh Singh
2017-08-16 0:37 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 05/23] OvmfPkg/Virtio: fix comment style Brijesh Singh
2017-08-16 0:41 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 06/23] OvmfPkg/Virtio: introduce IOMMU-like member functions to VIRTIO_DEVICE_PROTOCOL Brijesh Singh
2017-08-16 14:37 ` Laszlo Ersek
2017-08-16 15:58 ` Brijesh Singh
2017-08-14 11:36 ` [PATCH v2 07/23] OvmfPkg/Virtio10Dxe: implement IOMMU-like member functions Brijesh Singh
2017-08-16 14:59 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 08/23] OvmfPkg/VirtioPciDeviceDxe: " Brijesh Singh
2017-08-16 15:32 ` Laszlo Ersek
2017-08-16 15:53 ` Brijesh Singh
2017-08-14 11:36 ` [PATCH v2 09/23] OvmfPkg/VirtioMmioDeviceLib: " Brijesh Singh
2017-08-16 15:58 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 10/23] OvmfPkg/VirtioLib: add VirtioMapAllBytesInSharedBuffer() helper function Brijesh Singh
2017-08-16 16:47 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 11/23] OvmfPkg/VirtioLib: take VirtIo instance in VirtioRingInit/VirtioRingUninit Brijesh Singh
2017-08-16 16:53 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 12/23] OvmfPkg/VirtioLib: add functions to map/unmap VRING Brijesh Singh
2017-08-16 20:56 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 13/23] OvmfPkg/Virtio: take RingBaseShift in VirtioSetQueueAddress() Brijesh Singh
2017-08-16 21:43 ` Laszlo Ersek
2017-08-16 21:51 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 14/23] OvmfPkg/Virtio10Dxe: add the RingBaseShift offset Brijesh Singh
2017-08-16 21:57 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 15/23] OvmfPkg/VirtioLib: alloc vring buffer with AllocateSharedPages() Brijesh Singh
2017-08-16 22:18 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 16/23] OvmfPkg/VirtioRngDxe: map host address to device address Brijesh Singh
2017-08-21 14:05 ` Laszlo Ersek
2017-08-22 15:44 ` Brijesh Singh
2017-08-22 16:28 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 17/23] OvmfPkg/VirtioBlkDxe: " Brijesh Singh
2017-08-21 15:24 ` Laszlo Ersek
2017-08-22 1:42 ` Brijesh Singh
[not found] ` <1387174d-0040-0072-5e36-c133fd7ec934@redhat.com>
2017-08-22 14:29 ` Brijesh Singh
2017-08-22 15:53 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 18/23] OvmfPkg/VirtioScsiDxe: Use DeviceAddresses in vring descriptors Brijesh Singh
2017-08-21 19:08 ` Laszlo Ersek
2017-08-14 11:36 ` [PATCH v2 19/23] OvmfPkg/VirtioNetDxe: alloc Tx and Rx rings using AllocateSharedPage() Brijesh Singh
2017-08-14 11:36 ` [PATCH v2 20/23] OvmfPkg/VirtioNetDxe: alloc RxBuf using AllocateSharedPages() Brijesh Singh
2017-08-14 11:36 ` [PATCH v2 21/23] OvmfPkg/VirtioNetDxe: dynamically alloc transmit header Brijesh Singh
2017-08-14 11:36 ` [PATCH v2 22/23] OvmfPkg/VirtioNetDxe: map transmit buffer host address to device address Brijesh Singh
2017-08-14 11:36 ` [PATCH v2 23/23] OvmfPkg/Virtio: define VIRITO_F_IOMMU_PLATFORM feature bit Brijesh Singh
2017-08-21 15:40 ` Laszlo Ersek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82cb5dda-f02d-9e38-c47e-3723184dea08@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox