[edk2-devel] [PATCH v5 32/35] OvmfPkg: Introduce PcdXenGrantFrames

Anthony PERARD posted 35 patches 5 years, 3 months ago
[edk2-devel] [PATCH v5 32/35] OvmfPkg: Introduce PcdXenGrantFrames
Posted by Anthony PERARD 5 years, 3 months ago
Introduce PcdXenGrantFrames to replace a define in XenBusDxe and allow
the same value to be used in a different module.

The reason for the number of page to be 4 doesn't exist anymore, so
simply remove the comment.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v5:
    - add missing PcdLib to [LibraryClasses]
    
    v4:
    - new patch

 OvmfPkg/OvmfPkg.dec             | 3 +++
 OvmfPkg/XenBusDxe/XenBusDxe.inf | 3 +++
 OvmfPkg/XenBusDxe/XenBusDxe.h   | 1 +
 OvmfPkg/XenBusDxe/GrantTable.c  | 3 +--
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 04d5e29272..d5fee805ef 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -225,6 +225,9 @@ [PcdsFixedAtBuild]
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0x32
 
+  ## Number of page frames to use for storing grant table entries.
+  gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames|4|UINT32|0x33
+
 [PcdsDynamic, PcdsDynamicEx]
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf
index 86e0fb8224..536b49fa8c 100644
--- a/OvmfPkg/XenBusDxe/XenBusDxe.inf
+++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf
@@ -51,6 +51,7 @@ [LibraryClasses]
   XenHypercallLib
   SynchronizationLib
   PrintLib
+  PcdLib
 
 [Protocols]
   gEfiDriverBindingProtocolGuid
@@ -59,3 +60,5 @@ [Protocols]
   gXenBusProtocolGuid
   gXenIoProtocolGuid
 
+[FixedPcd]
+  gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.h b/OvmfPkg/XenBusDxe/XenBusDxe.h
index 8510361bca..b1dcc3549c 100644
--- a/OvmfPkg/XenBusDxe/XenBusDxe.h
+++ b/OvmfPkg/XenBusDxe/XenBusDxe.h
@@ -22,6 +22,7 @@
 #include <Library/UefiLib.h>
 #include <Library/DevicePathLib.h>
 #include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
 
 
 //
diff --git a/OvmfPkg/XenBusDxe/GrantTable.c b/OvmfPkg/XenBusDxe/GrantTable.c
index 6575e9b88c..1130404cd1 100644
--- a/OvmfPkg/XenBusDxe/GrantTable.c
+++ b/OvmfPkg/XenBusDxe/GrantTable.c
@@ -22,8 +22,7 @@
 
 #define NR_RESERVED_ENTRIES 8
 
-/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
-#define NR_GRANT_FRAMES 4
+#define NR_GRANT_FRAMES (FixedPcdGet32 (PcdXenGrantFrames))
 #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * EFI_PAGE_SIZE / sizeof(grant_entry_v1_t))
 
 STATIC grant_entry_v1_t *GrantTable = NULL;
-- 
Anthony PERARD


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#45544): https://edk2.groups.io/g/devel/message/45544
Mute This Topic: https://groups.io/mt/32851690/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [Xen-devel] [edk2-devel] [PATCH v5 32/35] OvmfPkg: Introduce PcdXenGrantFrames
Posted by Laszlo Ersek 5 years, 3 months ago
On 08/13/19 13:31, Anthony PERARD wrote:
> Introduce PcdXenGrantFrames to replace a define in XenBusDxe and allow
> the same value to be used in a different module.
> 
> The reason for the number of page to be 4 doesn't exist anymore, so
> simply remove the comment.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     v5:
>     - add missing PcdLib to [LibraryClasses]

Yes, that's for

http://mid.mail-archive.com/365f2b95-b6c9-03cf-5346-5e1192bfa437@redhat.com
https://edk2.groups.io/g/devel/message/44621

Thanks for it,
Laszlo

>     v4:
>     - new patch
> 
>  OvmfPkg/OvmfPkg.dec             | 3 +++
>  OvmfPkg/XenBusDxe/XenBusDxe.inf | 3 +++
>  OvmfPkg/XenBusDxe/XenBusDxe.h   | 1 +
>  OvmfPkg/XenBusDxe/GrantTable.c  | 3 +--
>  4 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
> index 04d5e29272..d5fee805ef 100644
> --- a/OvmfPkg/OvmfPkg.dec
> +++ b/OvmfPkg/OvmfPkg.dec
> @@ -225,6 +225,9 @@ [PcdsFixedAtBuild]
>    gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17
>    gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0x32
>  
> +  ## Number of page frames to use for storing grant table entries.
> +  gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames|4|UINT32|0x33
> +
>  [PcdsDynamic, PcdsDynamicEx]
>    gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2
>    gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10
> diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf
> index 86e0fb8224..536b49fa8c 100644
> --- a/OvmfPkg/XenBusDxe/XenBusDxe.inf
> +++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf
> @@ -51,6 +51,7 @@ [LibraryClasses]
>    XenHypercallLib
>    SynchronizationLib
>    PrintLib
> +  PcdLib
>  
>  [Protocols]
>    gEfiDriverBindingProtocolGuid
> @@ -59,3 +60,5 @@ [Protocols]
>    gXenBusProtocolGuid
>    gXenIoProtocolGuid
>  
> +[FixedPcd]
> +  gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames
> diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.h b/OvmfPkg/XenBusDxe/XenBusDxe.h
> index 8510361bca..b1dcc3549c 100644
> --- a/OvmfPkg/XenBusDxe/XenBusDxe.h
> +++ b/OvmfPkg/XenBusDxe/XenBusDxe.h
> @@ -22,6 +22,7 @@
>  #include <Library/UefiLib.h>
>  #include <Library/DevicePathLib.h>
>  #include <Library/DebugLib.h>
> +#include <Library/PcdLib.h>
>  
>  
>  //
> diff --git a/OvmfPkg/XenBusDxe/GrantTable.c b/OvmfPkg/XenBusDxe/GrantTable.c
> index 6575e9b88c..1130404cd1 100644
> --- a/OvmfPkg/XenBusDxe/GrantTable.c
> +++ b/OvmfPkg/XenBusDxe/GrantTable.c
> @@ -22,8 +22,7 @@
>  
>  #define NR_RESERVED_ENTRIES 8
>  
> -/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
> -#define NR_GRANT_FRAMES 4
> +#define NR_GRANT_FRAMES (FixedPcdGet32 (PcdXenGrantFrames))
>  #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * EFI_PAGE_SIZE / sizeof(grant_entry_v1_t))
>  
>  STATIC grant_entry_v1_t *GrantTable = NULL;
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [edk2-devel] [PATCH v5 32/35] OvmfPkg: Introduce PcdXenGrantFrames
Posted by Laszlo Ersek 5 years, 3 months ago
On 08/15/19 11:40, Laszlo Ersek wrote:
> On 08/13/19 13:31, Anthony PERARD wrote:
>> Introduce PcdXenGrantFrames to replace a define in XenBusDxe and allow
>> the same value to be used in a different module.
>>
>> The reason for the number of page to be 4 doesn't exist anymore, so
>> simply remove the comment.
>>
>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>
>> Notes:
>>     v5:
>>     - add missing PcdLib to [LibraryClasses]
> 
> Yes, that's for
> 
> http://mid.mail-archive.com/365f2b95-b6c9-03cf-5346-5e1192bfa437@redhat.com
> https://edk2.groups.io/g/devel/message/44621
> 
> Thanks for it,
> Laszlo
> 
>>     v4:
>>     - new patch

Also thanks for adding the v4 note retro-actively.

Thanks
Laszlo

>>  OvmfPkg/OvmfPkg.dec             | 3 +++
>>  OvmfPkg/XenBusDxe/XenBusDxe.inf | 3 +++
>>  OvmfPkg/XenBusDxe/XenBusDxe.h   | 1 +
>>  OvmfPkg/XenBusDxe/GrantTable.c  | 3 +--
>>  4 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
>> index 04d5e29272..d5fee805ef 100644
>> --- a/OvmfPkg/OvmfPkg.dec
>> +++ b/OvmfPkg/OvmfPkg.dec
>> @@ -225,6 +225,9 @@ [PcdsFixedAtBuild]
>>    gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17
>>    gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0x32
>>  
>> +  ## Number of page frames to use for storing grant table entries.
>> +  gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames|4|UINT32|0x33
>> +
>>  [PcdsDynamic, PcdsDynamicEx]
>>    gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2
>>    gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10
>> diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf
>> index 86e0fb8224..536b49fa8c 100644
>> --- a/OvmfPkg/XenBusDxe/XenBusDxe.inf
>> +++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf
>> @@ -51,6 +51,7 @@ [LibraryClasses]
>>    XenHypercallLib
>>    SynchronizationLib
>>    PrintLib
>> +  PcdLib
>>  
>>  [Protocols]
>>    gEfiDriverBindingProtocolGuid
>> @@ -59,3 +60,5 @@ [Protocols]
>>    gXenBusProtocolGuid
>>    gXenIoProtocolGuid
>>  
>> +[FixedPcd]
>> +  gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames
>> diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.h b/OvmfPkg/XenBusDxe/XenBusDxe.h
>> index 8510361bca..b1dcc3549c 100644
>> --- a/OvmfPkg/XenBusDxe/XenBusDxe.h
>> +++ b/OvmfPkg/XenBusDxe/XenBusDxe.h
>> @@ -22,6 +22,7 @@
>>  #include <Library/UefiLib.h>
>>  #include <Library/DevicePathLib.h>
>>  #include <Library/DebugLib.h>
>> +#include <Library/PcdLib.h>
>>  
>>  
>>  //
>> diff --git a/OvmfPkg/XenBusDxe/GrantTable.c b/OvmfPkg/XenBusDxe/GrantTable.c
>> index 6575e9b88c..1130404cd1 100644
>> --- a/OvmfPkg/XenBusDxe/GrantTable.c
>> +++ b/OvmfPkg/XenBusDxe/GrantTable.c
>> @@ -22,8 +22,7 @@
>>  
>>  #define NR_RESERVED_ENTRIES 8
>>  
>> -/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
>> -#define NR_GRANT_FRAMES 4
>> +#define NR_GRANT_FRAMES (FixedPcdGet32 (PcdXenGrantFrames))
>>  #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * EFI_PAGE_SIZE / sizeof(grant_entry_v1_t))
>>  
>>  STATIC grant_entry_v1_t *GrantTable = NULL;
>>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#45714): https://edk2.groups.io/g/devel/message/45714
Mute This Topic: https://groups.io/mt/32851690/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-