On Fri, May 29, 2026 at 16:12:15 +0200, Jiri Denemark via Devel wrote:
> From: Jiri Denemark <[email protected]>
> 
> This just makes the relevant part of virCPUx86GetHost reusable in other
> places.
> 
> Signed-off-by: Jiri Denemark <[email protected]>
> ---
> 
> Notes:
>     Version 2:
>     - no change
> 
>  src/cpu/cpu_x86.c        | 31 +++++++++++++++++++------------
>  src/cpu/cpu_x86.h        |  4 ++++
>  src/libvirt_private.syms |  1 +
>  3 files changed, 24 insertions(+), 12 deletions(-)
> 
> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> index 3a18d859dc..93f1427e36 100644
> --- a/src/cpu/cpu_x86.c
> +++ b/src/cpu/cpu_x86.c
> @@ -2911,18 +2911,8 @@ virCPUx86GetHost(virCPUDef *cpu,
>      /* This is best effort since there might be no way to read the MSR
>       * when we are not running as root. */
>      for (i = 0; i < nmsrs; i++) {
> -        if (virHostCPUGetMSR(msrs[i], &msr) == 0) {
> -            virCPUx86DataItem item = {
> -                .type = VIR_CPU_X86_DATA_MSR,
> -                .data.msr = {
> -                    .index = msrs[i],
> -                    .eax = msr & 0xffffffff,
> -                    .edx = msr >> 32,
> -                },
> -            };
> -
> -            virCPUx86DataAdd(cpuData, &item);
> -        }
> +        if (virHostCPUGetMSR(msrs[i], &msr) == 0)
> +            virCPUx86DataAddMSR(cpuData, msrs[i], msr);
>      }
>  
>      ret = x86DecodeCPUData(cpu, cpuData, models);
> @@ -3460,6 +3450,23 @@ virCPUx86DataAdd(virCPUData *cpuData,
>  }
>  
>  
> +void virCPUx86DataAddMSR(virCPUData *cpuData,
> +                         uint32_t index,
> +                         uint64_t value)

Majority of this file uses different alignment pattern for return type.

Since the function is epxorted; consider documenting it.

Reviewed-by: Peter Krempa <[email protected]>

Reply via email to