From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 02DAB2095DFF5 for ; Wed, 23 Aug 2017 16:18:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D790C883B6; Wed, 23 Aug 2017 23:21:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D790C883B6 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-43.phx2.redhat.com [10.3.116.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C6717AA71; Wed, 23 Aug 2017 23:21:13 +0000 (UTC) To: Brijesh Singh , edk2-devel@lists.01.org Cc: Jordan Justen , Tom Lendacky , Ard Biesheuvel References: <1503490967-5559-1-git-send-email-brijesh.singh@amd.com> <1503490967-5559-21-git-send-email-brijesh.singh@amd.com> From: Laszlo Ersek Message-ID: <8b1dca8d-6a5e-4279-bd0b-13c9423cccfb@redhat.com> Date: Thu, 24 Aug 2017 01:21:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1503490967-5559-21-git-send-email-brijesh.singh@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 23 Aug 2017 23:21:15 +0000 (UTC) Subject: Re: [PATCH v3 20/23] OvmfPkg/VirtioRngDxe: negotiate VIRITO_F_IOMMU_PLATFORM 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 23:18:41 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit (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 > Cc: Jordan Justen > Cc: Tom Lendacky > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Brijesh Singh > --- > 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 , 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; >