Remove unused macros from asm-offset
Subsystems (2)
v2 cover Remove unused macros from asm-offset
The kvm code was refactored to convert some of kvm assembly routines to C. This includes commits which moved code path for the kvm guest entry/exit for p7/8 from aseembly to C. As part of the code changes, usage of some of the macros were removed. But definitions still exist in the assembly files. Commits are listed below:
Commit 2e1ae9cd56f8 ("KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU") Commit 9769a7fd79b6 ("KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path") Commit fae5c9f3664b ("KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path") Commit 57dc0eed73ca ("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C")
Many of the asm-offset macro definitions were missed to remove. This patchset fixes by removing the unused macro definitions.
Patch1 removes a set of unused kvm vcpu and hstate macros from the asm-offset.c
Patch2 removes unused host_mmcr references for MMCR3/SIER2/SIER3
Changelog:
v1 -> v2:
Merge all the macro removal part from asm-offset.c file into a single patch as suggested by Christophe Leroy.
Link to patchset v1:
http://patchwork.ozlabs.org/project/linuxppc-dev/patch/[email protected]/
Link to the script used to get unused macro:
https://github.com/maddy-kerneldev/scripts/blob/master/check_asm-offset.sh
Link to linux-ci job result:
https://github.com/disgoel/linux-ci/actions?query=branch%3Akvmmacro.v2
Disha Goel (1):
powerpc/kvm: Remove unused macros from asm-offset
Kajol Jain (1):
powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers
arch/powerpc/include/asm/kvm_book3s_asm.h | 2 +- arch/powerpc/kernel/asm-offsets.c | 25 ----------------------- 2 files changed, 1 insertion(+), 26 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/2 powerpc/kvm: Remove unused macros from asm-offset
The kvm code was refactored to convert some of kvm assembly routines to C. This includes commits which moved code path for the kvm guest entry/exit for p7/8 from aseembly to C. As part of the code changes, usage of some of the macros were removed. But definitions still exist in the assembly files. Commits are listed below:
Commit 2e1ae9cd56f8 ("KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU") Commit 9769a7fd79b6 ("KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path") Commit fae5c9f3664b ("KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path") Commit 57dc0eed73ca ("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C")
Many of the asm-offset macro definitions were missed to remove. Patch fixes by removing the unused macros.
--- arch/powerpc/kernel/asm-offsets.c | 25 ------------------------- 1 file changed, 25 deletions(-)
arch/powerpc/kernel/asm-offsets.c +0 -25
@@ -418,21 +418,18 @@ int main(void)/* book3s */ #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE -OFFSET (KVM_TLB_SETS , kvm, arch.tlb_sets);OFFSET (KVM_SDR1 , kvm, arch.sdr1);OFFSET (KVM_HOST_LPID , kvm, arch.host_lpid);OFFSET (KVM_HOST_LPCR , kvm, arch.host_lpcr);OFFSET (KVM_HOST_SDR1 , kvm, arch.host_sdr1);OFFSET (KVM_ENABLED_HCALLS , kvm, arch.enabled_hcalls);OFFSET (KVM_VRMA_SLB_V , kvm, arch.vrma_slb_v); -OFFSET (KVM_RADIX , kvm, arch.radix);OFFSET (KVM_SECURE_GUEST , kvm, arch.secure_guest);OFFSET (VCPU_DSISR , kvm_vcpu, arch.shregs.dsisr);OFFSET (VCPU_DAR , kvm_vcpu, arch.shregs.dar);OFFSET (VCPU_VPA , kvm_vcpu, arch.vpa.pinned_addr);OFFSET (VCPU_VPA_DIRTY , kvm_vcpu, arch.vpa.dirty);OFFSET (VCPU_HEIR , kvm_vcpu, arch.emul_inst); -OFFSET (VCPU_NESTED , kvm_vcpu, arch.nested);OFFSET (VCPU_CPU , kvm_vcpu, cpu);OFFSET (VCPU_THREAD_CPU , kvm_vcpu, arch.thread_cpu);#endif
@@ -449,16 +446,12 @@ int main(void)OFFSET (VCPU_DABRX , kvm_vcpu, arch.dabrx);OFFSET (VCPU_DAWR0 , kvm_vcpu, arch.dawr0);OFFSET (VCPU_DAWRX0 , kvm_vcpu, arch.dawrx0); -OFFSET (VCPU_DAWR1 , kvm_vcpu, arch.dawr1); -OFFSET (VCPU_DAWRX1 , kvm_vcpu, arch.dawrx1);OFFSET (VCPU_CIABR , kvm_vcpu, arch.ciabr);OFFSET (VCPU_HFLAGS , kvm_vcpu, arch.hflags);OFFSET (VCPU_DEC_EXPIRES , kvm_vcpu, arch.dec_expires);OFFSET (VCPU_PENDING_EXC , kvm_vcpu, arch.pending_exceptions);OFFSET (VCPU_CEDED , kvm_vcpu, arch.ceded);OFFSET (VCPU_PRODDED , kvm_vcpu, arch.prodded); -OFFSET (VCPU_IRQ_PENDING , kvm_vcpu, arch.irq_pending); -OFFSET (VCPU_DBELL_REQ , kvm_vcpu, arch.doorbell_request);OFFSET (VCPU_MMCR , kvm_vcpu, arch.mmcr);OFFSET (VCPU_MMCRA , kvm_vcpu, arch.mmcra);OFFSET (VCPU_MMCRS , kvm_vcpu, arch.mmcrs);
@@ -486,8 +479,6 @@ int main(void)OFFSET (VCPU_TCSCR , kvm_vcpu, arch.tcscr);OFFSET (VCPU_ACOP , kvm_vcpu, arch.acop);OFFSET (VCPU_WORT , kvm_vcpu, arch.wort); -OFFSET (VCPU_TID , kvm_vcpu, arch.tid); -OFFSET (VCPU_PSSCR , kvm_vcpu, arch.psscr);OFFSET (VCPU_HFSCR , kvm_vcpu, arch.hfscr);OFFSET (VCORE_ENTRY_EXIT , kvmppc_vcore, entry_exit_map);OFFSET (VCORE_IN_GUEST , kvmppc_vcore, in_guest);
@@ -582,8 +573,6 @@ int main(void)HSTATE_FIELD (HSTATE_HWTHREAD_STATE , hwthread_state);HSTATE_FIELD (HSTATE_KVM_VCPU , kvm_vcpu);HSTATE_FIELD (HSTATE_KVM_VCORE , kvm_vcore); -HSTATE_FIELD (HSTATE_XIVE_TIMA_PHYS , xive_tima_phys); -HSTATE_FIELD (HSTATE_XIVE_TIMA_VIRT , xive_tima_virt);HSTATE_FIELD (HSTATE_HOST_IPI , host_ipi);HSTATE_FIELD (HSTATE_PTID , ptid);HSTATE_FIELD (HSTATE_FAKE_SUSPEND , fake_suspend);
@@ -594,9 +583,6 @@ int main(void)HSTATE_FIELD (HSTATE_SDAR , host_mmcr[4 ]);HSTATE_FIELD (HSTATE_MMCR2 , host_mmcr[5 ]);HSTATE_FIELD (HSTATE_SIER , host_mmcr[6 ]); -HSTATE_FIELD (HSTATE_MMCR3 , host_mmcr[7 ]); -HSTATE_FIELD (HSTATE_SIER2 , host_mmcr[8 ]); -HSTATE_FIELD (HSTATE_SIER3 , host_mmcr[9 ]);HSTATE_FIELD (HSTATE_PMC1 , host_pmc[0 ]);HSTATE_FIELD (HSTATE_PMC2 , host_pmc[1 ]);HSTATE_FIELD (HSTATE_PMC3 , host_pmc[2 ]);
@@ -672,17 +658,6 @@ int main(void)OFFSET (VCPU_HOST_MAS6 , kvm_vcpu, arch.host_mas6);#endif -#ifdef CONFIG_KVM_XICS -DEFINE (VCPU_XIVE_SAVED_STATE , offsetof(struct kvm_vcpu , - arch.xive_saved_state)); -DEFINE (VCPU_XIVE_CAM_WORD , offsetof(struct kvm_vcpu , - arch.xive_cam_word)); - DEFINE(VCPU_XIVE_PUSHED, offsetof(struct kvm_vcpu, arch.xive_pushed)); - DEFINE(VCPU_XIVE_ESC_ON, offsetof(struct kvm_vcpu, arch.xive_esc_on)); - DEFINE(VCPU_XIVE_ESC_RADDR, offsetof(struct kvm_vcpu, arch.xive_esc_raddr)); - DEFINE(VCPU_XIVE_ESC_VADDR, offsetof(struct kvm_vcpu, arch.xive_esc_vaddr)); -#endif -#ifdef CONFIG_KVM_EXIT_TIMING OFFSET (VCPU_TIMING_EXIT_TBU , kvm_vcpu, arch.timing_exit.tv32.tbu);OFFSET (VCPU_TIMING_EXIT_TBL , kvm_vcpu, arch.timing_exit.tv32.tbl);
Signature · 1 line
2.31.1
Re: [PATCH v2 1/2] powerpc/kvm: Remove unused macros from asm-offset
Quoted 11 lines · Disha Goel
The kvm code was refactored to convert some of kvm assembly routines to C. This includes commits which moved code path for the kvm guest entry/exit for p7/8 from aseembly to C. As part of the code changes, usage of some of the macros were removed. But definitions still exist in the assembly files. Commits are listed below:
Commit
2e1ae9cd56f8("KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU") Commit9769a7fd79b6("KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path") Commitfae5c9f3664b("KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path") Commit57dc0eed73ca("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C")
Quoted 4 lines
Many of the asm-offset macro definitions were missed to remove. Patch fixes by removing the unused macros.
Signed-off-by Disha Goel <[email protected]>
Thanks, good cleanup.
Quoted 95 lines
--- arch/powerpc/kernel/asm-offsets.c | 25 ------------------------- 1 file changed, 25 deletions(-)arch/powerpc/kernel/asm-offsets.c +0
-25@@ -418,21 +418,18 @@ int main(void)/* book3s */ #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE -OFFSET (KVM_TLB_SETS , kvm, arch.tlb_sets);OFFSET (KVM_SDR1 , kvm, arch.sdr1);OFFSET (KVM_HOST_LPID , kvm, arch.host_lpid);OFFSET (KVM_HOST_LPCR , kvm, arch.host_lpcr);OFFSET (KVM_HOST_SDR1 , kvm, arch.host_sdr1);OFFSET (KVM_ENABLED_HCALLS , kvm, arch.enabled_hcalls);OFFSET (KVM_VRMA_SLB_V , kvm, arch.vrma_slb_v); -OFFSET (KVM_RADIX , kvm, arch.radix);OFFSET (KVM_SECURE_GUEST , kvm, arch.secure_guest);OFFSET (VCPU_DSISR , kvm_vcpu, arch.shregs.dsisr);OFFSET (VCPU_DAR , kvm_vcpu, arch.shregs.dar);OFFSET (VCPU_VPA , kvm_vcpu, arch.vpa.pinned_addr);OFFSET (VCPU_VPA_DIRTY , kvm_vcpu, arch.vpa.dirty);OFFSET (VCPU_HEIR , kvm_vcpu, arch.emul_inst); -OFFSET (VCPU_NESTED , kvm_vcpu, arch.nested);OFFSET (VCPU_CPU , kvm_vcpu, cpu);OFFSET (VCPU_THREAD_CPU , kvm_vcpu, arch.thread_cpu);#endif @@ -449,16 +446,12 @@ int main(void)OFFSET (VCPU_DABRX , kvm_vcpu, arch.dabrx);OFFSET (VCPU_DAWR0 , kvm_vcpu, arch.dawr0);OFFSET (VCPU_DAWRX0 , kvm_vcpu, arch.dawrx0); -OFFSET (VCPU_DAWR1 , kvm_vcpu, arch.dawr1); -OFFSET (VCPU_DAWRX1 , kvm_vcpu, arch.dawrx1);OFFSET (VCPU_CIABR , kvm_vcpu, arch.ciabr);OFFSET (VCPU_HFLAGS , kvm_vcpu, arch.hflags);OFFSET (VCPU_DEC_EXPIRES , kvm_vcpu, arch.dec_expires);OFFSET (VCPU_PENDING_EXC , kvm_vcpu, arch.pending_exceptions);OFFSET (VCPU_CEDED , kvm_vcpu, arch.ceded);OFFSET (VCPU_PRODDED , kvm_vcpu, arch.prodded); -OFFSET (VCPU_IRQ_PENDING , kvm_vcpu, arch.irq_pending); -OFFSET (VCPU_DBELL_REQ , kvm_vcpu, arch.doorbell_request);OFFSET (VCPU_MMCR , kvm_vcpu, arch.mmcr);OFFSET (VCPU_MMCRA , kvm_vcpu, arch.mmcra);OFFSET (VCPU_MMCRS , kvm_vcpu, arch.mmcrs);@@ -486,8 +479,6 @@ int main(void)OFFSET (VCPU_TCSCR , kvm_vcpu, arch.tcscr);OFFSET (VCPU_ACOP , kvm_vcpu, arch.acop);OFFSET (VCPU_WORT , kvm_vcpu, arch.wort); -OFFSET (VCPU_TID , kvm_vcpu, arch.tid); -OFFSET (VCPU_PSSCR , kvm_vcpu, arch.psscr);OFFSET (VCPU_HFSCR , kvm_vcpu, arch.hfscr);OFFSET (VCORE_ENTRY_EXIT , kvmppc_vcore, entry_exit_map);OFFSET (VCORE_IN_GUEST , kvmppc_vcore, in_guest);@@ -582,8 +573,6 @@ int main(void)HSTATE_FIELD (HSTATE_HWTHREAD_STATE , hwthread_state);HSTATE_FIELD (HSTATE_KVM_VCPU , kvm_vcpu);HSTATE_FIELD (HSTATE_KVM_VCORE , kvm_vcore); -HSTATE_FIELD (HSTATE_XIVE_TIMA_PHYS , xive_tima_phys); -HSTATE_FIELD (HSTATE_XIVE_TIMA_VIRT , xive_tima_virt);HSTATE_FIELD (HSTATE_HOST_IPI , host_ipi);HSTATE_FIELD (HSTATE_PTID , ptid);HSTATE_FIELD (HSTATE_FAKE_SUSPEND , fake_suspend);@@ -594,9 +583,6 @@ int main(void)HSTATE_FIELD (HSTATE_SDAR , host_mmcr[4 ]);HSTATE_FIELD (HSTATE_MMCR2 , host_mmcr[5 ]);HSTATE_FIELD (HSTATE_SIER , host_mmcr[6 ]); -HSTATE_FIELD (HSTATE_MMCR3 , host_mmcr[7 ]); -HSTATE_FIELD (HSTATE_SIER2 , host_mmcr[8 ]); -HSTATE_FIELD (HSTATE_SIER3 , host_mmcr[9 ]);HSTATE_FIELD (HSTATE_PMC1 , host_pmc[0 ]);HSTATE_FIELD (HSTATE_PMC2 , host_pmc[1 ]);HSTATE_FIELD (HSTATE_PMC3 , host_pmc[2 ]);@@ -672,17 +658,6 @@ int main(void)OFFSET (VCPU_HOST_MAS6 , kvm_vcpu, arch.host_mas6);#endif -#ifdef CONFIG_KVM_XICS -DEFINE (VCPU_XIVE_SAVED_STATE , offsetof(struct kvm_vcpu , - arch.xive_saved_state)); -DEFINE (VCPU_XIVE_CAM_WORD , offsetof(struct kvm_vcpu , - arch.xive_cam_word)); - DEFINE(VCPU_XIVE_PUSHED, offsetof(struct kvm_vcpu, arch.xive_pushed)); - DEFINE(VCPU_XIVE_ESC_ON, offsetof(struct kvm_vcpu, arch.xive_esc_on)); - DEFINE(VCPU_XIVE_ESC_RADDR, offsetof(struct kvm_vcpu, arch.xive_esc_raddr)); - DEFINE(VCPU_XIVE_ESC_VADDR, offsetof(struct kvm_vcpu, arch.xive_esc_vaddr)); -#endif -#ifdef CONFIG_KVM_EXIT_TIMING OFFSET (VCPU_TIMING_EXIT_TBU , kvm_vcpu, arch.timing_exit.tv32.tbu);OFFSET (VCPU_TIMING_EXIT_TBL , kvm_vcpu, arch.timing_exit.tv32.tbl);Signature · 1 line
2.31.1
PATCH v2 2/2 powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers
In reply to Disha GoelFrom: Kajol Jain" <[email protected]>
Commit 57dc0eed73ca ("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C") removed the PMU save/restore functions from assembly code and implemented these functions in C, for power9 and later platforms.
After the code refactoring, Performance Monitoring Unit (PMU) registers became part of "p9_host_os_sprs" structure and now this structure is used to save/restore pmu host registers, for power9 and later platfroms. But we still have old unused registers references. Patch removes unused host_mmcr references for Monitor Mode Control Register 3 (MMCR3)/ Sampled Instruction Event Register 2 (SIER2)/ SIER3 registers from "struct kvmppc_host_state".
--- arch/powerpc/include/asm/kvm_book3s_asm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/kvm_book3s_asm.h +1 -1
@@ -105,7 +105,7 @@ struct kvmppc_host_state {void __iomem *xive_tima_virt;u32 saved_xirr;u64 dabr; -u64 host_mmcr[10 ];/* MMCR 0,1,A, SIAR, SDAR, MMCR2, SIER, MMCR3, SIER2/3 */ +u64 host_mmcr[7 ];/* MMCR 0,1,A, SIAR, SDAR, MMCR2, SIER */ u32 host_pmc[8 ];u64 host_purr;u64 host_spurr;
Signature · 1 line
2.31.1
Re: [PATCH v2 2/2] powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers
Quoted 14 lines · Disha Goel
From: Kajol Jain" <[email protected]>
Commit
57dc0eed73ca("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C") removed the PMU save/restore functions from assembly code and implemented these functions in C, for power9 and later platforms.After the code refactoring, Performance Monitoring Unit (PMU) registers became part of "
p9_host_os_sprs" structure and now this structure is used to save/restore pmu host registers, for power9 and later platfroms. But we still have old unused registers references. Patch removes unusedhost_mmcrreferences for Monitor Mode Control Register 3 (MMCR3)/ Sampled Instruction Event Register 2 (SIER2)/ SIER3 registers from "structkvmppc_host_state".
Quoted 2 lines
Fixes 57dc0eed73ca ("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C")Signed-off-by Kajol Jain <[email protected]>
And it was increased from 7 to 10 with 5752fe0b811bb which added the POWER10 registers, so that makes sense to go back to 7 in the POWER8 path.
Quoted 19 lines
--- arch/powerpc/include/asm/kvm_book3s_asm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/include/asm/kvm_book3s_asm.h +1
-1@@ -105,7 +105,7 @@ struct kvmppc_host_state {void __iomem *xive_tima_virt;u32 saved_xirr;u64 dabr; -u64 host_mmcr[10 ];/* MMCR 0,1,A, SIAR, SDAR, MMCR2, SIER, MMCR3, SIER2/3 */ +u64 host_mmcr[7 ];/* MMCR 0,1,A, SIAR, SDAR, MMCR2, SIER */ u32 host_pmc[8 ];u64 host_purr;u64 host_spurr;Signature · 1 line
2.31.1
Quoted 10 lines · Disha Goel
The kvm code was refactored to convert some of kvm assembly routines to C. This includes commits which moved code path for the kvm guest entry/exit for p7/8 from aseembly to C. As part of the code changes, usage of some of the macros were removed. But definitions still exist in the assembly files. Commits are listed below:
Quoted 8 lines
Commit
2e1ae9cd56f8("KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU") Commit9769a7fd79b6("KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path") Commitfae5c9f3664b("KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path") Commit57dc0eed73ca("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C")Many of the asm-offset macro definitions were missed to remove. This patchset fixes by removing the unused macro definitions.
For the patchset,
Thanks
Athira
Quoted 32 lines
Patch1 removes a set of unused kvm vcpu and hstate macros from the
asm-offset.cPatch2 removes unused
host_mmcrreferences for MMCR3/SIER2/SIER3Changelog:
v1 -> v2:
Merge all the macro removal part fromasm-offset.cfile into a single patch as suggested by Christophe Leroy.Link to patchset v1:
http://patchwork.ozlabs.org/project/linuxppc-dev/patch/[email protected]/Link to the script used to get unused macro:
https://github.com/maddy-kerneldev/scripts/blob/master/check_asm-offset.shLink to linux-ci job result:
https://github.com/disgoel/linux-ci/actions?query=branch%3Akvmmacro.v2Disha Goel (1):
powerpc/kvm: Remove unused macros from asm-offsetKajol Jain (1):
powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers
arch/powerpc/include/asm/kvm_book3s_asm.h| 2 +-arch/powerpc/kernel/asm-offsets.c| 25 -----------------------2 files changed, 1 insertion(+), 26 deletions(-)Signature · 1 line
2.31.1
Michael Ellerman
AppliedQuoted 6 lines · Disha Goel
The kvm code was refactored to convert some of kvm assembly routines to C. This includes commits which moved code path for the kvm guest entry/exit for p7/8 from aseembly to C. As part of the code changes, usage of some of the macros were removed. But definitions still exist in the assembly files. Commits are listed below:
Quoted 6 lines
Commit
2e1ae9cd56f8("KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU") Commit9769a7fd79b6("KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path") Commitfae5c9f3664b("KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path") Commit57dc0eed73ca("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C")[...]
Applied to powerpc/next.
[1/2] powerpc/kvm: Remove unused macros from asm-offset
https://git.kernel.org/powerpc/c/2223552256dfc48435e0699dbe1e9b8d2cd56b06 [2/2] powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers https://git.kernel.org/powerpc/c/4ac9d3187cc7ccba25f76a3faef3e08a366f77b9
cheers