From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Laight Date: Mon, 14 Aug 2023 08:15:41 +0000 Subject: RE: [PATCH v3 4/6] KVM: PPC: Book3s HV: Hold LPIDs in an unsigned long Message-Id: <014488c6d90446f38154a2f7645aa053@AcuMS.aculab.com> List-Id: References: <20230807014553.1168699-1-jniethe5@gmail.com> <20230807014553.1168699-5-jniethe5@gmail.com> In-Reply-To: <20230807014553.1168699-5-jniethe5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: 'Jordan Niethe' , "linuxppc-dev@lists.ozlabs.org" Cc: "mikey@neuling.org" , "sbhat@linux.ibm.com" , "kvm@vger.kernel.org" , "amachhiw@linux.vnet.ibm.com" , "gautam@linux.ibm.com" , "npiggin@gmail.com" , "kvm-ppc@vger.kernel.org" , "vaibhav@linux.ibm.com" , "kconsul@linux.vnet.ibm.com" From: Jordan Niethe > Sent: 07 August 2023 02:46 > > The LPID register is 32 bits long. The host keeps the lpids for each > guest in an unsigned word struct kvm_arch. Currently, LPIDs are already > limited by mmu_lpid_bits and KVM_MAX_NESTED_GUESTS_SHIFT. > > The nestedv2 API returns a 64 bit "Guest ID" to be used be the L1 host > for each L2 guest. This value is used as an lpid, e.g. it is the > parameter used by H_RPT_INVALIDATE. To minimize needless special casing > it makes sense to keep this "Guest ID" in struct kvm_arch::lpid. > > This means that struct kvm_arch::lpid is too small so prepare for this > and make it an unsigned long. This is not a problem for the KVM-HV and > nestedv1 cases as their lpid values are already limited to valid ranges > so in those contexts the lpid can be used as an unsigned word safely as > needed. Shouldn't it be changed to u64? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)