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: <MN2PR07MB62084589DE98AD2611C55FFDA15A9@MN2PR07MB6208.namprd07.prod.outlook.com>
Date:   Thu, 20 Jan 2022 13:10:54 +0000
From:   Tom Joseph <tjoseph@...ence.com>
To:     Li Chen <lchen@...arella.com>
CC:     Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Rob Herring <robh@...nel.org>,
        Krzysztof Wilczyński <kw@...ux.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: Why does cdns_pcie_ep_set_bar use sz > SZ_2G for is_64bits in
 pcie-cadence-ep.c?

Hi Li,

 For 64_bits ,  all the odd bars (BAR1, 3 ,5) will be disabled ( so as to use as upper bits).
I see that the code is assuming 32_bits if size < 2G , so all bars could be enabled.

As I understand, you have a use case where you want to set the bar as 64 bit, actually use small size.
Is it possible to describe bit more about this use case (just curious)?

Thanks,
Tom  

> -----Original Message-----
> From: Li Chen <lchen@...arella.com>
> Sent: 19 January 2022 09:28
> To: Tom Joseph <tjoseph@...ence.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>; Rob Herring
> <robh@...nel.org>; Krzysztof Wilczyński <kw@...ux.com>; Bjorn Helgaas
> <bhelgaas@...gle.com>; linux-pci@...r.kernel.org; linux-
> kernel@...r.kernel.org
> Subject: Why does cdns_pcie_ep_set_bar use sz > SZ_2G for is_64bits in
> pcie-cadence-ep.c?
> 
> EXTERNAL MAIL
> 
> 
> Hi, Tom
> 
> From these function:
> static int cdns_pcie_ep_set_bar(struct pci_epc *epc, u8 fn, u8 vfn,
> 				struct pci_epf_bar *epf_bar)
> {
> 	......
> 	if ((flags & PCI_BASE_ADDRESS_SPACE) ==
> PCI_BASE_ADDRESS_SPACE_IO) {
> 		ctrl = CDNS_PCIE_LM_BAR_CFG_CTRL_IO_32BITS;
> 	} else {
> 		bool is_prefetch = !!(flags &
> PCI_BASE_ADDRESS_MEM_PREFETCH);
> 		bool is_64bits = sz > SZ_2G;
> 		if (is_64bits && (bar & 1))
> 			return -EINVAL;
> 		if (is_64bits && !(flags &
> PCI_BASE_ADDRESS_MEM_TYPE_64))
> 			epf_bar->flags |=
> PCI_BASE_ADDRESS_MEM_TYPE_64;
> 
> 		if (is_64bits && is_prefetch)
> 			ctrl =
> CDNS_PCIE_LM_BAR_CFG_CTRL_PREFETCH_MEM_64BITS;
> 		else if (is_prefetch)
> 			ctrl =
> CDNS_PCIE_LM_BAR_CFG_CTRL_PREFETCH_MEM_32BITS;
> 		else if (is_64bits)
> 			ctrl = CDNS_PCIE_LM_BAR_CFG_CTRL_MEM_64BITS;
> 		else
> 			ctrl = CDNS_PCIE_LM_BAR_CFG_CTRL_MEM_32BITS;
> 	}
> 
> 	......
> }
> 
> 
> I don't understand why should sz > SZ_2G be taken into account for 64_bits.
> From my personal practice, there is no problem to use
> CDNS_PCIE_LM_BAR_CFG_CTRL_MEM_64BITS or
> CDNS_PCIE_LM_BAR_CFG_CTRL_PREFETCH_MEM_64BITS when sz < SZ_2G.
> 
> 
> Regards,
> Li
> 
> **********************************************************
> ************
> This email and attachments contain Ambarella Proprietary and/or
> Confidential Information and is intended solely for the use of the
> individual(s) to whom it is addressed. Any unauthorized review, use,
> disclosure, distribute, copy, or print is prohibited. If you are not an intended
> recipient, please contact the sender by reply email and destroy all copies of
> the original message. Thank you.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ