* [PATCH 1/2] PCI: Make pcim_request_region() a public function
2024-07-29 9:36 [PATCH 0/2] Use pcim_request_region() in vboxvideo Philipp Stanner
@ 2024-07-29 9:36 ` Philipp Stanner
2024-07-29 9:36 ` [PATCH 2/2] drm/vboxvideo: Add PCI region request Philipp Stanner
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Philipp Stanner @ 2024-07-29 9:36 UTC (permalink / raw)
To: Hans de Goede, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter, Bjorn Helgaas
Cc: dri-devel, linux-kernel, linux-pci, Philipp Stanner
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.
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/pci/devres.c | 1 +
drivers/pci/pci.h | 2 --
include/linux/pci.h | 1 +
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index 3780a9f9ec00..0127ca58c6e5 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -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
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 79c8398f3938..2fe6055a334d 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -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);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9e36b6c1810e..e5d8406874e2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -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);
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/2] drm/vboxvideo: Add PCI region request
2024-07-29 9:36 [PATCH 0/2] Use pcim_request_region() in vboxvideo Philipp Stanner
2024-07-29 9:36 ` [PATCH 1/2] PCI: Make pcim_request_region() a public function Philipp Stanner
@ 2024-07-29 9:36 ` Philipp Stanner
2024-07-31 19:36 ` [PATCH 0/2] Use pcim_request_region() in vboxvideo Bjorn Helgaas
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Philipp Stanner @ 2024-07-29 9:36 UTC (permalink / raw)
To: Hans de Goede, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter, Bjorn Helgaas
Cc: dri-devel, linux-kernel, linux-pci, Philipp Stanner
vboxvideo currently does not reserve its PCI BAR through a region
request.
Implement the request through the managed function
pcim_request_region().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c
index d4ade9325401..7f686a0190e6 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_main.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_main.c
@@ -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);
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/2] Use pcim_request_region() in vboxvideo
2024-07-29 9:36 [PATCH 0/2] Use pcim_request_region() in vboxvideo Philipp Stanner
2024-07-29 9:36 ` [PATCH 1/2] PCI: Make pcim_request_region() a public function Philipp Stanner
2024-07-29 9:36 ` [PATCH 2/2] drm/vboxvideo: Add PCI region request Philipp Stanner
@ 2024-07-31 19:36 ` Bjorn Helgaas
2024-08-01 15:15 ` Hans de Goede
2024-08-01 15:14 ` Hans de Goede
2024-08-01 17:04 ` Bjorn Helgaas
4 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2024-07-31 19:36 UTC (permalink / raw)
To: Philipp Stanner
Cc: Hans de Goede, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter, Bjorn Helgaas,
dri-devel, linux-kernel, linux-pci
On Mon, Jul 29, 2024 at 11:36:24AM +0200, Philipp Stanner wrote:
> 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(-)
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Use pcim_request_region() in vboxvideo
2024-07-31 19:36 ` [PATCH 0/2] Use pcim_request_region() in vboxvideo Bjorn Helgaas
@ 2024-08-01 15:15 ` Hans de Goede
0 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2024-08-01 15:15 UTC (permalink / raw)
To: Bjorn Helgaas, Philipp Stanner
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Bjorn Helgaas, dri-devel, linux-kernel, linux-pci
Hi Bjorn,
On 7/31/24 9:36 PM, Bjorn Helgaas wrote:
> On Mon, Jul 29, 2024 at 11:36:24AM +0200, Philipp Stanner wrote:
>> 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(-)
>
> 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:
Acked-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Use pcim_request_region() in vboxvideo
2024-07-29 9:36 [PATCH 0/2] Use pcim_request_region() in vboxvideo Philipp Stanner
` (2 preceding siblings ...)
2024-07-31 19:36 ` [PATCH 0/2] Use pcim_request_region() in vboxvideo Bjorn Helgaas
@ 2024-08-01 15:14 ` Hans de Goede
2024-08-01 17:04 ` Bjorn Helgaas
4 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2024-08-01 15:14 UTC (permalink / raw)
To: Philipp Stanner, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter, Bjorn Helgaas
Cc: dri-devel, linux-kernel, linux-pci
Hi,
On 7/29/24 11:36 AM, Philipp Stanner wrote:
> 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:
Tested-by: Hans de Goede <hdegoede@redhat.com>
Also both patches look good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
for the series.
Regards,
Hans
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/2] Use pcim_request_region() in vboxvideo
2024-07-29 9:36 [PATCH 0/2] Use pcim_request_region() in vboxvideo Philipp Stanner
` (3 preceding siblings ...)
2024-08-01 15:14 ` Hans de Goede
@ 2024-08-01 17:04 ` Bjorn Helgaas
4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2024-08-01 17:04 UTC (permalink / raw)
To: Philipp Stanner
Cc: Hans de Goede, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter, Bjorn Helgaas,
dri-devel, linux-kernel, linux-pci
On Mon, Jul 29, 2024 at 11:36:24AM +0200, Philipp Stanner wrote:
> 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(-)
Applied with Hans' ack to pci/devres for v6.12, thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread