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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B7DDC33CB1 for ; Sun, 19 Jan 2020 17:43:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EA68206B7 for ; Sun, 19 Jan 2020 17:43:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iNzbACXX"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="RmLd1ry7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EA68206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jtPYemx6Awqy9i6c9n4mkIeFSK1yqTw9Dnqxd/S62dY=; b=iNzbACXXspmXQ7 tJ+WtQoPOG24VMSLraNKVDRos0a5h86zgnMIFvUaZBUZL5OliOU4AJPEiqgN7BY7nbdaynb4vRFmx aaYHpLpDQ1NQsJob2Gu6uyie1QPx79KIUPpX0BH8WXiOlmZov5aOQla00vtv5P9mE6WeEyrng3nyz YuXEryB+Fz4rq7CmzRDWqjmCAZHxMJ0m5FvzPO3vZFE2v0gwNowsnp+f7Vn0Voed9bPbPVkDiQxb1 IxiD/ISKcnB5pvhjo9qJ3QXP+pinDz+TdAL6ZrtMFrFE/GdRb2uhSWyBC480PL3EXPgOQXFJTSMWK Md3ZLFZ/ipRonJDLQvgA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1itEbo-0003KY-BF; Sun, 19 Jan 2020 17:43:36 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1itEbk-0003K6-A4 for linux-arm-kernel@lists.infradead.org; Sun, 19 Jan 2020 17:43:34 +0000 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 01D4320674; Sun, 19 Jan 2020 17:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579455811; bh=R0N0qdRvwA0CSQsT/alDM97aT/J/0dgnyJzGEbfyDhM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RmLd1ry7lvMf/1dyH4I/wdco57Za4aj+As791DgPUn2DNnmdDV+6tnrt+HS+AWocT uTjnpfDYIuUpZ8yHToVG8n4Aa32cyZe/DIZAYjNfuJKmSQ91ADCQBXVcWJ04j5UBQd wDW5WgEHkPIau9KIyF3uJY1j3D3QKFsI4h0oKyeo= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1itEbg-0004D7-P4; Sun, 19 Jan 2020 17:43:28 +0000 Date: Sun, 19 Jan 2020 17:43:27 +0000 From: Marc Zyngier To: Russell King Subject: Re: [PATCH v2] arm64: kvm: fix IDMAP overlap with HYP VA Message-ID: <20200119174327.4b2c514e@why> In-Reply-To: References: Organization: Approximate X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: rmk+kernel@armlinux.org.uk, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200119_094332_369959_FC27ADA9 X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Suzuki K Poulose , Catalin Marinas , James Morse , Julien Thierry , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, 28 Dec 2019 11:57:14 +0000 Russell King wrote: > Booting 5.4 on LX2160A reveals that KVM is non-functional: > > kvm: Limiting the IPA size due to kernel Virtual Address limit > kvm [1]: IPA Size Limit: 43bits > kvm [1]: IDMAP intersecting with HYP VA, unable to continue > kvm [1]: error initializing Hyp mode: -22 > > Debugging shows: > > kvm [1]: IDMAP page: 81a26000 > kvm [1]: HYP VA range: 0:22ffffffff > > as RAM is located at: > > 80000000-fbdfffff : System RAM > 2080000000-237fffffff : System RAM > > Comparing this with the same kernel on Armada 8040 shows: > > kvm: Limiting the IPA size due to kernel Virtual Address limit > kvm [1]: IPA Size Limit: 43bits > kvm [1]: IDMAP page: 2a26000 > kvm [1]: HYP VA range: 4800000000:493fffffff > ... > kvm [1]: Hyp mode initialized successfully > > which indicates that hyp_va_msb is set, and is always set to the > opposite value of the idmap page to avoid the overlap. This does not > happen with the LX2160A. > > Further debugging shows vabits_actual = 39, kva_msb = 38 on LX2160A and > kva_msb = 33 on Armada 8040. Looking at the bit layout of the HYP VA, > there is still one bit available for hyp_va_msb. Set this bit > appropriately. This allows kvm to be functional on the LX2160A, but > without any HYP VA randomisation: > > kvm: Limiting the IPA size due to kernel Virtual Address limit > kvm [1]: IPA Size Limit: 43bits > kvm [1]: IDMAP page: 81a24000 > kvm [1]: HYP VA range: 4000000000:62ffffffff > ... > kvm [1]: Hyp mode initialized successfully > > Signed-off-by: Russell King I've applied this to kvmarm-next with a couple of cleanups, and preserving the fallback when the tag is zero (only the mask gets applied, without any ROR or ADD). M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel