[edk2] [PATCH 00/12] OvmfPkg/IoMmuDxe: cleanups and fixes

Laszlo Ersek posted 12 patches 7 years, 4 months ago
Failed in applying to current master (apply log)
OvmfPkg/IoMmuDxe/IoMmuDxe.inf  |  19 +-
OvmfPkg/IoMmuDxe/AmdSevIoMmu.h |  14 +-
OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 594 ++++++++++++++------
OvmfPkg/IoMmuDxe/IoMmuDxe.c    |  25 +-
4 files changed, 447 insertions(+), 205 deletions(-)
[edk2] [PATCH 00/12] OvmfPkg/IoMmuDxe: cleanups and fixes
Posted by Laszlo Ersek 7 years, 4 months ago
This series is proposed as a replacement (or a replacement "basis") for
patches #1 through #3 of Brijesh's series

  [PATCH v1 0/4] OvmfPkg : IoMmuDxe: BusMasterCommonBuffer support when
                 SEV is active
  http://mid.mail-archive.com/1501529474-20550-1-git-send-email-brijesh.singh@amd.com

Patch #4 of the same series ("OvmfPkg : QemuFwCfgLib: Map DMA buffer
with CommonBuffer when SEV is enable") is required on top of this
series; otherwise QemuFwCfgLib will break on SEV.


In the present series, patches #1 through #7 are lightweight
improvements for OvmfPkg/IoMmuDxe, concerning line width, MAP_INFO field
names, conversion specifiers for DEBUG(), coding style, error
propagation, and library class listings.

Patch #8 ("zero out pages before releasing them") fixes the "information
leak" issue pointed out in:

  http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com

Patch #9 ('rework setup of "MapInfo->PlainTextAddress" in Map()') fixes
as-yet undiscussed issues, and lays the groundwork for patch #10, by
reworking the calculation of the plaintext buffer address.

Patch #10 ("implement in-place decryption/encryption for Map/Unmap")
fixes the issues around BusMasterCommonBuffer[64] operations that were
discussed in the following messages:

  http://mid.mail-archive.com/4071596d-32c9-e6d9-8c93-0d43d28e9b5a@redhat.com
  http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
  http://mid.mail-archive.com/84c3c5db-623e-181b-c472-7fd7ae1c1670@amd.com
  http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com

Patch #11 ("abort harder on memory encryption mask failures") settles
the error handling for MemEncryptSevClearPageEncMask() and
MemEncryptSevSetPageEncMask(), discussed in:

  http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com

Patch #12 ("Unmap(): recycle MAP_INFO after BusMasterCommonBuffer[64]")
implements the "free list" proposed in:

  http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com

The series has been formatted with "--function-context", for easier
review.

Repo:   https://github.com/lersek/edk2.git
Branch: amdsev_iommu_cleanups_fixes

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>

Thanks
Laszlo

Laszlo Ersek (12):
  OvmfPkg/IoMmuDxe: rewrap source code to 79 characters
  OvmfPkg/IoMmuDxe: rename DeviceAddress to PlainTextAddress in MAP_INFO
  OvmfPkg/IoMmuDxe: rename HostAddress to CryptedAddress in MAP_INFO
  OvmfPkg/IoMmuDxe: convert UINTN arguments to UINT64 for the %Lx fmt
    spec
  OvmfPkg/IoMmuDxe: don't initialize local variables
  OvmfPkg/IoMmuDxe: propagate errors from AmdSevInstallIoMmuProtocol()
  OvmfPkg/IoMmuDxe: clean up used library classes
  OvmfPkg/IoMmuDxe: zero out pages before releasing them
  OvmfPkg/IoMmuDxe: rework setup of "MapInfo->PlainTextAddress" in Map()
  OvmfPkg/IoMmuDxe: implement in-place decryption/encryption for
    Map/Unmap
  OvmfPkg/IoMmuDxe: abort harder on memory encryption mask failures
  OvmfPkg/IoMmuDxe: Unmap(): recycle MAP_INFO after
    BusMasterCommonBuffer[64]

 OvmfPkg/IoMmuDxe/IoMmuDxe.inf  |  19 +-
 OvmfPkg/IoMmuDxe/AmdSevIoMmu.h |  14 +-
 OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 594 ++++++++++++++------
 OvmfPkg/IoMmuDxe/IoMmuDxe.c    |  25 +-
 4 files changed, 447 insertions(+), 205 deletions(-)

-- 
2.13.1.3.g8be5a757fa67

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 00/12] OvmfPkg/IoMmuDxe: cleanups and fixes
Posted by Laszlo Ersek 7 years, 4 months ago
On 08/02/17 23:24, Laszlo Ersek wrote:
> This series is proposed as a replacement (or a replacement "basis") for
> patches #1 through #3 of Brijesh's series
> 
>   [PATCH v1 0/4] OvmfPkg : IoMmuDxe: BusMasterCommonBuffer support when
>                  SEV is active
>   http://mid.mail-archive.com/1501529474-20550-1-git-send-email-brijesh.singh@amd.com

I forgot to mention in the blurb that I have no access to SEV hardware
(yet), so this is completely untested ;) It's only build-tested. It
could cause demons to fly out of your nose! :)

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 00/12] OvmfPkg/IoMmuDxe: cleanups and fixes
Posted by Brijesh Singh 7 years, 4 months ago
Hi Laszlo,

On 08/02/2017 04:24 PM, Laszlo Ersek wrote:
> This series is proposed as a replacement (or a replacement "basis") for
> patches #1 through #3 of Brijesh's series
> 
>    [PATCH v1 0/4] OvmfPkg : IoMmuDxe: BusMasterCommonBuffer support when
>                   SEV is active
>    http://mid.mail-archive.com/1501529474-20550-1-git-send-email-brijesh.singh@amd.com
> 
> Patch #4 of the same series ("OvmfPkg : QemuFwCfgLib: Map DMA buffer
> with CommonBuffer when SEV is enable") is required on top of this
> series; otherwise QemuFwCfgLib will break on SEV.
> 
> 
> In the present series, patches #1 through #7 are lightweight
> improvements for OvmfPkg/IoMmuDxe, concerning line width, MAP_INFO field
> names, conversion specifiers for DEBUG(), coding style, error
> propagation, and library class listings.
> 
> Patch #8 ("zero out pages before releasing them") fixes the "information
> leak" issue pointed out in:
> 
>    http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
> 
> Patch #9 ('rework setup of "MapInfo->PlainTextAddress" in Map()') fixes
> as-yet undiscussed issues, and lays the groundwork for patch #10, by
> reworking the calculation of the plaintext buffer address.
> 
> Patch #10 ("implement in-place decryption/encryption for Map/Unmap")
> fixes the issues around BusMasterCommonBuffer[64] operations that were
> discussed in the following messages:
> 
>    http://mid.mail-archive.com/4071596d-32c9-e6d9-8c93-0d43d28e9b5a@redhat.com
>    http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
>    http://mid.mail-archive.com/84c3c5db-623e-181b-c472-7fd7ae1c1670@amd.com
>    http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com
> 
> Patch #11 ("abort harder on memory encryption mask failures") settles
> the error handling for MemEncryptSevClearPageEncMask() and
> MemEncryptSevSetPageEncMask(), discussed in:
> 
>    http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com
> 
> Patch #12 ("Unmap(): recycle MAP_INFO after BusMasterCommonBuffer[64]")
> implements the "free list" proposed in:
> 
>    http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
> 
> The series has been formatted with "--function-context", for easier
> review.
> 
> Repo:   https://github.com/lersek/edk2.git
> Branch: amdsev_iommu_cleanups_fixes
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> 

Appreciate your help, the series looks good. I have ran some overnight tests
and so far things are looking positive. As you pointed out in blurb that we
still need Patch #4 from my series. I will soon send updated version.

Tested-By: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 00/12] OvmfPkg/IoMmuDxe: cleanups and fixes
Posted by Laszlo Ersek 7 years, 4 months ago
On 08/03/17 16:10, Brijesh Singh wrote:
> Hi Laszlo,
> 
> On 08/02/2017 04:24 PM, Laszlo Ersek wrote:
>> This series is proposed as a replacement (or a replacement "basis") for
>> patches #1 through #3 of Brijesh's series
>>
>>    [PATCH v1 0/4] OvmfPkg : IoMmuDxe: BusMasterCommonBuffer support when
>>                   SEV is active
>>   
>> http://mid.mail-archive.com/1501529474-20550-1-git-send-email-brijesh.singh@amd.com
>>
>>
>> Patch #4 of the same series ("OvmfPkg : QemuFwCfgLib: Map DMA buffer
>> with CommonBuffer when SEV is enable") is required on top of this
>> series; otherwise QemuFwCfgLib will break on SEV.
>>
>>
>> In the present series, patches #1 through #7 are lightweight
>> improvements for OvmfPkg/IoMmuDxe, concerning line width, MAP_INFO field
>> names, conversion specifiers for DEBUG(), coding style, error
>> propagation, and library class listings.
>>
>> Patch #8 ("zero out pages before releasing them") fixes the "information
>> leak" issue pointed out in:
>>
>>   
>> http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
>>
>>
>> Patch #9 ('rework setup of "MapInfo->PlainTextAddress" in Map()') fixes
>> as-yet undiscussed issues, and lays the groundwork for patch #10, by
>> reworking the calculation of the plaintext buffer address.
>>
>> Patch #10 ("implement in-place decryption/encryption for Map/Unmap")
>> fixes the issues around BusMasterCommonBuffer[64] operations that were
>> discussed in the following messages:
>>
>>   
>> http://mid.mail-archive.com/4071596d-32c9-e6d9-8c93-0d43d28e9b5a@redhat.com
>>
>>   
>> http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
>>
>>   
>> http://mid.mail-archive.com/84c3c5db-623e-181b-c472-7fd7ae1c1670@amd.com
>>   
>> http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com
>>
>>
>> Patch #11 ("abort harder on memory encryption mask failures") settles
>> the error handling for MemEncryptSevClearPageEncMask() and
>> MemEncryptSevSetPageEncMask(), discussed in:
>>
>>   
>> http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com
>>
>>
>> Patch #12 ("Unmap(): recycle MAP_INFO after BusMasterCommonBuffer[64]")
>> implements the "free list" proposed in:
>>
>>   
>> http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
>>
>>
>> The series has been formatted with "--function-context", for easier
>> review.
>>
>> Repo:   https://github.com/lersek/edk2.git
>> Branch: amdsev_iommu_cleanups_fixes
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Brijesh Singh <brijesh.singh@amd.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>>
> 
> Appreciate your help, the series looks good. I have ran some overnight
> tests
> and so far things are looking positive. As you pointed out in blurb that we
> still need Patch #4 from my series. I will soon send updated version.
> 
> Tested-By: Brijesh Singh <brijesh.singh@amd.com>
> Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
> 

Thank you!

I'll try to review your patch #4 soon after it hits the list. (Please
also consider pushing it to your public repo.)

Cheers
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 00/12] OvmfPkg/IoMmuDxe: cleanups and fixes
Posted by Laszlo Ersek 7 years, 4 months ago
On 08/03/17 16:10, Brijesh Singh wrote:
> Hi Laszlo,
> 
> On 08/02/2017 04:24 PM, Laszlo Ersek wrote:
>> This series is proposed as a replacement (or a replacement "basis") for
>> patches #1 through #3 of Brijesh's series
>>
>>    [PATCH v1 0/4] OvmfPkg : IoMmuDxe: BusMasterCommonBuffer support when
>>                   SEV is active
>>   
>> http://mid.mail-archive.com/1501529474-20550-1-git-send-email-brijesh.singh@amd.com
>>
>>
>> Patch #4 of the same series ("OvmfPkg : QemuFwCfgLib: Map DMA buffer
>> with CommonBuffer when SEV is enable") is required on top of this
>> series; otherwise QemuFwCfgLib will break on SEV.
>>
>>
>> In the present series, patches #1 through #7 are lightweight
>> improvements for OvmfPkg/IoMmuDxe, concerning line width, MAP_INFO field
>> names, conversion specifiers for DEBUG(), coding style, error
>> propagation, and library class listings.
>>
>> Patch #8 ("zero out pages before releasing them") fixes the "information
>> leak" issue pointed out in:
>>
>>   
>> http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
>>
>>
>> Patch #9 ('rework setup of "MapInfo->PlainTextAddress" in Map()') fixes
>> as-yet undiscussed issues, and lays the groundwork for patch #10, by
>> reworking the calculation of the plaintext buffer address.
>>
>> Patch #10 ("implement in-place decryption/encryption for Map/Unmap")
>> fixes the issues around BusMasterCommonBuffer[64] operations that were
>> discussed in the following messages:
>>
>>   
>> http://mid.mail-archive.com/4071596d-32c9-e6d9-8c93-0d43d28e9b5a@redhat.com
>>
>>   
>> http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
>>
>>   
>> http://mid.mail-archive.com/84c3c5db-623e-181b-c472-7fd7ae1c1670@amd.com
>>   
>> http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com
>>
>>
>> Patch #11 ("abort harder on memory encryption mask failures") settles
>> the error handling for MemEncryptSevClearPageEncMask() and
>> MemEncryptSevSetPageEncMask(), discussed in:
>>
>>   
>> http://mid.mail-archive.com/89e1553a-1630-87a5-cffd-99174a380d41@redhat.com
>>
>>
>> Patch #12 ("Unmap(): recycle MAP_INFO after BusMasterCommonBuffer[64]")
>> implements the "free list" proposed in:
>>
>>   
>> http://mid.mail-archive.com/e1137140-f5d5-7eb8-0162-952694b24f96@redhat.com
>>
>>
>> The series has been formatted with "--function-context", for easier
>> review.
>>
>> Repo:   https://github.com/lersek/edk2.git
>> Branch: amdsev_iommu_cleanups_fixes
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Brijesh Singh <brijesh.singh@amd.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>>
> 
> Appreciate your help, the series looks good. I have ran some overnight
> tests
> and so far things are looking positive. As you pointed out in blurb that we
> still need Patch #4 from my series. I will soon send updated version.
> 
> Tested-By: Brijesh Singh <brijesh.singh@amd.com>
> Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>

Pushed as 8dccfa6d4807..d0c9afea42a0.

(With the patch #10 fixup you pointed out in
<http://mid.mail-archive.com/ce614a16-117c-e904-ac5c-ed56bd729e06@amd.com>.)

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