From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C649CC433F5 for ; Sat, 16 Oct 2021 21:19:48 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 32E5061164 for ; Sat, 16 Oct 2021 21:19:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 32E5061164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9C5AA4B191; Sat, 16 Oct 2021 17:19:47 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rf0AaL1O2KIa; Sat, 16 Oct 2021 17:19:46 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 608E64B17C; Sat, 16 Oct 2021 17:19:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0F2864B174 for ; Sat, 16 Oct 2021 17:19:45 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WNxZsWo605uO for ; Sat, 16 Oct 2021 17:19:43 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id D26E14B0E6 for ; Sat, 16 Oct 2021 17:19:43 -0400 (EDT) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 370646115C; Sat, 16 Oct 2021 21:19:41 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mbr5e-00HFJL-Vc; Sat, 16 Oct 2021 22:19:39 +0100 Date: Sat, 16 Oct 2021 22:19:38 +0100 Message-ID: <877decvf9x.wl-maz@kernel.org> From: Marc Zyngier To: Chenxu Wang Subject: Re: Problems about Stage-2 translation In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: irakatz51@gmail.com, kvmarm@lists.cs.columbia.edu X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Sat, 16 Oct 2021 13:21:01 +0100, Chenxu Wang wrote: > > Hi all, > > I am facing two problems with the Stage-2 translation in KVM. > > (1) > I reserve a memory region (e.g., 0xa000_0000 ~ 0xa020_0000) from DRAM space > of HostOS, and fill it with some values. Then ask a GuestVM to access this > region. > > void __iomem *region=ioremap(0xa0000000, 0x1000); > uint32_t val=ioread32(region); > > But I get value 0, which is not the expected value. It is the expected behaviour. > I guess the reason is that the Stage-2 translation of the GuestVM does not > map the reserved region, but it should return a translation fault, rather > than 0. So I feel confused, could you provide some helpful explanation? Why should the guest see a translation fault? After all, the whole point of KVM is to transparently handle the translation fault and map a page on demand. > (2) > I consider mapping a region with the Stage-2 translation. I find that KVM > create the stage-2 table with kvm_alloc_stage2_pgd(). But I could not find > a function that can "arbitrarily add a stage-2 mapping to the physical > address in HostOS" when the VM is activated. > > Could you provide such functions? Follow the translation fault path in KVM, and you will find what you are asking for. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm