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.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 40E72C33CAF for ; Sun, 19 Jan 2020 19:44:16 +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 11D5D20679 for ; Sun, 19 Jan 2020 19:44:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oU69yXvn"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="lnGZsRNo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11D5D20679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk 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:In-Reply-To:MIME-Version:References: 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=C1WnvCGqFeC0g9W+f4aVAHo2OsKbG4aDcguVKxJft20=; b=oU69yXvn1Kfd1x rs8Pq2K/8/WppCtGi9J2NEQbMs718BLFkeDVgOwYqbsHw48eVGy95NuOKfLRX4J5zb0CXVJWf/vUZ gIRW52HgJlAITotdQdPrE7AjmY45vob69meia2rV8qcfhs9cqj3WvkrAIhszW1nCyuvsBHcoinOYh n0FIgrPURpf75EyqmHACV4WqFaNliP3HscjMhnM2k8XoUFatFQT8HLXeYq3Infb4JpCm2A1L6ZoRl a/A433OYUlfZYqMpkR2XPlXK6t1TQtjGTZcB7FvnNZVdnTDasfrZ05qS4UlJKxk/vTKzZEPTN/HrR JgGs4ZyeILWJRgu7BEpA==; 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 1itGUS-0007oT-A0; Sun, 19 Jan 2020 19:44:08 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1itGUO-0007nu-1Z for linux-arm-kernel@lists.infradead.org; Sun, 19 Jan 2020 19:44:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3z7zbcC6+n0ijVHwdWGh6TJYkP0ZMZNW/76LdpCfz2M=; b=lnGZsRNopbJxj2FTf8JDa48y7 B1t1nQaMIi9rDCTtt3Hsz8CzHM+mudBxXR5dgMaU7tFbqU3BkIORoSTa1gR+xjukxXR6ijxKCxwEL L2pjo0pMQsVD5JGYaJRCvZhSALLq9Xhj2YBQjpFVPHR8sIP1ExLNwyvd0Kze4FRz9WD+4xUyRM0Bb soGTxz1ERuZtAmDWnHTVLls9gT+lwIVNVohPYBZBn8S6nh6gNI+f5/2ItaYrdX7Pxs/6MIIXWuFnJ lGWb2kVMVYSzD+rj0MovK/ZBYuzr6PIMMZljI73ZUvIgzPYN6PLJ8/JcDfsE1EiRvzOOW16QFRd/V pL9hFXS1g==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:40530) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1itGU4-0001ez-Cy; Sun, 19 Jan 2020 19:43:44 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1itGU0-00025u-NL; Sun, 19 Jan 2020 19:43:40 +0000 Date: Sun, 19 Jan 2020 19:43:40 +0000 From: Russell King - ARM Linux admin To: Marc Zyngier Subject: Re: [PATCH v2] arm64: kvm: fix IDMAP overlap with HYP VA Message-ID: <20200119194340.GW25745@shell.armlinux.org.uk> References: <20200119174327.4b2c514e@why> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200119174327.4b2c514e@why> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200119_114404_248661_B796776C X-CRM114-Status: GOOD ( 20.17 ) 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 Sun, Jan 19, 2020 at 05:43:27PM +0000, Marc Zyngier wrote: > 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). If only the mask is applied, then it will overlap with the IDMAP region, and KVM will fail - so I think it would be a good idea in that case to print something a little more useful, rather than attributing the KVM failure to an overlap of IDMAP and the KVM range. The real problem is there aren't enough VA bits to allow the KVM range to be adequately placed, rather than the overlap itself. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel