Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp316301rdb; Thu, 8 Feb 2024 06:54:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX65RFySuV0OEgklgmNePKUS/6OJBNc8yYpfF+2OQJxAty/iw4v+K8lf7AE1C8J99ZHeGNOEZ81YYVAJJKKUiW8+wohyqHYHOHCX5wtHQ== X-Google-Smtp-Source: AGHT+IFlSnLd17g//rpyHluT+rrzyr9Sf8QIGbQ9nIRK2Sfwgs8zpRkCxtg2dnsLiKPQhucI7T/m X-Received: by 2002:a2e:b1d2:0:b0:2d0:8ac9:795d with SMTP id e18-20020a2eb1d2000000b002d08ac9795dmr5899670lja.52.1707404050567; Thu, 08 Feb 2024 06:54:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707404050; cv=pass; d=google.com; s=arc-20160816; b=NfCKTMwy+FDrRfYC+4b5bI5nXzgGb00CURgNJvdJgL0HoA0B10BFiUZuptkZbvfOJe KMI55GUehQJfJNPP1lD3eOJK7KJeZoTtsLU0oN5xMVZdus1L6ec5Xa4ezU6wPJLo51cM GpgVxd0PV8PcgTP7TG3fRy3UVdVePZtZX26aBDkzsuriiEOXS51b/LldFDH01Eux75LY HSi8vhj2sFYnUZMPQp667osaAMCrMXXU964Fr1Z15pRdwtgc6dxn9Z7E4J7Zo74x7NVZ WvCtmKkMt7XyiuiMYg1XrLqrZFXy/rRQ0K6NogD8s+WjpcQhXM2LxlI3mFHXbQ3GDYsV M6yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=66QDV+E2Er6w8oh1oGud0tl+BK8KP1oQ+z/ek6lz91w=; fh=Gi9wml4Bq2jgAmWFIdbM2g08ipxqd3B9714rTEUbh8o=; b=srxNmisGwNe/e2X5XWTVma7g7V3v3d6KNGcGbbSWRzPC79Ig62NaLZRSL6W5IFNTGI 9WbYxSyVsfIjLe5tesYMuNWKoiGos3mz6rvJJ0ykdqx/k1TAcvrMtDGc7AoL/Z+qMvF+ Nu+cQ8gZJGe/iQl0yYuREjCvWkNeLcha9yXX4txDHsA8MtO9SCDSKbplCp8NROoNKIlj WCcjWv+hSH86VgUVm5+4xUsZYfD/udj5ZhYYvzP9o0t1ykW/Qq6kiHE3DR6qdSZBJT+9 ZYkayjsCnFywtGPkbEDUcQByRPxwrIndQ0wGMC97C5J9AUvqLMJpVP6mbMxT8T5rNmoN 5hAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-58252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCW0X8RfegnUL9s5b2SbGWn5dlrU0g5SURE5Wy0NeToOb7PjehO/V40YOIawIefgwoQRZmidCASzI3NsvheM7wyVR3GhrwDV1HkD96xT+A== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s25-20020aa7d799000000b00560c9a5fe2bsi969942edq.230.2024.02.08.06.54.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 06:54:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-58252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 4BE731F28487 for ; Thu, 8 Feb 2024 14:54:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 433037B3E1; Thu, 8 Feb 2024 14:53:56 +0000 (UTC) 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 AD49F7B3C7; Thu, 8 Feb 2024 14:53:55 +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=1707404035; cv=none; b=RD1KzXszHaQ15lFq/shJXgClGSmoqykgAIih8+OUzET43N4r4JEcWD6v8uDnNcnX0Vq6J53yqWY/hxJZqCL9ux8yXYL4dna9kPracizDaFKps89u7qWM+APiXAsY3Ys2BDnnAlP0NwTMT7anusvIyjA5XokNxz7mDEeZjCZji/M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404035; c=relaxed/simple; bh=DsYyp3kIXmVn6CNV5p3iHd0W1LhJ8FsJgy2h91cPUvE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jCOlgyq4pj2xGVnEMZHHcEIO/BzRPvktUwh7iNRBkk14oedeUjY7hXG31CR7DS7wRtDM3MrkgYElT5KfStW6QkUm/0HOkU1DHLqkNCd4Bn8dgcvqYWd5zRnoISIXte9yRbJJKYtsYkwfIliUR/orG6djTvBpvd4uz9Qe+BZQ2dE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95689C433F1; Thu, 8 Feb 2024 14:53:47 +0000 (UTC) Date: Thu, 8 Feb 2024 14:53:45 +0000 From: Catalin Marinas To: ankita@nvidia.com Cc: jgg@nvidia.com, maz@kernel.org, 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, 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, ricarkol@google.com, linux-mm@kvack.org, lpieralisi@kernel.org, rananta@google.com, ryan.roberts@arm.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, David Hildenbrand Subject: Re: [PATCH v6 4/4] vfio: convey kvm that the vfio-pci device is wc safe Message-ID: References: <20240207204652.22954-1-ankita@nvidia.com> <20240207204652.22954-5-ankita@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240207204652.22954-5-ankita@nvidia.com> + David H On Thu, Feb 08, 2024 at 02:16:52AM +0530, ankita@nvidia.com wrote: > From: Ankit Agrawal > > The code to map the MMIO in S2 as NormalNC is enabled when conveyed > that the device is WC safe using a new flag VM_VFIO_ALLOW_WC. > > Make vfio-pci set the VM_VFIO_ALLOW_WC flag. > > This could be extended to other devices in the future once that > is deemed safe. > > Signed-off-by: Ankit Agrawal > Suggested-by: Catalin Marinas > Acked-by: Jason Gunthorpe > --- > drivers/vfio/pci/vfio_pci_core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c > index 1cbc990d42e0..c3f95ec7fc3a 100644 > --- a/drivers/vfio/pci/vfio_pci_core.c > +++ b/drivers/vfio/pci/vfio_pci_core.c > @@ -1863,7 +1863,8 @@ int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma > * See remap_pfn_range(), called from vfio_pci_fault() but we can't > * change vm_flags within the fault handler. Set them now. > */ > - vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP); > + vm_flags_set(vma, VM_VFIO_ALLOW_WC | VM_IO | VM_PFNMAP | > + VM_DONTEXPAND | VM_DONTDUMP); > vma->vm_ops = &vfio_pci_mmap_ops; > > return 0; Acked-by: Catalin Marinas