Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1196557rdb; Wed, 6 Dec 2023 11:07:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEM6qPayY8WmzQFI9grnyVq7NC/tvoDxpRTB2AHEgdmx/eBPwxGgmNjnLsmIizaL7V/pAlb X-Received: by 2002:a17:90b:1b46:b0:286:f16c:caff with SMTP id nv6-20020a17090b1b4600b00286f16ccaffmr1460936pjb.33.1701889642019; Wed, 06 Dec 2023 11:07:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701889642; cv=none; d=google.com; s=arc-20160816; b=fI5xXoJ2GH//WWdzvtRQLB6krs8GJXuzz878YMuo+2jxKGR6PpByL9dXYyXe9NHFDE vsj3gMdP3RYL3PUMBwJKqvedq6i5o1gC4EGJlqYNjq5NA68mWDldbYFoHwAz21mvak64 GqjRZEOXrdrUQGRgVhbkV/O3fVXuIsYyBV5Fr+b2xcptc4ynXBCODZySp09GvblEeGGd fGpcFD2zcg6BvNNj+oYS0O8SHQo8+41sbLhgvL/hqbuG7bxvIJZmIJ8r0aoLkQxKJlK5 WVoEJBLJSYG0EFdlkauGgvPekkBCj0ZHoh6+eV3N/BZZW61Uft0MW/KS/0b2YawO/M2x A6fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=gfToDhIAHF06ODaxasjueTJVZQGSXowtA8fKzcHSR4E=; fh=bEyFLQknfHvZVRjPYONukTUGOd/Q5gJXTq+COzby4r4=; b=IBKbWwwvS2Vkp0ZqdIrxkDWidZho005fTQ/dItdIRQvLXdSxLAkP2pvJFhzSracsyx aahgeoFkzfOo/o5V2jVrz/sMpdQYg6b/AAfF5E4NU5IL2b9Y8OoceNLqFRXiA4sJO5h0 XXaU86iBHYb0A9fXfiqXc3CN/AUlvVCFD0pmqYJQ/vK6+jZgxb/Y0pbG7Gnd+bpj7ZgI HYib/FLjjMZfY/oHWk7rDAfxQymGDLNUa1rwZ6+GEY+4iWuYBn3a9eFxL+AH66KKREx2 3KM9KHWFoqODHNmjoRwGWianZfOHOVmVHkWdDwCPh3F5U4QpQUIsEUuqeJ1QCWsQokpi XAKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id b9-20020a17090ae38900b00286a1497c76si250536pjz.21.2023.12.06.11.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 11:07:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 48A228343955; Wed, 6 Dec 2023 11:07:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442762AbjLFTG7 (ORCPT + 99 others); Wed, 6 Dec 2023 14:06:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379150AbjLFTG7 (ORCPT ); Wed, 6 Dec 2023 14:06:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51CADEE for ; Wed, 6 Dec 2023 11:07:05 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A909AC433C9; Wed, 6 Dec 2023 19:07:00 +0000 (UTC) Date: Wed, 6 Dec 2023 19:06:58 +0000 From: Catalin Marinas To: Jason Gunthorpe Cc: Marc Zyngier , ankita@nvidia.com, Shameerali Kolothum Thodi , oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org, ardb@kernel.org, akpm@linux-foundation.org, gshan@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, mochs@nvidia.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, lpieralisi@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/1] KVM: arm64: allow the VM to select DEVICE_* and NORMAL_NC for IO memory Message-ID: References: <86a5qobkt8.wl-maz@kernel.org> <868r67blwo.wl-maz@kernel.org> <20231206151603.GR2692119@nvidia.com> <20231206172035.GU2692119@nvidia.com> <20231206190356.GD2692119@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231206190356.GD2692119@nvidia.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 11:07:19 -0800 (PST) On Wed, Dec 06, 2023 at 03:03:56PM -0400, Jason Gunthorpe wrote: > On Wed, Dec 06, 2023 at 06:58:44PM +0000, Catalin Marinas wrote: > > -------------8<---------------------------- > > diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c > > index 1929103ee59a..b89d2dfcd534 100644 > > --- a/drivers/vfio/pci/vfio_pci_core.c > > +++ b/drivers/vfio/pci/vfio_pci_core.c > > @@ -1863,7 +1863,7 @@ 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 | VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP); > > vma->vm_ops = &vfio_pci_mmap_ops; > > > > return 0; > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 418d26608ece..6df46fd7836a 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -391,6 +391,13 @@ extern unsigned int kobjsize(const void *objp); > > # define VM_UFFD_MINOR VM_NONE > > #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */ > > > > +#ifdef CONFIG_64BIT > > +#define VM_VFIO_BIT 39 > > +#define VM_VFIO BIT(VM_VFIO_BIT) > > +#else > > +#define VM_VFIO VM_NONE > > +#endif > > + > > /* Bits set in the VMA until the stack is in its final location */ > > #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ | VM_STACK_EARLY) > > -------------8<---------------------------- > > > > In KVM, Akita's patch would take this into account, not just rely on > > "device==true". > > Yes, Ankit let's try this please. I would not call it VM_VFIO though > > VM_VFIO_ALLOW_WC ? Yeah. I don't really care about the name. -- Catalin