From: Kishon Vijay Abraham I Date: Mon, 14 Jan 2019 11:15:06 +0000 (+0530) Subject: PCI: endpoint: Fix pci_epf_alloc_space() to set correct MEM TYPE flags X-Git-Tag: v5.4.17~4028^2~4^2~11 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5544d67ed11245ccb64099deb32831308297bf6b;p=arm%2Flinux.git PCI: endpoint: Fix pci_epf_alloc_space() to set correct MEM TYPE flags pci_epf_alloc_space() sets the MEM TYPE flags to indicate a 32-bit Base Address Register irrespective of the size. Fix it here to indicate 64-bit BAR if the size is > 2GB. Tested-by: Gustavo Pimentel Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Lorenzo Pieralisi --- diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index 825fa24427a3..8bfdcd291196 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -131,7 +131,9 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar) epf->bar[bar].phys_addr = phys_addr; epf->bar[bar].size = size; epf->bar[bar].barno = bar; - epf->bar[bar].flags = PCI_BASE_ADDRESS_SPACE_MEMORY; + epf->bar[bar].flags |= upper_32_bits(size) ? + PCI_BASE_ADDRESS_MEM_TYPE_64 : + PCI_BASE_ADDRESS_MEM_TYPE_32; return space; }