diff mbox series

[XEN,v2,1/5] x86/vpmu: separate amd/intel vPMU code

Message ID ddbf4e24c41f48832bba4b11368cd5e6e9f79a20.1714640459.git.Sergiy_Kibrik@epam.com (mailing list archive)
State Superseded
Headers show
Series x86: make Intel/AMD vPMU & MCE support configurable | expand

Commit Message

Sergiy Kibrik May 2, 2024, 9:12 a.m. UTC
Build AMD vPMU when CONFIG_AMD is on, and Intel vPMU when CONFIG_INTEL
is on respectively, allowing for a plaftorm-specific build.

No functional change intended.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>

---
changes in v2:
 - drop static inline stubs, use #idef/#endif in vpmu_init)()
changes in v1:
 - switch to CONFIG_{AMD,INTEL} instead of CONFIG_{SVM,VMX}
---
 xen/arch/x86/cpu/Makefile | 4 +++-
 xen/arch/x86/cpu/vpmu.c   | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Jan Beulich May 6, 2024, 11:09 a.m. UTC | #1
On 02.05.2024 11:12, Sergiy Kibrik wrote:
> Build AMD vPMU when CONFIG_AMD is on, and Intel vPMU when CONFIG_INTEL
> is on respectively, allowing for a plaftorm-specific build.
> 
> No functional change intended.
> 
> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

I can only guess that Stefano is likely fine with

> changes in v2:
>  - drop static inline stubs, use #idef/#endif in vpmu_init)()

this.

Acked-by: Jan Beulich <jbeulich@suse.com>
with ...

> --- a/xen/arch/x86/cpu/vpmu.c
> +++ b/xen/arch/x86/cpu/vpmu.c
> @@ -827,6 +827,7 @@ static int __init cf_check vpmu_init(void)
>  
>      switch ( vendor )
>      {
> +#ifdef CONFIG_AMD
>      case X86_VENDOR_AMD:
>          ops = amd_vpmu_init();
>          break;
> @@ -834,11 +835,12 @@ static int __init cf_check vpmu_init(void)
>      case X86_VENDOR_HYGON:
>          ops = hygon_vpmu_init();
>          break;
> -
> +#endif
> +#ifdef CONFIG_INTEL
>      case X86_VENDOR_INTEL:
>          ops = core2_vpmu_init();
>          break;
> -
> +#endif
>      default:
>          printk(XENLOG_WARNING "VPMU: Unknown CPU vendor: %d. "
>                 "Turning VPMU off.\n", vendor);

... neither of the blank lines dropped.

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile
index 35561fe51d..eafce5f204 100644
--- a/xen/arch/x86/cpu/Makefile
+++ b/xen/arch/x86/cpu/Makefile
@@ -10,4 +10,6 @@  obj-y += intel.o
 obj-y += intel_cacheinfo.o
 obj-y += mwait-idle.o
 obj-y += shanghai.o
-obj-y += vpmu.o vpmu_amd.o vpmu_intel.o
+obj-y += vpmu.o
+obj-$(CONFIG_AMD) += vpmu_amd.o
+obj-$(CONFIG_INTEL) += vpmu_intel.o
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index b2e9881e06..3db90b7839 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -827,6 +827,7 @@  static int __init cf_check vpmu_init(void)
 
     switch ( vendor )
     {
+#ifdef CONFIG_AMD
     case X86_VENDOR_AMD:
         ops = amd_vpmu_init();
         break;
@@ -834,11 +835,12 @@  static int __init cf_check vpmu_init(void)
     case X86_VENDOR_HYGON:
         ops = hygon_vpmu_init();
         break;
-
+#endif
+#ifdef CONFIG_INTEL
     case X86_VENDOR_INTEL:
         ops = core2_vpmu_init();
         break;
-
+#endif
     default:
         printk(XENLOG_WARNING "VPMU: Unknown CPU vendor: %d. "
                "Turning VPMU off.\n", vendor);