Skip to contentSkip to conversation

sparc: Use generic pci_mmap_resource_range()

PATCH In review David Woodhouse 4 participants 7 messages Feb 19, 2018 – Mar 1, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: Use generic pci_mmap_resource_range()

Commit f719582435 ("PCI: Add pci_mmap_resource_range() and use it for ARM64") added this generic function with the intent of using it everywhere and ultimately killing the old arch-specific implementations.

Let's get on with that eradication...

---
 arch/sparc/include/asm/pci_64.h |   1 +
 arch/sparc/kernel/pci.c         | 155 ----------------------------------------
 2 files changed, 1 insertion(+), 155 deletions(-)
arch/sparc/include/asm/pci_64.h +1 -0
index 671274e..95d41c8 100644
@@ -43,6 +43,7 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 /* Platform support for /proc/bus/pci/X/Y mmap()s. */
 
 #define HAVE_PCI_MMAP
+#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define arch_can_pci_mmap_io()	1
 #define HAVE_ARCH_PCI_GET_UNMAPPED_AREA
 #define get_pci_unmapped_area get_fb_unmapped_area
arch/sparc/kernel/pci.c +0 -155

161 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#1 lore raw

From: David Woodhouse <[email protected]>
Date: Mon, 19 Feb 2018 13:04:12 +0000

Quoted 7 lines

Commit f719582435 ("PCI: Add pci_mmap_resource_range() and use it for ARM64") added this generic function with the intent of using it everywhere and ultimately killing the old arch-specific implementations.

Let's get on with that eradication...

David, the generic code is definitely doing different things.

For one, the sparc specific code allows mmap'ing any address range within a PCI bus device. The generic code does not allow that.

I know this was used by the X server and that's why the logic is there.

So we can't just use the generic code without breaking things, sorry.

#2 lore raw
Quoted 8 lines · David Miller

From: David Woodhouse <[email protected]>
Date: Mon, 19 Feb 2018 13:04:12 +0000

Quoted 5 lines

Commit f719582435 ("PCI: Add pci_mmap_resource_range() and use it for ARM64") added this generic function with the intent of using it everywhere and ultimately killing the old arch-specific implementations.

Quoted 5 lines
Quoted 3 lines

Let's get on with that eradication...

David, the generic code is definitely doing different things.

Note that this is new "generic" code that I added last year, specifically to be able to obsolete all the old arch-specific code. The main reason for the change was to take host physical addresses, instead of converting to via legacy "pci_resource_to_user()" even for the new sysfs API.

The details are hazy right now — I deliberately held back the "fun" architectures and sent only the no-brainers in the first batch via Bjorn's PCI tree, and then promptly forgot about it for a year.

But I definitely *attempted* to ensure that the new code would cover all the requirements of SPARC and the various architectures that have lifted and modified the SPARC PCI code over the years.

Quoted 2 lines

For one, the sparc specific code allows mmap'ing any address range within a PCI bus device.  The generic code does not allow that.

You mean any address range in a given PCI bus even if there is no actual device with a BAR at the corresponding address?

Would I be right to assume this was only available through the legacy procfs API? I think it should be possible to accommodate it, and it does look like I'd missed this requirement the first time round; thanks for pointing it out.

maintainer
#3 lore raw

From: David Woodhouse <[email protected]>
Date: Mon, 19 Feb 2018 15:24:18 +0000

Quoted 11 lines
Quoted 2 lines

For one, the sparc specific code allows mmap'ing any address range within a PCI bus device.  The generic code does not allow that.

You mean any address range in a given PCI bus even if there is no actual device with a BAR at the corresponding address?

Would I be right to assume this was only available through the legacy procfs API? I think it should be possible to accommodate it, and it does look like I'd missed this requirement the first time round; thanks for pointing it out.

It was probably the case that only procfs could do it.

It is the mechanism by which we were able to let the X server poke around in VGA ISA space. It does a bus I/O space map for the bus device above the VGA card.

#4 lore raw
Quoted 15 lines · David Miller

From: David Woodhouse <[email protected]>
Date: Mon, 19 Feb 2018 15:24:18 +0000

Quoted 11 lines
Quoted 2 lines

For one, the sparc specific code allows mmap'ing any address range within a PCI bus device.  The generic code does not allow that.

You mean any address range in a given PCI bus even if there is no actual device with a BAR at the corresponding address?

Would I be right to assume this was only available through the legacy procfs API? I think it should be possible to accommodate it, and it does look like I'd missed this requirement the first time round; thanks for pointing it out.

Quoted 5 lines

It was probably the case that only procfs could do it.

It is the mechanism by which we were able to let the X server poke around in VGA ISA space. It does a bus I/O space map for the bus device above the VGA card.

What's the bottom line? Do we want this for sparc? If so, do you want to take it, Dave M, or would you like me to?

maintainer
#5 lore raw

From: Bjorn Helgaas <[email protected]>
Date: Wed, 28 Feb 2018 17:08:29 -0600

Quoted 6 lines · David Miller
Quoted 5 lines

From: David Woodhouse <[email protected]>
Date: Mon, 19 Feb 2018 15:24:18 +0000
=

Quoted 1 line
Quoted 1 line

For one, the sparc specific code allows mmap'ing any address rang=

e

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

within a PCI bus device.=A0=A0The generic code does not allow tha=

t.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

=

=

You mean any address range in a given PCI bus even if there is no actual device with a BAR at the corresponding address? =

Would I be right to assume this was only available through the leg=

acy

Quoted 1 line
Quoted 1 line
Quoted 1 line

procfs API? I think it should be possible to accommodate it, and i=

t

Quoted 1 line
Quoted 1 line
Quoted 1 line

does look like I'd missed this requirement the first time round; t=

hanks

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

for pointing it out.

=

It was probably the case that only procfs could do it. =

Quoted 7 lines
Quoted 3 lines

It is the mechanism by which we were able to let the X server poke around in VGA ISA space. It does a bus I/O space map for the bus device above the VGA card.

=

What's the bottom line? Do we want this for sparc? If so, do you want to take it, Dave M, or would you like me to?

The bottom line is that David W.'s patch would break sparc so we don't want this.

#6 lore raw
In reply to Bjorn Helgaas
Quoted 3 lines · Bjorn Helgaas

What's the bottom line?  Do we want this for sparc?  If so, do you want to take it, Dave M, or would you like me to?

I need to fix it first, and then the intention is for Dave to take it.

There'll be a final patch to remove ARCH_GENERIC_PCI_MMAP_RESOURCE once it's actually ubiquitous, but I need to do all the "fun" architectures through their own trees first.

I deliberately gave you only the trivial ones, in the first batch. For precisely this reason — because I might have missed details.