[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v2 3/5] i386/kvm: Support event with select & umask format in K
From: |
Markus Armbruster |
Subject: |
Re: [RFC v2 3/5] i386/kvm: Support event with select & umask format in KVM PMU filter |
Date: |
Fri, 07 Feb 2025 14:06:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Zhao Liu <zhao1.liu@intel.com> writes:
>> > Do users need to know how to compute the raw event value from @select
>> > and @umask?
>>
>> Yes, because it's also a unified calculation. AMD and Intel have
>> differences in bits for supported select field, but this calculation
>> (which follows from the KVM code) makes both compatible.
>>
>> > If yes, is C code the best way?
>
> Sorry, I missed this line. In this patch, there's macro:
>
> +#define X86_PMU_RAW_EVENT(eventsel, umask) (((eventsel & 0xf00UL) << 24) | \
> + ((eventsel) & 0xff) | \
> + ((umask) & 0xff) << 8)
>
> So could I said something like the following?
>
> +##
> +# @KVMPMUX86SelectUmaskEvent:
> +#
> +# x86 PMU event encoding with select and umask. Using the X86_PMU_RAW_EVENT
> +# macro, the select and umask fields will be encoded into raw foramt and
> +# delivered to KVM.
Doc comments are for the QMP reference manual, i.e. for users of QMP.
Explaining the QMP interface in terms of its implementation in QEMU is
not nice.
> +#
> +# @select: x86 PMU event select field, which is a 12-bit unsigned
> +# number.
> +#
> +# @umask: x86 PMU event umask field.
> +#
> +# Since 10.0
> +##
> +{ 'struct': 'KVMPMUX86DefalutEvent',
> + 'data': { 'select': 'uint16',
> + 'umask': 'uint8' } }
> +
>
> Thanks very much!
>
>> > Here's another way:
>> >
>> > bits 0..7 : bits 0..7 of @select
>> > bits 8..15: @umask
>> > bits 24..27: bits 8..11 of @select
>> > all other bits: zero
>> >
>>
>> Thank you! This is what I want.
>>
>>
>>