Use pcim_request_region() in vboxvideo
Subsystems (4)
cover Use pcim_request_region() in vboxvideo
Hi everyone,
Now that we've got the simplified PCI devres API available we can slowly start using it in drivers and step by step phase the more problematic API out.
vboxvideo currently does not have a region request, so it is a suitable first user.
P.
Philipp Stanner (2):
PCI: Make pcim_request_region() a public function drm/vboxvideo: Add PCI region request
drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++++ drivers/pci/devres.c | 1 + drivers/pci/pci.h | 2 -- include/linux/pci.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/2 PCI: Make pcim_request_region() a public function
pcim_request_region() is the managed counterpart of pci_request_region(). It is currently only used internally for PCI.
It can be useful for a number of drivers and exporting it is a step towards deprecating more complicated functions.
Make pcim_request_region a public function.
--- drivers/pci/devres.c | 1 + drivers/pci/pci.h | 2 -- include/linux/pci.h | 1 + 3 files changed, 2 insertions(+), 2 deletions(-)
drivers/pci/devres.c +1 -0
@@ -863,6 +863,7 @@ int pcim_request_region(struct pci_dev *pdev, int bar, const char *name) {return _pcim_request_region (pdev, bar, name,0 ); } +EXPORT_SYMBOL (pcim_request_region);/** * pcim_request_region_exclusive - Request a PCI BAR exclusively
drivers/pci/pci.h +0 -2
@@ -887,8 +887,6 @@ static inline pci_power_t mid_pci_get_power_state(struct pci_dev *pdev)#endif int pcim_intx (struct pci_dev *dev,int enable); - -int pcim_request_region (struct pci_dev *pdev,int bar,const char *name);int pcim_request_region_exclusive (struct pci_dev *pdev,int bar,const char *name);void pcim_release_region (struct pci_dev *pdev,int bar);
include/linux/pci.h +1 -0
@@ -2294,6 +2294,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,void __iomem *pcim_iomap (struct pci_dev *pdev,int bar,unsigned long maxlen);void pcim_iounmap (struct pci_dev *pdev,void __iomem *addr);void __iomem *const *pcim_iomap_table (struct pci_dev *pdev); +int pcim_request_region (struct pci_dev *pdev,int bar,const char *name);int pcim_iomap_regions (struct pci_dev *pdev,int mask,const char *name);int pcim_iomap_regions_request_all (struct pci_dev *pdev,int mask,const char *name);
Signature · 1 line
2.45.2
PATCH 2/2 drm/vboxvideo: Add PCI region request
In reply to Philipp Stannervboxvideo currently does not reserve its PCI BAR through a region request.
Implement the request through the managed function pcim_request_region().
--- drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/vboxvideo/vbox_main.c +4 -0
@@ -114,6 +114,10 @@ int vbox_hw_init(struct vbox_private *vbox)DRM_INFO ("VRAM %08x\n" , vbox->full_vram_size); + ret =pcim_request_region (pdev,0 ,"vboxvideo" ); +if (ret) +return ret; +/* Map guest-heap at end of vram */ vbox->guest_heap =pcim_iomap_range (pdev,0 ,GUEST_HEAP_OFFSET (vbox),GUEST_HEAP_SIZE );
Signature · 1 line
2.45.2
Quoted 15 lines · Philipp Stanner
Hi everyone,
Now that we've got the simplified PCI devres API available we can slowly start using it in drivers and step by step phase the more problematic API out.
vboxvideo currently does not have a region request, so it is a suitable first user.
P.
Philipp Stanner (2):
PCI: Makepcim_request_region()a public function drm/vboxvideo: Add PCI region request
Quoted 5 lines
drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++++ drivers/pci/devres.c | 1 + drivers/pci/pci.h | 2 -- include/linux/pci.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-)
Given an ack from the vboxvideo maintainers, I can apply both of these via the PCI tree so there's no race during the merge window.
Hans de Goede
Acked-byHi Bjorn,
Quoted 16 lines · Bjorn Helgaas
Quoted 15 lines · Philipp Stanner
Hi everyone,
Now that we've got the simplified PCI devres API available we can slowly start using it in drivers and step by step phase the more problematic API out.
vboxvideo currently does not have a region request, so it is a suitable first user.
P.
Philipp Stanner (2):
PCI: Makepcim_request_region()a public function drm/vboxvideo: Add PCI region request
Quoted 8 lines
Quoted 5 lines
drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++++ drivers/pci/devres.c | 1 + drivers/pci/pci.h | 2 -- include/linux/pci.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-)Given an ack from the vboxvideo maintainers, I can apply both of these via the PCI tree so there's no race during the merge window.
I'm the vboxvideo maintainer, merging both through the PCI tree sounds good to me:
Regards,
Hans
Hi,
Quoted 8 lines · Philipp Stanner
Hi everyone,
Now that we've got the simplified PCI devres API available we can slowly start using it in drivers and step by step phase the more problematic API out.
vboxvideo currently does not have a region request, so it is a suitable first user.
I have given both patches a test-run on top of 6.11-rc1 in a VirtualBox VM using the vboxsvga virtual vga card:
Also both patches look good to me:
for the series.
Regards,
Hans
Quoted 15 lines · Philipp Stanner
Hi everyone,
Now that we've got the simplified PCI devres API available we can slowly start using it in drivers and step by step phase the more problematic API out.
vboxvideo currently does not have a region request, so it is a suitable first user.
P.
Philipp Stanner (2):
PCI: Makepcim_request_region()a public function drm/vboxvideo: Add PCI region request
Quoted 5 lines
drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++++ drivers/pci/devres.c | 1 + drivers/pci/pci.h | 2 -- include/linux/pci.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-)
Applied with Hans' ack to pci/devres for v6.12, thanks!