lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251125220445.02a72453.zhiw@nvidia.com>
Date: Tue, 25 Nov 2025 22:04:45 +0200
From: Zhi Wang <zhiw@...dia.com>
To: <ankita@...dia.com>
CC: <jgg@...pe.ca>, <yishaih@...dia.com>, <skolothumtho@...dia.com>,
	<kevin.tian@...el.com>, <alex@...zbot.org>, <aniketa@...dia.com>,
	<vsethi@...dia.com>, <mochs@...dia.com>, <Yunxiang.Li@....com>,
	<yi.l.liu@...el.com>, <zhangdongdong@...incomputing.com>,
	<avihaih@...dia.com>, <bhelgaas@...gle.com>, <peterx@...hat.com>,
	<pstanner@...hat.com>, <apopple@...dia.com>, <kvm@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <cjia@...dia.com>, <kwankhede@...dia.com>,
	<targupta@...dia.com>, <danw@...dia.com>, <dnigam@...dia.com>,
	<kjaju@...dia.com>
Subject: Re: [PATCH v6 3/6] vfio: use vfio_pci_core_setup_barmap to map bar
 in mmap

On Tue, 25 Nov 2025 17:30:10 +0000
<ankita@...dia.com> wrote:

LGTM.

Reviewed-by: Zhi Wang <zhiw@...dia.com>

> From: Ankit Agrawal <ankita@...dia.com>
> 
> Remove code duplication in vfio_pci_core_mmap by calling
> vfio_pci_core_setup_barmap to perform the bar mapping.
> 
> cc: Donald Dutile <ddutile@...hat.com>
> Reviewed-by: Shameer Kolothum <skolothumtho@...dia.com>
> Suggested-by: Alex Williamson <alex@...zbot.org>
> Signed-off-by: Ankit Agrawal <ankita@...dia.com>
> ---
>  drivers/vfio/pci/vfio_pci_core.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_core.c
> b/drivers/vfio/pci/vfio_pci_core.c index c445a53ee12e..3cc799eb75ea
> 100644 --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -1761,18 +1761,9 @@ int vfio_pci_core_mmap(struct vfio_device
> *core_vdev, struct vm_area_struct *vma
>  	 * Even though we don't make use of the barmap for the mmap,
>  	 * we need to request the region and the barmap tracks that.
>  	 */
> -	if (!vdev->barmap[index]) {
> -		ret = pci_request_selected_regions(pdev,
> -						   1 << index,
> "vfio-pci");
> -		if (ret)
> -			return ret;
> -
> -		vdev->barmap[index] = pci_iomap(pdev, index, 0);
> -		if (!vdev->barmap[index]) {
> -			pci_release_selected_regions(pdev, 1 <<
> index);
> -			return -ENOMEM;
> -		}
> -	}
> +	ret = vfio_pci_core_setup_barmap(vdev, index);
> +	if (ret)
> +		return ret;
>  
>  	vma->vm_private_data = vdev;
>  	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ