linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Remove unused macros from asm-offset
@ 2022-09-13  7:40 Disha Goel
  2022-09-13  7:40 ` [PATCH 1/4] powerpc/asm-offset: Remove unused KVM_TLB_SETS macros Disha Goel
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Disha Goel @ 2022-09-13  7:40 UTC (permalink / raw)
  To: mpe; +Cc: atrajeev, kjain, npiggin, maddy, disgoel, linuxppc-dev

There were commits which did code refactoring and converting some of kvm
assembly routines to C. When doing it, many of the asm-offset macro
definitions were missed to remove. Patchset here removes those.

Patch1 removes usage of KVM_TLB_SETS macro from the asm-offset

Patch2 removes KVM_RADIX macro from the asm-offset.c

Patch3 removes a set of unused kvm vcpu and hstate macros from the
asm-offset.c

Patch4 removes unused HSTATE/host_mmcr references for MMCR3/SIER2/SIER3

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

Disha Goel (3):
  powerpc/asm-offset: Remove unused KVM_TLB_SETS macros
  powerpc/asm-offset: Remove unused KVM_RADIX macros
  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(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] powerpc/asm-offset: Remove unused KVM_TLB_SETS macros
  2022-09-13  7:40 [PATCH 0/4] Remove unused macros from asm-offset Disha Goel
@ 2022-09-13  7:40 ` Disha Goel
  2022-09-13  7:40 ` [PATCH 2/4] powerpc/asm-offset: Remove unused KVM_RADIX macros Disha Goel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Disha Goel @ 2022-09-13  7:40 UTC (permalink / raw)
  To: mpe; +Cc: atrajeev, kjain, npiggin, maddy, disgoel, linuxppc-dev

Commit 2e1ae9cd56f8 ("KVM: PPC: Book3S HV: Implement radix
prefetch workaround by disabling MMU") removed usage of
KVM_TLB_SETS macro as part of fixing radix prefetch workaround.
But the patch missed to remove the asm-offset macro definition
which was used in the assembly files and now this is un-used.
Patch fixes by removing this.

Fixes: 2e1ae9cd56f8 ("KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU")
Signed-off-by: Disha Goel <disgoel@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/asm-offsets.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 8c10f536e478..d5d9c1dcef1c 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -418,7 +418,6 @@ 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);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] powerpc/asm-offset: Remove unused KVM_RADIX macros
  2022-09-13  7:40 [PATCH 0/4] Remove unused macros from asm-offset Disha Goel
  2022-09-13  7:40 ` [PATCH 1/4] powerpc/asm-offset: Remove unused KVM_TLB_SETS macros Disha Goel
@ 2022-09-13  7:40 ` Disha Goel
  2022-09-13  7:40 ` [PATCH 3/4] powerpc/kvm: Remove unused macros from asm-offset Disha Goel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Disha Goel @ 2022-09-13  7:40 UTC (permalink / raw)
  To: mpe; +Cc: atrajeev, kjain, npiggin, maddy, disgoel, linuxppc-dev

Commit 9769a7fd79b6 ("KVM: PPC: Book3S HV: Remove radix
guest support from P7/8 path") removed the radix guest
support from P7/8 path since the P9 path now supports of
all the supported radix guest. But missed to remove
KVM_RADIX from the asm-offset. Patch fixes by removing it.

Fixes: 9769a7fd79b6 ("KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path")
Signed-off-by: Disha Goel <disgoel@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/asm-offsets.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index d5d9c1dcef1c..88a329d74d23 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -424,7 +424,6 @@ int main(void)
 	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);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] powerpc/kvm: Remove unused macros from asm-offset
  2022-09-13  7:40 [PATCH 0/4] Remove unused macros from asm-offset Disha Goel
  2022-09-13  7:40 ` [PATCH 1/4] powerpc/asm-offset: Remove unused KVM_TLB_SETS macros Disha Goel
  2022-09-13  7:40 ` [PATCH 2/4] powerpc/asm-offset: Remove unused KVM_RADIX macros Disha Goel
@ 2022-09-13  7:40 ` Disha Goel
  2022-09-13  7:40 ` [PATCH 4/4] powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers Disha Goel
  2022-09-13  8:15 ` [PATCH 0/4] Remove unused macros from asm-offset Christophe Leroy
  4 siblings, 0 replies; 7+ messages in thread
From: Disha Goel @ 2022-09-13  7:40 UTC (permalink / raw)
  To: mpe; +Cc: atrajeev, kjain, npiggin, maddy, disgoel, linuxppc-dev

Commit fae5c9f3664b ("KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1
support from P7/8 path") moved code path for the kvm guest entry/exit
for p7/8 from aseembly to C. But the patch missed to remove the
asm-offset macro definitions which were used in the assembly files
and now they are un-used. Patch fixes by removing those.

Fixes: fae5c9f3664b ("KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path")
Signed-off-by: Disha Goel <disgoel@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/asm-offsets.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 88a329d74d23..90235288cc1a 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -430,7 +430,6 @@ int main(void)
 	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
@@ -447,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);
@@ -484,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);
@@ -580,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);
@@ -670,17 +661,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);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers
  2022-09-13  7:40 [PATCH 0/4] Remove unused macros from asm-offset Disha Goel
                   ` (2 preceding siblings ...)
  2022-09-13  7:40 ` [PATCH 3/4] powerpc/kvm: Remove unused macros from asm-offset Disha Goel
@ 2022-09-13  7:40 ` Disha Goel
  2022-09-13  8:15 ` [PATCH 0/4] Remove unused macros from asm-offset Christophe Leroy
  4 siblings, 0 replies; 7+ messages in thread
From: Disha Goel @ 2022-09-13  7:40 UTC (permalink / raw)
  To: mpe; +Cc: atrajeev, kjain, npiggin, maddy, disgoel, linuxppc-dev

From: Kajol Jain <kjain@linux.ibm.com>

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
HSTATE/host_mmcr references for Monitor Mode Control Register 3 (MMCR3)/
Sampled Instruction Event Register 2 (SIER2)/ SIER3 registers from
"struct kvmppc_host_state".

Fixes: 57dc0eed73ca ("KVM: PPC: Book3S HV P9: Implement PMU save/restore in C")
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
 arch/powerpc/include/asm/kvm_book3s_asm.h | 2 +-
 arch/powerpc/kernel/asm-offsets.c         | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index c8882d9b86c2..a36797938620 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -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;
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 90235288cc1a..95744e7c056d 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -583,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]);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] Remove unused macros from asm-offset
  2022-09-13  7:40 [PATCH 0/4] Remove unused macros from asm-offset Disha Goel
                   ` (3 preceding siblings ...)
  2022-09-13  7:40 ` [PATCH 4/4] powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers Disha Goel
@ 2022-09-13  8:15 ` Christophe Leroy
  2022-09-14 11:20   ` Disha Goel
  4 siblings, 1 reply; 7+ messages in thread
From: Christophe Leroy @ 2022-09-13  8:15 UTC (permalink / raw)
  To: Disha Goel, mpe@ellerman.id.au
  Cc: kjain@linux.ibm.com, atrajeev@linux.vnet.ibm.com,
	linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
	npiggin@gmail.com



Le 13/09/2022 à 09:40, Disha Goel a écrit :
> There were commits which did code refactoring and converting some of kvm
> assembly routines to C. When doing it, many of the asm-offset macro
> definitions were missed to remove. Patchset here removes those.
> 
> Patch1 removes usage of KVM_TLB_SETS macro from the asm-offset
> 
> Patch2 removes KVM_RADIX macro from the asm-offset.c
> 
> Patch3 removes a set of unused kvm vcpu and hstate macros from the
> asm-offset.c
> 
> Patch4 removes unused HSTATE/host_mmcr references for MMCR3/SIER2/SIER3

I think you can squash all changes to asm-offsets.c into a single patch.
The Fixes: tags are unrelevant, you are not fixing a real bug, it's just 
a cleanup.

Then have a second patch that reduces the size of host_mmcr[] in 
kvmppc_host_state struct.

Thanks
Christophe

> 
> 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
> 
> Disha Goel (3):
>    powerpc/asm-offset: Remove unused KVM_TLB_SETS macros
>    powerpc/asm-offset: Remove unused KVM_RADIX macros
>    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(-)
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] Remove unused macros from asm-offset
  2022-09-13  8:15 ` [PATCH 0/4] Remove unused macros from asm-offset Christophe Leroy
@ 2022-09-14 11:20   ` Disha Goel
  0 siblings, 0 replies; 7+ messages in thread
From: Disha Goel @ 2022-09-14 11:20 UTC (permalink / raw)
  To: Christophe Leroy, Disha Goel, mpe@ellerman.id.au
  Cc: kjain@linux.ibm.com, atrajeev@linux.vnet.ibm.com,
	linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
	npiggin@gmail.com


On 9/13/22 1:45 PM, Christophe Leroy wrote:
>
> Le 13/09/2022 à 09:40, Disha Goel a écrit :
>> There were commits which did code refactoring and converting some of kvm
>> assembly routines to C. When doing it, many of the asm-offset macro
>> definitions were missed to remove. Patchset here removes those.
>>
>> Patch1 removes usage of KVM_TLB_SETS macro from the asm-offset
>>
>> Patch2 removes KVM_RADIX macro from the asm-offset.c
>>
>> Patch3 removes a set of unused kvm vcpu and hstate macros from the
>> asm-offset.c
>>
>> Patch4 removes unused HSTATE/host_mmcr references for MMCR3/SIER2/SIER3
> I think you can squash all changes to asm-offsets.c into a single patch.
> The Fixes: tags are unrelevant, you are not fixing a real bug, it's just
> a cleanup.
>
> Then have a second patch that reduces the size of host_mmcr[] in
> kvmppc_host_state struct.

Hi Christophe,

Thanks for reviewing the patchset. I will send v2 patchset with 
mentioned changes.


Thanks

Disha

> Thanks
> Christophe
>
>> 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
>>
>> Disha Goel (3):
>>     powerpc/asm-offset: Remove unused KVM_TLB_SETS macros
>>     powerpc/asm-offset: Remove unused KVM_RADIX macros
>>     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(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-14 12:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-13  7:40 [PATCH 0/4] Remove unused macros from asm-offset Disha Goel
2022-09-13  7:40 ` [PATCH 1/4] powerpc/asm-offset: Remove unused KVM_TLB_SETS macros Disha Goel
2022-09-13  7:40 ` [PATCH 2/4] powerpc/asm-offset: Remove unused KVM_RADIX macros Disha Goel
2022-09-13  7:40 ` [PATCH 3/4] powerpc/kvm: Remove unused macros from asm-offset Disha Goel
2022-09-13  7:40 ` [PATCH 4/4] powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers Disha Goel
2022-09-13  8:15 ` [PATCH 0/4] Remove unused macros from asm-offset Christophe Leroy
2022-09-14 11:20   ` Disha Goel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).