powerpc: Fix sysfs pci mmap on 32-bit machines with 64-bit PCI

When manipulating 64-bit PCI addresses, the code would lose the
top 32-bit in a couple of places when shifting a pfn due to missing
type casting from the 32-bit pfn to a 64-bit resource before the
shift.

This breaks using newer X servers for example on 440 machines
with the PCI bus above 32-bit.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 76c31f23
...@@ -419,7 +419,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file, ...@@ -419,7 +419,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
struct resource *found = NULL; struct resource *found = NULL;
unsigned long prot = pgprot_val(protection); unsigned long prot = pgprot_val(protection);
unsigned long offset = pfn << PAGE_SHIFT; resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;
int i; int i;
if (page_is_ram(pfn)) if (page_is_ram(pfn))
...@@ -470,7 +470,8 @@ pgprot_t pci_phys_mem_access_prot(struct file *file, ...@@ -470,7 +470,8 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine) enum pci_mmap_state mmap_state, int write_combine)
{ {
resource_size_t offset = vma->vm_pgoff << PAGE_SHIFT; resource_size_t offset =
((resource_size_t)vma->vm_pgoff) << PAGE_SHIFT;
struct resource *rp; struct resource *rp;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment