Re: [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marc,


在 2023/7/12 星期三 16:36, Marc Zyngier 写道:
On Wed, 12 Jul 2023 08:55:05 +0100,
chenxiang <chenxiang66@xxxxxxxxxxxxx> wrote:
From: Xiang Chen <chenxiang66@xxxxxxxxxxxxx>

For those PMU system registers defined in sys_reg_descs[], use macro
PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
later two macros call macro PMU_SYS_REG() actually.
Currently the input parameter of PMU_SYS_REG() is other macro which is
calculation formula of the value of system registers, so for example, if
we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
the name will be as following:
(((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))

To fix the issue, use the name as a input parameter of PMU_SYS_REG like
MTE_REG or EL2_REG.
Why is the name relevant? Is this related to tracing?
I think It is not related to tracing. I find the issue when i want to know which system reigsters are set when on live migration and printk the name of sys_reg_desc in function kvm_sys_reg_set_user,
find the name of some registers are abnormal as followings:

[  227.145540] kvm_sys_reg_set_user 3427:SYS_FAR_EL1
[  227.158057] kvm_sys_reg_set_user 3427:SYS_PAR_EL1
[ 227.170574] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5)) [ 227.188037] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((2) << 5))
[  227.205511] kvm_sys_reg_set_user 3427:SYS_MAIR_EL1
[  227.218117] kvm_sys_reg_set_user 3427:SYS_PIRE0_EL1

I think it is caused by the macro PMU_SYS_REG(). For example PMU_SYS_REG(SYS_PMINTENSET_EL1),
#define SYS_PMINTENSET_EL1 sys_reg(3, 0, 9, 14, 1)
#define sys_reg(op0, op1, crn, crm, op2) (((op0) << OP0_shift) | ((op1) << OP1_shift) | ((crn) << CRn_shift) | ((crm) << CRm_shift) | ((op2) << OP2_shift))

So SYS_PMINTENSET_EL1 is equal to (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5)), and PMU_SYS_REG(SYS_PMINTENSET_EL1) calls SYS_DESC() which uses the input parameter as the name, so the name of SYS_PMINTENSET_EL1 becomes (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5)).




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux