public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface
@ 2016-12-02 20:20 Laszlo Ersek
  2016-12-02 20:20 ` [PATCH v2 1/6] ArmVirtPkg/QemuFwCfgLib: remove superfluous InternalQemuFwCfgIsAvailable() Laszlo Ersek
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-02 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Ard Biesheuvel, Jordan Justen, Leif Lindholm

Version 2 of
<https://lists.01.org/pipermail/edk2-devel/2016-December/005413.html>.

The following patches

  [PATCH 3/5] OvmfPkg/IndustryStandard: add QemuFwCfgDma.h
  [PATCH 4/5] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to
              OvmfPkg/IndustryStandard

have been replaced with

  [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related
                 defs to lib class
  [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more
                 definitions
  [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated
                 lib class header

The last patch

  [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg
                 access method

needed a trivial update too; for that I preserved Jordan's R-b. Please
see the individual patches for v1->v2 details.

Repo:   https://github.com/lersek/edk2/
Branch: ovmf_fwcfg_dma_v2

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>

Thanks
Laszlo

Laszlo Ersek (6):
  ArmVirtPkg/QemuFwCfgLib: remove superfluous
    InternalQemuFwCfgIsAvailable()
  OvmfPkg/QemuFwCfgLib: move InternalQemuFwCfgIsAvailable() to lib
    instances
  ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class
  OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions
  ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class
    header
  OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg access method

 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c      | 53 ++------------
 OvmfPkg/Include/Library/QemuFwCfgLib.h              | 43 +++++++-----
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c         | 74 ++++++++++++++++++++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf       |  1 +
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h | 46 ++++++++++++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c      | 28 +++++++-
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c         | 17 ++++-
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf    |  1 +
 8 files changed, 198 insertions(+), 65 deletions(-)
 create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h

-- 
2.9.2



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

* [PATCH v2 1/6] ArmVirtPkg/QemuFwCfgLib: remove superfluous InternalQemuFwCfgIsAvailable()
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
@ 2016-12-02 20:20 ` Laszlo Ersek
  2016-12-02 20:20 ` [PATCH v2 2/6] OvmfPkg/QemuFwCfgLib: move InternalQemuFwCfgIsAvailable() to lib instances Laszlo Ersek
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-02 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm

InternalQemuFwCfgIsAvailable() is an API that is incorrectly exposed by
the "OvmfPkg/Include/Library/QemuFwCfgLib.h" library class header; the API
is meant to be used internally to library instances (if it's needed at
all). ArmVirtPkg's instance has no use for it actually, so simplify the
code and remove the function definition.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 31 ++++----------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 8ecbe3fb5fe6..2fd8d9050566 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -75,25 +75,6 @@ typedef struct {
 
 
 /**
-  Returns a boolean indicating if the firmware configuration interface is
-  available for library-internal purposes.
-
-  This function never changes fw_cfg state.
-
-  @retval TRUE   The interface is available internally.
-  @retval FALSE  The interface is not available internally.
-**/
-BOOLEAN
-EFIAPI
-InternalQemuFwCfgIsAvailable (
-  VOID
-  )
-{
-  return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0);
-}
-
-
-/**
   Returns a boolean indicating if the firmware configuration interface
   is available or not.
 
@@ -109,7 +90,7 @@ QemuFwCfgIsAvailable (
   VOID
   )
 {
-  return InternalQemuFwCfgIsAvailable ();
+  return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0);
 }
 
 
@@ -187,7 +168,7 @@ QemuFwCfgInitialize (
     FwCfgDmaAddress = 0;
   }
 
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     UINT32 Signature;
 
     QemuFwCfgSelectItem (QemuFwCfgItemSignature);
@@ -231,7 +212,7 @@ QemuFwCfgSelectItem (
   IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem
   )
 {
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem));
   }
 }
@@ -360,7 +341,7 @@ QemuFwCfgReadBytes (
   IN VOID  *Buffer
   )
 {
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     InternalQemuFwCfgReadBytes (Size, Buffer);
   } else {
     ZeroMem (Buffer, Size);
@@ -384,7 +365,7 @@ QemuFwCfgWriteBytes (
   IN VOID                   *Buffer
   )
 {
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     UINTN Idx;
 
     for (Idx = 0; Idx < Size; ++Idx) {
@@ -494,7 +475,7 @@ QemuFwCfgFindFile (
   UINT32 Count;
   UINT32 Idx;
 
-  if (!InternalQemuFwCfgIsAvailable ()) {
+  if (!QemuFwCfgIsAvailable ()) {
     return RETURN_UNSUPPORTED;
   }
 
-- 
2.9.2




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

* [PATCH v2 2/6] OvmfPkg/QemuFwCfgLib: move InternalQemuFwCfgIsAvailable() to lib instances
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
  2016-12-02 20:20 ` [PATCH v2 1/6] ArmVirtPkg/QemuFwCfgLib: remove superfluous InternalQemuFwCfgIsAvailable() Laszlo Ersek
@ 2016-12-02 20:20 ` Laszlo Ersek
  2016-12-02 20:20 ` [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class Laszlo Ersek
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-02 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Jordan Justen

InternalQemuFwCfgIsAvailable() is an API that is incorrectly exposed by
the "OvmfPkg/Include/Library/QemuFwCfgLib.h" library class header; the API
is meant to be used internally to library instances (if it's needed at
all).

In OvmfPkg, we have two lib instances (for SEC and PEI/DXE); they provide
different implementations of InternalQemuFwCfgIsAvailable(), for the
shared file "OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c". Move the API
declaration to a new internal header called "QemuFwCfgLibInternal.h", and
drop EFIAPI in the process.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
---
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf       |  1 +
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf    |  1 +
 OvmfPkg/Include/Library/QemuFwCfgLib.h              | 16 ----------
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h | 33 ++++++++++++++++++++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c         |  2 ++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c      |  3 +-
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c         |  2 +-
 7 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
index a95e1e730c2c..66ac77850915 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
@@ -32,6 +32,7 @@ [Defines]
 #
 
 [Sources]
+  QemuFwCfgLibInternal.h
   QemuFwCfgLib.c
   QemuFwCfgPeiDxe.c
 
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf
index 03a659c9b082..c1d6a54b1a39 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf
@@ -30,6 +30,7 @@ [Defines]
 #
 
 [Sources]
+  QemuFwCfgLibInternal.h
   QemuFwCfgLib.c
   QemuFwCfgSec.c
 
diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
index baaa257d6188..7c29422fbd72 100644
--- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
+++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
@@ -206,22 +206,6 @@ QemuFwCfgFindFile (
 
 
 /**
-  Returns a boolean indicating if the firmware configuration interface is
-  available for library-internal purposes.
-
-  This function never changes fw_cfg state.
-
-  @retval    TRUE   The interface is available internally.
-  @retval    FALSE  The interface is not available internally.
-**/
-BOOLEAN
-EFIAPI
-InternalQemuFwCfgIsAvailable (
-  VOID
-  );
-
-
-/**
   Determine if S3 support is explicitly enabled.
 
   @retval  TRUE   if S3 support is explicitly enabled.
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h
new file mode 100644
index 000000000000..5b162bf98739
--- /dev/null
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h
@@ -0,0 +1,33 @@
+/** @file
+  Internal interfaces specific to the QemuFwCfgLib instances in OvmfPkg.
+
+  Copyright (C) 2016, Red Hat, Inc.
+
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __QEMU_FW_CFG_LIB_INTERNAL_H__
+#define __QEMU_FW_CFG_LIB_INTERNAL_H__
+
+/**
+  Returns a boolean indicating if the firmware configuration interface is
+  available for library-internal purposes.
+
+  This function never changes fw_cfg state.
+
+  @retval    TRUE   The interface is available internally.
+  @retval    FALSE  The interface is not available internally.
+**/
+BOOLEAN
+InternalQemuFwCfgIsAvailable (
+  VOID
+  );
+
+#endif
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 5c96d2af2532..804d5b0e42be 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -22,6 +22,8 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 
+#include "QemuFwCfgLibInternal.h"
+
 
 /**
   Reads an 8-bit I/O port fifo into a block of memory.
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c
index f693cff29e01..88d88c0edf69 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c
@@ -17,6 +17,8 @@
 #include <Library/DebugLib.h>
 #include <Library/QemuFwCfgLib.h>
 
+#include "QemuFwCfgLibInternal.h"
+
 STATIC BOOLEAN mQemuFwCfgSupported = FALSE;
 
 
@@ -83,7 +85,6 @@ QemuFwCfgInitialize (
   @retval    FALSE  The interface is not available internally.
 **/
 BOOLEAN
-EFIAPI
 InternalQemuFwCfgIsAvailable (
   VOID
   )
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c
index 88c32ce89a72..56c59ca3f01d 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c
@@ -19,6 +19,7 @@
 #include <Library/DebugLib.h>
 #include <Library/QemuFwCfgLib.h>
 
+#include "QemuFwCfgLibInternal.h"
 
 /**
   Returns a boolean indicating if the firmware configuration interface
@@ -67,7 +68,6 @@ QemuFwCfgIsAvailable (
   @retval    FALSE  The interface is not available internally.
 **/
 BOOLEAN
-EFIAPI
 InternalQemuFwCfgIsAvailable (
   VOID
   )
-- 
2.9.2




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

* [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
  2016-12-02 20:20 ` [PATCH v2 1/6] ArmVirtPkg/QemuFwCfgLib: remove superfluous InternalQemuFwCfgIsAvailable() Laszlo Ersek
  2016-12-02 20:20 ` [PATCH v2 2/6] OvmfPkg/QemuFwCfgLib: move InternalQemuFwCfgIsAvailable() to lib instances Laszlo Ersek
@ 2016-12-02 20:20 ` Laszlo Ersek
  2016-12-05 10:29   ` Leif Lindholm
  2016-12-02 20:20 ` [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions Laszlo Ersek
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-02 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Ard Biesheuvel, Jordan Justen, Leif Lindholm

Move the type and macro definitions related to QEMU's DMA-like fw_cfg
access method to the library class header.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    - move definitions to lib class header rather than to a new
      IndustryStandard include [Jordan]
    - because ArmVirtPkg's library instance already includes the lib class
      header, the code movement must be atomic and straddle both packages
    - restrict patch to code movement solely; FW_CFG_F_DMA and
      FW_CFG_DMA_CTL_WRITE will be added separately

 OvmfPkg/Include/Library/QemuFwCfgLib.h         | 19 +++++++++++++++++++
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 20 --------------------
 2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
index 7c29422fbd72..40a07456c530 100644
--- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
+++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
@@ -23,6 +23,14 @@
 //
 #define QEMU_FW_CFG_FNAME_SIZE 56
 
+//
+// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).
+//
+#define FW_CFG_DMA_CTL_ERROR  BIT0
+#define FW_CFG_DMA_CTL_READ   BIT1
+#define FW_CFG_DMA_CTL_SKIP   BIT2
+#define FW_CFG_DMA_CTL_SELECT BIT3
+
 typedef enum {
   QemuFwCfgItemSignature            = 0x0000,
   QemuFwCfgItemInterfaceVersion     = 0x0001,
@@ -59,6 +67,17 @@ typedef enum {
 
 } FIRMWARE_CONFIG_ITEM;
 
+//
+// Communication structure for the DMA access method. All fields are encoded in
+// big endian.
+//
+#pragma pack (1)
+typedef struct {
+  UINT32 Control;
+  UINT32 Length;
+  UINT64 Address;
+} FW_CFG_DMA_ACCESS;
+#pragma pack ()
 
 /**
   Returns a boolean indicating if the firmware configuration interface
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 2fd8d9050566..6033a2a14c42 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -53,26 +53,6 @@ STATIC READ_BYTES_FUNCTION DmaReadBytes;
 //
 STATIC READ_BYTES_FUNCTION *InternalQemuFwCfgReadBytes = MmioReadBytes;
 
-//
-// Communication structure for DmaReadBytes(). All fields are encoded in big
-// endian.
-//
-#pragma pack (1)
-typedef struct {
-  UINT32 Control;
-  UINT32 Length;
-  UINT64 Address;
-} FW_CFG_DMA_ACCESS;
-#pragma pack ()
-
-//
-// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).
-//
-#define FW_CFG_DMA_CTL_ERROR  BIT0
-#define FW_CFG_DMA_CTL_READ   BIT1
-#define FW_CFG_DMA_CTL_SKIP   BIT2
-#define FW_CFG_DMA_CTL_SELECT BIT3
-
 
 /**
   Returns a boolean indicating if the firmware configuration interface
-- 
2.9.2




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

* [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
                   ` (2 preceding siblings ...)
  2016-12-02 20:20 ` [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class Laszlo Ersek
@ 2016-12-02 20:20 ` Laszlo Ersek
  2016-12-05 10:30   ` Leif Lindholm
  2016-12-02 20:20 ` [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class header Laszlo Ersek
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-02 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Ard Biesheuvel, Jordan Justen, Leif Lindholm

The last patch consists purely of code movement; going forward, we should
use a few more symbolic constants.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    - split these out to a separate patch

 OvmfPkg/Include/Library/QemuFwCfgLib.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
index 40a07456c530..3e017d53a97e 100644
--- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
+++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
@@ -24,12 +24,20 @@
 #define QEMU_FW_CFG_FNAME_SIZE 56
 
 //
+// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap
+// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the
+// DMA interface is available.
+//
+#define FW_CFG_F_DMA BIT1
+
+//
 // Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).
 //
 #define FW_CFG_DMA_CTL_ERROR  BIT0
 #define FW_CFG_DMA_CTL_READ   BIT1
 #define FW_CFG_DMA_CTL_SKIP   BIT2
 #define FW_CFG_DMA_CTL_SELECT BIT3
+#define FW_CFG_DMA_CTL_WRITE  BIT4
 
 typedef enum {
   QemuFwCfgItemSignature            = 0x0000,
-- 
2.9.2




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

* [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class header
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
                   ` (3 preceding siblings ...)
  2016-12-02 20:20 ` [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions Laszlo Ersek
@ 2016-12-02 20:20 ` Laszlo Ersek
  2016-12-05 10:30   ` Leif Lindholm
  2016-12-02 20:20 ` [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg access method Laszlo Ersek
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-02 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm

Put the FW_CFG_F_DMA constant, introduced in the last patch, to use.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    - no need to include another header [Leif]
    - scope is smaller now (only FW_CFG_F_DMA)

 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 6033a2a14c42..1b19893709fc 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -163,7 +163,7 @@ QemuFwCfgInitialize (
 
         QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion);
         Features = QemuFwCfgRead32 ();
-        if ((Features & BIT1) != 0) {
+        if ((Features & FW_CFG_F_DMA) != 0) {
           mFwCfgDmaAddress = FwCfgDmaAddress;
           InternalQemuFwCfgReadBytes = DmaReadBytes;
         }
-- 
2.9.2




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

* [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg access method
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
                   ` (4 preceding siblings ...)
  2016-12-02 20:20 ` [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class header Laszlo Ersek
@ 2016-12-02 20:20 ` Laszlo Ersek
  2016-12-05 15:37 ` [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Ard Biesheuvel
  2016-12-05 18:28 ` Jordan Justen
  7 siblings, 0 replies; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-02 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Jordan Justen

The benefits of the DMA-like access method are (a) speed, (b) write
support in QEMU 2.9+.

(IOPort-based write support was discontinued in QEMU 2.4, and the
DMA-based one is being added to QEMU 2.9. Write support needs no separate
feature detection because writeability is governed on the level of
individual fw_cfg files -- if a file meant to be written by the firmware
exists in the directory, then it is writeable with the DMA method.)

We don't enable this feature for the SEC library instance, because:
- the SEC instance remains without clients (I've checked that it builds
  though),
- in SEC, any possible fw_cfg use is expected to be small and read-only.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
---

Notes:
    v2:
    - no need to include IndustryStandard/QemuFwCfgDma.h any longer (no such
      file)
    - kept Jordan's R-b

 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h | 13 ++++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c         | 72 ++++++++++++++++++++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c      | 25 ++++++-
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c         | 15 ++++
 4 files changed, 124 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h
index 5b162bf98739..6e87c625102e 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h
@@ -30,4 +30,17 @@ InternalQemuFwCfgIsAvailable (
   VOID
   );
 
+
+/**
+  Returns a boolean indicating whether QEMU provides the DMA-like access method
+  for fw_cfg.
+
+  @retval    TRUE   The DMA-like access method is available.
+  @retval    FALSE  The DMA-like access method is unavailable.
+**/
+BOOLEAN
+InternalQemuFwCfgDmaIsAvailable (
+  VOID
+  );
+
 #endif
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 804d5b0e42be..0bbf121de432 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -99,6 +99,70 @@ QemuFwCfgSelectItem (
 
 
 /**
+  Transfer an array of bytes using the DMA interface.
+
+  @param[in]     Size    Size in bytes to transfer.
+  @param[in,out] Buffer  Buffer to read data into or write data from. May be
+                         NULL if Size is zero.
+  @param[in]     Write   TRUE if writing to fw_cfg from Buffer, FALSE if
+                         reading from fw_cfg into Buffer.
+**/
+VOID
+InternalQemuFwCfgDmaBytes (
+  IN     UINT32   Size,
+  IN OUT VOID     *Buffer OPTIONAL,
+  IN     BOOLEAN  Write
+  )
+{
+  volatile FW_CFG_DMA_ACCESS Access;
+  UINT32                     AccessHigh, AccessLow;
+  UINT32                     Status;
+
+  if (Size == 0) {
+    return;
+  }
+
+  Access.Control = SwapBytes32 (
+                    Write ? FW_CFG_DMA_CTL_WRITE : FW_CFG_DMA_CTL_READ
+                    );
+  Access.Length  = SwapBytes32 (Size);
+  Access.Address = SwapBytes64 ((UINTN)Buffer);
+
+  //
+  // Delimit the transfer from (a) modifications to Access, (b) in case of a
+  // write, from writes to Buffer by the caller.
+  //
+  MemoryFence ();
+
+  //
+  // Start the transfer.
+  //
+  AccessHigh = (UINT32)RShiftU64 ((UINTN)&Access, 32);
+  AccessLow  = (UINT32)(UINTN)&Access;
+  IoWrite32 (0x514, SwapBytes32 (AccessHigh));
+  IoWrite32 (0x518, SwapBytes32 (AccessLow));
+
+  //
+  // Don't look at Access.Control before starting the transfer.
+  //
+  MemoryFence ();
+
+  //
+  // Wait for the transfer to complete.
+  //
+  do {
+    Status = SwapBytes32 (Access.Control);
+    ASSERT ((Status & FW_CFG_DMA_CTL_ERROR) == 0);
+  } while (Status != 0);
+
+  //
+  // After a read, the caller will want to use Buffer.
+  //
+  MemoryFence ();
+}
+
+
+/**
   Reads firmware configuration bytes into a buffer
 
   @param[in] Size - Size in bytes to read
@@ -112,6 +176,10 @@ InternalQemuFwCfgReadBytes (
   IN VOID                   *Buffer  OPTIONAL
   )
 {
+  if (InternalQemuFwCfgDmaIsAvailable () && Size <= MAX_UINT32) {
+    InternalQemuFwCfgDmaBytes ((UINT32)Size, Buffer, FALSE);
+    return;
+  }
   IoReadFifo8 (0x511, Size, Buffer);
 }
 
@@ -160,6 +228,10 @@ QemuFwCfgWriteBytes (
   )
 {
   if (InternalQemuFwCfgIsAvailable ()) {
+    if (InternalQemuFwCfgDmaIsAvailable () && Size <= MAX_UINT32) {
+      InternalQemuFwCfgDmaBytes ((UINT32)Size, Buffer, TRUE);
+      return;
+    }
     IoWriteFifo8 (0x511, Size, Buffer);
   }
 }
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c
index 88d88c0edf69..ac05f4c347f3 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c
@@ -20,6 +20,7 @@
 #include "QemuFwCfgLibInternal.h"
 
 STATIC BOOLEAN mQemuFwCfgSupported = FALSE;
+STATIC BOOLEAN mQemuFwCfgDmaSupported;
 
 
 /**
@@ -53,8 +54,10 @@ QemuFwCfgInitialize (
 
   //
   // Enable the access routines while probing to see if it is supported.
+  // For probing we always use the IO Port (IoReadFifo8()) access method.
   //
   mQemuFwCfgSupported = TRUE;
+  mQemuFwCfgDmaSupported = FALSE;
 
   QemuFwCfgSelectItem (QemuFwCfgItemSignature);
   Signature = QemuFwCfgRead32 ();
@@ -70,7 +73,12 @@ QemuFwCfgInitialize (
     return RETURN_SUCCESS;
   }
 
-  DEBUG ((EFI_D_INFO, "QemuFwCfg interface is supported.\n"));
+  if ((Revision & FW_CFG_F_DMA) == 0) {
+    DEBUG ((DEBUG_INFO, "QemuFwCfg interface (IO Port) is supported.\n"));
+  } else {
+    mQemuFwCfgDmaSupported = TRUE;
+    DEBUG ((DEBUG_INFO, "QemuFwCfg interface (DMA) is supported.\n"));
+  }
   return RETURN_SUCCESS;
 }
 
@@ -91,3 +99,18 @@ InternalQemuFwCfgIsAvailable (
 {
   return mQemuFwCfgSupported;
 }
+
+/**
+  Returns a boolean indicating whether QEMU provides the DMA-like access method
+  for fw_cfg.
+
+  @retval    TRUE   The DMA-like access method is available.
+  @retval    FALSE  The DMA-like access method is unavailable.
+**/
+BOOLEAN
+InternalQemuFwCfgDmaIsAvailable (
+  VOID
+  )
+{
+  return mQemuFwCfgDmaSupported;
+}
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c
index 56c59ca3f01d..465ccbe90dad 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c
@@ -79,3 +79,18 @@ InternalQemuFwCfgIsAvailable (
   //
   return TRUE;
 }
+
+/**
+  Returns a boolean indicating whether QEMU provides the DMA-like access method
+  for fw_cfg.
+
+  @retval    TRUE   The DMA-like access method is available.
+  @retval    FALSE  The DMA-like access method is unavailable.
+**/
+BOOLEAN
+InternalQemuFwCfgDmaIsAvailable (
+  VOID
+  )
+{
+  return FALSE;
+}
-- 
2.9.2



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

* Re: [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class
  2016-12-02 20:20 ` [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class Laszlo Ersek
@ 2016-12-05 10:29   ` Leif Lindholm
  0 siblings, 0 replies; 15+ messages in thread
From: Leif Lindholm @ 2016-12-05 10:29 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: edk2-devel-01, Ard Biesheuvel, Jordan Justen

On Fri, Dec 02, 2016 at 09:20:56PM +0100, Laszlo Ersek wrote:
> Move the type and macro definitions related to QEMU's DMA-like fw_cfg
> access method to the library class header.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Ard may be back from holiday, but fwiw:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
> 
> Notes:
>     v2:
>     - move definitions to lib class header rather than to a new
>       IndustryStandard include [Jordan]
>     - because ArmVirtPkg's library instance already includes the lib class
>       header, the code movement must be atomic and straddle both packages
>     - restrict patch to code movement solely; FW_CFG_F_DMA and
>       FW_CFG_DMA_CTL_WRITE will be added separately
> 
>  OvmfPkg/Include/Library/QemuFwCfgLib.h         | 19 +++++++++++++++++++
>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 20 --------------------
>  2 files changed, 19 insertions(+), 20 deletions(-)
> 
> diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
> index 7c29422fbd72..40a07456c530 100644
> --- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
> +++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
> @@ -23,6 +23,14 @@
>  //
>  #define QEMU_FW_CFG_FNAME_SIZE 56
>  
> +//
> +// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).
> +//
> +#define FW_CFG_DMA_CTL_ERROR  BIT0
> +#define FW_CFG_DMA_CTL_READ   BIT1
> +#define FW_CFG_DMA_CTL_SKIP   BIT2
> +#define FW_CFG_DMA_CTL_SELECT BIT3
> +
>  typedef enum {
>    QemuFwCfgItemSignature            = 0x0000,
>    QemuFwCfgItemInterfaceVersion     = 0x0001,
> @@ -59,6 +67,17 @@ typedef enum {
>  
>  } FIRMWARE_CONFIG_ITEM;
>  
> +//
> +// Communication structure for the DMA access method. All fields are encoded in
> +// big endian.
> +//
> +#pragma pack (1)
> +typedef struct {
> +  UINT32 Control;
> +  UINT32 Length;
> +  UINT64 Address;
> +} FW_CFG_DMA_ACCESS;
> +#pragma pack ()
>  
>  /**
>    Returns a boolean indicating if the firmware configuration interface
> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> index 2fd8d9050566..6033a2a14c42 100644
> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> @@ -53,26 +53,6 @@ STATIC READ_BYTES_FUNCTION DmaReadBytes;
>  //
>  STATIC READ_BYTES_FUNCTION *InternalQemuFwCfgReadBytes = MmioReadBytes;
>  
> -//
> -// Communication structure for DmaReadBytes(). All fields are encoded in big
> -// endian.
> -//
> -#pragma pack (1)
> -typedef struct {
> -  UINT32 Control;
> -  UINT32 Length;
> -  UINT64 Address;
> -} FW_CFG_DMA_ACCESS;
> -#pragma pack ()
> -
> -//
> -// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).
> -//
> -#define FW_CFG_DMA_CTL_ERROR  BIT0
> -#define FW_CFG_DMA_CTL_READ   BIT1
> -#define FW_CFG_DMA_CTL_SKIP   BIT2
> -#define FW_CFG_DMA_CTL_SELECT BIT3
> -
>  
>  /**
>    Returns a boolean indicating if the firmware configuration interface
> -- 
> 2.9.2
> 
> 


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

* Re: [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions
  2016-12-02 20:20 ` [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions Laszlo Ersek
@ 2016-12-05 10:30   ` Leif Lindholm
  0 siblings, 0 replies; 15+ messages in thread
From: Leif Lindholm @ 2016-12-05 10:30 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: edk2-devel-01, Ard Biesheuvel, Jordan Justen

On Fri, Dec 02, 2016 at 09:20:57PM +0100, Laszlo Ersek wrote:
> The last patch consists purely of code movement; going forward, we should
> use a few more symbolic constants.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
> 
> Notes:
>     v2:
>     - split these out to a separate patch
> 
>  OvmfPkg/Include/Library/QemuFwCfgLib.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
> index 40a07456c530..3e017d53a97e 100644
> --- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
> +++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
> @@ -24,12 +24,20 @@
>  #define QEMU_FW_CFG_FNAME_SIZE 56
>  
>  //
> +// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap
> +// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the
> +// DMA interface is available.
> +//
> +#define FW_CFG_F_DMA BIT1
> +
> +//
>  // Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).
>  //
>  #define FW_CFG_DMA_CTL_ERROR  BIT0
>  #define FW_CFG_DMA_CTL_READ   BIT1
>  #define FW_CFG_DMA_CTL_SKIP   BIT2
>  #define FW_CFG_DMA_CTL_SELECT BIT3
> +#define FW_CFG_DMA_CTL_WRITE  BIT4
>  
>  typedef enum {
>    QemuFwCfgItemSignature            = 0x0000,
> -- 
> 2.9.2
> 
> 


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

* Re: [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class header
  2016-12-02 20:20 ` [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class header Laszlo Ersek
@ 2016-12-05 10:30   ` Leif Lindholm
  2016-12-05 10:51     ` Laszlo Ersek
  0 siblings, 1 reply; 15+ messages in thread
From: Leif Lindholm @ 2016-12-05 10:30 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: edk2-devel-01, Ard Biesheuvel

On Fri, Dec 02, 2016 at 09:20:58PM +0100, Laszlo Ersek wrote:
> Put the FW_CFG_F_DMA constant, introduced in the last patch, to use.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
> 
> Notes:
>     v2:
>     - no need to include another header [Leif]
>     - scope is smaller now (only FW_CFG_F_DMA)
> 
>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> index 6033a2a14c42..1b19893709fc 100644
> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> @@ -163,7 +163,7 @@ QemuFwCfgInitialize (
>  
>          QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion);
>          Features = QemuFwCfgRead32 ();
> -        if ((Features & BIT1) != 0) {
> +        if ((Features & FW_CFG_F_DMA) != 0) {
>            mFwCfgDmaAddress = FwCfgDmaAddress;
>            InternalQemuFwCfgReadBytes = DmaReadBytes;
>          }
> -- 
> 2.9.2
> 
> 


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

* Re: [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class header
  2016-12-05 10:30   ` Leif Lindholm
@ 2016-12-05 10:51     ` Laszlo Ersek
  0 siblings, 0 replies; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-05 10:51 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel-01, Ard Biesheuvel

On 12/05/16 11:30, Leif Lindholm wrote:
> On Fri, Dec 02, 2016 at 09:20:58PM +0100, Laszlo Ersek wrote:
>> Put the FW_CFG_F_DMA constant, introduced in the last patch, to use.
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Leif Lindholm <leif.lindholm@linaro.org>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> 
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

Thanks Leif!
Laszlo

>> ---
>>
>> Notes:
>>     v2:
>>     - no need to include another header [Leif]
>>     - scope is smaller now (only FW_CFG_F_DMA)
>>
>>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> index 6033a2a14c42..1b19893709fc 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> @@ -163,7 +163,7 @@ QemuFwCfgInitialize (
>>  
>>          QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion);
>>          Features = QemuFwCfgRead32 ();
>> -        if ((Features & BIT1) != 0) {
>> +        if ((Features & FW_CFG_F_DMA) != 0) {
>>            mFwCfgDmaAddress = FwCfgDmaAddress;
>>            InternalQemuFwCfgReadBytes = DmaReadBytes;
>>          }
>> -- 
>> 2.9.2
>>
>>



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

* Re: [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
                   ` (5 preceding siblings ...)
  2016-12-02 20:20 ` [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg access method Laszlo Ersek
@ 2016-12-05 15:37 ` Ard Biesheuvel
  2016-12-05 15:55   ` Laszlo Ersek
  2016-12-05 18:28 ` Jordan Justen
  7 siblings, 1 reply; 15+ messages in thread
From: Ard Biesheuvel @ 2016-12-05 15:37 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: edk2-devel-01, Jordan Justen, Leif Lindholm

On 2 December 2016 at 20:20, Laszlo Ersek <lersek@redhat.com> wrote:
> Version 2 of
> <https://lists.01.org/pipermail/edk2-devel/2016-December/005413.html>.
>
> The following patches
>
>   [PATCH 3/5] OvmfPkg/IndustryStandard: add QemuFwCfgDma.h
>   [PATCH 4/5] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to
>               OvmfPkg/IndustryStandard
>
> have been replaced with
>
>   [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related
>                  defs to lib class
>   [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more
>                  definitions
>   [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated
>                  lib class header
>
> The last patch
>
>   [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg
>                  access method
>
> needed a trivial update too; for that I preserved Jordan's R-b. Please
> see the individual patches for v1->v2 details.
>
> Repo:   https://github.com/lersek/edk2/
> Branch: ovmf_fwcfg_dma_v2
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
>

Where needed:

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


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

* Re: [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface
  2016-12-05 15:37 ` [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Ard Biesheuvel
@ 2016-12-05 15:55   ` Laszlo Ersek
  0 siblings, 0 replies; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-05 15:55 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel-01, Jordan Justen, Leif Lindholm

On 12/05/16 16:37, Ard Biesheuvel wrote:
> On 2 December 2016 at 20:20, Laszlo Ersek <lersek@redhat.com> wrote:
>> Version 2 of
>> <https://lists.01.org/pipermail/edk2-devel/2016-December/005413.html>.
>>
>> The following patches
>>
>>   [PATCH 3/5] OvmfPkg/IndustryStandard: add QemuFwCfgDma.h
>>   [PATCH 4/5] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to
>>               OvmfPkg/IndustryStandard
>>
>> have been replaced with
>>
>>   [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related
>>                  defs to lib class
>>   [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more
>>                  definitions
>>   [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated
>>                  lib class header
>>
>> The last patch
>>
>>   [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg
>>                  access method
>>
>> needed a trivial update too; for that I preserved Jordan's R-b. Please
>> see the individual patches for v1->v2 details.
>>
>> Repo:   https://github.com/lersek/edk2/
>> Branch: ovmf_fwcfg_dma_v2
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Leif Lindholm <leif.lindholm@linaro.org>
>>
> 
> Where needed:
> 
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Thanks Ard! And welcome back.
Laszlo



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

* Re: [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface
  2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
                   ` (6 preceding siblings ...)
  2016-12-05 15:37 ` [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Ard Biesheuvel
@ 2016-12-05 18:28 ` Jordan Justen
  2016-12-05 18:55   ` Laszlo Ersek
  7 siblings, 1 reply; 15+ messages in thread
From: Jordan Justen @ 2016-12-05 18:28 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm

Series Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

On 2016-12-02 12:20:53, Laszlo Ersek wrote:
> Version 2 of
> <https://lists.01.org/pipermail/edk2-devel/2016-December/005413.html>.
> 
> The following patches
> 
>   [PATCH 3/5] OvmfPkg/IndustryStandard: add QemuFwCfgDma.h
>   [PATCH 4/5] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to
>               OvmfPkg/IndustryStandard
> 
> have been replaced with
> 
>   [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related
>                  defs to lib class
>   [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more
>                  definitions
>   [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated
>                  lib class header
> 
> The last patch
> 
>   [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg
>                  access method
> 
> needed a trivial update too; for that I preserved Jordan's R-b. Please
> see the individual patches for v1->v2 details.
> 
> Repo:   https://github.com/lersek/edk2/
> Branch: ovmf_fwcfg_dma_v2
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> 
> Thanks
> Laszlo
> 
> Laszlo Ersek (6):
>   ArmVirtPkg/QemuFwCfgLib: remove superfluous
>     InternalQemuFwCfgIsAvailable()
>   OvmfPkg/QemuFwCfgLib: move InternalQemuFwCfgIsAvailable() to lib
>     instances
>   ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class
>   OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions
>   ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class
>     header
>   OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg access method
> 
>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c      | 53 ++------------
>  OvmfPkg/Include/Library/QemuFwCfgLib.h              | 43 +++++++-----
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c         | 74 ++++++++++++++++++++
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf       |  1 +
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h | 46 ++++++++++++
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c      | 28 +++++++-
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c         | 17 ++++-
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf    |  1 +
>  8 files changed, 198 insertions(+), 65 deletions(-)
>  create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h
> 
> -- 
> 2.9.2
> 


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

* Re: [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface
  2016-12-05 18:28 ` Jordan Justen
@ 2016-12-05 18:55   ` Laszlo Ersek
  0 siblings, 0 replies; 15+ messages in thread
From: Laszlo Ersek @ 2016-12-05 18:55 UTC (permalink / raw)
  To: Jordan Justen, edk2-devel-01; +Cc: Leif Lindholm, Ard Biesheuvel

On 12/05/16 19:28, Jordan Justen wrote:
> Series Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

Thank you. Series pushed as 209b8f3c2710..2c8dcbc65ab6.

Cheers!
Laszlo

> On 2016-12-02 12:20:53, Laszlo Ersek wrote:
>> Version 2 of
>> <https://lists.01.org/pipermail/edk2-devel/2016-December/005413.html>.
>>
>> The following patches
>>
>>   [PATCH 3/5] OvmfPkg/IndustryStandard: add QemuFwCfgDma.h
>>   [PATCH 4/5] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to
>>               OvmfPkg/IndustryStandard
>>
>> have been replaced with
>>
>>   [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related
>>                  defs to lib class
>>   [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more
>>                  definitions
>>   [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated
>>                  lib class header
>>
>> The last patch
>>
>>   [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg
>>                  access method
>>
>> needed a trivial update too; for that I preserved Jordan's R-b. Please
>> see the individual patches for v1->v2 details.
>>
>> Repo:   https://github.com/lersek/edk2/
>> Branch: ovmf_fwcfg_dma_v2
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Leif Lindholm <leif.lindholm@linaro.org>
>>
>> Thanks
>> Laszlo
>>
>> Laszlo Ersek (6):
>>   ArmVirtPkg/QemuFwCfgLib: remove superfluous
>>     InternalQemuFwCfgIsAvailable()
>>   OvmfPkg/QemuFwCfgLib: move InternalQemuFwCfgIsAvailable() to lib
>>     instances
>>   ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class
>>   OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions
>>   ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class
>>     header
>>   OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg access method
>>
>>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c      | 53 ++------------
>>  OvmfPkg/Include/Library/QemuFwCfgLib.h              | 43 +++++++-----
>>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c         | 74 ++++++++++++++++++++
>>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf       |  1 +
>>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h | 46 ++++++++++++
>>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiDxe.c      | 28 +++++++-
>>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c         | 17 ++++-
>>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf    |  1 +
>>  8 files changed, 198 insertions(+), 65 deletions(-)
>>  create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibInternal.h
>>
>> -- 
>> 2.9.2
>>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 



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

end of thread, other threads:[~2016-12-05 18:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-02 20:20 [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Laszlo Ersek
2016-12-02 20:20 ` [PATCH v2 1/6] ArmVirtPkg/QemuFwCfgLib: remove superfluous InternalQemuFwCfgIsAvailable() Laszlo Ersek
2016-12-02 20:20 ` [PATCH v2 2/6] OvmfPkg/QemuFwCfgLib: move InternalQemuFwCfgIsAvailable() to lib instances Laszlo Ersek
2016-12-02 20:20 ` [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class Laszlo Ersek
2016-12-05 10:29   ` Leif Lindholm
2016-12-02 20:20 ` [PATCH v2 4/6] OvmfPkg/QemuFwCfgLib: extend lib class header with more definitions Laszlo Ersek
2016-12-05 10:30   ` Leif Lindholm
2016-12-02 20:20 ` [PATCH v2 5/6] ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class header Laszlo Ersek
2016-12-05 10:30   ` Leif Lindholm
2016-12-05 10:51     ` Laszlo Ersek
2016-12-02 20:20 ` [PATCH v2 6/6] OvmfPkg/QemuFwCfgLib: support QEMU's DMA-like fw_cfg access method Laszlo Ersek
2016-12-05 15:37 ` [PATCH v2 0/6] OvmfPkg/QemuFwCfgLib: support the DMA-like interface Ard Biesheuvel
2016-12-05 15:55   ` Laszlo Ersek
2016-12-05 18:28 ` Jordan Justen
2016-12-05 18:55   ` Laszlo Ersek

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