diff mbox series

[edk2] OvmfPkg/XenHypercallLib: enable virt extensions for ARM

Message ID 20171116165620.30523-1-ard.biesheuvel@linaro.org
State Accepted
Commit 12c6484058a8c5a8751c51eb24e9bb95497649c6
Headers show
Series [edk2] OvmfPkg/XenHypercallLib: enable virt extensions for ARM | expand

Commit Message

Ard Biesheuvel Nov. 16, 2017, 4:56 p.m. UTC
XenHypercallLib uses the 'hvc' instruction, which is not implemented
on all ARMv7 CPUs, and so we need to explicitly specify a CPU that
has the virtualization extensions.

This override used to be set at the platform level, but this was removed
in commit 0d36a219c7bdbb27d775b50837823b2a9928147c
('ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib
reference), under the assumption that all users of the 'hvc' instruction
had already been fixed.

So fix this for GNU binutils by adding the 'virt' arch extension
directive, and for RVCT by setting the --cpu command line option to a
CPU that is virt capable.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S     | 2 ++
 OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf | 3 +++
 2 files changed, 5 insertions(+)

-- 
2.11.0

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

Comments

Ard Biesheuvel Nov. 16, 2017, 5:18 p.m. UTC | #1
Forward to Julien at his @linaro.org address.



---------- Forwarded message ----------
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Date: 16 November 2017 at 16:56
Subject: [PATCH] OvmfPkg/XenHypercallLib: enable virt extensions for ARM
To: edk2-devel@lists.01.org, leif.lindholm@linaro.org,
lersek@redhat.com, julien.grall@arm.com
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>


XenHypercallLib uses the 'hvc' instruction, which is not implemented
on all ARMv7 CPUs, and so we need to explicitly specify a CPU that
has the virtualization extensions.

This override used to be set at the platform level, but this was removed
in commit 0d36a219c7bdbb27d775b50837823b2a9928147c
('ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib
reference), under the assumption that all users of the 'hvc' instruction
had already been fixed.

So fix this for GNU binutils by adding the 'virt' arch extension
directive, and for RVCT by setting the --cpu command line option to a
CPU that is virt capable.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S     | 2 ++
 OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S
b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S
index c12c8658b729..0adf65840a2f 100644
--- a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S
+++ b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S
@@ -16,6 +16,8 @@
 #include <IndustryStandard/Xen/arch-arm/xen.h>

   .text
+  .arch_extension virt
+
 GCC_ASM_EXPORT(XenHypercall2)

 ASM_PFX(XenHypercall2):
diff --git a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
index f4503a4b01f4..d268e540feca 100644
--- a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
+++ b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
@@ -64,3 +64,6 @@ [LibraryClasses.IA32, LibraryClasses.X64]

 [Guids.IA32, Guids.X64]
   gEfiXenInfoGuid
+
+[BuildOptions.ARM]
+  RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15
--
2.11.0
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek Nov. 16, 2017, 9:42 p.m. UTC | #2
On 11/16/17 17:56, Ard Biesheuvel wrote:
> XenHypercallLib uses the 'hvc' instruction, which is not implemented

> on all ARMv7 CPUs, and so we need to explicitly specify a CPU that

> has the virtualization extensions.

> 

> This override used to be set at the platform level, but this was removed

> in commit 0d36a219c7bdbb27d775b50837823b2a9928147c

> ('ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib

> reference), under the assumption that all users of the 'hvc' instruction

> had already been fixed.

> 

> So fix this for GNU binutils by adding the 'virt' arch extension

> directive, and for RVCT by setting the --cpu command line option to a

> CPU that is virt capable.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

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

> ---

>  OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S     | 2 ++

>  OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf | 3 +++

>  2 files changed, 5 insertions(+)

> 

> diff --git a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S

> index c12c8658b729..0adf65840a2f 100644

> --- a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S

> +++ b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S

> @@ -16,6 +16,8 @@

>  #include <IndustryStandard/Xen/arch-arm/xen.h>

>  

>    .text

> +  .arch_extension virt

> +

>  GCC_ASM_EXPORT(XenHypercall2)

>  

>  ASM_PFX(XenHypercall2):

> diff --git a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf

> index f4503a4b01f4..d268e540feca 100644

> --- a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf

> +++ b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf

> @@ -64,3 +64,6 @@ [LibraryClasses.IA32, LibraryClasses.X64]

>  

>  [Guids.IA32, Guids.X64]

>    gEfiXenInfoGuid

> +

> +[BuildOptions.ARM]

> +  RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15

> 


Acked-by: Laszlo Ersek <lersek@redhat.com>


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Nov. 17, 2017, 10:06 a.m. UTC | #3
On 16 November 2017 at 21:42, Laszlo Ersek <lersek@redhat.com> wrote:
> On 11/16/17 17:56, Ard Biesheuvel wrote:

>> XenHypercallLib uses the 'hvc' instruction, which is not implemented

>> on all ARMv7 CPUs, and so we need to explicitly specify a CPU that

>> has the virtualization extensions.

>>

>> This override used to be set at the platform level, but this was removed

>> in commit 0d36a219c7bdbb27d775b50837823b2a9928147c

>> ('ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib

>> reference), under the assumption that all users of the 'hvc' instruction

>> had already been fixed.

>>

>> So fix this for GNU binutils by adding the 'virt' arch extension

>> directive, and for RVCT by setting the --cpu command line option to a

>> CPU that is virt capable.

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

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

>> ---

>>  OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S     | 2 ++

>>  OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf | 3 +++

>>  2 files changed, 5 insertions(+)

>>

>> diff --git a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S

>> index c12c8658b729..0adf65840a2f 100644

>> --- a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S

>> +++ b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S

>> @@ -16,6 +16,8 @@

>>  #include <IndustryStandard/Xen/arch-arm/xen.h>

>>

>>    .text

>> +  .arch_extension virt

>> +

>>  GCC_ASM_EXPORT(XenHypercall2)

>>

>>  ASM_PFX(XenHypercall2):

>> diff --git a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf

>> index f4503a4b01f4..d268e540feca 100644

>> --- a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf

>> +++ b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf

>> @@ -64,3 +64,6 @@ [LibraryClasses.IA32, LibraryClasses.X64]

>>

>>  [Guids.IA32, Guids.X64]

>>    gEfiXenInfoGuid

>> +

>> +[BuildOptions.ARM]

>> +  RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15

>>

>

> Acked-by: Laszlo Ersek <lersek@redhat.com>

>


Pushed as 12c6484058a8c5a8751c51eb24e9bb95497649c6
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S
index c12c8658b729..0adf65840a2f 100644
--- a/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S
+++ b/OvmfPkg/Library/XenHypercallLib/Arm/Hypercall.S
@@ -16,6 +16,8 @@ 
 #include <IndustryStandard/Xen/arch-arm/xen.h>
 
   .text
+  .arch_extension virt
+
 GCC_ASM_EXPORT(XenHypercall2)
 
 ASM_PFX(XenHypercall2):
diff --git a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
index f4503a4b01f4..d268e540feca 100644
--- a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
+++ b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
@@ -64,3 +64,6 @@  [LibraryClasses.IA32, LibraryClasses.X64]
 
 [Guids.IA32, Guids.X64]
   gEfiXenInfoGuid
+
+[BuildOptions.ARM]
+  RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15