From patchwork Fri Jul 27 14:10:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 1249931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 04B433FDCA for ; Fri, 27 Jul 2012 14:16:01 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SulGD-0002wy-0d; Fri, 27 Jul 2012 14:11:21 +0000 Received: from smtp.ctxuk.citrix.com ([62.200.22.115] helo=SMTP.EU.CITRIX.COM) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SulG3-0002uu-CK for linux-arm-kernel@lists.infradead.org; Fri, 27 Jul 2012 14:11:12 +0000 X-IronPort-AV: E=Sophos;i="4.77,667,1336348800"; d="scan'208";a="13736617" Received: from lonpmailmx01.citrite.net ([10.30.203.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP/TLS/RC4-MD5; 27 Jul 2012 14:11:06 +0000 Received: from kaball.uk.xensource.com (10.80.2.59) by LONPMAILMX01.citrite.net (10.30.203.162) with Microsoft SMTP Server id 8.3.213.0; Fri, 27 Jul 2012 15:11:06 +0100 Date: Fri, 27 Jul 2012 15:10:13 +0100 From: Stefano Stabellini X-X-Sender: sstabellini@kaball.uk.xensource.com To: Jan Beulich Subject: Re: [Xen-devel] [PATCH 17/24] xen: allow privcmd for HVM guests In-Reply-To: <5012598C0200007800090DB9@nat28.tlf.novell.com> Message-ID: References: <1343316846-25860-17-git-send-email-stefano.stabellini@eu.citrix.com> <5012598C0200007800090DB9@nat28.tlf.novell.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Note: SpamAssassin invocation failed Cc: "xen-devel@lists.xensource.com" , "linaro-dev@lists.linaro.org" , Ian Campbell , "arnd@arndb.de" , Stefano Stabellini , "catalin.marinas@arm.com" , "konrad.wilk@oracle.com" , "Tim \(Xen.org\)" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Fri, 27 Jul 2012, Jan Beulich wrote: > >>> On 26.07.12 at 17:33, Stefano Stabellini wrote: > > In order for privcmd mmap to work correctly, xen_remap_domain_mfn_range > > needs to be implemented for HVM guests. > > If it is not, mmap is going to fail later on. > > Somehow, for me at least, this description doesn't connect to the > actual change. We can remove the "return -ENOSYS" from privcmd_mmap but the actual mmap is still not going to work unless xen_remap_domain_mfn_range is implemented correctly. The x86 implementation of xen_remap_domain_mfn_range is PV only so it is not going to work for HVM or auto_translated_physmap guests. As a result mmap_batch_fn is going to fail. > > Signed-off-by: Stefano Stabellini > > --- > > drivers/xen/privcmd.c | 4 ---- > > 1 files changed, 0 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c > > index ccee0f1..85226cb 100644 > > --- a/drivers/xen/privcmd.c > > +++ b/drivers/xen/privcmd.c > > @@ -380,10 +380,6 @@ static struct vm_operations_struct privcmd_vm_ops = { > > > > static int privcmd_mmap(struct file *file, struct vm_area_struct *vma) > > { > > - /* Unsupported for auto-translate guests. */ > > - if (xen_feature(XENFEAT_auto_translated_physmap)) > > - return -ENOSYS; > > - > > Is this safe on x86? > It is safe in the sense that is not going to crash dom0 or the hypervisor, but it is not going to work. Actually in order for it to be safe we need this additional change: diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 3a73785..885a223 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -2310,6 +2310,9 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, unsigned long range; int err = 0; + if (xen_feature(XENFEAT_auto_translated_physmap)) + return -EINVAL; + prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP); BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_RESERVED | VM_IO)) ==