Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp970310rbd; Fri, 23 Feb 2024 09:02:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWvaibz1omth7dyvgAveWEN56bF8ddwiN2mfomFbrUo58ncnMuYdxu7iRKUi9zzbjqVRGfGByBaoStR5KQJsPyfmvT1pBVzayQrdlbwUw== X-Google-Smtp-Source: AGHT+IFOpVRGwI+FeI+JdX8qgw83sMO/SvBqd1qu7OKjCnGubbiRnmimrtxkTwKNBDGWrxciRKDi X-Received: by 2002:aa7:d9d3:0:b0:565:862c:bf85 with SMTP id v19-20020aa7d9d3000000b00565862cbf85mr296563eds.12.1708707745283; Fri, 23 Feb 2024 09:02:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708707745; cv=pass; d=google.com; s=arc-20160816; b=fRyaYfR1y8pCt/NKDCSe/aZVQvlelhEBd0JDlWr1KreL6Goll4SyB3XL/O0Q+Cyxad HkoMUuPEgSpp6yCDog1ANXY4qtYXk/cLcUBu9IZTz4lV8DVngis2lKTJzkLFWWBWEF/V HSRuy1JGIgS98xBTssArTtE+tX9LvQSvLQJPrm3kS8rvIZx67FChrnTfCPM07qigRoNP LAn7aDnaZGfMDpV3ZJ25R6VwPxMnYs02u20rS9zqQRSPErj+2f1grFHTnNCy48NKF8uY E9XdVoa5WKWf79Yh9Of2r7nH6p3tQAyUhK5gyhL8tSwWyiVELsxWU9jRSH9RyOBJtheB gOFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=6b2pWRJ9Oa6e5bETaL9X/tYcqrG4xiBTy/MDt/29XMI=; fh=tstAJjFdlmLE7Ey/Et5GeOJTtabMgcgUyd2WNdOqQx4=; b=Xx3eU2GTWGIyrXv62ge6TArb1CU6016q2FUARzKbiFbfAwUAulMzwpsazi3IKLy1Uz eYuI1H4jzAHp2ezJNufAvB5SW0yw2YLGY/Q0KwvRSEdk8Z5lL87zJDzB2YfY4O8mbA2v c9f8v3dWSoFfIlv8YNeozDis2+lXi/43jjSAmW8XwoLh++Glv443LOw+nWGcf9OKnqWu 0I66Q/q04nLeJ77U0qZotpqeIYy3EnPuHI0eJEeuDBfqVqFxcFFtMTxyptJatSy1S50H bA9QXuGXY5bOmMu9+tcKjqoMMnuSAAPv5pwWBVx9yC6Md6iRrzPjM9SZp6j6iceOS2rM 3Olg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kE6gJjYI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78775-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i17-20020a508711000000b005654e58ca95si1147367edb.530.2024.02.23.09.02.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:02:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78775-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kE6gJjYI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78775-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 06FD11F25BB5 for ; Fri, 23 Feb 2024 17:02:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2520B12B173; Fri, 23 Feb 2024 17:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kE6gJjYI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22DFD1292C6; Fri, 23 Feb 2024 17:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708707732; cv=none; b=hJ7Xwan9vi8gOtjExLPs19fxSqVRJP1qALjFlKb/y8zh5LYGvFJRABBDwcQuRD+obTarUyCdtuwcx5LFpWtK15O//ZehRvjzvZ+nZAeg50EbizIj9sULr6Rw2g90TvWDYrCp9nsFdfmtr8eXHBtQwwIcuv49EkkPx/VP1MkcZ2A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708707732; c=relaxed/simple; bh=bK6MUj0ihY6O0q0AWMV5Wk/jMqKJGmt8hsDBwlu4A6Y=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=rXqje48o10psr6h76ylqXEcU41z4HZ1coIR31xo0l8SFH2jrNEwDOg6KDGJdky41V+xKSHCVbbFy9MyX/iEVa8vIIhmLRtfVCxV5k4vFlEfenkP8naPbXPg2Go/qokxgH+/n8jehLtYduCfa/+YXDDfbwfTTgjYa7XonTdMwHMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kE6gJjYI; arc=none smtp.client-ip=10.30.226.201 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.