(1) Please replace "VIRITO_F_IOMMU_PLATFORM" with
"VIRTIO_F_IOMMU_PLATFORM" in the subjects of the remaining patches
(including this one).

On 08/23/17 14:22, Brijesh Singh wrote:
> 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.
> 
> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
> Cc: Jordan Justen <jordan.l.jus...@intel.com>
> Cc: Tom Lendacky <thomas.lenda...@amd.com>
> Cc: Laszlo Ersek <ler...@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Brijesh Singh <brijesh.si...@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 59f32d343179..32512d882f7d 100644
> --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c
> +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c
> @@ -278,7 +278,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
> @@ -359,7 +359,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;

While all of the VIRTIO_F_VERSION_1 locations in this driver are covered
now, this change is invalid:

The bitwise-complement operator "~" has stronger binding than the
bitwise-or operator "|". The cast operator "(type)" also binds more
strongly than the bitwise-or operator "|".

The purpose of the above assignment is to clear both of the listed bits.
Therefore,

(2) parentheses are necessary tightly around the bitwise-or operator,
like I suggested in
<82cb5dda-f02d-9e38-c47e-3723184dea08@redhat.com">http://mid.mail-archive.com/82cb5dda-f02d-9e38-c47e-3723184dea08@redhat.com>,
point (4):

    Features &= ~(UINT64)(VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM);

I think this comment too applies to the rest of the patches.

Thanks,
Laszlo

>      Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
>      if (EFI_ERROR (Status)) {
>        goto UnmapQueue;
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to