From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Date: Fri, 06 Sep 2019 16:32:41 +0000 Subject: Re: [PATCH v7 1/7] kvmppc: Driver to manage pages of secure guest Message-Id: <20190906163241.GA12516@lst.de> List-Id: References: <20190822102620.21897-1-bharata@linux.ibm.com> <20190822102620.21897-2-bharata@linux.ibm.com> <20190829083810.GA13039@lst.de> <20190830034259.GD31913@in.ibm.com> <20190902075356.GA28967@lst.de> <20190906113639.GA8748@in.ibm.com> In-Reply-To: <20190906113639.GA8748@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bharata B Rao Cc: Christoph Hellwig , linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, linux-mm@kvack.org, paulus@au1.ibm.com, aneesh.kumar@linux.vnet.ibm.com, jglisse@redhat.com, linuxram@us.ibm.com, sukadev@linux.vnet.ibm.com, cclaudio@linux.ibm.com On Fri, Sep 06, 2019 at 05:06:39PM +0530, Bharata B Rao wrote: > > Also is bit 56+ a set of values, so is there 1 << 56 and 3 << 56 as well? Seems > > like even that other patch doesn't fully define these "pfn" values. > > I realized that the bit numbers have changed, it is no longer bits 60:56, > but instead top 8bits. > > #define KVMPPC_RMAP_UVMEM_PFN 0x0200000000000000 > static inline bool kvmppc_rmap_is_uvmem_pfn(unsigned long *rmap) > { > return ((*rmap & 0xff00000000000000) = KVMPPC_RMAP_UVMEM_PFN); > } In that overall scheme I'd actually much prefer something like (names just made up, they should vaguely match the spec this written to): static inline unsigned long kvmppc_rmap_type(unsigned long *rmap) { return (rmap & 0xff00000000000000); } And then where you check it you can use: if (kvmppc_rmap_type(*rmap) = KVMPPC_RMAP_UVMEM_PFN) and where you set it you do: *rmap |= KVMPPC_RMAP_UVMEM_PFN; as in the current patch to keep things symmetric.