Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 2/6] EdkRepo: Add new sections to edkrepo.cfg

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Friday, April 17, 2020 10:18 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH v2 2/6] EdkRepo: Add new sections to 
edkrepo.cfg

Add manifest-repos and edk2-staging sections to the edkrepo.cfg to enable 
support of multiple manifest repositories.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo_installer/Vendor/edkrepo.cfg | 8 
 1 file changed, 8 insertions(+)

diff --git a/edkrepo_installer/Vendor/edkrepo.cfg 
b/edkrepo_installer/Vendor/edkrepo.cfg
index 7dcaf20..97ebdd2 100644
--- a/edkrepo_installer/Vendor/edkrepo.cfg
+++ b/edkrepo_installer/Vendor/edkrepo.cfg
@@ -1,3 +1,11 @@
+[manifest-repos]
+edk2-staging =
+
+[edk2-staging]
+URL = https://github.com/tianocore/edk2-staging.git
+Branch = EdkRepo-Manifest
+LocalPath = edk2-staging-manifest-master
+
 [manifest-repo]
 URL = https://github.com/tianocore/edk2-staging.git
 Branch = EdkRepo-Manifest
--
2.16.2.windows.1


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

View/Reply Online (#57550): https://edk2.groups.io/g/devel/message/57550
Mute This Topic: https://groups.io/mt/73088006/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Friday, April 17, 2020 10:18 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH v2 5/6] EdkRepo: Move 
edkrepo_global_data directory to BaseConfig

Move the edkrepo_global_data_directory from the GlobalConfig class to the base 
config class.

Updated the assignments of self.filename in both the GlobalConfig and the 
GlobalUserConfig classes as well as the initializaion of the BaseConfig class 
to use get_edkrepo_global_data_directory()

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 1afa221..4ae06f6 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -77,10 +77,11 @@ class BaseConfig():
 for the class.  Property generation and verification is based off of a 
list of CfgProp classes.
 """
 prop_list = []
-def __init__(self, filename, read_only=True):
+def __init__(self, filename, global_data_dir, read_only=True):
 # Do basic initialization of private variables
 self.read_only = read_only
 self.filename = filename
+self.global_data_dir = global_data_dir
 self.cfg = configparser.ConfigParser(allow_no_value=True, 
delimiters='=')
 if os.path.isfile(self.filename):
 self.cfg.read(self.filename) @@ -132,8 +133,7 @@ class 
GlobalConfig(BaseConfig):
 edkrepo installer.
 """
 def __init__(self):
-self.edkrepo_global_data_directory = 
get_edkrepo_global_data_directory()
-self.filename = os.path.join(self.edkrepo_global_data_directory, 
"edkrepo.cfg")
+self.filename = 
+ os.path.join(get_edkrepo_global_data_directory(), "edkrepo.cfg")
 self.prop_list = [
 CfgProp('manifest-repo', 'URL', 'manifest_repo_url', None, 
True),
 CfgProp('manifest-repo', 'Branch', 'manifest_repo_branch', 
None, True), @@ -148,7 +148,7 @@ class GlobalConfig(BaseConfig):
 CfgProp('preferred-entry-point', 'entry-point', 
'pref_entry_point', None, True)]
 if not os.path.isfile(self.filename):
 raise 
EdkrepoGlobalConfigNotFoundException(humble.GLOBAL_CFG_NOT_FOUND.format(self.filename))
-super().__init__(self.filename, True)
+super().__init__(self.filename, 
+ get_edkrepo_global_data_directory(), True)
 
 @property
 def preferred_entry(self):
@@ -165,7 +165,7 @@ class GlobalConfig(BaseConfig):
 @property
 def manifest_repo_abs_local_path(self):
 """Provides an absolute path to the manifest repo based on 
configuration file values."""
-return os.path.join(self.edkrepo_global_data_directory, 
self.manifest_repo_local_path)
+return os.path.join(self.global_data_dir, 
+ self.manifest_repo_local_path)
 
 @property
 def sparsecheckout_data(self):
@@ -192,7 +192,7 @@ class GlobalUserConfig(BaseConfig):
 CfgProp('scm', 'mirror_geo', 'geo', 'none', False),
 CfgProp('send-review', 'max-patch-set', 'max_patch_set', '10', 
False)
 ]
-super().__init__(self.filename, False)
+super().__init__(self.filename, 
+ get_edkrepo_global_data_directory(), False)
 
 @property
 def max_patch_set_int(self):
--
2.16.2.windows.1


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

View/Reply Online (#57551): https://edk2.groups.io/g/devel/message/57551
Mute This Topic: https://groups.io/mt/73088011/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 6/6] EdkRepo: Add 'get' functions for Manifest Repo data

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Friday, April 17, 2020 10:18 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH v2 6/6] EdkRepo: Add 'get' functions for 
Manifest Repo data

Added functions to get the URL, LocalPath, Branch and the absolute path for 
individual manifest repositories to the BaseConfig class.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 37 +
 1 file changed, 37 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 4ae06f6..90f393c 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -127,6 +127,43 @@ class BaseConfig():
 """
 return [x for x in self.prop_list if manifest_repo in x.name]
 
+def get_manifest_repo_url(self, manifest_repo):
+""" 
+Returns the URL value for a given manifest repo based on config
+file contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'URL' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def get_manifest_repo_branch(self, manifest_repo):
+"""
+Returns the Branch value for a given manifest repo based on config file
+contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'Branch' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def get_manifest_repo_local_path(self, manifest_repo):
+"""
+Returns the Local path value for a given manifest repo based on config
+file contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'LocalPath' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def manifest_repo_abs_path(self, manifest_repo):
+"""
+Returns the absolute path of a single manifest repo based on config
+file contents and the global_data_dir location.
+"""
+return os.path.join(self.global_data_dir, 
+ self.get_manifest_repo_local_path(manifest_repo))
+
 class GlobalConfig(BaseConfig):
 """
 Class access structure for the edkrepo.cfg file.  This file is read only 
and maintained by the
--
2.16.2.windows.1


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

View/Reply Online (#57549): https://edk2.groups.io/g/devel/message/57549
Mute This Topic: https://groups.io/mt/73088008/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 4/6] EdkRepo: Add manifest_repo_props()

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Friday, April 17, 2020 10:18 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH v2 4/6] EdkRepo: Add 
manifest_repo_props()

Add the manifest_repo_props() function to the BaseConfig class which returns a 
list of all CfgProp objects for a given manifest repository.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6f89589..1afa221 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -118,6 +118,13 @@ class BaseConfig():
 """Returns a list of available manifest repos"""
 if self.cfg.has_section('manifest-repos'):
 return self.cfg.options('manifest-repos')
+
+def manifest_repo_props(self, manifest_repo):
+"""
+Returns a list of cfg_prop objects that pertain to a given manifest
+repo
+"""
+return [x for x in self.prop_list if manifest_repo in x.name]
 
 class GlobalConfig(BaseConfig):
 """
--
2.16.2.windows.1


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

View/Reply Online (#57548): https://edk2.groups.io/g/devel/message/57548
Mute This Topic: https://groups.io/mt/73088010/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Friday, April 17, 2020 10:18 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH v2 3/6] EdkRepo: Add the 
manifest_repo_list property to BaseConfig

Add the manifest_repo_list property to the BaseConfig class to return a list of 
manfiest repo sections in the config file.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6c14f1b..6f89589 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -113,6 +113,12 @@ class BaseConfig():
 with open(self.filename, 'w') as cfg_stream:
 self.cfg.write(cfg_stream)
 
+@property
+def manifest_repo_list(self):
+"""Returns a list of available manifest repos"""
+if self.cfg.has_section('manifest-repos'):
+return self.cfg.options('manifest-repos')
+
 class GlobalConfig(BaseConfig):
 """
 Class access structure for the edkrepo.cfg file.  This file is read only 
and maintained by the
--
2.16.2.windows.1


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

View/Reply Online (#57547): https://edk2.groups.io/g/devel/message/57547
Mute This Topic: https://groups.io/mt/73088007/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 02/13] OvmfPkg: support powering off bhyve guests

2020-04-17 Thread Rebecca Cran

On 4/17/20 2:55 AM, Laszlo Ersek wrote:


However, this library has hugely bit-rotted, and it needs some serious
scrubbing before we can do that. Let me look into a patch series for
that. I'll continue to review of this series after that. I hope that
works for you.


Yes, that works - especially since this patch is independent.


--

Rebecca Cran



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

View/Reply Online (#57546): https://edk2.groups.io/g/devel/message/57546
Mute This Topic: https://groups.io/mt/73045196/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v1 1/1] .python/SpellCheck: Increase SpellCheck plugin max failures

2020-04-17 Thread Sean via groups.io
Reviewed-by: Sean Brogan 

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

View/Reply Online (#57545): https://edk2.groups.io/g/devel/message/57545
Mute This Topic: https://groups.io/mt/72907803/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input with separately reported modifiers

2020-04-17 Thread Vitaly Cheptsov via groups.io
Zhichao,

This is correct. I did not notice the message previously, but otherwise 
everything outlined here is accurate. Let me know if further input can be 
performed from my side for this to land.

Best regards,
Vitaly

> 2 апр. 2020 г., в 11:28, Gao, Zhichao  написал(а):
> 
> Summarize the issue, if anything incorrect, please help to correct it. Thanks.
>
> Background:
> Uefi spec ambiguous description:
> > When interpreting the data from this function, it should be noted that if a 
> > class
> > of printable characters that are normally adjusted by shift modifiers (e.g. 
> > Shift
> > Key + "f" key) would be presented solely as a KeyData.Key.UnicodeChar 
> > without the
> > associated shift state. So in the previous example of a Shift Key + "f" key 
> > being
> > pressed, the only pertinent data returned would be KeyData.Key.UnicodeChar 
> > with
> > the value of "F". This of course would not typically be the case for 
> > non-printable
> > characters such as the pressing of the Right Shift Key + F10 key since the
> > corresponding returned data would be reflected both in the
> > KeyData.KeyState.KeyShiftState and KeyData.Key.ScanCode values.
>
> Some firmware vendor see the “if” as an option to implement the keyboard 
> driver and they choose to implement in the other way.
> Ideal: shift + UnicodeKey/UnScancodeKey == report as ==> “shifted” 
> UnicodeKey/UnScancodeKey
> Ctrl + UnicodeKey == report as ==> UnicodeKey – ‘A’/’a’ + 1
> Other way: shift + UnicodeKey/UnScancodeKey == report as ==> shift state + 
> “shifted” UnicodeKey/UnScancodeKey
> Ctrl + UnicodeKey == report as ==> ctrl state + UnicodeKey – 
> ‘A’/’a’ + 1
> I.e. do not remove the shift state.
> That would cause the shell edit/Hexedit missing handling the “shifted” key 
> when run shell in such firmware.
>
> Vitaly’s solution add the support the handle “other implementation”.
>
> If we take Vitaly’s solution, we should fixed all the applications in edk2 
> not only in shell edit/Hexeidt function.
> And when we catch another request same with this issue, we would follow the 
> same progress.
>
> Thanks,
> Zhichao
>
> From: devel@edk2.groups.io  
> [mailto:devel@edk2.groups.io ] On Behalf Of Gao, 
> Zhichao
> Sent: Thursday, April 2, 2020 2:57 PM
> To: devel@edk2.groups.io ; 
> vit9...@protonmail.com ; Rothman, Michael A 
> mailto:michael.a.roth...@intel.com>>
> Cc: Andrew Fish mailto:af...@apple.com>>; Laszlo Ersek 
> mailto:ler...@redhat.com>>; Marvin Häuser 
> mailto:mhaeu...@outlook.de>>; Kinney, Michael D 
> mailto:michael.d.kin...@intel.com>>; Ni, Ray 
> mailto:ray...@intel.com>>
> Subject: Re: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input with 
> separately reported modifiers
>
> Hi Micheal Rothman,
>
> Can you help to review this issue? Because of the uefi spec issue, some 
> firmware implemented the different behavior.
> Should the edk2 code to handle such issue? If yes, here maybe the situation:
> 1.   Change for all apps -> uefi spec update and accept  such behavior 
> with description -> Done.
> 2.   Change for all apps -> uefi spec update to remove the ambiguous and 
> reject other behavior -> removal the change in first step.
>
> Hi Vitaly,
>
> I used to think it is an additional support for different implementation 
> because of the spec. But if we approve this patch, all the app in edk2 using 
> the combo key function should be update.
> Using shell’s ctrl+’c’ as an example, it need to update at the same time. 
> Same with SCT tool.
>
> Thanks,
> Zhichao
>  <> 
> From: devel@edk2.groups.io  
> [mailto:devel@edk2.groups.io ] On Behalf Of 
> Vitaly Cheptsov via Groups.Io
> Sent: Friday, March 27, 2020 7:01 PM
> To: Gao, Zhichao mailto:zhichao@intel.com>>
> Cc: devel@edk2.groups.io ; Andrew Fish 
> mailto:af...@apple.com>>; Laszlo Ersek  >; Marvin Häuser  >; Kinney, Michael D  >; Ni, Ray  >
> Subject: Re: [edk2-devel] [PATCH 1/1] ShellPkg: Add support for input with 
> separately reported modifiers
>
> Hello,
>
> Requesting to merge this into edk2-stable202005 for the reasons explained in 
> BZ[1]. I assume there is no real objection for this, only the approach we 
> make such changes in the future, but this can be postponed as we encounter 
> more of such problems.
>
> Best regards,
> Vitaly
>
> [1] https://bugzilla.tianocore.org/show_bug.cgi?id=2510 
> 
>
> 
> 20 февр. 2020 г., в 03:27, Gao, Zhichao  > написал(а):
>
> Sorry for my mistake. Then I have no other comments for this patch.
> Reviewed-by: Zhichao Gao  >
>
> Thanks,
> Zhichao
>
>  <>From: 

[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories

2020-04-17 Thread Ashley E Desimone
This version amends patch 4/6 to use Erik's feeback
regardling list comprehensions. All other patches are
unchanged.

This patch set adds the initial support for consuming
multiple manifest repositories to the BaseConfig, GlobalConfig
and GlobalUserConfig classes defined in edkrepo/config/config_factory.py

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 

Ashley E Desimone (6):
  EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos
  EdkRepo: Add new sections to edkrepo.cfg
  EdkRepo: Add the manifest_repo_list property to BaseConfig
  EdkRepo: Add manifest_repo_props()
  EdkRepo: Move edkrepo_global_data directory to BaseConfig
  EdkRepo: Add 'get' functions for Manifest Repo data

 edkrepo/config/config_factory.py | 68 
 edkrepo_installer/Vendor/edkrepo.cfg |  8 +
 2 files changed, 70 insertions(+), 6 deletions(-)

-- 
2.16.2.windows.1


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

View/Reply Online (#57537): https://edk2.groups.io/g/devel/message/57537
Mute This Topic: https://groups.io/mt/73088005/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig

2020-04-17 Thread Ashley E Desimone
Move the edkrepo_global_data_directory from the
GlobalConfig class to the base config class.

Updated the assignments of self.filename in both
the GlobalConfig and the GlobalUserConfig classes
as well as the initializaion of the BaseConfig
class to use get_edkrepo_global_data_directory()

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 1afa221..4ae06f6 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -77,10 +77,11 @@ class BaseConfig():
 for the class.  Property generation and verification is based off of a 
list of CfgProp classes.
 """
 prop_list = []
-def __init__(self, filename, read_only=True):
+def __init__(self, filename, global_data_dir, read_only=True):
 # Do basic initialization of private variables
 self.read_only = read_only
 self.filename = filename
+self.global_data_dir = global_data_dir
 self.cfg = configparser.ConfigParser(allow_no_value=True, 
delimiters='=')
 if os.path.isfile(self.filename):
 self.cfg.read(self.filename)
@@ -132,8 +133,7 @@ class GlobalConfig(BaseConfig):
 edkrepo installer.
 """
 def __init__(self):
-self.edkrepo_global_data_directory = 
get_edkrepo_global_data_directory()
-self.filename = os.path.join(self.edkrepo_global_data_directory, 
"edkrepo.cfg")
+self.filename = os.path.join(get_edkrepo_global_data_directory(), 
"edkrepo.cfg")
 self.prop_list = [
 CfgProp('manifest-repo', 'URL', 'manifest_repo_url', None, 
True),
 CfgProp('manifest-repo', 'Branch', 'manifest_repo_branch', 
None, True),
@@ -148,7 +148,7 @@ class GlobalConfig(BaseConfig):
 CfgProp('preferred-entry-point', 'entry-point', 
'pref_entry_point', None, True)]
 if not os.path.isfile(self.filename):
 raise 
EdkrepoGlobalConfigNotFoundException(humble.GLOBAL_CFG_NOT_FOUND.format(self.filename))
-super().__init__(self.filename, True)
+super().__init__(self.filename, get_edkrepo_global_data_directory(), 
True)
 
 @property
 def preferred_entry(self):
@@ -165,7 +165,7 @@ class GlobalConfig(BaseConfig):
 @property
 def manifest_repo_abs_local_path(self):
 """Provides an absolute path to the manifest repo based on 
configuration file values."""
-return os.path.join(self.edkrepo_global_data_directory, 
self.manifest_repo_local_path)
+return os.path.join(self.global_data_dir, 
self.manifest_repo_local_path)
 
 @property
 def sparsecheckout_data(self):
@@ -192,7 +192,7 @@ class GlobalUserConfig(BaseConfig):
 CfgProp('scm', 'mirror_geo', 'geo', 'none', False),
 CfgProp('send-review', 'max-patch-set', 'max_patch_set', '10', 
False)
 ]
-super().__init__(self.filename, False)
+super().__init__(self.filename, get_edkrepo_global_data_directory(), 
False)
 
 @property
 def max_patch_set_int(self):
-- 
2.16.2.windows.1


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

View/Reply Online (#57543): https://edk2.groups.io/g/devel/message/57543
Mute This Topic: https://groups.io/mt/73088011/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos

2020-04-17 Thread Ashley E Desimone
Add support for the following cfg format to the
BaseConfig class enabling it to be consumed by
both the Global and User configuration file
classes. CfgProps for each listed manifest repository
will be dynamically added to the classes prop_list.

Configuration Example:

[Manifest_A]
...

[Manifest_B]
...

[manifest-repos]
Manifest_A
Manifest_B

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index c342838..6c14f1b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -85,6 +85,12 @@ class BaseConfig():
 if os.path.isfile(self.filename):
 self.cfg.read(self.filename)
 
+if self.cfg.has_section('manifest-repos'):
+for option in self.cfg.options('manifest-repos'):
+self.prop_list.append(CfgProp('{}'.format(option), 'URL', 
'{}-manifest_repo_url.'.format(option), None, False))
+self.prop_list.append(CfgProp('{}'.format(option), 'Branch', 
'{}-manifest_repo_branch'.format(option), None, False))
+self.prop_list.append(CfgProp('{}'.format(option), 
'LocalPath', '{}-manifest_repo_local_path.'.format(option), None, False))
+
 # Create properties defined by the prop_list
 cfg_updated = False
 for prop in self.prop_list:
-- 
2.16.2.windows.1


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

View/Reply Online (#57541): https://edk2.groups.io/g/devel/message/57541
Mute This Topic: https://groups.io/mt/73088009/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 6/6] EdkRepo: Add 'get' functions for Manifest Repo data

2020-04-17 Thread Ashley E Desimone
Added functions to get the URL, LocalPath, Branch
and the absolute path for individual manifest
repositories to the BaseConfig class.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 37 +
 1 file changed, 37 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 4ae06f6..90f393c 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -127,6 +127,43 @@ class BaseConfig():
 """
 return [x for x in self.prop_list if manifest_repo in x.name]
 
+def get_manifest_repo_url(self, manifest_repo):
+""" 
+Returns the URL value for a given manifest repo based on config
+file contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'URL' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def get_manifest_repo_branch(self, manifest_repo):
+"""
+Returns the Branch value for a given manifest repo based on config file
+contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'Branch' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def get_manifest_repo_local_path(self, manifest_repo):
+"""
+Returns the Local path value for a given manifest repo based on config
+file contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'LocalPath' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def manifest_repo_abs_path(self, manifest_repo):
+"""
+Returns the absolute path of a single manifest repo based on config
+file contents and the global_data_dir location.
+"""
+return os.path.join(self.global_data_dir, 
self.get_manifest_repo_local_path(manifest_repo))
+
 class GlobalConfig(BaseConfig):
 """
 Class access structure for the edkrepo.cfg file.  This file is read only 
and maintained by the
-- 
2.16.2.windows.1


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

View/Reply Online (#57540): https://edk2.groups.io/g/devel/message/57540
Mute This Topic: https://groups.io/mt/73088008/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 2/6] EdkRepo: Add new sections to edkrepo.cfg

2020-04-17 Thread Ashley E Desimone
Add manifest-repos and edk2-staging sections
to the edkrepo.cfg to enable support of multiple
manifest repositories.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo_installer/Vendor/edkrepo.cfg | 8 
 1 file changed, 8 insertions(+)

diff --git a/edkrepo_installer/Vendor/edkrepo.cfg 
b/edkrepo_installer/Vendor/edkrepo.cfg
index 7dcaf20..97ebdd2 100644
--- a/edkrepo_installer/Vendor/edkrepo.cfg
+++ b/edkrepo_installer/Vendor/edkrepo.cfg
@@ -1,3 +1,11 @@
+[manifest-repos]
+edk2-staging = 
+
+[edk2-staging]
+URL = https://github.com/tianocore/edk2-staging.git
+Branch = EdkRepo-Manifest
+LocalPath = edk2-staging-manifest-master
+
 [manifest-repo]
 URL = https://github.com/tianocore/edk2-staging.git
 Branch = EdkRepo-Manifest
-- 
2.16.2.windows.1


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

View/Reply Online (#57538): https://edk2.groups.io/g/devel/message/57538
Mute This Topic: https://groups.io/mt/73088006/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig

2020-04-17 Thread Ashley E Desimone
Add the manifest_repo_list property to the BaseConfig class
to return a list of manfiest repo sections in the config file.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6c14f1b..6f89589 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -113,6 +113,12 @@ class BaseConfig():
 with open(self.filename, 'w') as cfg_stream:
 self.cfg.write(cfg_stream)
 
+@property
+def manifest_repo_list(self):
+"""Returns a list of available manifest repos"""
+if self.cfg.has_section('manifest-repos'):
+return self.cfg.options('manifest-repos')
+
 class GlobalConfig(BaseConfig):
 """
 Class access structure for the edkrepo.cfg file.  This file is read only 
and maintained by the
-- 
2.16.2.windows.1


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

View/Reply Online (#57539): https://edk2.groups.io/g/devel/message/57539
Mute This Topic: https://groups.io/mt/73088007/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()

2020-04-17 Thread Ashley E Desimone
I am going to go with it was a long day. I will send out an updated patch set 
for review taking your feedback into account.

Thanks,
Ashley

-Original Message-
From: Bjorge, Erik C  
Sent: Friday, April 17, 2020 8:09 AM
To: Desimone, Ashley E ; devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bret Barkelew ; Agyeman, 
Prince 
Subject: RE: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add 
manifest_repo_props()

Why is this not a list comprehension?

return [x for x in self.prop_list if manifest_repo in x.name]

-Original Message-
From: Desimone, Ashley E  
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()

Add the manifest_repo_props() function to the BaseConfig class which returns a 
list of all CfgProp objects for a given manifest repository.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6f89589..e053f8b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -118,6 +118,17 @@ class BaseConfig():
 """Returns a list of available manifest repos"""
 if self.cfg.has_section('manifest-repos'):
 return self.cfg.options('manifest-repos')
+
+def manifest_repo_props(self, manifest_repo):
+"""
+Returns a list of cfg_prop objects that pertain to a given manifest
+repo
+"""
+repo_props = []
+for prop in self.prop_list:
+if manifest_repo in prop.name:
+repo_props.append(prop)
+return repo_props
 
 class GlobalConfig(BaseConfig):
 """
--
2.16.2.windows.1


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

View/Reply Online (#57536): https://edk2.groups.io/g/devel/message/57536
Mute This Topic: https://groups.io/mt/73070622/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 07/13] OvmfPkg: add QemuFwCfgS3LibNull

2020-04-17 Thread Laszlo Ersek
On 04/16/20 01:09, Rebecca Cran wrote:
> Add a null implementation of QemuFwCfgS3Lib, for bhyve.
> 
> Signed-off-by: Rebecca Cran 
> ---
>  .../PeiQemuFwCfgS3LibFwCfgNull.inf|  39 
>  .../QemuFwCfgS3BasePeiNull.c  | 221 ++
>  .../QemuFwCfgS3LibNull/QemuFwCfgS3PeiNull.c   |  80 +++
>  3 files changed, 340 insertions(+)
>  create mode 100644 
> OvmfPkg/Library/QemuFwCfgS3LibNull/PeiQemuFwCfgS3LibFwCfgNull.inf
>  create mode 100644 
> OvmfPkg/Library/QemuFwCfgS3LibNull/QemuFwCfgS3BasePeiNull.c
>  create mode 100644 OvmfPkg/Library/QemuFwCfgS3LibNull/QemuFwCfgS3PeiNull.c

My comment under patch#4 applies; just use

  OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf

please.

Thanks
Laszlo


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

View/Reply Online (#57535): https://edk2.groups.io/g/devel/message/57535
Mute This Topic: https://groups.io/mt/73045144/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 06/13] OvmfPkg: add QemuFwCfgPeiLibNull

2020-04-17 Thread Laszlo Ersek
On 04/16/20 01:09, Rebecca Cran wrote:
> Add a null PEI implementation of QemuFwCfgLib for bhyve.
> 
> Signed-off-by: Rebecca Cran 
> ---
>  .../QemuFwCfgLibNull/QemuFwCfgPeiLibNull.inf  |  36 ++
>  .../QemuFwCfgLibNull/QemuFwCfgPeiNull.c   | 107 ++
>  2 files changed, 143 insertions(+)
>  create mode 100644 OvmfPkg/Library/QemuFwCfgLibNull/QemuFwCfgPeiLibNull.inf
>  create mode 100644 OvmfPkg/Library/QemuFwCfgLibNull/QemuFwCfgPeiNull.c

The Null instance is usually not specific to any firmware phase, such as
the PEI phase. The Null instance does nothing, and doing nothing is
possible in any phase.

Please introduce the following files:

- QemuFwCfgLibNull.inf
- QemuFwCfgNull.c

In the INF file, set LIBRARY_CLASS to bare "QemuFwCfgLib"; there is no
need for a module type restriction (such as "|PEIM").

In the C file, implement the APIs listed in the lib class header,
"OvmfPkg/Include/Library/QemuFwCfgLib.h":

- QemuFwCfgIsAvailable -> return constant FALSE directly

- QemuFwCfgSelectItem  -> ASSERT (FALSE)
- QemuFwCfgReadBytes   -> ditto
- QemuFwCfgWriteBytes  -> ditto
- QemuFwCfgSkipBytes   -> ditto

- QemuFwCfgRead8   -> ASSERT (FALSE); return 0
- QemuFwCfgRead16  -> ditto
- QemuFwCfgRead32  -> ditto
- QemuFwCfgRead64  -> ditto

- QemuFwCfgFindFile-> return RETURN_UNSUPPORTED

Implement no other functions. (Helper functions are not needed.)

(If any of the ASSERTs is tripped in your testing, then we have a bug in
an fw-cfg consumer module, and we should fix that. Basically, an fw-cfg
consumer module is allowed to call QemuFwCfgIsAvailable or
QemuFwCfgFindFile first, and the rest of the functions only if one of
the former succeeds).

Thanks
Laszlo


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

View/Reply Online (#57534): https://edk2.groups.io/g/devel/message/57534
Mute This Topic: https://groups.io/mt/73045135/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 05/13] OvmfPkg: Add VBE2 mode info structure to LegacyVgaBios.h

2020-04-17 Thread Laszlo Ersek
On 04/16/20 01:09, Rebecca Cran wrote:
> bhyve uses the older VESA BIOS Extensions 2.0, so add the mode info
> structure to IndustryStandard/LegacyVgaBios.h
> 
> Signed-off-by: Rebecca Cran 
> ---
>  .../Include/IndustryStandard/LegacyVgaBios.h  | 39 +++
>  1 file changed, 39 insertions(+)

This header file currently only exists in support of
"OvmfPkg/QemuVideoDxe/VbeShim.c".

But, I still agree that VBE2_MODE_INFO belongs here. So it's OK.

> diff --git a/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h 
> b/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
> index 317dac3a56..016ff95a5d 100644
> --- a/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
> +++ b/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
> @@ -88,4 +88,43 @@ typedef struct {
>  } VBE_MODE_INFO;
>  #pragma pack ()
>  
> +typedef struct {
> +  UINT16 ModeAttr;
> +  UINT8  WindowAAttr;
> +  UINT8  WindowBAttr;
> +  UINT16 WindowGranularityKB;
> +  UINT16 WindowSizeKB;
> +  UINT16 WindowAStartSegment;
> +  UINT16 WindowBStartSegment;
> +  UINT32 WindowPositioningAddress;
> +  UINT16 BytesPerScanLine;
> +
> +  UINT16 Width;
> +  UINT16 Height;
> +  UINT8  CharCellWidth;
> +  UINT8  CharCellHeight;
> +  UINT8  NumPlanes;
> +  UINT8  BitsPerPixel;
> +  UINT8  NumBanks;
> +  UINT8  MemoryModel;
> +  UINT8  BankSizeKB;
> +  UINT8  NumImagePagesLessOne;
> +  UINT8  Vbe3;
> +
> +  UINT8  RedMaskSize;
> +  UINT8  RedMaskPos;
> +  UINT8  GreenMaskSize;
> +  UINT8  GreenMaskPos;
> +  UINT8  BlueMaskSize;
> +  UINT8  BlueMaskPos;
> +  UINT8  ReservedMaskSize;
> +  UINT8  ReservedMaskPos;
> +  UINT8  DirectColorModeInfo;
> +
> +  UINT32 LfbAddress;
> +  UINT32 OffScreenAddress;
> +  UINT16 OffScreenSizeKB;
> +} VBE2_MODE_INFO;
> +#pragma pack ()
> +
>  #endif
> 

I'm not going to review the contents of the new structure, so I'm going
to give an A-b, not an R-b.

However, the "#pragma pack ()" that you add at the end is unbalanced.
The pre-patch file already brackets the whole set of structs with

#pragma pack (1)
...
#pragma pack ()

Thus, you need not add any #pragma, just insert the VBE2_MODE_INFO
typedef between the existent pragmas.

Put differently: please remove the "#pragma pack ()" right after
"VBE_MODE_INFO" (*not* after VBE2_MODE_INFO), as a part of this patch.

With that update:

Acked-by: Laszlo Ersek 

Thanks
Laszlo


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

View/Reply Online (#57533): https://edk2.groups.io/g/devel/message/57533
Mute This Topic: https://groups.io/mt/73045191/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 04/13] OvmfPkg: Add QemuFwCfgS3LibNull

2020-04-17 Thread Laszlo Ersek
Hi,

On 04/16/20 01:09, Rebecca Cran wrote:
> Add a null implementation library fof QemuFwCfgS3Lib, to support bhyve.
> 
> Signed-off-by: Rebecca Cran 
> ---
>  .../DxeQemuFwCfgS3LibFwCfgNull.inf|  32 ++
>  .../QemuFwCfgS3LibNull/QemuFwCfgS3DxeNull.c   | 307 ++
>  .../QemuFwCfgS3PeiDxeNull.c   |  31 ++
>  3 files changed, 370 insertions(+)
>  create mode 100644 
> OvmfPkg/Library/QemuFwCfgS3LibNull/DxeQemuFwCfgS3LibFwCfgNull.inf
>  create mode 100644 OvmfPkg/Library/QemuFwCfgS3LibNull/QemuFwCfgS3DxeNull.c
>  create mode 100644 OvmfPkg/Library/QemuFwCfgS3LibNull/QemuFwCfgS3PeiDxeNull.c

I'm extremely sorry if I gave you bad advice on this.

We already have a Null instance of this library; it should be ready for
use in BhyvePkg. The ArmVirtQemu and ArmVirtQemuKernel platforms in
ArmVirtPkg already consume it. The INF file is located at:

  OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf

Thanks (and sorry again if I wasted your time!)
Laszlo


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

View/Reply Online (#57532): https://edk2.groups.io/g/devel/message/57532
Mute This Topic: https://groups.io/mt/73045164/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 6/6] OvmfPkg/ResetSystemLib: introduce the DxeResetSystemLib instance

2020-04-17 Thread Philippe Mathieu-Daudé

On 4/17/20 5:37 PM, Laszlo Ersek wrote:

The BaseResetSystemLib instance is not suitable for OS runtime, because
its ResetShutdown() implementation calls PciRead16 (OVMF_HOSTBRIDGE_DID).
On q35, this boils down to a memory-mapped config space access -- but we
never ask the OS to map MMCONFIG for runtime.

There are at least three alternatives to approach this:

(1) Investigate "MdePkg/Library/DxeRuntimePciExpressLib", which offers
 some kind of runtime mapping for MMCONFIG.

(2) Consume PciCf8Lib directly, rather than PciLib, in ResetSystemLib.
 Then we'll read OVMF_HOSTBRIDGE_DID from the config space with IO port
 accesses on q35 too, not just on i440fx. IO ports don't depend on page
 tables.

(3) In the lib constructor, cache "mAcpiPmBaseAddress" based on
 "PcdOvmfHostBridgePciDevId" (which is set by PlatformPei). Then the
 host bridge type will be known at runtime without PCI config space
 accesses.

This patch follows approach (3), in order to mirror AcpiTimerLib.


Reviewed-by: Philippe Mathieu-Daude 



Notes:

* This patch is best viewed with "git show --find-copies-harder -C43".

* PCDs are not usable in the DXE_CORE, as the PCD PPI is gone, and the PCD
   protocol is not available yet. (The DXE_CORE does consume ResetSystemLib
   in practice, when OVMF is built with -D SOURCE_DEBUG_ENABLE.)

* The bug is not easy to trigger in common setups, because e.g. the Linux
   guest cannot easily be convinced to use the EFI runtime service for
   poweroff. One way to trigger the bug is to (a) patch OVMF as follows:


diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index fe51f53d1df2..1edc4349ad20 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -28,6 +28,7 @@ ResetCold (
VOID
)
  {
+  ResetShutdown ();
IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST
MicroSecondDelay (50);


   (b) boot a Linux guest with "reboot=efi" on q35, and (c) reboot the
   guest with the "reboot" command. Then the guest kernel will log:


reboot: Restarting system
reboot: machine restart
[ cut here ]
[Firmware Bug]: Page fault caused by firmware at PA: 0xb002
WARNING: CPU: 0 PID: 1362 at arch/x86/platform/efi/quirks.c:738
efi_recover_from_page_fault+0x2a/0xc8
Modules linked in: ip_set nfnetlink sunrpc vfat fat intel_rapl_msr
intel_rapl_common kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul
bochs_drm drm_vram_helper ttm ghash_clmulni_intel drm_kms_helper
iTCO_wdt iTCO_vendor
CPU: 0 PID: 1362 Comm: reboot Not tainted 5.3.6-200.fc30.x86_64 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0
02/06/2015
RIP: 0010:efi_recover_from_page_fault+0x2a/0xc8
Code: 0f 1f 44 00 00 8b 15 35 c2 c1 01 85 d2 74 09 48 81 ff ff 0f 00 00
77 01 c3 53 48 89 fe 48 c7 c7 58 ba 12 aa 50 e8 74 f0 00 00 <0f> 0b 83
3d 0d c2 c1 01 0a 0f 84 8f 00 00 00 48 8b 05 70 c8 4a 01
RSP: 0018:af3a402539d8 EFLAGS: 00010286
RAX:  RBX: 8a3c33711f40 RCX: 03b2
RDX: 0001 RSI: 0096 RDI: 0246
RBP: af3a40253a88 R08:  R09: 03b2
R10: 0001 R11: a9ee3800 R12: b002
R13:  R14: 000b R15: 0001
FS:  7fbca9cf8940() GS:8a3c3ae0()
knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: fffeff8a67a1 CR3: 72868006 CR4: 001606f0
Call Trace:
  no_context+0x15b/0x380
  ? do_user_addr_fault+0x12e/0x440
  do_page_fault+0x31/0x110
  async_page_fault+0x3e/0x50
RIP: 0010:0xfffeff8a67a1
Code: Bad RIP value.
RSP: 0018:af3a40253b30 EFLAGS: 00010046
RAX: b002 RBX:  RCX: b002
RDX: b000 RSI:  RDI: fffeff8a80f0
RBP: af3a40253b60 R08: fffeff8aadb8 R09: 
R10: aa5762c0 R11: a9ee3800 R12: 
R13:  R14: 0046 R15: 
  ? efi_call+0x58/0x90
  ? virt_efi_reset_system+0x8d/0x100
  ? efi_reboot+0x85/0xb8
  ? native_machine_emergency_restart+0x9f/0x250
  ? native_apic_msr_read+0x16/0x20
  ? disconnect_bsp_APIC+0x8c/0xd0
  ? __do_sys_reboot+0x1d2/0x210
  ? __fput+0x168/0x250
  ? do_writev+0x6b/0x110
  ? do_syscall_64+0x5f/0x1a0
  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
---[ end trace d5bee708166d198b ]---
efi: efi_reset_system() buggy! Reboot through BIOS


Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/OvmfPkgIa32.dsc   
   |  6 +++
  OvmfPkg/OvmfPkgIa32X64.dsc
   |  6 +++
  OvmfPkg/OvmfPkgX64.dsc 

Re: [edk2-devel] [PATCH 0/6] OvmfPkg/ResetSystemLib: clean up, refactor, fix

2020-04-17 Thread Philippe Mathieu-Daudé

On 4/17/20 5:59 PM, Ard Biesheuvel wrote:

On 4/17/20 5:37 PM, Laszlo Ersek wrote:

Ref:    https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Repo:   https://pagure.io/lersek/edk2.git
Branch: rsl_cleanup

Rebecca's

   [PATCH 02/13] OvmfPkg: support powering off bhyve guests

at

   https://edk2.groups.io/g/devel/message/57450

e4e9b29189b83076e1d1a0b9c989938f5226cab6.1586991816.git.rebecca@bsdio.com">http://mid.mail-archive.com/e4e9b29189b83076e1d1a0b9c989938f5226cab6.1586991816.git.rebecca@bsdio.com 



made me realize OvmfPkg/ResetSystemLib should be refreshed. This will
let us add a simple bhyve-specific instance (later), and also allows us
to fix a long time dormant bug (now).

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 

Thanks,
Laszlo

Laszlo Ersek (6):
   OvmfPkg/ResetSystemLib: wrap long lines
   OvmfPkg/ResetSystemLib: clean up library dependencies
   OvmfPkg/ResetSystemLib: improve coding style in ResetSystem()
   OvmfPkg/ResetSystemLib: factor out ResetShutdown()
   OvmfPkg/ResetSystemLib: rename to BaseResetSystemLib
   OvmfPkg/ResetSystemLib: introduce the DxeResetSystemLib instance



For the series,

Reviewed-by: Ard Biesheuvel 

One nit: putting a diff block inside the commit log [6/6] doesn't help 
legibility a lot, and the issue of not being able to access memory that 
is not mapped for runtime is so basic that it doesn't require that level 
of detail to describe a reproducer and the Linux kernel log output when 
the issue is triggered.


Personally I find the kernel log relevant, it will help to understand th 
e patch when looking at it in >5years from now.


  
OvmfPkg/OvmfPkgIa32.dsc   
|  8 +-
  
OvmfPkg/OvmfPkgIa32X64.dsc 
|  8 +-
  
OvmfPkg/OvmfPkgX64.dsc 
|  8 +-
  
OvmfPkg/OvmfXen.dsc   
|  6 +-
  OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf => 
BaseResetSystemLib.inf} | 12 ++-
  
OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf   
| 43 ++
  
OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c 
| 51 
  
OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c 
| 62 +++
  
OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   
| 84 +---

  9 files changed, 209 insertions(+), 73 deletions(-)
  rename OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf => 
BaseResetSystemLib.inf} (65%)

  create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf
  create mode 100644 OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c
  create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c






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

View/Reply Online (#57530): https://edk2.groups.io/g/devel/message/57530
Mute This Topic: https://groups.io/mt/73085501/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] NetworkPkg/TlsAuthConfigDxe: Use HiiPopUp() instead of CreatePopUp()

2020-04-17 Thread Maciej Rabeda

Hi Chang,

For any and all of your future patches, "Signed-off" should contain your 
name + email and maintainer should be in Cc :)


Reviewed-by: Maciej Rabeda 

Thanks,
Maciej

On 17-Apr-20 04:38, Siyuan, Fu wrote:

Reviewed-by: Siyuan Fu 


-Original Message-
From: Keysound Chang 
Sent: 2020年4月9日 14:57
To: devel@edk2.groups.io
Cc: Keysound Chang ; Wu, Jiaxin
; Fu, Siyuan ; Maciej Rabeda

Subject: [PATCH] NetworkPkg/TlsAuthConfigDxe: Use HiiPopUp() instead of
CreatePopUp()

From: Keysound Chang 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2635

According to EDK2 Driver Writer's Guide For UEFI 2.3.1, 4.2.18 Offer
alternatives to function keys. Configuration of drivers should be
accomplished via HII and via OS-present interfaces.

Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Maciej Rabeda 
---
  .../TlsAuthConfigDxe/TlsAuthConfigDxe.inf |  1 +
  .../TlsAuthConfigDxeStrings.uni   |  2 ++
  .../TlsAuthConfigDxe/TlsAuthConfigImpl.c  | 20 +--
  .../TlsAuthConfigDxe/TlsAuthConfigImpl.h  |  1 +
  4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
index 3fc924a1d4..0ada835252 100644
--- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
+++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
@@ -52,6 +52,7 @@
  [Protocols]

gEfiDevicePathProtocolGuid## PRODUCES

gEfiHiiConfigAccessProtocolGuid   ## PRODUCES

+  gEfiHiiPopupProtocolGuid  ## CONSUMES



  [Guids]

gTlsAuthConfigGuid## PRODUCES  ## GUID

diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni
b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni
index 973b8b7716..2b4a27d24e 100644
--- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni
+++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni
@@ -28,6 +28,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
  #string STR_TLS_AUTH_CONFIG_SAVE_AND_EXIT#language en-US
"Commit Changes and Exit"

  #string STR_TLS_AUTH_CONFIG_NO_SAVE_AND_EXIT #language en-US
"Discard Changes and Exit"



+#string STR_TLS_AUTH_ENROLL_CERT_FAILURE #language en-US
"Enroll Cert Failure!"

+

  #string STR_CERT_TYPE_PCKS_GUID  #language en-US "GUID for
CERT"



  #string STR_NULL #language en-US ""

diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c
b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c
index 2481d1098f..0ef96dfaf2 100644
--- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c
+++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c
@@ -1383,7 +1383,6 @@ TlsAuthConfigAccessCallback (
OUTEFI_BROWSER_ACTION_REQUEST *ActionRequest

)

  {

-  EFI_INPUT_KEY   Key;

EFI_STATUS  Status;

RETURN_STATUS   RStatus;

TLS_AUTH_CONFIG_PRIVATE_DATA*Private;

@@ -1391,6 +1390,8 @@ TlsAuthConfigAccessCallback (
TLS_AUTH_CONFIG_IFR_NVDATA  *IfrNvData;

UINT16  LabelId;

EFI_DEVICE_PATH_PROTOCOL*File;

+  EFI_HII_POPUP_PROTOCOL  *HiiPopUp;

+  EFI_HII_POPUP_SELECTION PopUpSelect;



Status   = EFI_SUCCESS;

File = NULL;

@@ -1402,6 +1403,11 @@ TlsAuthConfigAccessCallback (
Private = TLS_AUTH_CONFIG_PRIVATE_FROM_THIS (This);



mTlsAuthPrivateData = Private;

+  Status = gBS->LocateProtocol (, NULL,
);

+  if (EFI_ERROR (Status)) {

+DEBUG ((DEBUG_ERROR, "Can't find Form PopUp protocol. Exit (%r)\n",
Status));

+return Status;

+  }



//

// Retrieve uncommitted data from Browser

@@ -1460,11 +1466,13 @@ TlsAuthConfigAccessCallback (
if (EFI_ERROR (Status)) {

  CleanFileContext (Private);



-CreatePopUp (

-  EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

-  ,

-  L"ERROR: Enroll Cert Failure!",

-  NULL

+HiiPopUp->CreatePopup(

+  HiiPopUp,

+  EfiHiiPopupStyleError,

+  EfiHiiPopupTypeOk,

+  Private->RegisteredHandle,

+  STRING_TOKEN(STR_TLS_AUTH_ENROLL_CERT_FAILURE),

+  

);

}

break;

diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h
b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h
index e9af492893..68c16845b3 100644
--- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h
+++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h
@@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent


  #include 

  #include 

+#include 



  //

  // Libraries

--
2.23.0.windows.1







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

View/Reply Online (#57529): https://edk2.groups.io/g/devel/message/57529
Mute This Topic: https://groups.io/mt/72892269/21656
Group Owner: 

Re: [edk2-devel] [PATCH 4/6] OvmfPkg/ResetSystemLib: factor out ResetShutdown()

2020-04-17 Thread Philippe Mathieu-Daudé

On 4/17/20 5:37 PM, Laszlo Ersek wrote:

Move the ResetShutdown() definition to its own file. This will help us
introduce:

- a new library instance that is not broken in runtime modules (the
   current library instance is broken in runtime modules),

- another new library instance for bhyve support.

While at it, squash AcpiPmControl() into ResetShutdown(), open-coding
SuspendType=0. This is justified because we've had no other callers for
AcpiPmControl() since commit 2d9950a2bff8 ("OvmfPkg: remove
EnterS3WithImmediateWake () from ResetSystemLib", 2020-01-10).

Tested with the "reset -s" UEFI shell command, on both i440fx and q35.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf |  1 +
  OvmfPkg/Library/ResetSystemLib/ResetShutdown.c| 51 
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   | 49 ---
  3 files changed, 52 insertions(+), 49 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index af20f516c035..9362f884f124 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -22,6 +22,7 @@ [Defines]
  #
  
  [Sources]

+  ResetShutdown.c
ResetSystemLib.c
  
  [Packages]

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c 
b/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c
new file mode 100644
index ..971d94fa5766
--- /dev/null
+++ b/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c
@@ -0,0 +1,51 @@
+/** @file
+  Reset System Library Shutdown API implementation for OVMF.
+
+  Copyright (C) 2020, Red Hat, Inc.
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include// BIT13
+
+#include // CpuDeadLoop()
+#include// ASSERT()
+#include   // IoOr16()
+#include  // PciRead16()
+#include  // ResetShutdown()
+#include   // OVMF_HOSTBRIDGE_DID
+
+/**
+  Calling this function causes the system to enter a power state equivalent
+  to the ACPI G2/S5 or G3 states.
+
+  System shutdown should not return, if it returns, it means the system does
+  not support shut down reset.
+**/
+VOID
+EFIAPI
+ResetShutdown (
+  VOID
+  )
+{
+  UINT16 AcpiPmBaseAddress;
+  UINT16 HostBridgeDevId;
+
+  AcpiPmBaseAddress = 0;
+  HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
+  switch (HostBridgeDevId) {
+  case INTEL_82441_DEVICE_ID:
+AcpiPmBaseAddress = PIIX4_PMBA_VALUE;
+break;
+  case INTEL_Q35_MCH_DEVICE_ID:
+AcpiPmBaseAddress = ICH9_PMBASE_VALUE;
+break;
+  default:
+ASSERT (FALSE);
+CpuDeadLoop ();
+  }
+
+  IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0);
+  IoOr16 (AcpiPmBaseAddress + 4, BIT13);
+  CpuDeadLoop ();
+}
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 0fc142325ece..fe51f53d1df2 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -9,41 +9,9 @@
  #include// BIT1
  
  #include // CpuDeadLoop()

-#include// ASSERT()
  #include   // IoWrite8()
-#include  // PciRead16()
  #include  // ResetCold()
  #include// MicroSecondDelay()
-#include   // OVMF_HOSTBRIDGE_DID
-
-VOID
-AcpiPmControl (
-  UINTN SuspendType
-  )
-{
-  UINT16 AcpiPmBaseAddress;
-  UINT16 HostBridgeDevId;
-
-  ASSERT (SuspendType < 6);
-
-  AcpiPmBaseAddress = 0;
-  HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
-  switch (HostBridgeDevId) {
-  case INTEL_82441_DEVICE_ID:
-AcpiPmBaseAddress = PIIX4_PMBA_VALUE;
-break;
-  case INTEL_Q35_MCH_DEVICE_ID:
-AcpiPmBaseAddress = ICH9_PMBASE_VALUE;
-break;
-  default:
-ASSERT (FALSE);
-CpuDeadLoop ();
-  }
-
-  IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, (UINT16) SuspendType);
-  IoOr16 (AcpiPmBaseAddress + 4, BIT13);
-  CpuDeadLoop ();
-}
  
  /**

Calling this function causes a system-wide reset. This sets
@@ -84,23 +52,6 @@ ResetWarm (
CpuDeadLoop ();
  }
  
-/**

-  Calling this function causes the system to enter a power state equivalent
-  to the ACPI G2/S5 or G3 states.
-
-  System shutdown should not return, if it returns, it means the system does
-  not support shut down reset.
-**/
-VOID
-EFIAPI
-ResetShutdown (
-  VOID
-  )
-{
-  AcpiPmControl (0);
-  ASSERT (FALSE);
-}
-
  
  /**

This function causes a systemwide reset. The exact type of the reset is



Reviewed-by: Philippe Mathieu-Daude 


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

View/Reply Online (#57528): https://edk2.groups.io/g/devel/message/57528
Mute This Topic: https://groups.io/mt/73085505/21656
Group 

Re: [edk2-devel] [PATCH 3/6] OvmfPkg/ResetSystemLib: improve coding style in ResetSystem()

2020-04-17 Thread Philippe Mathieu-Daudé

On 4/17/20 5:37 PM, Laszlo Ersek wrote:

The cases under ResetSystem() currently mix "break"s with "return"s for no
good reason. Use "break" consistently.

(The inconsistency was introduced in commit 84c0b80de716,
"OvmfPkg/ResetSystemLib: Add new API ResetSystem", 2019-04-28.)

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 23816183a953..0fc142325ece 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -157,13 +157,13 @@ ResetSystem (
  
case EfiResetShutdown:

  ResetShutdown ();
-return;
+break;
  
case EfiResetPlatformSpecific:

  ResetPlatformSpecific (DataSize, ResetData);
-return;
+break;
  
default:

-return;
+break;
}
  }



Reviewed-by: Philippe Mathieu-Daude 


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

View/Reply Online (#57527): https://edk2.groups.io/g/devel/message/57527
Mute This Topic: https://groups.io/mt/73085502/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 2/6] OvmfPkg/ResetSystemLib: clean up library dependencies

2020-04-17 Thread Philippe Mathieu-Daudé

On 4/17/20 5:37 PM, Laszlo Ersek wrote:

Annotate the #include directives with the interfaces that this lib
instance needs from the included lib class headers. This will help us keep
the #include set minimal, when we move code around later.

While at it, synchronize the [LibraryClasses] section with the #include
directives -- list BaseLib.

Also #include the ResetSystemLib class header, which declares the
interfaces that this lib instance implements.

This forces us to spell out the "MdeModulePkg.dec" dependency too, under
[Packages].

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf |  2 ++
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   | 15 ---
  2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index 063dc49f2453..af20f516c035 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -25,10 +25,12 @@ [Sources]
ResetSystemLib.c
  
  [Packages]

+  MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
  
  [LibraryClasses]

+  BaseLib
DebugLib
IoLib
PciLib
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index b3abda80e75a..23816183a953 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -6,14 +6,15 @@
  
  **/
  
-#include 

+#include// BIT1
  
-#include 

-#include 
-#include 
-#include 
-#include 
-#include 
+#include // CpuDeadLoop()
+#include// ASSERT()
+#include   // IoWrite8()
+#include  // PciRead16()
+#include  // ResetCold()
+#include// MicroSecondDelay()
+#include   // OVMF_HOSTBRIDGE_DID
  
  VOID

  AcpiPmControl (



Reviewed-by: Philippe Mathieu-Daude 


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

View/Reply Online (#57526): https://edk2.groups.io/g/devel/message/57526
Mute This Topic: https://groups.io/mt/73085500/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 1/6] OvmfPkg/ResetSystemLib: wrap long lines

2020-04-17 Thread Philippe Mathieu-Daudé

On 4/17/20 5:37 PM, Laszlo Ersek wrote:

Wrap the source code and the INF file at 79 characters.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf |  3 ++-
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   | 20 +++-
  2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index 2f24dac87faf..063dc49f2453 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -15,7 +15,8 @@ [Defines]
LIBRARY_CLASS  = ResetSystemLib
  
  #

-# The following information is for reference only and not required by the 
build tools.
+# The following information is for reference only and not required by the build
+# tools.
  #
  #  VALID_ARCHITECTURES   = IA32 X64
  #
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 2f2e1293a3ef..b3abda80e75a 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -103,10 +103,11 @@ ResetShutdown (
  
  /**

This function causes a systemwide reset. The exact type of the reset is
-  defined by the EFI_GUID that follows the Null-terminated Unicode string 
passed
-  into ResetData. If the platform does not recognize the EFI_GUID in ResetData
-  the platform must pick a supported reset type to perform.The platform may
-  optionally log the parameters from any non-normal reset that occurs.
+  defined by the EFI_GUID that follows the Null-terminated Unicode string
+  passed into ResetData. If the platform does not recognize the EFI_GUID in
+  ResetData the platform must pick a supported reset type to perform.The
+  platform may optionally log the parameters from any non-normal reset that
+  occurs.
  
@param[in]  DataSize   The size, in bytes, of ResetData.

@param[in]  ResetData  The data buffer starts with a Null-terminated string,
@@ -128,11 +129,12 @@ ResetPlatformSpecific (
@param[in] ResetType  The type of reset to perform.
@param[in] ResetStatusThe status code for the reset.
@param[in] DataSize   The size, in bytes, of ResetData.
-  @param[in] ResetData  For a ResetType of EfiResetCold, EfiResetWarm, or 
EfiResetShutdown
-the data buffer starts with a Null-terminated 
string, optionally
-followed by additional binary data. The string is 
a description
-that the caller may use to further indicate the 
reason for the
-system reset.
+  @param[in] ResetData  For a ResetType of EfiResetCold, EfiResetWarm, or
+EfiResetShutdown the data buffer starts with a
+Null-terminated string, optionally followed by
+additional binary data. The string is a description
+that the caller may use to further indicate the
+reason for the system reset.
  **/
  VOID
  EFIAPI



Reviewed-by: Philippe Mathieu-Daude 


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

View/Reply Online (#57525): https://edk2.groups.io/g/devel/message/57525
Mute This Topic: https://groups.io/mt/73085503/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 0/6] OvmfPkg/ResetSystemLib: clean up, refactor, fix

2020-04-17 Thread Ard Biesheuvel

On 4/17/20 5:37 PM, Laszlo Ersek wrote:

Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Repo:   https://pagure.io/lersek/edk2.git
Branch: rsl_cleanup

Rebecca's

   [PATCH 02/13] OvmfPkg: support powering off bhyve guests

at

   https://edk2.groups.io/g/devel/message/57450
   
e4e9b29189b83076e1d1a0b9c989938f5226cab6.1586991816.git.rebecca@bsdio.com">http://mid.mail-archive.com/e4e9b29189b83076e1d1a0b9c989938f5226cab6.1586991816.git.rebecca@bsdio.com

made me realize OvmfPkg/ResetSystemLib should be refreshed. This will
let us add a simple bhyve-specific instance (later), and also allows us
to fix a long time dormant bug (now).

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 

Thanks,
Laszlo

Laszlo Ersek (6):
   OvmfPkg/ResetSystemLib: wrap long lines
   OvmfPkg/ResetSystemLib: clean up library dependencies
   OvmfPkg/ResetSystemLib: improve coding style in ResetSystem()
   OvmfPkg/ResetSystemLib: factor out ResetShutdown()
   OvmfPkg/ResetSystemLib: rename to BaseResetSystemLib
   OvmfPkg/ResetSystemLib: introduce the DxeResetSystemLib instance



For the series,

Reviewed-by: Ard Biesheuvel 

One nit: putting a diff block inside the commit log [6/6] doesn't help 
legibility a lot, and the issue of not being able to access memory that 
is not mapped for runtime is so basic that it doesn't require that level 
of detail to describe a reproducer and the Linux kernel log output when 
the issue is triggered.




  OvmfPkg/OvmfPkgIa32.dsc   
|  8 +-
  OvmfPkg/OvmfPkgIa32X64.dsc
|  8 +-
  OvmfPkg/OvmfPkgX64.dsc
|  8 +-
  OvmfPkg/OvmfXen.dsc   
|  6 +-
  OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf => BaseResetSystemLib.inf} 
| 12 ++-
  OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf  
| 43 ++
  OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c
| 51 
  OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c 
| 62 +++
  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   
| 84 +---
  9 files changed, 209 insertions(+), 73 deletions(-)
  rename OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf => 
BaseResetSystemLib.inf} (65%)
  create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf
  create mode 100644 OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c
  create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c




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

View/Reply Online (#57524): https://edk2.groups.io/g/devel/message/57524
Mute This Topic: https://groups.io/mt/73085501/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v1 1/1] NetworkPkg/SnpDxe: Prevent invalid PCI BAR access

2020-04-17 Thread Maciej Rabeda

Reviewed-by: Maciej Rabeda 

On 17-Apr-20 04:51, Siyuan, Fu wrote:

Reviewed-by: Siyuan Fu 


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael
Kubacki
Sent: 2020年4月9日 11:02
To: devel@edk2.groups.io
Cc: Fu, Siyuan ; Maciej Rabeda
; Wu, Jiaxin 
Subject: [edk2-devel] [PATCH v1 1/1] NetworkPkg/SnpDxe: Prevent invalid PCI
BAR access

From: Michael Kubacki 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1563

SnpDxe initializes values for MemoryBarIndex and IoBarIndex to 0 and 1
respectively even if calls to PciIo->GetBarAttributes never return
success.

Later, if the BAR is used to perform IO/Mem reads/writes, a potentially
non-existent BAR index may be accessed. This change initializes the values
to an invalid BAR index (PCI_MAX_BAR) so the condition can be explicitly
checked to avoid an invalid BAR access.

Cc: Siyuan Fu 
Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Signed-off-by: Michael Kubacki 
---
  NetworkPkg/SnpDxe/Callback.c | 77 
  NetworkPkg/SnpDxe/Snp.c  |  5 +-
  2 files changed, 48 insertions(+), 34 deletions(-)

diff --git a/NetworkPkg/SnpDxe/Callback.c b/NetworkPkg/SnpDxe/Callback.c
index 0c0b81fdca8e..99b7fd3ef835 100644
--- a/NetworkPkg/SnpDxe/Callback.c
+++ b/NetworkPkg/SnpDxe/Callback.c
@@ -4,6 +4,7 @@
stores the interface context for the NIC that snp is trying to talk.

  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
  SPDX-License-Identifier: BSD-2-Clause-Patent

  **/
@@ -115,47 +116,59 @@ SnpUndi32CallbackMemio (

switch (ReadOrWrite) {
case PXE_IO_READ:
-Snp->PciIo->Io.Read (
- Snp->PciIo,
- Width,
- Snp->IoBarIndex,  // BAR 1 (for 32bit regs), IO base 
address
- MemOrPortAddr,
- 1,// count
- (VOID *) (UINTN) BufferPtr
- );
+ASSERT (Snp->IoBarIndex < PCI_MAX_BAR);
+if (Snp->IoBarIndex < PCI_MAX_BAR) {
+  Snp->PciIo->Io.Read (
+   Snp->PciIo,
+   Width,
+   Snp->IoBarIndex,  // BAR 1 (for 32bit regs), IO 
base address
+   MemOrPortAddr,
+   1,// count
+   (VOID *) (UINTN) BufferPtr
+   );
+}
  break;

case PXE_IO_WRITE:
-Snp->PciIo->Io.Write (
- Snp->PciIo,
- Width,
- Snp->IoBarIndex,  // BAR 1 (for 32bit regs), IO base 
address
- MemOrPortAddr,
- 1,// count
- (VOID *) (UINTN) BufferPtr
- );
+ASSERT (Snp->IoBarIndex < PCI_MAX_BAR);
+if (Snp->IoBarIndex < PCI_MAX_BAR) {
+  Snp->PciIo->Io.Write (
+   Snp->PciIo,
+   Width,
+   Snp->IoBarIndex,  // BAR 1 (for 32bit regs), IO 
base address
+   MemOrPortAddr,
+   1,// count
+   (VOID *) (UINTN) BufferPtr
+   );
+}
  break;

case PXE_MEM_READ:
-Snp->PciIo->Mem.Read (
-  Snp->PciIo,
-  Width,
-  Snp->MemoryBarIndex,  // BAR 0, Memory base address
-  MemOrPortAddr,
-  1,// count
-  (VOID *) (UINTN) BufferPtr
-  );
+ASSERT (Snp->MemoryBarIndex < PCI_MAX_BAR);
+if (Snp->MemoryBarIndex < PCI_MAX_BAR) {
+  Snp->PciIo->Mem.Read (
+Snp->PciIo,
+Width,
+Snp->MemoryBarIndex,  // BAR 0, Memory base address
+MemOrPortAddr,
+1,// count
+(VOID *) (UINTN) BufferPtr
+);
+}
  break;

case PXE_MEM_WRITE:
-Snp->PciIo->Mem.Write (
-  Snp->PciIo,
-  Width,
-  Snp->MemoryBarIndex,  // BAR 0, Memory base address
-  MemOrPortAddr,
-  1,// count
-  (VOID *) (UINTN) BufferPtr
-  );
+ASSERT (Snp->MemoryBarIndex < PCI_MAX_BAR);
+if (Snp->MemoryBarIndex < PCI_MAX_BAR) {
+  Snp->PciIo->Mem.Write (
+Snp->PciIo,
+Width,
+Snp->MemoryBarIndex,  // BAR 0, Memory base address
+MemOrPortAddr,
+1,// count
+(VOID *) (UINTN) BufferPtr
+);
+}
  break;
}

diff --git a/NetworkPkg/SnpDxe/Snp.c b/NetworkPkg/SnpDxe/Snp.c
index 

Re: [edk2-devel] [PATCH v1 1/1] NetworkPkg/Ip6Dxe: Validate source data record length

2020-04-17 Thread Maciej Rabeda

Reviewed-by: Maciej Rabeda 

On 09-Apr-20 10:22, Siyuan, Fu wrote:

Reviewed-by: Siyuan Fu 


-Original Message-
From: michael.kuba...@outlook.com 
Sent: 2020年4月8日 13:47
To: devel@edk2.groups.io
Cc: Fu, Siyuan ; Maciej Rabeda
; Wu, Jiaxin 
Subject: [PATCH v1 1/1] NetworkPkg/Ip6Dxe: Validate source data record
length

From: Michael Kubacki 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2273

Ip6ConfigReadConfigData() reads configuration data from a UEFI variable
and copies the data to another buffer. This change checks that the length
of the data record being copied does not exceed the size of the source
UEFI variable data buffer.

If the size is exceeded, this change follows existing logic to treat the
variable as corrupted and deletes the variable so it will be set again.

Cc: Siyuan Fu 
Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Signed-off-by: Michael Kubacki 
---
  NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 47 +---
  1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
index eb2a80b64f15..ab3801336912 100644
--- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
+++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
@@ -2,6 +2,7 @@
The implementation of EFI IPv6 Configuration Protocol.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) Microsoft Corporation.

SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -390,24 +391,9 @@ Ip6ConfigReadConfigData (
  );
  if (EFI_ERROR (Status) || (UINT16) (~NetblockChecksum ((UINT8 *)
Variable, (UINT32) VarSize)) != 0) {
//
-  // GetVariable still error or the variable is corrupted.
-  // Fall back to the default value.
+  // GetVariable error or the variable is corrupted.
//
-  FreePool (Variable);
-
-  //
-  // Remove the problematic variable and return EFI_NOT_FOUND, a new
-  // variable will be set again.
-  //
-  gRT->SetVariable (
- VarName,
- ,
- IP6_CONFIG_VARIABLE_ATTRIBUTE,
- 0,
- NULL
- );
-
-  return EFI_NOT_FOUND;
+  goto Error;
  }

  //
@@ -432,7 +418,12 @@ Ip6ConfigReadConfigData (
if (!DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_SIZE_FIXED)) {
  //
  // This data item has variable length data.
+// Check that the length is contained within the variable before
allocating.
  //
+if (DataRecord.DataSize > VarSize - DataRecord.Offset) {
+  goto Error;
+}
+
  DataItem->Data.Ptr = AllocatePool (DataRecord.DataSize);
  if (DataItem->Data.Ptr == NULL) {
//
@@ -454,6 +445,28 @@ Ip6ConfigReadConfigData (
}

return Status;
+
+Error:
+  //
+  // Fall back to the default value.
+  //
+  if (Variable != NULL) {
+FreePool (Variable);
+  }
+
+  //
+  // Remove the problematic variable and return EFI_NOT_FOUND, a new
+  // variable will be set again.
+  //
+  gRT->SetVariable (
+ VarName,
+ ,
+ IP6_CONFIG_VARIABLE_ATTRIBUTE,
+ 0,
+ NULL
+ );
+
+  return EFI_NOT_FOUND;
  }

  /**
--
2.16.3.windows.1







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

View/Reply Online (#57522): https://edk2.groups.io/g/devel/message/57522
Mute This Topic: https://groups.io/mt/72868597/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 1/6] OvmfPkg/ResetSystemLib: wrap long lines

2020-04-17 Thread Laszlo Ersek
Wrap the source code and the INF file at 79 characters.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf |  3 ++-
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   | 20 +++-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index 2f24dac87faf..063dc49f2453 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -15,7 +15,8 @@ [Defines]
   LIBRARY_CLASS  = ResetSystemLib
 
 #
-# The following information is for reference only and not required by the 
build tools.
+# The following information is for reference only and not required by the build
+# tools.
 #
 #  VALID_ARCHITECTURES   = IA32 X64
 #
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 2f2e1293a3ef..b3abda80e75a 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -103,10 +103,11 @@ ResetShutdown (
 
 /**
   This function causes a systemwide reset. The exact type of the reset is
-  defined by the EFI_GUID that follows the Null-terminated Unicode string 
passed
-  into ResetData. If the platform does not recognize the EFI_GUID in ResetData
-  the platform must pick a supported reset type to perform.The platform may
-  optionally log the parameters from any non-normal reset that occurs.
+  defined by the EFI_GUID that follows the Null-terminated Unicode string
+  passed into ResetData. If the platform does not recognize the EFI_GUID in
+  ResetData the platform must pick a supported reset type to perform.The
+  platform may optionally log the parameters from any non-normal reset that
+  occurs.
 
   @param[in]  DataSize   The size, in bytes, of ResetData.
   @param[in]  ResetData  The data buffer starts with a Null-terminated string,
@@ -128,11 +129,12 @@ ResetPlatformSpecific (
   @param[in] ResetType  The type of reset to perform.
   @param[in] ResetStatusThe status code for the reset.
   @param[in] DataSize   The size, in bytes, of ResetData.
-  @param[in] ResetData  For a ResetType of EfiResetCold, EfiResetWarm, or 
EfiResetShutdown
-the data buffer starts with a Null-terminated 
string, optionally
-followed by additional binary data. The string is 
a description
-that the caller may use to further indicate the 
reason for the
-system reset.
+  @param[in] ResetData  For a ResetType of EfiResetCold, EfiResetWarm, or
+EfiResetShutdown the data buffer starts with a
+Null-terminated string, optionally followed by
+additional binary data. The string is a description
+that the caller may use to further indicate the
+reason for the system reset.
 **/
 VOID
 EFIAPI
-- 
2.19.1.3.g30247aa5d201



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

View/Reply Online (#57518): https://edk2.groups.io/g/devel/message/57518
Mute This Topic: https://groups.io/mt/73085503/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 3/6] OvmfPkg/ResetSystemLib: improve coding style in ResetSystem()

2020-04-17 Thread Laszlo Ersek
The cases under ResetSystem() currently mix "break"s with "return"s for no
good reason. Use "break" consistently.

(The inconsistency was introduced in commit 84c0b80de716,
"OvmfPkg/ResetSystemLib: Add new API ResetSystem", 2019-04-28.)

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 23816183a953..0fc142325ece 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -157,13 +157,13 @@ ResetSystem (
 
   case EfiResetShutdown:
 ResetShutdown ();
-return;
+break;
 
   case EfiResetPlatformSpecific:
 ResetPlatformSpecific (DataSize, ResetData);
-return;
+break;
 
   default:
-return;
+break;
   }
 }
-- 
2.19.1.3.g30247aa5d201



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

View/Reply Online (#57517): https://edk2.groups.io/g/devel/message/57517
Mute This Topic: https://groups.io/mt/73085502/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 5/6] OvmfPkg/ResetSystemLib: rename to BaseResetSystemLib

2020-04-17 Thread Laszlo Ersek
In preparation for introducing DxeResetSystemLib, rename the current
(only) ResetSystemLib instance to BaseResetSystemLib.

In the DSC files, keep the ResetSystemLib resolution in the same
[LibraryClasses] section, but move it near the TimerLib resolution, as the
differences between the ResetSystemLib instances will mostly follow those
seen under OvmfPkg/Library/AcpiTimerLib.

(While OvmfXen does not use "OvmfPkg/Library/AcpiTimerLib", perform the
same movement there too, for keeping future DSC diffing simple.)

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32.dsc   
| 2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc
| 2 +-
 OvmfPkg/OvmfPkgX64.dsc
| 2 +-
 OvmfPkg/OvmfXen.dsc   
| 2 +-
 OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf => BaseResetSystemLib.inf} 
| 6 +++---
 OvmfPkg/Library/ResetSystemLib/{ResetShutdown.c => BaseResetShutdown.c}   
| 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index cbc5f0e583bc..cd0ed34e0e5a 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -114,6 +114,7 @@ [SkuIds]
 [LibraryClasses]
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
+  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
@@ -176,7 +177,6 @@ [LibraryClasses]
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
 !endif
 
-  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6d69cc6cb56f..3c377c6e858e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -118,6 +118,7 @@ [SkuIds]
 [LibraryClasses]
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
+  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
@@ -180,7 +181,6 @@ [LibraryClasses]
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
 !endif
 
-  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 5ad4f461ce52..701a7ccea987 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -118,6 +118,7 @@ [SkuIds]
 [LibraryClasses]
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
+  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
@@ -180,7 +181,6 @@ [LibraryClasses]
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
 !endif
 
-  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 47ee8db8b884..86b24d1716b9 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -110,6 +110,7 @@ [SkuIds]
 [LibraryClasses]
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf
+  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
@@ -169,7 +170,6 @@ [LibraryClasses]
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
 !endif
 
-  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
   

[edk2-devel] [PATCH 6/6] OvmfPkg/ResetSystemLib: introduce the DxeResetSystemLib instance

2020-04-17 Thread Laszlo Ersek
The BaseResetSystemLib instance is not suitable for OS runtime, because
its ResetShutdown() implementation calls PciRead16 (OVMF_HOSTBRIDGE_DID).
On q35, this boils down to a memory-mapped config space access -- but we
never ask the OS to map MMCONFIG for runtime.

There are at least three alternatives to approach this:

(1) Investigate "MdePkg/Library/DxeRuntimePciExpressLib", which offers
some kind of runtime mapping for MMCONFIG.

(2) Consume PciCf8Lib directly, rather than PciLib, in ResetSystemLib.
Then we'll read OVMF_HOSTBRIDGE_DID from the config space with IO port
accesses on q35 too, not just on i440fx. IO ports don't depend on page
tables.

(3) In the lib constructor, cache "mAcpiPmBaseAddress" based on
"PcdOvmfHostBridgePciDevId" (which is set by PlatformPei). Then the
host bridge type will be known at runtime without PCI config space
accesses.

This patch follows approach (3), in order to mirror AcpiTimerLib.

Notes:

* This patch is best viewed with "git show --find-copies-harder -C43".

* PCDs are not usable in the DXE_CORE, as the PCD PPI is gone, and the PCD
  protocol is not available yet. (The DXE_CORE does consume ResetSystemLib
  in practice, when OVMF is built with -D SOURCE_DEBUG_ENABLE.)

* The bug is not easy to trigger in common setups, because e.g. the Linux
  guest cannot easily be convinced to use the EFI runtime service for
  poweroff. One way to trigger the bug is to (a) patch OVMF as follows:

> diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
> b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
> index fe51f53d1df2..1edc4349ad20 100644
> --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
> +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
> @@ -28,6 +28,7 @@ ResetCold (
>VOID
>)
>  {
> +  ResetShutdown ();
>IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST
>MicroSecondDelay (50);

  (b) boot a Linux guest with "reboot=efi" on q35, and (c) reboot the
  guest with the "reboot" command. Then the guest kernel will log:

> reboot: Restarting system
> reboot: machine restart
> [ cut here ]
> [Firmware Bug]: Page fault caused by firmware at PA: 0xb002
> WARNING: CPU: 0 PID: 1362 at arch/x86/platform/efi/quirks.c:738
> efi_recover_from_page_fault+0x2a/0xc8
> Modules linked in: ip_set nfnetlink sunrpc vfat fat intel_rapl_msr
> intel_rapl_common kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul
> bochs_drm drm_vram_helper ttm ghash_clmulni_intel drm_kms_helper
> iTCO_wdt iTCO_vendor
> CPU: 0 PID: 1362 Comm: reboot Not tainted 5.3.6-200.fc30.x86_64 #1
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0
> 02/06/2015
> RIP: 0010:efi_recover_from_page_fault+0x2a/0xc8
> Code: 0f 1f 44 00 00 8b 15 35 c2 c1 01 85 d2 74 09 48 81 ff ff 0f 00 00
> 77 01 c3 53 48 89 fe 48 c7 c7 58 ba 12 aa 50 e8 74 f0 00 00 <0f> 0b 83
> 3d 0d c2 c1 01 0a 0f 84 8f 00 00 00 48 8b 05 70 c8 4a 01
> RSP: 0018:af3a402539d8 EFLAGS: 00010286
> RAX:  RBX: 8a3c33711f40 RCX: 03b2
> RDX: 0001 RSI: 0096 RDI: 0246
> RBP: af3a40253a88 R08:  R09: 03b2
> R10: 0001 R11: a9ee3800 R12: b002
> R13:  R14: 000b R15: 0001
> FS:  7fbca9cf8940() GS:8a3c3ae0()
> knlGS:
> CS:  0010 DS:  ES:  CR0: 80050033
> CR2: fffeff8a67a1 CR3: 72868006 CR4: 001606f0
> Call Trace:
>  no_context+0x15b/0x380
>  ? do_user_addr_fault+0x12e/0x440
>  do_page_fault+0x31/0x110
>  async_page_fault+0x3e/0x50
> RIP: 0010:0xfffeff8a67a1
> Code: Bad RIP value.
> RSP: 0018:af3a40253b30 EFLAGS: 00010046
> RAX: b002 RBX:  RCX: b002
> RDX: b000 RSI:  RDI: fffeff8a80f0
> RBP: af3a40253b60 R08: fffeff8aadb8 R09: 
> R10: aa5762c0 R11: a9ee3800 R12: 
> R13:  R14: 0046 R15: 
>  ? efi_call+0x58/0x90
>  ? virt_efi_reset_system+0x8d/0x100
>  ? efi_reboot+0x85/0xb8
>  ? native_machine_emergency_restart+0x9f/0x250
>  ? native_apic_msr_read+0x16/0x20
>  ? disconnect_bsp_APIC+0x8c/0xd0
>  ? __do_sys_reboot+0x1d2/0x210
>  ? __fput+0x168/0x250
>  ? do_writev+0x6b/0x110
>  ? do_syscall_64+0x5f/0x1a0
>  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
> ---[ end trace d5bee708166d198b ]---
> efi: efi_reset_system() buggy! Reboot through BIOS

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32.dsc
  |  6 +++
 OvmfPkg/OvmfPkgIa32X64.dsc 
  |  6 +++
 

[edk2-devel] [PATCH 4/6] OvmfPkg/ResetSystemLib: factor out ResetShutdown()

2020-04-17 Thread Laszlo Ersek
Move the ResetShutdown() definition to its own file. This will help us
introduce:

- a new library instance that is not broken in runtime modules (the
  current library instance is broken in runtime modules),

- another new library instance for bhyve support.

While at it, squash AcpiPmControl() into ResetShutdown(), open-coding
SuspendType=0. This is justified because we've had no other callers for
AcpiPmControl() since commit 2d9950a2bff8 ("OvmfPkg: remove
EnterS3WithImmediateWake () from ResetSystemLib", 2020-01-10).

Tested with the "reset -s" UEFI shell command, on both i440fx and q35.

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf |  1 +
 OvmfPkg/Library/ResetSystemLib/ResetShutdown.c| 51 
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   | 49 ---
 3 files changed, 52 insertions(+), 49 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index af20f516c035..9362f884f124 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -22,6 +22,7 @@ [Defines]
 #
 
 [Sources]
+  ResetShutdown.c
   ResetSystemLib.c
 
 [Packages]
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c 
b/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c
new file mode 100644
index ..971d94fa5766
--- /dev/null
+++ b/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c
@@ -0,0 +1,51 @@
+/** @file
+  Reset System Library Shutdown API implementation for OVMF.
+
+  Copyright (C) 2020, Red Hat, Inc.
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include// BIT13
+
+#include // CpuDeadLoop()
+#include// ASSERT()
+#include   // IoOr16()
+#include  // PciRead16()
+#include  // ResetShutdown()
+#include   // OVMF_HOSTBRIDGE_DID
+
+/**
+  Calling this function causes the system to enter a power state equivalent
+  to the ACPI G2/S5 or G3 states.
+
+  System shutdown should not return, if it returns, it means the system does
+  not support shut down reset.
+**/
+VOID
+EFIAPI
+ResetShutdown (
+  VOID
+  )
+{
+  UINT16 AcpiPmBaseAddress;
+  UINT16 HostBridgeDevId;
+
+  AcpiPmBaseAddress = 0;
+  HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
+  switch (HostBridgeDevId) {
+  case INTEL_82441_DEVICE_ID:
+AcpiPmBaseAddress = PIIX4_PMBA_VALUE;
+break;
+  case INTEL_Q35_MCH_DEVICE_ID:
+AcpiPmBaseAddress = ICH9_PMBASE_VALUE;
+break;
+  default:
+ASSERT (FALSE);
+CpuDeadLoop ();
+  }
+
+  IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0);
+  IoOr16 (AcpiPmBaseAddress + 4, BIT13);
+  CpuDeadLoop ();
+}
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 0fc142325ece..fe51f53d1df2 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -9,41 +9,9 @@
 #include// BIT1
 
 #include // CpuDeadLoop()
-#include// ASSERT()
 #include   // IoWrite8()
-#include  // PciRead16()
 #include  // ResetCold()
 #include// MicroSecondDelay()
-#include   // OVMF_HOSTBRIDGE_DID
-
-VOID
-AcpiPmControl (
-  UINTN SuspendType
-  )
-{
-  UINT16 AcpiPmBaseAddress;
-  UINT16 HostBridgeDevId;
-
-  ASSERT (SuspendType < 6);
-
-  AcpiPmBaseAddress = 0;
-  HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
-  switch (HostBridgeDevId) {
-  case INTEL_82441_DEVICE_ID:
-AcpiPmBaseAddress = PIIX4_PMBA_VALUE;
-break;
-  case INTEL_Q35_MCH_DEVICE_ID:
-AcpiPmBaseAddress = ICH9_PMBASE_VALUE;
-break;
-  default:
-ASSERT (FALSE);
-CpuDeadLoop ();
-  }
-
-  IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, (UINT16) SuspendType);
-  IoOr16 (AcpiPmBaseAddress + 4, BIT13);
-  CpuDeadLoop ();
-}
 
 /**
   Calling this function causes a system-wide reset. This sets
@@ -84,23 +52,6 @@ ResetWarm (
   CpuDeadLoop ();
 }
 
-/**
-  Calling this function causes the system to enter a power state equivalent
-  to the ACPI G2/S5 or G3 states.
-
-  System shutdown should not return, if it returns, it means the system does
-  not support shut down reset.
-**/
-VOID
-EFIAPI
-ResetShutdown (
-  VOID
-  )
-{
-  AcpiPmControl (0);
-  ASSERT (FALSE);
-}
-
 
 /**
   This function causes a systemwide reset. The exact type of the reset is
-- 
2.19.1.3.g30247aa5d201



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

View/Reply Online (#57519): https://edk2.groups.io/g/devel/message/57519
Mute This Topic: https://groups.io/mt/73085505/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  

[edk2-devel] [PATCH 0/6] OvmfPkg/ResetSystemLib: clean up, refactor, fix

2020-04-17 Thread Laszlo Ersek
Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Repo:   https://pagure.io/lersek/edk2.git
Branch: rsl_cleanup

Rebecca's

  [PATCH 02/13] OvmfPkg: support powering off bhyve guests

at

  https://edk2.groups.io/g/devel/message/57450
  
e4e9b29189b83076e1d1a0b9c989938f5226cab6.1586991816.git.rebecca@bsdio.com">http://mid.mail-archive.com/e4e9b29189b83076e1d1a0b9c989938f5226cab6.1586991816.git.rebecca@bsdio.com

made me realize OvmfPkg/ResetSystemLib should be refreshed. This will
let us add a simple bhyve-specific instance (later), and also allows us
to fix a long time dormant bug (now).

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 

Thanks,
Laszlo

Laszlo Ersek (6):
  OvmfPkg/ResetSystemLib: wrap long lines
  OvmfPkg/ResetSystemLib: clean up library dependencies
  OvmfPkg/ResetSystemLib: improve coding style in ResetSystem()
  OvmfPkg/ResetSystemLib: factor out ResetShutdown()
  OvmfPkg/ResetSystemLib: rename to BaseResetSystemLib
  OvmfPkg/ResetSystemLib: introduce the DxeResetSystemLib instance

 OvmfPkg/OvmfPkgIa32.dsc   
|  8 +-
 OvmfPkg/OvmfPkgIa32X64.dsc
|  8 +-
 OvmfPkg/OvmfPkgX64.dsc
|  8 +-
 OvmfPkg/OvmfXen.dsc   
|  6 +-
 OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf => BaseResetSystemLib.inf} 
| 12 ++-
 OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf  
| 43 ++
 OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c
| 51 
 OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c 
| 62 +++
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   
| 84 +---
 9 files changed, 209 insertions(+), 73 deletions(-)
 rename OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf => 
BaseResetSystemLib.inf} (65%)
 create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf
 create mode 100644 OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c
 create mode 100644 OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c

-- 
2.19.1.3.g30247aa5d201


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

View/Reply Online (#57516): https://edk2.groups.io/g/devel/message/57516
Mute This Topic: https://groups.io/mt/73085501/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 2/6] OvmfPkg/ResetSystemLib: clean up library dependencies

2020-04-17 Thread Laszlo Ersek
Annotate the #include directives with the interfaces that this lib
instance needs from the included lib class headers. This will help us keep
the #include set minimal, when we move code around later.

While at it, synchronize the [LibraryClasses] section with the #include
directives -- list BaseLib.

Also #include the ResetSystemLib class header, which declares the
interfaces that this lib instance implements.

This forces us to spell out the "MdeModulePkg.dec" dependency too, under
[Packages].

Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Philippe Mathieu-Daudé 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf |  2 ++
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   | 15 ---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index 063dc49f2453..af20f516c035 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -25,10 +25,12 @@ [Sources]
   ResetSystemLib.c
 
 [Packages]
+  MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
+  BaseLib
   DebugLib
   IoLib
   PciLib
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index b3abda80e75a..23816183a953 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -6,14 +6,15 @@
 
 **/
 
-#include 
+#include// BIT1
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include // CpuDeadLoop()
+#include// ASSERT()
+#include   // IoWrite8()
+#include  // PciRead16()
+#include  // ResetCold()
+#include// MicroSecondDelay()
+#include   // OVMF_HOSTBRIDGE_DID
 
 VOID
 AcpiPmControl (
-- 
2.19.1.3.g30247aa5d201



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

View/Reply Online (#57515): https://edk2.groups.io/g/devel/message/57515
Mute This Topic: https://groups.io/mt/73085500/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 00/13] BhyvePkg - initial patch series for review

2020-04-17 Thread Rebecca Cran

On 4/17/20 1:55 AM, Laszlo Ersek wrote:


Indeed I can't apply these patches with git-am, without some manual
hacking. Lines in the patches are terminated with .

Please run "BaseTools/Scripts/SetupGit.py" in your edk2 clone.


Ugh, sorry I thought I'd fixed that. I'll fix my editors and send 
another version out in the next day or so.



--

Rebecca Cran



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

View/Reply Online (#57514): https://edk2.groups.io/g/devel/message/57514
Mute This Topic: https://groups.io/mt/73045166/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for 
Manifest Repo data

Added functions to get the URL, LocalPath, Branch and the absolute path for 
individual manifest repositories to the BaseConfig class.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 37 +
 1 file changed, 37 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index a4daba3..022e0bb 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -131,6 +131,43 @@ class BaseConfig():
 repo_props.append(prop)
 return repo_props
 
+def get_manifest_repo_url(self, manifest_repo):
+""" 
+Returns the URL value for a given manifest repo based on config
+file contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'URL' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def get_manifest_repo_branch(self, manifest_repo):
+"""
+Returns the Branch value for a given manifest repo based on config file
+contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'Branch' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def get_manifest_repo_local_path(self, manifest_repo):
+"""
+Returns the Local path value for a given manifest repo based on config
+file contents.
+"""
+for prop in self.manifest_repo_props(manifest_repo):
+if 'LocalPath' == prop.key:
+return self.cfg[prop.section][prop.key]
+return None
+
+def manifest_repo_abs_path(self, manifest_repo):
+"""
+Returns the absolute path of a single manifest repo based on config
+file contents and the global_data_dir location.
+"""
+return os.path.join(self.global_data_dir, 
+ self.get_manifest_repo_local_path(manifest_repo))
+
 class GlobalConfig(BaseConfig):
 """
 Class access structure for the edkrepo.cfg file.  This file is read only 
and maintained by the
--
2.16.2.windows.1


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

View/Reply Online (#57513): https://edk2.groups.io/g/devel/message/57513
Mute This Topic: https://groups.io/mt/73070624/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list 
property to BaseConfig

Add the manifest_repo_list property to the BaseConfig class to return a list of 
manfiest repo sections in the config file.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6c14f1b..6f89589 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -113,6 +113,12 @@ class BaseConfig():
 with open(self.filename, 'w') as cfg_stream:
 self.cfg.write(cfg_stream)
 
+@property
+def manifest_repo_list(self):
+"""Returns a list of available manifest repos"""
+if self.cfg.has_section('manifest-repos'):
+return self.cfg.options('manifest-repos')
+
 class GlobalConfig(BaseConfig):
 """
 Class access structure for the edkrepo.cfg file.  This file is read only 
and maintained by the
--
2.16.2.windows.1


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

View/Reply Online (#57512): https://edk2.groups.io/g/devel/message/57512
Mute This Topic: https://groups.io/mt/73070621/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format 
Defining Multiple Manifest Repos

Add support for the following cfg format to the BaseConfig class enabling it to 
be consumed by both the Global and User configuration file classes. CfgProps 
for each listed manifest repository will be dynamically added to the classes 
prop_list.

Configuration Example:

[Manifest_A]
...

[Manifest_B]
...

[manifest-repos]
Manifest_A
Manifest_B

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index c342838..6c14f1b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -85,6 +85,12 @@ class BaseConfig():
 if os.path.isfile(self.filename):
 self.cfg.read(self.filename)
 
+if self.cfg.has_section('manifest-repos'):
+for option in self.cfg.options('manifest-repos'):
+self.prop_list.append(CfgProp('{}'.format(option), 'URL', 
'{}-manifest_repo_url.'.format(option), None, False))
+self.prop_list.append(CfgProp('{}'.format(option), 'Branch', 
'{}-manifest_repo_branch'.format(option), None, False))
+self.prop_list.append(CfgProp('{}'.format(option), 
+ 'LocalPath', '{}-manifest_repo_local_path.'.format(option), None, 
+ False))
+
 # Create properties defined by the prop_list
 cfg_updated = False
 for prop in self.prop_list:
--
2.16.2.windows.1


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

View/Reply Online (#57511): https://edk2.groups.io/g/devel/message/57511
Mute This Topic: https://groups.io/mt/73070620/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data 
directory to BaseConfig

Move the edkrepo_global_data_directory from the GlobalConfig class to the base 
config class.

Updated the assignments of self.filename in both the GlobalConfig and the 
GlobalUserConfig classes as well as the initializaion of the BaseConfig class 
to use get_edkrepo_global_data_directory()

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index e053f8b..a4daba3 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -77,10 +77,11 @@ class BaseConfig():
 for the class.  Property generation and verification is based off of a 
list of CfgProp classes.
 """
 prop_list = []
-def __init__(self, filename, read_only=True):
+def __init__(self, filename, global_data_dir, read_only=True):
 # Do basic initialization of private variables
 self.read_only = read_only
 self.filename = filename
+self.global_data_dir = global_data_dir
 self.cfg = configparser.ConfigParser(allow_no_value=True, 
delimiters='=')
 if os.path.isfile(self.filename):
 self.cfg.read(self.filename) @@ -136,8 +137,7 @@ class 
GlobalConfig(BaseConfig):
 edkrepo installer.
 """
 def __init__(self):
-self.edkrepo_global_data_directory = 
get_edkrepo_global_data_directory()
-self.filename = os.path.join(self.edkrepo_global_data_directory, 
"edkrepo.cfg")
+self.filename = 
+ os.path.join(get_edkrepo_global_data_directory(), "edkrepo.cfg")
 self.prop_list = [
 CfgProp('manifest-repo', 'URL', 'manifest_repo_url', None, 
True),
 CfgProp('manifest-repo', 'Branch', 'manifest_repo_branch', 
None, True), @@ -152,7 +152,7 @@ class GlobalConfig(BaseConfig):
 CfgProp('preferred-entry-point', 'entry-point', 
'pref_entry_point', None, True)]
 if not os.path.isfile(self.filename):
 raise 
EdkrepoGlobalConfigNotFoundException(humble.GLOBAL_CFG_NOT_FOUND.format(self.filename))
-super().__init__(self.filename, True)
+super().__init__(self.filename, 
+ get_edkrepo_global_data_directory(), True)
 
 @property
 def preferred_entry(self):
@@ -169,7 +169,7 @@ class GlobalConfig(BaseConfig):
 @property
 def manifest_repo_abs_local_path(self):
 """Provides an absolute path to the manifest repo based on 
configuration file values."""
-return os.path.join(self.edkrepo_global_data_directory, 
self.manifest_repo_local_path)
+return os.path.join(self.global_data_dir, 
+ self.manifest_repo_local_path)
 
 @property
 def sparsecheckout_data(self):
@@ -196,7 +196,7 @@ class GlobalUserConfig(BaseConfig):
 CfgProp('scm', 'mirror_geo', 'geo', 'none', False),
 CfgProp('send-review', 'max-patch-set', 'max_patch_set', '10', 
False)
 ]
-super().__init__(self.filename, False)
+super().__init__(self.filename, 
+ get_edkrepo_global_data_directory(), False)
 
 @property
 def max_patch_set_int(self):
--
2.16.2.windows.1


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

View/Reply Online (#57510): https://edk2.groups.io/g/devel/message/57510
Mute This Topic: https://groups.io/mt/73070623/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()

2020-04-17 Thread Bjorge, Erik C
Why is this not a list comprehension?

return [x for x in self.prop_list if manifest_repo in x.name]

-Original Message-
From: Desimone, Ashley E  
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()

Add the manifest_repo_props() function to the BaseConfig class which returns a 
list of all CfgProp objects for a given manifest repository.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/config/config_factory.py | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6f89589..e053f8b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -118,6 +118,17 @@ class BaseConfig():
 """Returns a list of available manifest repos"""
 if self.cfg.has_section('manifest-repos'):
 return self.cfg.options('manifest-repos')
+
+def manifest_repo_props(self, manifest_repo):
+"""
+Returns a list of cfg_prop objects that pertain to a given manifest
+repo
+"""
+repo_props = []
+for prop in self.prop_list:
+if manifest_repo in prop.name:
+repo_props.append(prop)
+return repo_props
 
 class GlobalConfig(BaseConfig):
 """
--
2.16.2.windows.1


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

View/Reply Online (#57509): https://edk2.groups.io/g/devel/message/57509
Mute This Topic: https://groups.io/mt/73070622/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg

2020-04-17 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

-Original Message-
From: Desimone, Ashley E  
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Pandya, Puja 
; Bjorge, Erik C ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to 
edkrepo.cfg

Add manifest-repos and edk2-staging sections to the edkrepo.cfg to enable 
support of multiple manifest repositories.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo_installer/Vendor/edkrepo.cfg | 8 
 1 file changed, 8 insertions(+)

diff --git a/edkrepo_installer/Vendor/edkrepo.cfg 
b/edkrepo_installer/Vendor/edkrepo.cfg
index 7dcaf20..97ebdd2 100644
--- a/edkrepo_installer/Vendor/edkrepo.cfg
+++ b/edkrepo_installer/Vendor/edkrepo.cfg
@@ -1,3 +1,11 @@
+[manifest-repos]
+edk2-staging =
+
+[edk2-staging]
+URL = https://github.com/tianocore/edk2-staging.git
+Branch = EdkRepo-Manifest
+LocalPath = edk2-staging-manifest-master
+
 [manifest-repo]
 URL = https://github.com/tianocore/edk2-staging.git
 Branch = EdkRepo-Manifest
--
2.16.2.windows.1


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

View/Reply Online (#57508): https://edk2.groups.io/g/devel/message/57508
Mute This Topic: https://groups.io/mt/73070619/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-test PATCH] SctPkg: Updated Start Address Alignment code

2020-04-17 Thread Samer El-Haj-Mahmoud
Gaurav,

You sent to the old list. Adding the new edk2-devel list


> 
> > -Original Message-
> > From: Gaurav Jain 
> > Sent: Friday, April 17, 2020 2:55 AM
> > To: edk2-de...@lists.01.org
> > Cc: Eric Jin ; Supreeth Venkatesh
> > ; Samer El-Haj-Mahmoud  > mahm...@arm.com>; Prasanth Pulla ; Pankaj
> > Bansal 
> > Subject: RE: [edk2-test PATCH] SctPkg: Updated Start Address Alignment
> > code
> >
> > Hi
> >
> > Gentle Reminder!!
> > Please help to review patch.
> >
> > Regards
> > Gaurav Jain
> >
> > > -Original Message-
> > > From: Gaurav Jain 
> > > Sent: Thursday, April 9, 2020 6:33 PM
> > > To: edk2-de...@lists.01.org
> > > Cc: Eric Jin ; Supreeth Venkatesh
> > > ; Samer El-Haj-Mahmoud  > > mahm...@arm.com>; Prasanth Pulla ; Pankaj
> > > Bansal ; Gaurav Jain 
> > > Subject: [edk2-test PATCH] SctPkg: Updated Start Address Alignment
> > > code
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2671
> > >
> > > AllocatePages Functionality test.
> > > Updated Start Address Calculation for aligning to 64k.
> > >
> > > Signed-off-by: Gaurav Jain 
> > > ---
> > >  .../BlackBoxTest/MemoryAllocationServicesBBTestFunction.c  | 14
> > > +++--
> > > -
> > >  1 file changed, 7 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/uefi-
> > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/B
> > > la ck BoxTest/MemoryAllocationServicesBBTestFunction.c b/uefi-
> > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/B
> > > la ck BoxTest/MemoryAllocationServicesBBTestFunction.c
> > > index d18fe1f..a42cd9a 100644
> > > --- a/uefi-
> > > sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/B
> > > la ck BoxTest/MemoryAllocationServicesBBTestFunction.c
> > > +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocatio
> > > +++ nS er
> > > +++ vices/BlackBoxTest/MemoryAllocationServicesBBTestFunction.c
> > > @@ -706,7 +706,7 @@ BBTestAllocatePagesInterfaceTest (
> > >  if (PageNum <= 0x10) {
> > >break;
> > >  }
> > > -Start   = (Start + 0x1) & 0x;
> > > +Start   = (Start + 0x) & 0x;
> > >  PageNum = PageNum - EFI_SIZE_TO_PAGES(0x1);
> > >
> > >  Memory  = Start;
> > > @@ -836,7 +836,7 @@ BBTestAllocatePagesInterfaceTest (
> > >  if (PageNum <= 0x10) {
> > >break;
> > >  }
> > > -Start   = (Start + 0x1) & 0x;
> > > +Start   = (Start + 0x) & 0x;
> > >  PageNum = PageNum - EFI_SIZE_TO_PAGES(0x1);
> > >
> > >  Memory  = Start;
> > > @@ -959,7 +959,7 @@ BBTestAllocatePagesInterfaceTest (
> > >  if (PageNum <= 0x10) {
> > >break;
> > >  }
> > > -Start   = (Start + 0x1) & 0x;
> > > +Start   = (Start + 0x) & 0x;
> > >  PageNum = PageNum - EFI_SIZE_TO_PAGES(0x1);
> > >
> > >  Memory = Start + (SctLShiftU64 (PageNum/3, EFI_PAGE_SHIFT)
> > > & 0x); @@ -1082,7 +1082,7 @@
> > > BBTestAllocatePagesInterfaceTest (
> > >  if (PageNum <= 0x10) {
> > >break;
> > >  }
> > > -Start   = (Start + 0x1) & 0x;
> > > +Start   = (Start + 0x) & 0x;
> > >  PageNum = PageNum - EFI_SIZE_TO_PAGES(0x1);
> > >
> > >  Memory  = Start + (SctLShiftU64 (PageNum * 2 / 3,
> > > EFI_PAGE_SHIFT) & 0x); @@ -1212,7 +1212,7 @@
> > > BBTestAllocatePagesInterfaceTest (
> > >  if (PageNum <= 0x10) {
> > >break;
> > >  }
> > > -Start   = (Start + 0x1) & 0x;
> > > +Start   = (Start + 0x) & 0x;
> > >  PageNum = PageNum - EFI_SIZE_TO_PAGES(0x1);
> > >
> > >  Memory  = Start;
> > > @@ -1335,7 +1335,7 @@ BBTestAllocatePagesInterfaceTest (
> > >  if (PageNum <= 0x10) {
> > >break;
> > >  }
> > > -Start   = (Start + 0x1) & 0x;
> > > +Start   = (Start + 0x) & 0x;
> > >  PageNum = PageNum - EFI_SIZE_TO_PAGES(0x1);
> > >
> > >  Memory  = Start;
> > > @@ -1474,7 +1474,7 @@ BBTestAllocatePagesInterfaceTest (
> > >  if (PageNum <= 0x10) {
> > >break;
> > >  }
> > > -Start   = (Start + 0x1) & 0x;
> > > +Start   = (Start + 0x) & 0x;
> > >  PageNum = PageNum - EFI_SIZE_TO_PAGES(0x1);
> > >
> > >  Memory  = Start;
> > > --
> > > 2.7.4


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

View/Reply Online (#57507): https://edk2.groups.io/g/devel/message/57507
Mute This Topic: https://groups.io/mt/73082849/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  

Re: [edk2-devel] [edk2-platforms: PATCH] MinPlatformPkg/PlatformInitPei: Create Library Instance of ReportCpuHobLib.

2020-04-17 Thread Chiu, Chasel


Pushed: 944af47a8c83115dcd5dae581e5c3770a12a2ed2

Thanks,
Chasel


> -Original Message-
> From: Chaganty, Rangasai V 
> Sent: Friday, April 17, 2020 4:11 PM
> To: Kumar, Chandana C ;
> devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> 
> Subject: RE: [edk2-platforms: PATCH] MinPlatformPkg/PlatformInitPei: Create
> Library Instance of ReportCpuHobLib.
> 
> Reviewed-by: Sai Chaganty 
> 
> -Original Message-
> From: Kumar, Chandana C 
> Sent: Wednesday, April 15, 2020 1:31 AM
> To: devel@edk2.groups.io
> Cc: Chaganty, Rangasai V ; Chiu, Chasel
> ; Desimone, Nathaniel L
> 
> Subject: [edk2-platforms: PATCH] MinPlatformPkg/PlatformInitPei: Create
> Library Instance of ReportCpuHobLib.
> 
> Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
> PA bits reported can be overriden using Library instance in Platform.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2674
> 
> Signed-off-by: Chandana Kumar 
> Cc: Sai Chaganty 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> ---
>  Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
> | 23 +++
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> |  4 +++-
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> |  3 ++-
> 
> Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/Repo
> rtCpuHobLib.c   | 32 
> 
> Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/Repo
> rtCpuHobLib.inf | 27 +++
> 
> Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPre
> Mem.c| 25 ++---
>  6 files changed, 89 insertions(+), 25 deletions(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
> b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
> new file mode 100644
> index 00..79e5d4efb2
> --- /dev/null
> +++ b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
> @@ -0,0 +1,23 @@
> +/** @file
> +
> +  Report CPU HOB library
> +
> +  This library report the CPU HOB with Physical Address bits.
> +
> +Copyright (c) 2020, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef _REPORT_CPU_HOB_LIB_H_
> +#define _REPORT_CPU_HOB_LIB_H_
> +
> +#include 
> +#include 
> +
> +VOID
> +ReportCpuHob (
> +  VOID
> +  )
> +
> +#endif
> diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> index 7f74ac9380..71776dfe80 100644
> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> @@ -68,7 +68,9 @@
>TestPointLib|Include/Library/TestPointLib.h
>TestPointCheckLib|Include/Library/TestPointCheckLib.h
> 
> -SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
> +  SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
> +
> +  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h
> 
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
> 
> diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> index 13a0fda272..b62351dac6 100644
> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> @@ -1,7 +1,7 @@
>  ## @file
>  #  Platform description.
>  #
> -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2017 - 2020, Intel Corporation. All rights
> +reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -92,6 +92,7 @@
>#
> 
> FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrappe
> rPlatformLib/PeiFspWrapperPlatformLib.inf
> 
> ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReport
> FvLib.inf
> +
> +
> ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/R
> e
> + portCpuHobLib.inf
> 
> TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPo
> intCheckLib.inf
> 
> TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
> 
> SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLib
> Null.inf
> diff --git
> a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/Re
> portCpuHobLib.c
> b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/Re
> portCpuHobLib.c
> new file mode 100644
> index 00..aa2565343c
> --- /dev/null
> +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib
> +++ /ReportCpuHobLib.c
> @@ -0,0 +1,32 @@
> +/** @file
> +  Source code file for Report CPU HOB library.
> +
> +Copyright (c) 2020, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include 
> +#include 
> +
> +VOID
> +ReportCpuHob (
> +  VOID
> +  )
> +{
> +  UINT8 PhysicalAddressBits;
> +  UINT32RegEax;
> +
> +  AsmCpuid (0x8000, , NULL, NULL, NULL);  if (RegEax 

Re: [edk2-devel] [PATCH v6 00/42] SEV-ES guest support

2020-04-17 Thread Dong, Eric


> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Lendacky, Thomas
> Sent: Thursday, April 16, 2020 9:47 PM
> To: devel@edk2.groups.io; Dong, Eric 
> Cc: Justen, Jordan L ; Laszlo Ersek
> ; Ard Biesheuvel ; Kinney,
> Michael D ; Gao, Liming
> ; Ni, Ray ; Brijesh Singh
> ; You, Benjamin ; Bi,
> Dandan ; Dong, Guo ; Wu,
> Hao A ; Wang, Jian J ; Ma,
> Maurice 
> Subject: Re: [edk2-devel] [PATCH v6 00/42] SEV-ES guest support
> 
> On 4/14/20 10:30 AM, Dong, Eric via groups.io wrote:
> >>> -Original Message-
> >>> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf
> Of
> >>> Lendacky, Thomas
> >>> Sent: Thursday, April 2, 2020 4:42 AM
> >>> To: Dong, Eric ; devel@edk2.groups.io
> >>> Cc: Justen, Jordan L ; Laszlo Ersek
> >>> ; Ard Biesheuvel ;
> >>> Kinney, Michael D ; Gao, Liming
> >>> ; Ni, Ray ; Brijesh Singh
> >>> ; You, Benjamin ;
> Bi,
> >>> Dandan ; Dong, Guo ;
> Wu,
> >> Hao
> >>> A ; Wang, Jian J ; Ma,
> >>> Maurice 
> >>> Subject: Re: [edk2-devel] [PATCH v6 00/42] SEV-ES guest support
> >>>
> >>> On 3/30/20 7:47 PM, Dong, Eric wrote:
>  Hi Tom,
> 
>  Sorry for late response. It’s a huge patch, please give me two more
>  weeks to detail review them.
> 
>  I have rough go through these patches and have some basic comments
>  for them now:
> 
>  1.It’s better to spit patch if changes files not in same package.
>  Like patch 1/42.
> >>>
> >>> Ok, will do.
> >>>
> 
>  2.All functions need to have comments for them. Miss comments in
>  patch
>  10/42 and others.
> >>>
> >>> Just external functions or both external and internal (STATIC) functions,
> too?
> >>
> >> All the functions.
> >
> > you can use ECC tool to help you find all the coding style related issues.
> > You can reference link
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> ub.com%2Ftianocore%2Ftianocore.github.io%2Fwiki%2FECC-
> tooldata=02%7C01%7Cthomas.lendacky%40amd.com%7C437e3b872cc
> 046cf645208d7e088d6dc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0
> %7C637224752713456520sdata=rjRgLrtyDu2dXoRddbaTWkPtENLLZK93
> MEsmxR36Fkc%3Dreserved=0  to know how to run this tool.
> 
> Thanks for the pointer. I have addressed all issues identified by ECC with
> respect to the code that I have added with these patches.
> 
> Are you waiting for another version with these changes before reviewing
> further? If so, I'll submit that now, otherwise I'll wait for your review
> of the current version.
> 

I have detail go through all your changes, I think it's good and should have no
impact for existing code if we don't enable this feature.

If you already fixed all the ECC issues, please send your new patches. 
I will base on latest code to give my review-by tag. 

Thanks,
Eric

> Thanks,
> Tom
> 
> >
> > Thanks,
> > Eric
> >>
> >> Thanks,
> >> Eric
> >>
> >>>
> >>> Thanks,
> >>> Tom
> >>>
> 
>  Please update patches to fix above basic checks first.
> 
>  Thanks,
> 
>  Eric
> 
>  *From:*devel@edk2.groups.io [mailto:devel@edk2.groups.io] *On
> >> Behalf
>  Of *Lendacky, Thomas
>  *Sent:* Tuesday, March 31, 2020 12:54 AM
>  *To:* devel@edk2.groups.io
>  *Cc:* Justen, Jordan L ; Laszlo Ersek
>  ; Ard Biesheuvel ;
>  Kinney, Michael D ; Gao, Liming
>  ; Dong, Eric ; Ni, Ray
>  ; Brijesh Singh ; You,
>  Benjamin ; Bi, Dandan
> >> ;
>  Dong, Guo ; Wu, Hao A ;
> >>> Wang,
>  Jian J ; Ma, Maurice 
>  *Subject:* Re: [edk2-devel] [PATCH v6 00/42] SEV-ES guest support
> 
>  I've gotten some nice feedback from Laszlo, especially on the
>  OvmfPkg side of this patchset, but haven't seen much response from
>  the other maintainers. Is there any feedback on the MdePkg,
>  MdeModulePkg and UefiCpuPkg changes that needs to be addressed
> in
> >> order to merge this?
> 
>  I do have some minor changes on ensuring the per-CPU variable page
>  stays encrypted, but not much beyond that. Those changes can be
>  submitted afterwards or as a new version before inclusion.
> 
>  Thanks,
>  Tom
> 
>  On 3/24/20 12:40 PM, Tom Lendacky wrote:
> > This patch series provides support for running EDK2/OVMF under
> SEV-
> >> ES.
> >
> > Secure Encrypted Virtualization - Encrypted State (SEV-ES) expands
> > on the SEV support to protect the guest register state from the
> > hypervisor. See
> > "AMD64 Architecture Programmer's Manual Volume 2: System
> > Programming", section "15.35 Encrypted State (SEV-ES)" [1].
> >
> > In order to allow a hypervisor to perform functions on behalf of a
> > guest, there is architectural support for notifying a guest's
> > operating system when certain types of VMEXITs are about to occur.
> > This allows the guest to selectively share information with the
> > hypervisor to satisfy the requested function. The 

Re: [edk2-devel] [PATCH 02/13] OvmfPkg: support powering off bhyve guests

2020-04-17 Thread Laszlo Ersek
On 04/16/20 01:09, Rebecca Cran wrote:
> Update ResetSystemLib to support powering off bhyve guests instead of
> having them enter the CpuDeadLoop.
> 
> On bhyve, the Power Management 1 Control Register is located at 0x404;
> a write with SLP_TYP set to 5 will power off the guest.
> 
> Signed-off-by: Rebecca Cran 
> ---
>  OvmfPkg/Include/IndustryStandard/Bhyve.h| 4 
>  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 6 ++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/OvmfPkg/Include/IndustryStandard/Bhyve.h 
> b/OvmfPkg/Include/IndustryStandard/Bhyve.h
> index 950f87048b..ceabc54d59 100644
> --- a/OvmfPkg/Include/IndustryStandard/Bhyve.h
> +++ b/OvmfPkg/Include/IndustryStandard/Bhyve.h
> @@ -18,4 +18,8 @@
>  
>  #define BHYVE_ACPI_TIMER_IO_ADDR 0x408
>  
> +#define BHYVE_PMBASE_VALUE 0x400
> +
> +#define BHYVE_PCI_DEVICE_ID 0x1275 // NetApp vendor ID
> +
>  #endif // __BHYVE_H__
> diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
> b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
> index 2f2e1293a3..8d9b9dfcf5 100644
> --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
> +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
> @@ -28,6 +28,12 @@ AcpiPmControl (
>AcpiPmBaseAddress = 0;
>HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
>switch (HostBridgeDevId) {
> +  case BHYVE_PCI_DEVICE_ID:
> +AcpiPmBaseAddress = BHYVE_PMBASE_VALUE;
> +// Bhyve needs a value of 5 to enter S5 (power off)
> +if (SuspendType == 0)
> +  SuspendType = 5;
> +break;
>case INTEL_82441_DEVICE_ID:
>  AcpiPmBaseAddress = PIIX4_PMBA_VALUE;
>  break;
> 

In this patch, we should follow the pattern seen in patch#1 -- new,
bhyve-specific library instance.

However, this library has hugely bit-rotted, and it needs some serious
scrubbing before we can do that. Let me look into a patch series for
that. I'll continue to review of this series after that. I hope that
works for you.

Thanks
Laszlo


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

View/Reply Online (#57504): https://edk2.groups.io/g/devel/message/57504
Mute This Topic: https://groups.io/mt/73045196/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] Question about LAPIC Timer lib

2020-04-17 Thread Tiger Liu(BJ-RD)
Hi, Experts:
There is a TimeLib implementation in 
UefiCpuPkg\Library\SecPeiDxeTimerLibUefiCpu .
It uses cpu's local apic timer.

I wonder whether it could be used in smm drivers?

If using MicroSecondDelay function (which provided in this timerlib), maybe we 
should save OS's CPU local apic timer setting first.
And restore OS's CPU local apic timer setting before return to OS environment.

Thanks


保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.

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

View/Reply Online (#57503): https://edk2.groups.io/g/devel/message/57503
Mute This Topic: https://groups.io/mt/73073476/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors.

2020-04-17 Thread Gary Lin
On Sat, Feb 29, 2020 at 09:05:45AM -0600, Leo Duran wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2556
> 
> This patch uses CPUID signature check to skip reading the PlatformId MSR,
> which is not implemented on AMD processors.
> 
> The PlatformId is used for loading microcode patches, which is also not
> supported and AMD-based platforms. To mitigate the PlatformId dependency,
> PcdCpuMicrocodePatchAddress and PcdCpuMicrodePatchRegionSize must be set
> to 0 (default value), in order to bypass microcode loading code paths.
> 
I got an error report about the executable bit of MpLib.h while
packaging ovmf. It turned out that this patch accidentally changed the
file mode. It would be nice if the mode can be corrected.

Thanks,

Gary Lin

> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Signed-off-by: Leo Duran 
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 34 --
>  UefiCpuPkg/Library/MpInitLib/MpLib.h |  3 +++
>  2 files changed, 35 insertions(+), 2 deletions(-)
>  mode change 100644 => 100755 UefiCpuPkg/Library/MpInitLib/MpLib.h
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index d0fbc17..d2200c3 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -2,6 +2,8 @@
>CPU MP Initialize Library common functions.
>  
>Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> +  Copyright (c) 2020, AMD Inc. All rights reserved.
> +
>SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  **/
> @@ -10,6 +12,29 @@
>  
>  EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;
>  
> +
> +/**
> +  Determine if the standard CPU signature is "AuthenticAMD".
> +
> +  @retval TRUE  The CPU signature matches.
> +  @retval FALSE The CPU signature does not match.
> +
> +**/
> +BOOLEAN
> +StandardSignatureIsAuthenticAMD (
> +  VOID
> +  )
> +{
> +  UINT32  RegEbx;
> +  UINT32  RegEcx;
> +  UINT32  RegEdx;
> +
> +  AsmCpuid (CPUID_SIGNATURE, NULL, , , );
> +  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
> +  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
> +  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
> +}
> +
>  /**
>The function will check if BSP Execute Disable is enabled.
>  
> @@ -564,8 +589,13 @@ InitializeApData (
>CpuMpData->CpuData[ProcessorNumber].Waiting= FALSE;
>CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ? TRUE : 
> FALSE;
>  
> -  PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);
> -  CpuMpData->CpuData[ProcessorNumber].PlatformId = (UINT8) 
> PlatformIdMsr.Bits.PlatformId;
> +  //
> +  // NOTE: PlatformId is not relevant on AMD platforms.
> +  //
> +  if (!StandardSignatureIsAuthenticAMD ()) {
> +PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);
> +CpuMpData->CpuData[ProcessorNumber].PlatformId = 
> (UINT8)PlatformIdMsr.Bits.PlatformId;
> +  }
>  
>AsmCpuid (
>  CPUID_VERSION_INFO,
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
> b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> old mode 100644
> new mode 100755
   ^^
   mode change
> index 455cb3f..0c89f8a
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> @@ -2,6 +2,8 @@
>Common header file for MP Initialize Library.
>  
>Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> +  Copyright (c) 2020, AMD Inc. All rights reserved.
> +
>SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  **/
> @@ -12,6 +14,7 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> -- 
> 2.7.4
> 
> 
> 
> 

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

View/Reply Online (#57502): https://edk2.groups.io/g/devel/message/57502
Mute This Topic: https://groups.io/mt/71626798/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float.

2020-04-17 Thread Ard Biesheuvel
On Tue, 14 Apr 2020 at 09:01, Jiang, Guomin  wrote:
>
> Summarize current status:
>
> Problem Statement:
> Openssl require _fltused to be defined as a constant anywhere floating point 
> is used.
> It may use float out of edk2 tree and need _fltused, for example, Microsoft’s 
> OnScreenKeyboard and UiToolKit.
>
> Current Proposal as below:
>
> Proposal 1: Add FltUsed.c into exist library
> Detail: Add FltUsed.c into EntryPointLib(PEIM, DXE).
> Recommend: Ard Biesheuvel 
> Approve: Laszlo Ersek ler...@redhat.com
> Netual: Michael D Kinney 
> Benefit: Doesn’t need modify every .dsc description file.
> Defection: I test that it will fail because of /GL option, the error show 
> fatal error LNK1237: during code generation, compiler introduced reference to 
> symbol '_fltused' defined in module 
> 'UefiApplicationEntryPoint.lib(FltUsed.obj)' compiled with /GL
>

Can you elaborate on this issue? What does /GL do, and why is it
throwing this error?

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

View/Reply Online (#57501): https://edk2.groups.io/g/devel/message/57501
Mute This Topic: https://groups.io/mt/72648022/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-platforms: PATCH] MinPlatformPkg/PlatformInitPei: Create Library Instance of ReportCpuHobLib.

2020-04-17 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Kumar, Chandana C  
Sent: Wednesday, April 15, 2020 1:31 AM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V ; Chiu, Chasel 
; Desimone, Nathaniel L 
Subject: [edk2-platforms: PATCH] MinPlatformPkg/PlatformInitPei: Create Library 
Instance of ReportCpuHobLib.

Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2674

Signed-off-by: Chandana Kumar 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
---
 Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
| 23 +++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
|  4 +++-
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc   
|  3 ++-
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
   | 32 
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 | 27 +++
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c 
   | 25 ++---
 6 files changed, 89 insertions(+), 25 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h 
b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
new file mode 100644
index 00..79e5d4efb2
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
@@ -0,0 +1,23 @@
+/** @file
+
+  Report CPU HOB library
+
+  This library report the CPU HOB with Physical Address bits.
+
+Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _REPORT_CPU_HOB_LIB_H_
+#define _REPORT_CPU_HOB_LIB_H_
+
+#include 
+#include 
+
+VOID
+ReportCpuHob (
+  VOID
+  )
+
+#endif
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 7f74ac9380..71776dfe80 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -68,7 +68,9 @@
   TestPointLib|Include/Library/TestPointLib.h
   TestPointCheckLib|Include/Library/TestPointCheckLib.h
 
-SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+  SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+
+  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h
 
 [PcdsFixedAtBuild, PcdsPatchableInModule]
 
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda272..b62351dac6 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights 
+reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+
+ ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/Re
+ portCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
new file mode 100644
index 00..aa2565343c
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib
+++ /ReportCpuHobLib.c
@@ -0,0 +1,32 @@
+/** @file
+  Source code file for Report CPU HOB library.
+
+Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+VOID
+ReportCpuHob (
+  VOID
+  )
+{
+  UINT8 PhysicalAddressBits;
+  UINT32RegEax;
+
+  AsmCpuid (0x8000, , NULL, NULL, NULL);  if (RegEax >= 
+ 0x8008) {
+AsmCpuid (0x8008, , NULL, NULL, NULL);
+PhysicalAddressBits = (UINT8) RegEax;  } else {
+PhysicalAddressBits = 36;
+  }
+
+  ///
+  /// Create a CPU hand-off information
+  ///
+  BuildCpuHob (PhysicalAddressBits, 16); }
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
new file mode 100644
index 00..ae6ec901a1
--- /dev/null
+++ 

Re: [edk2-devel] [PATCH 01/13] OvmfPkg: Add bhyve support into AcpiTimerLib

2020-04-17 Thread Laszlo Ersek
On 04/16/20 01:09, Rebecca Cran wrote:
> On bhyve, the ACPI timer is located at a fixed IO address; it need
> not be programmed into, nor fetched from, the PMBA -- power
> management base address -- register of the PCI host bridge.
> 
> Signed-off-by: Rebecca Cran 
> ---
>  OvmfPkg/Include/IndustryStandard/Bhyve.h  | 21 
>  OvmfPkg/Include/OvmfPlatforms.h   |  1 +
>  .../AcpiTimerLib/BaseAcpiTimerLibBhyve.c  | 33 +++
>  .../AcpiTimerLib/BaseAcpiTimerLibBhyve.inf| 29 
>  4 files changed, 84 insertions(+)
>  create mode 100644 OvmfPkg/Include/IndustryStandard/Bhyve.h
>  create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
>  create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
> 
> diff --git a/OvmfPkg/Include/IndustryStandard/Bhyve.h 
> b/OvmfPkg/Include/IndustryStandard/Bhyve.h
> new file mode 100644
> index 00..950f87048b
> --- /dev/null
> +++ b/OvmfPkg/Include/IndustryStandard/Bhyve.h
> @@ -0,0 +1,21 @@
> +/** @file
> +  Various register numbers and value bits based on FreeBSD's bhyve
> +  at r359530.
> +  - https://svnweb.freebsd.org/base?view=revision=359530
> +
> +  Copyright (C) 2020, Rebecca Cran 
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef __BHYVE_H__
> +#define __BHYVE_H__
> +
> +#include 
> +#include 
> +#include 
> +#include 

(1) These #include directives look unnecessary.

> +
> +#define BHYVE_ACPI_TIMER_IO_ADDR 0x408
> +
> +#endif // __BHYVE_H__
> diff --git a/OvmfPkg/Include/OvmfPlatforms.h b/OvmfPkg/Include/OvmfPlatforms.h
> index 59459231e8..77dd818e30 100644
> --- a/OvmfPkg/Include/OvmfPlatforms.h
> +++ b/OvmfPkg/Include/OvmfPlatforms.h
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  //
>  // OVMF Host Bridge DID Address
> diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c 
> b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
> new file mode 100644
> index 00..58ebffac86
> --- /dev/null
> +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
> @@ -0,0 +1,33 @@
> +/** @file
> +  Provide InternalAcpiGetTimerTick for the bhyve instance of the
> +  Base ACPI Timer Library
> +
> +  Copyright (C) 2020, Rebecca Cran 
> +  Copyright (C) 2014, Gabriel L. Somlo 
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include 

(2) We don't use DebugLib here, so please remove this #include.

(... in retrospect, I think the same #include should be removed from the
preexistent C source too, in this directory, but that's for another day.)

> +#include 
> +#include 
> +
> +/**
> +  Internal function to read the current tick counter of ACPI.
> +
> +  Read the current ACPI tick counter using the counter address cached
> +  by this instance's constructor.
> +
> +  @return The tick counter read.
> +
> +**/
> +UINT32
> +InternalAcpiGetTimerTick (
> +  VOID
> +  )
> +{
> +  //
> +  //   Return the current ACPI timer value.

(3) Please replace "//   Return" with "// Return".

> +  //
> +  return IoRead32 (BHYVE_ACPI_TIMER_IO_ADDR);
> +}
> diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf 
> b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
> new file mode 100644
> index 00..1e48718f3d
> --- /dev/null
> +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
> @@ -0,0 +1,29 @@
> +## @file
> +#  Base ACPI Timer Library Instance for Bhyve.
> +#
> +#  Copyright (C) 2020, Rebecca Cran 
> +#  Copyright (C) 2014, Gabriel L. Somlo 
> +#  Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = BaseAcpiTimerLibBhyve
> +  FILE_GUID  = A5E3B247-7302-11EA-9C04-3CECEF0C1C08
> +  MODULE_TYPE= BASE
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = TimerLib
> +
> +[Sources]
> +  AcpiTimerLib.c
> +  BaseAcpiTimerLibBhyve.c

(4) "AcpiTimerLib.h" should be listed here, as that is the file that
declares the InternalAcpiGetTimerTick() function.

> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  OvmfPkg/OvmfPkg.dec

(5) I think you can drop "OvmfPkg/OvmfPkg.dec", as you don't seem to be
consuming any interface (such as guid, protocol, pcd, lib class, ...)
that's declared in "OvmfPkg.dec".

> +
> +[LibraryClasses]
> +  IoLib
> 

With (1)-(5) fixed/considered:

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo


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

View/Reply Online (#57499): https://edk2.groups.io/g/devel/message/57499
Mute This Topic: https://groups.io/mt/73045133/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 00/13] BhyvePkg - initial patch series for review

2020-04-17 Thread Laszlo Ersek
On 04/16/20 22:47, Laszlo Ersek wrote:

> (5) Please make sure that the new files use CRLF line terminators
> consistently.

Indeed I can't apply these patches with git-am, without some manual
hacking. Lines in the patches are terminated with .

Please run "BaseTools/Scripts/SetupGit.py" in your edk2 clone.

Thanks,
Laszlo


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

View/Reply Online (#57498): https://edk2.groups.io/g/devel/message/57498
Mute This Topic: https://groups.io/mt/73045166/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging][PATCH] BaseTools/FMMT: Correct the extract function help message

2020-04-17 Thread Feng, YunhuaX
Correct the extract function help message

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/C/FMMT/FirmwareModuleManagement.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c 
b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
index db9b585541..e0ba27f6a1 100644
--- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
+++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
@@ -1,10 +1,10 @@
 /** @file

  FMMT main routine.

-Copyright (c) 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2019-2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent

 **/

 #include "FirmwareModuleManagement.h"
@@ -85,12 +85,12 @@ Usage (
 Delete a file (or files) from the firmware volume in an FD 
binary\n");

   //
   // Command Line for Extract ffs file from FV
   //
-  fprintf (stdout, "  -e[ 
 ...] \n\
-Delete a file (or files) from the firmware volume in an FD 
binary\n");
+  fprintf (stdout, "  -e
[  ...] \n\
+Extract a file (or files) from the firmware volume in an FD 
binary\n");

   //
   // Command Line for Add
   //
   fprintf (stdout, "  -a[ 
 ...] \n\
--
2.12.2.windows.2


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

View/Reply Online (#57497): https://edk2.groups.io/g/devel/message/57497
Mute This Topic: https://groups.io/mt/73073082/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v1 0/6] Edk2 Platform and Core CI for ArmVirtPkg, EmulatorPkg, and OvmfPkg

2020-04-17 Thread Zhang, Shenglei
Reviewed-by: Shenglei Zhang 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael Kubacki
> Sent: Thursday, April 9, 2020 2:13 AM
> To: devel@edk2.groups.io
> Cc: Andrew Fish ; Ard Biesheuvel
> ; Bret Barkelew
> ; Justen, Jordan L
> ; Laszlo Ersek ; Leif
> Lindholm ; Gao, Liming ; Kinney,
> Michael D ; Ni, Ray ; Sean
> Brogan 
> Subject: [edk2-devel] [PATCH v1 0/6] Edk2 Platform and Core CI for
> ArmVirtPkg, EmulatorPkg, and OvmfPkg
> 
> From: Michael Kubacki 
> 
> The following 6 patches adds support for "Platform CI" for ArmVirtPkg,
> OvmfPkg, and EmulatorPkg.
> 
> Each readme has live status and links to the builds as well as details
> of how to build and run the same way the CI server will.
> 
> ArmVirtPkg:
> https://github.com/spbrogan/edk2/blob/PlatformAndCoreCIForOvmfArmVi
> rtEmulatorPackages_v5/ArmVirtPkg/README-pytools.md
> 
> EmulatorPkg:
> https://github.com/spbrogan/edk2/blob/PlatformAndCoreCIForOvmfArmVi
> rtEmulatorPackages_v5/EmulatorPkg/README-pytools.md
> 
> OvmfPkg:
> https://github.com/spbrogan/edk2/blob/PlatformAndCoreCIForOvmfArmVi
> rtEmulatorPackages_v5/OvmfPkg/README-pytools.md
> 
> The patch set also adds ArmVirtPkg, OvmfPkg, and EmulatorPkg to Core CI
> for
> the code evaluation tests (not compiling). Details of those tests are here:
> https://github.com/spbrogan/edk2/tree/PlatformAndCoreCIForOvmfArmVir
> tEmulatorPackages_v5/.pytool
> 
> Branch can be reviewed here:
> https://github.com/spbrogan/edk2/tree/PlatformAndCoreCIForOvmfArmVir
> tEmulatorPackages_v5
> 
> Please send feedback to the mailing list and do not leave feedback directly
> on github.
> 
> On a separate note, shallow threading might not work on this patch series
> due to changes made by the SMTP server. Please bear with me while I am
> investigating if this can be changed.
> 
> Cc: Andrew Fish 
> Cc: Ard Biesheuvel 
> Cc: Bret Barkelew 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Leif Lindholm 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Ray Ni 
> Cc: Sean Brogan 
> Signed-off-by: Michael Kubacki 
> 
> Sean Brogan (6):
>   .azurepipelines: Add Platform CI template
>   ArmVirtPkg: Add Platform CI and configuration for Core CI
>   EmulatorPkg: Add Platform CI and configuration for Core CI
>   OvmfPkg: Add Platform CI and configuration for Core CI
>   .pytool: Update CI Settings to support Emulator, ArmVirt, and Ovmf
> packages
>   .azurepipelines: Update Core CI build matrix to include platforms
> 
>  .azurepipelines/ReadMe.md  |  50 
>  .azurepipelines/templates/ReadMe.md|  59 +
>  .azurepipelines/templates/platform-build-run-steps.yml | 134 ++
>  .azurepipelines/templates/pr-gate-build-job.yml|   5 +
>  .pytool/CISettings.py  |   7 +-
>  .pytool/Plugin/SpellCheck/cspell.base.yaml |  14 ++
>  .pytool/Readme.md  |  10 +-
>  ArmVirtPkg/.azurepipelines/Ubuntu-GCC5.yml |  89 +++
>  ArmVirtPkg/ArmVirtPkg.ci.yaml  | 103 
>  ArmVirtPkg/PlatformBuild.py| 263 
> 
>  ArmVirtPkg/README-pytools.md   | 123 +
>  ArmVirtPkg/iasl_ext_dep.yaml   |  21 ++
>  EmulatorPkg/.azurepipelines/Ubuntu-GCC5.yml|  95 +++
>  EmulatorPkg/.azurepipelines/Windows-VS2019.yml |  85 +++
>  EmulatorPkg/EmulatorPkg.ci.yaml|  85 +++
>  EmulatorPkg/PlatformBuild.py   | 252 
> +++
>  EmulatorPkg/README-pytools.md  | 173 +
>  OvmfPkg/.azurepipelines/Ubuntu-GCC5.yml| 133 ++
>  OvmfPkg/.azurepipelines/Windows-VS2019.yml | 138 ++
>  OvmfPkg/OvmfPkg.ci.yaml|  83 ++
>  OvmfPkg/PlatformBuild.py   | 242 
> ++
>  OvmfPkg/README-pytools.md  | 238 
> ++
>  OvmfPkg/iasl_ext_dep.yaml  |  21 ++
>  23 files changed, 2415 insertions(+), 8 deletions(-)
>  create mode 100644 .azurepipelines/ReadMe.md
>  create mode 100644 .azurepipelines/templates/ReadMe.md
>  create mode 100644 .azurepipelines/templates/platform-build-run-
> steps.yml
>  create mode 100644 ArmVirtPkg/.azurepipelines/Ubuntu-GCC5.yml
>  create mode 100644 ArmVirtPkg/ArmVirtPkg.ci.yaml
>  create mode 100644 ArmVirtPkg/PlatformBuild.py
>  create mode 100644 ArmVirtPkg/README-pytools.md
>  create mode 100644 ArmVirtPkg/iasl_ext_dep.yaml
>  create mode 100644 EmulatorPkg/.azurepipelines/Ubuntu-GCC5.yml
>  create mode 100644 EmulatorPkg/.azurepipelines/Windows-VS2019.yml
>  create mode 100644 EmulatorPkg/EmulatorPkg.ci.yaml
>  create mode 100644 EmulatorPkg/PlatformBuild.py
>  create mode 100644 

Re: [edk2-devel] [PATCH v1 0/3] Check if required ACPI tables are installed

2020-04-17 Thread Gao, Zhichao
For the patch set:
Reviewed-by: Zhichao Gao 

Thanks,
Zhichao

> -Original Message-
> From: Krzysztof Koch 
> Sent: Tuesday, April 14, 2020 4:50 PM
> To: devel@edk2.groups.io; Ni, Ray ; Gao, Zhichao
> 
> Cc: Sami Mujawar ; Matteo Carlini
> ; Laura Moretta ; nd
> 
> Subject: RE: [edk2-devel] [PATCH v1 0/3] Check if required ACPI tables are
> installed
> 
> Hi,
> 
> Can I get a review for this patch series?
> 
> Thanks,
> 
> Krzysztof
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> Krzysztof Koch via Groups.Io
> Sent: Wednesday, March 25, 2020 9:39
> To: devel@edk2.groups.io
> Cc: ray...@intel.com; zhichao@intel.com; Sami Mujawar
> ; Matteo Carlini ;
> Laura Moretta ; nd 
> Subject: [edk2-devel] [PATCH v1 0/3] Check if required ACPI tables are
> installed
> 
> This patch series adds a new capability to the Acpiview UEFI shell tool.
> Using the -r command line parameter, it is now possible to choose a
> specification which lists mandatory ACPI tables. The parameter value is then
> consumed by a library which validates ACPI tables identified on the platform
> against these requirements.
> 
> The -r parameter is architecture agnostic. However, as of now, the possible
> values for the parameter are only defined in the context of the Arm
> architecture.
> 
> For Arm-based platforms, it is now possible to validate that Server Base Boot
> Requirements (SBBR) mandatory ACPI tables are present on the platform.
> 
> Changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/617_sbbr_validate_acpi_tabl
> e_counts_v1
> 
> Krzysztof Koch (3):
>   ShellPkg: acpiview: Add -r parameter for table requirements validation
>   ShellPkg: acpiview: Add library for SBBR ACPI requirements validation
>   ShellPkg: acpiview: Check if SBBR mandatory ACPI tables are installed
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c   
> |
> 16 ++
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c  
> | 104
> -
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h  
> |  44
> +++-
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c
> | 222 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h
> |  91 
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComman
> dLib.inf |   6 +-
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComman
> dLib.uni |  14 +-
>  7 files changed, 492 insertions(+), 5 deletions(-)  create mode 100644
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c
>  create mode 100644
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h
> 
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> 


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

View/Reply Online (#57495): https://edk2.groups.io/g/devel/message/57495
Mute This Topic: https://groups.io/mt/72537308/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 00/13] BhyvePkg - initial patch series for review

2020-04-17 Thread Rebecca Cran

On 4/17/20 12:46 AM, Rebecca Cran wrote:



I'm running into a problem with Ecc against any code: I'm using Ubuntu 
19.10, and have copied the output of running it against MdePkg at the 
end of this email. Does Ecc work with Python 3, or does it still need 
Python 2?


Of course, this was the important line:

ANTLR runtime and generated code versions disagree: 4.8!=4.7.1


Running "pip3 install --user antlr4-python3-runtime==4.7.1" fixed the 
problem.



--
Rebecca Cran



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

View/Reply Online (#57494): https://edk2.groups.io/g/devel/message/57494
Mute This Topic: https://groups.io/mt/73045166/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 00/13] BhyvePkg - initial patch series for review

2020-04-17 Thread Rebecca Cran

Hi Laszlo,


I've removed comments from you that I won't have any difficulty with 
implementing.



(1) Please try to run the BhyvePkg code through the ECC tool, and see if
ECC is OK with the coding style. (In some cases ECC is *way* too strict
in my opinion, so please use common sense, and/or ask for feedback on
the list, with specific code examples and questions.)


I'm running into a problem with Ecc against any code: I'm using Ubuntu 
19.10, and have copied the output of running it against MdePkg at the 
end of this email. Does Ecc work with Python 3, or does it still need 
Python 2?



(2) Regarding platform code correctness, if someone from the bhyve
community can help you and review your code, that's welcome. We've had
fruitful examples for such collaboration, between xen-devel and
edk2-devel subscribers. But, I won't really "insist" on this -- I just
propose it.


Peter Grehan, who's agreed to be the reviewer for BhyvePkg, has already 
reviewed the changes.



If you must (or want to) stick with the 2-clause BSDL, then please list
the components with that license in "Readme.md", near the existent
"exceptions".


Unfortunately it's not going to be possible to contact all the original 
authors who contributed to BhyvePkg, so we'll need to stick with 
2-clause BSDL.



So, regarding these two modules, please do create copies of them under
BhyvePkg, add the bhyve special sauce there, and eliminate everything
from them that you do not need on bhyve.


Perfect! Peter had concerns about the added complexity of those modules, 
so it'll be good to have versions that are specific to bhyve.



The output of Ecc is as follows:


bcran@photon:~/src/uefi/edk2$ Ecc -c 
~/src/uefi/edk2/BaseTools/Source/Python/Ecc/config.ini -e 
~/src/uefi/edk2/BaseTools/Source/Python/Ecc/exception.xml -t 
~/src/uefi/edk2/MdePkg -r MdePkgECC.csv
/home/bcran/src/uefi/edk2/BaseTools/Source/Python/Ecc/EccMain.py:409: 
DeprecationWarning: time.clock has been deprecated in Python 3.3 and 
will be removed from Python 3.8: use time.perf_counter or 
time.process_time instead

  StartTime = time.clock()
00:37:17, Apr.17 2020 [00:00]

Loading ECC configuration ... done
Building database for Meta Data File ...
Building database for meta data files ...
Parsing //home/bcran/src/uefi/edk2/MdePkg/MdePkg.dec
Parser...
//home/bcran/src/uefi/edk2/MdePkg/MdePkg.dec(2301): warning: 
Unrecognized section

    [UserExtensions.TianoCore."ExtraFiles"]
Parsing //home/bcran/src/uefi/edk2/MdePkg/MdePkg.dsc
Parsing //home/bcran/src/uefi/edk2/MdePkg/MdePkg.uni
Parsing //home/bcran/src/uefi/edk2/MdePkg/MdePkgExtra.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.uni

Parsing //home/bcran/src/uefi/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
Parsing //home/bcran/src/uefi/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf

Parsing //home/bcran/src/uefi/edk2/MdePkg/Library/BaseLib/BaseLib.inf
Parsing //home/bcran/src/uefi/edk2/MdePkg/Library/BaseLib/BaseLib.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.uni
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
Parsing 
//home/bcran/src/uefi/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.uni
Parsing