<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 21-Jul-2020, at 9:24 AM, Paul Mackerras <<a href="mailto:paulus@ozlabs.org" class="">paulus@ozlabs.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On Fri, Jul 17, 2020 at 10:38:14AM -0400, Athira Rajeev wrote:<br class=""><blockquote type="cite" class="">Currently `kvm_vcpu_arch` stores all Monitor Mode Control registers<br class="">in a flat array in order: mmcr0, mmcr1, mmcra, mmcr2, mmcrs<br class="">Split this to give mmcra and mmcrs its own entries in vcpu and<br class="">use a flat array for mmcr0 to mmcr2. This patch implements this<br class="">cleanup to make code easier to read.<br class=""></blockquote><br class="">Changing the way KVM stores these values internally is fine, but<br class="">changing the user ABI is not.  This part:<br class=""><br class=""><blockquote type="cite" class="">diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h<br class="">index 264e266..e55d847 100644<br class="">--- a/arch/powerpc/include/uapi/asm/kvm.h<br class="">+++ b/arch/powerpc/include/uapi/asm/kvm.h<br class="">@@ -510,8 +510,8 @@ struct kvm_ppc_cpu_char {<br class=""><br class=""> #define KVM_REG_PPC_MMCR0<span class="Apple-tab-span" style="white-space:pre">       </span>(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10)<br class=""> #define KVM_REG_PPC_MMCR1<span class="Apple-tab-span" style="white-space:pre">      </span>(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11)<br class="">-#define KVM_REG_PPC_MMCRA<span class="Apple-tab-span" style="white-space:pre">      </span>(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12)<br class="">-#define KVM_REG_PPC_MMCR2<span class="Apple-tab-span" style="white-space:pre">      </span>(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x13)<br class="">+#define KVM_REG_PPC_MMCR2<span class="Apple-tab-span" style="white-space:pre">      </span>(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12)<br class="">+#define KVM_REG_PPC_MMCRA<span class="Apple-tab-span" style="white-space:pre">      </span>(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x13)<br class=""></blockquote><br class="">means that existing userspace programs that used to work would now be<br class="">broken.  That is not acceptable (breaking the user ABI is only ever<br class="">acceptable with a very compelling reason).  So NAK to this part of the<br class="">patch.<br class=""></div></div></blockquote><div><br class=""></div>Hi Paul</div><div><br class=""></div><div>Thanks for checking the patch. I understood your point on user ABI breakage that this particular change can cause.</div><div>I will retain original KVM_REG_PPC_MMCRA and KVM_REG_PPC_MMCR2 order in `kvm.h`</div><div>And with that, additionally I will need below change ( on top of current patch ) for my clean up updates for kvm cpu MMCR to work,</div><div>Because now <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">mmcra and mmcrs will have its own entries in vcpu</span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""> and is not part of the mmcr[] array</span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">Please suggest if this looks good</span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><br class=""></span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">Thanks</span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">Athira </span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><br class=""></span></div><div>—</div><div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">index 3f90eee261fc..b10bb404f0d5 100644</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">--- a/arch/powerpc/kvm/book3s_hv.c</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+++ b/arch/powerpc/kvm/book3s_hv.c</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">@@ -1679,10 +1679,13 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">        case KVM_REG_PPC_UAMOR:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                *val = get_reg_val(id, vcpu->arch.uamor);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">-       case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCR2:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+       case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCR1:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                i = id - KVM_REG_PPC_MMCR0;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                *val = get_reg_val(id, vcpu->arch.mmcr[i]);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+       case KVM_REG_PPC_MMCR2:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+               *val = get_reg_val(id, vcpu->arch.mmcr[2]);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+               break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">        case KVM_REG_PPC_MMCRA:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                *val = get_reg_val(id, vcpu->arch.mmcra);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">@@ -1906,10 +1909,13 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">        case KVM_REG_PPC_UAMOR:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                vcpu->arch.uamor = set_reg_val(id, *val);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">-       case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCR2:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+       case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCR1:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                i = id - KVM_REG_PPC_MMCR0;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                vcpu->arch.mmcr[i] = set_reg_val(id, *val);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+       case KVM_REG_PPC_MMCR2:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+               vcpu->arch.mmcr[2] = set_reg_val(id, *val);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">+               break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">        case KVM_REG_PPC_MMCRA:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                vcpu->arch.mmcra = set_reg_val(id, *val);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">                break;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class="">—</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";" class=""><br class=""></div></div><div><blockquote type="cite" class=""><div class=""><div class=""><br class="">Regards,<br class="">Paul.<br class=""></div></div></blockquote></div><br class=""></body></html>