From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2] xsm: add device tree labeling support Date: Fri, 13 Mar 2015 10:05:00 +0000 Message-ID: <5502B64C.6080808@linaro.org> References: <1426192942-6029-1-git-send-email-dgdegra@tycho.nsa.gov> <5502BA930200007800069A16@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YWMSo-0002Mt-6h for xen-devel@lists.xenproject.org; Fri, 13 Mar 2015 10:05:06 +0000 Received: by wggx13 with SMTP id x13so22131680wgg.4 for ; Fri, 13 Mar 2015 03:05:03 -0700 (PDT) In-Reply-To: <5502BA930200007800069A16@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , Daniel De Graaf Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Hi Jan, On 13/03/2015 09:23, Jan Beulich wrote: >>>> On 12.03.15 at 21:42, wrote: >> @@ -1999,11 +2055,23 @@ int policydb_read(struct policydb *p, void *fp) >> "Old xen policy does not support iomemcon"); >> goto bad; >> } >> - rc = next_entry(buf, fp, sizeof(u32) *2); >> - if ( rc < 0 ) >> - goto bad; >> - c->u.iomem.low_iomem = le32_to_cpu(buf[0]); >> - c->u.iomem.high_iomem = le32_to_cpu(buf[1]); >> + if ( p->policyvers >= POLICYDB_VERSION_XEN_DEVICETREE ) >> + { >> + u64 b64[2]; >> + rc = next_entry(b64, fp, sizeof(u64) *2); >> + if ( rc < 0 ) >> + goto bad; >> + c->u.iomem.low_iomem = le64_to_cpu(b64[0]); >> + c->u.iomem.high_iomem = le64_to_cpu(b64[1]); >> + } >> + else >> + { >> + rc = next_entry(buf, fp, sizeof(u32) *2); >> + if ( rc < 0 ) >> + goto bad; >> + c->u.iomem.low_iomem = le32_to_cpu(buf[0]); >> + c->u.iomem.high_iomem = le32_to_cpu(buf[1]); >> + } > > I might be completely wrong (knowing next to nothing about XSM), > but how is the permissible I/O mem range tied to DT (as expressed > by POLICYDB_VERSION_XEN_DEVICETREE)? All systems with > valid page frame number possibly being wider than 32 bits would > need this extension, i.e. namely also x86. I guess the name POLICYDB_VERSION_XEN_DEVICETREE was arbitrarily chose. The policy version 30 adds support for both device tree and 64 bits iomem. Although, I'm wondering if we should deny policy < 30 on newer Xen because a truncation on the MMIO pfns may occurs and give access to the wrong pfn. Regards, -- Julien Grall