Subject: linux-next: manual merge of the amdgpu tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 27 Jan 2022 10:29:08 +1100

Hi all,

Today's linux-next merge of the amdgpu tree got a conflict in:

  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

between commit:

  b95dc06af3e6 ("drm/amdgpu: disable runpm if we are the primary adapter")

from Linus' tree and commit:

  243c719e872a ("drm/amdgpu: handle BACO synchronization with secondary funcs")

from the amdgpu tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index b21bcdc97460,f3cada3f743b..000000000000
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@@ -1893,26 -1947,28 +1948,48 @@@ MODULE_DEVICE_TABLE(pci, pciidlist)
  
  static const struct drm_driver amdgpu_kms_driver;
  
 +static bool amdgpu_is_fw_framebuffer(resource_size_t base,
 +				     resource_size_t size)
 +{
 +	bool found = false;
 +#if IS_REACHABLE(CONFIG_FB)
 +	struct apertures_struct *a;
 +
 +	a = alloc_apertures(1);
 +	if (!a)
 +		return false;
 +
 +	a->ranges[0].base = base;
 +	a->ranges[0].size = size;
 +
 +	found = is_firmware_framebuffer(a);
 +	kfree(a);
 +#endif
 +	return found;
 +}
 +
+ static void amdgpu_get_secondary_funcs(struct amdgpu_device *adev)
+ {
+ 	struct pci_dev *p = NULL;
+ 	int i;
+ 
+ 	/* 0 - GPU
+ 	 * 1 - audio
+ 	 * 2 - USB
+ 	 * 3 - UCSI
+ 	 */
+ 	for (i = 1; i < 4; i++) {
+ 		p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
+ 						adev->pdev->bus->number, i);
+ 		if (p) {
+ 			pm_runtime_get_sync(&p->dev);
+ 			pm_runtime_mark_last_busy(&p->dev);
+ 			pm_runtime_put_autosuspend(&p->dev);
+ 			pci_dev_put(p);
+ 		}
+ 	}
+ }
+ 
  static int amdgpu_pci_probe(struct pci_dev *pdev,
  			    const struct pci_device_id *ent)
  {