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: <8357aa40-a518-1645-d4f2-bd12975bcb4b@linux.ibm.com>
Date:   Thu, 9 Dec 2021 16:28:38 +0100
From:   Christian Borntraeger <borntraeger@...ux.ibm.com>
To:     Matthew Rosato <mjrosato@...ux.ibm.com>, linux-s390@...r.kernel.org
Cc:     alex.williamson@...hat.com, cohuck@...hat.com,
        schnelle@...ux.ibm.com, farman@...ux.ibm.com, pmorel@...ux.ibm.com,
        hca@...ux.ibm.com, gor@...ux.ibm.com,
        gerald.schaefer@...ux.ibm.com, agordeev@...ux.ibm.com,
        frankja@...ux.ibm.com, david@...hat.com, imbrenda@...ux.ibm.com,
        vneethv@...ux.ibm.com, oberpar@...ux.ibm.com, freude@...ux.ibm.com,
        thuth@...hat.com, pasic@...ux.ibm.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/32] s390/pci: add helper function to find device by
 handle



Am 07.12.21 um 21:57 schrieb Matthew Rosato:
> Intercepted zPCI instructions will specify the desired function via a
> function handle.  Add a routine to find the device with the specified
> handle.
> 
> Acked-by: Niklas Schnelle <schnelle@...ux.ibm.com>
> Signed-off-by: Matthew Rosato <mjrosato@...ux.ibm.com>

I guess we do not have hundreds of devices, so this should be fast enough.
I guess long term wit hundreds of VFs we might want to redo the zpci_list
into a tree but for now as this is just like get_zdev_by_fid

Reviewed-by: Christian Borntraeger <borntraeger@...ibm.com>

> ---
>   arch/s390/include/asm/pci.h |  1 +
>   arch/s390/pci/pci.c         | 16 ++++++++++++++++
>   2 files changed, 17 insertions(+)
> 
> diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
> index 1a8f9f42da3a..00a2c24d6d2b 100644
> --- a/arch/s390/include/asm/pci.h
> +++ b/arch/s390/include/asm/pci.h
> @@ -275,6 +275,7 @@ static inline struct zpci_dev *to_zpci_dev(struct device *dev)
>   }
>   
>   struct zpci_dev *get_zdev_by_fid(u32);
> +struct zpci_dev *get_zdev_by_fh(u32 fh);
>   
>   /* DMA */
>   int zpci_dma_init(void);
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index 9b4d3d78b444..af1c0ae017b1 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -76,6 +76,22 @@ struct zpci_dev *get_zdev_by_fid(u32 fid)
>   	return zdev;
>   }
>   
> +struct zpci_dev *get_zdev_by_fh(u32 fh)
> +{
> +	struct zpci_dev *tmp, *zdev = NULL;
> +
> +	spin_lock(&zpci_list_lock);
> +	list_for_each_entry(tmp, &zpci_list, entry) {
> +		if (tmp->fh == fh) {
> +			zdev = tmp;
> +			break;
> +		}
> +	}
> +	spin_unlock(&zpci_list_lock);
> +	return zdev;
> +}
> +EXPORT_SYMBOL_GPL(get_zdev_by_fh);
> +
>   void zpci_remove_reserved_devices(void)
>   {
>   	struct zpci_dev *tmp, *zdev;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ