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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F336C54798 for ; Fri, 23 Feb 2024 17:02:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A04A6B0075; Fri, 23 Feb 2024 12:02:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 850786B007B; Fri, 23 Feb 2024 12:02:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F0756B007D; Fri, 23 Feb 2024 12:02:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5D3DB6B0075 for ; Fri, 23 Feb 2024 12:02:19 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ED1C6121195 for ; Fri, 23 Feb 2024 17:02:18 +0000 (UTC) X-FDA: 81823686756.17.E334997 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf30.hostedemail.com (Postfix) with ESMTP id 4A23480031 for ; Fri, 23 Feb 2024 17:02:15 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kE6gJjYI; spf=pass (imf30.hostedemail.com: domain of maz@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=maz@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708707737; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6b2pWRJ9Oa6e5bETaL9X/tYcqrG4xiBTy/MDt/29XMI=; b=Rs+Uss2P4+joAoLQM2OxycC+OZxWUWztTDl4mxp/7yOAL1k59NQzon7rMLWueSC0gqdDD4 uYcssc/M3x97j9TPdU2vggRx6cl0J0SQzvBQl+oGMobWvAlSWDKj6r1Kbn0KWooXcGr+w5 RzAuToFffdNK+/rjjCf38NFY8gxOnbk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708707737; a=rsa-sha256; cv=none; b=WYIIjPpFQfqEJEMsANqBG81UtBLSOhgtt2JIW3/V90P8Bz9ScVF+Z436rtjFLh8IUA6vUJ HJ87c1+hor2DZ4CSp9jIzi286JFZJUQyOGpUzTjkTOpcUGNqijhedAKwKxYw/BFS8G8jvB XLAMG1AAQXXfc5y0w1YhML0PZTTcS9Y= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kE6gJjYI; spf=pass (imf30.hostedemail.com: domain of maz@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=maz@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 81774CE2DA0; Fri, 23 Feb 2024 17:02:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACDAAC433C7; Fri, 23 Feb 2024 17:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708707731; bh=bK6MUj0ihY6O0q0AWMV5Wk/jMqKJGmt8hsDBwlu4A6Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kE6gJjYIsGH8AsPpO83eJ+g/DPLuomiNo+JyVL51HgR+r0a2J8av5JA+Yg2fJkl8M QfVisl5FK+CadKD8UhtrEm/6qymZvkFLRE5zBr3RQ8BAVpeo7OJ+pkhIetLorVaorB VtV6WgIc+DVZd/Jv2jlUFRRyze2X+GMgeIVC4V0I91zcFHHWwVfXhnL+P1UgZqO6Zv 4L192KNlIg0rc1cE9kxCkw1EG5RJupdIe98kG4YzOG/hQuz21XtAs0YVLKM2XdxIk2 g+M0X15L6NZnVaRixdvEBj8GudTieYGEf46FdKdS1TD39uq/W36ZkWwir918d56WFo +E5swKTwgmj8g== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rdYw5-006A9I-0t; Fri, 23 Feb 2024 17:02:09 +0000 Date: Fri, 23 Feb 2024 17:02:08 +0000 Message-ID: <86jzmv2jxr.wl-maz@kernel.org> From: Marc Zyngier To: Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v8 0/4] kvm: arm64: allow the VM to select DEVICE_* and NORMAL_NC for IO memory In-Reply-To: <20240220072926.6466-1-ankita@nvidia.com> References: <20240220072926.6466-1-ankita@nvidia.com> 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/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ankita@nvidia.com, jgg@nvidia.com, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, reinette.chatre@intel.com, surenb@google.com, stefanha@redhat.com, brauner@kernel.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, alex.williamson@redhat.com, kevin.tian@intel.com, yi.l.liu@intel.com, ardb@kernel.org, akpm@linux-foundation.org, andreyknvl@gmail.com, wangjinchao@xfusion.com, gshan@redhat.com, shahuang@redhat.com, ricarkol@google.com, linux-mm@kvack.org, lpieralisi@kernel.org, rananta@google.com, ryan.roberts@arm.com, david@redhat.com, linus.walleij@linaro.org, bhe@redhat.com, aniketa@nvidia.com, cjia@nvidia.com, kwankhede@nvidia.com, targupta@nvidia.com, vsethi@nvidia.com, acurrid@nvidia.com, apopple@nvidia.com, jhubbard@nvidia.com, danw@nvidia.com, kvmarm@lists.linux.dev, mochs@nvidia.com, zhiw@nvidia.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Stat-Signature: h6w1be6dr4oi3r6xgx1dwzc5tpr1jcqj X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 4A23480031 X-Rspam-User: X-HE-Tag: 1708707735-465228 X-HE-Meta: U2FsdGVkX19PNjNzKajsyrQmnoTUdCe/VJNp19riRQUJ9zq2rI7tKsD3+FyFDZW5BNsziKEG/erxJ/wlUZyHceu2jtsJuWwAZzehnVGPD4i63aMneTMC8Ej0quwTguYzhHQaxUlL46gdWwxE5aA7NVJyFPajeiNEsP0B4BSbC9nINo0LhFA0IslNrFpucph2uzulXWusyIHwcrxvbjl2trfxk5OOA3bWqCztbJ8vWvPsmRvK62Ze9LPLlvxijYUorCGuLkoHKS2tvwQR2y7Bq1EC0P6Rj3Yzk8E63msoIUHQ5d0+lnQAnOhxpHx9AG8sOF+mOa4rGRWAS/ddFs7wmG/HVitqg/GyNyR0AmlIJ6JoyS5BtsI8d0CFpmB4BocpvAgTLW4bSORtn0pNa9DZzLf6PA7Wc24/NWMDFfs24Yu6yMLr//J6KK52cXnL3hXOOty9af2g7/tJ26fYNiC8F4BSFvArwPv4I1deeIegXrwGm8Wg+PNfBPeuXm+rfyBP5E8T9GONllaIs2g4+dmM8RhF0KGEmF+chw3kmH1jo17NAo/Qw24bluGVTtbxRoror1tuI7L8V3LDQjVGXyLV2k0/wer6EdeqyvYU3rX4Oc/Zegup3t/pcqBgKbixNfXhQyP6bYy7jKsnN037c0nxMa2XbsSKrws9NiFRyka1IyXn8dSg+VPJp+zsPewNymwZeRTisaR6Ye+rx2gk9emVsVwSEnGOfI7DtqnlWG/LteEYbdVpgZLNy3eyMf1+PqrRmtFlkv4mQAdxh5+pXJs6ZSQXA3ommATDC7T35s2g46bS73TTT3dQviqPoF0uqYOQpdtZV7guo3bwmWTY8lRR9Ik6MoxhI6KY6wZx3CN2SVkVy0FwnEqrxL8ubsJmxOQ/bYmTgH7tAjEgGA9WBVUSD5EtbosPD2RTcNSfGrMlnNYfqMbXedkhrA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, 20 Feb 2024 07:29:22 +0000, wrote: > > From: Ankit Agrawal > > Currently, KVM for ARM64 maps at stage 2 memory that is considered device > with DEVICE_nGnRE memory attributes; this setting overrides (per > ARM architecture [1]) any device MMIO mapping present at stage 1, > resulting in a set-up whereby a guest operating system cannot > determine device MMIO mapping memory attributes on its own but > it is always overridden by the KVM stage 2 default. > > This set-up does not allow guest operating systems to select device > memory attributes independently from KVM stage-2 mappings > (refer to [1], "Combining stage 1 and stage 2 memory type attributes"), > which turns out to be an issue in that guest operating systems > (e.g. Linux) may request to map devices MMIO regions with memory > attributes that guarantee better performance (e.g. gathering > attribute - that for some devices can generate larger PCIe memory > writes TLPs) and specific operations (e.g. unaligned transactions) > such as the NormalNC memory type. > > The default device stage 2 mapping was chosen in KVM for ARM64 since > it was considered safer (i.e. it would not allow guests to trigger > uncontained failures ultimately crashing the machine) but this > turned out to be asynchronous (SError) defeating the purpose. > > For these reasons, relax the KVM stage 2 device memory attributes > from DEVICE_nGnRE to Normal-NC. > > Generalizing to other devices may be problematic, however. E.g. > GICv2 VCPU interface, which is effectively a shared peripheral, can > allow a guest to affect another guest's interrupt distribution. Hence > limit the change to VFIO PCI as caution. This is achieved by > making the VFIO PCI core module set a flag that is tested by KVM > to activate the code. This could be extended to other devices in > the future once that is deemed safe. > > [1] section D8.5 - DDI0487J_a_a-profile_architecture_reference_manual.pdf > > Applied over v6.8-rc5. For the series, Reviewed-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.